From 7cc613bf300b8232c9064af1dee84ea98f9e2d12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Thu, 21 Jul 2016 14:56:27 +0200 Subject: [PATCH 01/26] esdoc update --- .codeclimate.yml | 5 - .jshintrc | 3 - .travis.yml | 14 - LICENSE | 661 --- README.md | 15 - ast/source/adt/RedBlackTree.js.json | 4358 +++++++++++++++++ ast/source/adt/index.js.json | 57 + ast/source/base/colors.js.json | 211 + ast/source/base/find.js.json | 1043 ++++ ast/source/base/grandparent.js.json | 442 ++ ast/source/base/index.js.json | 453 ++ ast/source/base/inordertraversal.js.json | 787 +++ ast/source/base/insert.js.json | 1416 ++++++ ast/source/base/predecessor.js.json | 513 ++ ast/source/base/replace_node.js.json | 931 ++++ ast/source/base/rotate_left.js.json | 1939 ++++++++ ast/source/base/rotate_right.js.json | 1939 ++++++++ ast/source/base/sibling.js.json | 752 +++ ast/source/base/successor.js.json | 513 ++ ast/source/base/uncle.js.json | 1060 ++++ ast/source/index.js.json | 201 + ast/source/insertion/index.js.json | 201 + ast/source/insertion/insert_case1.js.json | 587 +++ ast/source/insertion/insert_case2.js.json | 592 +++ ast/source/insertion/insert_case3.js.json | 1489 ++++++ ast/source/insertion/insert_case4.js.json | 1748 +++++++ ast/source/insertion/insert_case5.js.json | 1068 ++++ ast/source/node/Leaf.js.json | 639 +++ ast/source/node/Node.js.json | 1048 ++++ ast/source/node/index.js.json | 93 + ast/source/removal/delete_case1.js.json | 390 ++ ast/source/removal/delete_case2.js.json | 1377 ++++++ ast/source/removal/delete_case3.js.json | 1452 ++++++ ast/source/removal/delete_case4.js.json | 1396 ++++++ ast/source/removal/delete_case5.js.json | 2517 ++++++++++ ast/source/removal/delete_case6.js.json | 1536 ++++++ ast/source/removal/delete_one_child.js.json | 1236 +++++ ast/source/removal/index.js.json | 273 ++ badge.svg | 17 + .../src/adt/RedBlackTree.js~RedBlackTree.html | 687 +++ coverage.json | 200 + css/prettify-tomorrow.css | 132 + css/style.css | 944 ++++ doc/manual/example.md | 0 doc/manual/installation.md | 15 - doc/manual/overview.md | 0 doc/manual/usage.md | 23 - dump.json | 2133 ++++++++ esdoc.json | 21 - file/src/adt/RedBlackTree.js.html | 158 + file/src/adt/index.js.html | 87 + file/src/base/colors.js.html | 88 + file/src/base/find.js.html | 115 + file/src/base/grandparent.js.html | 92 + file/src/base/index.js.html | 98 + file/src/base/inordertraversal.js.html | 100 + file/src/base/insert.js.html | 124 + file/src/base/predecessor.js.html | 95 + file/src/base/replace_node.js.html | 99 + file/src/base/rotate_left.js.html | 119 + file/src/base/rotate_right.js.html | 120 + file/src/base/sibling.js.html | 95 + file/src/base/successor.js.html | 95 + file/src/base/uncle.js.html | 97 + file/src/index.js.html | 91 + file/src/insertion/index.js.html | 91 + file/src/insertion/insert_case1.js.html | 97 + file/src/insertion/insert_case2.js.html | 97 + file/src/insertion/insert_case3.js.html | 104 + file/src/insertion/insert_case4.js.html | 127 + file/src/insertion/insert_case5.js.html | 100 + file/src/node/Leaf.js.html | 94 + file/src/node/Node.js.html | 97 + file/src/node/index.js.html | 88 + file/src/removal/delete_case1.js.html | 94 + file/src/removal/delete_case2.js.html | 104 + file/src/removal/delete_case3.js.html | 105 + file/src/removal/delete_case4.js.html | 103 + file/src/removal/delete_case5.js.html | 116 + file/src/removal/delete_case6.js.html | 104 + file/src/removal/delete_one_child.js.html | 106 + file/src/removal/index.js.html | 93 + function/index.html | 2243 +++++++++ identifiers.html | 810 +++ image/badge.svg | 17 + image/github.png | Bin 0 -> 4268 bytes image/search.png | Bin 0 -> 12704 bytes index.html | 96 + manual/example.html | 98 + manual/index.html | 130 + manual/installation.html | 109 + manual/overview.html | 98 + manual/usage.html | 116 + script/inherited-summary.js | 28 + script/inner-link.js | 31 + script/manual.js | 13 + script/patch-for-local.js | 8 + script/prettify/Apache-License-2.0.txt | 202 + script/prettify/prettify.js | 28 + script/pretty-print.js | 25 + script/search.js | 117 + script/search_index.js | 740 +++ script/test-summary.js | 54 + source.html | 365 ++ src/adt/RedBlackTree.js | 72 - src/adt/index.js | 1 - src/base/colors.js | 2 - src/base/find.js | 29 - src/base/grandparent.js | 6 - src/base/index.js | 12 - src/base/inordertraversal.js | 14 - src/base/insert.js | 38 - src/base/predecessor.js | 9 - src/base/replace_node.js | 13 - src/base/rotate_left.js | 33 - src/base/rotate_right.js | 34 - src/base/sibling.js | 9 - src/base/successor.js | 9 - src/base/uncle.js | 11 - src/index.js | 5 - src/insertion/index.js | 5 - src/insertion/insert_case1.js | 11 - src/insertion/insert_case2.js | 11 - src/insertion/insert_case3.js | 18 - src/insertion/insert_case4.js | 41 - src/insertion/insert_case5.js | 14 - src/node/Leaf.js | 8 - src/node/Node.js | 11 - src/node/index.js | 2 - src/removal/delete_case1.js | 8 - src/removal/delete_case2.js | 18 - src/removal/delete_case3.js | 19 - src/removal/delete_case4.js | 17 - src/removal/delete_case5.js | 30 - src/removal/delete_case6.js | 18 - src/removal/delete_one_child.js | 20 - src/removal/index.js | 7 - test/src/RedBlackTree.js | 35 - doc/css/style.css => user/css/0-style.css | 0 .../header.js => user/script/0-header.js | 0 variable/index.html | 224 + 141 files changed, 47315 insertions(+), 1347 deletions(-) delete mode 100644 .codeclimate.yml delete mode 100644 .jshintrc delete mode 100644 .travis.yml delete mode 100644 LICENSE delete mode 100644 README.md create mode 100644 ast/source/adt/RedBlackTree.js.json create mode 100644 ast/source/adt/index.js.json create mode 100644 ast/source/base/colors.js.json create mode 100644 ast/source/base/find.js.json create mode 100644 ast/source/base/grandparent.js.json create mode 100644 ast/source/base/index.js.json create mode 100644 ast/source/base/inordertraversal.js.json create mode 100644 ast/source/base/insert.js.json create mode 100644 ast/source/base/predecessor.js.json create mode 100644 ast/source/base/replace_node.js.json create mode 100644 ast/source/base/rotate_left.js.json create mode 100644 ast/source/base/rotate_right.js.json create mode 100644 ast/source/base/sibling.js.json create mode 100644 ast/source/base/successor.js.json create mode 100644 ast/source/base/uncle.js.json create mode 100644 ast/source/index.js.json create mode 100644 ast/source/insertion/index.js.json create mode 100644 ast/source/insertion/insert_case1.js.json create mode 100644 ast/source/insertion/insert_case2.js.json create mode 100644 ast/source/insertion/insert_case3.js.json create mode 100644 ast/source/insertion/insert_case4.js.json create mode 100644 ast/source/insertion/insert_case5.js.json create mode 100644 ast/source/node/Leaf.js.json create mode 100644 ast/source/node/Node.js.json create mode 100644 ast/source/node/index.js.json create mode 100644 ast/source/removal/delete_case1.js.json create mode 100644 ast/source/removal/delete_case2.js.json create mode 100644 ast/source/removal/delete_case3.js.json create mode 100644 ast/source/removal/delete_case4.js.json create mode 100644 ast/source/removal/delete_case5.js.json create mode 100644 ast/source/removal/delete_case6.js.json create mode 100644 ast/source/removal/delete_one_child.js.json create mode 100644 ast/source/removal/index.js.json create mode 100644 badge.svg create mode 100644 class/src/adt/RedBlackTree.js~RedBlackTree.html create mode 100644 coverage.json create mode 100644 css/prettify-tomorrow.css create mode 100644 css/style.css delete mode 100644 doc/manual/example.md delete mode 100644 doc/manual/installation.md delete mode 100644 doc/manual/overview.md delete mode 100644 doc/manual/usage.md create mode 100644 dump.json delete mode 100644 esdoc.json create mode 100644 file/src/adt/RedBlackTree.js.html create mode 100644 file/src/adt/index.js.html create mode 100644 file/src/base/colors.js.html create mode 100644 file/src/base/find.js.html create mode 100644 file/src/base/grandparent.js.html create mode 100644 file/src/base/index.js.html create mode 100644 file/src/base/inordertraversal.js.html create mode 100644 file/src/base/insert.js.html create mode 100644 file/src/base/predecessor.js.html create mode 100644 file/src/base/replace_node.js.html create mode 100644 file/src/base/rotate_left.js.html create mode 100644 file/src/base/rotate_right.js.html create mode 100644 file/src/base/sibling.js.html create mode 100644 file/src/base/successor.js.html create mode 100644 file/src/base/uncle.js.html create mode 100644 file/src/index.js.html create mode 100644 file/src/insertion/index.js.html create mode 100644 file/src/insertion/insert_case1.js.html create mode 100644 file/src/insertion/insert_case2.js.html create mode 100644 file/src/insertion/insert_case3.js.html create mode 100644 file/src/insertion/insert_case4.js.html create mode 100644 file/src/insertion/insert_case5.js.html create mode 100644 file/src/node/Leaf.js.html create mode 100644 file/src/node/Node.js.html create mode 100644 file/src/node/index.js.html create mode 100644 file/src/removal/delete_case1.js.html create mode 100644 file/src/removal/delete_case2.js.html create mode 100644 file/src/removal/delete_case3.js.html create mode 100644 file/src/removal/delete_case4.js.html create mode 100644 file/src/removal/delete_case5.js.html create mode 100644 file/src/removal/delete_case6.js.html create mode 100644 file/src/removal/delete_one_child.js.html create mode 100644 file/src/removal/index.js.html create mode 100644 function/index.html create mode 100644 identifiers.html create mode 100644 image/badge.svg create mode 100644 image/github.png create mode 100644 image/search.png create mode 100644 index.html create mode 100644 manual/example.html create mode 100644 manual/index.html create mode 100644 manual/installation.html create mode 100644 manual/overview.html create mode 100644 manual/usage.html create mode 100644 script/inherited-summary.js create mode 100644 script/inner-link.js create mode 100644 script/manual.js create mode 100644 script/patch-for-local.js create mode 100644 script/prettify/Apache-License-2.0.txt create mode 100644 script/prettify/prettify.js create mode 100644 script/pretty-print.js create mode 100644 script/search.js create mode 100644 script/search_index.js create mode 100644 script/test-summary.js create mode 100644 source.html delete mode 100644 src/adt/RedBlackTree.js delete mode 100644 src/adt/index.js delete mode 100644 src/base/colors.js delete mode 100644 src/base/find.js delete mode 100644 src/base/grandparent.js delete mode 100644 src/base/index.js delete mode 100644 src/base/inordertraversal.js delete mode 100644 src/base/insert.js delete mode 100644 src/base/predecessor.js delete mode 100644 src/base/replace_node.js delete mode 100644 src/base/rotate_left.js delete mode 100644 src/base/rotate_right.js delete mode 100644 src/base/sibling.js delete mode 100644 src/base/successor.js delete mode 100644 src/base/uncle.js delete mode 100644 src/index.js delete mode 100644 src/insertion/index.js delete mode 100644 src/insertion/insert_case1.js delete mode 100644 src/insertion/insert_case2.js delete mode 100644 src/insertion/insert_case3.js delete mode 100644 src/insertion/insert_case4.js delete mode 100644 src/insertion/insert_case5.js delete mode 100644 src/node/Leaf.js delete mode 100644 src/node/Node.js delete mode 100644 src/node/index.js delete mode 100644 src/removal/delete_case1.js delete mode 100644 src/removal/delete_case2.js delete mode 100644 src/removal/delete_case3.js delete mode 100644 src/removal/delete_case4.js delete mode 100644 src/removal/delete_case5.js delete mode 100644 src/removal/delete_case6.js delete mode 100644 src/removal/delete_one_child.js delete mode 100644 src/removal/index.js delete mode 100644 test/src/RedBlackTree.js rename doc/css/style.css => user/css/0-style.css (100%) rename doc/scripts/header.js => user/script/0-header.js (100%) create mode 100644 variable/index.html diff --git a/.codeclimate.yml b/.codeclimate.yml deleted file mode 100644 index 408fda5..0000000 --- a/.codeclimate.yml +++ /dev/null @@ -1,5 +0,0 @@ -languages: - JavaScript: true -exclude_paths: -- "doc/**/*.js" -- "test/**/*.js" diff --git a/.jshintrc b/.jshintrc deleted file mode 100644 index ffd48eb..0000000 --- a/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "esnext": true -} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 10d7e45..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: node_js - -node_js: - - node - -install: - - npm install - -script: - - npm run cover - -after_success: - - ./node_modules/.bin/coveralls < coverage/lcov.info || true - - ./node_modules/.bin/codeclimate-test-reporter < coverage/lcov.info || true diff --git a/LICENSE b/LICENSE deleted file mode 100644 index dbbe355..0000000 --- a/LICENSE +++ /dev/null @@ -1,661 +0,0 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published - by the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. diff --git a/README.md b/README.md deleted file mode 100644 index 4c66b02..0000000 --- a/README.md +++ /dev/null @@ -1,15 +0,0 @@ -[aureooms/es-red-black-tree](https://aureooms.github.io/es-red-black-tree) -== - -red-black tree library for JavaScript. See [documentation](https://aureooms.github.io/es-red-black-tree/index.html). - -[![NPM license](http://img.shields.io/npm/l/aureooms-es-red-black-tree.svg?style=flat)](https://raw.githubusercontent.com/aureooms/es-red-black-tree/master/LICENSE) -[![NPM version](http://img.shields.io/npm/v/aureooms-es-red-black-tree.svg?style=flat)](https://www.npmjs.org/package/aureooms-es-red-black-tree) -[![Build status](http://img.shields.io/travis/aureooms/es-red-black-tree.svg?style=flat)](https://travis-ci.org/aureooms/es-red-black-tree) -[![Coverage status](http://img.shields.io/coveralls/aureooms/es-red-black-tree.svg?style=flat)](https://coveralls.io/r/aureooms/es-red-black-tree) -[![Dependencies status](http://img.shields.io/david/aureooms/es-red-black-tree.svg?style=flat)](https://david-dm.org/aureooms/es-red-black-tree#info=dependencies) -[![Dev dependencies status](http://img.shields.io/david/dev/aureooms/es-red-black-tree.svg?style=flat)](https://david-dm.org/aureooms/es-red-black-tree#info=devDependencies) -[![Code Climate](http://img.shields.io/codeclimate/github/aureooms/es-red-black-tree.svg?style=flat)](https://codeclimate.com/github/aureooms/es-red-black-tree) -[![NPM downloads per month](http://img.shields.io/npm/dm/aureooms-es-red-black-tree.svg?style=flat)](https://www.npmjs.org/package/aureooms-es-red-black-tree) -[![GitHub issues](http://img.shields.io/github/issues/aureooms/es-red-black-tree.svg?style=flat)](https://github.com/aureooms/es-red-black-tree/issues) -[![Documentation](https://aureooms.github.io/es-red-black-tree/badge.svg)](https://aureooms.github.io/es-red-black-tree/source.html) diff --git a/ast/source/adt/RedBlackTree.js.json b/ast/source/adt/RedBlackTree.js.json new file mode 100644 index 0000000..4a0cc46 --- /dev/null +++ b/ast/source/adt/RedBlackTree.js.json @@ -0,0 +1,4358 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "Node", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "imported": { + "type": "Identifier", + "name": "Node", + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 13 + } + } + }, + "range": [ + 10, + 14 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 13 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 2, + "column": 21 + }, + "end": { + "line": 2, + "column": 25 + } + } + }, + "range": [ + 1, + 28 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 27 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 20 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 57, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + "range": [ + 29, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "predecessor", + "range": [ + 73, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "predecessor", + "range": [ + 73, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + "range": [ + 73, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "successor", + "range": [ + 87, + 96 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + "imported": { + "type": "Identifier", + "name": "successor", + "range": [ + 87, + 96 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + "range": [ + 87, + 96 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 32 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 104, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 4, + "column": 44 + } + } + }, + "range": [ + 64, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 46 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "insert", + "range": [ + 120, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "imported": { + "type": "Identifier", + "name": "insert", + "range": [ + 120, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "range": [ + 120, + 126 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "insert_case2", + "range": [ + 129, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "imported": { + "type": "Identifier", + "name": "insert_case2", + "range": [ + 129, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "range": [ + 129, + 141 + ], + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 149, + 153 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + "range": [ + 111, + 155 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_one_child", + "range": [ + 165, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_one_child", + "range": [ + 165, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 165, + 181 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 189, + 193 + ], + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + "range": [ + 156, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 39 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "find", + "range": [ + 205, + 209 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "imported": { + "type": "Identifier", + "name": "find", + "range": [ + 205, + 209 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "range": [ + 205, + 209 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 13 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 217, + 221 + ], + "loc": { + "start": { + "line": 7, + "column": 21 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + "range": [ + 196, + 223 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "inordertraversal", + "range": [ + 233, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + "imported": { + "type": "Identifier", + "name": "inordertraversal", + "range": [ + 233, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + "range": [ + 233, + 249 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 25 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 257, + 261 + ], + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 37 + } + } + }, + "range": [ + 224, + 263 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 39 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "ClassDeclaration", + "id": { + "type": "Identifier", + "name": "RedBlackTree", + "range": [ + 278, + 290 + ], + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 25 + } + } + }, + "superClass": null, + "body": { + "type": "ClassBody", + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "range": [ + 295, + 306 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 309, + 316 + ], + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 22 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 324, + 328 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "compare", + "range": [ + 329, + 336 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + "range": [ + 324, + 336 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "compare", + "range": [ + 339, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "range": [ + 324, + 346 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "range": [ + 324, + 348 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 351, + 355 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 356, + 360 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + "range": [ + 351, + 360 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 363, + 367 + ], + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "range": [ + 351, + 367 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + "range": [ + 351, + 369 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 20 + } + } + } + ], + "range": [ + 319, + 373 + ], + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 307, + 373 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + "kind": "constructor", + "computed": false, + "range": [ + 295, + 373 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 17, + "column": 2 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "add", + "range": [ + 376, + 379 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 382, + 387 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 12 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 399, + 403 + ], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 404, + 408 + ], + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + "range": [ + 399, + 408 + ], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 413, + 417 + ], + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + } + } + }, + "range": [ + 399, + 417 + ], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 25 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 425, + 429 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 430, + 434 + ], + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 12 + } + } + }, + "range": [ + 425, + 434 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 12 + } + } + }, + "right": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Node", + "range": [ + 441, + 445 + ], + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "BLACK", + "range": [ + 447, + 452 + ], + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 30 + } + } + }, + { + "type": "Identifier", + "name": "value", + "range": [ + 455, + 460 + ], + "loc": { + "start": { + "line": 21, + "column": 33 + }, + "end": { + "line": 21, + "column": 38 + } + } + } + ], + "range": [ + 437, + 462 + ], + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 40 + } + } + }, + "range": [ + 425, + 462 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 40 + } + } + }, + "range": [ + 425, + 464 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 42 + } + } + } + ], + "range": [ + 420, + 468 + ], + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 22, + "column": 3 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "node", + "range": [ + 487, + 491 + ], + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 13 + } + } + }, + "init": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Node", + "range": [ + 498, + 502 + ], + "loc": { + "start": { + "line": 24, + "column": 20 + }, + "end": { + "line": 24, + "column": 24 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "RED", + "range": [ + 504, + 507 + ], + "loc": { + "start": { + "line": 24, + "column": 26 + }, + "end": { + "line": 24, + "column": 29 + } + } + }, + { + "type": "Identifier", + "name": "value", + "range": [ + 510, + 515 + ], + "loc": { + "start": { + "line": 24, + "column": 32 + }, + "end": { + "line": 24, + "column": 37 + } + } + } + ], + "range": [ + 494, + 517 + ], + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 39 + } + } + }, + "range": [ + 487, + 517 + ], + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 39 + } + } + } + ], + "kind": "const", + "range": [ + 481, + 519 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 41 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "insert", + "range": [ + 523, + 529 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 9 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 531, + 535 + ], + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "compare", + "range": [ + 536, + 543 + ], + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 23 + } + } + }, + "range": [ + 531, + 543 + ], + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 23 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 546, + 550 + ], + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 30 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 551, + 555 + ], + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 35 + } + } + }, + "range": [ + 546, + 555 + ], + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "node", + "range": [ + 558, + 562 + ], + "loc": { + "start": { + "line": 25, + "column": 38 + }, + "end": { + "line": 25, + "column": 42 + } + } + } + ], + "range": [ + 523, + 564 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 44 + } + } + }, + "range": [ + 523, + 566 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 46 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "insert_case2", + "range": [ + 570, + 582 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 15 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 584, + 588 + ], + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 21 + } + } + } + ], + "range": [ + 570, + 590 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 23 + } + } + }, + "range": [ + 570, + 592 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 25 + } + } + } + ], + "range": [ + 476, + 596 + ], + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 27, + "column": 3 + } + } + }, + "range": [ + 394, + 596 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 27, + "column": 3 + } + } + } + ], + "range": [ + 390, + 599 + ], + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 380, + 599 + ], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 376, + 599 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 28, + "column": 2 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "find", + "range": [ + 602, + 606 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 5 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 609, + 614 + ], + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 13 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 627, + 631 + ], + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 632, + 636 + ], + "loc": { + "start": { + "line": 32, + "column": 12 + }, + "end": { + "line": 32, + "column": 16 + } + } + }, + "range": [ + 627, + 636 + ], + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 16 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 641, + 645 + ], + "loc": { + "start": { + "line": 32, + "column": 21 + }, + "end": { + "line": 32, + "column": 25 + } + } + }, + "range": [ + 627, + 645 + ], + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 25 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 655, + 659 + ], + "loc": { + "start": { + "line": 32, + "column": 35 + }, + "end": { + "line": 32, + "column": 39 + } + } + }, + "range": [ + 648, + 661 + ], + "loc": { + "start": { + "line": 32, + "column": 28 + }, + "end": { + "line": 32, + "column": 41 + } + } + }, + "alternate": null, + "range": [ + 622, + 661 + ], + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 41 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "find", + "range": [ + 672, + 676 + ], + "loc": { + "start": { + "line": 34, + "column": 9 + }, + "end": { + "line": 34, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 678, + 682 + ], + "loc": { + "start": { + "line": 34, + "column": 15 + }, + "end": { + "line": 34, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "compare", + "range": [ + 683, + 690 + ], + "loc": { + "start": { + "line": 34, + "column": 20 + }, + "end": { + "line": 34, + "column": 27 + } + } + }, + "range": [ + 678, + 690 + ], + "loc": { + "start": { + "line": 34, + "column": 15 + }, + "end": { + "line": 34, + "column": 27 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 693, + 697 + ], + "loc": { + "start": { + "line": 34, + "column": 30 + }, + "end": { + "line": 34, + "column": 34 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 698, + 702 + ], + "loc": { + "start": { + "line": 34, + "column": 35 + }, + "end": { + "line": 34, + "column": 39 + } + } + }, + "range": [ + 693, + 702 + ], + "loc": { + "start": { + "line": 34, + "column": 30 + }, + "end": { + "line": 34, + "column": 39 + } + } + }, + { + "type": "Identifier", + "name": "value", + "range": [ + 705, + 710 + ], + "loc": { + "start": { + "line": 34, + "column": 42 + }, + "end": { + "line": 34, + "column": 47 + } + } + } + ], + "range": [ + 672, + 712 + ], + "loc": { + "start": { + "line": 34, + "column": 9 + }, + "end": { + "line": 34, + "column": 49 + } + } + }, + "range": [ + 665, + 714 + ], + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 34, + "column": 51 + } + } + } + ], + "range": [ + 617, + 718 + ], + "loc": { + "start": { + "line": 30, + "column": 16 + }, + "end": { + "line": 36, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 607, + 718 + ], + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 36, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 602, + 718 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 36, + "column": 2 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "delete", + "range": [ + 721, + 727 + ], + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 7 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 730, + 734 + ], + "loc": { + "start": { + "line": 38, + "column": 10 + }, + "end": { + "line": 38, + "column": 14 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 748, + 752 + ], + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 753, + 757 + ], + "loc": { + "start": { + "line": 40, + "column": 13 + }, + "end": { + "line": 40, + "column": 17 + } + } + }, + "range": [ + 748, + 757 + ], + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 758, + 764 + ], + "loc": { + "start": { + "line": 40, + "column": 18 + }, + "end": { + "line": 40, + "column": 24 + } + } + }, + "range": [ + 748, + 764 + ], + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 748, + 766 + ], + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 26 + } + } + }, + "prefix": true, + "range": [ + 747, + 766 + ], + "loc": { + "start": { + "line": 40, + "column": 7 + }, + "end": { + "line": 40, + "column": 26 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "pred", + "range": [ + 832, + 836 + ], + "loc": { + "start": { + "line": 42, + "column": 9 + }, + "end": { + "line": 42, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "predecessor", + "range": [ + 839, + 850 + ], + "loc": { + "start": { + "line": 42, + "column": 16 + }, + "end": { + "line": 42, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 852, + 856 + ], + "loc": { + "start": { + "line": 42, + "column": 29 + }, + "end": { + "line": 42, + "column": 33 + } + } + } + ], + "range": [ + 839, + 858 + ], + "loc": { + "start": { + "line": 42, + "column": 16 + }, + "end": { + "line": 42, + "column": 35 + } + } + }, + "range": [ + 832, + 858 + ], + "loc": { + "start": { + "line": 42, + "column": 9 + }, + "end": { + "line": 42, + "column": 35 + } + } + } + ], + "kind": "const", + "range": [ + 826, + 860 + ], + "loc": { + "start": { + "line": 42, + "column": 3 + }, + "end": { + "line": 42, + "column": 37 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " replace node's value with predecessor's value", + "range": [ + 774, + 822 + ], + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 51 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 864, + 868 + ], + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 869, + 874 + ], + "loc": { + "start": { + "line": 43, + "column": 8 + }, + "end": { + "line": 43, + "column": 13 + } + } + }, + "range": [ + 864, + 874 + ], + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 13 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "pred", + "range": [ + 877, + 881 + ], + "loc": { + "start": { + "line": 43, + "column": 16 + }, + "end": { + "line": 43, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 882, + 887 + ], + "loc": { + "start": { + "line": 43, + "column": 21 + }, + "end": { + "line": 43, + "column": 26 + } + } + }, + "range": [ + 877, + 887 + ], + "loc": { + "start": { + "line": 43, + "column": 16 + }, + "end": { + "line": 43, + "column": 26 + } + } + }, + "range": [ + 864, + 887 + ], + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 26 + } + } + }, + "range": [ + 864, + 889 + ], + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 28 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " delete predecessor node", + "range": [ + 893, + 919 + ], + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 29 + } + } + }, + { + "type": "Line", + "value": " note: this node can only have one non-leaf child", + "range": [ + 923, + 974 + ], + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 54 + } + } + }, + { + "type": "Line", + "value": " because the tree is a red-black tree", + "range": [ + 978, + 1023 + ], + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 48 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_one_child", + "range": [ + 1027, + 1043 + ], + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "pred", + "range": [ + 1045, + 1049 + ], + "loc": { + "start": { + "line": 47, + "column": 21 + }, + "end": { + "line": 47, + "column": 25 + } + } + } + ], + "range": [ + 1027, + 1051 + ], + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 27 + } + } + }, + "range": [ + 1027, + 1053 + ], + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 29 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " delete predecessor node", + "range": [ + 893, + 919 + ], + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 29 + } + } + }, + { + "type": "Line", + "value": " note: this node can only have one non-leaf child", + "range": [ + 923, + 974 + ], + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 54 + } + } + }, + { + "type": "Line", + "value": " because the tree is a red-black tree", + "range": [ + 978, + 1023 + ], + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 48 + } + } + } + ] + } + ], + "range": [ + 769, + 1057 + ], + "loc": { + "start": { + "line": 40, + "column": 29 + }, + "end": { + "line": 48, + "column": 3 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 1072, + 1076 + ], + "loc": { + "start": { + "line": 50, + "column": 13 + }, + "end": { + "line": 50, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 1077, + 1082 + ], + "loc": { + "start": { + "line": 50, + "column": 18 + }, + "end": { + "line": 50, + "column": 23 + } + } + }, + "range": [ + 1072, + 1082 + ], + "loc": { + "start": { + "line": 50, + "column": 13 + }, + "end": { + "line": 50, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 1083, + 1089 + ], + "loc": { + "start": { + "line": 50, + "column": 24 + }, + "end": { + "line": 50, + "column": 30 + } + } + }, + "range": [ + 1072, + 1089 + ], + "loc": { + "start": { + "line": 50, + "column": 13 + }, + "end": { + "line": 50, + "column": 30 + } + } + }, + "arguments": [], + "range": [ + 1072, + 1091 + ], + "loc": { + "start": { + "line": 50, + "column": 13 + }, + "end": { + "line": 50, + "column": 32 + } + } + }, + "prefix": true, + "range": [ + 1071, + 1091 + ], + "loc": { + "start": { + "line": 50, + "column": 12 + }, + "end": { + "line": 50, + "column": 32 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "succ", + "range": [ + 1155, + 1159 + ], + "loc": { + "start": { + "line": 52, + "column": 9 + }, + "end": { + "line": 52, + "column": 13 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "successor", + "range": [ + 1162, + 1171 + ], + "loc": { + "start": { + "line": 52, + "column": 16 + }, + "end": { + "line": 52, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 1173, + 1177 + ], + "loc": { + "start": { + "line": 52, + "column": 27 + }, + "end": { + "line": 52, + "column": 31 + } + } + } + ], + "range": [ + 1162, + 1179 + ], + "loc": { + "start": { + "line": 52, + "column": 16 + }, + "end": { + "line": 52, + "column": 33 + } + } + }, + "range": [ + 1155, + 1179 + ], + "loc": { + "start": { + "line": 52, + "column": 9 + }, + "end": { + "line": 52, + "column": 33 + } + } + } + ], + "kind": "const", + "range": [ + 1149, + 1181 + ], + "loc": { + "start": { + "line": 52, + "column": 3 + }, + "end": { + "line": 52, + "column": 35 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " replace node's value with successor's value", + "range": [ + 1099, + 1145 + ], + "loc": { + "start": { + "line": 51, + "column": 3 + }, + "end": { + "line": 51, + "column": 49 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 1185, + 1189 + ], + "loc": { + "start": { + "line": 53, + "column": 3 + }, + "end": { + "line": 53, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 1190, + 1195 + ], + "loc": { + "start": { + "line": 53, + "column": 8 + }, + "end": { + "line": 53, + "column": 13 + } + } + }, + "range": [ + 1185, + 1195 + ], + "loc": { + "start": { + "line": 53, + "column": 3 + }, + "end": { + "line": 53, + "column": 13 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "succ", + "range": [ + 1198, + 1202 + ], + "loc": { + "start": { + "line": 53, + "column": 16 + }, + "end": { + "line": 53, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 1203, + 1208 + ], + "loc": { + "start": { + "line": 53, + "column": 21 + }, + "end": { + "line": 53, + "column": 26 + } + } + }, + "range": [ + 1198, + 1208 + ], + "loc": { + "start": { + "line": 53, + "column": 16 + }, + "end": { + "line": 53, + "column": 26 + } + } + }, + "range": [ + 1185, + 1208 + ], + "loc": { + "start": { + "line": 53, + "column": 3 + }, + "end": { + "line": 53, + "column": 26 + } + } + }, + "range": [ + 1185, + 1210 + ], + "loc": { + "start": { + "line": 53, + "column": 3 + }, + "end": { + "line": 53, + "column": 28 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " delete successor node", + "range": [ + 1214, + 1238 + ], + "loc": { + "start": { + "line": 54, + "column": 3 + }, + "end": { + "line": 54, + "column": 27 + } + } + }, + { + "type": "Line", + "value": " note: this node can only have one non-leaf child", + "range": [ + 1242, + 1293 + ], + "loc": { + "start": { + "line": 55, + "column": 3 + }, + "end": { + "line": 55, + "column": 54 + } + } + }, + { + "type": "Line", + "value": " because the tree is a red-black tree", + "range": [ + 1297, + 1342 + ], + "loc": { + "start": { + "line": 56, + "column": 3 + }, + "end": { + "line": 56, + "column": 48 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_one_child", + "range": [ + 1346, + 1362 + ], + "loc": { + "start": { + "line": 57, + "column": 3 + }, + "end": { + "line": 57, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "pred", + "range": [ + 1364, + 1368 + ], + "loc": { + "start": { + "line": 57, + "column": 21 + }, + "end": { + "line": 57, + "column": 25 + } + } + } + ], + "range": [ + 1346, + 1370 + ], + "loc": { + "start": { + "line": 57, + "column": 3 + }, + "end": { + "line": 57, + "column": 27 + } + } + }, + "range": [ + 1346, + 1372 + ], + "loc": { + "start": { + "line": 57, + "column": 3 + }, + "end": { + "line": 57, + "column": 29 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " delete successor node", + "range": [ + 1214, + 1238 + ], + "loc": { + "start": { + "line": 54, + "column": 3 + }, + "end": { + "line": 54, + "column": 27 + } + } + }, + { + "type": "Line", + "value": " note: this node can only have one non-leaf child", + "range": [ + 1242, + 1293 + ], + "loc": { + "start": { + "line": 55, + "column": 3 + }, + "end": { + "line": 55, + "column": 54 + } + } + }, + { + "type": "Line", + "value": " because the tree is a red-black tree", + "range": [ + 1297, + 1342 + ], + "loc": { + "start": { + "line": 56, + "column": 3 + }, + "end": { + "line": 56, + "column": 48 + } + } + } + ] + } + ], + "range": [ + 1094, + 1376 + ], + "loc": { + "start": { + "line": 50, + "column": 35 + }, + "end": { + "line": 58, + "column": 3 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1390, + 1394 + ], + "loc": { + "start": { + "line": 61, + "column": 3 + }, + "end": { + "line": 61, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 1395, + 1399 + ], + "loc": { + "start": { + "line": 61, + "column": 8 + }, + "end": { + "line": 61, + "column": 12 + } + } + }, + "range": [ + 1390, + 1399 + ], + "loc": { + "start": { + "line": 61, + "column": 3 + }, + "end": { + "line": 61, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1402, + 1406 + ], + "loc": { + "start": { + "line": 61, + "column": 15 + }, + "end": { + "line": 61, + "column": 19 + } + } + }, + "range": [ + 1390, + 1406 + ], + "loc": { + "start": { + "line": 61, + "column": 3 + }, + "end": { + "line": 61, + "column": 19 + } + } + }, + "range": [ + 1390, + 1408 + ], + "loc": { + "start": { + "line": 61, + "column": 3 + }, + "end": { + "line": 61, + "column": 21 + } + } + } + ], + "range": [ + 1385, + 1412 + ], + "loc": { + "start": { + "line": 60, + "column": 7 + }, + "end": { + "line": 62, + "column": 3 + } + } + }, + "range": [ + 1066, + 1412 + ], + "loc": { + "start": { + "line": 50, + "column": 7 + }, + "end": { + "line": 62, + "column": 3 + } + } + }, + "range": [ + 742, + 1412 + ], + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 62, + "column": 3 + } + } + } + ], + "range": [ + 737, + 1416 + ], + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 64, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 728, + 1416 + ], + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 64, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 721, + 1416 + ], + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 64, + "column": 2 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Symbol", + "range": [ + 1421, + 1427 + ], + "loc": { + "start": { + "line": 66, + "column": 3 + }, + "end": { + "line": 66, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "iterator", + "range": [ + 1428, + 1436 + ], + "loc": { + "start": { + "line": 66, + "column": 10 + }, + "end": { + "line": 66, + "column": 18 + } + } + }, + "range": [ + 1421, + 1436 + ], + "loc": { + "start": { + "line": 66, + "column": 3 + }, + "end": { + "line": 66, + "column": 18 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1452, + 1456 + ], + "loc": { + "start": { + "line": 68, + "column": 7 + }, + "end": { + "line": 68, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 1457, + 1461 + ], + "loc": { + "start": { + "line": 68, + "column": 12 + }, + "end": { + "line": 68, + "column": 16 + } + } + }, + "range": [ + 1452, + 1461 + ], + "loc": { + "start": { + "line": 68, + "column": 7 + }, + "end": { + "line": 68, + "column": 16 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1466, + 1470 + ], + "loc": { + "start": { + "line": 68, + "column": 21 + }, + "end": { + "line": 68, + "column": 25 + } + } + }, + "range": [ + 1452, + 1470 + ], + "loc": { + "start": { + "line": 68, + "column": 7 + }, + "end": { + "line": 68, + "column": 25 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "inordertraversal", + "range": [ + 1480, + 1496 + ], + "loc": { + "start": { + "line": 68, + "column": 35 + }, + "end": { + "line": 68, + "column": 51 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1498, + 1502 + ], + "loc": { + "start": { + "line": 68, + "column": 53 + }, + "end": { + "line": 68, + "column": 57 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 1503, + 1507 + ], + "loc": { + "start": { + "line": 68, + "column": 58 + }, + "end": { + "line": 68, + "column": 62 + } + } + }, + "range": [ + 1498, + 1507 + ], + "loc": { + "start": { + "line": 68, + "column": 53 + }, + "end": { + "line": 68, + "column": 62 + } + } + } + ], + "range": [ + 1480, + 1509 + ], + "loc": { + "start": { + "line": 68, + "column": 35 + }, + "end": { + "line": 68, + "column": 64 + } + } + }, + "delegate": true, + "range": [ + 1473, + 1509 + ], + "loc": { + "start": { + "line": 68, + "column": 28 + }, + "end": { + "line": 68, + "column": 64 + } + } + }, + "range": [ + 1473, + 1511 + ], + "loc": { + "start": { + "line": 68, + "column": 28 + }, + "end": { + "line": 68, + "column": 66 + } + } + }, + "alternate": null, + "range": [ + 1447, + 1511 + ], + "loc": { + "start": { + "line": 68, + "column": 2 + }, + "end": { + "line": 68, + "column": 66 + } + } + } + ], + "range": [ + 1442, + 1515 + ], + "loc": { + "start": { + "line": 66, + "column": 24 + }, + "end": { + "line": 70, + "column": 2 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 1438, + 1515 + ], + "loc": { + "start": { + "line": 66, + "column": 20 + }, + "end": { + "line": 70, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 1419, + 1515 + ], + "loc": { + "start": { + "line": 66, + "column": 1 + }, + "end": { + "line": 70, + "column": 2 + } + }, + "static": false + } + ], + "range": [ + 291, + 1518 + ], + "loc": { + "start": { + "line": 10, + "column": 26 + }, + "end": { + "line": 72, + "column": 1 + } + } + }, + "range": [ + 272, + 1518 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 72, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 265, + 1518 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 72, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 1518 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 72, + "column": 1 + } + }, + "comments": [ + { + "type": "Line", + "value": " replace node's value with predecessor's value", + "range": [ + 774, + 822 + ], + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 51 + } + } + }, + { + "type": "Line", + "value": " delete predecessor node", + "range": [ + 893, + 919 + ], + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 29 + } + } + }, + { + "type": "Line", + "value": " note: this node can only have one non-leaf child", + "range": [ + 923, + 974 + ], + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 54 + } + } + }, + { + "type": "Line", + "value": " because the tree is a red-black tree", + "range": [ + 978, + 1023 + ], + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 48 + } + } + }, + { + "type": "Line", + "value": " replace node's value with successor's value", + "range": [ + 1099, + 1145 + ], + "loc": { + "start": { + "line": 51, + "column": 3 + }, + "end": { + "line": 51, + "column": 49 + } + } + }, + { + "type": "Line", + "value": " delete successor node", + "range": [ + 1214, + 1238 + ], + "loc": { + "start": { + "line": 54, + "column": 3 + }, + "end": { + "line": 54, + "column": 27 + } + } + }, + { + "type": "Line", + "value": " note: this node can only have one non-leaf child", + "range": [ + 1242, + 1293 + ], + "loc": { + "start": { + "line": 55, + "column": 3 + }, + "end": { + "line": 55, + "column": 54 + } + } + }, + { + "type": "Line", + "value": " because the tree is a red-black tree", + "range": [ + 1297, + 1342 + ], + "loc": { + "start": { + "line": 56, + "column": 3 + }, + "end": { + "line": 56, + "column": 48 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/adt/index.js.json b/ast/source/adt/index.js.json new file mode 100644 index 0000000..dcc63ed --- /dev/null +++ b/ast/source/adt/index.js.json @@ -0,0 +1,57 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./RedBlackTree", + "raw": "'./RedBlackTree'", + "range": [ + 14, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/colors.js.json b/ast/source/base/colors.js.json new file mode 100644 index 0000000..956c7fb --- /dev/null +++ b/ast/source/base/colors.js.json @@ -0,0 +1,211 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 13, + 18 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + "init": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 21, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 13, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "kind": "const", + "range": [ + 7, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "RED", + "range": [ + 38, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 44, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "range": [ + 38, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 20 + } + } + } + ], + "kind": "const", + "range": [ + 32, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 25, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 47 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/find.js.json b/ast/source/base/find.js.json new file mode 100644 index 0000000..ba42b9f --- /dev/null +++ b/ast/source/base/find.js.json @@ -0,0 +1,1043 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "find", + "range": [ + 17, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "Identifier", + "name": "node", + "range": [ + 33, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 32 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "Identifier", + "name": "value", + "range": [ + 39, + 44 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 43 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 7, + "column": 9 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "d", + "range": [ + 141, + 142 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "compare", + "range": [ + 145, + 152 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 154, + 159 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 161, + 165 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 166, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 33 + }, + "end": { + "line": 9, + "column": 38 + } + } + }, + "range": [ + 161, + 171 + ], + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 38 + } + } + } + ], + "range": [ + 145, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 40 + } + } + }, + "range": [ + 141, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 40 + } + } + } + ], + "kind": "const", + "range": [ + 135, + 174 + ], + "loc": { + "start": { + "line": 9, + "column": 2 + }, + "end": { + "line": 9, + "column": 41 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "d", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "range": [ + 183, + 190 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "node", + "range": [ + 205, + 209 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + "range": [ + 198, + 210 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 15 + } + } + } + ], + "range": [ + 193, + 214 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "Identifier", + "name": "d", + "range": [ + 228, + 229 + ], + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + "range": [ + 228, + 233 + ], + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "node", + "range": [ + 241, + 245 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 248, + 252 + ], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 253, + 257 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 19 + } + } + }, + "range": [ + 248, + 257 + ], + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 19 + } + } + }, + "range": [ + 241, + 257 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 19 + } + } + }, + "range": [ + 241, + 258 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 20 + } + } + } + ], + "range": [ + 236, + 262 + ], + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "node", + "range": [ + 276, + 280 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 283, + 287 + ], + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + "range": [ + 283, + 293 + ], + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + "range": [ + 276, + 293 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + "range": [ + 276, + 294 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 21 + } + } + } + ], + "range": [ + 271, + 298 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + "range": [ + 223, + 298 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + "range": [ + 178, + 298 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 307, + 311 + ], + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 312, + 318 + ], + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 18 + } + } + }, + "range": [ + 307, + 318 + ], + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 18 + } + } + }, + "arguments": [], + "range": [ + 307, + 320 + ], + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 335, + 339 + ], + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 14 + } + } + }, + "range": [ + 328, + 340 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 15 + } + } + } + ], + "range": [ + 323, + 344 + ], + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 25, + "column": 3 + } + } + }, + "alternate": null, + "range": [ + 302, + 344 + ], + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 25, + "column": 3 + } + } + } + ], + "range": [ + 130, + 348 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 27, + "column": 2 + } + } + }, + "range": [ + 115, + 348 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 27, + "column": 2 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " scan for first node whose", + "range": [ + 51, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + { + "type": "Line", + "value": " value equals parameter value", + "range": [ + 81, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 32 + } + } + } + ] + } + ], + "range": [ + 47, + 351 + ], + "loc": { + "start": { + "line": 2, + "column": 46 + }, + "end": { + "line": 29, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 8, + 351 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 29, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 1, + 351 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 29, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 351 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 29, + "column": 1 + } + }, + "comments": [ + { + "type": "Line", + "value": " scan for first node whose", + "range": [ + 51, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, + { + "type": "Line", + "value": " value equals parameter value", + "range": [ + 81, + 112 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 32 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/base/grandparent.js.json b/ast/source/base/grandparent.js.json new file mode 100644 index 0000000..04021d6 --- /dev/null +++ b/ast/source/base/grandparent.js.json @@ -0,0 +1,442 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 29, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 29 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 40, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 7 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 46, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "range": [ + 40, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 56, + 57 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 58, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 56, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 69, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + "range": [ + 56, + 73 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 39 + } + } + }, + "range": [ + 39, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 5 + }, + "end": { + "line": 2, + "column": 40 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 85, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 87, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + "range": [ + 85, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 94, + 100 + ], + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 85, + 100 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + "range": [ + 78, + 101 + ], + "loc": { + "start": { + "line": 3, + "column": 2 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "alternate": { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 117, + 121 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 13 + } + } + }, + "range": [ + 110, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + "range": [ + 35, + 122 + ], + "loc": { + "start": { + "line": 2, + "column": 1 + }, + "end": { + "line": 5, + "column": 14 + } + } + } + ], + "range": [ + 32, + 124 + ], + "loc": { + "start": { + "line": 1, + "column": 32 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 7, + 124 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 124 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 124 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/index.js.json b/ast/source/base/index.js.json new file mode 100644 index 0000000..7ba435b --- /dev/null +++ b/ast/source/base/index.js.json @@ -0,0 +1,453 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./colors", + "raw": "'./colors'", + "range": [ + 14, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + "range": [ + 0, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./find", + "raw": "'./find'", + "range": [ + 41, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 27, + 51 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./grandparent", + "raw": "'./grandparent'", + "range": [ + 66, + 81 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + "range": [ + 52, + 83 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 31 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./inordertraversal", + "raw": "'./inordertraversal'", + "range": [ + 98, + 118 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + "range": [ + 84, + 120 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./insert", + "raw": "'./insert'", + "range": [ + 135, + 145 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "range": [ + 121, + 147 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./predecessor", + "raw": "'./predecessor'", + "range": [ + 162, + 177 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 29 + } + } + }, + "range": [ + 148, + 179 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 31 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./replace_node", + "raw": "'./replace_node'", + "range": [ + 194, + 210 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + "range": [ + 180, + 212 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./rotate_left", + "raw": "'./rotate_left'", + "range": [ + 227, + 242 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 29 + } + } + }, + "range": [ + 213, + 244 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./rotate_right", + "raw": "'./rotate_right'", + "range": [ + 259, + 275 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 30 + } + } + }, + "range": [ + 245, + 277 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./sibling", + "raw": "'./sibling'", + "range": [ + 292, + 303 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 25 + } + } + }, + "range": [ + 278, + 305 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 27 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./successor", + "raw": "'./successor'", + "range": [ + 320, + 333 + ], + "loc": { + "start": { + "line": 11, + "column": 14 + }, + "end": { + "line": 11, + "column": 27 + } + } + }, + "range": [ + 306, + 335 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./uncle", + "raw": "'./uncle'", + "range": [ + 350, + 359 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + "range": [ + 336, + 361 + ], + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 25 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 361 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 25 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/inordertraversal.js.json b/ast/source/base/inordertraversal.js.json new file mode 100644 index 0000000..e330999 --- /dev/null +++ b/ast/source/base/inordertraversal.js.json @@ -0,0 +1,787 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "inordertraversal", + "range": [ + 18, + 34 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 33 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 37, + 41 + ], + "loc": { + "start": { + "line": 2, + "column": 36 + }, + "end": { + "line": 2, + "column": 40 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 54, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 59, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "range": [ + 54, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 64, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "range": [ + 54, + 70 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "arguments": [], + "range": [ + 54, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "prefix": true, + "range": [ + 53, + 72 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "inordertraversal", + "range": [ + 86, + 102 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 104, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 109, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + "range": [ + 104, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 36 + } + } + } + ], + "range": [ + 86, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + "delegate": true, + "range": [ + 79, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + "range": [ + 79, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 2 + }, + "end": { + "line": 5, + "column": 39 + } + } + } + ], + "range": [ + 75, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 28 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + "alternate": null, + "range": [ + 48, + 119 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 6, + "column": 2 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 128, + 132 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 133, + 138 + ], + "loc": { + "start": { + "line": 8, + "column": 12 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 128, + 138 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "delegate": false, + "range": [ + 122, + 138 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 122, + 140 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 149, + 153 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 154, + 159 + ], + "loc": { + "start": { + "line": 10, + "column": 12 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + "range": [ + 149, + 159 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 160, + 166 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "range": [ + 149, + 166 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 149, + 168 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 26 + } + } + }, + "prefix": true, + "range": [ + 148, + 168 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 26 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "inordertraversal", + "range": [ + 182, + 198 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 200, + 204 + ], + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 205, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 32 + }, + "end": { + "line": 11, + "column": 37 + } + } + }, + "range": [ + 200, + 210 + ], + "loc": { + "start": { + "line": 11, + "column": 27 + }, + "end": { + "line": 11, + "column": 37 + } + } + } + ], + "range": [ + 182, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 9 + }, + "end": { + "line": 11, + "column": 39 + } + } + }, + "delegate": true, + "range": [ + 175, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 39 + } + } + }, + "range": [ + 175, + 213 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 40 + } + } + } + ], + "range": [ + 171, + 216 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + "alternate": null, + "range": [ + 143, + 216 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + } + ], + "range": [ + 44, + 219 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 8, + 219 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 1, + 219 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 219 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/insert.js.json b/ast/source/base/insert.js.json new file mode 100644 index 0000000..daab706 --- /dev/null +++ b/ast/source/base/insert.js.json @@ -0,0 +1,1416 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "insert", + "range": [ + 17, + 23 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 26, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Identifier", + "name": "A", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 34 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "Identifier", + "name": "B", + "range": [ + 38, + 39 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "WhileStatement", + "test": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 54, + 58 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "compare", + "range": [ + 71, + 78 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 82, + 87 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 80, + 87 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 91, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 27 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + "range": [ + 89, + 96 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 32 + } + } + } + ], + "range": [ + 71, + 98 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 34 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 101, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 37 + }, + "end": { + "line": 6, + "column": 38 + } + } + }, + "range": [ + 71, + 102 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 38 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "node", + "range": [ + 117, + 121 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 13 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 126, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + "range": [ + 124, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + "range": [ + 117, + 130 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 22 + } + } + } + ], + "kind": "const", + "range": [ + 111, + 131 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 141, + 145 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 146, + 152 + ], + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "range": [ + 141, + 152 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "arguments": [], + "range": [ + 141, + 154 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 163, + 164 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 165, + 169 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + "range": [ + 163, + 169 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 172, + 173 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "range": [ + 163, + 173 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "range": [ + 163, + 174 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 15 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 179, + 185 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 10 + } + } + } + ], + "range": [ + 157, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + "alternate": null, + "range": [ + 136, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 3 + }, + "end": { + "line": 13, + "column": 4 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "A", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 4 + } + } + }, + "right": { + "type": "Identifier", + "name": "node", + "range": [ + 199, + 203 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + "range": [ + 195, + 203 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + "range": [ + 195, + 204 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 12 + } + } + } + ], + "range": [ + 105, + 209 + ], + "loc": { + "start": { + "line": 6, + "column": 41 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "node", + "range": [ + 230, + 234 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 237, + 238 + ], + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 239, + 244 + ], + "loc": { + "start": { + "line": 21, + "column": 18 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + "range": [ + 237, + 244 + ], + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + "range": [ + 230, + 244 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 23 + } + } + } + ], + "kind": "const", + "range": [ + 224, + 245 + ], + "loc": { + "start": { + "line": 21, + "column": 3 + }, + "end": { + "line": 21, + "column": 24 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 255, + 259 + ], + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 260, + 266 + ], + "loc": { + "start": { + "line": 23, + "column": 13 + }, + "end": { + "line": 23, + "column": 19 + } + } + }, + "range": [ + 255, + 266 + ], + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 19 + } + } + }, + "arguments": [], + "range": [ + 255, + 268 + ], + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 279, + 284 + ], + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 11 + } + } + }, + "range": [ + 277, + 284 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 11 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 287, + 288 + ], + "loc": { + "start": { + "line": 24, + "column": 14 + }, + "end": { + "line": 24, + "column": 15 + } + } + }, + "range": [ + 277, + 288 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 15 + } + } + }, + "range": [ + 277, + 289 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + { + "type": "BreakStatement", + "label": null, + "range": [ + 294, + 300 + ], + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 10 + } + } + } + ], + "range": [ + 271, + 305 + ], + "loc": { + "start": { + "line": 23, + "column": 24 + }, + "end": { + "line": 26, + "column": 4 + } + } + }, + "alternate": null, + "range": [ + 250, + 305 + ], + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 26, + "column": 4 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "A", + "range": [ + 310, + 311 + ], + "loc": { + "start": { + "line": 28, + "column": 3 + }, + "end": { + "line": 28, + "column": 4 + } + } + }, + "right": { + "type": "Identifier", + "name": "node", + "range": [ + 314, + 318 + ], + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 11 + } + } + }, + "range": [ + 310, + 318 + ], + "loc": { + "start": { + "line": 28, + "column": 3 + }, + "end": { + "line": 28, + "column": 11 + } + } + }, + "range": [ + 310, + 319 + ], + "loc": { + "start": { + "line": 28, + "column": 3 + }, + "end": { + "line": 28, + "column": 12 + } + } + } + ], + "range": [ + 218, + 324 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 30, + "column": 3 + } + } + }, + "range": [ + 66, + 324 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 30, + "column": 3 + } + } + } + ], + "range": [ + 61, + 328 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + "range": [ + 46, + 328 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 333, + 339 + ], + "loc": { + "start": { + "line": 34, + "column": 3 + }, + "end": { + "line": 34, + "column": 9 + } + } + }, + "range": [ + 331, + 339 + ], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "A", + "range": [ + 342, + 343 + ], + "loc": { + "start": { + "line": 34, + "column": 12 + }, + "end": { + "line": 34, + "column": 13 + } + } + }, + "range": [ + 331, + 343 + ], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 + } + } + }, + "range": [ + 331, + 344 + ], + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 14 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "B", + "range": [ + 354, + 355 + ], + "loc": { + "start": { + "line": 36, + "column": 8 + }, + "end": { + "line": 36, + "column": 9 + } + } + }, + "range": [ + 347, + 356 + ], + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 10 + } + } + } + ], + "range": [ + 42, + 359 + ], + "loc": { + "start": { + "line": 2, + "column": 41 + }, + "end": { + "line": 38, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 8, + 359 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 38, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 1, + 359 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 38, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 359 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 38, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/predecessor.js.json b/ast/source/base/predecessor.js.json new file mode 100644 index 0000000..86b6f0b --- /dev/null +++ b/ast/source/base/predecessor.js.json @@ -0,0 +1,513 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "predecessor", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 30, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 34 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "pred", + "range": [ + 45, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 52, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 57, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 52, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 45, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "kind": "var", + "range": [ + 41, + 63 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": "WhileStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "pred", + "range": [ + 75, + 79 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 80, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + "range": [ + 75, + 85 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 86, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 21 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + "range": [ + 75, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 27 + } + } + }, + "arguments": [], + "range": [ + 75, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "prefix": true, + "range": [ + 74, + 94 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "pred", + "range": [ + 97, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "pred", + "range": [ + 104, + 108 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 43 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 109, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 44 + }, + "end": { + "line": 5, + "column": 49 + } + } + }, + "range": [ + 104, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 39 + }, + "end": { + "line": 5, + "column": 49 + } + } + }, + "range": [ + 97, + 114 + ], + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 49 + } + } + }, + "range": [ + 97, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + "range": [ + 66, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "pred", + "range": [ + 126, + 130 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + "range": [ + 119, + 132 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 14 + } + } + } + ], + "range": [ + 37, + 135 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 7, + 135 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 135 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 135 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/replace_node.js.json b/ast/source/base/replace_node.js.json new file mode 100644 index 0000000..6118d80 --- /dev/null +++ b/ast/source/base/replace_node.js.json @@ -0,0 +1,931 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "replace_node", + "range": [ + 17, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "A", + "range": [ + 32, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 31 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "Identifier", + "name": "B", + "range": [ + 36, + 37 + ], + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 48, + 49 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 50, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "range": [ + 48, + 56 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 14 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 61, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "range": [ + 48, + 65 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [], + "range": [ + 68, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 5, + "column": 2 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " nothing to do", + "range": [ + 72, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 18 + } + } + } + ] + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "A", + "range": [ + 103, + 104 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 12 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 111, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 109, + 117 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 118, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 26 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + "range": [ + 109, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 17 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + "range": [ + 103, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 131, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 4 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "range": [ + 129, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 138, + 142 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + "range": [ + 129, + 142 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 145, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 129, + 146 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 129, + 148 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 21 + } + } + } + ], + "range": [ + 125, + 151 + ], + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 164, + 170 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "range": [ + 162, + 170 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 171, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "range": [ + 162, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 179, + 180 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + "range": [ + 162, + 180 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 20 + } + } + }, + "range": [ + 162, + 182 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 22 + } + } + } + ], + "range": [ + 158, + 185 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + "range": [ + 98, + 185 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 11, + "column": 2 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " nothing to do", + "range": [ + 72, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 18 + } + } + } + ] + }, + "range": [ + 43, + 185 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 11, + "column": 2 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 187, + 188 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 189, + 195 + ], + "loc": { + "start": { + "line": 12, + "column": 3 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "range": [ + 187, + 195 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 200, + 206 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + "range": [ + 198, + 206 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + "range": [ + 187, + 206 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + "range": [ + 187, + 208 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 22 + } + } + } + ], + "range": [ + 40, + 210 + ], + "loc": { + "start": { + "line": 2, + "column": 39 + }, + "end": { + "line": 13, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 8, + 210 + ], + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 13, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 1, + 210 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 210 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 13, + "column": 1 + } + }, + "comments": [ + { + "type": "Line", + "value": " nothing to do", + "range": [ + 72, + 88 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 18 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/base/rotate_left.js.json b/ast/source/base/rotate_left.js.json new file mode 100644 index 0000000..c40ddf9 --- /dev/null +++ b/ast/source/base/rotate_left.js.json @@ -0,0 +1,1939 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 278, + 289 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "A", + "range": [ + 292, + 293 + ], + "loc": { + "start": { + "line": 14, + "column": 30 + }, + "end": { + "line": 14, + "column": 31 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "B", + "range": [ + 306, + 307 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 310, + 311 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 312, + 317 + ], + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "range": [ + 310, + 317 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "range": [ + 306, + 317 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 18 + } + } + } + ], + "kind": "const", + "range": [ + 300, + 319 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 327, + 328 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 331, + 332 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 333, + 337 + ], + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + "range": [ + 331, + 337 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + "range": [ + 327, + 337 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + ], + "kind": "const", + "range": [ + 321, + 339 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 19 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 351, + 352 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 353, + 357 + ], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + "range": [ + 351, + 357 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + "range": [ + 347, + 357 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 17 + } + } + } + ], + "kind": "const", + "range": [ + 341, + 359 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "c", + "range": [ + 367, + 368 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 371, + 372 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 373, + 378 + ], + "loc": { + "start": { + "line": 19, + "column": 13 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "range": [ + 371, + 378 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "range": [ + 367, + 378 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 18 + } + } + } + ], + "kind": "const", + "range": [ + 361, + 380 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 384, + 385 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 386, + 391 + ], + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + "range": [ + 384, + 391 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 394, + 395 + ], + "loc": { + "start": { + "line": 21, + "column": 12 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 396, + 401 + ], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + "range": [ + 394, + 401 + ], + "loc": { + "start": { + "line": 21, + "column": 12 + }, + "end": { + "line": 21, + "column": 19 + } + } + } + ], + "range": [ + 383, + 402 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 406, + 407 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 408, + 413 + ], + "loc": { + "start": { + "line": 21, + "column": 26 + }, + "end": { + "line": 21, + "column": 31 + } + } + }, + "range": [ + 406, + 413 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 31 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 416, + 417 + ], + "loc": { + "start": { + "line": 21, + "column": 34 + }, + "end": { + "line": 21, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 418, + 423 + ], + "loc": { + "start": { + "line": 21, + "column": 36 + }, + "end": { + "line": 21, + "column": 41 + } + } + }, + "range": [ + 416, + 423 + ], + "loc": { + "start": { + "line": 21, + "column": 34 + }, + "end": { + "line": 21, + "column": 41 + } + } + } + ], + "range": [ + 405, + 424 + ], + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 42 + } + } + }, + "range": [ + 383, + 424 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 42 + } + } + }, + "range": [ + 383, + 426 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 44 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 429, + 430 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 431, + 436 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + "range": [ + 429, + 436 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 439, + 440 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 441, + 446 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 19 + } + } + }, + "range": [ + 439, + 446 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 19 + } + } + } + ], + "range": [ + 428, + 447 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 451, + 452 + ], + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 453, + 458 + ], + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 31 + } + } + }, + "range": [ + 451, + 458 + ], + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 31 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 461, + 462 + ], + "loc": { + "start": { + "line": 22, + "column": 34 + }, + "end": { + "line": 22, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 463, + 468 + ], + "loc": { + "start": { + "line": 22, + "column": 36 + }, + "end": { + "line": 22, + "column": 41 + } + } + }, + "range": [ + 461, + 468 + ], + "loc": { + "start": { + "line": 22, + "column": 34 + }, + "end": { + "line": 22, + "column": 41 + } + } + } + ], + "range": [ + 450, + 469 + ], + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 42 + } + } + }, + "range": [ + 428, + 469 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 42 + } + } + }, + "range": [ + 428, + 471 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 44 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 474, + 475 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 476, + 480 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + "range": [ + 474, + 480 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 483, + 484 + ], + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 11 + } + } + }, + "range": [ + 474, + 484 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 11 + } + } + }, + "range": [ + 474, + 486 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 488, + 489 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 490, + 495 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + "range": [ + 488, + 495 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "c", + "range": [ + 498, + 499 + ], + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + } + } + }, + "range": [ + 488, + 499 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 12 + } + } + }, + "range": [ + 488, + 501 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 14 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 504, + 505 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 506, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 7 + } + } + }, + "range": [ + 504, + 510 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + } + } + }, + "right": { + "type": "Identifier", + "name": "a", + "range": [ + 513, + 514 + ], + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 11 + } + } + }, + "range": [ + 504, + 514 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 11 + } + } + }, + "range": [ + 504, + 516 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 518, + 519 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 520, + 525 + ], + "loc": { + "start": { + "line": 28, + "column": 3 + }, + "end": { + "line": 28, + "column": 8 + } + } + }, + "range": [ + 518, + 525 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 528, + 529 + ], + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 12 + } + } + }, + "range": [ + 518, + 529 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 12 + } + } + }, + "range": [ + 518, + 531 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 14 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 534, + 535 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 536, + 542 + ], + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + } + } + }, + "range": [ + 534, + 542 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 545, + 546 + ], + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + "range": [ + 534, + 546 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + "range": [ + 534, + 548 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 15 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "b", + "range": [ + 550, + 551 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 552, + 558 + ], + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 9 + } + } + }, + "range": [ + 550, + 558 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 561, + 562 + ], + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 13 + } + } + }, + "range": [ + 550, + 562 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + } + } + }, + "range": [ + 550, + 564 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 15 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "c", + "range": [ + 566, + 567 + ], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 568, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + "range": [ + 566, + 574 + ], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "A", + "range": [ + 577, + 578 + ], + "loc": { + "start": { + "line": 32, + "column": 12 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "range": [ + 566, + 578 + ], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "range": [ + 566, + 580 + ], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 15 + } + } + } + ], + "range": [ + 296, + 582 + ], + "loc": { + "start": { + "line": 14, + "column": 34 + }, + "end": { + "line": 33, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 269, + 582 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n ", + "range": [ + 0, + 260 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 262, + 582 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n ", + "range": [ + 0, + 260 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ] + } + ], + "sourceType": "module", + "range": [ + 262, + 582 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 33, + "column": 1 + } + }, + "comments": [ + { + "type": "Block", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n ", + "range": [ + 0, + 260 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/base/rotate_right.js.json b/ast/source/base/rotate_right.js.json new file mode 100644 index 0000000..94480b3 --- /dev/null +++ b/ast/source/base/rotate_right.js.json @@ -0,0 +1,1939 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 287, + 299 + ], + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "B", + "range": [ + 302, + 303 + ], + "loc": { + "start": { + "line": 14, + "column": 31 + }, + "end": { + "line": 14, + "column": 32 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "A", + "range": [ + 316, + 317 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 320, + 321 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 322, + 326 + ], + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 17 + } + } + }, + "range": [ + 320, + 326 + ], + "loc": { + "start": { + "line": 16, + "column": 11 + }, + "end": { + "line": 16, + "column": 17 + } + } + }, + "range": [ + 316, + 326 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 17 + } + } + } + ], + "kind": "const", + "range": [ + 310, + 327 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "a", + "range": [ + 335, + 336 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 339, + 340 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 341, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + "range": [ + 339, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + "range": [ + 335, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + ], + "kind": "const", + "range": [ + 329, + 347 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 19 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "b", + "range": [ + 355, + 356 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 359, + 360 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 361, + 366 + ], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "range": [ + 359, + 366 + ], + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "range": [ + 355, + 366 + ], + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 18 + } + } + } + ], + "kind": "const", + "range": [ + 349, + 368 + ], + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "c", + "range": [ + 376, + 377 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 380, + 381 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 382, + 387 + ], + "loc": { + "start": { + "line": 19, + "column": 13 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "range": [ + 380, + 387 + ], + "loc": { + "start": { + "line": 19, + "column": 11 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + "range": [ + 376, + 387 + ], + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 18 + } + } + } + ], + "kind": "const", + "range": [ + 370, + 389 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 393, + 394 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 395, + 400 + ], + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + "range": [ + 393, + 400 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 403, + 404 + ], + "loc": { + "start": { + "line": 21, + "column": 12 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 405, + 410 + ], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + "range": [ + 403, + 410 + ], + "loc": { + "start": { + "line": 21, + "column": 12 + }, + "end": { + "line": 21, + "column": 19 + } + } + } + ], + "range": [ + 392, + 411 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 415, + 416 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 417, + 422 + ], + "loc": { + "start": { + "line": 21, + "column": 26 + }, + "end": { + "line": 21, + "column": 31 + } + } + }, + "range": [ + 415, + 422 + ], + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 31 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 425, + 426 + ], + "loc": { + "start": { + "line": 21, + "column": 34 + }, + "end": { + "line": 21, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 427, + 432 + ], + "loc": { + "start": { + "line": 21, + "column": 36 + }, + "end": { + "line": 21, + "column": 41 + } + } + }, + "range": [ + 425, + 432 + ], + "loc": { + "start": { + "line": 21, + "column": 34 + }, + "end": { + "line": 21, + "column": 41 + } + } + } + ], + "range": [ + 414, + 433 + ], + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 42 + } + } + }, + "range": [ + 392, + 433 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 42 + } + } + }, + "range": [ + 392, + 435 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 44 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "ArrayPattern", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 438, + 439 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 440, + 445 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + "range": [ + 438, + 445 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 448, + 449 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 450, + 455 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 19 + } + } + }, + "range": [ + 448, + 455 + ], + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 19 + } + } + } + ], + "range": [ + 437, + 456 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "right": { + "type": "ArrayExpression", + "elements": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 460, + 461 + ], + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 462, + 467 + ], + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 31 + } + } + }, + "range": [ + 460, + 467 + ], + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 31 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 470, + 471 + ], + "loc": { + "start": { + "line": 22, + "column": 34 + }, + "end": { + "line": 22, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 472, + 477 + ], + "loc": { + "start": { + "line": 22, + "column": 36 + }, + "end": { + "line": 22, + "column": 41 + } + } + }, + "range": [ + 470, + 477 + ], + "loc": { + "start": { + "line": 22, + "column": 34 + }, + "end": { + "line": 22, + "column": 41 + } + } + } + ], + "range": [ + 459, + 478 + ], + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 42 + } + } + }, + "range": [ + 437, + 478 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 42 + } + } + }, + "range": [ + 437, + 480 + ], + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 44 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 483, + 484 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 485, + 489 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + "range": [ + 483, + 489 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + "right": { + "type": "Identifier", + "name": "a", + "range": [ + 492, + 493 + ], + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 11 + } + } + }, + "range": [ + 483, + 493 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 11 + } + } + }, + "range": [ + 483, + 495 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "B", + "range": [ + 497, + 498 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 499, + 504 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + "range": [ + 497, + 504 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "A", + "range": [ + 507, + 508 + ], + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + } + } + }, + "range": [ + 497, + 508 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 12 + } + } + }, + "range": [ + 497, + 510 + ], + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 14 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 513, + 514 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 515, + 519 + ], + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 7 + } + } + }, + "range": [ + 513, + 519 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + } + } + }, + "right": { + "type": "Identifier", + "name": "b", + "range": [ + 522, + 523 + ], + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 11 + } + } + }, + "range": [ + 513, + 523 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 11 + } + } + }, + "range": [ + 513, + 525 + ], + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 13 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 527, + 528 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 529, + 534 + ], + "loc": { + "start": { + "line": 28, + "column": 3 + }, + "end": { + "line": 28, + "column": 8 + } + } + }, + "range": [ + 527, + 534 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "c", + "range": [ + 537, + 538 + ], + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 12 + } + } + }, + "range": [ + 527, + 538 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 12 + } + } + }, + "range": [ + 527, + 540 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 14 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "a", + "range": [ + 543, + 544 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 545, + 551 + ], + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + } + } + }, + "range": [ + 543, + 551 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 554, + 555 + ], + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + "range": [ + 543, + 555 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + "range": [ + 543, + 557 + ], + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 15 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "b", + "range": [ + 559, + 560 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 561, + 567 + ], + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 9 + } + } + }, + "range": [ + 559, + 567 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "A", + "range": [ + 570, + 571 + ], + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 13 + } + } + }, + "range": [ + 559, + 571 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + } + } + }, + "range": [ + 559, + 573 + ], + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 15 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "c", + "range": [ + 575, + 576 + ], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 577, + 583 + ], + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + "range": [ + 575, + 583 + ], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "A", + "range": [ + 586, + 587 + ], + "loc": { + "start": { + "line": 32, + "column": 12 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "range": [ + 575, + 587 + ], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + "range": [ + 575, + 589 + ], + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 15 + } + } + } + ], + "range": [ + 306, + 592 + ], + "loc": { + "start": { + "line": 14, + "column": 35 + }, + "end": { + "line": 34, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 278, + 592 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 34, + "column": 1 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} A root of the tree\n ", + "range": [ + 0, + 269 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 271, + 592 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 34, + "column": 1 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} A root of the tree\n ", + "range": [ + 0, + 269 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ] + } + ], + "sourceType": "module", + "range": [ + 271, + 592 + ], + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 34, + "column": 1 + } + }, + "comments": [ + { + "type": "Block", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} A root of the tree\n ", + "range": [ + 0, + 269 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/base/sibling.js.json b/ast/source/base/sibling.js.json new file mode 100644 index 0000000..1247d27 --- /dev/null +++ b/ast/source/base/sibling.js.json @@ -0,0 +1,752 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "sibling", + "range": [ + 16, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 24, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "||", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 35, + 36 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 7 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 41, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + "range": [ + 35, + 45 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 51, + 52 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "range": [ + 51, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 64, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "range": [ + 51, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 39 + } + } + }, + "range": [ + 34, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 40 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 80, + 84 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "range": [ + 73, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 14 + } + } + }, + "alternate": null, + "range": [ + 30, + 85 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 4, + "column": 14 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " no parent means no sibling", + "range": [ + 86, + 115 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 44 + } + } + } + ] + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 127, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 129, + 135 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "range": [ + 127, + 135 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 136, + 140 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "range": [ + 127, + 140 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "range": [ + 121, + 140 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 151, + 152 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 153, + 159 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + "range": [ + 151, + 159 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 160, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 151, + 165 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + "range": [ + 144, + 166 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "alternate": { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 184, + 190 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 182, + 190 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 191, + 195 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + "range": [ + 182, + 195 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + "range": [ + 175, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "range": [ + 117, + 196 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 8, + "column": 23 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " no parent means no sibling", + "range": [ + 86, + 115 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 44 + } + } + } + ] + } + ], + "range": [ + 27, + 198 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 7, + 198 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 198 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 198 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "comments": [ + { + "type": "Line", + "value": " no parent means no sibling", + "range": [ + 86, + 115 + ], + "loc": { + "start": { + "line": 4, + "column": 15 + }, + "end": { + "line": 4, + "column": 44 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/base/successor.js.json b/ast/source/base/successor.js.json new file mode 100644 index 0000000..8f9f27f --- /dev/null +++ b/ast/source/base/successor.js.json @@ -0,0 +1,513 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "successor", + "range": [ + 16, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "succ", + "range": [ + 43, + 47 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 9 + } + } + }, + "init": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 50, + 54 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 55, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "range": [ + 50, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + "range": [ + 43, + 60 + ], + "loc": { + "start": { + "line": 3, + "column": 5 + }, + "end": { + "line": 3, + "column": 22 + } + } + } + ], + "kind": "var", + "range": [ + 39, + 62 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": "WhileStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "succ", + "range": [ + 74, + 78 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 79, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "range": [ + 74, + 83 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 84, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "range": [ + 74, + 90 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + "arguments": [], + "range": [ + 74, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "prefix": true, + "range": [ + 73, + 92 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "succ", + "range": [ + 95, + 99 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "succ", + "range": [ + 102, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 42 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 107, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 43 + }, + "end": { + "line": 5, + "column": 47 + } + } + }, + "range": [ + 102, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 47 + } + } + }, + "range": [ + 95, + 111 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 47 + } + } + }, + "range": [ + 95, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 31 + }, + "end": { + "line": 5, + "column": 49 + } + } + }, + "range": [ + 65, + 113 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 49 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "succ", + "range": [ + 123, + 127 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + "range": [ + 116, + 129 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 14 + } + } + } + ], + "range": [ + 35, + 132 + ], + "loc": { + "start": { + "line": 1, + "column": 35 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 7, + 132 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 132 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 132 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/uncle.js.json b/ast/source/base/uncle.js.json new file mode 100644 index 0000000..3fe9fcc --- /dev/null +++ b/ast/source/base/uncle.js.json @@ -0,0 +1,1060 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 9, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./grandparent", + "raw": "'./grandparent'", + "range": [ + 28, + 43 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 43 + } + } + }, + "range": [ + 0, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "uncle", + "range": [ + 63, + 68 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 69, + 70 + ], + "loc": { + "start": { + "line": 3, + "column": 22 + }, + "end": { + "line": 3, + "column": 23 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "g", + "range": [ + 80, + 81 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 84, + 95 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 96, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 24 + } + } + } + ], + "range": [ + 84, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "range": [ + 80, + 98 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "kind": "const", + "range": [ + 74, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 26 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "g", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 111, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 11 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "range": [ + 105, + 115 + ], + "loc": { + "start": { + "line": 5, + "column": 5 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 126, + 130 + ], + "loc": { + "start": { + "line": 6, + "column": 9 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "range": [ + 119, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 2 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + "alternate": null, + "range": [ + 101, + 131 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 6, + "column": 14 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " No grandparent means no uncle", + "range": [ + 132, + 164 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 47 + } + } + } + ] + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 170, + 171 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 172, + 178 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "range": [ + 170, + 178 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 185, + 189 + ], + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 183, + 189 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 170, + 189 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 200, + 201 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 202, + 207 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "range": [ + 200, + 207 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 208, + 214 + ], + "loc": { + "start": { + "line": 8, + "column": 17 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "range": [ + 200, + 214 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "arguments": [], + "range": [ + 200, + 216 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + "consequent": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 219, + 223 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + "alternate": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 226, + 227 + ], + "loc": { + "start": { + "line": 8, + "column": 35 + }, + "end": { + "line": 8, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 228, + 233 + ], + "loc": { + "start": { + "line": 8, + "column": 37 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "range": [ + 226, + 233 + ], + "loc": { + "start": { + "line": 8, + "column": 35 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "range": [ + 200, + 233 + ], + "loc": { + "start": { + "line": 8, + "column": 9 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "range": [ + 193, + 235 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 44 + } + } + }, + "alternate": { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 253, + 257 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "range": [ + 251, + 257 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 258, + 264 + ], + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + "range": [ + 251, + 264 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + "arguments": [], + "range": [ + 251, + 266 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "consequent": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 269, + 273 + ], + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + "alternate": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 276, + 277 + ], + "loc": { + "start": { + "line": 10, + "column": 34 + }, + "end": { + "line": 10, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 278, + 282 + ], + "loc": { + "start": { + "line": 10, + "column": 36 + }, + "end": { + "line": 10, + "column": 40 + } + } + }, + "range": [ + 276, + 282 + ], + "loc": { + "start": { + "line": 10, + "column": 34 + }, + "end": { + "line": 10, + "column": 40 + } + } + }, + "range": [ + 251, + 282 + ], + "loc": { + "start": { + "line": 10, + "column": 9 + }, + "end": { + "line": 10, + "column": 40 + } + } + }, + "range": [ + 244, + 283 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 41 + } + } + }, + "range": [ + 166, + 283 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " No grandparent means no uncle", + "range": [ + 132, + 164 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 47 + } + } + } + ] + } + ], + "range": [ + 71, + 285 + ], + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 54, + 285 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 11, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 47, + 285 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 285 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + }, + "comments": [ + { + "type": "Line", + "value": " No grandparent means no uncle", + "range": [ + 132, + 164 + ], + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 47 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/index.js.json b/ast/source/index.js.json new file mode 100644 index 0000000..cb4827c --- /dev/null +++ b/ast/source/index.js.json @@ -0,0 +1,201 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./adt", + "raw": "'./adt'", + "range": [ + 14, + 21 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 21 + } + } + }, + "range": [ + 0, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./base", + "raw": "'./base'", + "range": [ + 38, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 24, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./insertion", + "raw": "'./insertion'", + "range": [ + 63, + 76 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + "range": [ + 49, + 78 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./node", + "raw": "'./node'", + "range": [ + 93, + 101 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + "range": [ + 79, + 103 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./removal", + "raw": "'./removal'", + "range": [ + 118, + 129 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + "range": [ + 104, + 131 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 27 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 131 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 27 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/insertion/index.js.json b/ast/source/insertion/index.js.json new file mode 100644 index 0000000..e394996 --- /dev/null +++ b/ast/source/insertion/index.js.json @@ -0,0 +1,201 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./insert_case1", + "raw": "'./insert_case1'", + "range": [ + 14, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./insert_case2", + "raw": "'./insert_case2'", + "range": [ + 47, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 33, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./insert_case3", + "raw": "'./insert_case3'", + "range": [ + 80, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "range": [ + 66, + 98 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./insert_case4", + "raw": "'./insert_case4'", + "range": [ + 113, + 129 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "range": [ + 99, + 131 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./insert_case5", + "raw": "'./insert_case5'", + "range": [ + 146, + 162 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "range": [ + 132, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 32 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 164 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 5, + "column": 32 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/insertion/insert_case1.js.json b/ast/source/insertion/insert_case1.js.json new file mode 100644 index 0000000..69b5607 --- /dev/null +++ b/ast/source/insertion/insert_case1.js.json @@ -0,0 +1,587 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 1, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "insert_case2", + "range": [ + 39, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "insert_case2", + "range": [ + 39, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 39, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./insert_case2", + "raw": "'./insert_case2'", + "range": [ + 59, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 30, + 77 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "insert_case1", + "range": [ + 95, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 120, + 126 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "range": [ + 118, + 126 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 131, + 135 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + "range": [ + 118, + 135 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 139, + 140 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 141, + 146 + ], + "loc": { + "start": { + "line": 8, + "column": 4 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "range": [ + 139, + 146 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 149, + 154 + ], + "loc": { + "start": { + "line": 8, + "column": 12 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 139, + 154 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 139, + 155 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "insert_case2", + "range": [ + 164, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + ], + "range": [ + 164, + 179 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + "range": [ + 164, + 180 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + "range": [ + 114, + 180 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 10, + "column": 18 + } + } + } + ], + "range": [ + 111, + 182 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 86, + 182 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 11, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 79, + 182 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 182 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/insertion/insert_case2.js.json b/ast/source/insertion/insert_case2.js.json new file mode 100644 index 0000000..7d4a7e8 --- /dev/null +++ b/ast/source/insertion/insert_case2.js.json @@ -0,0 +1,592 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 23, + 27 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 26 + } + } + }, + "range": [ + 1, + 29 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "insert_case3", + "range": [ + 39, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "insert_case3", + "range": [ + 39, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 39, + 51 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./insert_case3", + "raw": "'./insert_case3'", + "range": [ + 59, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 30, + 77 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "insert_case2", + "range": [ + 95, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 108, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 118, + 119 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 120, + 126 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "range": [ + 118, + 126 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 127, + 132 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 118, + 132 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + "range": [ + 118, + 142 + ], + "loc": { + "start": { + "line": 7, + "column": 5 + }, + "end": { + "line": 7, + "column": 29 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": null, + "range": [ + 146, + 153 + ], + "loc": { + "start": { + "line": 8, + "column": 2 + }, + "end": { + "line": 8, + "column": 9 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": " Tree is still valid ", + "range": [ + 154, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 35 + } + } + } + ] + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "insert_case3", + "range": [ + 188, + 200 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 201, + 202 + ], + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 16 + } + } + } + ], + "range": [ + 188, + 203 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + "range": [ + 188, + 204 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 18 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " Tree is still valid ", + "range": [ + 154, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 35 + } + } + } + ] + }, + "range": [ + 114, + 204 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 10, + "column": 18 + } + } + } + ], + "range": [ + 111, + 206 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 86, + 206 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 11, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 79, + 206 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 206 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 11, + "column": 1 + } + }, + "comments": [ + { + "type": "Block", + "value": " Tree is still valid ", + "range": [ + 154, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 35 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/insertion/insert_case3.js.json b/ast/source/insertion/insert_case3.js.json new file mode 100644 index 0000000..a22765f --- /dev/null +++ b/ast/source/insertion/insert_case3.js.json @@ -0,0 +1,1489 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "uncle", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "imported": { + "type": "Identifier", + "name": "uncle", + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + "range": [ + 23, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 31, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "imported": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 31, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 31, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 42 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 50, + 54 + ], + "loc": { + "start": { + "line": 1, + "column": 50 + }, + "end": { + "line": 1, + "column": 54 + } + } + }, + "range": [ + 0, + 56 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 56 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "insert_case1", + "range": [ + 66, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "insert_case1", + "range": [ + 66, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "range": [ + 66, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./insert_case1", + "raw": "'./insert_case1'", + "range": [ + 86, + 102 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "range": [ + 57, + 104 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "insert_case4", + "range": [ + 114, + 126 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "insert_case4", + "range": [ + 114, + 126 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 114, + 126 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./insert_case4", + "raw": "'./insert_case4'", + "range": [ + 134, + 150 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 105, + 152 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "insert_case3", + "range": [ + 170, + 182 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 183, + 184 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "u", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "uncle", + "range": [ + 199, + 204 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 205, + 206 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 18 + } + } + } + ], + "range": [ + 199, + 207 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 195, + 207 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + } + ], + "kind": "const", + "range": [ + 189, + 208 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 20 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "Identifier", + "name": "u", + "range": [ + 216, + 217 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 222, + 226 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + "range": [ + 216, + 226 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 16 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "u", + "range": [ + 232, + 233 + ], + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 234, + 239 + ], + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "range": [ + 232, + 239 + ], + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 29 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 244, + 247 + ], + "loc": { + "start": { + "line": 9, + "column": 34 + }, + "end": { + "line": 9, + "column": 37 + } + } + }, + "range": [ + 232, + 247 + ], + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 9, + "column": 37 + } + } + }, + "range": [ + 215, + 248 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 38 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "range": [ + 254, + 262 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 263, + 268 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "range": [ + 254, + 268 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 271, + 276 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "range": [ + 254, + 276 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "range": [ + 254, + 277 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 25 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "u", + "range": [ + 280, + 281 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 282, + 287 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + "range": [ + 280, + 287 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 290, + 295 + ], + "loc": { + "start": { + "line": 11, + "column": 12 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + "range": [ + 280, + 295 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + "range": [ + 280, + 296 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "g", + "range": [ + 305, + 306 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 309, + 320 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 321, + 322 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 25 + } + } + } + ], + "range": [ + 309, + 323 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + "range": [ + 305, + 323 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 26 + } + } + } + ], + "kind": "const", + "range": [ + 299, + 324 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 327, + 328 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 329, + 334 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + "range": [ + 327, + 334 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 337, + 340 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "range": [ + 327, + 340 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "range": [ + 327, + 341 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "insert_case1", + "range": [ + 344, + 356 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "g", + "range": [ + 357, + 358 + ], + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 16 + } + } + } + ], + "range": [ + 344, + 359 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + "range": [ + 344, + 360 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 18 + } + } + } + ], + "range": [ + 250, + 363 + ], + "loc": { + "start": { + "line": 9, + "column": 40 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "insert_case4", + "range": [ + 373, + 385 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 386, + 387 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 16 + } + } + } + ], + "range": [ + 373, + 388 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 17 + } + } + }, + "range": [ + 373, + 389 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 18 + } + } + } + ], + "range": [ + 369, + 392 + ], + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + "range": [ + 211, + 392 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 17, + "column": 2 + } + } + } + ], + "range": [ + 186, + 394 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 161, + 394 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 154, + 394 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 394 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/insertion/insert_case4.js.json b/ast/source/insertion/insert_case4.js.json new file mode 100644 index 0000000..2c43e67 --- /dev/null +++ b/ast/source/insertion/insert_case4.js.json @@ -0,0 +1,1748 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 10, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 10, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "range": [ + 10, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 39, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "imported": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 39, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "range": [ + 39, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 49 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 58, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 57 + }, + "end": { + "line": 2, + "column": 61 + } + } + }, + "range": [ + 1, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 63 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "insert_case5", + "range": [ + 74, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "insert_case5", + "range": [ + 74, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 74, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./insert_case5", + "raw": "'./insert_case5'", + "range": [ + 94, + 110 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 65, + 112 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "insert_case4", + "range": [ + 130, + 142 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "g", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 159, + 170 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 171, + 172 + ], + "loc": { + "start": { + "line": 7, + "column": 23 + }, + "end": { + "line": 7, + "column": 24 + } + } + } + ], + "range": [ + 159, + 173 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + "range": [ + 155, + 173 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 25 + } + } + } + ], + "kind": "const", + "range": [ + 149, + 174 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 182, + 183 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 190, + 196 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "range": [ + 188, + 196 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 197, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "range": [ + 188, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "range": [ + 182, + 202 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 26 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 9, + "column": 32 + }, + "end": { + "line": 9, + "column": 33 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 9, + "column": 34 + }, + "end": { + "line": 9, + "column": 40 + } + } + }, + "range": [ + 208, + 216 + ], + "loc": { + "start": { + "line": 9, + "column": 32 + }, + "end": { + "line": 9, + "column": 40 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 221, + 222 + ], + "loc": { + "start": { + "line": 9, + "column": 45 + }, + "end": { + "line": 9, + "column": 46 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 223, + 227 + ], + "loc": { + "start": { + "line": 9, + "column": 47 + }, + "end": { + "line": 9, + "column": 51 + } + } + }, + "range": [ + 221, + 227 + ], + "loc": { + "start": { + "line": 9, + "column": 45 + }, + "end": { + "line": 9, + "column": 51 + } + } + }, + "range": [ + 208, + 227 + ], + "loc": { + "start": { + "line": 9, + "column": 32 + }, + "end": { + "line": 9, + "column": 51 + } + } + }, + "range": [ + 181, + 228 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 52 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 234, + 245 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 246, + 247 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 248, + 254 + ], + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + "range": [ + 246, + 254 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 22 + } + } + } + ], + "range": [ + 234, + 255 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + "range": [ + 234, + 256 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 24 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": "\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n ", + "range": [ + 259, + 496 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 21, + "column": 3 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 500, + 501 + ], + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 3 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 504, + 505 + ], + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 506, + 510 + ], + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 12 + } + } + }, + "range": [ + 504, + 510 + ], + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 12 + } + } + }, + "range": [ + 500, + 510 + ], + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 12 + } + } + }, + "range": [ + 500, + 511 + ], + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 13 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n ", + "range": [ + 259, + 496 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 21, + "column": 3 + } + } + } + ] + } + ], + "range": [ + 230, + 515 + ], + "loc": { + "start": { + "line": 9, + "column": 54 + }, + "end": { + "line": 25, + "column": 2 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 526, + 527 + ], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 14 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 532, + 533 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 534, + 540 + ], + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + "range": [ + 532, + 540 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 541, + 545 + ], + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 32 + } + } + }, + "range": [ + 532, + 545 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 32 + } + } + }, + "range": [ + 526, + 545 + ], + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 32 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 551, + 552 + ], + "loc": { + "start": { + "line": 25, + "column": 38 + }, + "end": { + "line": 25, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 553, + 559 + ], + "loc": { + "start": { + "line": 25, + "column": 40 + }, + "end": { + "line": 25, + "column": 46 + } + } + }, + "range": [ + 551, + 559 + ], + "loc": { + "start": { + "line": 25, + "column": 38 + }, + "end": { + "line": 25, + "column": 46 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 564, + 565 + ], + "loc": { + "start": { + "line": 25, + "column": 51 + }, + "end": { + "line": 25, + "column": 52 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 566, + 571 + ], + "loc": { + "start": { + "line": 25, + "column": 53 + }, + "end": { + "line": 25, + "column": 58 + } + } + }, + "range": [ + 564, + 571 + ], + "loc": { + "start": { + "line": 25, + "column": 51 + }, + "end": { + "line": 25, + "column": 58 + } + } + }, + "range": [ + 551, + 571 + ], + "loc": { + "start": { + "line": 25, + "column": 38 + }, + "end": { + "line": 25, + "column": 58 + } + } + }, + "range": [ + 525, + 572 + ], + "loc": { + "start": { + "line": 25, + "column": 12 + }, + "end": { + "line": 25, + "column": 59 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 578, + 590 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 591, + 592 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 593, + 599 + ], + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 23 + } + } + }, + "range": [ + 591, + 599 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 23 + } + } + } + ], + "range": [ + 578, + 600 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 24 + } + } + }, + "range": [ + 578, + 601 + ], + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", + "range": [ + 604, + 815 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 36, + "column": 3 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 819, + 820 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 3 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 823, + 824 + ], + "loc": { + "start": { + "line": 38, + "column": 6 + }, + "end": { + "line": 38, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 825, + 830 + ], + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 13 + } + } + }, + "range": [ + 823, + 830 + ], + "loc": { + "start": { + "line": 38, + "column": 6 + }, + "end": { + "line": 38, + "column": 13 + } + } + }, + "range": [ + 819, + 830 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 13 + } + } + }, + "range": [ + 819, + 831 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", + "range": [ + 604, + 815 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 36, + "column": 3 + } + } + } + ] + } + ], + "range": [ + 574, + 834 + ], + "loc": { + "start": { + "line": 25, + "column": 61 + }, + "end": { + "line": 39, + "column": 2 + } + } + }, + "alternate": null, + "range": [ + 521, + 834 + ], + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 39, + "column": 2 + } + } + }, + "range": [ + 177, + 834 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 39, + "column": 2 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "insert_case5", + "range": [ + 836, + 848 + ], + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 849, + 850 + ], + "loc": { + "start": { + "line": 40, + "column": 14 + }, + "end": { + "line": 40, + "column": 15 + } + } + } + ], + "range": [ + 836, + 851 + ], + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 16 + } + } + }, + "range": [ + 836, + 852 + ], + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 17 + } + } + } + ], + "range": [ + 146, + 854 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 41, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 121, + 854 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 41, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 114, + 854 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 41, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 854 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 41, + "column": 1 + } + }, + "comments": [ + { + "type": "Block", + "value": "\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n ", + "range": [ + 259, + 496 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", + "range": [ + 604, + 815 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 36, + "column": 3 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/insertion/insert_case5.js.json b/ast/source/insertion/insert_case5.js.json new file mode 100644 index 0000000..f2a10dd --- /dev/null +++ b/ast/source/insertion/insert_case5.js.json @@ -0,0 +1,1068 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + "range": [ + 10, + 13 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "range": [ + 16, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + "range": [ + 24, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + "range": [ + 38, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 53, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 63 + } + } + }, + "imported": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 53, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 63 + } + } + }, + "range": [ + 53, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 52 + }, + "end": { + "line": 2, + "column": 63 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 72, + 76 + ], + "loc": { + "start": { + "line": 2, + "column": 71 + }, + "end": { + "line": 2, + "column": 75 + } + } + }, + "range": [ + 1, + 78 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 77 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "insert_case5", + "range": [ + 96, + 108 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 109, + 110 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "g", + "range": [ + 121, + 122 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 125, + 136 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 137, + 138 + ], + "loc": { + "start": { + "line": 6, + "column": 23 + }, + "end": { + "line": 6, + "column": 24 + } + } + } + ], + "range": [ + 125, + 139 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 121, + 139 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 25 + } + } + } + ], + "kind": "const", + "range": [ + 115, + 140 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 26 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 145, + 151 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "range": [ + 143, + 151 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 152, + 157 + ], + "loc": { + "start": { + "line": 8, + "column": 10 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + "range": [ + 143, + 157 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 160, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 18 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "range": [ + 143, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + "range": [ + 143, + 166 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "g", + "range": [ + 168, + 169 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 170, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "range": [ + 168, + 175 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 178, + 181 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + "range": [ + 168, + 181 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + "range": [ + 168, + 182 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 188, + 189 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 194, + 195 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 196, + 202 + ], + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "range": [ + 194, + 202 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 203, + 207 + ], + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "range": [ + 194, + 207 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "range": [ + 188, + 207 + ], + "loc": { + "start": { + "line": 10, + "column": 5 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 211, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "g", + "range": [ + 224, + 225 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 16 + } + } + } + ], + "range": [ + 211, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + "range": [ + 211, + 227 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 236, + 247 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "g", + "range": [ + 248, + 249 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 15 + } + } + } + ], + "range": [ + 236, + 250 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + "range": [ + 236, + 251 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 17 + } + } + }, + "range": [ + 184, + 251 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 13, + "column": 17 + } + } + } + ], + "range": [ + 112, + 253 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 87, + 253 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 80, + 253 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 253 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/node/Leaf.js.json b/ast/source/node/Leaf.js.json new file mode 100644 index 0000000..8bde1fa --- /dev/null +++ b/ast/source/node/Leaf.js.json @@ -0,0 +1,639 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 22, + 26 + ], + "loc": { + "start": { + "line": 1, + "column": 22 + }, + "end": { + "line": 1, + "column": 26 + } + } + }, + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "Leaf", + "range": [ + 46, + 50 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "parent", + "range": [ + 53, + 59 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 29 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 65, + 69 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 70, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 65, + 75 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 78, + 83 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "range": [ + 65, + 83 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "range": [ + 65, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 87, + 91 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 92, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "range": [ + 87, + 98 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + "right": { + "type": "Identifier", + "name": "parent", + "range": [ + 101, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 87, + 107 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 87, + 109 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 23 + } + } + } + ], + "range": [ + 62, + 111 + ], + "loc": { + "start": { + "line": 3, + "column": 32 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 37, + 111 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 30, + 111 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Leaf", + "range": [ + 113, + 117 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 4 + } + } + }, + "property": { + "type": "Identifier", + "name": "prototype", + "range": [ + 118, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 5 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "range": [ + 113, + 127 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 128, + 134 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "range": [ + 113, + 134 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "right": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 128, + 134 + ], + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 159, + 163 + ], + "loc": { + "start": { + "line": 8, + "column": 46 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + "range": [ + 152, + 165 + ], + "loc": { + "start": { + "line": 8, + "column": 39 + }, + "end": { + "line": 8, + "column": 52 + } + } + } + ], + "range": [ + 150, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 37 + }, + "end": { + "line": 8, + "column": 54 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 137, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 54 + } + } + }, + "range": [ + 113, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 54 + } + } + }, + "range": [ + 113, + 169 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 56 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 169 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 56 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/node/Node.js.json b/ast/source/node/Node.js.json new file mode 100644 index 0000000..9538223 --- /dev/null +++ b/ast/source/node/Node.js.json @@ -0,0 +1,1048 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "Leaf", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "imported": { + "type": "Identifier", + "name": "Leaf", + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + "range": [ + 9, + 13 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 13 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./Leaf", + "raw": "'./Leaf'", + "range": [ + 21, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 21 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "Node", + "range": [ + 49, + 53 + ], + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 20 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "color", + "range": [ + 56, + 61 + ], + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "value", + "range": [ + 64, + 69 + ], + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 36 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 75, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 80, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "range": [ + 75, + 85 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + "right": { + "type": "Identifier", + "name": "color", + "range": [ + 88, + 93 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "range": [ + 75, + 93 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + "range": [ + 75, + 95 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 97, + 101 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 102, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 6 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "range": [ + 97, + 106 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + }, + "right": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Leaf", + "range": [ + 113, + 117 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 119, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 23 + }, + "end": { + "line": 5, + "column": 27 + } + } + } + ], + "range": [ + 109, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "range": [ + 97, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 29 + } + } + }, + "range": [ + 97, + 127 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 129, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 134, + 139 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "range": [ + 129, + 139 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 11 + } + } + }, + "right": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "Leaf", + "range": [ + 146, + 150 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + "arguments": [ + { + "type": "ThisExpression", + "range": [ + 152, + 156 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 28 + } + } + } + ], + "range": [ + 142, + 158 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + "range": [ + 129, + 158 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + "range": [ + 129, + 160 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 162, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 167, + 173 + ], + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + "range": [ + 162, + 173 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 176, + 180 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 162, + 180 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + "range": [ + 162, + 182 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 184, + 188 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 5 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 189, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + "range": [ + 184, + 194 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 11 + } + } + }, + "right": { + "type": "Identifier", + "name": "value", + "range": [ + 197, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 184, + 202 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 184, + 204 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 21 + } + } + } + ], + "range": [ + 72, + 206 + ], + "loc": { + "start": { + "line": 3, + "column": 39 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 40, + 206 + ], + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 9, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 33, + 206 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 1 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Node", + "range": [ + 208, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 4 + } + } + }, + "property": { + "type": "Identifier", + "name": "prototype", + "range": [ + 213, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "range": [ + 208, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 223, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 21 + } + } + }, + "range": [ + 208, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 21 + } + } + }, + "right": { + "type": "FunctionExpression", + "id": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 223, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 21 + } + } + }, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": false, + "raw": "false", + "range": [ + 254, + 259 + ], + "loc": { + "start": { + "line": 11, + "column": 46 + }, + "end": { + "line": 11, + "column": 51 + } + } + }, + "range": [ + 247, + 261 + ], + "loc": { + "start": { + "line": 11, + "column": 39 + }, + "end": { + "line": 11, + "column": 53 + } + } + } + ], + "range": [ + 245, + 263 + ], + "loc": { + "start": { + "line": 11, + "column": 37 + }, + "end": { + "line": 11, + "column": 55 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 232, + 263 + ], + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 55 + } + } + }, + "range": [ + 208, + 263 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 55 + } + } + }, + "range": [ + 208, + 265 + ], + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 57 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 265 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 11, + "column": 57 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/node/index.js.json b/ast/source/node/index.js.json new file mode 100644 index 0000000..4ff3703 --- /dev/null +++ b/ast/source/node/index.js.json @@ -0,0 +1,93 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./Leaf", + "raw": "'./Leaf'", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./Node", + "raw": "'./Node'", + "range": [ + 39, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 25, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/removal/delete_case1.js.json b/ast/source/removal/delete_case1.js.json new file mode 100644 index 0000000..48afdb5 --- /dev/null +++ b/ast/source/removal/delete_case1.js.json @@ -0,0 +1,390 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case2", + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case2", + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 21 + } + } + }, + "range": [ + 10, + 22 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case2", + "raw": "'./delete_case2'", + "range": [ + 30, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 29 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "range": [ + 1, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "delete_case1", + "range": [ + 66, + 78 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 79, + 80 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 89, + 90 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 91, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "range": [ + 89, + 97 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 102, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 18 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + "range": [ + 89, + 106 + ], + "loc": { + "start": { + "line": 6, + "column": 5 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case2", + "range": [ + 110, + 122 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 123, + 124 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 16 + } + } + } + ], + "range": [ + 110, + 125 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "range": [ + 110, + 126 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + "alternate": null, + "range": [ + 85, + 126 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 7, + "column": 18 + } + } + } + ], + "range": [ + 82, + 128 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 57, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 8, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 50, + 128 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 128 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 8, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/removal/delete_case2.js.json b/ast/source/removal/delete_case2.js.json new file mode 100644 index 0000000..d205034 --- /dev/null +++ b/ast/source/removal/delete_case2.js.json @@ -0,0 +1,1377 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 23, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 23, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 23, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 37, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 37, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 49 + } + } + }, + "range": [ + 37, + 49 + ], + "loc": { + "start": { + "line": 1, + "column": 37 + }, + "end": { + "line": 1, + "column": 49 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 57, + 61 + ], + "loc": { + "start": { + "line": 1, + "column": 57 + }, + "end": { + "line": 1, + "column": 61 + } + } + }, + "range": [ + 0, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 63 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case3", + "range": [ + 74, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case3", + "range": [ + 74, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 74, + 86 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case3", + "raw": "'./delete_case3'", + "range": [ + 94, + 110 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 65, + 112 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "delete_case2", + "range": [ + 130, + 142 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 143, + 144 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "s", + "range": [ + 155, + 156 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sibling", + "range": [ + 159, + 166 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 167, + 168 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 159, + 169 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 155, + 169 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 21 + } + } + } + ], + "kind": "const", + "range": [ + 149, + 170 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 177, + 178 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 179, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "range": [ + 177, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 12 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 189, + 192 + ], + "loc": { + "start": { + "line": 9, + "column": 17 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "range": [ + 177, + 192 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 200, + 206 + ], + "loc": { + "start": { + "line": 10, + "column": 4 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "range": [ + 198, + 206 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 207, + 212 + ], + "loc": { + "start": { + "line": 10, + "column": 11 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "range": [ + 198, + 212 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 16 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 215, + 218 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + "range": [ + 198, + 218 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 22 + } + } + }, + "range": [ + 198, + 219 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 222, + 223 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 224, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + "range": [ + 222, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 232, + 237 + ], + "loc": { + "start": { + "line": 11, + "column": 12 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + "range": [ + 222, + 237 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + "range": [ + 222, + 238 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 245, + 246 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 253, + 259 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + "range": [ + 251, + 259 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 260, + 264 + ], + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "range": [ + 251, + 264 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "range": [ + 245, + 264 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 269, + 280 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 281, + 282 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 283, + 289 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + "range": [ + 281, + 289 + ], + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 23 + } + } + } + ], + "range": [ + 269, + 290 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + "range": [ + 269, + 291 + ], + "loc": { + "start": { + "line": 13, + "column": 3 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 302, + 314 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 315, + 316 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 317, + 323 + ], + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + "range": [ + 315, + 323 + ], + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 24 + } + } + } + ], + "range": [ + 302, + 324 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + "range": [ + 302, + 325 + ], + "loc": { + "start": { + "line": 15, + "column": 3 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + "range": [ + 241, + 325 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 15, + "column": 26 + } + } + } + ], + "range": [ + 194, + 328 + ], + "loc": { + "start": { + "line": 9, + "column": 22 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + "alternate": null, + "range": [ + 173, + 328 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 16, + "column": 2 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case3", + "range": [ + 330, + 342 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 343, + 344 + ], + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 15 + } + } + } + ], + "range": [ + 330, + 345 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 16 + } + } + }, + "range": [ + 330, + 346 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 17 + } + } + } + ], + "range": [ + 146, + 348 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 121, + 348 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 114, + 348 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 348 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/removal/delete_case3.js.json b/ast/source/removal/delete_case3.js.json new file mode 100644 index 0000000..ee32d66 --- /dev/null +++ b/ast/source/removal/delete_case3.js.json @@ -0,0 +1,1452 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "sibling", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "imported": { + "type": "Identifier", + "name": "sibling", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 39, + 43 + ], + "loc": { + "start": { + "line": 2, + "column": 38 + }, + "end": { + "line": 2, + "column": 42 + } + } + }, + "range": [ + 1, + 45 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 44 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case1", + "range": [ + 56, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case1", + "range": [ + 56, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 56, + 68 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case1", + "raw": "'./delete_case1'", + "range": [ + 76, + 92 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 45 + } + } + }, + "range": [ + 47, + 94 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 47 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case4", + "range": [ + 104, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case4", + "range": [ + 104, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 21 + } + } + }, + "range": [ + 104, + 116 + ], + "loc": { + "start": { + "line": 5, + "column": 9 + }, + "end": { + "line": 5, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case4", + "raw": "'./delete_case4'", + "range": [ + 124, + 140 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 45 + } + } + }, + "range": [ + 95, + 142 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "delete_case3", + "range": [ + 160, + 172 + ], + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 173, + 174 + ], + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "s", + "range": [ + 185, + 186 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sibling", + "range": [ + 189, + 196 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 197, + 198 + ], + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 20 + } + } + } + ], + "range": [ + 189, + 199 + ], + "loc": { + "start": { + "line": 9, + "column": 11 + }, + "end": { + "line": 9, + "column": 21 + } + } + }, + "range": [ + 185, + 199 + ], + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 21 + } + } + } + ], + "kind": "const", + "range": [ + 179, + 200 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 22 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 208, + 209 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 210, + 216 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "range": [ + 208, + 216 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 217, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + "range": [ + 208, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 227, + 232 + ], + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 30 + } + } + }, + "range": [ + 208, + 232 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 30 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 245, + 250 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + "range": [ + 243, + 250 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 255, + 260 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + "range": [ + 243, + 260 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + "range": [ + 207, + 261 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 271, + 272 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 273, + 277 + ], + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + "range": [ + 271, + 277 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 278, + 283 + ], + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "range": [ + 271, + 283 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 28 + } + } + }, + "range": [ + 271, + 293 + ], + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 28 + } + } + }, + "range": [ + 207, + 294 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 13, + "column": 29 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 304, + 305 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 306, + 311 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "range": [ + 304, + 311 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 312, + 317 + ], + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 19 + } + } + }, + "range": [ + 304, + 317 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 19 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 322, + 327 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + "range": [ + 304, + 327 + ], + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + "range": [ + 207, + 328 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 334, + 335 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 336, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + "range": [ + 334, + 341 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 344, + 347 + ], + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + "range": [ + 334, + 347 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + "range": [ + 334, + 348 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case1", + "range": [ + 351, + 363 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 364, + 365 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 366, + 372 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 23 + } + } + }, + "range": [ + 364, + 372 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 23 + } + } + } + ], + "range": [ + 351, + 373 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + "range": [ + 351, + 374 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 25 + } + } + } + ], + "range": [ + 330, + 377 + ], + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case4", + "range": [ + 385, + 397 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 398, + 399 + ], + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 16 + } + } + } + ], + "range": [ + 385, + 400 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 17 + } + } + }, + "range": [ + 385, + 401 + ], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + "range": [ + 203, + 401 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 18, + "column": 18 + } + } + } + ], + "range": [ + 176, + 403 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 19, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 151, + 403 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 19, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 144, + 403 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 19, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 403 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 19, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/removal/delete_case4.js.json b/ast/source/removal/delete_case4.js.json new file mode 100644 index 0000000..a3767d2 --- /dev/null +++ b/ast/source/removal/delete_case4.js.json @@ -0,0 +1,1396 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "sibling", + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "imported": { + "type": "Identifier", + "name": "sibling", + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 38, + 42 + ], + "loc": { + "start": { + "line": 1, + "column": 38 + }, + "end": { + "line": 1, + "column": 42 + } + } + }, + "range": [ + 0, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case5", + "range": [ + 55, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case5", + "range": [ + 55, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 55, + 67 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case5", + "raw": "'./delete_case5'", + "range": [ + 75, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 46, + 93 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "delete_case4", + "range": [ + 111, + 123 + ], + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 124, + 125 + ], + "loc": { + "start": { + "line": 5, + "column": 29 + }, + "end": { + "line": 5, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "s", + "range": [ + 136, + 137 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sibling", + "range": [ + 140, + 147 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 20 + } + } + } + ], + "range": [ + 140, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 21 + } + } + }, + "range": [ + 136, + 150 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 21 + } + } + } + ], + "kind": "const", + "range": [ + 130, + 151 + ], + "loc": { + "start": { + "line": 7, + "column": 1 + }, + "end": { + "line": 7, + "column": 22 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 159, + 160 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 161, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + "range": [ + 159, + 167 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 168, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "range": [ + 159, + 173 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 178, + 181 + ], + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "range": [ + 159, + 181 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 28 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 194, + 199 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "range": [ + 192, + 199 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 204, + 209 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + "range": [ + 192, + 209 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + "range": [ + 158, + 210 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 220, + 221 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 222, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "range": [ + 220, + 226 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 227, + 232 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "range": [ + 220, + 232 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 237, + 242 + ], + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + "range": [ + 220, + 242 + ], + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + "range": [ + 158, + 243 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 253, + 254 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 255, + 260 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + "range": [ + 253, + 260 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 261, + 266 + ], + "loc": { + "start": { + "line": 12, + "column": 14 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "range": [ + 253, + 266 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 19 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 271, + 276 + ], + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "range": [ + 253, + 276 + ], + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + "range": [ + 158, + 277 + ], + "loc": { + "start": { + "line": 9, + "column": 5 + }, + "end": { + "line": 12, + "column": 30 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 285, + 290 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + "range": [ + 283, + 290 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 293, + 296 + ], + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "range": [ + 283, + 296 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "range": [ + 283, + 297 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 300, + 301 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 302, + 308 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "range": [ + 300, + 308 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 309, + 314 + ], + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "range": [ + 300, + 314 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 16 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 317, + 322 + ], + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "range": [ + 300, + 322 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + "range": [ + 300, + 323 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 25 + } + } + } + ], + "range": [ + 279, + 326 + ], + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case5", + "range": [ + 334, + 346 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 347, + 348 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 16 + } + } + } + ], + "range": [ + 334, + 349 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 17 + } + } + }, + "range": [ + 334, + 350 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + "range": [ + 154, + 350 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 16, + "column": 18 + } + } + } + ], + "range": [ + 127, + 352 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 17, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 102, + 352 + ], + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 17, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 95, + 352 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 17, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 352 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 17, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/removal/delete_case5.js.json b/ast/source/removal/delete_case5.js.json new file mode 100644 index 0000000..3fc821e --- /dev/null +++ b/ast/source/removal/delete_case5.js.json @@ -0,0 +1,2517 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "sibling", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "imported": { + "type": "Identifier", + "name": "sibling", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 34, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 34, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "range": [ + 34, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 49, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 49, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + "range": [ + 49, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 59 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 68, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 67 + }, + "end": { + "line": 2, + "column": 71 + } + } + }, + "range": [ + 1, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 73 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case6", + "range": [ + 85, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case6", + "range": [ + 85, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 85, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case6", + "raw": "'./delete_case6'", + "range": [ + 105, + 121 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 45 + } + } + }, + "range": [ + 76, + 123 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "delete_case5", + "range": [ + 141, + 153 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 154, + 155 + ], + "loc": { + "start": { + "line": 6, + "column": 29 + }, + "end": { + "line": 6, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "s", + "range": [ + 166, + 167 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sibling", + "range": [ + 170, + 177 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 178, + 179 + ], + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 20 + } + } + } + ], + "range": [ + 170, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + "range": [ + 166, + 180 + ], + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 21 + } + } + } + ], + "kind": "const", + "range": [ + 160, + 181 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 22 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 189, + 190 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 191, + 196 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "range": [ + 189, + 196 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 201, + 206 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + "range": [ + 189, + 206 + ], + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 562, + 563 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 568, + 569 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 570, + 576 + ], + "loc": { + "start": { + "line": 15, + "column": 15 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + "range": [ + 568, + 576 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 577, + 581 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + "range": [ + 568, + 581 + ], + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + "range": [ + 562, + 581 + ], + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 593, + 594 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 595, + 600 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "range": [ + 593, + 600 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 601, + 606 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + "range": [ + 593, + 606 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 611, + 616 + ], + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 30 + } + } + }, + "range": [ + 593, + 616 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 30 + } + } + }, + "range": [ + 561, + 617 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 16, + "column": 31 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 628, + 629 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 630, + 634 + ], + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "range": [ + 628, + 634 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 635, + 640 + ], + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 19 + } + } + }, + "range": [ + 628, + 640 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 19 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 645, + 648 + ], + "loc": { + "start": { + "line": 17, + "column": 24 + }, + "end": { + "line": 17, + "column": 27 + } + } + }, + "range": [ + 628, + 648 + ], + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 27 + } + } + }, + "range": [ + 561, + 649 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 17, + "column": 28 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 710, + 711 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 4 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 712, + 717 + ], + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + "range": [ + 710, + 717 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 720, + 723 + ], + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + "range": [ + 710, + 723 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + "range": [ + 710, + 724 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 17 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " this last test is trivial too due to cases 2-4. ", + "range": [ + 653, + 706 + ], + "loc": { + "start": { + "line": 17, + "column": 32 + }, + "end": { + "line": 17, + "column": 85 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 728, + 729 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 730, + 734 + ], + "loc": { + "start": { + "line": 19, + "column": 5 + }, + "end": { + "line": 19, + "column": 9 + } + } + }, + "range": [ + 728, + 734 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 735, + 740 + ], + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + "range": [ + 728, + 740 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 743, + 748 + ], + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "range": [ + 728, + 748 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + "range": [ + 728, + 749 + ], + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 753, + 765 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 15 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "s", + "range": [ + 766, + 767 + ], + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 17 + } + } + } + ], + "range": [ + 753, + 768 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 18 + } + } + }, + "range": [ + 753, + 769 + ], + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 19 + } + } + } + ], + "range": [ + 651, + 773 + ], + "loc": { + "start": { + "line": 17, + "column": 30 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 784, + 785 + ], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 15 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 790, + 791 + ], + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 792, + 798 + ], + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 28 + } + } + }, + "range": [ + 790, + 798 + ], + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 28 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 799, + 804 + ], + "loc": { + "start": { + "line": 21, + "column": 29 + }, + "end": { + "line": 21, + "column": 34 + } + } + }, + "range": [ + 790, + 804 + ], + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 34 + } + } + }, + "range": [ + 784, + 804 + ], + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 34 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 823, + 824 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 825, + 829 + ], + "loc": { + "start": { + "line": 22, + "column": 16 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "range": [ + 823, + 829 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 830, + 835 + ], + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + "range": [ + 823, + 835 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 840, + 845 + ], + "loc": { + "start": { + "line": 22, + "column": 31 + }, + "end": { + "line": 22, + "column": 36 + } + } + }, + "range": [ + 823, + 845 + ], + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 36 + } + } + }, + "range": [ + 783, + 846 + ], + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 22, + "column": 37 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 864, + 865 + ], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 866, + 871 + ], + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "range": [ + 864, + 871 + ], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 872, + 877 + ], + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, + "range": [ + 864, + 877 + ], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 882, + 885 + ], + "loc": { + "start": { + "line": 23, + "column": 32 + }, + "end": { + "line": 23, + "column": 35 + } + } + }, + "range": [ + 864, + 885 + ], + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 35 + } + } + }, + "range": [ + 783, + 886 + ], + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 23, + "column": 36 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 946, + 947 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 4 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 948, + 953 + ], + "loc": { + "start": { + "line": 24, + "column": 5 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + "range": [ + 946, + 953 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 956, + 959 + ], + "loc": { + "start": { + "line": 24, + "column": 13 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + "range": [ + 946, + 959 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + "range": [ + 946, + 960 + ], + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 17 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " this last test is trivial too due to cases 2-4. ", + "range": [ + 889, + 942 + ], + "loc": { + "start": { + "line": 23, + "column": 39 + }, + "end": { + "line": 23, + "column": 92 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 964, + 965 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 4 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 966, + 971 + ], + "loc": { + "start": { + "line": 25, + "column": 5 + }, + "end": { + "line": 25, + "column": 10 + } + } + }, + "range": [ + 964, + 971 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 972, + 977 + ], + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 16 + } + } + }, + "range": [ + 964, + 977 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 16 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 980, + 985 + ], + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + "range": [ + 964, + 985 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + "range": [ + 964, + 986 + ], + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 990, + 1001 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "s", + "range": [ + 1002, + 1003 + ], + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 16 + } + } + } + ], + "range": [ + 990, + 1004 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 17 + } + } + }, + "range": [ + 990, + 1005 + ], + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 18 + } + } + } + ], + "range": [ + 888, + 1009 + ], + "loc": { + "start": { + "line": 23, + "column": 38 + }, + "end": { + "line": 27, + "column": 3 + } + } + }, + "alternate": null, + "range": [ + 779, + 1009 + ], + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 27, + "column": 3 + } + } + }, + "range": [ + 557, + 1009 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 27, + "column": 3 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": " this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). ", + "range": [ + 210, + 398 + ], + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 12, + "column": 79 + } + } + }, + { + "type": "Block", + "value": " the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. ", + "range": [ + 399, + 554 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 14, + "column": 63 + } + } + } + ] + } + ], + "range": [ + 208, + 1012 + ], + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + "alternate": null, + "range": [ + 184, + 1012 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case6", + "range": [ + 1014, + 1026 + ], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 1027, + 1028 + ], + "loc": { + "start": { + "line": 29, + "column": 14 + }, + "end": { + "line": 29, + "column": 15 + } + } + } + ], + "range": [ + 1014, + 1029 + ], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 16 + } + } + }, + "range": [ + 1014, + 1030 + ], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 17 + } + } + } + ], + "range": [ + 157, + 1032 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 132, + 1032 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 30, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 125, + 1032 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 1032 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 30, + "column": 1 + } + }, + "comments": [ + { + "type": "Block", + "value": " this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). ", + "range": [ + 210, + 398 + ], + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 12, + "column": 79 + } + } + }, + { + "type": "Block", + "value": " the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. ", + "range": [ + 399, + 554 + ], + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 14, + "column": 63 + } + } + }, + { + "type": "Block", + "value": " this last test is trivial too due to cases 2-4. ", + "range": [ + 653, + 706 + ], + "loc": { + "start": { + "line": 17, + "column": 32 + }, + "end": { + "line": 17, + "column": 85 + } + } + }, + { + "type": "Block", + "value": " this last test is trivial too due to cases 2-4. ", + "range": [ + 889, + 942 + ], + "loc": { + "start": { + "line": 23, + "column": 39 + }, + "end": { + "line": 23, + "column": 92 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/removal/delete_case6.js.json b/ast/source/removal/delete_case6.js.json new file mode 100644 index 0000000..d50f2cf --- /dev/null +++ b/ast/source/removal/delete_case6.js.json @@ -0,0 +1,1536 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "sibling", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "imported": { + "type": "Identifier", + "name": "sibling", + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 24, + 31 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 34, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 34, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + "range": [ + 34, + 46 + ], + "loc": { + "start": { + "line": 2, + "column": 33 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 49, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 49, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 59 + } + } + }, + "range": [ + 49, + 60 + ], + "loc": { + "start": { + "line": 2, + "column": 48 + }, + "end": { + "line": 2, + "column": 59 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 68, + 72 + ], + "loc": { + "start": { + "line": 2, + "column": 67 + }, + "end": { + "line": 2, + "column": 71 + } + } + }, + "range": [ + 1, + 74 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 73 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "delete_case6", + "range": [ + 92, + 104 + ], + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 105, + 106 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 30 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "s", + "range": [ + 117, + 118 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sibling", + "range": [ + 121, + 128 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 129, + 130 + ], + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 20 + } + } + } + ], + "range": [ + 121, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "range": [ + 117, + 131 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 21 + } + } + } + ], + "kind": "const", + "range": [ + 111, + 132 + ], + "loc": { + "start": { + "line": 6, + "column": 1 + }, + "end": { + "line": 6, + "column": 22 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 135, + 136 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 137, + 142 + ], + "loc": { + "start": { + "line": 8, + "column": 3 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + "range": [ + 135, + 142 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 145, + 146 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 147, + 153 + ], + "loc": { + "start": { + "line": 8, + "column": 13 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "range": [ + 145, + 153 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 154, + 159 + ], + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + "range": [ + 145, + 159 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + "range": [ + 135, + 159 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 25 + } + } + }, + "range": [ + 135, + 160 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 162, + 163 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 2 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 164, + 170 + ], + "loc": { + "start": { + "line": 9, + "column": 3 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "range": [ + 162, + 170 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 171, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 10 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + "range": [ + 162, + 176 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 179, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 18 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + "range": [ + 162, + 184 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + "range": [ + 162, + 185 + ], + "loc": { + "start": { + "line": 9, + "column": 1 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 192, + 193 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 198, + 199 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 200, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + "range": [ + 198, + 206 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 207, + 211 + ], + "loc": { + "start": { + "line": 11, + "column": 20 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + "range": [ + 198, + 211 + ], + "loc": { + "start": { + "line": 11, + "column": 11 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + "range": [ + 192, + 211 + ], + "loc": { + "start": { + "line": 11, + "column": 5 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 217, + 218 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 219, + 224 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "range": [ + 217, + 224 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 225, + 230 + ], + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + "range": [ + 217, + 230 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 233, + 238 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + "range": [ + 217, + 238 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + "range": [ + 217, + 239 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 242, + 253 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 254, + 255 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 256, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + "range": [ + 254, + 262 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + ], + "range": [ + 242, + 263 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + "range": [ + 242, + 264 + ], + "loc": { + "start": { + "line": 13, + "column": 2 + }, + "end": { + "line": 13, + "column": 24 + } + } + } + ], + "range": [ + 213, + 267 + ], + "loc": { + "start": { + "line": 11, + "column": 26 + }, + "end": { + "line": 14, + "column": 2 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 277, + 278 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 279, + 283 + ], + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + "range": [ + 277, + 283 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 284, + 289 + ], + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "range": [ + 277, + 289 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 292, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + "range": [ + 277, + 297 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + "range": [ + 277, + 298 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 301, + 313 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 314, + 315 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 316, + 322 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 23 + } + } + }, + "range": [ + 314, + 322 + ], + "loc": { + "start": { + "line": 16, + "column": 15 + }, + "end": { + "line": 16, + "column": 23 + } + } + } + ], + "range": [ + 301, + 323 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + "range": [ + 301, + 324 + ], + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 25 + } + } + } + ], + "range": [ + 273, + 327 + ], + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 17, + "column": 2 + } + } + }, + "range": [ + 188, + 327 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 17, + "column": 2 + } + } + } + ], + "range": [ + 108, + 329 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 83, + 329 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 76, + 329 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 329 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 18, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/removal/delete_one_child.js.json b/ast/source/removal/delete_one_child.js.json new file mode 100644 index 0000000..7b6b56a --- /dev/null +++ b/ast/source/removal/delete_one_child.js.json @@ -0,0 +1,1236 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + "range": [ + 18, + 21 + ], + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "replace_node", + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + "imported": { + "type": "Identifier", + "name": "replace_node", + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + "range": [ + 24, + 36 + ], + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 35 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 2, + "column": 43 + }, + "end": { + "line": 2, + "column": 47 + } + } + }, + "range": [ + 1, + 50 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 49 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case1", + "range": [ + 61, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case1", + "range": [ + 61, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 61, + 73 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case1", + "raw": "'./delete_case1'", + "range": [ + 81, + 97 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 45 + } + } + }, + "range": [ + 52, + 99 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 47 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "delete_one_child", + "range": [ + 117, + 133 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 134, + 135 + ], + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 6, + "column": 34 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "child", + "range": [ + 207, + 212 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "init": { + "type": "ConditionalExpression", + "test": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 215, + 216 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 217, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 22 + } + } + }, + "range": [ + 215, + 222 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 223, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + "range": [ + 215, + 229 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + "arguments": [], + "range": [ + 215, + 231 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + "consequent": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 234, + 235 + ], + "loc": { + "start": { + "line": 11, + "column": 34 + }, + "end": { + "line": 11, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 236, + 240 + ], + "loc": { + "start": { + "line": 11, + "column": 36 + }, + "end": { + "line": 11, + "column": 40 + } + } + }, + "range": [ + 234, + 240 + ], + "loc": { + "start": { + "line": 11, + "column": 34 + }, + "end": { + "line": 11, + "column": 40 + } + } + }, + "alternate": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 243, + 244 + ], + "loc": { + "start": { + "line": 11, + "column": 43 + }, + "end": { + "line": 11, + "column": 44 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 245, + 250 + ], + "loc": { + "start": { + "line": 11, + "column": 45 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "range": [ + 243, + 250 + ], + "loc": { + "start": { + "line": 11, + "column": 43 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "range": [ + 215, + 250 + ], + "loc": { + "start": { + "line": 11, + "column": 15 + }, + "end": { + "line": 11, + "column": 50 + } + } + }, + "range": [ + 207, + 250 + ], + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 50 + } + } + } + ], + "kind": "const", + "range": [ + 201, + 251 + ], + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 51 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "\n * Precondition: n has at most one non-leaf child.\n ", + "range": [ + 140, + 199 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 10, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "replace_node", + "range": [ + 254, + 266 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 267, + 268 + ], + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": "Identifier", + "name": "child", + "range": [ + 270, + 275 + ], + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 22 + } + } + } + ], + "range": [ + 254, + 276 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + "range": [ + 254, + 277 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 283, + 284 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 285, + 290 + ], + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + "range": [ + 283, + 290 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 12 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 295, + 300 + ], + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + "range": [ + 283, + 300 + ], + "loc": { + "start": { + "line": 14, + "column": 5 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "child", + "range": [ + 310, + 315 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 316, + 321 + ], + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + "range": [ + 310, + 321 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 326, + 329 + ], + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + "range": [ + 310, + 329 + ], + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "child", + "range": [ + 334, + 339 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 340, + 345 + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "range": [ + 334, + 345 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 14 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 348, + 353 + ], + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 22 + } + } + }, + "range": [ + 334, + 353 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 22 + } + } + }, + "range": [ + 334, + 354 + ], + "loc": { + "start": { + "line": 16, + "column": 3 + }, + "end": { + "line": 16, + "column": 23 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case1", + "range": [ + 365, + 377 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "child", + "range": [ + 378, + 383 + ], + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 21 + } + } + } + ], + "range": [ + 365, + 384 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + "range": [ + 365, + 385 + ], + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 23 + } + } + }, + "range": [ + 306, + 385 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 18, + "column": 23 + } + } + } + ], + "range": [ + 302, + 388 + ], + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + "alternate": null, + "range": [ + 279, + 388 + ], + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + } + ], + "range": [ + 137, + 390 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 108, + 390 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 101, + 390 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 20, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 390 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "comments": [ + { + "type": "Block", + "value": "\n * Precondition: n has at most one non-leaf child.\n ", + "range": [ + 140, + 199 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 10, + "column": 4 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/removal/index.js.json b/ast/source/removal/index.js.json new file mode 100644 index 0000000..661813b --- /dev/null +++ b/ast/source/removal/index.js.json @@ -0,0 +1,273 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./delete_case1", + "raw": "'./delete_case1'", + "range": [ + 14, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 0, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./delete_case2", + "raw": "'./delete_case2'", + "range": [ + 47, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 33, + 65 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./delete_case3", + "raw": "'./delete_case3'", + "range": [ + 80, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "range": [ + 66, + 98 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./delete_case4", + "raw": "'./delete_case4'", + "range": [ + 113, + 129 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + "range": [ + 99, + 131 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./delete_case5", + "raw": "'./delete_case5'", + "range": [ + 146, + 162 + ], + "loc": { + "start": { + "line": 5, + "column": 14 + }, + "end": { + "line": 5, + "column": 30 + } + } + }, + "range": [ + 132, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./delete_case6", + "raw": "'./delete_case6'", + "range": [ + 179, + 195 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + "range": [ + 165, + 197 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./delete_one_child", + "raw": "'./delete_one_child'", + "range": [ + 212, + 232 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 34 + } + } + }, + "range": [ + 198, + 234 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 36 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 234 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 36 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/badge.svg b/badge.svg new file mode 100644 index 0000000..d1289c0 --- /dev/null +++ b/badge.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + document + document + 5% + 5% + + diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/adt/RedBlackTree.js~RedBlackTree.html new file mode 100644 index 0000000..37020e4 --- /dev/null +++ b/class/src/adt/RedBlackTree.js~RedBlackTree.html @@ -0,0 +1,687 @@ + + + + + + RedBlackTree | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +
+ + public + class + + + + | source +
+ +
+

RedBlackTree

+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + +

Constructor Summary

+ + + + + + + + + +
Public Constructor
+ public + + + + + +
+

+ constructor(compare: *) +

+
+
+ + + +
+
+ + +
+
+

Member Summary

+ + + + + + + + + + + + + + +
Public Members
+ public + + + + + +
+

+ compare: * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ root: * +

+
+
+ + + +
+
+ + +
+
+

Method Summary

+ + + + + + + + + + + + + + + + + + + + + + + + +
Public Methods
+ public + + + + + +
+

+ * [Symbol.iterator]() +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ add(value: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete(node: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ find(value: *): * +

+
+
+ + + +
+
+ + +
+
+ + + + + +

Public Constructors

+ +
+

+ public + + + + + constructor(compare: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
compare*
+
+
+ + + + + + + + + + + + + + + +
+
+

Public Members

+ +
+

+ public + + + + + compare: * + + + + source + +

+ + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + root: * + + + + source + +

+ + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+
+

Public Methods

+ +
+

+ public + + + + * + [Symbol.iterator]() + + + + source + +

+ + + + + + + + +
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + add(value: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
value*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + delete(node: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
node*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + find(value: *): * + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
value*
+
+
+ +
+

Return:

+ + + + + +
*
+
+
+
+ + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + diff --git a/coverage.json b/coverage.json new file mode 100644 index 0000000..c62df6e --- /dev/null +++ b/coverage.json @@ -0,0 +1,200 @@ +{ + "coverage": "5.71%", + "expectCount": 35, + "actualCount": 2, + "files": { + "src/base/colors.js": { + "expectCount": 2, + "actualCount": 0, + "undocumentLines": [ + 1, + 2 + ] + }, + "src/node/Leaf.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 3 + ] + }, + "src/node/Node.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 3 + ] + }, + "src/adt/RedBlackTree.js": { + "expectCount": 8, + "actualCount": 0, + "undocumentLines": [ + 10, + 66, + 19, + 14, + 12, + 38, + 30, + 15 + ] + }, + "src/removal/delete_case1.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 4 + ] + }, + "src/removal/delete_case2.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 5 + ] + }, + "src/removal/delete_case3.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 7 + ] + }, + "src/removal/delete_case4.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 5 + ] + }, + "src/removal/delete_case5.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 6 + ] + }, + "src/removal/delete_case6.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 4 + ] + }, + "src/removal/delete_one_child.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 6 + ] + }, + "src/base/find.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 2 + ] + }, + "src/base/grandparent.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 1 + ] + }, + "src/base/inordertraversal.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 2 + ] + }, + "src/base/insert.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 2 + ] + }, + "src/insertion/insert_case1.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 5 + ] + }, + "src/insertion/insert_case2.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 5 + ] + }, + "src/insertion/insert_case3.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 5 + ] + }, + "src/insertion/insert_case4.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 5 + ] + }, + "src/insertion/insert_case5.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 4 + ] + }, + "src/base/predecessor.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 1 + ] + }, + "src/base/replace_node.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 2 + ] + }, + "src/base/rotate_left.js": { + "expectCount": 1, + "actualCount": 1, + "undocumentLines": [] + }, + "src/base/rotate_right.js": { + "expectCount": 1, + "actualCount": 1, + "undocumentLines": [] + }, + "src/base/sibling.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 1 + ] + }, + "src/base/successor.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 1 + ] + }, + "src/base/uncle.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 3 + ] + } + } +} \ No newline at end of file diff --git a/css/prettify-tomorrow.css b/css/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/css/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..baf349f --- /dev/null +++ b/css/style.css @@ -0,0 +1,944 @@ +@import url(https://fonts.googleapis.com/css?family=Roboto:400,300,700); + +* { + margin: 0; + padding: 0; + text-decoration: none; +} + +html +{ + font-family: 'Roboto', sans-serif; + overflow: auto; + font-size: 14px; + /*color: #4d4e53;*/ + color: rgba(0, 0, 0, .68); + background-color: #fff; +} + +a { + /*color: #0095dd;*/ + /*color:rgb(37, 138, 175);*/ + color: #039BE5; +} + +code a:hover { + text-decoration: underline; +} + +ul, ol { + padding-left: 20px; +} + +ul li { + list-style: disc; + margin: 4px 0; +} + +ol li { + margin: 4px 0; +} + +h1 { + margin-bottom: 10px; + font-size: 34px; + font-weight: 300; + border-bottom: solid 1px #ddd; +} + +h2 { + margin-top: 24px; + margin-bottom: 10px; + font-size: 20px; + border-bottom: solid 1px #ddd; + font-weight: 300; +} + +h3 { + position: relative; + font-size: 16px; + margin-bottom: 12px; + background-color: #E2E2E2; + padding: 4px; + font-weight: 300; +} + +del { + text-decoration: line-through; +} + +p { + margin-bottom: 15px; + line-height: 1.5; +} + +p > code { + background-color: #f5f5f5; + border-radius: 3px; +} + +pre > code { + display: block; +} + +pre.prettyprint, pre > code { + padding: 4px; + margin: 1em 0; + background-color: #f5f5f5; + border-radius: 3px; +} + +pre.prettyprint > code { + margin: 0; +} + +p > code, +li > code { + padding: 0 4px; + border-radius: 3px; +} + +.import-path pre.prettyprint, +.import-path pre.prettyprint code { + margin: 0; + padding: 0; + border: none; + background: white; +} + +.layout-container { + /*display: flex;*/ + /*flex-direction: row;*/ + /*justify-content: flex-start;*/ + /*align-items: stretch;*/ +} + +.layout-container > header { + height: 40px; + line-height: 40px; + font-size: 16px; + padding: 0 10px; + margin: 0; + position: fixed; + width: 100%; + z-index: 1; + background-color: white; + top: 0; + border-bottom: solid 1px #E02130; +} +.layout-container > header > a{ + margin: 0 5px; +} + +.layout-container > header > a.repo-url-github { + font-size: 0; + display: inline-block; + width: 20px; + height: 38px; + background: url("../image/github.png") no-repeat center; + background-size: 20px; + vertical-align: top; +} + +.navigation { + position: fixed; + top: 0; + left: 0; + box-sizing: border-box; + width: 250px; + height: 100%; + padding-top: 40px; + padding-left: 15px; + padding-bottom: 2em; + margin-top:1em; + overflow-x: scroll; + box-shadow: rgba(255, 255, 255, 1) -1px 0 0 inset; + border-right: 1px solid rgba(0, 0, 0, 0.1); +} + +.navigation ul { + padding: 0; +} + +.navigation li { + list-style: none; + margin: 4px 0; + white-space: nowrap; +} + +.navigation .nav-dir-path { + margin-top: 0.7em; + margin-bottom: 0.25em; + font-size: 0.8em; + color: #aaa; +} + +.kind-class, +.kind-interface, +.kind-function, +.kind-typedef, +.kind-variable, +.kind-external { + margin-left: 0.75em; + width: 1.2em; + height: 1.2em; + display: inline-block; + text-align: center; + border-radius: 0.2em; + margin-right: 0.2em; + font-weight: bold; +} + +.kind-class { + color: #009800; + background-color: #bfe5bf; +} + +.kind-interface { + color: #fbca04; + background-color: #fef2c0; +} + +.kind-function { + color: #6b0090; + background-color: #d6bdde; +} + +.kind-variable { + color: #eb6420; + background-color: #fad8c7; +} + +.kind-typedef { + color: #db001e; + background-color: #edbec3; +} + +.kind-external { + color: #0738c3; + background-color: #bbcbea; +} + +h1 .version, +h1 .url a { + font-size: 14px; + color: #aaa; +} + +.content { + margin-top: 40px; + margin-left: 250px; + padding: 10px 50px 10px 20px; +} + +.header-notice { + font-size: 14px; + color: #aaa; + margin: 0; +} + +.expression-extends .prettyprint { + margin-left: 10px; + background: white; +} + +.extends-chain { + border-bottom: 1px solid#ddd; + padding-bottom: 10px; + margin-bottom: 10px; +} + +.extends-chain span:nth-of-type(1) { + padding-left: 10px; +} + +.extends-chain > div { + margin: 5px 0; +} + +.description table { + font-size: 14px; + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +.description thead { + background: #999; + color: white; +} + +.description table td, +.description table th { + border: solid 1px #ddd; + padding: 4px; + font-weight: normal; +} + +.flat-list ul { + padding-left: 0; +} + +.flat-list li { + display: inline; + list-style: none; +} + +table.summary { + width: 100%; + margin: 10px 0; + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +table.summary thead { + background: #999; + color: white; +} + +table.summary td { + border: solid 1px #ddd; + padding: 4px 10px; +} + +table.summary tbody td:nth-child(1) { + text-align: right; + white-space: nowrap; + min-width: 64px; + vertical-align: top; +} + +table.summary tbody td:nth-child(2) { + width: 100%; + border-right: none; +} + +table.summary tbody td:nth-child(3) { + white-space: nowrap; + border-left: none; + vertical-align: top; +} + +table.summary td > div:nth-of-type(2) { + padding-top: 4px; + padding-left: 15px; +} + +table.summary td p { + margin-bottom: 0; +} + +.inherited-summary thead td { + padding-left: 2px; +} + +.inherited-summary thead a { + color: white; +} + +.inherited-summary .summary tbody { + display: none; +} + +.inherited-summary .summary .toggle { + padding: 0 4px; + font-size: 12px; + cursor: pointer; +} +.inherited-summary .summary .toggle.closed:before { + content: "â–¶"; +} +.inherited-summary .summary .toggle.opened:before { + content: "â–¼"; +} + +.member, .method { + margin-bottom: 24px; +} + +table.params { + width: 100%; + margin: 10px 0; + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +table.params thead { + background: #eee; + color: #aaa; +} + +table.params td { + padding: 4px; + border: solid 1px #ddd; +} + +table.params td p { + margin: 0; +} + +.content .detail > * { + margin: 15px 0; +} + +.content .detail > h3 { + color: black; +} + +.content .detail > div { + margin-left: 10px; +} + +.content .detail > .import-path { + margin-top: -8px; +} + +.content .detail + .detail { + margin-top: 30px; +} + +.content .detail .throw td:first-child { + padding-right: 10px; +} + +.content .detail h4 + :not(pre) { + padding-left: 0; + margin-left: 10px; +} + +.content .detail h4 + ul li { + list-style: none; +} + +.return-param * { + display: inline; +} + +.argument-params { + margin-bottom: 20px; +} + +.return-type { + padding-right: 10px; + font-weight: normal; +} + +.return-desc { + margin-left: 10px; + margin-top: 4px; +} + +.return-desc p { + margin: 0; +} + +.deprecated, .experimental, .instance-docs { + border-left: solid 5px orange; + padding-left: 4px; + margin: 4px 0; +} + +tr.listen p, +tr.throw p, +tr.emit p{ + margin-bottom: 10px; +} + +.version, .since { + color: #aaa; +} + +h3 .right-info { + position: absolute; + right: 4px; + font-size: 14px; +} + +.version + .since:before { + content: '| '; +} + +.see { + margin-top: 10px; +} + +.see h4 { + margin: 4px 0; +} + +.content .detail h4 + .example-doc { + margin: 6px 0; +} + +.example-caption { + position: relative; + bottom: -1px; + display: inline-block; + padding: 4px; + font-style: italic; + background-color: #f5f5f5; + font-weight: bold; + border-radius: 3px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + +.example-caption + pre.source-code { + margin-top: 0; + border-top-left-radius: 0; +} + +footer, .file-footer { + text-align: right; + font-style: italic; + font-weight: 100; + font-size: 13px; + margin-right: 50px; + margin-left: 270px; + border-top: 1px solid #ddd; + padding-top: 30px; + margin-top: 20px; + padding-bottom: 10px; +} + +pre.source-code { + background: #f5f5f5; + padding: 4px; +} + +pre.raw-source-code > code { + padding: 0; + margin: 0; +} + +pre.source-code.line-number { + padding: 0; +} + +pre.source-code ol { + background: #eee; + padding-left: 40px; +} + +pre.source-code li { + background: white; + padding-left: 4px; + list-style: decimal; + margin: 0; +} + +pre.source-code.line-number li.active { + background: rgb(255, 255, 150); +} + +pre.source-code.line-number li.error-line { + background: #ffb8bf; +} + +table.files-summary { + width: 100%; + margin: 10px 0; + border-spacing: 0; + border: 0; + border-collapse: collapse; + text-align: right; +} + +table.files-summary tbody tr:hover { + background: #eee; +} + +table.files-summary td:first-child, +table.files-summary td:nth-of-type(2) { + text-align: left; +} + +table.files-summary[data-use-coverage="false"] td.coverage { + display: none; +} + +table.files-summary thead { + background: #999; + color: white; +} + +table.files-summary td { + border: solid 1px #ddd; + padding: 4px 10px; + vertical-align: top; +} + +table.files-summary td.identifiers > span { + display: block; + margin-top: 4px; +} +table.files-summary td.identifiers > span:first-child { + margin-top: 0; +} + +table.files-summary .coverage-count { + font-size: 12px; + color: #aaa; + display: inline-block; + min-width: 40px; +} + +.total-coverage-count { + position: relative; + bottom: 2px; + font-size: 12px; + color: #666; + font-weight: 500; + padding-left: 5px; +} + +table.test-summary thead { + background: #999; + color: white; +} + +table.test-summary thead .test-description { + width: 50%; +} + +table.test-summary { + width: 100%; + margin: 10px 0; + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +table.test-summary thead .test-count { + width: 3em; +} + +table.test-summary tbody tr:hover { + background-color: #eee; +} + +table.test-summary td { + border: solid 1px #ddd; + padding: 4px 10px; + vertical-align: top; +} + +table.test-summary td p { + margin: 0; +} + +table.test-summary tr.test-describe .toggle { + display: inline-block; + float: left; + margin-right: 4px; + cursor: pointer; +} + +table.test-summary tr.test-describe .toggle.opened:before { + content: 'â–¼'; +} + +table.test-summary tr.test-describe .toggle.closed:before { + content: 'â–¶'; +} + +table.test-summary .test-target > span { + display: block; + margin-top: 4px; +} +table.test-summary .test-target > span:first-child { + margin-top: 0; +} + +.inner-link-active { + background: rgb(255, 255, 150); +} + +/* search box */ +.search-box { + position: absolute; + top: 10px; + right: 50px; + padding-right: 8px; + padding-bottom: 10px; + line-height: normal; + font-size: 12px; +} + +.search-box img { + width: 20px; + vertical-align: top; +} + +.search-input { + display: inline; + visibility: hidden; + width: 0; + padding: 2px; + height: 1.5em; + outline: none; + background: transparent; + border: 1px #0af; + border-style: none none solid none; + vertical-align: bottom; +} + +.search-input-edge { + display: none; + width: 1px; + height: 5px; + background-color: #0af; + vertical-align: bottom; +} + +.search-result { + position: absolute; + display: none; + height: 600px; + width: 100%; + padding: 0; + margin-top: 5px; + margin-left: 24px; + background: white; + box-shadow: 1px 1px 4px rgb(0,0,0); + white-space: nowrap; + overflow-y: scroll; +} + +.search-result-import-path { + color: #aaa; + font-size: 12px; +} + +.search-result li { + list-style: none; + padding: 2px 4px; +} + +.search-result li a { + display: block; +} + +.search-result li.selected { + background: #ddd; +} + +.search-result li.search-separator { + background: rgb(37, 138, 175); + color: white; +} + +.search-box.active .search-input { + visibility: visible; + transition: width 0.2s ease-out; + width: 300px; +} + +.search-box.active .search-input-edge { + display: inline-block; +} + +/* coverage badge */ +.esdoc-coverage { + display: inline-block; + height: 20px; + vertical-align: top; +} + +h1 .esdoc-coverage { + position: relative; + top: -4px; +} + +.esdoc-coverage-wrap { + color: white; + font-size: 12px; + font-weight: 500; +} + +.esdoc-coverage-label { + padding: 3px 4px 3px 6px; + background: linear-gradient(to bottom, #5e5e5e 0%,#4c4c4c 100%); + border-radius: 4px 0 0 4px; + display: inline-block; + height: 20px; + box-sizing: border-box; + line-height: 14px; +} + +.esdoc-coverage-ratio { + padding: 3px 6px 3px 4px; + border-radius: 0 4px 4px 0; + display: inline-block; + height: 20px; + box-sizing: border-box; + line-height: 14px; +} + +.esdoc-coverage-low { + background: linear-gradient(to bottom, #db654f 0%,#c9533d 100%); +} + +.esdoc-coverage-middle { + background: linear-gradient(to bottom, #dab226 0%,#c9a179 100%); +} + +.esdoc-coverage-high { + background: linear-gradient(to bottom, #4fc921 0%,#3eb810 100%); +} + +.github-markdown .manual-toc { + padding-left: 0; +} + +/** manual */ + +.manual-root .navigation { + padding-left: 0; +} + +.navigation .manual-toc-title { + margin: 0; + padding: 0.5em 0 0.5em 1em; + border: none; + font-size: 1em; + font-weight: normal; +} + +.navigation .manual-toc-title:first-child { + margin-top: 0; +} + +.navigation .manual-toc { + display: none; + margin-left: 0.5em; + margin-top: -0.25em; +} + +.github-markdown .manual-toc-title a { + color: inherit; +} + +.manual-breadcrumb-list { + font-size: 0.8em; + margin-bottom: 1em; +} + +.manual-toc-title a:hover { + color: #039BE5; +} + +.manual-toc li { + margin: 0.75em 0; + list-style-type: none; +} + +.manual-toc .indent-h1 { + margin-left: 0; +} +.manual-toc .indent-h2 { + margin-left: 1em; +} +.manual-toc .indent-h3 { + margin-left: 3em; +} +.manual-toc .indent-h4 { + margin-left: 4em; +} +.manual-toc .indent-h5 { + margin-left: 5em; +} + +.manual-nav li { + margin: 0.75em 0; +} + +.manual-dot { + margin-left: 0.75em; + width: 0.6em; + height: 0.6em; + display: inline-block; + border-radius: 0.3em; + margin-right: 0.3em; + background-color: #bfe5bf; +} + +/* github markdown */ +.github-markdown { + font-size: 16px; +} + +.github-markdown h1, +.github-markdown h2, +.github-markdown h3, +.github-markdown h4, +.github-markdown h5 { + margin-top: 1em; + margin-bottom: 16px; + font-weight: bold; + padding: 0; +} + +.github-markdown h1:nth-of-type(1) { + margin-top: 0; +} + +.github-markdown h1 { + font-size: 2em; + padding-bottom: 0.3em; +} + +.github-markdown h2 { + font-size: 1.75em; + padding-bottom: 0.3em; +} + +.github-markdown h3 { + font-size: 1.5em; + background-color: transparent; +} + +.github-markdown h4 { + font-size: 1.25em; +} + +.github-markdown h5 { + font-size: 1em; +} + +.github-markdown ul, .github-markdown ol { + padding-left: 2em; +} + +.github-markdown pre > code { + font-size: 0.85em; +} + +.github-markdown table { + margin-bottom: 1em; + border-collapse: collapse; + border-spacing: 0; +} + +.github-markdown table tr { + background-color: #fff; + border-top: 1px solid #ccc; +} + +.github-markdown table th, +.github-markdown table td { + padding: 6px 13px; + border: 1px solid #ddd; +} + +.github-markdown table tr:nth-child(2n) { + background-color: #f8f8f8; +} + +/** badge(.svg) does not have border */ +.github-markdown img:not([src*=".svg"]) { + max-width: 100%; + box-shadow: 1px 1px 1px rgba(0,0,0,0.5); +} diff --git a/doc/manual/example.md b/doc/manual/example.md deleted file mode 100644 index e69de29..0000000 diff --git a/doc/manual/installation.md b/doc/manual/installation.md deleted file mode 100644 index 658f25d..0000000 --- a/doc/manual/installation.md +++ /dev/null @@ -1,15 +0,0 @@ -Can be managed through -[jspm](http://jspm.io) -or [npm](https://github.com/npm/npm). - -### jspm -```terminal -jspm install github:aureooms/es-red-black-tree -# or -jspm install npm:aureooms-es-red-black-tree -``` - -### npm -```terminal -npm install aureooms-es-red-black-tree --save -``` diff --git a/doc/manual/overview.md b/doc/manual/overview.md deleted file mode 100644 index e69de29..0000000 diff --git a/doc/manual/usage.md b/doc/manual/usage.md deleted file mode 100644 index bef8ef8..0000000 --- a/doc/manual/usage.md +++ /dev/null @@ -1,23 +0,0 @@ -Depending on the syntax used by this code you will need to pass the source -through a transpiler, for example [babel](https://babeljs.io). - -### jspm -Configure [jspm](http://jspm.io) to transpile all the code. Then -```js -let redblacktree = require( 'github:aureooms/es-red-black-tree' ) ; -// or -import redblacktree from 'aureooms-es-red-black-tree' ; -``` - -### npm -Configure your code to transpile dependencies on the fly (for example with -[babel-register](https://babeljs.io/docs/usage/require)). Then you can -```js -import redblacktree from 'aureooms-es-red-black-tree' ; -``` - -Additionally, for the browser, you can configure -[rollup](http://rollupjs.org), -[browserify](http://browserify.org), -or [webpack](https://webpack.github.io) to transpile and package the -dependencies with your code. diff --git a/dump.json b/dump.json new file mode 100644 index 0000000..0c8883a --- /dev/null +++ b/dump.json @@ -0,0 +1,2133 @@ +[ + { + "__docId__": 0, + "kind": "file", + "static": true, + "variation": null, + "name": "src/adt/RedBlackTree.js", + "memberof": null, + "longname": "src/adt/RedBlackTree.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { Node } from '..' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor , successor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { find } from '..' ;\nimport { inordertraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\tfind ( value ) {\n\n\t\tif ( this.root === null ) return null ;\n\n\t\treturn find( this.compare , this.root , value ) ;\n\n\t}\n\n\tdelete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\tconst succ = successor( node ) ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t}\n\n\t*[Symbol.iterator] ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n}\n" + }, + { + "__docId__": 1, + "kind": "class", + "static": true, + "variation": null, + "name": "RedBlackTree", + "memberof": "src/adt/RedBlackTree.js", + "longname": "src/adt/RedBlackTree.js~RedBlackTree", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/adt/RedBlackTree.js", + "importStyle": "{RedBlackTree}", + "description": null, + "lineNumber": 10, + "undocument": true, + "interface": false + }, + { + "__docId__": 2, + "kind": "constructor", + "static": false, + "variation": null, + "name": "constructor", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#constructor", + "access": null, + "description": null, + "lineNumber": 12, + "undocument": true, + "params": [ + { + "name": "compare", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 3, + "kind": "member", + "static": false, + "variation": null, + "name": "compare", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#compare", + "access": null, + "description": null, + "lineNumber": 14, + "undocument": true, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 4, + "kind": "member", + "static": false, + "variation": null, + "name": "root", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", + "access": null, + "description": null, + "lineNumber": 15, + "undocument": true, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 5, + "kind": "method", + "static": false, + "variation": null, + "name": "add", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#add", + "access": null, + "description": null, + "lineNumber": 19, + "undocument": true, + "params": [ + { + "name": "value", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 6, + "kind": "member", + "static": false, + "variation": null, + "name": "root", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", + "access": null, + "description": null, + "lineNumber": 21, + "undocument": true, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 7, + "kind": "method", + "static": false, + "variation": null, + "name": "find", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#find", + "access": null, + "description": null, + "lineNumber": 30, + "undocument": true, + "params": [ + { + "name": "value", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 8, + "kind": "method", + "static": false, + "variation": null, + "name": "delete", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#delete", + "access": null, + "description": null, + "lineNumber": 38, + "undocument": true, + "params": [ + { + "name": "node", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 9, + "kind": "member", + "static": false, + "variation": null, + "name": "root", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", + "access": null, + "description": null, + "lineNumber": 61, + "undocument": true, + "type": { + "types": [ + "*" + ] + } + }, + { + "__docId__": 10, + "kind": "method", + "static": false, + "variation": null, + "name": "[Symbol.iterator]", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", + "access": null, + "description": null, + "lineNumber": 66, + "undocument": true, + "params": [], + "generator": true + }, + { + "__docId__": 11, + "kind": "file", + "static": true, + "variation": null, + "name": "src/adt/index.js", + "memberof": null, + "longname": "src/adt/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './RedBlackTree' ;\n" + }, + { + "__docId__": 12, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/colors.js", + "memberof": null, + "longname": "src/base/colors.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export const BLACK = 0 ;\nexport const RED = 1 ;\n" + }, + { + "__docId__": 13, + "kind": "variable", + "static": true, + "variation": null, + "name": "BLACK", + "memberof": "src/base/colors.js", + "longname": "src/base/colors.js~BLACK", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/colors.js", + "importStyle": "{BLACK}", + "description": null, + "lineNumber": 1, + "undocument": true, + "type": { + "types": [ + "number" + ] + } + }, + { + "__docId__": 14, + "kind": "variable", + "static": true, + "variation": null, + "name": "RED", + "memberof": "src/base/colors.js", + "longname": "src/base/colors.js~RED", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/colors.js", + "importStyle": "{RED}", + "description": null, + "lineNumber": 2, + "undocument": true, + "type": { + "types": [ + "number" + ] + } + }, + { + "__docId__": 15, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/find.js", + "memberof": null, + "longname": "src/base/find.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nexport function find ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" + }, + { + "__docId__": 16, + "kind": "function", + "static": true, + "variation": null, + "name": "find", + "memberof": "src/base/find.js", + "longname": "src/base/find.js~find", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/find.js", + "importStyle": "{find}", + "description": null, + "lineNumber": 2, + "undocument": true, + "params": [ + { + "name": "compare", + "types": [ + "*" + ] + }, + { + "name": "node", + "types": [ + "*" + ] + }, + { + "name": "value", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 17, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/grandparent.js", + "memberof": null, + "longname": "src/base/grandparent.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export function grandparent( n ){\n if ((n !== null) && (n.parent !== null))\n return n.parent.parent;\n else\n return null;\n}\n" + }, + { + "__docId__": 18, + "kind": "function", + "static": true, + "variation": null, + "name": "grandparent", + "memberof": "src/base/grandparent.js", + "longname": "src/base/grandparent.js~grandparent", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/grandparent.js", + "importStyle": "{grandparent}", + "description": null, + "lineNumber": 1, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 19, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/index.js", + "memberof": null, + "longname": "src/base/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './colors' ;\nexport * from './find' ;\nexport * from './grandparent' ;\nexport * from './inordertraversal' ;\nexport * from './insert' ;\nexport * from './predecessor' ;\nexport * from './replace_node' ;\nexport * from './rotate_left' ;\nexport * from './rotate_right' ;\nexport * from './sibling' ;\nexport * from './successor' ;\nexport * from './uncle' ;\n" + }, + { + "__docId__": 20, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/inordertraversal.js", + "memberof": null, + "longname": "src/base/inordertraversal.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nexport function* inordertraversal ( node ) {\n\n\tif ( !node.left.isleaf() ) {\n\t\tyield *inordertraversal( node.left );\n\t}\n\n\tyield node.value ;\n\n\tif ( !node.right.isleaf() ) {\n\t\tyield* inordertraversal( node.right );\n\t}\n\n}\n" + }, + { + "__docId__": 21, + "kind": "function", + "static": true, + "variation": null, + "name": "inordertraversal", + "memberof": "src/base/inordertraversal.js", + "longname": "src/base/inordertraversal.js~inordertraversal", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/inordertraversal.js", + "importStyle": "{inordertraversal}", + "description": null, + "lineNumber": 2, + "undocument": true, + "params": [ + { + "name": "node", + "types": [ + "*" + ] + } + ], + "generator": true + }, + { + "__docId__": 22, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/insert.js", + "memberof": null, + "longname": "src/base/insert.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nexport function insert ( compare, A, B ) {\n\n\twhile ( true ) {\n\n\t\tif ( compare( B.value, A.value ) < 0 ) {\n\n\t\t\tconst node = A.left;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t\telse {\n\n\t\t\tconst node = A.right;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n\n}\n" + }, + { + "__docId__": 23, + "kind": "function", + "static": true, + "variation": null, + "name": "insert", + "memberof": "src/base/insert.js", + "longname": "src/base/insert.js~insert", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/insert.js", + "importStyle": "{insert}", + "description": null, + "lineNumber": 2, + "undocument": true, + "params": [ + { + "name": "compare", + "types": [ + "*" + ] + }, + { + "name": "A", + "types": [ + "*" + ] + }, + { + "name": "B", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 24, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/predecessor.js", + "memberof": null, + "longname": "src/base/predecessor.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export function predecessor ( node ) {\n\n\tvar pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" + }, + { + "__docId__": 25, + "kind": "function", + "static": true, + "variation": null, + "name": "predecessor", + "memberof": "src/base/predecessor.js", + "longname": "src/base/predecessor.js~predecessor", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/predecessor.js", + "importStyle": "{predecessor}", + "description": null, + "lineNumber": 1, + "undocument": true, + "params": [ + { + "name": "node", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 26, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/replace_node.js", + "memberof": null, + "longname": "src/base/replace_node.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nexport function replace_node ( A , B ) {\n\tif ( A.parent === null ) {\n\t\t// nothing to do\n\t}\n\telse if ( A === A.parent.left ) {\n\t\tA.parent.left = B ;\n\t}\n\telse {\n\t\tA.parent.right = B ;\n\t}\n\tB.parent = A.parent ;\n}\n" + }, + { + "__docId__": 27, + "kind": "function", + "static": true, + "variation": null, + "name": "replace_node", + "memberof": "src/base/replace_node.js", + "longname": "src/base/replace_node.js~replace_node", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/replace_node.js", + "importStyle": "{replace_node}", + "description": null, + "lineNumber": 2, + "undocument": true, + "params": [ + { + "name": "A", + "types": [ + "*" + ] + }, + { + "name": "B", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 28, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/rotate_left.js", + "memberof": null, + "longname": "src/base/rotate_left.js", + "access": null, + "description": null, + "lineNumber": 14, + "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" + }, + { + "__docId__": 29, + "kind": "function", + "static": true, + "variation": null, + "name": "rotate_left", + "memberof": "src/base/rotate_left.js", + "longname": "src/base/rotate_left.js~rotate_left", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/rotate_left.js", + "importStyle": "{rotate_left}", + "description": "Rotate tree left.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", + "lineNumber": 14, + "params": [ + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "A", + "description": "root of the tree" + } + ], + "generator": false + }, + { + "__docId__": 30, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/rotate_right.js", + "memberof": null, + "longname": "src/base/rotate_right.js", + "access": null, + "description": null, + "lineNumber": 14, + "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} A root of the tree\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" + }, + { + "__docId__": 31, + "kind": "function", + "static": true, + "variation": null, + "name": "rotate_right", + "memberof": "src/base/rotate_right.js", + "longname": "src/base/rotate_right.js~rotate_right", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/rotate_right.js", + "importStyle": "{rotate_right}", + "description": "Rotate tree right.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", + "lineNumber": 14, + "params": [ + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "A", + "description": "root of the tree" + } + ], + "generator": false + }, + { + "__docId__": 32, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/sibling.js", + "memberof": null, + "longname": "src/base/sibling.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export function sibling(n)\n{\n if ((n === null) || (n.parent === null))\n return null; // no parent means no sibling\n if (n === n.parent.left)\n return n.parent.right;\n else\n return n.parent.left;\n}\n" + }, + { + "__docId__": 33, + "kind": "function", + "static": true, + "variation": null, + "name": "sibling", + "memberof": "src/base/sibling.js", + "longname": "src/base/sibling.js~sibling", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/sibling.js", + "importStyle": "{sibling}", + "description": null, + "lineNumber": 1, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 34, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/successor.js", + "memberof": null, + "longname": "src/base/successor.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export function successor ( node ) {\n\n\tvar succ = node.right ;\n\n\twhile ( !succ.left.isleaf() ) succ = succ.left ;\n\n\treturn succ ;\n\n}\n" + }, + { + "__docId__": 35, + "kind": "function", + "static": true, + "variation": null, + "name": "successor", + "memberof": "src/base/successor.js", + "longname": "src/base/successor.js~successor", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/successor.js", + "importStyle": "{successor}", + "description": null, + "lineNumber": 1, + "undocument": true, + "params": [ + { + "name": "node", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 36, + "kind": "file", + "static": true, + "variation": null, + "name": "src/base/uncle.js", + "memberof": null, + "longname": "src/base/uncle.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { grandparent } from './grandparent' ;\n\nexport function uncle(n){\n const g = grandparent(n);\n if (g === null)\n return null; // No grandparent means no uncle\n if (n.parent === g.left)\n return g.right.isleaf() ? null : g.right ;\n else\n return g.left.isleaf() ? null : g.left;\n}\n" + }, + { + "__docId__": 37, + "kind": "function", + "static": true, + "variation": null, + "name": "uncle", + "memberof": "src/base/uncle.js", + "longname": "src/base/uncle.js~uncle", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/base/uncle.js", + "importStyle": "{uncle}", + "description": null, + "lineNumber": 3, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 38, + "kind": "file", + "static": true, + "variation": null, + "name": "src/index.js", + "memberof": null, + "longname": "src/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './adt' ;\nexport * from './base' ;\nexport * from './insertion' ;\nexport * from './node' ;\nexport * from './removal' ;\n" + }, + { + "__docId__": 39, + "kind": "file", + "static": true, + "variation": null, + "name": "src/insertion/index.js", + "memberof": null, + "longname": "src/insertion/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './insert_case1' ;\nexport * from './insert_case2' ;\nexport * from './insert_case3' ;\nexport * from './insert_case4' ;\nexport * from './insert_case5' ;\n" + }, + { + "__docId__": 40, + "kind": "file", + "static": true, + "variation": null, + "name": "src/insertion/insert_case1.js", + "memberof": null, + "longname": "src/insertion/insert_case1.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { BLACK } from '..' ;\nimport { insert_case2 } from './insert_case2' ;\n\nexport function insert_case1(n)\n{\n if (n.parent === null)\n n.color = BLACK;\n else\n insert_case2(n);\n}\n" + }, + { + "__docId__": 41, + "kind": "function", + "static": true, + "variation": null, + "name": "insert_case1", + "memberof": "src/insertion/insert_case1.js", + "longname": "src/insertion/insert_case1.js~insert_case1", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case1.js", + "importStyle": "{insert_case1}", + "description": null, + "lineNumber": 5, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 42, + "kind": "file", + "static": true, + "variation": null, + "name": "src/insertion/insert_case2.js", + "memberof": null, + "longname": "src/insertion/insert_case2.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { BLACK } from '..' ;\nimport { insert_case3 } from './insert_case3' ;\n\nexport function insert_case2(n)\n{\n if (n.parent.color === BLACK)\n return; /* Tree is still valid */\n else\n insert_case3(n);\n}\n" + }, + { + "__docId__": 43, + "kind": "function", + "static": true, + "variation": null, + "name": "insert_case2", + "memberof": "src/insertion/insert_case2.js", + "longname": "src/insertion/insert_case2.js~insert_case2", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case2.js", + "importStyle": "{insert_case2}", + "description": null, + "lineNumber": 5, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 44, + "kind": "file", + "static": true, + "variation": null, + "name": "src/insertion/insert_case3.js", + "memberof": null, + "longname": "src/insertion/insert_case3.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { BLACK , RED , uncle , grandparent } from '..' ;\nimport { insert_case1 } from './insert_case1' ;\nimport { insert_case4 } from './insert_case4' ;\n\nexport function insert_case3(n)\n{\n const u = uncle(n);\n\n if ((u !== null) && (u.color === RED)) {\n n.parent.color = BLACK;\n u.color = BLACK;\n const g = grandparent(n);\n g.color = RED;\n insert_case1(g);\n } else {\n insert_case4(n);\n }\n}\n" + }, + { + "__docId__": 45, + "kind": "function", + "static": true, + "variation": null, + "name": "insert_case3", + "memberof": "src/insertion/insert_case3.js", + "longname": "src/insertion/insert_case3.js~insert_case3", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case3.js", + "importStyle": "{insert_case3}", + "description": null, + "lineNumber": 5, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 46, + "kind": "file", + "static": true, + "variation": null, + "name": "src/insertion/insert_case4.js", + "memberof": null, + "longname": "src/insertion/insert_case4.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { rotate_left , rotate_right , grandparent } from '..' ;\nimport { insert_case5 } from './insert_case5' ;\n\nexport function insert_case4(n)\n{\n const g = grandparent(n);\n\n if ((n === n.parent.right) && (n.parent === g.left)) {\n rotate_left(n.parent);\n\n /*\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n */\n\n n = n.left;\n\n } else if ((n === n.parent.left) && (n.parent === g.right)) {\n rotate_right(n.parent);\n\n /*\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n */\n\n n = n.right;\n }\n insert_case5(n);\n}\n" + }, + { + "__docId__": 47, + "kind": "function", + "static": true, + "variation": null, + "name": "insert_case4", + "memberof": "src/insertion/insert_case4.js", + "longname": "src/insertion/insert_case4.js~insert_case4", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case4.js", + "importStyle": "{insert_case4}", + "description": null, + "lineNumber": 5, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 48, + "kind": "file", + "static": true, + "variation": null, + "name": "src/insertion/insert_case5.js", + "memberof": null, + "longname": "src/insertion/insert_case5.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;\n\nexport function insert_case5(n)\n{\n const g = grandparent(n);\n\n n.parent.color = BLACK;\n g.color = RED;\n if (n === n.parent.left)\n rotate_right(g);\n else\n rotate_left(g);\n}\n" + }, + { + "__docId__": 49, + "kind": "function", + "static": true, + "variation": null, + "name": "insert_case5", + "memberof": "src/insertion/insert_case5.js", + "longname": "src/insertion/insert_case5.js~insert_case5", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case5.js", + "importStyle": "{insert_case5}", + "description": null, + "lineNumber": 4, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 50, + "kind": "file", + "static": true, + "variation": null, + "name": "src/node/Leaf.js", + "memberof": null, + "longname": "src/node/Leaf.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { BLACK } from '..' ;\n\nexport function Leaf ( parent ) {\n\tthis.color = BLACK ;\n\tthis.parent = parent ;\n}\n\nLeaf.prototype.isleaf = function ( ) { return true ; } ;\n" + }, + { + "__docId__": 51, + "kind": "function", + "static": true, + "variation": null, + "name": "Leaf", + "memberof": "src/node/Leaf.js", + "longname": "src/node/Leaf.js~Leaf", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/node/Leaf.js", + "importStyle": "{Leaf}", + "description": null, + "lineNumber": 3, + "undocument": true, + "params": [ + { + "name": "parent", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 52, + "kind": "function", + "static": true, + "variation": null, + "name": "isleaf", + "memberof": "src/node/Leaf.js", + "longname": "src/node/Leaf.js~isleaf", + "access": null, + "export": false, + "importPath": "aureooms-es-red-black-tree/src/node/Leaf.js", + "importStyle": null, + "description": null, + "lineNumber": 8, + "undocument": true, + "params": [], + "return": { + "types": [ + "boolean" + ] + }, + "generator": false + }, + { + "__docId__": 53, + "kind": "file", + "static": true, + "variation": null, + "name": "src/node/Node.js", + "memberof": null, + "longname": "src/node/Node.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { Leaf } from './Leaf' ;\n\nexport function Node ( color , value ) {\n\tthis.color = color ;\n\tthis.left = new Leaf( this ) ;\n\tthis.right = new Leaf( this ) ;\n\tthis.parent = null ;\n\tthis.value = value ;\n}\n\nNode.prototype.isleaf = function ( ) { return false ; } ;\n" + }, + { + "__docId__": 54, + "kind": "function", + "static": true, + "variation": null, + "name": "Node", + "memberof": "src/node/Node.js", + "longname": "src/node/Node.js~Node", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/node/Node.js", + "importStyle": "{Node}", + "description": null, + "lineNumber": 3, + "undocument": true, + "params": [ + { + "name": "color", + "types": [ + "*" + ] + }, + { + "name": "value", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 55, + "kind": "function", + "static": true, + "variation": null, + "name": "isleaf", + "memberof": "src/node/Node.js", + "longname": "src/node/Node.js~isleaf", + "access": null, + "export": false, + "importPath": "aureooms-es-red-black-tree/src/node/Node.js", + "importStyle": null, + "description": null, + "lineNumber": 11, + "undocument": true, + "params": [], + "return": { + "types": [ + "boolean" + ] + }, + "generator": false + }, + { + "__docId__": 56, + "kind": "file", + "static": true, + "variation": null, + "name": "src/node/index.js", + "memberof": null, + "longname": "src/node/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './Leaf' ;\nexport * from './Node' ;\n" + }, + { + "__docId__": 57, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case1.js", + "memberof": null, + "longname": "src/removal/delete_case1.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { delete_case2 } from './delete_case2' ;\n\nexport function delete_case1(n)\n{\n if (n.parent !== null)\n delete_case2(n);\n}\n" + }, + { + "__docId__": 58, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_case1", + "memberof": "src/removal/delete_case1.js", + "longname": "src/removal/delete_case1.js~delete_case1", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case1.js", + "importStyle": "{delete_case1}", + "description": null, + "lineNumber": 4, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 59, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case2.js", + "memberof": null, + "longname": "src/removal/delete_case2.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { BLACK , RED , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\n\nexport function delete_case2(n)\n{\n const s = sibling(n);\n\n if (s.color === RED) {\n n.parent.color = RED;\n s.color = BLACK;\n if (n === n.parent.left)\n rotate_left(n.parent);\n else\n rotate_right(n.parent);\n }\n delete_case3(n);\n}\n" + }, + { + "__docId__": 60, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_case2", + "memberof": "src/removal/delete_case2.js", + "longname": "src/removal/delete_case2.js~delete_case2", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case2.js", + "importStyle": "{delete_case2}", + "description": null, + "lineNumber": 5, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 61, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case3.js", + "memberof": null, + "longname": "src/removal/delete_case3.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\nexport function delete_case3(n)\n{\n const s = sibling(n);\n\n if ((n.parent.color === BLACK) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n delete_case1(n.parent);\n } else\n delete_case4(n);\n}\n" + }, + { + "__docId__": 62, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_case3", + "memberof": "src/removal/delete_case3.js", + "longname": "src/removal/delete_case3.js~delete_case3", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case3.js", + "importStyle": "{delete_case3}", + "description": null, + "lineNumber": 7, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 63, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case4.js", + "memberof": null, + "longname": "src/removal/delete_case4.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\nexport function delete_case4(n)\n{\n const s = sibling(n);\n\n if ((n.parent.color === RED) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n n.parent.color = BLACK;\n } else\n delete_case5(n);\n}\n" + }, + { + "__docId__": 64, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_case4", + "memberof": "src/removal/delete_case4.js", + "longname": "src/removal/delete_case4.js~delete_case4", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case4.js", + "importStyle": "{delete_case4}", + "description": null, + "lineNumber": 5, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 65, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case5.js", + "memberof": null, + "longname": "src/removal/delete_case5.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nimport { delete_case6 } from './delete_case6' ;\n\nexport function delete_case5(n)\n{\n const s = sibling(n);\n\n if (s.color === BLACK) { /* this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). */\n/* the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. */\n if ((n === n.parent.left) &&\n (s.right.color === BLACK) &&\n (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.left.color = BLACK;\n rotate_right(s);\n } else if ((n === n.parent.right) &&\n (s.left.color === BLACK) &&\n (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.right.color = BLACK;\n rotate_left(s);\n }\n }\n delete_case6(n);\n}\n" + }, + { + "__docId__": 66, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_case5", + "memberof": "src/removal/delete_case5.js", + "longname": "src/removal/delete_case5.js~delete_case5", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case5.js", + "importStyle": "{delete_case5}", + "description": null, + "lineNumber": 6, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 67, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case6.js", + "memberof": null, + "longname": "src/removal/delete_case6.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nexport function delete_case6(n)\n{\n const s = sibling(n);\n\n s.color = n.parent.color;\n n.parent.color = BLACK;\n\n if (n === n.parent.left) {\n s.right.color = BLACK;\n rotate_left(n.parent);\n } else {\n s.left.color = BLACK;\n rotate_right(n.parent);\n }\n}\n" + }, + { + "__docId__": 68, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_case6", + "memberof": "src/removal/delete_case6.js", + "longname": "src/removal/delete_case6.js~delete_case6", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case6.js", + "importStyle": "{delete_case6}", + "description": null, + "lineNumber": 4, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 69, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_one_child.js", + "memberof": null, + "longname": "src/removal/delete_one_child.js", + "access": null, + "description": null, + "lineNumber": 2, + "content": "\nimport { BLACK , RED , replace_node } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\n\nexport function delete_one_child(n)\n{\n /*\n * Precondition: n has at most one non-leaf child.\n */\n const child = n.right.isleaf() ? n.left : n.right;\n\n replace_node(n, child);\n if (n.color === BLACK) {\n if (child.color === RED)\n child.color = BLACK;\n else\n delete_case1(child);\n }\n}\n" + }, + { + "__docId__": 70, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_one_child", + "memberof": "src/removal/delete_one_child.js", + "longname": "src/removal/delete_one_child.js~delete_one_child", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_one_child.js", + "importStyle": "{delete_one_child}", + "description": null, + "lineNumber": 6, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 71, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/index.js", + "memberof": null, + "longname": "src/removal/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './delete_case1' ;\nexport * from './delete_case2' ;\nexport * from './delete_case3' ;\nexport * from './delete_case4' ;\nexport * from './delete_case5' ;\nexport * from './delete_case6' ;\nexport * from './delete_one_child' ;\n" + }, + { + "__docId__": 73, + "kind": "external", + "static": true, + "variation": null, + "name": "Infinity", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Infinity", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Infinity", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 74, + "kind": "external", + "static": true, + "variation": null, + "name": "NaN", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~NaN", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 75, + "kind": "external", + "static": true, + "variation": null, + "name": "undefined", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~undefined", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 76, + "kind": "external", + "static": true, + "variation": null, + "name": "null", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~null", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 77, + "kind": "external", + "static": true, + "variation": null, + "name": "Object", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Object", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 78, + "kind": "external", + "static": true, + "variation": null, + "name": "object", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~object", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 79, + "kind": "external", + "static": true, + "variation": null, + "name": "Function", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Function", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 80, + "kind": "external", + "static": true, + "variation": null, + "name": "function", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~function", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 81, + "kind": "external", + "static": true, + "variation": null, + "name": "Boolean", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Boolean", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 82, + "kind": "external", + "static": true, + "variation": null, + "name": "boolean", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~boolean", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 83, + "kind": "external", + "static": true, + "variation": null, + "name": "Symbol", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Symbol", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 84, + "kind": "external", + "static": true, + "variation": null, + "name": "Error", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Error", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 85, + "kind": "external", + "static": true, + "variation": null, + "name": "EvalError", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/EvalError", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~EvalError", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 86, + "kind": "external", + "static": true, + "variation": null, + "name": "InternalError", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/InternalError", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~InternalError", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 87, + "kind": "external", + "static": true, + "variation": null, + "name": "RangeError", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~RangeError", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 88, + "kind": "external", + "static": true, + "variation": null, + "name": "ReferenceError", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ReferenceError", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~ReferenceError", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 89, + "kind": "external", + "static": true, + "variation": null, + "name": "SyntaxError", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SyntaxError", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~SyntaxError", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 90, + "kind": "external", + "static": true, + "variation": null, + "name": "TypeError", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypeError", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~TypeError", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 91, + "kind": "external", + "static": true, + "variation": null, + "name": "URIError", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/URIError", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~URIError", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 92, + "kind": "external", + "static": true, + "variation": null, + "name": "Number", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Number", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 93, + "kind": "external", + "static": true, + "variation": null, + "name": "number", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~number", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 94, + "kind": "external", + "static": true, + "variation": null, + "name": "Date", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Date", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 95, + "kind": "external", + "static": true, + "variation": null, + "name": "String", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~String", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 96, + "kind": "external", + "static": true, + "variation": null, + "name": "string", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~string", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 97, + "kind": "external", + "static": true, + "variation": null, + "name": "RegExp", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~RegExp", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 98, + "kind": "external", + "static": true, + "variation": null, + "name": "Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 99, + "kind": "external", + "static": true, + "variation": null, + "name": "Int8Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Int8Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 100, + "kind": "external", + "static": true, + "variation": null, + "name": "Uint8Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Uint8Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 101, + "kind": "external", + "static": true, + "variation": null, + "name": "Uint8ClampedArray", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Uint8ClampedArray", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 102, + "kind": "external", + "static": true, + "variation": null, + "name": "Int16Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Int16Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 103, + "kind": "external", + "static": true, + "variation": null, + "name": "Uint16Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Uint16Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 104, + "kind": "external", + "static": true, + "variation": null, + "name": "Int32Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Int32Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 105, + "kind": "external", + "static": true, + "variation": null, + "name": "Uint32Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Uint32Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 106, + "kind": "external", + "static": true, + "variation": null, + "name": "Float32Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Float32Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 107, + "kind": "external", + "static": true, + "variation": null, + "name": "Float64Array", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Float64Array", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 108, + "kind": "external", + "static": true, + "variation": null, + "name": "Map", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Map", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 109, + "kind": "external", + "static": true, + "variation": null, + "name": "Set", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Set", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 110, + "kind": "external", + "static": true, + "variation": null, + "name": "WeakMap", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~WeakMap", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 111, + "kind": "external", + "static": true, + "variation": null, + "name": "WeakSet", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~WeakSet", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 112, + "kind": "external", + "static": true, + "variation": null, + "name": "ArrayBuffer", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~ArrayBuffer", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 113, + "kind": "external", + "static": true, + "variation": null, + "name": "DataView", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~DataView", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 114, + "kind": "external", + "static": true, + "variation": null, + "name": "JSON", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~JSON", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 115, + "kind": "external", + "static": true, + "variation": null, + "name": "Promise", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Promise", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 116, + "kind": "external", + "static": true, + "variation": null, + "name": "Generator", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Generator", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 117, + "kind": "external", + "static": true, + "variation": null, + "name": "GeneratorFunction", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/GeneratorFunction", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~GeneratorFunction", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 118, + "kind": "external", + "static": true, + "variation": null, + "name": "Reflect", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Reflect", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 119, + "kind": "external", + "static": true, + "variation": null, + "name": "Proxy", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy", + "memberof": "BuiltinExternal/ECMAScriptExternal.js", + "longname": "BuiltinExternal/ECMAScriptExternal.js~Proxy", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 121, + "kind": "external", + "static": true, + "variation": null, + "name": "CanvasRenderingContext2D", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D", + "memberof": "BuiltinExternal/WebAPIExternal.js", + "longname": "BuiltinExternal/WebAPIExternal.js~CanvasRenderingContext2D", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 122, + "kind": "external", + "static": true, + "variation": null, + "name": "DocumentFragment", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/DocumentFragment", + "memberof": "BuiltinExternal/WebAPIExternal.js", + "longname": "BuiltinExternal/WebAPIExternal.js~DocumentFragment", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 123, + "kind": "external", + "static": true, + "variation": null, + "name": "Element", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Element", + "memberof": "BuiltinExternal/WebAPIExternal.js", + "longname": "BuiltinExternal/WebAPIExternal.js~Element", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 124, + "kind": "external", + "static": true, + "variation": null, + "name": "Event", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Event", + "memberof": "BuiltinExternal/WebAPIExternal.js", + "longname": "BuiltinExternal/WebAPIExternal.js~Event", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 125, + "kind": "external", + "static": true, + "variation": null, + "name": "Node", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/Node", + "memberof": "BuiltinExternal/WebAPIExternal.js", + "longname": "BuiltinExternal/WebAPIExternal.js~Node", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 126, + "kind": "external", + "static": true, + "variation": null, + "name": "NodeList", + "externalLink": "https://developer.mozilla.org/en-US/docs/Web/API/NodeList", + "memberof": "BuiltinExternal/WebAPIExternal.js", + "longname": "BuiltinExternal/WebAPIExternal.js~NodeList", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 127, + "kind": "external", + "static": true, + "variation": null, + "name": "XMLHttpRequest", + "externalLink": "https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest", + "memberof": "BuiltinExternal/WebAPIExternal.js", + "longname": "BuiltinExternal/WebAPIExternal.js~XMLHttpRequest", + "access": null, + "description": "", + "builtinExternal": true + }, + { + "__docId__": 128, + "kind": "external", + "static": true, + "variation": null, + "name": "AudioContext", + "externalLink": "https://developer.mozilla.org/en/docs/Web/API/AudioContext", + "memberof": "BuiltinExternal/WebAPIExternal.js", + "longname": "BuiltinExternal/WebAPIExternal.js~AudioContext", + "access": null, + "description": "", + "builtinExternal": true + } +] \ No newline at end of file diff --git a/esdoc.json b/esdoc.json deleted file mode 100644 index f6cd160..0000000 --- a/esdoc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "source": "./src", - "destination": "./gh-pages", - "access": ["public", "protected", "private"], - "debug": false, - "index": "./README.md", - "package": "./package.json", - "title": "aureooms/es-red-black-tree", - "test": { - "type": "ava", - "source": "./test/src" - }, - "manual": { - "overview": ["./doc/manual/overview.md"], - "installation": ["./doc/manual/installation.md"], - "usage": ["./doc/manual/usage.md"], - "example": ["./doc/manual/example.md"] - }, - "styles": ["./doc/css/style.css"], - "scripts": ["./doc/scripts/header.js"] -} diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/adt/RedBlackTree.js.html new file mode 100644 index 0000000..f0a562b --- /dev/null +++ b/file/src/adt/RedBlackTree.js.html @@ -0,0 +1,158 @@ + + + + + + src/adt/RedBlackTree.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/adt/RedBlackTree.js

+

+import { Node } from '..' ;
+import { RED , BLACK } from '..' ;
+import { predecessor , successor } from '..' ;
+import { insert , insert_case2 } from '..' ;
+import { delete_one_child } from '..' ;
+import { find } from '..' ;
+import { inordertraversal } from '..' ;
+
+export class RedBlackTree {
+
+	constructor ( compare ) {
+
+		this.compare = compare ;
+		this.root = null ;
+
+	}
+
+	add ( value ) {
+		if ( this.root === null ) {
+			this.root = new Node( BLACK , value ) ;
+		}
+		else {
+			const node = new Node( RED , value ) ;
+			insert( this.compare , this.root , node ) ;
+			insert_case2( node ) ;
+		}
+	}
+
+	find ( value ) {
+
+		if ( this.root === null ) return null ;
+
+		return find( this.compare , this.root , value ) ;
+
+	}
+
+	delete ( node ) {
+
+		if ( !node.left.isleaf() ) {
+			// replace node's value with predecessor's value
+			const pred = predecessor( node ) ;
+			node.value = pred.value ;
+			// delete predecessor node
+			// note: this node can only have one non-leaf child
+			//       because the tree is a red-black tree
+			delete_one_child( pred ) ;
+		}
+
+		else if ( !node.right.isleaf() ) {
+			// replace node's value with successor's value
+			const succ = successor( node ) ;
+			node.value = succ.value ;
+			// delete successor node
+			// note: this node can only have one non-leaf child
+			//       because the tree is a red-black tree
+			delete_one_child( pred ) ;
+		}
+
+		else {
+			this.root = null ;
+		}
+
+	}
+
+	*[Symbol.iterator] ( ) {
+
+		if ( this.root !== null ) yield* inordertraversal( this.root ) ;
+
+	}
+
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/adt/index.js.html b/file/src/adt/index.js.html new file mode 100644 index 0000000..5b65e6f --- /dev/null +++ b/file/src/adt/index.js.html @@ -0,0 +1,87 @@ + + + + + + src/adt/index.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/adt/index.js

+
export * from './RedBlackTree' ;
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/colors.js.html b/file/src/base/colors.js.html new file mode 100644 index 0000000..881afac --- /dev/null +++ b/file/src/base/colors.js.html @@ -0,0 +1,88 @@ + + + + + + src/base/colors.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/colors.js

+
export const BLACK = 0 ;
+export const RED = 1 ;
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/find.js.html b/file/src/base/find.js.html new file mode 100644 index 0000000..4799a09 --- /dev/null +++ b/file/src/base/find.js.html @@ -0,0 +1,115 @@ + + + + + + src/base/find.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/find.js

+

+export function find ( compare, node, value ) {
+
+	// scan for first node whose
+	// value equals parameter value
+
+	while ( true ) {
+
+		const d = compare( value, node.value );
+
+		if ( d === 0 ) {
+			return node;
+		}
+
+		else if ( d < 0 ) {
+			node = node.left;
+		}
+
+		else {
+			node = node.right;
+		}
+
+		if ( node.isleaf() ) {
+			return null;
+		}
+
+	}
+
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/grandparent.js.html b/file/src/base/grandparent.js.html new file mode 100644 index 0000000..db3401a --- /dev/null +++ b/file/src/base/grandparent.js.html @@ -0,0 +1,92 @@ + + + + + + src/base/grandparent.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/grandparent.js

+
export function grandparent( n ){
+ if ((n !== null) && (n.parent !== null))
+  return n.parent.parent;
+ else
+  return null;
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/index.js.html b/file/src/base/index.js.html new file mode 100644 index 0000000..e777707 --- /dev/null +++ b/file/src/base/index.js.html @@ -0,0 +1,98 @@ + + + + + + src/base/index.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/index.js

+
export * from './colors' ;
+export * from './find' ;
+export * from './grandparent' ;
+export * from './inordertraversal' ;
+export * from './insert' ;
+export * from './predecessor' ;
+export * from './replace_node' ;
+export * from './rotate_left' ;
+export * from './rotate_right' ;
+export * from './sibling' ;
+export * from './successor' ;
+export * from './uncle' ;
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/inordertraversal.js.html b/file/src/base/inordertraversal.js.html new file mode 100644 index 0000000..cdf02da --- /dev/null +++ b/file/src/base/inordertraversal.js.html @@ -0,0 +1,100 @@ + + + + + + src/base/inordertraversal.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/inordertraversal.js

+

+export function* inordertraversal ( node ) {
+
+	if ( !node.left.isleaf() ) {
+		yield *inordertraversal( node.left );
+	}
+
+	yield node.value ;
+
+	if ( !node.right.isleaf() ) {
+		yield* inordertraversal( node.right );
+	}
+
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/insert.js.html b/file/src/base/insert.js.html new file mode 100644 index 0000000..3eb69c1 --- /dev/null +++ b/file/src/base/insert.js.html @@ -0,0 +1,124 @@ + + + + + + src/base/insert.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/insert.js

+

+export function insert ( compare, A, B ) {
+
+	while ( true ) {
+
+		if ( compare( B.value, A.value ) < 0 ) {
+
+			const node = A.left;
+
+			if ( node.isleaf() ) {
+				A.left = B;
+				break;
+			}
+
+			A = node;
+
+		}
+
+		else {
+
+			const node = A.right;
+
+			if ( node.isleaf() ) {
+				A.right = B;
+				break;
+			}
+
+			A = node;
+
+		}
+
+	}
+
+	B.parent = A;
+
+	return B;
+
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/predecessor.js.html b/file/src/base/predecessor.js.html new file mode 100644 index 0000000..08045f3 --- /dev/null +++ b/file/src/base/predecessor.js.html @@ -0,0 +1,95 @@ + + + + + + src/base/predecessor.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/predecessor.js

+
export function predecessor ( node ) {
+
+	var pred = node.left ;
+
+	while ( !pred.right.isleaf() ) pred = pred.right ;
+
+	return pred ;
+
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/replace_node.js.html b/file/src/base/replace_node.js.html new file mode 100644 index 0000000..e84dc9a --- /dev/null +++ b/file/src/base/replace_node.js.html @@ -0,0 +1,99 @@ + + + + + + src/base/replace_node.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/replace_node.js

+

+export function replace_node ( A , B ) {
+	if ( A.parent === null ) {
+		// nothing to do
+	}
+	else if ( A === A.parent.left ) {
+		A.parent.left = B ;
+	}
+	else {
+		A.parent.right = B ;
+	}
+	B.parent = A.parent ;
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/rotate_left.js.html b/file/src/base/rotate_left.js.html new file mode 100644 index 0000000..e5da6cf --- /dev/null +++ b/file/src/base/rotate_left.js.html @@ -0,0 +1,119 @@ + + + + + + src/base/rotate_left.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/rotate_left.js

+
/**
+ * Rotate tree left.
+ * (see https://en.wikipedia.org/wiki/Tree_rotation)
+ *
+ *      A                B
+ *     / \              / \
+ *    a   B     ->     A   c
+ *       / \          / \
+ *      b   c        a   b
+ *
+ * @param {Node} A root of the tree
+ */
+
+export function rotate_left ( A ) {
+
+	const B = A.right ;
+	const a = A.left ;
+	const b = B.left ;
+	const c = B.right ;
+
+	[A.value , B.value] = [B.value , A.value] ;
+	[A.color , B.color] = [B.color , A.color] ;
+
+	A.left = B ;
+	A.right = c ;
+
+	B.left = a ;
+	B.right = b ;
+
+	a.parent = B ;
+	b.parent = B ;
+	c.parent = A ;
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/rotate_right.js.html b/file/src/base/rotate_right.js.html new file mode 100644 index 0000000..666ca56 --- /dev/null +++ b/file/src/base/rotate_right.js.html @@ -0,0 +1,120 @@ + + + + + + src/base/rotate_right.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/rotate_right.js

+
/**
+ * Rotate tree right.
+ * (see https://en.wikipedia.org/wiki/Tree_rotation)
+ *
+ *      B                A
+ *     / \              / \
+ *    A   c     ->     a   B
+ *   / \                  / \
+ *  a   b                b   c
+ *
+ * @param {Node} A root of the tree
+ */
+
+export function rotate_right ( B ) {
+
+	const A = B.left;
+	const a = A.left ;
+	const b = A.right ;
+	const c = B.right ;
+
+	[A.value , B.value] = [B.value , A.value] ;
+	[A.color , B.color] = [B.color , A.color] ;
+
+	B.left = a ;
+	B.right = A ;
+
+	A.left = b ;
+	A.right = c ;
+
+	a.parent = B ;
+	b.parent = A ;
+	c.parent = A ;
+
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/sibling.js.html b/file/src/base/sibling.js.html new file mode 100644 index 0000000..078062d --- /dev/null +++ b/file/src/base/sibling.js.html @@ -0,0 +1,95 @@ + + + + + + src/base/sibling.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/sibling.js

+
export function sibling(n)
+{
+ if ((n === null) || (n.parent === null))
+  return null; // no parent means no sibling
+ if (n === n.parent.left)
+  return n.parent.right;
+ else
+  return n.parent.left;
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/successor.js.html b/file/src/base/successor.js.html new file mode 100644 index 0000000..cdb1c3e --- /dev/null +++ b/file/src/base/successor.js.html @@ -0,0 +1,95 @@ + + + + + + src/base/successor.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/successor.js

+
export function successor ( node ) {
+
+	var succ = node.right ;
+
+	while ( !succ.left.isleaf() ) succ = succ.left ;
+
+	return succ ;
+
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/base/uncle.js.html b/file/src/base/uncle.js.html new file mode 100644 index 0000000..ff07a5b --- /dev/null +++ b/file/src/base/uncle.js.html @@ -0,0 +1,97 @@ + + + + + + src/base/uncle.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/base/uncle.js

+
import { grandparent } from './grandparent' ;
+
+export function uncle(n){
+ const g = grandparent(n);
+ if (g === null)
+  return null; // No grandparent means no uncle
+ if (n.parent === g.left)
+  return g.right.isleaf() ? null : g.right ;
+ else
+  return g.left.isleaf() ? null : g.left;
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/index.js.html b/file/src/index.js.html new file mode 100644 index 0000000..a475fa0 --- /dev/null +++ b/file/src/index.js.html @@ -0,0 +1,91 @@ + + + + + + src/index.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/index.js

+
export * from './adt' ;
+export * from './base' ;
+export * from './insertion' ;
+export * from './node' ;
+export * from './removal' ;
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/insertion/index.js.html b/file/src/insertion/index.js.html new file mode 100644 index 0000000..d754cfc --- /dev/null +++ b/file/src/insertion/index.js.html @@ -0,0 +1,91 @@ + + + + + + src/insertion/index.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/insertion/index.js

+
export * from './insert_case1' ;
+export * from './insert_case2' ;
+export * from './insert_case3' ;
+export * from './insert_case4' ;
+export * from './insert_case5' ;
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html new file mode 100644 index 0000000..73df6f3 --- /dev/null +++ b/file/src/insertion/insert_case1.js.html @@ -0,0 +1,97 @@ + + + + + + src/insertion/insert_case1.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/insertion/insert_case1.js

+

+import { BLACK } from '..' ;
+import { insert_case2 } from './insert_case2' ;
+
+export function insert_case1(n)
+{
+ if (n.parent === null)
+  n.color = BLACK;
+ else
+  insert_case2(n);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html new file mode 100644 index 0000000..7078a9a --- /dev/null +++ b/file/src/insertion/insert_case2.js.html @@ -0,0 +1,97 @@ + + + + + + src/insertion/insert_case2.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/insertion/insert_case2.js

+

+import { BLACK } from '..' ;
+import { insert_case3 } from './insert_case3' ;
+
+export function insert_case2(n)
+{
+ if (n.parent.color === BLACK)
+  return; /* Tree is still valid */
+ else
+  insert_case3(n);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html new file mode 100644 index 0000000..6b136d4 --- /dev/null +++ b/file/src/insertion/insert_case3.js.html @@ -0,0 +1,104 @@ + + + + + + src/insertion/insert_case3.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/insertion/insert_case3.js

+
import { BLACK , RED , uncle , grandparent } from '..' ;
+import { insert_case1 } from './insert_case1' ;
+import { insert_case4 } from './insert_case4' ;
+
+export function insert_case3(n)
+{
+ const u = uncle(n);
+
+ if ((u !== null) && (u.color === RED)) {
+  n.parent.color = BLACK;
+  u.color = BLACK;
+  const g = grandparent(n);
+  g.color = RED;
+  insert_case1(g);
+ } else {
+  insert_case4(n);
+ }
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html new file mode 100644 index 0000000..acef865 --- /dev/null +++ b/file/src/insertion/insert_case4.js.html @@ -0,0 +1,127 @@ + + + + + + src/insertion/insert_case4.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/insertion/insert_case4.js

+

+import { rotate_left , rotate_right , grandparent } from '..' ;
+import { insert_case5 } from './insert_case5' ;
+
+export function insert_case4(n)
+{
+ const g = grandparent(n);
+
+ if ((n === n.parent.right) && (n.parent === g.left)) {
+  rotate_left(n.parent);
+
+ /*
+ * rotate_left can be the below because of already having *g =  grandparent(n)
+ *
+ * saved_p=g.left, *saved_left_n=n.left;
+ * g.left=n;
+ * n.left=saved_p;
+ * saved_p.right=saved_left_n;
+ *
+ * and modify the parent's nodes properly
+ */
+
+  n = n.left;
+
+ } else if ((n === n.parent.left) && (n.parent === g.right)) {
+  rotate_right(n.parent);
+
+ /*
+ * rotate_right can be the below to take advantage of already having *g =  grandparent(n)
+ *
+ * saved_p=g.right, *saved_right_n=n.right;
+ * g.right=n;
+ * n.right=saved_p;
+ * saved_p.left=saved_right_n;
+ *
+ */
+
+  n = n.right;
+ }
+ insert_case5(n);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case5.js.html new file mode 100644 index 0000000..d33bd88 --- /dev/null +++ b/file/src/insertion/insert_case5.js.html @@ -0,0 +1,100 @@ + + + + + + src/insertion/insert_case5.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/insertion/insert_case5.js

+

+import { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;
+
+export function insert_case5(n)
+{
+ const g = grandparent(n);
+
+ n.parent.color = BLACK;
+ g.color = RED;
+ if (n === n.parent.left)
+  rotate_right(g);
+ else
+  rotate_left(g);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/node/Leaf.js.html b/file/src/node/Leaf.js.html new file mode 100644 index 0000000..52d292b --- /dev/null +++ b/file/src/node/Leaf.js.html @@ -0,0 +1,94 @@ + + + + + + src/node/Leaf.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/node/Leaf.js

+
import { BLACK } from '..' ;
+
+export function Leaf ( parent ) {
+	this.color = BLACK ;
+	this.parent = parent ;
+}
+
+Leaf.prototype.isleaf = function ( ) { return true ; } ;
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/node/Node.js.html b/file/src/node/Node.js.html new file mode 100644 index 0000000..f09a0cf --- /dev/null +++ b/file/src/node/Node.js.html @@ -0,0 +1,97 @@ + + + + + + src/node/Node.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/node/Node.js

+
import { Leaf } from './Leaf' ;
+
+export function Node ( color , value ) {
+	this.color = color ;
+	this.left = new Leaf( this ) ;
+	this.right = new Leaf( this ) ;
+	this.parent = null ;
+	this.value = value ;
+}
+
+Node.prototype.isleaf = function ( ) { return false ; } ;
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/node/index.js.html b/file/src/node/index.js.html new file mode 100644 index 0000000..229e2ad --- /dev/null +++ b/file/src/node/index.js.html @@ -0,0 +1,88 @@ + + + + + + src/node/index.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/node/index.js

+
export * from './Leaf' ;
+export * from './Node' ;
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/removal/delete_case1.js.html b/file/src/removal/delete_case1.js.html new file mode 100644 index 0000000..7559cc6 --- /dev/null +++ b/file/src/removal/delete_case1.js.html @@ -0,0 +1,94 @@ + + + + + + src/removal/delete_case1.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/removal/delete_case1.js

+

+import { delete_case2 } from './delete_case2' ;
+
+export function delete_case1(n)
+{
+ if (n.parent !== null)
+  delete_case2(n);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/removal/delete_case2.js.html b/file/src/removal/delete_case2.js.html new file mode 100644 index 0000000..9f2449f --- /dev/null +++ b/file/src/removal/delete_case2.js.html @@ -0,0 +1,104 @@ + + + + + + src/removal/delete_case2.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/removal/delete_case2.js

+
import { BLACK , RED , rotate_left , rotate_right } from '..' ;
+
+import { delete_case3 } from './delete_case3' ;
+
+export function delete_case2(n)
+{
+ const s = sibling(n);
+
+ if (s.color === RED) {
+  n.parent.color = RED;
+  s.color = BLACK;
+  if (n === n.parent.left)
+   rotate_left(n.parent);
+  else
+   rotate_right(n.parent);
+ }
+ delete_case3(n);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/removal/delete_case3.js.html b/file/src/removal/delete_case3.js.html new file mode 100644 index 0000000..6b9ed65 --- /dev/null +++ b/file/src/removal/delete_case3.js.html @@ -0,0 +1,105 @@ + + + + + + src/removal/delete_case3.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/removal/delete_case3.js

+

+import { BLACK , RED , sibling } from '..' ;
+
+import { delete_case1 } from './delete_case1' ;
+import { delete_case4 } from './delete_case4' ;
+
+export function delete_case3(n)
+{
+ const s = sibling(n);
+
+ if ((n.parent.color === BLACK) &&
+     (s.color === BLACK) &&
+     (s.left.color === BLACK) &&
+     (s.right.color === BLACK)) {
+  s.color = RED;
+  delete_case1(n.parent);
+ } else
+  delete_case4(n);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/removal/delete_case4.js.html b/file/src/removal/delete_case4.js.html new file mode 100644 index 0000000..377c50f --- /dev/null +++ b/file/src/removal/delete_case4.js.html @@ -0,0 +1,103 @@ + + + + + + src/removal/delete_case4.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/removal/delete_case4.js

+
import { BLACK , RED , sibling } from '..' ;
+
+import { delete_case5 } from './delete_case5' ;
+
+export function delete_case4(n)
+{
+ const s = sibling(n);
+
+ if ((n.parent.color === RED) &&
+     (s.color === BLACK) &&
+     (s.left.color === BLACK) &&
+     (s.right.color === BLACK)) {
+  s.color = RED;
+  n.parent.color = BLACK;
+ } else
+  delete_case5(n);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/removal/delete_case5.js.html b/file/src/removal/delete_case5.js.html new file mode 100644 index 0000000..5115668 --- /dev/null +++ b/file/src/removal/delete_case5.js.html @@ -0,0 +1,116 @@ + + + + + + src/removal/delete_case5.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/removal/delete_case5.js

+

+import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;
+
+import { delete_case6 } from './delete_case6' ;
+
+export function delete_case5(n)
+{
+ const s = sibling(n);
+
+ if  (s.color === BLACK) { /* this if statement is trivial,
+due to case 2 (even though case 2 changed the sibling to a sibling's child,
+the sibling's child can't be red, since no red parent can have a red child). */
+/* the following statements just force the red to be on the left of the left of the parent,
+   or right of the right, so case six will rotate correctly. */
+  if ((n === n.parent.left) &&
+      (s.right.color === BLACK) &&
+      (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */
+   s.color = RED;
+   s.left.color = BLACK;
+   rotate_right(s);
+  } else if ((n === n.parent.right) &&
+             (s.left.color === BLACK) &&
+             (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */
+   s.color = RED;
+   s.right.color = BLACK;
+   rotate_left(s);
+  }
+ }
+ delete_case6(n);
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/removal/delete_case6.js.html b/file/src/removal/delete_case6.js.html new file mode 100644 index 0000000..3789b59 --- /dev/null +++ b/file/src/removal/delete_case6.js.html @@ -0,0 +1,104 @@ + + + + + + src/removal/delete_case6.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/removal/delete_case6.js

+

+import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;
+
+export function delete_case6(n)
+{
+ const s = sibling(n);
+
+ s.color = n.parent.color;
+ n.parent.color = BLACK;
+
+ if (n === n.parent.left) {
+  s.right.color = BLACK;
+  rotate_left(n.parent);
+ } else {
+  s.left.color = BLACK;
+  rotate_right(n.parent);
+ }
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/removal/delete_one_child.js.html b/file/src/removal/delete_one_child.js.html new file mode 100644 index 0000000..77f786c --- /dev/null +++ b/file/src/removal/delete_one_child.js.html @@ -0,0 +1,106 @@ + + + + + + src/removal/delete_one_child.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/removal/delete_one_child.js

+

+import { BLACK , RED , replace_node } from '..' ;
+
+import { delete_case1 } from './delete_case1' ;
+
+export function delete_one_child(n)
+{
+ /*
+  * Precondition: n has at most one non-leaf child.
+  */
+ const child = n.right.isleaf() ? n.left : n.right;
+
+ replace_node(n, child);
+ if (n.color === BLACK) {
+  if (child.color === RED)
+   child.color = BLACK;
+  else
+   delete_case1(child);
+ }
+}
+
+ +
+ + + + + + + + + + + + diff --git a/file/src/removal/index.js.html b/file/src/removal/index.js.html new file mode 100644 index 0000000..ab2a847 --- /dev/null +++ b/file/src/removal/index.js.html @@ -0,0 +1,93 @@ + + + + + + src/removal/index.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

src/removal/index.js

+
export * from './delete_case1' ;
+export * from './delete_case2' ;
+export * from './delete_case3' ;
+export * from './delete_case4' ;
+export * from './delete_case5' ;
+export * from './delete_case6' ;
+export * from './delete_one_child' ;
+
+ +
+ + + + + + + + + + + + diff --git a/function/index.html b/function/index.html new file mode 100644 index 0000000..d4b2a84 --- /dev/null +++ b/function/index.html @@ -0,0 +1,2243 @@ + + + + + + Function | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

Function

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Static Public Summary
+ public + + + + + +
+

+ Leaf(parent: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ Node(color: *, value: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case1(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case2(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case3(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case4(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case5(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case6(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_one_child(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ find(compare: *, node: *, value: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ grandparent(n: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ * inordertraversal(node: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert(compare: *, A: *, B: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case1(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case2(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case3(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case4(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case5(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ predecessor(node: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ replace_node(A: *, B: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ rotate_left(A: Node) +

+
+
+ + +

Rotate tree left.

+
+
+
+ + +
+ public + + + + + +
+

+ rotate_right(A: Node) +

+
+
+ + +

Rotate tree right.

+
+
+
+ + +
+ public + + + + + +
+

+ sibling(n: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ successor(node: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ uncle(n: *): * +

+
+
+ + + +
+
+ + +
+
+

Static Public

+ +
+

+ public + + + + + Leaf(parent: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
parent*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + Node(color: *, value: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
color*
value*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + delete_case1(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + delete_case2(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + delete_case3(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + delete_case4(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + delete_case5(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + delete_case6(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + delete_one_child(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + find(compare: *, node: *, value: *): * + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
compare*
node*
value*
+
+
+ +
+

Return:

+ + + + + +
*
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + grandparent(n: *): * + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ +
+

Return:

+ + + + + +
*
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + * + inordertraversal(node: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
node*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + insert(compare: *, A: *, B: *): * + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
compare*
A*
B*
+
+
+ +
+

Return:

+ + + + + +
*
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + insert_case1(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + insert_case2(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + insert_case3(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + insert_case4(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + insert_case5(n: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + predecessor(node: *): * + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
node*
+
+
+ +
+

Return:

+ + + + + +
*
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + replace_node(A: *, B: *) + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + + + + + + + +
NameTypeAttributeDescription
A*
B*
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + rotate_left(A: Node) + + + + source + +

+ + + + +

Rotate tree left. +(see https://en.wikipedia.org/wiki/Tree_rotation)

+
 A                B
+/ \              / \
+

a B -> A c + / \ / \ + b c a b

+
+ + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
ANode

root of the tree

+
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + rotate_right(A: Node) + + + + source + +

+ + + + +

Rotate tree right. +(see https://en.wikipedia.org/wiki/Tree_rotation)

+
 B                A
+/ \              / \
+

A c -> a B + / \ / \ + a b b c

+
+ + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
ANode

root of the tree

+
+
+
+ + + + + + + + + + + + + + + +
+
+

+ public + + + + + sibling(n: *): * + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ +
+

Return:

+ + + + + +
*
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + successor(node: *): * + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
node*
+
+
+ +
+

Return:

+ + + + + +
*
+
+
+
+ + + + + + + + + + + + + +
+
+

+ public + + + + + uncle(n: *): * + + + + source + +

+ + + + + + + + +
+

Params:

+ + + + + + + + + + + + + +
NameTypeAttributeDescription
n*
+
+
+ +
+

Return:

+ + + + + +
*
+
+
+
+ + + + + + + + + + + + + +
+
+
+ + + + + + + + + + + + diff --git a/identifiers.html b/identifiers.html new file mode 100644 index 0000000..c830f16 --- /dev/null +++ b/identifiers.html @@ -0,0 +1,810 @@ + + + + + + Index | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

References

+

Class Summary

+ + + + + + + + + +
Static Public Class Summary
+ public + + + + + +
+

+ RedBlackTree +

+
+
+ + + +
+
+ + +
+
+ +

Function Summary

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Static Public Function Summary
+ public + + + + + +
+

+ Leaf(parent: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ Node(color: *, value: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case1(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case2(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case3(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case4(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case5(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_case6(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ delete_one_child(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ find(compare: *, node: *, value: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ grandparent(n: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ * inordertraversal(node: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert(compare: *, A: *, B: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case1(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case2(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case3(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case4(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ insert_case5(n: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ predecessor(node: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ replace_node(A: *, B: *) +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ rotate_left(A: Node) +

+
+
+ + +

Rotate tree left.

+
+
+
+ + +
+ public + + + + + +
+

+ rotate_right(A: Node) +

+
+
+ + +

Rotate tree right.

+
+
+
+ + +
+ public + + + + + +
+

+ sibling(n: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ successor(node: *): * +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ uncle(n: *): * +

+
+
+ + + +
+
+ + +
+
+

Variable Summary

+ + + + + + + + + + + + + + +
Static Public Variable Summary
+ public + + + + + +
+

+ BLACK: number +

+
+
+ + + +
+
+ + +
+ public + + + + + +
+

+ RED: number +

+
+
+ + + +
+
+ + +
+
+ + +
+ + + + + + + + + + + + diff --git a/image/badge.svg b/image/badge.svg new file mode 100644 index 0000000..324db4c --- /dev/null +++ b/image/badge.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + document + document + @ratio@ + @ratio@ + + diff --git a/image/github.png b/image/github.png new file mode 100644 index 0000000000000000000000000000000000000000..ea6ff545a246caa64074ba809bbc86fcb8589071 GIT binary patch literal 4268 zcmaJ_c|25m+@2YcEGe=tO+zT_42H4qTL_VT8D=nHX3PwRki9HfBH7BIQ7JCj_beeI z(PA%IQuZumf5*MI`@VnN`<~A^=eL~adA{p8f1EgTGXqv8J|+MFz-nZuYe^f)M;9Xl z?T$df2WbN@Nzaya1?NEuL=w;dEfmfT4L0&cdZI1SNK}yDE3_&AKqrE+vL)G?nkc*D ze5H{`7-_OEp2h|MR5i$Wq`Nno1a?DvVz6qEm4+4w7=u!S*eICFn&NfPUKqn*0{Tj@ znU#C6w>ts_(NG7gl9g!!zGxB>O!oD`5|znnkUw>mY4f9P83_1K2+3Ow@|RP#rsiNB z903hhkd~8jmxV&XaJV#7UI7k=N`hgsP?(G??SxA~<&_oS$}mOn-v@+djezn{w$#=C z+ZJu52Js@1@X9hWfq{Y2fpXF~f~O1=fj}H-z+h4|gcLCdOG1*RuteeC3c6^bI{||y zVQ^URks{I!=TB0D&^-Ms1Yi6=vRLBZX`&@ehK$6^K&54mLi!CfHU0mgzP|sUi6l$( z|N8r{!bGbeJX*#QO~m;V+-ZgL5I!=6SJok*kt7_!3WxLgokepm90^DC!r{R>SKwfA zQ=~fvd$e)kPllD+ zRvxaUgpifj{ms?Ix%>N~v83Nz6pahhl84G`Y3tCq(0}C~HG?mnW?2_azyzRC`UIRW z_|Kq~G5_t0?0@_67Z>#}zWf~rt)x_q6t=RejnvErW>9V+3xJmC z`WZuvjAn72w+0gZ!c zA#ROc&m%S~RCo}xuD5jUEbXg(tZCM@w!T|#S$ju3+PKnZvOq!Te!k1i>ZlAY2d$hq zcr3hl)6*dTc>dY=Qd5hg9F-3ZJx12?th3 zY?KG;EA_?MEA`bUgvx84mEd_1K6WD6Zh&~3v&UiJT=<@uGaZ9%(IN9U?-o?uhZNz# z0#o|=;zl}_TF1jsmf+jyEQ<#bNr0KCAUYnr%4g{D(N{m#MffRnz-^cE<1DqGVEx5r zS9<&IEpl`xM442IxYkCk*}6`7oUa@Kl_Om(Wi)GrS2ItP;Ou5QroVSmsVXN0)hk8e z;lQ7wszq5KKkzMEul9)W#^WhAdM9n0$1xd~J`)gN+?&lyrT2u#TL&e_WNZu=06!YS z_X6e%y?CXFn(qe)=6ByvLZ1sdi9L_*4O%9s*q`)g@<+ngXLPynb=p>5ndD-SPd(4C`aTbdZ?bxKHELC zZeth7;3PqZD?s#@He`g7m$B$qvPY*AnR5l@#vg7e+&xsaNZJ7s<$W$OK|T@wSM zh`E>hGt7-jtmLJrt}Ivhf&`2+J~l%A7}}Xca7jJxI^wvclcjQLM5Eta<3kf9Toscy z2I56cmFzMI1s+2ser!B|B({ns8CaFV`-AdpPxNlkWi`M4xfYlJ>bcQa_Db9t&LAY; zx^2E~@4$Karl&<}9jvxNSjTQMt#zzn;Qqi*Jw&F8Na(c1_Jsc6N8&(xJElah#X~^m zO$FtV=RBR5){5SC5(*jhk?uKK7`fi`Y}eJ#ci%vh-fi6~JE0;=vP_jpjlbT?{#e-Q zg~+X2Dcc7K^U`4_pWG;HNCdX~rJUssvKg;+f3y~ob_om7(fWQVrk~|8c+5Oyh)!0u zH&@f%C3-|i_!B$Ex|tDNvP7;t@z^Uj(%<;2W8RZEAuh0EPbru^)k9_D$^x*({E+n& z{y0*heI0x$J9Uj|T}LA6SZHS^U1@BX{##YX50iv${&P>g_W{k;`KLa}>>L)9+be$H za1Hq$db|JP;I|C#s!D6abpfQ!SMEJxNrX5Po=~2~$zN$@d{C4ae%`0;u5lJIc<5zV zW0x;w_KUnGPtktlP2P#J6QNQr*8K9PVlhCrtEJW_VcAdqvfOn2!G(Z&x2T5n3f@d6yv9qGdpFIWgxra94$P&Yhsnc!#t)-Gv2pxFx>U@5&M# z7#U*2+|*`pSdAT(GQiPE$Ex`}N+I!wwb~zatxGDuvCL1$dV-cI>A&21r3eoG;Lk8> zhmAcpb*$KgS=PzD#t!=+rn>kYXx#YR)Dn+tD7G%>f%NHRvzUhtr}1(z(HiB$A-%vD z`5X-Jp!>%UspC}u?_WmmD;h%*I*Zz09eZ~A{G;;OSqJ&?c>WA=&gyqG%p)(6V*26E z{`k1QNoE~O9dKi0)Wme|c} zpD9V60svR6jT^^lPq@XY4fnzWFP@(qA|#AoRZ#%ui7nS&g(Xw!JO=DIRz0X4b&exr zkY`td`J1Q{ea9M&%2%T#Ta;&a<1sj6L)n2PV_y7NO8EsgholQRo&m^2^@skl2bJt` zu{-&e43fXh6JRAQ*3k{gK53WkKIN2vD)Z{THopDGy|Ji5&I%H;Ecs!{lt{IB9_h<_F@CJB{)}FVpTFvK zXP(=eD=e5uI3>NH`X-wAtvibZtmZ?rL z7wsuLRIVuCeEjQ}R}+ZAfvu;^h{(w;f2~*YCtDTpuuti0eA}tHeTR8%o~dzA^q5{z zUQNy_)>BQCr4&n zY9ifZI%XxIcTU~-B#>+|02RG{!zI=^*x31j0>MV-*^bTh_(BK8Ju&5MRoaw8+1sG1 zL%CEWY*}Ha7nicSa&3PfVrP_f!DVI}!S&!{Ym;aR{feM{vMO6NOZr%GWB(&Z`wMOR z#)*@43&=FFCXmN^kEWAz)MHgZ6DzNPf8RC_rbOG((u3cI+!P)?mdoPYwy+W=xS^mz zfWC?vOdizPc*paTy;7&k%4PvouNbGIDHnoj<91_&*-aZqO)}LOa&*pZeF>N7l>Pz< zd;rv0z9>AUFFFYW!822_#dpkxb^lmTJyFw~@j`t0>4*7~9p0D`MHX1=O>e$JdK(YU zaj~=9#M%X_gvkYeC*Lkko|dT;vWBG#k0&O6W2g6_Mv4}FWx^J#7cBEjg3w2YH@g)Q zuPcXBzOk0d9;`^u*e`sV2s~bPHkR-tDYRo6Xua4hTUwLG+tvh)QIX*oR|Y1Ov28Zk zylyfJyrpjDH=Jjhz5$=Jg(|PB@fV!q?btPZ{rS$TKfdo!+1YTi23~<47U94_5&pH} znfUigS(B@ik&Xh(E?Ua@PItu=bDG)ZUT{R;eznP5G{Em}%@vdRrM`+tN6I(JQMxzt zzG?+!S4Ta~BX5?vtMn^pahCg%YIEzN%1z!wZj%6cu}N6lF1c=c&0t!fJ{z?E+8|pX ztL03D#Wef7T$WgBgBg5GX1JT$UHCk!=iSaW`dgj`dWdyaEzWVS!D%kH>i&#|Y?8|9 z-4$lE_MykI*a<$47lk7Bjbdv}w_`*zdXZuGN3Iu`_YOWZs2xJ(qa;J)R&SUlR@|sR zt8oL;Vk6BgD)ama+gNdT3rq5$E=wTS_vPNL5v7O8(WRT)ia$MvhreFxtoojl@A>L* z?V3N9{Or`QzB8zrK~Wzy9(B6iNvvA2IDC!4FDT_F{|-W_zsO%Zd!zcZU$$SrY)QbT z+}KQlk=a`^_W*hzPZ#yMhjHq8PQ9i6db5c4WxBN_N7p?>>OOl+NcT)WrFk4NdiE{l z;%pD)D#!i39~nk@^PUQri!2Iu0oQ(*7KqFFs)#t$B7j`oGM}O2VyLY`9N-5vh@n;< zRNIc6&UJhY@?%IVdD-=xjGWJqn^0=jZBU)tv{v1U7ED&2v5=oi(iJ2&r=CAe0V;*$ zW$8S9fv(wveNqLlBQuhxlIr{{L<<*+21HMjNzwF5+p`Q`+5~JF9k>|vUCpaTL{(Py zw>le+8;vV|Ci0p)i8;A|+2>n*&Llb{e1az3q!#5`h2t?5>RN5A0%e*-$ySQrj$M&HIK~a9W)6d?W8J*D|_Nsk$ zGP@D92-<(_m%Dt`w&=aK1L=et-x-8!#A~nMjd>p5y_E~xqvBa(g-xz$rbrZzJy}@V zMDqqtV5Q@0Jnd^ZegdA!J_j+KUwf*Q89r!GpX^tCjM-_vCiKDr%LHG*Tq?b|4*FY1 zr|I5VzQbkN?NfI!QSV9w{6i7N+PZuZNn#B7s)KDhPO1TQJe zZL1UgBIOOdRP;I*>7?O<3ezgLDn5OQ67L#>r1#{bKe8hz0Pg XLyRvu{aX3a{{tgEGu={c*U0|?Dtn-9 literal 0 HcmV?d00001 diff --git a/image/search.png b/image/search.png new file mode 100644 index 0000000000000000000000000000000000000000..f5d84b697dad0c856a822c2df0a0da46ee3e9be3 GIT binary patch literal 12704 zcmaKTWn9x?_ct&$YBY?JE+wS96+raD)ZuW1T?Qn3UDI*M)-R57?D8{(G_ySR4Gggm^{a$ULZ`#Vl zSlI`9mR!860V&>^<>UGzD;4vViC})Ksa(fDL<)3`tNaT<{#2fw6lCrH>lD%OOh1aR z{Ml3g&0cbLo?W29O1rl;uYT|AlgnY5Wtk1R4fA56Y@{{Pk0y=hB9{g+(RJ5@-qNKjvOa^8CutOT_;keeKu@ z_jbkrr}T`M16BPOI@rG9dBd#DW>VRJ{#&#a8mSRjo@tTgVYnW?I9&fK^9LShqHR~{ z$R8L1OsSy~UIrW)mz5GLf*fiZIk{GSRhg^GGSMTs5zUk{PaJsQ(w^F#!a7XW=3U4z z4AJNt+u{kXwD)tMoSOx<=h4l5%wHVe@dVNP&MLuWh1Nm$=FKKwST}t}sBfyOa%w{a zt*5?f$bHex6HV#uP?MDB799wW=oz*W;m{eUa$fY6N&MX(9$!b-Ay}kWEZ1M{-ZfZj ztfc=7_nOtZen*(ef%;30)NJ++p(aumNd_c-=ORnXHxYRM-9%7MW`)tAhQMZFkn_GZc{UxHU(d&vI}-CD{u{JKt_sfMQ2f+e~1PX}g) z=yU{p!`wmdNnG#vywP9q0H0o*oEwx2n(2G_J-osbVltnfT=GJ4pl|k=v()=_&RSY5 zR5mY`_i4<2oKA25su*5#9{k+=oTsJ)aB`bWEi5aGb`j9x9uQm2mGv-ua!l-*Jvw3* z1X?C5dRE~*EjdJM^sBnO`TZP9lzJ5Hh&U~3?Y^W>OGkIyXRgjLjt`qEOIMvw zycfYPd#0*UcinQ^hHp&Er~`K?PP!Q9A~D(l>taQ51Sf4Bs~ex6{sATF%hoJkF>h(E zE_ybPL1AYGC|*@LRw>52Dk(-e3ywR;nB9?*362NUnTeko2S-rqnX1Z5DDG|`si(nI zrsM^8EfpT&5bu|0HkTVsJmagd1P@u}avO(Ek;zcy^VBCsU9!U`GR!yY4wWC8emffV zYafJtq~HooGv@!Utu_nFlx!q^>QKY1*1BJ`&_mJVb8v@TUtd?)o~d?o zuYZ{K1mtW53*8t^9!?W%XEb^BK)VaL>P@Za7JeS@Zk$t5s&dY#hc=H!vsn5wx0su> zzFWJhGVJaifQ5i{F;t#&p+FKf2Rpk|Wi1VMwqlA;+f?!f->oRRnnMCfYTVwsxh=mk zGYfnK6b@wrD2gg0<5VQ~T1inT)E#5^^SYK7(cekWU4a%9U9N=7inEQtSKfgZKS0FE%iFV;^>)0OMy$LK|I|vXh zhzS`bUcxGt*WTX#XN1@~M{>JivVMc5%K8~u&7`NN=j1n&`t`(D?vw;ry2`WoLc6zD z`&~@73ej4wk^1A^P?oyR-I}Y?3d71vQpNV30bCc!{E!+#^UF`%n)d9;{`8N0K3}+! z{KO;7*YfdoKKVPv6jH=5&Gju4%!PtYg-Ut-o%~i*RCI+&>0W-c$-}Edj*9+{6TZ*3 z&VKu5rpiobW@cu%fZ%Qb<_G#l1ON2tQ_izw9>GUyXB16%C+5QRY;_%+vn)!Uo4Qle zm8Pa($%xU%2$)M~dQ8=}5BobMWi=lI!t2sLRoeho<@2EUsy$-ZUtK`F@_;fc=o_Vc zd|ME$zGmJZg*L?{Qgp?_@1B&jHTtPQ3D{o~ZU*`k+}}VQmWysauEfuUBkJ}JaD_0x z;g76ITZ75>bgT^0qs|Gl*|kZCet^Svwfbq2uSD1m@EB*(YxH(fr1b+rx*na|A2ht3 z(6-UF;Vtmsi=(;=XNXMVz|GB$jNf}^>p9W0Bd_nQ-ggGVcb8em><`TyD-)-f?Bmf^y4J)XZpWkt?yEJIHL;|^ zqGfuKDhYtv#8n|%1QRHJ;L~VC2RW)^T7L&lgr}rQ%eva#_&DINL&vu`Fd?8^On$5T z!#$Zpi?OGWF|$($sMo<*n?sZ%?@a zE$BdYA)$SKo4)u92}8@3c8QmMgRgZ%9H1>0KHNN1Gwh>rKZ=tE7VU8|mmX@p%rh}D zxhR~stA}GmDK_Qd7e^Zwao_eNV$Glc;j}d>YAPlw&e{(vL82c803mkJIEWzMrypc0 zfp&ETz5!5r#QPRjjS?dRgGPRN!-*Hw^n_eJVY7>oNwbwSa@7ltI;~WkRQyz8r^Zh- zL#+{KU>#98B1=z`!%)$zldOK6y{%m2Hiu@$R_2D>^XR}4%%31FTUe-d=>uXgf`jg9 z4D-^27{Vl${W5K3@Xfb{@V>t6(OAGEIq`)Fe}Z`9HT>G#2SbS1!0#RKEKf@m$i+fR%YM7?i7qaDm~gM-c1?+)uTau(h;h~V$@ z12S1=(pY?7?|3I}iuh;0F%;}Pr>BW|9ukd8i;az4tm&=(!O0vzSG4zHQg9yZ zoSr>sdsyb7_kdtohdY=DMaTrmBg_+6%FNEb0^#qArBPq9FwRe8u%4R2Kd+F^&K349 zX~6-uvg>k7M63fZ{^lEm4pY-(kQZ3TvGrPYlG?A5Z_*1HCouf5daZqluY{wIElxIU zSH^jJG<7a=QMF>l%yHSdQ`I*HZnB!{M?2$Ev_qK`1=*Dq5bslHgutrLBu!f z!c5OzwFFQjb7nZ)-aYwi0^ecQup3fom_0zu+SF-X2!mqubfL?P$t%0DL>M5GrSuBf zr_ON~s%6hXi2d046z zJ|L$SM7XmYfw9YY0}%FMpSUX8ZRP@>Jh!aTAHj@MzPzIgbts?R1>FKO%sG<7FX*h; zIIfrbJ<}XtQAl!TJGKSg;i{YnW2hPv?k;coB8@U!I)rQkw zl5ly$AeqKlo6qp!&#cez)wXXL$wqG%D*EWRq8_|MW`u3=^SUFiEN+5cUM9ZI;I_xD zrq50TvZU16Nqzf5Am}c%;ZIm_Q8F5ejENH2zP-x`ouSF0CphWJw)JP;0{>s?+{^tcB z4xW3<n?TI268$OEjv^(LV{gTY{{8e~Ct41a%03AJRl?|+|V8n3x zv<$)A1zwYER6%xBtf<0&(nRQj2mwzod-b6Yz3x4|LGWuZx5-@PQ zr0R1J=;^jEi6~)$d3-Vmh}VX2!EsIJJ=@9n)jHyMeHi|J zMe#NX$-*uoPSkv~MZZ#QQ*sDen^VVklQ(sef z7gvw+Yh=$Qj*nC4tIt-sNP$a}fKU#GW`F;0=Z^w7IuDw7Hi|X1G@a#yLL9ONu#3a= z$Q>oYXYpw-4Gfsa<3-|UdwExx)|x6lxU4NO5V`3hd&KIgJ-BlUr$pn4tNuK~dDS6i z8-1=8@P)Rpx2dfKI@jP=9TBNY6-)LY z<%0@q6{8Dry;g5WLn}?2n=-V5=xgECRGTy40r&8UNZ5ldi256EHr*- z?#R_gJ7jhvaFAiYH5)_v1M|~ssE92}zKw{G9YhO#FD27C+YwKw-OsFL7lgvlAp~Bb zQT@poizbi)Y+~Z!so;Bm^!hQiycXhK0)MqYNaZ>?w8_TPt({RBf0Y=ps((<)AJO_U zy0^0dH$B!ygqUHI7n%Vx32iW+Vzic@E(f_qSTJ{wW=n*Wh0llzD;WU@zD3E8umDT(y2YHDiA?5s=1JrKlS zmw7(@)(Mc+Qj0tM1Zmpj{A=pzR`rA}4P%e&b7=JUKBnV?+^BYn$#D7}P! z>S9RFSo=%j#TI76+ zJ7)F1agox(sZP(pbW}Bd%lIKN%ZrO_afYyT#I+$ci}k?=T$j%2X$ag#F@W2GMn0oz zU7@I@`n~H&mV{e4ig~5MI6zR*$hIS^sUVt~zu=f~DM#jgpOvS^#5>)2gliNncp_RA zi&^7P2G`F_KS~zjfmK?DloQcw>+9uzf3D{J7w$*Eh*zVIaetEi zjYtSnX3F(~T1nD+Z2i59OSf7+ft7wDdWC0KLggh(rS`(`+izuMXcE7oB%1@pgVuBN zxR|WDaEP`uVvG|iY#R!(akr}^NP8#y5x)Y?$v}OG}|Dh(8H7cXZ^2rVG4HyH`DUHqP_K#rTonNVM?Byrd+L2p-8-uU_4U zX5Cxmgt&ChOiKoMMl>1}lQT&=r$Dydm%sS-M3SmEpxMcS87P)D!RMwX0Rf*53e5VwKlA$<$2}XGi-f$2?+e*d+sYD!PpH*D!#og!>0Oqj zka&E>dG6A~o&3lmK7QQ1DgyX=5#@+{bPp+9AOMs^_m0-9PK(N$I^_hUkqz3hSUzkIhCj5JUuf)@|>pjFv1;l|5RXPf9N|a6KhKB!no&_dXQL^3|FOGQltKS-I zr5y0Ea|X`{ds24{sk9$Hxyh8u^FAD%uRQX-s|tX*fU3&p(ESki$x%+|$jFGlcxK!c zwArcqvA~iTY)5)9v ziv^!%KfMOCyd?%Ggwo-*8~2}o^Tav0riU*Ax`p!-+f ztCqDP-?<_fhGwrc+VFhs+vRb0bEZ?Da9uOU*-4Y{SZ`so$dS>X zvNbUJRtNtWjS4Cn(~9wm@lBYG9y9|L5$C-OAb9MEoIZI^#Uyi)*A!>mu%&rw1i9Zck3mV)@DU<12 zto>MgY-g#9G_AKEVIA{YSUSUhzI*^37xhfHf7`7pfF;{W$r{+EJ|h+5660Z37Tu=_ z0@1>sepfo7QZBdS^f&H!GsdwL_AK>jI*Kko+U@nj>D|?r{Y~?Ib#V5_tHev?1{FbJ z{DpJP(kr*REarIiloKqG&`RSgU}c+pEnCX$d9x-7fO!B*UI+ zv?i9An7BN|V^q&!MAA51@Oc2c;+V5OSBXL8O?MUSB@*DiB zIr2AsZ{#F<2fNs`JF9N&V&H}SBhJol#f3!LNU}vpO|IhvnOi0(?UtvsZJ~R-B zgJ)$syj-a`QxB1K1#nmCL!)y!TS$F^IC zBRUs&13r|;h{OHa{Px8r-m6-5^FFiZwT=?}YOK+Mw@?0M(-&2n#rTPM92<-I(9qHO zu(jN2B>+WW(VHv#uF>X9s{2#)Q64_T-~k1>tv<$#UuKRHPxfD^3EU_>KvI*jv7G3a zYTsz$U!?N5@y2dQwv(Xqf$ zb@D?Oa$vj9ekaUVt8@%!Pc()a%^d5mV@Lm^h4}N&I~|a_*~NiF??Sx+(w&#zCwzEdS9~wq@FnAWVSW1|1xUJ9 z7=`Z&8HneW!GfRN`>w~Qf3y5!X5Pc#FX21}NT$#&mi|$NdkK*qni@~>WEqOmKkOQM zx(!?Pi)gj~qNAXpox+CYKG=9fswY2~W1$R(R-Q1{9HZzC4B^M7M@>xj29h`})B&wy zv@dZXp%3@|Z#JmHn^ak7^MR01m!A12Qr0v-y-sesI)A4YPBTjR70Z?G2z^@`@=T-y zctbTUGRbRPvhYAD)-K#T!xd$DF4FOaQPrG>BABG}y&wyyVgj>#-wz}=I)$VDyOo?n z&qkOPQ1BRR{prNkr-4%?LbSb228ypW;#0w7Wu@nmp)gB{>y`b6lGQi-IsJT>p zd?27jncg5HVp!;NuKd5-j8=Yq`pVyQ<-pVm{7-b&svze?Fy~ z0SdiS+V2`IaMgA4B1W(UIMgUaxiFX1J3rQ&ODEFlIsP<{PV}AKLzbK>P(NtlF4KSD zry{anV?G1aasTlzMUE{&xy`yO36WLrvv2z|CRW@)s;~S3{f?QvIWhj_6COGz+UICR z^riDXx%2w>p!a{QKyDsNW7u~30D78ey+OWmG1 zahql0m=l7FDO%?Bs%<^XX9U0l&&>@q$Btr6(uYs9F!;P}FZkVU0$PVN67G|&P7scL zjly9;Y=mIl^8ZV;f~0prr6XAA$Mz4}85&OiSEkhpU*t6O%O(TbR0l|YIz0a~D5ejZ zi2M2+kCI~wtVs5lFdO3wxyyfS=ndgSI;`m{qnoW-biv6w_uk8VV2E5kJdnY?+qlF_ zNtL#O6>Wq|u%ZrLVg85|7yj-~td8?+3=mH+ND5J=FW3Y=^0!Vcxqf2;ceF)5moL5C zUg?RtW2j56J@~M(Z;NmTozrJo6O>$qR902(f!mzL#-8~1Ctey8Fc49L=_v0EfaYoKHUQVF@ArA&DYRL=8=<{MpV@8}pnr3P{;vE{+ zx63E#>FQ#{tNa4MBZXqVukO=J$7*5hjN6DRJnonjO8Lib6d0-M^+olw(I@m_#UIvx4-2wEH=(O_L#B6%z{m2_A}7YoH@t@*)~t`?)9C2v zN>`YNtC64&ho>H2D3LsFk9%%nQ+HNR4|0$ecE^;Y?->I4DpcLVE$YFN>Vlq_D*^#o z|9tuJuaGY&L_CH33jW!Nt=)3MY<%#qW|X3#0W;%@xpTeWz67#57#BvPkO=3Zqje4@ z?c`S|?=G{R@_s91SKHZX-qzw&J2&KRi$8&B7qJffD#(7*MMCXpBrYi#)Lv4u9%fF4 zo@p-8&gJ7cH)_dXpib;KZwwBdaCY|j947~PJ%j63*50BP3u;Ya_-C`8feR1TF=eusR?=)c)HW)h7v;Lndw1a~Z znfg!lK5TvR@)4J>>Ht@p2c=(mW#w++-@kvU2UC>CG$REa`im-e`gbG7hlYm8b5kw% zOr{C(&E;<*70B@98+3K$j{!UdG6@2^fa`^LR@sQ>9QO|w9CL;61bWIJ7cRbIt z8VI|w_1e($strnQ2G{^I@>F_B+o;iNdm2)@rYe_MM3+G8a~ARZ7+d09`iSt15&-w3 z5^MvK{m+iXyg;M6WEyHwzpf=R_D1vkV#YKJHlJ*KAL+27Qm6n{>*x;f3DmO%kRP#F zuo~VAc=CIeq|hI1Hj^N&us2W<#s|uIG{&SHvn|)n;b%n&U&49T^D?dd02M~j$%o(LaX!#3d9tJOP|8oji^l;B?+RO=Ba}V22b_bZuXk%~Z;=IlBR_ zAePIadw-{GSufs^L}jn(9xvF6`I$7uumFYH@_+A{{Y%*$%5#vxfvZ0Mnj|vHTJECQ zQln1oE(cfwZt2Wp8|?nYoxj_?f@u`?%^Z_A^)RpF(`DYT#}AK;bP#n*F>pXhWAk8^ zt)M#{MB0Y6!DHP$2InZfz4rTO!o9m@*TFTdt-h$slkGL&&%%p;x8AWgjh2K=7XwdB z&0}=e5vI$Wrp4x#m?C~)hzVEkU%SgF)>CTLJ^ihFkrH;$LAq?ZM*V0y(rg3cOSKUk zfUPPfOW)Znymv~oxi}*NU>V~?g0NcjW##>bb#*9@_ZiXMZo3YHH&v;N#B5n<2G(WItdU&dH=i`0=5^b);) zWC1Pxs>t`bQ=33Xhyt;>XTC>uAhs_h;P~smTXI2<|BX)?G>Q`iGV+&pn!fKx19$JU z-u%`_xEe9aP>HZ~!BWzvpb1AS0E}P6g>EQ}=sAsYVV9LXT-BbZM-%{oLdvC%lvvs@ z6-0TU9il9q=3*#bC-p4_RslLc?In<+qjPh7LbMwe2r#}Nb}I}3o4V>ze*S#KS0I_S z+$Zq7$N8`k{{eRD&&_wSA9iS1>*($ymK3bUcVanTi4g+mTME#m-HFReKz6K}yE=Yc z;@RMk?ldC!9KP!@U`+q%U=fikDGKvBy(QTD?KS@@OF~4hbOW-^ZZysiP7EqZOBiU)4~k2ZOG$44Vi4yvSbzH#9fj4ZWjIkVH9QwZy>8 zf}bw{n3|fZ<{X~S-tm=RQUbyMec#|9+vk4t#+3xbNvbvoe(c&OHrZF-?9n~sO5aq{ zW}F+7AoLp%SUCg;!C4>g0fgX~N7VRkF7F%;HreRi|M9H?P4aTIL`P95JY*MfK4!nN+l-dGOT+LirWWqu1|nJ#8S`Xfl_g1m$|A3(!udzK#!BGyN;g>q!Q9C@Cg1kP+6_0+t*Pb0B* zGO6~XKE_(4=cdpeC;1af?>HVDa=@wn;o3yt4?K!4j$w~n0dRG;@0N{)CoZn8doG&~ zX~Xj<9uq3t2ThDfEngpE3*I0&G?yWdU7PENCB0<{9eDriWNekoD{LlDNVg9s&?YjS zxL#h01}r=wh8h_d=!ZZcol$!8i-BY0x`8H<-S2omhRj7`hQ&O_+_f9bh5oTs3WQjDiT9z3CRk*I^!7jFB6g^Hn)&G z&joW~?T`@er<8km$SZ4K-;0C}_xsQeEle_)3yGZ}s>4$h$0B@hA$($UA?j-`z%#62 z()?5dBkPC5{q?+1*8SM0nuBoMwS*OwE+^8%GiscF)oq2QgqAK_sFvkm&E7i#TyrBM zqpt;D&|7D;l#JLTbvlw=sl#dHPl7m<^|3I1>x8DQ(E_&(+}WsAof!Q?7gQrZwq{)W znJmG1wDA{M0%bf~Sy?$F)+06@h+mb8Ywstk5Y~9eb2KKJ+sV$?!+^GVb9pa1B+idG zPqB+4i5nY@P0Ab!19ftB2nTqu#@P=ZLo}fN0P1(G!j*;+x zqJxJetputfNtVb}DX6d;kg|-SKCu%oLQim=$Qb}RbyQ_NrVpSYhp3^R0jzF>tMfmj zfqe@6WMTlC4rRCwk|f;QPy_VOvM&oG?z?b`$p_0gxY!o3V&{WAp_k+!K{7pzd~rrZ za>zNB!PWPF`Y53d@u3@_B!MvSmmw@w1JLjMd~99h6g!Fy5c2PWQtm4Cm?&8DI_P8Wc?={EC<|j{rrKcswfGg=0y7neDnOsug<+#C z+<)WVFXygcu>gL|Tu!T@ZO%K0O#eH3E%lgh9Lh40}t?f*`y9eOD&)}tArkf({2#qw-# zkyqHo&P7{WTT=B8gfQQc8K=*M?&0eerZ8%uQVl6F_)CUA7q$pX5ai)&X>NZ0?G1_! zr73$Xy}@u`#yXX8ERl5+?r_%z%hUNFh&dFxqF0*>a#&hv$N;n z@-nMDEW~-)&UFH!mePQKjfA*kS4EYio;f-}dEZV;8DdlBw9=@qQecD%!pTuTOSFcIc&hy{iZ!&NJ1j z!^-~vu(r0AEK+VtymG~;m9p`^+S`$@_qm$s9re6q%0W9el!+Vgk`@&Db#%+LSA9J+ Vu(5TF{pSVFvnSfBRgWw~{|7^yU3&lk literal 0 HcmV?d00001 diff --git a/index.html b/index.html new file mode 100644 index 0000000..839e6f3 --- /dev/null +++ b/index.html @@ -0,0 +1,96 @@ + + + + + + aureooms/es-red-black-tree API Document + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +

aureooms/es-red-black-tree

+

red-black tree library for JavaScript. See documentation.

+

NPM license +NPM version +Build status +Coverage status +Dependencies status +Dev dependencies status +Code Climate +NPM downloads per month +GitHub issues +Documentation

+
+
+ + + + + + + + + + + + diff --git a/manual/example.html b/manual/example.html new file mode 100644 index 0000000..5e1a90c --- /dev/null +++ b/manual/example.html @@ -0,0 +1,98 @@ + + + + + + Example + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +
+
+ Manual + » + Example +
+ +
+
+ + + + + + + + + + + + diff --git a/manual/index.html b/manual/index.html new file mode 100644 index 0000000..a3c1e25 --- /dev/null +++ b/manual/index.html @@ -0,0 +1,130 @@ + + + + + + Manual + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +
+ +
+

Overview

+
    + +
+
+
+

Installation

+ +
+
+

Usage

+ +
+
+

Example

+
    + +
+
+ +
+
+ + + + + + + + + + + + diff --git a/manual/installation.html b/manual/installation.html new file mode 100644 index 0000000..2db23bf --- /dev/null +++ b/manual/installation.html @@ -0,0 +1,109 @@ + + + + + + Installation + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +
+
+ Manual + » + Installation +
+

Can be managed through +jspm +or npm.

+

jspm

+
jspm install github:aureooms/es-red-black-tree
+# or
+jspm install npm:aureooms-es-red-black-tree
+
+

npm

+
npm install aureooms-es-red-black-tree --save
+
+
+
+
+ + + + + + + + + + + + diff --git a/manual/overview.html b/manual/overview.html new file mode 100644 index 0000000..d8dc893 --- /dev/null +++ b/manual/overview.html @@ -0,0 +1,98 @@ + + + + + + Overview + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +
+
+ Manual + » + Overview +
+ +
+
+ + + + + + + + + + + + diff --git a/manual/usage.html b/manual/usage.html new file mode 100644 index 0000000..2f0eaf5 --- /dev/null +++ b/manual/usage.html @@ -0,0 +1,116 @@ + + + + + + Usage + + + + + + + + + + + +
+ Home + Manual + Reference + Source + Test + Repository + +
+ + + +
+
+ Manual + » + Usage +
+

Depending on the syntax used by this code you will need to pass the source +through a transpiler, for example babel.

+

jspm

+

Configure jspm to transpile all the code. Then

+
let redblacktree = require( 'github:aureooms/es-red-black-tree' ) ;
+// or
+import redblacktree from 'aureooms-es-red-black-tree' ;
+
+

npm

+

Configure your code to transpile dependencies on the fly (for example with +babel-register). Then you can

+
import redblacktree from 'aureooms-es-red-black-tree' ;
+
+

Additionally, for the browser, you can configure +rollup, +browserify, +or webpack to transpile and package the +dependencies with your code.

+
+
+
+ + + + + + + + + + + + diff --git a/script/inherited-summary.js b/script/inherited-summary.js new file mode 100644 index 0000000..0a35b6d --- /dev/null +++ b/script/inherited-summary.js @@ -0,0 +1,28 @@ +(function(){ + function toggle(ev) { + var button = ev.target; + var parent = ev.target.parentElement; + while(parent) { + if (parent.tagName === 'TABLE' && parent.classList.contains('summary')) break; + parent = parent.parentElement; + } + + if (!parent) return; + + var tbody = parent.querySelector('tbody'); + if (button.classList.contains('opened')) { + button.classList.remove('opened'); + button.classList.add('closed'); + tbody.style.display = 'none'; + } else { + button.classList.remove('closed'); + button.classList.add('opened'); + tbody.style.display = 'block'; + } + } + + var buttons = document.querySelectorAll('.inherited-summary thead .toggle'); + for (var i = 0; i < buttons.length; i++) { + buttons[i].addEventListener('click', toggle); + } +})(); diff --git a/script/inner-link.js b/script/inner-link.js new file mode 100644 index 0000000..69a7477 --- /dev/null +++ b/script/inner-link.js @@ -0,0 +1,31 @@ +// inner link(#foo) can not correctly scroll, because page has fixed header, +// so, I manually scroll. +(function(){ + var matched = location.hash.match(/errorLines=([\d,]+)/); + if (matched) return; + + function adjust() { + window.scrollBy(0, -55); + var el = document.querySelector('.inner-link-active'); + if (el) el.classList.remove('inner-link-active'); + + // ``[ ] . ' " @`` are not valid in DOM id. so must escape these. + var id = location.hash.replace(/([\[\].'"@$])/g, '\\$1'); + var el = document.querySelector(id); + if (el) el.classList.add('inner-link-active'); + } + + window.addEventListener('hashchange', adjust); + + if (location.hash) { + setTimeout(adjust, 0); + } +})(); + +(function(){ + var els = document.querySelectorAll('[href^="#"]'); + for (var i = 0; i < els.length; i++) { + var el = els[i]; + el.href = location.href + el.getAttribute('href'); // because el.href is absolute path + } +})(); diff --git a/script/manual.js b/script/manual.js new file mode 100644 index 0000000..125049d --- /dev/null +++ b/script/manual.js @@ -0,0 +1,13 @@ +(function(){ + var matched = location.pathname.match(/([^/]*)\.html$/); + if (!matched) return; + + var currentName = matched[1]; + var cssClass = '.navigation [data-toc-name="' + currentName + '"]'; + var styleText = cssClass + ' .manual-toc { display: block; }\n'; + styleText += cssClass + ' .manual-toc-title { background-color: #039BE5; }\n'; + styleText += cssClass + ' .manual-toc-title a { color: white; }\n'; + var style = document.createElement('style'); + style.textContent = styleText; + document.querySelector('head').appendChild(style); +})(); diff --git a/script/patch-for-local.js b/script/patch-for-local.js new file mode 100644 index 0000000..5756d13 --- /dev/null +++ b/script/patch-for-local.js @@ -0,0 +1,8 @@ +(function(){ + if (location.protocol === 'file:') { + var elms = document.querySelectorAll('a[href="./"]'); + for (var i = 0; i < elms.length; i++) { + elms[i].href = './index.html'; + } + } +})(); diff --git a/script/prettify/Apache-License-2.0.txt b/script/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/script/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/script/prettify/prettify.js b/script/prettify/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/script/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p' + pair[2] + ''); + } + } + + var innerHTML = ''; + for (kind in html) { + var list = html[kind]; + if (!list.length) continue; + innerHTML += '
  • ' + kind + '
  • \n' + list.join('\n'); + } + result.innerHTML = innerHTML; + if (innerHTML) result.style.display = 'block'; + selectedIndex = -1; + }); + + // down, up and enter key are pressed, select search result. + input.addEventListener('keydown', function(ev){ + if (ev.keyCode === 40) { + // arrow down + var current = result.children[selectedIndex]; + var selected = result.children[selectedIndex + 1]; + if (selected && selected.classList.contains('search-separator')) { + var selected = result.children[selectedIndex + 2]; + selectedIndex++; + } + + if (selected) { + if (current) current.classList.remove('selected'); + selectedIndex++; + selected.classList.add('selected'); + } + } else if (ev.keyCode === 38) { + // arrow up + var current = result.children[selectedIndex]; + var selected = result.children[selectedIndex - 1]; + if (selected && selected.classList.contains('search-separator')) { + var selected = result.children[selectedIndex - 2]; + selectedIndex--; + } + + if (selected) { + if (current) current.classList.remove('selected'); + selectedIndex--; + selected.classList.add('selected'); + } + } else if (ev.keyCode === 13) { + // enter + var current = result.children[selectedIndex]; + if (current) { + var link = current.querySelector('a'); + if (link) location.href = link.href; + } + } else { + return; + } + + ev.preventDefault(); + }); + + // select search result when search result is mouse over. + result.addEventListener('mousemove', function(ev){ + var current = result.children[selectedIndex]; + if (current) current.classList.remove('selected'); + + var li = ev.target; + while (li) { + if (li.nodeName === 'LI') break; + li = li.parentElement; + } + + if (li) { + selectedIndex = Array.prototype.indexOf.call(result.children, li); + li.classList.add('selected'); + } + }); + + // clear search result when body is clicked. + document.body.addEventListener('click', function(ev){ + selectedIndex = -1; + result.style.display = 'none'; + result.innerHTML = ''; + }); + +})(); diff --git a/script/search_index.js b/script/search_index.js new file mode 100644 index 0000000..3e9b8f8 --- /dev/null +++ b/script/search_index.js @@ -0,0 +1,740 @@ +window.esdocSearchIndex = [ + [ + "aureooms-es-red-black-tree/src/base/colors.js~black", + "variable/index.html#static-variable-BLACK", + "BLACK aureooms-es-red-black-tree/src/base/colors.js", + "variable" + ], + [ + "aureooms-es-red-black-tree/src/node/leaf.js~leaf", + "function/index.html#static-function-Leaf", + "Leaf aureooms-es-red-black-tree/src/node/Leaf.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/node/node.js~node", + "function/index.html#static-function-Node", + "Node aureooms-es-red-black-tree/src/node/Node.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/colors.js~red", + "variable/index.html#static-variable-RED", + "RED aureooms-es-red-black-tree/src/base/colors.js", + "variable" + ], + [ + "aureooms-es-red-black-tree/src/adt/redblacktree.js~redblacktree", + "class/src/adt/RedBlackTree.js~RedBlackTree.html", + "RedBlackTree aureooms-es-red-black-tree/src/adt/RedBlackTree.js", + "class" + ], + [ + "aureooms-es-red-black-tree/src/removal/delete_case1.js~delete_case1", + "function/index.html#static-function-delete_case1", + "delete_case1 aureooms-es-red-black-tree/src/removal/delete_case1.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/removal/delete_case2.js~delete_case2", + "function/index.html#static-function-delete_case2", + "delete_case2 aureooms-es-red-black-tree/src/removal/delete_case2.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/removal/delete_case3.js~delete_case3", + "function/index.html#static-function-delete_case3", + "delete_case3 aureooms-es-red-black-tree/src/removal/delete_case3.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/removal/delete_case4.js~delete_case4", + "function/index.html#static-function-delete_case4", + "delete_case4 aureooms-es-red-black-tree/src/removal/delete_case4.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/removal/delete_case5.js~delete_case5", + "function/index.html#static-function-delete_case5", + "delete_case5 aureooms-es-red-black-tree/src/removal/delete_case5.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/removal/delete_case6.js~delete_case6", + "function/index.html#static-function-delete_case6", + "delete_case6 aureooms-es-red-black-tree/src/removal/delete_case6.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/removal/delete_one_child.js~delete_one_child", + "function/index.html#static-function-delete_one_child", + "delete_one_child aureooms-es-red-black-tree/src/removal/delete_one_child.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/find.js~find", + "function/index.html#static-function-find", + "find aureooms-es-red-black-tree/src/base/find.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/grandparent.js~grandparent", + "function/index.html#static-function-grandparent", + "grandparent aureooms-es-red-black-tree/src/base/grandparent.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/inordertraversal.js~inordertraversal", + "function/index.html#static-function-inordertraversal", + "inordertraversal aureooms-es-red-black-tree/src/base/inordertraversal.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/insert.js~insert", + "function/index.html#static-function-insert", + "insert aureooms-es-red-black-tree/src/base/insert.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/insertion/insert_case1.js~insert_case1", + "function/index.html#static-function-insert_case1", + "insert_case1 aureooms-es-red-black-tree/src/insertion/insert_case1.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/insertion/insert_case2.js~insert_case2", + "function/index.html#static-function-insert_case2", + "insert_case2 aureooms-es-red-black-tree/src/insertion/insert_case2.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/insertion/insert_case3.js~insert_case3", + "function/index.html#static-function-insert_case3", + "insert_case3 aureooms-es-red-black-tree/src/insertion/insert_case3.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/insertion/insert_case4.js~insert_case4", + "function/index.html#static-function-insert_case4", + "insert_case4 aureooms-es-red-black-tree/src/insertion/insert_case4.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/insertion/insert_case5.js~insert_case5", + "function/index.html#static-function-insert_case5", + "insert_case5 aureooms-es-red-black-tree/src/insertion/insert_case5.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/predecessor.js~predecessor", + "function/index.html#static-function-predecessor", + "predecessor aureooms-es-red-black-tree/src/base/predecessor.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/replace_node.js~replace_node", + "function/index.html#static-function-replace_node", + "replace_node aureooms-es-red-black-tree/src/base/replace_node.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/rotate_left.js~rotate_left", + "function/index.html#static-function-rotate_left", + "rotate_left aureooms-es-red-black-tree/src/base/rotate_left.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/rotate_right.js~rotate_right", + "function/index.html#static-function-rotate_right", + "rotate_right aureooms-es-red-black-tree/src/base/rotate_right.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/sibling.js~sibling", + "function/index.html#static-function-sibling", + "sibling aureooms-es-red-black-tree/src/base/sibling.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/successor.js~successor", + "function/index.html#static-function-successor", + "successor aureooms-es-red-black-tree/src/base/successor.js", + "function" + ], + [ + "aureooms-es-red-black-tree/src/base/uncle.js~uncle", + "function/index.html#static-function-uncle", + "uncle aureooms-es-red-black-tree/src/base/uncle.js", + "function" + ], + [ + "builtinexternal/ecmascriptexternal.js~array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~arraybuffer", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~ArrayBuffer", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~boolean", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Boolean", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~dataview", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~DataView", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~date", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Date", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~error", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Error", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~evalerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~EvalError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~float32array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Float32Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~float64array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Float64Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~function", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Function", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~generator", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Generator", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~generatorfunction", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~GeneratorFunction", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~infinity", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Infinity", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~int16array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Int16Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~int32array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Int32Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~int8array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Int8Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~internalerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~InternalError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~json", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~JSON", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~map", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Map", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~nan", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~NaN", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~number", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Number", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~object", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Object", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~promise", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Promise", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~proxy", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Proxy", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~rangeerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~RangeError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~referenceerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~ReferenceError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~reflect", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Reflect", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~regexp", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~RegExp", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~set", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Set", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~string", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~String", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~symbol", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Symbol", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~syntaxerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~SyntaxError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~typeerror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~TypeError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~urierror", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~URIError", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~uint16array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Uint16Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~uint32array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Uint32Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~uint8array", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Uint8Array", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~uint8clampedarray", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~Uint8ClampedArray", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~weakmap", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~WeakMap", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~weakset", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~WeakSet", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~boolean", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~boolean", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~function", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~function", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~null", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~null", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~number", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~number", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~object", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~object", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~string", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~string", + "external" + ], + [ + "builtinexternal/ecmascriptexternal.js~undefined", + "external/index.html", + "BuiltinExternal/ECMAScriptExternal.js~undefined", + "external" + ], + [ + "builtinexternal/webapiexternal.js~audiocontext", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~AudioContext", + "external" + ], + [ + "builtinexternal/webapiexternal.js~canvasrenderingcontext2d", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~CanvasRenderingContext2D", + "external" + ], + [ + "builtinexternal/webapiexternal.js~documentfragment", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~DocumentFragment", + "external" + ], + [ + "builtinexternal/webapiexternal.js~element", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~Element", + "external" + ], + [ + "builtinexternal/webapiexternal.js~event", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~Event", + "external" + ], + [ + "builtinexternal/webapiexternal.js~node", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~Node", + "external" + ], + [ + "builtinexternal/webapiexternal.js~nodelist", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~NodeList", + "external" + ], + [ + "builtinexternal/webapiexternal.js~xmlhttprequest", + "external/index.html", + "BuiltinExternal/WebAPIExternal.js~XMLHttpRequest", + "external" + ], + [ + "src/adt/redblacktree.js", + "file/src/adt/RedBlackTree.js.html", + "src/adt/RedBlackTree.js", + "file" + ], + [ + "src/adt/redblacktree.js~redblacktree#[symbol.iterator]", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-[Symbol.iterator]", + "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", + "method" + ], + [ + "src/adt/redblacktree.js~redblacktree#add", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-add", + "src/adt/RedBlackTree.js~RedBlackTree#add", + "method" + ], + [ + "src/adt/redblacktree.js~redblacktree#compare", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-member-compare", + "src/adt/RedBlackTree.js~RedBlackTree#compare", + "member" + ], + [ + "src/adt/redblacktree.js~redblacktree#constructor", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-constructor-constructor", + "src/adt/RedBlackTree.js~RedBlackTree#constructor", + "method" + ], + [ + "src/adt/redblacktree.js~redblacktree#delete", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-delete", + "src/adt/RedBlackTree.js~RedBlackTree#delete", + "method" + ], + [ + "src/adt/redblacktree.js~redblacktree#find", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-find", + "src/adt/RedBlackTree.js~RedBlackTree#find", + "method" + ], + [ + "src/adt/redblacktree.js~redblacktree#root", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-member-root", + "src/adt/RedBlackTree.js~RedBlackTree#root", + "member" + ], + [ + "src/adt/index.js", + "file/src/adt/index.js.html", + "src/adt/index.js", + "file" + ], + [ + "src/base/colors.js", + "file/src/base/colors.js.html", + "src/base/colors.js", + "file" + ], + [ + "src/base/find.js", + "file/src/base/find.js.html", + "src/base/find.js", + "file" + ], + [ + "src/base/grandparent.js", + "file/src/base/grandparent.js.html", + "src/base/grandparent.js", + "file" + ], + [ + "src/base/index.js", + "file/src/base/index.js.html", + "src/base/index.js", + "file" + ], + [ + "src/base/inordertraversal.js", + "file/src/base/inordertraversal.js.html", + "src/base/inordertraversal.js", + "file" + ], + [ + "src/base/insert.js", + "file/src/base/insert.js.html", + "src/base/insert.js", + "file" + ], + [ + "src/base/predecessor.js", + "file/src/base/predecessor.js.html", + "src/base/predecessor.js", + "file" + ], + [ + "src/base/replace_node.js", + "file/src/base/replace_node.js.html", + "src/base/replace_node.js", + "file" + ], + [ + "src/base/rotate_left.js", + "file/src/base/rotate_left.js.html", + "src/base/rotate_left.js", + "file" + ], + [ + "src/base/rotate_right.js", + "file/src/base/rotate_right.js.html", + "src/base/rotate_right.js", + "file" + ], + [ + "src/base/sibling.js", + "file/src/base/sibling.js.html", + "src/base/sibling.js", + "file" + ], + [ + "src/base/successor.js", + "file/src/base/successor.js.html", + "src/base/successor.js", + "file" + ], + [ + "src/base/uncle.js", + "file/src/base/uncle.js.html", + "src/base/uncle.js", + "file" + ], + [ + "src/index.js", + "file/src/index.js.html", + "src/index.js", + "file" + ], + [ + "src/insertion/index.js", + "file/src/insertion/index.js.html", + "src/insertion/index.js", + "file" + ], + [ + "src/insertion/insert_case1.js", + "file/src/insertion/insert_case1.js.html", + "src/insertion/insert_case1.js", + "file" + ], + [ + "src/insertion/insert_case2.js", + "file/src/insertion/insert_case2.js.html", + "src/insertion/insert_case2.js", + "file" + ], + [ + "src/insertion/insert_case3.js", + "file/src/insertion/insert_case3.js.html", + "src/insertion/insert_case3.js", + "file" + ], + [ + "src/insertion/insert_case4.js", + "file/src/insertion/insert_case4.js.html", + "src/insertion/insert_case4.js", + "file" + ], + [ + "src/insertion/insert_case5.js", + "file/src/insertion/insert_case5.js.html", + "src/insertion/insert_case5.js", + "file" + ], + [ + "src/node/leaf.js", + "file/src/node/Leaf.js.html", + "src/node/Leaf.js", + "file" + ], + [ + "src/node/node.js", + "file/src/node/Node.js.html", + "src/node/Node.js", + "file" + ], + [ + "src/node/index.js", + "file/src/node/index.js.html", + "src/node/index.js", + "file" + ], + [ + "src/removal/delete_case1.js", + "file/src/removal/delete_case1.js.html", + "src/removal/delete_case1.js", + "file" + ], + [ + "src/removal/delete_case2.js", + "file/src/removal/delete_case2.js.html", + "src/removal/delete_case2.js", + "file" + ], + [ + "src/removal/delete_case3.js", + "file/src/removal/delete_case3.js.html", + "src/removal/delete_case3.js", + "file" + ], + [ + "src/removal/delete_case4.js", + "file/src/removal/delete_case4.js.html", + "src/removal/delete_case4.js", + "file" + ], + [ + "src/removal/delete_case5.js", + "file/src/removal/delete_case5.js.html", + "src/removal/delete_case5.js", + "file" + ], + [ + "src/removal/delete_case6.js", + "file/src/removal/delete_case6.js.html", + "src/removal/delete_case6.js", + "file" + ], + [ + "src/removal/delete_one_child.js", + "file/src/removal/delete_one_child.js.html", + "src/removal/delete_one_child.js", + "file" + ], + [ + "src/removal/index.js", + "file/src/removal/index.js.html", + "src/removal/index.js", + "file" + ] +] \ No newline at end of file diff --git a/script/test-summary.js b/script/test-summary.js new file mode 100644 index 0000000..2f32cb0 --- /dev/null +++ b/script/test-summary.js @@ -0,0 +1,54 @@ +(function(){ + function toggle(ev) { + var button = ev.target; + var parent = ev.target.parentElement; + while(parent) { + if (parent.tagName === 'TR' && parent.classList.contains('test-describe')) break; + parent = parent.parentElement; + } + + if (!parent) return; + + var direction; + if (button.classList.contains('opened')) { + button.classList.remove('opened'); + button.classList.add('closed'); + direction = 'closed'; + } else { + button.classList.remove('closed'); + button.classList.add('opened'); + direction = 'opened'; + } + + var targetDepth = parseInt(parent.dataset.testDepth, 10) + 1; + var nextElement = parent.nextElementSibling; + while (nextElement) { + var depth = parseInt(nextElement.dataset.testDepth, 10); + if (depth >= targetDepth) { + if (direction === 'opened') { + if (depth === targetDepth) nextElement.style.display = ''; + } else if (direction === 'closed') { + nextElement.style.display = 'none'; + var innerButton = nextElement.querySelector('.toggle'); + if (innerButton && innerButton.classList.contains('opened')) { + innerButton.classList.remove('opened'); + innerButton.classList.add('closed'); + } + } + } else { + break; + } + nextElement = nextElement.nextElementSibling; + } + } + + var buttons = document.querySelectorAll('.test-summary tr.test-describe .toggle'); + for (var i = 0; i < buttons.length; i++) { + buttons[i].addEventListener('click', toggle); + } + + var topDescribes = document.querySelectorAll('.test-summary tr[data-test-depth="0"]'); + for (var i = 0; i < topDescribes.length; i++) { + topDescribes[i].style.display = ''; + } +})(); diff --git a/source.html b/source.html new file mode 100644 index 0000000..5fb6f2a --- /dev/null +++ b/source.html @@ -0,0 +1,365 @@ + + + + + + Source | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
    + Home + Manual + Reference + Source + Test + Repository + +
    + + + +

    Source 2/35

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    FileIdentifierDocumentSizeLinesUpdated
    src/adt/RedBlackTree.jsRedBlackTree0 %0/81519 byte722016-07-05 12:53:58 (UTC)
    src/adt/index.js--33 byte12016-07-05 09:31:45 (UTC)
    src/base/colors.jsBLACK +RED0 %0/248 byte22016-07-05 08:46:01 (UTC)
    src/base/find.jsfind0 %0/1352 byte292016-07-05 08:46:01 (UTC)
    src/base/grandparent.jsgrandparent0 %0/1125 byte62016-07-05 08:46:01 (UTC)
    src/base/index.js--362 byte122016-07-05 09:32:15 (UTC)
    src/base/inordertraversal.jsinordertraversal0 %0/1220 byte142016-07-05 08:46:01 (UTC)
    src/base/insert.jsinsert0 %0/1360 byte382016-07-05 08:46:01 (UTC)
    src/base/predecessor.jspredecessor0 %0/1136 byte92016-07-05 08:46:01 (UTC)
    src/base/replace_node.jsreplace_node0 %0/1211 byte132016-07-05 08:46:01 (UTC)
    src/base/rotate_left.jsrotate_left100 %1/1583 byte332016-07-05 12:45:48 (UTC)
    src/base/rotate_right.jsrotate_right100 %1/1593 byte342016-07-05 12:46:44 (UTC)
    src/base/sibling.jssibling0 %0/1199 byte92016-07-05 08:46:01 (UTC)
    src/base/successor.jssuccessor0 %0/1133 byte92016-07-05 10:41:09 (UTC)
    src/base/uncle.jsuncle0 %0/1286 byte112016-07-05 10:39:06 (UTC)
    src/index.js--132 byte52016-07-05 09:31:07 (UTC)
    src/insertion/index.js--165 byte52016-07-05 09:32:39 (UTC)
    src/insertion/insert_case1.jsinsert_case10 %0/1183 byte112016-07-05 08:46:01 (UTC)
    src/insertion/insert_case2.jsinsert_case20 %0/1207 byte112016-07-05 08:46:01 (UTC)
    src/insertion/insert_case3.jsinsert_case30 %0/1395 byte182016-07-05 08:46:01 (UTC)
    src/insertion/insert_case4.jsinsert_case40 %0/1855 byte412016-07-05 10:25:37 (UTC)
    src/insertion/insert_case5.jsinsert_case50 %0/1254 byte142016-07-05 08:46:01 (UTC)
    src/node/Leaf.jsLeaf0 %0/1170 byte82016-07-05 08:46:01 (UTC)
    src/node/Node.jsNode0 %0/1266 byte112016-07-05 08:46:01 (UTC)
    src/node/index.js--50 byte22016-07-05 09:33:04 (UTC)
    src/removal/delete_case1.jsdelete_case10 %0/1129 byte82016-07-05 08:46:01 (UTC)
    src/removal/delete_case2.jsdelete_case20 %0/1349 byte182016-07-05 08:46:01 (UTC)
    src/removal/delete_case3.jsdelete_case30 %0/1404 byte192016-07-05 08:46:01 (UTC)
    src/removal/delete_case4.jsdelete_case40 %0/1353 byte172016-07-05 08:46:01 (UTC)
    src/removal/delete_case5.jsdelete_case50 %0/11033 byte302016-07-05 08:46:01 (UTC)
    src/removal/delete_case6.jsdelete_case60 %0/1330 byte182016-07-05 08:46:01 (UTC)
    src/removal/delete_one_child.jsdelete_one_child0 %0/1391 byte202016-07-05 08:46:01 (UTC)
    src/removal/index.js--235 byte72016-07-05 09:35:37 (UTC)
    +
    + + + + + + + + + + + + diff --git a/src/adt/RedBlackTree.js b/src/adt/RedBlackTree.js deleted file mode 100644 index 94fb37c..0000000 --- a/src/adt/RedBlackTree.js +++ /dev/null @@ -1,72 +0,0 @@ - -import { Node } from '..' ; -import { RED , BLACK } from '..' ; -import { predecessor , successor } from '..' ; -import { insert , insert_case2 } from '..' ; -import { delete_one_child } from '..' ; -import { find } from '..' ; -import { inordertraversal } from '..' ; - -export class RedBlackTree { - - constructor ( compare ) { - - this.compare = compare ; - this.root = null ; - - } - - add ( value ) { - if ( this.root === null ) { - this.root = new Node( BLACK , value ) ; - } - else { - const node = new Node( RED , value ) ; - insert( this.compare , this.root , node ) ; - insert_case2( node ) ; - } - } - - find ( value ) { - - if ( this.root === null ) return null ; - - return find( this.compare , this.root , value ) ; - - } - - delete ( node ) { - - if ( !node.left.isleaf() ) { - // replace node's value with predecessor's value - const pred = predecessor( node ) ; - node.value = pred.value ; - // delete predecessor node - // note: this node can only have one non-leaf child - // because the tree is a red-black tree - delete_one_child( pred ) ; - } - - else if ( !node.right.isleaf() ) { - // replace node's value with successor's value - const succ = successor( node ) ; - node.value = succ.value ; - // delete successor node - // note: this node can only have one non-leaf child - // because the tree is a red-black tree - delete_one_child( pred ) ; - } - - else { - this.root = null ; - } - - } - - *[Symbol.iterator] ( ) { - - if ( this.root !== null ) yield* inordertraversal( this.root ) ; - - } - -} diff --git a/src/adt/index.js b/src/adt/index.js deleted file mode 100644 index 45b6d37..0000000 --- a/src/adt/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from './RedBlackTree' ; diff --git a/src/base/colors.js b/src/base/colors.js deleted file mode 100644 index 909392b..0000000 --- a/src/base/colors.js +++ /dev/null @@ -1,2 +0,0 @@ -export const BLACK = 0 ; -export const RED = 1 ; diff --git a/src/base/find.js b/src/base/find.js deleted file mode 100644 index 7693cac..0000000 --- a/src/base/find.js +++ /dev/null @@ -1,29 +0,0 @@ - -export function find ( compare, node, value ) { - - // scan for first node whose - // value equals parameter value - - while ( true ) { - - const d = compare( value, node.value ); - - if ( d === 0 ) { - return node; - } - - else if ( d < 0 ) { - node = node.left; - } - - else { - node = node.right; - } - - if ( node.isleaf() ) { - return null; - } - - } - -} diff --git a/src/base/grandparent.js b/src/base/grandparent.js deleted file mode 100644 index 092cb01..0000000 --- a/src/base/grandparent.js +++ /dev/null @@ -1,6 +0,0 @@ -export function grandparent( n ){ - if ((n !== null) && (n.parent !== null)) - return n.parent.parent; - else - return null; -} diff --git a/src/base/index.js b/src/base/index.js deleted file mode 100644 index 6f0fac3..0000000 --- a/src/base/index.js +++ /dev/null @@ -1,12 +0,0 @@ -export * from './colors' ; -export * from './find' ; -export * from './grandparent' ; -export * from './inordertraversal' ; -export * from './insert' ; -export * from './predecessor' ; -export * from './replace_node' ; -export * from './rotate_left' ; -export * from './rotate_right' ; -export * from './sibling' ; -export * from './successor' ; -export * from './uncle' ; diff --git a/src/base/inordertraversal.js b/src/base/inordertraversal.js deleted file mode 100644 index 22e2cd6..0000000 --- a/src/base/inordertraversal.js +++ /dev/null @@ -1,14 +0,0 @@ - -export function* inordertraversal ( node ) { - - if ( !node.left.isleaf() ) { - yield *inordertraversal( node.left ); - } - - yield node.value ; - - if ( !node.right.isleaf() ) { - yield* inordertraversal( node.right ); - } - -} diff --git a/src/base/insert.js b/src/base/insert.js deleted file mode 100644 index 9db6084..0000000 --- a/src/base/insert.js +++ /dev/null @@ -1,38 +0,0 @@ - -export function insert ( compare, A, B ) { - - while ( true ) { - - if ( compare( B.value, A.value ) < 0 ) { - - const node = A.left; - - if ( node.isleaf() ) { - A.left = B; - break; - } - - A = node; - - } - - else { - - const node = A.right; - - if ( node.isleaf() ) { - A.right = B; - break; - } - - A = node; - - } - - } - - B.parent = A; - - return B; - -} diff --git a/src/base/predecessor.js b/src/base/predecessor.js deleted file mode 100644 index 7068c56..0000000 --- a/src/base/predecessor.js +++ /dev/null @@ -1,9 +0,0 @@ -export function predecessor ( node ) { - - var pred = node.left ; - - while ( !pred.right.isleaf() ) pred = pred.right ; - - return pred ; - -} diff --git a/src/base/replace_node.js b/src/base/replace_node.js deleted file mode 100644 index d3687f1..0000000 --- a/src/base/replace_node.js +++ /dev/null @@ -1,13 +0,0 @@ - -export function replace_node ( A , B ) { - if ( A.parent === null ) { - // nothing to do - } - else if ( A === A.parent.left ) { - A.parent.left = B ; - } - else { - A.parent.right = B ; - } - B.parent = A.parent ; -} diff --git a/src/base/rotate_left.js b/src/base/rotate_left.js deleted file mode 100644 index 68bd0db..0000000 --- a/src/base/rotate_left.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Rotate tree left. - * (see https://en.wikipedia.org/wiki/Tree_rotation) - * - * A B - * / \ / \ - * a B -> A c - * / \ / \ - * b c a b - * - * @param {Node} A root of the tree - */ - -export function rotate_left ( A ) { - - const B = A.right ; - const a = A.left ; - const b = B.left ; - const c = B.right ; - - [A.value , B.value] = [B.value , A.value] ; - [A.color , B.color] = [B.color , A.color] ; - - A.left = B ; - A.right = c ; - - B.left = a ; - B.right = b ; - - a.parent = B ; - b.parent = B ; - c.parent = A ; -} diff --git a/src/base/rotate_right.js b/src/base/rotate_right.js deleted file mode 100644 index 4f53b55..0000000 --- a/src/base/rotate_right.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Rotate tree right. - * (see https://en.wikipedia.org/wiki/Tree_rotation) - * - * B A - * / \ / \ - * A c -> a B - * / \ / \ - * a b b c - * - * @param {Node} A root of the tree - */ - -export function rotate_right ( B ) { - - const A = B.left; - const a = A.left ; - const b = A.right ; - const c = B.right ; - - [A.value , B.value] = [B.value , A.value] ; - [A.color , B.color] = [B.color , A.color] ; - - B.left = a ; - B.right = A ; - - A.left = b ; - A.right = c ; - - a.parent = B ; - b.parent = A ; - c.parent = A ; - -} diff --git a/src/base/sibling.js b/src/base/sibling.js deleted file mode 100644 index 57efda6..0000000 --- a/src/base/sibling.js +++ /dev/null @@ -1,9 +0,0 @@ -export function sibling(n) -{ - if ((n === null) || (n.parent === null)) - return null; // no parent means no sibling - if (n === n.parent.left) - return n.parent.right; - else - return n.parent.left; -} diff --git a/src/base/successor.js b/src/base/successor.js deleted file mode 100644 index ad0a9b8..0000000 --- a/src/base/successor.js +++ /dev/null @@ -1,9 +0,0 @@ -export function successor ( node ) { - - var succ = node.right ; - - while ( !succ.left.isleaf() ) succ = succ.left ; - - return succ ; - -} diff --git a/src/base/uncle.js b/src/base/uncle.js deleted file mode 100644 index a350666..0000000 --- a/src/base/uncle.js +++ /dev/null @@ -1,11 +0,0 @@ -import { grandparent } from './grandparent' ; - -export function uncle(n){ - const g = grandparent(n); - if (g === null) - return null; // No grandparent means no uncle - if (n.parent === g.left) - return g.right.isleaf() ? null : g.right ; - else - return g.left.isleaf() ? null : g.left; -} diff --git a/src/index.js b/src/index.js deleted file mode 100644 index 94970e4..0000000 --- a/src/index.js +++ /dev/null @@ -1,5 +0,0 @@ -export * from './adt' ; -export * from './base' ; -export * from './insertion' ; -export * from './node' ; -export * from './removal' ; diff --git a/src/insertion/index.js b/src/insertion/index.js deleted file mode 100644 index 4b4e584..0000000 --- a/src/insertion/index.js +++ /dev/null @@ -1,5 +0,0 @@ -export * from './insert_case1' ; -export * from './insert_case2' ; -export * from './insert_case3' ; -export * from './insert_case4' ; -export * from './insert_case5' ; diff --git a/src/insertion/insert_case1.js b/src/insertion/insert_case1.js deleted file mode 100644 index 4c8790b..0000000 --- a/src/insertion/insert_case1.js +++ /dev/null @@ -1,11 +0,0 @@ - -import { BLACK } from '..' ; -import { insert_case2 } from './insert_case2' ; - -export function insert_case1(n) -{ - if (n.parent === null) - n.color = BLACK; - else - insert_case2(n); -} diff --git a/src/insertion/insert_case2.js b/src/insertion/insert_case2.js deleted file mode 100644 index c88cc53..0000000 --- a/src/insertion/insert_case2.js +++ /dev/null @@ -1,11 +0,0 @@ - -import { BLACK } from '..' ; -import { insert_case3 } from './insert_case3' ; - -export function insert_case2(n) -{ - if (n.parent.color === BLACK) - return; /* Tree is still valid */ - else - insert_case3(n); -} diff --git a/src/insertion/insert_case3.js b/src/insertion/insert_case3.js deleted file mode 100644 index 3136b45..0000000 --- a/src/insertion/insert_case3.js +++ /dev/null @@ -1,18 +0,0 @@ -import { BLACK , RED , uncle , grandparent } from '..' ; -import { insert_case1 } from './insert_case1' ; -import { insert_case4 } from './insert_case4' ; - -export function insert_case3(n) -{ - const u = uncle(n); - - if ((u !== null) && (u.color === RED)) { - n.parent.color = BLACK; - u.color = BLACK; - const g = grandparent(n); - g.color = RED; - insert_case1(g); - } else { - insert_case4(n); - } -} diff --git a/src/insertion/insert_case4.js b/src/insertion/insert_case4.js deleted file mode 100644 index 59ea121..0000000 --- a/src/insertion/insert_case4.js +++ /dev/null @@ -1,41 +0,0 @@ - -import { rotate_left , rotate_right , grandparent } from '..' ; -import { insert_case5 } from './insert_case5' ; - -export function insert_case4(n) -{ - const g = grandparent(n); - - if ((n === n.parent.right) && (n.parent === g.left)) { - rotate_left(n.parent); - - /* - * rotate_left can be the below because of already having *g = grandparent(n) - * - * saved_p=g.left, *saved_left_n=n.left; - * g.left=n; - * n.left=saved_p; - * saved_p.right=saved_left_n; - * - * and modify the parent's nodes properly - */ - - n = n.left; - - } else if ((n === n.parent.left) && (n.parent === g.right)) { - rotate_right(n.parent); - - /* - * rotate_right can be the below to take advantage of already having *g = grandparent(n) - * - * saved_p=g.right, *saved_right_n=n.right; - * g.right=n; - * n.right=saved_p; - * saved_p.left=saved_right_n; - * - */ - - n = n.right; - } - insert_case5(n); -} diff --git a/src/insertion/insert_case5.js b/src/insertion/insert_case5.js deleted file mode 100644 index 8e5f6cf..0000000 --- a/src/insertion/insert_case5.js +++ /dev/null @@ -1,14 +0,0 @@ - -import { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ; - -export function insert_case5(n) -{ - const g = grandparent(n); - - n.parent.color = BLACK; - g.color = RED; - if (n === n.parent.left) - rotate_right(g); - else - rotate_left(g); -} diff --git a/src/node/Leaf.js b/src/node/Leaf.js deleted file mode 100644 index 99ed3c0..0000000 --- a/src/node/Leaf.js +++ /dev/null @@ -1,8 +0,0 @@ -import { BLACK } from '..' ; - -export function Leaf ( parent ) { - this.color = BLACK ; - this.parent = parent ; -} - -Leaf.prototype.isleaf = function ( ) { return true ; } ; diff --git a/src/node/Node.js b/src/node/Node.js deleted file mode 100644 index 3c257a8..0000000 --- a/src/node/Node.js +++ /dev/null @@ -1,11 +0,0 @@ -import { Leaf } from './Leaf' ; - -export function Node ( color , value ) { - this.color = color ; - this.left = new Leaf( this ) ; - this.right = new Leaf( this ) ; - this.parent = null ; - this.value = value ; -} - -Node.prototype.isleaf = function ( ) { return false ; } ; diff --git a/src/node/index.js b/src/node/index.js deleted file mode 100644 index cd7ff1c..0000000 --- a/src/node/index.js +++ /dev/null @@ -1,2 +0,0 @@ -export * from './Leaf' ; -export * from './Node' ; diff --git a/src/removal/delete_case1.js b/src/removal/delete_case1.js deleted file mode 100644 index afaf069..0000000 --- a/src/removal/delete_case1.js +++ /dev/null @@ -1,8 +0,0 @@ - -import { delete_case2 } from './delete_case2' ; - -export function delete_case1(n) -{ - if (n.parent !== null) - delete_case2(n); -} diff --git a/src/removal/delete_case2.js b/src/removal/delete_case2.js deleted file mode 100644 index d291047..0000000 --- a/src/removal/delete_case2.js +++ /dev/null @@ -1,18 +0,0 @@ -import { BLACK , RED , rotate_left , rotate_right } from '..' ; - -import { delete_case3 } from './delete_case3' ; - -export function delete_case2(n) -{ - const s = sibling(n); - - if (s.color === RED) { - n.parent.color = RED; - s.color = BLACK; - if (n === n.parent.left) - rotate_left(n.parent); - else - rotate_right(n.parent); - } - delete_case3(n); -} diff --git a/src/removal/delete_case3.js b/src/removal/delete_case3.js deleted file mode 100644 index 3564a1d..0000000 --- a/src/removal/delete_case3.js +++ /dev/null @@ -1,19 +0,0 @@ - -import { BLACK , RED , sibling } from '..' ; - -import { delete_case1 } from './delete_case1' ; -import { delete_case4 } from './delete_case4' ; - -export function delete_case3(n) -{ - const s = sibling(n); - - if ((n.parent.color === BLACK) && - (s.color === BLACK) && - (s.left.color === BLACK) && - (s.right.color === BLACK)) { - s.color = RED; - delete_case1(n.parent); - } else - delete_case4(n); -} diff --git a/src/removal/delete_case4.js b/src/removal/delete_case4.js deleted file mode 100644 index ffec673..0000000 --- a/src/removal/delete_case4.js +++ /dev/null @@ -1,17 +0,0 @@ -import { BLACK , RED , sibling } from '..' ; - -import { delete_case5 } from './delete_case5' ; - -export function delete_case4(n) -{ - const s = sibling(n); - - if ((n.parent.color === RED) && - (s.color === BLACK) && - (s.left.color === BLACK) && - (s.right.color === BLACK)) { - s.color = RED; - n.parent.color = BLACK; - } else - delete_case5(n); -} diff --git a/src/removal/delete_case5.js b/src/removal/delete_case5.js deleted file mode 100644 index e57f8ea..0000000 --- a/src/removal/delete_case5.js +++ /dev/null @@ -1,30 +0,0 @@ - -import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ; - -import { delete_case6 } from './delete_case6' ; - -export function delete_case5(n) -{ - const s = sibling(n); - - if (s.color === BLACK) { /* this if statement is trivial, -due to case 2 (even though case 2 changed the sibling to a sibling's child, -the sibling's child can't be red, since no red parent can have a red child). */ -/* the following statements just force the red to be on the left of the left of the parent, - or right of the right, so case six will rotate correctly. */ - if ((n === n.parent.left) && - (s.right.color === BLACK) && - (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */ - s.color = RED; - s.left.color = BLACK; - rotate_right(s); - } else if ((n === n.parent.right) && - (s.left.color === BLACK) && - (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */ - s.color = RED; - s.right.color = BLACK; - rotate_left(s); - } - } - delete_case6(n); -} diff --git a/src/removal/delete_case6.js b/src/removal/delete_case6.js deleted file mode 100644 index 5637059..0000000 --- a/src/removal/delete_case6.js +++ /dev/null @@ -1,18 +0,0 @@ - -import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ; - -export function delete_case6(n) -{ - const s = sibling(n); - - s.color = n.parent.color; - n.parent.color = BLACK; - - if (n === n.parent.left) { - s.right.color = BLACK; - rotate_left(n.parent); - } else { - s.left.color = BLACK; - rotate_right(n.parent); - } -} diff --git a/src/removal/delete_one_child.js b/src/removal/delete_one_child.js deleted file mode 100644 index 22905e0..0000000 --- a/src/removal/delete_one_child.js +++ /dev/null @@ -1,20 +0,0 @@ - -import { BLACK , RED , replace_node } from '..' ; - -import { delete_case1 } from './delete_case1' ; - -export function delete_one_child(n) -{ - /* - * Precondition: n has at most one non-leaf child. - */ - const child = n.right.isleaf() ? n.left : n.right; - - replace_node(n, child); - if (n.color === BLACK) { - if (child.color === RED) - child.color = BLACK; - else - delete_case1(child); - } -} diff --git a/src/removal/index.js b/src/removal/index.js deleted file mode 100644 index fcb6c2c..0000000 --- a/src/removal/index.js +++ /dev/null @@ -1,7 +0,0 @@ -export * from './delete_case1' ; -export * from './delete_case2' ; -export * from './delete_case3' ; -export * from './delete_case4' ; -export * from './delete_case5' ; -export * from './delete_case6' ; -export * from './delete_one_child' ; diff --git a/test/src/RedBlackTree.js b/test/src/RedBlackTree.js deleted file mode 100644 index bfb34c4..0000000 --- a/test/src/RedBlackTree.js +++ /dev/null @@ -1,35 +0,0 @@ -import test from 'ava' ; - -import { increasing , decreasing } from 'aureooms-js-compare' ; - -import { list , range } from 'aureooms-js-itertools' ; - -import { randint } from 'aureooms-js-random' ; - -import { RedBlackTree } from '../../src' ; - -test( 'RedBlackTree::Symbol.iterator' , t => { - - const tree = new RedBlackTree( increasing ) ; - - const a1 = list( tree ) ; - - t.deepEqual( a1.length , 0 , 'tree contains 0 elements' ) ; - - const n = 10000 ; - const reference = [ ] ; - - for ( let i of range( n ) ) { - const x = randint( 0 , n ) ; - tree.add( x ) ; - reference.push( x ) ; - } - - reference.sort(increasing); - - const a2 = list( tree ) ; - - t.deepEqual( a2.length , n , `tree contains ${n} elements` ) ; - t.deepEqual( a2 , reference , 'tree is sorted' ) ; - -}); diff --git a/doc/css/style.css b/user/css/0-style.css similarity index 100% rename from doc/css/style.css rename to user/css/0-style.css diff --git a/doc/scripts/header.js b/user/script/0-header.js similarity index 100% rename from doc/scripts/header.js rename to user/script/0-header.js diff --git a/variable/index.html b/variable/index.html new file mode 100644 index 0000000..29830c0 --- /dev/null +++ b/variable/index.html @@ -0,0 +1,224 @@ + + + + + + Variable | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
    + Home + Manual + Reference + Source + Test + Repository + +
    + + + +

    Variable

    +
    + + + + + + + + + + + + + + +
    Static Public Summary
    + public + + + + + +
    +

    + BLACK: number +

    +
    +
    + + + +
    +
    + + +
    + public + + + + + +
    +

    + RED: number +

    +
    +
    + + + +
    +
    + + +
    +
    +

    Static Public

    + +
    +

    + public + + + + + BLACK: number + + + + source + +

    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    + public + + + + + RED: number + + + + source + +

    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + +
    +
    +
    + + + + + + + + + + + + From 9f2fc321cc265dcc7465d94f178f92c1b0f3003b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Thu, 21 Jul 2016 14:57:13 +0200 Subject: [PATCH 02/26] esdoc update --- source.html | 66 ++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/source.html b/source.html index 5fb6f2a..5f4cf42 100644 --- a/source.html +++ b/source.html @@ -87,7 +87,7 @@ 0 %0/8 1519 byte 72 - 2016-07-05 12:53:58 (UTC) + 2016-07-05 12:56:33 (UTC) src/adt/index.js @@ -95,7 +95,7 @@ - 33 byte 1 - 2016-07-05 09:31:45 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/colors.js @@ -104,7 +104,7 @@ 0 %0/2 48 byte 2 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/find.js @@ -112,7 +112,7 @@ 0 %0/1 352 byte 29 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/grandparent.js @@ -120,7 +120,7 @@ 0 %0/1 125 byte 6 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/index.js @@ -128,7 +128,7 @@ - 362 byte 12 - 2016-07-05 09:32:15 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/inordertraversal.js @@ -136,7 +136,7 @@ 0 %0/1 220 byte 14 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/insert.js @@ -144,7 +144,7 @@ 0 %0/1 360 byte 38 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/predecessor.js @@ -152,7 +152,7 @@ 0 %0/1 136 byte 9 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/replace_node.js @@ -160,7 +160,7 @@ 0 %0/1 211 byte 13 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/rotate_left.js @@ -168,7 +168,7 @@ 100 %1/1 583 byte 33 - 2016-07-05 12:45:48 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/rotate_right.js @@ -176,7 +176,7 @@ 100 %1/1 593 byte 34 - 2016-07-05 12:46:44 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/sibling.js @@ -184,7 +184,7 @@ 0 %0/1 199 byte 9 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/successor.js @@ -192,7 +192,7 @@ 0 %0/1 133 byte 9 - 2016-07-05 10:41:09 (UTC) + 2016-07-05 12:56:33 (UTC) src/base/uncle.js @@ -200,7 +200,7 @@ 0 %0/1 286 byte 11 - 2016-07-05 10:39:06 (UTC) + 2016-07-05 12:56:33 (UTC) src/index.js @@ -208,7 +208,7 @@ - 132 byte 5 - 2016-07-05 09:31:07 (UTC) + 2016-07-05 12:56:33 (UTC) src/insertion/index.js @@ -216,7 +216,7 @@ - 165 byte 5 - 2016-07-05 09:32:39 (UTC) + 2016-07-05 12:56:33 (UTC) src/insertion/insert_case1.js @@ -224,7 +224,7 @@ 0 %0/1 183 byte 11 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/insertion/insert_case2.js @@ -232,7 +232,7 @@ 0 %0/1 207 byte 11 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/insertion/insert_case3.js @@ -240,7 +240,7 @@ 0 %0/1 395 byte 18 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/insertion/insert_case4.js @@ -248,7 +248,7 @@ 0 %0/1 855 byte 41 - 2016-07-05 10:25:37 (UTC) + 2016-07-05 12:56:33 (UTC) src/insertion/insert_case5.js @@ -256,7 +256,7 @@ 0 %0/1 254 byte 14 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/node/Leaf.js @@ -264,7 +264,7 @@ 0 %0/1 170 byte 8 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/node/Node.js @@ -272,7 +272,7 @@ 0 %0/1 266 byte 11 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/node/index.js @@ -280,7 +280,7 @@ - 50 byte 2 - 2016-07-05 09:33:04 (UTC) + 2016-07-05 12:56:33 (UTC) src/removal/delete_case1.js @@ -288,7 +288,7 @@ 0 %0/1 129 byte 8 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/removal/delete_case2.js @@ -296,7 +296,7 @@ 0 %0/1 349 byte 18 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/removal/delete_case3.js @@ -304,7 +304,7 @@ 0 %0/1 404 byte 19 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/removal/delete_case4.js @@ -312,7 +312,7 @@ 0 %0/1 353 byte 17 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/removal/delete_case5.js @@ -320,7 +320,7 @@ 0 %0/1 1033 byte 30 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/removal/delete_case6.js @@ -328,7 +328,7 @@ 0 %0/1 330 byte 18 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/removal/delete_one_child.js @@ -336,7 +336,7 @@ 0 %0/1 391 byte 20 - 2016-07-05 08:46:01 (UTC) + 2016-07-05 12:56:33 (UTC) src/removal/index.js @@ -344,7 +344,7 @@ - 235 byte 7 - 2016-07-05 09:35:37 (UTC) + 2016-07-05 12:56:33 (UTC) From 691bb15991d878721936a91b9327f4c9cf611a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Thu, 21 Jul 2016 14:58:08 +0200 Subject: [PATCH 03/26] esdoc update --- ast/source/base/rotate_right.js.json | 6 +-- dump.json | 4 +- file/src/base/rotate_right.js.html | 2 +- function/index.html | 6 +-- identifiers.html | 2 +- source.html | 66 ++++++++++++++-------------- 6 files changed, 43 insertions(+), 43 deletions(-) diff --git a/ast/source/base/rotate_right.js.json b/ast/source/base/rotate_right.js.json index 94480b3..cb53d10 100644 --- a/ast/source/base/rotate_right.js.json +++ b/ast/source/base/rotate_right.js.json @@ -1844,7 +1844,7 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} A root of the tree\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n ", "range": [ 0, 269 @@ -1882,7 +1882,7 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} A root of the tree\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n ", "range": [ 0, 269 @@ -1919,7 +1919,7 @@ "comments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} A root of the tree\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n ", "range": [ 0, 269 diff --git a/dump.json b/dump.json index 0c8883a..b24fcec 100644 --- a/dump.json +++ b/dump.json @@ -620,7 +620,7 @@ "access": null, "description": null, "lineNumber": 14, - "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} A root of the tree\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" + "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" }, { "__docId__": 31, @@ -644,7 +644,7 @@ ], "spread": false, "optional": false, - "name": "A", + "name": "B", "description": "root of the tree" } ], diff --git a/file/src/base/rotate_right.js.html b/file/src/base/rotate_right.js.html index 666ca56..993e5bf 100644 --- a/file/src/base/rotate_right.js.html +++ b/file/src/base/rotate_right.js.html @@ -77,7 +77,7 @@ * / \ / \ * a b b c * - * @param {Node} A root of the tree + * @param {Node} B root of the tree */ export function rotate_right ( B ) { diff --git a/function/index.html b/function/index.html index d4b2a84..e8e80c8 100644 --- a/function/index.html +++ b/function/index.html @@ -608,7 +608,7 @@
    @@ -1970,7 +1970,7 @@

    - rotate_right(A: Node) + rotate_right(B: Node) @@ -2001,7 +2001,7 @@

    Params:

    - A + B Node

    root of the tree

    diff --git a/identifiers.html b/identifiers.html index c830f16..37e8038 100644 --- a/identifiers.html +++ b/identifiers.html @@ -641,7 +641,7 @@
    diff --git a/source.html b/source.html index 5f4cf42..abd10c7 100644 --- a/source.html +++ b/source.html @@ -87,7 +87,7 @@ 0 %0/8 1519 byte 72 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/adt/index.js @@ -95,7 +95,7 @@ - 33 byte 1 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/colors.js @@ -104,7 +104,7 @@ 0 %0/2 48 byte 2 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/find.js @@ -112,7 +112,7 @@ 0 %0/1 352 byte 29 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/grandparent.js @@ -120,7 +120,7 @@ 0 %0/1 125 byte 6 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/index.js @@ -128,7 +128,7 @@ - 362 byte 12 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/inordertraversal.js @@ -136,7 +136,7 @@ 0 %0/1 220 byte 14 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/insert.js @@ -144,7 +144,7 @@ 0 %0/1 360 byte 38 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/predecessor.js @@ -152,7 +152,7 @@ 0 %0/1 136 byte 9 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/replace_node.js @@ -160,7 +160,7 @@ 0 %0/1 211 byte 13 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/rotate_left.js @@ -168,7 +168,7 @@ 100 %1/1 583 byte 33 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/rotate_right.js @@ -176,7 +176,7 @@ 100 %1/1 593 byte 34 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:29 (UTC) src/base/sibling.js @@ -184,7 +184,7 @@ 0 %0/1 199 byte 9 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/successor.js @@ -192,7 +192,7 @@ 0 %0/1 133 byte 9 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/base/uncle.js @@ -200,7 +200,7 @@ 0 %0/1 286 byte 11 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/index.js @@ -208,7 +208,7 @@ - 132 byte 5 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/insertion/index.js @@ -216,7 +216,7 @@ - 165 byte 5 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/insertion/insert_case1.js @@ -224,7 +224,7 @@ 0 %0/1 183 byte 11 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/insertion/insert_case2.js @@ -232,7 +232,7 @@ 0 %0/1 207 byte 11 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/insertion/insert_case3.js @@ -240,7 +240,7 @@ 0 %0/1 395 byte 18 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/insertion/insert_case4.js @@ -248,7 +248,7 @@ 0 %0/1 855 byte 41 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/insertion/insert_case5.js @@ -256,7 +256,7 @@ 0 %0/1 254 byte 14 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/node/Leaf.js @@ -264,7 +264,7 @@ 0 %0/1 170 byte 8 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/node/Node.js @@ -272,7 +272,7 @@ 0 %0/1 266 byte 11 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/node/index.js @@ -280,7 +280,7 @@ - 50 byte 2 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/removal/delete_case1.js @@ -288,7 +288,7 @@ 0 %0/1 129 byte 8 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/removal/delete_case2.js @@ -296,7 +296,7 @@ 0 %0/1 349 byte 18 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/removal/delete_case3.js @@ -304,7 +304,7 @@ 0 %0/1 404 byte 19 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/removal/delete_case4.js @@ -312,7 +312,7 @@ 0 %0/1 353 byte 17 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/removal/delete_case5.js @@ -320,7 +320,7 @@ 0 %0/1 1033 byte 30 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/removal/delete_case6.js @@ -328,7 +328,7 @@ 0 %0/1 330 byte 18 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/removal/delete_one_child.js @@ -336,7 +336,7 @@ 0 %0/1 391 byte 20 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) src/removal/index.js @@ -344,7 +344,7 @@ - 235 byte 7 - 2016-07-05 12:56:33 (UTC) + 2016-07-05 12:57:17 (UTC) From f67d2b90c8d67949e65baf22250b4d37bb9c6cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Fri, 22 Jul 2016 10:15:04 +0200 Subject: [PATCH 04/26] esdoc update --- ast/source/adt/RedBlackTree.js.json | 2024 +++++++++++------ ast/source/base/debug.js.json | 1223 ++++++++++ ast/source/base/grandparent.js.json | 442 ---- ast/source/base/index.js.json | 240 +- ast/source/base/replace_node.js.json | 874 +++---- ast/source/base/sibling.js.json | 752 ------ ast/source/family/grandparent.js.json | 300 +++ ast/source/family/index.js.json | 165 ++ .../{base => family}/predecessor.js.json | 0 .../sibling.js.json} | 560 +++-- ast/source/{base => family}/uncle.js.json | 463 ++-- ast/source/index.js.json | 82 +- ast/source/insertion/insert_case4.js.json | 488 ++-- ast/source/removal/delete_case1.js.json | 197 +- ast/source/removal/delete_case2.js.json | 351 +-- ast/source/removal/delete_case3.js.json | 457 ++-- ast/source/removal/delete_case4.js.json | 473 ++-- ast/source/removal/delete_one_child.js.json | 949 ++++---- .../src/adt/RedBlackTree.js~RedBlackTree.html | 121 +- coverage.json | 35 +- dump.json | 488 ++-- file/src/adt/RedBlackTree.js.html | 36 +- file/src/adt/index.js.html | 12 +- file/src/base/colors.js.html | 12 +- file/src/base/debug.js.html | 100 + file/src/base/find.js.html | 12 +- file/src/base/index.js.html | 18 +- file/src/base/inordertraversal.js.html | 12 +- file/src/base/insert.js.html | 12 +- file/src/base/replace_node.js.html | 33 +- file/src/base/rotate_left.js.html | 12 +- file/src/base/rotate_right.js.html | 12 +- file/src/{base => family}/grandparent.js.html | 27 +- .../index.js.html} | 29 +- file/src/{base => family}/predecessor.js.html | 16 +- file/src/{base => family}/sibling.js.html | 32 +- file/src/{base => family}/uncle.js.html | 32 +- file/src/index.js.html | 13 +- file/src/insertion/index.js.html | 12 +- file/src/insertion/insert_case1.js.html | 12 +- file/src/insertion/insert_case2.js.html | 12 +- file/src/insertion/insert_case3.js.html | 12 +- file/src/insertion/insert_case4.js.html | 16 +- file/src/insertion/insert_case5.js.html | 12 +- file/src/node/Leaf.js.html | 12 +- file/src/node/Node.js.html | 12 +- file/src/node/index.js.html | 12 +- file/src/removal/delete_case1.js.html | 14 +- file/src/removal/delete_case2.js.html | 14 +- file/src/removal/delete_case3.js.html | 17 +- file/src/removal/delete_case4.js.html | 13 +- file/src/removal/delete_case5.js.html | 12 +- file/src/removal/delete_case6.js.html | 12 +- file/src/removal/delete_one_child.js.html | 46 +- file/src/removal/index.js.html | 12 +- function/index.html | 218 +- identifiers.html | 62 +- index.html | 12 +- package.json | 4 +- script/search_index.js | 82 +- source.html | 176 +- variable/index.html | 12 +- 62 files changed, 6690 insertions(+), 5232 deletions(-) create mode 100644 ast/source/base/debug.js.json delete mode 100644 ast/source/base/grandparent.js.json delete mode 100644 ast/source/base/sibling.js.json create mode 100644 ast/source/family/grandparent.js.json create mode 100644 ast/source/family/index.js.json rename ast/source/{base => family}/predecessor.js.json (100%) rename ast/source/{base/successor.js.json => family/sibling.js.json} (53%) rename ast/source/{base => family}/uncle.js.json (78%) create mode 100644 file/src/base/debug.js.html rename file/src/{base => family}/grandparent.js.html (92%) rename file/src/{base/successor.js.html => family/index.js.html} (91%) rename file/src/{base => family}/predecessor.js.html (93%) rename file/src/{base => family}/sibling.js.html (91%) rename file/src/{base => family}/uncle.js.html (91%) diff --git a/ast/source/adt/RedBlackTree.js.json b/ast/source/adt/RedBlackTree.js.json index 4a0cc46..db09463 100644 --- a/ast/source/adt/RedBlackTree.js.json +++ b/ast/source/adt/RedBlackTree.js.json @@ -291,59 +291,6 @@ "column": 20 } } - }, - { - "type": "ImportSpecifier", - "local": { - "type": "Identifier", - "name": "successor", - "range": [ - 87, - 96 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 32 - } - } - }, - "imported": { - "type": "Identifier", - "name": "successor", - "range": [ - 87, - 96 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 32 - } - } - }, - "range": [ - 87, - 96 - ], - "loc": { - "start": { - "line": 4, - "column": 23 - }, - "end": { - "line": 4, - "column": 32 - } - } } ], "source": { @@ -351,23 +298,23 @@ "value": "..", "raw": "'..'", "range": [ - 104, - 108 + 92, + 96 ], "loc": { "start": { "line": 4, - "column": 40 + "column": 28 }, "end": { "line": 4, - "column": 44 + "column": 32 } } }, "range": [ 64, - 110 + 98 ], "loc": { "start": { @@ -376,7 +323,7 @@ }, "end": { "line": 4, - "column": 46 + "column": 34 } } }, @@ -389,8 +336,8 @@ "type": "Identifier", "name": "insert", "range": [ - 120, - 126 + 108, + 114 ], "loc": { "start": { @@ -407,8 +354,8 @@ "type": "Identifier", "name": "insert", "range": [ - 120, - 126 + 108, + 114 ], "loc": { "start": { @@ -422,8 +369,8 @@ } }, "range": [ - 120, - 126 + 108, + 114 ], "loc": { "start": { @@ -442,8 +389,8 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 129, - 141 + 117, + 129 ], "loc": { "start": { @@ -460,8 +407,8 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 129, - 141 + 117, + 129 ], "loc": { "start": { @@ -475,8 +422,8 @@ } }, "range": [ - 129, - 141 + 117, + 129 ], "loc": { "start": { @@ -495,8 +442,8 @@ "value": "..", "raw": "'..'", "range": [ - 149, - 153 + 137, + 141 ], "loc": { "start": { @@ -510,8 +457,8 @@ } }, "range": [ - 111, - 155 + 99, + 143 ], "loc": { "start": { @@ -533,8 +480,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 165, - 181 + 153, + 169 ], "loc": { "start": { @@ -551,8 +498,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 165, - 181 + 153, + 169 ], "loc": { "start": { @@ -566,8 +513,8 @@ } }, "range": [ - 165, - 181 + 153, + 169 ], "loc": { "start": { @@ -586,8 +533,8 @@ "value": "..", "raw": "'..'", "range": [ - 189, - 193 + 177, + 181 ], "loc": { "start": { @@ -601,8 +548,8 @@ } }, "range": [ - 156, - 195 + 144, + 183 ], "loc": { "start": { @@ -624,8 +571,8 @@ "type": "Identifier", "name": "find", "range": [ - 205, - 209 + 193, + 197 ], "loc": { "start": { @@ -642,8 +589,8 @@ "type": "Identifier", "name": "find", "range": [ - 205, - 209 + 193, + 197 ], "loc": { "start": { @@ -657,8 +604,8 @@ } }, "range": [ - 205, - 209 + 193, + 197 ], "loc": { "start": { @@ -677,8 +624,8 @@ "value": "..", "raw": "'..'", "range": [ - 217, - 221 + 205, + 209 ], "loc": { "start": { @@ -692,8 +639,8 @@ } }, "range": [ - 196, - 223 + 184, + 211 ], "loc": { "start": { @@ -715,8 +662,8 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 233, - 249 + 221, + 237 ], "loc": { "start": { @@ -733,8 +680,8 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 233, - 249 + 221, + 237 ], "loc": { "start": { @@ -748,8 +695,8 @@ } }, "range": [ - 233, - 249 + 221, + 237 ], "loc": { "start": { @@ -768,8 +715,8 @@ "value": "..", "raw": "'..'", "range": [ - 257, - 261 + 245, + 249 ], "loc": { "start": { @@ -783,8 +730,8 @@ } }, "range": [ - 224, - 263 + 212, + 251 ], "loc": { "start": { @@ -805,8 +752,8 @@ "type": "Identifier", "name": "RedBlackTree", "range": [ - 278, - 290 + 266, + 278 ], "loc": { "start": { @@ -829,8 +776,8 @@ "type": "Identifier", "name": "constructor", "range": [ - 295, - 306 + 283, + 294 ], "loc": { "start": { @@ -851,8 +798,8 @@ "type": "Identifier", "name": "compare", "range": [ - 309, - 316 + 297, + 304 ], "loc": { "start": { @@ -880,8 +827,8 @@ "object": { "type": "ThisExpression", "range": [ - 324, - 328 + 312, + 316 ], "loc": { "start": { @@ -898,8 +845,8 @@ "type": "Identifier", "name": "compare", "range": [ - 329, - 336 + 317, + 324 ], "loc": { "start": { @@ -913,8 +860,8 @@ } }, "range": [ - 324, - 336 + 312, + 324 ], "loc": { "start": { @@ -931,8 +878,8 @@ "type": "Identifier", "name": "compare", "range": [ - 339, - 346 + 327, + 334 ], "loc": { "start": { @@ -946,8 +893,8 @@ } }, "range": [ - 324, - 346 + 312, + 334 ], "loc": { "start": { @@ -961,8 +908,8 @@ } }, "range": [ - 324, - 348 + 312, + 336 ], "loc": { "start": { @@ -986,8 +933,8 @@ "object": { "type": "ThisExpression", "range": [ - 351, - 355 + 339, + 343 ], "loc": { "start": { @@ -1004,8 +951,8 @@ "type": "Identifier", "name": "root", "range": [ - 356, - 360 + 344, + 348 ], "loc": { "start": { @@ -1019,8 +966,8 @@ } }, "range": [ - 351, - 360 + 339, + 348 ], "loc": { "start": { @@ -1038,8 +985,8 @@ "value": null, "raw": "null", "range": [ - 363, - 367 + 351, + 355 ], "loc": { "start": { @@ -1053,8 +1000,8 @@ } }, "range": [ - 351, - 367 + 339, + 355 ], "loc": { "start": { @@ -1068,8 +1015,8 @@ } }, "range": [ - 351, - 369 + 339, + 357 ], "loc": { "start": { @@ -1084,8 +1031,8 @@ } ], "range": [ - 319, - 373 + 307, + 361 ], "loc": { "start": { @@ -1101,8 +1048,8 @@ "generator": false, "expression": false, "range": [ - 307, - 373 + 295, + 361 ], "loc": { "start": { @@ -1118,8 +1065,8 @@ "kind": "constructor", "computed": false, "range": [ - 295, - 373 + 283, + 361 ], "loc": { "start": { @@ -1139,8 +1086,8 @@ "type": "Identifier", "name": "add", "range": [ - 376, - 379 + 364, + 367 ], "loc": { "start": { @@ -1161,8 +1108,8 @@ "type": "Identifier", "name": "value", "range": [ - 382, - 387 + 370, + 375 ], "loc": { "start": { @@ -1190,8 +1137,8 @@ "object": { "type": "ThisExpression", "range": [ - 399, - 403 + 387, + 391 ], "loc": { "start": { @@ -1208,8 +1155,8 @@ "type": "Identifier", "name": "root", "range": [ - 404, - 408 + 392, + 396 ], "loc": { "start": { @@ -1223,8 +1170,8 @@ } }, "range": [ - 399, - 408 + 387, + 396 ], "loc": { "start": { @@ -1242,8 +1189,8 @@ "value": null, "raw": "null", "range": [ - 413, - 417 + 401, + 405 ], "loc": { "start": { @@ -1257,8 +1204,8 @@ } }, "range": [ - 399, - 417 + 387, + 405 ], "loc": { "start": { @@ -1285,8 +1232,8 @@ "object": { "type": "ThisExpression", "range": [ - 425, - 429 + 413, + 417 ], "loc": { "start": { @@ -1303,8 +1250,8 @@ "type": "Identifier", "name": "root", "range": [ - 430, - 434 + 418, + 422 ], "loc": { "start": { @@ -1318,8 +1265,8 @@ } }, "range": [ - 425, - 434 + 413, + 422 ], "loc": { "start": { @@ -1338,8 +1285,8 @@ "type": "Identifier", "name": "Node", "range": [ - 441, - 445 + 429, + 433 ], "loc": { "start": { @@ -1357,8 +1304,8 @@ "type": "Identifier", "name": "BLACK", "range": [ - 447, - 452 + 435, + 440 ], "loc": { "start": { @@ -1375,8 +1322,8 @@ "type": "Identifier", "name": "value", "range": [ - 455, - 460 + 443, + 448 ], "loc": { "start": { @@ -1391,8 +1338,8 @@ } ], "range": [ - 437, - 462 + 425, + 450 ], "loc": { "start": { @@ -1406,8 +1353,8 @@ } }, "range": [ - 425, - 462 + 413, + 450 ], "loc": { "start": { @@ -1421,8 +1368,8 @@ } }, "range": [ - 425, - 464 + 413, + 452 ], "loc": { "start": { @@ -1437,8 +1384,8 @@ } ], "range": [ - 420, - 468 + 408, + 456 ], "loc": { "start": { @@ -1463,8 +1410,8 @@ "type": "Identifier", "name": "node", "range": [ - 487, - 491 + 475, + 479 ], "loc": { "start": { @@ -1483,8 +1430,8 @@ "type": "Identifier", "name": "Node", "range": [ - 498, - 502 + 486, + 490 ], "loc": { "start": { @@ -1502,8 +1449,8 @@ "type": "Identifier", "name": "RED", "range": [ - 504, - 507 + 492, + 495 ], "loc": { "start": { @@ -1520,8 +1467,8 @@ "type": "Identifier", "name": "value", "range": [ - 510, - 515 + 498, + 503 ], "loc": { "start": { @@ -1536,8 +1483,8 @@ } ], "range": [ - 494, - 517 + 482, + 505 ], "loc": { "start": { @@ -1551,8 +1498,8 @@ } }, "range": [ - 487, - 517 + 475, + 505 ], "loc": { "start": { @@ -1568,8 +1515,8 @@ ], "kind": "const", "range": [ - 481, - 519 + 469, + 507 ], "loc": { "start": { @@ -1590,8 +1537,8 @@ "type": "Identifier", "name": "insert", "range": [ - 523, - 529 + 511, + 517 ], "loc": { "start": { @@ -1611,8 +1558,8 @@ "object": { "type": "ThisExpression", "range": [ - 531, - 535 + 519, + 523 ], "loc": { "start": { @@ -1629,8 +1576,8 @@ "type": "Identifier", "name": "compare", "range": [ - 536, - 543 + 524, + 531 ], "loc": { "start": { @@ -1644,8 +1591,8 @@ } }, "range": [ - 531, - 543 + 519, + 531 ], "loc": { "start": { @@ -1664,8 +1611,8 @@ "object": { "type": "ThisExpression", "range": [ - 546, - 550 + 534, + 538 ], "loc": { "start": { @@ -1682,8 +1629,8 @@ "type": "Identifier", "name": "root", "range": [ - 551, - 555 + 539, + 543 ], "loc": { "start": { @@ -1697,8 +1644,8 @@ } }, "range": [ - 546, - 555 + 534, + 543 ], "loc": { "start": { @@ -1715,8 +1662,8 @@ "type": "Identifier", "name": "node", "range": [ - 558, - 562 + 546, + 550 ], "loc": { "start": { @@ -1731,8 +1678,8 @@ } ], "range": [ - 523, - 564 + 511, + 552 ], "loc": { "start": { @@ -1746,8 +1693,8 @@ } }, "range": [ - 523, - 566 + 511, + 554 ], "loc": { "start": { @@ -1768,8 +1715,8 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 570, - 582 + 558, + 570 ], "loc": { "start": { @@ -1787,8 +1734,8 @@ "type": "Identifier", "name": "node", "range": [ - 584, - 588 + 572, + 576 ], "loc": { "start": { @@ -1803,8 +1750,8 @@ } ], "range": [ - 570, - 590 + 558, + 578 ], "loc": { "start": { @@ -1818,8 +1765,8 @@ } }, "range": [ - 570, - 592 + 558, + 580 ], "loc": { "start": { @@ -1834,8 +1781,8 @@ } ], "range": [ - 476, - 596 + 464, + 584 ], "loc": { "start": { @@ -1849,8 +1796,8 @@ } }, "range": [ - 394, - 596 + 382, + 584 ], "loc": { "start": { @@ -1865,8 +1812,8 @@ } ], "range": [ - 390, - 599 + 378, + 587 ], "loc": { "start": { @@ -1882,8 +1829,8 @@ "generator": false, "expression": false, "range": [ - 380, - 599 + 368, + 587 ], "loc": { "start": { @@ -1899,8 +1846,8 @@ "kind": "method", "computed": false, "range": [ - 376, - 599 + 364, + 587 ], "loc": { "start": { @@ -1920,8 +1867,8 @@ "type": "Identifier", "name": "find", "range": [ - 602, - 606 + 590, + 594 ], "loc": { "start": { @@ -1942,8 +1889,8 @@ "type": "Identifier", "name": "value", "range": [ - 609, - 614 + 597, + 602 ], "loc": { "start": { @@ -1971,8 +1918,8 @@ "object": { "type": "ThisExpression", "range": [ - 627, - 631 + 615, + 619 ], "loc": { "start": { @@ -1989,8 +1936,8 @@ "type": "Identifier", "name": "root", "range": [ - 632, - 636 + 620, + 624 ], "loc": { "start": { @@ -2004,8 +1951,8 @@ } }, "range": [ - 627, - 636 + 615, + 624 ], "loc": { "start": { @@ -2023,8 +1970,8 @@ "value": null, "raw": "null", "range": [ - 641, - 645 + 629, + 633 ], "loc": { "start": { @@ -2038,8 +1985,8 @@ } }, "range": [ - 627, - 645 + 615, + 633 ], "loc": { "start": { @@ -2059,8 +2006,8 @@ "value": null, "raw": "null", "range": [ - 655, - 659 + 643, + 647 ], "loc": { "start": { @@ -2074,8 +2021,8 @@ } }, "range": [ - 648, - 661 + 636, + 649 ], "loc": { "start": { @@ -2090,8 +2037,8 @@ }, "alternate": null, "range": [ - 622, - 661 + 610, + 649 ], "loc": { "start": { @@ -2112,8 +2059,8 @@ "type": "Identifier", "name": "find", "range": [ - 672, - 676 + 660, + 664 ], "loc": { "start": { @@ -2133,8 +2080,8 @@ "object": { "type": "ThisExpression", "range": [ - 678, - 682 + 666, + 670 ], "loc": { "start": { @@ -2151,8 +2098,8 @@ "type": "Identifier", "name": "compare", "range": [ - 683, - 690 + 671, + 678 ], "loc": { "start": { @@ -2166,8 +2113,8 @@ } }, "range": [ - 678, - 690 + 666, + 678 ], "loc": { "start": { @@ -2186,8 +2133,8 @@ "object": { "type": "ThisExpression", "range": [ - 693, - 697 + 681, + 685 ], "loc": { "start": { @@ -2204,8 +2151,8 @@ "type": "Identifier", "name": "root", "range": [ - 698, - 702 + 686, + 690 ], "loc": { "start": { @@ -2219,8 +2166,8 @@ } }, "range": [ - 693, - 702 + 681, + 690 ], "loc": { "start": { @@ -2237,8 +2184,8 @@ "type": "Identifier", "name": "value", "range": [ - 705, - 710 + 693, + 698 ], "loc": { "start": { @@ -2253,8 +2200,8 @@ } ], "range": [ - 672, - 712 + 660, + 700 ], "loc": { "start": { @@ -2268,8 +2215,8 @@ } }, "range": [ - 665, - 714 + 653, + 702 ], "loc": { "start": { @@ -2284,8 +2231,8 @@ } ], "range": [ - 617, - 718 + 605, + 706 ], "loc": { "start": { @@ -2301,8 +2248,8 @@ "generator": false, "expression": false, "range": [ - 607, - 718 + 595, + 706 ], "loc": { "start": { @@ -2318,8 +2265,8 @@ "kind": "method", "computed": false, "range": [ - 602, - 718 + 590, + 706 ], "loc": { "start": { @@ -2339,8 +2286,8 @@ "type": "Identifier", "name": "delete", "range": [ - 721, - 727 + 709, + 715 ], "loc": { "start": { @@ -2361,8 +2308,8 @@ "type": "Identifier", "name": "node", "range": [ - 730, - 734 + 718, + 722 ], "loc": { "start": { @@ -2396,8 +2343,8 @@ "type": "Identifier", "name": "node", "range": [ - 748, - 752 + 736, + 740 ], "loc": { "start": { @@ -2414,8 +2361,8 @@ "type": "Identifier", "name": "left", "range": [ - 753, - 757 + 741, + 745 ], "loc": { "start": { @@ -2429,8 +2376,8 @@ } }, "range": [ - 748, - 757 + 736, + 745 ], "loc": { "start": { @@ -2447,8 +2394,8 @@ "type": "Identifier", "name": "isleaf", "range": [ - 758, - 764 + 746, + 752 ], "loc": { "start": { @@ -2462,8 +2409,8 @@ } }, "range": [ - 748, - 764 + 736, + 752 ], "loc": { "start": { @@ -2478,8 +2425,8 @@ }, "arguments": [], "range": [ - 748, - 766 + 736, + 754 ], "loc": { "start": { @@ -2494,8 +2441,8 @@ }, "prefix": true, "range": [ - 747, - 766 + 735, + 754 ], "loc": { "start": { @@ -2520,8 +2467,8 @@ "type": "Identifier", "name": "pred", "range": [ - 832, - 836 + 820, + 824 ], "loc": { "start": { @@ -2540,8 +2487,8 @@ "type": "Identifier", "name": "predecessor", "range": [ - 839, - 850 + 827, + 838 ], "loc": { "start": { @@ -2559,8 +2506,8 @@ "type": "Identifier", "name": "node", "range": [ - 852, - 856 + 840, + 844 ], "loc": { "start": { @@ -2575,8 +2522,8 @@ } ], "range": [ - 839, - 858 + 827, + 846 ], "loc": { "start": { @@ -2590,8 +2537,8 @@ } }, "range": [ - 832, - 858 + 820, + 846 ], "loc": { "start": { @@ -2607,8 +2554,8 @@ ], "kind": "const", "range": [ - 826, - 860 + 814, + 848 ], "loc": { "start": { @@ -2625,8 +2572,8 @@ "type": "Line", "value": " replace node's value with predecessor's value", "range": [ - 774, - 822 + 762, + 810 ], "loc": { "start": { @@ -2653,8 +2600,8 @@ "type": "Identifier", "name": "node", "range": [ - 864, - 868 + 852, + 856 ], "loc": { "start": { @@ -2671,8 +2618,8 @@ "type": "Identifier", "name": "value", "range": [ - 869, - 874 + 857, + 862 ], "loc": { "start": { @@ -2686,8 +2633,8 @@ } }, "range": [ - 864, - 874 + 852, + 862 ], "loc": { "start": { @@ -2707,8 +2654,8 @@ "type": "Identifier", "name": "pred", "range": [ - 877, - 881 + 865, + 869 ], "loc": { "start": { @@ -2725,8 +2672,8 @@ "type": "Identifier", "name": "value", "range": [ - 882, - 887 + 870, + 875 ], "loc": { "start": { @@ -2740,8 +2687,8 @@ } }, "range": [ - 877, - 887 + 865, + 875 ], "loc": { "start": { @@ -2755,8 +2702,8 @@ } }, "range": [ - 864, - 887 + 852, + 875 ], "loc": { "start": { @@ -2770,8 +2717,8 @@ } }, "range": [ - 864, - 889 + 852, + 877 ], "loc": { "start": { @@ -2788,8 +2735,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 893, - 919 + 881, + 907 ], "loc": { "start": { @@ -2806,8 +2753,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 923, - 974 + 911, + 962 ], "loc": { "start": { @@ -2824,8 +2771,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 978, - 1023 + 966, + 1011 ], "loc": { "start": { @@ -2848,8 +2795,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1027, - 1043 + 1015, + 1031 ], "loc": { "start": { @@ -2867,8 +2814,8 @@ "type": "Identifier", "name": "pred", "range": [ - 1045, - 1049 + 1033, + 1037 ], "loc": { "start": { @@ -2883,8 +2830,8 @@ } ], "range": [ - 1027, - 1051 + 1015, + 1039 ], "loc": { "start": { @@ -2898,8 +2845,8 @@ } }, "range": [ - 1027, - 1053 + 1015, + 1041 ], "loc": { "start": { @@ -2916,8 +2863,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 893, - 919 + 881, + 907 ], "loc": { "start": { @@ -2934,8 +2881,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 923, - 974 + 911, + 962 ], "loc": { "start": { @@ -2952,8 +2899,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 978, - 1023 + 966, + 1011 ], "loc": { "start": { @@ -2970,8 +2917,8 @@ } ], "range": [ - 769, - 1057 + 757, + 1045 ], "loc": { "start": { @@ -3001,8 +2948,8 @@ "type": "Identifier", "name": "node", "range": [ - 1072, - 1076 + 1060, + 1064 ], "loc": { "start": { @@ -3019,8 +2966,8 @@ "type": "Identifier", "name": "right", "range": [ - 1077, - 1082 + 1065, + 1070 ], "loc": { "start": { @@ -3034,8 +2981,8 @@ } }, "range": [ - 1072, - 1082 + 1060, + 1070 ], "loc": { "start": { @@ -3052,8 +2999,8 @@ "type": "Identifier", "name": "isleaf", "range": [ - 1083, - 1089 + 1071, + 1077 ], "loc": { "start": { @@ -3067,8 +3014,8 @@ } }, "range": [ - 1072, - 1089 + 1060, + 1077 ], "loc": { "start": { @@ -3083,8 +3030,8 @@ }, "arguments": [], "range": [ - 1072, - 1091 + 1060, + 1079 ], "loc": { "start": { @@ -3099,8 +3046,8 @@ }, "prefix": true, "range": [ - 1071, - 1091 + 1059, + 1079 ], "loc": { "start": { @@ -3125,104 +3072,103 @@ "type": "Identifier", "name": "succ", "range": [ - 1155, - 1159 + 1222, + 1226 ], "loc": { "start": { - "line": 52, + "line": 54, "column": 9 }, "end": { - "line": 52, + "line": 54, "column": 13 } } }, "init": { - "type": "CallExpression", - "callee": { + "type": "MemberExpression", + "computed": false, + "object": { "type": "Identifier", - "name": "successor", + "name": "node", "range": [ - 1162, - 1171 + 1229, + 1233 ], "loc": { "start": { - "line": 52, + "line": 54, "column": 16 }, "end": { - "line": 52, - "column": 25 + "line": 54, + "column": 20 } } }, - "arguments": [ - { - "type": "Identifier", - "name": "node", - "range": [ - 1173, - 1177 - ], - "loc": { - "start": { - "line": 52, - "column": 27 - }, - "end": { - "line": 52, - "column": 31 - } + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 1234, + 1239 + ], + "loc": { + "start": { + "line": 54, + "column": 21 + }, + "end": { + "line": 54, + "column": 26 } } - ], + }, "range": [ - 1162, - 1179 + 1229, + 1239 ], "loc": { "start": { - "line": 52, + "line": 54, "column": 16 }, "end": { - "line": 52, - "column": 33 + "line": 54, + "column": 26 } } }, "range": [ - 1155, - 1179 + 1222, + 1239 ], "loc": { "start": { - "line": 52, + "line": 54, "column": 9 }, "end": { - "line": 52, - "column": 33 + "line": 54, + "column": 26 } } } ], "kind": "const", "range": [ - 1149, - 1181 + 1216, + 1241 ], "loc": { "start": { - "line": 52, + "line": 54, "column": 3 }, "end": { - "line": 52, - "column": 35 + "line": 54, + "column": 28 } }, "leadingComments": [ @@ -3230,8 +3176,8 @@ "type": "Line", "value": " replace node's value with successor's value", "range": [ - 1099, - 1145 + 1087, + 1133 ], "loc": { "start": { @@ -3243,6 +3189,42 @@ "column": 49 } } + }, + { + "type": "Line", + "value": " If there is no left child, then there can only be one right", + "range": [ + 1137, + 1199 + ], + "loc": { + "start": { + "line": 52, + "column": 3 + }, + "end": { + "line": 52, + "column": 65 + } + } + }, + { + "type": "Line", + "value": " child.", + "range": [ + 1203, + 1212 + ], + "loc": { + "start": { + "line": 53, + "column": 3 + }, + "end": { + "line": 53, + "column": 12 + } + } } ] }, @@ -3258,16 +3240,16 @@ "type": "Identifier", "name": "node", "range": [ - 1185, - 1189 + 1245, + 1249 ], "loc": { "start": { - "line": 53, + "line": 55, "column": 3 }, "end": { - "line": 53, + "line": 55, "column": 7 } } @@ -3276,31 +3258,31 @@ "type": "Identifier", "name": "value", "range": [ - 1190, - 1195 + 1250, + 1255 ], "loc": { "start": { - "line": 53, + "line": 55, "column": 8 }, "end": { - "line": 53, + "line": 55, "column": 13 } } }, "range": [ - 1185, - 1195 + 1245, + 1255 ], "loc": { "start": { - "line": 53, + "line": 55, "column": 3 }, "end": { - "line": 53, + "line": 55, "column": 13 } } @@ -3312,16 +3294,16 @@ "type": "Identifier", "name": "succ", "range": [ - 1198, - 1202 + 1258, + 1262 ], "loc": { "start": { - "line": 53, + "line": 55, "column": 16 }, "end": { - "line": 53, + "line": 55, "column": 20 } } @@ -3330,61 +3312,61 @@ "type": "Identifier", "name": "value", "range": [ - 1203, - 1208 + 1263, + 1268 ], "loc": { "start": { - "line": 53, + "line": 55, "column": 21 }, "end": { - "line": 53, + "line": 55, "column": 26 } } }, "range": [ - 1198, - 1208 + 1258, + 1268 ], "loc": { "start": { - "line": 53, + "line": 55, "column": 16 }, "end": { - "line": 53, + "line": 55, "column": 26 } } }, "range": [ - 1185, - 1208 + 1245, + 1268 ], "loc": { "start": { - "line": 53, + "line": 55, "column": 3 }, "end": { - "line": 53, + "line": 55, "column": 26 } } }, "range": [ - 1185, - 1210 + 1245, + 1270 ], "loc": { "start": { - "line": 53, + "line": 55, "column": 3 }, "end": { - "line": 53, + "line": 55, "column": 28 } }, @@ -3393,16 +3375,16 @@ "type": "Line", "value": " delete successor node", "range": [ - 1214, - 1238 + 1274, + 1298 ], "loc": { "start": { - "line": 54, + "line": 56, "column": 3 }, "end": { - "line": 54, + "line": 56, "column": 27 } } @@ -3411,16 +3393,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1242, - 1293 + 1302, + 1353 ], "loc": { "start": { - "line": 55, + "line": 57, "column": 3 }, "end": { - "line": 55, + "line": 57, "column": 54 } } @@ -3429,16 +3411,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1297, - 1342 + 1357, + 1402 ], "loc": { "start": { - "line": 56, + "line": 58, "column": 3 }, "end": { - "line": 56, + "line": 58, "column": 48 } } @@ -3453,16 +3435,16 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1346, - 1362 + 1406, + 1422 ], "loc": { "start": { - "line": 57, + "line": 59, "column": 3 }, "end": { - "line": 57, + "line": 59, "column": 19 } } @@ -3470,49 +3452,49 @@ "arguments": [ { "type": "Identifier", - "name": "pred", + "name": "succ", "range": [ - 1364, - 1368 + 1424, + 1428 ], "loc": { "start": { - "line": 57, + "line": 59, "column": 21 }, "end": { - "line": 57, + "line": 59, "column": 25 } } } ], "range": [ - 1346, - 1370 + 1406, + 1430 ], "loc": { "start": { - "line": 57, + "line": 59, "column": 3 }, "end": { - "line": 57, + "line": 59, "column": 27 } } }, "range": [ - 1346, - 1372 + 1406, + 1432 ], "loc": { "start": { - "line": 57, + "line": 59, "column": 3 }, "end": { - "line": 57, + "line": 59, "column": 29 } }, @@ -3521,16 +3503,16 @@ "type": "Line", "value": " delete successor node", "range": [ - 1214, - 1238 + 1274, + 1298 ], "loc": { "start": { - "line": 54, + "line": 56, "column": 3 }, "end": { - "line": 54, + "line": 56, "column": 27 } } @@ -3539,16 +3521,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1242, - 1293 + 1302, + 1353 ], "loc": { "start": { - "line": 55, + "line": 57, "column": 3 }, "end": { - "line": 55, + "line": 57, "column": 54 } } @@ -3557,16 +3539,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1297, - 1342 + 1357, + 1402 ], "loc": { "start": { - "line": 56, + "line": 58, "column": 3 }, "end": { - "line": 56, + "line": 58, "column": 48 } } @@ -3575,8 +3557,8 @@ } ], "range": [ - 1094, - 1376 + 1082, + 1436 ], "loc": { "start": { @@ -3584,140 +3566,337 @@ "column": 35 }, "end": { - "line": 58, + "line": 60, "column": 3 } } }, "alternate": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "ThisExpression", + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "node", + "range": [ + 1450, + 1454 + ], + "loc": { + "start": { + "line": 62, + "column": 12 + }, + "end": { + "line": 62, + "column": 16 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1459, + 1463 + ], + "loc": { + "start": { + "line": 62, + "column": 21 + }, + "end": { + "line": 62, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 1464, + 1468 + ], + "loc": { + "start": { + "line": 62, + "column": 26 + }, + "end": { + "line": 62, + "column": 30 + } + } + }, + "range": [ + 1459, + 1468 + ], + "loc": { + "start": { + "line": 62, + "column": 21 + }, + "end": { + "line": 62, + "column": 30 + } + } + }, + "range": [ + 1450, + 1468 + ], + "loc": { + "start": { + "line": 62, + "column": 12 + }, + "end": { + "line": 62, + "column": 30 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1476, + 1480 + ], + "loc": { + "start": { + "line": 63, + "column": 3 + }, + "end": { + "line": 63, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 1481, + 1485 + ], + "loc": { + "start": { + "line": 63, + "column": 8 + }, + "end": { + "line": 63, + "column": 12 + } + } + }, "range": [ - 1390, - 1394 + 1476, + 1485 ], "loc": { "start": { - "line": 61, + "line": 63, "column": 3 }, "end": { - "line": 61, - "column": 7 + "line": 63, + "column": 12 } } }, - "property": { - "type": "Identifier", - "name": "root", + "right": { + "type": "Literal", + "value": null, + "raw": "null", "range": [ - 1395, - 1399 + 1488, + 1492 ], "loc": { "start": { - "line": 61, - "column": 8 + "line": 63, + "column": 15 }, "end": { - "line": 61, - "column": 12 + "line": 63, + "column": 19 } } }, "range": [ - 1390, - 1399 + 1476, + 1492 ], "loc": { "start": { - "line": 61, + "line": 63, "column": 3 }, "end": { - "line": 61, - "column": 12 - } - } - }, - "right": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 1402, - 1406 - ], - "loc": { - "start": { - "line": 61, - "column": 15 - }, - "end": { - "line": 61, + "line": 63, "column": 19 } } }, "range": [ - 1390, - 1406 + 1476, + 1494 ], "loc": { "start": { - "line": 61, + "line": 63, "column": 3 }, "end": { - "line": 61, - "column": 19 + "line": 63, + "column": 21 } } - }, - "range": [ - 1390, - 1408 - ], - "loc": { - "start": { - "line": 61, - "column": 3 + } + ], + "range": [ + 1471, + 1498 + ], + "loc": { + "start": { + "line": 62, + "column": 33 + }, + "end": { + "line": 64, + "column": 3 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_one_child", + "range": [ + 1512, + 1528 + ], + "loc": { + "start": { + "line": 67, + "column": 3 + }, + "end": { + "line": 67, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 1530, + 1534 + ], + "loc": { + "start": { + "line": 67, + "column": 21 + }, + "end": { + "line": 67, + "column": 25 + } + } + } + ], + "range": [ + 1512, + 1536 + ], + "loc": { + "start": { + "line": 67, + "column": 3 + }, + "end": { + "line": 67, + "column": 27 + } + } }, - "end": { - "line": 61, - "column": 21 + "range": [ + 1512, + 1538 + ], + "loc": { + "start": { + "line": 67, + "column": 3 + }, + "end": { + "line": 67, + "column": 29 + } } } + ], + "range": [ + 1507, + 1542 + ], + "loc": { + "start": { + "line": 66, + "column": 7 + }, + "end": { + "line": 68, + "column": 3 + } } - ], + }, "range": [ - 1385, - 1412 + 1445, + 1542 ], "loc": { "start": { - "line": 60, + "line": 62, "column": 7 }, "end": { - "line": 62, + "line": 68, "column": 3 } } }, "range": [ - 1066, - 1412 + 1054, + 1542 ], "loc": { "start": { @@ -3725,14 +3904,14 @@ "column": 7 }, "end": { - "line": 62, + "line": 68, "column": 3 } } }, "range": [ - 742, - 1412 + 730, + 1542 ], "loc": { "start": { @@ -3740,15 +3919,15 @@ "column": 2 }, "end": { - "line": 62, + "line": 68, "column": 3 } } } ], "range": [ - 737, - 1416 + 725, + 1546 ], "loc": { "start": { @@ -3756,7 +3935,7 @@ "column": 17 }, "end": { - "line": 64, + "line": 70, "column": 2 } } @@ -3764,8 +3943,8 @@ "generator": false, "expression": false, "range": [ - 728, - 1416 + 716, + 1546 ], "loc": { "start": { @@ -3773,7 +3952,7 @@ "column": 8 }, "end": { - "line": 64, + "line": 70, "column": 2 } } @@ -3781,8 +3960,8 @@ "kind": "method", "computed": false, "range": [ - 721, - 1416 + 709, + 1546 ], "loc": { "start": { @@ -3790,7 +3969,7 @@ "column": 1 }, "end": { - "line": 64, + "line": 70, "column": 2 } }, @@ -3805,16 +3984,16 @@ "type": "Identifier", "name": "Symbol", "range": [ - 1421, - 1427 + 1551, + 1557 ], "loc": { "start": { - "line": 66, + "line": 72, "column": 3 }, "end": { - "line": 66, + "line": 72, "column": 9 } } @@ -3823,31 +4002,31 @@ "type": "Identifier", "name": "iterator", "range": [ - 1428, - 1436 + 1558, + 1566 ], "loc": { "start": { - "line": 66, + "line": 72, "column": 10 }, "end": { - "line": 66, + "line": 72, "column": 18 } } }, "range": [ - 1421, - 1436 + 1551, + 1566 ], "loc": { "start": { - "line": 66, + "line": 72, "column": 3 }, "end": { - "line": 66, + "line": 72, "column": 18 } } @@ -3870,16 +4049,16 @@ "object": { "type": "ThisExpression", "range": [ - 1452, - 1456 + 1582, + 1586 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 7 }, "end": { - "line": 68, + "line": 74, "column": 11 } } @@ -3888,31 +4067,31 @@ "type": "Identifier", "name": "root", "range": [ - 1457, - 1461 + 1587, + 1591 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 12 }, "end": { - "line": 68, + "line": 74, "column": 16 } } }, "range": [ - 1452, - 1461 + 1582, + 1591 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 7 }, "end": { - "line": 68, + "line": 74, "column": 16 } } @@ -3922,31 +4101,31 @@ "value": null, "raw": "null", "range": [ - 1466, - 1470 + 1596, + 1600 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 21 }, "end": { - "line": 68, + "line": 74, "column": 25 } } }, "range": [ - 1452, - 1470 + 1582, + 1600 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 7 }, "end": { - "line": 68, + "line": 74, "column": 25 } } @@ -3961,16 +4140,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 1480, - 1496 + 1610, + 1626 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 35 }, "end": { - "line": 68, + "line": 74, "column": 51 } } @@ -3982,16 +4161,16 @@ "object": { "type": "ThisExpression", "range": [ - 1498, - 1502 + 1628, + 1632 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 53 }, "end": { - "line": 68, + "line": 74, "column": 57 } } @@ -4000,110 +4179,110 @@ "type": "Identifier", "name": "root", "range": [ - 1503, - 1507 + 1633, + 1637 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 58 }, "end": { - "line": 68, + "line": 74, "column": 62 } } }, "range": [ - 1498, - 1507 + 1628, + 1637 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 53 }, "end": { - "line": 68, + "line": 74, "column": 62 } } } ], "range": [ - 1480, - 1509 + 1610, + 1639 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 35 }, "end": { - "line": 68, + "line": 74, "column": 64 } } }, "delegate": true, "range": [ - 1473, - 1509 + 1603, + 1639 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 28 }, "end": { - "line": 68, + "line": 74, "column": 64 } } }, "range": [ - 1473, - 1511 + 1603, + 1641 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 28 }, "end": { - "line": 68, + "line": 74, "column": 66 } } }, "alternate": null, "range": [ - 1447, - 1511 + 1577, + 1641 ], "loc": { "start": { - "line": 68, + "line": 74, "column": 2 }, "end": { - "line": 68, + "line": 74, "column": 66 } } } ], "range": [ - 1442, - 1515 + 1572, + 1645 ], "loc": { "start": { - "line": 66, + "line": 72, "column": 24 }, "end": { - "line": 70, + "line": 76, "column": 2 } } @@ -4111,16 +4290,16 @@ "generator": true, "expression": false, "range": [ - 1438, - 1515 + 1568, + 1645 ], "loc": { "start": { - "line": 66, + "line": 72, "column": 20 }, "end": { - "line": 70, + "line": 76, "column": 2 } } @@ -4128,25 +4307,484 @@ "kind": "method", "computed": false, "range": [ - 1419, - 1515 + 1549, + 1645 ], "loc": { "start": { - "line": 66, + "line": 72, "column": 1 }, "end": { - "line": 70, + "line": 76, "column": 2 } }, "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "from", + "range": [ + 1655, + 1659 + ], + "loc": { + "start": { + "line": 78, + "column": 8 + }, + "end": { + "line": 78, + "column": 12 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 1662, + 1669 + ], + "loc": { + "start": { + "line": 78, + "column": 15 + }, + "end": { + "line": 78, + "column": 22 + } + } + }, + { + "type": "Identifier", + "name": "iterable", + "range": [ + 1672, + 1680 + ], + "loc": { + "start": { + "line": 78, + "column": 25 + }, + "end": { + "line": 78, + "column": 33 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "tree", + "range": [ + 1694, + 1698 + ], + "loc": { + "start": { + "line": 80, + "column": 8 + }, + "end": { + "line": 80, + "column": 12 + } + } + }, + "init": { + "type": "NewExpression", + "callee": { + "type": "Identifier", + "name": "RedBlackTree", + "range": [ + 1705, + 1717 + ], + "loc": { + "start": { + "line": 80, + "column": 19 + }, + "end": { + "line": 80, + "column": 31 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 1719, + 1726 + ], + "loc": { + "start": { + "line": 80, + "column": 33 + }, + "end": { + "line": 80, + "column": 40 + } + } + } + ], + "range": [ + 1701, + 1728 + ], + "loc": { + "start": { + "line": 80, + "column": 15 + }, + "end": { + "line": 80, + "column": 42 + } + } + }, + "range": [ + 1694, + 1728 + ], + "loc": { + "start": { + "line": 80, + "column": 8 + }, + "end": { + "line": 80, + "column": 42 + } + } + } + ], + "kind": "const", + "range": [ + 1688, + 1730 + ], + "loc": { + "start": { + "line": 80, + "column": 2 + }, + "end": { + "line": 80, + "column": 44 + } + } + }, + { + "type": "ForOfStatement", + "left": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "element", + "range": [ + 1746, + 1753 + ], + "loc": { + "start": { + "line": 82, + "column": 14 + }, + "end": { + "line": 82, + "column": 21 + } + } + }, + "init": null, + "range": [ + 1746, + 1753 + ], + "loc": { + "start": { + "line": 82, + "column": 14 + }, + "end": { + "line": 82, + "column": 21 + } + } + } + ], + "kind": "const", + "range": [ + 1740, + 1753 + ], + "loc": { + "start": { + "line": 82, + "column": 8 + }, + "end": { + "line": 82, + "column": 21 + } + } + }, + "right": { + "type": "Identifier", + "name": "iterable", + "range": [ + 1757, + 1765 + ], + "loc": { + "start": { + "line": 82, + "column": 25 + }, + "end": { + "line": 82, + "column": 33 + } + } + }, + "body": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "tree", + "range": [ + 1768, + 1772 + ], + "loc": { + "start": { + "line": 82, + "column": 36 + }, + "end": { + "line": 82, + "column": 40 + } + } + }, + "property": { + "type": "Identifier", + "name": "add", + "range": [ + 1773, + 1776 + ], + "loc": { + "start": { + "line": 82, + "column": 41 + }, + "end": { + "line": 82, + "column": 44 + } + } + }, + "range": [ + 1768, + 1776 + ], + "loc": { + "start": { + "line": 82, + "column": 36 + }, + "end": { + "line": 82, + "column": 44 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "element", + "range": [ + 1778, + 1785 + ], + "loc": { + "start": { + "line": 82, + "column": 46 + }, + "end": { + "line": 82, + "column": 53 + } + } + } + ], + "range": [ + 1768, + 1787 + ], + "loc": { + "start": { + "line": 82, + "column": 36 + }, + "end": { + "line": 82, + "column": 55 + } + } + }, + "range": [ + 1768, + 1789 + ], + "loc": { + "start": { + "line": 82, + "column": 36 + }, + "end": { + "line": 82, + "column": 57 + } + } + }, + "range": [ + 1734, + 1789 + ], + "loc": { + "start": { + "line": 82, + "column": 2 + }, + "end": { + "line": 82, + "column": 57 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Identifier", + "name": "tree", + "range": [ + 1800, + 1804 + ], + "loc": { + "start": { + "line": 84, + "column": 9 + }, + "end": { + "line": 84, + "column": 13 + } + } + }, + "range": [ + 1793, + 1806 + ], + "loc": { + "start": { + "line": 84, + "column": 2 + }, + "end": { + "line": 84, + "column": 15 + } + } + } + ], + "range": [ + 1683, + 1810 + ], + "loc": { + "start": { + "line": 78, + "column": 36 + }, + "end": { + "line": 86, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1660, + 1810 + ], + "loc": { + "start": { + "line": 78, + "column": 13 + }, + "end": { + "line": 86, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 1648, + 1810 + ], + "loc": { + "start": { + "line": 78, + "column": 1 + }, + "end": { + "line": 86, + "column": 2 + } + }, + "static": true } ], "range": [ - 291, - 1518 + 279, + 1813 ], "loc": { "start": { @@ -4154,14 +4792,14 @@ "column": 26 }, "end": { - "line": 72, + "line": 88, "column": 1 } } }, "range": [ - 272, - 1518 + 260, + 1813 ], "loc": { "start": { @@ -4169,7 +4807,7 @@ "column": 7 }, "end": { - "line": 72, + "line": 88, "column": 1 } }, @@ -4179,8 +4817,8 @@ "specifiers": [], "source": null, "range": [ - 265, - 1518 + 253, + 1813 ], "loc": { "start": { @@ -4188,7 +4826,7 @@ "column": 0 }, "end": { - "line": 72, + "line": 88, "column": 1 } } @@ -4197,7 +4835,7 @@ "sourceType": "module", "range": [ 1, - 1518 + 1813 ], "loc": { "start": { @@ -4205,7 +4843,7 @@ "column": 0 }, "end": { - "line": 72, + "line": 88, "column": 1 } }, @@ -4214,8 +4852,8 @@ "type": "Line", "value": " replace node's value with predecessor's value", "range": [ - 774, - 822 + 762, + 810 ], "loc": { "start": { @@ -4232,8 +4870,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 893, - 919 + 881, + 907 ], "loc": { "start": { @@ -4250,8 +4888,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 923, - 974 + 911, + 962 ], "loc": { "start": { @@ -4268,8 +4906,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 978, - 1023 + 966, + 1011 ], "loc": { "start": { @@ -4286,8 +4924,8 @@ "type": "Line", "value": " replace node's value with successor's value", "range": [ - 1099, - 1145 + 1087, + 1133 ], "loc": { "start": { @@ -4300,20 +4938,56 @@ } } }, + { + "type": "Line", + "value": " If there is no left child, then there can only be one right", + "range": [ + 1137, + 1199 + ], + "loc": { + "start": { + "line": 52, + "column": 3 + }, + "end": { + "line": 52, + "column": 65 + } + } + }, + { + "type": "Line", + "value": " child.", + "range": [ + 1203, + 1212 + ], + "loc": { + "start": { + "line": 53, + "column": 3 + }, + "end": { + "line": 53, + "column": 12 + } + } + }, { "type": "Line", "value": " delete successor node", "range": [ - 1214, - 1238 + 1274, + 1298 ], "loc": { "start": { - "line": 54, + "line": 56, "column": 3 }, "end": { - "line": 54, + "line": 56, "column": 27 } } @@ -4322,16 +4996,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1242, - 1293 + 1302, + 1353 ], "loc": { "start": { - "line": 55, + "line": 57, "column": 3 }, "end": { - "line": 55, + "line": 57, "column": 54 } } @@ -4340,16 +5014,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1297, - 1342 + 1357, + 1402 ], "loc": { "start": { - "line": 56, + "line": 58, "column": 3 }, "end": { - "line": 56, + "line": 58, "column": 48 } } diff --git a/ast/source/base/debug.js.json b/ast/source/base/debug.js.json new file mode 100644 index 0000000..bc0e338 --- /dev/null +++ b/ast/source/base/debug.js.json @@ -0,0 +1,1223 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + }, + "range": [ + 10, + 15 + ], + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 14 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./colors", + "raw": "'./colors'", + "range": [ + 23, + 33 + ], + "loc": { + "start": { + "line": 2, + "column": 22 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + "range": [ + 1, + 35 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "chalk", + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + "range": [ + 44, + 49 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 12 + } + } + } + ], + "source": { + "type": "Literal", + "value": "chalk", + "raw": "'chalk'", + "range": [ + 55, + 62 + ], + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "range": [ + 37, + 64 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "debug", + "range": [ + 82, + 87 + ], + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 21 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 90, + 94 + ], + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 28 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 106, + 110 + ], + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 111, + 117 + ], + "loc": { + "start": { + "line": 8, + "column": 11 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "range": [ + 106, + 117 + ], + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 17 + } + } + }, + "arguments": [], + "range": [ + 106, + 120 + ], + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "chalk", + "range": [ + 130, + 135 + ], + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 35 + } + } + }, + "property": { + "type": "Identifier", + "name": "bgBlack", + "range": [ + 136, + 143 + ], + "loc": { + "start": { + "line": 8, + "column": 36 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + "range": [ + 130, + 143 + ], + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + "arguments": [ + { + "type": "Literal", + "value": "L", + "raw": "'L'", + "range": [ + 144, + 147 + ], + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 47 + } + } + } + ], + "range": [ + 130, + 148 + ], + "loc": { + "start": { + "line": 8, + "column": 30 + }, + "end": { + "line": 8, + "column": 48 + } + } + }, + "range": [ + 123, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + "alternate": null, + "range": [ + 101, + 150 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 50 + } + } + }, + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "repr", + "range": [ + 159, + 163 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 11 + } + } + }, + "init": { + "type": "ConditionalExpression", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 166, + 170 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 171, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "range": [ + 166, + 176 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 181, + 186 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 34 + } + } + }, + "range": [ + 166, + 186 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 34 + } + } + }, + "consequent": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "chalk", + "range": [ + 189, + 194 + ], + "loc": { + "start": { + "line": 10, + "column": 37 + }, + "end": { + "line": 10, + "column": 42 + } + } + }, + "property": { + "type": "Identifier", + "name": "bgBlack", + "range": [ + 195, + 202 + ], + "loc": { + "start": { + "line": 10, + "column": 43 + }, + "end": { + "line": 10, + "column": 50 + } + } + }, + "range": [ + 189, + 202 + ], + "loc": { + "start": { + "line": 10, + "column": 37 + }, + "end": { + "line": 10, + "column": 50 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 203, + 207 + ], + "loc": { + "start": { + "line": 10, + "column": 51 + }, + "end": { + "line": 10, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 208, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 56 + }, + "end": { + "line": 10, + "column": 61 + } + } + }, + "range": [ + 203, + 213 + ], + "loc": { + "start": { + "line": 10, + "column": 51 + }, + "end": { + "line": 10, + "column": 61 + } + } + } + ], + "range": [ + 189, + 214 + ], + "loc": { + "start": { + "line": 10, + "column": 37 + }, + "end": { + "line": 10, + "column": 62 + } + } + }, + "alternate": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "chalk", + "range": [ + 217, + 222 + ], + "loc": { + "start": { + "line": 10, + "column": 65 + }, + "end": { + "line": 10, + "column": 70 + } + } + }, + "property": { + "type": "Identifier", + "name": "bgRed", + "range": [ + 223, + 228 + ], + "loc": { + "start": { + "line": 10, + "column": 71 + }, + "end": { + "line": 10, + "column": 76 + } + } + }, + "range": [ + 217, + 228 + ], + "loc": { + "start": { + "line": 10, + "column": 65 + }, + "end": { + "line": 10, + "column": 76 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 230, + 234 + ], + "loc": { + "start": { + "line": 10, + "column": 78 + }, + "end": { + "line": 10, + "column": 82 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 235, + 240 + ], + "loc": { + "start": { + "line": 10, + "column": 83 + }, + "end": { + "line": 10, + "column": 88 + } + } + }, + "range": [ + 230, + 240 + ], + "loc": { + "start": { + "line": 10, + "column": 78 + }, + "end": { + "line": 10, + "column": 88 + } + } + } + ], + "range": [ + 217, + 242 + ], + "loc": { + "start": { + "line": 10, + "column": 65 + }, + "end": { + "line": 10, + "column": 90 + } + } + }, + "range": [ + 166, + 242 + ], + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 90 + } + } + }, + "range": [ + 159, + 242 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 90 + } + } + } + ], + "kind": "const", + "range": [ + 153, + 244 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 92 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "TemplateLiteral", + "quasis": [ + { + "type": "TemplateElement", + "value": { + "raw": "(", + "cooked": "(" + }, + "tail": false, + "range": [ + 254, + 258 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": ", ", + "cooked": ", " + }, + "tail": false, + "range": [ + 274, + 279 + ], + "loc": { + "start": { + "line": 12, + "column": 28 + }, + "end": { + "line": 12, + "column": 33 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": ", ", + "cooked": ", " + }, + "tail": false, + "range": [ + 283, + 288 + ], + "loc": { + "start": { + "line": 12, + "column": 37 + }, + "end": { + "line": 12, + "column": 42 + } + } + }, + { + "type": "TemplateElement", + "value": { + "raw": ")", + "cooked": ")" + }, + "tail": true, + "range": [ + 305, + 308 + ], + "loc": { + "start": { + "line": 12, + "column": 59 + }, + "end": { + "line": 12, + "column": 62 + } + } + } + ], + "expressions": [ + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "debug", + "range": [ + 258, + 263 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 17 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 264, + 268 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 22 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 269, + 273 + ], + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + "range": [ + 264, + 273 + ], + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 27 + } + } + } + ], + "range": [ + 258, + 274 + ], + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 28 + } + } + }, + { + "type": "Identifier", + "name": "repr", + "range": [ + 279, + 283 + ], + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 37 + } + } + }, + { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "debug", + "range": [ + 288, + 293 + ], + "loc": { + "start": { + "line": 12, + "column": 42 + }, + "end": { + "line": 12, + "column": 47 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 294, + 298 + ], + "loc": { + "start": { + "line": 12, + "column": 48 + }, + "end": { + "line": 12, + "column": 52 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 299, + 304 + ], + "loc": { + "start": { + "line": 12, + "column": 53 + }, + "end": { + "line": 12, + "column": 58 + } + } + }, + "range": [ + 294, + 304 + ], + "loc": { + "start": { + "line": 12, + "column": 48 + }, + "end": { + "line": 12, + "column": 58 + } + } + } + ], + "range": [ + 288, + 305 + ], + "loc": { + "start": { + "line": 12, + "column": 42 + }, + "end": { + "line": 12, + "column": 59 + } + } + } + ], + "range": [ + 254, + 308 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 62 + } + } + }, + "range": [ + 247, + 310 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 64 + } + } + } + ], + "range": [ + 97, + 313 + ], + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 14, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 73, + 313 + ], + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 66, + 313 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 1, + 313 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 14, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/grandparent.js.json b/ast/source/base/grandparent.js.json deleted file mode 100644 index 04021d6..0000000 --- a/ast/source/base/grandparent.js.json +++ /dev/null @@ -1,442 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "grandparent", - "range": [ - 16, - 27 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "n", - "range": [ - 29, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 29 - }, - "end": { - "line": 1, - "column": 30 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "test": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "BinaryExpression", - "operator": "!==", - "left": { - "type": "Identifier", - "name": "n", - "range": [ - 40, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 7 - } - } - }, - "right": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 46, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "range": [ - 40, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 6 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "!==", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 56, - 57 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 58, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - "range": [ - 56, - 64 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 30 - } - } - }, - "right": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 69, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 39 - } - } - }, - "range": [ - 56, - 73 - ], - "loc": { - "start": { - "line": 2, - "column": 22 - }, - "end": { - "line": 2, - "column": 39 - } - } - }, - "range": [ - 39, - 74 - ], - "loc": { - "start": { - "line": 2, - "column": 5 - }, - "end": { - "line": 2, - "column": 40 - } - } - }, - "consequent": { - "type": "ReturnStatement", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 85, - 86 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 87, - 93 - ], - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "range": [ - 85, - 93 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 94, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - "range": [ - 85, - 100 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - "range": [ - 78, - 101 - ], - "loc": { - "start": { - "line": 3, - "column": 2 - }, - "end": { - "line": 3, - "column": 25 - } - } - }, - "alternate": { - "type": "ReturnStatement", - "argument": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 117, - 121 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - "range": [ - 110, - 122 - ], - "loc": { - "start": { - "line": 5, - "column": 2 - }, - "end": { - "line": 5, - "column": 14 - } - } - }, - "range": [ - 35, - 122 - ], - "loc": { - "start": { - "line": 2, - "column": 1 - }, - "end": { - "line": 5, - "column": 14 - } - } - } - ], - "range": [ - 32, - 124 - ], - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 6, - "column": 1 - } - } - }, - "generator": false, - "expression": false, - "range": [ - 7, - 124 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "leadingComments": [], - "trailingComments": [] - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 124 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 124 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 1 - } - }, - "comments": [] -} \ No newline at end of file diff --git a/ast/source/base/index.js.json b/ast/source/base/index.js.json index 7ba435b..ebc9ffd 100644 --- a/ast/source/base/index.js.json +++ b/ast/source/base/index.js.json @@ -41,11 +41,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./find", - "raw": "'./find'", + "value": "./debug", + "raw": "'./debug'", "range": [ 41, - 49 + 50 ], "loc": { "start": { @@ -54,13 +54,13 @@ }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, "range": [ 27, - 51 + 52 ], "loc": { "start": { @@ -69,7 +69,7 @@ }, "end": { "line": 2, - "column": 24 + "column": 25 } } }, @@ -77,11 +77,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./grandparent", - "raw": "'./grandparent'", + "value": "./find", + "raw": "'./find'", "range": [ - 66, - 81 + 67, + 75 ], "loc": { "start": { @@ -90,13 +90,13 @@ }, "end": { "line": 3, - "column": 29 + "column": 22 } } }, "range": [ - 52, - 83 + 53, + 77 ], "loc": { "start": { @@ -105,7 +105,7 @@ }, "end": { "line": 3, - "column": 31 + "column": 24 } } }, @@ -116,8 +116,8 @@ "value": "./inordertraversal", "raw": "'./inordertraversal'", "range": [ - 98, - 118 + 92, + 112 ], "loc": { "start": { @@ -131,8 +131,8 @@ } }, "range": [ - 84, - 120 + 78, + 114 ], "loc": { "start": { @@ -152,8 +152,8 @@ "value": "./insert", "raw": "'./insert'", "range": [ - 135, - 145 + 129, + 139 ], "loc": { "start": { @@ -167,8 +167,8 @@ } }, "range": [ - 121, - 147 + 115, + 141 ], "loc": { "start": { @@ -185,11 +185,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./predecessor", - "raw": "'./predecessor'", + "value": "./replace_node", + "raw": "'./replace_node'", "range": [ - 162, - 177 + 156, + 172 ], "loc": { "start": { @@ -198,13 +198,13 @@ }, "end": { "line": 6, - "column": 29 + "column": 30 } } }, "range": [ - 148, - 179 + 142, + 174 ], "loc": { "start": { @@ -213,42 +213,6 @@ }, "end": { "line": 6, - "column": 31 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./replace_node", - "raw": "'./replace_node'", - "range": [ - 194, - 210 - ], - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 30 - } - } - }, - "range": [ - 180, - 212 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, "column": 32 } } @@ -260,31 +224,31 @@ "value": "./rotate_left", "raw": "'./rotate_left'", "range": [ - 227, - 242 + 189, + 204 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 14 }, "end": { - "line": 8, + "line": 7, "column": 29 } } }, "range": [ - 213, - 244 + 175, + 206 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 0 }, "end": { - "line": 8, + "line": 7, "column": 31 } } @@ -296,148 +260,40 @@ "value": "./rotate_right", "raw": "'./rotate_right'", "range": [ - 259, - 275 + 221, + 237 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 14 }, "end": { - "line": 9, + "line": 8, "column": 30 } } }, "range": [ - 245, - 277 + 207, + 239 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 0 }, "end": { - "line": 9, + "line": 8, "column": 32 } } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./sibling", - "raw": "'./sibling'", - "range": [ - 292, - 303 - ], - "loc": { - "start": { - "line": 10, - "column": 14 - }, - "end": { - "line": 10, - "column": 25 - } - } - }, - "range": [ - 278, - 305 - ], - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 27 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./successor", - "raw": "'./successor'", - "range": [ - 320, - 333 - ], - "loc": { - "start": { - "line": 11, - "column": 14 - }, - "end": { - "line": 11, - "column": 27 - } - } - }, - "range": [ - 306, - 335 - ], - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 29 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./uncle", - "raw": "'./uncle'", - "range": [ - 350, - 359 - ], - "loc": { - "start": { - "line": 12, - "column": 14 - }, - "end": { - "line": 12, - "column": 23 - } - } - }, - "range": [ - 336, - 361 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 25 - } - } } ], "sourceType": "module", "range": [ 0, - 361 + 239 ], "loc": { "start": { @@ -445,8 +301,8 @@ "column": 0 }, "end": { - "line": 12, - "column": 25 + "line": 8, + "column": 32 } }, "comments": [] diff --git a/ast/source/base/replace_node.js.json b/ast/source/base/replace_node.js.json index 6118d80..a29da0f 100644 --- a/ast/source/base/replace_node.js.json +++ b/ast/source/base/replace_node.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "replace_node", "range": [ - 17, - 29 + 16, + 28 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 16 }, "end": { - "line": 2, + "line": 1, "column": 28 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "A", "range": [ - 32, - 33 + 31, + 32 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 31 }, "end": { - "line": 2, + "line": 1, "column": 32 } } @@ -46,16 +46,16 @@ "type": "Identifier", "name": "B", "range": [ - 36, - 37 + 35, + 36 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 35 }, "end": { - "line": 2, + "line": 1, "column": 36 } } @@ -70,155 +70,134 @@ "type": "BinaryExpression", "operator": "===", "left": { + "type": "Identifier", + "name": "A", + "range": [ + 146, + 147 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 6, + "column": 7 + } + } + }, + "right": { "type": "MemberExpression", "computed": false, "object": { - "type": "Identifier", - "name": "A", + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 152, + 153 + ], + "loc": { + "start": { + "line": 6, + "column": 12 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 154, + 160 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 20 + } + } + }, "range": [ - 48, - 49 + 152, + 160 ], "loc": { "start": { - "line": 3, - "column": 6 + "line": 6, + "column": 12 }, "end": { - "line": 3, - "column": 7 + "line": 6, + "column": 20 } } }, "property": { "type": "Identifier", - "name": "parent", + "name": "left", "range": [ - 50, - 56 + 161, + 165 ], "loc": { "start": { - "line": 3, - "column": 8 + "line": 6, + "column": 21 }, "end": { - "line": 3, - "column": 14 + "line": 6, + "column": 25 } } }, "range": [ - 48, - 56 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 14 - } - } - }, - "right": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 61, - 65 + 152, + 165 ], "loc": { "start": { - "line": 3, - "column": 19 + "line": 6, + "column": 12 }, "end": { - "line": 3, - "column": 23 + "line": 6, + "column": 25 } } }, "range": [ - 48, - 65 + 146, + 165 ], "loc": { "start": { - "line": 3, + "line": 6, "column": 6 }, "end": { - "line": 3, - "column": 23 + "line": 6, + "column": 25 } } }, "consequent": { - "type": "BlockStatement", - "body": [], - "range": [ - 68, - 91 - ], - "loc": { - "start": { - "line": 3, - "column": 26 - }, - "end": { - "line": 5, - "column": 2 - } - }, - "trailingComments": [ - { - "type": "Line", - "value": " nothing to do", - "range": [ - 72, - 88 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - } - } - ] - }, - "alternate": { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "===", + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", "left": { - "type": "Identifier", - "name": "A", - "range": [ - 103, - 104 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 12 - } - } - }, - "right": { "type": "MemberExpression", "computed": false, "object": { @@ -228,17 +207,17 @@ "type": "Identifier", "name": "A", "range": [ - 109, - 110 + 168, + 169 ], "loc": { "start": { "line": 6, - "column": 17 + "column": 28 }, "end": { "line": 6, - "column": 18 + "column": 29 } } }, @@ -246,32 +225,32 @@ "type": "Identifier", "name": "parent", "range": [ - 111, - 117 + 170, + 176 ], "loc": { "start": { "line": 6, - "column": 19 + "column": 30 }, "end": { "line": 6, - "column": 25 + "column": 36 } } }, "range": [ - 109, - 117 + 168, + 176 ], "loc": { "start": { "line": 6, - "column": 17 + "column": 28 }, "end": { "line": 6, - "column": 25 + "column": 36 } } }, @@ -279,423 +258,278 @@ "type": "Identifier", "name": "left", "range": [ - 118, - 122 + 177, + 181 ], "loc": { "start": { "line": 6, - "column": 26 + "column": 37 }, "end": { "line": 6, - "column": 30 + "column": 41 } } }, "range": [ - 109, - 122 + 168, + 181 ], "loc": { "start": { "line": 6, - "column": 17 + "column": 28 }, "end": { "line": 6, - "column": 30 + "column": 41 + } + } + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 184, + 185 + ], + "loc": { + "start": { + "line": 6, + "column": 44 + }, + "end": { + "line": 6, + "column": 45 } } }, "range": [ - 103, - 122 + 168, + 185 ], "loc": { "start": { "line": 6, - "column": 11 + "column": 28 }, "end": { "line": 6, - "column": 30 + "column": 45 } } }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "A", - "range": [ - 129, - 130 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 3 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 131, - 137 - ], - "loc": { - "start": { - "line": 7, - "column": 4 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - "range": [ - 129, - 137 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 138, - 142 - ], - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 15 - } - } + "range": [ + 168, + 187 + ], + "loc": { + "start": { + "line": 6, + "column": 28 + }, + "end": { + "line": 6, + "column": 47 + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "A", + "range": [ + 195, + 196 + ], + "loc": { + "start": { + "line": 8, + "column": 6 }, - "range": [ - 129, - 142 - ], - "loc": { - "start": { - "line": 7, - "column": 2 - }, - "end": { - "line": 7, - "column": 15 - } - } - }, - "right": { - "type": "Identifier", - "name": "B", - "range": [ - 145, - 146 - ], - "loc": { - "start": { - "line": 7, - "column": 18 - }, - "end": { - "line": 7, - "column": 19 - } + "end": { + "line": 8, + "column": 7 } - }, + } + }, + "property": { + "type": "Identifier", + "name": "parent", "range": [ - 129, - 146 + 197, + 203 ], "loc": { "start": { - "line": 7, - "column": 2 + "line": 8, + "column": 8 }, "end": { - "line": 7, - "column": 19 + "line": 8, + "column": 14 } } }, "range": [ - 129, - 148 + 195, + 203 ], "loc": { "start": { - "line": 7, - "column": 2 + "line": 8, + "column": 6 }, "end": { - "line": 7, - "column": 21 + "line": 8, + "column": 14 } } - } - ], - "range": [ - 125, - 151 - ], - "loc": { - "start": { - "line": 6, - "column": 33 }, - "end": { - "line": 8, - "column": 2 - } - } - }, - "alternate": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "A", - "range": [ - 162, - 163 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 3 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 164, - 170 - ], - "loc": { - "start": { - "line": 10, - "column": 4 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "range": [ - 162, - 170 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 171, - 176 - ], - "loc": { - "start": { - "line": 10, - "column": 11 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - "range": [ - 162, - 176 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 16 - } - } - }, - "right": { - "type": "Identifier", - "name": "B", - "range": [ - 179, - 180 - ], - "loc": { - "start": { - "line": 10, - "column": 19 - }, - "end": { - "line": 10, - "column": 20 - } - } - }, - "range": [ - 162, - 180 - ], - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 20 - } - } - }, + "property": { + "type": "Identifier", + "name": "right", "range": [ - 162, - 182 + 204, + 209 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 8, + "column": 15 }, "end": { - "line": 10, - "column": 22 + "line": 8, + "column": 20 } } + }, + "range": [ + 195, + 209 + ], + "loc": { + "start": { + "line": 8, + "column": 6 + }, + "end": { + "line": 8, + "column": 20 + } } - ], + }, + "right": { + "type": "Identifier", + "name": "B", + "range": [ + 212, + 213 + ], + "loc": { + "start": { + "line": 8, + "column": 23 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, "range": [ - 158, - 185 + 195, + 213 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 6 }, "end": { - "line": 11, - "column": 2 + "line": 8, + "column": 24 } } }, "range": [ - 98, - 185 + 195, + 215 ], "loc": { "start": { - "line": 6, + "line": 8, "column": 6 }, "end": { - "line": 11, - "column": 2 - } - }, - "leadingComments": [ - { - "type": "Line", - "value": " nothing to do", - "range": [ - 72, - 88 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 18 - } - } + "line": 8, + "column": 26 } - ] + } }, "range": [ - 43, - 185 + 141, + 215 ], "loc": { "start": { - "line": 3, + "line": 6, "column": 1 }, "end": { - "line": 11, - "column": 2 + "line": 8, + "column": 26 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " assert( A.parent !== null ) ;", + "range": [ + 43, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Line", + "value": " we never apply delete_one_child on the root so we are safe", + "range": [ + 77, + 138 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 62 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -709,16 +543,16 @@ "type": "Identifier", "name": "B", "range": [ - 187, - 188 + 218, + 219 ], "loc": { "start": { - "line": 12, + "line": 10, "column": 1 }, "end": { - "line": 12, + "line": 10, "column": 2 } } @@ -727,31 +561,31 @@ "type": "Identifier", "name": "parent", "range": [ - 189, - 195 + 220, + 226 ], "loc": { "start": { - "line": 12, + "line": 10, "column": 3 }, "end": { - "line": 12, + "line": 10, "column": 9 } } }, "range": [ - 187, - 195 + 218, + 226 ], "loc": { "start": { - "line": 12, + "line": 10, "column": 1 }, "end": { - "line": 12, + "line": 10, "column": 9 } } @@ -763,16 +597,16 @@ "type": "Identifier", "name": "A", "range": [ - 198, - 199 + 229, + 230 ], "loc": { "start": { - "line": 12, + "line": 10, "column": 12 }, "end": { - "line": 12, + "line": 10, "column": 13 } } @@ -781,77 +615,77 @@ "type": "Identifier", "name": "parent", "range": [ - 200, - 206 + 231, + 237 ], "loc": { "start": { - "line": 12, + "line": 10, "column": 14 }, "end": { - "line": 12, + "line": 10, "column": 20 } } }, "range": [ - 198, - 206 + 229, + 237 ], "loc": { "start": { - "line": 12, + "line": 10, "column": 12 }, "end": { - "line": 12, + "line": 10, "column": 20 } } }, "range": [ - 187, - 206 + 218, + 237 ], "loc": { "start": { - "line": 12, + "line": 10, "column": 1 }, "end": { - "line": 12, + "line": 10, "column": 20 } } }, "range": [ - 187, - 208 + 218, + 239 ], "loc": { "start": { - "line": 12, + "line": 10, "column": 1 }, "end": { - "line": 12, + "line": 10, "column": 22 } } } ], "range": [ - 40, - 210 + 39, + 242 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 39 }, "end": { - "line": 13, + "line": 12, "column": 1 } } @@ -859,16 +693,16 @@ "generator": false, "expression": false, "range": [ - 8, - 210 + 7, + 242 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 7 }, "end": { - "line": 13, + "line": 12, "column": 1 } }, @@ -878,16 +712,16 @@ "specifiers": [], "source": null, "range": [ - 1, - 210 + 0, + 242 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 13, + "line": 12, "column": 1 } } @@ -895,35 +729,53 @@ ], "sourceType": "module", "range": [ - 1, - 210 + 0, + 242 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 13, + "line": 12, "column": 1 } }, "comments": [ { "type": "Line", - "value": " nothing to do", + "value": " assert( A.parent !== null ) ;", + "range": [ + 43, + 75 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": "Line", + "value": " we never apply delete_one_child on the root so we are safe", "range": [ - 72, - 88 + 77, + 138 ], "loc": { "start": { "line": 4, - "column": 2 + "column": 1 }, "end": { "line": 4, - "column": 18 + "column": 62 } } } diff --git a/ast/source/base/sibling.js.json b/ast/source/base/sibling.js.json deleted file mode 100644 index 1247d27..0000000 --- a/ast/source/base/sibling.js.json +++ /dev/null @@ -1,752 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "sibling", - "range": [ - 16, - 23 - ], - "loc": { - "start": { - "line": 1, - "column": 16 - }, - "end": { - "line": 1, - "column": 23 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "n", - "range": [ - 24, - 25 - ], - "loc": { - "start": { - "line": 1, - "column": 24 - }, - "end": { - "line": 1, - "column": 25 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "test": { - "type": "LogicalExpression", - "operator": "||", - "left": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "Identifier", - "name": "n", - "range": [ - 35, - 36 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 7 - } - } - }, - "right": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 41, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - "range": [ - 35, - 45 - ], - "loc": { - "start": { - "line": 3, - "column": 6 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 51, - 52 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 23 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 53, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 24 - }, - "end": { - "line": 3, - "column": 30 - } - } - }, - "range": [ - 51, - 59 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 30 - } - } - }, - "right": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 64, - 68 - ], - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 39 - } - } - }, - "range": [ - 51, - 68 - ], - "loc": { - "start": { - "line": 3, - "column": 22 - }, - "end": { - "line": 3, - "column": 39 - } - } - }, - "range": [ - 34, - 69 - ], - "loc": { - "start": { - "line": 3, - "column": 5 - }, - "end": { - "line": 3, - "column": 40 - } - } - }, - "consequent": { - "type": "ReturnStatement", - "argument": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 80, - 84 - ], - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - "range": [ - 73, - 85 - ], - "loc": { - "start": { - "line": 4, - "column": 2 - }, - "end": { - "line": 4, - "column": 14 - } - } - }, - "alternate": null, - "range": [ - 30, - 85 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 4, - "column": 14 - } - }, - "trailingComments": [ - { - "type": "Line", - "value": " no parent means no sibling", - "range": [ - 86, - 115 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 44 - } - } - } - ] - }, - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "Identifier", - "name": "n", - "range": [ - 121, - 122 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "right": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 127, - 128 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 12 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 129, - 135 - ], - "loc": { - "start": { - "line": 5, - "column": 13 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - "range": [ - 127, - 135 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 136, - 140 - ], - "loc": { - "start": { - "line": 5, - "column": 20 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - "range": [ - 127, - 140 - ], - "loc": { - "start": { - "line": 5, - "column": 11 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - "range": [ - 121, - 140 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - "consequent": { - "type": "ReturnStatement", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 151, - 152 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 153, - 159 - ], - "loc": { - "start": { - "line": 6, - "column": 11 - }, - "end": { - "line": 6, - "column": 17 - } - } - }, - "range": [ - 151, - 159 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 17 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 160, - 165 - ], - "loc": { - "start": { - "line": 6, - "column": 18 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "range": [ - 151, - 165 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - "range": [ - 144, - 166 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 24 - } - } - }, - "alternate": { - "type": "ReturnStatement", - "argument": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 182, - 183 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 184, - 190 - ], - "loc": { - "start": { - "line": 8, - "column": 11 - }, - "end": { - "line": 8, - "column": 17 - } - } - }, - "range": [ - 182, - 190 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 17 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 191, - 195 - ], - "loc": { - "start": { - "line": 8, - "column": 18 - }, - "end": { - "line": 8, - "column": 22 - } - } - }, - "range": [ - 182, - 195 - ], - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 22 - } - } - }, - "range": [ - 175, - 196 - ], - "loc": { - "start": { - "line": 8, - "column": 2 - }, - "end": { - "line": 8, - "column": 23 - } - } - }, - "range": [ - 117, - 196 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 8, - "column": 23 - } - }, - "leadingComments": [ - { - "type": "Line", - "value": " no parent means no sibling", - "range": [ - 86, - 115 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 44 - } - } - } - ] - } - ], - "range": [ - 27, - 198 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - } - }, - "generator": false, - "expression": false, - "range": [ - 7, - 198 - ], - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "leadingComments": [], - "trailingComments": [] - }, - "specifiers": [], - "source": null, - "range": [ - 0, - 198 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 198 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 1 - } - }, - "comments": [ - { - "type": "Line", - "value": " no parent means no sibling", - "range": [ - 86, - 115 - ], - "loc": { - "start": { - "line": 4, - "column": 15 - }, - "end": { - "line": 4, - "column": 44 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/family/grandparent.js.json b/ast/source/family/grandparent.js.json new file mode 100644 index 0000000..416f915 --- /dev/null +++ b/ast/source/family/grandparent.js.json @@ -0,0 +1,300 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "grandparent", + "range": [ + 16, + 27 + ], + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 30, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 30 + }, + "end": { + "line": 1, + "column": 31 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 148, + 149 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 150, + 156 + ], + "loc": { + "start": { + "line": 5, + "column": 10 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + "range": [ + 148, + 156 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 157, + 163 + ], + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 148, + 163 + ], + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + "range": [ + 141, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 24 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": "assert((n !== null) && (n.parent !== null));", + "range": [ + 38, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "Line", + "value": "We only call this function when n HAS a grandparent", + "range": [ + 86, + 139 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 54 + } + } + } + ] + } + ], + "range": [ + 34, + 167 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 7, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 7, + 167 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 167 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 167 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 1 + } + }, + "comments": [ + { + "type": "Line", + "value": "assert((n !== null) && (n.parent !== null));", + "range": [ + 38, + 84 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "Line", + "value": "We only call this function when n HAS a grandparent", + "range": [ + 86, + 139 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 54 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/family/index.js.json b/ast/source/family/index.js.json new file mode 100644 index 0000000..67212de --- /dev/null +++ b/ast/source/family/index.js.json @@ -0,0 +1,165 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./grandparent", + "raw": "'./grandparent'", + "range": [ + 14, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./predecessor", + "raw": "'./predecessor'", + "range": [ + 46, + 61 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + "range": [ + 32, + 63 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 31 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./sibling", + "raw": "'./sibling'", + "range": [ + 78, + 89 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "range": [ + 64, + 91 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 27 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./uncle", + "raw": "'./uncle'", + "range": [ + 106, + 115 + ], + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + "range": [ + 92, + 117 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 117 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 4, + "column": 25 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/predecessor.js.json b/ast/source/family/predecessor.js.json similarity index 100% rename from ast/source/base/predecessor.js.json rename to ast/source/family/predecessor.js.json diff --git a/ast/source/base/successor.js.json b/ast/source/family/sibling.js.json similarity index 53% rename from ast/source/base/successor.js.json rename to ast/source/family/sibling.js.json index 8f9f27f..a08dd0b 100644 --- a/ast/source/base/successor.js.json +++ b/ast/source/family/sibling.js.json @@ -7,10 +7,10 @@ "type": "FunctionDeclaration", "id": { "type": "Identifier", - "name": "successor", + "name": "sibling", "range": [ 16, - 25 + 23 ], "loc": { "start": { @@ -19,26 +19,26 @@ }, "end": { "line": 1, - "column": 25 + "column": 23 } } }, "params": [ { "type": "Identifier", - "name": "node", + "name": "n", "range": [ - 28, - 32 + 26, + 27 ], "loc": { "start": { "line": 1, - "column": 28 + "column": 26 }, "end": { "line": 1, - "column": 32 + "column": 27 } } } @@ -47,388 +47,333 @@ "type": "BlockStatement", "body": [ { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { "type": "Identifier", - "name": "succ", + "name": "n", "range": [ - 43, - 47 + 175, + 176 ], "loc": { "start": { - "line": 3, - "column": 5 + "line": 7, + "column": 9 }, "end": { - "line": 3, - "column": 9 + "line": 7, + "column": 10 } } }, - "init": { + "right": { "type": "MemberExpression", "computed": false, "object": { - "type": "Identifier", - "name": "node", + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 181, + 182 + ], + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 16 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 183, + 189 + ], + "loc": { + "start": { + "line": 7, + "column": 17 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, "range": [ - 50, - 54 + 181, + 189 ], "loc": { "start": { - "line": 3, - "column": 12 + "line": 7, + "column": 15 }, "end": { - "line": 3, - "column": 16 + "line": 7, + "column": 23 } } }, "property": { "type": "Identifier", - "name": "right", + "name": "left", "range": [ - 55, - 60 + 190, + 194 ], "loc": { "start": { - "line": 3, - "column": 17 + "line": 7, + "column": 24 }, "end": { - "line": 3, - "column": 22 + "line": 7, + "column": 28 } } }, "range": [ - 50, - 60 + 181, + 194 ], "loc": { "start": { - "line": 3, - "column": 12 + "line": 7, + "column": 15 }, "end": { - "line": 3, - "column": 22 + "line": 7, + "column": 28 } } }, "range": [ - 43, - 60 + 175, + 194 ], "loc": { "start": { - "line": 3, - "column": 5 + "line": 7, + "column": 9 }, "end": { - "line": 3, - "column": 22 + "line": 7, + "column": 28 } } - } - ], - "kind": "var", - "range": [ - 39, - 62 - ], - "loc": { - "start": { - "line": 3, - "column": 1 }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "WhileStatement", - "test": { - "type": "UnaryExpression", - "operator": "!", - "argument": { - "type": "CallExpression", - "callee": { + "consequent": { + "type": "MemberExpression", + "computed": false, + "object": { "type": "MemberExpression", "computed": false, "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "succ", - "range": [ - 74, - 78 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 14 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 79, - 83 - ], - "loc": { - "start": { - "line": 5, - "column": 15 - }, - "end": { - "line": 5, - "column": 19 - } - } - }, + "type": "Identifier", + "name": "n", "range": [ - 74, - 83 + 197, + 198 ], "loc": { "start": { - "line": 5, - "column": 10 + "line": 7, + "column": 31 }, "end": { - "line": 5, - "column": 19 + "line": 7, + "column": 32 } } }, "property": { "type": "Identifier", - "name": "isleaf", + "name": "parent", "range": [ - 84, - 90 + 199, + 205 ], "loc": { "start": { - "line": 5, - "column": 20 + "line": 7, + "column": 33 }, "end": { - "line": 5, - "column": 26 + "line": 7, + "column": 39 } } }, "range": [ - 74, - 90 + 197, + 205 ], "loc": { "start": { - "line": 5, - "column": 10 + "line": 7, + "column": 31 }, "end": { - "line": 5, - "column": 26 + "line": 7, + "column": 39 } } }, - "arguments": [], - "range": [ - 74, - 92 - ], - "loc": { - "start": { - "line": 5, - "column": 10 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - "prefix": true, - "range": [ - 73, - 92 - ], - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - "body": { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { + "property": { "type": "Identifier", - "name": "succ", + "name": "right", "range": [ - 95, - 99 + 206, + 211 ], "loc": { "start": { - "line": 5, - "column": 31 + "line": 7, + "column": 40 }, "end": { - "line": 5, - "column": 35 + "line": 7, + "column": 45 } } }, - "right": { + "range": [ + 197, + 211 + ], + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 45 + } + } + }, + "alternate": { + "type": "MemberExpression", + "computed": false, + "object": { "type": "MemberExpression", "computed": false, "object": { "type": "Identifier", - "name": "succ", + "name": "n", "range": [ - 102, - 106 + 214, + 215 ], "loc": { "start": { - "line": 5, - "column": 38 + "line": 7, + "column": 48 }, "end": { - "line": 5, - "column": 42 + "line": 7, + "column": 49 } } }, "property": { "type": "Identifier", - "name": "left", + "name": "parent", "range": [ - 107, - 111 + 216, + 222 ], "loc": { "start": { - "line": 5, - "column": 43 + "line": 7, + "column": 50 }, "end": { - "line": 5, - "column": 47 + "line": 7, + "column": 56 } } }, "range": [ - 102, - 111 + 214, + 222 + ], + "loc": { + "start": { + "line": 7, + "column": 48 + }, + "end": { + "line": 7, + "column": 56 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 223, + 227 ], "loc": { "start": { - "line": 5, - "column": 38 + "line": 7, + "column": 57 }, "end": { - "line": 5, - "column": 47 + "line": 7, + "column": 61 } } }, "range": [ - 95, - 111 + 214, + 227 ], "loc": { "start": { - "line": 5, - "column": 31 + "line": 7, + "column": 48 }, "end": { - "line": 5, - "column": 47 + "line": 7, + "column": 61 } } }, "range": [ - 95, - 113 - ], - "loc": { - "start": { - "line": 5, - "column": 31 - }, - "end": { - "line": 5, - "column": 49 - } - } - }, - "range": [ - 65, - 113 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 5, - "column": 49 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "Identifier", - "name": "succ", - "range": [ - 123, - 127 + 175, + 227 ], "loc": { "start": { "line": 7, - "column": 8 + "column": 9 }, "end": { "line": 7, - "column": 12 + "column": 61 } } }, "range": [ - 116, - 129 + 167, + 229 ], "loc": { "start": { @@ -437,19 +382,75 @@ }, "end": { "line": 7, - "column": 14 + "column": 63 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": "assert((n !== null) && (n.parent !== null));", + "range": [ + 34, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "Line", + "value": "We only use this function when n HAS a sibling so this case can never", + "range": [ + 82, + 153 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 72 + } + } + }, + { + "type": "Line", + "value": "happen.", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + } + ] } ], "range": [ - 35, - 132 + 30, + 232 ], "loc": { "start": { "line": 1, - "column": 35 + "column": 30 }, "end": { "line": 9, @@ -461,7 +462,7 @@ "expression": false, "range": [ 7, - 132 + 232 ], "loc": { "start": { @@ -480,7 +481,7 @@ "source": null, "range": [ 0, - 132 + 232 ], "loc": { "start": { @@ -497,7 +498,7 @@ "sourceType": "module", "range": [ 0, - 132 + 232 ], "loc": { "start": { @@ -509,5 +510,60 @@ "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Line", + "value": "assert((n !== null) && (n.parent !== null));", + "range": [ + 34, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 3, + "column": 47 + } + } + }, + { + "type": "Line", + "value": "We only use this function when n HAS a sibling so this case can never", + "range": [ + 82, + 153 + ], + "loc": { + "start": { + "line": 4, + "column": 1 + }, + "end": { + "line": 4, + "column": 72 + } + } + }, + { + "type": "Line", + "value": "happen.", + "range": [ + 155, + 164 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 10 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/base/uncle.js.json b/ast/source/family/uncle.js.json similarity index 78% rename from ast/source/base/uncle.js.json rename to ast/source/family/uncle.js.json index 3fe9fcc..654e52a 100644 --- a/ast/source/base/uncle.js.json +++ b/ast/source/family/uncle.js.json @@ -119,17 +119,17 @@ "type": "Identifier", "name": "n", "range": [ - 69, - 70 + 71, + 72 ], "loc": { "start": { "line": 3, - "column": 22 + "column": 24 }, "end": { "line": 3, - "column": 23 + "column": 25 } } } @@ -146,8 +146,8 @@ "type": "Identifier", "name": "g", "range": [ - 80, - 81 + 84, + 85 ], "loc": { "start": { @@ -166,8 +166,8 @@ "type": "Identifier", "name": "grandparent", "range": [ - 84, - 95 + 88, + 99 ], "loc": { "start": { @@ -185,24 +185,24 @@ "type": "Identifier", "name": "n", "range": [ - 96, - 97 + 101, + 102 ], "loc": { "start": { "line": 4, - "column": 23 + "column": 24 }, "end": { "line": 4, - "column": 24 + "column": 25 } } } ], "range": [ - 84, - 98 + 88, + 104 ], "loc": { "start": { @@ -211,13 +211,13 @@ }, "end": { "line": 4, - "column": 25 + "column": 27 } } }, "range": [ - 80, - 98 + 84, + 104 ], "loc": { "start": { @@ -226,15 +226,15 @@ }, "end": { "line": 4, - "column": 25 + "column": 27 } } } ], "kind": "const", "range": [ - 74, - 99 + 78, + 105 ], "loc": { "start": { @@ -243,134 +243,43 @@ }, "end": { "line": 4, - "column": 26 + "column": 28 } - } - }, - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "Identifier", - "name": "g", - "range": [ - 105, - 106 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - "right": { - "type": "Literal", - "value": null, - "raw": "null", + }, + "trailingComments": [ + { + "type": "Line", + "value": " assert( g !== null ) ;", "range": [ - 111, - 115 + 107, + 132 ], "loc": { "start": { "line": 5, - "column": 11 + "column": 1 }, "end": { "line": 5, - "column": 15 - } - } - }, - "range": [ - 105, - 115 - ], - "loc": { - "start": { - "line": 5, - "column": 5 - }, - "end": { - "line": 5, - "column": 15 - } - } - }, - "consequent": { - "type": "ReturnStatement", - "argument": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 126, - 130 - ], - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 13 + "column": 26 } } }, - "range": [ - 119, - 131 - ], - "loc": { - "start": { - "line": 6, - "column": 2 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - "alternate": null, - "range": [ - 101, - 131 - ], - "loc": { - "start": { - "line": 5, - "column": 1 - }, - "end": { - "line": 6, - "column": 14 - } - }, - "trailingComments": [ { "type": "Line", - "value": " No grandparent means no uncle", + "value": " this can never happen", "range": [ - 132, - 164 + 134, + 158 ], "loc": { "start": { "line": 6, - "column": 15 + "column": 1 }, "end": { "line": 6, - "column": 47 + "column": 25 } } } @@ -388,17 +297,17 @@ "type": "Identifier", "name": "n", "range": [ - 170, - 171 + 165, + 166 ], "loc": { "start": { "line": 7, - "column": 5 + "column": 6 }, "end": { "line": 7, - "column": 6 + "column": 7 } } }, @@ -406,32 +315,32 @@ "type": "Identifier", "name": "parent", "range": [ - 172, - 178 + 167, + 173 ], "loc": { "start": { "line": 7, - "column": 7 + "column": 8 }, "end": { "line": 7, - "column": 13 + "column": 14 } } }, "range": [ - 170, - 178 + 165, + 173 ], "loc": { "start": { "line": 7, - "column": 5 + "column": 6 }, "end": { "line": 7, - "column": 13 + "column": 14 } } }, @@ -442,17 +351,17 @@ "type": "Identifier", "name": "g", "range": [ - 183, - 184 + 178, + 179 ], "loc": { "start": { "line": 7, - "column": 18 + "column": 19 }, "end": { "line": 7, - "column": 19 + "column": 20 } } }, @@ -460,47 +369,47 @@ "type": "Identifier", "name": "left", "range": [ - 185, - 189 + 180, + 184 ], "loc": { "start": { "line": 7, - "column": 20 + "column": 21 }, "end": { "line": 7, - "column": 24 + "column": 25 } } }, "range": [ - 183, - 189 + 178, + 184 ], "loc": { "start": { "line": 7, - "column": 18 + "column": 19 }, "end": { "line": 7, - "column": 24 + "column": 25 } } }, "range": [ - 170, - 189 + 165, + 184 ], "loc": { "start": { "line": 7, - "column": 5 + "column": 6 }, "end": { "line": 7, - "column": 24 + "column": 25 } } }, @@ -520,17 +429,17 @@ "type": "Identifier", "name": "g", "range": [ - 200, - 201 + 197, + 198 ], "loc": { "start": { "line": 8, - "column": 9 + "column": 10 }, "end": { "line": 8, - "column": 10 + "column": 11 } } }, @@ -538,32 +447,32 @@ "type": "Identifier", "name": "right", "range": [ - 202, - 207 + 199, + 204 ], "loc": { "start": { "line": 8, - "column": 11 + "column": 12 }, "end": { "line": 8, - "column": 16 + "column": 17 } } }, "range": [ - 200, - 207 + 197, + 204 ], "loc": { "start": { "line": 8, - "column": 9 + "column": 10 }, "end": { "line": 8, - "column": 16 + "column": 17 } } }, @@ -571,48 +480,48 @@ "type": "Identifier", "name": "isleaf", "range": [ - 208, - 214 + 205, + 211 ], "loc": { "start": { "line": 8, - "column": 17 + "column": 18 }, "end": { "line": 8, - "column": 23 + "column": 24 } } }, "range": [ - 200, - 214 + 197, + 211 ], "loc": { "start": { "line": 8, - "column": 9 + "column": 10 }, "end": { "line": 8, - "column": 23 + "column": 24 } } }, "arguments": [], "range": [ - 200, - 216 + 197, + 214 ], "loc": { "start": { "line": 8, - "column": 9 + "column": 10 }, "end": { "line": 8, - "column": 25 + "column": 27 } } }, @@ -621,17 +530,17 @@ "value": null, "raw": "null", "range": [ - 219, - 223 + 217, + 221 ], "loc": { "start": { "line": 8, - "column": 28 + "column": 30 }, "end": { "line": 8, - "column": 32 + "column": 34 } } }, @@ -642,17 +551,17 @@ "type": "Identifier", "name": "g", "range": [ - 226, - 227 + 224, + 225 ], "loc": { "start": { "line": 8, - "column": 35 + "column": 37 }, "end": { "line": 8, - "column": 36 + "column": 38 } } }, @@ -660,62 +569,62 @@ "type": "Identifier", "name": "right", "range": [ - 228, - 233 + 226, + 231 ], "loc": { "start": { "line": 8, - "column": 37 + "column": 39 }, "end": { "line": 8, - "column": 42 + "column": 44 } } }, "range": [ - 226, - 233 + 224, + 231 ], "loc": { "start": { "line": 8, - "column": 35 + "column": 37 }, "end": { "line": 8, - "column": 42 + "column": 44 } } }, "range": [ - 200, - 233 + 197, + 231 ], "loc": { "start": { "line": 8, - "column": 9 + "column": 10 }, "end": { "line": 8, - "column": 42 + "column": 44 } } }, "range": [ - 193, - 235 + 190, + 233 ], "loc": { "start": { "line": 8, - "column": 2 + "column": 3 }, "end": { "line": 8, - "column": 44 + "column": 46 } } }, @@ -735,17 +644,17 @@ "type": "Identifier", "name": "g", "range": [ - 251, - 252 + 250, + 251 ], "loc": { "start": { "line": 10, - "column": 9 + "column": 10 }, "end": { "line": 10, - "column": 10 + "column": 11 } } }, @@ -753,32 +662,32 @@ "type": "Identifier", "name": "left", "range": [ - 253, - 257 + 252, + 256 ], "loc": { "start": { "line": 10, - "column": 11 + "column": 12 }, "end": { "line": 10, - "column": 15 + "column": 16 } } }, "range": [ - 251, - 257 + 250, + 256 ], "loc": { "start": { "line": 10, - "column": 9 + "column": 10 }, "end": { "line": 10, - "column": 15 + "column": 16 } } }, @@ -786,48 +695,48 @@ "type": "Identifier", "name": "isleaf", "range": [ - 258, - 264 + 257, + 263 ], "loc": { "start": { "line": 10, - "column": 16 + "column": 17 }, "end": { "line": 10, - "column": 22 + "column": 23 } } }, "range": [ - 251, - 264 + 250, + 263 ], "loc": { "start": { "line": 10, - "column": 9 + "column": 10 }, "end": { "line": 10, - "column": 22 + "column": 23 } } }, "arguments": [], "range": [ - 251, + 250, 266 ], "loc": { "start": { "line": 10, - "column": 9 + "column": 10 }, "end": { "line": 10, - "column": 24 + "column": 26 } } }, @@ -842,11 +751,11 @@ "loc": { "start": { "line": 10, - "column": 27 + "column": 29 }, "end": { "line": 10, - "column": 31 + "column": 33 } } }, @@ -863,11 +772,11 @@ "loc": { "start": { "line": 10, - "column": 34 + "column": 36 }, "end": { "line": 10, - "column": 35 + "column": 37 } } }, @@ -881,11 +790,11 @@ "loc": { "start": { "line": 10, - "column": 36 + "column": 38 }, "end": { "line": 10, - "column": 40 + "column": 42 } } }, @@ -896,47 +805,47 @@ "loc": { "start": { "line": 10, - "column": 34 + "column": 36 }, "end": { "line": 10, - "column": 40 + "column": 42 } } }, "range": [ - 251, + 250, 282 ], "loc": { "start": { "line": 10, - "column": 9 + "column": 10 }, "end": { "line": 10, - "column": 40 + "column": 42 } } }, "range": [ - 244, - 283 + 243, + 284 ], "loc": { "start": { "line": 10, - "column": 2 + "column": 3 }, "end": { "line": 10, - "column": 41 + "column": 44 } } }, "range": [ - 166, - 283 + 160, + 284 ], "loc": { "start": { @@ -945,25 +854,43 @@ }, "end": { "line": 10, - "column": 41 + "column": 44 } }, "leadingComments": [ { "type": "Line", - "value": " No grandparent means no uncle", + "value": " assert( g !== null ) ;", + "range": [ + 107, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Line", + "value": " this can never happen", "range": [ - 132, - 164 + 134, + 158 ], "loc": { "start": { "line": 6, - "column": 15 + "column": 1 }, "end": { "line": 6, - "column": 47 + "column": 25 } } } @@ -971,13 +898,13 @@ } ], "range": [ - 71, - 285 + 75, + 286 ], "loc": { "start": { "line": 3, - "column": 24 + "column": 28 }, "end": { "line": 11, @@ -989,7 +916,7 @@ "expression": false, "range": [ 54, - 285 + 286 ], "loc": { "start": { @@ -1008,7 +935,7 @@ "source": null, "range": [ 47, - 285 + 286 ], "loc": { "start": { @@ -1025,7 +952,7 @@ "sourceType": "module", "range": [ 0, - 285 + 286 ], "loc": { "start": { @@ -1040,19 +967,37 @@ "comments": [ { "type": "Line", - "value": " No grandparent means no uncle", + "value": " assert( g !== null ) ;", + "range": [ + 107, + 132 + ], + "loc": { + "start": { + "line": 5, + "column": 1 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": "Line", + "value": " this can never happen", "range": [ - 132, - 164 + 134, + 158 ], "loc": { "start": { "line": 6, - "column": 15 + "column": 1 }, "end": { "line": 6, - "column": 47 + "column": 25 } } } diff --git a/ast/source/index.js.json b/ast/source/index.js.json index cb4827c..376234d 100644 --- a/ast/source/index.js.json +++ b/ast/source/index.js.json @@ -77,11 +77,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./insertion", - "raw": "'./insertion'", + "value": "./family", + "raw": "'./family'", "range": [ 63, - 76 + 73 ], "loc": { "start": { @@ -90,13 +90,13 @@ }, "end": { "line": 3, - "column": 27 + "column": 24 } } }, "range": [ 49, - 78 + 75 ], "loc": { "start": { @@ -105,7 +105,7 @@ }, "end": { "line": 3, - "column": 29 + "column": 26 } } }, @@ -113,11 +113,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./node", - "raw": "'./node'", + "value": "./insertion", + "raw": "'./insertion'", "range": [ - 93, - 101 + 90, + 103 ], "loc": { "start": { @@ -126,13 +126,13 @@ }, "end": { "line": 4, - "column": 22 + "column": 27 } } }, "range": [ - 79, - 103 + 76, + 105 ], "loc": { "start": { @@ -141,7 +141,7 @@ }, "end": { "line": 4, - "column": 24 + "column": 29 } } }, @@ -149,11 +149,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./removal", - "raw": "'./removal'", + "value": "./node", + "raw": "'./node'", "range": [ - 118, - 129 + 120, + 128 ], "loc": { "start": { @@ -162,13 +162,13 @@ }, "end": { "line": 5, - "column": 25 + "column": 22 } } }, "range": [ - 104, - 131 + 106, + 130 ], "loc": { "start": { @@ -177,6 +177,42 @@ }, "end": { "line": 5, + "column": 24 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./removal", + "raw": "'./removal'", + "range": [ + 145, + 156 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 25 + } + } + }, + "range": [ + 131, + 158 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, "column": 27 } } @@ -185,7 +221,7 @@ "sourceType": "module", "range": [ 0, - 131 + 158 ], "loc": { "start": { @@ -193,7 +229,7 @@ "column": 0 }, "end": { - "line": 5, + "line": 6, "column": 27 } }, diff --git a/ast/source/insertion/insert_case4.js.json b/ast/source/insertion/insert_case4.js.json index 2c43e67..17ae8d5 100644 --- a/ast/source/insertion/insert_case4.js.json +++ b/ast/source/insertion/insert_case4.js.json @@ -844,20 +844,13 @@ "column": 3 } } - } - ] - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "n", + }, + { + "type": "Line", + "value": "n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", "range": [ 500, - 501 + 576 ], "loc": { "start": { @@ -866,109 +859,7 @@ }, "end": { "line": 23, - "column": 3 - } - } - }, - "right": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 504, - 505 - ], - "loc": { - "start": { - "line": 23, - "column": 6 - }, - "end": { - "line": 23, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 506, - 510 - ], - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 12 - } - } - }, - "range": [ - 504, - 510 - ], - "loc": { - "start": { - "line": 23, - "column": 6 - }, - "end": { - "line": 23, - "column": 12 - } - } - }, - "range": [ - 500, - 510 - ], - "loc": { - "start": { - "line": 23, - "column": 2 - }, - "end": { - "line": 23, - "column": 12 - } - } - }, - "range": [ - 500, - 511 - ], - "loc": { - "start": { - "line": 23, - "column": 2 - }, - "end": { - "line": 23, - "column": 13 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": "\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n ", - "range": [ - 259, - 496 - ], - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 21, - "column": 3 + "column": 78 } } } @@ -977,7 +868,7 @@ ], "range": [ 230, - 515 + 580 ], "loc": { "start": { @@ -1002,8 +893,8 @@ "type": "Identifier", "name": "n", "range": [ - 526, - 527 + 591, + 592 ], "loc": { "start": { @@ -1026,8 +917,8 @@ "type": "Identifier", "name": "n", "range": [ - 532, - 533 + 597, + 598 ], "loc": { "start": { @@ -1044,8 +935,8 @@ "type": "Identifier", "name": "parent", "range": [ - 534, - 540 + 599, + 605 ], "loc": { "start": { @@ -1059,8 +950,8 @@ } }, "range": [ - 532, - 540 + 597, + 605 ], "loc": { "start": { @@ -1077,8 +968,8 @@ "type": "Identifier", "name": "left", "range": [ - 541, - 545 + 606, + 610 ], "loc": { "start": { @@ -1092,8 +983,8 @@ } }, "range": [ - 532, - 545 + 597, + 610 ], "loc": { "start": { @@ -1107,8 +998,8 @@ } }, "range": [ - 526, - 545 + 591, + 610 ], "loc": { "start": { @@ -1131,8 +1022,8 @@ "type": "Identifier", "name": "n", "range": [ - 551, - 552 + 616, + 617 ], "loc": { "start": { @@ -1149,8 +1040,8 @@ "type": "Identifier", "name": "parent", "range": [ - 553, - 559 + 618, + 624 ], "loc": { "start": { @@ -1164,8 +1055,8 @@ } }, "range": [ - 551, - 559 + 616, + 624 ], "loc": { "start": { @@ -1185,8 +1076,8 @@ "type": "Identifier", "name": "g", "range": [ - 564, - 565 + 629, + 630 ], "loc": { "start": { @@ -1203,8 +1094,8 @@ "type": "Identifier", "name": "right", "range": [ - 566, - 571 + 631, + 636 ], "loc": { "start": { @@ -1218,8 +1109,8 @@ } }, "range": [ - 564, - 571 + 629, + 636 ], "loc": { "start": { @@ -1233,8 +1124,8 @@ } }, "range": [ - 551, - 571 + 616, + 636 ], "loc": { "start": { @@ -1248,8 +1139,8 @@ } }, "range": [ - 525, - 572 + 590, + 637 ], "loc": { "start": { @@ -1273,8 +1164,8 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 578, - 590 + 643, + 655 ], "loc": { "start": { @@ -1295,8 +1186,8 @@ "type": "Identifier", "name": "n", "range": [ - 591, - 592 + 656, + 657 ], "loc": { "start": { @@ -1313,8 +1204,8 @@ "type": "Identifier", "name": "parent", "range": [ - 593, - 599 + 658, + 664 ], "loc": { "start": { @@ -1328,8 +1219,8 @@ } }, "range": [ - 591, - 599 + 656, + 664 ], "loc": { "start": { @@ -1344,8 +1235,8 @@ } ], "range": [ - 578, - 600 + 643, + 665 ], "loc": { "start": { @@ -1359,8 +1250,8 @@ } }, "range": [ - 578, - 601 + 643, + 666 ], "loc": { "start": { @@ -1377,8 +1268,8 @@ "type": "Block", "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", "range": [ - 604, - 815 + 669, + 880 ], "loc": { "start": { @@ -1390,131 +1281,22 @@ "column": 3 } } - } - ] - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "Identifier", - "name": "n", - "range": [ - 819, - 820 - ], - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 3 - } - } }, - "right": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 823, - 824 - ], - "loc": { - "start": { - "line": 38, - "column": 6 - }, - "end": { - "line": 38, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 825, - 830 - ], - "loc": { - "start": { - "line": 38, - "column": 8 - }, - "end": { - "line": 38, - "column": 13 - } - } - }, + { + "type": "Line", + "value": "n = n.right;", "range": [ - 823, - 830 + 884, + 898 ], "loc": { "start": { "line": 38, - "column": 6 + "column": 2 }, "end": { "line": 38, - "column": 13 - } - } - }, - "range": [ - 819, - 830 - ], - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 13 - } - } - }, - "range": [ - 819, - 831 - ], - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 14 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", - "range": [ - 604, - 815 - ], - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 36, - "column": 3 + "column": 16 } } } @@ -1522,8 +1304,8 @@ } ], "range": [ - 574, - 834 + 639, + 901 ], "loc": { "start": { @@ -1538,8 +1320,8 @@ }, "alternate": null, "range": [ - 521, - 834 + 586, + 901 ], "loc": { "start": { @@ -1550,11 +1332,49 @@ "line": 39, "column": 2 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n ", + "range": [ + 259, + 496 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "Line", + "value": "n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "range": [ + 500, + 576 + ], + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 78 + } + } + } + ] }, "range": [ 177, - 834 + 901 ], "loc": { "start": { @@ -1575,8 +1395,8 @@ "type": "Identifier", "name": "insert_case5", "range": [ - 836, - 848 + 903, + 915 ], "loc": { "start": { @@ -1594,8 +1414,8 @@ "type": "Identifier", "name": "n", "range": [ - 849, - 850 + 916, + 917 ], "loc": { "start": { @@ -1610,8 +1430,8 @@ } ], "range": [ - 836, - 851 + 903, + 918 ], "loc": { "start": { @@ -1625,8 +1445,8 @@ } }, "range": [ - 836, - 852 + 903, + 919 ], "loc": { "start": { @@ -1637,12 +1457,50 @@ "line": 40, "column": 17 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", + "range": [ + 669, + 880 + ], + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 36, + "column": 3 + } + } + }, + { + "type": "Line", + "value": "n = n.right;", + "range": [ + 884, + 898 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 16 + } + } + } + ] } ], "range": [ 146, - 854 + 921 ], "loc": { "start": { @@ -1659,7 +1517,7 @@ "expression": false, "range": [ 121, - 854 + 921 ], "loc": { "start": { @@ -1678,7 +1536,7 @@ "source": null, "range": [ 114, - 854 + 921 ], "loc": { "start": { @@ -1695,7 +1553,7 @@ "sourceType": "module", "range": [ 1, - 854 + 921 ], "loc": { "start": { @@ -1726,12 +1584,30 @@ } } }, + { + "type": "Line", + "value": "n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "range": [ + 500, + 576 + ], + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 78 + } + } + }, { "type": "Block", "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", "range": [ - 604, - 815 + 669, + 880 ], "loc": { "start": { @@ -1743,6 +1619,24 @@ "column": 3 } } + }, + { + "type": "Line", + "value": "n = n.right;", + "range": [ + 884, + 898 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 16 + } + } } ] } \ No newline at end of file diff --git a/ast/source/removal/delete_case1.js.json b/ast/source/removal/delete_case1.js.json index 48afdb5..390ad08 100644 --- a/ast/source/removal/delete_case1.js.json +++ b/ast/source/removal/delete_case1.js.json @@ -92,6 +92,79 @@ } } }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "local": { + "type": "Identifier", + "name": "assert", + "range": [ + 57, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + }, + "range": [ + 57, + 63 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 13 + } + } + } + ], + "source": { + "type": "Literal", + "value": "assert", + "raw": "'assert'", + "range": [ + 69, + 77 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "range": [ + 50, + 79 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 29 + } + } + }, { "type": "ExportNamedDeclaration", "declaration": { @@ -100,16 +173,16 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 66, - 78 + 97, + 109 ], "loc": { "start": { - "line": 4, + "line": 6, "column": 16 }, "end": { - "line": 4, + "line": 6, "column": 28 } } @@ -119,16 +192,16 @@ "type": "Identifier", "name": "n", "range": [ - 79, - 80 + 110, + 111 ], "loc": { "start": { - "line": 4, + "line": 6, "column": 29 }, "end": { - "line": 4, + "line": 6, "column": 30 } } @@ -149,16 +222,16 @@ "type": "Identifier", "name": "n", "range": [ - 89, - 90 + 120, + 121 ], "loc": { "start": { - "line": 6, + "line": 8, "column": 5 }, "end": { - "line": 6, + "line": 8, "column": 6 } } @@ -167,31 +240,31 @@ "type": "Identifier", "name": "parent", "range": [ - 91, - 97 + 122, + 128 ], "loc": { "start": { - "line": 6, + "line": 8, "column": 7 }, "end": { - "line": 6, + "line": 8, "column": 13 } } }, "range": [ - 89, - 97 + 120, + 128 ], "loc": { "start": { - "line": 6, + "line": 8, "column": 5 }, "end": { - "line": 6, + "line": 8, "column": 13 } } @@ -201,31 +274,31 @@ "value": null, "raw": "null", "range": [ - 102, - 106 + 133, + 137 ], "loc": { "start": { - "line": 6, + "line": 8, "column": 18 }, "end": { - "line": 6, + "line": 8, "column": 22 } } }, "range": [ - 89, - 106 + 120, + 137 ], "loc": { "start": { - "line": 6, + "line": 8, "column": 5 }, "end": { - "line": 6, + "line": 8, "column": 22 } } @@ -238,16 +311,16 @@ "type": "Identifier", "name": "delete_case2", "range": [ - 110, - 122 + 141, + 153 ], "loc": { "start": { - "line": 7, + "line": 9, "column": 2 }, "end": { - "line": 7, + "line": 9, "column": 14 } } @@ -257,79 +330,79 @@ "type": "Identifier", "name": "n", "range": [ - 123, - 124 + 154, + 155 ], "loc": { "start": { - "line": 7, + "line": 9, "column": 15 }, "end": { - "line": 7, + "line": 9, "column": 16 } } } ], "range": [ - 110, - 125 + 141, + 156 ], "loc": { "start": { - "line": 7, + "line": 9, "column": 2 }, "end": { - "line": 7, + "line": 9, "column": 17 } } }, "range": [ - 110, - 126 + 141, + 157 ], "loc": { "start": { - "line": 7, + "line": 9, "column": 2 }, "end": { - "line": 7, + "line": 9, "column": 18 } } }, "alternate": null, "range": [ - 85, - 126 + 116, + 157 ], "loc": { "start": { - "line": 6, + "line": 8, "column": 1 }, "end": { - "line": 7, + "line": 9, "column": 18 } } } ], "range": [ - 82, - 128 + 113, + 159 ], "loc": { "start": { - "line": 5, + "line": 7, "column": 0 }, "end": { - "line": 8, + "line": 10, "column": 1 } } @@ -337,16 +410,16 @@ "generator": false, "expression": false, "range": [ - 57, - 128 + 88, + 159 ], "loc": { "start": { - "line": 4, + "line": 6, "column": 7 }, "end": { - "line": 8, + "line": 10, "column": 1 } }, @@ -356,16 +429,16 @@ "specifiers": [], "source": null, "range": [ - 50, - 128 + 81, + 159 ], "loc": { "start": { - "line": 4, + "line": 6, "column": 0 }, "end": { - "line": 8, + "line": 10, "column": 1 } } @@ -374,7 +447,7 @@ "sourceType": "module", "range": [ 1, - 128 + 159 ], "loc": { "start": { @@ -382,7 +455,7 @@ "column": 0 }, "end": { - "line": 8, + "line": 10, "column": 1 } }, diff --git a/ast/source/removal/delete_case2.js.json b/ast/source/removal/delete_case2.js.json index d205034..e241e54 100644 --- a/ast/source/removal/delete_case2.js.json +++ b/ast/source/removal/delete_case2.js.json @@ -114,10 +114,10 @@ "type": "ImportSpecifier", "local": { "type": "Identifier", - "name": "rotate_left", + "name": "sibling", "range": [ 23, - 34 + 30 ], "loc": { "start": { @@ -126,16 +126,16 @@ }, "end": { "line": 1, - "column": 34 + "column": 30 } } }, "imported": { "type": "Identifier", - "name": "rotate_left", + "name": "sibling", "range": [ 23, - 34 + 30 ], "loc": { "start": { @@ -144,13 +144,13 @@ }, "end": { "line": 1, - "column": 34 + "column": 30 } } }, "range": [ 23, - 34 + 30 ], "loc": { "start": { @@ -159,7 +159,60 @@ }, "end": { "line": 1, - "column": 34 + "column": 30 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 33, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 33, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 + } + } + }, + "range": [ + 33, + 44 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 44 } } }, @@ -169,17 +222,17 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 37, - 49 + 47, + 59 ], "loc": { "start": { "line": 1, - "column": 37 + "column": 47 }, "end": { "line": 1, - "column": 49 + "column": 59 } } }, @@ -187,32 +240,32 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 37, - 49 + 47, + 59 ], "loc": { "start": { "line": 1, - "column": 37 + "column": 47 }, "end": { "line": 1, - "column": 49 + "column": 59 } } }, "range": [ - 37, - 49 + 47, + 59 ], "loc": { "start": { "line": 1, - "column": 37 + "column": 47 }, "end": { "line": 1, - "column": 49 + "column": 59 } } } @@ -222,23 +275,23 @@ "value": "..", "raw": "'..'", "range": [ - 57, - 61 + 67, + 71 ], "loc": { "start": { "line": 1, - "column": 57 + "column": 67 }, "end": { "line": 1, - "column": 61 + "column": 71 } } }, "range": [ 0, - 63 + 73 ], "loc": { "start": { @@ -247,7 +300,7 @@ }, "end": { "line": 1, - "column": 63 + "column": 73 } } }, @@ -260,8 +313,8 @@ "type": "Identifier", "name": "delete_case3", "range": [ - 74, - 86 + 84, + 96 ], "loc": { "start": { @@ -278,8 +331,8 @@ "type": "Identifier", "name": "delete_case3", "range": [ - 74, - 86 + 84, + 96 ], "loc": { "start": { @@ -293,8 +346,8 @@ } }, "range": [ - 74, - 86 + 84, + 96 ], "loc": { "start": { @@ -313,8 +366,8 @@ "value": "./delete_case3", "raw": "'./delete_case3'", "range": [ - 94, - 110 + 104, + 120 ], "loc": { "start": { @@ -328,8 +381,8 @@ } }, "range": [ - 65, - 112 + 75, + 122 ], "loc": { "start": { @@ -350,8 +403,8 @@ "type": "Identifier", "name": "delete_case2", "range": [ - 130, - 142 + 140, + 152 ], "loc": { "start": { @@ -369,8 +422,8 @@ "type": "Identifier", "name": "n", "range": [ - 143, - 144 + 153, + 154 ], "loc": { "start": { @@ -396,8 +449,8 @@ "type": "Identifier", "name": "s", "range": [ - 155, - 156 + 165, + 166 ], "loc": { "start": { @@ -416,8 +469,8 @@ "type": "Identifier", "name": "sibling", "range": [ - 159, - 166 + 169, + 176 ], "loc": { "start": { @@ -435,8 +488,8 @@ "type": "Identifier", "name": "n", "range": [ - 167, - 168 + 177, + 178 ], "loc": { "start": { @@ -451,8 +504,8 @@ } ], "range": [ - 159, - 169 + 169, + 179 ], "loc": { "start": { @@ -466,8 +519,8 @@ } }, "range": [ - 155, - 169 + 165, + 179 ], "loc": { "start": { @@ -483,8 +536,8 @@ ], "kind": "const", "range": [ - 149, - 170 + 159, + 180 ], "loc": { "start": { @@ -509,8 +562,8 @@ "type": "Identifier", "name": "s", "range": [ - 177, - 178 + 187, + 188 ], "loc": { "start": { @@ -527,8 +580,8 @@ "type": "Identifier", "name": "color", "range": [ - 179, - 184 + 189, + 194 ], "loc": { "start": { @@ -542,8 +595,8 @@ } }, "range": [ - 177, - 184 + 187, + 194 ], "loc": { "start": { @@ -560,8 +613,8 @@ "type": "Identifier", "name": "RED", "range": [ - 189, - 192 + 199, + 202 ], "loc": { "start": { @@ -575,8 +628,8 @@ } }, "range": [ - 177, - 192 + 187, + 202 ], "loc": { "start": { @@ -607,8 +660,8 @@ "type": "Identifier", "name": "n", "range": [ - 198, - 199 + 208, + 209 ], "loc": { "start": { @@ -625,8 +678,8 @@ "type": "Identifier", "name": "parent", "range": [ - 200, - 206 + 210, + 216 ], "loc": { "start": { @@ -640,8 +693,8 @@ } }, "range": [ - 198, - 206 + 208, + 216 ], "loc": { "start": { @@ -658,8 +711,8 @@ "type": "Identifier", "name": "color", "range": [ - 207, - 212 + 217, + 222 ], "loc": { "start": { @@ -673,8 +726,8 @@ } }, "range": [ - 198, - 212 + 208, + 222 ], "loc": { "start": { @@ -691,8 +744,8 @@ "type": "Identifier", "name": "RED", "range": [ - 215, - 218 + 225, + 228 ], "loc": { "start": { @@ -706,8 +759,8 @@ } }, "range": [ - 198, - 218 + 208, + 228 ], "loc": { "start": { @@ -721,8 +774,8 @@ } }, "range": [ - 198, - 219 + 208, + 229 ], "loc": { "start": { @@ -747,8 +800,8 @@ "type": "Identifier", "name": "s", "range": [ - 222, - 223 + 232, + 233 ], "loc": { "start": { @@ -765,8 +818,8 @@ "type": "Identifier", "name": "color", "range": [ - 224, - 229 + 234, + 239 ], "loc": { "start": { @@ -780,8 +833,8 @@ } }, "range": [ - 222, - 229 + 232, + 239 ], "loc": { "start": { @@ -798,8 +851,8 @@ "type": "Identifier", "name": "BLACK", "range": [ - 232, - 237 + 242, + 247 ], "loc": { "start": { @@ -813,8 +866,8 @@ } }, "range": [ - 222, - 237 + 232, + 247 ], "loc": { "start": { @@ -828,8 +881,8 @@ } }, "range": [ - 222, - 238 + 232, + 248 ], "loc": { "start": { @@ -851,8 +904,8 @@ "type": "Identifier", "name": "n", "range": [ - 245, - 246 + 255, + 256 ], "loc": { "start": { @@ -875,8 +928,8 @@ "type": "Identifier", "name": "n", "range": [ - 251, - 252 + 261, + 262 ], "loc": { "start": { @@ -893,8 +946,8 @@ "type": "Identifier", "name": "parent", "range": [ - 253, - 259 + 263, + 269 ], "loc": { "start": { @@ -908,8 +961,8 @@ } }, "range": [ - 251, - 259 + 261, + 269 ], "loc": { "start": { @@ -926,8 +979,8 @@ "type": "Identifier", "name": "left", "range": [ - 260, - 264 + 270, + 274 ], "loc": { "start": { @@ -941,8 +994,8 @@ } }, "range": [ - 251, - 264 + 261, + 274 ], "loc": { "start": { @@ -956,8 +1009,8 @@ } }, "range": [ - 245, - 264 + 255, + 274 ], "loc": { "start": { @@ -978,8 +1031,8 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 269, - 280 + 279, + 290 ], "loc": { "start": { @@ -1000,8 +1053,8 @@ "type": "Identifier", "name": "n", "range": [ - 281, - 282 + 291, + 292 ], "loc": { "start": { @@ -1018,8 +1071,8 @@ "type": "Identifier", "name": "parent", "range": [ - 283, - 289 + 293, + 299 ], "loc": { "start": { @@ -1033,8 +1086,8 @@ } }, "range": [ - 281, - 289 + 291, + 299 ], "loc": { "start": { @@ -1049,8 +1102,8 @@ } ], "range": [ - 269, - 290 + 279, + 300 ], "loc": { "start": { @@ -1064,8 +1117,8 @@ } }, "range": [ - 269, - 291 + 279, + 301 ], "loc": { "start": { @@ -1086,8 +1139,8 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 302, - 314 + 312, + 324 ], "loc": { "start": { @@ -1108,8 +1161,8 @@ "type": "Identifier", "name": "n", "range": [ - 315, - 316 + 325, + 326 ], "loc": { "start": { @@ -1126,8 +1179,8 @@ "type": "Identifier", "name": "parent", "range": [ - 317, - 323 + 327, + 333 ], "loc": { "start": { @@ -1141,8 +1194,8 @@ } }, "range": [ - 315, - 323 + 325, + 333 ], "loc": { "start": { @@ -1157,8 +1210,8 @@ } ], "range": [ - 302, - 324 + 312, + 334 ], "loc": { "start": { @@ -1172,8 +1225,8 @@ } }, "range": [ - 302, - 325 + 312, + 335 ], "loc": { "start": { @@ -1187,8 +1240,8 @@ } }, "range": [ - 241, - 325 + 251, + 335 ], "loc": { "start": { @@ -1203,8 +1256,8 @@ } ], "range": [ - 194, - 328 + 204, + 338 ], "loc": { "start": { @@ -1219,8 +1272,8 @@ }, "alternate": null, "range": [ - 173, - 328 + 183, + 338 ], "loc": { "start": { @@ -1241,8 +1294,8 @@ "type": "Identifier", "name": "delete_case3", "range": [ - 330, - 342 + 340, + 352 ], "loc": { "start": { @@ -1260,8 +1313,8 @@ "type": "Identifier", "name": "n", "range": [ - 343, - 344 + 353, + 354 ], "loc": { "start": { @@ -1276,8 +1329,8 @@ } ], "range": [ - 330, - 345 + 340, + 355 ], "loc": { "start": { @@ -1291,8 +1344,8 @@ } }, "range": [ - 330, - 346 + 340, + 356 ], "loc": { "start": { @@ -1307,8 +1360,8 @@ } ], "range": [ - 146, - 348 + 156, + 358 ], "loc": { "start": { @@ -1324,8 +1377,8 @@ "generator": false, "expression": false, "range": [ - 121, - 348 + 131, + 358 ], "loc": { "start": { @@ -1343,8 +1396,8 @@ "specifiers": [], "source": null, "range": [ - 114, - 348 + 124, + 358 ], "loc": { "start": { @@ -1361,7 +1414,7 @@ "sourceType": "module", "range": [ 0, - 348 + 358 ], "loc": { "start": { diff --git a/ast/source/removal/delete_case3.js.json b/ast/source/removal/delete_case3.js.json index ee32d66..b591880 100644 --- a/ast/source/removal/delete_case3.js.json +++ b/ast/source/removal/delete_case3.js.json @@ -533,7 +533,27 @@ "line": 9, "column": 22 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", + "range": [ + 202, + 263 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 62 + } + } + } + ] }, { "type": "IfStatement", @@ -559,16 +579,16 @@ "type": "Identifier", "name": "n", "range": [ - 208, - 209 + 271, + 272 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 6 }, "end": { - "line": 11, + "line": 12, "column": 7 } } @@ -577,31 +597,31 @@ "type": "Identifier", "name": "parent", "range": [ - 210, - 216 + 273, + 279 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 8 }, "end": { - "line": 11, + "line": 12, "column": 14 } } }, "range": [ - 208, - 216 + 271, + 279 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 6 }, "end": { - "line": 11, + "line": 12, "column": 14 } } @@ -610,31 +630,31 @@ "type": "Identifier", "name": "color", "range": [ - 217, - 222 + 280, + 285 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 15 }, "end": { - "line": 11, + "line": 12, "column": 20 } } }, "range": [ - 208, - 222 + 271, + 285 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 6 }, "end": { - "line": 11, + "line": 12, "column": 20 } } @@ -643,31 +663,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 227, - 232 + 290, + 295 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 25 }, "end": { - "line": 11, + "line": 12, "column": 30 } } }, "range": [ - 208, - 232 + 271, + 295 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 6 }, "end": { - "line": 11, + "line": 12, "column": 30 } } @@ -682,16 +702,16 @@ "type": "Identifier", "name": "s", "range": [ - 243, - 244 + 306, + 307 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 6 }, "end": { - "line": 12, + "line": 13, "column": 7 } } @@ -700,31 +720,31 @@ "type": "Identifier", "name": "color", "range": [ - 245, - 250 + 308, + 313 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 8 }, "end": { - "line": 12, + "line": 13, "column": 13 } } }, "range": [ - 243, - 250 + 306, + 313 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 6 }, "end": { - "line": 12, + "line": 13, "column": 13 } } @@ -733,46 +753,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 255, - 260 + 318, + 323 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 18 }, "end": { - "line": 12, + "line": 13, "column": 23 } } }, "range": [ - 243, - 260 + 306, + 323 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 6 }, "end": { - "line": 12, + "line": 13, "column": 23 } } }, "range": [ - 207, - 261 + 270, + 324 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 5 }, "end": { - "line": 12, + "line": 13, "column": 24 } } @@ -790,16 +810,16 @@ "type": "Identifier", "name": "s", "range": [ - 271, - 272 + 334, + 335 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 6 }, "end": { - "line": 13, + "line": 14, "column": 7 } } @@ -808,31 +828,31 @@ "type": "Identifier", "name": "left", "range": [ - 273, - 277 + 336, + 340 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 8 }, "end": { - "line": 13, + "line": 14, "column": 12 } } }, "range": [ - 271, - 277 + 334, + 340 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 6 }, "end": { - "line": 13, + "line": 14, "column": 12 } } @@ -841,31 +861,31 @@ "type": "Identifier", "name": "color", "range": [ - 278, - 283 + 341, + 346 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 13 }, "end": { - "line": 13, + "line": 14, "column": 18 } } }, "range": [ - 271, - 283 + 334, + 346 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 6 }, "end": { - "line": 13, + "line": 14, "column": 18 } } @@ -874,46 +894,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 288, - 293 + 351, + 356 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 23 }, "end": { - "line": 13, + "line": 14, "column": 28 } } }, "range": [ - 271, - 293 + 334, + 356 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 6 }, "end": { - "line": 13, + "line": 14, "column": 28 } } }, "range": [ - 207, - 294 + 270, + 357 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 5 }, "end": { - "line": 13, + "line": 14, "column": 29 } } @@ -931,16 +951,16 @@ "type": "Identifier", "name": "s", "range": [ - 304, - 305 + 367, + 368 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 7 } } @@ -949,31 +969,31 @@ "type": "Identifier", "name": "right", "range": [ - 306, - 311 + 369, + 374 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 8 }, "end": { - "line": 14, + "line": 15, "column": 13 } } }, "range": [ - 304, - 311 + 367, + 374 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 13 } } @@ -982,31 +1002,31 @@ "type": "Identifier", "name": "color", "range": [ - 312, - 317 + 375, + 380 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 14 }, "end": { - "line": 14, + "line": 15, "column": 19 } } }, "range": [ - 304, - 317 + 367, + 380 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 19 } } @@ -1015,46 +1035,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 322, - 327 + 385, + 390 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 24 }, "end": { - "line": 14, + "line": 15, "column": 29 } } }, "range": [ - 304, - 327 + 367, + 390 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 29 } } }, "range": [ - 207, - 328 + 270, + 391 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 5 }, "end": { - "line": 14, + "line": 15, "column": 30 } } @@ -1074,16 +1094,16 @@ "type": "Identifier", "name": "s", "range": [ - 334, - 335 + 397, + 398 ], "loc": { "start": { - "line": 15, + "line": 16, "column": 2 }, "end": { - "line": 15, + "line": 16, "column": 3 } } @@ -1092,31 +1112,31 @@ "type": "Identifier", "name": "color", "range": [ - 336, - 341 + 399, + 404 ], "loc": { "start": { - "line": 15, + "line": 16, "column": 4 }, "end": { - "line": 15, + "line": 16, "column": 9 } } }, "range": [ - 334, - 341 + 397, + 404 ], "loc": { "start": { - "line": 15, + "line": 16, "column": 2 }, "end": { - "line": 15, + "line": 16, "column": 9 } } @@ -1125,46 +1145,46 @@ "type": "Identifier", "name": "RED", "range": [ - 344, - 347 + 407, + 410 ], "loc": { "start": { - "line": 15, + "line": 16, "column": 12 }, "end": { - "line": 15, + "line": 16, "column": 15 } } }, "range": [ - 334, - 347 + 397, + 410 ], "loc": { "start": { - "line": 15, + "line": 16, "column": 2 }, "end": { - "line": 15, + "line": 16, "column": 15 } } }, "range": [ - 334, - 348 + 397, + 411 ], "loc": { "start": { - "line": 15, + "line": 16, "column": 2 }, "end": { - "line": 15, + "line": 16, "column": 16 } } @@ -1177,16 +1197,16 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 351, - 363 + 414, + 426 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 2 }, "end": { - "line": 16, + "line": 17, "column": 14 } } @@ -1199,16 +1219,16 @@ "type": "Identifier", "name": "n", "range": [ - 364, - 365 + 427, + 428 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 15 }, "end": { - "line": 16, + "line": 17, "column": 16 } } @@ -1217,78 +1237,78 @@ "type": "Identifier", "name": "parent", "range": [ - 366, - 372 + 429, + 435 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 17 }, "end": { - "line": 16, + "line": 17, "column": 23 } } }, "range": [ - 364, - 372 + 427, + 435 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 15 }, "end": { - "line": 16, + "line": 17, "column": 23 } } } ], "range": [ - 351, - 373 + 414, + 436 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 2 }, "end": { - "line": 16, + "line": 17, "column": 24 } } }, "range": [ - 351, - 374 + 414, + 437 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 2 }, "end": { - "line": 16, + "line": 17, "column": 25 } } } ], "range": [ - 330, - 377 + 393, + 440 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 32 }, "end": { - "line": 17, + "line": 18, "column": 2 } } @@ -1301,16 +1321,16 @@ "type": "Identifier", "name": "delete_case4", "range": [ - 385, - 397 + 450, + 462 ], "loc": { "start": { - "line": 18, + "line": 21, "column": 2 }, "end": { - "line": 18, + "line": 21, "column": 14 } } @@ -1320,70 +1340,90 @@ "type": "Identifier", "name": "n", "range": [ - 398, - 399 + 463, + 464 ], "loc": { "start": { - "line": 18, + "line": 21, "column": 15 }, "end": { - "line": 18, + "line": 21, "column": 16 } } } ], "range": [ - 385, - 400 + 450, + 465 ], "loc": { "start": { - "line": 18, + "line": 21, "column": 2 }, "end": { - "line": 18, + "line": 21, "column": 17 } } }, "range": [ - 385, - 401 + 450, + 466 ], "loc": { "start": { - "line": 18, + "line": 21, "column": 2 }, "end": { - "line": 18, + "line": 21, "column": 18 } } }, "range": [ - 203, - 401 + 266, + 466 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 1 }, "end": { - "line": 18, + "line": 21, "column": 18 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", + "range": [ + 202, + 263 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 62 + } + } + } + ] } ], "range": [ 176, - 403 + 468 ], "loc": { "start": { @@ -1391,7 +1431,7 @@ "column": 0 }, "end": { - "line": 19, + "line": 22, "column": 1 } } @@ -1400,7 +1440,7 @@ "expression": false, "range": [ 151, - 403 + 468 ], "loc": { "start": { @@ -1408,7 +1448,7 @@ "column": 7 }, "end": { - "line": 19, + "line": 22, "column": 1 } }, @@ -1419,7 +1459,7 @@ "source": null, "range": [ 144, - 403 + 468 ], "loc": { "start": { @@ -1427,7 +1467,7 @@ "column": 0 }, "end": { - "line": 19, + "line": 22, "column": 1 } } @@ -1436,7 +1476,7 @@ "sourceType": "module", "range": [ 1, - 403 + 468 ], "loc": { "start": { @@ -1444,9 +1484,28 @@ "column": 0 }, "end": { - "line": 19, + "line": 22, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Line", + "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", + "range": [ + 202, + 263 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 62 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/removal/delete_case4.js.json b/ast/source/removal/delete_case4.js.json index a3767d2..f153fc1 100644 --- a/ast/source/removal/delete_case4.js.json +++ b/ast/source/removal/delete_case4.js.json @@ -442,7 +442,27 @@ "line": 7, "column": 22 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": "console.log( s ) ;", + "range": [ + 153, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 21 + } + } + } + ] }, { "type": "IfStatement", @@ -468,16 +488,16 @@ "type": "Identifier", "name": "n", "range": [ - 159, - 160 + 181, + 182 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 6 }, "end": { - "line": 9, + "line": 10, "column": 7 } } @@ -486,31 +506,31 @@ "type": "Identifier", "name": "parent", "range": [ - 161, - 167 + 183, + 189 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 8 }, "end": { - "line": 9, + "line": 10, "column": 14 } } }, "range": [ - 159, - 167 + 181, + 189 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 6 }, "end": { - "line": 9, + "line": 10, "column": 14 } } @@ -519,31 +539,31 @@ "type": "Identifier", "name": "color", "range": [ - 168, - 173 + 190, + 195 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 15 }, "end": { - "line": 9, + "line": 10, "column": 20 } } }, "range": [ - 159, - 173 + 181, + 195 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 6 }, "end": { - "line": 9, + "line": 10, "column": 20 } } @@ -552,31 +572,31 @@ "type": "Identifier", "name": "RED", "range": [ - 178, - 181 + 200, + 203 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 25 }, "end": { - "line": 9, + "line": 10, "column": 28 } } }, "range": [ - 159, - 181 + 181, + 203 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 6 }, "end": { - "line": 9, + "line": 10, "column": 28 } } @@ -591,16 +611,16 @@ "type": "Identifier", "name": "s", "range": [ - 192, - 193 + 214, + 215 ], "loc": { "start": { - "line": 10, + "line": 11, "column": 6 }, "end": { - "line": 10, + "line": 11, "column": 7 } } @@ -609,31 +629,31 @@ "type": "Identifier", "name": "color", "range": [ - 194, - 199 + 216, + 221 ], "loc": { "start": { - "line": 10, + "line": 11, "column": 8 }, "end": { - "line": 10, + "line": 11, "column": 13 } } }, "range": [ - 192, - 199 + 214, + 221 ], "loc": { "start": { - "line": 10, + "line": 11, "column": 6 }, "end": { - "line": 10, + "line": 11, "column": 13 } } @@ -642,46 +662,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 204, - 209 + 226, + 231 ], "loc": { "start": { - "line": 10, + "line": 11, "column": 18 }, "end": { - "line": 10, + "line": 11, "column": 23 } } }, "range": [ - 192, - 209 + 214, + 231 ], "loc": { "start": { - "line": 10, + "line": 11, "column": 6 }, "end": { - "line": 10, + "line": 11, "column": 23 } } }, "range": [ - 158, - 210 + 180, + 232 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 5 }, "end": { - "line": 10, + "line": 11, "column": 24 } } @@ -699,16 +719,16 @@ "type": "Identifier", "name": "s", "range": [ - 220, - 221 + 242, + 243 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 6 }, "end": { - "line": 11, + "line": 12, "column": 7 } } @@ -717,31 +737,31 @@ "type": "Identifier", "name": "left", "range": [ - 222, - 226 + 244, + 248 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 8 }, "end": { - "line": 11, + "line": 12, "column": 12 } } }, "range": [ - 220, - 226 + 242, + 248 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 6 }, "end": { - "line": 11, + "line": 12, "column": 12 } } @@ -750,31 +770,31 @@ "type": "Identifier", "name": "color", "range": [ - 227, - 232 + 249, + 254 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 13 }, "end": { - "line": 11, + "line": 12, "column": 18 } } }, "range": [ - 220, - 232 + 242, + 254 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 6 }, "end": { - "line": 11, + "line": 12, "column": 18 } } @@ -783,46 +803,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 237, - 242 + 259, + 264 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 23 }, "end": { - "line": 11, + "line": 12, "column": 28 } } }, "range": [ - 220, - 242 + 242, + 264 ], "loc": { "start": { - "line": 11, + "line": 12, "column": 6 }, "end": { - "line": 11, + "line": 12, "column": 28 } } }, "range": [ - 158, - 243 + 180, + 265 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 5 }, "end": { - "line": 11, + "line": 12, "column": 29 } } @@ -840,16 +860,16 @@ "type": "Identifier", "name": "s", "range": [ - 253, - 254 + 275, + 276 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 6 }, "end": { - "line": 12, + "line": 13, "column": 7 } } @@ -858,31 +878,31 @@ "type": "Identifier", "name": "right", "range": [ - 255, - 260 + 277, + 282 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 8 }, "end": { - "line": 12, + "line": 13, "column": 13 } } }, "range": [ - 253, - 260 + 275, + 282 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 6 }, "end": { - "line": 12, + "line": 13, "column": 13 } } @@ -891,31 +911,31 @@ "type": "Identifier", "name": "color", "range": [ - 261, - 266 + 283, + 288 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 14 }, "end": { - "line": 12, + "line": 13, "column": 19 } } }, "range": [ - 253, - 266 + 275, + 288 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 6 }, "end": { - "line": 12, + "line": 13, "column": 19 } } @@ -924,46 +944,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 271, - 276 + 293, + 298 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 24 }, "end": { - "line": 12, + "line": 13, "column": 29 } } }, "range": [ - 253, - 276 + 275, + 298 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 6 }, "end": { - "line": 12, + "line": 13, "column": 29 } } }, "range": [ - 158, - 277 + 180, + 299 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 5 }, "end": { - "line": 12, + "line": 13, "column": 30 } } @@ -983,16 +1003,16 @@ "type": "Identifier", "name": "s", "range": [ - 283, - 284 + 305, + 306 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 2 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -1001,31 +1021,31 @@ "type": "Identifier", "name": "color", "range": [ - 285, - 290 + 307, + 312 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 4 }, "end": { - "line": 13, + "line": 14, "column": 9 } } }, "range": [ - 283, - 290 + 305, + 312 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 2 }, "end": { - "line": 13, + "line": 14, "column": 9 } } @@ -1034,46 +1054,46 @@ "type": "Identifier", "name": "RED", "range": [ - 293, - 296 + 315, + 318 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 12 }, "end": { - "line": 13, + "line": 14, "column": 15 } } }, "range": [ - 283, - 296 + 305, + 318 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 2 }, "end": { - "line": 13, + "line": 14, "column": 15 } } }, "range": [ - 283, - 297 + 305, + 319 ], "loc": { "start": { - "line": 13, + "line": 14, "column": 2 }, "end": { - "line": 13, + "line": 14, "column": 16 } } @@ -1093,16 +1113,16 @@ "type": "Identifier", "name": "n", "range": [ - 300, - 301 + 322, + 323 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 2 }, "end": { - "line": 14, + "line": 15, "column": 3 } } @@ -1111,31 +1131,31 @@ "type": "Identifier", "name": "parent", "range": [ - 302, - 308 + 324, + 330 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 4 }, "end": { - "line": 14, + "line": 15, "column": 10 } } }, "range": [ - 300, - 308 + 322, + 330 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 2 }, "end": { - "line": 14, + "line": 15, "column": 10 } } @@ -1144,31 +1164,31 @@ "type": "Identifier", "name": "color", "range": [ - 309, - 314 + 331, + 336 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 11 }, "end": { - "line": 14, + "line": 15, "column": 16 } } }, "range": [ - 300, - 314 + 322, + 336 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 2 }, "end": { - "line": 14, + "line": 15, "column": 16 } } @@ -1177,62 +1197,62 @@ "type": "Identifier", "name": "BLACK", "range": [ - 317, - 322 + 339, + 344 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 19 }, "end": { - "line": 14, + "line": 15, "column": 24 } } }, "range": [ - 300, - 322 + 322, + 344 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 2 }, "end": { - "line": 14, + "line": 15, "column": 24 } } }, "range": [ - 300, - 323 + 322, + 345 ], "loc": { "start": { - "line": 14, + "line": 15, "column": 2 }, "end": { - "line": 14, + "line": 15, "column": 25 } } } ], "range": [ - 279, - 326 + 301, + 348 ], "loc": { "start": { - "line": 12, + "line": 13, "column": 32 }, "end": { - "line": 15, + "line": 16, "column": 2 } } @@ -1245,16 +1265,16 @@ "type": "Identifier", "name": "delete_case5", "range": [ - 334, - 346 + 356, + 368 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 2 }, "end": { - "line": 16, + "line": 17, "column": 14 } } @@ -1264,70 +1284,90 @@ "type": "Identifier", "name": "n", "range": [ - 347, - 348 + 369, + 370 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 15 }, "end": { - "line": 16, + "line": 17, "column": 16 } } } ], "range": [ - 334, - 349 + 356, + 371 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 2 }, "end": { - "line": 16, + "line": 17, "column": 17 } } }, "range": [ - 334, - 350 + 356, + 372 ], "loc": { "start": { - "line": 16, + "line": 17, "column": 2 }, "end": { - "line": 16, + "line": 17, "column": 18 } } }, "range": [ - 154, - 350 + 176, + 372 ], "loc": { "start": { - "line": 9, + "line": 10, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 18 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": "console.log( s ) ;", + "range": [ + 153, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 21 + } + } + } + ] } ], "range": [ 127, - 352 + 374 ], "loc": { "start": { @@ -1335,7 +1375,7 @@ "column": 0 }, "end": { - "line": 17, + "line": 18, "column": 1 } } @@ -1344,7 +1384,7 @@ "expression": false, "range": [ 102, - 352 + 374 ], "loc": { "start": { @@ -1352,7 +1392,7 @@ "column": 7 }, "end": { - "line": 17, + "line": 18, "column": 1 } }, @@ -1363,7 +1403,7 @@ "source": null, "range": [ 95, - 352 + 374 ], "loc": { "start": { @@ -1371,7 +1411,7 @@ "column": 0 }, "end": { - "line": 17, + "line": 18, "column": 1 } } @@ -1380,7 +1420,7 @@ "sourceType": "module", "range": [ 0, - 352 + 374 ], "loc": { "start": { @@ -1388,9 +1428,28 @@ "column": 0 }, "end": { - "line": 17, + "line": 18, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Line", + "value": "console.log( s ) ;", + "range": [ + 153, + 173 + ], + "loc": { + "start": { + "line": 8, + "column": 1 + }, + "end": { + "line": 8, + "column": 21 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/removal/delete_one_child.js.json b/ast/source/removal/delete_one_child.js.json index 7b6b56a..589d32f 100644 --- a/ast/source/removal/delete_one_child.js.json +++ b/ast/source/removal/delete_one_child.js.json @@ -316,17 +316,17 @@ "type": "Identifier", "name": "n", "range": [ - 134, - 135 + 136, + 137 ], "loc": { "start": { "line": 6, - "column": 33 + "column": 35 }, "end": { "line": 6, - "column": 34 + "column": 36 } } } @@ -343,300 +343,193 @@ "type": "Identifier", "name": "child", "range": [ - 207, - 212 + 472, + 477 ], "loc": { "start": { - "line": 11, - "column": 7 + "line": 14, + "column": 10 }, "end": { - "line": 11, - "column": 12 + "line": 14, + "column": 15 } } }, "init": { - "type": "ConditionalExpression", - "test": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 215, - 216 - ], - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 16 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 217, - 222 - ], - "loc": { - "start": { - "line": 11, - "column": 17 - }, - "end": { - "line": 11, - "column": 22 - } - } - }, - "range": [ - 215, - 222 - ], - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 22 - } - } - }, - "property": { - "type": "Identifier", - "name": "isleaf", - "range": [ - 223, - 229 - ], - "loc": { - "start": { - "line": 11, - "column": 23 - }, - "end": { - "line": 11, - "column": 29 - } - } - }, - "range": [ - 215, - 229 - ], - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 29 - } - } - }, - "arguments": [], + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", "range": [ - 215, - 231 + 480, + 481 ], "loc": { "start": { - "line": 11, - "column": 15 + "line": 14, + "column": 18 }, "end": { - "line": 11, - "column": 31 + "line": 14, + "column": 19 } } }, - "consequent": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 234, - 235 - ], - "loc": { - "start": { - "line": 11, - "column": 34 - }, - "end": { - "line": 11, - "column": 35 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 236, - 240 - ], - "loc": { - "start": { - "line": 11, - "column": 36 - }, - "end": { - "line": 11, - "column": 40 - } - } - }, + "property": { + "type": "Identifier", + "name": "left", "range": [ - 234, - 240 + 482, + 486 ], "loc": { "start": { - "line": 11, - "column": 34 + "line": 14, + "column": 20 }, "end": { - "line": 11, - "column": 40 - } - } - }, - "alternate": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 243, - 244 - ], - "loc": { - "start": { - "line": 11, - "column": 43 - }, - "end": { - "line": 11, - "column": 44 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 245, - 250 - ], - "loc": { - "start": { - "line": 11, - "column": 45 - }, - "end": { - "line": 11, - "column": 50 - } - } - }, - "range": [ - 243, - 250 - ], - "loc": { - "start": { - "line": 11, - "column": 43 - }, - "end": { - "line": 11, - "column": 50 + "line": 14, + "column": 24 } } }, "range": [ - 215, - 250 + 480, + 486 ], "loc": { "start": { - "line": 11, - "column": 15 + "line": 14, + "column": 18 }, "end": { - "line": 11, - "column": 50 + "line": 14, + "column": 24 } } }, "range": [ - 207, - 250 + 472, + 486 ], "loc": { "start": { - "line": 11, - "column": 7 + "line": 14, + "column": 10 }, "end": { - "line": 11, - "column": 50 + "line": 14, + "column": 24 } } } ], "kind": "const", "range": [ - 201, - 251 + 466, + 488 ], "loc": { "start": { - "line": 11, - "column": 1 + "line": 14, + "column": 4 }, "end": { - "line": 11, - "column": 51 + "line": 14, + "column": 26 } }, "leadingComments": [ { - "type": "Block", - "value": "\n * Precondition: n has at most one non-leaf child.\n ", + "type": "Line", + "value": " Precondition: n has at most one non-leaf child.", "range": [ - 140, - 199 + 147, + 197 ], "loc": { "start": { "line": 8, - "column": 1 + "column": 4 + }, + "end": { + "line": 8, + "column": 54 + } + } + }, + { + "type": "Line", + "value": " assert( n.right.isleaf() || n.left.isleaf());", + "range": [ + 202, + 250 + ], + "loc": { + "start": { + "line": 9, + "column": 4 }, "end": { - "line": 10, + "line": 9, + "column": 52 + } + } + }, + { + "type": "Line", + "value": " const child = n.right.isleaf() ? n.left : n.right;", + "range": [ + 256, + 309 + ], + "loc": { + "start": { + "line": 11, "column": 4 + }, + "end": { + "line": 11, + "column": 57 + } + } + }, + { + "type": "Line", + "value": " n.right is always a LEAF because either n is a subtree predecessor or it", + "range": [ + 314, + 389 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 79 + } + } + }, + { + "type": "Line", + "value": " is the only child of its parent by the red-black tree properties", + "range": [ + 394, + 461 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 71 } } } @@ -650,17 +543,17 @@ "type": "Identifier", "name": "replace_node", "range": [ - 254, - 266 + 494, + 506 ], "loc": { "start": { - "line": 13, - "column": 1 + "line": 16, + "column": 4 }, "end": { - "line": 13, - "column": 13 + "line": 16, + "column": 16 } } }, @@ -669,17 +562,17 @@ "type": "Identifier", "name": "n", "range": [ - 267, - 268 + 507, + 508 ], "loc": { "start": { - "line": 13, - "column": 14 + "line": 16, + "column": 17 }, "end": { - "line": 13, - "column": 15 + "line": 16, + "column": 18 } } }, @@ -687,48 +580,48 @@ "type": "Identifier", "name": "child", "range": [ - 270, - 275 + 510, + 515 ], "loc": { "start": { - "line": 13, - "column": 17 + "line": 16, + "column": 20 }, "end": { - "line": 13, - "column": 22 + "line": 16, + "column": 25 } } } ], "range": [ - 254, - 276 + 494, + 516 ], "loc": { "start": { - "line": 13, - "column": 1 + "line": 16, + "column": 4 }, "end": { - "line": 13, - "column": 23 + "line": 16, + "column": 26 } } }, "range": [ - 254, - 277 + 494, + 517 ], "loc": { "start": { - "line": 13, - "column": 1 + "line": 16, + "column": 4 }, "end": { - "line": 13, - "column": 24 + "line": 16, + "column": 27 } } }, @@ -744,17 +637,17 @@ "type": "Identifier", "name": "n", "range": [ - 283, - 284 + 527, + 528 ], "loc": { "start": { - "line": 14, - "column": 5 + "line": 18, + "column": 8 }, "end": { - "line": 14, - "column": 6 + "line": 18, + "column": 9 } } }, @@ -762,32 +655,32 @@ "type": "Identifier", "name": "color", "range": [ - 285, - 290 + 529, + 534 ], "loc": { "start": { - "line": 14, - "column": 7 + "line": 18, + "column": 10 }, "end": { - "line": 14, - "column": 12 + "line": 18, + "column": 15 } } }, "range": [ - 283, - 290 + 527, + 534 ], "loc": { "start": { - "line": 14, - "column": 5 + "line": 18, + "column": 8 }, "end": { - "line": 14, - "column": 12 + "line": 18, + "column": 15 } } }, @@ -795,32 +688,32 @@ "type": "Identifier", "name": "BLACK", "range": [ - 295, - 300 + 539, + 544 ], "loc": { "start": { - "line": 14, - "column": 17 + "line": 18, + "column": 20 }, "end": { - "line": 14, - "column": 22 + "line": 18, + "column": 25 } } }, "range": [ - 283, - 300 + 527, + 544 ], "loc": { "start": { - "line": 14, - "column": 5 + "line": 18, + "column": 8 }, "end": { - "line": 14, - "column": 22 + "line": 18, + "column": 25 } } }, @@ -839,17 +732,17 @@ "type": "Identifier", "name": "child", "range": [ - 310, - 315 + 560, + 565 ], "loc": { "start": { - "line": 15, - "column": 6 + "line": 19, + "column": 12 }, "end": { - "line": 15, - "column": 11 + "line": 19, + "column": 17 } } }, @@ -857,32 +750,32 @@ "type": "Identifier", "name": "color", "range": [ - 316, - 321 + 566, + 571 ], "loc": { "start": { - "line": 15, - "column": 12 + "line": 19, + "column": 18 }, "end": { - "line": 15, - "column": 17 + "line": 19, + "column": 23 } } }, "range": [ - 310, - 321 + 560, + 571 ], "loc": { "start": { - "line": 15, - "column": 6 + "line": 19, + "column": 12 }, "end": { - "line": 15, - "column": 17 + "line": 19, + "column": 23 } } }, @@ -890,32 +783,32 @@ "type": "Identifier", "name": "RED", "range": [ - 326, - 329 + 576, + 579 ], "loc": { "start": { - "line": 15, - "column": 22 + "line": 19, + "column": 28 }, "end": { - "line": 15, - "column": 25 + "line": 19, + "column": 31 } } }, "range": [ - 310, - 329 + 560, + 579 ], "loc": { "start": { - "line": 15, - "column": 6 + "line": 19, + "column": 12 }, "end": { - "line": 15, - "column": 25 + "line": 19, + "column": 31 } } }, @@ -931,17 +824,17 @@ "type": "Identifier", "name": "child", "range": [ - 334, - 339 + 581, + 586 ], "loc": { "start": { - "line": 16, - "column": 3 + "line": 19, + "column": 33 }, "end": { - "line": 16, - "column": 8 + "line": 19, + "column": 38 } } }, @@ -949,32 +842,32 @@ "type": "Identifier", "name": "color", "range": [ - 340, - 345 + 587, + 592 ], "loc": { "start": { - "line": 16, - "column": 9 + "line": 19, + "column": 39 }, "end": { - "line": 16, - "column": 14 + "line": 19, + "column": 44 } } }, "range": [ - 334, - 345 + 581, + 592 ], "loc": { "start": { - "line": 16, - "column": 3 + "line": 19, + "column": 33 }, "end": { - "line": 16, - "column": 14 + "line": 19, + "column": 44 } } }, @@ -982,47 +875,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 348, - 353 + 595, + 600 ], "loc": { "start": { - "line": 16, - "column": 17 + "line": 19, + "column": 47 }, "end": { - "line": 16, - "column": 22 + "line": 19, + "column": 52 } } }, "range": [ - 334, - 353 + 581, + 600 ], "loc": { "start": { - "line": 16, - "column": 3 + "line": 19, + "column": 33 }, "end": { - "line": 16, - "column": 22 + "line": 19, + "column": 52 } } }, "range": [ - 334, - 354 + 581, + 601 ], "loc": { "start": { - "line": 16, - "column": 3 + "line": 19, + "column": 33 }, "end": { - "line": 16, - "column": 23 + "line": 19, + "column": 53 } } }, @@ -1034,17 +927,17 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 365, - 377 + 615, + 627 ], "loc": { "start": { - "line": 18, - "column": 3 + "line": 20, + "column": 13 }, "end": { - "line": 18, - "column": 15 + "line": 20, + "column": 25 } } }, @@ -1053,110 +946,184 @@ "type": "Identifier", "name": "child", "range": [ - 378, - 383 + 628, + 633 ], "loc": { "start": { - "line": 18, - "column": 16 + "line": 20, + "column": 26 }, "end": { - "line": 18, - "column": 21 + "line": 20, + "column": 31 } } } ], "range": [ - 365, - 384 + 615, + 634 ], "loc": { "start": { - "line": 18, - "column": 3 + "line": 20, + "column": 13 }, "end": { - "line": 18, - "column": 22 + "line": 20, + "column": 32 } } }, "range": [ - 365, - 385 + 615, + 635 ], "loc": { "start": { - "line": 18, - "column": 3 + "line": 20, + "column": 13 }, "end": { - "line": 18, - "column": 23 + "line": 20, + "column": 33 } } }, "range": [ - 306, - 385 + 556, + 635 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 19, + "column": 8 }, "end": { - "line": 18, - "column": 23 + "line": 20, + "column": 33 } } } ], "range": [ - 302, - 388 + 546, + 641 ], "loc": { "start": { - "line": 14, - "column": 24 + "line": 18, + "column": 27 }, "end": { - "line": 19, - "column": 2 + "line": 21, + "column": 5 } } }, "alternate": null, "range": [ - 279, - 388 + 523, + 641 ], "loc": { "start": { - "line": 14, - "column": 1 + "line": 18, + "column": 4 }, "end": { - "line": 19, - "column": 2 + "line": 21, + "column": 5 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": "else {", + "range": [ + 647, + 655 + ], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 12 + } + } + }, + { + "type": "Line", + "value": " If n is RED then its child can only be BLACK. Replacing n with its", + "range": [ + 660, + 732 + ], + "loc": { + "start": { + "line": 24, + "column": 4 + }, + "end": { + "line": 24, + "column": 76 + } + } + }, + { + "type": "Line", + "value": " child suffices.", + "range": [ + 737, + 758 + ], + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": "Line", + "value": "}", + "range": [ + 763, + 766 + ], + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 7 + } + } + } + ] } ], "range": [ - 137, - 390 + 140, + 769 ], "loc": { "start": { - "line": 7, - "column": 0 + "line": 6, + "column": 39 }, "end": { - "line": 20, + "line": 28, "column": 1 } } @@ -1165,7 +1132,7 @@ "expression": false, "range": [ 108, - 390 + 769 ], "loc": { "start": { @@ -1173,7 +1140,7 @@ "column": 7 }, "end": { - "line": 20, + "line": 28, "column": 1 } }, @@ -1184,7 +1151,7 @@ "source": null, "range": [ 101, - 390 + 769 ], "loc": { "start": { @@ -1192,7 +1159,7 @@ "column": 0 }, "end": { - "line": 20, + "line": 28, "column": 1 } } @@ -1201,7 +1168,7 @@ "sourceType": "module", "range": [ 1, - 390 + 769 ], "loc": { "start": { @@ -1209,26 +1176,170 @@ "column": 0 }, "end": { - "line": 20, + "line": 28, "column": 1 } }, "comments": [ { - "type": "Block", - "value": "\n * Precondition: n has at most one non-leaf child.\n ", + "type": "Line", + "value": " Precondition: n has at most one non-leaf child.", "range": [ - 140, - 199 + 147, + 197 ], "loc": { "start": { "line": 8, - "column": 1 + "column": 4 }, "end": { - "line": 10, + "line": 8, + "column": 54 + } + } + }, + { + "type": "Line", + "value": " assert( n.right.isleaf() || n.left.isleaf());", + "range": [ + 202, + 250 + ], + "loc": { + "start": { + "line": 9, + "column": 4 + }, + "end": { + "line": 9, + "column": 52 + } + } + }, + { + "type": "Line", + "value": " const child = n.right.isleaf() ? n.left : n.right;", + "range": [ + 256, + 309 + ], + "loc": { + "start": { + "line": 11, + "column": 4 + }, + "end": { + "line": 11, + "column": 57 + } + } + }, + { + "type": "Line", + "value": " n.right is always a LEAF because either n is a subtree predecessor or it", + "range": [ + 314, + 389 + ], + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 79 + } + } + }, + { + "type": "Line", + "value": " is the only child of its parent by the red-black tree properties", + "range": [ + 394, + 461 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 71 + } + } + }, + { + "type": "Line", + "value": "else {", + "range": [ + 647, + 655 + ], + "loc": { + "start": { + "line": 23, + "column": 4 + }, + "end": { + "line": 23, + "column": 12 + } + } + }, + { + "type": "Line", + "value": " If n is RED then its child can only be BLACK. Replacing n with its", + "range": [ + 660, + 732 + ], + "loc": { + "start": { + "line": 24, "column": 4 + }, + "end": { + "line": 24, + "column": 76 + } + } + }, + { + "type": "Line", + "value": " child suffices.", + "range": [ + 737, + 758 + ], + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": "Line", + "value": "}", + "range": [ + 763, + 766 + ], + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 7 } } } diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/adt/RedBlackTree.js~RedBlackTree.html index 37020e4..2dd453f 100644 --- a/class/src/adt/RedBlackTree.js~RedBlackTree.html +++ b/class/src/adt/RedBlackTree.js~RedBlackTree.html @@ -35,19 +35,19 @@
    - +

    Static Method Summary

    + + + + + + + + + +
    Static Public Methods
    + public + static + + + + +
    +

    + from(compare: *, iterable: *): * +

    +
    +
    + + + +
    +
    + + +
    +

    Constructor Summary

    @@ -306,7 +337,81 @@

    RedBlackTree

    +

    Static Public Methods

    + +
    +

    + public + static + + + + from(compare: *, iterable: *): * + + + + source + +

    + + + + + + + + +
    +

    Params:

    +
    Public Constructor
    + + + + + + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    compare*
    iterable*
    +
    +

    + +
    +

    Return:

    + + + + + +
    *
    +
    +
    +
    + + + + + + + + + + + + + +

    Public Constructors

    @@ -462,7 +567,7 @@

    - source + source

    diff --git a/coverage.json b/coverage.json index c62df6e..36c0a04 100644 --- a/coverage.json +++ b/coverage.json @@ -1,6 +1,6 @@ { - "coverage": "5.71%", - "expectCount": 35, + "coverage": "5.55%", + "expectCount": 36, "actualCount": 2, "files": { "src/base/colors.js": { @@ -26,24 +26,32 @@ ] }, "src/adt/RedBlackTree.js": { - "expectCount": 8, + "expectCount": 9, "actualCount": 0, "undocumentLines": [ 10, - 66, + 72, 19, 14, 12, 38, 30, + 78, 15 ] }, + "src/base/debug.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 6 + ] + }, "src/removal/delete_case1.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 4 + 6 ] }, "src/removal/delete_case2.js": { @@ -95,7 +103,7 @@ 2 ] }, - "src/base/grandparent.js": { + "src/family/grandparent.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ @@ -151,7 +159,7 @@ 4 ] }, - "src/base/predecessor.js": { + "src/family/predecessor.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ @@ -162,7 +170,7 @@ "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 2 + 1 ] }, "src/base/rotate_left.js": { @@ -175,21 +183,14 @@ "actualCount": 1, "undocumentLines": [] }, - "src/base/sibling.js": { - "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] - }, - "src/base/successor.js": { + "src/family/sibling.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ 1 ] }, - "src/base/uncle.js": { + "src/family/uncle.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ diff --git a/dump.json b/dump.json index b24fcec..d67ee21 100644 --- a/dump.json +++ b/dump.json @@ -10,7 +10,7 @@ "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { Node } from '..' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor , successor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { find } from '..' ;\nimport { inordertraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\tfind ( value ) {\n\n\t\tif ( this.root === null ) return null ;\n\n\t\treturn find( this.compare , this.root , value ) ;\n\n\t}\n\n\tdelete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\tconst succ = successor( node ) ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t}\n\n\t*[Symbol.iterator] ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n}\n" + "content": "\nimport { Node } from '..' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { find } from '..' ;\nimport { inordertraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\tfind ( value ) {\n\n\t\tif ( this.root === null ) return null ;\n\n\t\treturn find( this.compare , this.root , value ) ;\n\n\t}\n\n\tdelete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\t*[Symbol.iterator] ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" }, { "__docId__": 1, @@ -186,7 +186,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", "access": null, "description": null, - "lineNumber": 61, + "lineNumber": 63, "undocument": true, "type": { "types": [ @@ -204,13 +204,46 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "access": null, "description": null, - "lineNumber": 66, + "lineNumber": 72, "undocument": true, "params": [], "generator": true }, { "__docId__": 11, + "kind": "method", + "static": true, + "variation": null, + "name": "from", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree.from", + "access": null, + "description": null, + "lineNumber": 78, + "undocument": true, + "params": [ + { + "name": "compare", + "types": [ + "*" + ] + }, + { + "name": "iterable", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 12, "kind": "file", "static": true, "variation": null, @@ -223,7 +256,7 @@ "content": "export * from './RedBlackTree' ;\n" }, { - "__docId__": 12, + "__docId__": 13, "kind": "file", "static": true, "variation": null, @@ -236,7 +269,7 @@ "content": "export const BLACK = 0 ;\nexport const RED = 1 ;\n" }, { - "__docId__": 13, + "__docId__": 14, "kind": "variable", "static": true, "variation": null, @@ -257,7 +290,7 @@ } }, { - "__docId__": 14, + "__docId__": 15, "kind": "variable", "static": true, "variation": null, @@ -278,91 +311,91 @@ } }, { - "__docId__": 15, + "__docId__": 16, "kind": "file", "static": true, "variation": null, - "name": "src/base/find.js", + "name": "src/base/debug.js", "memberof": null, - "longname": "src/base/find.js", + "longname": "src/base/debug.js", "access": null, "description": null, "lineNumber": 2, - "content": "\nexport function find ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" + "content": "\nimport { BLACK } from './colors' ;\n\nimport chalk from 'chalk' ;\n\nexport function debug ( node ) {\n\n\tif ( node.isleaf( ) ) return chalk.bgBlack('L') ;\n\n\tconst repr = node.color === BLACK ? chalk.bgBlack(node.value) : chalk.bgRed( node.value ) ;\n\n\treturn `(${debug(node.left)}, ${repr}, ${debug(node.right)})` ;\n\n}\n" }, { - "__docId__": 16, + "__docId__": 17, "kind": "function", "static": true, "variation": null, - "name": "find", - "memberof": "src/base/find.js", - "longname": "src/base/find.js~find", + "name": "debug", + "memberof": "src/base/debug.js", + "longname": "src/base/debug.js~debug", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/find.js", - "importStyle": "{find}", + "importPath": "aureooms-es-red-black-tree/src/base/debug.js", + "importStyle": "{debug}", "description": null, - "lineNumber": 2, + "lineNumber": 6, "undocument": true, "params": [ - { - "name": "compare", - "types": [ - "*" - ] - }, { "name": "node", "types": [ "*" ] - }, - { - "name": "value", - "types": [ - "*" - ] } ], "return": { "types": [ - "*" + "string" ] }, "generator": false }, { - "__docId__": 17, + "__docId__": 18, "kind": "file", "static": true, "variation": null, - "name": "src/base/grandparent.js", + "name": "src/base/find.js", "memberof": null, - "longname": "src/base/grandparent.js", + "longname": "src/base/find.js", "access": null, "description": null, - "lineNumber": 1, - "content": "export function grandparent( n ){\n if ((n !== null) && (n.parent !== null))\n return n.parent.parent;\n else\n return null;\n}\n" + "lineNumber": 2, + "content": "\nexport function find ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" }, { - "__docId__": 18, + "__docId__": 19, "kind": "function", "static": true, "variation": null, - "name": "grandparent", - "memberof": "src/base/grandparent.js", - "longname": "src/base/grandparent.js~grandparent", + "name": "find", + "memberof": "src/base/find.js", + "longname": "src/base/find.js~find", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/grandparent.js", - "importStyle": "{grandparent}", + "importPath": "aureooms-es-red-black-tree/src/base/find.js", + "importStyle": "{find}", "description": null, - "lineNumber": 1, + "lineNumber": 2, "undocument": true, "params": [ { - "name": "n", + "name": "compare", + "types": [ + "*" + ] + }, + { + "name": "node", + "types": [ + "*" + ] + }, + { + "name": "value", "types": [ "*" ] @@ -376,7 +409,7 @@ "generator": false }, { - "__docId__": 19, + "__docId__": 20, "kind": "file", "static": true, "variation": null, @@ -386,10 +419,10 @@ "access": null, "description": null, "lineNumber": 1, - "content": "export * from './colors' ;\nexport * from './find' ;\nexport * from './grandparent' ;\nexport * from './inordertraversal' ;\nexport * from './insert' ;\nexport * from './predecessor' ;\nexport * from './replace_node' ;\nexport * from './rotate_left' ;\nexport * from './rotate_right' ;\nexport * from './sibling' ;\nexport * from './successor' ;\nexport * from './uncle' ;\n" + "content": "export * from './colors' ;\nexport * from './debug' ;\nexport * from './find' ;\nexport * from './inordertraversal' ;\nexport * from './insert' ;\nexport * from './replace_node' ;\nexport * from './rotate_left' ;\nexport * from './rotate_right' ;\n" }, { - "__docId__": 20, + "__docId__": 21, "kind": "file", "static": true, "variation": null, @@ -402,7 +435,7 @@ "content": "\nexport function* inordertraversal ( node ) {\n\n\tif ( !node.left.isleaf() ) {\n\t\tyield *inordertraversal( node.left );\n\t}\n\n\tyield node.value ;\n\n\tif ( !node.right.isleaf() ) {\n\t\tyield* inordertraversal( node.right );\n\t}\n\n}\n" }, { - "__docId__": 21, + "__docId__": 22, "kind": "function", "static": true, "variation": null, @@ -427,7 +460,7 @@ "generator": true }, { - "__docId__": 22, + "__docId__": 23, "kind": "file", "static": true, "variation": null, @@ -440,7 +473,7 @@ "content": "\nexport function insert ( compare, A, B ) {\n\n\twhile ( true ) {\n\n\t\tif ( compare( B.value, A.value ) < 0 ) {\n\n\t\t\tconst node = A.left;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t\telse {\n\n\t\t\tconst node = A.right;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n\n}\n" }, { - "__docId__": 23, + "__docId__": 24, "kind": "function", "static": true, "variation": null, @@ -481,51 +514,8 @@ }, "generator": false }, - { - "__docId__": 24, - "kind": "file", - "static": true, - "variation": null, - "name": "src/base/predecessor.js", - "memberof": null, - "longname": "src/base/predecessor.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export function predecessor ( node ) {\n\n\tvar pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" - }, { "__docId__": 25, - "kind": "function", - "static": true, - "variation": null, - "name": "predecessor", - "memberof": "src/base/predecessor.js", - "longname": "src/base/predecessor.js~predecessor", - "access": null, - "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/predecessor.js", - "importStyle": "{predecessor}", - "description": null, - "lineNumber": 1, - "undocument": true, - "params": [ - { - "name": "node", - "types": [ - "*" - ] - } - ], - "return": { - "types": [ - "*" - ] - }, - "generator": false - }, - { - "__docId__": 26, "kind": "file", "static": true, "variation": null, @@ -534,11 +524,11 @@ "longname": "src/base/replace_node.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nexport function replace_node ( A , B ) {\n\tif ( A.parent === null ) {\n\t\t// nothing to do\n\t}\n\telse if ( A === A.parent.left ) {\n\t\tA.parent.left = B ;\n\t}\n\telse {\n\t\tA.parent.right = B ;\n\t}\n\tB.parent = A.parent ;\n}\n" + "lineNumber": 1, + "content": "export function replace_node ( A , B ) {\n\n\t// assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif ( A === A.parent.left ) A.parent.left = B ;\n\n\telse A.parent.right = B ;\n\n\tB.parent = A.parent ;\n\n}\n" }, { - "__docId__": 27, + "__docId__": 26, "kind": "function", "static": true, "variation": null, @@ -550,7 +540,7 @@ "importPath": "aureooms-es-red-black-tree/src/base/replace_node.js", "importStyle": "{replace_node}", "description": null, - "lineNumber": 2, + "lineNumber": 1, "undocument": true, "params": [ { @@ -569,7 +559,7 @@ "generator": false }, { - "__docId__": 28, + "__docId__": 27, "kind": "file", "static": true, "variation": null, @@ -582,7 +572,7 @@ "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" }, { - "__docId__": 29, + "__docId__": 28, "kind": "function", "static": true, "variation": null, @@ -610,7 +600,7 @@ "generator": false }, { - "__docId__": 30, + "__docId__": 29, "kind": "file", "static": true, "variation": null, @@ -623,7 +613,7 @@ "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" }, { - "__docId__": 31, + "__docId__": 30, "kind": "function", "static": true, "variation": null, @@ -651,30 +641,30 @@ "generator": false }, { - "__docId__": 32, + "__docId__": 31, "kind": "file", "static": true, "variation": null, - "name": "src/base/sibling.js", + "name": "src/family/grandparent.js", "memberof": null, - "longname": "src/base/sibling.js", + "longname": "src/family/grandparent.js", "access": null, "description": null, "lineNumber": 1, - "content": "export function sibling(n)\n{\n if ((n === null) || (n.parent === null))\n return null; // no parent means no sibling\n if (n === n.parent.left)\n return n.parent.right;\n else\n return n.parent.left;\n}\n" + "content": "export function grandparent ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only call this function when n HAS a grandparent\n\treturn n.parent.parent;\n\n}\n" }, { - "__docId__": 33, + "__docId__": 32, "kind": "function", "static": true, "variation": null, - "name": "sibling", - "memberof": "src/base/sibling.js", - "longname": "src/base/sibling.js~sibling", + "name": "grandparent", + "memberof": "src/family/grandparent.js", + "longname": "src/family/grandparent.js~grandparent", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/sibling.js", - "importStyle": "{sibling}", + "importPath": "aureooms-es-red-black-tree/src/family/grandparent.js", + "importStyle": "{grandparent}", "description": null, "lineNumber": 1, "undocument": true, @@ -693,31 +683,44 @@ }, "generator": false }, + { + "__docId__": 33, + "kind": "file", + "static": true, + "variation": null, + "name": "src/family/index.js", + "memberof": null, + "longname": "src/family/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './grandparent' ;\nexport * from './predecessor' ;\nexport * from './sibling' ;\nexport * from './uncle' ;\n" + }, { "__docId__": 34, "kind": "file", "static": true, "variation": null, - "name": "src/base/successor.js", + "name": "src/family/predecessor.js", "memberof": null, - "longname": "src/base/successor.js", + "longname": "src/family/predecessor.js", "access": null, "description": null, "lineNumber": 1, - "content": "export function successor ( node ) {\n\n\tvar succ = node.right ;\n\n\twhile ( !succ.left.isleaf() ) succ = succ.left ;\n\n\treturn succ ;\n\n}\n" + "content": "export function predecessor ( node ) {\n\n\tvar pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" }, { "__docId__": 35, "kind": "function", "static": true, "variation": null, - "name": "successor", - "memberof": "src/base/successor.js", - "longname": "src/base/successor.js~successor", + "name": "predecessor", + "memberof": "src/family/predecessor.js", + "longname": "src/family/predecessor.js~predecessor", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/successor.js", - "importStyle": "{successor}", + "importPath": "aureooms-es-red-black-tree/src/family/predecessor.js", + "importStyle": "{predecessor}", "description": null, "lineNumber": 1, "undocument": true, @@ -741,25 +744,68 @@ "kind": "file", "static": true, "variation": null, - "name": "src/base/uncle.js", + "name": "src/family/sibling.js", "memberof": null, - "longname": "src/base/uncle.js", + "longname": "src/family/sibling.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { grandparent } from './grandparent' ;\n\nexport function uncle(n){\n const g = grandparent(n);\n if (g === null)\n return null; // No grandparent means no uncle\n if (n.parent === g.left)\n return g.right.isleaf() ? null : g.right ;\n else\n return g.left.isleaf() ? null : g.left;\n}\n" + "content": "export function sibling ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only use this function when n HAS a sibling so this case can never\n\t//happen.\n\n\treturn n === n.parent.left ? n.parent.right : n.parent.left ;\n\n}\n" }, { "__docId__": 37, "kind": "function", "static": true, "variation": null, + "name": "sibling", + "memberof": "src/family/sibling.js", + "longname": "src/family/sibling.js~sibling", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/family/sibling.js", + "importStyle": "{sibling}", + "description": null, + "lineNumber": 1, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 38, + "kind": "file", + "static": true, + "variation": null, + "name": "src/family/uncle.js", + "memberof": null, + "longname": "src/family/uncle.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { grandparent } from './grandparent' ;\n\nexport function uncle ( n ) {\n\tconst g = grandparent( n );\n\t// assert( g !== null ) ;\n\t// this can never happen\n\tif ( n.parent === g.left )\n\t return g.right.isleaf( ) ? null : g.right ;\n\telse\n\t return g.left.isleaf( ) ? null : g.left ;\n}\n" + }, + { + "__docId__": 39, + "kind": "function", + "static": true, + "variation": null, "name": "uncle", - "memberof": "src/base/uncle.js", - "longname": "src/base/uncle.js~uncle", + "memberof": "src/family/uncle.js", + "longname": "src/family/uncle.js~uncle", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/uncle.js", + "importPath": "aureooms-es-red-black-tree/src/family/uncle.js", "importStyle": "{uncle}", "description": null, "lineNumber": 3, @@ -780,7 +826,7 @@ "generator": false }, { - "__docId__": 38, + "__docId__": 40, "kind": "file", "static": true, "variation": null, @@ -790,10 +836,10 @@ "access": null, "description": null, "lineNumber": 1, - "content": "export * from './adt' ;\nexport * from './base' ;\nexport * from './insertion' ;\nexport * from './node' ;\nexport * from './removal' ;\n" + "content": "export * from './adt' ;\nexport * from './base' ;\nexport * from './family' ;\nexport * from './insertion' ;\nexport * from './node' ;\nexport * from './removal' ;\n" }, { - "__docId__": 39, + "__docId__": 41, "kind": "file", "static": true, "variation": null, @@ -806,7 +852,7 @@ "content": "export * from './insert_case1' ;\nexport * from './insert_case2' ;\nexport * from './insert_case3' ;\nexport * from './insert_case4' ;\nexport * from './insert_case5' ;\n" }, { - "__docId__": 40, + "__docId__": 42, "kind": "file", "static": true, "variation": null, @@ -819,7 +865,7 @@ "content": "\nimport { BLACK } from '..' ;\nimport { insert_case2 } from './insert_case2' ;\n\nexport function insert_case1(n)\n{\n if (n.parent === null)\n n.color = BLACK;\n else\n insert_case2(n);\n}\n" }, { - "__docId__": 41, + "__docId__": 43, "kind": "function", "static": true, "variation": null, @@ -844,7 +890,7 @@ "generator": false }, { - "__docId__": 42, + "__docId__": 44, "kind": "file", "static": true, "variation": null, @@ -857,7 +903,7 @@ "content": "\nimport { BLACK } from '..' ;\nimport { insert_case3 } from './insert_case3' ;\n\nexport function insert_case2(n)\n{\n if (n.parent.color === BLACK)\n return; /* Tree is still valid */\n else\n insert_case3(n);\n}\n" }, { - "__docId__": 43, + "__docId__": 45, "kind": "function", "static": true, "variation": null, @@ -882,7 +928,7 @@ "generator": false }, { - "__docId__": 44, + "__docId__": 46, "kind": "file", "static": true, "variation": null, @@ -895,7 +941,7 @@ "content": "import { BLACK , RED , uncle , grandparent } from '..' ;\nimport { insert_case1 } from './insert_case1' ;\nimport { insert_case4 } from './insert_case4' ;\n\nexport function insert_case3(n)\n{\n const u = uncle(n);\n\n if ((u !== null) && (u.color === RED)) {\n n.parent.color = BLACK;\n u.color = BLACK;\n const g = grandparent(n);\n g.color = RED;\n insert_case1(g);\n } else {\n insert_case4(n);\n }\n}\n" }, { - "__docId__": 45, + "__docId__": 47, "kind": "function", "static": true, "variation": null, @@ -920,7 +966,7 @@ "generator": false }, { - "__docId__": 46, + "__docId__": 48, "kind": "file", "static": true, "variation": null, @@ -930,10 +976,10 @@ "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { rotate_left , rotate_right , grandparent } from '..' ;\nimport { insert_case5 } from './insert_case5' ;\n\nexport function insert_case4(n)\n{\n const g = grandparent(n);\n\n if ((n === n.parent.right) && (n.parent === g.left)) {\n rotate_left(n.parent);\n\n /*\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n */\n\n n = n.left;\n\n } else if ((n === n.parent.left) && (n.parent === g.right)) {\n rotate_right(n.parent);\n\n /*\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n */\n\n n = n.right;\n }\n insert_case5(n);\n}\n" + "content": "\nimport { rotate_left , rotate_right , grandparent } from '..' ;\nimport { insert_case5 } from './insert_case5' ;\n\nexport function insert_case4(n)\n{\n const g = grandparent(n);\n\n if ((n === n.parent.right) && (n.parent === g.left)) {\n rotate_left(n.parent);\n\n /*\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n */\n\n //n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\n } else if ((n === n.parent.left) && (n.parent === g.right)) {\n rotate_right(n.parent);\n\n /*\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n */\n\n //n = n.right;\n }\n insert_case5(n);\n}\n" }, { - "__docId__": 47, + "__docId__": 49, "kind": "function", "static": true, "variation": null, @@ -958,7 +1004,7 @@ "generator": false }, { - "__docId__": 48, + "__docId__": 50, "kind": "file", "static": true, "variation": null, @@ -971,7 +1017,7 @@ "content": "\nimport { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;\n\nexport function insert_case5(n)\n{\n const g = grandparent(n);\n\n n.parent.color = BLACK;\n g.color = RED;\n if (n === n.parent.left)\n rotate_right(g);\n else\n rotate_left(g);\n}\n" }, { - "__docId__": 49, + "__docId__": 51, "kind": "function", "static": true, "variation": null, @@ -996,7 +1042,7 @@ "generator": false }, { - "__docId__": 50, + "__docId__": 52, "kind": "file", "static": true, "variation": null, @@ -1009,7 +1055,7 @@ "content": "import { BLACK } from '..' ;\n\nexport function Leaf ( parent ) {\n\tthis.color = BLACK ;\n\tthis.parent = parent ;\n}\n\nLeaf.prototype.isleaf = function ( ) { return true ; } ;\n" }, { - "__docId__": 51, + "__docId__": 53, "kind": "function", "static": true, "variation": null, @@ -1034,7 +1080,7 @@ "generator": false }, { - "__docId__": 52, + "__docId__": 54, "kind": "function", "static": true, "variation": null, @@ -1057,7 +1103,7 @@ "generator": false }, { - "__docId__": 53, + "__docId__": 55, "kind": "file", "static": true, "variation": null, @@ -1070,7 +1116,7 @@ "content": "import { Leaf } from './Leaf' ;\n\nexport function Node ( color , value ) {\n\tthis.color = color ;\n\tthis.left = new Leaf( this ) ;\n\tthis.right = new Leaf( this ) ;\n\tthis.parent = null ;\n\tthis.value = value ;\n}\n\nNode.prototype.isleaf = function ( ) { return false ; } ;\n" }, { - "__docId__": 54, + "__docId__": 56, "kind": "function", "static": true, "variation": null, @@ -1101,7 +1147,7 @@ "generator": false }, { - "__docId__": 55, + "__docId__": 57, "kind": "function", "static": true, "variation": null, @@ -1124,7 +1170,7 @@ "generator": false }, { - "__docId__": 56, + "__docId__": 58, "kind": "file", "static": true, "variation": null, @@ -1137,7 +1183,7 @@ "content": "export * from './Leaf' ;\nexport * from './Node' ;\n" }, { - "__docId__": 57, + "__docId__": 59, "kind": "file", "static": true, "variation": null, @@ -1147,10 +1193,10 @@ "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { delete_case2 } from './delete_case2' ;\n\nexport function delete_case1(n)\n{\n if (n.parent !== null)\n delete_case2(n);\n}\n" + "content": "\nimport { delete_case2 } from './delete_case2' ;\n\nimport assert from 'assert' ;\n\nexport function delete_case1(n)\n{\n if (n.parent !== null)\n delete_case2(n);\n}\n" }, { - "__docId__": 58, + "__docId__": 60, "kind": "function", "static": true, "variation": null, @@ -1162,7 +1208,7 @@ "importPath": "aureooms-es-red-black-tree/src/removal/delete_case1.js", "importStyle": "{delete_case1}", "description": null, - "lineNumber": 4, + "lineNumber": 6, "undocument": true, "params": [ { @@ -1175,7 +1221,7 @@ "generator": false }, { - "__docId__": 59, + "__docId__": 61, "kind": "file", "static": true, "variation": null, @@ -1185,10 +1231,10 @@ "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK , RED , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\n\nexport function delete_case2(n)\n{\n const s = sibling(n);\n\n if (s.color === RED) {\n n.parent.color = RED;\n s.color = BLACK;\n if (n === n.parent.left)\n rotate_left(n.parent);\n else\n rotate_right(n.parent);\n }\n delete_case3(n);\n}\n" + "content": "import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\n\nexport function delete_case2(n)\n{\n const s = sibling(n);\n\n if (s.color === RED) {\n n.parent.color = RED;\n s.color = BLACK;\n if (n === n.parent.left)\n rotate_left(n.parent);\n else\n rotate_right(n.parent);\n }\n delete_case3(n);\n}\n" }, { - "__docId__": 60, + "__docId__": 62, "kind": "function", "static": true, "variation": null, @@ -1213,7 +1259,7 @@ "generator": false }, { - "__docId__": 61, + "__docId__": 63, "kind": "file", "static": true, "variation": null, @@ -1223,10 +1269,10 @@ "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\nexport function delete_case3(n)\n{\n const s = sibling(n);\n\n if ((n.parent.color === BLACK) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n delete_case1(n.parent);\n } else\n delete_case4(n);\n}\n" + "content": "\nimport { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\nexport function delete_case3(n)\n{\n const s = sibling(n);\n //console.log(n.color, n.parent.color, s.color , s.isleaf());\n\n if ((n.parent.color === BLACK) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n delete_case1(n.parent);\n }\n\n else\n delete_case4(n);\n}\n" }, { - "__docId__": 62, + "__docId__": 64, "kind": "function", "static": true, "variation": null, @@ -1251,7 +1297,7 @@ "generator": false }, { - "__docId__": 63, + "__docId__": 65, "kind": "file", "static": true, "variation": null, @@ -1261,10 +1307,10 @@ "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\nexport function delete_case4(n)\n{\n const s = sibling(n);\n\n if ((n.parent.color === RED) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n n.parent.color = BLACK;\n } else\n delete_case5(n);\n}\n" + "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\nexport function delete_case4(n)\n{\n const s = sibling(n);\n //console.log( s ) ;\n\n if ((n.parent.color === RED) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n n.parent.color = BLACK;\n } else\n delete_case5(n);\n}\n" }, { - "__docId__": 64, + "__docId__": 66, "kind": "function", "static": true, "variation": null, @@ -1289,7 +1335,7 @@ "generator": false }, { - "__docId__": 65, + "__docId__": 67, "kind": "file", "static": true, "variation": null, @@ -1302,7 +1348,7 @@ "content": "\nimport { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nimport { delete_case6 } from './delete_case6' ;\n\nexport function delete_case5(n)\n{\n const s = sibling(n);\n\n if (s.color === BLACK) { /* this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). */\n/* the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. */\n if ((n === n.parent.left) &&\n (s.right.color === BLACK) &&\n (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.left.color = BLACK;\n rotate_right(s);\n } else if ((n === n.parent.right) &&\n (s.left.color === BLACK) &&\n (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.right.color = BLACK;\n rotate_left(s);\n }\n }\n delete_case6(n);\n}\n" }, { - "__docId__": 66, + "__docId__": 68, "kind": "function", "static": true, "variation": null, @@ -1327,7 +1373,7 @@ "generator": false }, { - "__docId__": 67, + "__docId__": 69, "kind": "file", "static": true, "variation": null, @@ -1340,7 +1386,7 @@ "content": "\nimport { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nexport function delete_case6(n)\n{\n const s = sibling(n);\n\n s.color = n.parent.color;\n n.parent.color = BLACK;\n\n if (n === n.parent.left) {\n s.right.color = BLACK;\n rotate_left(n.parent);\n } else {\n s.left.color = BLACK;\n rotate_right(n.parent);\n }\n}\n" }, { - "__docId__": 68, + "__docId__": 70, "kind": "function", "static": true, "variation": null, @@ -1365,7 +1411,7 @@ "generator": false }, { - "__docId__": 69, + "__docId__": 71, "kind": "file", "static": true, "variation": null, @@ -1375,10 +1421,10 @@ "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { BLACK , RED , replace_node } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\n\nexport function delete_one_child(n)\n{\n /*\n * Precondition: n has at most one non-leaf child.\n */\n const child = n.right.isleaf() ? n.left : n.right;\n\n replace_node(n, child);\n if (n.color === BLACK) {\n if (child.color === RED)\n child.color = BLACK;\n else\n delete_case1(child);\n }\n}\n" + "content": "\nimport { BLACK , RED , replace_node } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\n\nexport function delete_one_child ( n ) {\n\n // Precondition: n has at most one non-leaf child.\n // assert( n.right.isleaf() || n.left.isleaf());\n\n // const child = n.right.isleaf() ? n.left : n.right;\n // n.right is always a LEAF because either n is a subtree predecessor or it\n // is the only child of its parent by the red-black tree properties\n const child = n.left ;\n\n replace_node(n, child);\n\n if (n.color === BLACK) {\n if (child.color === RED) child.color = BLACK;\n else delete_case1(child);\n }\n\n //else {\n // If n is RED then its child can only be BLACK. Replacing n with its\n // child suffices.\n //}\n\n}\n" }, { - "__docId__": 70, + "__docId__": 72, "kind": "function", "static": true, "variation": null, @@ -1403,7 +1449,7 @@ "generator": false }, { - "__docId__": 71, + "__docId__": 73, "kind": "file", "static": true, "variation": null, @@ -1416,7 +1462,7 @@ "content": "export * from './delete_case1' ;\nexport * from './delete_case2' ;\nexport * from './delete_case3' ;\nexport * from './delete_case4' ;\nexport * from './delete_case5' ;\nexport * from './delete_case6' ;\nexport * from './delete_one_child' ;\n" }, { - "__docId__": 73, + "__docId__": 75, "kind": "external", "static": true, "variation": null, @@ -1429,7 +1475,7 @@ "builtinExternal": true }, { - "__docId__": 74, + "__docId__": 76, "kind": "external", "static": true, "variation": null, @@ -1442,7 +1488,7 @@ "builtinExternal": true }, { - "__docId__": 75, + "__docId__": 77, "kind": "external", "static": true, "variation": null, @@ -1455,7 +1501,7 @@ "builtinExternal": true }, { - "__docId__": 76, + "__docId__": 78, "kind": "external", "static": true, "variation": null, @@ -1468,7 +1514,7 @@ "builtinExternal": true }, { - "__docId__": 77, + "__docId__": 79, "kind": "external", "static": true, "variation": null, @@ -1481,7 +1527,7 @@ "builtinExternal": true }, { - "__docId__": 78, + "__docId__": 80, "kind": "external", "static": true, "variation": null, @@ -1494,7 +1540,7 @@ "builtinExternal": true }, { - "__docId__": 79, + "__docId__": 81, "kind": "external", "static": true, "variation": null, @@ -1507,7 +1553,7 @@ "builtinExternal": true }, { - "__docId__": 80, + "__docId__": 82, "kind": "external", "static": true, "variation": null, @@ -1520,7 +1566,7 @@ "builtinExternal": true }, { - "__docId__": 81, + "__docId__": 83, "kind": "external", "static": true, "variation": null, @@ -1533,7 +1579,7 @@ "builtinExternal": true }, { - "__docId__": 82, + "__docId__": 84, "kind": "external", "static": true, "variation": null, @@ -1546,7 +1592,7 @@ "builtinExternal": true }, { - "__docId__": 83, + "__docId__": 85, "kind": "external", "static": true, "variation": null, @@ -1559,7 +1605,7 @@ "builtinExternal": true }, { - "__docId__": 84, + "__docId__": 86, "kind": "external", "static": true, "variation": null, @@ -1572,7 +1618,7 @@ "builtinExternal": true }, { - "__docId__": 85, + "__docId__": 87, "kind": "external", "static": true, "variation": null, @@ -1585,7 +1631,7 @@ "builtinExternal": true }, { - "__docId__": 86, + "__docId__": 88, "kind": "external", "static": true, "variation": null, @@ -1598,7 +1644,7 @@ "builtinExternal": true }, { - "__docId__": 87, + "__docId__": 89, "kind": "external", "static": true, "variation": null, @@ -1611,7 +1657,7 @@ "builtinExternal": true }, { - "__docId__": 88, + "__docId__": 90, "kind": "external", "static": true, "variation": null, @@ -1624,7 +1670,7 @@ "builtinExternal": true }, { - "__docId__": 89, + "__docId__": 91, "kind": "external", "static": true, "variation": null, @@ -1637,7 +1683,7 @@ "builtinExternal": true }, { - "__docId__": 90, + "__docId__": 92, "kind": "external", "static": true, "variation": null, @@ -1650,7 +1696,7 @@ "builtinExternal": true }, { - "__docId__": 91, + "__docId__": 93, "kind": "external", "static": true, "variation": null, @@ -1663,7 +1709,7 @@ "builtinExternal": true }, { - "__docId__": 92, + "__docId__": 94, "kind": "external", "static": true, "variation": null, @@ -1676,7 +1722,7 @@ "builtinExternal": true }, { - "__docId__": 93, + "__docId__": 95, "kind": "external", "static": true, "variation": null, @@ -1689,7 +1735,7 @@ "builtinExternal": true }, { - "__docId__": 94, + "__docId__": 96, "kind": "external", "static": true, "variation": null, @@ -1702,7 +1748,7 @@ "builtinExternal": true }, { - "__docId__": 95, + "__docId__": 97, "kind": "external", "static": true, "variation": null, @@ -1715,7 +1761,7 @@ "builtinExternal": true }, { - "__docId__": 96, + "__docId__": 98, "kind": "external", "static": true, "variation": null, @@ -1728,7 +1774,7 @@ "builtinExternal": true }, { - "__docId__": 97, + "__docId__": 99, "kind": "external", "static": true, "variation": null, @@ -1741,7 +1787,7 @@ "builtinExternal": true }, { - "__docId__": 98, + "__docId__": 100, "kind": "external", "static": true, "variation": null, @@ -1754,7 +1800,7 @@ "builtinExternal": true }, { - "__docId__": 99, + "__docId__": 101, "kind": "external", "static": true, "variation": null, @@ -1767,7 +1813,7 @@ "builtinExternal": true }, { - "__docId__": 100, + "__docId__": 102, "kind": "external", "static": true, "variation": null, @@ -1780,7 +1826,7 @@ "builtinExternal": true }, { - "__docId__": 101, + "__docId__": 103, "kind": "external", "static": true, "variation": null, @@ -1793,7 +1839,7 @@ "builtinExternal": true }, { - "__docId__": 102, + "__docId__": 104, "kind": "external", "static": true, "variation": null, @@ -1806,7 +1852,7 @@ "builtinExternal": true }, { - "__docId__": 103, + "__docId__": 105, "kind": "external", "static": true, "variation": null, @@ -1819,7 +1865,7 @@ "builtinExternal": true }, { - "__docId__": 104, + "__docId__": 106, "kind": "external", "static": true, "variation": null, @@ -1832,7 +1878,7 @@ "builtinExternal": true }, { - "__docId__": 105, + "__docId__": 107, "kind": "external", "static": true, "variation": null, @@ -1845,7 +1891,7 @@ "builtinExternal": true }, { - "__docId__": 106, + "__docId__": 108, "kind": "external", "static": true, "variation": null, @@ -1858,7 +1904,7 @@ "builtinExternal": true }, { - "__docId__": 107, + "__docId__": 109, "kind": "external", "static": true, "variation": null, @@ -1871,7 +1917,7 @@ "builtinExternal": true }, { - "__docId__": 108, + "__docId__": 110, "kind": "external", "static": true, "variation": null, @@ -1884,7 +1930,7 @@ "builtinExternal": true }, { - "__docId__": 109, + "__docId__": 111, "kind": "external", "static": true, "variation": null, @@ -1897,7 +1943,7 @@ "builtinExternal": true }, { - "__docId__": 110, + "__docId__": 112, "kind": "external", "static": true, "variation": null, @@ -1910,7 +1956,7 @@ "builtinExternal": true }, { - "__docId__": 111, + "__docId__": 113, "kind": "external", "static": true, "variation": null, @@ -1923,7 +1969,7 @@ "builtinExternal": true }, { - "__docId__": 112, + "__docId__": 114, "kind": "external", "static": true, "variation": null, @@ -1936,7 +1982,7 @@ "builtinExternal": true }, { - "__docId__": 113, + "__docId__": 115, "kind": "external", "static": true, "variation": null, @@ -1949,7 +1995,7 @@ "builtinExternal": true }, { - "__docId__": 114, + "__docId__": 116, "kind": "external", "static": true, "variation": null, @@ -1962,7 +2008,7 @@ "builtinExternal": true }, { - "__docId__": 115, + "__docId__": 117, "kind": "external", "static": true, "variation": null, @@ -1975,7 +2021,7 @@ "builtinExternal": true }, { - "__docId__": 116, + "__docId__": 118, "kind": "external", "static": true, "variation": null, @@ -1988,7 +2034,7 @@ "builtinExternal": true }, { - "__docId__": 117, + "__docId__": 119, "kind": "external", "static": true, "variation": null, @@ -2001,7 +2047,7 @@ "builtinExternal": true }, { - "__docId__": 118, + "__docId__": 120, "kind": "external", "static": true, "variation": null, @@ -2014,7 +2060,7 @@ "builtinExternal": true }, { - "__docId__": 119, + "__docId__": 121, "kind": "external", "static": true, "variation": null, @@ -2027,7 +2073,7 @@ "builtinExternal": true }, { - "__docId__": 121, + "__docId__": 123, "kind": "external", "static": true, "variation": null, @@ -2040,7 +2086,7 @@ "builtinExternal": true }, { - "__docId__": 122, + "__docId__": 124, "kind": "external", "static": true, "variation": null, @@ -2053,7 +2099,7 @@ "builtinExternal": true }, { - "__docId__": 123, + "__docId__": 125, "kind": "external", "static": true, "variation": null, @@ -2066,7 +2112,7 @@ "builtinExternal": true }, { - "__docId__": 124, + "__docId__": 126, "kind": "external", "static": true, "variation": null, @@ -2079,7 +2125,7 @@ "builtinExternal": true }, { - "__docId__": 125, + "__docId__": 127, "kind": "external", "static": true, "variation": null, @@ -2092,7 +2138,7 @@ "builtinExternal": true }, { - "__docId__": 126, + "__docId__": 128, "kind": "external", "static": true, "variation": null, @@ -2105,7 +2151,7 @@ "builtinExternal": true }, { - "__docId__": 127, + "__docId__": 129, "kind": "external", "static": true, "variation": null, @@ -2118,7 +2164,7 @@ "builtinExternal": true }, { - "__docId__": 128, + "__docId__": 130, "kind": "external", "static": true, "variation": null, diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/adt/RedBlackTree.js.html index f0a562b..7eff548 100644 --- a/file/src/adt/RedBlackTree.js.html +++ b/file/src/adt/RedBlackTree.js.html @@ -35,19 +35,19 @@
    • CRedBlackTree
    • -
    • Ffind
    • -
    • Fgrandparent
    • +
    • Fdebug
    • +
    • Ffind
    • Finordertraversal
    • Finsert
    • -
    • Fpredecessor
    • Freplace_node
    • Frotate_left
    • Frotate_right
    • -
    • Fsibling
    • -
    • Fsuccessor
    • -
    • Funcle
    • VBLACK
    • VRED
    • +
    • Fgrandparent
    • +
    • Fpredecessor
    • +
    • Fsibling
    • +
    • Funcle
    • Finsert_case1
    • Finsert_case2
    • Finsert_case3
    • @@ -70,7 +70,7 @@
      
       import { Node } from '..' ;
       import { RED , BLACK } from '..' ;
      -import { predecessor , successor } from '..' ;
      +import { predecessor } from '..' ;
       import { insert , insert_case2 } from '..' ;
       import { delete_one_child } from '..' ;
       import { find } from '..' ;
      @@ -118,18 +118,24 @@
       
       		else if ( !node.right.isleaf() ) {
       			// replace node's value with successor's value
      -			const succ = successor( node ) ;
      +			// If there is no left child, then there can only be one right
      +			// child.
      +			const succ = node.right ;
       			node.value = succ.value ;
       			// delete successor node
       			// note: this node can only have one non-leaf child
       			//       because the tree is a red-black tree
      -			delete_one_child( pred ) ;
      +			delete_one_child( succ ) ;
       		}
       
      -		else {
      +		else if ( node === this.root ) {
       			this.root = null ;
       		}
       
      +		else {
      +			delete_one_child( node ) ;
      +		}
      +
       	}
       
       	*[Symbol.iterator] ( ) {
      @@ -138,6 +144,16 @@
       
       	}
       
      +	static from ( compare , iterable ) {
      +
      +		const tree = new RedBlackTree( compare ) ;
      +
      +		for ( const element of iterable ) tree.add( element ) ;
      +
      +		return tree ;
      +
      +	}
      +
       }
       
      diff --git a/file/src/adt/index.js.html b/file/src/adt/index.js.html index 5b65e6f..c652a62 100644 --- a/file/src/adt/index.js.html +++ b/file/src/adt/index.js.html @@ -35,19 +35,19 @@
      • CRedBlackTree
      • -
      • Ffind
      • -
      • Fgrandparent
      • +
      • Fdebug
      • +
      • Ffind
      • Finordertraversal
      • Finsert
      • -
      • Fpredecessor
      • Freplace_node
      • Frotate_left
      • Frotate_right
      • -
      • Fsibling
      • -
      • Fsuccessor
      • -
      • Funcle
      • VBLACK
      • VRED
      • +
      • Fgrandparent
      • +
      • Fpredecessor
      • +
      • Fsibling
      • +
      • Funcle
      • Finsert_case1
      • Finsert_case2
      • Finsert_case3
      • diff --git a/file/src/base/colors.js.html b/file/src/base/colors.js.html index 881afac..b484edd 100644 --- a/file/src/base/colors.js.html +++ b/file/src/base/colors.js.html @@ -35,19 +35,19 @@
        • CRedBlackTree
        • -
        • Ffind
        • -
        • Fgrandparent
        • +
        • Fdebug
        • +
        • Ffind
        • Finordertraversal
        • Finsert
        • -
        • Fpredecessor
        • Freplace_node
        • Frotate_left
        • Frotate_right
        • -
        • Fsibling
        • -
        • Fsuccessor
        • -
        • Funcle
        • VBLACK
        • VRED
        • +
        • Fgrandparent
        • +
        • Fpredecessor
        • +
        • Fsibling
        • +
        • Funcle
        • Finsert_case1
        • Finsert_case2
        • Finsert_case3
        • diff --git a/file/src/base/debug.js.html b/file/src/base/debug.js.html new file mode 100644 index 0000000..b62814f --- /dev/null +++ b/file/src/base/debug.js.html @@ -0,0 +1,100 @@ + + + + + + src/base/debug.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
          + Home + Manual + Reference + Source + Test + Repository + +
          + + + +

          src/base/debug.js

          +
          
          +import { BLACK } from './colors' ;
          +
          +import chalk from 'chalk' ;
          +
          +export function debug ( node ) {
          +
          +	if ( node.isleaf( ) ) return chalk.bgBlack('L') ;
          +
          +	const repr = node.color === BLACK ? chalk.bgBlack(node.value) : chalk.bgRed( node.value ) ;
          +
          +	return `(${debug(node.left)}, ${repr}, ${debug(node.right)})` ;
          +
          +}
          +
          + +
          + + + + + + + + + + + + diff --git a/file/src/base/find.js.html b/file/src/base/find.js.html index 4799a09..307a2fa 100644 --- a/file/src/base/find.js.html +++ b/file/src/base/find.js.html @@ -35,19 +35,19 @@
          • CRedBlackTree
          • -
          • Ffind
          • -
          • Fgrandparent
          • +
          • Fdebug
          • +
          • Ffind
          • Finordertraversal
          • Finsert
          • -
          • Fpredecessor
          • Freplace_node
          • Frotate_left
          • Frotate_right
          • -
          • Fsibling
          • -
          • Fsuccessor
          • -
          • Funcle
          • VBLACK
          • VRED
          • +
          • Fgrandparent
          • +
          • Fpredecessor
          • +
          • Fsibling
          • +
          • Funcle
          • Finsert_case1
          • Finsert_case2
          • Finsert_case3
          • diff --git a/file/src/base/index.js.html b/file/src/base/index.js.html index e777707..dd269c8 100644 --- a/file/src/base/index.js.html +++ b/file/src/base/index.js.html @@ -35,19 +35,19 @@
            • CRedBlackTree
            • -
            • Ffind
            • -
            • Fgrandparent
            • +
            • Fdebug
            • +
            • Ffind
            • Finordertraversal
            • Finsert
            • -
            • Fpredecessor
            • Freplace_node
            • Frotate_left
            • Frotate_right
            • -
            • Fsibling
            • -
            • Fsuccessor
            • -
            • Funcle
            • VBLACK
            • VRED
            • +
            • Fgrandparent
            • +
            • Fpredecessor
            • +
            • Fsibling
            • +
            • Funcle
            • Finsert_case1
            • Finsert_case2
            • Finsert_case3
            • @@ -68,17 +68,13 @@

              src/base/index.js

              export * from './colors' ;
              +export * from './debug' ;
               export * from './find' ;
              -export * from './grandparent' ;
               export * from './inordertraversal' ;
               export * from './insert' ;
              -export * from './predecessor' ;
               export * from './replace_node' ;
               export * from './rotate_left' ;
               export * from './rotate_right' ;
              -export * from './sibling' ;
              -export * from './successor' ;
              -export * from './uncle' ;
               
              diff --git a/file/src/base/inordertraversal.js.html b/file/src/base/inordertraversal.js.html index cdf02da..85d235a 100644 --- a/file/src/base/inordertraversal.js.html +++ b/file/src/base/inordertraversal.js.html @@ -35,19 +35,19 @@
              • CRedBlackTree
              • -
              • Ffind
              • -
              • Fgrandparent
              • +
              • Fdebug
              • +
              • Ffind
              • Finordertraversal
              • Finsert
              • -
              • Fpredecessor
              • Freplace_node
              • Frotate_left
              • Frotate_right
              • -
              • Fsibling
              • -
              • Fsuccessor
              • -
              • Funcle
              • VBLACK
              • VRED
              • +
              • Fgrandparent
              • +
              • Fpredecessor
              • +
              • Fsibling
              • +
              • Funcle
              • Finsert_case1
              • Finsert_case2
              • Finsert_case3
              • diff --git a/file/src/base/insert.js.html b/file/src/base/insert.js.html index 3eb69c1..f5ddfa5 100644 --- a/file/src/base/insert.js.html +++ b/file/src/base/insert.js.html @@ -35,19 +35,19 @@
                • CRedBlackTree
                • -
                • Ffind
                • -
                • Fgrandparent
                • +
                • Fdebug
                • +
                • Ffind
                • Finordertraversal
                • Finsert
                • -
                • Fpredecessor
                • Freplace_node
                • Frotate_left
                • Frotate_right
                • -
                • Fsibling
                • -
                • Fsuccessor
                • -
                • Funcle
                • VBLACK
                • VRED
                • +
                • Fgrandparent
                • +
                • Fpredecessor
                • +
                • Fsibling
                • +
                • Funcle
                • Finsert_case1
                • Finsert_case2
                • Finsert_case3
                • diff --git a/file/src/base/replace_node.js.html b/file/src/base/replace_node.js.html index e84dc9a..e13638b 100644 --- a/file/src/base/replace_node.js.html +++ b/file/src/base/replace_node.js.html @@ -35,19 +35,19 @@
                  • CRedBlackTree
                  • -
                  • Ffind
                  • -
                  • Fgrandparent
                  • +
                  • Fdebug
                  • +
                  • Ffind
                  • Finordertraversal
                  • Finsert
                  • -
                  • Fpredecessor
                  • Freplace_node
                  • Frotate_left
                  • Frotate_right
                  • -
                  • Fsibling
                  • -
                  • Fsuccessor
                  • -
                  • Funcle
                  • VBLACK
                  • VRED
                  • +
                  • Fgrandparent
                  • +
                  • Fpredecessor
                  • +
                  • Fsibling
                  • +
                  • Funcle
                  • Finsert_case1
                  • Finsert_case2
                  • Finsert_case3
                  • @@ -67,18 +67,17 @@

                    src/base/replace_node.js

                    -
                    
                    -export function replace_node ( A , B ) {
                    -	if ( A.parent === null ) {
                    -		// nothing to do
                    -	}
                    -	else if ( A === A.parent.left ) {
                    -		A.parent.left = B ;
                    -	}
                    -	else {
                    -		A.parent.right = B ;
                    -	}
                    +
                    export function replace_node ( A , B ) {
                    +
                    +	// assert( A.parent !== null ) ;
                    +	// we never apply delete_one_child on the root so we are safe
                    +
                    +	if ( A === A.parent.left ) A.parent.left = B ;
                    +
                    +	else A.parent.right = B ;
                    +
                     	B.parent = A.parent ;
                    +
                     }
                     
                    diff --git a/file/src/base/rotate_left.js.html b/file/src/base/rotate_left.js.html index e5da6cf..70c6887 100644 --- a/file/src/base/rotate_left.js.html +++ b/file/src/base/rotate_left.js.html @@ -35,19 +35,19 @@
                    -

                    src/base/grandparent.js

                    -
                    export function grandparent( n ){
                    - if ((n !== null) && (n.parent !== null))
                    -  return n.parent.parent;
                    - else
                    -  return null;
                    +

                    src/family/grandparent.js

                    +
                    export function grandparent ( n ) {
                    +
                    +	//assert((n !== null) && (n.parent !== null));
                    +	//We only call this function when n HAS a grandparent
                    +	return n.parent.parent;
                    +
                     }
                     
                    diff --git a/file/src/base/successor.js.html b/file/src/family/index.js.html similarity index 91% rename from file/src/base/successor.js.html rename to file/src/family/index.js.html index cdb1c3e..9e31362 100644 --- a/file/src/base/successor.js.html +++ b/file/src/family/index.js.html @@ -3,7 +3,7 @@ - src/base/successor.js | aureooms/es-red-black-tree API Document + src/family/index.js | aureooms/es-red-black-tree API Document @@ -35,19 +35,19 @@
                    -

                    src/base/successor.js

                    -
                    export function successor ( node ) {
                    -
                    -	var succ = node.right ;
                    -
                    -	while ( !succ.left.isleaf() ) succ = succ.left ;
                    -
                    -	return succ ;
                    -
                    -}
                    +

                    src/family/index.js

                    +
                    export * from './grandparent' ;
                    +export * from './predecessor' ;
                    +export * from './sibling' ;
                    +export * from './uncle' ;
                     
                    diff --git a/file/src/base/predecessor.js.html b/file/src/family/predecessor.js.html similarity index 93% rename from file/src/base/predecessor.js.html rename to file/src/family/predecessor.js.html index 08045f3..d577a98 100644 --- a/file/src/base/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -3,7 +3,7 @@ - src/base/predecessor.js | aureooms/es-red-black-tree API Document + src/family/predecessor.js | aureooms/es-red-black-tree API Document @@ -35,19 +35,19 @@
                    -

                    src/base/predecessor.js

                    +

                    src/family/predecessor.js

                    export function predecessor ( node ) {
                     
                     	var pred = node.left ;
                    diff --git a/file/src/base/sibling.js.html b/file/src/family/sibling.js.html
                    similarity index 91%
                    rename from file/src/base/sibling.js.html
                    rename to file/src/family/sibling.js.html
                    index 078062d..3e4d168 100644
                    --- a/file/src/base/sibling.js.html
                    +++ b/file/src/family/sibling.js.html
                    @@ -3,7 +3,7 @@
                     
                       
                       
                    -  src/base/sibling.js | aureooms/es-red-black-tree API Document
                    +  src/family/sibling.js | aureooms/es-red-black-tree API Document
                       
                       
                       
                    @@ -35,19 +35,19 @@
                       
                    -

                    src/base/sibling.js

                    -
                    export function sibling(n)
                    -{
                    - if ((n === null) || (n.parent === null))
                    -  return null; // no parent means no sibling
                    - if (n === n.parent.left)
                    -  return n.parent.right;
                    - else
                    -  return n.parent.left;
                    +

                    src/family/sibling.js

                    +
                    export function sibling ( n ) {
                    +
                    +	//assert((n !== null) && (n.parent !== null));
                    +	//We only use this function when n HAS a sibling so this case can never
                    +	//happen.
                    +
                    +	return  n === n.parent.left ? n.parent.right : n.parent.left ;
                    +
                     }
                     
                    diff --git a/file/src/base/uncle.js.html b/file/src/family/uncle.js.html similarity index 91% rename from file/src/base/uncle.js.html rename to file/src/family/uncle.js.html index ff07a5b..879de63 100644 --- a/file/src/base/uncle.js.html +++ b/file/src/family/uncle.js.html @@ -3,7 +3,7 @@ - src/base/uncle.js | aureooms/es-red-black-tree API Document + src/family/uncle.js | aureooms/es-red-black-tree API Document @@ -35,19 +35,19 @@
                    -

                    src/base/uncle.js

                    +

                    src/family/uncle.js

                    import { grandparent } from './grandparent' ;
                     
                    -export function uncle(n){
                    - const g = grandparent(n);
                    - if (g === null)
                    -  return null; // No grandparent means no uncle
                    - if (n.parent === g.left)
                    -  return g.right.isleaf() ? null : g.right ;
                    - else
                    -  return g.left.isleaf() ? null : g.left;
                    +export function uncle ( n ) {
                    +	const g = grandparent( n );
                    +	// assert( g !== null ) ;
                    +	// this can never happen
                    +	if ( n.parent === g.left )
                    +	  return g.right.isleaf( ) ? null : g.right ;
                    +	else
                    +	  return g.left.isleaf( ) ? null : g.left ;
                     }
                     
                    diff --git a/file/src/index.js.html b/file/src/index.js.html index a475fa0..cb82c6c 100644 --- a/file/src/index.js.html +++ b/file/src/index.js.html @@ -35,19 +35,19 @@
                    • CRedBlackTree
                    • -
                    • Ffind
                    • -
                    • Fgrandparent
                    • +
                    • Fdebug
                    • +
                    • Ffind
                    • Finordertraversal
                    • Finsert
                    • -
                    • Fpredecessor
                    • Freplace_node
                    • Frotate_left
                    • Frotate_right
                    • -
                    • Fsibling
                    • -
                    • Fsuccessor
                    • -
                    • Funcle
                    • VBLACK
                    • VRED
                    • +
                    • Fgrandparent
                    • +
                    • Fpredecessor
                    • +
                    • Fsibling
                    • +
                    • Funcle
                    • Finsert_case1
                    • Finsert_case2
                    • Finsert_case3
                    • @@ -69,6 +69,7 @@

                      src/index.js

                      export * from './adt' ;
                       export * from './base' ;
                      +export * from './family' ;
                       export * from './insertion' ;
                       export * from './node' ;
                       export * from './removal' ;
                      diff --git a/file/src/insertion/index.js.html b/file/src/insertion/index.js.html
                      index d754cfc..72a7533 100644
                      --- a/file/src/insertion/index.js.html
                      +++ b/file/src/insertion/index.js.html
                      @@ -35,19 +35,19 @@
                         
                      • CRedBlackTree
                      • -
                      • Ffind
                      • -
                      • Fgrandparent
                      • +
                      • Fdebug
                      • +
                      • Ffind
                      • Finordertraversal
                      • Finsert
                      • -
                      • Fpredecessor
                      • Freplace_node
                      • Frotate_left
                      • Frotate_right
                      • -
                      • Fsibling
                      • -
                      • Fsuccessor
                      • -
                      • Funcle
                      • VBLACK
                      • VRED
                      • +
                      • Fgrandparent
                      • +
                      • Fpredecessor
                      • +
                      • Fsibling
                      • +
                      • Funcle
                      • Finsert_case1
                      • Finsert_case2
                      • Finsert_case3
                      • diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html index 73df6f3..06d7bb3 100644 --- a/file/src/insertion/insert_case1.js.html +++ b/file/src/insertion/insert_case1.js.html @@ -35,19 +35,19 @@
                        • CRedBlackTree
                        • -
                        • Ffind
                        • -
                        • Fgrandparent
                        • +
                        • Fdebug
                        • +
                        • Ffind
                        • Finordertraversal
                        • Finsert
                        • -
                        • Fpredecessor
                        • Freplace_node
                        • Frotate_left
                        • Frotate_right
                        • -
                        • Fsibling
                        • -
                        • Fsuccessor
                        • -
                        • Funcle
                        • VBLACK
                        • VRED
                        • +
                        • Fgrandparent
                        • +
                        • Fpredecessor
                        • +
                        • Fsibling
                        • +
                        • Funcle
                        • Finsert_case1
                        • Finsert_case2
                        • Finsert_case3
                        • diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index 7078a9a..b26e22a 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -35,19 +35,19 @@
                          • CRedBlackTree
                          • -
                          • Ffind
                          • -
                          • Fgrandparent
                          • +
                          • Fdebug
                          • +
                          • Ffind
                          • Finordertraversal
                          • Finsert
                          • -
                          • Fpredecessor
                          • Freplace_node
                          • Frotate_left
                          • Frotate_right
                          • -
                          • Fsibling
                          • -
                          • Fsuccessor
                          • -
                          • Funcle
                          • VBLACK
                          • VRED
                          • +
                          • Fgrandparent
                          • +
                          • Fpredecessor
                          • +
                          • Fsibling
                          • +
                          • Funcle
                          • Finsert_case1
                          • Finsert_case2
                          • Finsert_case3
                          • diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index 6b136d4..c28d9f7 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -35,19 +35,19 @@
                            • CRedBlackTree
                            • -
                            • Ffind
                            • -
                            • Fgrandparent
                            • +
                            • Fdebug
                            • +
                            • Ffind
                            • Finordertraversal
                            • Finsert
                            • -
                            • Fpredecessor
                            • Freplace_node
                            • Frotate_left
                            • Frotate_right
                            • -
                            • Fsibling
                            • -
                            • Fsuccessor
                            • -
                            • Funcle
                            • VBLACK
                            • VRED
                            • +
                            • Fgrandparent
                            • +
                            • Fpredecessor
                            • +
                            • Fsibling
                            • +
                            • Funcle
                            • Finsert_case1
                            • Finsert_case2
                            • Finsert_case3
                            • diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index acef865..69a5331 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -35,19 +35,19 @@
                              • CRedBlackTree
                              • -
                              • Ffind
                              • -
                              • Fgrandparent
                              • +
                              • Fdebug
                              • +
                              • Ffind
                              • Finordertraversal
                              • Finsert
                              • -
                              • Fpredecessor
                              • Freplace_node
                              • Frotate_left
                              • Frotate_right
                              • -
                              • Fsibling
                              • -
                              • Fsuccessor
                              • -
                              • Funcle
                              • VBLACK
                              • VRED
                              • +
                              • Fgrandparent
                              • +
                              • Fpredecessor
                              • +
                              • Fsibling
                              • +
                              • Funcle
                              • Finsert_case1
                              • Finsert_case2
                              • Finsert_case3
                              • @@ -89,7 +89,7 @@ * and modify the parent's nodes properly */ - n = n.left; + //n = n.left; /!\ need to fix rotate, so that we can safely reference a node } else if ((n === n.parent.left) && (n.parent === g.right)) { rotate_right(n.parent); @@ -104,7 +104,7 @@ * */ - n = n.right; + //n = n.right; } insert_case5(n); } diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case5.js.html index d33bd88..35ab9ff 100644 --- a/file/src/insertion/insert_case5.js.html +++ b/file/src/insertion/insert_case5.js.html @@ -35,19 +35,19 @@
                                • CRedBlackTree
                                • -
                                • Ffind
                                • -
                                • Fgrandparent
                                • +
                                • Fdebug
                                • +
                                • Ffind
                                • Finordertraversal
                                • Finsert
                                • -
                                • Fpredecessor
                                • Freplace_node
                                • Frotate_left
                                • Frotate_right
                                • -
                                • Fsibling
                                • -
                                • Fsuccessor
                                • -
                                • Funcle
                                • VBLACK
                                • VRED
                                • +
                                • Fgrandparent
                                • +
                                • Fpredecessor
                                • +
                                • Fsibling
                                • +
                                • Funcle
                                • Finsert_case1
                                • Finsert_case2
                                • Finsert_case3
                                • diff --git a/file/src/node/Leaf.js.html b/file/src/node/Leaf.js.html index 52d292b..8e57cc9 100644 --- a/file/src/node/Leaf.js.html +++ b/file/src/node/Leaf.js.html @@ -35,19 +35,19 @@
                                  • CRedBlackTree
                                  • -
                                  • Ffind
                                  • -
                                  • Fgrandparent
                                  • +
                                  • Fdebug
                                  • +
                                  • Ffind
                                  • Finordertraversal
                                  • Finsert
                                  • -
                                  • Fpredecessor
                                  • Freplace_node
                                  • Frotate_left
                                  • Frotate_right
                                  • -
                                  • Fsibling
                                  • -
                                  • Fsuccessor
                                  • -
                                  • Funcle
                                  • VBLACK
                                  • VRED
                                  • +
                                  • Fgrandparent
                                  • +
                                  • Fpredecessor
                                  • +
                                  • Fsibling
                                  • +
                                  • Funcle
                                  • Finsert_case1
                                  • Finsert_case2
                                  • Finsert_case3
                                  • diff --git a/file/src/node/Node.js.html b/file/src/node/Node.js.html index f09a0cf..bf3a25a 100644 --- a/file/src/node/Node.js.html +++ b/file/src/node/Node.js.html @@ -35,19 +35,19 @@
                                    • CRedBlackTree
                                    • -
                                    • Ffind
                                    • -
                                    • Fgrandparent
                                    • +
                                    • Fdebug
                                    • +
                                    • Ffind
                                    • Finordertraversal
                                    • Finsert
                                    • -
                                    • Fpredecessor
                                    • Freplace_node
                                    • Frotate_left
                                    • Frotate_right
                                    • -
                                    • Fsibling
                                    • -
                                    • Fsuccessor
                                    • -
                                    • Funcle
                                    • VBLACK
                                    • VRED
                                    • +
                                    • Fgrandparent
                                    • +
                                    • Fpredecessor
                                    • +
                                    • Fsibling
                                    • +
                                    • Funcle
                                    • Finsert_case1
                                    • Finsert_case2
                                    • Finsert_case3
                                    • diff --git a/file/src/node/index.js.html b/file/src/node/index.js.html index 229e2ad..31c813e 100644 --- a/file/src/node/index.js.html +++ b/file/src/node/index.js.html @@ -35,19 +35,19 @@
                                      • CRedBlackTree
                                      • -
                                      • Ffind
                                      • -
                                      • Fgrandparent
                                      • +
                                      • Fdebug
                                      • +
                                      • Ffind
                                      • Finordertraversal
                                      • Finsert
                                      • -
                                      • Fpredecessor
                                      • Freplace_node
                                      • Frotate_left
                                      • Frotate_right
                                      • -
                                      • Fsibling
                                      • -
                                      • Fsuccessor
                                      • -
                                      • Funcle
                                      • VBLACK
                                      • VRED
                                      • +
                                      • Fgrandparent
                                      • +
                                      • Fpredecessor
                                      • +
                                      • Fsibling
                                      • +
                                      • Funcle
                                      • Finsert_case1
                                      • Finsert_case2
                                      • Finsert_case3
                                      • diff --git a/file/src/removal/delete_case1.js.html b/file/src/removal/delete_case1.js.html index 7559cc6..df79d0c 100644 --- a/file/src/removal/delete_case1.js.html +++ b/file/src/removal/delete_case1.js.html @@ -35,19 +35,19 @@
                                        • CRedBlackTree
                                        • -
                                        • Ffind
                                        • -
                                        • Fgrandparent
                                        • +
                                        • Fdebug
                                        • +
                                        • Ffind
                                        • Finordertraversal
                                        • Finsert
                                        • -
                                        • Fpredecessor
                                        • Freplace_node
                                        • Frotate_left
                                        • Frotate_right
                                        • -
                                        • Fsibling
                                        • -
                                        • Fsuccessor
                                        • -
                                        • Funcle
                                        • VBLACK
                                        • VRED
                                        • +
                                        • Fgrandparent
                                        • +
                                        • Fpredecessor
                                        • +
                                        • Fsibling
                                        • +
                                        • Funcle
                                        • Finsert_case1
                                        • Finsert_case2
                                        • Finsert_case3
                                        • @@ -70,6 +70,8 @@
                                          
                                           import { delete_case2 } from './delete_case2' ;
                                           
                                          +import assert from 'assert' ;
                                          +
                                           export function delete_case1(n)
                                           {
                                            if (n.parent !== null)
                                          diff --git a/file/src/removal/delete_case2.js.html b/file/src/removal/delete_case2.js.html
                                          index 9f2449f..a0a3b33 100644
                                          --- a/file/src/removal/delete_case2.js.html
                                          +++ b/file/src/removal/delete_case2.js.html
                                          @@ -35,19 +35,19 @@
                                             
                                          • CRedBlackTree
                                          • -
                                          • Ffind
                                          • -
                                          • Fgrandparent
                                          • +
                                          • Fdebug
                                          • +
                                          • Ffind
                                          • Finordertraversal
                                          • Finsert
                                          • -
                                          • Fpredecessor
                                          • Freplace_node
                                          • Frotate_left
                                          • Frotate_right
                                          • -
                                          • Fsibling
                                          • -
                                          • Fsuccessor
                                          • -
                                          • Funcle
                                          • VBLACK
                                          • VRED
                                          • +
                                          • Fgrandparent
                                          • +
                                          • Fpredecessor
                                          • +
                                          • Fsibling
                                          • +
                                          • Funcle
                                          • Finsert_case1
                                          • Finsert_case2
                                          • Finsert_case3
                                          • @@ -67,7 +67,7 @@

                                            src/removal/delete_case2.js

                                            -
                                            import { BLACK , RED , rotate_left , rotate_right } from '..' ;
                                            +
                                            import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;
                                             
                                             import { delete_case3 } from './delete_case3' ;
                                             
                                            diff --git a/file/src/removal/delete_case3.js.html b/file/src/removal/delete_case3.js.html
                                            index 6b9ed65..b75a2bd 100644
                                            --- a/file/src/removal/delete_case3.js.html
                                            +++ b/file/src/removal/delete_case3.js.html
                                            @@ -35,19 +35,19 @@
                                               
                                            diff --git a/file/src/removal/delete_case4.js.html b/file/src/removal/delete_case4.js.html index 377c50f..98212d2 100644 --- a/file/src/removal/delete_case4.js.html +++ b/file/src/removal/delete_case4.js.html @@ -35,19 +35,19 @@
                                            diff --git a/file/src/removal/index.js.html b/file/src/removal/index.js.html index ab2a847..0cd0659 100644 --- a/file/src/removal/index.js.html +++ b/file/src/removal/index.js.html @@ -35,19 +35,19 @@
                                            +
                                            +

                                            + public + + + + + debug(node: *): string + + + + source + +

                                            + + + + + + + + +
                                            +

                                            Params:

                                            + + + + + + + + + + + + + +
                                            NameTypeAttributeDescription
                                            node*
                                            +
                                            +
                                            + +
                                            +

                                            Return:

                                            + + + + + +
                                            string
                                            +
                                            +
                                            +
                                            + + + + + + + + + + + + +

                                            @@ -832,11 +898,11 @@

                                            - source + source

                                            - + @@ -1302,11 +1368,11 @@

                                            - source + source

                                            - + @@ -1782,11 +1848,11 @@

                                            - source + source

                                            - + @@ -1848,11 +1914,11 @@

                                            - source + source

                                            - + @@ -2038,11 +2104,11 @@

                                            - source + source

                                            - + @@ -2092,72 +2158,6 @@

                                            Return:

                                            -
                                            -
                                            -

                                            - public - - - - - successor(node: *): * - - - - source - -

                                            - - - - - - - - -
                                            -

                                            Params:

                                            - - - - - - - - - - - - - -
                                            NameTypeAttributeDescription
                                            node*
                                            -
                                            -
                                            - -
                                            -

                                            Return:

                                            - - - - - -
                                            *
                                            -
                                            -
                                            -
                                            - - - - - - - - - - - - -

                                            @@ -2170,11 +2170,11 @@

                                            - source + source

                                            - + diff --git a/identifiers.html b/identifiers.html index 37e8038..ce49b00 100644 --- a/identifiers.html +++ b/identifiers.html @@ -35,19 +35,19 @@
                                            • CRedBlackTree
                                            • -
                                            • Ffind
                                            • -
                                            • Fgrandparent
                                            • +
                                            • Fdebug
                                            • +
                                            • Ffind
                                            • Finordertraversal
                                            • Finsert
                                            • -
                                            • Fpredecessor
                                            • Freplace_node
                                            • Frotate_left
                                            • Frotate_right
                                            • -
                                            • Fsibling
                                            • -
                                            • Fsuccessor
                                            • -
                                            • Funcle
                                            • VBLACK
                                            • VRED
                                            • +
                                            • Fgrandparent
                                            • +
                                            • Fpredecessor
                                            • +
                                            • Fsibling
                                            • +
                                            • Funcle
                                            • Finsert_case1
                                            • Finsert_case2
                                            • Finsert_case3
                                            • @@ -160,6 +160,31 @@ + + + +
                                              +

                                              + debug(node: *): string +

                                              +
                                              +
                                              + + + +
                                              + + + + + + + + + public + + + @@ -687,31 +712,6 @@ - - - -
                                              -

                                              - successor(node: *): * -

                                              -
                                              -
                                              - - - -
                                              - - - - - - - - - public - - - diff --git a/index.html b/index.html index 839e6f3..affb5b2 100644 --- a/index.html +++ b/index.html @@ -35,19 +35,19 @@
                                              • CRedBlackTree
                                              • -
                                              • Ffind
                                              • -
                                              • Fgrandparent
                                              • +
                                              • Fdebug
                                              • +
                                              • Ffind
                                              • Finordertraversal
                                              • Finsert
                                              • -
                                              • Fpredecessor
                                              • Freplace_node
                                              • Frotate_left
                                              • Frotate_right
                                              • -
                                              • Fsibling
                                              • -
                                              • Fsuccessor
                                              • -
                                              • Funcle
                                              • VBLACK
                                              • VRED
                                              • +
                                              • Fgrandparent
                                              • +
                                              • Fpredecessor
                                              • +
                                              • Fsibling
                                              • +
                                              • Funcle
                                              • Finsert_case1
                                              • Finsert_case2
                                              • Finsert_case3
                                              • diff --git a/package.json b/package.json index 3d14b7d..ee82923 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,9 @@ "cover": "./node_modules/.bin/nyc --reporter=lcov npm test" }, "main": "src/index.js", - "dependencies": {}, + "dependencies": { + "chalk": "^1.1.3" + }, "devDependencies": { "aureooms-js-compare": "^1.4.5", "aureooms-js-itertools": "^1.3.0", diff --git a/script/search_index.js b/script/search_index.js index 3e9b8f8..575f8a3 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -29,6 +29,12 @@ window.esdocSearchIndex = [ "RedBlackTree aureooms-es-red-black-tree/src/adt/RedBlackTree.js", "class" ], + [ + "aureooms-es-red-black-tree/src/base/debug.js~debug", + "function/index.html#static-function-debug", + "debug aureooms-es-red-black-tree/src/base/debug.js", + "function" + ], [ "aureooms-es-red-black-tree/src/removal/delete_case1.js~delete_case1", "function/index.html#static-function-delete_case1", @@ -78,9 +84,9 @@ window.esdocSearchIndex = [ "function" ], [ - "aureooms-es-red-black-tree/src/base/grandparent.js~grandparent", + "aureooms-es-red-black-tree/src/family/grandparent.js~grandparent", "function/index.html#static-function-grandparent", - "grandparent aureooms-es-red-black-tree/src/base/grandparent.js", + "grandparent aureooms-es-red-black-tree/src/family/grandparent.js", "function" ], [ @@ -126,9 +132,9 @@ window.esdocSearchIndex = [ "function" ], [ - "aureooms-es-red-black-tree/src/base/predecessor.js~predecessor", + "aureooms-es-red-black-tree/src/family/predecessor.js~predecessor", "function/index.html#static-function-predecessor", - "predecessor aureooms-es-red-black-tree/src/base/predecessor.js", + "predecessor aureooms-es-red-black-tree/src/family/predecessor.js", "function" ], [ @@ -150,21 +156,15 @@ window.esdocSearchIndex = [ "function" ], [ - "aureooms-es-red-black-tree/src/base/sibling.js~sibling", + "aureooms-es-red-black-tree/src/family/sibling.js~sibling", "function/index.html#static-function-sibling", - "sibling aureooms-es-red-black-tree/src/base/sibling.js", - "function" - ], - [ - "aureooms-es-red-black-tree/src/base/successor.js~successor", - "function/index.html#static-function-successor", - "successor aureooms-es-red-black-tree/src/base/successor.js", + "sibling aureooms-es-red-black-tree/src/family/sibling.js", "function" ], [ - "aureooms-es-red-black-tree/src/base/uncle.js~uncle", + "aureooms-es-red-black-tree/src/family/uncle.js~uncle", "function/index.html#static-function-uncle", - "uncle aureooms-es-red-black-tree/src/base/uncle.js", + "uncle aureooms-es-red-black-tree/src/family/uncle.js", "function" ], [ @@ -545,6 +545,12 @@ window.esdocSearchIndex = [ "src/adt/RedBlackTree.js~RedBlackTree#root", "member" ], + [ + "src/adt/redblacktree.js~redblacktree.from", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#static-method-from", + "src/adt/RedBlackTree.js~RedBlackTree.from", + "method" + ], [ "src/adt/index.js", "file/src/adt/index.js.html", @@ -558,15 +564,15 @@ window.esdocSearchIndex = [ "file" ], [ - "src/base/find.js", - "file/src/base/find.js.html", - "src/base/find.js", + "src/base/debug.js", + "file/src/base/debug.js.html", + "src/base/debug.js", "file" ], [ - "src/base/grandparent.js", - "file/src/base/grandparent.js.html", - "src/base/grandparent.js", + "src/base/find.js", + "file/src/base/find.js.html", + "src/base/find.js", "file" ], [ @@ -587,12 +593,6 @@ window.esdocSearchIndex = [ "src/base/insert.js", "file" ], - [ - "src/base/predecessor.js", - "file/src/base/predecessor.js.html", - "src/base/predecessor.js", - "file" - ], [ "src/base/replace_node.js", "file/src/base/replace_node.js.html", @@ -612,21 +612,33 @@ window.esdocSearchIndex = [ "file" ], [ - "src/base/sibling.js", - "file/src/base/sibling.js.html", - "src/base/sibling.js", + "src/family/grandparent.js", + "file/src/family/grandparent.js.html", + "src/family/grandparent.js", + "file" + ], + [ + "src/family/index.js", + "file/src/family/index.js.html", + "src/family/index.js", + "file" + ], + [ + "src/family/predecessor.js", + "file/src/family/predecessor.js.html", + "src/family/predecessor.js", "file" ], [ - "src/base/successor.js", - "file/src/base/successor.js.html", - "src/base/successor.js", + "src/family/sibling.js", + "file/src/family/sibling.js.html", + "src/family/sibling.js", "file" ], [ - "src/base/uncle.js", - "file/src/base/uncle.js.html", - "src/base/uncle.js", + "src/family/uncle.js", + "file/src/family/uncle.js.html", + "src/family/uncle.js", "file" ], [ diff --git a/source.html b/source.html index abd10c7..f907c09 100644 --- a/source.html +++ b/source.html @@ -35,19 +35,19 @@
                                            -

                                            Source 2/35

                                            +

                                            Source 2/36

                                            @@ -82,12 +82,12 @@ - + - - - - + + + + @@ -95,7 +95,7 @@ - + @@ -104,7 +104,15 @@ - + + + + + + + + + @@ -112,23 +120,15 @@ - - - - - - - - - + - - - + + + @@ -136,7 +136,7 @@ - + @@ -144,23 +144,15 @@ - + - - - - - - - - - + - - - + + + @@ -168,7 +160,7 @@ - + @@ -176,39 +168,55 @@ - + - - + + + + + + + + + + + + + + + + + + - + - + - - + + - + - + - + - + - + - - - + + + @@ -216,7 +224,7 @@ - + @@ -224,7 +232,7 @@ - + @@ -232,7 +240,7 @@ - + @@ -240,15 +248,15 @@ - + - + - + @@ -256,7 +264,7 @@ - + @@ -264,7 +272,7 @@ - + @@ -272,7 +280,7 @@ - + @@ -280,39 +288,39 @@ - + - + - - - + + + - + - + - - - + + + - - - + + + @@ -320,7 +328,7 @@ - + @@ -328,15 +336,15 @@ - + - - - + + + @@ -344,7 +352,7 @@ - +
                                            src/adt/RedBlackTree.jssrc/adt/RedBlackTree.js RedBlackTree0 %0/81519 byte722016-07-05 12:57:17 (UTC)0 %0/91814 byte882016-07-06 07:55:36 (UTC)
                                            src/adt/index.js- 33 byte 12016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/base/colors.js0 %0/2 48 byte 22016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/base/debug.jsdebug0 %0/1314 byte142016-07-05 15:00:15 (UTC)
                                            src/base/find.js0 %0/1 352 byte 292016-07-05 12:57:17 (UTC)
                                            src/base/grandparent.jsgrandparent0 %0/1125 byte62016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/base/index.js - -362 byte122016-07-05 12:57:17 (UTC)240 byte82016-07-05 15:23:22 (UTC)
                                            src/base/inordertraversal.js0 %0/1 220 byte 142016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/base/insert.js0 %0/1 360 byte 382016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/base/predecessor.jspredecessor0 %0/1136 byte92016-07-05 12:57:17 (UTC)
                                            src/base/replace_node.jssrc/base/replace_node.js replace_node 0 %0/1211 byte132016-07-05 12:57:17 (UTC)243 byte122016-07-06 07:46:44 (UTC)
                                            src/base/rotate_left.js100 %1/1 583 byte 332016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/base/rotate_right.js100 %1/1 593 byte 342016-07-05 12:57:29 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/base/sibling.jssiblingsrc/family/grandparent.jsgrandparent0 %0/1168 byte72016-07-06 07:45:12 (UTC)
                                            src/family/index.js--118 byte42016-07-06 07:55:09 (UTC)
                                            src/family/predecessor.jspredecessor 0 %0/1199 byte136 byte 92016-07-05 12:57:17 (UTC)2016-07-05 15:22:59 (UTC)
                                            src/base/successor.jssuccessorsrc/family/sibling.jssibling 0 %0/1133 byte233 byte 92016-07-05 12:57:17 (UTC)2016-07-06 07:46:12 (UTC)
                                            src/base/uncle.jssrc/family/uncle.js uncle 0 %0/1286 byte287 byte 112016-07-05 12:57:17 (UTC)2016-07-06 07:49:29 (UTC)
                                            src/index.js - -132 byte52016-07-05 12:57:17 (UTC)159 byte62016-07-05 15:24:51 (UTC)
                                            src/insertion/index.js- 165 byte 52016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/insertion/insert_case1.js0 %0/1 183 byte 112016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/insertion/insert_case2.js0 %0/1 207 byte 112016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/insertion/insert_case3.js0 %0/1 395 byte 182016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/insertion/insert_case4.js insert_case4 0 %0/1855 byte922 byte 412016-07-05 12:57:17 (UTC)2016-07-05 15:20:17 (UTC)
                                            src/insertion/insert_case5.js0 %0/1 254 byte 142016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/node/Leaf.js0 %0/1 170 byte 82016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/node/Node.js0 %0/1 266 byte 112016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/node/index.js- 50 byte 22016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/removal/delete_case1.jssrc/removal/delete_case1.js delete_case1 0 %0/1129 byte82016-07-05 12:57:17 (UTC)160 byte102016-07-05 15:28:23 (UTC)
                                            src/removal/delete_case2.js delete_case2 0 %0/1349 byte359 byte 182016-07-05 12:57:17 (UTC)2016-07-05 13:15:58 (UTC)
                                            src/removal/delete_case3.js delete_case3 0 %0/1404 byte192016-07-05 12:57:17 (UTC)469 byte222016-07-05 15:16:40 (UTC)
                                            src/removal/delete_case4.js delete_case4 0 %0/1353 byte172016-07-05 12:57:17 (UTC)375 byte182016-07-05 15:16:30 (UTC)
                                            src/removal/delete_case5.js0 %0/1 1033 byte 302016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/removal/delete_case6.js0 %0/1 330 byte 182016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            src/removal/delete_one_child.js delete_one_child 0 %0/1391 byte202016-07-05 12:57:17 (UTC)770 byte282016-07-06 08:10:27 (UTC)
                                            src/removal/index.js- 235 byte 72016-07-05 12:57:17 (UTC)2016-07-05 12:58:10 (UTC)
                                            diff --git a/variable/index.html b/variable/index.html index 29830c0..3d19165 100644 --- a/variable/index.html +++ b/variable/index.html @@ -35,19 +35,19 @@
                                            • CRedBlackTree
                                            • -
                                            • Ffind
                                            • -
                                            • Fgrandparent
                                            • +
                                            • Fdebug
                                            • +
                                            • Ffind
                                            • Finordertraversal
                                            • Finsert
                                            • -
                                            • Fpredecessor
                                            • Freplace_node
                                            • Frotate_left
                                            • Frotate_right
                                            • -
                                            • Fsibling
                                            • -
                                            • Fsuccessor
                                            • -
                                            • Funcle
                                            • VBLACK
                                            • VRED
                                            • +
                                            • Fgrandparent
                                            • +
                                            • Fpredecessor
                                            • +
                                            • Fsibling
                                            • +
                                            • Funcle
                                            • Finsert_case1
                                            • Finsert_case2
                                            • Finsert_case3
                                            • From 80c9e2452276e6c43aec9cd8fc4b149988320d87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Fri, 22 Jul 2016 10:39:50 +0200 Subject: [PATCH 05/26] esdoc update --- ast/source/{node => adt}/Leaf.js.json | 0 ast/source/{node => adt}/Node.js.json | 0 ast/source/adt/RedBlackTree.js.json | 1094 +++++++-------- ast/source/adt/index.js.json | 86 +- ast/source/base/index.js.json | 309 ---- .../colors.js.json => color/BLACK.js.json} | 101 +- ast/source/color/RED.js.json | 116 ++ ast/source/{node => color}/index.js.json | 26 +- ast/source/{base => debug}/debug.js.json | 600 ++++---- ast/source/debug/index.js.json | 57 + ast/source/index.js.json | 174 ++- ast/source/insertion/index.js.json | 100 +- ast/source/{base => insertion}/insert.js.json | 0 ast/source/removal/delete_case1.js.json | 287 ++-- ast/source/removal/delete_case3.js.json | 664 ++++----- ast/source/removal/delete_case5.js.json | 1112 +++++++-------- ast/source/removal/delete_case6.js.json | 680 ++++----- ast/source/removal/delete_one_child.js.json | 402 +++--- ast/source/removal/index.js.json | 42 +- .../{base => removal}/replace_node.js.json | 0 ast/source/rotate/index.js.json | 93 ++ .../{base => rotate}/rotate_left.js.json | 850 +++++------ .../{base => rotate}/rotate_right.js.json | 850 +++++------ ast/source/{base => search}/find.js.json | 456 +++--- ast/source/search/index.js.json | 57 + ast/source/traversal/index.js.json | 57 + .../inordertraversal.js.json | 344 ++--- .../src/adt/RedBlackTree.js~RedBlackTree.html | 22 +- coverage.json | 46 +- dump.json | 1248 +++++++++-------- file/src/{node => adt}/Leaf.js.html | 26 +- file/src/{node => adt}/Node.js.html | 26 +- file/src/adt/RedBlackTree.js.html | 24 +- file/src/adt/index.js.html | 26 +- .../colors.js.html => color/BLACK.js.html} | 27 +- file/src/color/RED.js.html | 87 ++ file/src/color/index.js.html | 88 ++ file/src/{base => debug}/debug.js.html | 31 +- file/src/{node => debug}/index.js.html | 29 +- file/src/family/grandparent.js.html | 22 +- file/src/family/index.js.html | 22 +- file/src/family/predecessor.js.html | 22 +- file/src/family/sibling.js.html | 22 +- file/src/family/uncle.js.html | 22 +- file/src/index.js.html | 29 +- file/src/insertion/index.js.html | 25 +- file/src/{base => insertion}/insert.js.html | 26 +- file/src/insertion/insert_case1.js.html | 22 +- file/src/insertion/insert_case2.js.html | 22 +- file/src/insertion/insert_case3.js.html | 22 +- file/src/insertion/insert_case4.js.html | 22 +- file/src/insertion/insert_case5.js.html | 22 +- file/src/removal/delete_case1.js.html | 33 +- file/src/removal/delete_case2.js.html | 22 +- file/src/removal/delete_case3.js.html | 25 +- file/src/removal/delete_case4.js.html | 22 +- file/src/removal/delete_case5.js.html | 25 +- file/src/removal/delete_case6.js.html | 25 +- file/src/removal/delete_one_child.js.html | 26 +- file/src/removal/index.js.html | 23 +- .../{base => removal}/replace_node.js.html | 26 +- file/src/{base => rotate}/index.js.html | 34 +- file/src/{base => rotate}/rotate_left.js.html | 28 +- .../src/{base => rotate}/rotate_right.js.html | 28 +- file/src/{base => search}/find.js.html | 29 +- file/src/search/index.js.html | 87 ++ file/src/traversal/index.js.html | 87 ++ .../inordertraversal.js.html | 29 +- function/index.html | 74 +- identifiers.html | 22 +- index.html | 22 +- script/search_index.js | 182 +-- source.html | 305 ++-- variable/index.html | 30 +- 74 files changed, 6185 insertions(+), 5536 deletions(-) rename ast/source/{node => adt}/Leaf.js.json (100%) rename ast/source/{node => adt}/Node.js.json (100%) delete mode 100644 ast/source/base/index.js.json rename ast/source/{base/colors.js.json => color/BLACK.js.json} (51%) create mode 100644 ast/source/color/RED.js.json rename ast/source/{node => color}/index.js.json (81%) rename ast/source/{base => debug}/debug.js.json (77%) create mode 100644 ast/source/debug/index.js.json rename ast/source/{base => insertion}/insert.js.json (100%) rename ast/source/{base => removal}/replace_node.js.json (100%) create mode 100644 ast/source/rotate/index.js.json rename ast/source/{base => rotate}/rotate_left.js.json (82%) rename ast/source/{base => rotate}/rotate_right.js.json (83%) rename ast/source/{base => search}/find.js.json (78%) create mode 100644 ast/source/search/index.js.json create mode 100644 ast/source/traversal/index.js.json rename ast/source/{base => traversal}/inordertraversal.js.json (79%) rename file/src/{node => adt}/Leaf.js.html (82%) rename file/src/{node => adt}/Node.js.html (83%) rename file/src/{base/colors.js.html => color/BLACK.js.html} (82%) create mode 100644 file/src/color/RED.js.html create mode 100644 file/src/color/index.js.html rename file/src/{base => debug}/debug.js.html (81%) rename file/src/{node => debug}/index.js.html (82%) rename file/src/{base => insertion}/insert.js.html (83%) rename file/src/{base => removal}/replace_node.js.html (82%) rename file/src/{base => rotate}/index.js.html (81%) rename file/src/{base => rotate}/rotate_left.js.html (83%) rename file/src/{base => rotate}/rotate_right.js.html (83%) rename file/src/{base => search}/find.js.html (82%) create mode 100644 file/src/search/index.js.html create mode 100644 file/src/traversal/index.js.html rename file/src/{base => traversal}/inordertraversal.js.html (81%) diff --git a/ast/source/node/Leaf.js.json b/ast/source/adt/Leaf.js.json similarity index 100% rename from ast/source/node/Leaf.js.json rename to ast/source/adt/Leaf.js.json diff --git a/ast/source/node/Node.js.json b/ast/source/adt/Node.js.json similarity index 100% rename from ast/source/node/Node.js.json rename to ast/source/adt/Node.js.json diff --git a/ast/source/adt/RedBlackTree.js.json b/ast/source/adt/RedBlackTree.js.json index db09463..6312bf3 100644 --- a/ast/source/adt/RedBlackTree.js.json +++ b/ast/source/adt/RedBlackTree.js.json @@ -60,11 +60,11 @@ ], "source": { "type": "Literal", - "value": "..", - "raw": "'..'", + "value": "./Node", + "raw": "'./Node'", "range": [ 22, - 26 + 30 ], "loc": { "start": { @@ -73,13 +73,13 @@ }, "end": { "line": 2, - "column": 25 + "column": 29 } } }, "range": [ 1, - 28 + 32 ], "loc": { "start": { @@ -88,7 +88,7 @@ }, "end": { "line": 2, - "column": 27 + "column": 31 } } }, @@ -101,8 +101,8 @@ "type": "Identifier", "name": "RED", "range": [ - 38, - 41 + 42, + 45 ], "loc": { "start": { @@ -119,8 +119,8 @@ "type": "Identifier", "name": "RED", "range": [ - 38, - 41 + 42, + 45 ], "loc": { "start": { @@ -134,8 +134,8 @@ } }, "range": [ - 38, - 41 + 42, + 45 ], "loc": { "start": { @@ -154,8 +154,8 @@ "type": "Identifier", "name": "BLACK", "range": [ - 44, - 49 + 48, + 53 ], "loc": { "start": { @@ -172,8 +172,8 @@ "type": "Identifier", "name": "BLACK", "range": [ - 44, - 49 + 48, + 53 ], "loc": { "start": { @@ -187,8 +187,8 @@ } }, "range": [ - 44, - 49 + 48, + 53 ], "loc": { "start": { @@ -207,8 +207,8 @@ "value": "..", "raw": "'..'", "range": [ - 57, - 61 + 61, + 65 ], "loc": { "start": { @@ -222,8 +222,8 @@ } }, "range": [ - 29, - 63 + 33, + 67 ], "loc": { "start": { @@ -245,8 +245,8 @@ "type": "Identifier", "name": "predecessor", "range": [ - 73, - 84 + 77, + 88 ], "loc": { "start": { @@ -263,8 +263,8 @@ "type": "Identifier", "name": "predecessor", "range": [ - 73, - 84 + 77, + 88 ], "loc": { "start": { @@ -278,8 +278,8 @@ } }, "range": [ - 73, - 84 + 77, + 88 ], "loc": { "start": { @@ -298,8 +298,8 @@ "value": "..", "raw": "'..'", "range": [ - 92, - 96 + 96, + 100 ], "loc": { "start": { @@ -313,8 +313,8 @@ } }, "range": [ - 64, - 98 + 68, + 102 ], "loc": { "start": { @@ -336,8 +336,8 @@ "type": "Identifier", "name": "insert", "range": [ - 108, - 114 + 112, + 118 ], "loc": { "start": { @@ -354,8 +354,8 @@ "type": "Identifier", "name": "insert", "range": [ - 108, - 114 + 112, + 118 ], "loc": { "start": { @@ -369,8 +369,8 @@ } }, "range": [ - 108, - 114 + 112, + 118 ], "loc": { "start": { @@ -389,8 +389,8 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 117, - 129 + 121, + 133 ], "loc": { "start": { @@ -407,8 +407,8 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 117, - 129 + 121, + 133 ], "loc": { "start": { @@ -422,8 +422,8 @@ } }, "range": [ - 117, - 129 + 121, + 133 ], "loc": { "start": { @@ -442,8 +442,8 @@ "value": "..", "raw": "'..'", "range": [ - 137, - 141 + 141, + 145 ], "loc": { "start": { @@ -457,8 +457,8 @@ } }, "range": [ - 99, - 143 + 103, + 147 ], "loc": { "start": { @@ -480,8 +480,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 153, - 169 + 157, + 173 ], "loc": { "start": { @@ -498,8 +498,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 153, - 169 + 157, + 173 ], "loc": { "start": { @@ -513,8 +513,8 @@ } }, "range": [ - 153, - 169 + 157, + 173 ], "loc": { "start": { @@ -533,8 +533,8 @@ "value": "..", "raw": "'..'", "range": [ - 177, - 181 + 181, + 185 ], "loc": { "start": { @@ -548,8 +548,8 @@ } }, "range": [ - 144, - 183 + 148, + 187 ], "loc": { "start": { @@ -571,8 +571,8 @@ "type": "Identifier", "name": "find", "range": [ - 193, - 197 + 197, + 201 ], "loc": { "start": { @@ -589,8 +589,8 @@ "type": "Identifier", "name": "find", "range": [ - 193, - 197 + 197, + 201 ], "loc": { "start": { @@ -604,8 +604,8 @@ } }, "range": [ - 193, - 197 + 197, + 201 ], "loc": { "start": { @@ -624,8 +624,8 @@ "value": "..", "raw": "'..'", "range": [ - 205, - 209 + 209, + 213 ], "loc": { "start": { @@ -639,8 +639,8 @@ } }, "range": [ - 184, - 211 + 188, + 215 ], "loc": { "start": { @@ -662,8 +662,8 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 221, - 237 + 225, + 241 ], "loc": { "start": { @@ -680,8 +680,8 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 221, - 237 + 225, + 241 ], "loc": { "start": { @@ -695,8 +695,8 @@ } }, "range": [ - 221, - 237 + 225, + 241 ], "loc": { "start": { @@ -715,8 +715,8 @@ "value": "..", "raw": "'..'", "range": [ - 245, - 249 + 249, + 253 ], "loc": { "start": { @@ -730,8 +730,8 @@ } }, "range": [ - 212, - 251 + 216, + 255 ], "loc": { "start": { @@ -752,8 +752,8 @@ "type": "Identifier", "name": "RedBlackTree", "range": [ - 266, - 278 + 270, + 282 ], "loc": { "start": { @@ -776,8 +776,8 @@ "type": "Identifier", "name": "constructor", "range": [ - 283, - 294 + 287, + 298 ], "loc": { "start": { @@ -798,8 +798,8 @@ "type": "Identifier", "name": "compare", "range": [ - 297, - 304 + 301, + 308 ], "loc": { "start": { @@ -827,8 +827,8 @@ "object": { "type": "ThisExpression", "range": [ - 312, - 316 + 316, + 320 ], "loc": { "start": { @@ -845,8 +845,8 @@ "type": "Identifier", "name": "compare", "range": [ - 317, - 324 + 321, + 328 ], "loc": { "start": { @@ -860,8 +860,8 @@ } }, "range": [ - 312, - 324 + 316, + 328 ], "loc": { "start": { @@ -878,8 +878,8 @@ "type": "Identifier", "name": "compare", "range": [ - 327, - 334 + 331, + 338 ], "loc": { "start": { @@ -893,8 +893,8 @@ } }, "range": [ - 312, - 334 + 316, + 338 ], "loc": { "start": { @@ -908,8 +908,8 @@ } }, "range": [ - 312, - 336 + 316, + 340 ], "loc": { "start": { @@ -933,8 +933,8 @@ "object": { "type": "ThisExpression", "range": [ - 339, - 343 + 343, + 347 ], "loc": { "start": { @@ -951,8 +951,8 @@ "type": "Identifier", "name": "root", "range": [ - 344, - 348 + 348, + 352 ], "loc": { "start": { @@ -966,8 +966,8 @@ } }, "range": [ - 339, - 348 + 343, + 352 ], "loc": { "start": { @@ -985,8 +985,8 @@ "value": null, "raw": "null", "range": [ - 351, - 355 + 355, + 359 ], "loc": { "start": { @@ -1000,8 +1000,8 @@ } }, "range": [ - 339, - 355 + 343, + 359 ], "loc": { "start": { @@ -1015,8 +1015,8 @@ } }, "range": [ - 339, - 357 + 343, + 361 ], "loc": { "start": { @@ -1031,8 +1031,8 @@ } ], "range": [ - 307, - 361 + 311, + 365 ], "loc": { "start": { @@ -1048,8 +1048,8 @@ "generator": false, "expression": false, "range": [ - 295, - 361 + 299, + 365 ], "loc": { "start": { @@ -1065,8 +1065,8 @@ "kind": "constructor", "computed": false, "range": [ - 283, - 361 + 287, + 365 ], "loc": { "start": { @@ -1086,8 +1086,8 @@ "type": "Identifier", "name": "add", "range": [ - 364, - 367 + 368, + 371 ], "loc": { "start": { @@ -1108,8 +1108,8 @@ "type": "Identifier", "name": "value", "range": [ - 370, - 375 + 374, + 379 ], "loc": { "start": { @@ -1137,8 +1137,8 @@ "object": { "type": "ThisExpression", "range": [ - 387, - 391 + 391, + 395 ], "loc": { "start": { @@ -1155,8 +1155,8 @@ "type": "Identifier", "name": "root", "range": [ - 392, - 396 + 396, + 400 ], "loc": { "start": { @@ -1170,8 +1170,8 @@ } }, "range": [ - 387, - 396 + 391, + 400 ], "loc": { "start": { @@ -1189,8 +1189,8 @@ "value": null, "raw": "null", "range": [ - 401, - 405 + 405, + 409 ], "loc": { "start": { @@ -1204,8 +1204,8 @@ } }, "range": [ - 387, - 405 + 391, + 409 ], "loc": { "start": { @@ -1232,8 +1232,8 @@ "object": { "type": "ThisExpression", "range": [ - 413, - 417 + 417, + 421 ], "loc": { "start": { @@ -1250,8 +1250,8 @@ "type": "Identifier", "name": "root", "range": [ - 418, - 422 + 422, + 426 ], "loc": { "start": { @@ -1265,8 +1265,8 @@ } }, "range": [ - 413, - 422 + 417, + 426 ], "loc": { "start": { @@ -1285,8 +1285,8 @@ "type": "Identifier", "name": "Node", "range": [ - 429, - 433 + 433, + 437 ], "loc": { "start": { @@ -1304,8 +1304,8 @@ "type": "Identifier", "name": "BLACK", "range": [ - 435, - 440 + 439, + 444 ], "loc": { "start": { @@ -1322,8 +1322,8 @@ "type": "Identifier", "name": "value", "range": [ - 443, - 448 + 447, + 452 ], "loc": { "start": { @@ -1338,8 +1338,8 @@ } ], "range": [ - 425, - 450 + 429, + 454 ], "loc": { "start": { @@ -1353,8 +1353,8 @@ } }, "range": [ - 413, - 450 + 417, + 454 ], "loc": { "start": { @@ -1368,8 +1368,8 @@ } }, "range": [ - 413, - 452 + 417, + 456 ], "loc": { "start": { @@ -1384,8 +1384,8 @@ } ], "range": [ - 408, - 456 + 412, + 460 ], "loc": { "start": { @@ -1410,8 +1410,8 @@ "type": "Identifier", "name": "node", "range": [ - 475, - 479 + 479, + 483 ], "loc": { "start": { @@ -1430,8 +1430,8 @@ "type": "Identifier", "name": "Node", "range": [ - 486, - 490 + 490, + 494 ], "loc": { "start": { @@ -1449,8 +1449,8 @@ "type": "Identifier", "name": "RED", "range": [ - 492, - 495 + 496, + 499 ], "loc": { "start": { @@ -1467,8 +1467,8 @@ "type": "Identifier", "name": "value", "range": [ - 498, - 503 + 502, + 507 ], "loc": { "start": { @@ -1483,8 +1483,8 @@ } ], "range": [ - 482, - 505 + 486, + 509 ], "loc": { "start": { @@ -1498,8 +1498,8 @@ } }, "range": [ - 475, - 505 + 479, + 509 ], "loc": { "start": { @@ -1515,8 +1515,8 @@ ], "kind": "const", "range": [ - 469, - 507 + 473, + 511 ], "loc": { "start": { @@ -1537,8 +1537,8 @@ "type": "Identifier", "name": "insert", "range": [ - 511, - 517 + 515, + 521 ], "loc": { "start": { @@ -1558,8 +1558,8 @@ "object": { "type": "ThisExpression", "range": [ - 519, - 523 + 523, + 527 ], "loc": { "start": { @@ -1576,8 +1576,8 @@ "type": "Identifier", "name": "compare", "range": [ - 524, - 531 + 528, + 535 ], "loc": { "start": { @@ -1591,8 +1591,8 @@ } }, "range": [ - 519, - 531 + 523, + 535 ], "loc": { "start": { @@ -1611,8 +1611,8 @@ "object": { "type": "ThisExpression", "range": [ - 534, - 538 + 538, + 542 ], "loc": { "start": { @@ -1629,8 +1629,8 @@ "type": "Identifier", "name": "root", "range": [ - 539, - 543 + 543, + 547 ], "loc": { "start": { @@ -1644,8 +1644,8 @@ } }, "range": [ - 534, - 543 + 538, + 547 ], "loc": { "start": { @@ -1662,8 +1662,8 @@ "type": "Identifier", "name": "node", "range": [ - 546, - 550 + 550, + 554 ], "loc": { "start": { @@ -1678,8 +1678,8 @@ } ], "range": [ - 511, - 552 + 515, + 556 ], "loc": { "start": { @@ -1693,8 +1693,8 @@ } }, "range": [ - 511, - 554 + 515, + 558 ], "loc": { "start": { @@ -1715,8 +1715,8 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 558, - 570 + 562, + 574 ], "loc": { "start": { @@ -1734,8 +1734,8 @@ "type": "Identifier", "name": "node", "range": [ - 572, - 576 + 576, + 580 ], "loc": { "start": { @@ -1750,8 +1750,8 @@ } ], "range": [ - 558, - 578 + 562, + 582 ], "loc": { "start": { @@ -1765,8 +1765,8 @@ } }, "range": [ - 558, - 580 + 562, + 584 ], "loc": { "start": { @@ -1781,8 +1781,8 @@ } ], "range": [ - 464, - 584 + 468, + 588 ], "loc": { "start": { @@ -1796,8 +1796,8 @@ } }, "range": [ - 382, - 584 + 386, + 588 ], "loc": { "start": { @@ -1812,8 +1812,8 @@ } ], "range": [ - 378, - 587 + 382, + 591 ], "loc": { "start": { @@ -1829,8 +1829,8 @@ "generator": false, "expression": false, "range": [ - 368, - 587 + 372, + 591 ], "loc": { "start": { @@ -1846,8 +1846,8 @@ "kind": "method", "computed": false, "range": [ - 364, - 587 + 368, + 591 ], "loc": { "start": { @@ -1867,8 +1867,8 @@ "type": "Identifier", "name": "find", "range": [ - 590, - 594 + 594, + 598 ], "loc": { "start": { @@ -1889,8 +1889,8 @@ "type": "Identifier", "name": "value", "range": [ - 597, - 602 + 601, + 606 ], "loc": { "start": { @@ -1918,8 +1918,8 @@ "object": { "type": "ThisExpression", "range": [ - 615, - 619 + 619, + 623 ], "loc": { "start": { @@ -1936,8 +1936,8 @@ "type": "Identifier", "name": "root", "range": [ - 620, - 624 + 624, + 628 ], "loc": { "start": { @@ -1951,8 +1951,8 @@ } }, "range": [ - 615, - 624 + 619, + 628 ], "loc": { "start": { @@ -1970,8 +1970,8 @@ "value": null, "raw": "null", "range": [ - 629, - 633 + 633, + 637 ], "loc": { "start": { @@ -1985,8 +1985,8 @@ } }, "range": [ - 615, - 633 + 619, + 637 ], "loc": { "start": { @@ -2006,8 +2006,8 @@ "value": null, "raw": "null", "range": [ - 643, - 647 + 647, + 651 ], "loc": { "start": { @@ -2021,8 +2021,8 @@ } }, "range": [ - 636, - 649 + 640, + 653 ], "loc": { "start": { @@ -2037,8 +2037,8 @@ }, "alternate": null, "range": [ - 610, - 649 + 614, + 653 ], "loc": { "start": { @@ -2059,8 +2059,8 @@ "type": "Identifier", "name": "find", "range": [ - 660, - 664 + 664, + 668 ], "loc": { "start": { @@ -2080,8 +2080,8 @@ "object": { "type": "ThisExpression", "range": [ - 666, - 670 + 670, + 674 ], "loc": { "start": { @@ -2098,8 +2098,8 @@ "type": "Identifier", "name": "compare", "range": [ - 671, - 678 + 675, + 682 ], "loc": { "start": { @@ -2113,8 +2113,8 @@ } }, "range": [ - 666, - 678 + 670, + 682 ], "loc": { "start": { @@ -2133,8 +2133,8 @@ "object": { "type": "ThisExpression", "range": [ - 681, - 685 + 685, + 689 ], "loc": { "start": { @@ -2151,8 +2151,8 @@ "type": "Identifier", "name": "root", "range": [ - 686, - 690 + 690, + 694 ], "loc": { "start": { @@ -2166,8 +2166,8 @@ } }, "range": [ - 681, - 690 + 685, + 694 ], "loc": { "start": { @@ -2184,8 +2184,8 @@ "type": "Identifier", "name": "value", "range": [ - 693, - 698 + 697, + 702 ], "loc": { "start": { @@ -2200,8 +2200,8 @@ } ], "range": [ - 660, - 700 + 664, + 704 ], "loc": { "start": { @@ -2215,8 +2215,8 @@ } }, "range": [ - 653, - 702 + 657, + 706 ], "loc": { "start": { @@ -2231,8 +2231,8 @@ } ], "range": [ - 605, - 706 + 609, + 710 ], "loc": { "start": { @@ -2248,8 +2248,8 @@ "generator": false, "expression": false, "range": [ - 595, - 706 + 599, + 710 ], "loc": { "start": { @@ -2265,8 +2265,8 @@ "kind": "method", "computed": false, "range": [ - 590, - 706 + 594, + 710 ], "loc": { "start": { @@ -2286,8 +2286,8 @@ "type": "Identifier", "name": "delete", "range": [ - 709, - 715 + 713, + 719 ], "loc": { "start": { @@ -2308,8 +2308,8 @@ "type": "Identifier", "name": "node", "range": [ - 718, - 722 + 722, + 726 ], "loc": { "start": { @@ -2343,8 +2343,8 @@ "type": "Identifier", "name": "node", "range": [ - 736, - 740 + 740, + 744 ], "loc": { "start": { @@ -2361,8 +2361,8 @@ "type": "Identifier", "name": "left", "range": [ - 741, - 745 + 745, + 749 ], "loc": { "start": { @@ -2376,8 +2376,8 @@ } }, "range": [ - 736, - 745 + 740, + 749 ], "loc": { "start": { @@ -2394,8 +2394,8 @@ "type": "Identifier", "name": "isleaf", "range": [ - 746, - 752 + 750, + 756 ], "loc": { "start": { @@ -2409,8 +2409,8 @@ } }, "range": [ - 736, - 752 + 740, + 756 ], "loc": { "start": { @@ -2425,8 +2425,8 @@ }, "arguments": [], "range": [ - 736, - 754 + 740, + 758 ], "loc": { "start": { @@ -2441,8 +2441,8 @@ }, "prefix": true, "range": [ - 735, - 754 + 739, + 758 ], "loc": { "start": { @@ -2467,8 +2467,8 @@ "type": "Identifier", "name": "pred", "range": [ - 820, - 824 + 824, + 828 ], "loc": { "start": { @@ -2487,8 +2487,8 @@ "type": "Identifier", "name": "predecessor", "range": [ - 827, - 838 + 831, + 842 ], "loc": { "start": { @@ -2506,8 +2506,8 @@ "type": "Identifier", "name": "node", "range": [ - 840, - 844 + 844, + 848 ], "loc": { "start": { @@ -2522,8 +2522,8 @@ } ], "range": [ - 827, - 846 + 831, + 850 ], "loc": { "start": { @@ -2537,8 +2537,8 @@ } }, "range": [ - 820, - 846 + 824, + 850 ], "loc": { "start": { @@ -2554,8 +2554,8 @@ ], "kind": "const", "range": [ - 814, - 848 + 818, + 852 ], "loc": { "start": { @@ -2572,8 +2572,8 @@ "type": "Line", "value": " replace node's value with predecessor's value", "range": [ - 762, - 810 + 766, + 814 ], "loc": { "start": { @@ -2600,8 +2600,8 @@ "type": "Identifier", "name": "node", "range": [ - 852, - 856 + 856, + 860 ], "loc": { "start": { @@ -2618,8 +2618,8 @@ "type": "Identifier", "name": "value", "range": [ - 857, - 862 + 861, + 866 ], "loc": { "start": { @@ -2633,8 +2633,8 @@ } }, "range": [ - 852, - 862 + 856, + 866 ], "loc": { "start": { @@ -2654,8 +2654,8 @@ "type": "Identifier", "name": "pred", "range": [ - 865, - 869 + 869, + 873 ], "loc": { "start": { @@ -2672,8 +2672,8 @@ "type": "Identifier", "name": "value", "range": [ - 870, - 875 + 874, + 879 ], "loc": { "start": { @@ -2687,8 +2687,8 @@ } }, "range": [ - 865, - 875 + 869, + 879 ], "loc": { "start": { @@ -2702,8 +2702,8 @@ } }, "range": [ - 852, - 875 + 856, + 879 ], "loc": { "start": { @@ -2717,8 +2717,8 @@ } }, "range": [ - 852, - 877 + 856, + 881 ], "loc": { "start": { @@ -2735,8 +2735,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 881, - 907 + 885, + 911 ], "loc": { "start": { @@ -2753,8 +2753,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 911, - 962 + 915, + 966 ], "loc": { "start": { @@ -2771,8 +2771,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 966, - 1011 + 970, + 1015 ], "loc": { "start": { @@ -2795,8 +2795,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1015, - 1031 + 1019, + 1035 ], "loc": { "start": { @@ -2814,8 +2814,8 @@ "type": "Identifier", "name": "pred", "range": [ - 1033, - 1037 + 1037, + 1041 ], "loc": { "start": { @@ -2830,8 +2830,8 @@ } ], "range": [ - 1015, - 1039 + 1019, + 1043 ], "loc": { "start": { @@ -2845,8 +2845,8 @@ } }, "range": [ - 1015, - 1041 + 1019, + 1045 ], "loc": { "start": { @@ -2863,8 +2863,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 881, - 907 + 885, + 911 ], "loc": { "start": { @@ -2881,8 +2881,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 911, - 962 + 915, + 966 ], "loc": { "start": { @@ -2899,8 +2899,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 966, - 1011 + 970, + 1015 ], "loc": { "start": { @@ -2917,8 +2917,8 @@ } ], "range": [ - 757, - 1045 + 761, + 1049 ], "loc": { "start": { @@ -2948,8 +2948,8 @@ "type": "Identifier", "name": "node", "range": [ - 1060, - 1064 + 1064, + 1068 ], "loc": { "start": { @@ -2966,8 +2966,8 @@ "type": "Identifier", "name": "right", "range": [ - 1065, - 1070 + 1069, + 1074 ], "loc": { "start": { @@ -2981,8 +2981,8 @@ } }, "range": [ - 1060, - 1070 + 1064, + 1074 ], "loc": { "start": { @@ -2999,8 +2999,8 @@ "type": "Identifier", "name": "isleaf", "range": [ - 1071, - 1077 + 1075, + 1081 ], "loc": { "start": { @@ -3014,8 +3014,8 @@ } }, "range": [ - 1060, - 1077 + 1064, + 1081 ], "loc": { "start": { @@ -3030,8 +3030,8 @@ }, "arguments": [], "range": [ - 1060, - 1079 + 1064, + 1083 ], "loc": { "start": { @@ -3046,8 +3046,8 @@ }, "prefix": true, "range": [ - 1059, - 1079 + 1063, + 1083 ], "loc": { "start": { @@ -3072,8 +3072,8 @@ "type": "Identifier", "name": "succ", "range": [ - 1222, - 1226 + 1226, + 1230 ], "loc": { "start": { @@ -3093,8 +3093,8 @@ "type": "Identifier", "name": "node", "range": [ - 1229, - 1233 + 1233, + 1237 ], "loc": { "start": { @@ -3111,8 +3111,8 @@ "type": "Identifier", "name": "right", "range": [ - 1234, - 1239 + 1238, + 1243 ], "loc": { "start": { @@ -3126,8 +3126,8 @@ } }, "range": [ - 1229, - 1239 + 1233, + 1243 ], "loc": { "start": { @@ -3141,8 +3141,8 @@ } }, "range": [ - 1222, - 1239 + 1226, + 1243 ], "loc": { "start": { @@ -3158,8 +3158,8 @@ ], "kind": "const", "range": [ - 1216, - 1241 + 1220, + 1245 ], "loc": { "start": { @@ -3176,8 +3176,8 @@ "type": "Line", "value": " replace node's value with successor's value", "range": [ - 1087, - 1133 + 1091, + 1137 ], "loc": { "start": { @@ -3194,8 +3194,8 @@ "type": "Line", "value": " If there is no left child, then there can only be one right", "range": [ - 1137, - 1199 + 1141, + 1203 ], "loc": { "start": { @@ -3212,8 +3212,8 @@ "type": "Line", "value": " child.", "range": [ - 1203, - 1212 + 1207, + 1216 ], "loc": { "start": { @@ -3240,8 +3240,8 @@ "type": "Identifier", "name": "node", "range": [ - 1245, - 1249 + 1249, + 1253 ], "loc": { "start": { @@ -3258,8 +3258,8 @@ "type": "Identifier", "name": "value", "range": [ - 1250, - 1255 + 1254, + 1259 ], "loc": { "start": { @@ -3273,8 +3273,8 @@ } }, "range": [ - 1245, - 1255 + 1249, + 1259 ], "loc": { "start": { @@ -3294,8 +3294,8 @@ "type": "Identifier", "name": "succ", "range": [ - 1258, - 1262 + 1262, + 1266 ], "loc": { "start": { @@ -3312,8 +3312,8 @@ "type": "Identifier", "name": "value", "range": [ - 1263, - 1268 + 1267, + 1272 ], "loc": { "start": { @@ -3327,8 +3327,8 @@ } }, "range": [ - 1258, - 1268 + 1262, + 1272 ], "loc": { "start": { @@ -3342,8 +3342,8 @@ } }, "range": [ - 1245, - 1268 + 1249, + 1272 ], "loc": { "start": { @@ -3357,8 +3357,8 @@ } }, "range": [ - 1245, - 1270 + 1249, + 1274 ], "loc": { "start": { @@ -3375,8 +3375,8 @@ "type": "Line", "value": " delete successor node", "range": [ - 1274, - 1298 + 1278, + 1302 ], "loc": { "start": { @@ -3393,8 +3393,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1302, - 1353 + 1306, + 1357 ], "loc": { "start": { @@ -3411,8 +3411,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1357, - 1402 + 1361, + 1406 ], "loc": { "start": { @@ -3435,8 +3435,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1406, - 1422 + 1410, + 1426 ], "loc": { "start": { @@ -3454,8 +3454,8 @@ "type": "Identifier", "name": "succ", "range": [ - 1424, - 1428 + 1428, + 1432 ], "loc": { "start": { @@ -3470,8 +3470,8 @@ } ], "range": [ - 1406, - 1430 + 1410, + 1434 ], "loc": { "start": { @@ -3485,8 +3485,8 @@ } }, "range": [ - 1406, - 1432 + 1410, + 1436 ], "loc": { "start": { @@ -3503,8 +3503,8 @@ "type": "Line", "value": " delete successor node", "range": [ - 1274, - 1298 + 1278, + 1302 ], "loc": { "start": { @@ -3521,8 +3521,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1302, - 1353 + 1306, + 1357 ], "loc": { "start": { @@ -3539,8 +3539,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1357, - 1402 + 1361, + 1406 ], "loc": { "start": { @@ -3557,8 +3557,8 @@ } ], "range": [ - 1082, - 1436 + 1086, + 1440 ], "loc": { "start": { @@ -3580,8 +3580,8 @@ "type": "Identifier", "name": "node", "range": [ - 1450, - 1454 + 1454, + 1458 ], "loc": { "start": { @@ -3600,8 +3600,8 @@ "object": { "type": "ThisExpression", "range": [ - 1459, - 1463 + 1463, + 1467 ], "loc": { "start": { @@ -3618,8 +3618,8 @@ "type": "Identifier", "name": "root", "range": [ - 1464, - 1468 + 1468, + 1472 ], "loc": { "start": { @@ -3633,8 +3633,8 @@ } }, "range": [ - 1459, - 1468 + 1463, + 1472 ], "loc": { "start": { @@ -3648,8 +3648,8 @@ } }, "range": [ - 1450, - 1468 + 1454, + 1472 ], "loc": { "start": { @@ -3676,8 +3676,8 @@ "object": { "type": "ThisExpression", "range": [ - 1476, - 1480 + 1480, + 1484 ], "loc": { "start": { @@ -3694,8 +3694,8 @@ "type": "Identifier", "name": "root", "range": [ - 1481, - 1485 + 1485, + 1489 ], "loc": { "start": { @@ -3709,8 +3709,8 @@ } }, "range": [ - 1476, - 1485 + 1480, + 1489 ], "loc": { "start": { @@ -3728,8 +3728,8 @@ "value": null, "raw": "null", "range": [ - 1488, - 1492 + 1492, + 1496 ], "loc": { "start": { @@ -3743,8 +3743,8 @@ } }, "range": [ - 1476, - 1492 + 1480, + 1496 ], "loc": { "start": { @@ -3758,8 +3758,8 @@ } }, "range": [ - 1476, - 1494 + 1480, + 1498 ], "loc": { "start": { @@ -3774,8 +3774,8 @@ } ], "range": [ - 1471, - 1498 + 1475, + 1502 ], "loc": { "start": { @@ -3799,8 +3799,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1512, - 1528 + 1516, + 1532 ], "loc": { "start": { @@ -3818,8 +3818,8 @@ "type": "Identifier", "name": "node", "range": [ - 1530, - 1534 + 1534, + 1538 ], "loc": { "start": { @@ -3834,8 +3834,8 @@ } ], "range": [ - 1512, - 1536 + 1516, + 1540 ], "loc": { "start": { @@ -3849,8 +3849,8 @@ } }, "range": [ - 1512, - 1538 + 1516, + 1542 ], "loc": { "start": { @@ -3865,8 +3865,8 @@ } ], "range": [ - 1507, - 1542 + 1511, + 1546 ], "loc": { "start": { @@ -3880,8 +3880,8 @@ } }, "range": [ - 1445, - 1542 + 1449, + 1546 ], "loc": { "start": { @@ -3895,8 +3895,8 @@ } }, "range": [ - 1054, - 1542 + 1058, + 1546 ], "loc": { "start": { @@ -3910,8 +3910,8 @@ } }, "range": [ - 730, - 1542 + 734, + 1546 ], "loc": { "start": { @@ -3926,8 +3926,8 @@ } ], "range": [ - 725, - 1546 + 729, + 1550 ], "loc": { "start": { @@ -3943,8 +3943,8 @@ "generator": false, "expression": false, "range": [ - 716, - 1546 + 720, + 1550 ], "loc": { "start": { @@ -3960,8 +3960,8 @@ "kind": "method", "computed": false, "range": [ - 709, - 1546 + 713, + 1550 ], "loc": { "start": { @@ -3984,8 +3984,8 @@ "type": "Identifier", "name": "Symbol", "range": [ - 1551, - 1557 + 1555, + 1561 ], "loc": { "start": { @@ -4002,8 +4002,8 @@ "type": "Identifier", "name": "iterator", "range": [ - 1558, - 1566 + 1562, + 1570 ], "loc": { "start": { @@ -4017,8 +4017,8 @@ } }, "range": [ - 1551, - 1566 + 1555, + 1570 ], "loc": { "start": { @@ -4049,8 +4049,8 @@ "object": { "type": "ThisExpression", "range": [ - 1582, - 1586 + 1586, + 1590 ], "loc": { "start": { @@ -4067,8 +4067,8 @@ "type": "Identifier", "name": "root", "range": [ - 1587, - 1591 + 1591, + 1595 ], "loc": { "start": { @@ -4082,8 +4082,8 @@ } }, "range": [ - 1582, - 1591 + 1586, + 1595 ], "loc": { "start": { @@ -4101,8 +4101,8 @@ "value": null, "raw": "null", "range": [ - 1596, - 1600 + 1600, + 1604 ], "loc": { "start": { @@ -4116,8 +4116,8 @@ } }, "range": [ - 1582, - 1600 + 1586, + 1604 ], "loc": { "start": { @@ -4140,8 +4140,8 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 1610, - 1626 + 1614, + 1630 ], "loc": { "start": { @@ -4161,8 +4161,8 @@ "object": { "type": "ThisExpression", "range": [ - 1628, - 1632 + 1632, + 1636 ], "loc": { "start": { @@ -4179,8 +4179,8 @@ "type": "Identifier", "name": "root", "range": [ - 1633, - 1637 + 1637, + 1641 ], "loc": { "start": { @@ -4194,8 +4194,8 @@ } }, "range": [ - 1628, - 1637 + 1632, + 1641 ], "loc": { "start": { @@ -4210,8 +4210,8 @@ } ], "range": [ - 1610, - 1639 + 1614, + 1643 ], "loc": { "start": { @@ -4226,8 +4226,8 @@ }, "delegate": true, "range": [ - 1603, - 1639 + 1607, + 1643 ], "loc": { "start": { @@ -4241,8 +4241,8 @@ } }, "range": [ - 1603, - 1641 + 1607, + 1645 ], "loc": { "start": { @@ -4257,8 +4257,8 @@ }, "alternate": null, "range": [ - 1577, - 1641 + 1581, + 1645 ], "loc": { "start": { @@ -4273,8 +4273,8 @@ } ], "range": [ - 1572, - 1645 + 1576, + 1649 ], "loc": { "start": { @@ -4290,8 +4290,8 @@ "generator": true, "expression": false, "range": [ - 1568, - 1645 + 1572, + 1649 ], "loc": { "start": { @@ -4307,8 +4307,8 @@ "kind": "method", "computed": false, "range": [ - 1549, - 1645 + 1553, + 1649 ], "loc": { "start": { @@ -4328,8 +4328,8 @@ "type": "Identifier", "name": "from", "range": [ - 1655, - 1659 + 1659, + 1663 ], "loc": { "start": { @@ -4350,8 +4350,8 @@ "type": "Identifier", "name": "compare", "range": [ - 1662, - 1669 + 1666, + 1673 ], "loc": { "start": { @@ -4368,8 +4368,8 @@ "type": "Identifier", "name": "iterable", "range": [ - 1672, - 1680 + 1676, + 1684 ], "loc": { "start": { @@ -4395,8 +4395,8 @@ "type": "Identifier", "name": "tree", "range": [ - 1694, - 1698 + 1698, + 1702 ], "loc": { "start": { @@ -4415,8 +4415,8 @@ "type": "Identifier", "name": "RedBlackTree", "range": [ - 1705, - 1717 + 1709, + 1721 ], "loc": { "start": { @@ -4434,8 +4434,8 @@ "type": "Identifier", "name": "compare", "range": [ - 1719, - 1726 + 1723, + 1730 ], "loc": { "start": { @@ -4450,8 +4450,8 @@ } ], "range": [ - 1701, - 1728 + 1705, + 1732 ], "loc": { "start": { @@ -4465,8 +4465,8 @@ } }, "range": [ - 1694, - 1728 + 1698, + 1732 ], "loc": { "start": { @@ -4482,8 +4482,8 @@ ], "kind": "const", "range": [ - 1688, - 1730 + 1692, + 1734 ], "loc": { "start": { @@ -4507,8 +4507,8 @@ "type": "Identifier", "name": "element", "range": [ - 1746, - 1753 + 1750, + 1757 ], "loc": { "start": { @@ -4523,8 +4523,8 @@ }, "init": null, "range": [ - 1746, - 1753 + 1750, + 1757 ], "loc": { "start": { @@ -4540,8 +4540,8 @@ ], "kind": "const", "range": [ - 1740, - 1753 + 1744, + 1757 ], "loc": { "start": { @@ -4558,8 +4558,8 @@ "type": "Identifier", "name": "iterable", "range": [ - 1757, - 1765 + 1761, + 1769 ], "loc": { "start": { @@ -4583,8 +4583,8 @@ "type": "Identifier", "name": "tree", "range": [ - 1768, - 1772 + 1772, + 1776 ], "loc": { "start": { @@ -4601,8 +4601,8 @@ "type": "Identifier", "name": "add", "range": [ - 1773, - 1776 + 1777, + 1780 ], "loc": { "start": { @@ -4616,8 +4616,8 @@ } }, "range": [ - 1768, - 1776 + 1772, + 1780 ], "loc": { "start": { @@ -4635,8 +4635,8 @@ "type": "Identifier", "name": "element", "range": [ - 1778, - 1785 + 1782, + 1789 ], "loc": { "start": { @@ -4651,8 +4651,8 @@ } ], "range": [ - 1768, - 1787 + 1772, + 1791 ], "loc": { "start": { @@ -4666,8 +4666,8 @@ } }, "range": [ - 1768, - 1789 + 1772, + 1793 ], "loc": { "start": { @@ -4681,8 +4681,8 @@ } }, "range": [ - 1734, - 1789 + 1738, + 1793 ], "loc": { "start": { @@ -4701,8 +4701,8 @@ "type": "Identifier", "name": "tree", "range": [ - 1800, - 1804 + 1804, + 1808 ], "loc": { "start": { @@ -4716,8 +4716,8 @@ } }, "range": [ - 1793, - 1806 + 1797, + 1810 ], "loc": { "start": { @@ -4732,8 +4732,8 @@ } ], "range": [ - 1683, - 1810 + 1687, + 1814 ], "loc": { "start": { @@ -4749,8 +4749,8 @@ "generator": false, "expression": false, "range": [ - 1660, - 1810 + 1664, + 1814 ], "loc": { "start": { @@ -4766,8 +4766,8 @@ "kind": "method", "computed": false, "range": [ - 1648, - 1810 + 1652, + 1814 ], "loc": { "start": { @@ -4783,8 +4783,8 @@ } ], "range": [ - 279, - 1813 + 283, + 1817 ], "loc": { "start": { @@ -4798,8 +4798,8 @@ } }, "range": [ - 260, - 1813 + 264, + 1817 ], "loc": { "start": { @@ -4817,8 +4817,8 @@ "specifiers": [], "source": null, "range": [ - 253, - 1813 + 257, + 1817 ], "loc": { "start": { @@ -4835,7 +4835,7 @@ "sourceType": "module", "range": [ 1, - 1813 + 1817 ], "loc": { "start": { @@ -4852,8 +4852,8 @@ "type": "Line", "value": " replace node's value with predecessor's value", "range": [ - 762, - 810 + 766, + 814 ], "loc": { "start": { @@ -4870,8 +4870,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 881, - 907 + 885, + 911 ], "loc": { "start": { @@ -4888,8 +4888,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 911, - 962 + 915, + 966 ], "loc": { "start": { @@ -4906,8 +4906,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 966, - 1011 + 970, + 1015 ], "loc": { "start": { @@ -4924,8 +4924,8 @@ "type": "Line", "value": " replace node's value with successor's value", "range": [ - 1087, - 1133 + 1091, + 1137 ], "loc": { "start": { @@ -4942,8 +4942,8 @@ "type": "Line", "value": " If there is no left child, then there can only be one right", "range": [ - 1137, - 1199 + 1141, + 1203 ], "loc": { "start": { @@ -4960,8 +4960,8 @@ "type": "Line", "value": " child.", "range": [ - 1203, - 1212 + 1207, + 1216 ], "loc": { "start": { @@ -4978,8 +4978,8 @@ "type": "Line", "value": " delete successor node", "range": [ - 1274, - 1298 + 1278, + 1302 ], "loc": { "start": { @@ -4996,8 +4996,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1302, - 1353 + 1306, + 1357 ], "loc": { "start": { @@ -5014,8 +5014,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1357, - 1402 + 1361, + 1406 ], "loc": { "start": { diff --git a/ast/source/adt/index.js.json b/ast/source/adt/index.js.json index dcc63ed..12455ab 100644 --- a/ast/source/adt/index.js.json +++ b/ast/source/adt/index.js.json @@ -5,11 +5,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./RedBlackTree", - "raw": "'./RedBlackTree'", + "value": "./Leaf", + "raw": "'./Leaf'", "range": [ 14, - 30 + 22 ], "loc": { "start": { @@ -18,13 +18,13 @@ }, "end": { "line": 1, - "column": 30 + "column": 22 } } }, "range": [ 0, - 32 + 24 ], "loc": { "start": { @@ -33,6 +33,78 @@ }, "end": { "line": 1, + "column": 24 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./Node", + "raw": "'./Node'", + "range": [ + 39, + 47 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 22 + } + } + }, + "range": [ + 25, + 49 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./RedBlackTree", + "raw": "'./RedBlackTree'", + "range": [ + 64, + 80 + ], + "loc": { + "start": { + "line": 3, + "column": 14 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + "range": [ + 50, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, "column": 32 } } @@ -41,7 +113,7 @@ "sourceType": "module", "range": [ 0, - 32 + 82 ], "loc": { "start": { @@ -49,7 +121,7 @@ "column": 0 }, "end": { - "line": 1, + "line": 3, "column": 32 } }, diff --git a/ast/source/base/index.js.json b/ast/source/base/index.js.json deleted file mode 100644 index ebc9ffd..0000000 --- a/ast/source/base/index.js.json +++ /dev/null @@ -1,309 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./colors", - "raw": "'./colors'", - "range": [ - 14, - 24 - ], - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 24 - } - } - }, - "range": [ - 0, - 26 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./debug", - "raw": "'./debug'", - "range": [ - 41, - 50 - ], - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 23 - } - } - }, - "range": [ - 27, - 52 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./find", - "raw": "'./find'", - "range": [ - 67, - 75 - ], - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 22 - } - } - }, - "range": [ - 53, - 77 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 24 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./inordertraversal", - "raw": "'./inordertraversal'", - "range": [ - 92, - 112 - ], - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 34 - } - } - }, - "range": [ - 78, - 114 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 36 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./insert", - "raw": "'./insert'", - "range": [ - 129, - 139 - ], - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - "range": [ - 115, - 141 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 26 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./replace_node", - "raw": "'./replace_node'", - "range": [ - 156, - 172 - ], - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 30 - } - } - }, - "range": [ - 142, - 174 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 32 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./rotate_left", - "raw": "'./rotate_left'", - "range": [ - 189, - 204 - ], - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 29 - } - } - }, - "range": [ - 175, - 206 - ], - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 31 - } - } - }, - { - "type": "ExportAllDeclaration", - "source": { - "type": "Literal", - "value": "./rotate_right", - "raw": "'./rotate_right'", - "range": [ - 221, - 237 - ], - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 30 - } - } - }, - "range": [ - 207, - 239 - ], - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 32 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 239 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 32 - } - }, - "comments": [] -} \ No newline at end of file diff --git a/ast/source/base/colors.js.json b/ast/source/color/BLACK.js.json similarity index 51% rename from ast/source/base/colors.js.json rename to ast/source/color/BLACK.js.json index 956c7fb..12e437a 100644 --- a/ast/source/base/colors.js.json +++ b/ast/source/color/BLACK.js.json @@ -95,107 +95,12 @@ "column": 24 } } - }, - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "RED", - "range": [ - 38, - 41 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - "init": { - "type": "Literal", - "value": 1, - "raw": "1", - "range": [ - 44, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 19 - }, - "end": { - "line": 2, - "column": 20 - } - } - }, - "range": [ - 38, - 45 - ], - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 20 - } - } - } - ], - "kind": "const", - "range": [ - 32, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 22 - } - }, - "leadingComments": [], - "trailingComments": [] - }, - "specifiers": [], - "source": null, - "range": [ - 25, - 47 - ], - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 22 - } - } } ], "sourceType": "module", "range": [ 0, - 47 + 24 ], "loc": { "start": { @@ -203,8 +108,8 @@ "column": 0 }, "end": { - "line": 2, - "column": 22 + "line": 1, + "column": 24 } }, "comments": [] diff --git a/ast/source/color/RED.js.json b/ast/source/color/RED.js.json new file mode 100644 index 0000000..87d4a3b --- /dev/null +++ b/ast/source/color/RED.js.json @@ -0,0 +1,116 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "RED", + "range": [ + 13, + 16 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 16 + } + } + }, + "init": { + "type": "Literal", + "value": 1, + "raw": "1", + "range": [ + 19, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 13, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 13 + }, + "end": { + "line": 1, + "column": 20 + } + } + } + ], + "kind": "const", + "range": [ + 7, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 22 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/node/index.js.json b/ast/source/color/index.js.json similarity index 81% rename from ast/source/node/index.js.json rename to ast/source/color/index.js.json index 4ff3703..1f4c524 100644 --- a/ast/source/node/index.js.json +++ b/ast/source/color/index.js.json @@ -5,11 +5,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./Leaf", - "raw": "'./Leaf'", + "value": "./BLACK", + "raw": "'./BLACK'", "range": [ 14, - 22 + 23 ], "loc": { "start": { @@ -18,13 +18,13 @@ }, "end": { "line": 1, - "column": 22 + "column": 23 } } }, "range": [ 0, - 24 + 25 ], "loc": { "start": { @@ -33,7 +33,7 @@ }, "end": { "line": 1, - "column": 24 + "column": 25 } } }, @@ -41,10 +41,10 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./Node", - "raw": "'./Node'", + "value": "./RED", + "raw": "'./RED'", "range": [ - 39, + 40, 47 ], "loc": { @@ -54,12 +54,12 @@ }, "end": { "line": 2, - "column": 22 + "column": 21 } } }, "range": [ - 25, + 26, 49 ], "loc": { @@ -69,7 +69,7 @@ }, "end": { "line": 2, - "column": 24 + "column": 23 } } } @@ -86,7 +86,7 @@ }, "end": { "line": 2, - "column": 24 + "column": 23 } }, "comments": [] diff --git a/ast/source/base/debug.js.json b/ast/source/debug/debug.js.json similarity index 77% rename from ast/source/base/debug.js.json rename to ast/source/debug/debug.js.json index bc0e338..f42a39d 100644 --- a/ast/source/base/debug.js.json +++ b/ast/source/debug/debug.js.json @@ -5,90 +5,72 @@ "type": "ImportDeclaration", "specifiers": [ { - "type": "ImportSpecifier", + "type": "ImportDefaultSpecifier", "local": { "type": "Identifier", - "name": "BLACK", - "range": [ - 10, - 15 - ], - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 14 - } - } - }, - "imported": { - "type": "Identifier", - "name": "BLACK", + "name": "chalk", "range": [ - 10, - 15 + 7, + 12 ], "loc": { "start": { - "line": 2, - "column": 9 + "line": 1, + "column": 7 }, "end": { - "line": 2, - "column": 14 + "line": 1, + "column": 12 } } }, "range": [ - 10, - 15 + 7, + 12 ], "loc": { "start": { - "line": 2, - "column": 9 + "line": 1, + "column": 7 }, "end": { - "line": 2, - "column": 14 + "line": 1, + "column": 12 } } } ], "source": { "type": "Literal", - "value": "./colors", - "raw": "'./colors'", + "value": "chalk", + "raw": "'chalk'", "range": [ - 23, - 33 + 18, + 25 ], "loc": { "start": { - "line": 2, - "column": 22 + "line": 1, + "column": 18 }, "end": { - "line": 2, - "column": 32 + "line": 1, + "column": 25 } } }, "range": [ - 1, - 35 + 0, + 27 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 2, - "column": 34 + "line": 1, + "column": 27 } } }, @@ -96,72 +78,90 @@ "type": "ImportDeclaration", "specifiers": [ { - "type": "ImportDefaultSpecifier", + "type": "ImportSpecifier", "local": { "type": "Identifier", - "name": "chalk", + "name": "BLACK", "range": [ - 44, - 49 + 38, + 43 ], "loc": { "start": { - "line": 4, - "column": 7 + "line": 3, + "column": 9 }, "end": { - "line": 4, - "column": 12 + "line": 3, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 38, + 43 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 14 } } }, "range": [ - 44, - 49 + 38, + 43 ], "loc": { "start": { - "line": 4, - "column": 7 + "line": 3, + "column": 9 }, "end": { - "line": 4, - "column": 12 + "line": 3, + "column": 14 } } } ], "source": { "type": "Literal", - "value": "chalk", - "raw": "'chalk'", + "value": "..", + "raw": "'..'", "range": [ - 55, - 62 + 51, + 55 ], "loc": { "start": { - "line": 4, - "column": 18 + "line": 3, + "column": 22 }, "end": { - "line": 4, - "column": 25 + "line": 3, + "column": 26 } } }, "range": [ - 37, - 64 + 29, + 57 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 0 }, "end": { - "line": 4, - "column": 27 + "line": 3, + "column": 28 } } }, @@ -173,16 +173,16 @@ "type": "Identifier", "name": "debug", "range": [ - 82, - 87 + 75, + 80 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 16 }, "end": { - "line": 6, + "line": 5, "column": 21 } } @@ -192,16 +192,16 @@ "type": "Identifier", "name": "node", "range": [ - 90, - 94 + 83, + 87 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 24 }, "end": { - "line": 6, + "line": 5, "column": 28 } } @@ -221,16 +221,16 @@ "type": "Identifier", "name": "node", "range": [ - 106, - 110 + 99, + 103 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 6 }, "end": { - "line": 8, + "line": 7, "column": 10 } } @@ -239,47 +239,47 @@ "type": "Identifier", "name": "isleaf", "range": [ - 111, - 117 + 104, + 110 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 11 }, "end": { - "line": 8, + "line": 7, "column": 17 } } }, "range": [ - 106, - 117 + 99, + 110 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 6 }, "end": { - "line": 8, + "line": 7, "column": 17 } } }, "arguments": [], "range": [ - 106, - 120 + 99, + 113 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 6 }, "end": { - "line": 8, + "line": 7, "column": 20 } } @@ -295,16 +295,16 @@ "type": "Identifier", "name": "chalk", "range": [ - 130, - 135 + 123, + 128 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 30 }, "end": { - "line": 8, + "line": 7, "column": 35 } } @@ -313,31 +313,31 @@ "type": "Identifier", "name": "bgBlack", "range": [ - 136, - 143 + 129, + 136 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 36 }, "end": { - "line": 8, + "line": 7, "column": 43 } } }, "range": [ - 130, - 143 + 123, + 136 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 30 }, "end": { - "line": 8, + "line": 7, "column": 43 } } @@ -348,63 +348,63 @@ "value": "L", "raw": "'L'", "range": [ - 144, - 147 + 137, + 140 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 44 }, "end": { - "line": 8, + "line": 7, "column": 47 } } } ], "range": [ - 130, - 148 + 123, + 141 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 30 }, "end": { - "line": 8, + "line": 7, "column": 48 } } }, "range": [ - 123, - 150 + 116, + 143 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 23 }, "end": { - "line": 8, + "line": 7, "column": 50 } } }, "alternate": null, "range": [ - 101, - 150 + 94, + 143 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 1 }, "end": { - "line": 8, + "line": 7, "column": 50 } } @@ -418,16 +418,16 @@ "type": "Identifier", "name": "repr", "range": [ - 159, - 163 + 152, + 156 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 7 }, "end": { - "line": 10, + "line": 9, "column": 11 } } @@ -444,16 +444,16 @@ "type": "Identifier", "name": "node", "range": [ - 166, - 170 + 159, + 163 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 14 }, "end": { - "line": 10, + "line": 9, "column": 18 } } @@ -462,31 +462,31 @@ "type": "Identifier", "name": "color", "range": [ - 171, - 176 + 164, + 169 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 19 }, "end": { - "line": 10, + "line": 9, "column": 24 } } }, "range": [ - 166, - 176 + 159, + 169 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 14 }, "end": { - "line": 10, + "line": 9, "column": 24 } } @@ -495,31 +495,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 181, - 186 + 174, + 179 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 29 }, "end": { - "line": 10, + "line": 9, "column": 34 } } }, "range": [ - 166, - 186 + 159, + 179 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 14 }, "end": { - "line": 10, + "line": 9, "column": 34 } } @@ -533,16 +533,16 @@ "type": "Identifier", "name": "chalk", "range": [ - 189, - 194 + 182, + 187 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 37 }, "end": { - "line": 10, + "line": 9, "column": 42 } } @@ -551,31 +551,31 @@ "type": "Identifier", "name": "bgBlack", "range": [ - 195, - 202 + 188, + 195 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 43 }, "end": { - "line": 10, + "line": 9, "column": 50 } } }, "range": [ - 189, - 202 + 182, + 195 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 37 }, "end": { - "line": 10, + "line": 9, "column": 50 } } @@ -588,16 +588,16 @@ "type": "Identifier", "name": "node", "range": [ - 203, - 207 + 196, + 200 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 51 }, "end": { - "line": 10, + "line": 9, "column": 55 } } @@ -606,47 +606,47 @@ "type": "Identifier", "name": "value", "range": [ - 208, - 213 + 201, + 206 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 56 }, "end": { - "line": 10, + "line": 9, "column": 61 } } }, "range": [ - 203, - 213 + 196, + 206 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 51 }, "end": { - "line": 10, + "line": 9, "column": 61 } } } ], "range": [ - 189, - 214 + 182, + 207 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 37 }, "end": { - "line": 10, + "line": 9, "column": 62 } } @@ -660,16 +660,16 @@ "type": "Identifier", "name": "chalk", "range": [ - 217, - 222 + 210, + 215 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 65 }, "end": { - "line": 10, + "line": 9, "column": 70 } } @@ -678,31 +678,31 @@ "type": "Identifier", "name": "bgRed", "range": [ - 223, - 228 + 216, + 221 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 71 }, "end": { - "line": 10, + "line": 9, "column": 76 } } }, "range": [ - 217, - 228 + 210, + 221 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 65 }, "end": { - "line": 10, + "line": 9, "column": 76 } } @@ -715,16 +715,16 @@ "type": "Identifier", "name": "node", "range": [ - 230, - 234 + 223, + 227 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 78 }, "end": { - "line": 10, + "line": 9, "column": 82 } } @@ -733,77 +733,77 @@ "type": "Identifier", "name": "value", "range": [ - 235, - 240 + 228, + 233 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 83 }, "end": { - "line": 10, + "line": 9, "column": 88 } } }, "range": [ - 230, - 240 + 223, + 233 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 78 }, "end": { - "line": 10, + "line": 9, "column": 88 } } } ], "range": [ - 217, - 242 + 210, + 235 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 65 }, "end": { - "line": 10, + "line": 9, "column": 90 } } }, "range": [ - 166, - 242 + 159, + 235 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 14 }, "end": { - "line": 10, + "line": 9, "column": 90 } } }, "range": [ - 159, - 242 + 152, + 235 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 7 }, "end": { - "line": 10, + "line": 9, "column": 90 } } @@ -811,16 +811,16 @@ ], "kind": "const", "range": [ - 153, - 244 + 146, + 237 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 1 }, "end": { - "line": 10, + "line": 9, "column": 92 } } @@ -838,16 +838,16 @@ }, "tail": false, "range": [ - 254, - 258 + 247, + 251 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 12 } } @@ -860,16 +860,16 @@ }, "tail": false, "range": [ - 274, - 279 + 267, + 272 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 28 }, "end": { - "line": 12, + "line": 11, "column": 33 } } @@ -882,16 +882,16 @@ }, "tail": false, "range": [ - 283, - 288 + 276, + 281 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 37 }, "end": { - "line": 12, + "line": 11, "column": 42 } } @@ -904,16 +904,16 @@ }, "tail": true, "range": [ - 305, - 308 + 298, + 301 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 59 }, "end": { - "line": 12, + "line": 11, "column": 62 } } @@ -926,16 +926,16 @@ "type": "Identifier", "name": "debug", "range": [ - 258, - 263 + 251, + 256 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 12 }, "end": { - "line": 12, + "line": 11, "column": 17 } } @@ -948,16 +948,16 @@ "type": "Identifier", "name": "node", "range": [ - 264, - 268 + 257, + 261 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 18 }, "end": { - "line": 12, + "line": 11, "column": 22 } } @@ -966,47 +966,47 @@ "type": "Identifier", "name": "left", "range": [ - 269, - 273 + 262, + 266 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 23 }, "end": { - "line": 12, + "line": 11, "column": 27 } } }, "range": [ - 264, - 273 + 257, + 266 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 18 }, "end": { - "line": 12, + "line": 11, "column": 27 } } } ], "range": [ - 258, - 274 + 251, + 267 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 12 }, "end": { - "line": 12, + "line": 11, "column": 28 } } @@ -1015,16 +1015,16 @@ "type": "Identifier", "name": "repr", "range": [ - 279, - 283 + 272, + 276 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 33 }, "end": { - "line": 12, + "line": 11, "column": 37 } } @@ -1035,16 +1035,16 @@ "type": "Identifier", "name": "debug", "range": [ - 288, - 293 + 281, + 286 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 42 }, "end": { - "line": 12, + "line": 11, "column": 47 } } @@ -1057,16 +1057,16 @@ "type": "Identifier", "name": "node", "range": [ - 294, - 298 + 287, + 291 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 48 }, "end": { - "line": 12, + "line": 11, "column": 52 } } @@ -1075,94 +1075,94 @@ "type": "Identifier", "name": "right", "range": [ - 299, - 304 + 292, + 297 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 53 }, "end": { - "line": 12, + "line": 11, "column": 58 } } }, "range": [ - 294, - 304 + 287, + 297 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 48 }, "end": { - "line": 12, + "line": 11, "column": 58 } } } ], "range": [ - 288, - 305 + 281, + 298 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 42 }, "end": { - "line": 12, + "line": 11, "column": 59 } } } ], "range": [ - 254, - 308 + 247, + 301 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 62 } } }, "range": [ - 247, - 310 + 240, + 303 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 64 } } } ], "range": [ - 97, - 313 + 90, + 306 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 31 }, "end": { - "line": 14, + "line": 13, "column": 1 } } @@ -1170,16 +1170,16 @@ "generator": false, "expression": false, "range": [ - 73, - 313 + 66, + 306 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 7 }, "end": { - "line": 14, + "line": 13, "column": 1 } }, @@ -1189,16 +1189,16 @@ "specifiers": [], "source": null, "range": [ - 66, - 313 + 59, + 306 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 14, + "line": 13, "column": 1 } } @@ -1206,16 +1206,16 @@ ], "sourceType": "module", "range": [ - 1, - 313 + 0, + 306 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 14, + "line": 13, "column": 1 } }, diff --git a/ast/source/debug/index.js.json b/ast/source/debug/index.js.json new file mode 100644 index 0000000..9f9fc9b --- /dev/null +++ b/ast/source/debug/index.js.json @@ -0,0 +1,57 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./debug", + "raw": "'./debug'", + "range": [ + 14, + 23 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + } + }, + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 25 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/index.js.json b/ast/source/index.js.json index 376234d..907da0b 100644 --- a/ast/source/index.js.json +++ b/ast/source/index.js.json @@ -41,11 +41,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./base", - "raw": "'./base'", + "value": "./color", + "raw": "'./color'", "range": [ 38, - 46 + 47 ], "loc": { "start": { @@ -54,13 +54,13 @@ }, "end": { "line": 2, - "column": 22 + "column": 23 } } }, "range": [ 24, - 48 + 49 ], "loc": { "start": { @@ -69,7 +69,7 @@ }, "end": { "line": 2, - "column": 24 + "column": 25 } } }, @@ -77,10 +77,10 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./family", - "raw": "'./family'", + "value": "./debug", + "raw": "'./debug'", "range": [ - 63, + 64, 73 ], "loc": { @@ -90,12 +90,12 @@ }, "end": { "line": 3, - "column": 24 + "column": 23 } } }, "range": [ - 49, + 50, 75 ], "loc": { @@ -105,7 +105,7 @@ }, "end": { "line": 3, - "column": 26 + "column": 25 } } }, @@ -113,11 +113,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./insertion", - "raw": "'./insertion'", + "value": "./family", + "raw": "'./family'", "range": [ 90, - 103 + 100 ], "loc": { "start": { @@ -126,13 +126,13 @@ }, "end": { "line": 4, - "column": 27 + "column": 24 } } }, "range": [ 76, - 105 + 102 ], "loc": { "start": { @@ -141,7 +141,7 @@ }, "end": { "line": 4, - "column": 29 + "column": 26 } } }, @@ -149,11 +149,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./node", - "raw": "'./node'", + "value": "./insertion", + "raw": "'./insertion'", "range": [ - 120, - 128 + 117, + 130 ], "loc": { "start": { @@ -162,13 +162,13 @@ }, "end": { "line": 5, - "column": 22 + "column": 27 } } }, "range": [ - 106, - 130 + 103, + 132 ], "loc": { "start": { @@ -177,7 +177,7 @@ }, "end": { "line": 5, - "column": 24 + "column": 29 } } }, @@ -188,8 +188,8 @@ "value": "./removal", "raw": "'./removal'", "range": [ - 145, - 156 + 147, + 158 ], "loc": { "start": { @@ -203,8 +203,8 @@ } }, "range": [ - 131, - 158 + 133, + 160 ], "loc": { "start": { @@ -216,12 +216,120 @@ "column": 27 } } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./rotate", + "raw": "'./rotate'", + "range": [ + 175, + 185 + ], + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 161, + 187 + ], + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./search", + "raw": "'./search'", + "range": [ + 202, + 212 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + "range": [ + 188, + 214 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 26 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./traversal", + "raw": "'./traversal'", + "range": [ + 229, + 242 + ], + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + "range": [ + 215, + 244 + ], + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 29 + } + } } ], "sourceType": "module", "range": [ 0, - 158 + 244 ], "loc": { "start": { @@ -229,8 +337,8 @@ "column": 0 }, "end": { - "line": 6, - "column": 27 + "line": 9, + "column": 29 } }, "comments": [] diff --git a/ast/source/insertion/index.js.json b/ast/source/insertion/index.js.json index e394996..4439810 100644 --- a/ast/source/insertion/index.js.json +++ b/ast/source/insertion/index.js.json @@ -5,11 +5,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./insert_case1", - "raw": "'./insert_case1'", + "value": "./insert", + "raw": "'./insert'", "range": [ 14, - 30 + 24 ], "loc": { "start": { @@ -18,13 +18,13 @@ }, "end": { "line": 1, - "column": 30 + "column": 24 } } }, "range": [ 0, - 32 + 26 ], "loc": { "start": { @@ -33,7 +33,7 @@ }, "end": { "line": 1, - "column": 32 + "column": 26 } } }, @@ -41,11 +41,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./insert_case2", - "raw": "'./insert_case2'", + "value": "./insert_case1", + "raw": "'./insert_case1'", "range": [ - 47, - 63 + 41, + 57 ], "loc": { "start": { @@ -59,8 +59,8 @@ } }, "range": [ - 33, - 65 + 27, + 59 ], "loc": { "start": { @@ -77,11 +77,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./insert_case3", - "raw": "'./insert_case3'", + "value": "./insert_case2", + "raw": "'./insert_case2'", "range": [ - 80, - 96 + 74, + 90 ], "loc": { "start": { @@ -95,8 +95,8 @@ } }, "range": [ - 66, - 98 + 60, + 92 ], "loc": { "start": { @@ -113,11 +113,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./insert_case4", - "raw": "'./insert_case4'", + "value": "./insert_case3", + "raw": "'./insert_case3'", "range": [ - 113, - 129 + 107, + 123 ], "loc": { "start": { @@ -131,8 +131,8 @@ } }, "range": [ - 99, - 131 + 93, + 125 ], "loc": { "start": { @@ -149,11 +149,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./insert_case5", - "raw": "'./insert_case5'", + "value": "./insert_case4", + "raw": "'./insert_case4'", "range": [ - 146, - 162 + 140, + 156 ], "loc": { "start": { @@ -167,8 +167,8 @@ } }, "range": [ - 132, - 164 + 126, + 158 ], "loc": { "start": { @@ -180,12 +180,48 @@ "column": 32 } } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./insert_case5", + "raw": "'./insert_case5'", + "range": [ + 173, + 189 + ], + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + "range": [ + 159, + 191 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 32 + } + } } ], "sourceType": "module", "range": [ 0, - 164 + 191 ], "loc": { "start": { @@ -193,7 +229,7 @@ "column": 0 }, "end": { - "line": 5, + "line": 6, "column": 32 } }, diff --git a/ast/source/base/insert.js.json b/ast/source/insertion/insert.js.json similarity index 100% rename from ast/source/base/insert.js.json rename to ast/source/insertion/insert.js.json diff --git a/ast/source/removal/delete_case1.js.json b/ast/source/removal/delete_case1.js.json index 390ad08..4b0ecf4 100644 --- a/ast/source/removal/delete_case1.js.json +++ b/ast/source/removal/delete_case1.js.json @@ -10,16 +10,16 @@ "type": "Identifier", "name": "delete_case2", "range": [ - 10, - 22 + 9, + 21 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 21 } } @@ -28,31 +28,31 @@ "type": "Identifier", "name": "delete_case2", "range": [ - 10, - 22 + 9, + 21 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 21 } } }, "range": [ - 10, - 22 + 9, + 21 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 21 } } @@ -63,108 +63,35 @@ "value": "./delete_case2", "raw": "'./delete_case2'", "range": [ - 30, - 46 + 29, + 45 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 29 }, "end": { - "line": 2, + "line": 1, "column": 45 } } }, "range": [ - 1, - 48 + 0, + 47 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 2, + "line": 1, "column": 47 } } }, - { - "type": "ImportDeclaration", - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "local": { - "type": "Identifier", - "name": "assert", - "range": [ - 57, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - "range": [ - 57, - 63 - ], - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 13 - } - } - } - ], - "source": { - "type": "Literal", - "value": "assert", - "raw": "'assert'", - "range": [ - 69, - 77 - ], - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - "range": [ - 50, - 79 - ], - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 29 - } - } - }, { "type": "ExportNamedDeclaration", "declaration": { @@ -173,16 +100,16 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 97, - 109 + 65, + 77 ], "loc": { "start": { - "line": 6, + "line": 3, "column": 16 }, "end": { - "line": 6, + "line": 3, "column": 28 } } @@ -192,17 +119,17 @@ "type": "Identifier", "name": "n", "range": [ - 110, - 111 + 80, + 81 ], "loc": { "start": { - "line": 6, - "column": 29 + "line": 3, + "column": 31 }, "end": { - "line": 6, - "column": 30 + "line": 3, + "column": 32 } } } @@ -222,17 +149,17 @@ "type": "Identifier", "name": "n", "range": [ - 120, - 121 + 96, + 97 ], "loc": { "start": { - "line": 8, - "column": 5 + "line": 5, + "column": 9 }, "end": { - "line": 8, - "column": 6 + "line": 5, + "column": 10 } } }, @@ -240,32 +167,32 @@ "type": "Identifier", "name": "parent", "range": [ - 122, - 128 + 98, + 104 ], "loc": { "start": { - "line": 8, - "column": 7 + "line": 5, + "column": 11 }, "end": { - "line": 8, - "column": 13 + "line": 5, + "column": 17 } } }, "range": [ - 120, - 128 + 96, + 104 ], "loc": { "start": { - "line": 8, - "column": 5 + "line": 5, + "column": 9 }, "end": { - "line": 8, - "column": 13 + "line": 5, + "column": 17 } } }, @@ -274,32 +201,32 @@ "value": null, "raw": "null", "range": [ - 133, - 137 + 109, + 113 ], "loc": { "start": { - "line": 8, - "column": 18 + "line": 5, + "column": 22 }, "end": { - "line": 8, - "column": 22 + "line": 5, + "column": 26 } } }, "range": [ - 120, - 137 + 96, + 113 ], "loc": { "start": { - "line": 8, - "column": 5 + "line": 5, + "column": 9 }, "end": { - "line": 8, - "column": 22 + "line": 5, + "column": 26 } } }, @@ -311,17 +238,17 @@ "type": "Identifier", "name": "delete_case2", "range": [ - 141, - 153 + 116, + 128 ], "loc": { "start": { - "line": 9, - "column": 2 + "line": 5, + "column": 29 }, "end": { - "line": 9, - "column": 14 + "line": 5, + "column": 41 } } }, @@ -330,79 +257,79 @@ "type": "Identifier", "name": "n", "range": [ - 154, - 155 + 130, + 131 ], "loc": { "start": { - "line": 9, - "column": 15 + "line": 5, + "column": 43 }, "end": { - "line": 9, - "column": 16 + "line": 5, + "column": 44 } } } ], "range": [ - 141, - 156 + 116, + 133 ], "loc": { "start": { - "line": 9, - "column": 2 + "line": 5, + "column": 29 }, "end": { - "line": 9, - "column": 17 + "line": 5, + "column": 46 } } }, "range": [ - 141, - 157 + 116, + 135 ], "loc": { "start": { - "line": 9, - "column": 2 + "line": 5, + "column": 29 }, "end": { - "line": 9, - "column": 18 + "line": 5, + "column": 48 } } }, "alternate": null, "range": [ - 116, - 157 + 91, + 135 ], "loc": { "start": { - "line": 8, - "column": 1 + "line": 5, + "column": 4 }, "end": { - "line": 9, - "column": 18 + "line": 5, + "column": 48 } } } ], "range": [ - 113, - 159 + 84, + 138 ], "loc": { "start": { - "line": 7, - "column": 0 + "line": 3, + "column": 35 }, "end": { - "line": 10, + "line": 7, "column": 1 } } @@ -410,16 +337,16 @@ "generator": false, "expression": false, "range": [ - 88, - 159 + 56, + 138 ], "loc": { "start": { - "line": 6, + "line": 3, "column": 7 }, "end": { - "line": 10, + "line": 7, "column": 1 } }, @@ -429,16 +356,16 @@ "specifiers": [], "source": null, "range": [ - 81, - 159 + 49, + 138 ], "loc": { "start": { - "line": 6, + "line": 3, "column": 0 }, "end": { - "line": 10, + "line": 7, "column": 1 } } @@ -446,16 +373,16 @@ ], "sourceType": "module", "range": [ - 1, - 159 + 0, + 138 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 10, + "line": 7, "column": 1 } }, diff --git a/ast/source/removal/delete_case3.js.json b/ast/source/removal/delete_case3.js.json index b591880..b77b0a2 100644 --- a/ast/source/removal/delete_case3.js.json +++ b/ast/source/removal/delete_case3.js.json @@ -10,16 +10,16 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -28,31 +28,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } }, "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -63,16 +63,16 @@ "type": "Identifier", "name": "RED", "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -81,31 +81,31 @@ "type": "Identifier", "name": "RED", "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } }, "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -116,16 +116,16 @@ "type": "Identifier", "name": "sibling", "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } @@ -134,31 +134,31 @@ "type": "Identifier", "name": "sibling", "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } }, "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } @@ -169,31 +169,31 @@ "value": "..", "raw": "'..'", "range": [ - 39, - 43 + 38, + 42 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 38 }, "end": { - "line": 2, + "line": 1, "column": 42 } } }, "range": [ - 1, - 45 + 0, + 44 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 2, + "line": 1, "column": 44 } } @@ -207,16 +207,16 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 56, - 68 + 55, + 67 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 9 }, "end": { - "line": 4, + "line": 3, "column": 21 } } @@ -225,31 +225,31 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 56, - 68 + 55, + 67 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 9 }, "end": { - "line": 4, + "line": 3, "column": 21 } } }, "range": [ - 56, - 68 + 55, + 67 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 9 }, "end": { - "line": 4, + "line": 3, "column": 21 } } @@ -260,31 +260,31 @@ "value": "./delete_case1", "raw": "'./delete_case1'", "range": [ - 76, - 92 + 75, + 91 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 29 }, "end": { - "line": 4, + "line": 3, "column": 45 } } }, "range": [ - 47, - 94 + 46, + 93 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 0 }, "end": { - "line": 4, + "line": 3, "column": 47 } } @@ -298,16 +298,16 @@ "type": "Identifier", "name": "delete_case4", "range": [ - 104, - 116 + 103, + 115 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 9 }, "end": { - "line": 5, + "line": 4, "column": 21 } } @@ -316,31 +316,31 @@ "type": "Identifier", "name": "delete_case4", "range": [ - 104, - 116 + 103, + 115 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 9 }, "end": { - "line": 5, + "line": 4, "column": 21 } } }, "range": [ - 104, - 116 + 103, + 115 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 9 }, "end": { - "line": 5, + "line": 4, "column": 21 } } @@ -351,31 +351,31 @@ "value": "./delete_case4", "raw": "'./delete_case4'", "range": [ - 124, - 140 + 123, + 139 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 29 }, "end": { - "line": 5, + "line": 4, "column": 45 } } }, "range": [ - 95, - 142 + 94, + 141 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 5, + "line": 4, "column": 47 } } @@ -388,16 +388,16 @@ "type": "Identifier", "name": "delete_case3", "range": [ - 160, - 172 + 159, + 171 ], "loc": { "start": { - "line": 7, + "line": 6, "column": 16 }, "end": { - "line": 7, + "line": 6, "column": 28 } } @@ -407,16 +407,16 @@ "type": "Identifier", "name": "n", "range": [ - 173, - 174 + 172, + 173 ], "loc": { "start": { - "line": 7, + "line": 6, "column": 29 }, "end": { - "line": 7, + "line": 6, "column": 30 } } @@ -434,16 +434,16 @@ "type": "Identifier", "name": "s", "range": [ - 185, - 186 + 184, + 185 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 7 }, "end": { - "line": 9, + "line": 8, "column": 8 } } @@ -454,16 +454,16 @@ "type": "Identifier", "name": "sibling", "range": [ - 189, - 196 + 188, + 195 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 11 }, "end": { - "line": 9, + "line": 8, "column": 18 } } @@ -473,47 +473,47 @@ "type": "Identifier", "name": "n", "range": [ - 197, - 198 + 196, + 197 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 19 }, "end": { - "line": 9, + "line": 8, "column": 20 } } } ], "range": [ - 189, - 199 + 188, + 198 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 11 }, "end": { - "line": 9, + "line": 8, "column": 21 } } }, "range": [ - 185, - 199 + 184, + 198 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 7 }, "end": { - "line": 9, + "line": 8, "column": 21 } } @@ -521,16 +521,16 @@ ], "kind": "const", "range": [ - 179, - 200 + 178, + 199 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 1 }, "end": { - "line": 9, + "line": 8, "column": 22 } }, @@ -539,16 +539,16 @@ "type": "Line", "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", "range": [ - 202, - 263 + 201, + 262 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 1 }, "end": { - "line": 10, + "line": 9, "column": 62 } } @@ -579,16 +579,16 @@ "type": "Identifier", "name": "n", "range": [ - 271, - 272 + 270, + 271 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 12, + "line": 11, "column": 7 } } @@ -597,31 +597,31 @@ "type": "Identifier", "name": "parent", "range": [ - 273, - 279 + 272, + 278 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 14 } } }, "range": [ - 271, - 279 + 270, + 278 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 12, + "line": 11, "column": 14 } } @@ -630,31 +630,31 @@ "type": "Identifier", "name": "color", "range": [ - 280, - 285 + 279, + 284 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 15 }, "end": { - "line": 12, + "line": 11, "column": 20 } } }, "range": [ - 271, - 285 + 270, + 284 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 12, + "line": 11, "column": 20 } } @@ -663,31 +663,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 290, - 295 + 289, + 294 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 25 }, "end": { - "line": 12, + "line": 11, "column": 30 } } }, "range": [ - 271, - 295 + 270, + 294 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 12, + "line": 11, "column": 30 } } @@ -702,16 +702,16 @@ "type": "Identifier", "name": "s", "range": [ - 306, - 307 + 305, + 306 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 6 }, "end": { - "line": 13, + "line": 12, "column": 7 } } @@ -720,31 +720,31 @@ "type": "Identifier", "name": "color", "range": [ - 308, - 313 + 307, + 312 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 8 }, "end": { - "line": 13, + "line": 12, "column": 13 } } }, "range": [ - 306, - 313 + 305, + 312 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 6 }, "end": { - "line": 13, + "line": 12, "column": 13 } } @@ -753,46 +753,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 318, - 323 + 317, + 322 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 18 }, "end": { - "line": 13, + "line": 12, "column": 23 } } }, "range": [ - 306, - 323 + 305, + 322 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 6 }, "end": { - "line": 13, + "line": 12, "column": 23 } } }, "range": [ - 270, - 324 + 269, + 323 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 5 }, "end": { - "line": 13, + "line": 12, "column": 24 } } @@ -810,16 +810,16 @@ "type": "Identifier", "name": "s", "range": [ - 334, - 335 + 333, + 334 ], "loc": { "start": { - "line": 14, + "line": 13, "column": 6 }, "end": { - "line": 14, + "line": 13, "column": 7 } } @@ -828,31 +828,31 @@ "type": "Identifier", "name": "left", "range": [ - 336, - 340 + 335, + 339 ], "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 12 } } }, "range": [ - 334, - 340 + 333, + 339 ], "loc": { "start": { - "line": 14, + "line": 13, "column": 6 }, "end": { - "line": 14, + "line": 13, "column": 12 } } @@ -861,31 +861,31 @@ "type": "Identifier", "name": "color", "range": [ - 341, - 346 + 340, + 345 ], "loc": { "start": { - "line": 14, + "line": 13, "column": 13 }, "end": { - "line": 14, + "line": 13, "column": 18 } } }, "range": [ - 334, - 346 + 333, + 345 ], "loc": { "start": { - "line": 14, + "line": 13, "column": 6 }, "end": { - "line": 14, + "line": 13, "column": 18 } } @@ -894,46 +894,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 351, - 356 + 350, + 355 ], "loc": { "start": { - "line": 14, + "line": 13, "column": 23 }, "end": { - "line": 14, + "line": 13, "column": 28 } } }, "range": [ - 334, - 356 + 333, + 355 ], "loc": { "start": { - "line": 14, + "line": 13, "column": 6 }, "end": { - "line": 14, + "line": 13, "column": 28 } } }, "range": [ - 270, - 357 + 269, + 356 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 5 }, "end": { - "line": 14, + "line": 13, "column": 29 } } @@ -951,16 +951,16 @@ "type": "Identifier", "name": "s", "range": [ - 367, - 368 + 366, + 367 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 6 }, "end": { - "line": 15, + "line": 14, "column": 7 } } @@ -969,31 +969,31 @@ "type": "Identifier", "name": "right", "range": [ - 369, - 374 + 368, + 373 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 8 }, "end": { - "line": 15, + "line": 14, "column": 13 } } }, "range": [ - 367, - 374 + 366, + 373 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 6 }, "end": { - "line": 15, + "line": 14, "column": 13 } } @@ -1002,31 +1002,31 @@ "type": "Identifier", "name": "color", "range": [ - 375, - 380 + 374, + 379 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 14 }, "end": { - "line": 15, + "line": 14, "column": 19 } } }, "range": [ - 367, - 380 + 366, + 379 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 6 }, "end": { - "line": 15, + "line": 14, "column": 19 } } @@ -1035,46 +1035,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 385, - 390 + 384, + 389 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 24 }, "end": { - "line": 15, + "line": 14, "column": 29 } } }, "range": [ - 367, - 390 + 366, + 389 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 6 }, "end": { - "line": 15, + "line": 14, "column": 29 } } }, "range": [ - 270, - 391 + 269, + 390 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 5 }, "end": { - "line": 15, + "line": 14, "column": 30 } } @@ -1094,16 +1094,16 @@ "type": "Identifier", "name": "s", "range": [ - 397, - 398 + 396, + 397 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 2 }, "end": { - "line": 16, + "line": 15, "column": 3 } } @@ -1112,31 +1112,31 @@ "type": "Identifier", "name": "color", "range": [ - 399, - 404 + 398, + 403 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 4 }, "end": { - "line": 16, + "line": 15, "column": 9 } } }, "range": [ - 397, - 404 + 396, + 403 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 2 }, "end": { - "line": 16, + "line": 15, "column": 9 } } @@ -1145,46 +1145,46 @@ "type": "Identifier", "name": "RED", "range": [ - 407, - 410 + 406, + 409 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 12 }, "end": { - "line": 16, + "line": 15, "column": 15 } } }, "range": [ - 397, - 410 + 396, + 409 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 2 }, "end": { - "line": 16, + "line": 15, "column": 15 } } }, "range": [ - 397, - 411 + 396, + 410 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 2 }, "end": { - "line": 16, + "line": 15, "column": 16 } } @@ -1197,16 +1197,16 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 414, - 426 + 413, + 425 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 2 }, "end": { - "line": 17, + "line": 16, "column": 14 } } @@ -1219,16 +1219,16 @@ "type": "Identifier", "name": "n", "range": [ - 427, - 428 + 426, + 427 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 15 }, "end": { - "line": 17, + "line": 16, "column": 16 } } @@ -1237,78 +1237,78 @@ "type": "Identifier", "name": "parent", "range": [ - 429, - 435 + 428, + 434 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 17 }, "end": { - "line": 17, + "line": 16, "column": 23 } } }, "range": [ - 427, - 435 + 426, + 434 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 15 }, "end": { - "line": 17, + "line": 16, "column": 23 } } } ], "range": [ - 414, - 436 + 413, + 435 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 2 }, "end": { - "line": 17, + "line": 16, "column": 24 } } }, "range": [ - 414, - 437 + 413, + 436 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 2 }, "end": { - "line": 17, + "line": 16, "column": 25 } } } ], "range": [ - 393, - 440 + 392, + 439 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 32 }, "end": { - "line": 18, + "line": 17, "column": 2 } } @@ -1321,16 +1321,16 @@ "type": "Identifier", "name": "delete_case4", "range": [ - 450, - 462 + 449, + 461 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 2 }, "end": { - "line": 21, + "line": 20, "column": 14 } } @@ -1340,62 +1340,62 @@ "type": "Identifier", "name": "n", "range": [ - 463, - 464 + 462, + 463 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 15 }, "end": { - "line": 21, + "line": 20, "column": 16 } } } ], "range": [ - 450, - 465 + 449, + 464 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 2 }, "end": { - "line": 21, + "line": 20, "column": 17 } } }, "range": [ - 450, - 466 + 449, + 465 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 2 }, "end": { - "line": 21, + "line": 20, "column": 18 } } }, "range": [ - 266, - 466 + 265, + 465 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 21, + "line": 20, "column": 18 } }, @@ -1404,16 +1404,16 @@ "type": "Line", "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", "range": [ - 202, - 263 + 201, + 262 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 1 }, "end": { - "line": 10, + "line": 9, "column": 62 } } @@ -1422,16 +1422,16 @@ } ], "range": [ - 176, - 468 + 175, + 467 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 0 }, "end": { - "line": 22, + "line": 21, "column": 1 } } @@ -1439,16 +1439,16 @@ "generator": false, "expression": false, "range": [ - 151, - 468 + 150, + 467 ], "loc": { "start": { - "line": 7, + "line": 6, "column": 7 }, "end": { - "line": 22, + "line": 21, "column": 1 } }, @@ -1458,16 +1458,16 @@ "specifiers": [], "source": null, "range": [ - 144, - 468 + 143, + 467 ], "loc": { "start": { - "line": 7, + "line": 6, "column": 0 }, "end": { - "line": 22, + "line": 21, "column": 1 } } @@ -1475,16 +1475,16 @@ ], "sourceType": "module", "range": [ - 1, - 468 + 0, + 467 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 22, + "line": 21, "column": 1 } }, @@ -1493,16 +1493,16 @@ "type": "Line", "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", "range": [ - 202, - 263 + 201, + 262 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 1 }, "end": { - "line": 10, + "line": 9, "column": 62 } } diff --git a/ast/source/removal/delete_case5.js.json b/ast/source/removal/delete_case5.js.json index 3fc821e..0552ef8 100644 --- a/ast/source/removal/delete_case5.js.json +++ b/ast/source/removal/delete_case5.js.json @@ -10,16 +10,16 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -28,31 +28,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } }, "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -63,16 +63,16 @@ "type": "Identifier", "name": "RED", "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -81,31 +81,31 @@ "type": "Identifier", "name": "RED", "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } }, "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -116,16 +116,16 @@ "type": "Identifier", "name": "sibling", "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } @@ -134,31 +134,31 @@ "type": "Identifier", "name": "sibling", "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } }, "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } @@ -169,16 +169,16 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 34, - 46 + 33, + 45 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 33 }, "end": { - "line": 2, + "line": 1, "column": 45 } } @@ -187,31 +187,31 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 34, - 46 + 33, + 45 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 33 }, "end": { - "line": 2, + "line": 1, "column": 45 } } }, "range": [ - 34, - 46 + 33, + 45 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 33 }, "end": { - "line": 2, + "line": 1, "column": 45 } } @@ -222,16 +222,16 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 49, - 60 + 48, + 59 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 48 }, "end": { - "line": 2, + "line": 1, "column": 59 } } @@ -240,31 +240,31 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 49, - 60 + 48, + 59 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 48 }, "end": { - "line": 2, + "line": 1, "column": 59 } } }, "range": [ - 49, - 60 + 48, + 59 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 48 }, "end": { - "line": 2, + "line": 1, "column": 59 } } @@ -275,31 +275,31 @@ "value": "..", "raw": "'..'", "range": [ - 68, - 72 + 67, + 71 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 67 }, "end": { - "line": 2, + "line": 1, "column": 71 } } }, "range": [ - 1, - 74 + 0, + 73 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 2, + "line": 1, "column": 73 } } @@ -313,16 +313,16 @@ "type": "Identifier", "name": "delete_case6", "range": [ - 85, - 97 + 84, + 96 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 9 }, "end": { - "line": 4, + "line": 3, "column": 21 } } @@ -331,31 +331,31 @@ "type": "Identifier", "name": "delete_case6", "range": [ - 85, - 97 + 84, + 96 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 9 }, "end": { - "line": 4, + "line": 3, "column": 21 } } }, "range": [ - 85, - 97 + 84, + 96 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 9 }, "end": { - "line": 4, + "line": 3, "column": 21 } } @@ -366,31 +366,31 @@ "value": "./delete_case6", "raw": "'./delete_case6'", "range": [ - 105, - 121 + 104, + 120 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 29 }, "end": { - "line": 4, + "line": 3, "column": 45 } } }, "range": [ - 76, - 123 + 75, + 122 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 0 }, "end": { - "line": 4, + "line": 3, "column": 47 } } @@ -403,16 +403,16 @@ "type": "Identifier", "name": "delete_case5", "range": [ - 141, - 153 + 140, + 152 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 16 }, "end": { - "line": 6, + "line": 5, "column": 28 } } @@ -422,16 +422,16 @@ "type": "Identifier", "name": "n", "range": [ - 154, - 155 + 153, + 154 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 29 }, "end": { - "line": 6, + "line": 5, "column": 30 } } @@ -449,16 +449,16 @@ "type": "Identifier", "name": "s", "range": [ - 166, - 167 + 165, + 166 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 8 } } @@ -469,16 +469,16 @@ "type": "Identifier", "name": "sibling", "range": [ - 170, - 177 + 169, + 176 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 11 }, "end": { - "line": 8, + "line": 7, "column": 18 } } @@ -488,47 +488,47 @@ "type": "Identifier", "name": "n", "range": [ - 178, - 179 + 177, + 178 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 19 }, "end": { - "line": 8, + "line": 7, "column": 20 } } } ], "range": [ - 170, - 180 + 169, + 179 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 11 }, "end": { - "line": 8, + "line": 7, "column": 21 } } }, "range": [ - 166, - 180 + 165, + 179 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 21 } } @@ -536,16 +536,16 @@ ], "kind": "const", "range": [ - 160, - 181 + 159, + 180 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 1 }, "end": { - "line": 8, + "line": 7, "column": 22 } } @@ -562,16 +562,16 @@ "type": "Identifier", "name": "s", "range": [ - 189, - 190 + 188, + 189 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 6 }, "end": { - "line": 10, + "line": 9, "column": 7 } } @@ -580,31 +580,31 @@ "type": "Identifier", "name": "color", "range": [ - 191, - 196 + 190, + 195 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 8 }, "end": { - "line": 10, + "line": 9, "column": 13 } } }, "range": [ - 189, - 196 + 188, + 195 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 6 }, "end": { - "line": 10, + "line": 9, "column": 13 } } @@ -613,31 +613,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 201, - 206 + 200, + 205 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 18 }, "end": { - "line": 10, + "line": 9, "column": 23 } } }, "range": [ - 189, - 206 + 188, + 205 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 6 }, "end": { - "line": 10, + "line": 9, "column": 23 } } @@ -660,16 +660,16 @@ "type": "Identifier", "name": "n", "range": [ - 562, - 563 + 561, + 562 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 7 }, "end": { - "line": 15, + "line": 14, "column": 8 } } @@ -684,16 +684,16 @@ "type": "Identifier", "name": "n", "range": [ - 568, - 569 + 567, + 568 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 13 }, "end": { - "line": 15, + "line": 14, "column": 14 } } @@ -702,31 +702,31 @@ "type": "Identifier", "name": "parent", "range": [ - 570, - 576 + 569, + 575 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 15 }, "end": { - "line": 15, + "line": 14, "column": 21 } } }, "range": [ - 568, - 576 + 567, + 575 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 13 }, "end": { - "line": 15, + "line": 14, "column": 21 } } @@ -735,46 +735,46 @@ "type": "Identifier", "name": "left", "range": [ - 577, - 581 + 576, + 580 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 22 }, "end": { - "line": 15, + "line": 14, "column": 26 } } }, "range": [ - 568, - 581 + 567, + 580 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 13 }, "end": { - "line": 15, + "line": 14, "column": 26 } } }, "range": [ - 562, - 581 + 561, + 580 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 7 }, "end": { - "line": 15, + "line": 14, "column": 26 } } @@ -792,16 +792,16 @@ "type": "Identifier", "name": "s", "range": [ - 593, - 594 + 592, + 593 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 7 }, "end": { - "line": 16, + "line": 15, "column": 8 } } @@ -810,31 +810,31 @@ "type": "Identifier", "name": "right", "range": [ - 595, - 600 + 594, + 599 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 9 }, "end": { - "line": 16, + "line": 15, "column": 14 } } }, "range": [ - 593, - 600 + 592, + 599 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 7 }, "end": { - "line": 16, + "line": 15, "column": 14 } } @@ -843,31 +843,31 @@ "type": "Identifier", "name": "color", "range": [ - 601, - 606 + 600, + 605 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 15 }, "end": { - "line": 16, + "line": 15, "column": 20 } } }, "range": [ - 593, - 606 + 592, + 605 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 7 }, "end": { - "line": 16, + "line": 15, "column": 20 } } @@ -876,46 +876,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 611, - 616 + 610, + 615 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 25 }, "end": { - "line": 16, + "line": 15, "column": 30 } } }, "range": [ - 593, - 616 + 592, + 615 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 7 }, "end": { - "line": 16, + "line": 15, "column": 30 } } }, "range": [ - 561, - 617 + 560, + 616 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 6 }, "end": { - "line": 16, + "line": 15, "column": 31 } } @@ -933,16 +933,16 @@ "type": "Identifier", "name": "s", "range": [ - 628, - 629 + 627, + 628 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 7 }, "end": { - "line": 17, + "line": 16, "column": 8 } } @@ -951,31 +951,31 @@ "type": "Identifier", "name": "left", "range": [ - 630, - 634 + 629, + 633 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 9 }, "end": { - "line": 17, + "line": 16, "column": 13 } } }, "range": [ - 628, - 634 + 627, + 633 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 7 }, "end": { - "line": 17, + "line": 16, "column": 13 } } @@ -984,31 +984,31 @@ "type": "Identifier", "name": "color", "range": [ - 635, - 640 + 634, + 639 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 14 }, "end": { - "line": 17, + "line": 16, "column": 19 } } }, "range": [ - 628, - 640 + 627, + 639 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 7 }, "end": { - "line": 17, + "line": 16, "column": 19 } } @@ -1017,46 +1017,46 @@ "type": "Identifier", "name": "RED", "range": [ - 645, - 648 + 644, + 647 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 24 }, "end": { - "line": 17, + "line": 16, "column": 27 } } }, "range": [ - 628, - 648 + 627, + 647 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 7 }, "end": { - "line": 17, + "line": 16, "column": 27 } } }, "range": [ - 561, - 649 + 560, + 648 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 6 }, "end": { - "line": 17, + "line": 16, "column": 28 } } @@ -1076,16 +1076,16 @@ "type": "Identifier", "name": "s", "range": [ - 710, - 711 + 709, + 710 ], "loc": { "start": { - "line": 18, + "line": 17, "column": 3 }, "end": { - "line": 18, + "line": 17, "column": 4 } } @@ -1094,31 +1094,31 @@ "type": "Identifier", "name": "color", "range": [ - 712, - 717 + 711, + 716 ], "loc": { "start": { - "line": 18, + "line": 17, "column": 5 }, "end": { - "line": 18, + "line": 17, "column": 10 } } }, "range": [ - 710, - 717 + 709, + 716 ], "loc": { "start": { - "line": 18, + "line": 17, "column": 3 }, "end": { - "line": 18, + "line": 17, "column": 10 } } @@ -1127,46 +1127,46 @@ "type": "Identifier", "name": "RED", "range": [ - 720, - 723 + 719, + 722 ], "loc": { "start": { - "line": 18, + "line": 17, "column": 13 }, "end": { - "line": 18, + "line": 17, "column": 16 } } }, "range": [ - 710, - 723 + 709, + 722 ], "loc": { "start": { - "line": 18, + "line": 17, "column": 3 }, "end": { - "line": 18, + "line": 17, "column": 16 } } }, "range": [ - 710, - 724 + 709, + 723 ], "loc": { "start": { - "line": 18, + "line": 17, "column": 3 }, "end": { - "line": 18, + "line": 17, "column": 17 } }, @@ -1175,16 +1175,16 @@ "type": "Block", "value": " this last test is trivial too due to cases 2-4. ", "range": [ - 653, - 706 + 652, + 705 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 32 }, "end": { - "line": 17, + "line": 16, "column": 85 } } @@ -1206,16 +1206,16 @@ "type": "Identifier", "name": "s", "range": [ - 728, - 729 + 727, + 728 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 3 }, "end": { - "line": 19, + "line": 18, "column": 4 } } @@ -1224,31 +1224,31 @@ "type": "Identifier", "name": "left", "range": [ - 730, - 734 + 729, + 733 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 5 }, "end": { - "line": 19, + "line": 18, "column": 9 } } }, "range": [ - 728, - 734 + 727, + 733 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 3 }, "end": { - "line": 19, + "line": 18, "column": 9 } } @@ -1257,31 +1257,31 @@ "type": "Identifier", "name": "color", "range": [ - 735, - 740 + 734, + 739 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 10 }, "end": { - "line": 19, + "line": 18, "column": 15 } } }, "range": [ - 728, - 740 + 727, + 739 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 3 }, "end": { - "line": 19, + "line": 18, "column": 15 } } @@ -1290,46 +1290,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 743, - 748 + 742, + 747 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 18 }, "end": { - "line": 19, + "line": 18, "column": 23 } } }, "range": [ - 728, - 748 + 727, + 747 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 3 }, "end": { - "line": 19, + "line": 18, "column": 23 } } }, "range": [ - 728, - 749 + 727, + 748 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 3 }, "end": { - "line": 19, + "line": 18, "column": 24 } } @@ -1342,16 +1342,16 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 753, - 765 + 752, + 764 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 15 } } @@ -1361,63 +1361,63 @@ "type": "Identifier", "name": "s", "range": [ - 766, - 767 + 765, + 766 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 16 }, "end": { - "line": 20, + "line": 19, "column": 17 } } } ], "range": [ - 753, - 768 + 752, + 767 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 18 } } }, "range": [ - 753, - 769 + 752, + 768 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 19 } } } ], "range": [ - 651, - 773 + 650, + 772 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 30 }, "end": { - "line": 21, + "line": 20, "column": 3 } } @@ -1437,16 +1437,16 @@ "type": "Identifier", "name": "n", "range": [ - 784, - 785 + 783, + 784 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 14 }, "end": { - "line": 21, + "line": 20, "column": 15 } } @@ -1461,16 +1461,16 @@ "type": "Identifier", "name": "n", "range": [ - 790, - 791 + 789, + 790 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 20 }, "end": { - "line": 21, + "line": 20, "column": 21 } } @@ -1479,31 +1479,31 @@ "type": "Identifier", "name": "parent", "range": [ - 792, - 798 + 791, + 797 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 22 }, "end": { - "line": 21, + "line": 20, "column": 28 } } }, "range": [ - 790, - 798 + 789, + 797 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 20 }, "end": { - "line": 21, + "line": 20, "column": 28 } } @@ -1512,46 +1512,46 @@ "type": "Identifier", "name": "right", "range": [ - 799, - 804 + 798, + 803 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 29 }, "end": { - "line": 21, + "line": 20, "column": 34 } } }, "range": [ - 790, - 804 + 789, + 803 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 20 }, "end": { - "line": 21, + "line": 20, "column": 34 } } }, "range": [ - 784, - 804 + 783, + 803 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 14 }, "end": { - "line": 21, + "line": 20, "column": 34 } } @@ -1569,16 +1569,16 @@ "type": "Identifier", "name": "s", "range": [ - 823, - 824 + 822, + 823 ], "loc": { "start": { - "line": 22, + "line": 21, "column": 14 }, "end": { - "line": 22, + "line": 21, "column": 15 } } @@ -1587,31 +1587,31 @@ "type": "Identifier", "name": "left", "range": [ - 825, - 829 + 824, + 828 ], "loc": { "start": { - "line": 22, + "line": 21, "column": 16 }, "end": { - "line": 22, + "line": 21, "column": 20 } } }, "range": [ - 823, - 829 + 822, + 828 ], "loc": { "start": { - "line": 22, + "line": 21, "column": 14 }, "end": { - "line": 22, + "line": 21, "column": 20 } } @@ -1620,31 +1620,31 @@ "type": "Identifier", "name": "color", "range": [ - 830, - 835 + 829, + 834 ], "loc": { "start": { - "line": 22, + "line": 21, "column": 21 }, "end": { - "line": 22, + "line": 21, "column": 26 } } }, "range": [ - 823, - 835 + 822, + 834 ], "loc": { "start": { - "line": 22, + "line": 21, "column": 14 }, "end": { - "line": 22, + "line": 21, "column": 26 } } @@ -1653,46 +1653,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 840, - 845 + 839, + 844 ], "loc": { "start": { - "line": 22, + "line": 21, "column": 31 }, "end": { - "line": 22, + "line": 21, "column": 36 } } }, "range": [ - 823, - 845 + 822, + 844 ], "loc": { "start": { - "line": 22, + "line": 21, "column": 14 }, "end": { - "line": 22, + "line": 21, "column": 36 } } }, "range": [ - 783, - 846 + 782, + 845 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 13 }, "end": { - "line": 22, + "line": 21, "column": 37 } } @@ -1710,16 +1710,16 @@ "type": "Identifier", "name": "s", "range": [ - 864, - 865 + 863, + 864 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 14 }, "end": { - "line": 23, + "line": 22, "column": 15 } } @@ -1728,31 +1728,31 @@ "type": "Identifier", "name": "right", "range": [ - 866, - 871 + 865, + 870 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 16 }, "end": { - "line": 23, + "line": 22, "column": 21 } } }, "range": [ - 864, - 871 + 863, + 870 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 14 }, "end": { - "line": 23, + "line": 22, "column": 21 } } @@ -1761,31 +1761,31 @@ "type": "Identifier", "name": "color", "range": [ - 872, - 877 + 871, + 876 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 22 }, "end": { - "line": 23, + "line": 22, "column": 27 } } }, "range": [ - 864, - 877 + 863, + 876 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 14 }, "end": { - "line": 23, + "line": 22, "column": 27 } } @@ -1794,46 +1794,46 @@ "type": "Identifier", "name": "RED", "range": [ - 882, - 885 + 881, + 884 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 32 }, "end": { - "line": 23, + "line": 22, "column": 35 } } }, "range": [ - 864, - 885 + 863, + 884 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 14 }, "end": { - "line": 23, + "line": 22, "column": 35 } } }, "range": [ - 783, - 886 + 782, + 885 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 13 }, "end": { - "line": 23, + "line": 22, "column": 36 } } @@ -1853,16 +1853,16 @@ "type": "Identifier", "name": "s", "range": [ - 946, - 947 + 945, + 946 ], "loc": { "start": { - "line": 24, + "line": 23, "column": 3 }, "end": { - "line": 24, + "line": 23, "column": 4 } } @@ -1871,31 +1871,31 @@ "type": "Identifier", "name": "color", "range": [ - 948, - 953 + 947, + 952 ], "loc": { "start": { - "line": 24, + "line": 23, "column": 5 }, "end": { - "line": 24, + "line": 23, "column": 10 } } }, "range": [ - 946, - 953 + 945, + 952 ], "loc": { "start": { - "line": 24, + "line": 23, "column": 3 }, "end": { - "line": 24, + "line": 23, "column": 10 } } @@ -1904,46 +1904,46 @@ "type": "Identifier", "name": "RED", "range": [ - 956, - 959 + 955, + 958 ], "loc": { "start": { - "line": 24, + "line": 23, "column": 13 }, "end": { - "line": 24, + "line": 23, "column": 16 } } }, "range": [ - 946, - 959 + 945, + 958 ], "loc": { "start": { - "line": 24, + "line": 23, "column": 3 }, "end": { - "line": 24, + "line": 23, "column": 16 } } }, "range": [ - 946, - 960 + 945, + 959 ], "loc": { "start": { - "line": 24, + "line": 23, "column": 3 }, "end": { - "line": 24, + "line": 23, "column": 17 } }, @@ -1952,16 +1952,16 @@ "type": "Block", "value": " this last test is trivial too due to cases 2-4. ", "range": [ - 889, - 942 + 888, + 941 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 39 }, "end": { - "line": 23, + "line": 22, "column": 92 } } @@ -1983,16 +1983,16 @@ "type": "Identifier", "name": "s", "range": [ - 964, - 965 + 963, + 964 ], "loc": { "start": { - "line": 25, + "line": 24, "column": 3 }, "end": { - "line": 25, + "line": 24, "column": 4 } } @@ -2001,31 +2001,31 @@ "type": "Identifier", "name": "right", "range": [ - 966, - 971 + 965, + 970 ], "loc": { "start": { - "line": 25, + "line": 24, "column": 5 }, "end": { - "line": 25, + "line": 24, "column": 10 } } }, "range": [ - 964, - 971 + 963, + 970 ], "loc": { "start": { - "line": 25, + "line": 24, "column": 3 }, "end": { - "line": 25, + "line": 24, "column": 10 } } @@ -2034,31 +2034,31 @@ "type": "Identifier", "name": "color", "range": [ - 972, - 977 + 971, + 976 ], "loc": { "start": { - "line": 25, + "line": 24, "column": 11 }, "end": { - "line": 25, + "line": 24, "column": 16 } } }, "range": [ - 964, - 977 + 963, + 976 ], "loc": { "start": { - "line": 25, + "line": 24, "column": 3 }, "end": { - "line": 25, + "line": 24, "column": 16 } } @@ -2067,46 +2067,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 980, - 985 + 979, + 984 ], "loc": { "start": { - "line": 25, + "line": 24, "column": 19 }, "end": { - "line": 25, + "line": 24, "column": 24 } } }, "range": [ - 964, - 985 + 963, + 984 ], "loc": { "start": { - "line": 25, + "line": 24, "column": 3 }, "end": { - "line": 25, + "line": 24, "column": 24 } } }, "range": [ - 964, - 986 + 963, + 985 ], "loc": { "start": { - "line": 25, + "line": 24, "column": 3 }, "end": { - "line": 25, + "line": 24, "column": 25 } } @@ -2119,16 +2119,16 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 990, - 1001 + 989, + 1000 ], "loc": { "start": { - "line": 26, + "line": 25, "column": 3 }, "end": { - "line": 26, + "line": 25, "column": 14 } } @@ -2138,94 +2138,94 @@ "type": "Identifier", "name": "s", "range": [ - 1002, - 1003 + 1001, + 1002 ], "loc": { "start": { - "line": 26, + "line": 25, "column": 15 }, "end": { - "line": 26, + "line": 25, "column": 16 } } } ], "range": [ - 990, - 1004 + 989, + 1003 ], "loc": { "start": { - "line": 26, + "line": 25, "column": 3 }, "end": { - "line": 26, + "line": 25, "column": 17 } } }, "range": [ - 990, - 1005 + 989, + 1004 ], "loc": { "start": { - "line": 26, + "line": 25, "column": 3 }, "end": { - "line": 26, + "line": 25, "column": 18 } } } ], "range": [ - 888, - 1009 + 887, + 1008 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 38 }, "end": { - "line": 27, + "line": 26, "column": 3 } } }, "alternate": null, "range": [ - 779, - 1009 + 778, + 1008 ], "loc": { "start": { - "line": 21, + "line": 20, "column": 9 }, "end": { - "line": 27, + "line": 26, "column": 3 } } }, "range": [ - 557, - 1009 + 556, + 1008 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 2 }, "end": { - "line": 27, + "line": 26, "column": 3 } }, @@ -2234,16 +2234,16 @@ "type": "Block", "value": " this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). ", "range": [ - 210, - 398 + 209, + 397 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 27 }, "end": { - "line": 12, + "line": 11, "column": 79 } } @@ -2252,16 +2252,16 @@ "type": "Block", "value": " the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. ", "range": [ - 399, - 554 + 398, + 553 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 0 }, "end": { - "line": 14, + "line": 13, "column": 63 } } @@ -2270,32 +2270,32 @@ } ], "range": [ - 208, - 1012 + 207, + 1011 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 25 }, "end": { - "line": 28, + "line": 27, "column": 2 } } }, "alternate": null, "range": [ - 184, - 1012 + 183, + 1011 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 1 }, "end": { - "line": 28, + "line": 27, "column": 2 } } @@ -2308,16 +2308,16 @@ "type": "Identifier", "name": "delete_case6", "range": [ - 1014, - 1026 + 1013, + 1025 ], "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 29, + "line": 28, "column": 13 } } @@ -2327,63 +2327,63 @@ "type": "Identifier", "name": "n", "range": [ - 1027, - 1028 + 1026, + 1027 ], "loc": { "start": { - "line": 29, + "line": 28, "column": 14 }, "end": { - "line": 29, + "line": 28, "column": 15 } } } ], "range": [ - 1014, - 1029 + 1013, + 1028 ], "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 29, + "line": 28, "column": 16 } } }, "range": [ - 1014, - 1030 + 1013, + 1029 ], "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 29, + "line": 28, "column": 17 } } } ], "range": [ - 157, - 1032 + 156, + 1031 ], "loc": { "start": { - "line": 7, + "line": 6, "column": 0 }, "end": { - "line": 30, + "line": 29, "column": 1 } } @@ -2391,16 +2391,16 @@ "generator": false, "expression": false, "range": [ - 132, - 1032 + 131, + 1031 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 7 }, "end": { - "line": 30, + "line": 29, "column": 1 } }, @@ -2410,16 +2410,16 @@ "specifiers": [], "source": null, "range": [ - 125, - 1032 + 124, + 1031 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 30, + "line": 29, "column": 1 } } @@ -2427,16 +2427,16 @@ ], "sourceType": "module", "range": [ - 1, - 1032 + 0, + 1031 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 30, + "line": 29, "column": 1 } }, @@ -2445,16 +2445,16 @@ "type": "Block", "value": " this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). ", "range": [ - 210, - 398 + 209, + 397 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 27 }, "end": { - "line": 12, + "line": 11, "column": 79 } } @@ -2463,16 +2463,16 @@ "type": "Block", "value": " the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. ", "range": [ - 399, - 554 + 398, + 553 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 0 }, "end": { - "line": 14, + "line": 13, "column": 63 } } @@ -2481,16 +2481,16 @@ "type": "Block", "value": " this last test is trivial too due to cases 2-4. ", "range": [ - 653, - 706 + 652, + 705 ], "loc": { "start": { - "line": 17, + "line": 16, "column": 32 }, "end": { - "line": 17, + "line": 16, "column": 85 } } @@ -2499,16 +2499,16 @@ "type": "Block", "value": " this last test is trivial too due to cases 2-4. ", "range": [ - 889, - 942 + 888, + 941 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 39 }, "end": { - "line": 23, + "line": 22, "column": 92 } } diff --git a/ast/source/removal/delete_case6.js.json b/ast/source/removal/delete_case6.js.json index d50f2cf..3813ca5 100644 --- a/ast/source/removal/delete_case6.js.json +++ b/ast/source/removal/delete_case6.js.json @@ -10,16 +10,16 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -28,31 +28,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } }, "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -63,16 +63,16 @@ "type": "Identifier", "name": "RED", "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -81,31 +81,31 @@ "type": "Identifier", "name": "RED", "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } }, "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -116,16 +116,16 @@ "type": "Identifier", "name": "sibling", "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } @@ -134,31 +134,31 @@ "type": "Identifier", "name": "sibling", "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } }, "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } @@ -169,16 +169,16 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 34, - 46 + 33, + 45 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 33 }, "end": { - "line": 2, + "line": 1, "column": 45 } } @@ -187,31 +187,31 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 34, - 46 + 33, + 45 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 33 }, "end": { - "line": 2, + "line": 1, "column": 45 } } }, "range": [ - 34, - 46 + 33, + 45 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 33 }, "end": { - "line": 2, + "line": 1, "column": 45 } } @@ -222,16 +222,16 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 49, - 60 + 48, + 59 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 48 }, "end": { - "line": 2, + "line": 1, "column": 59 } } @@ -240,31 +240,31 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 49, - 60 + 48, + 59 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 48 }, "end": { - "line": 2, + "line": 1, "column": 59 } } }, "range": [ - 49, - 60 + 48, + 59 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 48 }, "end": { - "line": 2, + "line": 1, "column": 59 } } @@ -275,31 +275,31 @@ "value": "..", "raw": "'..'", "range": [ - 68, - 72 + 67, + 71 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 67 }, "end": { - "line": 2, + "line": 1, "column": 71 } } }, "range": [ - 1, - 74 + 0, + 73 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 2, + "line": 1, "column": 73 } } @@ -312,16 +312,16 @@ "type": "Identifier", "name": "delete_case6", "range": [ - 92, - 104 + 91, + 103 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 16 }, "end": { - "line": 4, + "line": 3, "column": 28 } } @@ -331,16 +331,16 @@ "type": "Identifier", "name": "n", "range": [ - 105, - 106 + 104, + 105 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 29 }, "end": { - "line": 4, + "line": 3, "column": 30 } } @@ -358,16 +358,16 @@ "type": "Identifier", "name": "s", "range": [ - 117, - 118 + 116, + 117 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 7 }, "end": { - "line": 6, + "line": 5, "column": 8 } } @@ -378,16 +378,16 @@ "type": "Identifier", "name": "sibling", "range": [ - 121, - 128 + 120, + 127 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 11 }, "end": { - "line": 6, + "line": 5, "column": 18 } } @@ -397,47 +397,47 @@ "type": "Identifier", "name": "n", "range": [ - 129, - 130 + 128, + 129 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 19 }, "end": { - "line": 6, + "line": 5, "column": 20 } } } ], "range": [ - 121, - 131 + 120, + 130 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 11 }, "end": { - "line": 6, + "line": 5, "column": 21 } } }, "range": [ - 117, - 131 + 116, + 130 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 7 }, "end": { - "line": 6, + "line": 5, "column": 21 } } @@ -445,16 +445,16 @@ ], "kind": "const", "range": [ - 111, - 132 + 110, + 131 ], "loc": { "start": { - "line": 6, + "line": 5, "column": 1 }, "end": { - "line": 6, + "line": 5, "column": 22 } } @@ -471,16 +471,16 @@ "type": "Identifier", "name": "s", "range": [ - 135, - 136 + 134, + 135 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 1 }, "end": { - "line": 8, + "line": 7, "column": 2 } } @@ -489,31 +489,31 @@ "type": "Identifier", "name": "color", "range": [ - 137, - 142 + 136, + 141 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 3 }, "end": { - "line": 8, + "line": 7, "column": 8 } } }, "range": [ - 135, - 142 + 134, + 141 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 1 }, "end": { - "line": 8, + "line": 7, "column": 8 } } @@ -528,16 +528,16 @@ "type": "Identifier", "name": "n", "range": [ - 145, - 146 + 144, + 145 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 11 }, "end": { - "line": 8, + "line": 7, "column": 12 } } @@ -546,31 +546,31 @@ "type": "Identifier", "name": "parent", "range": [ - 147, - 153 + 146, + 152 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 13 }, "end": { - "line": 8, + "line": 7, "column": 19 } } }, "range": [ - 145, - 153 + 144, + 152 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 11 }, "end": { - "line": 8, + "line": 7, "column": 19 } } @@ -579,61 +579,61 @@ "type": "Identifier", "name": "color", "range": [ - 154, - 159 + 153, + 158 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 20 }, "end": { - "line": 8, + "line": 7, "column": 25 } } }, "range": [ - 145, - 159 + 144, + 158 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 11 }, "end": { - "line": 8, + "line": 7, "column": 25 } } }, "range": [ - 135, - 159 + 134, + 158 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 1 }, "end": { - "line": 8, + "line": 7, "column": 25 } } }, "range": [ - 135, - 160 + 134, + 159 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 1 }, "end": { - "line": 8, + "line": 7, "column": 26 } } @@ -653,16 +653,16 @@ "type": "Identifier", "name": "n", "range": [ - 162, - 163 + 161, + 162 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 1 }, "end": { - "line": 9, + "line": 8, "column": 2 } } @@ -671,31 +671,31 @@ "type": "Identifier", "name": "parent", "range": [ - 164, - 170 + 163, + 169 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 3 }, "end": { - "line": 9, + "line": 8, "column": 9 } } }, "range": [ - 162, - 170 + 161, + 169 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 1 }, "end": { - "line": 9, + "line": 8, "column": 9 } } @@ -704,31 +704,31 @@ "type": "Identifier", "name": "color", "range": [ - 171, - 176 + 170, + 175 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 10 }, "end": { - "line": 9, + "line": 8, "column": 15 } } }, "range": [ - 162, - 176 + 161, + 175 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 1 }, "end": { - "line": 9, + "line": 8, "column": 15 } } @@ -737,46 +737,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 179, - 184 + 178, + 183 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 18 }, "end": { - "line": 9, + "line": 8, "column": 23 } } }, "range": [ - 162, - 184 + 161, + 183 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 1 }, "end": { - "line": 9, + "line": 8, "column": 23 } } }, "range": [ - 162, - 185 + 161, + 184 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 1 }, "end": { - "line": 9, + "line": 8, "column": 24 } } @@ -790,16 +790,16 @@ "type": "Identifier", "name": "n", "range": [ - 192, - 193 + 191, + 192 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 5 }, "end": { - "line": 11, + "line": 10, "column": 6 } } @@ -814,16 +814,16 @@ "type": "Identifier", "name": "n", "range": [ - 198, - 199 + 197, + 198 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 11 }, "end": { - "line": 11, + "line": 10, "column": 12 } } @@ -832,31 +832,31 @@ "type": "Identifier", "name": "parent", "range": [ - 200, - 206 + 199, + 205 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 13 }, "end": { - "line": 11, + "line": 10, "column": 19 } } }, "range": [ - 198, - 206 + 197, + 205 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 11 }, "end": { - "line": 11, + "line": 10, "column": 19 } } @@ -865,46 +865,46 @@ "type": "Identifier", "name": "left", "range": [ - 207, - 211 + 206, + 210 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 20 }, "end": { - "line": 11, + "line": 10, "column": 24 } } }, "range": [ - 198, - 211 + 197, + 210 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 11 }, "end": { - "line": 11, + "line": 10, "column": 24 } } }, "range": [ - 192, - 211 + 191, + 210 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 5 }, "end": { - "line": 11, + "line": 10, "column": 24 } } @@ -927,16 +927,16 @@ "type": "Identifier", "name": "s", "range": [ - 217, - 218 + 216, + 217 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 2 }, "end": { - "line": 12, + "line": 11, "column": 3 } } @@ -945,31 +945,31 @@ "type": "Identifier", "name": "right", "range": [ - 219, - 224 + 218, + 223 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 4 }, "end": { - "line": 12, + "line": 11, "column": 9 } } }, "range": [ - 217, - 224 + 216, + 223 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 2 }, "end": { - "line": 12, + "line": 11, "column": 9 } } @@ -978,31 +978,31 @@ "type": "Identifier", "name": "color", "range": [ - 225, - 230 + 224, + 229 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 10 }, "end": { - "line": 12, + "line": 11, "column": 15 } } }, "range": [ - 217, - 230 + 216, + 229 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 2 }, "end": { - "line": 12, + "line": 11, "column": 15 } } @@ -1011,46 +1011,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 233, - 238 + 232, + 237 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 18 }, "end": { - "line": 12, + "line": 11, "column": 23 } } }, "range": [ - 217, - 238 + 216, + 237 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 2 }, "end": { - "line": 12, + "line": 11, "column": 23 } } }, "range": [ - 217, - 239 + 216, + 238 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 2 }, "end": { - "line": 12, + "line": 11, "column": 24 } } @@ -1063,16 +1063,16 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 242, - 253 + 241, + 252 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 2 }, "end": { - "line": 13, + "line": 12, "column": 13 } } @@ -1085,16 +1085,16 @@ "type": "Identifier", "name": "n", "range": [ - 254, - 255 + 253, + 254 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 14 }, "end": { - "line": 13, + "line": 12, "column": 15 } } @@ -1103,78 +1103,78 @@ "type": "Identifier", "name": "parent", "range": [ - 256, - 262 + 255, + 261 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 16 }, "end": { - "line": 13, + "line": 12, "column": 22 } } }, "range": [ - 254, - 262 + 253, + 261 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 14 }, "end": { - "line": 13, + "line": 12, "column": 22 } } } ], "range": [ - 242, - 263 + 241, + 262 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 2 }, "end": { - "line": 13, + "line": 12, "column": 23 } } }, "range": [ - 242, - 264 + 241, + 263 ], "loc": { "start": { - "line": 13, + "line": 12, "column": 2 }, "end": { - "line": 13, + "line": 12, "column": 24 } } } ], "range": [ - 213, - 267 + 212, + 266 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 26 }, "end": { - "line": 14, + "line": 13, "column": 2 } } @@ -1197,16 +1197,16 @@ "type": "Identifier", "name": "s", "range": [ - 277, - 278 + 276, + 277 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 2 }, "end": { - "line": 15, + "line": 14, "column": 3 } } @@ -1215,31 +1215,31 @@ "type": "Identifier", "name": "left", "range": [ - 279, - 283 + 278, + 282 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 4 }, "end": { - "line": 15, + "line": 14, "column": 8 } } }, "range": [ - 277, - 283 + 276, + 282 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 2 }, "end": { - "line": 15, + "line": 14, "column": 8 } } @@ -1248,31 +1248,31 @@ "type": "Identifier", "name": "color", "range": [ - 284, - 289 + 283, + 288 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 9 }, "end": { - "line": 15, + "line": 14, "column": 14 } } }, "range": [ - 277, - 289 + 276, + 288 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 2 }, "end": { - "line": 15, + "line": 14, "column": 14 } } @@ -1281,46 +1281,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 292, - 297 + 291, + 296 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 17 }, "end": { - "line": 15, + "line": 14, "column": 22 } } }, "range": [ - 277, - 297 + 276, + 296 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 2 }, "end": { - "line": 15, + "line": 14, "column": 22 } } }, "range": [ - 277, - 298 + 276, + 297 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 2 }, "end": { - "line": 15, + "line": 14, "column": 23 } } @@ -1333,16 +1333,16 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 301, - 313 + 300, + 312 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 2 }, "end": { - "line": 16, + "line": 15, "column": 14 } } @@ -1355,16 +1355,16 @@ "type": "Identifier", "name": "n", "range": [ - 314, - 315 + 313, + 314 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 15 }, "end": { - "line": 16, + "line": 15, "column": 16 } } @@ -1373,109 +1373,109 @@ "type": "Identifier", "name": "parent", "range": [ - 316, - 322 + 315, + 321 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 17 }, "end": { - "line": 16, + "line": 15, "column": 23 } } }, "range": [ - 314, - 322 + 313, + 321 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 15 }, "end": { - "line": 16, + "line": 15, "column": 23 } } } ], "range": [ - 301, - 323 + 300, + 322 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 2 }, "end": { - "line": 16, + "line": 15, "column": 24 } } }, "range": [ - 301, - 324 + 300, + 323 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 2 }, "end": { - "line": 16, + "line": 15, "column": 25 } } } ], "range": [ - 273, - 327 + 272, + 326 ], "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 17, + "line": 16, "column": 2 } } }, "range": [ - 188, - 327 + 187, + 326 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 1 }, "end": { - "line": 17, + "line": 16, "column": 2 } } } ], "range": [ - 108, - 329 + 107, + 328 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 18, + "line": 17, "column": 1 } } @@ -1483,16 +1483,16 @@ "generator": false, "expression": false, "range": [ - 83, - 329 + 82, + 328 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 7 }, "end": { - "line": 18, + "line": 17, "column": 1 } }, @@ -1502,16 +1502,16 @@ "specifiers": [], "source": null, "range": [ - 76, - 329 + 75, + 328 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 0 }, "end": { - "line": 18, + "line": 17, "column": 1 } } @@ -1519,16 +1519,16 @@ ], "sourceType": "module", "range": [ - 1, - 329 + 0, + 328 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 18, + "line": 17, "column": 1 } }, diff --git a/ast/source/removal/delete_one_child.js.json b/ast/source/removal/delete_one_child.js.json index 589d32f..c63fbb0 100644 --- a/ast/source/removal/delete_one_child.js.json +++ b/ast/source/removal/delete_one_child.js.json @@ -10,16 +10,16 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -28,31 +28,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } }, "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -63,16 +63,16 @@ "type": "Identifier", "name": "RED", "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -81,52 +81,90 @@ "type": "Identifier", "name": "RED", "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } }, "range": [ - 18, - 21 + 17, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 20 } } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 28, + 32 + ], + "loc": { + "start": { + "line": 1, + "column": 28 + }, + "end": { + "line": 1, + "column": 32 + } + } + }, + "range": [ + 0, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 0 }, + "end": { + "line": 1, + "column": 34 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ { "type": "ImportSpecifier", "local": { "type": "Identifier", "name": "replace_node", "range": [ - 24, - 36 + 45, + 57 ], "loc": { "start": { - "line": 2, - "column": 23 + "line": 3, + "column": 9 }, "end": { - "line": 2, - "column": 35 + "line": 3, + "column": 21 } } }, @@ -134,67 +172,67 @@ "type": "Identifier", "name": "replace_node", "range": [ - 24, - 36 + 45, + 57 ], "loc": { "start": { - "line": 2, - "column": 23 + "line": 3, + "column": 9 }, "end": { - "line": 2, - "column": 35 + "line": 3, + "column": 21 } } }, "range": [ - 24, - 36 + 45, + 57 ], "loc": { "start": { - "line": 2, - "column": 23 + "line": 3, + "column": 9 }, "end": { - "line": 2, - "column": 35 + "line": 3, + "column": 21 } } } ], "source": { "type": "Literal", - "value": "..", - "raw": "'..'", + "value": "./replace_node", + "raw": "'./replace_node'", "range": [ - 44, - 48 + 65, + 81 ], "loc": { "start": { - "line": 2, - "column": 43 + "line": 3, + "column": 29 }, "end": { - "line": 2, - "column": 47 + "line": 3, + "column": 45 } } }, "range": [ - 1, - 50 + 36, + 83 ], "loc": { "start": { - "line": 2, + "line": 3, "column": 0 }, "end": { - "line": 2, - "column": 49 + "line": 3, + "column": 47 } } }, @@ -207,8 +245,8 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 61, - 73 + 93, + 105 ], "loc": { "start": { @@ -225,8 +263,8 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 61, - 73 + 93, + 105 ], "loc": { "start": { @@ -240,8 +278,8 @@ } }, "range": [ - 61, - 73 + 93, + 105 ], "loc": { "start": { @@ -260,8 +298,8 @@ "value": "./delete_case1", "raw": "'./delete_case1'", "range": [ - 81, - 97 + 113, + 129 ], "loc": { "start": { @@ -275,8 +313,8 @@ } }, "range": [ - 52, - 99 + 84, + 131 ], "loc": { "start": { @@ -297,8 +335,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 117, - 133 + 149, + 165 ], "loc": { "start": { @@ -316,8 +354,8 @@ "type": "Identifier", "name": "n", "range": [ - 136, - 137 + 168, + 169 ], "loc": { "start": { @@ -343,8 +381,8 @@ "type": "Identifier", "name": "child", "range": [ - 472, - 477 + 504, + 509 ], "loc": { "start": { @@ -364,8 +402,8 @@ "type": "Identifier", "name": "n", "range": [ - 480, - 481 + 512, + 513 ], "loc": { "start": { @@ -382,8 +420,8 @@ "type": "Identifier", "name": "left", "range": [ - 482, - 486 + 514, + 518 ], "loc": { "start": { @@ -397,8 +435,8 @@ } }, "range": [ - 480, - 486 + 512, + 518 ], "loc": { "start": { @@ -412,8 +450,8 @@ } }, "range": [ - 472, - 486 + 504, + 518 ], "loc": { "start": { @@ -429,8 +467,8 @@ ], "kind": "const", "range": [ - 466, - 488 + 498, + 520 ], "loc": { "start": { @@ -447,8 +485,8 @@ "type": "Line", "value": " Precondition: n has at most one non-leaf child.", "range": [ - 147, - 197 + 179, + 229 ], "loc": { "start": { @@ -465,8 +503,8 @@ "type": "Line", "value": " assert( n.right.isleaf() || n.left.isleaf());", "range": [ - 202, - 250 + 234, + 282 ], "loc": { "start": { @@ -483,8 +521,8 @@ "type": "Line", "value": " const child = n.right.isleaf() ? n.left : n.right;", "range": [ - 256, - 309 + 288, + 341 ], "loc": { "start": { @@ -501,8 +539,8 @@ "type": "Line", "value": " n.right is always a LEAF because either n is a subtree predecessor or it", "range": [ - 314, - 389 + 346, + 421 ], "loc": { "start": { @@ -519,8 +557,8 @@ "type": "Line", "value": " is the only child of its parent by the red-black tree properties", "range": [ - 394, - 461 + 426, + 493 ], "loc": { "start": { @@ -543,8 +581,8 @@ "type": "Identifier", "name": "replace_node", "range": [ - 494, - 506 + 526, + 538 ], "loc": { "start": { @@ -562,8 +600,8 @@ "type": "Identifier", "name": "n", "range": [ - 507, - 508 + 539, + 540 ], "loc": { "start": { @@ -580,8 +618,8 @@ "type": "Identifier", "name": "child", "range": [ - 510, - 515 + 542, + 547 ], "loc": { "start": { @@ -596,8 +634,8 @@ } ], "range": [ - 494, - 516 + 526, + 548 ], "loc": { "start": { @@ -611,8 +649,8 @@ } }, "range": [ - 494, - 517 + 526, + 549 ], "loc": { "start": { @@ -637,8 +675,8 @@ "type": "Identifier", "name": "n", "range": [ - 527, - 528 + 559, + 560 ], "loc": { "start": { @@ -655,8 +693,8 @@ "type": "Identifier", "name": "color", "range": [ - 529, - 534 + 561, + 566 ], "loc": { "start": { @@ -670,8 +708,8 @@ } }, "range": [ - 527, - 534 + 559, + 566 ], "loc": { "start": { @@ -688,8 +726,8 @@ "type": "Identifier", "name": "BLACK", "range": [ - 539, - 544 + 571, + 576 ], "loc": { "start": { @@ -703,8 +741,8 @@ } }, "range": [ - 527, - 544 + 559, + 576 ], "loc": { "start": { @@ -732,8 +770,8 @@ "type": "Identifier", "name": "child", "range": [ - 560, - 565 + 592, + 597 ], "loc": { "start": { @@ -750,8 +788,8 @@ "type": "Identifier", "name": "color", "range": [ - 566, - 571 + 598, + 603 ], "loc": { "start": { @@ -765,8 +803,8 @@ } }, "range": [ - 560, - 571 + 592, + 603 ], "loc": { "start": { @@ -783,8 +821,8 @@ "type": "Identifier", "name": "RED", "range": [ - 576, - 579 + 608, + 611 ], "loc": { "start": { @@ -798,8 +836,8 @@ } }, "range": [ - 560, - 579 + 592, + 611 ], "loc": { "start": { @@ -824,8 +862,8 @@ "type": "Identifier", "name": "child", "range": [ - 581, - 586 + 613, + 618 ], "loc": { "start": { @@ -842,8 +880,8 @@ "type": "Identifier", "name": "color", "range": [ - 587, - 592 + 619, + 624 ], "loc": { "start": { @@ -857,8 +895,8 @@ } }, "range": [ - 581, - 592 + 613, + 624 ], "loc": { "start": { @@ -875,8 +913,8 @@ "type": "Identifier", "name": "BLACK", "range": [ - 595, - 600 + 627, + 632 ], "loc": { "start": { @@ -890,8 +928,8 @@ } }, "range": [ - 581, - 600 + 613, + 632 ], "loc": { "start": { @@ -905,8 +943,8 @@ } }, "range": [ - 581, - 601 + 613, + 633 ], "loc": { "start": { @@ -927,8 +965,8 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 615, - 627 + 647, + 659 ], "loc": { "start": { @@ -946,8 +984,8 @@ "type": "Identifier", "name": "child", "range": [ - 628, - 633 + 660, + 665 ], "loc": { "start": { @@ -962,8 +1000,8 @@ } ], "range": [ - 615, - 634 + 647, + 666 ], "loc": { "start": { @@ -977,8 +1015,8 @@ } }, "range": [ - 615, - 635 + 647, + 667 ], "loc": { "start": { @@ -992,8 +1030,8 @@ } }, "range": [ - 556, - 635 + 588, + 667 ], "loc": { "start": { @@ -1008,8 +1046,8 @@ } ], "range": [ - 546, - 641 + 578, + 673 ], "loc": { "start": { @@ -1024,8 +1062,8 @@ }, "alternate": null, "range": [ - 523, - 641 + 555, + 673 ], "loc": { "start": { @@ -1042,8 +1080,8 @@ "type": "Line", "value": "else {", "range": [ - 647, - 655 + 679, + 687 ], "loc": { "start": { @@ -1060,8 +1098,8 @@ "type": "Line", "value": " If n is RED then its child can only be BLACK. Replacing n with its", "range": [ - 660, - 732 + 692, + 764 ], "loc": { "start": { @@ -1078,8 +1116,8 @@ "type": "Line", "value": " child suffices.", "range": [ - 737, - 758 + 769, + 790 ], "loc": { "start": { @@ -1096,8 +1134,8 @@ "type": "Line", "value": "}", "range": [ - 763, - 766 + 795, + 798 ], "loc": { "start": { @@ -1114,8 +1152,8 @@ } ], "range": [ - 140, - 769 + 172, + 801 ], "loc": { "start": { @@ -1131,8 +1169,8 @@ "generator": false, "expression": false, "range": [ - 108, - 769 + 140, + 801 ], "loc": { "start": { @@ -1150,8 +1188,8 @@ "specifiers": [], "source": null, "range": [ - 101, - 769 + 133, + 801 ], "loc": { "start": { @@ -1167,12 +1205,12 @@ ], "sourceType": "module", "range": [ - 1, - 769 + 0, + 801 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { @@ -1185,8 +1223,8 @@ "type": "Line", "value": " Precondition: n has at most one non-leaf child.", "range": [ - 147, - 197 + 179, + 229 ], "loc": { "start": { @@ -1203,8 +1241,8 @@ "type": "Line", "value": " assert( n.right.isleaf() || n.left.isleaf());", "range": [ - 202, - 250 + 234, + 282 ], "loc": { "start": { @@ -1221,8 +1259,8 @@ "type": "Line", "value": " const child = n.right.isleaf() ? n.left : n.right;", "range": [ - 256, - 309 + 288, + 341 ], "loc": { "start": { @@ -1239,8 +1277,8 @@ "type": "Line", "value": " n.right is always a LEAF because either n is a subtree predecessor or it", "range": [ - 314, - 389 + 346, + 421 ], "loc": { "start": { @@ -1257,8 +1295,8 @@ "type": "Line", "value": " is the only child of its parent by the red-black tree properties", "range": [ - 394, - 461 + 426, + 493 ], "loc": { "start": { @@ -1275,8 +1313,8 @@ "type": "Line", "value": "else {", "range": [ - 647, - 655 + 679, + 687 ], "loc": { "start": { @@ -1293,8 +1331,8 @@ "type": "Line", "value": " If n is RED then its child can only be BLACK. Replacing n with its", "range": [ - 660, - 732 + 692, + 764 ], "loc": { "start": { @@ -1311,8 +1349,8 @@ "type": "Line", "value": " child suffices.", "range": [ - 737, - 758 + 769, + 790 ], "loc": { "start": { @@ -1329,8 +1367,8 @@ "type": "Line", "value": "}", "range": [ - 763, - 766 + 795, + 798 ], "loc": { "start": { diff --git a/ast/source/removal/index.js.json b/ast/source/removal/index.js.json index 661813b..e196eae 100644 --- a/ast/source/removal/index.js.json +++ b/ast/source/removal/index.js.json @@ -252,12 +252,48 @@ "column": 36 } } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./replace_node", + "raw": "'./replace_node'", + "range": [ + 249, + 265 + ], + "loc": { + "start": { + "line": 8, + "column": 14 + }, + "end": { + "line": 8, + "column": 30 + } + } + }, + "range": [ + 235, + 267 + ], + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 32 + } + } } ], "sourceType": "module", "range": [ 0, - 234 + 267 ], "loc": { "start": { @@ -265,8 +301,8 @@ "column": 0 }, "end": { - "line": 7, - "column": 36 + "line": 8, + "column": 32 } }, "comments": [] diff --git a/ast/source/base/replace_node.js.json b/ast/source/removal/replace_node.js.json similarity index 100% rename from ast/source/base/replace_node.js.json rename to ast/source/removal/replace_node.js.json diff --git a/ast/source/rotate/index.js.json b/ast/source/rotate/index.js.json new file mode 100644 index 0000000..1cec1eb --- /dev/null +++ b/ast/source/rotate/index.js.json @@ -0,0 +1,93 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./rotate_left", + "raw": "'./rotate_left'", + "range": [ + 14, + 29 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 29 + } + } + }, + "range": [ + 0, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./rotate_right", + "raw": "'./rotate_right'", + "range": [ + 46, + 62 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 30 + } + } + }, + "range": [ + 32, + 64 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 64 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 32 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/rotate_left.js.json b/ast/source/rotate/rotate_left.js.json similarity index 82% rename from ast/source/base/rotate_left.js.json rename to ast/source/rotate/rotate_left.js.json index c40ddf9..ce92a3c 100644 --- a/ast/source/base/rotate_left.js.json +++ b/ast/source/rotate/rotate_left.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 278, - 289 + 284, + 295 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 16 }, "end": { - "line": 14, + "line": 16, "column": 27 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "A", "range": [ - 292, - 293 + 298, + 299 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 30 }, "end": { - "line": 14, + "line": 16, "column": 31 } } @@ -55,16 +55,16 @@ "type": "Identifier", "name": "B", "range": [ - 306, - 307 + 312, + 313 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 7 }, "end": { - "line": 16, + "line": 18, "column": 8 } } @@ -76,16 +76,16 @@ "type": "Identifier", "name": "A", "range": [ - 310, - 311 + 316, + 317 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 11 }, "end": { - "line": 16, + "line": 18, "column": 12 } } @@ -94,46 +94,46 @@ "type": "Identifier", "name": "right", "range": [ - 312, - 317 + 318, + 323 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 13 }, "end": { - "line": 16, + "line": 18, "column": 18 } } }, "range": [ - 310, - 317 + 316, + 323 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 11 }, "end": { - "line": 16, + "line": 18, "column": 18 } } }, "range": [ - 306, - 317 + 312, + 323 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 7 }, "end": { - "line": 16, + "line": 18, "column": 18 } } @@ -141,16 +141,16 @@ ], "kind": "const", "range": [ - 300, - 319 + 306, + 325 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 1 }, "end": { - "line": 16, + "line": 18, "column": 20 } } @@ -164,16 +164,16 @@ "type": "Identifier", "name": "a", "range": [ - 327, - 328 + 333, + 334 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 7 }, "end": { - "line": 17, + "line": 19, "column": 8 } } @@ -185,16 +185,16 @@ "type": "Identifier", "name": "A", "range": [ - 331, - 332 + 337, + 338 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 11 }, "end": { - "line": 17, + "line": 19, "column": 12 } } @@ -203,46 +203,46 @@ "type": "Identifier", "name": "left", "range": [ - 333, - 337 + 339, + 343 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 13 }, "end": { - "line": 17, + "line": 19, "column": 17 } } }, "range": [ - 331, - 337 + 337, + 343 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 11 }, "end": { - "line": 17, + "line": 19, "column": 17 } } }, "range": [ - 327, - 337 + 333, + 343 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 7 }, "end": { - "line": 17, + "line": 19, "column": 17 } } @@ -250,16 +250,16 @@ ], "kind": "const", "range": [ - 321, - 339 + 327, + 345 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 1 }, "end": { - "line": 17, + "line": 19, "column": 19 } } @@ -273,16 +273,16 @@ "type": "Identifier", "name": "b", "range": [ - 347, - 348 + 353, + 354 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 7 }, "end": { - "line": 18, + "line": 20, "column": 8 } } @@ -294,16 +294,16 @@ "type": "Identifier", "name": "B", "range": [ - 351, - 352 + 357, + 358 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 11 }, "end": { - "line": 18, + "line": 20, "column": 12 } } @@ -312,46 +312,46 @@ "type": "Identifier", "name": "left", "range": [ - 353, - 357 + 359, + 363 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 13 }, "end": { - "line": 18, + "line": 20, "column": 17 } } }, "range": [ - 351, - 357 + 357, + 363 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 11 }, "end": { - "line": 18, + "line": 20, "column": 17 } } }, "range": [ - 347, - 357 + 353, + 363 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 7 }, "end": { - "line": 18, + "line": 20, "column": 17 } } @@ -359,16 +359,16 @@ ], "kind": "const", "range": [ - 341, - 359 + 347, + 365 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 1 }, "end": { - "line": 18, + "line": 20, "column": 19 } } @@ -382,16 +382,16 @@ "type": "Identifier", "name": "c", "range": [ - 367, - 368 + 373, + 374 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 7 }, "end": { - "line": 19, + "line": 21, "column": 8 } } @@ -403,16 +403,16 @@ "type": "Identifier", "name": "B", "range": [ - 371, - 372 + 377, + 378 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 11 }, "end": { - "line": 19, + "line": 21, "column": 12 } } @@ -421,46 +421,46 @@ "type": "Identifier", "name": "right", "range": [ - 373, - 378 + 379, + 384 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 13 }, "end": { - "line": 19, + "line": 21, "column": 18 } } }, "range": [ - 371, - 378 + 377, + 384 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 11 }, "end": { - "line": 19, + "line": 21, "column": 18 } } }, "range": [ - 367, - 378 + 373, + 384 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 7 }, "end": { - "line": 19, + "line": 21, "column": 18 } } @@ -468,16 +468,16 @@ ], "kind": "const", "range": [ - 361, - 380 + 367, + 386 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 1 }, "end": { - "line": 19, + "line": 21, "column": 20 } } @@ -497,16 +497,16 @@ "type": "Identifier", "name": "A", "range": [ - 384, - 385 + 390, + 391 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 2 }, "end": { - "line": 21, + "line": 23, "column": 3 } } @@ -515,31 +515,31 @@ "type": "Identifier", "name": "value", "range": [ - 386, - 391 + 392, + 397 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 4 }, "end": { - "line": 21, + "line": 23, "column": 9 } } }, "range": [ - 384, - 391 + 390, + 397 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 2 }, "end": { - "line": 21, + "line": 23, "column": 9 } } @@ -551,16 +551,16 @@ "type": "Identifier", "name": "B", "range": [ - 394, - 395 + 400, + 401 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 12 }, "end": { - "line": 21, + "line": 23, "column": 13 } } @@ -569,47 +569,47 @@ "type": "Identifier", "name": "value", "range": [ - 396, - 401 + 402, + 407 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 14 }, "end": { - "line": 21, + "line": 23, "column": 19 } } }, "range": [ - 394, - 401 + 400, + 407 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 12 }, "end": { - "line": 21, + "line": 23, "column": 19 } } } ], "range": [ - 383, - 402 + 389, + 408 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 20 } } @@ -624,16 +624,16 @@ "type": "Identifier", "name": "B", "range": [ - 406, - 407 + 412, + 413 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 24 }, "end": { - "line": 21, + "line": 23, "column": 25 } } @@ -642,31 +642,31 @@ "type": "Identifier", "name": "value", "range": [ - 408, - 413 + 414, + 419 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 26 }, "end": { - "line": 21, + "line": 23, "column": 31 } } }, "range": [ - 406, - 413 + 412, + 419 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 24 }, "end": { - "line": 21, + "line": 23, "column": 31 } } @@ -678,16 +678,16 @@ "type": "Identifier", "name": "A", "range": [ - 416, - 417 + 422, + 423 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 34 }, "end": { - "line": 21, + "line": 23, "column": 35 } } @@ -696,77 +696,77 @@ "type": "Identifier", "name": "value", "range": [ - 418, - 423 + 424, + 429 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 36 }, "end": { - "line": 21, + "line": 23, "column": 41 } } }, "range": [ - 416, - 423 + 422, + 429 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 34 }, "end": { - "line": 21, + "line": 23, "column": 41 } } } ], "range": [ - 405, - 424 + 411, + 430 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 23 }, "end": { - "line": 21, + "line": 23, "column": 42 } } }, "range": [ - 383, - 424 + 389, + 430 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 42 } } }, "range": [ - 383, - 426 + 389, + 432 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 44 } } @@ -786,16 +786,16 @@ "type": "Identifier", "name": "A", "range": [ - 429, - 430 + 435, + 436 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 2 }, "end": { - "line": 22, + "line": 24, "column": 3 } } @@ -804,31 +804,31 @@ "type": "Identifier", "name": "color", "range": [ - 431, - 436 + 437, + 442 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 4 }, "end": { - "line": 22, + "line": 24, "column": 9 } } }, "range": [ - 429, - 436 + 435, + 442 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 2 }, "end": { - "line": 22, + "line": 24, "column": 9 } } @@ -840,16 +840,16 @@ "type": "Identifier", "name": "B", "range": [ - 439, - 440 + 445, + 446 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 12 }, "end": { - "line": 22, + "line": 24, "column": 13 } } @@ -858,47 +858,47 @@ "type": "Identifier", "name": "color", "range": [ - 441, - 446 + 447, + 452 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 14 }, "end": { - "line": 22, + "line": 24, "column": 19 } } }, "range": [ - 439, - 446 + 445, + 452 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 12 }, "end": { - "line": 22, + "line": 24, "column": 19 } } } ], "range": [ - 428, - 447 + 434, + 453 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, + "line": 24, "column": 20 } } @@ -913,16 +913,16 @@ "type": "Identifier", "name": "B", "range": [ - 451, - 452 + 457, + 458 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 24 }, "end": { - "line": 22, + "line": 24, "column": 25 } } @@ -931,31 +931,31 @@ "type": "Identifier", "name": "color", "range": [ - 453, - 458 + 459, + 464 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 26 }, "end": { - "line": 22, + "line": 24, "column": 31 } } }, "range": [ - 451, - 458 + 457, + 464 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 24 }, "end": { - "line": 22, + "line": 24, "column": 31 } } @@ -967,16 +967,16 @@ "type": "Identifier", "name": "A", "range": [ - 461, - 462 + 467, + 468 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 34 }, "end": { - "line": 22, + "line": 24, "column": 35 } } @@ -985,77 +985,77 @@ "type": "Identifier", "name": "color", "range": [ - 463, - 468 + 469, + 474 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 36 }, "end": { - "line": 22, + "line": 24, "column": 41 } } }, "range": [ - 461, - 468 + 467, + 474 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 34 }, "end": { - "line": 22, + "line": 24, "column": 41 } } } ], "range": [ - 450, - 469 + 456, + 475 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 23 }, "end": { - "line": 22, + "line": 24, "column": 42 } } }, "range": [ - 428, - 469 + 434, + 475 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, + "line": 24, "column": 42 } } }, "range": [ - 428, - 471 + 434, + 477 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, + "line": 24, "column": 44 } } @@ -1072,16 +1072,16 @@ "type": "Identifier", "name": "A", "range": [ - 474, - 475 + 480, + 481 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, + "line": 26, "column": 2 } } @@ -1090,31 +1090,31 @@ "type": "Identifier", "name": "left", "range": [ - 476, - 480 + 482, + 486 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 3 }, "end": { - "line": 24, + "line": 26, "column": 7 } } }, "range": [ - 474, - 480 + 480, + 486 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, + "line": 26, "column": 7 } } @@ -1123,46 +1123,46 @@ "type": "Identifier", "name": "B", "range": [ - 483, - 484 + 489, + 490 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 10 }, "end": { - "line": 24, + "line": 26, "column": 11 } } }, "range": [ - 474, - 484 + 480, + 490 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, + "line": 26, "column": 11 } } }, "range": [ - 474, - 486 + 480, + 492 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, + "line": 26, "column": 13 } } @@ -1179,16 +1179,16 @@ "type": "Identifier", "name": "A", "range": [ - 488, - 489 + 494, + 495 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 1 }, "end": { - "line": 25, + "line": 27, "column": 2 } } @@ -1197,31 +1197,31 @@ "type": "Identifier", "name": "right", "range": [ - 490, - 495 + 496, + 501 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 3 }, "end": { - "line": 25, + "line": 27, "column": 8 } } }, "range": [ - 488, - 495 + 494, + 501 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 1 }, "end": { - "line": 25, + "line": 27, "column": 8 } } @@ -1230,46 +1230,46 @@ "type": "Identifier", "name": "c", "range": [ - 498, - 499 + 504, + 505 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 11 }, "end": { - "line": 25, + "line": 27, "column": 12 } } }, "range": [ - 488, - 499 + 494, + 505 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 1 }, "end": { - "line": 25, + "line": 27, "column": 12 } } }, "range": [ - 488, - 501 + 494, + 507 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 1 }, "end": { - "line": 25, + "line": 27, "column": 14 } } @@ -1286,16 +1286,16 @@ "type": "Identifier", "name": "B", "range": [ - 504, - 505 + 510, + 511 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 1 }, "end": { - "line": 27, + "line": 29, "column": 2 } } @@ -1304,31 +1304,31 @@ "type": "Identifier", "name": "left", "range": [ - 506, - 510 + 512, + 516 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 3 }, "end": { - "line": 27, + "line": 29, "column": 7 } } }, "range": [ - 504, - 510 + 510, + 516 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 1 }, "end": { - "line": 27, + "line": 29, "column": 7 } } @@ -1337,46 +1337,46 @@ "type": "Identifier", "name": "a", "range": [ - 513, - 514 + 519, + 520 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 10 }, "end": { - "line": 27, + "line": 29, "column": 11 } } }, "range": [ - 504, - 514 + 510, + 520 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 1 }, "end": { - "line": 27, + "line": 29, "column": 11 } } }, "range": [ - 504, - 516 + 510, + 522 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 1 }, "end": { - "line": 27, + "line": 29, "column": 13 } } @@ -1393,16 +1393,16 @@ "type": "Identifier", "name": "B", "range": [ - 518, - 519 + 524, + 525 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 2 } } @@ -1411,31 +1411,31 @@ "type": "Identifier", "name": "right", "range": [ - 520, - 525 + 526, + 531 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 3 }, "end": { - "line": 28, + "line": 30, "column": 8 } } }, "range": [ - 518, - 525 + 524, + 531 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 8 } } @@ -1444,46 +1444,46 @@ "type": "Identifier", "name": "b", "range": [ - 528, - 529 + 534, + 535 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 11 }, "end": { - "line": 28, + "line": 30, "column": 12 } } }, "range": [ - 518, - 529 + 524, + 535 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 12 } } }, "range": [ - 518, - 531 + 524, + 537 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 14 } } @@ -1500,16 +1500,16 @@ "type": "Identifier", "name": "a", "range": [ - 534, - 535 + 540, + 541 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 2 } } @@ -1518,31 +1518,31 @@ "type": "Identifier", "name": "parent", "range": [ - 536, - 542 + 542, + 548 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 3 }, "end": { - "line": 30, + "line": 32, "column": 9 } } }, "range": [ - 534, - 542 + 540, + 548 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 9 } } @@ -1551,46 +1551,46 @@ "type": "Identifier", "name": "B", "range": [ - 545, - 546 + 551, + 552 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 12 }, "end": { - "line": 30, + "line": 32, "column": 13 } } }, "range": [ - 534, - 546 + 540, + 552 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 13 } } }, "range": [ - 534, - 548 + 540, + 554 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 15 } } @@ -1607,16 +1607,16 @@ "type": "Identifier", "name": "b", "range": [ - 550, - 551 + 556, + 557 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 1 }, "end": { - "line": 31, + "line": 33, "column": 2 } } @@ -1625,31 +1625,31 @@ "type": "Identifier", "name": "parent", "range": [ - 552, - 558 + 558, + 564 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 3 }, "end": { - "line": 31, + "line": 33, "column": 9 } } }, "range": [ - 550, - 558 + 556, + 564 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 1 }, "end": { - "line": 31, + "line": 33, "column": 9 } } @@ -1658,46 +1658,46 @@ "type": "Identifier", "name": "B", "range": [ - 561, - 562 + 567, + 568 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 12 }, "end": { - "line": 31, + "line": 33, "column": 13 } } }, "range": [ - 550, - 562 + 556, + 568 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 1 }, "end": { - "line": 31, + "line": 33, "column": 13 } } }, "range": [ - 550, - 564 + 556, + 570 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 1 }, "end": { - "line": 31, + "line": 33, "column": 15 } } @@ -1714,16 +1714,16 @@ "type": "Identifier", "name": "c", "range": [ - 566, - 567 + 572, + 573 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 1 }, "end": { - "line": 32, + "line": 34, "column": 2 } } @@ -1732,31 +1732,31 @@ "type": "Identifier", "name": "parent", "range": [ - 568, - 574 + 574, + 580 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 3 }, "end": { - "line": 32, + "line": 34, "column": 9 } } }, "range": [ - 566, - 574 + 572, + 580 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 1 }, "end": { - "line": 32, + "line": 34, "column": 9 } } @@ -1765,62 +1765,62 @@ "type": "Identifier", "name": "A", "range": [ - 577, - 578 + 583, + 584 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 12 }, "end": { - "line": 32, + "line": 34, "column": 13 } } }, "range": [ - 566, - 578 + 572, + 584 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 1 }, "end": { - "line": 32, + "line": 34, "column": 13 } } }, "range": [ - 566, - 580 + 572, + 586 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 1 }, "end": { - "line": 32, + "line": 34, "column": 15 } } } ], "range": [ - 296, - 582 + 302, + 588 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 34 }, "end": { - "line": 33, + "line": 35, "column": 1 } } @@ -1828,26 +1828,26 @@ "generator": false, "expression": false, "range": [ - 269, - 582 + 275, + 588 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 7 }, "end": { - "line": 33, + "line": 35, "column": 1 } }, "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n ", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", "range": [ 0, - 260 + 266 ], "loc": { "start": { @@ -1855,7 +1855,7 @@ "column": 0 }, "end": { - "line": 12, + "line": 14, "column": 3 } } @@ -1866,26 +1866,26 @@ "specifiers": [], "source": null, "range": [ - 262, - 582 + 268, + 588 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 0 }, "end": { - "line": 33, + "line": 35, "column": 1 } }, "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n ", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", "range": [ 0, - 260 + 266 ], "loc": { "start": { @@ -1893,7 +1893,7 @@ "column": 0 }, "end": { - "line": 12, + "line": 14, "column": 3 } } @@ -1903,26 +1903,26 @@ ], "sourceType": "module", "range": [ - 262, - 582 + 268, + 588 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 0 }, "end": { - "line": 33, + "line": 35, "column": 1 } }, "comments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n ", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", "range": [ 0, - 260 + 266 ], "loc": { "start": { @@ -1930,7 +1930,7 @@ "column": 0 }, "end": { - "line": 12, + "line": 14, "column": 3 } } diff --git a/ast/source/base/rotate_right.js.json b/ast/source/rotate/rotate_right.js.json similarity index 83% rename from ast/source/base/rotate_right.js.json rename to ast/source/rotate/rotate_right.js.json index cb53d10..72c4069 100644 --- a/ast/source/base/rotate_right.js.json +++ b/ast/source/rotate/rotate_right.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 287, - 299 + 293, + 305 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 16 }, "end": { - "line": 14, + "line": 16, "column": 28 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "B", "range": [ - 302, - 303 + 308, + 309 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 31 }, "end": { - "line": 14, + "line": 16, "column": 32 } } @@ -55,16 +55,16 @@ "type": "Identifier", "name": "A", "range": [ - 316, - 317 + 322, + 323 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 7 }, "end": { - "line": 16, + "line": 18, "column": 8 } } @@ -76,16 +76,16 @@ "type": "Identifier", "name": "B", "range": [ - 320, - 321 + 326, + 327 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 11 }, "end": { - "line": 16, + "line": 18, "column": 12 } } @@ -94,46 +94,46 @@ "type": "Identifier", "name": "left", "range": [ - 322, - 326 + 328, + 332 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 13 }, "end": { - "line": 16, + "line": 18, "column": 17 } } }, "range": [ - 320, - 326 + 326, + 332 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 11 }, "end": { - "line": 16, + "line": 18, "column": 17 } } }, "range": [ - 316, - 326 + 322, + 332 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 7 }, "end": { - "line": 16, + "line": 18, "column": 17 } } @@ -141,16 +141,16 @@ ], "kind": "const", "range": [ - 310, - 327 + 316, + 333 ], "loc": { "start": { - "line": 16, + "line": 18, "column": 1 }, "end": { - "line": 16, + "line": 18, "column": 18 } } @@ -164,16 +164,16 @@ "type": "Identifier", "name": "a", "range": [ - 335, - 336 + 341, + 342 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 7 }, "end": { - "line": 17, + "line": 19, "column": 8 } } @@ -185,16 +185,16 @@ "type": "Identifier", "name": "A", "range": [ - 339, - 340 + 345, + 346 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 11 }, "end": { - "line": 17, + "line": 19, "column": 12 } } @@ -203,46 +203,46 @@ "type": "Identifier", "name": "left", "range": [ - 341, - 345 + 347, + 351 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 13 }, "end": { - "line": 17, + "line": 19, "column": 17 } } }, "range": [ - 339, - 345 + 345, + 351 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 11 }, "end": { - "line": 17, + "line": 19, "column": 17 } } }, "range": [ - 335, - 345 + 341, + 351 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 7 }, "end": { - "line": 17, + "line": 19, "column": 17 } } @@ -250,16 +250,16 @@ ], "kind": "const", "range": [ - 329, - 347 + 335, + 353 ], "loc": { "start": { - "line": 17, + "line": 19, "column": 1 }, "end": { - "line": 17, + "line": 19, "column": 19 } } @@ -273,16 +273,16 @@ "type": "Identifier", "name": "b", "range": [ - 355, - 356 + 361, + 362 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 7 }, "end": { - "line": 18, + "line": 20, "column": 8 } } @@ -294,16 +294,16 @@ "type": "Identifier", "name": "A", "range": [ - 359, - 360 + 365, + 366 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 11 }, "end": { - "line": 18, + "line": 20, "column": 12 } } @@ -312,46 +312,46 @@ "type": "Identifier", "name": "right", "range": [ - 361, - 366 + 367, + 372 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 13 }, "end": { - "line": 18, + "line": 20, "column": 18 } } }, "range": [ - 359, - 366 + 365, + 372 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 11 }, "end": { - "line": 18, + "line": 20, "column": 18 } } }, "range": [ - 355, - 366 + 361, + 372 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 7 }, "end": { - "line": 18, + "line": 20, "column": 18 } } @@ -359,16 +359,16 @@ ], "kind": "const", "range": [ - 349, - 368 + 355, + 374 ], "loc": { "start": { - "line": 18, + "line": 20, "column": 1 }, "end": { - "line": 18, + "line": 20, "column": 20 } } @@ -382,16 +382,16 @@ "type": "Identifier", "name": "c", "range": [ - 376, - 377 + 382, + 383 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 7 }, "end": { - "line": 19, + "line": 21, "column": 8 } } @@ -403,16 +403,16 @@ "type": "Identifier", "name": "B", "range": [ - 380, - 381 + 386, + 387 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 11 }, "end": { - "line": 19, + "line": 21, "column": 12 } } @@ -421,46 +421,46 @@ "type": "Identifier", "name": "right", "range": [ - 382, - 387 + 388, + 393 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 13 }, "end": { - "line": 19, + "line": 21, "column": 18 } } }, "range": [ - 380, - 387 + 386, + 393 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 11 }, "end": { - "line": 19, + "line": 21, "column": 18 } } }, "range": [ - 376, - 387 + 382, + 393 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 7 }, "end": { - "line": 19, + "line": 21, "column": 18 } } @@ -468,16 +468,16 @@ ], "kind": "const", "range": [ - 370, - 389 + 376, + 395 ], "loc": { "start": { - "line": 19, + "line": 21, "column": 1 }, "end": { - "line": 19, + "line": 21, "column": 20 } } @@ -497,16 +497,16 @@ "type": "Identifier", "name": "A", "range": [ - 393, - 394 + 399, + 400 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 2 }, "end": { - "line": 21, + "line": 23, "column": 3 } } @@ -515,31 +515,31 @@ "type": "Identifier", "name": "value", "range": [ - 395, - 400 + 401, + 406 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 4 }, "end": { - "line": 21, + "line": 23, "column": 9 } } }, "range": [ - 393, - 400 + 399, + 406 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 2 }, "end": { - "line": 21, + "line": 23, "column": 9 } } @@ -551,16 +551,16 @@ "type": "Identifier", "name": "B", "range": [ - 403, - 404 + 409, + 410 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 12 }, "end": { - "line": 21, + "line": 23, "column": 13 } } @@ -569,47 +569,47 @@ "type": "Identifier", "name": "value", "range": [ - 405, - 410 + 411, + 416 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 14 }, "end": { - "line": 21, + "line": 23, "column": 19 } } }, "range": [ - 403, - 410 + 409, + 416 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 12 }, "end": { - "line": 21, + "line": 23, "column": 19 } } } ], "range": [ - 392, - 411 + 398, + 417 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 20 } } @@ -624,16 +624,16 @@ "type": "Identifier", "name": "B", "range": [ - 415, - 416 + 421, + 422 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 24 }, "end": { - "line": 21, + "line": 23, "column": 25 } } @@ -642,31 +642,31 @@ "type": "Identifier", "name": "value", "range": [ - 417, - 422 + 423, + 428 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 26 }, "end": { - "line": 21, + "line": 23, "column": 31 } } }, "range": [ - 415, - 422 + 421, + 428 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 24 }, "end": { - "line": 21, + "line": 23, "column": 31 } } @@ -678,16 +678,16 @@ "type": "Identifier", "name": "A", "range": [ - 425, - 426 + 431, + 432 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 34 }, "end": { - "line": 21, + "line": 23, "column": 35 } } @@ -696,77 +696,77 @@ "type": "Identifier", "name": "value", "range": [ - 427, - 432 + 433, + 438 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 36 }, "end": { - "line": 21, + "line": 23, "column": 41 } } }, "range": [ - 425, - 432 + 431, + 438 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 34 }, "end": { - "line": 21, + "line": 23, "column": 41 } } } ], "range": [ - 414, - 433 + 420, + 439 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 23 }, "end": { - "line": 21, + "line": 23, "column": 42 } } }, "range": [ - 392, - 433 + 398, + 439 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 42 } } }, "range": [ - 392, - 435 + 398, + 441 ], "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 44 } } @@ -786,16 +786,16 @@ "type": "Identifier", "name": "A", "range": [ - 438, - 439 + 444, + 445 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 2 }, "end": { - "line": 22, + "line": 24, "column": 3 } } @@ -804,31 +804,31 @@ "type": "Identifier", "name": "color", "range": [ - 440, - 445 + 446, + 451 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 4 }, "end": { - "line": 22, + "line": 24, "column": 9 } } }, "range": [ - 438, - 445 + 444, + 451 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 2 }, "end": { - "line": 22, + "line": 24, "column": 9 } } @@ -840,16 +840,16 @@ "type": "Identifier", "name": "B", "range": [ - 448, - 449 + 454, + 455 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 12 }, "end": { - "line": 22, + "line": 24, "column": 13 } } @@ -858,47 +858,47 @@ "type": "Identifier", "name": "color", "range": [ - 450, - 455 + 456, + 461 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 14 }, "end": { - "line": 22, + "line": 24, "column": 19 } } }, "range": [ - 448, - 455 + 454, + 461 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 12 }, "end": { - "line": 22, + "line": 24, "column": 19 } } } ], "range": [ - 437, - 456 + 443, + 462 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, + "line": 24, "column": 20 } } @@ -913,16 +913,16 @@ "type": "Identifier", "name": "B", "range": [ - 460, - 461 + 466, + 467 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 24 }, "end": { - "line": 22, + "line": 24, "column": 25 } } @@ -931,31 +931,31 @@ "type": "Identifier", "name": "color", "range": [ - 462, - 467 + 468, + 473 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 26 }, "end": { - "line": 22, + "line": 24, "column": 31 } } }, "range": [ - 460, - 467 + 466, + 473 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 24 }, "end": { - "line": 22, + "line": 24, "column": 31 } } @@ -967,16 +967,16 @@ "type": "Identifier", "name": "A", "range": [ - 470, - 471 + 476, + 477 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 34 }, "end": { - "line": 22, + "line": 24, "column": 35 } } @@ -985,77 +985,77 @@ "type": "Identifier", "name": "color", "range": [ - 472, - 477 + 478, + 483 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 36 }, "end": { - "line": 22, + "line": 24, "column": 41 } } }, "range": [ - 470, - 477 + 476, + 483 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 34 }, "end": { - "line": 22, + "line": 24, "column": 41 } } } ], "range": [ - 459, - 478 + 465, + 484 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 23 }, "end": { - "line": 22, + "line": 24, "column": 42 } } }, "range": [ - 437, - 478 + 443, + 484 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, + "line": 24, "column": 42 } } }, "range": [ - 437, - 480 + 443, + 486 ], "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, + "line": 24, "column": 44 } } @@ -1072,16 +1072,16 @@ "type": "Identifier", "name": "B", "range": [ - 483, - 484 + 489, + 490 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, + "line": 26, "column": 2 } } @@ -1090,31 +1090,31 @@ "type": "Identifier", "name": "left", "range": [ - 485, - 489 + 491, + 495 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 3 }, "end": { - "line": 24, + "line": 26, "column": 7 } } }, "range": [ - 483, - 489 + 489, + 495 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, + "line": 26, "column": 7 } } @@ -1123,46 +1123,46 @@ "type": "Identifier", "name": "a", "range": [ - 492, - 493 + 498, + 499 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 10 }, "end": { - "line": 24, + "line": 26, "column": 11 } } }, "range": [ - 483, - 493 + 489, + 499 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, + "line": 26, "column": 11 } } }, "range": [ - 483, - 495 + 489, + 501 ], "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, + "line": 26, "column": 13 } } @@ -1179,16 +1179,16 @@ "type": "Identifier", "name": "B", "range": [ - 497, - 498 + 503, + 504 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 1 }, "end": { - "line": 25, + "line": 27, "column": 2 } } @@ -1197,31 +1197,31 @@ "type": "Identifier", "name": "right", "range": [ - 499, - 504 + 505, + 510 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 3 }, "end": { - "line": 25, + "line": 27, "column": 8 } } }, "range": [ - 497, - 504 + 503, + 510 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 1 }, "end": { - "line": 25, + "line": 27, "column": 8 } } @@ -1230,46 +1230,46 @@ "type": "Identifier", "name": "A", "range": [ - 507, - 508 + 513, + 514 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 11 }, "end": { - "line": 25, + "line": 27, "column": 12 } } }, "range": [ - 497, - 508 + 503, + 514 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 1 }, "end": { - "line": 25, + "line": 27, "column": 12 } } }, "range": [ - 497, - 510 + 503, + 516 ], "loc": { "start": { - "line": 25, + "line": 27, "column": 1 }, "end": { - "line": 25, + "line": 27, "column": 14 } } @@ -1286,16 +1286,16 @@ "type": "Identifier", "name": "A", "range": [ - 513, - 514 + 519, + 520 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 1 }, "end": { - "line": 27, + "line": 29, "column": 2 } } @@ -1304,31 +1304,31 @@ "type": "Identifier", "name": "left", "range": [ - 515, - 519 + 521, + 525 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 3 }, "end": { - "line": 27, + "line": 29, "column": 7 } } }, "range": [ - 513, - 519 + 519, + 525 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 1 }, "end": { - "line": 27, + "line": 29, "column": 7 } } @@ -1337,46 +1337,46 @@ "type": "Identifier", "name": "b", "range": [ - 522, - 523 + 528, + 529 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 10 }, "end": { - "line": 27, + "line": 29, "column": 11 } } }, "range": [ - 513, - 523 + 519, + 529 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 1 }, "end": { - "line": 27, + "line": 29, "column": 11 } } }, "range": [ - 513, - 525 + 519, + 531 ], "loc": { "start": { - "line": 27, + "line": 29, "column": 1 }, "end": { - "line": 27, + "line": 29, "column": 13 } } @@ -1393,16 +1393,16 @@ "type": "Identifier", "name": "A", "range": [ - 527, - 528 + 533, + 534 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 2 } } @@ -1411,31 +1411,31 @@ "type": "Identifier", "name": "right", "range": [ - 529, - 534 + 535, + 540 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 3 }, "end": { - "line": 28, + "line": 30, "column": 8 } } }, "range": [ - 527, - 534 + 533, + 540 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 8 } } @@ -1444,46 +1444,46 @@ "type": "Identifier", "name": "c", "range": [ - 537, - 538 + 543, + 544 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 11 }, "end": { - "line": 28, + "line": 30, "column": 12 } } }, "range": [ - 527, - 538 + 533, + 544 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 12 } } }, "range": [ - 527, - 540 + 533, + 546 ], "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 14 } } @@ -1500,16 +1500,16 @@ "type": "Identifier", "name": "a", "range": [ - 543, - 544 + 549, + 550 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 2 } } @@ -1518,31 +1518,31 @@ "type": "Identifier", "name": "parent", "range": [ - 545, - 551 + 551, + 557 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 3 }, "end": { - "line": 30, + "line": 32, "column": 9 } } }, "range": [ - 543, - 551 + 549, + 557 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 9 } } @@ -1551,46 +1551,46 @@ "type": "Identifier", "name": "B", "range": [ - 554, - 555 + 560, + 561 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 12 }, "end": { - "line": 30, + "line": 32, "column": 13 } } }, "range": [ - 543, - 555 + 549, + 561 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 13 } } }, "range": [ - 543, - 557 + 549, + 563 ], "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 15 } } @@ -1607,16 +1607,16 @@ "type": "Identifier", "name": "b", "range": [ - 559, - 560 + 565, + 566 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 1 }, "end": { - "line": 31, + "line": 33, "column": 2 } } @@ -1625,31 +1625,31 @@ "type": "Identifier", "name": "parent", "range": [ - 561, - 567 + 567, + 573 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 3 }, "end": { - "line": 31, + "line": 33, "column": 9 } } }, "range": [ - 559, - 567 + 565, + 573 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 1 }, "end": { - "line": 31, + "line": 33, "column": 9 } } @@ -1658,46 +1658,46 @@ "type": "Identifier", "name": "A", "range": [ - 570, - 571 + 576, + 577 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 12 }, "end": { - "line": 31, + "line": 33, "column": 13 } } }, "range": [ - 559, - 571 + 565, + 577 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 1 }, "end": { - "line": 31, + "line": 33, "column": 13 } } }, "range": [ - 559, - 573 + 565, + 579 ], "loc": { "start": { - "line": 31, + "line": 33, "column": 1 }, "end": { - "line": 31, + "line": 33, "column": 15 } } @@ -1714,16 +1714,16 @@ "type": "Identifier", "name": "c", "range": [ - 575, - 576 + 581, + 582 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 1 }, "end": { - "line": 32, + "line": 34, "column": 2 } } @@ -1732,31 +1732,31 @@ "type": "Identifier", "name": "parent", "range": [ - 577, - 583 + 583, + 589 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 3 }, "end": { - "line": 32, + "line": 34, "column": 9 } } }, "range": [ - 575, - 583 + 581, + 589 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 1 }, "end": { - "line": 32, + "line": 34, "column": 9 } } @@ -1765,62 +1765,62 @@ "type": "Identifier", "name": "A", "range": [ - 586, - 587 + 592, + 593 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 12 }, "end": { - "line": 32, + "line": 34, "column": 13 } } }, "range": [ - 575, - 587 + 581, + 593 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 1 }, "end": { - "line": 32, + "line": 34, "column": 13 } } }, "range": [ - 575, - 589 + 581, + 595 ], "loc": { "start": { - "line": 32, + "line": 34, "column": 1 }, "end": { - "line": 32, + "line": 34, "column": 15 } } } ], "range": [ - 306, - 592 + 312, + 598 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 35 }, "end": { - "line": 34, + "line": 36, "column": 1 } } @@ -1828,26 +1828,26 @@ "generator": false, "expression": false, "range": [ - 278, - 592 + 284, + 598 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 7 }, "end": { - "line": 34, + "line": 36, "column": 1 } }, "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", "range": [ 0, - 269 + 275 ], "loc": { "start": { @@ -1855,7 +1855,7 @@ "column": 0 }, "end": { - "line": 12, + "line": 14, "column": 3 } } @@ -1866,26 +1866,26 @@ "specifiers": [], "source": null, "range": [ - 271, - 592 + 277, + 598 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 0 }, "end": { - "line": 34, + "line": 36, "column": 1 } }, "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", "range": [ 0, - 269 + 275 ], "loc": { "start": { @@ -1893,7 +1893,7 @@ "column": 0 }, "end": { - "line": 12, + "line": 14, "column": 3 } } @@ -1903,26 +1903,26 @@ ], "sourceType": "module", "range": [ - 271, - 592 + 277, + 598 ], "loc": { "start": { - "line": 14, + "line": 16, "column": 0 }, "end": { - "line": 34, + "line": 36, "column": 1 } }, "comments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", "range": [ 0, - 269 + 275 ], "loc": { "start": { @@ -1930,7 +1930,7 @@ "column": 0 }, "end": { - "line": 12, + "line": 14, "column": 3 } } diff --git a/ast/source/base/find.js.json b/ast/source/search/find.js.json similarity index 78% rename from ast/source/base/find.js.json rename to ast/source/search/find.js.json index ba42b9f..92c4473 100644 --- a/ast/source/base/find.js.json +++ b/ast/source/search/find.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "find", "range": [ - 17, - 21 + 16, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 16 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "compare", "range": [ - 24, - 31 + 23, + 30 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 30 } } @@ -46,16 +46,16 @@ "type": "Identifier", "name": "node", "range": [ - 33, - 37 + 32, + 36 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 32 }, "end": { - "line": 2, + "line": 1, "column": 36 } } @@ -64,16 +64,16 @@ "type": "Identifier", "name": "value", "range": [ - 39, - 44 + 38, + 43 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 38 }, "end": { - "line": 2, + "line": 1, "column": 43 } } @@ -89,16 +89,16 @@ "value": true, "raw": "true", "range": [ - 123, - 127 + 122, + 126 ], "loc": { "start": { - "line": 7, + "line": 6, "column": 9 }, "end": { - "line": 7, + "line": 6, "column": 13 } } @@ -115,16 +115,16 @@ "type": "Identifier", "name": "d", "range": [ - 141, - 142 + 140, + 141 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 8 }, "end": { - "line": 9, + "line": 8, "column": 9 } } @@ -135,16 +135,16 @@ "type": "Identifier", "name": "compare", "range": [ - 145, - 152 + 144, + 151 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 12 }, "end": { - "line": 9, + "line": 8, "column": 19 } } @@ -154,16 +154,16 @@ "type": "Identifier", "name": "value", "range": [ - 154, - 159 + 153, + 158 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 21 }, "end": { - "line": 9, + "line": 8, "column": 26 } } @@ -175,16 +175,16 @@ "type": "Identifier", "name": "node", "range": [ - 161, - 165 + 160, + 164 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 28 }, "end": { - "line": 9, + "line": 8, "column": 32 } } @@ -193,62 +193,62 @@ "type": "Identifier", "name": "value", "range": [ - 166, - 171 + 165, + 170 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 33 }, "end": { - "line": 9, + "line": 8, "column": 38 } } }, "range": [ - 161, - 171 + 160, + 170 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 28 }, "end": { - "line": 9, + "line": 8, "column": 38 } } } ], "range": [ - 145, - 173 + 144, + 172 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 12 }, "end": { - "line": 9, + "line": 8, "column": 40 } } }, "range": [ - 141, - 173 + 140, + 172 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 8 }, "end": { - "line": 9, + "line": 8, "column": 40 } } @@ -256,16 +256,16 @@ ], "kind": "const", "range": [ - 135, - 174 + 134, + 173 ], "loc": { "start": { - "line": 9, + "line": 8, "column": 2 }, "end": { - "line": 9, + "line": 8, "column": 41 } } @@ -279,16 +279,16 @@ "type": "Identifier", "name": "d", "range": [ - 183, - 184 + 182, + 183 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 7 }, "end": { - "line": 11, + "line": 10, "column": 8 } } @@ -298,31 +298,31 @@ "value": 0, "raw": "0", "range": [ - 189, - 190 + 188, + 189 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 13 }, "end": { - "line": 11, + "line": 10, "column": 14 } } }, "range": [ - 183, - 190 + 182, + 189 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 7 }, "end": { - "line": 11, + "line": 10, "column": 14 } } @@ -336,47 +336,47 @@ "type": "Identifier", "name": "node", "range": [ - 205, - 209 + 204, + 208 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 10 }, "end": { - "line": 12, + "line": 11, "column": 14 } } }, "range": [ - 198, - 210 + 197, + 209 ], "loc": { "start": { - "line": 12, + "line": 11, "column": 3 }, "end": { - "line": 12, + "line": 11, "column": 15 } } } ], "range": [ - 193, - 214 + 192, + 213 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 17 }, "end": { - "line": 13, + "line": 12, "column": 3 } } @@ -390,16 +390,16 @@ "type": "Identifier", "name": "d", "range": [ - 228, - 229 + 227, + 228 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 12 }, "end": { - "line": 15, + "line": 14, "column": 13 } } @@ -409,31 +409,31 @@ "value": 0, "raw": "0", "range": [ - 232, - 233 + 231, + 232 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 16 }, "end": { - "line": 15, + "line": 14, "column": 17 } } }, "range": [ - 228, - 233 + 227, + 232 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 12 }, "end": { - "line": 15, + "line": 14, "column": 17 } } @@ -450,16 +450,16 @@ "type": "Identifier", "name": "node", "range": [ - 241, - 245 + 240, + 244 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 3 }, "end": { - "line": 16, + "line": 15, "column": 7 } } @@ -471,16 +471,16 @@ "type": "Identifier", "name": "node", "range": [ - 248, - 252 + 247, + 251 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 10 }, "end": { - "line": 16, + "line": 15, "column": 14 } } @@ -489,77 +489,77 @@ "type": "Identifier", "name": "left", "range": [ - 253, - 257 + 252, + 256 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 15 }, "end": { - "line": 16, + "line": 15, "column": 19 } } }, "range": [ - 248, - 257 + 247, + 256 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 10 }, "end": { - "line": 16, + "line": 15, "column": 19 } } }, "range": [ - 241, - 257 + 240, + 256 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 3 }, "end": { - "line": 16, + "line": 15, "column": 19 } } }, "range": [ - 241, - 258 + 240, + 257 ], "loc": { "start": { - "line": 16, + "line": 15, "column": 3 }, "end": { - "line": 16, + "line": 15, "column": 20 } } } ], "range": [ - 236, - 262 + 235, + 261 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 20 }, "end": { - "line": 17, + "line": 16, "column": 3 } } @@ -576,16 +576,16 @@ "type": "Identifier", "name": "node", "range": [ - 276, - 280 + 275, + 279 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 7 } } @@ -597,16 +597,16 @@ "type": "Identifier", "name": "node", "range": [ - 283, - 287 + 282, + 286 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 10 }, "end": { - "line": 20, + "line": 19, "column": 14 } } @@ -615,107 +615,107 @@ "type": "Identifier", "name": "right", "range": [ - 288, - 293 + 287, + 292 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 15 }, "end": { - "line": 20, + "line": 19, "column": 20 } } }, "range": [ - 283, - 293 + 282, + 292 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 10 }, "end": { - "line": 20, + "line": 19, "column": 20 } } }, "range": [ - 276, - 293 + 275, + 292 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 20 } } }, "range": [ - 276, - 294 + 275, + 293 ], "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 21 } } } ], "range": [ - 271, - 298 + 270, + 297 ], "loc": { "start": { - "line": 19, + "line": 18, "column": 7 }, "end": { - "line": 21, + "line": 20, "column": 3 } } }, "range": [ - 223, - 298 + 222, + 297 ], "loc": { "start": { - "line": 15, + "line": 14, "column": 7 }, "end": { - "line": 21, + "line": 20, "column": 3 } } }, "range": [ - 178, - 298 + 177, + 297 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 2 }, "end": { - "line": 21, + "line": 20, "column": 3 } } @@ -731,16 +731,16 @@ "type": "Identifier", "name": "node", "range": [ - 307, - 311 + 306, + 310 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 7 }, "end": { - "line": 23, + "line": 22, "column": 11 } } @@ -749,47 +749,47 @@ "type": "Identifier", "name": "isleaf", "range": [ - 312, - 318 + 311, + 317 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 12 }, "end": { - "line": 23, + "line": 22, "column": 18 } } }, "range": [ - 307, - 318 + 306, + 317 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 7 }, "end": { - "line": 23, + "line": 22, "column": 18 } } }, "arguments": [], "range": [ - 307, - 320 + 306, + 319 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 7 }, "end": { - "line": 23, + "line": 22, "column": 20 } } @@ -804,94 +804,94 @@ "value": null, "raw": "null", "range": [ - 335, - 339 + 334, + 338 ], "loc": { "start": { - "line": 24, + "line": 23, "column": 10 }, "end": { - "line": 24, + "line": 23, "column": 14 } } }, "range": [ - 328, - 340 + 327, + 339 ], "loc": { "start": { - "line": 24, + "line": 23, "column": 3 }, "end": { - "line": 24, + "line": 23, "column": 15 } } } ], "range": [ - 323, - 344 + 322, + 343 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 23 }, "end": { - "line": 25, + "line": 24, "column": 3 } } }, "alternate": null, "range": [ - 302, - 344 + 301, + 343 ], "loc": { "start": { - "line": 23, + "line": 22, "column": 2 }, "end": { - "line": 25, + "line": 24, "column": 3 } } } ], "range": [ - 130, - 348 + 129, + 347 ], "loc": { "start": { - "line": 7, + "line": 6, "column": 16 }, "end": { - "line": 27, + "line": 26, "column": 2 } } }, "range": [ - 115, - 348 + 114, + 347 ], "loc": { "start": { - "line": 7, + "line": 6, "column": 1 }, "end": { - "line": 27, + "line": 26, "column": 2 } }, @@ -900,16 +900,16 @@ "type": "Line", "value": " scan for first node whose", "range": [ - 51, - 79 + 50, + 78 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 1 }, "end": { - "line": 4, + "line": 3, "column": 29 } } @@ -918,16 +918,16 @@ "type": "Line", "value": " value equals parameter value", "range": [ - 81, - 112 + 80, + 111 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 1 }, "end": { - "line": 5, + "line": 4, "column": 32 } } @@ -936,16 +936,16 @@ } ], "range": [ - 47, - 351 + 46, + 350 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 46 }, "end": { - "line": 29, + "line": 28, "column": 1 } } @@ -953,16 +953,16 @@ "generator": false, "expression": false, "range": [ - 8, - 351 + 7, + 350 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 7 }, "end": { - "line": 29, + "line": 28, "column": 1 } }, @@ -972,16 +972,16 @@ "specifiers": [], "source": null, "range": [ - 1, - 351 + 0, + 350 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 29, + "line": 28, "column": 1 } } @@ -989,16 +989,16 @@ ], "sourceType": "module", "range": [ - 1, - 351 + 0, + 350 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 29, + "line": 28, "column": 1 } }, @@ -1007,16 +1007,16 @@ "type": "Line", "value": " scan for first node whose", "range": [ - 51, - 79 + 50, + 78 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 1 }, "end": { - "line": 4, + "line": 3, "column": 29 } } @@ -1025,16 +1025,16 @@ "type": "Line", "value": " value equals parameter value", "range": [ - 81, - 112 + 80, + 111 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 1 }, "end": { - "line": 5, + "line": 4, "column": 32 } } diff --git a/ast/source/search/index.js.json b/ast/source/search/index.js.json new file mode 100644 index 0000000..7bdc04b --- /dev/null +++ b/ast/source/search/index.js.json @@ -0,0 +1,57 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./find", + "raw": "'./find'", + "range": [ + 14, + 22 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 22 + } + } + }, + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 24 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/traversal/index.js.json b/ast/source/traversal/index.js.json new file mode 100644 index 0000000..fd1d5ee --- /dev/null +++ b/ast/source/traversal/index.js.json @@ -0,0 +1,57 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./inordertraversal", + "raw": "'./inordertraversal'", + "range": [ + 14, + 34 + ], + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 34 + } + } + }, + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 36 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 36 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/ast/source/base/inordertraversal.js.json b/ast/source/traversal/inordertraversal.js.json similarity index 79% rename from ast/source/base/inordertraversal.js.json rename to ast/source/traversal/inordertraversal.js.json index e330999..0c6c76d 100644 --- a/ast/source/base/inordertraversal.js.json +++ b/ast/source/traversal/inordertraversal.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 18, - 34 + 17, + 33 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 17 }, "end": { - "line": 2, + "line": 1, "column": 33 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "node", "range": [ - 37, - 41 + 36, + 40 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 36 }, "end": { - "line": 2, + "line": 1, "column": 40 } } @@ -63,16 +63,16 @@ "type": "Identifier", "name": "node", "range": [ - 54, - 58 + 53, + 57 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 7 }, "end": { - "line": 4, + "line": 3, "column": 11 } } @@ -81,31 +81,31 @@ "type": "Identifier", "name": "left", "range": [ - 59, - 63 + 58, + 62 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 12 }, "end": { - "line": 4, + "line": 3, "column": 16 } } }, "range": [ - 54, - 63 + 53, + 62 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 7 }, "end": { - "line": 4, + "line": 3, "column": 16 } } @@ -114,63 +114,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 64, - 70 + 63, + 69 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 17 }, "end": { - "line": 4, + "line": 3, "column": 23 } } }, "range": [ - 54, - 70 + 53, + 69 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 7 }, "end": { - "line": 4, + "line": 3, "column": 23 } } }, "arguments": [], "range": [ - 54, - 72 + 53, + 71 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 7 }, "end": { - "line": 4, + "line": 3, "column": 25 } } }, "prefix": true, "range": [ - 53, - 72 + 52, + 71 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 6 }, "end": { - "line": 4, + "line": 3, "column": 25 } } @@ -188,16 +188,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 86, - 102 + 85, + 101 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 9 }, "end": { - "line": 5, + "line": 4, "column": 25 } } @@ -210,16 +210,16 @@ "type": "Identifier", "name": "node", "range": [ - 104, - 108 + 103, + 107 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 27 }, "end": { - "line": 5, + "line": 4, "column": 31 } } @@ -228,110 +228,110 @@ "type": "Identifier", "name": "left", "range": [ - 109, - 113 + 108, + 112 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 32 }, "end": { - "line": 5, + "line": 4, "column": 36 } } }, "range": [ - 104, - 113 + 103, + 112 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 27 }, "end": { - "line": 5, + "line": 4, "column": 36 } } } ], "range": [ - 86, - 115 + 85, + 114 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 9 }, "end": { - "line": 5, + "line": 4, "column": 38 } } }, "delegate": true, "range": [ - 79, - 115 + 78, + 114 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 2 }, "end": { - "line": 5, + "line": 4, "column": 38 } } }, "range": [ - 79, - 116 + 78, + 115 ], "loc": { "start": { - "line": 5, + "line": 4, "column": 2 }, "end": { - "line": 5, + "line": 4, "column": 39 } } } ], "range": [ - 75, - 119 + 74, + 118 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 28 }, "end": { - "line": 6, + "line": 5, "column": 2 } } }, "alternate": null, "range": [ - 48, - 119 + 47, + 118 ], "loc": { "start": { - "line": 4, + "line": 3, "column": 1 }, "end": { - "line": 6, + "line": 5, "column": 2 } } @@ -347,16 +347,16 @@ "type": "Identifier", "name": "node", "range": [ - 128, - 132 + 127, + 131 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 11 } } @@ -365,62 +365,62 @@ "type": "Identifier", "name": "value", "range": [ - 133, - 138 + 132, + 137 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 12 }, "end": { - "line": 8, + "line": 7, "column": 17 } } }, "range": [ - 128, - 138 + 127, + 137 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 17 } } }, "delegate": false, "range": [ - 122, - 138 + 121, + 137 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 1 }, "end": { - "line": 8, + "line": 7, "column": 17 } } }, "range": [ - 122, - 140 + 121, + 139 ], "loc": { "start": { - "line": 8, + "line": 7, "column": 1 }, "end": { - "line": 8, + "line": 7, "column": 19 } } @@ -442,16 +442,16 @@ "type": "Identifier", "name": "node", "range": [ - 149, - 153 + 148, + 152 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 7 }, "end": { - "line": 10, + "line": 9, "column": 11 } } @@ -460,31 +460,31 @@ "type": "Identifier", "name": "right", "range": [ - 154, - 159 + 153, + 158 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 12 }, "end": { - "line": 10, + "line": 9, "column": 17 } } }, "range": [ - 149, - 159 + 148, + 158 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 7 }, "end": { - "line": 10, + "line": 9, "column": 17 } } @@ -493,63 +493,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 160, - 166 + 159, + 165 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 18 }, "end": { - "line": 10, + "line": 9, "column": 24 } } }, "range": [ - 149, - 166 + 148, + 165 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 7 }, "end": { - "line": 10, + "line": 9, "column": 24 } } }, "arguments": [], "range": [ - 149, - 168 + 148, + 167 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 7 }, "end": { - "line": 10, + "line": 9, "column": 26 } } }, "prefix": true, "range": [ - 148, - 168 + 147, + 167 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 6 }, "end": { - "line": 10, + "line": 9, "column": 26 } } @@ -567,16 +567,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 182, - 198 + 181, + 197 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 9 }, "end": { - "line": 11, + "line": 10, "column": 25 } } @@ -589,16 +589,16 @@ "type": "Identifier", "name": "node", "range": [ - 200, - 204 + 199, + 203 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 27 }, "end": { - "line": 11, + "line": 10, "column": 31 } } @@ -607,126 +607,126 @@ "type": "Identifier", "name": "right", "range": [ - 205, - 210 + 204, + 209 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 32 }, "end": { - "line": 11, + "line": 10, "column": 37 } } }, "range": [ - 200, - 210 + 199, + 209 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 27 }, "end": { - "line": 11, + "line": 10, "column": 37 } } } ], "range": [ - 182, - 212 + 181, + 211 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 9 }, "end": { - "line": 11, + "line": 10, "column": 39 } } }, "delegate": true, "range": [ - 175, - 212 + 174, + 211 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 2 }, "end": { - "line": 11, + "line": 10, "column": 39 } } }, "range": [ - 175, - 213 + 174, + 212 ], "loc": { "start": { - "line": 11, + "line": 10, "column": 2 }, "end": { - "line": 11, + "line": 10, "column": 40 } } } ], "range": [ - 171, - 216 + 170, + 215 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 29 }, "end": { - "line": 12, + "line": 11, "column": 2 } } }, "alternate": null, "range": [ - 143, - 216 + 142, + 215 ], "loc": { "start": { - "line": 10, + "line": 9, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 2 } } } ], "range": [ - 44, - 219 + 43, + 218 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 43 }, "end": { - "line": 14, + "line": 13, "column": 1 } } @@ -734,16 +734,16 @@ "generator": true, "expression": false, "range": [ - 8, - 219 + 7, + 218 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 7 }, "end": { - "line": 14, + "line": 13, "column": 1 } }, @@ -753,16 +753,16 @@ "specifiers": [], "source": null, "range": [ - 1, - 219 + 0, + 218 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 14, + "line": 13, "column": 1 } } @@ -770,16 +770,16 @@ ], "sourceType": "module", "range": [ - 1, - 219 + 0, + 218 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 14, + "line": 13, "column": 1 } }, diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/adt/RedBlackTree.js~RedBlackTree.html index 2dd453f..b5e8e94 100644 --- a/class/src/adt/RedBlackTree.js~RedBlackTree.html +++ b/class/src/adt/RedBlackTree.js~RedBlackTree.html @@ -35,26 +35,21 @@
                                            diff --git a/coverage.json b/coverage.json index 36c0a04..fe7dfec 100644 --- a/coverage.json +++ b/coverage.json @@ -3,28 +3,34 @@ "expectCount": 36, "actualCount": 2, "files": { - "src/base/colors.js": { - "expectCount": 2, + "src/color/BLACK.js": { + "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 1, - 2 + 1 ] }, - "src/node/Leaf.js": { + "src/adt/Leaf.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ 3 ] }, - "src/node/Node.js": { + "src/adt/Node.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ 3 ] }, + "src/color/RED.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 1 + ] + }, "src/adt/RedBlackTree.js": { "expectCount": 9, "actualCount": 0, @@ -40,18 +46,18 @@ 15 ] }, - "src/base/debug.js": { + "src/debug/debug.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 6 + 5 ] }, "src/removal/delete_case1.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 6 + 3 ] }, "src/removal/delete_case2.js": { @@ -65,7 +71,7 @@ "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 7 + 6 ] }, "src/removal/delete_case4.js": { @@ -79,14 +85,14 @@ "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 6 + 5 ] }, "src/removal/delete_case6.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 4 + 3 ] }, "src/removal/delete_one_child.js": { @@ -96,11 +102,11 @@ 6 ] }, - "src/base/find.js": { + "src/search/find.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 2 + 1 ] }, "src/family/grandparent.js": { @@ -110,14 +116,14 @@ 1 ] }, - "src/base/inordertraversal.js": { + "src/traversal/inordertraversal.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ - 2 + 1 ] }, - "src/base/insert.js": { + "src/insertion/insert.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ @@ -166,19 +172,19 @@ 1 ] }, - "src/base/replace_node.js": { + "src/removal/replace_node.js": { "expectCount": 1, "actualCount": 0, "undocumentLines": [ 1 ] }, - "src/base/rotate_left.js": { + "src/rotate/rotate_left.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/base/rotate_right.js": { + "src/rotate/rotate_right.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] diff --git a/dump.json b/dump.json index d67ee21..6b11b97 100644 --- a/dump.json +++ b/dump.json @@ -4,16 +4,144 @@ "kind": "file", "static": true, "variation": null, + "name": "src/adt/Leaf.js", + "memberof": null, + "longname": "src/adt/Leaf.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { BLACK } from '..' ;\n\nexport function Leaf ( parent ) {\n\tthis.color = BLACK ;\n\tthis.parent = parent ;\n}\n\nLeaf.prototype.isleaf = function ( ) { return true ; } ;\n" + }, + { + "__docId__": 1, + "kind": "function", + "static": true, + "variation": null, + "name": "Leaf", + "memberof": "src/adt/Leaf.js", + "longname": "src/adt/Leaf.js~Leaf", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/adt/Leaf.js", + "importStyle": "{Leaf}", + "description": null, + "lineNumber": 3, + "undocument": true, + "params": [ + { + "name": "parent", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 2, + "kind": "function", + "static": true, + "variation": null, + "name": "isleaf", + "memberof": "src/adt/Leaf.js", + "longname": "src/adt/Leaf.js~isleaf", + "access": null, + "export": false, + "importPath": "aureooms-es-red-black-tree/src/adt/Leaf.js", + "importStyle": null, + "description": null, + "lineNumber": 8, + "undocument": true, + "params": [], + "return": { + "types": [ + "boolean" + ] + }, + "generator": false + }, + { + "__docId__": 3, + "kind": "file", + "static": true, + "variation": null, + "name": "src/adt/Node.js", + "memberof": null, + "longname": "src/adt/Node.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { Leaf } from './Leaf' ;\n\nexport function Node ( color , value ) {\n\tthis.color = color ;\n\tthis.left = new Leaf( this ) ;\n\tthis.right = new Leaf( this ) ;\n\tthis.parent = null ;\n\tthis.value = value ;\n}\n\nNode.prototype.isleaf = function ( ) { return false ; } ;\n" + }, + { + "__docId__": 4, + "kind": "function", + "static": true, + "variation": null, + "name": "Node", + "memberof": "src/adt/Node.js", + "longname": "src/adt/Node.js~Node", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/adt/Node.js", + "importStyle": "{Node}", + "description": null, + "lineNumber": 3, + "undocument": true, + "params": [ + { + "name": "color", + "types": [ + "*" + ] + }, + { + "name": "value", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 5, + "kind": "function", + "static": true, + "variation": null, + "name": "isleaf", + "memberof": "src/adt/Node.js", + "longname": "src/adt/Node.js~isleaf", + "access": null, + "export": false, + "importPath": "aureooms-es-red-black-tree/src/adt/Node.js", + "importStyle": null, + "description": null, + "lineNumber": 11, + "undocument": true, + "params": [], + "return": { + "types": [ + "boolean" + ] + }, + "generator": false + }, + { + "__docId__": 6, + "kind": "file", + "static": true, + "variation": null, "name": "src/adt/RedBlackTree.js", "memberof": null, "longname": "src/adt/RedBlackTree.js", "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { Node } from '..' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { find } from '..' ;\nimport { inordertraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\tfind ( value ) {\n\n\t\tif ( this.root === null ) return null ;\n\n\t\treturn find( this.compare , this.root , value ) ;\n\n\t}\n\n\tdelete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\t*[Symbol.iterator] ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" + "content": "\nimport { Node } from './Node' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { find } from '..' ;\nimport { inordertraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\tfind ( value ) {\n\n\t\tif ( this.root === null ) return null ;\n\n\t\treturn find( this.compare , this.root , value ) ;\n\n\t}\n\n\tdelete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\t*[Symbol.iterator] ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" }, { - "__docId__": 1, + "__docId__": 7, "kind": "class", "static": true, "variation": null, @@ -30,7 +158,7 @@ "interface": false }, { - "__docId__": 2, + "__docId__": 8, "kind": "constructor", "static": false, "variation": null, @@ -52,7 +180,7 @@ "generator": false }, { - "__docId__": 3, + "__docId__": 9, "kind": "member", "static": false, "variation": null, @@ -70,7 +198,7 @@ } }, { - "__docId__": 4, + "__docId__": 10, "kind": "member", "static": false, "variation": null, @@ -88,7 +216,7 @@ } }, { - "__docId__": 5, + "__docId__": 11, "kind": "method", "static": false, "variation": null, @@ -110,7 +238,7 @@ "generator": false }, { - "__docId__": 6, + "__docId__": 12, "kind": "member", "static": false, "variation": null, @@ -128,7 +256,7 @@ } }, { - "__docId__": 7, + "__docId__": 13, "kind": "method", "static": false, "variation": null, @@ -155,7 +283,7 @@ "generator": false }, { - "__docId__": 8, + "__docId__": 14, "kind": "method", "static": false, "variation": null, @@ -177,7 +305,7 @@ "generator": false }, { - "__docId__": 9, + "__docId__": 15, "kind": "member", "static": false, "variation": null, @@ -195,7 +323,7 @@ } }, { - "__docId__": 10, + "__docId__": 16, "kind": "method", "static": false, "variation": null, @@ -210,7 +338,7 @@ "generator": true }, { - "__docId__": 11, + "__docId__": 17, "kind": "method", "static": true, "variation": null, @@ -243,7 +371,7 @@ "generator": false }, { - "__docId__": 12, + "__docId__": 18, "kind": "file", "static": true, "variation": null, @@ -253,32 +381,32 @@ "access": null, "description": null, "lineNumber": 1, - "content": "export * from './RedBlackTree' ;\n" + "content": "export * from './Leaf' ;\nexport * from './Node' ;\nexport * from './RedBlackTree' ;\n" }, { - "__docId__": 13, + "__docId__": 19, "kind": "file", "static": true, "variation": null, - "name": "src/base/colors.js", + "name": "src/color/BLACK.js", "memberof": null, - "longname": "src/base/colors.js", + "longname": "src/color/BLACK.js", "access": null, "description": null, "lineNumber": 1, - "content": "export const BLACK = 0 ;\nexport const RED = 1 ;\n" + "content": "export const BLACK = 0 ;\n" }, { - "__docId__": 14, + "__docId__": 20, "kind": "variable", "static": true, "variation": null, "name": "BLACK", - "memberof": "src/base/colors.js", - "longname": "src/base/colors.js~BLACK", + "memberof": "src/color/BLACK.js", + "longname": "src/color/BLACK.js~BLACK", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/colors.js", + "importPath": "aureooms-es-red-black-tree/src/color/BLACK.js", "importStyle": "{BLACK}", "description": null, "lineNumber": 1, @@ -290,19 +418,32 @@ } }, { - "__docId__": 15, + "__docId__": 21, + "kind": "file", + "static": true, + "variation": null, + "name": "src/color/RED.js", + "memberof": null, + "longname": "src/color/RED.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export const RED = 1 ;\n" + }, + { + "__docId__": 22, "kind": "variable", "static": true, "variation": null, "name": "RED", - "memberof": "src/base/colors.js", - "longname": "src/base/colors.js~RED", + "memberof": "src/color/RED.js", + "longname": "src/color/RED.js~RED", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/colors.js", + "importPath": "aureooms-es-red-black-tree/src/color/RED.js", "importStyle": "{RED}", "description": null, - "lineNumber": 2, + "lineNumber": 1, "undocument": true, "type": { "types": [ @@ -311,32 +452,45 @@ } }, { - "__docId__": 16, + "__docId__": 23, "kind": "file", "static": true, "variation": null, - "name": "src/base/debug.js", + "name": "src/color/index.js", "memberof": null, - "longname": "src/base/debug.js", + "longname": "src/color/index.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { BLACK } from './colors' ;\n\nimport chalk from 'chalk' ;\n\nexport function debug ( node ) {\n\n\tif ( node.isleaf( ) ) return chalk.bgBlack('L') ;\n\n\tconst repr = node.color === BLACK ? chalk.bgBlack(node.value) : chalk.bgRed( node.value ) ;\n\n\treturn `(${debug(node.left)}, ${repr}, ${debug(node.right)})` ;\n\n}\n" + "lineNumber": 1, + "content": "export * from './BLACK' ;\nexport * from './RED' ;\n" }, { - "__docId__": 17, + "__docId__": 24, + "kind": "file", + "static": true, + "variation": null, + "name": "src/debug/debug.js", + "memberof": null, + "longname": "src/debug/debug.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import chalk from 'chalk' ;\n\nimport { BLACK } from '..' ;\n\nexport function debug ( node ) {\n\n\tif ( node.isleaf( ) ) return chalk.bgBlack('L') ;\n\n\tconst repr = node.color === BLACK ? chalk.bgBlack(node.value) : chalk.bgRed( node.value ) ;\n\n\treturn `(${debug(node.left)}, ${repr}, ${debug(node.right)})` ;\n\n}\n" + }, + { + "__docId__": 25, "kind": "function", "static": true, "variation": null, "name": "debug", - "memberof": "src/base/debug.js", - "longname": "src/base/debug.js~debug", + "memberof": "src/debug/debug.js", + "longname": "src/debug/debug.js~debug", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/debug.js", + "importPath": "aureooms-es-red-black-tree/src/debug/debug.js", "importStyle": "{debug}", "description": null, - "lineNumber": 6, + "lineNumber": 5, "undocument": true, "params": [ { @@ -354,48 +508,49 @@ "generator": false }, { - "__docId__": 18, + "__docId__": 26, "kind": "file", "static": true, "variation": null, - "name": "src/base/find.js", + "name": "src/debug/index.js", "memberof": null, - "longname": "src/base/find.js", + "longname": "src/debug/index.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nexport function find ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" + "lineNumber": 1, + "content": "export * from './debug' ;\n" }, { - "__docId__": 19, + "__docId__": 27, + "kind": "file", + "static": true, + "variation": null, + "name": "src/family/grandparent.js", + "memberof": null, + "longname": "src/family/grandparent.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export function grandparent ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only call this function when n HAS a grandparent\n\treturn n.parent.parent;\n\n}\n" + }, + { + "__docId__": 28, "kind": "function", "static": true, "variation": null, - "name": "find", - "memberof": "src/base/find.js", - "longname": "src/base/find.js~find", + "name": "grandparent", + "memberof": "src/family/grandparent.js", + "longname": "src/family/grandparent.js~grandparent", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/find.js", - "importStyle": "{find}", + "importPath": "aureooms-es-red-black-tree/src/family/grandparent.js", + "importStyle": "{grandparent}", "description": null, - "lineNumber": 2, + "lineNumber": 1, "undocument": true, "params": [ { - "name": "compare", - "types": [ - "*" - ] - }, - { - "name": "node", - "types": [ - "*" - ] - }, - { - "name": "value", + "name": "n", "types": [ "*" ] @@ -409,45 +564,45 @@ "generator": false }, { - "__docId__": 20, + "__docId__": 29, "kind": "file", "static": true, "variation": null, - "name": "src/base/index.js", + "name": "src/family/index.js", "memberof": null, - "longname": "src/base/index.js", + "longname": "src/family/index.js", "access": null, "description": null, "lineNumber": 1, - "content": "export * from './colors' ;\nexport * from './debug' ;\nexport * from './find' ;\nexport * from './inordertraversal' ;\nexport * from './insert' ;\nexport * from './replace_node' ;\nexport * from './rotate_left' ;\nexport * from './rotate_right' ;\n" + "content": "export * from './grandparent' ;\nexport * from './predecessor' ;\nexport * from './sibling' ;\nexport * from './uncle' ;\n" }, { - "__docId__": 21, + "__docId__": 30, "kind": "file", "static": true, "variation": null, - "name": "src/base/inordertraversal.js", + "name": "src/family/predecessor.js", "memberof": null, - "longname": "src/base/inordertraversal.js", + "longname": "src/family/predecessor.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nexport function* inordertraversal ( node ) {\n\n\tif ( !node.left.isleaf() ) {\n\t\tyield *inordertraversal( node.left );\n\t}\n\n\tyield node.value ;\n\n\tif ( !node.right.isleaf() ) {\n\t\tyield* inordertraversal( node.right );\n\t}\n\n}\n" + "lineNumber": 1, + "content": "export function predecessor ( node ) {\n\n\tvar pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" }, { - "__docId__": 22, + "__docId__": 31, "kind": "function", "static": true, "variation": null, - "name": "inordertraversal", - "memberof": "src/base/inordertraversal.js", - "longname": "src/base/inordertraversal.js~inordertraversal", + "name": "predecessor", + "memberof": "src/family/predecessor.js", + "longname": "src/family/predecessor.js~predecessor", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/inordertraversal.js", - "importStyle": "{inordertraversal}", + "importPath": "aureooms-es-red-black-tree/src/family/predecessor.js", + "importStyle": "{predecessor}", "description": null, - "lineNumber": 2, + "lineNumber": 1, "undocument": true, "params": [ { @@ -457,214 +612,38 @@ ] } ], - "generator": true + "return": { + "types": [ + "*" + ] + }, + "generator": false }, { - "__docId__": 23, + "__docId__": 32, "kind": "file", "static": true, "variation": null, - "name": "src/base/insert.js", + "name": "src/family/sibling.js", "memberof": null, - "longname": "src/base/insert.js", + "longname": "src/family/sibling.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nexport function insert ( compare, A, B ) {\n\n\twhile ( true ) {\n\n\t\tif ( compare( B.value, A.value ) < 0 ) {\n\n\t\t\tconst node = A.left;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t\telse {\n\n\t\t\tconst node = A.right;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n\n}\n" + "lineNumber": 1, + "content": "export function sibling ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only use this function when n HAS a sibling so this case can never\n\t//happen.\n\n\treturn n === n.parent.left ? n.parent.right : n.parent.left ;\n\n}\n" }, { - "__docId__": 24, + "__docId__": 33, "kind": "function", "static": true, "variation": null, - "name": "insert", - "memberof": "src/base/insert.js", - "longname": "src/base/insert.js~insert", - "access": null, - "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/insert.js", - "importStyle": "{insert}", - "description": null, - "lineNumber": 2, - "undocument": true, - "params": [ - { - "name": "compare", - "types": [ - "*" - ] - }, - { - "name": "A", - "types": [ - "*" - ] - }, - { - "name": "B", - "types": [ - "*" - ] - } - ], - "return": { - "types": [ - "*" - ] - }, - "generator": false - }, - { - "__docId__": 25, - "kind": "file", - "static": true, - "variation": null, - "name": "src/base/replace_node.js", - "memberof": null, - "longname": "src/base/replace_node.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export function replace_node ( A , B ) {\n\n\t// assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif ( A === A.parent.left ) A.parent.left = B ;\n\n\telse A.parent.right = B ;\n\n\tB.parent = A.parent ;\n\n}\n" - }, - { - "__docId__": 26, - "kind": "function", - "static": true, - "variation": null, - "name": "replace_node", - "memberof": "src/base/replace_node.js", - "longname": "src/base/replace_node.js~replace_node", - "access": null, - "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/replace_node.js", - "importStyle": "{replace_node}", - "description": null, - "lineNumber": 1, - "undocument": true, - "params": [ - { - "name": "A", - "types": [ - "*" - ] - }, - { - "name": "B", - "types": [ - "*" - ] - } - ], - "generator": false - }, - { - "__docId__": 27, - "kind": "file", - "static": true, - "variation": null, - "name": "src/base/rotate_left.js", - "memberof": null, - "longname": "src/base/rotate_left.js", - "access": null, - "description": null, - "lineNumber": 14, - "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n * @param {Node} A root of the tree\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" - }, - { - "__docId__": 28, - "kind": "function", - "static": true, - "variation": null, - "name": "rotate_left", - "memberof": "src/base/rotate_left.js", - "longname": "src/base/rotate_left.js~rotate_left", - "access": null, - "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/rotate_left.js", - "importStyle": "{rotate_left}", - "description": "Rotate tree left.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", - "lineNumber": 14, - "params": [ - { - "nullable": null, - "types": [ - "Node" - ], - "spread": false, - "optional": false, - "name": "A", - "description": "root of the tree" - } - ], - "generator": false - }, - { - "__docId__": 29, - "kind": "file", - "static": true, - "variation": null, - "name": "src/base/rotate_right.js", - "memberof": null, - "longname": "src/base/rotate_right.js", - "access": null, - "description": null, - "lineNumber": 14, - "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n * @param {Node} B root of the tree\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" - }, - { - "__docId__": 30, - "kind": "function", - "static": true, - "variation": null, - "name": "rotate_right", - "memberof": "src/base/rotate_right.js", - "longname": "src/base/rotate_right.js~rotate_right", - "access": null, - "export": true, - "importPath": "aureooms-es-red-black-tree/src/base/rotate_right.js", - "importStyle": "{rotate_right}", - "description": "Rotate tree right.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", - "lineNumber": 14, - "params": [ - { - "nullable": null, - "types": [ - "Node" - ], - "spread": false, - "optional": false, - "name": "B", - "description": "root of the tree" - } - ], - "generator": false - }, - { - "__docId__": 31, - "kind": "file", - "static": true, - "variation": null, - "name": "src/family/grandparent.js", - "memberof": null, - "longname": "src/family/grandparent.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export function grandparent ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only call this function when n HAS a grandparent\n\treturn n.parent.parent;\n\n}\n" - }, - { - "__docId__": 32, - "kind": "function", - "static": true, - "variation": null, - "name": "grandparent", - "memberof": "src/family/grandparent.js", - "longname": "src/family/grandparent.js~grandparent", + "name": "sibling", + "memberof": "src/family/sibling.js", + "longname": "src/family/sibling.js~sibling", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/family/grandparent.js", - "importStyle": "{grandparent}", + "importPath": "aureooms-es-red-black-tree/src/family/sibling.js", + "importStyle": "{sibling}", "description": null, "lineNumber": 1, "undocument": true, @@ -683,50 +662,37 @@ }, "generator": false }, - { - "__docId__": 33, - "kind": "file", - "static": true, - "variation": null, - "name": "src/family/index.js", - "memberof": null, - "longname": "src/family/index.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export * from './grandparent' ;\nexport * from './predecessor' ;\nexport * from './sibling' ;\nexport * from './uncle' ;\n" - }, { "__docId__": 34, "kind": "file", "static": true, "variation": null, - "name": "src/family/predecessor.js", + "name": "src/family/uncle.js", "memberof": null, - "longname": "src/family/predecessor.js", + "longname": "src/family/uncle.js", "access": null, "description": null, "lineNumber": 1, - "content": "export function predecessor ( node ) {\n\n\tvar pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" + "content": "import { grandparent } from './grandparent' ;\n\nexport function uncle ( n ) {\n\tconst g = grandparent( n );\n\t// assert( g !== null ) ;\n\t// this can never happen\n\tif ( n.parent === g.left )\n\t return g.right.isleaf( ) ? null : g.right ;\n\telse\n\t return g.left.isleaf( ) ? null : g.left ;\n}\n" }, { "__docId__": 35, "kind": "function", "static": true, "variation": null, - "name": "predecessor", - "memberof": "src/family/predecessor.js", - "longname": "src/family/predecessor.js~predecessor", + "name": "uncle", + "memberof": "src/family/uncle.js", + "longname": "src/family/uncle.js~uncle", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/family/predecessor.js", - "importStyle": "{predecessor}", + "importPath": "aureooms-es-red-black-tree/src/family/uncle.js", + "importStyle": "{uncle}", "description": null, - "lineNumber": 1, + "lineNumber": 3, "undocument": true, "params": [ { - "name": "node", + "name": "n", "types": [ "*" ] @@ -744,75 +710,70 @@ "kind": "file", "static": true, "variation": null, - "name": "src/family/sibling.js", + "name": "src/index.js", "memberof": null, - "longname": "src/family/sibling.js", + "longname": "src/index.js", "access": null, "description": null, "lineNumber": 1, - "content": "export function sibling ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only use this function when n HAS a sibling so this case can never\n\t//happen.\n\n\treturn n === n.parent.left ? n.parent.right : n.parent.left ;\n\n}\n" + "content": "export * from './adt' ;\nexport * from './color' ;\nexport * from './debug' ;\nexport * from './family' ;\nexport * from './insertion' ;\nexport * from './removal' ;\nexport * from './rotate' ;\nexport * from './search' ;\nexport * from './traversal' ;\n" }, { "__docId__": 37, - "kind": "function", + "kind": "file", "static": true, "variation": null, - "name": "sibling", - "memberof": "src/family/sibling.js", - "longname": "src/family/sibling.js~sibling", + "name": "src/insertion/index.js", + "memberof": null, + "longname": "src/insertion/index.js", "access": null, - "export": true, - "importPath": "aureooms-es-red-black-tree/src/family/sibling.js", - "importStyle": "{sibling}", "description": null, "lineNumber": 1, - "undocument": true, - "params": [ - { - "name": "n", - "types": [ - "*" - ] - } - ], - "return": { - "types": [ - "*" - ] - }, - "generator": false + "content": "export * from './insert' ;\nexport * from './insert_case1' ;\nexport * from './insert_case2' ;\nexport * from './insert_case3' ;\nexport * from './insert_case4' ;\nexport * from './insert_case5' ;\n" }, { "__docId__": 38, "kind": "file", "static": true, "variation": null, - "name": "src/family/uncle.js", + "name": "src/insertion/insert.js", "memberof": null, - "longname": "src/family/uncle.js", + "longname": "src/insertion/insert.js", "access": null, "description": null, - "lineNumber": 1, - "content": "import { grandparent } from './grandparent' ;\n\nexport function uncle ( n ) {\n\tconst g = grandparent( n );\n\t// assert( g !== null ) ;\n\t// this can never happen\n\tif ( n.parent === g.left )\n\t return g.right.isleaf( ) ? null : g.right ;\n\telse\n\t return g.left.isleaf( ) ? null : g.left ;\n}\n" + "lineNumber": 2, + "content": "\nexport function insert ( compare, A, B ) {\n\n\twhile ( true ) {\n\n\t\tif ( compare( B.value, A.value ) < 0 ) {\n\n\t\t\tconst node = A.left;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t\telse {\n\n\t\t\tconst node = A.right;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n\n}\n" }, { "__docId__": 39, "kind": "function", "static": true, "variation": null, - "name": "uncle", - "memberof": "src/family/uncle.js", - "longname": "src/family/uncle.js~uncle", + "name": "insert", + "memberof": "src/insertion/insert.js", + "longname": "src/insertion/insert.js~insert", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/family/uncle.js", - "importStyle": "{uncle}", + "importPath": "aureooms-es-red-black-tree/src/insertion/insert.js", + "importStyle": "{insert}", "description": null, - "lineNumber": 3, + "lineNumber": 2, "undocument": true, "params": [ { - "name": "n", + "name": "compare", + "types": [ + "*" + ] + }, + { + "name": "A", + "types": [ + "*" + ] + }, + { + "name": "B", "types": [ "*" ] @@ -830,32 +791,6 @@ "kind": "file", "static": true, "variation": null, - "name": "src/index.js", - "memberof": null, - "longname": "src/index.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export * from './adt' ;\nexport * from './base' ;\nexport * from './family' ;\nexport * from './insertion' ;\nexport * from './node' ;\nexport * from './removal' ;\n" - }, - { - "__docId__": 41, - "kind": "file", - "static": true, - "variation": null, - "name": "src/insertion/index.js", - "memberof": null, - "longname": "src/insertion/index.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export * from './insert_case1' ;\nexport * from './insert_case2' ;\nexport * from './insert_case3' ;\nexport * from './insert_case4' ;\nexport * from './insert_case5' ;\n" - }, - { - "__docId__": 42, - "kind": "file", - "static": true, - "variation": null, "name": "src/insertion/insert_case1.js", "memberof": null, "longname": "src/insertion/insert_case1.js", @@ -865,7 +800,7 @@ "content": "\nimport { BLACK } from '..' ;\nimport { insert_case2 } from './insert_case2' ;\n\nexport function insert_case1(n)\n{\n if (n.parent === null)\n n.color = BLACK;\n else\n insert_case2(n);\n}\n" }, { - "__docId__": 43, + "__docId__": 41, "kind": "function", "static": true, "variation": null, @@ -890,7 +825,7 @@ "generator": false }, { - "__docId__": 44, + "__docId__": 42, "kind": "file", "static": true, "variation": null, @@ -903,7 +838,7 @@ "content": "\nimport { BLACK } from '..' ;\nimport { insert_case3 } from './insert_case3' ;\n\nexport function insert_case2(n)\n{\n if (n.parent.color === BLACK)\n return; /* Tree is still valid */\n else\n insert_case3(n);\n}\n" }, { - "__docId__": 45, + "__docId__": 43, "kind": "function", "static": true, "variation": null, @@ -928,7 +863,7 @@ "generator": false }, { - "__docId__": 46, + "__docId__": 44, "kind": "file", "static": true, "variation": null, @@ -941,7 +876,7 @@ "content": "import { BLACK , RED , uncle , grandparent } from '..' ;\nimport { insert_case1 } from './insert_case1' ;\nimport { insert_case4 } from './insert_case4' ;\n\nexport function insert_case3(n)\n{\n const u = uncle(n);\n\n if ((u !== null) && (u.color === RED)) {\n n.parent.color = BLACK;\n u.color = BLACK;\n const g = grandparent(n);\n g.color = RED;\n insert_case1(g);\n } else {\n insert_case4(n);\n }\n}\n" }, { - "__docId__": 47, + "__docId__": 45, "kind": "function", "static": true, "variation": null, @@ -966,7 +901,7 @@ "generator": false }, { - "__docId__": 48, + "__docId__": 46, "kind": "file", "static": true, "variation": null, @@ -979,7 +914,7 @@ "content": "\nimport { rotate_left , rotate_right , grandparent } from '..' ;\nimport { insert_case5 } from './insert_case5' ;\n\nexport function insert_case4(n)\n{\n const g = grandparent(n);\n\n if ((n === n.parent.right) && (n.parent === g.left)) {\n rotate_left(n.parent);\n\n /*\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n */\n\n //n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\n } else if ((n === n.parent.left) && (n.parent === g.right)) {\n rotate_right(n.parent);\n\n /*\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n */\n\n //n = n.right;\n }\n insert_case5(n);\n}\n" }, { - "__docId__": 49, + "__docId__": 47, "kind": "function", "static": true, "variation": null, @@ -1004,7 +939,7 @@ "generator": false }, { - "__docId__": 50, + "__docId__": 48, "kind": "file", "static": true, "variation": null, @@ -1017,7 +952,7 @@ "content": "\nimport { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;\n\nexport function insert_case5(n)\n{\n const g = grandparent(n);\n\n n.parent.color = BLACK;\n g.color = RED;\n if (n === n.parent.left)\n rotate_right(g);\n else\n rotate_left(g);\n}\n" }, { - "__docId__": 51, + "__docId__": 49, "kind": "function", "static": true, "variation": null, @@ -1042,36 +977,36 @@ "generator": false }, { - "__docId__": 52, + "__docId__": 50, "kind": "file", "static": true, "variation": null, - "name": "src/node/Leaf.js", + "name": "src/removal/delete_case1.js", "memberof": null, - "longname": "src/node/Leaf.js", + "longname": "src/removal/delete_case1.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK } from '..' ;\n\nexport function Leaf ( parent ) {\n\tthis.color = BLACK ;\n\tthis.parent = parent ;\n}\n\nLeaf.prototype.isleaf = function ( ) { return true ; } ;\n" + "content": "import { delete_case2 } from './delete_case2' ;\n\nexport function delete_case1 ( n ) {\n\n if ( n.parent !== null ) delete_case2( n ) ;\n\n}\n" }, { - "__docId__": 53, + "__docId__": 51, "kind": "function", "static": true, "variation": null, - "name": "Leaf", - "memberof": "src/node/Leaf.js", - "longname": "src/node/Leaf.js~Leaf", + "name": "delete_case1", + "memberof": "src/removal/delete_case1.js", + "longname": "src/removal/delete_case1.js~delete_case1", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/node/Leaf.js", - "importStyle": "{Leaf}", + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case1.js", + "importStyle": "{delete_case1}", "description": null, "lineNumber": 3, "undocument": true, "params": [ { - "name": "parent", + "name": "n", "types": [ "*" ] @@ -1080,65 +1015,112 @@ "generator": false }, { - "__docId__": 54, + "__docId__": 52, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case2.js", + "memberof": null, + "longname": "src/removal/delete_case2.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\n\nexport function delete_case2(n)\n{\n const s = sibling(n);\n\n if (s.color === RED) {\n n.parent.color = RED;\n s.color = BLACK;\n if (n === n.parent.left)\n rotate_left(n.parent);\n else\n rotate_right(n.parent);\n }\n delete_case3(n);\n}\n" + }, + { + "__docId__": 53, "kind": "function", "static": true, "variation": null, - "name": "isleaf", - "memberof": "src/node/Leaf.js", - "longname": "src/node/Leaf.js~isleaf", + "name": "delete_case2", + "memberof": "src/removal/delete_case2.js", + "longname": "src/removal/delete_case2.js~delete_case2", "access": null, - "export": false, - "importPath": "aureooms-es-red-black-tree/src/node/Leaf.js", - "importStyle": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case2.js", + "importStyle": "{delete_case2}", "description": null, - "lineNumber": 8, + "lineNumber": 5, "undocument": true, - "params": [], - "return": { - "types": [ - "boolean" - ] - }, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], "generator": false }, { - "__docId__": 55, + "__docId__": 54, "kind": "file", "static": true, "variation": null, - "name": "src/node/Node.js", + "name": "src/removal/delete_case3.js", "memberof": null, - "longname": "src/node/Node.js", + "longname": "src/removal/delete_case3.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { Leaf } from './Leaf' ;\n\nexport function Node ( color , value ) {\n\tthis.color = color ;\n\tthis.left = new Leaf( this ) ;\n\tthis.right = new Leaf( this ) ;\n\tthis.parent = null ;\n\tthis.value = value ;\n}\n\nNode.prototype.isleaf = function ( ) { return false ; } ;\n" + "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\nexport function delete_case3(n)\n{\n const s = sibling(n);\n //console.log(n.color, n.parent.color, s.color , s.isleaf());\n\n if ((n.parent.color === BLACK) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n delete_case1(n.parent);\n }\n\n else\n delete_case4(n);\n}\n" }, { - "__docId__": 56, + "__docId__": 55, "kind": "function", "static": true, "variation": null, - "name": "Node", - "memberof": "src/node/Node.js", - "longname": "src/node/Node.js~Node", + "name": "delete_case3", + "memberof": "src/removal/delete_case3.js", + "longname": "src/removal/delete_case3.js~delete_case3", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/node/Node.js", - "importStyle": "{Node}", + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case3.js", + "importStyle": "{delete_case3}", "description": null, - "lineNumber": 3, + "lineNumber": 6, "undocument": true, "params": [ { - "name": "color", + "name": "n", "types": [ "*" ] - }, + } + ], + "generator": false + }, + { + "__docId__": 56, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case4.js", + "memberof": null, + "longname": "src/removal/delete_case4.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\nexport function delete_case4(n)\n{\n const s = sibling(n);\n //console.log( s ) ;\n\n if ((n.parent.color === RED) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n n.parent.color = BLACK;\n } else\n delete_case5(n);\n}\n" + }, + { + "__docId__": 57, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_case4", + "memberof": "src/removal/delete_case4.js", + "longname": "src/removal/delete_case4.js~delete_case4", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case4.js", + "importStyle": "{delete_case4}", + "description": null, + "lineNumber": 5, + "undocument": true, + "params": [ { - "name": "value", + "name": "n", "types": [ "*" ] @@ -1147,66 +1129,106 @@ "generator": false }, { - "__docId__": 57, + "__docId__": 58, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/delete_case5.js", + "memberof": null, + "longname": "src/removal/delete_case5.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nimport { delete_case6 } from './delete_case6' ;\n\nexport function delete_case5(n)\n{\n const s = sibling(n);\n\n if (s.color === BLACK) { /* this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). */\n/* the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. */\n if ((n === n.parent.left) &&\n (s.right.color === BLACK) &&\n (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.left.color = BLACK;\n rotate_right(s);\n } else if ((n === n.parent.right) &&\n (s.left.color === BLACK) &&\n (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.right.color = BLACK;\n rotate_left(s);\n }\n }\n delete_case6(n);\n}\n" + }, + { + "__docId__": 59, "kind": "function", "static": true, "variation": null, - "name": "isleaf", - "memberof": "src/node/Node.js", - "longname": "src/node/Node.js~isleaf", + "name": "delete_case5", + "memberof": "src/removal/delete_case5.js", + "longname": "src/removal/delete_case5.js~delete_case5", "access": null, - "export": false, - "importPath": "aureooms-es-red-black-tree/src/node/Node.js", - "importStyle": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case5.js", + "importStyle": "{delete_case5}", "description": null, - "lineNumber": 11, + "lineNumber": 5, "undocument": true, - "params": [], - "return": { - "types": [ - "boolean" - ] - }, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], "generator": false }, { - "__docId__": 58, + "__docId__": 60, "kind": "file", "static": true, "variation": null, - "name": "src/node/index.js", + "name": "src/removal/delete_case6.js", "memberof": null, - "longname": "src/node/index.js", + "longname": "src/removal/delete_case6.js", "access": null, "description": null, "lineNumber": 1, - "content": "export * from './Leaf' ;\nexport * from './Node' ;\n" + "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nexport function delete_case6(n)\n{\n const s = sibling(n);\n\n s.color = n.parent.color;\n n.parent.color = BLACK;\n\n if (n === n.parent.left) {\n s.right.color = BLACK;\n rotate_left(n.parent);\n } else {\n s.left.color = BLACK;\n rotate_right(n.parent);\n }\n}\n" }, { - "__docId__": 59, + "__docId__": 61, + "kind": "function", + "static": true, + "variation": null, + "name": "delete_case6", + "memberof": "src/removal/delete_case6.js", + "longname": "src/removal/delete_case6.js~delete_case6", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/removal/delete_case6.js", + "importStyle": "{delete_case6}", + "description": null, + "lineNumber": 3, + "undocument": true, + "params": [ + { + "name": "n", + "types": [ + "*" + ] + } + ], + "generator": false + }, + { + "__docId__": 62, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case1.js", + "name": "src/removal/delete_one_child.js", "memberof": null, - "longname": "src/removal/delete_case1.js", + "longname": "src/removal/delete_one_child.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { delete_case2 } from './delete_case2' ;\n\nimport assert from 'assert' ;\n\nexport function delete_case1(n)\n{\n if (n.parent !== null)\n delete_case2(n);\n}\n" + "lineNumber": 1, + "content": "import { BLACK , RED } from '..' ;\n\nimport { replace_node } from './replace_node' ;\nimport { delete_case1 } from './delete_case1' ;\n\nexport function delete_one_child ( n ) {\n\n // Precondition: n has at most one non-leaf child.\n // assert( n.right.isleaf() || n.left.isleaf());\n\n // const child = n.right.isleaf() ? n.left : n.right;\n // n.right is always a LEAF because either n is a subtree predecessor or it\n // is the only child of its parent by the red-black tree properties\n const child = n.left ;\n\n replace_node(n, child);\n\n if (n.color === BLACK) {\n if (child.color === RED) child.color = BLACK;\n else delete_case1(child);\n }\n\n //else {\n // If n is RED then its child can only be BLACK. Replacing n with its\n // child suffices.\n //}\n\n}\n" }, { - "__docId__": 60, + "__docId__": 63, "kind": "function", "static": true, "variation": null, - "name": "delete_case1", - "memberof": "src/removal/delete_case1.js", - "longname": "src/removal/delete_case1.js~delete_case1", + "name": "delete_one_child", + "memberof": "src/removal/delete_one_child.js", + "longname": "src/removal/delete_one_child.js~delete_one_child", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case1.js", - "importStyle": "{delete_case1}", + "importPath": "aureooms-es-red-black-tree/src/removal/delete_one_child.js", + "importStyle": "{delete_one_child}", "description": null, "lineNumber": 6, "undocument": true, @@ -1221,36 +1243,55 @@ "generator": false }, { - "__docId__": 61, + "__docId__": 64, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case2.js", + "name": "src/removal/index.js", "memberof": null, - "longname": "src/removal/delete_case2.js", + "longname": "src/removal/index.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\n\nexport function delete_case2(n)\n{\n const s = sibling(n);\n\n if (s.color === RED) {\n n.parent.color = RED;\n s.color = BLACK;\n if (n === n.parent.left)\n rotate_left(n.parent);\n else\n rotate_right(n.parent);\n }\n delete_case3(n);\n}\n" + "content": "export * from './delete_case1' ;\nexport * from './delete_case2' ;\nexport * from './delete_case3' ;\nexport * from './delete_case4' ;\nexport * from './delete_case5' ;\nexport * from './delete_case6' ;\nexport * from './delete_one_child' ;\nexport * from './replace_node' ;\n" }, { - "__docId__": 62, + "__docId__": 65, + "kind": "file", + "static": true, + "variation": null, + "name": "src/removal/replace_node.js", + "memberof": null, + "longname": "src/removal/replace_node.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export function replace_node ( A , B ) {\n\n\t// assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif ( A === A.parent.left ) A.parent.left = B ;\n\n\telse A.parent.right = B ;\n\n\tB.parent = A.parent ;\n\n}\n" + }, + { + "__docId__": 66, "kind": "function", "static": true, "variation": null, - "name": "delete_case2", - "memberof": "src/removal/delete_case2.js", - "longname": "src/removal/delete_case2.js~delete_case2", + "name": "replace_node", + "memberof": "src/removal/replace_node.js", + "longname": "src/removal/replace_node.js~replace_node", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case2.js", - "importStyle": "{delete_case2}", + "importPath": "aureooms-es-red-black-tree/src/removal/replace_node.js", + "importStyle": "{replace_node}", "description": null, - "lineNumber": 5, + "lineNumber": 1, "undocument": true, "params": [ { - "name": "n", + "name": "A", + "types": [ + "*" + ] + }, + { + "name": "B", "types": [ "*" ] @@ -1259,210 +1300,221 @@ "generator": false }, { - "__docId__": 63, + "__docId__": 67, + "kind": "file", + "static": true, + "variation": null, + "name": "src/rotate/index.js", + "memberof": null, + "longname": "src/rotate/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './rotate_left' ;\nexport * from './rotate_right' ;\n" + }, + { + "__docId__": 68, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case3.js", + "name": "src/rotate/rotate_left.js", "memberof": null, - "longname": "src/removal/delete_case3.js", + "longname": "src/rotate/rotate_left.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\nexport function delete_case3(n)\n{\n const s = sibling(n);\n //console.log(n.color, n.parent.color, s.color , s.isleaf());\n\n if ((n.parent.color === BLACK) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n delete_case1(n.parent);\n }\n\n else\n delete_case4(n);\n}\n" + "lineNumber": 16, + "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" }, { - "__docId__": 64, + "__docId__": 69, "kind": "function", "static": true, "variation": null, - "name": "delete_case3", - "memberof": "src/removal/delete_case3.js", - "longname": "src/removal/delete_case3.js~delete_case3", + "name": "rotate_left", + "memberof": "src/rotate/rotate_left.js", + "longname": "src/rotate/rotate_left.js~rotate_left", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case3.js", - "importStyle": "{delete_case3}", - "description": null, - "lineNumber": 7, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/rotate/rotate_left.js", + "importStyle": "{rotate_left}", + "description": "Rotate tree left.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", + "lineNumber": 16, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "A", + "description": "root of the tree" } ], "generator": false }, { - "__docId__": 65, + "__docId__": 70, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case4.js", + "name": "src/rotate/rotate_right.js", "memberof": null, - "longname": "src/removal/delete_case4.js", + "longname": "src/rotate/rotate_right.js", "access": null, "description": null, - "lineNumber": 1, - "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\nexport function delete_case4(n)\n{\n const s = sibling(n);\n //console.log( s ) ;\n\n if ((n.parent.color === RED) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n n.parent.color = BLACK;\n } else\n delete_case5(n);\n}\n" + "lineNumber": 16, + "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" }, { - "__docId__": 66, + "__docId__": 71, "kind": "function", "static": true, "variation": null, - "name": "delete_case4", - "memberof": "src/removal/delete_case4.js", - "longname": "src/removal/delete_case4.js~delete_case4", + "name": "rotate_right", + "memberof": "src/rotate/rotate_right.js", + "longname": "src/rotate/rotate_right.js~rotate_right", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case4.js", - "importStyle": "{delete_case4}", - "description": null, - "lineNumber": 5, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/rotate/rotate_right.js", + "importStyle": "{rotate_right}", + "description": "Rotate tree right.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", + "lineNumber": 16, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "B", + "description": "root of the tree" } ], "generator": false }, { - "__docId__": 67, + "__docId__": 72, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case5.js", + "name": "src/search/find.js", "memberof": null, - "longname": "src/removal/delete_case5.js", + "longname": "src/search/find.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nimport { delete_case6 } from './delete_case6' ;\n\nexport function delete_case5(n)\n{\n const s = sibling(n);\n\n if (s.color === BLACK) { /* this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). */\n/* the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. */\n if ((n === n.parent.left) &&\n (s.right.color === BLACK) &&\n (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.left.color = BLACK;\n rotate_right(s);\n } else if ((n === n.parent.right) &&\n (s.left.color === BLACK) &&\n (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.right.color = BLACK;\n rotate_left(s);\n }\n }\n delete_case6(n);\n}\n" + "lineNumber": 1, + "content": "export function find ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" }, { - "__docId__": 68, + "__docId__": 73, "kind": "function", "static": true, "variation": null, - "name": "delete_case5", - "memberof": "src/removal/delete_case5.js", - "longname": "src/removal/delete_case5.js~delete_case5", + "name": "find", + "memberof": "src/search/find.js", + "longname": "src/search/find.js~find", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case5.js", - "importStyle": "{delete_case5}", + "importPath": "aureooms-es-red-black-tree/src/search/find.js", + "importStyle": "{find}", "description": null, - "lineNumber": 6, + "lineNumber": 1, "undocument": true, "params": [ { - "name": "n", + "name": "compare", + "types": [ + "*" + ] + }, + { + "name": "node", + "types": [ + "*" + ] + }, + { + "name": "value", "types": [ "*" ] } ], + "return": { + "types": [ + "*" + ] + }, "generator": false }, { - "__docId__": 69, + "__docId__": 74, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case6.js", + "name": "src/search/index.js", "memberof": null, - "longname": "src/removal/delete_case6.js", + "longname": "src/search/index.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nexport function delete_case6(n)\n{\n const s = sibling(n);\n\n s.color = n.parent.color;\n n.parent.color = BLACK;\n\n if (n === n.parent.left) {\n s.right.color = BLACK;\n rotate_left(n.parent);\n } else {\n s.left.color = BLACK;\n rotate_right(n.parent);\n }\n}\n" + "lineNumber": 1, + "content": "export * from './find' ;\n" }, { - "__docId__": 70, - "kind": "function", + "__docId__": 75, + "kind": "file", "static": true, "variation": null, - "name": "delete_case6", - "memberof": "src/removal/delete_case6.js", - "longname": "src/removal/delete_case6.js~delete_case6", + "name": "src/traversal/index.js", + "memberof": null, + "longname": "src/traversal/index.js", "access": null, - "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case6.js", - "importStyle": "{delete_case6}", "description": null, - "lineNumber": 4, - "undocument": true, - "params": [ - { - "name": "n", - "types": [ - "*" - ] - } - ], - "generator": false + "lineNumber": 1, + "content": "export * from './inordertraversal' ;\n" }, { - "__docId__": 71, + "__docId__": 76, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_one_child.js", + "name": "src/traversal/inordertraversal.js", "memberof": null, - "longname": "src/removal/delete_one_child.js", + "longname": "src/traversal/inordertraversal.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { BLACK , RED , replace_node } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\n\nexport function delete_one_child ( n ) {\n\n // Precondition: n has at most one non-leaf child.\n // assert( n.right.isleaf() || n.left.isleaf());\n\n // const child = n.right.isleaf() ? n.left : n.right;\n // n.right is always a LEAF because either n is a subtree predecessor or it\n // is the only child of its parent by the red-black tree properties\n const child = n.left ;\n\n replace_node(n, child);\n\n if (n.color === BLACK) {\n if (child.color === RED) child.color = BLACK;\n else delete_case1(child);\n }\n\n //else {\n // If n is RED then its child can only be BLACK. Replacing n with its\n // child suffices.\n //}\n\n}\n" + "lineNumber": 1, + "content": "export function* inordertraversal ( node ) {\n\n\tif ( !node.left.isleaf() ) {\n\t\tyield *inordertraversal( node.left );\n\t}\n\n\tyield node.value ;\n\n\tif ( !node.right.isleaf() ) {\n\t\tyield* inordertraversal( node.right );\n\t}\n\n}\n" }, { - "__docId__": 72, + "__docId__": 77, "kind": "function", "static": true, "variation": null, - "name": "delete_one_child", - "memberof": "src/removal/delete_one_child.js", - "longname": "src/removal/delete_one_child.js~delete_one_child", + "name": "inordertraversal", + "memberof": "src/traversal/inordertraversal.js", + "longname": "src/traversal/inordertraversal.js~inordertraversal", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_one_child.js", - "importStyle": "{delete_one_child}", + "importPath": "aureooms-es-red-black-tree/src/traversal/inordertraversal.js", + "importStyle": "{inordertraversal}", "description": null, - "lineNumber": 6, + "lineNumber": 1, "undocument": true, "params": [ { - "name": "n", + "name": "node", "types": [ "*" ] } ], - "generator": false - }, - { - "__docId__": 73, - "kind": "file", - "static": true, - "variation": null, - "name": "src/removal/index.js", - "memberof": null, - "longname": "src/removal/index.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export * from './delete_case1' ;\nexport * from './delete_case2' ;\nexport * from './delete_case3' ;\nexport * from './delete_case4' ;\nexport * from './delete_case5' ;\nexport * from './delete_case6' ;\nexport * from './delete_one_child' ;\n" + "generator": true }, { - "__docId__": 75, + "__docId__": 79, "kind": "external", "static": true, "variation": null, @@ -1475,7 +1527,7 @@ "builtinExternal": true }, { - "__docId__": 76, + "__docId__": 80, "kind": "external", "static": true, "variation": null, @@ -1488,7 +1540,7 @@ "builtinExternal": true }, { - "__docId__": 77, + "__docId__": 81, "kind": "external", "static": true, "variation": null, @@ -1501,7 +1553,7 @@ "builtinExternal": true }, { - "__docId__": 78, + "__docId__": 82, "kind": "external", "static": true, "variation": null, @@ -1514,7 +1566,7 @@ "builtinExternal": true }, { - "__docId__": 79, + "__docId__": 83, "kind": "external", "static": true, "variation": null, @@ -1527,7 +1579,7 @@ "builtinExternal": true }, { - "__docId__": 80, + "__docId__": 84, "kind": "external", "static": true, "variation": null, @@ -1540,7 +1592,7 @@ "builtinExternal": true }, { - "__docId__": 81, + "__docId__": 85, "kind": "external", "static": true, "variation": null, @@ -1553,7 +1605,7 @@ "builtinExternal": true }, { - "__docId__": 82, + "__docId__": 86, "kind": "external", "static": true, "variation": null, @@ -1566,7 +1618,7 @@ "builtinExternal": true }, { - "__docId__": 83, + "__docId__": 87, "kind": "external", "static": true, "variation": null, @@ -1579,7 +1631,7 @@ "builtinExternal": true }, { - "__docId__": 84, + "__docId__": 88, "kind": "external", "static": true, "variation": null, @@ -1592,7 +1644,7 @@ "builtinExternal": true }, { - "__docId__": 85, + "__docId__": 89, "kind": "external", "static": true, "variation": null, @@ -1605,7 +1657,7 @@ "builtinExternal": true }, { - "__docId__": 86, + "__docId__": 90, "kind": "external", "static": true, "variation": null, @@ -1618,7 +1670,7 @@ "builtinExternal": true }, { - "__docId__": 87, + "__docId__": 91, "kind": "external", "static": true, "variation": null, @@ -1631,7 +1683,7 @@ "builtinExternal": true }, { - "__docId__": 88, + "__docId__": 92, "kind": "external", "static": true, "variation": null, @@ -1644,7 +1696,7 @@ "builtinExternal": true }, { - "__docId__": 89, + "__docId__": 93, "kind": "external", "static": true, "variation": null, @@ -1657,7 +1709,7 @@ "builtinExternal": true }, { - "__docId__": 90, + "__docId__": 94, "kind": "external", "static": true, "variation": null, @@ -1670,7 +1722,7 @@ "builtinExternal": true }, { - "__docId__": 91, + "__docId__": 95, "kind": "external", "static": true, "variation": null, @@ -1683,7 +1735,7 @@ "builtinExternal": true }, { - "__docId__": 92, + "__docId__": 96, "kind": "external", "static": true, "variation": null, @@ -1696,7 +1748,7 @@ "builtinExternal": true }, { - "__docId__": 93, + "__docId__": 97, "kind": "external", "static": true, "variation": null, @@ -1709,7 +1761,7 @@ "builtinExternal": true }, { - "__docId__": 94, + "__docId__": 98, "kind": "external", "static": true, "variation": null, @@ -1722,7 +1774,7 @@ "builtinExternal": true }, { - "__docId__": 95, + "__docId__": 99, "kind": "external", "static": true, "variation": null, @@ -1735,7 +1787,7 @@ "builtinExternal": true }, { - "__docId__": 96, + "__docId__": 100, "kind": "external", "static": true, "variation": null, @@ -1748,7 +1800,7 @@ "builtinExternal": true }, { - "__docId__": 97, + "__docId__": 101, "kind": "external", "static": true, "variation": null, @@ -1761,7 +1813,7 @@ "builtinExternal": true }, { - "__docId__": 98, + "__docId__": 102, "kind": "external", "static": true, "variation": null, @@ -1774,7 +1826,7 @@ "builtinExternal": true }, { - "__docId__": 99, + "__docId__": 103, "kind": "external", "static": true, "variation": null, @@ -1787,7 +1839,7 @@ "builtinExternal": true }, { - "__docId__": 100, + "__docId__": 104, "kind": "external", "static": true, "variation": null, @@ -1800,7 +1852,7 @@ "builtinExternal": true }, { - "__docId__": 101, + "__docId__": 105, "kind": "external", "static": true, "variation": null, @@ -1813,7 +1865,7 @@ "builtinExternal": true }, { - "__docId__": 102, + "__docId__": 106, "kind": "external", "static": true, "variation": null, @@ -1826,7 +1878,7 @@ "builtinExternal": true }, { - "__docId__": 103, + "__docId__": 107, "kind": "external", "static": true, "variation": null, @@ -1839,7 +1891,7 @@ "builtinExternal": true }, { - "__docId__": 104, + "__docId__": 108, "kind": "external", "static": true, "variation": null, @@ -1852,7 +1904,7 @@ "builtinExternal": true }, { - "__docId__": 105, + "__docId__": 109, "kind": "external", "static": true, "variation": null, @@ -1865,7 +1917,7 @@ "builtinExternal": true }, { - "__docId__": 106, + "__docId__": 110, "kind": "external", "static": true, "variation": null, @@ -1878,7 +1930,7 @@ "builtinExternal": true }, { - "__docId__": 107, + "__docId__": 111, "kind": "external", "static": true, "variation": null, @@ -1891,7 +1943,7 @@ "builtinExternal": true }, { - "__docId__": 108, + "__docId__": 112, "kind": "external", "static": true, "variation": null, @@ -1904,7 +1956,7 @@ "builtinExternal": true }, { - "__docId__": 109, + "__docId__": 113, "kind": "external", "static": true, "variation": null, @@ -1917,7 +1969,7 @@ "builtinExternal": true }, { - "__docId__": 110, + "__docId__": 114, "kind": "external", "static": true, "variation": null, @@ -1930,7 +1982,7 @@ "builtinExternal": true }, { - "__docId__": 111, + "__docId__": 115, "kind": "external", "static": true, "variation": null, @@ -1943,7 +1995,7 @@ "builtinExternal": true }, { - "__docId__": 112, + "__docId__": 116, "kind": "external", "static": true, "variation": null, @@ -1956,7 +2008,7 @@ "builtinExternal": true }, { - "__docId__": 113, + "__docId__": 117, "kind": "external", "static": true, "variation": null, @@ -1969,7 +2021,7 @@ "builtinExternal": true }, { - "__docId__": 114, + "__docId__": 118, "kind": "external", "static": true, "variation": null, @@ -1982,7 +2034,7 @@ "builtinExternal": true }, { - "__docId__": 115, + "__docId__": 119, "kind": "external", "static": true, "variation": null, @@ -1995,7 +2047,7 @@ "builtinExternal": true }, { - "__docId__": 116, + "__docId__": 120, "kind": "external", "static": true, "variation": null, @@ -2008,7 +2060,7 @@ "builtinExternal": true }, { - "__docId__": 117, + "__docId__": 121, "kind": "external", "static": true, "variation": null, @@ -2021,7 +2073,7 @@ "builtinExternal": true }, { - "__docId__": 118, + "__docId__": 122, "kind": "external", "static": true, "variation": null, @@ -2034,7 +2086,7 @@ "builtinExternal": true }, { - "__docId__": 119, + "__docId__": 123, "kind": "external", "static": true, "variation": null, @@ -2047,7 +2099,7 @@ "builtinExternal": true }, { - "__docId__": 120, + "__docId__": 124, "kind": "external", "static": true, "variation": null, @@ -2060,7 +2112,7 @@ "builtinExternal": true }, { - "__docId__": 121, + "__docId__": 125, "kind": "external", "static": true, "variation": null, @@ -2073,7 +2125,7 @@ "builtinExternal": true }, { - "__docId__": 123, + "__docId__": 127, "kind": "external", "static": true, "variation": null, @@ -2086,7 +2138,7 @@ "builtinExternal": true }, { - "__docId__": 124, + "__docId__": 128, "kind": "external", "static": true, "variation": null, @@ -2099,7 +2151,7 @@ "builtinExternal": true }, { - "__docId__": 125, + "__docId__": 129, "kind": "external", "static": true, "variation": null, @@ -2112,7 +2164,7 @@ "builtinExternal": true }, { - "__docId__": 126, + "__docId__": 130, "kind": "external", "static": true, "variation": null, @@ -2125,7 +2177,7 @@ "builtinExternal": true }, { - "__docId__": 127, + "__docId__": 131, "kind": "external", "static": true, "variation": null, @@ -2138,7 +2190,7 @@ "builtinExternal": true }, { - "__docId__": 128, + "__docId__": 132, "kind": "external", "static": true, "variation": null, @@ -2151,7 +2203,7 @@ "builtinExternal": true }, { - "__docId__": 129, + "__docId__": 133, "kind": "external", "static": true, "variation": null, @@ -2164,7 +2216,7 @@ "builtinExternal": true }, { - "__docId__": 130, + "__docId__": 134, "kind": "external", "static": true, "variation": null, diff --git a/file/src/node/Leaf.js.html b/file/src/adt/Leaf.js.html similarity index 82% rename from file/src/node/Leaf.js.html rename to file/src/adt/Leaf.js.html index 8e57cc9..7166c5c 100644 --- a/file/src/node/Leaf.js.html +++ b/file/src/adt/Leaf.js.html @@ -3,7 +3,7 @@ - src/node/Leaf.js | aureooms/es-red-black-tree API Document + src/adt/Leaf.js | aureooms/es-red-black-tree API Document @@ -35,26 +35,21 @@
                                            -

                                            src/node/Leaf.js

                                            +

                                            src/adt/Leaf.js

                                            import { BLACK } from '..' ;
                                             
                                             export function Leaf ( parent ) {
                                            diff --git a/file/src/node/Node.js.html b/file/src/adt/Node.js.html
                                            similarity index 83%
                                            rename from file/src/node/Node.js.html
                                            rename to file/src/adt/Node.js.html
                                            index bf3a25a..510ca89 100644
                                            --- a/file/src/node/Node.js.html
                                            +++ b/file/src/adt/Node.js.html
                                            @@ -3,7 +3,7 @@
                                             
                                               
                                               
                                            -  src/node/Node.js | aureooms/es-red-black-tree API Document
                                            +  src/adt/Node.js | aureooms/es-red-black-tree API Document
                                               
                                               
                                               
                                            @@ -35,26 +35,21 @@
                                               
                                             
                                            -

                                            src/node/Node.js

                                            +

                                            src/adt/Node.js

                                            import { Leaf } from './Leaf' ;
                                             
                                             export function Node ( color , value ) {
                                            diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/adt/RedBlackTree.js.html
                                            index 7eff548..fdf2fec 100644
                                            --- a/file/src/adt/RedBlackTree.js.html
                                            +++ b/file/src/adt/RedBlackTree.js.html
                                            @@ -35,26 +35,21 @@
                                               
                                             

                                            src/adt/RedBlackTree.js

                                            
                                            -import { Node } from '..' ;
                                            +import { Node } from './Node' ;
                                             import { RED , BLACK } from '..' ;
                                             import { predecessor } from '..' ;
                                             import { insert , insert_case2 } from '..' ;
                                            diff --git a/file/src/adt/index.js.html b/file/src/adt/index.js.html
                                            index c652a62..df7be0d 100644
                                            --- a/file/src/adt/index.js.html
                                            +++ b/file/src/adt/index.js.html
                                            @@ -35,26 +35,21 @@
                                               
                                             

                                            src/adt/index.js

                                            -
                                            export * from './RedBlackTree' ;
                                            +
                                            export * from './Leaf' ;
                                            +export * from './Node' ;
                                            +export * from './RedBlackTree' ;
                                             
                                            diff --git a/file/src/base/colors.js.html b/file/src/color/BLACK.js.html similarity index 82% rename from file/src/base/colors.js.html rename to file/src/color/BLACK.js.html index b484edd..47c549b 100644 --- a/file/src/base/colors.js.html +++ b/file/src/color/BLACK.js.html @@ -3,7 +3,7 @@ - src/base/colors.js | aureooms/es-red-black-tree API Document + src/color/BLACK.js | aureooms/es-red-black-tree API Document @@ -35,26 +35,21 @@
                                            -

                                            src/base/colors.js

                                            +

                                            src/color/BLACK.js

                                            export const BLACK = 0 ;
                                            -export const RED = 1 ;
                                             
                                            diff --git a/file/src/color/RED.js.html b/file/src/color/RED.js.html new file mode 100644 index 0000000..5c56757 --- /dev/null +++ b/file/src/color/RED.js.html @@ -0,0 +1,87 @@ + + + + + + src/color/RED.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
                                            + Home + Manual + Reference + Source + Test + Repository + +
                                            + + + +

                                            src/color/RED.js

                                            +
                                            export const RED = 1 ;
                                            +
                                            + +
                                            + + + + + + + + + + + + diff --git a/file/src/color/index.js.html b/file/src/color/index.js.html new file mode 100644 index 0000000..0d77154 --- /dev/null +++ b/file/src/color/index.js.html @@ -0,0 +1,88 @@ + + + + + + src/color/index.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
                                            + Home + Manual + Reference + Source + Test + Repository + +
                                            + + + +

                                            src/color/index.js

                                            +
                                            export * from './BLACK' ;
                                            +export * from './RED' ;
                                            +
                                            + +
                                            + + + + + + + + + + + + diff --git a/file/src/base/debug.js.html b/file/src/debug/debug.js.html similarity index 81% rename from file/src/base/debug.js.html rename to file/src/debug/debug.js.html index b62814f..32b51dd 100644 --- a/file/src/base/debug.js.html +++ b/file/src/debug/debug.js.html @@ -3,7 +3,7 @@ - src/base/debug.js | aureooms/es-red-black-tree API Document + src/debug/debug.js | aureooms/es-red-black-tree API Document @@ -35,26 +35,21 @@
                                            -

                                            src/base/debug.js

                                            -
                                            
                                            -import { BLACK } from './colors' ;
                                            +

                                            src/debug/debug.js

                                            +
                                            import chalk from 'chalk' ;
                                             
                                            -import chalk from 'chalk' ;
                                            +import { BLACK } from '..' ;
                                             
                                             export function debug ( node ) {
                                             
                                            diff --git a/file/src/node/index.js.html b/file/src/debug/index.js.html
                                            similarity index 82%
                                            rename from file/src/node/index.js.html
                                            rename to file/src/debug/index.js.html
                                            index 31c813e..602e654 100644
                                            --- a/file/src/node/index.js.html
                                            +++ b/file/src/debug/index.js.html
                                            @@ -3,7 +3,7 @@
                                             
                                               
                                               
                                            -  src/node/index.js | aureooms/es-red-black-tree API Document
                                            +  src/debug/index.js | aureooms/es-red-black-tree API Document
                                               
                                               
                                               
                                            @@ -35,26 +35,21 @@
                                               
                                             
                                            -

                                            src/node/index.js

                                            -
                                            export * from './Leaf' ;
                                            -export * from './Node' ;
                                            +

                                            src/debug/index.js

                                            +
                                            export * from './debug' ;
                                             
                                            diff --git a/file/src/family/grandparent.js.html b/file/src/family/grandparent.js.html index abdcc35..27398bf 100644 --- a/file/src/family/grandparent.js.html +++ b/file/src/family/grandparent.js.html @@ -35,26 +35,21 @@
                                            diff --git a/file/src/family/index.js.html b/file/src/family/index.js.html index 9e31362..c6ae259 100644 --- a/file/src/family/index.js.html +++ b/file/src/family/index.js.html @@ -35,26 +35,21 @@
                                            diff --git a/file/src/family/predecessor.js.html b/file/src/family/predecessor.js.html index d577a98..de31310 100644 --- a/file/src/family/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -35,26 +35,21 @@
                                            diff --git a/file/src/family/sibling.js.html b/file/src/family/sibling.js.html index 3e4d168..fe67a5f 100644 --- a/file/src/family/sibling.js.html +++ b/file/src/family/sibling.js.html @@ -35,26 +35,21 @@
                      diff --git a/file/src/family/uncle.js.html b/file/src/family/uncle.js.html index 879de63..28f78f2 100644 --- a/file/src/family/uncle.js.html +++ b/file/src/family/uncle.js.html @@ -35,26 +35,21 @@
                    diff --git a/file/src/index.js.html b/file/src/index.js.html index cb82c6c..32730f2 100644 --- a/file/src/index.js.html +++ b/file/src/index.js.html @@ -35,26 +35,21 @@

                    src/index.js

                    export * from './adt' ;
                    -export * from './base' ;
                    +export * from './color' ;
                    +export * from './debug' ;
                     export * from './family' ;
                     export * from './insertion' ;
                    -export * from './node' ;
                     export * from './removal' ;
                    +export * from './rotate' ;
                    +export * from './search' ;
                    +export * from './traversal' ;
                     
                    diff --git a/file/src/insertion/index.js.html b/file/src/insertion/index.js.html index 72a7533..3ea00a1 100644 --- a/file/src/insertion/index.js.html +++ b/file/src/insertion/index.js.html @@ -35,26 +35,21 @@

                    src/insertion/index.js

                    -
                    export * from './insert_case1' ;
                    +
                    export * from './insert' ;
                    +export * from './insert_case1' ;
                     export * from './insert_case2' ;
                     export * from './insert_case3' ;
                     export * from './insert_case4' ;
                    diff --git a/file/src/base/insert.js.html b/file/src/insertion/insert.js.html
                    similarity index 83%
                    rename from file/src/base/insert.js.html
                    rename to file/src/insertion/insert.js.html
                    index f5ddfa5..48f32ca 100644
                    --- a/file/src/base/insert.js.html
                    +++ b/file/src/insertion/insert.js.html
                    @@ -3,7 +3,7 @@
                     
                       
                       
                    -  src/base/insert.js | aureooms/es-red-black-tree API Document
                    +  src/insertion/insert.js | aureooms/es-red-black-tree API Document
                       
                       
                       
                    @@ -35,26 +35,21 @@
                       
                     
                    -

                    src/base/insert.js

                    +

                    src/insertion/insert.js

                    
                     export function insert ( compare, A, B ) {
                     
                    diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html
                    index 06d7bb3..d44a9d4 100644
                    --- a/file/src/insertion/insert_case1.js.html
                    +++ b/file/src/insertion/insert_case1.js.html
                    @@ -35,26 +35,21 @@
                       
                     
                    diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index b26e22a..141e7dc 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -35,26 +35,21 @@
                    diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index c28d9f7..29fc09c 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -35,26 +35,21 @@
                    diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index 69a5331..17757c3 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -35,26 +35,21 @@
                    diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case5.js.html index 35ab9ff..47509c2 100644 --- a/file/src/insertion/insert_case5.js.html +++ b/file/src/insertion/insert_case5.js.html @@ -35,26 +35,21 @@
    diff --git a/file/src/removal/delete_case1.js.html b/file/src/removal/delete_case1.js.html index df79d0c..8cf4b17 100644 --- a/file/src/removal/delete_case1.js.html +++ b/file/src/removal/delete_case1.js.html @@ -35,26 +35,21 @@

    src/removal/delete_case1.js

    -
    
    -import { delete_case2 } from './delete_case2' ;
    +
    import { delete_case2 } from './delete_case2' ;
    +
    +export function delete_case1 ( n ) {
     
    -import assert from 'assert' ;
    +    if ( n.parent !== null ) delete_case2( n ) ;
     
    -export function delete_case1(n)
    -{
    - if (n.parent !== null)
    -  delete_case2(n);
     }
     
    diff --git a/file/src/removal/delete_case2.js.html b/file/src/removal/delete_case2.js.html index a0a3b33..027fd59 100644 --- a/file/src/removal/delete_case2.js.html +++ b/file/src/removal/delete_case2.js.html @@ -35,26 +35,21 @@
    diff --git a/file/src/removal/delete_case3.js.html b/file/src/removal/delete_case3.js.html index b75a2bd..e4bc7d4 100644 --- a/file/src/removal/delete_case3.js.html +++ b/file/src/removal/delete_case3.js.html @@ -35,26 +35,21 @@

    src/removal/delete_case3.js

    -
    
    -import { BLACK , RED , sibling } from '..' ;
    +
    import { BLACK , RED , sibling } from '..' ;
     
     import { delete_case1 } from './delete_case1' ;
     import { delete_case4 } from './delete_case4' ;
    diff --git a/file/src/removal/delete_case4.js.html b/file/src/removal/delete_case4.js.html
    index 98212d2..a077f09 100644
    --- a/file/src/removal/delete_case4.js.html
    +++ b/file/src/removal/delete_case4.js.html
    @@ -35,26 +35,21 @@
       
     
    diff --git a/file/src/removal/delete_case5.js.html b/file/src/removal/delete_case5.js.html index f5a7437..959aa04 100644 --- a/file/src/removal/delete_case5.js.html +++ b/file/src/removal/delete_case5.js.html @@ -35,26 +35,21 @@

    src/removal/delete_case5.js

    -
    
    -import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;
    +
    import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;
     
     import { delete_case6 } from './delete_case6' ;
     
    diff --git a/file/src/removal/delete_case6.js.html b/file/src/removal/delete_case6.js.html
    index 5d8088f..e1828b0 100644
    --- a/file/src/removal/delete_case6.js.html
    +++ b/file/src/removal/delete_case6.js.html
    @@ -35,26 +35,21 @@
       
     

    src/removal/delete_case6.js

    -
    
    -import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;
    +
    import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;
     
     export function delete_case6(n)
     {
    diff --git a/file/src/removal/delete_one_child.js.html b/file/src/removal/delete_one_child.js.html
    index 9aed992..3cae9b4 100644
    --- a/file/src/removal/delete_one_child.js.html
    +++ b/file/src/removal/delete_one_child.js.html
    @@ -35,26 +35,21 @@
       
     

    src/removal/delete_one_child.js

    -
    
    -import { BLACK , RED , replace_node } from '..' ;
    +
    import { BLACK , RED } from '..' ;
     
    +import { replace_node } from './replace_node' ;
     import { delete_case1 } from './delete_case1' ;
     
     export function delete_one_child ( n ) {
    diff --git a/file/src/removal/index.js.html b/file/src/removal/index.js.html
    index 0cd0659..aa0ced5 100644
    --- a/file/src/removal/index.js.html
    +++ b/file/src/removal/index.js.html
    @@ -35,26 +35,21 @@
       
     
    @@ -74,6 +74,7 @@ export * from './delete_case5' ; export * from './delete_case6' ; export * from './delete_one_child' ; +export * from './replace_node' ; diff --git a/file/src/base/replace_node.js.html b/file/src/removal/replace_node.js.html similarity index 82% rename from file/src/base/replace_node.js.html rename to file/src/removal/replace_node.js.html index e13638b..3cdd16c 100644 --- a/file/src/base/replace_node.js.html +++ b/file/src/removal/replace_node.js.html @@ -3,7 +3,7 @@ - src/base/replace_node.js | aureooms/es-red-black-tree API Document + src/removal/replace_node.js | aureooms/es-red-black-tree API Document @@ -35,26 +35,21 @@ -

    src/base/replace_node.js

    +

    src/removal/replace_node.js

    export function replace_node ( A , B ) {
     
     	// assert( A.parent !== null ) ;
    diff --git a/file/src/base/index.js.html b/file/src/rotate/index.js.html
    similarity index 81%
    rename from file/src/base/index.js.html
    rename to file/src/rotate/index.js.html
    index dd269c8..6277aa4 100644
    --- a/file/src/base/index.js.html
    +++ b/file/src/rotate/index.js.html
    @@ -3,7 +3,7 @@
     
       
       
    -  src/base/index.js | aureooms/es-red-black-tree API Document
    +  src/rotate/index.js | aureooms/es-red-black-tree API Document
       
       
       
    @@ -35,26 +35,21 @@
       
     
    -

    src/base/index.js

    -
    export * from './colors' ;
    -export * from './debug' ;
    -export * from './find' ;
    -export * from './inordertraversal' ;
    -export * from './insert' ;
    -export * from './replace_node' ;
    -export * from './rotate_left' ;
    +

    src/rotate/index.js

    +
    export * from './rotate_left' ;
     export * from './rotate_right' ;
     
    diff --git a/file/src/base/rotate_left.js.html b/file/src/rotate/rotate_left.js.html similarity index 83% rename from file/src/base/rotate_left.js.html rename to file/src/rotate/rotate_left.js.html index 70c6887..e009cde 100644 --- a/file/src/base/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -3,7 +3,7 @@ - src/base/rotate_left.js | aureooms/es-red-black-tree API Document + src/rotate/rotate_left.js | aureooms/es-red-black-tree API Document @@ -35,26 +35,21 @@
    -

    src/base/rotate_left.js

    +

    src/rotate/rotate_left.js

    /**
      * Rotate tree left.
      * (see https://en.wikipedia.org/wiki/Tree_rotation)
    @@ -77,7 +77,9 @@
      *       / \          / \
      *      b   c        a   b
      *
    + *
      * @param {Node} A root of the tree
    + *
      */
     
     export function rotate_left ( A ) {
    diff --git a/file/src/base/rotate_right.js.html b/file/src/rotate/rotate_right.js.html
    similarity index 83%
    rename from file/src/base/rotate_right.js.html
    rename to file/src/rotate/rotate_right.js.html
    index db40fba..b3b358c 100644
    --- a/file/src/base/rotate_right.js.html
    +++ b/file/src/rotate/rotate_right.js.html
    @@ -3,7 +3,7 @@
     
       
       
    -  src/base/rotate_right.js | aureooms/es-red-black-tree API Document
    +  src/rotate/rotate_right.js | aureooms/es-red-black-tree API Document
       
       
       
    @@ -35,26 +35,21 @@
       
     
    -

    src/base/rotate_right.js

    +

    src/rotate/rotate_right.js

    /**
      * Rotate tree right.
      * (see https://en.wikipedia.org/wiki/Tree_rotation)
    @@ -77,7 +77,9 @@
      *   / \                  / \
      *  a   b                b   c
      *
    + *
      * @param {Node} B root of the tree
    + *
      */
     
     export function rotate_right ( B ) {
    diff --git a/file/src/base/find.js.html b/file/src/search/find.js.html
    similarity index 82%
    rename from file/src/base/find.js.html
    rename to file/src/search/find.js.html
    index 307a2fa..2fa5f10 100644
    --- a/file/src/base/find.js.html
    +++ b/file/src/search/find.js.html
    @@ -3,7 +3,7 @@
     
       
       
    -  src/base/find.js | aureooms/es-red-black-tree API Document
    +  src/search/find.js | aureooms/es-red-black-tree API Document
       
       
       
    @@ -35,26 +35,21 @@
       
     
    -

    src/base/find.js

    -
    
    -export function find ( compare, node, value ) {
    +

    src/search/find.js

    +
    export function find ( compare, node, value ) {
     
     	// scan for first node whose
     	// value equals parameter value
    diff --git a/file/src/search/index.js.html b/file/src/search/index.js.html
    new file mode 100644
    index 0000000..aa40b47
    --- /dev/null
    +++ b/file/src/search/index.js.html
    @@ -0,0 +1,87 @@
    +
    +
    +
    +  
    +  
    +  src/search/index.js | aureooms/es-red-black-tree API Document
    +  
    +  
    +  
    +  
    +  
    +  
    +
    +
    +
    +
    +
    +
    + Home + Manual + Reference + Source + Test + Repository + +
    + + + +

    src/search/index.js

    +
    export * from './find' ;
    +
    + +
    + + + + + + + + + + + + diff --git a/file/src/traversal/index.js.html b/file/src/traversal/index.js.html new file mode 100644 index 0000000..518f178 --- /dev/null +++ b/file/src/traversal/index.js.html @@ -0,0 +1,87 @@ + + + + + + src/traversal/index.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
    + Home + Manual + Reference + Source + Test + Repository + +
    + + + +

    src/traversal/index.js

    +
    export * from './inordertraversal' ;
    +
    + +
    + + + + + + + + + + + + diff --git a/file/src/base/inordertraversal.js.html b/file/src/traversal/inordertraversal.js.html similarity index 81% rename from file/src/base/inordertraversal.js.html rename to file/src/traversal/inordertraversal.js.html index 85d235a..6efb71c 100644 --- a/file/src/base/inordertraversal.js.html +++ b/file/src/traversal/inordertraversal.js.html @@ -3,7 +3,7 @@ - src/base/inordertraversal.js | aureooms/es-red-black-tree API Document + src/traversal/inordertraversal.js | aureooms/es-red-black-tree API Document @@ -35,26 +35,21 @@
    -

    src/base/inordertraversal.js

    -
    
    -export function* inordertraversal ( node ) {
    +

    src/traversal/inordertraversal.js

    +
    export function* inordertraversal ( node ) {
     
     	if ( !node.left.isleaf() ) {
     		yield *inordertraversal( node.left );
    diff --git a/function/index.html b/function/index.html
    index ee2c9c1..cd71f77 100644
    --- a/function/index.html
    +++ b/function/index.html
    @@ -35,26 +35,21 @@
       
     
    @@ -714,11 +714,11 @@

    - source + source

    - + @@ -770,11 +770,11 @@

    - source + source

    - + @@ -832,11 +832,11 @@

    - source + source

    - + @@ -898,11 +898,11 @@

    - source + source

    - + @@ -1010,11 +1010,11 @@

    - source + source

    - + @@ -1122,11 +1122,11 @@

    - source + source

    - + @@ -1178,11 +1178,11 @@

    - source + source

    - + @@ -1290,11 +1290,11 @@

    - source + source

    - + @@ -1434,11 +1434,11 @@

    - source + source

    - + @@ -1490,11 +1490,11 @@

    - source + source

    - + @@ -1914,11 +1914,11 @@

    - source + source

    - + @@ -1976,11 +1976,11 @@

    - source + source

    - +

    Rotate tree left. @@ -2040,11 +2040,11 @@

    - source + source

    - +

    Rotate tree right. diff --git a/identifiers.html b/identifiers.html index ce49b00..cbacaba 100644 --- a/identifiers.html +++ b/identifiers.html @@ -35,26 +35,21 @@

    diff --git a/index.html b/index.html index affb5b2..47daee8 100644 --- a/index.html +++ b/index.html @@ -35,26 +35,21 @@
    diff --git a/script/search_index.js b/script/search_index.js index 575f8a3..318159e 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -1,26 +1,26 @@ window.esdocSearchIndex = [ [ - "aureooms-es-red-black-tree/src/base/colors.js~black", + "aureooms-es-red-black-tree/src/color/black.js~black", "variable/index.html#static-variable-BLACK", - "BLACK aureooms-es-red-black-tree/src/base/colors.js", + "BLACK aureooms-es-red-black-tree/src/color/BLACK.js", "variable" ], [ - "aureooms-es-red-black-tree/src/node/leaf.js~leaf", + "aureooms-es-red-black-tree/src/adt/leaf.js~leaf", "function/index.html#static-function-Leaf", - "Leaf aureooms-es-red-black-tree/src/node/Leaf.js", + "Leaf aureooms-es-red-black-tree/src/adt/Leaf.js", "function" ], [ - "aureooms-es-red-black-tree/src/node/node.js~node", + "aureooms-es-red-black-tree/src/adt/node.js~node", "function/index.html#static-function-Node", - "Node aureooms-es-red-black-tree/src/node/Node.js", + "Node aureooms-es-red-black-tree/src/adt/Node.js", "function" ], [ - "aureooms-es-red-black-tree/src/base/colors.js~red", + "aureooms-es-red-black-tree/src/color/red.js~red", "variable/index.html#static-variable-RED", - "RED aureooms-es-red-black-tree/src/base/colors.js", + "RED aureooms-es-red-black-tree/src/color/RED.js", "variable" ], [ @@ -30,9 +30,9 @@ window.esdocSearchIndex = [ "class" ], [ - "aureooms-es-red-black-tree/src/base/debug.js~debug", + "aureooms-es-red-black-tree/src/debug/debug.js~debug", "function/index.html#static-function-debug", - "debug aureooms-es-red-black-tree/src/base/debug.js", + "debug aureooms-es-red-black-tree/src/debug/debug.js", "function" ], [ @@ -78,9 +78,9 @@ window.esdocSearchIndex = [ "function" ], [ - "aureooms-es-red-black-tree/src/base/find.js~find", + "aureooms-es-red-black-tree/src/search/find.js~find", "function/index.html#static-function-find", - "find aureooms-es-red-black-tree/src/base/find.js", + "find aureooms-es-red-black-tree/src/search/find.js", "function" ], [ @@ -90,15 +90,15 @@ window.esdocSearchIndex = [ "function" ], [ - "aureooms-es-red-black-tree/src/base/inordertraversal.js~inordertraversal", + "aureooms-es-red-black-tree/src/traversal/inordertraversal.js~inordertraversal", "function/index.html#static-function-inordertraversal", - "inordertraversal aureooms-es-red-black-tree/src/base/inordertraversal.js", + "inordertraversal aureooms-es-red-black-tree/src/traversal/inordertraversal.js", "function" ], [ - "aureooms-es-red-black-tree/src/base/insert.js~insert", + "aureooms-es-red-black-tree/src/insertion/insert.js~insert", "function/index.html#static-function-insert", - "insert aureooms-es-red-black-tree/src/base/insert.js", + "insert aureooms-es-red-black-tree/src/insertion/insert.js", "function" ], [ @@ -138,21 +138,21 @@ window.esdocSearchIndex = [ "function" ], [ - "aureooms-es-red-black-tree/src/base/replace_node.js~replace_node", + "aureooms-es-red-black-tree/src/removal/replace_node.js~replace_node", "function/index.html#static-function-replace_node", - "replace_node aureooms-es-red-black-tree/src/base/replace_node.js", + "replace_node aureooms-es-red-black-tree/src/removal/replace_node.js", "function" ], [ - "aureooms-es-red-black-tree/src/base/rotate_left.js~rotate_left", + "aureooms-es-red-black-tree/src/rotate/rotate_left.js~rotate_left", "function/index.html#static-function-rotate_left", - "rotate_left aureooms-es-red-black-tree/src/base/rotate_left.js", + "rotate_left aureooms-es-red-black-tree/src/rotate/rotate_left.js", "function" ], [ - "aureooms-es-red-black-tree/src/base/rotate_right.js~rotate_right", + "aureooms-es-red-black-tree/src/rotate/rotate_right.js~rotate_right", "function/index.html#static-function-rotate_right", - "rotate_right aureooms-es-red-black-tree/src/base/rotate_right.js", + "rotate_right aureooms-es-red-black-tree/src/rotate/rotate_right.js", "function" ], [ @@ -497,6 +497,18 @@ window.esdocSearchIndex = [ "BuiltinExternal/WebAPIExternal.js~XMLHttpRequest", "external" ], + [ + "src/adt/leaf.js", + "file/src/adt/Leaf.js.html", + "src/adt/Leaf.js", + "file" + ], + [ + "src/adt/node.js", + "file/src/adt/Node.js.html", + "src/adt/Node.js", + "file" + ], [ "src/adt/redblacktree.js", "file/src/adt/RedBlackTree.js.html", @@ -558,57 +570,33 @@ window.esdocSearchIndex = [ "file" ], [ - "src/base/colors.js", - "file/src/base/colors.js.html", - "src/base/colors.js", - "file" - ], - [ - "src/base/debug.js", - "file/src/base/debug.js.html", - "src/base/debug.js", + "src/color/black.js", + "file/src/color/BLACK.js.html", + "src/color/BLACK.js", "file" ], [ - "src/base/find.js", - "file/src/base/find.js.html", - "src/base/find.js", + "src/color/red.js", + "file/src/color/RED.js.html", + "src/color/RED.js", "file" ], [ - "src/base/index.js", - "file/src/base/index.js.html", - "src/base/index.js", + "src/color/index.js", + "file/src/color/index.js.html", + "src/color/index.js", "file" ], [ - "src/base/inordertraversal.js", - "file/src/base/inordertraversal.js.html", - "src/base/inordertraversal.js", + "src/debug/debug.js", + "file/src/debug/debug.js.html", + "src/debug/debug.js", "file" ], [ - "src/base/insert.js", - "file/src/base/insert.js.html", - "src/base/insert.js", - "file" - ], - [ - "src/base/replace_node.js", - "file/src/base/replace_node.js.html", - "src/base/replace_node.js", - "file" - ], - [ - "src/base/rotate_left.js", - "file/src/base/rotate_left.js.html", - "src/base/rotate_left.js", - "file" - ], - [ - "src/base/rotate_right.js", - "file/src/base/rotate_right.js.html", - "src/base/rotate_right.js", + "src/debug/index.js", + "file/src/debug/index.js.html", + "src/debug/index.js", "file" ], [ @@ -653,6 +641,12 @@ window.esdocSearchIndex = [ "src/insertion/index.js", "file" ], + [ + "src/insertion/insert.js", + "file/src/insertion/insert.js.html", + "src/insertion/insert.js", + "file" + ], [ "src/insertion/insert_case1.js", "file/src/insertion/insert_case1.js.html", @@ -683,24 +677,6 @@ window.esdocSearchIndex = [ "src/insertion/insert_case5.js", "file" ], - [ - "src/node/leaf.js", - "file/src/node/Leaf.js.html", - "src/node/Leaf.js", - "file" - ], - [ - "src/node/node.js", - "file/src/node/Node.js.html", - "src/node/Node.js", - "file" - ], - [ - "src/node/index.js", - "file/src/node/index.js.html", - "src/node/index.js", - "file" - ], [ "src/removal/delete_case1.js", "file/src/removal/delete_case1.js.html", @@ -748,5 +724,53 @@ window.esdocSearchIndex = [ "file/src/removal/index.js.html", "src/removal/index.js", "file" + ], + [ + "src/removal/replace_node.js", + "file/src/removal/replace_node.js.html", + "src/removal/replace_node.js", + "file" + ], + [ + "src/rotate/index.js", + "file/src/rotate/index.js.html", + "src/rotate/index.js", + "file" + ], + [ + "src/rotate/rotate_left.js", + "file/src/rotate/rotate_left.js.html", + "src/rotate/rotate_left.js", + "file" + ], + [ + "src/rotate/rotate_right.js", + "file/src/rotate/rotate_right.js.html", + "src/rotate/rotate_right.js", + "file" + ], + [ + "src/search/find.js", + "file/src/search/find.js.html", + "src/search/find.js", + "file" + ], + [ + "src/search/index.js", + "file/src/search/index.js.html", + "src/search/index.js", + "file" + ], + [ + "src/traversal/index.js", + "file/src/traversal/index.js.html", + "src/traversal/index.js", + "file" + ], + [ + "src/traversal/inordertraversal.js", + "file/src/traversal/inordertraversal.js.html", + "src/traversal/inordertraversal.js", + "file" ] ] \ No newline at end of file diff --git a/source.html b/source.html index f907c09..bb591ac 100644 --- a/source.html +++ b/source.html @@ -35,26 +35,21 @@
    @@ -82,93 +82,76 @@ + src/adt/Leaf.js + Leaf + 0 %0/1 + 170 byte + 8 + 2016-07-06 08:32:01 (UTC) + + + src/adt/Node.js + Node + 0 %0/1 + 266 byte + 11 + 2016-07-06 08:32:01 (UTC) + + src/adt/RedBlackTree.js RedBlackTree 0 %0/9 - 1814 byte + 1818 byte 88 - 2016-07-06 07:55:36 (UTC) + 2016-07-06 08:33:18 (UTC) src/adt/index.js - - - 33 byte - 1 - 2016-07-05 12:58:10 (UTC) - - - src/base/colors.js - BLACK -RED - 0 %0/2 - 48 byte - 2 - 2016-07-05 12:58:10 (UTC) + 83 byte + 3 + 2016-07-06 08:37:31 (UTC) - src/base/debug.js - debug + src/color/BLACK.js + BLACK 0 %0/1 - 314 byte - 14 - 2016-07-05 15:00:15 (UTC) + 25 byte + 1 + 2016-07-06 08:18:18 (UTC) - src/base/find.js - find + src/color/RED.js + RED 0 %0/1 - 352 byte - 29 - 2016-07-05 12:58:10 (UTC) + 23 byte + 1 + 2016-07-06 08:18:22 (UTC) - src/base/index.js + src/color/index.js - - - 240 byte - 8 - 2016-07-05 15:23:22 (UTC) - - - src/base/inordertraversal.js - inordertraversal - 0 %0/1 - 220 byte - 14 - 2016-07-05 12:58:10 (UTC) - - - src/base/insert.js - insert - 0 %0/1 - 360 byte - 38 - 2016-07-05 12:58:10 (UTC) + 50 byte + 2 + 2016-07-06 08:37:31 (UTC) - src/base/replace_node.js - replace_node + src/debug/debug.js + debug 0 %0/1 - 243 byte - 12 - 2016-07-06 07:46:44 (UTC) + 307 byte + 13 + 2016-07-06 08:33:45 (UTC) - src/base/rotate_left.js - rotate_left - 100 %1/1 - 583 byte - 33 - 2016-07-05 12:58:10 (UTC) - - - src/base/rotate_right.js - rotate_right - 100 %1/1 - 593 byte - 34 - 2016-07-05 12:58:10 (UTC) + src/debug/index.js + - + - + 26 byte + 1 + 2016-07-06 08:37:31 (UTC) src/family/grandparent.js @@ -176,7 +159,7 @@ 0 %0/1 168 byte 7 - 2016-07-06 07:45:12 (UTC) + 2016-07-06 08:15:09 (UTC) src/family/index.js @@ -184,7 +167,7 @@ - 118 byte 4 - 2016-07-06 07:55:09 (UTC) + 2016-07-06 08:37:31 (UTC) src/family/predecessor.js @@ -192,7 +175,7 @@ 0 %0/1 136 byte 9 - 2016-07-05 15:22:59 (UTC) + 2016-07-06 08:15:09 (UTC) src/family/sibling.js @@ -200,7 +183,7 @@ 0 %0/1 233 byte 9 - 2016-07-06 07:46:12 (UTC) + 2016-07-06 08:15:09 (UTC) src/family/uncle.js @@ -208,23 +191,31 @@ 0 %0/1 287 byte 11 - 2016-07-06 07:49:29 (UTC) + 2016-07-06 08:15:09 (UTC) src/index.js - - - 159 byte - 6 - 2016-07-05 15:24:51 (UTC) + 245 byte + 9 + 2016-07-06 08:37:31 (UTC) src/insertion/index.js - - - 165 byte - 5 - 2016-07-05 12:58:10 (UTC) + 192 byte + 6 + 2016-07-06 08:37:31 (UTC) + + + src/insertion/insert.js + insert + 0 %0/1 + 360 byte + 38 + 2016-07-06 08:25:33 (UTC) src/insertion/insert_case1.js @@ -232,7 +223,7 @@ 0 %0/1 183 byte 11 - 2016-07-05 12:58:10 (UTC) + 2016-07-06 08:15:09 (UTC) src/insertion/insert_case2.js @@ -240,7 +231,7 @@ 0 %0/1 207 byte 11 - 2016-07-05 12:58:10 (UTC) + 2016-07-06 08:15:09 (UTC) src/insertion/insert_case3.js @@ -248,7 +239,7 @@ 0 %0/1 395 byte 18 - 2016-07-05 12:58:10 (UTC) + 2016-07-06 08:15:09 (UTC) src/insertion/insert_case4.js @@ -256,7 +247,7 @@ 0 %0/1 922 byte 41 - 2016-07-05 15:20:17 (UTC) + 2016-07-06 08:15:09 (UTC) src/insertion/insert_case5.js @@ -264,39 +255,15 @@ 0 %0/1 254 byte 14 - 2016-07-05 12:58:10 (UTC) - - - src/node/Leaf.js - Leaf - 0 %0/1 - 170 byte - 8 - 2016-07-05 12:58:10 (UTC) - - - src/node/Node.js - Node - 0 %0/1 - 266 byte - 11 - 2016-07-05 12:58:10 (UTC) + 2016-07-06 08:15:09 (UTC) - src/node/index.js - - - - - 50 byte - 2 - 2016-07-05 12:58:10 (UTC) - - - src/removal/delete_case1.js + src/removal/delete_case1.js delete_case1 0 %0/1 - 160 byte - 10 - 2016-07-05 15:28:23 (UTC) + 139 byte + 7 + 2016-07-06 08:35:27 (UTC) src/removal/delete_case2.js @@ -304,15 +271,15 @@ 0 %0/1 359 byte 18 - 2016-07-05 13:15:58 (UTC) + 2016-07-06 08:15:09 (UTC) - src/removal/delete_case3.js + src/removal/delete_case3.js delete_case3 0 %0/1 - 469 byte - 22 - 2016-07-05 15:16:40 (UTC) + 468 byte + 21 + 2016-07-06 08:35:34 (UTC) src/removal/delete_case4.js @@ -320,39 +287,103 @@ 0 %0/1 375 byte 18 - 2016-07-05 15:16:30 (UTC) + 2016-07-06 08:15:09 (UTC) - src/removal/delete_case5.js + src/removal/delete_case5.js delete_case5 0 %0/1 - 1033 byte - 30 - 2016-07-05 12:58:10 (UTC) + 1032 byte + 29 + 2016-07-06 08:35:38 (UTC) - src/removal/delete_case6.js + src/removal/delete_case6.js delete_case6 0 %0/1 - 330 byte - 18 - 2016-07-05 12:58:10 (UTC) + 329 byte + 17 + 2016-07-06 08:35:42 (UTC) src/removal/delete_one_child.js delete_one_child 0 %0/1 - 770 byte + 802 byte 28 - 2016-07-06 08:10:27 (UTC) + 2016-07-06 08:35:45 (UTC) src/removal/index.js - - - 235 byte - 7 - 2016-07-05 12:58:10 (UTC) + 268 byte + 8 + 2016-07-06 08:37:31 (UTC) + + + src/removal/replace_node.js + replace_node + 0 %0/1 + 243 byte + 12 + 2016-07-06 08:26:26 (UTC) + + + src/rotate/index.js + - + - + 65 byte + 2 + 2016-07-06 08:37:31 (UTC) + + + src/rotate/rotate_left.js + rotate_left + 100 %1/1 + 589 byte + 35 + 2016-07-06 08:37:13 (UTC) + + + src/rotate/rotate_right.js + rotate_right + 100 %1/1 + 599 byte + 36 + 2016-07-06 08:37:17 (UTC) + + + src/search/find.js + find + 0 %0/1 + 351 byte + 28 + 2016-07-06 08:36:09 (UTC) + + + src/search/index.js + - + - + 25 byte + 1 + 2016-07-06 08:37:31 (UTC) + + + src/traversal/index.js + - + - + 37 byte + 1 + 2016-07-06 08:37:31 (UTC) + + + src/traversal/inordertraversal.js + inordertraversal + 0 %0/1 + 219 byte + 13 + 2016-07-06 08:36:15 (UTC) diff --git a/variable/index.html b/variable/index.html index 3d19165..95b0482 100644 --- a/variable/index.html +++ b/variable/index.html @@ -35,26 +35,21 @@
    @@ -137,11 +137,11 @@

    - source + source

    - + @@ -177,11 +177,11 @@

    - source + source

    - + From babce666346276f3de81558cbaf315498e4982b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Fri, 22 Jul 2016 10:54:56 +0200 Subject: [PATCH 06/26] esdoc update --- ast/source/adt/RedBlackTree.js.json | 1282 ++++++++++++----- .../src/adt/RedBlackTree.js~RedBlackTree.html | 125 +- coverage.json | 13 +- dump.json | 269 ++-- file/src/adt/RedBlackTree.js.html | 12 +- script/search_index.js | 18 +- source.html | 86 +- 7 files changed, 1221 insertions(+), 584 deletions(-) diff --git a/ast/source/adt/RedBlackTree.js.json b/ast/source/adt/RedBlackTree.js.json index 6312bf3..af45926 100644 --- a/ast/source/adt/RedBlackTree.js.json +++ b/ast/source/adt/RedBlackTree.js.json @@ -2284,10 +2284,10 @@ "type": "MethodDefinition", "key": { "type": "Identifier", - "name": "delete", + "name": "_delete", "range": [ 713, - 719 + 720 ], "loc": { "start": { @@ -2296,7 +2296,7 @@ }, "end": { "line": 38, - "column": 7 + "column": 8 } } }, @@ -2308,17 +2308,17 @@ "type": "Identifier", "name": "node", "range": [ - 722, - 726 + 723, + 727 ], "loc": { "start": { "line": 38, - "column": 10 + "column": 11 }, "end": { "line": 38, - "column": 14 + "column": 15 } } } @@ -2343,8 +2343,8 @@ "type": "Identifier", "name": "node", "range": [ - 740, - 744 + 741, + 745 ], "loc": { "start": { @@ -2361,8 +2361,8 @@ "type": "Identifier", "name": "left", "range": [ - 745, - 749 + 746, + 750 ], "loc": { "start": { @@ -2376,8 +2376,8 @@ } }, "range": [ - 740, - 749 + 741, + 750 ], "loc": { "start": { @@ -2394,8 +2394,8 @@ "type": "Identifier", "name": "isleaf", "range": [ - 750, - 756 + 751, + 757 ], "loc": { "start": { @@ -2409,8 +2409,8 @@ } }, "range": [ - 740, - 756 + 741, + 757 ], "loc": { "start": { @@ -2425,8 +2425,8 @@ }, "arguments": [], "range": [ - 740, - 758 + 741, + 759 ], "loc": { "start": { @@ -2441,8 +2441,8 @@ }, "prefix": true, "range": [ - 739, - 758 + 740, + 759 ], "loc": { "start": { @@ -2467,8 +2467,8 @@ "type": "Identifier", "name": "pred", "range": [ - 824, - 828 + 825, + 829 ], "loc": { "start": { @@ -2487,8 +2487,8 @@ "type": "Identifier", "name": "predecessor", "range": [ - 831, - 842 + 832, + 843 ], "loc": { "start": { @@ -2506,8 +2506,8 @@ "type": "Identifier", "name": "node", "range": [ - 844, - 848 + 845, + 849 ], "loc": { "start": { @@ -2522,8 +2522,8 @@ } ], "range": [ - 831, - 850 + 832, + 851 ], "loc": { "start": { @@ -2537,8 +2537,8 @@ } }, "range": [ - 824, - 850 + 825, + 851 ], "loc": { "start": { @@ -2554,8 +2554,8 @@ ], "kind": "const", "range": [ - 818, - 852 + 819, + 853 ], "loc": { "start": { @@ -2572,8 +2572,8 @@ "type": "Line", "value": " replace node's value with predecessor's value", "range": [ - 766, - 814 + 767, + 815 ], "loc": { "start": { @@ -2600,8 +2600,8 @@ "type": "Identifier", "name": "node", "range": [ - 856, - 860 + 857, + 861 ], "loc": { "start": { @@ -2618,8 +2618,8 @@ "type": "Identifier", "name": "value", "range": [ - 861, - 866 + 862, + 867 ], "loc": { "start": { @@ -2633,8 +2633,8 @@ } }, "range": [ - 856, - 866 + 857, + 867 ], "loc": { "start": { @@ -2654,8 +2654,8 @@ "type": "Identifier", "name": "pred", "range": [ - 869, - 873 + 870, + 874 ], "loc": { "start": { @@ -2672,8 +2672,8 @@ "type": "Identifier", "name": "value", "range": [ - 874, - 879 + 875, + 880 ], "loc": { "start": { @@ -2687,8 +2687,8 @@ } }, "range": [ - 869, - 879 + 870, + 880 ], "loc": { "start": { @@ -2702,8 +2702,8 @@ } }, "range": [ - 856, - 879 + 857, + 880 ], "loc": { "start": { @@ -2717,8 +2717,8 @@ } }, "range": [ - 856, - 881 + 857, + 882 ], "loc": { "start": { @@ -2735,8 +2735,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 885, - 911 + 886, + 912 ], "loc": { "start": { @@ -2753,8 +2753,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 915, - 966 + 916, + 967 ], "loc": { "start": { @@ -2771,8 +2771,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 970, - 1015 + 971, + 1016 ], "loc": { "start": { @@ -2795,8 +2795,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1019, - 1035 + 1020, + 1036 ], "loc": { "start": { @@ -2814,8 +2814,8 @@ "type": "Identifier", "name": "pred", "range": [ - 1037, - 1041 + 1038, + 1042 ], "loc": { "start": { @@ -2830,8 +2830,8 @@ } ], "range": [ - 1019, - 1043 + 1020, + 1044 ], "loc": { "start": { @@ -2845,8 +2845,8 @@ } }, "range": [ - 1019, - 1045 + 1020, + 1046 ], "loc": { "start": { @@ -2863,8 +2863,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 885, - 911 + 886, + 912 ], "loc": { "start": { @@ -2881,8 +2881,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 915, - 966 + 916, + 967 ], "loc": { "start": { @@ -2899,8 +2899,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 970, - 1015 + 971, + 1016 ], "loc": { "start": { @@ -2917,8 +2917,8 @@ } ], "range": [ - 761, - 1049 + 762, + 1050 ], "loc": { "start": { @@ -2948,8 +2948,8 @@ "type": "Identifier", "name": "node", "range": [ - 1064, - 1068 + 1065, + 1069 ], "loc": { "start": { @@ -2966,8 +2966,8 @@ "type": "Identifier", "name": "right", "range": [ - 1069, - 1074 + 1070, + 1075 ], "loc": { "start": { @@ -2981,8 +2981,8 @@ } }, "range": [ - 1064, - 1074 + 1065, + 1075 ], "loc": { "start": { @@ -2999,8 +2999,8 @@ "type": "Identifier", "name": "isleaf", "range": [ - 1075, - 1081 + 1076, + 1082 ], "loc": { "start": { @@ -3014,8 +3014,8 @@ } }, "range": [ - 1064, - 1081 + 1065, + 1082 ], "loc": { "start": { @@ -3030,8 +3030,8 @@ }, "arguments": [], "range": [ - 1064, - 1083 + 1065, + 1084 ], "loc": { "start": { @@ -3046,8 +3046,8 @@ }, "prefix": true, "range": [ - 1063, - 1083 + 1064, + 1084 ], "loc": { "start": { @@ -3072,8 +3072,8 @@ "type": "Identifier", "name": "succ", "range": [ - 1226, - 1230 + 1227, + 1231 ], "loc": { "start": { @@ -3093,8 +3093,8 @@ "type": "Identifier", "name": "node", "range": [ - 1233, - 1237 + 1234, + 1238 ], "loc": { "start": { @@ -3111,8 +3111,8 @@ "type": "Identifier", "name": "right", "range": [ - 1238, - 1243 + 1239, + 1244 ], "loc": { "start": { @@ -3126,8 +3126,8 @@ } }, "range": [ - 1233, - 1243 + 1234, + 1244 ], "loc": { "start": { @@ -3141,8 +3141,8 @@ } }, "range": [ - 1226, - 1243 + 1227, + 1244 ], "loc": { "start": { @@ -3158,8 +3158,8 @@ ], "kind": "const", "range": [ - 1220, - 1245 + 1221, + 1246 ], "loc": { "start": { @@ -3176,8 +3176,8 @@ "type": "Line", "value": " replace node's value with successor's value", "range": [ - 1091, - 1137 + 1092, + 1138 ], "loc": { "start": { @@ -3194,8 +3194,8 @@ "type": "Line", "value": " If there is no left child, then there can only be one right", "range": [ - 1141, - 1203 + 1142, + 1204 ], "loc": { "start": { @@ -3212,8 +3212,8 @@ "type": "Line", "value": " child.", "range": [ - 1207, - 1216 + 1208, + 1217 ], "loc": { "start": { @@ -3240,8 +3240,8 @@ "type": "Identifier", "name": "node", "range": [ - 1249, - 1253 + 1250, + 1254 ], "loc": { "start": { @@ -3258,8 +3258,8 @@ "type": "Identifier", "name": "value", "range": [ - 1254, - 1259 + 1255, + 1260 ], "loc": { "start": { @@ -3273,8 +3273,8 @@ } }, "range": [ - 1249, - 1259 + 1250, + 1260 ], "loc": { "start": { @@ -3294,8 +3294,8 @@ "type": "Identifier", "name": "succ", "range": [ - 1262, - 1266 + 1263, + 1267 ], "loc": { "start": { @@ -3312,8 +3312,8 @@ "type": "Identifier", "name": "value", "range": [ - 1267, - 1272 + 1268, + 1273 ], "loc": { "start": { @@ -3327,8 +3327,8 @@ } }, "range": [ - 1262, - 1272 + 1263, + 1273 ], "loc": { "start": { @@ -3342,8 +3342,8 @@ } }, "range": [ - 1249, - 1272 + 1250, + 1273 ], "loc": { "start": { @@ -3357,8 +3357,8 @@ } }, "range": [ - 1249, - 1274 + 1250, + 1275 ], "loc": { "start": { @@ -3375,8 +3375,8 @@ "type": "Line", "value": " delete successor node", "range": [ - 1278, - 1302 + 1279, + 1303 ], "loc": { "start": { @@ -3393,8 +3393,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1306, - 1357 + 1307, + 1358 ], "loc": { "start": { @@ -3411,8 +3411,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1361, - 1406 + 1362, + 1407 ], "loc": { "start": { @@ -3435,8 +3435,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1410, - 1426 + 1411, + 1427 ], "loc": { "start": { @@ -3454,8 +3454,8 @@ "type": "Identifier", "name": "succ", "range": [ - 1428, - 1432 + 1429, + 1433 ], "loc": { "start": { @@ -3470,8 +3470,8 @@ } ], "range": [ - 1410, - 1434 + 1411, + 1435 ], "loc": { "start": { @@ -3485,8 +3485,8 @@ } }, "range": [ - 1410, - 1436 + 1411, + 1437 ], "loc": { "start": { @@ -3503,8 +3503,8 @@ "type": "Line", "value": " delete successor node", "range": [ - 1278, - 1302 + 1279, + 1303 ], "loc": { "start": { @@ -3521,8 +3521,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1306, - 1357 + 1307, + 1358 ], "loc": { "start": { @@ -3539,8 +3539,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1361, - 1406 + 1362, + 1407 ], "loc": { "start": { @@ -3557,8 +3557,8 @@ } ], "range": [ - 1086, - 1440 + 1087, + 1441 ], "loc": { "start": { @@ -3580,8 +3580,8 @@ "type": "Identifier", "name": "node", "range": [ - 1454, - 1458 + 1455, + 1459 ], "loc": { "start": { @@ -3600,8 +3600,8 @@ "object": { "type": "ThisExpression", "range": [ - 1463, - 1467 + 1464, + 1468 ], "loc": { "start": { @@ -3618,8 +3618,8 @@ "type": "Identifier", "name": "root", "range": [ - 1468, - 1472 + 1469, + 1473 ], "loc": { "start": { @@ -3633,8 +3633,8 @@ } }, "range": [ - 1463, - 1472 + 1464, + 1473 ], "loc": { "start": { @@ -3648,8 +3648,8 @@ } }, "range": [ - 1454, - 1472 + 1455, + 1473 ], "loc": { "start": { @@ -3676,8 +3676,8 @@ "object": { "type": "ThisExpression", "range": [ - 1480, - 1484 + 1481, + 1485 ], "loc": { "start": { @@ -3694,8 +3694,8 @@ "type": "Identifier", "name": "root", "range": [ - 1485, - 1489 + 1486, + 1490 ], "loc": { "start": { @@ -3709,8 +3709,8 @@ } }, "range": [ - 1480, - 1489 + 1481, + 1490 ], "loc": { "start": { @@ -3728,8 +3728,8 @@ "value": null, "raw": "null", "range": [ - 1492, - 1496 + 1493, + 1497 ], "loc": { "start": { @@ -3743,8 +3743,8 @@ } }, "range": [ - 1480, - 1496 + 1481, + 1497 ], "loc": { "start": { @@ -3758,8 +3758,8 @@ } }, "range": [ - 1480, - 1498 + 1481, + 1499 ], "loc": { "start": { @@ -3774,8 +3774,8 @@ } ], "range": [ - 1475, - 1502 + 1476, + 1503 ], "loc": { "start": { @@ -3799,8 +3799,8 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1516, - 1532 + 1517, + 1533 ], "loc": { "start": { @@ -3818,8 +3818,8 @@ "type": "Identifier", "name": "node", "range": [ - 1534, - 1538 + 1535, + 1539 ], "loc": { "start": { @@ -3834,8 +3834,8 @@ } ], "range": [ - 1516, - 1540 + 1517, + 1541 ], "loc": { "start": { @@ -3849,8 +3849,8 @@ } }, "range": [ - 1516, - 1542 + 1517, + 1543 ], "loc": { "start": { @@ -3865,8 +3865,8 @@ } ], "range": [ - 1511, - 1546 + 1512, + 1547 ], "loc": { "start": { @@ -3880,8 +3880,8 @@ } }, "range": [ - 1449, - 1546 + 1450, + 1547 ], "loc": { "start": { @@ -3895,8 +3895,8 @@ } }, "range": [ - 1058, - 1546 + 1059, + 1547 ], "loc": { "start": { @@ -3910,8 +3910,8 @@ } }, "range": [ - 734, - 1546 + 735, + 1547 ], "loc": { "start": { @@ -3926,13 +3926,13 @@ } ], "range": [ - 729, - 1550 + 730, + 1551 ], "loc": { "start": { "line": 38, - "column": 17 + "column": 18 }, "end": { "line": 70, @@ -3943,13 +3943,13 @@ "generator": false, "expression": false, "range": [ - 720, - 1550 + 721, + 1551 ], "loc": { "start": { "line": 38, - "column": 8 + "column": 9 }, "end": { "line": 70, @@ -3961,7 +3961,7 @@ "computed": false, "range": [ 713, - 1550 + 1551 ], "loc": { "start": { @@ -3975,6 +3975,500 @@ }, "static": false }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "remove", + "range": [ + 1554, + 1560 + ], + "loc": { + "start": { + "line": 72, + "column": 1 + }, + "end": { + "line": 72, + "column": 7 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 1563, + 1568 + ], + "loc": { + "start": { + "line": 72, + "column": 10 + }, + "end": { + "line": 72, + "column": 15 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "node", + "range": [ + 1582, + 1586 + ], + "loc": { + "start": { + "line": 74, + "column": 8 + }, + "end": { + "line": 74, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1589, + 1593 + ], + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "find", + "range": [ + 1594, + 1598 + ], + "loc": { + "start": { + "line": 74, + "column": 20 + }, + "end": { + "line": 74, + "column": 24 + } + } + }, + "range": [ + 1589, + 1598 + ], + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 24 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 1600, + 1605 + ], + "loc": { + "start": { + "line": 74, + "column": 26 + }, + "end": { + "line": 74, + "column": 31 + } + } + } + ], + "range": [ + 1589, + 1607 + ], + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 33 + } + } + }, + "range": [ + 1582, + 1607 + ], + "loc": { + "start": { + "line": 74, + "column": 8 + }, + "end": { + "line": 74, + "column": 33 + } + } + } + ], + "kind": "const", + "range": [ + 1576, + 1609 + ], + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 35 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "node", + "range": [ + 1617, + 1621 + ], + "loc": { + "start": { + "line": 75, + "column": 7 + }, + "end": { + "line": 75, + "column": 11 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1626, + 1630 + ], + "loc": { + "start": { + "line": 75, + "column": 16 + }, + "end": { + "line": 75, + "column": 20 + } + } + }, + "range": [ + 1617, + 1630 + ], + "loc": { + "start": { + "line": 75, + "column": 7 + }, + "end": { + "line": 75, + "column": 20 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": false, + "raw": "false", + "range": [ + 1640, + 1645 + ], + "loc": { + "start": { + "line": 75, + "column": 30 + }, + "end": { + "line": 75, + "column": 35 + } + } + }, + "range": [ + 1633, + 1647 + ], + "loc": { + "start": { + "line": 75, + "column": 23 + }, + "end": { + "line": 75, + "column": 37 + } + } + }, + "alternate": null, + "range": [ + 1612, + 1647 + ], + "loc": { + "start": { + "line": 75, + "column": 2 + }, + "end": { + "line": 75, + "column": 37 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1651, + 1655 + ], + "loc": { + "start": { + "line": 77, + "column": 2 + }, + "end": { + "line": 77, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "_delete", + "range": [ + 1656, + 1663 + ], + "loc": { + "start": { + "line": 77, + "column": 7 + }, + "end": { + "line": 77, + "column": 14 + } + } + }, + "range": [ + 1651, + 1663 + ], + "loc": { + "start": { + "line": 77, + "column": 2 + }, + "end": { + "line": 77, + "column": 14 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 1665, + 1669 + ], + "loc": { + "start": { + "line": 77, + "column": 16 + }, + "end": { + "line": 77, + "column": 20 + } + } + } + ], + "range": [ + 1651, + 1671 + ], + "loc": { + "start": { + "line": 77, + "column": 2 + }, + "end": { + "line": 77, + "column": 22 + } + } + }, + "range": [ + 1651, + 1673 + ], + "loc": { + "start": { + "line": 77, + "column": 2 + }, + "end": { + "line": 77, + "column": 24 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 1683, + 1687 + ], + "loc": { + "start": { + "line": 78, + "column": 9 + }, + "end": { + "line": 78, + "column": 13 + } + } + }, + "range": [ + 1676, + 1689 + ], + "loc": { + "start": { + "line": 78, + "column": 2 + }, + "end": { + "line": 78, + "column": 15 + } + } + } + ], + "range": [ + 1571, + 1693 + ], + "loc": { + "start": { + "line": 72, + "column": 18 + }, + "end": { + "line": 80, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 1561, + 1693 + ], + "loc": { + "start": { + "line": 72, + "column": 8 + }, + "end": { + "line": 80, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 1554, + 1693 + ], + "loc": { + "start": { + "line": 72, + "column": 1 + }, + "end": { + "line": 80, + "column": 2 + } + }, + "static": false + }, { "type": "MethodDefinition", "key": { @@ -3984,16 +4478,16 @@ "type": "Identifier", "name": "Symbol", "range": [ - 1555, - 1561 + 1698, + 1704 ], "loc": { "start": { - "line": 72, + "line": 82, "column": 3 }, "end": { - "line": 72, + "line": 82, "column": 9 } } @@ -4002,31 +4496,31 @@ "type": "Identifier", "name": "iterator", "range": [ - 1562, - 1570 + 1705, + 1713 ], "loc": { "start": { - "line": 72, + "line": 82, "column": 10 }, "end": { - "line": 72, + "line": 82, "column": 18 } } }, "range": [ - 1555, - 1570 + 1698, + 1713 ], "loc": { "start": { - "line": 72, + "line": 82, "column": 3 }, "end": { - "line": 72, + "line": 82, "column": 18 } } @@ -4049,16 +4543,16 @@ "object": { "type": "ThisExpression", "range": [ - 1586, - 1590 + 1729, + 1733 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 7 }, "end": { - "line": 74, + "line": 84, "column": 11 } } @@ -4067,31 +4561,31 @@ "type": "Identifier", "name": "root", "range": [ - 1591, - 1595 + 1734, + 1738 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 12 }, "end": { - "line": 74, + "line": 84, "column": 16 } } }, "range": [ - 1586, - 1595 + 1729, + 1738 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 7 }, "end": { - "line": 74, + "line": 84, "column": 16 } } @@ -4101,31 +4595,31 @@ "value": null, "raw": "null", "range": [ - 1600, - 1604 + 1743, + 1747 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 21 }, "end": { - "line": 74, + "line": 84, "column": 25 } } }, "range": [ - 1586, - 1604 + 1729, + 1747 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 7 }, "end": { - "line": 74, + "line": 84, "column": 25 } } @@ -4140,16 +4634,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 1614, - 1630 + 1757, + 1773 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 35 }, "end": { - "line": 74, + "line": 84, "column": 51 } } @@ -4161,16 +4655,16 @@ "object": { "type": "ThisExpression", "range": [ - 1632, - 1636 + 1775, + 1779 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 53 }, "end": { - "line": 74, + "line": 84, "column": 57 } } @@ -4179,110 +4673,110 @@ "type": "Identifier", "name": "root", "range": [ - 1637, - 1641 + 1780, + 1784 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 58 }, "end": { - "line": 74, + "line": 84, "column": 62 } } }, "range": [ - 1632, - 1641 + 1775, + 1784 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 53 }, "end": { - "line": 74, + "line": 84, "column": 62 } } } ], "range": [ - 1614, - 1643 + 1757, + 1786 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 35 }, "end": { - "line": 74, + "line": 84, "column": 64 } } }, "delegate": true, "range": [ - 1607, - 1643 + 1750, + 1786 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 28 }, "end": { - "line": 74, + "line": 84, "column": 64 } } }, "range": [ - 1607, - 1645 + 1750, + 1788 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 28 }, "end": { - "line": 74, + "line": 84, "column": 66 } } }, "alternate": null, "range": [ - 1581, - 1645 + 1724, + 1788 ], "loc": { "start": { - "line": 74, + "line": 84, "column": 2 }, "end": { - "line": 74, + "line": 84, "column": 66 } } } ], "range": [ - 1576, - 1649 + 1719, + 1792 ], "loc": { "start": { - "line": 72, + "line": 82, "column": 24 }, "end": { - "line": 76, + "line": 86, "column": 2 } } @@ -4290,16 +4784,16 @@ "generator": true, "expression": false, "range": [ - 1572, - 1649 + 1715, + 1792 ], "loc": { "start": { - "line": 72, + "line": 82, "column": 20 }, "end": { - "line": 76, + "line": 86, "column": 2 } } @@ -4307,16 +4801,16 @@ "kind": "method", "computed": false, "range": [ - 1553, - 1649 + 1696, + 1792 ], "loc": { "start": { - "line": 72, + "line": 82, "column": 1 }, "end": { - "line": 76, + "line": 86, "column": 2 } }, @@ -4328,16 +4822,16 @@ "type": "Identifier", "name": "from", "range": [ - 1659, - 1663 + 1802, + 1806 ], "loc": { "start": { - "line": 78, + "line": 88, "column": 8 }, "end": { - "line": 78, + "line": 88, "column": 12 } } @@ -4350,16 +4844,16 @@ "type": "Identifier", "name": "compare", "range": [ - 1666, - 1673 + 1809, + 1816 ], "loc": { "start": { - "line": 78, + "line": 88, "column": 15 }, "end": { - "line": 78, + "line": 88, "column": 22 } } @@ -4368,16 +4862,16 @@ "type": "Identifier", "name": "iterable", "range": [ - 1676, - 1684 + 1819, + 1827 ], "loc": { "start": { - "line": 78, + "line": 88, "column": 25 }, "end": { - "line": 78, + "line": 88, "column": 33 } } @@ -4395,16 +4889,16 @@ "type": "Identifier", "name": "tree", "range": [ - 1698, - 1702 + 1841, + 1845 ], "loc": { "start": { - "line": 80, + "line": 90, "column": 8 }, "end": { - "line": 80, + "line": 90, "column": 12 } } @@ -4415,16 +4909,16 @@ "type": "Identifier", "name": "RedBlackTree", "range": [ - 1709, - 1721 + 1852, + 1864 ], "loc": { "start": { - "line": 80, + "line": 90, "column": 19 }, "end": { - "line": 80, + "line": 90, "column": 31 } } @@ -4434,47 +4928,47 @@ "type": "Identifier", "name": "compare", "range": [ - 1723, - 1730 + 1866, + 1873 ], "loc": { "start": { - "line": 80, + "line": 90, "column": 33 }, "end": { - "line": 80, + "line": 90, "column": 40 } } } ], "range": [ - 1705, - 1732 + 1848, + 1875 ], "loc": { "start": { - "line": 80, + "line": 90, "column": 15 }, "end": { - "line": 80, + "line": 90, "column": 42 } } }, "range": [ - 1698, - 1732 + 1841, + 1875 ], "loc": { "start": { - "line": 80, + "line": 90, "column": 8 }, "end": { - "line": 80, + "line": 90, "column": 42 } } @@ -4482,16 +4976,16 @@ ], "kind": "const", "range": [ - 1692, - 1734 + 1835, + 1877 ], "loc": { "start": { - "line": 80, + "line": 90, "column": 2 }, "end": { - "line": 80, + "line": 90, "column": 44 } } @@ -4507,32 +5001,32 @@ "type": "Identifier", "name": "element", "range": [ - 1750, - 1757 + 1893, + 1900 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 14 }, "end": { - "line": 82, + "line": 92, "column": 21 } } }, "init": null, "range": [ - 1750, - 1757 + 1893, + 1900 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 14 }, "end": { - "line": 82, + "line": 92, "column": 21 } } @@ -4540,16 +5034,16 @@ ], "kind": "const", "range": [ - 1744, - 1757 + 1887, + 1900 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 8 }, "end": { - "line": 82, + "line": 92, "column": 21 } } @@ -4558,16 +5052,16 @@ "type": "Identifier", "name": "iterable", "range": [ - 1761, - 1769 + 1904, + 1912 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 25 }, "end": { - "line": 82, + "line": 92, "column": 33 } } @@ -4583,16 +5077,16 @@ "type": "Identifier", "name": "tree", "range": [ - 1772, - 1776 + 1915, + 1919 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 36 }, "end": { - "line": 82, + "line": 92, "column": 40 } } @@ -4601,31 +5095,31 @@ "type": "Identifier", "name": "add", "range": [ - 1777, - 1780 + 1920, + 1923 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 41 }, "end": { - "line": 82, + "line": 92, "column": 44 } } }, "range": [ - 1772, - 1780 + 1915, + 1923 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 36 }, "end": { - "line": 82, + "line": 92, "column": 44 } } @@ -4635,62 +5129,62 @@ "type": "Identifier", "name": "element", "range": [ - 1782, - 1789 + 1925, + 1932 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 46 }, "end": { - "line": 82, + "line": 92, "column": 53 } } } ], "range": [ - 1772, - 1791 + 1915, + 1934 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 36 }, "end": { - "line": 82, + "line": 92, "column": 55 } } }, "range": [ - 1772, - 1793 + 1915, + 1936 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 36 }, "end": { - "line": 82, + "line": 92, "column": 57 } } }, "range": [ - 1738, - 1793 + 1881, + 1936 ], "loc": { "start": { - "line": 82, + "line": 92, "column": 2 }, "end": { - "line": 82, + "line": 92, "column": 57 } } @@ -4701,47 +5195,47 @@ "type": "Identifier", "name": "tree", "range": [ - 1804, - 1808 + 1947, + 1951 ], "loc": { "start": { - "line": 84, + "line": 94, "column": 9 }, "end": { - "line": 84, + "line": 94, "column": 13 } } }, "range": [ - 1797, - 1810 + 1940, + 1953 ], "loc": { "start": { - "line": 84, + "line": 94, "column": 2 }, "end": { - "line": 84, + "line": 94, "column": 15 } } } ], "range": [ - 1687, - 1814 + 1830, + 1957 ], "loc": { "start": { - "line": 78, + "line": 88, "column": 36 }, "end": { - "line": 86, + "line": 96, "column": 2 } } @@ -4749,16 +5243,16 @@ "generator": false, "expression": false, "range": [ - 1664, - 1814 + 1807, + 1957 ], "loc": { "start": { - "line": 78, + "line": 88, "column": 13 }, "end": { - "line": 86, + "line": 96, "column": 2 } } @@ -4766,16 +5260,16 @@ "kind": "method", "computed": false, "range": [ - 1652, - 1814 + 1795, + 1957 ], "loc": { "start": { - "line": 78, + "line": 88, "column": 1 }, "end": { - "line": 86, + "line": 96, "column": 2 } }, @@ -4784,7 +5278,7 @@ ], "range": [ 283, - 1817 + 1960 ], "loc": { "start": { @@ -4792,14 +5286,14 @@ "column": 26 }, "end": { - "line": 88, + "line": 98, "column": 1 } } }, "range": [ 264, - 1817 + 1960 ], "loc": { "start": { @@ -4807,7 +5301,7 @@ "column": 7 }, "end": { - "line": 88, + "line": 98, "column": 1 } }, @@ -4818,7 +5312,7 @@ "source": null, "range": [ 257, - 1817 + 1960 ], "loc": { "start": { @@ -4826,7 +5320,7 @@ "column": 0 }, "end": { - "line": 88, + "line": 98, "column": 1 } } @@ -4835,7 +5329,7 @@ "sourceType": "module", "range": [ 1, - 1817 + 1960 ], "loc": { "start": { @@ -4843,7 +5337,7 @@ "column": 0 }, "end": { - "line": 88, + "line": 98, "column": 1 } }, @@ -4852,8 +5346,8 @@ "type": "Line", "value": " replace node's value with predecessor's value", "range": [ - 766, - 814 + 767, + 815 ], "loc": { "start": { @@ -4870,8 +5364,8 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 885, - 911 + 886, + 912 ], "loc": { "start": { @@ -4888,8 +5382,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 915, - 966 + 916, + 967 ], "loc": { "start": { @@ -4906,8 +5400,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 970, - 1015 + 971, + 1016 ], "loc": { "start": { @@ -4924,8 +5418,8 @@ "type": "Line", "value": " replace node's value with successor's value", "range": [ - 1091, - 1137 + 1092, + 1138 ], "loc": { "start": { @@ -4942,8 +5436,8 @@ "type": "Line", "value": " If there is no left child, then there can only be one right", "range": [ - 1141, - 1203 + 1142, + 1204 ], "loc": { "start": { @@ -4960,8 +5454,8 @@ "type": "Line", "value": " child.", "range": [ - 1207, - 1216 + 1208, + 1217 ], "loc": { "start": { @@ -4978,8 +5472,8 @@ "type": "Line", "value": " delete successor node", "range": [ - 1278, - 1302 + 1279, + 1303 ], "loc": { "start": { @@ -4996,8 +5490,8 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1306, - 1357 + 1307, + 1358 ], "loc": { "start": { @@ -5014,8 +5508,8 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1361, - 1406 + 1362, + 1407 ], "loc": { "start": { diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/adt/RedBlackTree.js~RedBlackTree.html index b5e8e94..c2ea32b 100644 --- a/class/src/adt/RedBlackTree.js~RedBlackTree.html +++ b/class/src/adt/RedBlackTree.js~RedBlackTree.html @@ -291,7 +291,7 @@

    RedBlackTree

    - delete(node: *) + find(value: *): *

    @@ -316,7 +316,38 @@

    RedBlackTree

    - find(value: *): * + remove(value: *): boolean +

    +
    +
    + + + +
    + + + + + + + + + + + + + + + - + @@ -693,7 +724,17 @@

    Params:

    - +
    +

    Return:

    +
    Private Methods
    + private + + + + + +
    +

    + _delete(node: *)

    @@ -350,7 +381,7 @@

    - source + source

    @@ -567,7 +598,7 @@

    - source + source

    @@ -653,17 +684,17 @@

    Params:

    -

    +

    public - delete(node: *) + find(value: *): * - source + source

    @@ -683,7 +714,7 @@

    Params:

    nodevalue *
    + + + + +
    *
    +
    +
    +
    @@ -709,17 +750,17 @@

    Params:

    -

    +

    public - find(value: *): * + remove(value: *): boolean - source + source

    @@ -753,7 +794,7 @@

    Params:

    Return:

    - +
    *boolean
    @@ -773,6 +814,64 @@

    Return:

    +
    +

    Private Methods

    + +
    +

    + private + + + + + _delete(node: *) + + + + source + +

    + + + + + + + + +
    +

    Params:

    + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    node*
    +
    +
    + + + + + + + + + + + + + + +
    diff --git a/coverage.json b/coverage.json index fe7dfec..cdc923c 100644 --- a/coverage.json +++ b/coverage.json @@ -1,6 +1,6 @@ { - "coverage": "5.55%", - "expectCount": 36, + "coverage": "5.4%", + "expectCount": 37, "actualCount": 2, "files": { "src/color/BLACK.js": { @@ -32,17 +32,18 @@ ] }, "src/adt/RedBlackTree.js": { - "expectCount": 9, + "expectCount": 10, "actualCount": 0, "undocumentLines": [ 10, - 72, + 82, + 38, 19, 14, 12, - 38, 30, - 78, + 88, + 72, 15 ] }, diff --git a/dump.json b/dump.json index 6b11b97..e38ba7d 100644 --- a/dump.json +++ b/dump.json @@ -138,7 +138,7 @@ "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { Node } from './Node' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { find } from '..' ;\nimport { inordertraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\tfind ( value ) {\n\n\t\tif ( this.root === null ) return null ;\n\n\t\treturn find( this.compare , this.root , value ) ;\n\n\t}\n\n\tdelete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\t*[Symbol.iterator] ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" + "content": "\nimport { Node } from './Node' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { find } from '..' ;\nimport { inordertraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\tfind ( value ) {\n\n\t\tif ( this.root === null ) return null ;\n\n\t\treturn find( this.compare , this.root , value ) ;\n\n\t}\n\n\t_delete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\tremove ( value ) {\n\n\t\tconst node = this.find( value ) ;\n\t\tif ( node === null ) return false ;\n\n\t\tthis._delete( node ) ;\n\t\treturn true ;\n\n\t}\n\n\t*[Symbol.iterator] ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" }, { "__docId__": 7, @@ -287,9 +287,9 @@ "kind": "method", "static": false, "variation": null, - "name": "delete", + "name": "_delete", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", - "longname": "src/adt/RedBlackTree.js~RedBlackTree#delete", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#_delete", "access": null, "description": null, "lineNumber": 38, @@ -327,18 +327,45 @@ "kind": "method", "static": false, "variation": null, + "name": "remove", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#remove", + "access": null, + "description": null, + "lineNumber": 72, + "undocument": true, + "params": [ + { + "name": "value", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "boolean" + ] + }, + "generator": false + }, + { + "__docId__": 17, + "kind": "method", + "static": false, + "variation": null, "name": "[Symbol.iterator]", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "access": null, "description": null, - "lineNumber": 72, + "lineNumber": 82, "undocument": true, "params": [], "generator": true }, { - "__docId__": 17, + "__docId__": 18, "kind": "method", "static": true, "variation": null, @@ -347,7 +374,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree.from", "access": null, "description": null, - "lineNumber": 78, + "lineNumber": 88, "undocument": true, "params": [ { @@ -371,7 +398,7 @@ "generator": false }, { - "__docId__": 18, + "__docId__": 19, "kind": "file", "static": true, "variation": null, @@ -384,7 +411,7 @@ "content": "export * from './Leaf' ;\nexport * from './Node' ;\nexport * from './RedBlackTree' ;\n" }, { - "__docId__": 19, + "__docId__": 20, "kind": "file", "static": true, "variation": null, @@ -397,7 +424,7 @@ "content": "export const BLACK = 0 ;\n" }, { - "__docId__": 20, + "__docId__": 21, "kind": "variable", "static": true, "variation": null, @@ -418,7 +445,7 @@ } }, { - "__docId__": 21, + "__docId__": 22, "kind": "file", "static": true, "variation": null, @@ -431,7 +458,7 @@ "content": "export const RED = 1 ;\n" }, { - "__docId__": 22, + "__docId__": 23, "kind": "variable", "static": true, "variation": null, @@ -452,7 +479,7 @@ } }, { - "__docId__": 23, + "__docId__": 24, "kind": "file", "static": true, "variation": null, @@ -465,7 +492,7 @@ "content": "export * from './BLACK' ;\nexport * from './RED' ;\n" }, { - "__docId__": 24, + "__docId__": 25, "kind": "file", "static": true, "variation": null, @@ -478,7 +505,7 @@ "content": "import chalk from 'chalk' ;\n\nimport { BLACK } from '..' ;\n\nexport function debug ( node ) {\n\n\tif ( node.isleaf( ) ) return chalk.bgBlack('L') ;\n\n\tconst repr = node.color === BLACK ? chalk.bgBlack(node.value) : chalk.bgRed( node.value ) ;\n\n\treturn `(${debug(node.left)}, ${repr}, ${debug(node.right)})` ;\n\n}\n" }, { - "__docId__": 25, + "__docId__": 26, "kind": "function", "static": true, "variation": null, @@ -508,7 +535,7 @@ "generator": false }, { - "__docId__": 26, + "__docId__": 27, "kind": "file", "static": true, "variation": null, @@ -521,7 +548,7 @@ "content": "export * from './debug' ;\n" }, { - "__docId__": 27, + "__docId__": 28, "kind": "file", "static": true, "variation": null, @@ -534,7 +561,7 @@ "content": "export function grandparent ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only call this function when n HAS a grandparent\n\treturn n.parent.parent;\n\n}\n" }, { - "__docId__": 28, + "__docId__": 29, "kind": "function", "static": true, "variation": null, @@ -564,7 +591,7 @@ "generator": false }, { - "__docId__": 29, + "__docId__": 30, "kind": "file", "static": true, "variation": null, @@ -577,7 +604,7 @@ "content": "export * from './grandparent' ;\nexport * from './predecessor' ;\nexport * from './sibling' ;\nexport * from './uncle' ;\n" }, { - "__docId__": 30, + "__docId__": 31, "kind": "file", "static": true, "variation": null, @@ -590,7 +617,7 @@ "content": "export function predecessor ( node ) {\n\n\tvar pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" }, { - "__docId__": 31, + "__docId__": 32, "kind": "function", "static": true, "variation": null, @@ -620,7 +647,7 @@ "generator": false }, { - "__docId__": 32, + "__docId__": 33, "kind": "file", "static": true, "variation": null, @@ -633,7 +660,7 @@ "content": "export function sibling ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only use this function when n HAS a sibling so this case can never\n\t//happen.\n\n\treturn n === n.parent.left ? n.parent.right : n.parent.left ;\n\n}\n" }, { - "__docId__": 33, + "__docId__": 34, "kind": "function", "static": true, "variation": null, @@ -663,7 +690,7 @@ "generator": false }, { - "__docId__": 34, + "__docId__": 35, "kind": "file", "static": true, "variation": null, @@ -676,7 +703,7 @@ "content": "import { grandparent } from './grandparent' ;\n\nexport function uncle ( n ) {\n\tconst g = grandparent( n );\n\t// assert( g !== null ) ;\n\t// this can never happen\n\tif ( n.parent === g.left )\n\t return g.right.isleaf( ) ? null : g.right ;\n\telse\n\t return g.left.isleaf( ) ? null : g.left ;\n}\n" }, { - "__docId__": 35, + "__docId__": 36, "kind": "function", "static": true, "variation": null, @@ -706,7 +733,7 @@ "generator": false }, { - "__docId__": 36, + "__docId__": 37, "kind": "file", "static": true, "variation": null, @@ -719,7 +746,7 @@ "content": "export * from './adt' ;\nexport * from './color' ;\nexport * from './debug' ;\nexport * from './family' ;\nexport * from './insertion' ;\nexport * from './removal' ;\nexport * from './rotate' ;\nexport * from './search' ;\nexport * from './traversal' ;\n" }, { - "__docId__": 37, + "__docId__": 38, "kind": "file", "static": true, "variation": null, @@ -732,7 +759,7 @@ "content": "export * from './insert' ;\nexport * from './insert_case1' ;\nexport * from './insert_case2' ;\nexport * from './insert_case3' ;\nexport * from './insert_case4' ;\nexport * from './insert_case5' ;\n" }, { - "__docId__": 38, + "__docId__": 39, "kind": "file", "static": true, "variation": null, @@ -745,7 +772,7 @@ "content": "\nexport function insert ( compare, A, B ) {\n\n\twhile ( true ) {\n\n\t\tif ( compare( B.value, A.value ) < 0 ) {\n\n\t\t\tconst node = A.left;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t\telse {\n\n\t\t\tconst node = A.right;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n\n}\n" }, { - "__docId__": 39, + "__docId__": 40, "kind": "function", "static": true, "variation": null, @@ -787,7 +814,7 @@ "generator": false }, { - "__docId__": 40, + "__docId__": 41, "kind": "file", "static": true, "variation": null, @@ -800,7 +827,7 @@ "content": "\nimport { BLACK } from '..' ;\nimport { insert_case2 } from './insert_case2' ;\n\nexport function insert_case1(n)\n{\n if (n.parent === null)\n n.color = BLACK;\n else\n insert_case2(n);\n}\n" }, { - "__docId__": 41, + "__docId__": 42, "kind": "function", "static": true, "variation": null, @@ -825,7 +852,7 @@ "generator": false }, { - "__docId__": 42, + "__docId__": 43, "kind": "file", "static": true, "variation": null, @@ -838,7 +865,7 @@ "content": "\nimport { BLACK } from '..' ;\nimport { insert_case3 } from './insert_case3' ;\n\nexport function insert_case2(n)\n{\n if (n.parent.color === BLACK)\n return; /* Tree is still valid */\n else\n insert_case3(n);\n}\n" }, { - "__docId__": 43, + "__docId__": 44, "kind": "function", "static": true, "variation": null, @@ -863,7 +890,7 @@ "generator": false }, { - "__docId__": 44, + "__docId__": 45, "kind": "file", "static": true, "variation": null, @@ -876,7 +903,7 @@ "content": "import { BLACK , RED , uncle , grandparent } from '..' ;\nimport { insert_case1 } from './insert_case1' ;\nimport { insert_case4 } from './insert_case4' ;\n\nexport function insert_case3(n)\n{\n const u = uncle(n);\n\n if ((u !== null) && (u.color === RED)) {\n n.parent.color = BLACK;\n u.color = BLACK;\n const g = grandparent(n);\n g.color = RED;\n insert_case1(g);\n } else {\n insert_case4(n);\n }\n}\n" }, { - "__docId__": 45, + "__docId__": 46, "kind": "function", "static": true, "variation": null, @@ -901,7 +928,7 @@ "generator": false }, { - "__docId__": 46, + "__docId__": 47, "kind": "file", "static": true, "variation": null, @@ -914,7 +941,7 @@ "content": "\nimport { rotate_left , rotate_right , grandparent } from '..' ;\nimport { insert_case5 } from './insert_case5' ;\n\nexport function insert_case4(n)\n{\n const g = grandparent(n);\n\n if ((n === n.parent.right) && (n.parent === g.left)) {\n rotate_left(n.parent);\n\n /*\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n */\n\n //n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\n } else if ((n === n.parent.left) && (n.parent === g.right)) {\n rotate_right(n.parent);\n\n /*\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n */\n\n //n = n.right;\n }\n insert_case5(n);\n}\n" }, { - "__docId__": 47, + "__docId__": 48, "kind": "function", "static": true, "variation": null, @@ -939,7 +966,7 @@ "generator": false }, { - "__docId__": 48, + "__docId__": 49, "kind": "file", "static": true, "variation": null, @@ -952,7 +979,7 @@ "content": "\nimport { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;\n\nexport function insert_case5(n)\n{\n const g = grandparent(n);\n\n n.parent.color = BLACK;\n g.color = RED;\n if (n === n.parent.left)\n rotate_right(g);\n else\n rotate_left(g);\n}\n" }, { - "__docId__": 49, + "__docId__": 50, "kind": "function", "static": true, "variation": null, @@ -977,7 +1004,7 @@ "generator": false }, { - "__docId__": 50, + "__docId__": 51, "kind": "file", "static": true, "variation": null, @@ -990,7 +1017,7 @@ "content": "import { delete_case2 } from './delete_case2' ;\n\nexport function delete_case1 ( n ) {\n\n if ( n.parent !== null ) delete_case2( n ) ;\n\n}\n" }, { - "__docId__": 51, + "__docId__": 52, "kind": "function", "static": true, "variation": null, @@ -1015,7 +1042,7 @@ "generator": false }, { - "__docId__": 52, + "__docId__": 53, "kind": "file", "static": true, "variation": null, @@ -1028,7 +1055,7 @@ "content": "import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\n\nexport function delete_case2(n)\n{\n const s = sibling(n);\n\n if (s.color === RED) {\n n.parent.color = RED;\n s.color = BLACK;\n if (n === n.parent.left)\n rotate_left(n.parent);\n else\n rotate_right(n.parent);\n }\n delete_case3(n);\n}\n" }, { - "__docId__": 53, + "__docId__": 54, "kind": "function", "static": true, "variation": null, @@ -1053,7 +1080,7 @@ "generator": false }, { - "__docId__": 54, + "__docId__": 55, "kind": "file", "static": true, "variation": null, @@ -1066,7 +1093,7 @@ "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\nexport function delete_case3(n)\n{\n const s = sibling(n);\n //console.log(n.color, n.parent.color, s.color , s.isleaf());\n\n if ((n.parent.color === BLACK) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n delete_case1(n.parent);\n }\n\n else\n delete_case4(n);\n}\n" }, { - "__docId__": 55, + "__docId__": 56, "kind": "function", "static": true, "variation": null, @@ -1091,7 +1118,7 @@ "generator": false }, { - "__docId__": 56, + "__docId__": 57, "kind": "file", "static": true, "variation": null, @@ -1104,7 +1131,7 @@ "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\nexport function delete_case4(n)\n{\n const s = sibling(n);\n //console.log( s ) ;\n\n if ((n.parent.color === RED) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n n.parent.color = BLACK;\n } else\n delete_case5(n);\n}\n" }, { - "__docId__": 57, + "__docId__": 58, "kind": "function", "static": true, "variation": null, @@ -1129,7 +1156,7 @@ "generator": false }, { - "__docId__": 58, + "__docId__": 59, "kind": "file", "static": true, "variation": null, @@ -1142,7 +1169,7 @@ "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nimport { delete_case6 } from './delete_case6' ;\n\nexport function delete_case5(n)\n{\n const s = sibling(n);\n\n if (s.color === BLACK) { /* this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). */\n/* the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. */\n if ((n === n.parent.left) &&\n (s.right.color === BLACK) &&\n (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.left.color = BLACK;\n rotate_right(s);\n } else if ((n === n.parent.right) &&\n (s.left.color === BLACK) &&\n (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.right.color = BLACK;\n rotate_left(s);\n }\n }\n delete_case6(n);\n}\n" }, { - "__docId__": 59, + "__docId__": 60, "kind": "function", "static": true, "variation": null, @@ -1167,7 +1194,7 @@ "generator": false }, { - "__docId__": 60, + "__docId__": 61, "kind": "file", "static": true, "variation": null, @@ -1180,7 +1207,7 @@ "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nexport function delete_case6(n)\n{\n const s = sibling(n);\n\n s.color = n.parent.color;\n n.parent.color = BLACK;\n\n if (n === n.parent.left) {\n s.right.color = BLACK;\n rotate_left(n.parent);\n } else {\n s.left.color = BLACK;\n rotate_right(n.parent);\n }\n}\n" }, { - "__docId__": 61, + "__docId__": 62, "kind": "function", "static": true, "variation": null, @@ -1205,7 +1232,7 @@ "generator": false }, { - "__docId__": 62, + "__docId__": 63, "kind": "file", "static": true, "variation": null, @@ -1218,7 +1245,7 @@ "content": "import { BLACK , RED } from '..' ;\n\nimport { replace_node } from './replace_node' ;\nimport { delete_case1 } from './delete_case1' ;\n\nexport function delete_one_child ( n ) {\n\n // Precondition: n has at most one non-leaf child.\n // assert( n.right.isleaf() || n.left.isleaf());\n\n // const child = n.right.isleaf() ? n.left : n.right;\n // n.right is always a LEAF because either n is a subtree predecessor or it\n // is the only child of its parent by the red-black tree properties\n const child = n.left ;\n\n replace_node(n, child);\n\n if (n.color === BLACK) {\n if (child.color === RED) child.color = BLACK;\n else delete_case1(child);\n }\n\n //else {\n // If n is RED then its child can only be BLACK. Replacing n with its\n // child suffices.\n //}\n\n}\n" }, { - "__docId__": 63, + "__docId__": 64, "kind": "function", "static": true, "variation": null, @@ -1243,7 +1270,7 @@ "generator": false }, { - "__docId__": 64, + "__docId__": 65, "kind": "file", "static": true, "variation": null, @@ -1256,7 +1283,7 @@ "content": "export * from './delete_case1' ;\nexport * from './delete_case2' ;\nexport * from './delete_case3' ;\nexport * from './delete_case4' ;\nexport * from './delete_case5' ;\nexport * from './delete_case6' ;\nexport * from './delete_one_child' ;\nexport * from './replace_node' ;\n" }, { - "__docId__": 65, + "__docId__": 66, "kind": "file", "static": true, "variation": null, @@ -1269,7 +1296,7 @@ "content": "export function replace_node ( A , B ) {\n\n\t// assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif ( A === A.parent.left ) A.parent.left = B ;\n\n\telse A.parent.right = B ;\n\n\tB.parent = A.parent ;\n\n}\n" }, { - "__docId__": 66, + "__docId__": 67, "kind": "function", "static": true, "variation": null, @@ -1300,7 +1327,7 @@ "generator": false }, { - "__docId__": 67, + "__docId__": 68, "kind": "file", "static": true, "variation": null, @@ -1313,7 +1340,7 @@ "content": "export * from './rotate_left' ;\nexport * from './rotate_right' ;\n" }, { - "__docId__": 68, + "__docId__": 69, "kind": "file", "static": true, "variation": null, @@ -1326,7 +1353,7 @@ "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" }, { - "__docId__": 69, + "__docId__": 70, "kind": "function", "static": true, "variation": null, @@ -1354,7 +1381,7 @@ "generator": false }, { - "__docId__": 70, + "__docId__": 71, "kind": "file", "static": true, "variation": null, @@ -1367,7 +1394,7 @@ "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" }, { - "__docId__": 71, + "__docId__": 72, "kind": "function", "static": true, "variation": null, @@ -1395,7 +1422,7 @@ "generator": false }, { - "__docId__": 72, + "__docId__": 73, "kind": "file", "static": true, "variation": null, @@ -1408,7 +1435,7 @@ "content": "export function find ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" }, { - "__docId__": 73, + "__docId__": 74, "kind": "function", "static": true, "variation": null, @@ -1450,7 +1477,7 @@ "generator": false }, { - "__docId__": 74, + "__docId__": 75, "kind": "file", "static": true, "variation": null, @@ -1463,7 +1490,7 @@ "content": "export * from './find' ;\n" }, { - "__docId__": 75, + "__docId__": 76, "kind": "file", "static": true, "variation": null, @@ -1476,7 +1503,7 @@ "content": "export * from './inordertraversal' ;\n" }, { - "__docId__": 76, + "__docId__": 77, "kind": "file", "static": true, "variation": null, @@ -1489,7 +1516,7 @@ "content": "export function* inordertraversal ( node ) {\n\n\tif ( !node.left.isleaf() ) {\n\t\tyield *inordertraversal( node.left );\n\t}\n\n\tyield node.value ;\n\n\tif ( !node.right.isleaf() ) {\n\t\tyield* inordertraversal( node.right );\n\t}\n\n}\n" }, { - "__docId__": 77, + "__docId__": 78, "kind": "function", "static": true, "variation": null, @@ -1514,7 +1541,7 @@ "generator": true }, { - "__docId__": 79, + "__docId__": 80, "kind": "external", "static": true, "variation": null, @@ -1527,7 +1554,7 @@ "builtinExternal": true }, { - "__docId__": 80, + "__docId__": 81, "kind": "external", "static": true, "variation": null, @@ -1540,7 +1567,7 @@ "builtinExternal": true }, { - "__docId__": 81, + "__docId__": 82, "kind": "external", "static": true, "variation": null, @@ -1553,7 +1580,7 @@ "builtinExternal": true }, { - "__docId__": 82, + "__docId__": 83, "kind": "external", "static": true, "variation": null, @@ -1566,7 +1593,7 @@ "builtinExternal": true }, { - "__docId__": 83, + "__docId__": 84, "kind": "external", "static": true, "variation": null, @@ -1579,7 +1606,7 @@ "builtinExternal": true }, { - "__docId__": 84, + "__docId__": 85, "kind": "external", "static": true, "variation": null, @@ -1592,7 +1619,7 @@ "builtinExternal": true }, { - "__docId__": 85, + "__docId__": 86, "kind": "external", "static": true, "variation": null, @@ -1605,7 +1632,7 @@ "builtinExternal": true }, { - "__docId__": 86, + "__docId__": 87, "kind": "external", "static": true, "variation": null, @@ -1618,7 +1645,7 @@ "builtinExternal": true }, { - "__docId__": 87, + "__docId__": 88, "kind": "external", "static": true, "variation": null, @@ -1631,7 +1658,7 @@ "builtinExternal": true }, { - "__docId__": 88, + "__docId__": 89, "kind": "external", "static": true, "variation": null, @@ -1644,7 +1671,7 @@ "builtinExternal": true }, { - "__docId__": 89, + "__docId__": 90, "kind": "external", "static": true, "variation": null, @@ -1657,7 +1684,7 @@ "builtinExternal": true }, { - "__docId__": 90, + "__docId__": 91, "kind": "external", "static": true, "variation": null, @@ -1670,7 +1697,7 @@ "builtinExternal": true }, { - "__docId__": 91, + "__docId__": 92, "kind": "external", "static": true, "variation": null, @@ -1683,7 +1710,7 @@ "builtinExternal": true }, { - "__docId__": 92, + "__docId__": 93, "kind": "external", "static": true, "variation": null, @@ -1696,7 +1723,7 @@ "builtinExternal": true }, { - "__docId__": 93, + "__docId__": 94, "kind": "external", "static": true, "variation": null, @@ -1709,7 +1736,7 @@ "builtinExternal": true }, { - "__docId__": 94, + "__docId__": 95, "kind": "external", "static": true, "variation": null, @@ -1722,7 +1749,7 @@ "builtinExternal": true }, { - "__docId__": 95, + "__docId__": 96, "kind": "external", "static": true, "variation": null, @@ -1735,7 +1762,7 @@ "builtinExternal": true }, { - "__docId__": 96, + "__docId__": 97, "kind": "external", "static": true, "variation": null, @@ -1748,7 +1775,7 @@ "builtinExternal": true }, { - "__docId__": 97, + "__docId__": 98, "kind": "external", "static": true, "variation": null, @@ -1761,7 +1788,7 @@ "builtinExternal": true }, { - "__docId__": 98, + "__docId__": 99, "kind": "external", "static": true, "variation": null, @@ -1774,7 +1801,7 @@ "builtinExternal": true }, { - "__docId__": 99, + "__docId__": 100, "kind": "external", "static": true, "variation": null, @@ -1787,7 +1814,7 @@ "builtinExternal": true }, { - "__docId__": 100, + "__docId__": 101, "kind": "external", "static": true, "variation": null, @@ -1800,7 +1827,7 @@ "builtinExternal": true }, { - "__docId__": 101, + "__docId__": 102, "kind": "external", "static": true, "variation": null, @@ -1813,7 +1840,7 @@ "builtinExternal": true }, { - "__docId__": 102, + "__docId__": 103, "kind": "external", "static": true, "variation": null, @@ -1826,7 +1853,7 @@ "builtinExternal": true }, { - "__docId__": 103, + "__docId__": 104, "kind": "external", "static": true, "variation": null, @@ -1839,7 +1866,7 @@ "builtinExternal": true }, { - "__docId__": 104, + "__docId__": 105, "kind": "external", "static": true, "variation": null, @@ -1852,7 +1879,7 @@ "builtinExternal": true }, { - "__docId__": 105, + "__docId__": 106, "kind": "external", "static": true, "variation": null, @@ -1865,7 +1892,7 @@ "builtinExternal": true }, { - "__docId__": 106, + "__docId__": 107, "kind": "external", "static": true, "variation": null, @@ -1878,7 +1905,7 @@ "builtinExternal": true }, { - "__docId__": 107, + "__docId__": 108, "kind": "external", "static": true, "variation": null, @@ -1891,7 +1918,7 @@ "builtinExternal": true }, { - "__docId__": 108, + "__docId__": 109, "kind": "external", "static": true, "variation": null, @@ -1904,7 +1931,7 @@ "builtinExternal": true }, { - "__docId__": 109, + "__docId__": 110, "kind": "external", "static": true, "variation": null, @@ -1917,7 +1944,7 @@ "builtinExternal": true }, { - "__docId__": 110, + "__docId__": 111, "kind": "external", "static": true, "variation": null, @@ -1930,7 +1957,7 @@ "builtinExternal": true }, { - "__docId__": 111, + "__docId__": 112, "kind": "external", "static": true, "variation": null, @@ -1943,7 +1970,7 @@ "builtinExternal": true }, { - "__docId__": 112, + "__docId__": 113, "kind": "external", "static": true, "variation": null, @@ -1956,7 +1983,7 @@ "builtinExternal": true }, { - "__docId__": 113, + "__docId__": 114, "kind": "external", "static": true, "variation": null, @@ -1969,7 +1996,7 @@ "builtinExternal": true }, { - "__docId__": 114, + "__docId__": 115, "kind": "external", "static": true, "variation": null, @@ -1982,7 +2009,7 @@ "builtinExternal": true }, { - "__docId__": 115, + "__docId__": 116, "kind": "external", "static": true, "variation": null, @@ -1995,7 +2022,7 @@ "builtinExternal": true }, { - "__docId__": 116, + "__docId__": 117, "kind": "external", "static": true, "variation": null, @@ -2008,7 +2035,7 @@ "builtinExternal": true }, { - "__docId__": 117, + "__docId__": 118, "kind": "external", "static": true, "variation": null, @@ -2021,7 +2048,7 @@ "builtinExternal": true }, { - "__docId__": 118, + "__docId__": 119, "kind": "external", "static": true, "variation": null, @@ -2034,7 +2061,7 @@ "builtinExternal": true }, { - "__docId__": 119, + "__docId__": 120, "kind": "external", "static": true, "variation": null, @@ -2047,7 +2074,7 @@ "builtinExternal": true }, { - "__docId__": 120, + "__docId__": 121, "kind": "external", "static": true, "variation": null, @@ -2060,7 +2087,7 @@ "builtinExternal": true }, { - "__docId__": 121, + "__docId__": 122, "kind": "external", "static": true, "variation": null, @@ -2073,7 +2100,7 @@ "builtinExternal": true }, { - "__docId__": 122, + "__docId__": 123, "kind": "external", "static": true, "variation": null, @@ -2086,7 +2113,7 @@ "builtinExternal": true }, { - "__docId__": 123, + "__docId__": 124, "kind": "external", "static": true, "variation": null, @@ -2099,7 +2126,7 @@ "builtinExternal": true }, { - "__docId__": 124, + "__docId__": 125, "kind": "external", "static": true, "variation": null, @@ -2112,7 +2139,7 @@ "builtinExternal": true }, { - "__docId__": 125, + "__docId__": 126, "kind": "external", "static": true, "variation": null, @@ -2125,7 +2152,7 @@ "builtinExternal": true }, { - "__docId__": 127, + "__docId__": 128, "kind": "external", "static": true, "variation": null, @@ -2138,7 +2165,7 @@ "builtinExternal": true }, { - "__docId__": 128, + "__docId__": 129, "kind": "external", "static": true, "variation": null, @@ -2151,7 +2178,7 @@ "builtinExternal": true }, { - "__docId__": 129, + "__docId__": 130, "kind": "external", "static": true, "variation": null, @@ -2164,7 +2191,7 @@ "builtinExternal": true }, { - "__docId__": 130, + "__docId__": 131, "kind": "external", "static": true, "variation": null, @@ -2177,7 +2204,7 @@ "builtinExternal": true }, { - "__docId__": 131, + "__docId__": 132, "kind": "external", "static": true, "variation": null, @@ -2190,7 +2217,7 @@ "builtinExternal": true }, { - "__docId__": 132, + "__docId__": 133, "kind": "external", "static": true, "variation": null, @@ -2203,7 +2230,7 @@ "builtinExternal": true }, { - "__docId__": 133, + "__docId__": 134, "kind": "external", "static": true, "variation": null, @@ -2216,7 +2243,7 @@ "builtinExternal": true }, { - "__docId__": 134, + "__docId__": 135, "kind": "external", "static": true, "variation": null, diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/adt/RedBlackTree.js.html index fdf2fec..255ed4c 100644 --- a/file/src/adt/RedBlackTree.js.html +++ b/file/src/adt/RedBlackTree.js.html @@ -104,7 +104,7 @@ } - delete ( node ) { + _delete ( node ) { if ( !node.left.isleaf() ) { // replace node's value with predecessor's value @@ -138,6 +138,16 @@ } + remove ( value ) { + + const node = this.find( value ) ; + if ( node === null ) return false ; + + this._delete( node ) ; + return true ; + + } + *[Symbol.iterator] ( ) { if ( this.root !== null ) yield* inordertraversal( this.root ) ; diff --git a/script/search_index.js b/script/search_index.js index 318159e..a122ecd 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -521,6 +521,12 @@ window.esdocSearchIndex = [ "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "method" ], + [ + "src/adt/redblacktree.js~redblacktree#_delete", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-_delete", + "src/adt/RedBlackTree.js~RedBlackTree#_delete", + "method" + ], [ "src/adt/redblacktree.js~redblacktree#add", "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-add", @@ -539,18 +545,18 @@ window.esdocSearchIndex = [ "src/adt/RedBlackTree.js~RedBlackTree#constructor", "method" ], - [ - "src/adt/redblacktree.js~redblacktree#delete", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-delete", - "src/adt/RedBlackTree.js~RedBlackTree#delete", - "method" - ], [ "src/adt/redblacktree.js~redblacktree#find", "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-find", "src/adt/RedBlackTree.js~RedBlackTree#find", "method" ], + [ + "src/adt/redblacktree.js~redblacktree#remove", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-remove", + "src/adt/RedBlackTree.js~RedBlackTree#remove", + "method" + ], [ "src/adt/redblacktree.js~redblacktree#root", "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-member-root", diff --git a/source.html b/source.html index bb591ac..3be5697 100644 --- a/source.html +++ b/source.html @@ -66,7 +66,7 @@
    -

    Source 2/36

    +

    Source 2/37

    @@ -87,7 +87,7 @@ - + @@ -95,15 +95,15 @@ - + - + - - - - + + + + @@ -111,7 +111,7 @@ - + @@ -119,7 +119,7 @@ - + @@ -127,7 +127,7 @@ - + @@ -135,7 +135,7 @@ - + @@ -143,7 +143,7 @@ - + @@ -151,7 +151,7 @@ - + @@ -159,7 +159,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -175,7 +175,7 @@ - + @@ -183,7 +183,7 @@ - + @@ -191,7 +191,7 @@ - + @@ -199,7 +199,7 @@ - + @@ -207,7 +207,7 @@ - + @@ -215,7 +215,7 @@ - + @@ -223,7 +223,7 @@ - + @@ -231,7 +231,7 @@ - + @@ -239,7 +239,7 @@ - + @@ -247,7 +247,7 @@ - + @@ -255,7 +255,7 @@ - + @@ -263,7 +263,7 @@ - + @@ -271,7 +271,7 @@ - + @@ -279,7 +279,7 @@ - + @@ -287,7 +287,7 @@ - + @@ -295,7 +295,7 @@ - + @@ -303,7 +303,7 @@ - + @@ -311,7 +311,7 @@ - + @@ -319,7 +319,7 @@ - + @@ -327,7 +327,7 @@ - + @@ -335,7 +335,7 @@ - + @@ -343,7 +343,7 @@ - + @@ -351,7 +351,7 @@ - + @@ -359,7 +359,7 @@ - + @@ -367,7 +367,7 @@ - + @@ -375,7 +375,7 @@ - + @@ -383,7 +383,7 @@ - +
    0 %0/1 170 byte 82016-07-06 08:32:01 (UTC)2016-07-06 08:39:57 (UTC)
    src/adt/Node.js0 %0/1 266 byte 112016-07-06 08:32:01 (UTC)2016-07-06 08:39:57 (UTC)
    src/adt/RedBlackTree.jssrc/adt/RedBlackTree.js RedBlackTree0 %0/91818 byte882016-07-06 08:33:18 (UTC)0 %0/101961 byte982016-07-06 08:51:34 (UTC)
    src/adt/index.js- 83 byte 32016-07-06 08:37:31 (UTC)2016-07-06 08:39:57 (UTC)
    src/color/BLACK.js0 %0/1 25 byte 12016-07-06 08:18:18 (UTC)2016-07-06 08:39:57 (UTC)
    src/color/RED.js0 %0/1 23 byte 12016-07-06 08:18:22 (UTC)2016-07-06 08:39:57 (UTC)
    src/color/index.js- 50 byte 22016-07-06 08:37:31 (UTC)2016-07-06 08:39:57 (UTC)
    src/debug/debug.js0 %0/1 307 byte 132016-07-06 08:33:45 (UTC)2016-07-06 08:39:57 (UTC)
    src/debug/index.js- 26 byte 12016-07-06 08:37:31 (UTC)2016-07-06 08:39:57 (UTC)
    src/family/grandparent.js0 %0/1 168 byte 72016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/family/index.js- 118 byte 42016-07-06 08:37:31 (UTC)2016-07-06 08:39:57 (UTC)
    src/family/predecessor.js0 %0/1 136 byte 92016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/family/sibling.js0 %0/1 233 byte 92016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/family/uncle.js0 %0/1 287 byte 112016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/index.js- 245 byte 92016-07-06 08:37:31 (UTC)2016-07-06 08:39:57 (UTC)
    src/insertion/index.js- 192 byte 62016-07-06 08:37:31 (UTC)2016-07-06 08:39:57 (UTC)
    src/insertion/insert.js0 %0/1 360 byte 382016-07-06 08:25:33 (UTC)2016-07-06 08:39:57 (UTC)
    src/insertion/insert_case1.js0 %0/1 183 byte 112016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/insertion/insert_case2.js0 %0/1 207 byte 112016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/insertion/insert_case3.js0 %0/1 395 byte 182016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/insertion/insert_case4.js0 %0/1 922 byte 412016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/insertion/insert_case5.js0 %0/1 254 byte 142016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/removal/delete_case1.js0 %0/1 139 byte 72016-07-06 08:35:27 (UTC)2016-07-06 08:39:57 (UTC)
    src/removal/delete_case2.js0 %0/1 359 byte 182016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/removal/delete_case3.js0 %0/1 468 byte 212016-07-06 08:35:34 (UTC)2016-07-06 08:39:57 (UTC)
    src/removal/delete_case4.js0 %0/1 375 byte 182016-07-06 08:15:09 (UTC)2016-07-06 08:39:57 (UTC)
    src/removal/delete_case5.js0 %0/1 1032 byte 292016-07-06 08:35:38 (UTC)2016-07-06 08:39:57 (UTC)
    src/removal/delete_case6.js0 %0/1 329 byte 172016-07-06 08:35:42 (UTC)2016-07-06 08:39:58 (UTC)
    src/removal/delete_one_child.js0 %0/1 802 byte 282016-07-06 08:35:45 (UTC)2016-07-06 08:39:58 (UTC)
    src/removal/index.js- 268 byte 82016-07-06 08:37:31 (UTC)2016-07-06 08:39:58 (UTC)
    src/removal/replace_node.js0 %0/1 243 byte 122016-07-06 08:26:26 (UTC)2016-07-06 08:39:58 (UTC)
    src/rotate/index.js- 65 byte 22016-07-06 08:37:31 (UTC)2016-07-06 08:39:58 (UTC)
    src/rotate/rotate_left.js100 %1/1 589 byte 352016-07-06 08:37:13 (UTC)2016-07-06 08:39:58 (UTC)
    src/rotate/rotate_right.js100 %1/1 599 byte 362016-07-06 08:37:17 (UTC)2016-07-06 08:39:58 (UTC)
    src/search/find.js0 %0/1 351 byte 282016-07-06 08:36:09 (UTC)2016-07-06 08:39:58 (UTC)
    src/search/index.js- 25 byte 12016-07-06 08:37:31 (UTC)2016-07-06 08:39:58 (UTC)
    src/traversal/index.js- 37 byte 12016-07-06 08:37:31 (UTC)2016-07-06 08:39:58 (UTC)
    src/traversal/inordertraversal.js0 %0/1 219 byte 132016-07-06 08:36:15 (UTC)2016-07-06 08:39:58 (UTC)
    From 868ed6ecbe0eedfae8c5f0b218f77596aa475dfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Fri, 22 Jul 2016 10:59:26 +0200 Subject: [PATCH 07/26] esdoc update --- source.html | 76 ++++++++++++++++++++++++++--------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/source.html b/source.html index 3be5697..9f25a84 100644 --- a/source.html +++ b/source.html @@ -87,7 +87,7 @@ 0 %0/1 170 byte 8 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/adt/Node.js @@ -95,7 +95,7 @@ 0 %0/1 266 byte 11 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/adt/RedBlackTree.js @@ -103,7 +103,7 @@ 0 %0/10 1961 byte 98 - 2016-07-06 08:51:34 (UTC) + 2016-07-06 08:55:01 (UTC) src/adt/index.js @@ -111,7 +111,7 @@ - 83 byte 3 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/color/BLACK.js @@ -119,7 +119,7 @@ 0 %0/1 25 byte 1 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/color/RED.js @@ -127,7 +127,7 @@ 0 %0/1 23 byte 1 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/color/index.js @@ -135,7 +135,7 @@ - 50 byte 2 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/debug/debug.js @@ -143,7 +143,7 @@ 0 %0/1 307 byte 13 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/debug/index.js @@ -151,7 +151,7 @@ - 26 byte 1 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/family/grandparent.js @@ -159,7 +159,7 @@ 0 %0/1 168 byte 7 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/family/index.js @@ -167,7 +167,7 @@ - 118 byte 4 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/family/predecessor.js @@ -175,7 +175,7 @@ 0 %0/1 136 byte 9 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/family/sibling.js @@ -183,7 +183,7 @@ 0 %0/1 233 byte 9 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/family/uncle.js @@ -191,7 +191,7 @@ 0 %0/1 287 byte 11 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/index.js @@ -199,7 +199,7 @@ - 245 byte 9 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/insertion/index.js @@ -207,7 +207,7 @@ - 192 byte 6 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/insertion/insert.js @@ -215,7 +215,7 @@ 0 %0/1 360 byte 38 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/insertion/insert_case1.js @@ -223,7 +223,7 @@ 0 %0/1 183 byte 11 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/insertion/insert_case2.js @@ -231,7 +231,7 @@ 0 %0/1 207 byte 11 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/insertion/insert_case3.js @@ -239,7 +239,7 @@ 0 %0/1 395 byte 18 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/insertion/insert_case4.js @@ -247,7 +247,7 @@ 0 %0/1 922 byte 41 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/insertion/insert_case5.js @@ -255,7 +255,7 @@ 0 %0/1 254 byte 14 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/delete_case1.js @@ -263,7 +263,7 @@ 0 %0/1 139 byte 7 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/delete_case2.js @@ -271,7 +271,7 @@ 0 %0/1 359 byte 18 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/delete_case3.js @@ -279,7 +279,7 @@ 0 %0/1 468 byte 21 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/delete_case4.js @@ -287,7 +287,7 @@ 0 %0/1 375 byte 18 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/delete_case5.js @@ -295,7 +295,7 @@ 0 %0/1 1032 byte 29 - 2016-07-06 08:39:57 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/delete_case6.js @@ -303,7 +303,7 @@ 0 %0/1 329 byte 17 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/delete_one_child.js @@ -311,7 +311,7 @@ 0 %0/1 802 byte 28 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/index.js @@ -319,7 +319,7 @@ - 268 byte 8 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/removal/replace_node.js @@ -327,7 +327,7 @@ 0 %0/1 243 byte 12 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/rotate/index.js @@ -335,7 +335,7 @@ - 65 byte 2 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/rotate/rotate_left.js @@ -343,7 +343,7 @@ 100 %1/1 589 byte 35 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/rotate/rotate_right.js @@ -351,7 +351,7 @@ 100 %1/1 599 byte 36 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/search/find.js @@ -359,7 +359,7 @@ 0 %0/1 351 byte 28 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/search/index.js @@ -367,7 +367,7 @@ - 25 byte 1 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/traversal/index.js @@ -375,7 +375,7 @@ - 37 byte 1 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) src/traversal/inordertraversal.js @@ -383,7 +383,7 @@ 0 %0/1 219 byte 13 - 2016-07-06 08:39:58 (UTC) + 2016-07-06 08:55:01 (UTC) From 4715980f4accbcc15397f49a14e96c3ffe950cf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Fri, 22 Jul 2016 12:40:20 +0200 Subject: [PATCH 08/26] esdoc update --- ast/source/adt/RedBlackTree.js.json | 4069 +++++++++++------ ast/source/search/index.js.json | 16 +- .../search/{find.js.json => search.js.json} | 238 +- ast/source/traversal/index.js.json | 42 +- ast/source/traversal/rangetraversal.js.json | 1944 ++++++++ badge.svg | 4 +- .../src/adt/RedBlackTree.js~RedBlackTree.html | 371 +- coverage.json | 41 +- dump.json | 456 +- file/src/adt/Leaf.js.html | 3 +- file/src/adt/Node.js.html | 3 +- file/src/adt/RedBlackTree.js.html | 35 +- file/src/adt/index.js.html | 3 +- file/src/color/BLACK.js.html | 3 +- file/src/color/RED.js.html | 3 +- file/src/color/index.js.html | 3 +- file/src/debug/debug.js.html | 3 +- file/src/debug/index.js.html | 3 +- file/src/family/grandparent.js.html | 3 +- file/src/family/index.js.html | 3 +- file/src/family/predecessor.js.html | 3 +- file/src/family/sibling.js.html | 3 +- file/src/family/uncle.js.html | 3 +- file/src/index.js.html | 3 +- file/src/insertion/index.js.html | 3 +- file/src/insertion/insert.js.html | 3 +- file/src/insertion/insert_case1.js.html | 3 +- file/src/insertion/insert_case2.js.html | 3 +- file/src/insertion/insert_case3.js.html | 3 +- file/src/insertion/insert_case4.js.html | 3 +- file/src/insertion/insert_case5.js.html | 3 +- file/src/removal/delete_case1.js.html | 3 +- file/src/removal/delete_case2.js.html | 3 +- file/src/removal/delete_case3.js.html | 3 +- file/src/removal/delete_case4.js.html | 3 +- file/src/removal/delete_case5.js.html | 3 +- file/src/removal/delete_case6.js.html | 3 +- file/src/removal/delete_one_child.js.html | 3 +- file/src/removal/index.js.html | 3 +- file/src/removal/replace_node.js.html | 3 +- file/src/rotate/index.js.html | 3 +- file/src/rotate/rotate_left.js.html | 3 +- file/src/rotate/rotate_right.js.html | 3 +- file/src/search/index.js.html | 5 +- .../search/{find.js.html => search.js.html} | 9 +- file/src/traversal/index.js.html | 4 +- file/src/traversal/inordertraversal.js.html | 3 +- file/src/traversal/rangetraversal.js.html | 102 + function/index.html | 278 +- identifiers.html | 48 +- index.html | 3 +- package.json | 2 +- script/search_index.js | 66 +- source.html | 117 +- variable/index.html | 3 +- 55 files changed, 6041 insertions(+), 1914 deletions(-) rename ast/source/search/{find.js.json => search.js.json} (89%) create mode 100644 ast/source/traversal/rangetraversal.js.json rename file/src/search/{find.js.html => search.js.html} (94%) create mode 100644 file/src/traversal/rangetraversal.js.html diff --git a/ast/source/adt/RedBlackTree.js.json b/ast/source/adt/RedBlackTree.js.json index af45926..bc8f5a2 100644 --- a/ast/source/adt/RedBlackTree.js.json +++ b/ast/source/adt/RedBlackTree.js.json @@ -569,10 +569,10 @@ "type": "ImportSpecifier", "local": { "type": "Identifier", - "name": "find", + "name": "search", "range": [ 197, - 201 + 203 ], "loc": { "start": { @@ -581,16 +581,16 @@ }, "end": { "line": 7, - "column": 13 + "column": 15 } } }, "imported": { "type": "Identifier", - "name": "find", + "name": "search", "range": [ 197, - 201 + 203 ], "loc": { "start": { @@ -599,13 +599,13 @@ }, "end": { "line": 7, - "column": 13 + "column": 15 } } }, "range": [ 197, - 201 + 203 ], "loc": { "start": { @@ -614,7 +614,7 @@ }, "end": { "line": 7, - "column": 13 + "column": 15 } } } @@ -624,23 +624,23 @@ "value": "..", "raw": "'..'", "range": [ - 209, - 213 + 211, + 215 ], "loc": { "start": { "line": 7, - "column": 21 + "column": 23 }, "end": { "line": 7, - "column": 25 + "column": 27 } } }, "range": [ 188, - 215 + 217 ], "loc": { "start": { @@ -649,7 +649,7 @@ }, "end": { "line": 7, - "column": 27 + "column": 29 } } }, @@ -662,8 +662,8 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 225, - 241 + 227, + 243 ], "loc": { "start": { @@ -680,8 +680,8 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 225, - 241 + 227, + 243 ], "loc": { "start": { @@ -695,8 +695,8 @@ } }, "range": [ - 225, - 241 + 227, + 243 ], "loc": { "start": { @@ -708,6 +708,59 @@ "column": 25 } } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rangetraversal", + "range": [ + 246, + 260 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rangetraversal", + "range": [ + 246, + 260 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + "range": [ + 246, + 260 + ], + "loc": { + "start": { + "line": 8, + "column": 28 + }, + "end": { + "line": 8, + "column": 42 + } + } } ], "source": { @@ -715,23 +768,23 @@ "value": "..", "raw": "'..'", "range": [ - 249, - 253 + 268, + 272 ], "loc": { "start": { "line": 8, - "column": 33 + "column": 50 }, "end": { "line": 8, - "column": 37 + "column": 54 } } }, "range": [ - 216, - 255 + 218, + 274 ], "loc": { "start": { @@ -740,7 +793,7 @@ }, "end": { "line": 8, - "column": 39 + "column": 56 } } }, @@ -752,8 +805,8 @@ "type": "Identifier", "name": "RedBlackTree", "range": [ - 270, - 282 + 289, + 301 ], "loc": { "start": { @@ -776,8 +829,8 @@ "type": "Identifier", "name": "constructor", "range": [ - 287, - 298 + 306, + 317 ], "loc": { "start": { @@ -798,8 +851,8 @@ "type": "Identifier", "name": "compare", "range": [ - 301, - 308 + 320, + 327 ], "loc": { "start": { @@ -827,8 +880,8 @@ "object": { "type": "ThisExpression", "range": [ - 316, - 320 + 335, + 339 ], "loc": { "start": { @@ -845,8 +898,8 @@ "type": "Identifier", "name": "compare", "range": [ - 321, - 328 + 340, + 347 ], "loc": { "start": { @@ -860,8 +913,8 @@ } }, "range": [ - 316, - 328 + 335, + 347 ], "loc": { "start": { @@ -878,8 +931,8 @@ "type": "Identifier", "name": "compare", "range": [ - 331, - 338 + 350, + 357 ], "loc": { "start": { @@ -893,8 +946,8 @@ } }, "range": [ - 316, - 338 + 335, + 357 ], "loc": { "start": { @@ -908,8 +961,8 @@ } }, "range": [ - 316, - 340 + 335, + 359 ], "loc": { "start": { @@ -933,8 +986,8 @@ "object": { "type": "ThisExpression", "range": [ - 343, - 347 + 362, + 366 ], "loc": { "start": { @@ -951,8 +1004,8 @@ "type": "Identifier", "name": "root", "range": [ - 348, - 352 + 367, + 371 ], "loc": { "start": { @@ -966,8 +1019,8 @@ } }, "range": [ - 343, - 352 + 362, + 371 ], "loc": { "start": { @@ -985,8 +1038,8 @@ "value": null, "raw": "null", "range": [ - 355, - 359 + 374, + 378 ], "loc": { "start": { @@ -1000,8 +1053,8 @@ } }, "range": [ - 343, - 359 + 362, + 378 ], "loc": { "start": { @@ -1015,8 +1068,8 @@ } }, "range": [ - 343, - 361 + 362, + 380 ], "loc": { "start": { @@ -1031,8 +1084,8 @@ } ], "range": [ - 311, - 365 + 330, + 384 ], "loc": { "start": { @@ -1048,8 +1101,8 @@ "generator": false, "expression": false, "range": [ - 299, - 365 + 318, + 384 ], "loc": { "start": { @@ -1065,8 +1118,8 @@ "kind": "constructor", "computed": false, "range": [ - 287, - 365 + 306, + 384 ], "loc": { "start": { @@ -1086,8 +1139,8 @@ "type": "Identifier", "name": "add", "range": [ - 368, - 371 + 387, + 390 ], "loc": { "start": { @@ -1108,8 +1161,8 @@ "type": "Identifier", "name": "value", "range": [ - 374, - 379 + 393, + 398 ], "loc": { "start": { @@ -1137,8 +1190,8 @@ "object": { "type": "ThisExpression", "range": [ - 391, - 395 + 410, + 414 ], "loc": { "start": { @@ -1155,8 +1208,8 @@ "type": "Identifier", "name": "root", "range": [ - 396, - 400 + 415, + 419 ], "loc": { "start": { @@ -1170,8 +1223,8 @@ } }, "range": [ - 391, - 400 + 410, + 419 ], "loc": { "start": { @@ -1189,8 +1242,8 @@ "value": null, "raw": "null", "range": [ - 405, - 409 + 424, + 428 ], "loc": { "start": { @@ -1204,8 +1257,8 @@ } }, "range": [ - 391, - 409 + 410, + 428 ], "loc": { "start": { @@ -1232,8 +1285,8 @@ "object": { "type": "ThisExpression", "range": [ - 417, - 421 + 436, + 440 ], "loc": { "start": { @@ -1250,8 +1303,8 @@ "type": "Identifier", "name": "root", "range": [ - 422, - 426 + 441, + 445 ], "loc": { "start": { @@ -1265,8 +1318,8 @@ } }, "range": [ - 417, - 426 + 436, + 445 ], "loc": { "start": { @@ -1285,8 +1338,8 @@ "type": "Identifier", "name": "Node", "range": [ - 433, - 437 + 452, + 456 ], "loc": { "start": { @@ -1304,8 +1357,8 @@ "type": "Identifier", "name": "BLACK", "range": [ - 439, - 444 + 458, + 463 ], "loc": { "start": { @@ -1322,8 +1375,8 @@ "type": "Identifier", "name": "value", "range": [ - 447, - 452 + 466, + 471 ], "loc": { "start": { @@ -1338,8 +1391,8 @@ } ], "range": [ - 429, - 454 + 448, + 473 ], "loc": { "start": { @@ -1353,8 +1406,8 @@ } }, "range": [ - 417, - 454 + 436, + 473 ], "loc": { "start": { @@ -1368,8 +1421,8 @@ } }, "range": [ - 417, - 456 + 436, + 475 ], "loc": { "start": { @@ -1384,8 +1437,8 @@ } ], "range": [ - 412, - 460 + 431, + 479 ], "loc": { "start": { @@ -1410,8 +1463,8 @@ "type": "Identifier", "name": "node", "range": [ - 479, - 483 + 498, + 502 ], "loc": { "start": { @@ -1430,8 +1483,8 @@ "type": "Identifier", "name": "Node", "range": [ - 490, - 494 + 509, + 513 ], "loc": { "start": { @@ -1449,8 +1502,8 @@ "type": "Identifier", "name": "RED", "range": [ - 496, - 499 + 515, + 518 ], "loc": { "start": { @@ -1467,8 +1520,8 @@ "type": "Identifier", "name": "value", "range": [ - 502, - 507 + 521, + 526 ], "loc": { "start": { @@ -1483,8 +1536,8 @@ } ], "range": [ - 486, - 509 + 505, + 528 ], "loc": { "start": { @@ -1498,8 +1551,8 @@ } }, "range": [ - 479, - 509 + 498, + 528 ], "loc": { "start": { @@ -1515,8 +1568,8 @@ ], "kind": "const", "range": [ - 473, - 511 + 492, + 530 ], "loc": { "start": { @@ -1537,8 +1590,8 @@ "type": "Identifier", "name": "insert", "range": [ - 515, - 521 + 534, + 540 ], "loc": { "start": { @@ -1558,8 +1611,8 @@ "object": { "type": "ThisExpression", "range": [ - 523, - 527 + 542, + 546 ], "loc": { "start": { @@ -1576,8 +1629,8 @@ "type": "Identifier", "name": "compare", "range": [ - 528, - 535 + 547, + 554 ], "loc": { "start": { @@ -1591,8 +1644,8 @@ } }, "range": [ - 523, - 535 + 542, + 554 ], "loc": { "start": { @@ -1611,8 +1664,8 @@ "object": { "type": "ThisExpression", "range": [ - 538, - 542 + 557, + 561 ], "loc": { "start": { @@ -1629,8 +1682,8 @@ "type": "Identifier", "name": "root", "range": [ - 543, - 547 + 562, + 566 ], "loc": { "start": { @@ -1644,8 +1697,8 @@ } }, "range": [ - 538, - 547 + 557, + 566 ], "loc": { "start": { @@ -1662,8 +1715,8 @@ "type": "Identifier", "name": "node", "range": [ - 550, - 554 + 569, + 573 ], "loc": { "start": { @@ -1678,8 +1731,8 @@ } ], "range": [ - 515, - 556 + 534, + 575 ], "loc": { "start": { @@ -1693,8 +1746,8 @@ } }, "range": [ - 515, - 558 + 534, + 577 ], "loc": { "start": { @@ -1715,8 +1768,8 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 562, - 574 + 581, + 593 ], "loc": { "start": { @@ -1734,8 +1787,8 @@ "type": "Identifier", "name": "node", "range": [ - 576, - 580 + 595, + 599 ], "loc": { "start": { @@ -1750,8 +1803,8 @@ } ], "range": [ - 562, - 582 + 581, + 601 ], "loc": { "start": { @@ -1765,8 +1818,8 @@ } }, "range": [ - 562, - 584 + 581, + 603 ], "loc": { "start": { @@ -1781,8 +1834,8 @@ } ], "range": [ - 468, - 588 + 487, + 607 ], "loc": { "start": { @@ -1796,8 +1849,8 @@ } }, "range": [ - 386, - 588 + 405, + 607 ], "loc": { "start": { @@ -1812,8 +1865,8 @@ } ], "range": [ - 382, - 591 + 401, + 610 ], "loc": { "start": { @@ -1829,8 +1882,8 @@ "generator": false, "expression": false, "range": [ - 372, - 591 + 391, + 610 ], "loc": { "start": { @@ -1846,8 +1899,8 @@ "kind": "method", "computed": false, "range": [ - 368, - 591 + 387, + 610 ], "loc": { "start": { @@ -1865,10 +1918,10 @@ "type": "MethodDefinition", "key": { "type": "Identifier", - "name": "find", + "name": "_search", "range": [ - 594, - 598 + 613, + 620 ], "loc": { "start": { @@ -1877,7 +1930,7 @@ }, "end": { "line": 30, - "column": 5 + "column": 8 } } }, @@ -1889,17 +1942,17 @@ "type": "Identifier", "name": "value", "range": [ - 601, - 606 + 623, + 628 ], "loc": { "start": { "line": 30, - "column": 8 + "column": 11 }, "end": { "line": 30, - "column": 13 + "column": 16 } } } @@ -1918,16 +1971,16 @@ "object": { "type": "ThisExpression", "range": [ - 619, - 623 + 640, + 644 ], "loc": { "start": { - "line": 32, + "line": 31, "column": 7 }, "end": { - "line": 32, + "line": 31, "column": 11 } } @@ -1936,31 +1989,31 @@ "type": "Identifier", "name": "root", "range": [ - 624, - 628 + 645, + 649 ], "loc": { "start": { - "line": 32, + "line": 31, "column": 12 }, "end": { - "line": 32, + "line": 31, "column": 16 } } }, "range": [ - 619, - 628 + 640, + 649 ], "loc": { "start": { - "line": 32, + "line": 31, "column": 7 }, "end": { - "line": 32, + "line": 31, "column": 16 } } @@ -1970,31 +2023,31 @@ "value": null, "raw": "null", "range": [ - 633, - 637 + 654, + 658 ], "loc": { "start": { - "line": 32, + "line": 31, "column": 21 }, "end": { - "line": 32, + "line": 31, "column": 25 } } }, "range": [ - 619, - 637 + 640, + 658 ], "loc": { "start": { - "line": 32, + "line": 31, "column": 7 }, "end": { - "line": 32, + "line": 31, "column": 25 } } @@ -2006,47 +2059,47 @@ "value": null, "raw": "null", "range": [ - 647, - 651 + 668, + 672 ], "loc": { "start": { - "line": 32, + "line": 31, "column": 35 }, "end": { - "line": 32, + "line": 31, "column": 39 } } }, "range": [ - 640, - 653 + 661, + 674 ], "loc": { "start": { - "line": 32, + "line": 31, "column": 28 }, "end": { - "line": 32, + "line": 31, "column": 41 } } }, "alternate": null, "range": [ - 614, - 653 + 635, + 674 ], "loc": { "start": { - "line": 32, + "line": 31, "column": 2 }, "end": { - "line": 32, + "line": 31, "column": 41 } } @@ -2057,19 +2110,19 @@ "type": "CallExpression", "callee": { "type": "Identifier", - "name": "find", + "name": "search", "range": [ - 664, - 668 + 684, + 690 ], "loc": { "start": { - "line": 34, + "line": 32, "column": 9 }, "end": { - "line": 34, - "column": 13 + "line": 32, + "column": 15 } } }, @@ -2080,17 +2133,17 @@ "object": { "type": "ThisExpression", "range": [ - 670, - 674 + 692, + 696 ], "loc": { "start": { - "line": 34, - "column": 15 + "line": 32, + "column": 17 }, "end": { - "line": 34, - "column": 19 + "line": 32, + "column": 21 } } }, @@ -2098,32 +2151,32 @@ "type": "Identifier", "name": "compare", "range": [ - 675, - 682 + 697, + 704 ], "loc": { "start": { - "line": 34, - "column": 20 + "line": 32, + "column": 22 }, "end": { - "line": 34, - "column": 27 + "line": 32, + "column": 29 } } }, "range": [ - 670, - 682 + 692, + 704 ], "loc": { "start": { - "line": 34, - "column": 15 + "line": 32, + "column": 17 }, "end": { - "line": 34, - "column": 27 + "line": 32, + "column": 29 } } }, @@ -2133,17 +2186,17 @@ "object": { "type": "ThisExpression", "range": [ - 685, - 689 + 707, + 711 ], "loc": { "start": { - "line": 34, - "column": 30 + "line": 32, + "column": 32 }, "end": { - "line": 34, - "column": 34 + "line": 32, + "column": 36 } } }, @@ -2151,32 +2204,32 @@ "type": "Identifier", "name": "root", "range": [ - 690, - 694 + 712, + 716 ], "loc": { "start": { - "line": 34, - "column": 35 + "line": 32, + "column": 37 }, "end": { - "line": 34, - "column": 39 + "line": 32, + "column": 41 } } }, "range": [ - 685, - 694 + 707, + 716 ], "loc": { "start": { - "line": 34, - "column": 30 + "line": 32, + "column": 32 }, "end": { - "line": 34, - "column": 39 + "line": 32, + "column": 41 } } }, @@ -2184,63 +2237,63 @@ "type": "Identifier", "name": "value", "range": [ - 697, - 702 + 719, + 724 ], "loc": { "start": { - "line": 34, - "column": 42 + "line": 32, + "column": 44 }, "end": { - "line": 34, - "column": 47 + "line": 32, + "column": 49 } } } ], "range": [ - 664, - 704 + 684, + 726 ], "loc": { "start": { - "line": 34, + "line": 32, "column": 9 }, "end": { - "line": 34, - "column": 49 + "line": 32, + "column": 51 } } }, "range": [ - 657, - 706 + 677, + 728 ], "loc": { "start": { - "line": 34, + "line": 32, "column": 2 }, "end": { - "line": 34, - "column": 51 + "line": 32, + "column": 53 } } } ], "range": [ - 609, - 710 + 631, + 731 ], "loc": { "start": { "line": 30, - "column": 16 + "column": 19 }, "end": { - "line": 36, + "line": 33, "column": 2 } } @@ -2248,16 +2301,16 @@ "generator": false, "expression": false, "range": [ - 599, - 710 + 621, + 731 ], "loc": { "start": { "line": 30, - "column": 6 + "column": 9 }, "end": { - "line": 36, + "line": 33, "column": 2 } } @@ -2265,8 +2318,8 @@ "kind": "method", "computed": false, "range": [ - 594, - 710 + 613, + 731 ], "loc": { "start": { @@ -2274,7 +2327,7 @@ "column": 1 }, "end": { - "line": 36, + "line": 33, "column": 2 } }, @@ -2284,19 +2337,19 @@ "type": "MethodDefinition", "key": { "type": "Identifier", - "name": "_delete", + "name": "get", "range": [ - 713, - 720 + 734, + 737 ], "loc": { "start": { - "line": 38, + "line": 35, "column": 1 }, "end": { - "line": 38, - "column": 8 + "line": 35, + "column": 4 } } }, @@ -2306,19 +2359,19 @@ "params": [ { "type": "Identifier", - "name": "node", + "name": "value", "range": [ - 723, - 727 + 740, + 745 ], "loc": { "start": { - "line": 38, - "column": 11 + "line": 35, + "column": 7 }, "end": { - "line": 38, - "column": 15 + "line": 35, + "column": 12 } } } @@ -2327,156 +2380,801 @@ "type": "BlockStatement", "body": [ { - "type": "IfStatement", - "test": { - "type": "UnaryExpression", - "operator": "!", - "argument": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "node", + "range": [ + 758, + 762 + ], + "loc": { + "start": { + "line": 36, + "column": 8 + }, + "end": { + "line": 36, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { "type": "MemberExpression", "computed": false, "object": { - "type": "Identifier", - "name": "node", + "type": "ThisExpression", "range": [ - 741, - 745 + 765, + 769 ], "loc": { "start": { - "line": 40, - "column": 8 + "line": 36, + "column": 15 }, "end": { - "line": 40, - "column": 12 + "line": 36, + "column": 19 } } }, "property": { "type": "Identifier", - "name": "left", + "name": "_search", "range": [ - 746, - 750 + 770, + 777 ], "loc": { "start": { - "line": 40, - "column": 13 + "line": 36, + "column": 20 }, "end": { - "line": 40, - "column": 17 + "line": 36, + "column": 27 } } }, "range": [ - 741, - 750 + 765, + 777 ], "loc": { "start": { - "line": 40, - "column": 8 + "line": 36, + "column": 15 }, "end": { - "line": 40, - "column": 17 + "line": 36, + "column": 27 } } }, - "property": { - "type": "Identifier", - "name": "isleaf", - "range": [ - 751, - 757 - ], - "loc": { - "start": { - "line": 40, - "column": 18 - }, - "end": { - "line": 40, - "column": 24 + "arguments": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 779, + 784 + ], + "loc": { + "start": { + "line": 36, + "column": 29 + }, + "end": { + "line": 36, + "column": 34 + } } } - }, + ], "range": [ - 741, - 757 + 765, + 786 ], "loc": { "start": { - "line": 40, - "column": 8 + "line": 36, + "column": 15 }, "end": { - "line": 40, - "column": 24 + "line": 36, + "column": 36 } } }, - "arguments": [], "range": [ - 741, - 759 + 758, + 786 ], "loc": { "start": { - "line": 40, + "line": 36, "column": 8 }, "end": { - "line": 40, - "column": 26 + "line": 36, + "column": 36 } } + } + ], + "kind": "const", + "range": [ + 752, + 788 + ], + "loc": { + "start": { + "line": 36, + "column": 2 }, - "prefix": true, - "range": [ - 740, - 759 - ], - "loc": { - "start": { - "line": 40, - "column": 7 + "end": { + "line": 36, + "column": 38 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "ConditionalExpression", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "node", + "range": [ + 798, + 802 + ], + "loc": { + "start": { + "line": 37, + "column": 9 + }, + "end": { + "line": 37, + "column": 13 + } + } }, - "end": { - "line": 40, - "column": 26 + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 807, + 811 + ], + "loc": { + "start": { + "line": 37, + "column": 18 + }, + "end": { + "line": 37, + "column": 22 + } + } + }, + "range": [ + 798, + 811 + ], + "loc": { + "start": { + "line": 37, + "column": 9 + }, + "end": { + "line": 37, + "column": 22 + } } - } - }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ + }, + "consequent": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 814, + 818 + ], + "loc": { + "start": { + "line": 37, + "column": 25 + }, + "end": { + "line": 37, + "column": 29 + } + } + }, + "alternate": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 821, + 825 + ], + "loc": { + "start": { + "line": 37, + "column": 32 + }, + "end": { + "line": 37, + "column": 36 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 826, + 831 + ], + "loc": { + "start": { + "line": 37, + "column": 37 + }, + "end": { + "line": 37, + "column": 42 + } + } + }, + "range": [ + 821, + 831 + ], + "loc": { + "start": { + "line": 37, + "column": 32 + }, + "end": { + "line": 37, + "column": 42 + } + } + }, + "range": [ + 798, + 831 + ], + "loc": { + "start": { + "line": 37, + "column": 9 + }, + "end": { + "line": 37, + "column": 42 + } + } + }, + "range": [ + 791, + 833 + ], + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 37, + "column": 44 + } + } + } + ], + "range": [ + 748, + 836 + ], + "loc": { + "start": { + "line": 35, + "column": 15 + }, + "end": { + "line": 38, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 738, + 836 + ], + "loc": { + "start": { + "line": 35, + "column": 5 + }, + "end": { + "line": 38, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 734, + 836 + ], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 38, + "column": 2 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "has", + "range": [ + 839, + 842 + ], + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 845, + 850 + ], + "loc": { + "start": { + "line": 40, + "column": 7 + }, + "end": { + "line": 40, + "column": 12 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 864, + 868 + ], + "loc": { + "start": { + "line": 41, + "column": 9 + }, + "end": { + "line": 41, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "_search", + "range": [ + 869, + 876 + ], + "loc": { + "start": { + "line": 41, + "column": 14 + }, + "end": { + "line": 41, + "column": 21 + } + } + }, + "range": [ + 864, + 876 + ], + "loc": { + "start": { + "line": 41, + "column": 9 + }, + "end": { + "line": 41, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 878, + 883 + ], + "loc": { + "start": { + "line": 41, + "column": 23 + }, + "end": { + "line": 41, + "column": 28 + } + } + } + ], + "range": [ + 864, + 885 + ], + "loc": { + "start": { + "line": 41, + "column": 9 + }, + "end": { + "line": 41, + "column": 30 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 890, + 894 + ], + "loc": { + "start": { + "line": 41, + "column": 35 + }, + "end": { + "line": 41, + "column": 39 + } + } + }, + "range": [ + 864, + 894 + ], + "loc": { + "start": { + "line": 41, + "column": 9 + }, + "end": { + "line": 41, + "column": 39 + } + } + }, + "range": [ + 857, + 896 + ], + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 41 + } + } + } + ], + "range": [ + 853, + 899 + ], + "loc": { + "start": { + "line": 40, + "column": 15 + }, + "end": { + "line": 42, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 843, + 899 + ], + "loc": { + "start": { + "line": 40, + "column": 5 + }, + "end": { + "line": 42, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 839, + 899 + ], + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 42, + "column": 2 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_delete", + "range": [ + 902, + 909 + ], + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 8 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 912, + 916 + ], + "loc": { + "start": { + "line": 44, + "column": 11 + }, + "end": { + "line": 44, + "column": 15 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 930, + 934 + ], + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 935, + 939 + ], + "loc": { + "start": { + "line": 46, + "column": 13 + }, + "end": { + "line": 46, + "column": 17 + } + } + }, + "range": [ + 930, + 939 + ], + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 940, + 946 + ], + "loc": { + "start": { + "line": 46, + "column": 18 + }, + "end": { + "line": 46, + "column": 24 + } + } + }, + "range": [ + 930, + 946 + ], + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 930, + 948 + ], + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 26 + } + } + }, + "prefix": true, + "range": [ + 929, + 948 + ], + "loc": { + "start": { + "line": 46, + "column": 7 + }, + "end": { + "line": 46, + "column": 26 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "pred", "range": [ - 825, - 829 + 1014, + 1018 ], "loc": { "start": { - "line": 42, + "line": 48, "column": 9 }, "end": { - "line": 42, + "line": 48, "column": 13 } } @@ -2487,16 +3185,16 @@ "type": "Identifier", "name": "predecessor", "range": [ - 832, - 843 + 1021, + 1032 ], "loc": { "start": { - "line": 42, + "line": 48, "column": 16 }, "end": { - "line": 42, + "line": 48, "column": 27 } } @@ -2506,47 +3204,47 @@ "type": "Identifier", "name": "node", "range": [ - 845, - 849 + 1034, + 1038 ], "loc": { "start": { - "line": 42, + "line": 48, "column": 29 }, "end": { - "line": 42, + "line": 48, "column": 33 } } } ], "range": [ - 832, - 851 + 1021, + 1040 ], "loc": { "start": { - "line": 42, + "line": 48, "column": 16 }, "end": { - "line": 42, + "line": 48, "column": 35 } } }, "range": [ - 825, - 851 + 1014, + 1040 ], "loc": { "start": { - "line": 42, + "line": 48, "column": 9 }, "end": { - "line": 42, + "line": 48, "column": 35 } } @@ -2554,16 +3252,16 @@ ], "kind": "const", "range": [ - 819, - 853 + 1008, + 1042 ], "loc": { "start": { - "line": 42, + "line": 48, "column": 3 }, "end": { - "line": 42, + "line": 48, "column": 37 } }, @@ -2572,16 +3270,16 @@ "type": "Line", "value": " replace node's value with predecessor's value", "range": [ - 767, - 815 + 956, + 1004 ], "loc": { "start": { - "line": 41, + "line": 47, "column": 3 }, "end": { - "line": 41, + "line": 47, "column": 51 } } @@ -2600,16 +3298,16 @@ "type": "Identifier", "name": "node", "range": [ - 857, - 861 + 1046, + 1050 ], "loc": { "start": { - "line": 43, + "line": 49, "column": 3 }, "end": { - "line": 43, + "line": 49, "column": 7 } } @@ -2618,31 +3316,31 @@ "type": "Identifier", "name": "value", "range": [ - 862, - 867 + 1051, + 1056 ], "loc": { "start": { - "line": 43, + "line": 49, "column": 8 }, "end": { - "line": 43, + "line": 49, "column": 13 } } }, "range": [ - 857, - 867 + 1046, + 1056 ], "loc": { "start": { - "line": 43, + "line": 49, "column": 3 }, "end": { - "line": 43, + "line": 49, "column": 13 } } @@ -2654,16 +3352,16 @@ "type": "Identifier", "name": "pred", "range": [ - 870, - 874 + 1059, + 1063 ], "loc": { "start": { - "line": 43, + "line": 49, "column": 16 }, "end": { - "line": 43, + "line": 49, "column": 20 } } @@ -2672,61 +3370,61 @@ "type": "Identifier", "name": "value", "range": [ - 875, - 880 + 1064, + 1069 ], "loc": { "start": { - "line": 43, + "line": 49, "column": 21 }, "end": { - "line": 43, + "line": 49, "column": 26 } } }, "range": [ - 870, - 880 + 1059, + 1069 ], "loc": { "start": { - "line": 43, + "line": 49, "column": 16 }, "end": { - "line": 43, + "line": 49, "column": 26 } } }, "range": [ - 857, - 880 + 1046, + 1069 ], "loc": { "start": { - "line": 43, + "line": 49, "column": 3 }, "end": { - "line": 43, + "line": 49, "column": 26 } } }, "range": [ - 857, - 882 + 1046, + 1071 ], "loc": { "start": { - "line": 43, + "line": 49, "column": 3 }, "end": { - "line": 43, + "line": 49, "column": 28 } }, @@ -2735,16 +3433,16 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 886, - 912 + 1075, + 1101 ], "loc": { "start": { - "line": 44, + "line": 50, "column": 3 }, "end": { - "line": 44, + "line": 50, "column": 29 } } @@ -2753,16 +3451,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 916, - 967 + 1105, + 1156 ], "loc": { "start": { - "line": 45, + "line": 51, "column": 3 }, "end": { - "line": 45, + "line": 51, "column": 54 } } @@ -2771,16 +3469,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 971, - 1016 + 1160, + 1205 ], "loc": { "start": { - "line": 46, + "line": 52, "column": 3 }, "end": { - "line": 46, + "line": 52, "column": 48 } } @@ -2795,16 +3493,16 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1020, - 1036 + 1209, + 1225 ], "loc": { "start": { - "line": 47, + "line": 53, "column": 3 }, "end": { - "line": 47, + "line": 53, "column": 19 } } @@ -2814,47 +3512,47 @@ "type": "Identifier", "name": "pred", "range": [ - 1038, - 1042 + 1227, + 1231 ], "loc": { "start": { - "line": 47, + "line": 53, "column": 21 }, "end": { - "line": 47, + "line": 53, "column": 25 } } } ], "range": [ - 1020, - 1044 + 1209, + 1233 ], "loc": { "start": { - "line": 47, + "line": 53, "column": 3 }, "end": { - "line": 47, + "line": 53, "column": 27 } } }, "range": [ - 1020, - 1046 + 1209, + 1235 ], "loc": { "start": { - "line": 47, + "line": 53, "column": 3 }, "end": { - "line": 47, + "line": 53, "column": 29 } }, @@ -2863,16 +3561,16 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 886, - 912 + 1075, + 1101 ], "loc": { "start": { - "line": 44, + "line": 50, "column": 3 }, "end": { - "line": 44, + "line": 50, "column": 29 } } @@ -2881,16 +3579,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 916, - 967 + 1105, + 1156 ], "loc": { "start": { - "line": 45, + "line": 51, "column": 3 }, "end": { - "line": 45, + "line": 51, "column": 54 } } @@ -2899,16 +3597,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 971, - 1016 + 1160, + 1205 ], "loc": { "start": { - "line": 46, + "line": 52, "column": 3 }, "end": { - "line": 46, + "line": 52, "column": 48 } } @@ -2917,16 +3615,16 @@ } ], "range": [ - 762, - 1050 + 951, + 1239 ], "loc": { "start": { - "line": 40, + "line": 46, "column": 29 }, "end": { - "line": 48, + "line": 54, "column": 3 } } @@ -2948,16 +3646,16 @@ "type": "Identifier", "name": "node", "range": [ - 1065, - 1069 + 1254, + 1258 ], "loc": { "start": { - "line": 50, + "line": 56, "column": 13 }, "end": { - "line": 50, + "line": 56, "column": 17 } } @@ -2966,31 +3664,31 @@ "type": "Identifier", "name": "right", "range": [ - 1070, - 1075 + 1259, + 1264 ], "loc": { "start": { - "line": 50, + "line": 56, "column": 18 }, "end": { - "line": 50, + "line": 56, "column": 23 } } }, "range": [ - 1065, - 1075 + 1254, + 1264 ], "loc": { "start": { - "line": 50, + "line": 56, "column": 13 }, "end": { - "line": 50, + "line": 56, "column": 23 } } @@ -2999,63 +3697,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 1076, - 1082 + 1265, + 1271 ], "loc": { "start": { - "line": 50, + "line": 56, "column": 24 }, "end": { - "line": 50, + "line": 56, "column": 30 } } }, "range": [ - 1065, - 1082 + 1254, + 1271 ], "loc": { "start": { - "line": 50, + "line": 56, "column": 13 }, "end": { - "line": 50, + "line": 56, "column": 30 } } }, "arguments": [], "range": [ - 1065, - 1084 + 1254, + 1273 ], "loc": { "start": { - "line": 50, + "line": 56, "column": 13 }, "end": { - "line": 50, + "line": 56, "column": 32 } } }, "prefix": true, "range": [ - 1064, - 1084 + 1253, + 1273 ], "loc": { "start": { - "line": 50, + "line": 56, "column": 12 }, "end": { - "line": 50, + "line": 56, "column": 32 } } @@ -3072,16 +3770,16 @@ "type": "Identifier", "name": "succ", "range": [ - 1227, - 1231 + 1416, + 1420 ], "loc": { "start": { - "line": 54, + "line": 60, "column": 9 }, "end": { - "line": 54, + "line": 60, "column": 13 } } @@ -3093,16 +3791,16 @@ "type": "Identifier", "name": "node", "range": [ - 1234, - 1238 + 1423, + 1427 ], "loc": { "start": { - "line": 54, + "line": 60, "column": 16 }, "end": { - "line": 54, + "line": 60, "column": 20 } } @@ -3111,46 +3809,46 @@ "type": "Identifier", "name": "right", "range": [ - 1239, - 1244 + 1428, + 1433 ], "loc": { "start": { - "line": 54, + "line": 60, "column": 21 }, "end": { - "line": 54, + "line": 60, "column": 26 } } }, "range": [ - 1234, - 1244 + 1423, + 1433 ], "loc": { "start": { - "line": 54, + "line": 60, "column": 16 }, "end": { - "line": 54, + "line": 60, "column": 26 } } }, "range": [ - 1227, - 1244 + 1416, + 1433 ], "loc": { "start": { - "line": 54, + "line": 60, "column": 9 }, "end": { - "line": 54, + "line": 60, "column": 26 } } @@ -3158,16 +3856,16 @@ ], "kind": "const", "range": [ - 1221, - 1246 + 1410, + 1435 ], "loc": { "start": { - "line": 54, + "line": 60, "column": 3 }, "end": { - "line": 54, + "line": 60, "column": 28 } }, @@ -3176,16 +3874,16 @@ "type": "Line", "value": " replace node's value with successor's value", "range": [ - 1092, - 1138 + 1281, + 1327 ], "loc": { "start": { - "line": 51, + "line": 57, "column": 3 }, "end": { - "line": 51, + "line": 57, "column": 49 } } @@ -3194,16 +3892,16 @@ "type": "Line", "value": " If there is no left child, then there can only be one right", "range": [ - 1142, - 1204 + 1331, + 1393 ], "loc": { "start": { - "line": 52, + "line": 58, "column": 3 }, "end": { - "line": 52, + "line": 58, "column": 65 } } @@ -3212,16 +3910,16 @@ "type": "Line", "value": " child.", "range": [ - 1208, - 1217 + 1397, + 1406 ], "loc": { "start": { - "line": 53, + "line": 59, "column": 3 }, "end": { - "line": 53, + "line": 59, "column": 12 } } @@ -3240,16 +3938,16 @@ "type": "Identifier", "name": "node", "range": [ - 1250, - 1254 + 1439, + 1443 ], "loc": { "start": { - "line": 55, + "line": 61, "column": 3 }, "end": { - "line": 55, + "line": 61, "column": 7 } } @@ -3258,31 +3956,31 @@ "type": "Identifier", "name": "value", "range": [ - 1255, - 1260 + 1444, + 1449 ], "loc": { "start": { - "line": 55, + "line": 61, "column": 8 }, "end": { - "line": 55, + "line": 61, "column": 13 } } }, "range": [ - 1250, - 1260 + 1439, + 1449 ], "loc": { "start": { - "line": 55, + "line": 61, "column": 3 }, "end": { - "line": 55, + "line": 61, "column": 13 } } @@ -3294,16 +3992,16 @@ "type": "Identifier", "name": "succ", "range": [ - 1263, - 1267 + 1452, + 1456 ], "loc": { "start": { - "line": 55, + "line": 61, "column": 16 }, "end": { - "line": 55, + "line": 61, "column": 20 } } @@ -3312,61 +4010,61 @@ "type": "Identifier", "name": "value", "range": [ - 1268, - 1273 + 1457, + 1462 ], "loc": { "start": { - "line": 55, + "line": 61, "column": 21 }, "end": { - "line": 55, + "line": 61, "column": 26 } } }, "range": [ - 1263, - 1273 + 1452, + 1462 ], "loc": { "start": { - "line": 55, + "line": 61, "column": 16 }, "end": { - "line": 55, + "line": 61, "column": 26 } } }, "range": [ - 1250, - 1273 + 1439, + 1462 ], "loc": { "start": { - "line": 55, + "line": 61, "column": 3 }, "end": { - "line": 55, + "line": 61, "column": 26 } } }, "range": [ - 1250, - 1275 + 1439, + 1464 ], "loc": { "start": { - "line": 55, + "line": 61, "column": 3 }, "end": { - "line": 55, + "line": 61, "column": 28 } }, @@ -3375,16 +4073,16 @@ "type": "Line", "value": " delete successor node", "range": [ - 1279, - 1303 + 1468, + 1492 ], "loc": { "start": { - "line": 56, + "line": 62, "column": 3 }, "end": { - "line": 56, + "line": 62, "column": 27 } } @@ -3393,16 +4091,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1307, - 1358 + 1496, + 1547 ], "loc": { "start": { - "line": 57, + "line": 63, "column": 3 }, "end": { - "line": 57, + "line": 63, "column": 54 } } @@ -3411,16 +4109,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1362, - 1407 + 1551, + 1596 ], "loc": { "start": { - "line": 58, + "line": 64, "column": 3 }, "end": { - "line": 58, + "line": 64, "column": 48 } } @@ -3435,16 +4133,16 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1411, - 1427 + 1600, + 1616 ], "loc": { "start": { - "line": 59, + "line": 65, "column": 3 }, "end": { - "line": 59, + "line": 65, "column": 19 } } @@ -3454,47 +4152,47 @@ "type": "Identifier", "name": "succ", "range": [ - 1429, - 1433 + 1618, + 1622 ], "loc": { "start": { - "line": 59, + "line": 65, "column": 21 }, "end": { - "line": 59, + "line": 65, "column": 25 } } } ], "range": [ - 1411, - 1435 + 1600, + 1624 ], "loc": { "start": { - "line": 59, + "line": 65, "column": 3 }, "end": { - "line": 59, + "line": 65, "column": 27 } } }, "range": [ - 1411, - 1437 + 1600, + 1626 ], "loc": { "start": { - "line": 59, + "line": 65, "column": 3 }, "end": { - "line": 59, + "line": 65, "column": 29 } }, @@ -3503,16 +4201,16 @@ "type": "Line", "value": " delete successor node", "range": [ - 1279, - 1303 + 1468, + 1492 ], "loc": { "start": { - "line": 56, + "line": 62, "column": 3 }, "end": { - "line": 56, + "line": 62, "column": 27 } } @@ -3521,16 +4219,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1307, - 1358 + 1496, + 1547 ], "loc": { "start": { - "line": 57, + "line": 63, "column": 3 }, "end": { - "line": 57, + "line": 63, "column": 54 } } @@ -3539,16 +4237,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1362, - 1407 + 1551, + 1596 ], "loc": { "start": { - "line": 58, + "line": 64, "column": 3 }, "end": { - "line": 58, + "line": 64, "column": 48 } } @@ -3557,16 +4255,16 @@ } ], "range": [ - 1087, - 1441 + 1276, + 1630 ], "loc": { "start": { - "line": 50, + "line": 56, "column": 35 }, "end": { - "line": 60, + "line": 66, "column": 3 } } @@ -3580,16 +4278,16 @@ "type": "Identifier", "name": "node", "range": [ - 1455, - 1459 + 1644, + 1648 ], "loc": { "start": { - "line": 62, + "line": 68, "column": 12 }, "end": { - "line": 62, + "line": 68, "column": 16 } } @@ -3600,16 +4298,16 @@ "object": { "type": "ThisExpression", "range": [ - 1464, - 1468 + 1653, + 1657 ], "loc": { "start": { - "line": 62, + "line": 68, "column": 21 }, "end": { - "line": 62, + "line": 68, "column": 25 } } @@ -3618,46 +4316,46 @@ "type": "Identifier", "name": "root", "range": [ - 1469, - 1473 + 1658, + 1662 ], "loc": { "start": { - "line": 62, + "line": 68, "column": 26 }, "end": { - "line": 62, + "line": 68, "column": 30 } } }, "range": [ - 1464, - 1473 + 1653, + 1662 ], "loc": { "start": { - "line": 62, + "line": 68, "column": 21 }, "end": { - "line": 62, + "line": 68, "column": 30 } } }, "range": [ - 1455, - 1473 + 1644, + 1662 ], "loc": { "start": { - "line": 62, + "line": 68, "column": 12 }, "end": { - "line": 62, + "line": 68, "column": 30 } } @@ -3676,16 +4374,16 @@ "object": { "type": "ThisExpression", "range": [ - 1481, - 1485 + 1670, + 1674 ], "loc": { "start": { - "line": 63, + "line": 69, "column": 3 }, "end": { - "line": 63, + "line": 69, "column": 7 } } @@ -3694,248 +4392,742 @@ "type": "Identifier", "name": "root", "range": [ - 1486, - 1490 + 1675, + 1679 ], "loc": { "start": { - "line": 63, + "line": 69, "column": 8 }, "end": { - "line": 63, + "line": 69, "column": 12 } } }, "range": [ - 1481, - 1490 + 1670, + 1679 ], "loc": { "start": { - "line": 63, + "line": 69, "column": 3 }, "end": { - "line": 63, + "line": 69, "column": 12 } } }, - "right": { - "type": "Literal", - "value": null, - "raw": "null", - "range": [ - 1493, - 1497 - ], - "loc": { - "start": { - "line": 63, - "column": 15 - }, - "end": { - "line": 63, - "column": 19 - } - } + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1682, + 1686 + ], + "loc": { + "start": { + "line": 69, + "column": 15 + }, + "end": { + "line": 69, + "column": 19 + } + } + }, + "range": [ + 1670, + 1686 + ], + "loc": { + "start": { + "line": 69, + "column": 3 + }, + "end": { + "line": 69, + "column": 19 + } + } + }, + "range": [ + 1670, + 1688 + ], + "loc": { + "start": { + "line": 69, + "column": 3 + }, + "end": { + "line": 69, + "column": 21 + } + } + } + ], + "range": [ + 1665, + 1692 + ], + "loc": { + "start": { + "line": 68, + "column": 33 + }, + "end": { + "line": 70, + "column": 3 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_one_child", + "range": [ + 1706, + 1722 + ], + "loc": { + "start": { + "line": 73, + "column": 3 + }, + "end": { + "line": 73, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 1724, + 1728 + ], + "loc": { + "start": { + "line": 73, + "column": 21 + }, + "end": { + "line": 73, + "column": 25 + } + } + } + ], + "range": [ + 1706, + 1730 + ], + "loc": { + "start": { + "line": 73, + "column": 3 + }, + "end": { + "line": 73, + "column": 27 + } + } + }, + "range": [ + 1706, + 1732 + ], + "loc": { + "start": { + "line": 73, + "column": 3 + }, + "end": { + "line": 73, + "column": 29 + } + } + } + ], + "range": [ + 1701, + 1736 + ], + "loc": { + "start": { + "line": 72, + "column": 7 + }, + "end": { + "line": 74, + "column": 3 + } + } + }, + "range": [ + 1639, + 1736 + ], + "loc": { + "start": { + "line": 68, + "column": 7 + }, + "end": { + "line": 74, + "column": 3 + } + } + }, + "range": [ + 1248, + 1736 + ], + "loc": { + "start": { + "line": 56, + "column": 7 + }, + "end": { + "line": 74, + "column": 3 + } + } + }, + "range": [ + 924, + 1736 + ], + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 74, + "column": 3 + } + } + } + ], + "range": [ + 919, + 1740 + ], + "loc": { + "start": { + "line": 44, + "column": 18 + }, + "end": { + "line": 76, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 910, + 1740 + ], + "loc": { + "start": { + "line": 44, + "column": 9 + }, + "end": { + "line": 76, + "column": 2 + } + } + }, + "kind": "method", + "computed": false, + "range": [ + 902, + 1740 + ], + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 76, + "column": 2 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "remove", + "range": [ + 1743, + 1749 + ], + "loc": { + "start": { + "line": 78, + "column": 1 + }, + "end": { + "line": 78, + "column": 7 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [ + { + "type": "Identifier", + "name": "value", + "range": [ + 1752, + 1757 + ], + "loc": { + "start": { + "line": 78, + "column": 10 + }, + "end": { + "line": 78, + "column": 15 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "node", + "range": [ + 1771, + 1775 + ], + "loc": { + "start": { + "line": 80, + "column": 8 + }, + "end": { + "line": 80, + "column": 12 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1778, + 1782 + ], + "loc": { + "start": { + "line": 80, + "column": 15 + }, + "end": { + "line": 80, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "_search", + "range": [ + 1783, + 1790 + ], + "loc": { + "start": { + "line": 80, + "column": 20 }, - "range": [ - 1481, - 1497 - ], - "loc": { - "start": { - "line": 63, - "column": 3 - }, - "end": { - "line": 63, - "column": 19 - } + "end": { + "line": 80, + "column": 27 } + } + }, + "range": [ + 1778, + 1790 + ], + "loc": { + "start": { + "line": 80, + "column": 15 }, + "end": { + "line": 80, + "column": 27 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "value", "range": [ - 1481, - 1499 + 1792, + 1797 ], "loc": { "start": { - "line": 63, - "column": 3 + "line": 80, + "column": 29 }, "end": { - "line": 63, - "column": 21 + "line": 80, + "column": 34 } } } ], "range": [ - 1476, - 1503 + 1778, + 1799 ], "loc": { "start": { - "line": 62, - "column": 33 + "line": 80, + "column": 15 }, "end": { - "line": 64, - "column": 3 + "line": 80, + "column": 36 } } }, - "alternate": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "delete_one_child", - "range": [ - 1517, - 1533 - ], - "loc": { - "start": { - "line": 67, - "column": 3 - }, - "end": { - "line": 67, - "column": 19 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "node", - "range": [ - 1535, - 1539 - ], - "loc": { - "start": { - "line": 67, - "column": 21 - }, - "end": { - "line": 67, - "column": 25 - } - } - } - ], - "range": [ - 1517, - 1541 - ], - "loc": { - "start": { - "line": 67, - "column": 3 - }, - "end": { - "line": 67, - "column": 27 - } - } - }, - "range": [ - 1517, - 1543 - ], - "loc": { - "start": { - "line": 67, - "column": 3 - }, - "end": { - "line": 67, - "column": 29 - } - } - } + "range": [ + 1771, + 1799 + ], + "loc": { + "start": { + "line": 80, + "column": 8 + }, + "end": { + "line": 80, + "column": 36 + } + } + } + ], + "kind": "const", + "range": [ + 1765, + 1801 + ], + "loc": { + "start": { + "line": 80, + "column": 2 + }, + "end": { + "line": 80, + "column": 38 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "node", + "range": [ + 1809, + 1813 + ], + "loc": { + "start": { + "line": 81, + "column": 7 + }, + "end": { + "line": 81, + "column": 11 + } + } + }, + "right": { + "type": "Literal", + "value": null, + "raw": "null", + "range": [ + 1818, + 1822 + ], + "loc": { + "start": { + "line": 81, + "column": 16 + }, + "end": { + "line": 81, + "column": 20 + } + } + }, + "range": [ + 1809, + 1822 + ], + "loc": { + "start": { + "line": 81, + "column": 7 + }, + "end": { + "line": 81, + "column": 20 + } + } + }, + "consequent": { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": false, + "raw": "false", + "range": [ + 1832, + 1837 + ], + "loc": { + "start": { + "line": 81, + "column": 30 + }, + "end": { + "line": 81, + "column": 35 + } + } + }, + "range": [ + 1825, + 1839 + ], + "loc": { + "start": { + "line": 81, + "column": 23 + }, + "end": { + "line": 81, + "column": 37 + } + } + }, + "alternate": null, + "range": [ + 1804, + 1839 + ], + "loc": { + "start": { + "line": 81, + "column": 2 + }, + "end": { + "line": 81, + "column": 37 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1843, + 1847 ], + "loc": { + "start": { + "line": 83, + "column": 2 + }, + "end": { + "line": 83, + "column": 6 + } + } + }, + "property": { + "type": "Identifier", + "name": "_delete", "range": [ - 1512, - 1547 + 1848, + 1855 ], "loc": { "start": { - "line": 66, + "line": 83, "column": 7 }, "end": { - "line": 68, - "column": 3 + "line": 83, + "column": 14 } } }, "range": [ - 1450, - 1547 + 1843, + 1855 ], "loc": { "start": { - "line": 62, - "column": 7 + "line": 83, + "column": 2 }, "end": { - "line": 68, - "column": 3 + "line": 83, + "column": 14 } } }, + "arguments": [ + { + "type": "Identifier", + "name": "node", + "range": [ + 1857, + 1861 + ], + "loc": { + "start": { + "line": 83, + "column": 16 + }, + "end": { + "line": 83, + "column": 20 + } + } + } + ], "range": [ - 1059, - 1547 + 1843, + 1863 ], "loc": { "start": { - "line": 50, - "column": 7 + "line": 83, + "column": 2 }, "end": { - "line": 68, - "column": 3 + "line": 83, + "column": 22 } } }, "range": [ - 735, - 1547 + 1843, + 1865 ], "loc": { "start": { - "line": 40, + "line": 83, "column": 2 }, "end": { - "line": 68, - "column": 3 + "line": 83, + "column": 24 + } + } + }, + { + "type": "ReturnStatement", + "argument": { + "type": "Literal", + "value": true, + "raw": "true", + "range": [ + 1875, + 1879 + ], + "loc": { + "start": { + "line": 84, + "column": 9 + }, + "end": { + "line": 84, + "column": 13 + } + } + }, + "range": [ + 1868, + 1881 + ], + "loc": { + "start": { + "line": 84, + "column": 2 + }, + "end": { + "line": 84, + "column": 15 } } } ], "range": [ - 730, - 1551 + 1760, + 1885 ], "loc": { "start": { - "line": 38, + "line": 78, "column": 18 }, "end": { - "line": 70, + "line": 86, "column": 2 } } @@ -3943,16 +5135,16 @@ "generator": false, "expression": false, "range": [ - 721, - 1551 + 1750, + 1885 ], "loc": { "start": { - "line": 38, - "column": 9 + "line": 78, + "column": 8 }, "end": { - "line": 70, + "line": 86, "column": 2 } } @@ -3960,16 +5152,16 @@ "kind": "method", "computed": false, "range": [ - 713, - 1551 + 1743, + 1885 ], "loc": { "start": { - "line": 38, + "line": 78, "column": 1 }, "end": { - "line": 70, + "line": 86, "column": 2 } }, @@ -3979,18 +5171,18 @@ "type": "MethodDefinition", "key": { "type": "Identifier", - "name": "remove", + "name": "range", "range": [ - 1554, - 1560 + 1889, + 1894 ], "loc": { "start": { - "line": 72, - "column": 1 + "line": 88, + "column": 2 }, "end": { - "line": 72, + "line": 88, "column": 7 } } @@ -4001,19 +5193,37 @@ "params": [ { "type": "Identifier", - "name": "value", + "name": "left", "range": [ - 1563, - 1568 + 1897, + 1901 ], "loc": { "start": { - "line": 72, + "line": 88, "column": 10 }, "end": { - "line": 72, - "column": 15 + "line": 88, + "column": 14 + } + } + }, + { + "type": "Identifier", + "name": "right", + "range": [ + 1904, + 1909 + ], + "loc": { + "start": { + "line": 88, + "column": 17 + }, + "end": { + "line": 88, + "column": 22 } } } @@ -4022,170 +5232,60 @@ "type": "BlockStatement", "body": [ { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "node", - "range": [ - 1582, - 1586 - ], - "loc": { - "start": { - "line": 74, - "column": 8 - }, - "end": { - "line": 74, - "column": 12 - } - } - }, - "init": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "ThisExpression", - "range": [ - 1589, - 1593 - ], - "loc": { - "start": { - "line": 74, - "column": 15 - }, - "end": { - "line": 74, - "column": 19 - } - } - }, - "property": { - "type": "Identifier", - "name": "find", - "range": [ - 1594, - 1598 - ], - "loc": { - "start": { - "line": 74, - "column": 20 - }, - "end": { - "line": 74, - "column": 24 - } - } - }, - "range": [ - 1589, - 1598 - ], - "loc": { - "start": { - "line": 74, - "column": 15 - }, - "end": { - "line": 74, - "column": 24 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "value", - "range": [ - 1600, - 1605 - ], - "loc": { - "start": { - "line": 74, - "column": 26 - }, - "end": { - "line": 74, - "column": 31 - } - } - } - ], + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "!==", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", "range": [ - 1589, - 1607 + 1922, + 1926 ], "loc": { "start": { - "line": 74, - "column": 15 + "line": 90, + "column": 7 }, "end": { - "line": 74, - "column": 33 - } - } - }, - "range": [ - 1582, - 1607 - ], - "loc": { - "start": { - "line": 74, - "column": 8 - }, - "end": { - "line": 74, - "column": 33 - } - } - } - ], - "kind": "const", - "range": [ - 1576, - 1609 - ], - "loc": { - "start": { - "line": 74, - "column": 2 - }, - "end": { - "line": 74, - "column": 35 - } - } - }, - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "Identifier", - "name": "node", + "line": 90, + "column": 11 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 1927, + 1931 + ], + "loc": { + "start": { + "line": 90, + "column": 12 + }, + "end": { + "line": 90, + "column": 16 + } + } + }, "range": [ - 1617, - 1621 + 1922, + 1931 ], "loc": { "start": { - "line": 75, + "line": 90, "column": 7 }, "end": { - "line": 75, - "column": 11 + "line": 90, + "column": 16 } } }, @@ -4194,259 +5294,294 @@ "value": null, "raw": "null", "range": [ - 1626, - 1630 + 1936, + 1940 ], "loc": { "start": { - "line": 75, - "column": 16 + "line": 90, + "column": 21 }, "end": { - "line": 75, - "column": 20 + "line": 90, + "column": 25 } } }, "range": [ - 1617, - 1630 + 1922, + 1940 ], "loc": { "start": { - "line": 75, + "line": 90, "column": 7 }, "end": { - "line": 75, - "column": 20 + "line": 90, + "column": 25 } } }, "consequent": { - "type": "ReturnStatement", - "argument": { - "type": "Literal", - "value": false, - "raw": "false", - "range": [ - 1640, - 1645 - ], - "loc": { - "start": { - "line": 75, - "column": 30 + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rangetraversal", + "range": [ + 1950, + 1964 + ], + "loc": { + "start": { + "line": 90, + "column": 35 + }, + "end": { + "line": 90, + "column": 49 + } + } }, - "end": { - "line": 75, - "column": 35 - } - } - }, - "range": [ - 1633, - 1647 - ], - "loc": { - "start": { - "line": 75, - "column": 23 - }, - "end": { - "line": 75, - "column": 37 - } - } - }, - "alternate": null, - "range": [ - 1612, - 1647 - ], - "loc": { - "start": { - "line": 75, - "column": 2 - }, - "end": { - "line": 75, - "column": 37 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "ThisExpression", - "range": [ - 1651, - 1655 - ], - "loc": { - "start": { - "line": 77, - "column": 2 + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1966, + 1970 + ], + "loc": { + "start": { + "line": 90, + "column": 51 + }, + "end": { + "line": 90, + "column": 55 + } + } + }, + "property": { + "type": "Identifier", + "name": "compare", + "range": [ + 1971, + 1978 + ], + "loc": { + "start": { + "line": 90, + "column": 56 + }, + "end": { + "line": 90, + "column": 63 + } + } + }, + "range": [ + 1966, + 1978 + ], + "loc": { + "start": { + "line": 90, + "column": 51 + }, + "end": { + "line": 90, + "column": 63 + } + } }, - "end": { - "line": 77, - "column": 6 + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 1981, + 1985 + ], + "loc": { + "start": { + "line": 90, + "column": 66 + }, + "end": { + "line": 90, + "column": 70 + } + } + }, + "property": { + "type": "Identifier", + "name": "root", + "range": [ + 1986, + 1990 + ], + "loc": { + "start": { + "line": 90, + "column": 71 + }, + "end": { + "line": 90, + "column": 75 + } + } + }, + "range": [ + 1981, + 1990 + ], + "loc": { + "start": { + "line": 90, + "column": 66 + }, + "end": { + "line": 90, + "column": 75 + } + } + }, + { + "type": "Identifier", + "name": "left", + "range": [ + 1993, + 1997 + ], + "loc": { + "start": { + "line": 90, + "column": 78 + }, + "end": { + "line": 90, + "column": 82 + } + } + }, + { + "type": "Identifier", + "name": "right", + "range": [ + 2000, + 2005 + ], + "loc": { + "start": { + "line": 90, + "column": 85 + }, + "end": { + "line": 90, + "column": 90 + } + } } - } - }, - "property": { - "type": "Identifier", - "name": "_delete", + ], "range": [ - 1656, - 1663 + 1950, + 2007 ], "loc": { "start": { - "line": 77, - "column": 7 + "line": 90, + "column": 35 }, "end": { - "line": 77, - "column": 14 + "line": 90, + "column": 92 } } }, + "delegate": true, "range": [ - 1651, - 1663 + 1943, + 2007 ], "loc": { "start": { - "line": 77, - "column": 2 + "line": 90, + "column": 28 }, "end": { - "line": 77, - "column": 14 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "node", - "range": [ - 1665, - 1669 - ], - "loc": { - "start": { - "line": 77, - "column": 16 - }, - "end": { - "line": 77, - "column": 20 - } - } - } - ], - "range": [ - 1651, - 1671 - ], - "loc": { - "start": { - "line": 77, - "column": 2 - }, - "end": { - "line": 77, - "column": 22 - } - } - }, - "range": [ - 1651, - 1673 - ], - "loc": { - "start": { - "line": 77, - "column": 2 + "line": 90, + "column": 92 + } + } }, - "end": { - "line": 77, - "column": 24 - } - } - }, - { - "type": "ReturnStatement", - "argument": { - "type": "Literal", - "value": true, - "raw": "true", "range": [ - 1683, - 1687 + 1943, + 2009 ], "loc": { "start": { - "line": 78, - "column": 9 + "line": 90, + "column": 28 }, "end": { - "line": 78, - "column": 13 + "line": 90, + "column": 94 } } }, + "alternate": null, "range": [ - 1676, - 1689 + 1917, + 2009 ], "loc": { "start": { - "line": 78, + "line": 90, "column": 2 }, "end": { - "line": 78, - "column": 15 + "line": 90, + "column": 94 } } } ], "range": [ - 1571, - 1693 + 1912, + 2013 ], "loc": { "start": { - "line": 72, - "column": 18 + "line": 88, + "column": 25 }, "end": { - "line": 80, + "line": 92, "column": 2 } } }, - "generator": false, + "generator": true, "expression": false, "range": [ - 1561, - 1693 + 1895, + 2013 ], "loc": { "start": { - "line": 72, + "line": 88, "column": 8 }, "end": { - "line": 80, + "line": 92, "column": 2 } } @@ -4454,16 +5589,16 @@ "kind": "method", "computed": false, "range": [ - 1554, - 1693 + 1888, + 2013 ], "loc": { "start": { - "line": 72, + "line": 88, "column": 1 }, "end": { - "line": 80, + "line": 92, "column": 2 } }, @@ -4472,56 +5607,20 @@ { "type": "MethodDefinition", "key": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "Symbol", - "range": [ - 1698, - 1704 - ], - "loc": { - "start": { - "line": 82, - "column": 3 - }, - "end": { - "line": 82, - "column": 9 - } - } - }, - "property": { - "type": "Identifier", - "name": "iterator", - "range": [ - 1705, - 1713 - ], - "loc": { - "start": { - "line": 82, - "column": 10 - }, - "end": { - "line": 82, - "column": 18 - } - } - }, + "type": "Identifier", + "name": "values", "range": [ - 1698, - 1713 + 2017, + 2023 ], "loc": { "start": { - "line": 82, - "column": 3 + "line": 94, + "column": 2 }, "end": { - "line": 82, - "column": 18 + "line": 94, + "column": 8 } } }, @@ -4543,16 +5642,16 @@ "object": { "type": "ThisExpression", "range": [ - 1729, - 1733 + 2038, + 2042 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 7 }, "end": { - "line": 84, + "line": 96, "column": 11 } } @@ -4561,31 +5660,31 @@ "type": "Identifier", "name": "root", "range": [ - 1734, - 1738 + 2043, + 2047 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 12 }, "end": { - "line": 84, + "line": 96, "column": 16 } } }, "range": [ - 1729, - 1738 + 2038, + 2047 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 7 }, "end": { - "line": 84, + "line": 96, "column": 16 } } @@ -4595,31 +5694,31 @@ "value": null, "raw": "null", "range": [ - 1743, - 1747 + 2052, + 2056 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 21 }, "end": { - "line": 84, + "line": 96, "column": 25 } } }, "range": [ - 1729, - 1747 + 2038, + 2056 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 7 }, "end": { - "line": 84, + "line": 96, "column": 25 } } @@ -4634,16 +5733,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 1757, - 1773 + 2066, + 2082 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 35 }, "end": { - "line": 84, + "line": 96, "column": 51 } } @@ -4655,16 +5754,16 @@ "object": { "type": "ThisExpression", "range": [ - 1775, - 1779 + 2084, + 2088 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 53 }, "end": { - "line": 84, + "line": 96, "column": 57 } } @@ -4673,110 +5772,110 @@ "type": "Identifier", "name": "root", "range": [ - 1780, - 1784 + 2089, + 2093 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 58 }, "end": { - "line": 84, + "line": 96, "column": 62 } } }, "range": [ - 1775, - 1784 + 2084, + 2093 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 53 }, "end": { - "line": 84, + "line": 96, "column": 62 } } } ], "range": [ - 1757, - 1786 + 2066, + 2095 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 35 }, "end": { - "line": 84, + "line": 96, "column": 64 } } }, "delegate": true, "range": [ - 1750, - 1786 + 2059, + 2095 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 28 }, "end": { - "line": 84, + "line": 96, "column": 64 } } }, "range": [ - 1750, - 1788 + 2059, + 2097 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 28 }, "end": { - "line": 84, + "line": 96, "column": 66 } } }, "alternate": null, "range": [ - 1724, - 1788 + 2033, + 2097 ], "loc": { "start": { - "line": 84, + "line": 96, "column": 2 }, "end": { - "line": 84, + "line": 96, "column": 66 } } } ], "range": [ - 1719, - 1792 + 2028, + 2101 ], "loc": { "start": { - "line": 82, - "column": 24 + "line": 94, + "column": 13 }, "end": { - "line": 86, + "line": 98, "column": 2 } } @@ -4784,16 +5883,16 @@ "generator": true, "expression": false, "range": [ - 1715, - 1792 + 2024, + 2101 ], "loc": { "start": { - "line": 82, - "column": 20 + "line": 94, + "column": 9 }, "end": { - "line": 86, + "line": 98, "column": 2 } } @@ -4801,16 +5900,218 @@ "kind": "method", "computed": false, "range": [ - 1696, - 1792 + 2016, + 2101 ], "loc": { "start": { - "line": 82, + "line": 94, "column": 1 }, "end": { - "line": 86, + "line": 98, + "column": 2 + } + }, + "static": false + }, + { + "type": "MethodDefinition", + "key": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "Symbol", + "range": [ + 2105, + 2111 + ], + "loc": { + "start": { + "line": 100, + "column": 2 + }, + "end": { + "line": 100, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "name": "iterator", + "range": [ + 2112, + 2120 + ], + "loc": { + "start": { + "line": 100, + "column": 9 + }, + "end": { + "line": 100, + "column": 17 + } + } + }, + "range": [ + 2105, + 2120 + ], + "loc": { + "start": { + "line": 100, + "column": 2 + }, + "end": { + "line": 100, + "column": 17 + } + } + }, + "value": { + "type": "FunctionExpression", + "id": null, + "params": [], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "ReturnStatement", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "ThisExpression", + "range": [ + 2138, + 2142 + ], + "loc": { + "start": { + "line": 102, + "column": 9 + }, + "end": { + "line": 102, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "name": "values", + "range": [ + 2143, + 2149 + ], + "loc": { + "start": { + "line": 102, + "column": 14 + }, + "end": { + "line": 102, + "column": 20 + } + } + }, + "range": [ + 2138, + 2149 + ], + "loc": { + "start": { + "line": 102, + "column": 9 + }, + "end": { + "line": 102, + "column": 20 + } + } + }, + "arguments": [], + "range": [ + 2138, + 2151 + ], + "loc": { + "start": { + "line": 102, + "column": 9 + }, + "end": { + "line": 102, + "column": 22 + } + } + }, + "range": [ + 2131, + 2153 + ], + "loc": { + "start": { + "line": 102, + "column": 2 + }, + "end": { + "line": 102, + "column": 24 + } + } + } + ], + "range": [ + 2126, + 2157 + ], + "loc": { + "start": { + "line": 100, + "column": 23 + }, + "end": { + "line": 104, + "column": 2 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 2122, + 2157 + ], + "loc": { + "start": { + "line": 100, + "column": 19 + }, + "end": { + "line": 104, + "column": 2 + } + } + }, + "kind": "method", + "computed": true, + "range": [ + 2104, + 2157 + ], + "loc": { + "start": { + "line": 100, + "column": 1 + }, + "end": { + "line": 104, "column": 2 } }, @@ -4822,16 +6123,16 @@ "type": "Identifier", "name": "from", "range": [ - 1802, - 1806 + 2167, + 2171 ], "loc": { "start": { - "line": 88, + "line": 106, "column": 8 }, "end": { - "line": 88, + "line": 106, "column": 12 } } @@ -4844,16 +6145,16 @@ "type": "Identifier", "name": "compare", "range": [ - 1809, - 1816 + 2174, + 2181 ], "loc": { "start": { - "line": 88, + "line": 106, "column": 15 }, "end": { - "line": 88, + "line": 106, "column": 22 } } @@ -4862,16 +6163,16 @@ "type": "Identifier", "name": "iterable", "range": [ - 1819, - 1827 + 2184, + 2192 ], "loc": { "start": { - "line": 88, + "line": 106, "column": 25 }, "end": { - "line": 88, + "line": 106, "column": 33 } } @@ -4889,16 +6190,16 @@ "type": "Identifier", "name": "tree", "range": [ - 1841, - 1845 + 2206, + 2210 ], "loc": { "start": { - "line": 90, + "line": 108, "column": 8 }, "end": { - "line": 90, + "line": 108, "column": 12 } } @@ -4909,16 +6210,16 @@ "type": "Identifier", "name": "RedBlackTree", "range": [ - 1852, - 1864 + 2217, + 2229 ], "loc": { "start": { - "line": 90, + "line": 108, "column": 19 }, "end": { - "line": 90, + "line": 108, "column": 31 } } @@ -4928,47 +6229,47 @@ "type": "Identifier", "name": "compare", "range": [ - 1866, - 1873 + 2231, + 2238 ], "loc": { "start": { - "line": 90, + "line": 108, "column": 33 }, "end": { - "line": 90, + "line": 108, "column": 40 } } } ], "range": [ - 1848, - 1875 + 2213, + 2240 ], "loc": { "start": { - "line": 90, + "line": 108, "column": 15 }, "end": { - "line": 90, + "line": 108, "column": 42 } } }, "range": [ - 1841, - 1875 + 2206, + 2240 ], "loc": { "start": { - "line": 90, + "line": 108, "column": 8 }, "end": { - "line": 90, + "line": 108, "column": 42 } } @@ -4976,16 +6277,16 @@ ], "kind": "const", "range": [ - 1835, - 1877 + 2200, + 2242 ], "loc": { "start": { - "line": 90, + "line": 108, "column": 2 }, "end": { - "line": 90, + "line": 108, "column": 44 } } @@ -5001,32 +6302,32 @@ "type": "Identifier", "name": "element", "range": [ - 1893, - 1900 + 2258, + 2265 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 14 }, "end": { - "line": 92, + "line": 110, "column": 21 } } }, "init": null, "range": [ - 1893, - 1900 + 2258, + 2265 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 14 }, "end": { - "line": 92, + "line": 110, "column": 21 } } @@ -5034,16 +6335,16 @@ ], "kind": "const", "range": [ - 1887, - 1900 + 2252, + 2265 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 8 }, "end": { - "line": 92, + "line": 110, "column": 21 } } @@ -5052,16 +6353,16 @@ "type": "Identifier", "name": "iterable", "range": [ - 1904, - 1912 + 2269, + 2277 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 25 }, "end": { - "line": 92, + "line": 110, "column": 33 } } @@ -5077,16 +6378,16 @@ "type": "Identifier", "name": "tree", "range": [ - 1915, - 1919 + 2280, + 2284 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 36 }, "end": { - "line": 92, + "line": 110, "column": 40 } } @@ -5095,31 +6396,31 @@ "type": "Identifier", "name": "add", "range": [ - 1920, - 1923 + 2285, + 2288 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 41 }, "end": { - "line": 92, + "line": 110, "column": 44 } } }, "range": [ - 1915, - 1923 + 2280, + 2288 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 36 }, "end": { - "line": 92, + "line": 110, "column": 44 } } @@ -5129,62 +6430,62 @@ "type": "Identifier", "name": "element", "range": [ - 1925, - 1932 + 2290, + 2297 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 46 }, "end": { - "line": 92, + "line": 110, "column": 53 } } } ], "range": [ - 1915, - 1934 + 2280, + 2299 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 36 }, "end": { - "line": 92, + "line": 110, "column": 55 } } }, "range": [ - 1915, - 1936 + 2280, + 2301 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 36 }, "end": { - "line": 92, + "line": 110, "column": 57 } } }, "range": [ - 1881, - 1936 + 2246, + 2301 ], "loc": { "start": { - "line": 92, + "line": 110, "column": 2 }, "end": { - "line": 92, + "line": 110, "column": 57 } } @@ -5195,47 +6496,47 @@ "type": "Identifier", "name": "tree", "range": [ - 1947, - 1951 + 2312, + 2316 ], "loc": { "start": { - "line": 94, + "line": 112, "column": 9 }, "end": { - "line": 94, + "line": 112, "column": 13 } } }, "range": [ - 1940, - 1953 + 2305, + 2318 ], "loc": { "start": { - "line": 94, + "line": 112, "column": 2 }, "end": { - "line": 94, + "line": 112, "column": 15 } } } ], "range": [ - 1830, - 1957 + 2195, + 2322 ], "loc": { "start": { - "line": 88, + "line": 106, "column": 36 }, "end": { - "line": 96, + "line": 114, "column": 2 } } @@ -5243,16 +6544,16 @@ "generator": false, "expression": false, "range": [ - 1807, - 1957 + 2172, + 2322 ], "loc": { "start": { - "line": 88, + "line": 106, "column": 13 }, "end": { - "line": 96, + "line": 114, "column": 2 } } @@ -5260,16 +6561,16 @@ "kind": "method", "computed": false, "range": [ - 1795, - 1957 + 2160, + 2322 ], "loc": { "start": { - "line": 88, + "line": 106, "column": 1 }, "end": { - "line": 96, + "line": 114, "column": 2 } }, @@ -5277,8 +6578,8 @@ } ], "range": [ - 283, - 1960 + 302, + 2325 ], "loc": { "start": { @@ -5286,14 +6587,14 @@ "column": 26 }, "end": { - "line": 98, + "line": 116, "column": 1 } } }, "range": [ - 264, - 1960 + 283, + 2325 ], "loc": { "start": { @@ -5301,7 +6602,7 @@ "column": 7 }, "end": { - "line": 98, + "line": 116, "column": 1 } }, @@ -5311,8 +6612,8 @@ "specifiers": [], "source": null, "range": [ - 257, - 1960 + 276, + 2325 ], "loc": { "start": { @@ -5320,7 +6621,7 @@ "column": 0 }, "end": { - "line": 98, + "line": 116, "column": 1 } } @@ -5329,7 +6630,7 @@ "sourceType": "module", "range": [ 1, - 1960 + 2325 ], "loc": { "start": { @@ -5337,7 +6638,7 @@ "column": 0 }, "end": { - "line": 98, + "line": 116, "column": 1 } }, @@ -5346,16 +6647,16 @@ "type": "Line", "value": " replace node's value with predecessor's value", "range": [ - 767, - 815 + 956, + 1004 ], "loc": { "start": { - "line": 41, + "line": 47, "column": 3 }, "end": { - "line": 41, + "line": 47, "column": 51 } } @@ -5364,16 +6665,16 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 886, - 912 + 1075, + 1101 ], "loc": { "start": { - "line": 44, + "line": 50, "column": 3 }, "end": { - "line": 44, + "line": 50, "column": 29 } } @@ -5382,16 +6683,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 916, - 967 + 1105, + 1156 ], "loc": { "start": { - "line": 45, + "line": 51, "column": 3 }, "end": { - "line": 45, + "line": 51, "column": 54 } } @@ -5400,16 +6701,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 971, - 1016 + 1160, + 1205 ], "loc": { "start": { - "line": 46, + "line": 52, "column": 3 }, "end": { - "line": 46, + "line": 52, "column": 48 } } @@ -5418,16 +6719,16 @@ "type": "Line", "value": " replace node's value with successor's value", "range": [ - 1092, - 1138 + 1281, + 1327 ], "loc": { "start": { - "line": 51, + "line": 57, "column": 3 }, "end": { - "line": 51, + "line": 57, "column": 49 } } @@ -5436,16 +6737,16 @@ "type": "Line", "value": " If there is no left child, then there can only be one right", "range": [ - 1142, - 1204 + 1331, + 1393 ], "loc": { "start": { - "line": 52, + "line": 58, "column": 3 }, "end": { - "line": 52, + "line": 58, "column": 65 } } @@ -5454,16 +6755,16 @@ "type": "Line", "value": " child.", "range": [ - 1208, - 1217 + 1397, + 1406 ], "loc": { "start": { - "line": 53, + "line": 59, "column": 3 }, "end": { - "line": 53, + "line": 59, "column": 12 } } @@ -5472,16 +6773,16 @@ "type": "Line", "value": " delete successor node", "range": [ - 1279, - 1303 + 1468, + 1492 ], "loc": { "start": { - "line": 56, + "line": 62, "column": 3 }, "end": { - "line": 56, + "line": 62, "column": 27 } } @@ -5490,16 +6791,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1307, - 1358 + 1496, + 1547 ], "loc": { "start": { - "line": 57, + "line": 63, "column": 3 }, "end": { - "line": 57, + "line": 63, "column": 54 } } @@ -5508,16 +6809,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1362, - 1407 + 1551, + 1596 ], "loc": { "start": { - "line": 58, + "line": 64, "column": 3 }, "end": { - "line": 58, + "line": 64, "column": 48 } } diff --git a/ast/source/search/index.js.json b/ast/source/search/index.js.json index 7bdc04b..5aaedd1 100644 --- a/ast/source/search/index.js.json +++ b/ast/source/search/index.js.json @@ -5,11 +5,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./find", - "raw": "'./find'", + "value": "./search", + "raw": "'./search'", "range": [ 14, - 22 + 24 ], "loc": { "start": { @@ -18,13 +18,13 @@ }, "end": { "line": 1, - "column": 22 + "column": 24 } } }, "range": [ 0, - 24 + 26 ], "loc": { "start": { @@ -33,7 +33,7 @@ }, "end": { "line": 1, - "column": 24 + "column": 26 } } } @@ -41,7 +41,7 @@ "sourceType": "module", "range": [ 0, - 24 + 26 ], "loc": { "start": { @@ -50,7 +50,7 @@ }, "end": { "line": 1, - "column": 24 + "column": 26 } }, "comments": [] diff --git a/ast/source/search/find.js.json b/ast/source/search/search.js.json similarity index 89% rename from ast/source/search/find.js.json rename to ast/source/search/search.js.json index 92c4473..0ef1d5b 100644 --- a/ast/source/search/find.js.json +++ b/ast/source/search/search.js.json @@ -7,10 +7,10 @@ "type": "FunctionDeclaration", "id": { "type": "Identifier", - "name": "find", + "name": "search", "range": [ 16, - 20 + 22 ], "loc": { "start": { @@ -19,7 +19,7 @@ }, "end": { "line": 1, - "column": 20 + "column": 22 } } }, @@ -28,17 +28,17 @@ "type": "Identifier", "name": "compare", "range": [ - 23, - 30 + 25, + 32 ], "loc": { "start": { "line": 1, - "column": 23 + "column": 25 }, "end": { "line": 1, - "column": 30 + "column": 32 } } }, @@ -46,17 +46,17 @@ "type": "Identifier", "name": "node", "range": [ - 32, - 36 + 34, + 38 ], "loc": { "start": { "line": 1, - "column": 32 + "column": 34 }, "end": { "line": 1, - "column": 36 + "column": 38 } } }, @@ -64,17 +64,17 @@ "type": "Identifier", "name": "value", "range": [ - 38, - 43 + 40, + 45 ], "loc": { "start": { "line": 1, - "column": 38 + "column": 40 }, "end": { "line": 1, - "column": 43 + "column": 45 } } } @@ -89,8 +89,8 @@ "value": true, "raw": "true", "range": [ - 122, - 126 + 124, + 128 ], "loc": { "start": { @@ -115,8 +115,8 @@ "type": "Identifier", "name": "d", "range": [ - 140, - 141 + 142, + 143 ], "loc": { "start": { @@ -135,8 +135,8 @@ "type": "Identifier", "name": "compare", "range": [ - 144, - 151 + 146, + 153 ], "loc": { "start": { @@ -154,8 +154,8 @@ "type": "Identifier", "name": "value", "range": [ - 153, - 158 + 155, + 160 ], "loc": { "start": { @@ -175,8 +175,8 @@ "type": "Identifier", "name": "node", "range": [ - 160, - 164 + 162, + 166 ], "loc": { "start": { @@ -193,8 +193,8 @@ "type": "Identifier", "name": "value", "range": [ - 165, - 170 + 167, + 172 ], "loc": { "start": { @@ -208,8 +208,8 @@ } }, "range": [ - 160, - 170 + 162, + 172 ], "loc": { "start": { @@ -224,8 +224,8 @@ } ], "range": [ - 144, - 172 + 146, + 174 ], "loc": { "start": { @@ -239,8 +239,8 @@ } }, "range": [ - 140, - 172 + 142, + 174 ], "loc": { "start": { @@ -256,8 +256,8 @@ ], "kind": "const", "range": [ - 134, - 173 + 136, + 175 ], "loc": { "start": { @@ -279,8 +279,8 @@ "type": "Identifier", "name": "d", "range": [ - 182, - 183 + 184, + 185 ], "loc": { "start": { @@ -298,8 +298,8 @@ "value": 0, "raw": "0", "range": [ - 188, - 189 + 190, + 191 ], "loc": { "start": { @@ -313,8 +313,8 @@ } }, "range": [ - 182, - 189 + 184, + 191 ], "loc": { "start": { @@ -336,8 +336,8 @@ "type": "Identifier", "name": "node", "range": [ - 204, - 208 + 206, + 210 ], "loc": { "start": { @@ -351,8 +351,8 @@ } }, "range": [ - 197, - 209 + 199, + 211 ], "loc": { "start": { @@ -367,8 +367,8 @@ } ], "range": [ - 192, - 213 + 194, + 215 ], "loc": { "start": { @@ -390,8 +390,8 @@ "type": "Identifier", "name": "d", "range": [ - 227, - 228 + 229, + 230 ], "loc": { "start": { @@ -409,8 +409,8 @@ "value": 0, "raw": "0", "range": [ - 231, - 232 + 233, + 234 ], "loc": { "start": { @@ -424,8 +424,8 @@ } }, "range": [ - 227, - 232 + 229, + 234 ], "loc": { "start": { @@ -450,8 +450,8 @@ "type": "Identifier", "name": "node", "range": [ - 240, - 244 + 242, + 246 ], "loc": { "start": { @@ -471,8 +471,8 @@ "type": "Identifier", "name": "node", "range": [ - 247, - 251 + 249, + 253 ], "loc": { "start": { @@ -489,8 +489,8 @@ "type": "Identifier", "name": "left", "range": [ - 252, - 256 + 254, + 258 ], "loc": { "start": { @@ -504,8 +504,8 @@ } }, "range": [ - 247, - 256 + 249, + 258 ], "loc": { "start": { @@ -519,8 +519,8 @@ } }, "range": [ - 240, - 256 + 242, + 258 ], "loc": { "start": { @@ -534,8 +534,8 @@ } }, "range": [ - 240, - 257 + 242, + 259 ], "loc": { "start": { @@ -550,8 +550,8 @@ } ], "range": [ - 235, - 261 + 237, + 263 ], "loc": { "start": { @@ -576,8 +576,8 @@ "type": "Identifier", "name": "node", "range": [ - 275, - 279 + 277, + 281 ], "loc": { "start": { @@ -597,8 +597,8 @@ "type": "Identifier", "name": "node", "range": [ - 282, - 286 + 284, + 288 ], "loc": { "start": { @@ -615,8 +615,8 @@ "type": "Identifier", "name": "right", "range": [ - 287, - 292 + 289, + 294 ], "loc": { "start": { @@ -630,8 +630,8 @@ } }, "range": [ - 282, - 292 + 284, + 294 ], "loc": { "start": { @@ -645,8 +645,8 @@ } }, "range": [ - 275, - 292 + 277, + 294 ], "loc": { "start": { @@ -660,8 +660,8 @@ } }, "range": [ - 275, - 293 + 277, + 295 ], "loc": { "start": { @@ -676,8 +676,8 @@ } ], "range": [ - 270, - 297 + 272, + 299 ], "loc": { "start": { @@ -691,8 +691,8 @@ } }, "range": [ - 222, - 297 + 224, + 299 ], "loc": { "start": { @@ -706,8 +706,8 @@ } }, "range": [ - 177, - 297 + 179, + 299 ], "loc": { "start": { @@ -731,8 +731,8 @@ "type": "Identifier", "name": "node", "range": [ - 306, - 310 + 308, + 312 ], "loc": { "start": { @@ -749,8 +749,8 @@ "type": "Identifier", "name": "isleaf", "range": [ - 311, - 317 + 313, + 319 ], "loc": { "start": { @@ -764,8 +764,8 @@ } }, "range": [ - 306, - 317 + 308, + 319 ], "loc": { "start": { @@ -780,8 +780,8 @@ }, "arguments": [], "range": [ - 306, - 319 + 308, + 321 ], "loc": { "start": { @@ -804,8 +804,8 @@ "value": null, "raw": "null", "range": [ - 334, - 338 + 336, + 340 ], "loc": { "start": { @@ -819,8 +819,8 @@ } }, "range": [ - 327, - 339 + 329, + 341 ], "loc": { "start": { @@ -835,8 +835,8 @@ } ], "range": [ - 322, - 343 + 324, + 345 ], "loc": { "start": { @@ -851,8 +851,8 @@ }, "alternate": null, "range": [ - 301, - 343 + 303, + 345 ], "loc": { "start": { @@ -867,8 +867,8 @@ } ], "range": [ - 129, - 347 + 131, + 349 ], "loc": { "start": { @@ -882,8 +882,8 @@ } }, "range": [ - 114, - 347 + 116, + 349 ], "loc": { "start": { @@ -900,8 +900,8 @@ "type": "Line", "value": " scan for first node whose", "range": [ - 50, - 78 + 52, + 80 ], "loc": { "start": { @@ -918,8 +918,8 @@ "type": "Line", "value": " value equals parameter value", "range": [ - 80, - 111 + 82, + 113 ], "loc": { "start": { @@ -936,13 +936,13 @@ } ], "range": [ - 46, - 350 + 48, + 352 ], "loc": { "start": { "line": 1, - "column": 46 + "column": 48 }, "end": { "line": 28, @@ -954,7 +954,7 @@ "expression": false, "range": [ 7, - 350 + 352 ], "loc": { "start": { @@ -973,7 +973,7 @@ "source": null, "range": [ 0, - 350 + 352 ], "loc": { "start": { @@ -990,7 +990,7 @@ "sourceType": "module", "range": [ 0, - 350 + 352 ], "loc": { "start": { @@ -1007,8 +1007,8 @@ "type": "Line", "value": " scan for first node whose", "range": [ - 50, - 78 + 52, + 80 ], "loc": { "start": { @@ -1025,8 +1025,8 @@ "type": "Line", "value": " value equals parameter value", "range": [ - 80, - 111 + 82, + 113 ], "loc": { "start": { diff --git a/ast/source/traversal/index.js.json b/ast/source/traversal/index.js.json index fd1d5ee..15fb8ed 100644 --- a/ast/source/traversal/index.js.json +++ b/ast/source/traversal/index.js.json @@ -36,12 +36,48 @@ "column": 36 } } + }, + { + "type": "ExportAllDeclaration", + "source": { + "type": "Literal", + "value": "./rangetraversal", + "raw": "'./rangetraversal'", + "range": [ + 51, + 69 + ], + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 32 + } + } + }, + "range": [ + 37, + 71 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 34 + } + } } ], "sourceType": "module", "range": [ 0, - 36 + 71 ], "loc": { "start": { @@ -49,8 +85,8 @@ "column": 0 }, "end": { - "line": 1, - "column": 36 + "line": 2, + "column": 34 } }, "comments": [] diff --git a/ast/source/traversal/rangetraversal.js.json b/ast/source/traversal/rangetraversal.js.json new file mode 100644 index 0000000..c4f7185 --- /dev/null +++ b/ast/source/traversal/rangetraversal.js.json @@ -0,0 +1,1944 @@ +{ + "type": "Program", + "body": [ + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "rangetraversal", + "range": [ + 17, + 31 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 31 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 34, + 41 + ], + "loc": { + "start": { + "line": 1, + "column": 34 + }, + "end": { + "line": 1, + "column": 41 + } + } + }, + { + "type": "Identifier", + "name": "node", + "range": [ + 44, + 48 + ], + "loc": { + "start": { + "line": 1, + "column": 44 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": "Identifier", + "name": "left", + "range": [ + 51, + 55 + ], + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 55 + } + } + }, + { + "type": "Identifier", + "name": "right", + "range": [ + 58, + 63 + ], + "loc": { + "start": { + "line": 1, + "column": 58 + }, + "end": { + "line": 1, + "column": 63 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": "<", + "left": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "compare", + "range": [ + 75, + 82 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 13 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 84, + 88 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 89, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + "range": [ + 84, + 94 + ], + "loc": { + "start": { + "line": 3, + "column": 15 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": "Identifier", + "name": "left", + "range": [ + 97, + 101 + ], + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 32 + } + } + } + ], + "range": [ + 75, + 103 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 106, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + "range": [ + 75, + 107 + ], + "loc": { + "start": { + "line": 3, + "column": 6 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 120, + 124 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 125, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "range": [ + 120, + 130 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 131, + 137 + ], + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "range": [ + 120, + 137 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 25 + } + } + }, + "arguments": [], + "range": [ + 120, + 139 + ], + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "prefix": true, + "range": [ + 119, + 139 + ], + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 27 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rangetraversal", + "range": [ + 149, + 163 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 51 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 165, + 172 + ], + "loc": { + "start": { + "line": 4, + "column": 53 + }, + "end": { + "line": 4, + "column": 60 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 175, + 179 + ], + "loc": { + "start": { + "line": 4, + "column": 63 + }, + "end": { + "line": 4, + "column": 67 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 180, + 185 + ], + "loc": { + "start": { + "line": 4, + "column": 68 + }, + "end": { + "line": 4, + "column": 73 + } + } + }, + "range": [ + 175, + 185 + ], + "loc": { + "start": { + "line": 4, + "column": 63 + }, + "end": { + "line": 4, + "column": 73 + } + } + }, + { + "type": "Identifier", + "name": "left", + "range": [ + 188, + 192 + ], + "loc": { + "start": { + "line": 4, + "column": 76 + }, + "end": { + "line": 4, + "column": 80 + } + } + }, + { + "type": "Identifier", + "name": "right", + "range": [ + 195, + 200 + ], + "loc": { + "start": { + "line": 4, + "column": 83 + }, + "end": { + "line": 4, + "column": 88 + } + } + } + ], + "range": [ + 149, + 202 + ], + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 90 + } + } + }, + "delegate": true, + "range": [ + 142, + 202 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 90 + } + } + }, + "range": [ + 142, + 203 + ], + "loc": { + "start": { + "line": 4, + "column": 30 + }, + "end": { + "line": 4, + "column": 91 + } + } + }, + "alternate": null, + "range": [ + 114, + 203 + ], + "loc": { + "start": { + "line": 4, + "column": 2 + }, + "end": { + "line": 4, + "column": 91 + } + } + } + ], + "range": [ + 110, + 206 + ], + "loc": { + "start": { + "line": 3, + "column": 41 + }, + "end": { + "line": 5, + "column": 2 + } + } + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "BinaryExpression", + "operator": ">=", + "left": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "compare", + "range": [ + 218, + 225 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 227, + 231 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 232, + 237 + ], + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + "range": [ + 227, + 237 + ], + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 30 + } + } + }, + { + "type": "Identifier", + "name": "right", + "range": [ + 240, + 245 + ], + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 6, + "column": 38 + } + } + } + ], + "range": [ + 218, + 247 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 40 + } + } + }, + "right": { + "type": "Literal", + "value": 0, + "raw": "0", + "range": [ + 251, + 252 + ], + "loc": { + "start": { + "line": 6, + "column": 44 + }, + "end": { + "line": 6, + "column": 45 + } + } + }, + "range": [ + 218, + 252 + ], + "loc": { + "start": { + "line": 6, + "column": 11 + }, + "end": { + "line": 6, + "column": 45 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 265, + 269 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 270, + 274 + ], + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "range": [ + 265, + 274 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 275, + 281 + ], + "loc": { + "start": { + "line": 7, + "column": 18 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "range": [ + 265, + 281 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 265, + 283 + ], + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "prefix": true, + "range": [ + 264, + 283 + ], + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rangetraversal", + "range": [ + 293, + 307 + ], + "loc": { + "start": { + "line": 7, + "column": 36 + }, + "end": { + "line": 7, + "column": 50 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 309, + 316 + ], + "loc": { + "start": { + "line": 7, + "column": 52 + }, + "end": { + "line": 7, + "column": 59 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 319, + 323 + ], + "loc": { + "start": { + "line": 7, + "column": 62 + }, + "end": { + "line": 7, + "column": 66 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 324, + 328 + ], + "loc": { + "start": { + "line": 7, + "column": 67 + }, + "end": { + "line": 7, + "column": 71 + } + } + }, + "range": [ + 319, + 328 + ], + "loc": { + "start": { + "line": 7, + "column": 62 + }, + "end": { + "line": 7, + "column": 71 + } + } + }, + { + "type": "Identifier", + "name": "left", + "range": [ + 331, + 335 + ], + "loc": { + "start": { + "line": 7, + "column": 74 + }, + "end": { + "line": 7, + "column": 78 + } + } + }, + { + "type": "Identifier", + "name": "right", + "range": [ + 338, + 343 + ], + "loc": { + "start": { + "line": 7, + "column": 81 + }, + "end": { + "line": 7, + "column": 86 + } + } + } + ], + "range": [ + 293, + 345 + ], + "loc": { + "start": { + "line": 7, + "column": 36 + }, + "end": { + "line": 7, + "column": 88 + } + } + }, + "delegate": true, + "range": [ + 286, + 345 + ], + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 88 + } + } + }, + "range": [ + 286, + 346 + ], + "loc": { + "start": { + "line": 7, + "column": 29 + }, + "end": { + "line": 7, + "column": 89 + } + } + }, + "alternate": null, + "range": [ + 259, + 346 + ], + "loc": { + "start": { + "line": 7, + "column": 2 + }, + "end": { + "line": 7, + "column": 89 + } + } + } + ], + "range": [ + 255, + 349 + ], + "loc": { + "start": { + "line": 6, + "column": 48 + }, + "end": { + "line": 8, + "column": 2 + } + } + }, + "alternate": { + "type": "BlockStatement", + "body": [ + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 366, + 370 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 371, + 375 + ], + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + "range": [ + 366, + 375 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 376, + 382 + ], + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "range": [ + 366, + 382 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + "arguments": [], + "range": [ + 366, + 384 + ], + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 26 + } + } + }, + "prefix": true, + "range": [ + 365, + 384 + ], + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 26 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rangetraversal", + "range": [ + 394, + 408 + ], + "loc": { + "start": { + "line": 10, + "column": 36 + }, + "end": { + "line": 10, + "column": 50 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 410, + 417 + ], + "loc": { + "start": { + "line": 10, + "column": 52 + }, + "end": { + "line": 10, + "column": 59 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 420, + 424 + ], + "loc": { + "start": { + "line": 10, + "column": 62 + }, + "end": { + "line": 10, + "column": 66 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 425, + 429 + ], + "loc": { + "start": { + "line": 10, + "column": 67 + }, + "end": { + "line": 10, + "column": 71 + } + } + }, + "range": [ + 420, + 429 + ], + "loc": { + "start": { + "line": 10, + "column": 62 + }, + "end": { + "line": 10, + "column": 71 + } + } + }, + { + "type": "Identifier", + "name": "left", + "range": [ + 432, + 436 + ], + "loc": { + "start": { + "line": 10, + "column": 74 + }, + "end": { + "line": 10, + "column": 78 + } + } + }, + { + "type": "Identifier", + "name": "right", + "range": [ + 439, + 444 + ], + "loc": { + "start": { + "line": 10, + "column": 81 + }, + "end": { + "line": 10, + "column": 86 + } + } + } + ], + "range": [ + 394, + 446 + ], + "loc": { + "start": { + "line": 10, + "column": 36 + }, + "end": { + "line": 10, + "column": 88 + } + } + }, + "delegate": true, + "range": [ + 387, + 446 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 88 + } + } + }, + "range": [ + 387, + 447 + ], + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 89 + } + } + }, + "alternate": null, + "range": [ + 360, + 447 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 89 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 456, + 460 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "value", + "range": [ + 461, + 466 + ], + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "range": [ + 456, + 466 + ], + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "delegate": false, + "range": [ + 450, + 466 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + "range": [ + 450, + 468 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + { + "type": "IfStatement", + "test": { + "type": "UnaryExpression", + "operator": "!", + "argument": { + "type": "CallExpression", + "callee": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 477, + 481 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 482, + 487 + ], + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + "range": [ + 477, + 487 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "isleaf", + "range": [ + 488, + 494 + ], + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "range": [ + 477, + 494 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + "arguments": [], + "range": [ + 477, + 496 + ], + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + "prefix": true, + "range": [ + 476, + 496 + ], + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "expression": { + "type": "YieldExpression", + "argument": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rangetraversal", + "range": [ + 506, + 520 + ], + "loc": { + "start": { + "line": 12, + "column": 37 + }, + "end": { + "line": 12, + "column": 51 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "compare", + "range": [ + 522, + 529 + ], + "loc": { + "start": { + "line": 12, + "column": 53 + }, + "end": { + "line": 12, + "column": 60 + } + } + }, + { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "node", + "range": [ + 532, + 536 + ], + "loc": { + "start": { + "line": 12, + "column": 63 + }, + "end": { + "line": 12, + "column": 67 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 537, + 542 + ], + "loc": { + "start": { + "line": 12, + "column": 68 + }, + "end": { + "line": 12, + "column": 73 + } + } + }, + "range": [ + 532, + 542 + ], + "loc": { + "start": { + "line": 12, + "column": 63 + }, + "end": { + "line": 12, + "column": 73 + } + } + }, + { + "type": "Identifier", + "name": "left", + "range": [ + 545, + 549 + ], + "loc": { + "start": { + "line": 12, + "column": 76 + }, + "end": { + "line": 12, + "column": 80 + } + } + }, + { + "type": "Identifier", + "name": "right", + "range": [ + 552, + 557 + ], + "loc": { + "start": { + "line": 12, + "column": 83 + }, + "end": { + "line": 12, + "column": 88 + } + } + } + ], + "range": [ + 506, + 559 + ], + "loc": { + "start": { + "line": 12, + "column": 37 + }, + "end": { + "line": 12, + "column": 90 + } + } + }, + "delegate": true, + "range": [ + 499, + 559 + ], + "loc": { + "start": { + "line": 12, + "column": 30 + }, + "end": { + "line": 12, + "column": 90 + } + } + }, + "range": [ + 499, + 560 + ], + "loc": { + "start": { + "line": 12, + "column": 30 + }, + "end": { + "line": 12, + "column": 91 + } + } + }, + "alternate": null, + "range": [ + 471, + 560 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 91 + } + } + } + ], + "range": [ + 356, + 563 + ], + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "range": [ + 213, + 563 + ], + "loc": { + "start": { + "line": 6, + "column": 6 + }, + "end": { + "line": 13, + "column": 2 + } + } + }, + "range": [ + 70, + 563 + ], + "loc": { + "start": { + "line": 3, + "column": 1 + }, + "end": { + "line": 13, + "column": 2 + } + } + } + ], + "range": [ + 66, + 566 + ], + "loc": { + "start": { + "line": 1, + "column": 66 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + "generator": true, + "expression": false, + "range": [ + 7, + 566 + ], + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 15, + "column": 1 + } + }, + "leadingComments": [], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 0, + 566 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + } + } + ], + "sourceType": "module", + "range": [ + 0, + 566 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + }, + "comments": [] +} \ No newline at end of file diff --git a/badge.svg b/badge.svg index d1289c0..e78bc6e 100644 --- a/badge.svg +++ b/badge.svg @@ -11,7 +11,7 @@ document document - 5% - 5% + 4% + 4% diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/adt/RedBlackTree.js~RedBlackTree.html index c2ea32b..8518c62 100644 --- a/class/src/adt/RedBlackTree.js~RedBlackTree.html +++ b/class/src/adt/RedBlackTree.js~RedBlackTree.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • @@ -241,7 +242,7 @@

    RedBlackTree

    @@ -291,7 +292,57 @@

    RedBlackTree

    - find(value: *): * + get(value: *): * +

    +
    +
    + + + +
    + + + + + + + + + public + + + + + + +
    +

    + has(value: *): * +

    +
    +
    + + + +
    + + + + + + + + + public + + + + + + +
    +

    + * range(left: *, right: *)

    @@ -328,6 +379,31 @@

    RedBlackTree

    + + + + + public + + + + + + +
    +

    + * values() +

    +
    +
    + + + +
    + + + + @@ -359,6 +435,31 @@

    RedBlackTree

    + + + + + private + + + + + + +
    +

    + _search(value: *): * +

    +
    +
    + + + +
    + + + + @@ -381,7 +482,7 @@

    - source + source

    @@ -593,12 +694,12 @@

    - * - [Symbol.iterator]() + + [Symbol.iterator](): * - source + source

    @@ -612,7 +713,17 @@

    - +
    +

    Return:

    + + + + + +
    *
    +
    +
    +
    @@ -684,17 +795,83 @@

    Params:

    -

    +

    public - find(value: *): * + get(value: *): * - source + source + +

    + + + + + + + + +
    +

    Params:

    + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    value*
    +
    +
    + +
    +

    Return:

    + + + + + +
    *
    +
    +
    +
    + + + + + + + + + + + + + +
    +
    +

    + public + + + + + has(value: *): * + + + + source

    @@ -748,6 +925,68 @@

    Return:

    +
    +
    +

    + public + + + + * + range(left: *, right: *) + + + + source + +

    + + + + + + + + +
    +

    Params:

    + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    left*
    right*
    +
    +
    + + + + + + + + + + + + + + +

    @@ -760,7 +999,7 @@

    - source + source

    @@ -814,6 +1053,46 @@

    Return:

    +
    +
    +

    + public + + + + * + values() + + + + source + +

    + + + + + + + + +
    +
    + + + + + + + + + + + + + + +

    Private Methods

    @@ -828,7 +1107,7 @@

    - source + source

    @@ -872,6 +1151,72 @@

    Params:

    +
    +
    + + + + + + + + + +
    +

    Params:

    + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    value*
    +
    +
    + +
    +

    Return:

    + + + + + +
    *
    +
    +
    +
    + + + + + + + + + + + + +
    diff --git a/coverage.json b/coverage.json index cdc923c..a707d87 100644 --- a/coverage.json +++ b/coverage.json @@ -1,6 +1,6 @@ { - "coverage": "5.4%", - "expectCount": 37, + "coverage": "4.76%", + "expectCount": 42, "actualCount": 2, "files": { "src/color/BLACK.js": { @@ -32,19 +32,23 @@ ] }, "src/adt/RedBlackTree.js": { - "expectCount": 10, + "expectCount": 14, "actualCount": 0, "undocumentLines": [ 10, - 82, - 38, + 100, + 44, + 30, 19, 14, 12, - 30, + 106, + 35, + 40, 88, - 72, - 15 + 78, + 15, + 94 ] }, "src/debug/debug.js": { @@ -103,13 +107,6 @@ 6 ] }, - "src/search/find.js": { - "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] - }, "src/family/grandparent.js": { "expectCount": 1, "actualCount": 0, @@ -173,6 +170,13 @@ 1 ] }, + "src/traversal/rangetraversal.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 1 + ] + }, "src/removal/replace_node.js": { "expectCount": 1, "actualCount": 0, @@ -190,6 +194,13 @@ "actualCount": 1, "undocumentLines": [] }, + "src/search/search.js": { + "expectCount": 1, + "actualCount": 0, + "undocumentLines": [ + 1 + ] + }, "src/family/sibling.js": { "expectCount": 1, "actualCount": 0, diff --git a/dump.json b/dump.json index e38ba7d..b37d389 100644 --- a/dump.json +++ b/dump.json @@ -138,7 +138,7 @@ "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { Node } from './Node' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { find } from '..' ;\nimport { inordertraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\tfind ( value ) {\n\n\t\tif ( this.root === null ) return null ;\n\n\t\treturn find( this.compare , this.root , value ) ;\n\n\t}\n\n\t_delete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\tremove ( value ) {\n\n\t\tconst node = this.find( value ) ;\n\t\tif ( node === null ) return false ;\n\n\t\tthis._delete( node ) ;\n\t\treturn true ;\n\n\t}\n\n\t*[Symbol.iterator] ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" + "content": "\nimport { Node } from './Node' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { search } from '..' ;\nimport { inordertraversal , rangetraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\t_search ( value ) {\n\t\tif ( this.root === null ) return null ;\n\t\treturn search( this.compare , this.root , value ) ;\n\t}\n\n\tget ( value ) {\n\t\tconst node = this._search( value ) ;\n\t\treturn node === null ? null : node.value ;\n\t}\n\n\thas ( value ) {\n\t\treturn this._search( value ) !== null ;\n\t}\n\n\t_delete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\tremove ( value ) {\n\n\t\tconst node = this._search( value ) ;\n\t\tif ( node === null ) return false ;\n\n\t\tthis._delete( node ) ;\n\t\treturn true ;\n\n\t}\n\n\t*range ( left , right ) {\n\n\t\tif ( this.root !== null ) yield* rangetraversal( this.compare , this.root , left , right ) ;\n\n\t}\n\n\t*values ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\t[Symbol.iterator] ( ) {\n\n\t\treturn this.values() ;\n\n\t}\n\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" }, { "__docId__": 7, @@ -260,9 +260,9 @@ "kind": "method", "static": false, "variation": null, - "name": "find", + "name": "_search", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", - "longname": "src/adt/RedBlackTree.js~RedBlackTree#find", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#_search", "access": null, "description": null, "lineNumber": 30, @@ -287,12 +287,66 @@ "kind": "method", "static": false, "variation": null, + "name": "get", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#get", + "access": null, + "description": null, + "lineNumber": 35, + "undocument": true, + "params": [ + { + "name": "value", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 15, + "kind": "method", + "static": false, + "variation": null, + "name": "has", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#has", + "access": null, + "description": null, + "lineNumber": 40, + "undocument": true, + "params": [ + { + "name": "value", + "types": [ + "*" + ] + } + ], + "return": { + "types": [ + "*" + ] + }, + "generator": false + }, + { + "__docId__": 16, + "kind": "method", + "static": false, + "variation": null, "name": "_delete", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#_delete", "access": null, "description": null, - "lineNumber": 38, + "lineNumber": 44, "undocument": true, "params": [ { @@ -305,7 +359,7 @@ "generator": false }, { - "__docId__": 15, + "__docId__": 17, "kind": "member", "static": false, "variation": null, @@ -314,7 +368,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", "access": null, "description": null, - "lineNumber": 63, + "lineNumber": 69, "undocument": true, "type": { "types": [ @@ -323,7 +377,7 @@ } }, { - "__docId__": 16, + "__docId__": 18, "kind": "method", "static": false, "variation": null, @@ -332,7 +386,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#remove", "access": null, "description": null, - "lineNumber": 72, + "lineNumber": 78, "undocument": true, "params": [ { @@ -350,7 +404,50 @@ "generator": false }, { - "__docId__": 17, + "__docId__": 19, + "kind": "method", + "static": false, + "variation": null, + "name": "range", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#range", + "access": null, + "description": null, + "lineNumber": 88, + "undocument": true, + "params": [ + { + "name": "left", + "types": [ + "*" + ] + }, + { + "name": "right", + "types": [ + "*" + ] + } + ], + "generator": true + }, + { + "__docId__": 20, + "kind": "method", + "static": false, + "variation": null, + "name": "values", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#values", + "access": null, + "description": null, + "lineNumber": 94, + "undocument": true, + "params": [], + "generator": true + }, + { + "__docId__": 21, "kind": "method", "static": false, "variation": null, @@ -359,13 +456,18 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "access": null, "description": null, - "lineNumber": 82, + "lineNumber": 100, "undocument": true, "params": [], - "generator": true + "return": { + "types": [ + "*" + ] + }, + "generator": false }, { - "__docId__": 18, + "__docId__": 22, "kind": "method", "static": true, "variation": null, @@ -374,7 +476,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree.from", "access": null, "description": null, - "lineNumber": 88, + "lineNumber": 106, "undocument": true, "params": [ { @@ -398,7 +500,7 @@ "generator": false }, { - "__docId__": 19, + "__docId__": 23, "kind": "file", "static": true, "variation": null, @@ -411,7 +513,7 @@ "content": "export * from './Leaf' ;\nexport * from './Node' ;\nexport * from './RedBlackTree' ;\n" }, { - "__docId__": 20, + "__docId__": 24, "kind": "file", "static": true, "variation": null, @@ -424,7 +526,7 @@ "content": "export const BLACK = 0 ;\n" }, { - "__docId__": 21, + "__docId__": 25, "kind": "variable", "static": true, "variation": null, @@ -445,7 +547,7 @@ } }, { - "__docId__": 22, + "__docId__": 26, "kind": "file", "static": true, "variation": null, @@ -458,7 +560,7 @@ "content": "export const RED = 1 ;\n" }, { - "__docId__": 23, + "__docId__": 27, "kind": "variable", "static": true, "variation": null, @@ -479,7 +581,7 @@ } }, { - "__docId__": 24, + "__docId__": 28, "kind": "file", "static": true, "variation": null, @@ -492,7 +594,7 @@ "content": "export * from './BLACK' ;\nexport * from './RED' ;\n" }, { - "__docId__": 25, + "__docId__": 29, "kind": "file", "static": true, "variation": null, @@ -505,7 +607,7 @@ "content": "import chalk from 'chalk' ;\n\nimport { BLACK } from '..' ;\n\nexport function debug ( node ) {\n\n\tif ( node.isleaf( ) ) return chalk.bgBlack('L') ;\n\n\tconst repr = node.color === BLACK ? chalk.bgBlack(node.value) : chalk.bgRed( node.value ) ;\n\n\treturn `(${debug(node.left)}, ${repr}, ${debug(node.right)})` ;\n\n}\n" }, { - "__docId__": 26, + "__docId__": 30, "kind": "function", "static": true, "variation": null, @@ -535,7 +637,7 @@ "generator": false }, { - "__docId__": 27, + "__docId__": 31, "kind": "file", "static": true, "variation": null, @@ -548,7 +650,7 @@ "content": "export * from './debug' ;\n" }, { - "__docId__": 28, + "__docId__": 32, "kind": "file", "static": true, "variation": null, @@ -561,7 +663,7 @@ "content": "export function grandparent ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only call this function when n HAS a grandparent\n\treturn n.parent.parent;\n\n}\n" }, { - "__docId__": 29, + "__docId__": 33, "kind": "function", "static": true, "variation": null, @@ -591,7 +693,7 @@ "generator": false }, { - "__docId__": 30, + "__docId__": 34, "kind": "file", "static": true, "variation": null, @@ -604,7 +706,7 @@ "content": "export * from './grandparent' ;\nexport * from './predecessor' ;\nexport * from './sibling' ;\nexport * from './uncle' ;\n" }, { - "__docId__": 31, + "__docId__": 35, "kind": "file", "static": true, "variation": null, @@ -617,7 +719,7 @@ "content": "export function predecessor ( node ) {\n\n\tvar pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" }, { - "__docId__": 32, + "__docId__": 36, "kind": "function", "static": true, "variation": null, @@ -647,7 +749,7 @@ "generator": false }, { - "__docId__": 33, + "__docId__": 37, "kind": "file", "static": true, "variation": null, @@ -660,7 +762,7 @@ "content": "export function sibling ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only use this function when n HAS a sibling so this case can never\n\t//happen.\n\n\treturn n === n.parent.left ? n.parent.right : n.parent.left ;\n\n}\n" }, { - "__docId__": 34, + "__docId__": 38, "kind": "function", "static": true, "variation": null, @@ -690,7 +792,7 @@ "generator": false }, { - "__docId__": 35, + "__docId__": 39, "kind": "file", "static": true, "variation": null, @@ -703,7 +805,7 @@ "content": "import { grandparent } from './grandparent' ;\n\nexport function uncle ( n ) {\n\tconst g = grandparent( n );\n\t// assert( g !== null ) ;\n\t// this can never happen\n\tif ( n.parent === g.left )\n\t return g.right.isleaf( ) ? null : g.right ;\n\telse\n\t return g.left.isleaf( ) ? null : g.left ;\n}\n" }, { - "__docId__": 36, + "__docId__": 40, "kind": "function", "static": true, "variation": null, @@ -733,7 +835,7 @@ "generator": false }, { - "__docId__": 37, + "__docId__": 41, "kind": "file", "static": true, "variation": null, @@ -746,7 +848,7 @@ "content": "export * from './adt' ;\nexport * from './color' ;\nexport * from './debug' ;\nexport * from './family' ;\nexport * from './insertion' ;\nexport * from './removal' ;\nexport * from './rotate' ;\nexport * from './search' ;\nexport * from './traversal' ;\n" }, { - "__docId__": 38, + "__docId__": 42, "kind": "file", "static": true, "variation": null, @@ -759,7 +861,7 @@ "content": "export * from './insert' ;\nexport * from './insert_case1' ;\nexport * from './insert_case2' ;\nexport * from './insert_case3' ;\nexport * from './insert_case4' ;\nexport * from './insert_case5' ;\n" }, { - "__docId__": 39, + "__docId__": 43, "kind": "file", "static": true, "variation": null, @@ -772,7 +874,7 @@ "content": "\nexport function insert ( compare, A, B ) {\n\n\twhile ( true ) {\n\n\t\tif ( compare( B.value, A.value ) < 0 ) {\n\n\t\t\tconst node = A.left;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t\telse {\n\n\t\t\tconst node = A.right;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n\n}\n" }, { - "__docId__": 40, + "__docId__": 44, "kind": "function", "static": true, "variation": null, @@ -814,7 +916,7 @@ "generator": false }, { - "__docId__": 41, + "__docId__": 45, "kind": "file", "static": true, "variation": null, @@ -827,7 +929,7 @@ "content": "\nimport { BLACK } from '..' ;\nimport { insert_case2 } from './insert_case2' ;\n\nexport function insert_case1(n)\n{\n if (n.parent === null)\n n.color = BLACK;\n else\n insert_case2(n);\n}\n" }, { - "__docId__": 42, + "__docId__": 46, "kind": "function", "static": true, "variation": null, @@ -852,7 +954,7 @@ "generator": false }, { - "__docId__": 43, + "__docId__": 47, "kind": "file", "static": true, "variation": null, @@ -865,7 +967,7 @@ "content": "\nimport { BLACK } from '..' ;\nimport { insert_case3 } from './insert_case3' ;\n\nexport function insert_case2(n)\n{\n if (n.parent.color === BLACK)\n return; /* Tree is still valid */\n else\n insert_case3(n);\n}\n" }, { - "__docId__": 44, + "__docId__": 48, "kind": "function", "static": true, "variation": null, @@ -890,7 +992,7 @@ "generator": false }, { - "__docId__": 45, + "__docId__": 49, "kind": "file", "static": true, "variation": null, @@ -903,7 +1005,7 @@ "content": "import { BLACK , RED , uncle , grandparent } from '..' ;\nimport { insert_case1 } from './insert_case1' ;\nimport { insert_case4 } from './insert_case4' ;\n\nexport function insert_case3(n)\n{\n const u = uncle(n);\n\n if ((u !== null) && (u.color === RED)) {\n n.parent.color = BLACK;\n u.color = BLACK;\n const g = grandparent(n);\n g.color = RED;\n insert_case1(g);\n } else {\n insert_case4(n);\n }\n}\n" }, { - "__docId__": 46, + "__docId__": 50, "kind": "function", "static": true, "variation": null, @@ -928,7 +1030,7 @@ "generator": false }, { - "__docId__": 47, + "__docId__": 51, "kind": "file", "static": true, "variation": null, @@ -941,7 +1043,7 @@ "content": "\nimport { rotate_left , rotate_right , grandparent } from '..' ;\nimport { insert_case5 } from './insert_case5' ;\n\nexport function insert_case4(n)\n{\n const g = grandparent(n);\n\n if ((n === n.parent.right) && (n.parent === g.left)) {\n rotate_left(n.parent);\n\n /*\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n */\n\n //n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\n } else if ((n === n.parent.left) && (n.parent === g.right)) {\n rotate_right(n.parent);\n\n /*\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n */\n\n //n = n.right;\n }\n insert_case5(n);\n}\n" }, { - "__docId__": 48, + "__docId__": 52, "kind": "function", "static": true, "variation": null, @@ -966,7 +1068,7 @@ "generator": false }, { - "__docId__": 49, + "__docId__": 53, "kind": "file", "static": true, "variation": null, @@ -979,7 +1081,7 @@ "content": "\nimport { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;\n\nexport function insert_case5(n)\n{\n const g = grandparent(n);\n\n n.parent.color = BLACK;\n g.color = RED;\n if (n === n.parent.left)\n rotate_right(g);\n else\n rotate_left(g);\n}\n" }, { - "__docId__": 50, + "__docId__": 54, "kind": "function", "static": true, "variation": null, @@ -1004,7 +1106,7 @@ "generator": false }, { - "__docId__": 51, + "__docId__": 55, "kind": "file", "static": true, "variation": null, @@ -1017,7 +1119,7 @@ "content": "import { delete_case2 } from './delete_case2' ;\n\nexport function delete_case1 ( n ) {\n\n if ( n.parent !== null ) delete_case2( n ) ;\n\n}\n" }, { - "__docId__": 52, + "__docId__": 56, "kind": "function", "static": true, "variation": null, @@ -1042,7 +1144,7 @@ "generator": false }, { - "__docId__": 53, + "__docId__": 57, "kind": "file", "static": true, "variation": null, @@ -1055,7 +1157,7 @@ "content": "import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\n\nexport function delete_case2(n)\n{\n const s = sibling(n);\n\n if (s.color === RED) {\n n.parent.color = RED;\n s.color = BLACK;\n if (n === n.parent.left)\n rotate_left(n.parent);\n else\n rotate_right(n.parent);\n }\n delete_case3(n);\n}\n" }, { - "__docId__": 54, + "__docId__": 58, "kind": "function", "static": true, "variation": null, @@ -1080,7 +1182,7 @@ "generator": false }, { - "__docId__": 55, + "__docId__": 59, "kind": "file", "static": true, "variation": null, @@ -1093,7 +1195,7 @@ "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\nexport function delete_case3(n)\n{\n const s = sibling(n);\n //console.log(n.color, n.parent.color, s.color , s.isleaf());\n\n if ((n.parent.color === BLACK) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n delete_case1(n.parent);\n }\n\n else\n delete_case4(n);\n}\n" }, { - "__docId__": 56, + "__docId__": 60, "kind": "function", "static": true, "variation": null, @@ -1118,7 +1220,7 @@ "generator": false }, { - "__docId__": 57, + "__docId__": 61, "kind": "file", "static": true, "variation": null, @@ -1131,7 +1233,7 @@ "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\nexport function delete_case4(n)\n{\n const s = sibling(n);\n //console.log( s ) ;\n\n if ((n.parent.color === RED) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n n.parent.color = BLACK;\n } else\n delete_case5(n);\n}\n" }, { - "__docId__": 58, + "__docId__": 62, "kind": "function", "static": true, "variation": null, @@ -1156,7 +1258,7 @@ "generator": false }, { - "__docId__": 59, + "__docId__": 63, "kind": "file", "static": true, "variation": null, @@ -1169,7 +1271,7 @@ "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nimport { delete_case6 } from './delete_case6' ;\n\nexport function delete_case5(n)\n{\n const s = sibling(n);\n\n if (s.color === BLACK) { /* this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). */\n/* the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. */\n if ((n === n.parent.left) &&\n (s.right.color === BLACK) &&\n (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.left.color = BLACK;\n rotate_right(s);\n } else if ((n === n.parent.right) &&\n (s.left.color === BLACK) &&\n (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.right.color = BLACK;\n rotate_left(s);\n }\n }\n delete_case6(n);\n}\n" }, { - "__docId__": 60, + "__docId__": 64, "kind": "function", "static": true, "variation": null, @@ -1194,7 +1296,7 @@ "generator": false }, { - "__docId__": 61, + "__docId__": 65, "kind": "file", "static": true, "variation": null, @@ -1207,7 +1309,7 @@ "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nexport function delete_case6(n)\n{\n const s = sibling(n);\n\n s.color = n.parent.color;\n n.parent.color = BLACK;\n\n if (n === n.parent.left) {\n s.right.color = BLACK;\n rotate_left(n.parent);\n } else {\n s.left.color = BLACK;\n rotate_right(n.parent);\n }\n}\n" }, { - "__docId__": 62, + "__docId__": 66, "kind": "function", "static": true, "variation": null, @@ -1232,7 +1334,7 @@ "generator": false }, { - "__docId__": 63, + "__docId__": 67, "kind": "file", "static": true, "variation": null, @@ -1245,7 +1347,7 @@ "content": "import { BLACK , RED } from '..' ;\n\nimport { replace_node } from './replace_node' ;\nimport { delete_case1 } from './delete_case1' ;\n\nexport function delete_one_child ( n ) {\n\n // Precondition: n has at most one non-leaf child.\n // assert( n.right.isleaf() || n.left.isleaf());\n\n // const child = n.right.isleaf() ? n.left : n.right;\n // n.right is always a LEAF because either n is a subtree predecessor or it\n // is the only child of its parent by the red-black tree properties\n const child = n.left ;\n\n replace_node(n, child);\n\n if (n.color === BLACK) {\n if (child.color === RED) child.color = BLACK;\n else delete_case1(child);\n }\n\n //else {\n // If n is RED then its child can only be BLACK. Replacing n with its\n // child suffices.\n //}\n\n}\n" }, { - "__docId__": 64, + "__docId__": 68, "kind": "function", "static": true, "variation": null, @@ -1270,7 +1372,7 @@ "generator": false }, { - "__docId__": 65, + "__docId__": 69, "kind": "file", "static": true, "variation": null, @@ -1283,7 +1385,7 @@ "content": "export * from './delete_case1' ;\nexport * from './delete_case2' ;\nexport * from './delete_case3' ;\nexport * from './delete_case4' ;\nexport * from './delete_case5' ;\nexport * from './delete_case6' ;\nexport * from './delete_one_child' ;\nexport * from './replace_node' ;\n" }, { - "__docId__": 66, + "__docId__": 70, "kind": "file", "static": true, "variation": null, @@ -1296,7 +1398,7 @@ "content": "export function replace_node ( A , B ) {\n\n\t// assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif ( A === A.parent.left ) A.parent.left = B ;\n\n\telse A.parent.right = B ;\n\n\tB.parent = A.parent ;\n\n}\n" }, { - "__docId__": 67, + "__docId__": 71, "kind": "function", "static": true, "variation": null, @@ -1327,7 +1429,7 @@ "generator": false }, { - "__docId__": 68, + "__docId__": 72, "kind": "file", "static": true, "variation": null, @@ -1340,7 +1442,7 @@ "content": "export * from './rotate_left' ;\nexport * from './rotate_right' ;\n" }, { - "__docId__": 69, + "__docId__": 73, "kind": "file", "static": true, "variation": null, @@ -1353,7 +1455,7 @@ "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" }, { - "__docId__": 70, + "__docId__": 74, "kind": "function", "static": true, "variation": null, @@ -1381,7 +1483,7 @@ "generator": false }, { - "__docId__": 71, + "__docId__": 75, "kind": "file", "static": true, "variation": null, @@ -1394,7 +1496,7 @@ "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" }, { - "__docId__": 72, + "__docId__": 76, "kind": "function", "static": true, "variation": null, @@ -1422,30 +1524,43 @@ "generator": false }, { - "__docId__": 73, + "__docId__": 77, "kind": "file", "static": true, "variation": null, - "name": "src/search/find.js", + "name": "src/search/index.js", "memberof": null, - "longname": "src/search/find.js", + "longname": "src/search/index.js", "access": null, "description": null, "lineNumber": 1, - "content": "export function find ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" + "content": "export * from './search' ;\n" }, { - "__docId__": 74, + "__docId__": 78, + "kind": "file", + "static": true, + "variation": null, + "name": "src/search/search.js", + "memberof": null, + "longname": "src/search/search.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export function search ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" + }, + { + "__docId__": 79, "kind": "function", "static": true, "variation": null, - "name": "find", - "memberof": "src/search/find.js", - "longname": "src/search/find.js~find", + "name": "search", + "memberof": "src/search/search.js", + "longname": "src/search/search.js~search", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/search/find.js", - "importStyle": "{find}", + "importPath": "aureooms-es-red-black-tree/src/search/search.js", + "importStyle": "{search}", "description": null, "lineNumber": 1, "undocument": true, @@ -1477,20 +1592,7 @@ "generator": false }, { - "__docId__": 75, - "kind": "file", - "static": true, - "variation": null, - "name": "src/search/index.js", - "memberof": null, - "longname": "src/search/index.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export * from './find' ;\n" - }, - { - "__docId__": 76, + "__docId__": 80, "kind": "file", "static": true, "variation": null, @@ -1500,10 +1602,10 @@ "access": null, "description": null, "lineNumber": 1, - "content": "export * from './inordertraversal' ;\n" + "content": "export * from './inordertraversal' ;\nexport * from './rangetraversal' ;\n" }, { - "__docId__": 77, + "__docId__": 81, "kind": "file", "static": true, "variation": null, @@ -1516,7 +1618,7 @@ "content": "export function* inordertraversal ( node ) {\n\n\tif ( !node.left.isleaf() ) {\n\t\tyield *inordertraversal( node.left );\n\t}\n\n\tyield node.value ;\n\n\tif ( !node.right.isleaf() ) {\n\t\tyield* inordertraversal( node.right );\n\t}\n\n}\n" }, { - "__docId__": 78, + "__docId__": 82, "kind": "function", "static": true, "variation": null, @@ -1541,7 +1643,63 @@ "generator": true }, { - "__docId__": 80, + "__docId__": 83, + "kind": "file", + "static": true, + "variation": null, + "name": "src/traversal/rangetraversal.js", + "memberof": null, + "longname": "src/traversal/rangetraversal.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export function* rangetraversal ( compare , node , left , right ) {\n\n\tif ( compare( node.value , left ) < 0 ) {\n\t\tif ( !node.right.isleaf() ) yield *rangetraversal( compare , node.right , left , right );\n\t}\n\telse if ( compare( node.value , right ) >= 0 ) {\n\t\tif ( !node.left.isleaf() ) yield *rangetraversal( compare , node.left , left , right );\n\t}\n\telse {\n\t\tif ( !node.left.isleaf() ) yield *rangetraversal( compare , node.left , left , right );\n\t\tyield node.value ;\n\t\tif ( !node.right.isleaf() ) yield *rangetraversal( compare , node.right , left , right );\n\t}\n\n}\n" + }, + { + "__docId__": 84, + "kind": "function", + "static": true, + "variation": null, + "name": "rangetraversal", + "memberof": "src/traversal/rangetraversal.js", + "longname": "src/traversal/rangetraversal.js~rangetraversal", + "access": null, + "export": true, + "importPath": "aureooms-es-red-black-tree/src/traversal/rangetraversal.js", + "importStyle": "{rangetraversal}", + "description": null, + "lineNumber": 1, + "undocument": true, + "params": [ + { + "name": "compare", + "types": [ + "*" + ] + }, + { + "name": "node", + "types": [ + "*" + ] + }, + { + "name": "left", + "types": [ + "*" + ] + }, + { + "name": "right", + "types": [ + "*" + ] + } + ], + "generator": true + }, + { + "__docId__": 86, "kind": "external", "static": true, "variation": null, @@ -1554,7 +1712,7 @@ "builtinExternal": true }, { - "__docId__": 81, + "__docId__": 87, "kind": "external", "static": true, "variation": null, @@ -1567,7 +1725,7 @@ "builtinExternal": true }, { - "__docId__": 82, + "__docId__": 88, "kind": "external", "static": true, "variation": null, @@ -1580,7 +1738,7 @@ "builtinExternal": true }, { - "__docId__": 83, + "__docId__": 89, "kind": "external", "static": true, "variation": null, @@ -1593,7 +1751,7 @@ "builtinExternal": true }, { - "__docId__": 84, + "__docId__": 90, "kind": "external", "static": true, "variation": null, @@ -1606,7 +1764,7 @@ "builtinExternal": true }, { - "__docId__": 85, + "__docId__": 91, "kind": "external", "static": true, "variation": null, @@ -1619,7 +1777,7 @@ "builtinExternal": true }, { - "__docId__": 86, + "__docId__": 92, "kind": "external", "static": true, "variation": null, @@ -1632,7 +1790,7 @@ "builtinExternal": true }, { - "__docId__": 87, + "__docId__": 93, "kind": "external", "static": true, "variation": null, @@ -1645,7 +1803,7 @@ "builtinExternal": true }, { - "__docId__": 88, + "__docId__": 94, "kind": "external", "static": true, "variation": null, @@ -1658,7 +1816,7 @@ "builtinExternal": true }, { - "__docId__": 89, + "__docId__": 95, "kind": "external", "static": true, "variation": null, @@ -1671,7 +1829,7 @@ "builtinExternal": true }, { - "__docId__": 90, + "__docId__": 96, "kind": "external", "static": true, "variation": null, @@ -1684,7 +1842,7 @@ "builtinExternal": true }, { - "__docId__": 91, + "__docId__": 97, "kind": "external", "static": true, "variation": null, @@ -1697,7 +1855,7 @@ "builtinExternal": true }, { - "__docId__": 92, + "__docId__": 98, "kind": "external", "static": true, "variation": null, @@ -1710,7 +1868,7 @@ "builtinExternal": true }, { - "__docId__": 93, + "__docId__": 99, "kind": "external", "static": true, "variation": null, @@ -1723,7 +1881,7 @@ "builtinExternal": true }, { - "__docId__": 94, + "__docId__": 100, "kind": "external", "static": true, "variation": null, @@ -1736,7 +1894,7 @@ "builtinExternal": true }, { - "__docId__": 95, + "__docId__": 101, "kind": "external", "static": true, "variation": null, @@ -1749,7 +1907,7 @@ "builtinExternal": true }, { - "__docId__": 96, + "__docId__": 102, "kind": "external", "static": true, "variation": null, @@ -1762,7 +1920,7 @@ "builtinExternal": true }, { - "__docId__": 97, + "__docId__": 103, "kind": "external", "static": true, "variation": null, @@ -1775,7 +1933,7 @@ "builtinExternal": true }, { - "__docId__": 98, + "__docId__": 104, "kind": "external", "static": true, "variation": null, @@ -1788,7 +1946,7 @@ "builtinExternal": true }, { - "__docId__": 99, + "__docId__": 105, "kind": "external", "static": true, "variation": null, @@ -1801,7 +1959,7 @@ "builtinExternal": true }, { - "__docId__": 100, + "__docId__": 106, "kind": "external", "static": true, "variation": null, @@ -1814,7 +1972,7 @@ "builtinExternal": true }, { - "__docId__": 101, + "__docId__": 107, "kind": "external", "static": true, "variation": null, @@ -1827,7 +1985,7 @@ "builtinExternal": true }, { - "__docId__": 102, + "__docId__": 108, "kind": "external", "static": true, "variation": null, @@ -1840,7 +1998,7 @@ "builtinExternal": true }, { - "__docId__": 103, + "__docId__": 109, "kind": "external", "static": true, "variation": null, @@ -1853,7 +2011,7 @@ "builtinExternal": true }, { - "__docId__": 104, + "__docId__": 110, "kind": "external", "static": true, "variation": null, @@ -1866,7 +2024,7 @@ "builtinExternal": true }, { - "__docId__": 105, + "__docId__": 111, "kind": "external", "static": true, "variation": null, @@ -1879,7 +2037,7 @@ "builtinExternal": true }, { - "__docId__": 106, + "__docId__": 112, "kind": "external", "static": true, "variation": null, @@ -1892,7 +2050,7 @@ "builtinExternal": true }, { - "__docId__": 107, + "__docId__": 113, "kind": "external", "static": true, "variation": null, @@ -1905,7 +2063,7 @@ "builtinExternal": true }, { - "__docId__": 108, + "__docId__": 114, "kind": "external", "static": true, "variation": null, @@ -1918,7 +2076,7 @@ "builtinExternal": true }, { - "__docId__": 109, + "__docId__": 115, "kind": "external", "static": true, "variation": null, @@ -1931,7 +2089,7 @@ "builtinExternal": true }, { - "__docId__": 110, + "__docId__": 116, "kind": "external", "static": true, "variation": null, @@ -1944,7 +2102,7 @@ "builtinExternal": true }, { - "__docId__": 111, + "__docId__": 117, "kind": "external", "static": true, "variation": null, @@ -1957,7 +2115,7 @@ "builtinExternal": true }, { - "__docId__": 112, + "__docId__": 118, "kind": "external", "static": true, "variation": null, @@ -1970,7 +2128,7 @@ "builtinExternal": true }, { - "__docId__": 113, + "__docId__": 119, "kind": "external", "static": true, "variation": null, @@ -1983,7 +2141,7 @@ "builtinExternal": true }, { - "__docId__": 114, + "__docId__": 120, "kind": "external", "static": true, "variation": null, @@ -1996,7 +2154,7 @@ "builtinExternal": true }, { - "__docId__": 115, + "__docId__": 121, "kind": "external", "static": true, "variation": null, @@ -2009,7 +2167,7 @@ "builtinExternal": true }, { - "__docId__": 116, + "__docId__": 122, "kind": "external", "static": true, "variation": null, @@ -2022,7 +2180,7 @@ "builtinExternal": true }, { - "__docId__": 117, + "__docId__": 123, "kind": "external", "static": true, "variation": null, @@ -2035,7 +2193,7 @@ "builtinExternal": true }, { - "__docId__": 118, + "__docId__": 124, "kind": "external", "static": true, "variation": null, @@ -2048,7 +2206,7 @@ "builtinExternal": true }, { - "__docId__": 119, + "__docId__": 125, "kind": "external", "static": true, "variation": null, @@ -2061,7 +2219,7 @@ "builtinExternal": true }, { - "__docId__": 120, + "__docId__": 126, "kind": "external", "static": true, "variation": null, @@ -2074,7 +2232,7 @@ "builtinExternal": true }, { - "__docId__": 121, + "__docId__": 127, "kind": "external", "static": true, "variation": null, @@ -2087,7 +2245,7 @@ "builtinExternal": true }, { - "__docId__": 122, + "__docId__": 128, "kind": "external", "static": true, "variation": null, @@ -2100,7 +2258,7 @@ "builtinExternal": true }, { - "__docId__": 123, + "__docId__": 129, "kind": "external", "static": true, "variation": null, @@ -2113,7 +2271,7 @@ "builtinExternal": true }, { - "__docId__": 124, + "__docId__": 130, "kind": "external", "static": true, "variation": null, @@ -2126,7 +2284,7 @@ "builtinExternal": true }, { - "__docId__": 125, + "__docId__": 131, "kind": "external", "static": true, "variation": null, @@ -2139,7 +2297,7 @@ "builtinExternal": true }, { - "__docId__": 126, + "__docId__": 132, "kind": "external", "static": true, "variation": null, @@ -2152,7 +2310,7 @@ "builtinExternal": true }, { - "__docId__": 128, + "__docId__": 134, "kind": "external", "static": true, "variation": null, @@ -2165,7 +2323,7 @@ "builtinExternal": true }, { - "__docId__": 129, + "__docId__": 135, "kind": "external", "static": true, "variation": null, @@ -2178,7 +2336,7 @@ "builtinExternal": true }, { - "__docId__": 130, + "__docId__": 136, "kind": "external", "static": true, "variation": null, @@ -2191,7 +2349,7 @@ "builtinExternal": true }, { - "__docId__": 131, + "__docId__": 137, "kind": "external", "static": true, "variation": null, @@ -2204,7 +2362,7 @@ "builtinExternal": true }, { - "__docId__": 132, + "__docId__": 138, "kind": "external", "static": true, "variation": null, @@ -2217,7 +2375,7 @@ "builtinExternal": true }, { - "__docId__": 133, + "__docId__": 139, "kind": "external", "static": true, "variation": null, @@ -2230,7 +2388,7 @@ "builtinExternal": true }, { - "__docId__": 134, + "__docId__": 140, "kind": "external", "static": true, "variation": null, @@ -2243,7 +2401,7 @@ "builtinExternal": true }, { - "__docId__": 135, + "__docId__": 141, "kind": "external", "static": true, "variation": null, diff --git a/file/src/adt/Leaf.js.html b/file/src/adt/Leaf.js.html index 7166c5c..10b0bae 100644 --- a/file/src/adt/Leaf.js.html +++ b/file/src/adt/Leaf.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/adt/Node.js.html b/file/src/adt/Node.js.html index 510ca89..2d0eb96 100644 --- a/file/src/adt/Node.js.html +++ b/file/src/adt/Node.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/adt/RedBlackTree.js.html index 255ed4c..7f3bd61 100644 --- a/file/src/adt/RedBlackTree.js.html +++ b/file/src/adt/RedBlackTree.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • @@ -73,8 +74,8 @@ import { predecessor } from '..' ; import { insert , insert_case2 } from '..' ; import { delete_one_child } from '..' ; -import { find } from '..' ; -import { inordertraversal } from '..' ; +import { search } from '..' ; +import { inordertraversal , rangetraversal } from '..' ; export class RedBlackTree { @@ -96,12 +97,18 @@ } } - find ( value ) { - + _search ( value ) { if ( this.root === null ) return null ; + return search( this.compare , this.root , value ) ; + } - return find( this.compare , this.root , value ) ; + get ( value ) { + const node = this._search( value ) ; + return node === null ? null : node.value ; + } + has ( value ) { + return this._search( value ) !== null ; } _delete ( node ) { @@ -140,7 +147,7 @@ remove ( value ) { - const node = this.find( value ) ; + const node = this._search( value ) ; if ( node === null ) return false ; this._delete( node ) ; @@ -148,12 +155,24 @@ } - *[Symbol.iterator] ( ) { + *range ( left , right ) { + + if ( this.root !== null ) yield* rangetraversal( this.compare , this.root , left , right ) ; + + } + + *values ( ) { if ( this.root !== null ) yield* inordertraversal( this.root ) ; } + [Symbol.iterator] ( ) { + + return this.values() ; + + } + static from ( compare , iterable ) { const tree = new RedBlackTree( compare ) ; diff --git a/file/src/adt/index.js.html b/file/src/adt/index.js.html index df7be0d..d2e29de 100644 --- a/file/src/adt/index.js.html +++ b/file/src/adt/index.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/color/BLACK.js.html b/file/src/color/BLACK.js.html index 47c549b..1e3d6af 100644 --- a/file/src/color/BLACK.js.html +++ b/file/src/color/BLACK.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/color/RED.js.html b/file/src/color/RED.js.html index 5c56757..0a6e68a 100644 --- a/file/src/color/RED.js.html +++ b/file/src/color/RED.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/color/index.js.html b/file/src/color/index.js.html index 0d77154..3aef541 100644 --- a/file/src/color/index.js.html +++ b/file/src/color/index.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/debug/debug.js.html b/file/src/debug/debug.js.html index 32b51dd..1d0fdd3 100644 --- a/file/src/debug/debug.js.html +++ b/file/src/debug/debug.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/debug/index.js.html b/file/src/debug/index.js.html index 602e654..11717ee 100644 --- a/file/src/debug/index.js.html +++ b/file/src/debug/index.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/family/grandparent.js.html b/file/src/family/grandparent.js.html index 27398bf..cef2568 100644 --- a/file/src/family/grandparent.js.html +++ b/file/src/family/grandparent.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/family/index.js.html b/file/src/family/index.js.html index c6ae259..f0311f6 100644 --- a/file/src/family/index.js.html +++ b/file/src/family/index.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/family/predecessor.js.html b/file/src/family/predecessor.js.html index de31310..7028872 100644 --- a/file/src/family/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/family/sibling.js.html b/file/src/family/sibling.js.html index fe67a5f..990ce4a 100644 --- a/file/src/family/sibling.js.html +++ b/file/src/family/sibling.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/family/uncle.js.html b/file/src/family/uncle.js.html index 28f78f2..fbacdaf 100644 --- a/file/src/family/uncle.js.html +++ b/file/src/family/uncle.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/index.js.html b/file/src/index.js.html index 32730f2..8984476 100644 --- a/file/src/index.js.html +++ b/file/src/index.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/insertion/index.js.html b/file/src/insertion/index.js.html index 3ea00a1..4363d37 100644 --- a/file/src/insertion/index.js.html +++ b/file/src/insertion/index.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/insertion/insert.js.html b/file/src/insertion/insert.js.html index 48f32ca..e831010 100644 --- a/file/src/insertion/insert.js.html +++ b/file/src/insertion/insert.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html index d44a9d4..356da41 100644 --- a/file/src/insertion/insert_case1.js.html +++ b/file/src/insertion/insert_case1.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index 141e7dc..d592703 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index 29fc09c..3691f80 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index 17757c3..6d1c56a 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case5.js.html index 47509c2..9c26808 100644 --- a/file/src/insertion/insert_case5.js.html +++ b/file/src/insertion/insert_case5.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/delete_case1.js.html b/file/src/removal/delete_case1.js.html index 8cf4b17..dda98eb 100644 --- a/file/src/removal/delete_case1.js.html +++ b/file/src/removal/delete_case1.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/delete_case2.js.html b/file/src/removal/delete_case2.js.html index 027fd59..3ede65d 100644 --- a/file/src/removal/delete_case2.js.html +++ b/file/src/removal/delete_case2.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/delete_case3.js.html b/file/src/removal/delete_case3.js.html index e4bc7d4..9274682 100644 --- a/file/src/removal/delete_case3.js.html +++ b/file/src/removal/delete_case3.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/delete_case4.js.html b/file/src/removal/delete_case4.js.html index a077f09..63f27bd 100644 --- a/file/src/removal/delete_case4.js.html +++ b/file/src/removal/delete_case4.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/delete_case5.js.html b/file/src/removal/delete_case5.js.html index 959aa04..389d4ac 100644 --- a/file/src/removal/delete_case5.js.html +++ b/file/src/removal/delete_case5.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/delete_case6.js.html b/file/src/removal/delete_case6.js.html index e1828b0..902f5e6 100644 --- a/file/src/removal/delete_case6.js.html +++ b/file/src/removal/delete_case6.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/delete_one_child.js.html b/file/src/removal/delete_one_child.js.html index 3cae9b4..d0ee55c 100644 --- a/file/src/removal/delete_one_child.js.html +++ b/file/src/removal/delete_one_child.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/index.js.html b/file/src/removal/index.js.html index aa0ced5..c5de7a7 100644 --- a/file/src/removal/index.js.html +++ b/file/src/removal/index.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/removal/replace_node.js.html b/file/src/removal/replace_node.js.html index 3cdd16c..ea59d62 100644 --- a/file/src/removal/replace_node.js.html +++ b/file/src/removal/replace_node.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/rotate/index.js.html b/file/src/rotate/index.js.html index 6277aa4..2ca7def 100644 --- a/file/src/rotate/index.js.html +++ b/file/src/rotate/index.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/rotate/rotate_left.js.html b/file/src/rotate/rotate_left.js.html index e009cde..588992c 100644 --- a/file/src/rotate/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/rotate/rotate_right.js.html b/file/src/rotate/rotate_right.js.html index b3b358c..ee3af43 100644 --- a/file/src/rotate/rotate_right.js.html +++ b/file/src/rotate/rotate_right.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/search/index.js.html b/file/src/search/index.js.html index aa40b47..2ebd363 100644 --- a/file/src/search/index.js.html +++ b/file/src/search/index.js.html @@ -60,14 +60,15 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • src/search/index.js

    -
    export * from './find' ;
    +
    export * from './search' ;
     
    diff --git a/file/src/search/find.js.html b/file/src/search/search.js.html similarity index 94% rename from file/src/search/find.js.html rename to file/src/search/search.js.html index 2fa5f10..4434125 100644 --- a/file/src/search/find.js.html +++ b/file/src/search/search.js.html @@ -3,7 +3,7 @@ - src/search/find.js | aureooms/es-red-black-tree API Document + src/search/search.js | aureooms/es-red-black-tree API Document @@ -60,14 +60,15 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • -

    src/search/find.js

    -
    export function find ( compare, node, value ) {
    +

    src/search/search.js

    +
    export function search ( compare, node, value ) {
     
     	// scan for first node whose
     	// value equals parameter value
    diff --git a/file/src/traversal/index.js.html b/file/src/traversal/index.js.html
    index 518f178..ef07e7b 100644
    --- a/file/src/traversal/index.js.html
    +++ b/file/src/traversal/index.js.html
    @@ -60,14 +60,16 @@
     
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • src/traversal/index.js

    export * from './inordertraversal' ;
    +export * from './rangetraversal' ;
     
    diff --git a/file/src/traversal/inordertraversal.js.html b/file/src/traversal/inordertraversal.js.html index 6efb71c..0ba5cfc 100644 --- a/file/src/traversal/inordertraversal.js.html +++ b/file/src/traversal/inordertraversal.js.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/file/src/traversal/rangetraversal.js.html b/file/src/traversal/rangetraversal.js.html new file mode 100644 index 0000000..d73ce07 --- /dev/null +++ b/file/src/traversal/rangetraversal.js.html @@ -0,0 +1,102 @@ + + + + + + src/traversal/rangetraversal.js | aureooms/es-red-black-tree API Document + + + + + + + + + + + +
    + Home + Manual + Reference + Source + Test + Repository + +
    + + + +

    src/traversal/rangetraversal.js

    +
    export function* rangetraversal ( compare , node , left , right ) {
    +
    +	if ( compare( node.value , left ) < 0 ) {
    +		if ( !node.right.isleaf() ) yield *rangetraversal( compare , node.right , left , right );
    +	}
    +	else if ( compare( node.value , right ) >= 0 ) {
    +		if ( !node.left.isleaf() ) yield *rangetraversal( compare , node.left , left , right );
    +	}
    +	else {
    +		if ( !node.left.isleaf() ) yield *rangetraversal( compare , node.left , left , right );
    +		yield node.value ;
    +		if ( !node.right.isleaf() ) yield *rangetraversal( compare , node.right , left , right );
    +	}
    +
    +}
    +
    + +
    + + + + + + + + + + + + diff --git a/function/index.html b/function/index.html index cd71f77..8da1161 100644 --- a/function/index.html +++ b/function/index.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • @@ -332,7 +333,7 @@

    - find(compare: *, node: *, value: *): * + grandparent(n: *): *

    @@ -357,7 +358,7 @@

    - grandparent(n: *): * + * inordertraversal(node: *)

    @@ -382,7 +383,7 @@

    - * inordertraversal(node: *) + insert(compare: *, A: *, B: *): *

    @@ -407,7 +408,7 @@

    - insert(compare: *, A: *, B: *): * + insert_case1(n: *)

    @@ -432,7 +433,7 @@

    - insert_case1(n: *) + insert_case2(n: *)

    @@ -457,7 +458,7 @@

    - insert_case2(n: *) + insert_case3(n: *)

    @@ -482,7 +483,7 @@

    - insert_case3(n: *) + insert_case4(n: *)

    @@ -507,7 +508,7 @@

    - insert_case4(n: *) + insert_case5(n: *)

    @@ -532,7 +533,7 @@

    - insert_case5(n: *) + predecessor(node: *): *

    @@ -557,7 +558,7 @@

    - predecessor(node: *): * + * rangetraversal(compare: *, node: *, left: *, right: *)

    @@ -654,6 +655,31 @@ + + + +
    +

    + search(compare: *, node: *, value: *): * +

    +
    +
    + + + +
    + + + + + + + + + public + + + @@ -1278,84 +1304,6 @@

    Params:

    -
    -
    -

    - public - - - - - find(compare: *, node: *, value: *): * - - - - source - -

    - - - - - - - - -
    -

    Params:

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    NameTypeAttributeDescription
    compare*
    node*
    value*
    -
    -
    - -
    -

    Return:

    - - - - - -
    *
    -
    -
    -
    - - - - - - - - - - - - -

    @@ -1902,6 +1850,80 @@

    Return:

    +
    +
    +

    + public + + + + * + rangetraversal(compare: *, node: *, left: *, right: *) + + + + source + +

    + + + + + + + + +
    +

    Params:

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    compare*
    node*
    left*
    right*
    +
    +
    + + + + + + + + + + + + + + +

    @@ -2092,6 +2114,84 @@

    Params:

    +
    +
    + + + + + + + + + +
    +

    Params:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    compare*
    node*
    value*
    +
    +
    + +
    +

    Return:

    + + + + + +
    *
    +
    +
    +
    + + + + + + + + + + + + +

    diff --git a/identifiers.html b/identifiers.html index cbacaba..ff6f304 100644 --- a/identifiers.html +++ b/identifiers.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • @@ -365,7 +366,7 @@

    - find(compare: *, node: *, value: *): * + grandparent(n: *): *

    @@ -390,7 +391,7 @@

    - grandparent(n: *): * + * inordertraversal(node: *)

    @@ -415,7 +416,7 @@

    - * inordertraversal(node: *) + insert(compare: *, A: *, B: *): *

    @@ -440,7 +441,7 @@

    - insert(compare: *, A: *, B: *): * + insert_case1(n: *)

    @@ -465,7 +466,7 @@

    - insert_case1(n: *) + insert_case2(n: *)

    @@ -490,7 +491,7 @@

    - insert_case2(n: *) + insert_case3(n: *)

    @@ -515,7 +516,7 @@

    - insert_case3(n: *) + insert_case4(n: *)

    @@ -540,7 +541,7 @@

    - insert_case4(n: *) + insert_case5(n: *)

    @@ -565,7 +566,7 @@

    - insert_case5(n: *) + predecessor(node: *): *

    @@ -590,7 +591,7 @@

    - predecessor(node: *): * + * rangetraversal(compare: *, node: *, left: *, right: *)

    @@ -687,6 +688,31 @@ + + + +
    +

    + search(compare: *, node: *, value: *): * +

    +
    +
    + + + +
    + + + + + + + + + public + + + diff --git a/index.html b/index.html index 47daee8..829ca9d 100644 --- a/index.html +++ b/index.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • diff --git a/package.json b/package.json index ee82923..e5a2543 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aureooms-es-red-black-tree", - "version": "0.0.1", + "version": "1.0.0", "author": "aureooms", "license": "AGPL-3.0", "description": "red-black tree library for JavaScript", diff --git a/script/search_index.js b/script/search_index.js index a122ecd..a58adad 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -77,12 +77,6 @@ window.esdocSearchIndex = [ "delete_one_child aureooms-es-red-black-tree/src/removal/delete_one_child.js", "function" ], - [ - "aureooms-es-red-black-tree/src/search/find.js~find", - "function/index.html#static-function-find", - "find aureooms-es-red-black-tree/src/search/find.js", - "function" - ], [ "aureooms-es-red-black-tree/src/family/grandparent.js~grandparent", "function/index.html#static-function-grandparent", @@ -137,6 +131,12 @@ window.esdocSearchIndex = [ "predecessor aureooms-es-red-black-tree/src/family/predecessor.js", "function" ], + [ + "aureooms-es-red-black-tree/src/traversal/rangetraversal.js~rangetraversal", + "function/index.html#static-function-rangetraversal", + "rangetraversal aureooms-es-red-black-tree/src/traversal/rangetraversal.js", + "function" + ], [ "aureooms-es-red-black-tree/src/removal/replace_node.js~replace_node", "function/index.html#static-function-replace_node", @@ -155,6 +155,12 @@ window.esdocSearchIndex = [ "rotate_right aureooms-es-red-black-tree/src/rotate/rotate_right.js", "function" ], + [ + "aureooms-es-red-black-tree/src/search/search.js~search", + "function/index.html#static-function-search", + "search aureooms-es-red-black-tree/src/search/search.js", + "function" + ], [ "aureooms-es-red-black-tree/src/family/sibling.js~sibling", "function/index.html#static-function-sibling", @@ -527,6 +533,12 @@ window.esdocSearchIndex = [ "src/adt/RedBlackTree.js~RedBlackTree#_delete", "method" ], + [ + "src/adt/redblacktree.js~redblacktree#_search", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-_search", + "src/adt/RedBlackTree.js~RedBlackTree#_search", + "method" + ], [ "src/adt/redblacktree.js~redblacktree#add", "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-add", @@ -546,9 +558,21 @@ window.esdocSearchIndex = [ "method" ], [ - "src/adt/redblacktree.js~redblacktree#find", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-find", - "src/adt/RedBlackTree.js~RedBlackTree#find", + "src/adt/redblacktree.js~redblacktree#get", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-get", + "src/adt/RedBlackTree.js~RedBlackTree#get", + "method" + ], + [ + "src/adt/redblacktree.js~redblacktree#has", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-has", + "src/adt/RedBlackTree.js~RedBlackTree#has", + "method" + ], + [ + "src/adt/redblacktree.js~redblacktree#range", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-range", + "src/adt/RedBlackTree.js~RedBlackTree#range", "method" ], [ @@ -563,6 +587,12 @@ window.esdocSearchIndex = [ "src/adt/RedBlackTree.js~RedBlackTree#root", "member" ], + [ + "src/adt/redblacktree.js~redblacktree#values", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-values", + "src/adt/RedBlackTree.js~RedBlackTree#values", + "method" + ], [ "src/adt/redblacktree.js~redblacktree.from", "class/src/adt/RedBlackTree.js~RedBlackTree.html#static-method-from", @@ -755,18 +785,18 @@ window.esdocSearchIndex = [ "src/rotate/rotate_right.js", "file" ], - [ - "src/search/find.js", - "file/src/search/find.js.html", - "src/search/find.js", - "file" - ], [ "src/search/index.js", "file/src/search/index.js.html", "src/search/index.js", "file" ], + [ + "src/search/search.js", + "file/src/search/search.js.html", + "src/search/search.js", + "file" + ], [ "src/traversal/index.js", "file/src/traversal/index.js.html", @@ -778,5 +808,11 @@ window.esdocSearchIndex = [ "file/src/traversal/inordertraversal.js.html", "src/traversal/inordertraversal.js", "file" + ], + [ + "src/traversal/rangetraversal.js", + "file/src/traversal/rangetraversal.js.html", + "src/traversal/rangetraversal.js", + "file" ] ] \ No newline at end of file diff --git a/source.html b/source.html index 9f25a84..9930876 100644 --- a/source.html +++ b/source.html @@ -60,13 +60,14 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • -

    Source 2/37

    +

    Source 2/42

    @@ -87,7 +88,7 @@ - + @@ -95,15 +96,15 @@ - + - + - - - - + + + + @@ -111,7 +112,7 @@ - + @@ -119,7 +120,7 @@ - + @@ -127,7 +128,7 @@ - + @@ -135,7 +136,7 @@ - + @@ -143,7 +144,7 @@ - + @@ -151,7 +152,7 @@ - + @@ -159,7 +160,7 @@ - + @@ -167,7 +168,7 @@ - + @@ -175,7 +176,7 @@ - + @@ -183,7 +184,7 @@ - + @@ -191,7 +192,7 @@ - + @@ -199,7 +200,7 @@ - + @@ -207,7 +208,7 @@ - + @@ -215,7 +216,7 @@ - + @@ -223,7 +224,7 @@ - + @@ -231,7 +232,7 @@ - + @@ -239,7 +240,7 @@ - + @@ -247,7 +248,7 @@ - + @@ -255,7 +256,7 @@ - + @@ -263,7 +264,7 @@ - + @@ -271,7 +272,7 @@ - + @@ -279,7 +280,7 @@ - + @@ -287,7 +288,7 @@ - + @@ -295,7 +296,7 @@ - + @@ -303,7 +304,7 @@ - + @@ -311,7 +312,7 @@ - + @@ -319,7 +320,7 @@ - + @@ -327,7 +328,7 @@ - + @@ -335,7 +336,7 @@ - + @@ -343,7 +344,7 @@ - + @@ -351,31 +352,31 @@ - - - - - - - - - + - + - + + + + + + + + + - - - + + + @@ -383,7 +384,15 @@ - + + + + + + + + +
    0 %0/1 170 byte 82016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/adt/Node.js0 %0/1 266 byte 112016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/adt/RedBlackTree.jssrc/adt/RedBlackTree.js RedBlackTree0 %0/101961 byte982016-07-06 08:55:01 (UTC)0 %0/142326 byte1162016-07-06 10:15:32 (UTC)
    src/adt/index.js- 83 byte 32016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/color/BLACK.js0 %0/1 25 byte 12016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/color/RED.js0 %0/1 23 byte 12016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/color/index.js- 50 byte 22016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/debug/debug.js0 %0/1 307 byte 132016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/debug/index.js- 26 byte 12016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/family/grandparent.js0 %0/1 168 byte 72016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/family/index.js- 118 byte 42016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/family/predecessor.js0 %0/1 136 byte 92016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/family/sibling.js0 %0/1 233 byte 92016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/family/uncle.js0 %0/1 287 byte 112016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/index.js- 245 byte 92016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/insertion/index.js- 192 byte 62016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/insertion/insert.js0 %0/1 360 byte 382016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/insertion/insert_case1.js0 %0/1 183 byte 112016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/insertion/insert_case2.js0 %0/1 207 byte 112016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/insertion/insert_case3.js0 %0/1 395 byte 182016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/insertion/insert_case4.js0 %0/1 922 byte 412016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/insertion/insert_case5.js0 %0/1 254 byte 142016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/removal/delete_case1.js0 %0/1 139 byte 72016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/removal/delete_case2.js0 %0/1 359 byte 182016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/removal/delete_case3.js0 %0/1 468 byte 212016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/removal/delete_case4.js0 %0/1 375 byte 182016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/removal/delete_case5.js0 %0/1 1032 byte 292016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/removal/delete_case6.js0 %0/1 329 byte 172016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/removal/delete_one_child.js0 %0/1 802 byte 282016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/removal/index.js- 268 byte 82016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/removal/replace_node.js0 %0/1 243 byte 122016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/rotate/index.js- 65 byte 22016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/rotate/rotate_left.js100 %1/1 589 byte 352016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/rotate/rotate_right.js100 %1/1 599 byte 362016-07-06 08:55:01 (UTC)
    src/search/find.jsfind0 %0/1351 byte282016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/search/index.js - -25 byte27 byte 12016-07-06 08:55:01 (UTC)2016-07-06 10:12:23 (UTC)
    src/search/search.jssearch0 %0/1353 byte282016-07-06 09:37:22 (UTC)
    src/traversal/index.js - -37 byte12016-07-06 08:55:01 (UTC)72 byte22016-07-06 10:12:23 (UTC)
    src/traversal/inordertraversal.js0 %0/1 219 byte 132016-07-06 08:55:01 (UTC)2016-07-06 08:59:28 (UTC)
    src/traversal/rangetraversal.jsrangetraversal0 %0/1567 byte152016-07-06 10:25:33 (UTC)
    diff --git a/variable/index.html b/variable/index.html index 95b0482..f90aacd 100644 --- a/variable/index.html +++ b/variable/index.html @@ -60,8 +60,9 @@
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • -
  • Ffind
  • +
  • Fsearch
  • Finordertraversal
  • +
  • Frangetraversal
  • From 3ab3551ff600cbf040cd102c8a2174c8b68a5303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Fri, 22 Jul 2016 12:42:08 +0200 Subject: [PATCH 09/26] esdoc update --- index.html | 4 ++- package.json | 2 +- source.html | 78 ++++++++++++++++++++++++++-------------------------- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/index.html b/index.html index 829ca9d..4ceabcb 100644 --- a/index.html +++ b/index.html @@ -68,7 +68,9 @@

    aureooms/es-red-black-tree

    -

    red-black tree library for JavaScript. See documentation.

    +
    let tree = RedBlackTree.from( increasing , range( 100000 ) ) ;
    +
    +

    Red-black tree library for JavaScript. See documentation.

    NPM license NPM version Build status diff --git a/package.json b/package.json index e5a2543..8467182 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aureooms-es-red-black-tree", - "version": "1.0.0", + "version": "1.0.1", "author": "aureooms", "license": "AGPL-3.0", "description": "red-black tree library for JavaScript", diff --git a/source.html b/source.html index 9930876..89dee08 100644 --- a/source.html +++ b/source.html @@ -88,7 +88,7 @@ 0 %0/1 170 byte 8 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/adt/Node.js @@ -96,7 +96,7 @@ 0 %0/1 266 byte 11 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/adt/RedBlackTree.js @@ -104,7 +104,7 @@ 0 %0/14 2326 byte 116 - 2016-07-06 10:15:32 (UTC) + 2016-07-06 10:40:27 (UTC) src/adt/index.js @@ -112,7 +112,7 @@ - 83 byte 3 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/color/BLACK.js @@ -120,7 +120,7 @@ 0 %0/1 25 byte 1 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/color/RED.js @@ -128,7 +128,7 @@ 0 %0/1 23 byte 1 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/color/index.js @@ -136,7 +136,7 @@ - 50 byte 2 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/debug/debug.js @@ -144,7 +144,7 @@ 0 %0/1 307 byte 13 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/debug/index.js @@ -152,7 +152,7 @@ - 26 byte 1 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/family/grandparent.js @@ -160,7 +160,7 @@ 0 %0/1 168 byte 7 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/family/index.js @@ -168,7 +168,7 @@ - 118 byte 4 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/family/predecessor.js @@ -176,7 +176,7 @@ 0 %0/1 136 byte 9 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/family/sibling.js @@ -184,7 +184,7 @@ 0 %0/1 233 byte 9 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/family/uncle.js @@ -192,7 +192,7 @@ 0 %0/1 287 byte 11 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/index.js @@ -200,7 +200,7 @@ - 245 byte 9 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/insertion/index.js @@ -208,7 +208,7 @@ - 192 byte 6 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/insertion/insert.js @@ -216,7 +216,7 @@ 0 %0/1 360 byte 38 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/insertion/insert_case1.js @@ -224,7 +224,7 @@ 0 %0/1 183 byte 11 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/insertion/insert_case2.js @@ -232,7 +232,7 @@ 0 %0/1 207 byte 11 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/insertion/insert_case3.js @@ -240,7 +240,7 @@ 0 %0/1 395 byte 18 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/insertion/insert_case4.js @@ -248,7 +248,7 @@ 0 %0/1 922 byte 41 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/insertion/insert_case5.js @@ -256,7 +256,7 @@ 0 %0/1 254 byte 14 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/delete_case1.js @@ -264,7 +264,7 @@ 0 %0/1 139 byte 7 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/delete_case2.js @@ -272,7 +272,7 @@ 0 %0/1 359 byte 18 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/delete_case3.js @@ -280,7 +280,7 @@ 0 %0/1 468 byte 21 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/delete_case4.js @@ -288,7 +288,7 @@ 0 %0/1 375 byte 18 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/delete_case5.js @@ -296,7 +296,7 @@ 0 %0/1 1032 byte 29 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/delete_case6.js @@ -304,7 +304,7 @@ 0 %0/1 329 byte 17 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/delete_one_child.js @@ -312,7 +312,7 @@ 0 %0/1 802 byte 28 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/index.js @@ -320,7 +320,7 @@ - 268 byte 8 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/removal/replace_node.js @@ -328,7 +328,7 @@ 0 %0/1 243 byte 12 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/rotate/index.js @@ -336,7 +336,7 @@ - 65 byte 2 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/rotate/rotate_left.js @@ -344,7 +344,7 @@ 100 %1/1 589 byte 35 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/rotate/rotate_right.js @@ -352,7 +352,7 @@ 100 %1/1 599 byte 36 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/search/index.js @@ -360,7 +360,7 @@ - 27 byte 1 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/search/search.js @@ -368,7 +368,7 @@ 0 %0/1 353 byte 28 - 2016-07-06 09:37:22 (UTC) + 2016-07-06 10:40:27 (UTC) src/traversal/index.js @@ -376,7 +376,7 @@ - 72 byte 2 - 2016-07-06 10:12:23 (UTC) + 2016-07-06 10:40:27 (UTC) src/traversal/inordertraversal.js @@ -384,7 +384,7 @@ 0 %0/1 219 byte 13 - 2016-07-06 08:59:28 (UTC) + 2016-07-06 10:40:27 (UTC) src/traversal/rangetraversal.js @@ -392,7 +392,7 @@ 0 %0/1 567 byte 15 - 2016-07-06 10:25:33 (UTC) + 2016-07-06 10:40:27 (UTC) From 73edb495ebb2f901cbcf51e963b35ed7236433ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Fri, 22 Jul 2016 12:47:41 +0200 Subject: [PATCH 10/26] esdoc update --- ast/source/rotate/rotate_left.js.json | 428 ++++++++++++------------- ast/source/rotate/rotate_right.js.json | 428 ++++++++++++------------- dump.json | 8 +- file/src/rotate/rotate_left.js.html | 10 +- file/src/rotate/rotate_right.js.html | 10 +- function/index.html | 24 +- package.json | 2 +- source.html | 82 ++--- 8 files changed, 496 insertions(+), 496 deletions(-) diff --git a/ast/source/rotate/rotate_left.js.json b/ast/source/rotate/rotate_left.js.json index ce92a3c..ae6d207 100644 --- a/ast/source/rotate/rotate_left.js.json +++ b/ast/source/rotate/rotate_left.js.json @@ -9,8 +9,8 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 284, - 295 + 299, + 310 ], "loc": { "start": { @@ -28,8 +28,8 @@ "type": "Identifier", "name": "A", "range": [ - 298, - 299 + 313, + 314 ], "loc": { "start": { @@ -55,8 +55,8 @@ "type": "Identifier", "name": "B", "range": [ - 312, - 313 + 327, + 328 ], "loc": { "start": { @@ -76,8 +76,8 @@ "type": "Identifier", "name": "A", "range": [ - 316, - 317 + 331, + 332 ], "loc": { "start": { @@ -94,8 +94,8 @@ "type": "Identifier", "name": "right", "range": [ - 318, - 323 + 333, + 338 ], "loc": { "start": { @@ -109,8 +109,8 @@ } }, "range": [ - 316, - 323 + 331, + 338 ], "loc": { "start": { @@ -124,8 +124,8 @@ } }, "range": [ - 312, - 323 + 327, + 338 ], "loc": { "start": { @@ -141,8 +141,8 @@ ], "kind": "const", "range": [ - 306, - 325 + 321, + 340 ], "loc": { "start": { @@ -164,8 +164,8 @@ "type": "Identifier", "name": "a", "range": [ - 333, - 334 + 348, + 349 ], "loc": { "start": { @@ -185,8 +185,8 @@ "type": "Identifier", "name": "A", "range": [ - 337, - 338 + 352, + 353 ], "loc": { "start": { @@ -203,8 +203,8 @@ "type": "Identifier", "name": "left", "range": [ - 339, - 343 + 354, + 358 ], "loc": { "start": { @@ -218,8 +218,8 @@ } }, "range": [ - 337, - 343 + 352, + 358 ], "loc": { "start": { @@ -233,8 +233,8 @@ } }, "range": [ - 333, - 343 + 348, + 358 ], "loc": { "start": { @@ -250,8 +250,8 @@ ], "kind": "const", "range": [ - 327, - 345 + 342, + 360 ], "loc": { "start": { @@ -273,8 +273,8 @@ "type": "Identifier", "name": "b", "range": [ - 353, - 354 + 368, + 369 ], "loc": { "start": { @@ -294,8 +294,8 @@ "type": "Identifier", "name": "B", "range": [ - 357, - 358 + 372, + 373 ], "loc": { "start": { @@ -312,8 +312,8 @@ "type": "Identifier", "name": "left", "range": [ - 359, - 363 + 374, + 378 ], "loc": { "start": { @@ -327,8 +327,8 @@ } }, "range": [ - 357, - 363 + 372, + 378 ], "loc": { "start": { @@ -342,8 +342,8 @@ } }, "range": [ - 353, - 363 + 368, + 378 ], "loc": { "start": { @@ -359,8 +359,8 @@ ], "kind": "const", "range": [ - 347, - 365 + 362, + 380 ], "loc": { "start": { @@ -382,8 +382,8 @@ "type": "Identifier", "name": "c", "range": [ - 373, - 374 + 388, + 389 ], "loc": { "start": { @@ -403,8 +403,8 @@ "type": "Identifier", "name": "B", "range": [ - 377, - 378 + 392, + 393 ], "loc": { "start": { @@ -421,8 +421,8 @@ "type": "Identifier", "name": "right", "range": [ - 379, - 384 + 394, + 399 ], "loc": { "start": { @@ -436,8 +436,8 @@ } }, "range": [ - 377, - 384 + 392, + 399 ], "loc": { "start": { @@ -451,8 +451,8 @@ } }, "range": [ - 373, - 384 + 388, + 399 ], "loc": { "start": { @@ -468,8 +468,8 @@ ], "kind": "const", "range": [ - 367, - 386 + 382, + 401 ], "loc": { "start": { @@ -497,8 +497,8 @@ "type": "Identifier", "name": "A", "range": [ - 390, - 391 + 405, + 406 ], "loc": { "start": { @@ -515,8 +515,8 @@ "type": "Identifier", "name": "value", "range": [ - 392, - 397 + 407, + 412 ], "loc": { "start": { @@ -530,8 +530,8 @@ } }, "range": [ - 390, - 397 + 405, + 412 ], "loc": { "start": { @@ -551,8 +551,8 @@ "type": "Identifier", "name": "B", "range": [ - 400, - 401 + 415, + 416 ], "loc": { "start": { @@ -569,8 +569,8 @@ "type": "Identifier", "name": "value", "range": [ - 402, - 407 + 417, + 422 ], "loc": { "start": { @@ -584,8 +584,8 @@ } }, "range": [ - 400, - 407 + 415, + 422 ], "loc": { "start": { @@ -600,8 +600,8 @@ } ], "range": [ - 389, - 408 + 404, + 423 ], "loc": { "start": { @@ -624,8 +624,8 @@ "type": "Identifier", "name": "B", "range": [ - 412, - 413 + 427, + 428 ], "loc": { "start": { @@ -642,8 +642,8 @@ "type": "Identifier", "name": "value", "range": [ - 414, - 419 + 429, + 434 ], "loc": { "start": { @@ -657,8 +657,8 @@ } }, "range": [ - 412, - 419 + 427, + 434 ], "loc": { "start": { @@ -678,8 +678,8 @@ "type": "Identifier", "name": "A", "range": [ - 422, - 423 + 437, + 438 ], "loc": { "start": { @@ -696,8 +696,8 @@ "type": "Identifier", "name": "value", "range": [ - 424, - 429 + 439, + 444 ], "loc": { "start": { @@ -711,8 +711,8 @@ } }, "range": [ - 422, - 429 + 437, + 444 ], "loc": { "start": { @@ -727,8 +727,8 @@ } ], "range": [ - 411, - 430 + 426, + 445 ], "loc": { "start": { @@ -742,8 +742,8 @@ } }, "range": [ - 389, - 430 + 404, + 445 ], "loc": { "start": { @@ -757,8 +757,8 @@ } }, "range": [ - 389, - 432 + 404, + 447 ], "loc": { "start": { @@ -786,8 +786,8 @@ "type": "Identifier", "name": "A", "range": [ - 435, - 436 + 450, + 451 ], "loc": { "start": { @@ -804,8 +804,8 @@ "type": "Identifier", "name": "color", "range": [ - 437, - 442 + 452, + 457 ], "loc": { "start": { @@ -819,8 +819,8 @@ } }, "range": [ - 435, - 442 + 450, + 457 ], "loc": { "start": { @@ -840,8 +840,8 @@ "type": "Identifier", "name": "B", "range": [ - 445, - 446 + 460, + 461 ], "loc": { "start": { @@ -858,8 +858,8 @@ "type": "Identifier", "name": "color", "range": [ - 447, - 452 + 462, + 467 ], "loc": { "start": { @@ -873,8 +873,8 @@ } }, "range": [ - 445, - 452 + 460, + 467 ], "loc": { "start": { @@ -889,8 +889,8 @@ } ], "range": [ - 434, - 453 + 449, + 468 ], "loc": { "start": { @@ -913,8 +913,8 @@ "type": "Identifier", "name": "B", "range": [ - 457, - 458 + 472, + 473 ], "loc": { "start": { @@ -931,8 +931,8 @@ "type": "Identifier", "name": "color", "range": [ - 459, - 464 + 474, + 479 ], "loc": { "start": { @@ -946,8 +946,8 @@ } }, "range": [ - 457, - 464 + 472, + 479 ], "loc": { "start": { @@ -967,8 +967,8 @@ "type": "Identifier", "name": "A", "range": [ - 467, - 468 + 482, + 483 ], "loc": { "start": { @@ -985,8 +985,8 @@ "type": "Identifier", "name": "color", "range": [ - 469, - 474 + 484, + 489 ], "loc": { "start": { @@ -1000,8 +1000,8 @@ } }, "range": [ - 467, - 474 + 482, + 489 ], "loc": { "start": { @@ -1016,8 +1016,8 @@ } ], "range": [ - 456, - 475 + 471, + 490 ], "loc": { "start": { @@ -1031,8 +1031,8 @@ } }, "range": [ - 434, - 475 + 449, + 490 ], "loc": { "start": { @@ -1046,8 +1046,8 @@ } }, "range": [ - 434, - 477 + 449, + 492 ], "loc": { "start": { @@ -1072,8 +1072,8 @@ "type": "Identifier", "name": "A", "range": [ - 480, - 481 + 495, + 496 ], "loc": { "start": { @@ -1090,8 +1090,8 @@ "type": "Identifier", "name": "left", "range": [ - 482, - 486 + 497, + 501 ], "loc": { "start": { @@ -1105,8 +1105,8 @@ } }, "range": [ - 480, - 486 + 495, + 501 ], "loc": { "start": { @@ -1123,8 +1123,8 @@ "type": "Identifier", "name": "B", "range": [ - 489, - 490 + 504, + 505 ], "loc": { "start": { @@ -1138,8 +1138,8 @@ } }, "range": [ - 480, - 490 + 495, + 505 ], "loc": { "start": { @@ -1153,8 +1153,8 @@ } }, "range": [ - 480, - 492 + 495, + 507 ], "loc": { "start": { @@ -1179,8 +1179,8 @@ "type": "Identifier", "name": "A", "range": [ - 494, - 495 + 509, + 510 ], "loc": { "start": { @@ -1197,8 +1197,8 @@ "type": "Identifier", "name": "right", "range": [ - 496, - 501 + 511, + 516 ], "loc": { "start": { @@ -1212,8 +1212,8 @@ } }, "range": [ - 494, - 501 + 509, + 516 ], "loc": { "start": { @@ -1230,8 +1230,8 @@ "type": "Identifier", "name": "c", "range": [ - 504, - 505 + 519, + 520 ], "loc": { "start": { @@ -1245,8 +1245,8 @@ } }, "range": [ - 494, - 505 + 509, + 520 ], "loc": { "start": { @@ -1260,8 +1260,8 @@ } }, "range": [ - 494, - 507 + 509, + 522 ], "loc": { "start": { @@ -1286,8 +1286,8 @@ "type": "Identifier", "name": "B", "range": [ - 510, - 511 + 525, + 526 ], "loc": { "start": { @@ -1304,8 +1304,8 @@ "type": "Identifier", "name": "left", "range": [ - 512, - 516 + 527, + 531 ], "loc": { "start": { @@ -1319,8 +1319,8 @@ } }, "range": [ - 510, - 516 + 525, + 531 ], "loc": { "start": { @@ -1337,8 +1337,8 @@ "type": "Identifier", "name": "a", "range": [ - 519, - 520 + 534, + 535 ], "loc": { "start": { @@ -1352,8 +1352,8 @@ } }, "range": [ - 510, - 520 + 525, + 535 ], "loc": { "start": { @@ -1367,8 +1367,8 @@ } }, "range": [ - 510, - 522 + 525, + 537 ], "loc": { "start": { @@ -1393,8 +1393,8 @@ "type": "Identifier", "name": "B", "range": [ - 524, - 525 + 539, + 540 ], "loc": { "start": { @@ -1411,8 +1411,8 @@ "type": "Identifier", "name": "right", "range": [ - 526, - 531 + 541, + 546 ], "loc": { "start": { @@ -1426,8 +1426,8 @@ } }, "range": [ - 524, - 531 + 539, + 546 ], "loc": { "start": { @@ -1444,8 +1444,8 @@ "type": "Identifier", "name": "b", "range": [ - 534, - 535 + 549, + 550 ], "loc": { "start": { @@ -1459,8 +1459,8 @@ } }, "range": [ - 524, - 535 + 539, + 550 ], "loc": { "start": { @@ -1474,8 +1474,8 @@ } }, "range": [ - 524, - 537 + 539, + 552 ], "loc": { "start": { @@ -1500,8 +1500,8 @@ "type": "Identifier", "name": "a", "range": [ - 540, - 541 + 555, + 556 ], "loc": { "start": { @@ -1518,8 +1518,8 @@ "type": "Identifier", "name": "parent", "range": [ - 542, - 548 + 557, + 563 ], "loc": { "start": { @@ -1533,8 +1533,8 @@ } }, "range": [ - 540, - 548 + 555, + 563 ], "loc": { "start": { @@ -1551,8 +1551,8 @@ "type": "Identifier", "name": "B", "range": [ - 551, - 552 + 566, + 567 ], "loc": { "start": { @@ -1566,8 +1566,8 @@ } }, "range": [ - 540, - 552 + 555, + 567 ], "loc": { "start": { @@ -1581,8 +1581,8 @@ } }, "range": [ - 540, - 554 + 555, + 569 ], "loc": { "start": { @@ -1607,8 +1607,8 @@ "type": "Identifier", "name": "b", "range": [ - 556, - 557 + 571, + 572 ], "loc": { "start": { @@ -1625,8 +1625,8 @@ "type": "Identifier", "name": "parent", "range": [ - 558, - 564 + 573, + 579 ], "loc": { "start": { @@ -1640,8 +1640,8 @@ } }, "range": [ - 556, - 564 + 571, + 579 ], "loc": { "start": { @@ -1658,8 +1658,8 @@ "type": "Identifier", "name": "B", "range": [ - 567, - 568 + 582, + 583 ], "loc": { "start": { @@ -1673,8 +1673,8 @@ } }, "range": [ - 556, - 568 + 571, + 583 ], "loc": { "start": { @@ -1688,8 +1688,8 @@ } }, "range": [ - 556, - 570 + 571, + 585 ], "loc": { "start": { @@ -1714,8 +1714,8 @@ "type": "Identifier", "name": "c", "range": [ - 572, - 573 + 587, + 588 ], "loc": { "start": { @@ -1732,8 +1732,8 @@ "type": "Identifier", "name": "parent", "range": [ - 574, - 580 + 589, + 595 ], "loc": { "start": { @@ -1747,8 +1747,8 @@ } }, "range": [ - 572, - 580 + 587, + 595 ], "loc": { "start": { @@ -1765,8 +1765,8 @@ "type": "Identifier", "name": "A", "range": [ - 583, - 584 + 598, + 599 ], "loc": { "start": { @@ -1780,8 +1780,8 @@ } }, "range": [ - 572, - 584 + 587, + 599 ], "loc": { "start": { @@ -1795,8 +1795,8 @@ } }, "range": [ - 572, - 586 + 587, + 601 ], "loc": { "start": { @@ -1811,8 +1811,8 @@ } ], "range": [ - 302, - 588 + 317, + 603 ], "loc": { "start": { @@ -1828,8 +1828,8 @@ "generator": false, "expression": false, "range": [ - 275, - 588 + 290, + 603 ], "loc": { "start": { @@ -1844,10 +1844,10 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", "range": [ 0, - 266 + 281 ], "loc": { "start": { @@ -1866,8 +1866,8 @@ "specifiers": [], "source": null, "range": [ - 268, - 588 + 283, + 603 ], "loc": { "start": { @@ -1882,10 +1882,10 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", "range": [ 0, - 266 + 281 ], "loc": { "start": { @@ -1903,8 +1903,8 @@ ], "sourceType": "module", "range": [ - 268, - 588 + 283, + 603 ], "loc": { "start": { @@ -1919,10 +1919,10 @@ "comments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", + "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", "range": [ 0, - 266 + 281 ], "loc": { "start": { diff --git a/ast/source/rotate/rotate_right.js.json b/ast/source/rotate/rotate_right.js.json index 72c4069..9377184 100644 --- a/ast/source/rotate/rotate_right.js.json +++ b/ast/source/rotate/rotate_right.js.json @@ -9,8 +9,8 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 293, - 305 + 308, + 320 ], "loc": { "start": { @@ -28,8 +28,8 @@ "type": "Identifier", "name": "B", "range": [ - 308, - 309 + 323, + 324 ], "loc": { "start": { @@ -55,8 +55,8 @@ "type": "Identifier", "name": "A", "range": [ - 322, - 323 + 337, + 338 ], "loc": { "start": { @@ -76,8 +76,8 @@ "type": "Identifier", "name": "B", "range": [ - 326, - 327 + 341, + 342 ], "loc": { "start": { @@ -94,8 +94,8 @@ "type": "Identifier", "name": "left", "range": [ - 328, - 332 + 343, + 347 ], "loc": { "start": { @@ -109,8 +109,8 @@ } }, "range": [ - 326, - 332 + 341, + 347 ], "loc": { "start": { @@ -124,8 +124,8 @@ } }, "range": [ - 322, - 332 + 337, + 347 ], "loc": { "start": { @@ -141,8 +141,8 @@ ], "kind": "const", "range": [ - 316, - 333 + 331, + 348 ], "loc": { "start": { @@ -164,8 +164,8 @@ "type": "Identifier", "name": "a", "range": [ - 341, - 342 + 356, + 357 ], "loc": { "start": { @@ -185,8 +185,8 @@ "type": "Identifier", "name": "A", "range": [ - 345, - 346 + 360, + 361 ], "loc": { "start": { @@ -203,8 +203,8 @@ "type": "Identifier", "name": "left", "range": [ - 347, - 351 + 362, + 366 ], "loc": { "start": { @@ -218,8 +218,8 @@ } }, "range": [ - 345, - 351 + 360, + 366 ], "loc": { "start": { @@ -233,8 +233,8 @@ } }, "range": [ - 341, - 351 + 356, + 366 ], "loc": { "start": { @@ -250,8 +250,8 @@ ], "kind": "const", "range": [ - 335, - 353 + 350, + 368 ], "loc": { "start": { @@ -273,8 +273,8 @@ "type": "Identifier", "name": "b", "range": [ - 361, - 362 + 376, + 377 ], "loc": { "start": { @@ -294,8 +294,8 @@ "type": "Identifier", "name": "A", "range": [ - 365, - 366 + 380, + 381 ], "loc": { "start": { @@ -312,8 +312,8 @@ "type": "Identifier", "name": "right", "range": [ - 367, - 372 + 382, + 387 ], "loc": { "start": { @@ -327,8 +327,8 @@ } }, "range": [ - 365, - 372 + 380, + 387 ], "loc": { "start": { @@ -342,8 +342,8 @@ } }, "range": [ - 361, - 372 + 376, + 387 ], "loc": { "start": { @@ -359,8 +359,8 @@ ], "kind": "const", "range": [ - 355, - 374 + 370, + 389 ], "loc": { "start": { @@ -382,8 +382,8 @@ "type": "Identifier", "name": "c", "range": [ - 382, - 383 + 397, + 398 ], "loc": { "start": { @@ -403,8 +403,8 @@ "type": "Identifier", "name": "B", "range": [ - 386, - 387 + 401, + 402 ], "loc": { "start": { @@ -421,8 +421,8 @@ "type": "Identifier", "name": "right", "range": [ - 388, - 393 + 403, + 408 ], "loc": { "start": { @@ -436,8 +436,8 @@ } }, "range": [ - 386, - 393 + 401, + 408 ], "loc": { "start": { @@ -451,8 +451,8 @@ } }, "range": [ - 382, - 393 + 397, + 408 ], "loc": { "start": { @@ -468,8 +468,8 @@ ], "kind": "const", "range": [ - 376, - 395 + 391, + 410 ], "loc": { "start": { @@ -497,8 +497,8 @@ "type": "Identifier", "name": "A", "range": [ - 399, - 400 + 414, + 415 ], "loc": { "start": { @@ -515,8 +515,8 @@ "type": "Identifier", "name": "value", "range": [ - 401, - 406 + 416, + 421 ], "loc": { "start": { @@ -530,8 +530,8 @@ } }, "range": [ - 399, - 406 + 414, + 421 ], "loc": { "start": { @@ -551,8 +551,8 @@ "type": "Identifier", "name": "B", "range": [ - 409, - 410 + 424, + 425 ], "loc": { "start": { @@ -569,8 +569,8 @@ "type": "Identifier", "name": "value", "range": [ - 411, - 416 + 426, + 431 ], "loc": { "start": { @@ -584,8 +584,8 @@ } }, "range": [ - 409, - 416 + 424, + 431 ], "loc": { "start": { @@ -600,8 +600,8 @@ } ], "range": [ - 398, - 417 + 413, + 432 ], "loc": { "start": { @@ -624,8 +624,8 @@ "type": "Identifier", "name": "B", "range": [ - 421, - 422 + 436, + 437 ], "loc": { "start": { @@ -642,8 +642,8 @@ "type": "Identifier", "name": "value", "range": [ - 423, - 428 + 438, + 443 ], "loc": { "start": { @@ -657,8 +657,8 @@ } }, "range": [ - 421, - 428 + 436, + 443 ], "loc": { "start": { @@ -678,8 +678,8 @@ "type": "Identifier", "name": "A", "range": [ - 431, - 432 + 446, + 447 ], "loc": { "start": { @@ -696,8 +696,8 @@ "type": "Identifier", "name": "value", "range": [ - 433, - 438 + 448, + 453 ], "loc": { "start": { @@ -711,8 +711,8 @@ } }, "range": [ - 431, - 438 + 446, + 453 ], "loc": { "start": { @@ -727,8 +727,8 @@ } ], "range": [ - 420, - 439 + 435, + 454 ], "loc": { "start": { @@ -742,8 +742,8 @@ } }, "range": [ - 398, - 439 + 413, + 454 ], "loc": { "start": { @@ -757,8 +757,8 @@ } }, "range": [ - 398, - 441 + 413, + 456 ], "loc": { "start": { @@ -786,8 +786,8 @@ "type": "Identifier", "name": "A", "range": [ - 444, - 445 + 459, + 460 ], "loc": { "start": { @@ -804,8 +804,8 @@ "type": "Identifier", "name": "color", "range": [ - 446, - 451 + 461, + 466 ], "loc": { "start": { @@ -819,8 +819,8 @@ } }, "range": [ - 444, - 451 + 459, + 466 ], "loc": { "start": { @@ -840,8 +840,8 @@ "type": "Identifier", "name": "B", "range": [ - 454, - 455 + 469, + 470 ], "loc": { "start": { @@ -858,8 +858,8 @@ "type": "Identifier", "name": "color", "range": [ - 456, - 461 + 471, + 476 ], "loc": { "start": { @@ -873,8 +873,8 @@ } }, "range": [ - 454, - 461 + 469, + 476 ], "loc": { "start": { @@ -889,8 +889,8 @@ } ], "range": [ - 443, - 462 + 458, + 477 ], "loc": { "start": { @@ -913,8 +913,8 @@ "type": "Identifier", "name": "B", "range": [ - 466, - 467 + 481, + 482 ], "loc": { "start": { @@ -931,8 +931,8 @@ "type": "Identifier", "name": "color", "range": [ - 468, - 473 + 483, + 488 ], "loc": { "start": { @@ -946,8 +946,8 @@ } }, "range": [ - 466, - 473 + 481, + 488 ], "loc": { "start": { @@ -967,8 +967,8 @@ "type": "Identifier", "name": "A", "range": [ - 476, - 477 + 491, + 492 ], "loc": { "start": { @@ -985,8 +985,8 @@ "type": "Identifier", "name": "color", "range": [ - 478, - 483 + 493, + 498 ], "loc": { "start": { @@ -1000,8 +1000,8 @@ } }, "range": [ - 476, - 483 + 491, + 498 ], "loc": { "start": { @@ -1016,8 +1016,8 @@ } ], "range": [ - 465, - 484 + 480, + 499 ], "loc": { "start": { @@ -1031,8 +1031,8 @@ } }, "range": [ - 443, - 484 + 458, + 499 ], "loc": { "start": { @@ -1046,8 +1046,8 @@ } }, "range": [ - 443, - 486 + 458, + 501 ], "loc": { "start": { @@ -1072,8 +1072,8 @@ "type": "Identifier", "name": "B", "range": [ - 489, - 490 + 504, + 505 ], "loc": { "start": { @@ -1090,8 +1090,8 @@ "type": "Identifier", "name": "left", "range": [ - 491, - 495 + 506, + 510 ], "loc": { "start": { @@ -1105,8 +1105,8 @@ } }, "range": [ - 489, - 495 + 504, + 510 ], "loc": { "start": { @@ -1123,8 +1123,8 @@ "type": "Identifier", "name": "a", "range": [ - 498, - 499 + 513, + 514 ], "loc": { "start": { @@ -1138,8 +1138,8 @@ } }, "range": [ - 489, - 499 + 504, + 514 ], "loc": { "start": { @@ -1153,8 +1153,8 @@ } }, "range": [ - 489, - 501 + 504, + 516 ], "loc": { "start": { @@ -1179,8 +1179,8 @@ "type": "Identifier", "name": "B", "range": [ - 503, - 504 + 518, + 519 ], "loc": { "start": { @@ -1197,8 +1197,8 @@ "type": "Identifier", "name": "right", "range": [ - 505, - 510 + 520, + 525 ], "loc": { "start": { @@ -1212,8 +1212,8 @@ } }, "range": [ - 503, - 510 + 518, + 525 ], "loc": { "start": { @@ -1230,8 +1230,8 @@ "type": "Identifier", "name": "A", "range": [ - 513, - 514 + 528, + 529 ], "loc": { "start": { @@ -1245,8 +1245,8 @@ } }, "range": [ - 503, - 514 + 518, + 529 ], "loc": { "start": { @@ -1260,8 +1260,8 @@ } }, "range": [ - 503, - 516 + 518, + 531 ], "loc": { "start": { @@ -1286,8 +1286,8 @@ "type": "Identifier", "name": "A", "range": [ - 519, - 520 + 534, + 535 ], "loc": { "start": { @@ -1304,8 +1304,8 @@ "type": "Identifier", "name": "left", "range": [ - 521, - 525 + 536, + 540 ], "loc": { "start": { @@ -1319,8 +1319,8 @@ } }, "range": [ - 519, - 525 + 534, + 540 ], "loc": { "start": { @@ -1337,8 +1337,8 @@ "type": "Identifier", "name": "b", "range": [ - 528, - 529 + 543, + 544 ], "loc": { "start": { @@ -1352,8 +1352,8 @@ } }, "range": [ - 519, - 529 + 534, + 544 ], "loc": { "start": { @@ -1367,8 +1367,8 @@ } }, "range": [ - 519, - 531 + 534, + 546 ], "loc": { "start": { @@ -1393,8 +1393,8 @@ "type": "Identifier", "name": "A", "range": [ - 533, - 534 + 548, + 549 ], "loc": { "start": { @@ -1411,8 +1411,8 @@ "type": "Identifier", "name": "right", "range": [ - 535, - 540 + 550, + 555 ], "loc": { "start": { @@ -1426,8 +1426,8 @@ } }, "range": [ - 533, - 540 + 548, + 555 ], "loc": { "start": { @@ -1444,8 +1444,8 @@ "type": "Identifier", "name": "c", "range": [ - 543, - 544 + 558, + 559 ], "loc": { "start": { @@ -1459,8 +1459,8 @@ } }, "range": [ - 533, - 544 + 548, + 559 ], "loc": { "start": { @@ -1474,8 +1474,8 @@ } }, "range": [ - 533, - 546 + 548, + 561 ], "loc": { "start": { @@ -1500,8 +1500,8 @@ "type": "Identifier", "name": "a", "range": [ - 549, - 550 + 564, + 565 ], "loc": { "start": { @@ -1518,8 +1518,8 @@ "type": "Identifier", "name": "parent", "range": [ - 551, - 557 + 566, + 572 ], "loc": { "start": { @@ -1533,8 +1533,8 @@ } }, "range": [ - 549, - 557 + 564, + 572 ], "loc": { "start": { @@ -1551,8 +1551,8 @@ "type": "Identifier", "name": "B", "range": [ - 560, - 561 + 575, + 576 ], "loc": { "start": { @@ -1566,8 +1566,8 @@ } }, "range": [ - 549, - 561 + 564, + 576 ], "loc": { "start": { @@ -1581,8 +1581,8 @@ } }, "range": [ - 549, - 563 + 564, + 578 ], "loc": { "start": { @@ -1607,8 +1607,8 @@ "type": "Identifier", "name": "b", "range": [ - 565, - 566 + 580, + 581 ], "loc": { "start": { @@ -1625,8 +1625,8 @@ "type": "Identifier", "name": "parent", "range": [ - 567, - 573 + 582, + 588 ], "loc": { "start": { @@ -1640,8 +1640,8 @@ } }, "range": [ - 565, - 573 + 580, + 588 ], "loc": { "start": { @@ -1658,8 +1658,8 @@ "type": "Identifier", "name": "A", "range": [ - 576, - 577 + 591, + 592 ], "loc": { "start": { @@ -1673,8 +1673,8 @@ } }, "range": [ - 565, - 577 + 580, + 592 ], "loc": { "start": { @@ -1688,8 +1688,8 @@ } }, "range": [ - 565, - 579 + 580, + 594 ], "loc": { "start": { @@ -1714,8 +1714,8 @@ "type": "Identifier", "name": "c", "range": [ - 581, - 582 + 596, + 597 ], "loc": { "start": { @@ -1732,8 +1732,8 @@ "type": "Identifier", "name": "parent", "range": [ - 583, - 589 + 598, + 604 ], "loc": { "start": { @@ -1747,8 +1747,8 @@ } }, "range": [ - 581, - 589 + 596, + 604 ], "loc": { "start": { @@ -1765,8 +1765,8 @@ "type": "Identifier", "name": "A", "range": [ - 592, - 593 + 607, + 608 ], "loc": { "start": { @@ -1780,8 +1780,8 @@ } }, "range": [ - 581, - 593 + 596, + 608 ], "loc": { "start": { @@ -1795,8 +1795,8 @@ } }, "range": [ - 581, - 595 + 596, + 610 ], "loc": { "start": { @@ -1811,8 +1811,8 @@ } ], "range": [ - 312, - 598 + 327, + 613 ], "loc": { "start": { @@ -1828,8 +1828,8 @@ "generator": false, "expression": false, "range": [ - 284, - 598 + 299, + 613 ], "loc": { "start": { @@ -1844,10 +1844,10 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", "range": [ 0, - 275 + 290 ], "loc": { "start": { @@ -1866,8 +1866,8 @@ "specifiers": [], "source": null, "range": [ - 277, - 598 + 292, + 613 ], "loc": { "start": { @@ -1882,10 +1882,10 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", "range": [ 0, - 275 + 290 ], "loc": { "start": { @@ -1903,8 +1903,8 @@ ], "sourceType": "module", "range": [ - 277, - 598 + 292, + 613 ], "loc": { "start": { @@ -1919,10 +1919,10 @@ "comments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", + "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", "range": [ 0, - 275 + 290 ], "loc": { "start": { diff --git a/dump.json b/dump.json index b37d389..e9b42ae 100644 --- a/dump.json +++ b/dump.json @@ -1452,7 +1452,7 @@ "access": null, "description": null, "lineNumber": 16, - "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" + "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" }, { "__docId__": 74, @@ -1466,7 +1466,7 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/rotate/rotate_left.js", "importStyle": "{rotate_left}", - "description": "Rotate tree left.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", + "description": "Rotate tree left.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", "lineNumber": 16, "params": [ { @@ -1493,7 +1493,7 @@ "access": null, "description": null, "lineNumber": 16, - "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" + "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" }, { "__docId__": 76, @@ -1507,7 +1507,7 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/rotate/rotate_right.js", "importStyle": "{rotate_right}", - "description": "Rotate tree right.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", + "description": "Rotate tree right.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", "lineNumber": 16, "params": [ { diff --git a/file/src/rotate/rotate_left.js.html b/file/src/rotate/rotate_left.js.html index 588992c..1ba24bb 100644 --- a/file/src/rotate/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -72,11 +72,11 @@ * Rotate tree left. * (see https://en.wikipedia.org/wiki/Tree_rotation) * - * A B - * / \ / \ - * a B -> A c - * / \ / \ - * b c a b + * A B + * / \ / \ + * a B -> A c + * / \ / \ + * b c a b * * * @param {Node} A root of the tree diff --git a/file/src/rotate/rotate_right.js.html b/file/src/rotate/rotate_right.js.html index ee3af43..e3f858a 100644 --- a/file/src/rotate/rotate_right.js.html +++ b/file/src/rotate/rotate_right.js.html @@ -72,11 +72,11 @@ * Rotate tree right. * (see https://en.wikipedia.org/wiki/Tree_rotation) * - * B A - * / \ / \ - * A c -> a B - * / \ / \ - * a b b c + * B A + * / \ / \ + * A c -> a B + * / \ / \ + * a b b c * * * @param {Node} B root of the tree diff --git a/function/index.html b/function/index.html index 8da1161..7dde221 100644 --- a/function/index.html +++ b/function/index.html @@ -2007,12 +2007,12 @@

    Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)

    -
     A                B
    -/ \              / \
    -

    a B -> A c - / \ / \ - b c a b

    -
    +
        A                B
    +   / \              / \
    +  a   B     ->     A   c
    +     / \          / \
    +    b   c        a   b
    +

    @@ -2071,12 +2071,12 @@

    Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)

    -
     B                A
    -/ \              / \
    -

    A c -> a B - / \ / \ - a b b c

    -
    +
        B                A
    +   / \              / \
    +  A   c     ->     a   B
    + / \                  / \
    +a   b                b   c
    +

    diff --git a/package.json b/package.json index 8467182..2ffe1a7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aureooms-es-red-black-tree", - "version": "1.0.1", + "version": "1.0.2", "author": "aureooms", "license": "AGPL-3.0", "description": "red-black tree library for JavaScript", diff --git a/source.html b/source.html index 89dee08..d1d5d28 100644 --- a/source.html +++ b/source.html @@ -88,7 +88,7 @@ 0 %0/1 170 byte 8 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/adt/Node.js @@ -96,7 +96,7 @@ 0 %0/1 266 byte 11 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/adt/RedBlackTree.js @@ -104,7 +104,7 @@ 0 %0/14 2326 byte 116 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/adt/index.js @@ -112,7 +112,7 @@ - 83 byte 3 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/color/BLACK.js @@ -120,7 +120,7 @@ 0 %0/1 25 byte 1 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/color/RED.js @@ -128,7 +128,7 @@ 0 %0/1 23 byte 1 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/color/index.js @@ -136,7 +136,7 @@ - 50 byte 2 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/debug/debug.js @@ -144,7 +144,7 @@ 0 %0/1 307 byte 13 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/debug/index.js @@ -152,7 +152,7 @@ - 26 byte 1 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/family/grandparent.js @@ -160,7 +160,7 @@ 0 %0/1 168 byte 7 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/family/index.js @@ -168,7 +168,7 @@ - 118 byte 4 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/family/predecessor.js @@ -176,7 +176,7 @@ 0 %0/1 136 byte 9 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/family/sibling.js @@ -184,7 +184,7 @@ 0 %0/1 233 byte 9 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/family/uncle.js @@ -192,7 +192,7 @@ 0 %0/1 287 byte 11 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/index.js @@ -200,7 +200,7 @@ - 245 byte 9 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/insertion/index.js @@ -208,7 +208,7 @@ - 192 byte 6 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/insertion/insert.js @@ -216,7 +216,7 @@ 0 %0/1 360 byte 38 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/insertion/insert_case1.js @@ -224,7 +224,7 @@ 0 %0/1 183 byte 11 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/insertion/insert_case2.js @@ -232,7 +232,7 @@ 0 %0/1 207 byte 11 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/insertion/insert_case3.js @@ -240,7 +240,7 @@ 0 %0/1 395 byte 18 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/insertion/insert_case4.js @@ -248,7 +248,7 @@ 0 %0/1 922 byte 41 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/insertion/insert_case5.js @@ -256,7 +256,7 @@ 0 %0/1 254 byte 14 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/delete_case1.js @@ -264,7 +264,7 @@ 0 %0/1 139 byte 7 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/delete_case2.js @@ -272,7 +272,7 @@ 0 %0/1 359 byte 18 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/delete_case3.js @@ -280,7 +280,7 @@ 0 %0/1 468 byte 21 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/delete_case4.js @@ -288,7 +288,7 @@ 0 %0/1 375 byte 18 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/delete_case5.js @@ -296,7 +296,7 @@ 0 %0/1 1032 byte 29 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/delete_case6.js @@ -304,7 +304,7 @@ 0 %0/1 329 byte 17 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/delete_one_child.js @@ -312,7 +312,7 @@ 0 %0/1 802 byte 28 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/index.js @@ -320,7 +320,7 @@ - 268 byte 8 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/removal/replace_node.js @@ -328,7 +328,7 @@ 0 %0/1 243 byte 12 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/rotate/index.js @@ -336,23 +336,23 @@ - 65 byte 2 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/rotate/rotate_left.js rotate_left 100 %1/1 - 589 byte + 604 byte 35 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:46:34 (UTC) src/rotate/rotate_right.js rotate_right 100 %1/1 - 599 byte + 614 byte 36 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:46:08 (UTC) src/search/index.js @@ -360,7 +360,7 @@ - 27 byte 1 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/search/search.js @@ -368,7 +368,7 @@ 0 %0/1 353 byte 28 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/traversal/index.js @@ -376,7 +376,7 @@ - 72 byte 2 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/traversal/inordertraversal.js @@ -384,7 +384,7 @@ 0 %0/1 219 byte 13 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) src/traversal/rangetraversal.js @@ -392,7 +392,7 @@ 0 %0/1 567 byte 15 - 2016-07-06 10:40:27 (UTC) + 2016-07-06 10:42:11 (UTC) From cee6883272c834a030353c41ab8e1c01a660cda0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Sun, 31 Jul 2016 21:25:59 +0200 Subject: [PATCH 11/26] esdoc update --- ast/source/adt/Leaf.js.json | 403 +- ast/source/adt/Node.js.json | 609 +-- ast/source/adt/RedBlackTree.js.json | 3501 ++++++++++------- ast/source/color/BLACK.js.json | 112 +- ast/source/color/RED.js.json | 112 +- ast/source/debug/debug.js.json | 596 +-- .../delete_case1.js.json | 286 +- .../delete_case2.js.json | 1088 +++-- .../delete_case3.js.json | 933 ++--- .../delete_case4.js.json | 997 ++--- ast/source/deletion/delete_case5.js.json | 2307 +++++++++++ .../delete_case6.js.json | 1004 +++-- .../delete_one_child.js.json | 997 +++-- .../{removal => deletion}/index.js.json | 0 .../replace_node.js.json | 405 +- ast/source/family/grandparent.js.json | 229 +- ast/source/family/predecessor.js.json | 330 +- ast/source/family/sibling.js.json | 415 +- ast/source/family/uncle.js.json | 519 +-- ast/source/index.js.json | 70 +- ast/source/insertion/insert.js.json | 718 ++-- ast/source/insertion/insert_case1.js.json | 450 ++- ast/source/insertion/insert_case2.js.json | 451 ++- ast/source/insertion/insert_case3.js.json | 767 ++-- ast/source/insertion/insert_case4.js.json | 1001 +++-- ast/source/insertion/insert_case5.js.json | 826 ++-- ast/source/removal/delete_case5.js.json | 2517 ------------ ast/source/rotate/rotate_left.js.json | 486 +-- ast/source/rotate/rotate_right.js.json | 486 +-- ast/source/search/search.js.json | 587 ++- ast/source/traversal/inordertraversal.js.json | 704 +++- ast/source/traversal/rangetraversal.js.json | 1222 +++--- badge.svg | 8 +- .../src/adt/RedBlackTree.js~RedBlackTree.html | 330 +- coverage.json | 194 +- dump.json | 1470 ++++--- file/src/adt/Leaf.js.html | 29 +- file/src/adt/Node.js.html | 34 +- file/src/adt/RedBlackTree.js.html | 128 +- file/src/adt/index.js.html | 16 +- file/src/color/BLACK.js.html | 21 +- file/src/color/RED.js.html | 21 +- file/src/color/index.js.html | 16 +- file/src/debug/debug.js.html | 31 +- file/src/debug/index.js.html | 16 +- .../delete_case1.js.html | 30 +- .../delete_case2.js.html | 67 +- .../delete_case3.js.html | 70 +- .../delete_case4.js.html | 73 +- .../delete_case5.js.html | 97 +- .../delete_case6.js.html | 78 +- .../delete_one_child.js.html | 53 +- file/src/{removal => deletion}/index.js.html | 20 +- .../replace_node.js.html | 28 +- file/src/family/grandparent.js.html | 30 +- file/src/family/index.js.html | 16 +- file/src/family/predecessor.js.html | 28 +- file/src/family/sibling.js.html | 32 +- file/src/family/uncle.js.html | 29 +- file/src/index.js.html | 18 +- file/src/insertion/index.js.html | 16 +- file/src/insertion/insert.js.html | 34 +- file/src/insertion/insert_case1.js.html | 44 +- file/src/insertion/insert_case2.js.html | 47 +- file/src/insertion/insert_case3.js.html | 64 +- file/src/insertion/insert_case4.js.html | 119 +- file/src/insertion/insert_case5.js.html | 73 +- file/src/rotate/index.js.html | 16 +- file/src/rotate/rotate_left.js.html | 24 +- file/src/rotate/rotate_right.js.html | 24 +- file/src/search/index.js.html | 16 +- file/src/search/search.js.html | 39 +- file/src/traversal/index.js.html | 16 +- file/src/traversal/inordertraversal.js.html | 33 +- file/src/traversal/rangetraversal.js.html | 48 +- function/index.html | 757 ++-- identifiers.html | 208 +- index.html | 16 +- script/search_index.js | 152 +- source.html | 380 +- variable/index.html | 36 +- 81 files changed, 17715 insertions(+), 12558 deletions(-) rename ast/source/{removal => deletion}/delete_case1.js.json (57%) rename ast/source/{removal => deletion}/delete_case2.js.json (58%) rename ast/source/{removal => deletion}/delete_case3.js.json (65%) rename ast/source/{removal => deletion}/delete_case4.js.json (61%) create mode 100644 ast/source/deletion/delete_case5.js.json rename ast/source/{removal => deletion}/delete_case6.js.json (61%) rename ast/source/{removal => deletion}/delete_one_child.js.json (58%) rename ast/source/{removal => deletion}/index.js.json (100%) rename ast/source/{removal => deletion}/replace_node.js.json (73%) delete mode 100644 ast/source/removal/delete_case5.js.json rename file/src/{removal => deletion}/delete_case1.js.html (92%) rename file/src/{removal => deletion}/delete_case2.js.html (85%) rename file/src/{removal => deletion}/delete_case3.js.html (83%) rename file/src/{removal => deletion}/delete_case4.js.html (81%) rename file/src/{removal => deletion}/delete_case5.js.html (78%) rename file/src/{removal => deletion}/delete_case6.js.html (81%) rename file/src/{removal => deletion}/delete_one_child.js.html (87%) rename file/src/{removal => deletion}/index.js.html (96%) rename file/src/{removal => deletion}/replace_node.js.html (93%) diff --git a/ast/source/adt/Leaf.js.json b/ast/source/adt/Leaf.js.json index 8bde1fa..14789fc 100644 --- a/ast/source/adt/Leaf.js.json +++ b/ast/source/adt/Leaf.js.json @@ -90,7 +90,27 @@ "line": 1, "column": 28 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", + "range": [ + 30, + 152 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -100,16 +120,16 @@ "type": "Identifier", "name": "Leaf", "range": [ - 46, - 50 + 169, + 173 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 16 }, "end": { - "line": 3, + "line": 10, "column": 20 } } @@ -119,16 +139,16 @@ "type": "Identifier", "name": "parent", "range": [ - 53, - 59 + 176, + 182 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 23 }, "end": { - "line": 3, + "line": 10, "column": 29 } } @@ -148,16 +168,16 @@ "object": { "type": "ThisExpression", "range": [ - 65, - 69 + 188, + 192 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 1 }, "end": { - "line": 4, + "line": 11, "column": 5 } } @@ -166,31 +186,31 @@ "type": "Identifier", "name": "color", "range": [ - 70, - 75 + 193, + 198 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 6 }, "end": { - "line": 4, + "line": 11, "column": 11 } } }, "range": [ - 65, - 75 + 188, + 198 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 1 }, "end": { - "line": 4, + "line": 11, "column": 11 } } @@ -199,46 +219,46 @@ "type": "Identifier", "name": "BLACK", "range": [ - 78, - 83 + 201, + 206 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 14 }, "end": { - "line": 4, + "line": 11, "column": 19 } } }, "range": [ - 65, - 83 + 188, + 206 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 1 }, "end": { - "line": 4, + "line": 11, "column": 19 } } }, "range": [ - 65, - 85 + 188, + 208 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 1 }, "end": { - "line": 4, + "line": 11, "column": 21 } } @@ -254,16 +274,16 @@ "object": { "type": "ThisExpression", "range": [ - 87, - 91 + 210, + 214 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 1 }, "end": { - "line": 5, + "line": 12, "column": 5 } } @@ -272,31 +292,31 @@ "type": "Identifier", "name": "parent", "range": [ - 92, - 98 + 215, + 221 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 6 }, "end": { - "line": 5, + "line": 12, "column": 12 } } }, "range": [ - 87, - 98 + 210, + 221 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 1 }, "end": { - "line": 5, + "line": 12, "column": 12 } } @@ -305,62 +325,62 @@ "type": "Identifier", "name": "parent", "range": [ - 101, - 107 + 224, + 230 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 15 }, "end": { - "line": 5, + "line": 12, "column": 21 } } }, "range": [ - 87, - 107 + 210, + 230 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 1 }, "end": { - "line": 5, + "line": 12, "column": 21 } } }, "range": [ - 87, - 109 + 210, + 232 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 1 }, "end": { - "line": 5, + "line": 12, "column": 23 } } } ], "range": [ - 62, - 111 + 185, + 234 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 32 }, "end": { - "line": 6, + "line": 13, "column": 1 } } @@ -368,38 +388,116 @@ "generator": false, "expression": false, "range": [ - 37, - 111 + 160, + 234 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 7 }, "end": { - "line": 6, + "line": 13, "column": 1 } }, - "leadingComments": [], - "trailingComments": [] + "leadingComments": [ + { + "type": "Block", + "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", + "range": [ + 30, + 152 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", + "range": [ + 236, + 382 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ] }, "specifiers": [], "source": null, "range": [ - 30, - 111 + 153, + 234 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 0 }, "end": { - "line": 6, + "line": 13, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", + "range": [ + 30, + 152 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", + "range": [ + 236, + 382 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -416,16 +514,16 @@ "type": "Identifier", "name": "Leaf", "range": [ - 113, - 117 + 383, + 387 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 0 }, "end": { - "line": 8, + "line": 21, "column": 4 } } @@ -434,31 +532,31 @@ "type": "Identifier", "name": "prototype", "range": [ - 118, - 127 + 388, + 397 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 5 }, "end": { - "line": 8, + "line": 21, "column": 14 } } }, "range": [ - 113, - 127 + 383, + 397 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 0 }, "end": { - "line": 8, + "line": 21, "column": 14 } } @@ -467,31 +565,31 @@ "type": "Identifier", "name": "isleaf", "range": [ - 128, - 134 + 398, + 404 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 15 }, "end": { - "line": 8, + "line": 21, "column": 21 } } }, "range": [ - 113, - 134 + 383, + 404 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 0 }, "end": { - "line": 8, + "line": 21, "column": 21 } } @@ -502,16 +600,16 @@ "type": "Identifier", "name": "isleaf", "range": [ - 128, - 134 + 398, + 404 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 15 }, "end": { - "line": 8, + "line": 21, "column": 21 } } @@ -527,47 +625,47 @@ "value": true, "raw": "true", "range": [ - 159, - 163 + 429, + 433 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 46 }, "end": { - "line": 8, + "line": 21, "column": 50 } } }, "range": [ - 152, - 165 + 422, + 435 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 39 }, "end": { - "line": 8, + "line": 21, "column": 52 } } } ], "range": [ - 150, - 167 + 420, + 437 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 37 }, "end": { - "line": 8, + "line": 21, "column": 54 } } @@ -575,55 +673,75 @@ "generator": false, "expression": false, "range": [ - 137, - 167 + 407, + 437 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 24 }, "end": { - "line": 8, + "line": 21, "column": 54 } } }, "range": [ - 113, - 167 + 383, + 437 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 0 }, "end": { - "line": 8, + "line": 21, "column": 54 } } }, "range": [ - 113, - 169 + 383, + 439 ], "loc": { "start": { - "line": 8, + "line": 21, "column": 0 }, "end": { - "line": 8, + "line": 21, "column": 56 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", + "range": [ + 236, + 382 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 169 + 439 ], "loc": { "start": { @@ -631,9 +749,46 @@ "column": 0 }, "end": { - "line": 8, + "line": 21, "column": 56 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", + "range": [ + 30, + 152 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", + "range": [ + 236, + 382 + ], + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/adt/Node.js.json b/ast/source/adt/Node.js.json index 9538223..f25faff 100644 --- a/ast/source/adt/Node.js.json +++ b/ast/source/adt/Node.js.json @@ -90,7 +90,27 @@ "line": 1, "column": 31 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", + "range": [ + 33, + 223 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -100,16 +120,16 @@ "type": "Identifier", "name": "Node", "range": [ - 49, - 53 + 240, + 244 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 16 }, "end": { - "line": 3, + "line": 11, "column": 20 } } @@ -119,35 +139,35 @@ "type": "Identifier", "name": "color", "range": [ - 56, - 61 + 247, + 252 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 23 }, "end": { - "line": 3, + "line": 11, "column": 28 } } }, { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 64, - 69 + 255, + 258 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 31 }, "end": { - "line": 3, - "column": 36 + "line": 11, + "column": 34 } } } @@ -166,16 +186,16 @@ "object": { "type": "ThisExpression", "range": [ - 75, - 79 + 264, + 268 ], "loc": { "start": { - "line": 4, + "line": 12, "column": 1 }, "end": { - "line": 4, + "line": 12, "column": 5 } } @@ -184,31 +204,31 @@ "type": "Identifier", "name": "color", "range": [ - 80, - 85 + 269, + 274 ], "loc": { "start": { - "line": 4, + "line": 12, "column": 6 }, "end": { - "line": 4, + "line": 12, "column": 11 } } }, "range": [ - 75, - 85 + 264, + 274 ], "loc": { "start": { - "line": 4, + "line": 12, "column": 1 }, "end": { - "line": 4, + "line": 12, "column": 11 } } @@ -217,46 +237,46 @@ "type": "Identifier", "name": "color", "range": [ - 88, - 93 + 277, + 282 ], "loc": { "start": { - "line": 4, + "line": 12, "column": 14 }, "end": { - "line": 4, + "line": 12, "column": 19 } } }, "range": [ - 75, - 93 + 264, + 282 ], "loc": { "start": { - "line": 4, + "line": 12, "column": 1 }, "end": { - "line": 4, + "line": 12, "column": 19 } } }, "range": [ - 75, - 95 + 264, + 284 ], "loc": { "start": { - "line": 4, + "line": 12, "column": 1 }, "end": { - "line": 4, + "line": 12, "column": 21 } } @@ -272,16 +292,16 @@ "object": { "type": "ThisExpression", "range": [ - 97, - 101 + 286, + 290 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 1 }, "end": { - "line": 5, + "line": 13, "column": 5 } } @@ -290,31 +310,31 @@ "type": "Identifier", "name": "left", "range": [ - 102, - 106 + 291, + 295 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 6 }, "end": { - "line": 5, + "line": 13, "column": 10 } } }, "range": [ - 97, - 106 + 286, + 295 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 1 }, "end": { - "line": 5, + "line": 13, "column": 10 } } @@ -325,16 +345,16 @@ "type": "Identifier", "name": "Leaf", "range": [ - 113, - 117 + 302, + 306 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 17 }, "end": { - "line": 5, + "line": 13, "column": 21 } } @@ -343,62 +363,62 @@ { "type": "ThisExpression", "range": [ - 119, - 123 + 308, + 312 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 23 }, "end": { - "line": 5, + "line": 13, "column": 27 } } } ], "range": [ - 109, - 125 + 298, + 314 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 13 }, "end": { - "line": 5, + "line": 13, "column": 29 } } }, "range": [ - 97, - 125 + 286, + 314 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 1 }, "end": { - "line": 5, + "line": 13, "column": 29 } } }, "range": [ - 97, - 127 + 286, + 316 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 1 }, "end": { - "line": 5, + "line": 13, "column": 31 } } @@ -414,16 +434,16 @@ "object": { "type": "ThisExpression", "range": [ - 129, - 133 + 318, + 322 ], "loc": { "start": { - "line": 6, + "line": 14, "column": 1 }, "end": { - "line": 6, + "line": 14, "column": 5 } } @@ -432,31 +452,31 @@ "type": "Identifier", "name": "right", "range": [ - 134, - 139 + 323, + 328 ], "loc": { "start": { - "line": 6, + "line": 14, "column": 6 }, "end": { - "line": 6, + "line": 14, "column": 11 } } }, "range": [ - 129, - 139 + 318, + 328 ], "loc": { "start": { - "line": 6, + "line": 14, "column": 1 }, "end": { - "line": 6, + "line": 14, "column": 11 } } @@ -467,16 +487,16 @@ "type": "Identifier", "name": "Leaf", "range": [ - 146, - 150 + 335, + 339 ], "loc": { "start": { - "line": 6, + "line": 14, "column": 18 }, "end": { - "line": 6, + "line": 14, "column": 22 } } @@ -485,62 +505,62 @@ { "type": "ThisExpression", "range": [ - 152, - 156 + 341, + 345 ], "loc": { "start": { - "line": 6, + "line": 14, "column": 24 }, "end": { - "line": 6, + "line": 14, "column": 28 } } } ], "range": [ - 142, - 158 + 331, + 347 ], "loc": { "start": { - "line": 6, + "line": 14, "column": 14 }, "end": { - "line": 6, + "line": 14, "column": 30 } } }, "range": [ - 129, - 158 + 318, + 347 ], "loc": { "start": { - "line": 6, + "line": 14, "column": 1 }, "end": { - "line": 6, + "line": 14, "column": 30 } } }, "range": [ - 129, - 160 + 318, + 349 ], "loc": { "start": { - "line": 6, + "line": 14, "column": 1 }, "end": { - "line": 6, + "line": 14, "column": 32 } } @@ -556,16 +576,16 @@ "object": { "type": "ThisExpression", "range": [ - 162, - 166 + 351, + 355 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 1 }, "end": { - "line": 7, + "line": 15, "column": 5 } } @@ -574,31 +594,31 @@ "type": "Identifier", "name": "parent", "range": [ - 167, - 173 + 356, + 362 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 6 }, "end": { - "line": 7, + "line": 15, "column": 12 } } }, "range": [ - 162, - 173 + 351, + 362 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 1 }, "end": { - "line": 7, + "line": 15, "column": 12 } } @@ -608,46 +628,46 @@ "value": null, "raw": "null", "range": [ - 176, - 180 + 365, + 369 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 15 }, "end": { - "line": 7, + "line": 15, "column": 19 } } }, "range": [ - 162, - 180 + 351, + 369 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 1 }, "end": { - "line": 7, + "line": 15, "column": 19 } } }, "range": [ - 162, - 182 + 351, + 371 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 1 }, "end": { - "line": 7, + "line": 15, "column": 21 } } @@ -663,113 +683,113 @@ "object": { "type": "ThisExpression", "range": [ - 184, - 188 + 373, + 377 ], "loc": { "start": { - "line": 8, + "line": 16, "column": 1 }, "end": { - "line": 8, + "line": 16, "column": 5 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 189, - 194 + 378, + 381 ], "loc": { "start": { - "line": 8, + "line": 16, "column": 6 }, "end": { - "line": 8, - "column": 11 + "line": 16, + "column": 9 } } }, "range": [ - 184, - 194 + 373, + 381 ], "loc": { "start": { - "line": 8, + "line": 16, "column": 1 }, "end": { - "line": 8, - "column": 11 + "line": 16, + "column": 9 } } }, "right": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 197, - 202 + 384, + 387 ], "loc": { "start": { - "line": 8, - "column": 14 + "line": 16, + "column": 12 }, "end": { - "line": 8, - "column": 19 + "line": 16, + "column": 15 } } }, "range": [ - 184, - 202 + 373, + 387 ], "loc": { "start": { - "line": 8, + "line": 16, "column": 1 }, "end": { - "line": 8, - "column": 19 + "line": 16, + "column": 15 } } }, "range": [ - 184, - 204 + 373, + 389 ], "loc": { "start": { - "line": 8, + "line": 16, "column": 1 }, "end": { - "line": 8, - "column": 21 + "line": 16, + "column": 17 } } } ], "range": [ - 72, - 206 + 261, + 391 ], "loc": { "start": { - "line": 3, - "column": 39 + "line": 11, + "column": 37 }, "end": { - "line": 9, + "line": 17, "column": 1 } } @@ -777,38 +797,116 @@ "generator": false, "expression": false, "range": [ - 40, - 206 + 231, + 391 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 7 }, "end": { - "line": 9, + "line": 17, "column": 1 } }, - "leadingComments": [], - "trailingComments": [] + "leadingComments": [ + { + "type": "Block", + "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", + "range": [ + 33, + 223 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", + "range": [ + 393, + 540 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 24, + "column": 3 + } + } + } + ] }, "specifiers": [], "source": null, "range": [ - 33, - 206 + 224, + 391 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 0 }, "end": { - "line": 9, + "line": 17, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", + "range": [ + 33, + 223 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", + "range": [ + 393, + 540 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 24, + "column": 3 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -825,16 +923,16 @@ "type": "Identifier", "name": "Node", "range": [ - 208, - 212 + 541, + 545 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 0 }, "end": { - "line": 11, + "line": 25, "column": 4 } } @@ -843,31 +941,31 @@ "type": "Identifier", "name": "prototype", "range": [ - 213, - 222 + 546, + 555 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 5 }, "end": { - "line": 11, + "line": 25, "column": 14 } } }, "range": [ - 208, - 222 + 541, + 555 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 0 }, "end": { - "line": 11, + "line": 25, "column": 14 } } @@ -876,31 +974,31 @@ "type": "Identifier", "name": "isleaf", "range": [ - 223, - 229 + 556, + 562 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 15 }, "end": { - "line": 11, + "line": 25, "column": 21 } } }, "range": [ - 208, - 229 + 541, + 562 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 0 }, "end": { - "line": 11, + "line": 25, "column": 21 } } @@ -911,16 +1009,16 @@ "type": "Identifier", "name": "isleaf", "range": [ - 223, - 229 + 556, + 562 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 15 }, "end": { - "line": 11, + "line": 25, "column": 21 } } @@ -936,47 +1034,47 @@ "value": false, "raw": "false", "range": [ - 254, - 259 + 587, + 592 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 46 }, "end": { - "line": 11, + "line": 25, "column": 51 } } }, "range": [ - 247, - 261 + 580, + 594 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 39 }, "end": { - "line": 11, + "line": 25, "column": 53 } } } ], "range": [ - 245, - 263 + 578, + 596 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 37 }, "end": { - "line": 11, + "line": 25, "column": 55 } } @@ -984,55 +1082,75 @@ "generator": false, "expression": false, "range": [ - 232, - 263 + 565, + 596 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 24 }, "end": { - "line": 11, + "line": 25, "column": 55 } } }, "range": [ - 208, - 263 + 541, + 596 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 0 }, "end": { - "line": 11, + "line": 25, "column": 55 } } }, "range": [ - 208, - 265 + 541, + 598 ], "loc": { "start": { - "line": 11, + "line": 25, "column": 0 }, "end": { - "line": 11, + "line": 25, "column": 57 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", + "range": [ + 393, + 540 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 24, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 265 + 598 ], "loc": { "start": { @@ -1040,9 +1158,46 @@ "column": 0 }, "end": { - "line": 11, + "line": 25, "column": 57 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", + "range": [ + 33, + 223 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", + "range": [ + 393, + 540 + ], + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 24, + "column": 3 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/adt/RedBlackTree.js.json b/ast/source/adt/RedBlackTree.js.json index bc8f5a2..8f0bc0f 100644 --- a/ast/source/adt/RedBlackTree.js.json +++ b/ast/source/adt/RedBlackTree.js.json @@ -795,7 +795,27 @@ "line": 8, "column": 56 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", + "range": [ + 276, + 325 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -805,16 +825,16 @@ "type": "Identifier", "name": "RedBlackTree", "range": [ - 289, - 301 + 339, + 351 ], "loc": { "start": { - "line": 10, + "line": 14, "column": 13 }, "end": { - "line": 10, + "line": 14, "column": 25 } } @@ -829,16 +849,16 @@ "type": "Identifier", "name": "constructor", "range": [ - 306, - 317 + 512, + 523 ], "loc": { "start": { - "line": 12, + "line": 22, "column": 1 }, "end": { - "line": 12, + "line": 22, "column": 12 } } @@ -851,16 +871,16 @@ "type": "Identifier", "name": "compare", "range": [ - 320, - 327 + 526, + 533 ], "loc": { "start": { - "line": 12, + "line": 22, "column": 15 }, "end": { - "line": 12, + "line": 22, "column": 22 } } @@ -880,16 +900,16 @@ "object": { "type": "ThisExpression", "range": [ - 335, - 339 + 541, + 545 ], "loc": { "start": { - "line": 14, + "line": 24, "column": 2 }, "end": { - "line": 14, + "line": 24, "column": 6 } } @@ -898,31 +918,31 @@ "type": "Identifier", "name": "compare", "range": [ - 340, - 347 + 546, + 553 ], "loc": { "start": { - "line": 14, + "line": 24, "column": 7 }, "end": { - "line": 14, + "line": 24, "column": 14 } } }, "range": [ - 335, - 347 + 541, + 553 ], "loc": { "start": { - "line": 14, + "line": 24, "column": 2 }, "end": { - "line": 14, + "line": 24, "column": 14 } } @@ -931,46 +951,46 @@ "type": "Identifier", "name": "compare", "range": [ - 350, - 357 + 556, + 563 ], "loc": { "start": { - "line": 14, + "line": 24, "column": 17 }, "end": { - "line": 14, + "line": 24, "column": 24 } } }, "range": [ - 335, - 357 + 541, + 563 ], "loc": { "start": { - "line": 14, + "line": 24, "column": 2 }, "end": { - "line": 14, + "line": 24, "column": 24 } } }, "range": [ - 335, - 359 + 541, + 565 ], "loc": { "start": { - "line": 14, + "line": 24, "column": 2 }, "end": { - "line": 14, + "line": 24, "column": 26 } } @@ -986,16 +1006,16 @@ "object": { "type": "ThisExpression", "range": [ - 362, - 366 + 568, + 572 ], "loc": { "start": { - "line": 15, + "line": 25, "column": 2 }, "end": { - "line": 15, + "line": 25, "column": 6 } } @@ -1004,31 +1024,31 @@ "type": "Identifier", "name": "root", "range": [ - 367, - 371 + 573, + 577 ], "loc": { "start": { - "line": 15, + "line": 25, "column": 7 }, "end": { - "line": 15, + "line": 25, "column": 11 } } }, "range": [ - 362, - 371 + 568, + 577 ], "loc": { "start": { - "line": 15, + "line": 25, "column": 2 }, "end": { - "line": 15, + "line": 25, "column": 11 } } @@ -1038,62 +1058,62 @@ "value": null, "raw": "null", "range": [ - 374, - 378 + 580, + 584 ], "loc": { "start": { - "line": 15, + "line": 25, "column": 14 }, "end": { - "line": 15, + "line": 25, "column": 18 } } }, "range": [ - 362, - 378 + 568, + 584 ], "loc": { "start": { - "line": 15, + "line": 25, "column": 2 }, "end": { - "line": 15, + "line": 25, "column": 18 } } }, "range": [ - 362, - 380 + 568, + 586 ], "loc": { "start": { - "line": 15, + "line": 25, "column": 2 }, "end": { - "line": 15, + "line": 25, "column": 20 } } } ], "range": [ - 330, - 384 + 536, + 590 ], "loc": { "start": { - "line": 12, + "line": 22, "column": 25 }, "end": { - "line": 17, + "line": 27, "column": 2 } } @@ -1101,16 +1121,16 @@ "generator": false, "expression": false, "range": [ - 318, - 384 + 524, + 590 ], "loc": { "start": { - "line": 12, + "line": 22, "column": 13 }, "end": { - "line": 17, + "line": 27, "column": 2 } } @@ -1118,19 +1138,59 @@ "kind": "constructor", "computed": false, "range": [ - 306, - 384 + 512, + 590 ], "loc": { "start": { - "line": 12, + "line": 22, "column": 1 }, "end": { - "line": 17, + "line": 27, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t ", + "range": [ + 356, + 510 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t ", + "range": [ + 593, + 672 + ], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 33, + "column": 4 + } + } + } + ], "static": false }, { @@ -1139,16 +1199,16 @@ "type": "Identifier", "name": "add", "range": [ - 387, - 390 + 674, + 677 ], "loc": { "start": { - "line": 19, + "line": 34, "column": 1 }, "end": { - "line": 19, + "line": 34, "column": 4 } } @@ -1159,19 +1219,19 @@ "params": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 393, - 398 + 680, + 683 ], "loc": { "start": { - "line": 19, + "line": 34, "column": 7 }, "end": { - "line": 19, - "column": 12 + "line": 34, + "column": 10 } } } @@ -1190,16 +1250,16 @@ "object": { "type": "ThisExpression", "range": [ - 410, - 414 + 695, + 699 ], "loc": { "start": { - "line": 20, + "line": 35, "column": 7 }, "end": { - "line": 20, + "line": 35, "column": 11 } } @@ -1208,31 +1268,31 @@ "type": "Identifier", "name": "root", "range": [ - 415, - 419 + 700, + 704 ], "loc": { "start": { - "line": 20, + "line": 35, "column": 12 }, "end": { - "line": 20, + "line": 35, "column": 16 } } }, "range": [ - 410, - 419 + 695, + 704 ], "loc": { "start": { - "line": 20, + "line": 35, "column": 7 }, "end": { - "line": 20, + "line": 35, "column": 16 } } @@ -1242,31 +1302,31 @@ "value": null, "raw": "null", "range": [ - 424, - 428 + 709, + 713 ], "loc": { "start": { - "line": 20, + "line": 35, "column": 21 }, "end": { - "line": 20, + "line": 35, "column": 25 } } }, "range": [ - 410, - 428 + 695, + 713 ], "loc": { "start": { - "line": 20, + "line": 35, "column": 7 }, "end": { - "line": 20, + "line": 35, "column": 25 } } @@ -1285,16 +1345,16 @@ "object": { "type": "ThisExpression", "range": [ - 436, - 440 + 721, + 725 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 3 }, "end": { - "line": 21, + "line": 36, "column": 7 } } @@ -1303,31 +1363,31 @@ "type": "Identifier", "name": "root", "range": [ - 441, - 445 + 726, + 730 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 8 }, "end": { - "line": 21, + "line": 36, "column": 12 } } }, "range": [ - 436, - 445 + 721, + 730 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 3 }, "end": { - "line": 21, + "line": 36, "column": 12 } } @@ -1338,16 +1398,16 @@ "type": "Identifier", "name": "Node", "range": [ - 452, - 456 + 737, + 741 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 19 }, "end": { - "line": 21, + "line": 36, "column": 23 } } @@ -1357,96 +1417,96 @@ "type": "Identifier", "name": "BLACK", "range": [ - 458, - 463 + 743, + 748 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 25 }, "end": { - "line": 21, + "line": 36, "column": 30 } } }, { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 466, - 471 + 751, + 754 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 33 }, "end": { - "line": 21, - "column": 38 + "line": 36, + "column": 36 } } } ], "range": [ - 448, - 473 + 733, + 756 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 15 }, "end": { - "line": 21, - "column": 40 + "line": 36, + "column": 38 } } }, "range": [ - 436, - 473 + 721, + 756 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 3 }, "end": { - "line": 21, - "column": 40 + "line": 36, + "column": 38 } } }, "range": [ - 436, - 475 + 721, + 758 ], "loc": { "start": { - "line": 21, + "line": 36, "column": 3 }, "end": { - "line": 21, - "column": 42 + "line": 36, + "column": 40 } } } ], "range": [ - 431, - 479 + 716, + 762 ], "loc": { "start": { - "line": 20, + "line": 35, "column": 28 }, "end": { - "line": 22, + "line": 37, "column": 3 } } @@ -1463,16 +1523,16 @@ "type": "Identifier", "name": "node", "range": [ - 498, - 502 + 781, + 785 ], "loc": { "start": { - "line": 24, + "line": 39, "column": 9 }, "end": { - "line": 24, + "line": 39, "column": 13 } } @@ -1483,16 +1543,16 @@ "type": "Identifier", "name": "Node", "range": [ - 509, - 513 + 792, + 796 ], "loc": { "start": { - "line": 24, + "line": 39, "column": 20 }, "end": { - "line": 24, + "line": 39, "column": 24 } } @@ -1502,83 +1562,83 @@ "type": "Identifier", "name": "RED", "range": [ - 515, - 518 + 798, + 801 ], "loc": { "start": { - "line": 24, + "line": 39, "column": 26 }, "end": { - "line": 24, + "line": 39, "column": 29 } } }, { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 521, - 526 + 804, + 807 ], "loc": { "start": { - "line": 24, + "line": 39, "column": 32 }, "end": { - "line": 24, - "column": 37 + "line": 39, + "column": 35 } } } ], "range": [ - 505, - 528 + 788, + 809 ], "loc": { "start": { - "line": 24, + "line": 39, "column": 16 }, "end": { - "line": 24, - "column": 39 + "line": 39, + "column": 37 } } }, "range": [ - 498, - 528 + 781, + 809 ], "loc": { "start": { - "line": 24, + "line": 39, "column": 9 }, "end": { - "line": 24, - "column": 39 + "line": 39, + "column": 37 } } } ], "kind": "const", "range": [ - 492, - 530 + 775, + 811 ], "loc": { "start": { - "line": 24, + "line": 39, "column": 3 }, "end": { - "line": 24, - "column": 41 + "line": 39, + "column": 39 } } }, @@ -1590,16 +1650,16 @@ "type": "Identifier", "name": "insert", "range": [ - 534, - 540 + 815, + 821 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 3 }, "end": { - "line": 25, + "line": 40, "column": 9 } } @@ -1611,16 +1671,16 @@ "object": { "type": "ThisExpression", "range": [ - 542, - 546 + 823, + 827 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 11 }, "end": { - "line": 25, + "line": 40, "column": 15 } } @@ -1629,31 +1689,31 @@ "type": "Identifier", "name": "compare", "range": [ - 547, - 554 + 828, + 835 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 16 }, "end": { - "line": 25, + "line": 40, "column": 23 } } }, "range": [ - 542, - 554 + 823, + 835 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 11 }, "end": { - "line": 25, + "line": 40, "column": 23 } } @@ -1664,16 +1724,16 @@ "object": { "type": "ThisExpression", "range": [ - 557, - 561 + 838, + 842 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 26 }, "end": { - "line": 25, + "line": 40, "column": 30 } } @@ -1682,31 +1742,31 @@ "type": "Identifier", "name": "root", "range": [ - 562, - 566 + 843, + 847 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 31 }, "end": { - "line": 25, + "line": 40, "column": 35 } } }, "range": [ - 557, - 566 + 838, + 847 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 26 }, "end": { - "line": 25, + "line": 40, "column": 35 } } @@ -1715,47 +1775,47 @@ "type": "Identifier", "name": "node", "range": [ - 569, - 573 + 850, + 854 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 38 }, "end": { - "line": 25, + "line": 40, "column": 42 } } } ], "range": [ - 534, - 575 + 815, + 856 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 3 }, "end": { - "line": 25, + "line": 40, "column": 44 } } }, "range": [ - 534, - 577 + 815, + 858 ], "loc": { "start": { - "line": 25, + "line": 40, "column": 3 }, "end": { - "line": 25, + "line": 40, "column": 46 } } @@ -1768,16 +1828,16 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 581, - 593 + 862, + 874 ], "loc": { "start": { - "line": 26, + "line": 41, "column": 3 }, "end": { - "line": 26, + "line": 41, "column": 15 } } @@ -1787,94 +1847,94 @@ "type": "Identifier", "name": "node", "range": [ - 595, - 599 + 876, + 880 ], "loc": { "start": { - "line": 26, + "line": 41, "column": 17 }, "end": { - "line": 26, + "line": 41, "column": 21 } } } ], "range": [ - 581, - 601 + 862, + 882 ], "loc": { "start": { - "line": 26, + "line": 41, "column": 3 }, "end": { - "line": 26, + "line": 41, "column": 23 } } }, "range": [ - 581, - 603 + 862, + 884 ], "loc": { "start": { - "line": 26, + "line": 41, "column": 3 }, "end": { - "line": 26, + "line": 41, "column": 25 } } } ], "range": [ - 487, - 607 + 770, + 888 ], "loc": { "start": { - "line": 23, + "line": 38, "column": 7 }, "end": { - "line": 27, + "line": 42, "column": 3 } } }, "range": [ - 405, - 607 + 690, + 888 ], "loc": { "start": { - "line": 20, + "line": 35, "column": 2 }, "end": { - "line": 27, + "line": 42, "column": 3 } } } ], "range": [ - 401, - 610 + 686, + 891 ], "loc": { "start": { - "line": 19, - "column": 15 + "line": 34, + "column": 13 }, "end": { - "line": 28, + "line": 43, "column": 2 } } @@ -1882,16 +1942,16 @@ "generator": false, "expression": false, "range": [ - 391, - 610 + 678, + 891 ], "loc": { "start": { - "line": 19, + "line": 34, "column": 5 }, "end": { - "line": 28, + "line": 43, "column": 2 } } @@ -1899,19 +1959,59 @@ "kind": "method", "computed": false, "range": [ - 387, - 610 + 674, + 891 ], "loc": { "start": { - "line": 19, + "line": 34, "column": 1 }, "end": { - "line": 28, + "line": 43, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t ", + "range": [ + 593, + 672 + ], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 33, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t ", + "range": [ + 894, + 1120 + ], + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 52, + "column": 4 + } + } + } + ], "static": false }, { @@ -1920,16 +2020,16 @@ "type": "Identifier", "name": "_search", "range": [ - 613, - 620 + 1122, + 1129 ], "loc": { "start": { - "line": 30, + "line": 53, "column": 1 }, "end": { - "line": 30, + "line": 53, "column": 8 } } @@ -1940,19 +2040,19 @@ "params": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 623, - 628 + 1132, + 1135 ], "loc": { "start": { - "line": 30, + "line": 53, "column": 11 }, "end": { - "line": 30, - "column": 16 + "line": 53, + "column": 14 } } } @@ -1971,16 +2071,16 @@ "object": { "type": "ThisExpression", "range": [ - 640, - 644 + 1147, + 1151 ], "loc": { "start": { - "line": 31, + "line": 54, "column": 7 }, "end": { - "line": 31, + "line": 54, "column": 11 } } @@ -1989,31 +2089,31 @@ "type": "Identifier", "name": "root", "range": [ - 645, - 649 + 1152, + 1156 ], "loc": { "start": { - "line": 31, + "line": 54, "column": 12 }, "end": { - "line": 31, + "line": 54, "column": 16 } } }, "range": [ - 640, - 649 + 1147, + 1156 ], "loc": { "start": { - "line": 31, + "line": 54, "column": 7 }, "end": { - "line": 31, + "line": 54, "column": 16 } } @@ -2023,31 +2123,31 @@ "value": null, "raw": "null", "range": [ - 654, - 658 + 1161, + 1165 ], "loc": { "start": { - "line": 31, + "line": 54, "column": 21 }, "end": { - "line": 31, + "line": 54, "column": 25 } } }, "range": [ - 640, - 658 + 1147, + 1165 ], "loc": { "start": { - "line": 31, + "line": 54, "column": 7 }, "end": { - "line": 31, + "line": 54, "column": 25 } } @@ -2059,47 +2159,47 @@ "value": null, "raw": "null", "range": [ - 668, - 672 + 1175, + 1179 ], "loc": { "start": { - "line": 31, + "line": 54, "column": 35 }, "end": { - "line": 31, + "line": 54, "column": 39 } } }, "range": [ - 661, - 674 + 1168, + 1181 ], "loc": { "start": { - "line": 31, + "line": 54, "column": 28 }, "end": { - "line": 31, + "line": 54, "column": 41 } } }, "alternate": null, "range": [ - 635, - 674 + 1142, + 1181 ], "loc": { "start": { - "line": 31, + "line": 54, "column": 2 }, "end": { - "line": 31, + "line": 54, "column": 41 } } @@ -2112,16 +2212,16 @@ "type": "Identifier", "name": "search", "range": [ - 684, - 690 + 1191, + 1197 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 9 }, "end": { - "line": 32, + "line": 55, "column": 15 } } @@ -2133,16 +2233,16 @@ "object": { "type": "ThisExpression", "range": [ - 692, - 696 + 1199, + 1203 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 17 }, "end": { - "line": 32, + "line": 55, "column": 21 } } @@ -2151,31 +2251,31 @@ "type": "Identifier", "name": "compare", "range": [ - 697, - 704 + 1204, + 1211 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 22 }, "end": { - "line": 32, + "line": 55, "column": 29 } } }, "range": [ - 692, - 704 + 1199, + 1211 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 17 }, "end": { - "line": 32, + "line": 55, "column": 29 } } @@ -2186,16 +2286,16 @@ "object": { "type": "ThisExpression", "range": [ - 707, - 711 + 1214, + 1218 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 32 }, "end": { - "line": 32, + "line": 55, "column": 36 } } @@ -2204,96 +2304,96 @@ "type": "Identifier", "name": "root", "range": [ - 712, - 716 + 1219, + 1223 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 37 }, "end": { - "line": 32, + "line": 55, "column": 41 } } }, "range": [ - 707, - 716 + 1214, + 1223 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 32 }, "end": { - "line": 32, + "line": 55, "column": 41 } } }, { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 719, - 724 + 1226, + 1229 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 44 }, "end": { - "line": 32, - "column": 49 + "line": 55, + "column": 47 } } } ], "range": [ - 684, - 726 + 1191, + 1231 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 9 }, "end": { - "line": 32, - "column": 51 + "line": 55, + "column": 49 } } }, "range": [ - 677, - 728 + 1184, + 1233 ], "loc": { "start": { - "line": 32, + "line": 55, "column": 2 }, "end": { - "line": 32, - "column": 53 + "line": 55, + "column": 51 } } } ], "range": [ - 631, - 731 + 1138, + 1236 ], "loc": { "start": { - "line": 30, - "column": 19 + "line": 53, + "column": 17 }, "end": { - "line": 33, + "line": 56, "column": 2 } } @@ -2301,16 +2401,16 @@ "generator": false, "expression": false, "range": [ - 621, - 731 + 1130, + 1236 ], "loc": { "start": { - "line": 30, + "line": 53, "column": 9 }, "end": { - "line": 33, + "line": 56, "column": 2 } } @@ -2318,19 +2418,59 @@ "kind": "method", "computed": false, "range": [ - 613, - 731 + 1122, + 1236 ], "loc": { "start": { - "line": 30, + "line": 53, "column": 1 }, "end": { - "line": 33, + "line": 56, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t ", + "range": [ + 894, + 1120 + ], + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 52, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t ", + "range": [ + 1239, + 1501 + ], + "loc": { + "start": { + "line": 58, + "column": 1 + }, + "end": { + "line": 65, + "column": 4 + } + } + } + ], "static": false }, { @@ -2339,16 +2479,16 @@ "type": "Identifier", "name": "get", "range": [ - 734, - 737 + 1503, + 1506 ], "loc": { "start": { - "line": 35, + "line": 66, "column": 1 }, "end": { - "line": 35, + "line": 66, "column": 4 } } @@ -2359,19 +2499,19 @@ "params": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 740, - 745 + 1509, + 1512 ], "loc": { "start": { - "line": 35, + "line": 66, "column": 7 }, "end": { - "line": 35, - "column": 12 + "line": 66, + "column": 10 } } } @@ -2388,16 +2528,16 @@ "type": "Identifier", "name": "node", "range": [ - 758, - 762 + 1525, + 1529 ], "loc": { "start": { - "line": 36, + "line": 67, "column": 8 }, "end": { - "line": 36, + "line": 67, "column": 12 } } @@ -2410,16 +2550,16 @@ "object": { "type": "ThisExpression", "range": [ - 765, - 769 + 1532, + 1536 ], "loc": { "start": { - "line": 36, + "line": 67, "column": 15 }, "end": { - "line": 36, + "line": 67, "column": 19 } } @@ -2428,31 +2568,31 @@ "type": "Identifier", "name": "_search", "range": [ - 770, - 777 + 1537, + 1544 ], "loc": { "start": { - "line": 36, + "line": 67, "column": 20 }, "end": { - "line": 36, + "line": 67, "column": 27 } } }, "range": [ - 765, - 777 + 1532, + 1544 ], "loc": { "start": { - "line": 36, + "line": 67, "column": 15 }, "end": { - "line": 36, + "line": 67, "column": 27 } } @@ -2460,67 +2600,67 @@ "arguments": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 779, - 784 + 1546, + 1549 ], "loc": { "start": { - "line": 36, + "line": 67, "column": 29 }, "end": { - "line": 36, - "column": 34 + "line": 67, + "column": 32 } } } ], "range": [ - 765, - 786 + 1532, + 1551 ], "loc": { "start": { - "line": 36, + "line": 67, "column": 15 }, "end": { - "line": 36, - "column": 36 + "line": 67, + "column": 34 } } }, "range": [ - 758, - 786 + 1525, + 1551 ], "loc": { "start": { - "line": 36, + "line": 67, "column": 8 }, "end": { - "line": 36, - "column": 36 + "line": 67, + "column": 34 } } } ], "kind": "const", "range": [ - 752, - 788 + 1519, + 1553 ], "loc": { "start": { - "line": 36, + "line": 67, "column": 2 }, "end": { - "line": 36, - "column": 38 + "line": 67, + "column": 36 } } }, @@ -2535,16 +2675,16 @@ "type": "Identifier", "name": "node", "range": [ - 798, - 802 + 1563, + 1567 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 9 }, "end": { - "line": 37, + "line": 68, "column": 13 } } @@ -2554,31 +2694,31 @@ "value": null, "raw": "null", "range": [ - 807, - 811 + 1572, + 1576 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 18 }, "end": { - "line": 37, + "line": 68, "column": 22 } } }, "range": [ - 798, - 811 + 1563, + 1576 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 9 }, "end": { - "line": 37, + "line": 68, "column": 22 } } @@ -2588,16 +2728,16 @@ "value": null, "raw": "null", "range": [ - 814, - 818 + 1579, + 1583 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 25 }, "end": { - "line": 37, + "line": 68, "column": 29 } } @@ -2609,95 +2749,95 @@ "type": "Identifier", "name": "node", "range": [ - 821, - 825 + 1586, + 1590 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 32 }, "end": { - "line": 37, + "line": 68, "column": 36 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 826, - 831 + 1591, + 1594 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 37 }, "end": { - "line": 37, - "column": 42 + "line": 68, + "column": 40 } } }, "range": [ - 821, - 831 + 1586, + 1594 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 32 }, "end": { - "line": 37, - "column": 42 + "line": 68, + "column": 40 } } }, "range": [ - 798, - 831 + 1563, + 1594 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 9 }, "end": { - "line": 37, - "column": 42 + "line": 68, + "column": 40 } } }, "range": [ - 791, - 833 + 1556, + 1596 ], "loc": { "start": { - "line": 37, + "line": 68, "column": 2 }, "end": { - "line": 37, - "column": 44 + "line": 68, + "column": 42 } } } ], "range": [ - 748, - 836 + 1515, + 1599 ], "loc": { "start": { - "line": 35, - "column": 15 + "line": 66, + "column": 13 }, "end": { - "line": 38, + "line": 69, "column": 2 } } @@ -2705,16 +2845,16 @@ "generator": false, "expression": false, "range": [ - 738, - 836 + 1507, + 1599 ], "loc": { "start": { - "line": 35, + "line": 66, "column": 5 }, "end": { - "line": 38, + "line": 69, "column": 2 } } @@ -2722,19 +2862,59 @@ "kind": "method", "computed": false, "range": [ - 734, - 836 + 1503, + 1599 ], "loc": { "start": { - "line": 35, + "line": 66, "column": 1 }, "end": { - "line": 38, + "line": 69, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t ", + "range": [ + 1239, + 1501 + ], + "loc": { + "start": { + "line": 58, + "column": 1 + }, + "end": { + "line": 65, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t ", + "range": [ + 1602, + 1757 + ], + "loc": { + "start": { + "line": 71, + "column": 1 + }, + "end": { + "line": 77, + "column": 4 + } + } + } + ], "static": false }, { @@ -2743,16 +2923,16 @@ "type": "Identifier", "name": "has", "range": [ - 839, - 842 + 1759, + 1762 ], "loc": { "start": { - "line": 40, + "line": 78, "column": 1 }, "end": { - "line": 40, + "line": 78, "column": 4 } } @@ -2763,19 +2943,19 @@ "params": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 845, - 850 + 1765, + 1768 ], "loc": { "start": { - "line": 40, + "line": 78, "column": 7 }, "end": { - "line": 40, - "column": 12 + "line": 78, + "column": 10 } } } @@ -2796,16 +2976,16 @@ "object": { "type": "ThisExpression", "range": [ - 864, - 868 + 1782, + 1786 ], "loc": { "start": { - "line": 41, + "line": 79, "column": 9 }, "end": { - "line": 41, + "line": 79, "column": 13 } } @@ -2814,31 +2994,31 @@ "type": "Identifier", "name": "_search", "range": [ - 869, - 876 + 1787, + 1794 ], "loc": { "start": { - "line": 41, + "line": 79, "column": 14 }, "end": { - "line": 41, + "line": 79, "column": 21 } } }, "range": [ - 864, - 876 + 1782, + 1794 ], "loc": { "start": { - "line": 41, + "line": 79, "column": 9 }, "end": { - "line": 41, + "line": 79, "column": 21 } } @@ -2846,35 +3026,35 @@ "arguments": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 878, - 883 + 1796, + 1799 ], "loc": { "start": { - "line": 41, + "line": 79, "column": 23 }, "end": { - "line": 41, - "column": 28 + "line": 79, + "column": 26 } } } ], "range": [ - 864, - 885 + 1782, + 1801 ], "loc": { "start": { - "line": 41, + "line": 79, "column": 9 }, "end": { - "line": 41, - "column": 30 + "line": 79, + "column": 28 } } }, @@ -2883,62 +3063,62 @@ "value": null, "raw": "null", "range": [ - 890, - 894 + 1806, + 1810 ], "loc": { "start": { - "line": 41, - "column": 35 + "line": 79, + "column": 33 }, "end": { - "line": 41, - "column": 39 + "line": 79, + "column": 37 } } }, "range": [ - 864, - 894 + 1782, + 1810 ], "loc": { "start": { - "line": 41, + "line": 79, "column": 9 }, "end": { - "line": 41, - "column": 39 + "line": 79, + "column": 37 } } }, "range": [ - 857, - 896 + 1775, + 1812 ], "loc": { "start": { - "line": 41, + "line": 79, "column": 2 }, "end": { - "line": 41, - "column": 41 + "line": 79, + "column": 39 } } } ], "range": [ - 853, - 899 + 1771, + 1815 ], "loc": { "start": { - "line": 40, - "column": 15 + "line": 78, + "column": 13 }, "end": { - "line": 42, + "line": 80, "column": 2 } } @@ -2946,16 +3126,16 @@ "generator": false, "expression": false, "range": [ - 843, - 899 + 1763, + 1815 ], "loc": { "start": { - "line": 40, + "line": 78, "column": 5 }, "end": { - "line": 42, + "line": 80, "column": 2 } } @@ -2963,19 +3143,59 @@ "kind": "method", "computed": false, "range": [ - 839, - 899 + 1759, + 1815 ], "loc": { "start": { - "line": 40, + "line": 78, "column": 1 }, "end": { - "line": 42, + "line": 80, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t ", + "range": [ + 1602, + 1757 + ], + "loc": { + "start": { + "line": 71, + "column": 1 + }, + "end": { + "line": 77, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", + "range": [ + 1818, + 1923 + ], + "loc": { + "start": { + "line": 82, + "column": 1 + }, + "end": { + "line": 86, + "column": 4 + } + } + } + ], "static": false }, { @@ -2984,16 +3204,16 @@ "type": "Identifier", "name": "_delete", "range": [ - 902, - 909 + 1925, + 1932 ], "loc": { "start": { - "line": 44, + "line": 87, "column": 1 }, "end": { - "line": 44, + "line": 87, "column": 8 } } @@ -3006,16 +3226,16 @@ "type": "Identifier", "name": "node", "range": [ - 912, - 916 + 1935, + 1939 ], "loc": { "start": { - "line": 44, + "line": 87, "column": 11 }, "end": { - "line": 44, + "line": 87, "column": 15 } } @@ -3041,16 +3261,16 @@ "type": "Identifier", "name": "node", "range": [ - 930, - 934 + 1953, + 1957 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 8 }, "end": { - "line": 46, + "line": 89, "column": 12 } } @@ -3059,31 +3279,31 @@ "type": "Identifier", "name": "left", "range": [ - 935, - 939 + 1958, + 1962 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 13 }, "end": { - "line": 46, + "line": 89, "column": 17 } } }, "range": [ - 930, - 939 + 1953, + 1962 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 8 }, "end": { - "line": 46, + "line": 89, "column": 17 } } @@ -3092,63 +3312,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 940, - 946 + 1963, + 1969 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 18 }, "end": { - "line": 46, + "line": 89, "column": 24 } } }, "range": [ - 930, - 946 + 1953, + 1969 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 8 }, "end": { - "line": 46, + "line": 89, "column": 24 } } }, "arguments": [], "range": [ - 930, - 948 + 1953, + 1971 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 8 }, "end": { - "line": 46, + "line": 89, "column": 26 } } }, "prefix": true, "range": [ - 929, - 948 + 1952, + 1971 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 7 }, "end": { - "line": 46, + "line": 89, "column": 26 } } @@ -3165,16 +3385,16 @@ "type": "Identifier", "name": "pred", "range": [ - 1014, - 1018 + 2033, + 2037 ], "loc": { "start": { - "line": 48, + "line": 91, "column": 9 }, "end": { - "line": 48, + "line": 91, "column": 13 } } @@ -3185,16 +3405,16 @@ "type": "Identifier", "name": "predecessor", "range": [ - 1021, - 1032 + 2040, + 2051 ], "loc": { "start": { - "line": 48, + "line": 91, "column": 16 }, "end": { - "line": 48, + "line": 91, "column": 27 } } @@ -3204,47 +3424,47 @@ "type": "Identifier", "name": "node", "range": [ - 1034, - 1038 + 2053, + 2057 ], "loc": { "start": { - "line": 48, + "line": 91, "column": 29 }, "end": { - "line": 48, + "line": 91, "column": 33 } } } ], "range": [ - 1021, - 1040 + 2040, + 2059 ], "loc": { "start": { - "line": 48, + "line": 91, "column": 16 }, "end": { - "line": 48, + "line": 91, "column": 35 } } }, "range": [ - 1014, - 1040 + 2033, + 2059 ], "loc": { "start": { - "line": 48, + "line": 91, "column": 9 }, "end": { - "line": 48, + "line": 91, "column": 35 } } @@ -3252,35 +3472,35 @@ ], "kind": "const", "range": [ - 1008, - 1042 + 2027, + 2061 ], "loc": { "start": { - "line": 48, + "line": 91, "column": 3 }, "end": { - "line": 48, + "line": 91, "column": 37 } }, "leadingComments": [ { "type": "Line", - "value": " replace node's value with predecessor's value", + "value": " replace node's key with predecessor's key", "range": [ - 956, - 1004 + 1979, + 2023 ], "loc": { "start": { - "line": 47, + "line": 90, "column": 3 }, "end": { - "line": 47, - "column": 51 + "line": 90, + "column": 47 } } } @@ -3298,50 +3518,50 @@ "type": "Identifier", "name": "node", "range": [ - 1046, - 1050 + 2065, + 2069 ], "loc": { "start": { - "line": 49, + "line": 92, "column": 3 }, "end": { - "line": 49, + "line": 92, "column": 7 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 1051, - 1056 + 2070, + 2073 ], "loc": { "start": { - "line": 49, + "line": 92, "column": 8 }, "end": { - "line": 49, - "column": 13 + "line": 92, + "column": 11 } } }, "range": [ - 1046, - 1056 + 2065, + 2073 ], "loc": { "start": { - "line": 49, + "line": 92, "column": 3 }, "end": { - "line": 49, - "column": 13 + "line": 92, + "column": 11 } } }, @@ -3352,80 +3572,80 @@ "type": "Identifier", "name": "pred", "range": [ - 1059, - 1063 + 2076, + 2080 ], "loc": { "start": { - "line": 49, - "column": 16 + "line": 92, + "column": 14 }, "end": { - "line": 49, - "column": 20 + "line": 92, + "column": 18 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 1064, - 1069 + 2081, + 2084 ], "loc": { "start": { - "line": 49, - "column": 21 + "line": 92, + "column": 19 }, "end": { - "line": 49, - "column": 26 + "line": 92, + "column": 22 } } }, "range": [ - 1059, - 1069 + 2076, + 2084 ], "loc": { "start": { - "line": 49, - "column": 16 + "line": 92, + "column": 14 }, "end": { - "line": 49, - "column": 26 + "line": 92, + "column": 22 } } }, "range": [ - 1046, - 1069 + 2065, + 2084 ], "loc": { "start": { - "line": 49, + "line": 92, "column": 3 }, "end": { - "line": 49, - "column": 26 + "line": 92, + "column": 22 } } }, "range": [ - 1046, - 1071 + 2065, + 2086 ], "loc": { "start": { - "line": 49, + "line": 92, "column": 3 }, "end": { - "line": 49, - "column": 28 + "line": 92, + "column": 24 } }, "trailingComments": [ @@ -3433,16 +3653,16 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 1075, - 1101 + 2090, + 2116 ], "loc": { "start": { - "line": 50, + "line": 93, "column": 3 }, "end": { - "line": 50, + "line": 93, "column": 29 } } @@ -3451,16 +3671,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1105, - 1156 + 2120, + 2171 ], "loc": { "start": { - "line": 51, + "line": 94, "column": 3 }, "end": { - "line": 51, + "line": 94, "column": 54 } } @@ -3469,16 +3689,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1160, - 1205 + 2175, + 2220 ], "loc": { "start": { - "line": 52, + "line": 95, "column": 3 }, "end": { - "line": 52, + "line": 95, "column": 48 } } @@ -3493,16 +3713,16 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1209, - 1225 + 2224, + 2240 ], "loc": { "start": { - "line": 53, + "line": 96, "column": 3 }, "end": { - "line": 53, + "line": 96, "column": 19 } } @@ -3512,47 +3732,47 @@ "type": "Identifier", "name": "pred", "range": [ - 1227, - 1231 + 2242, + 2246 ], "loc": { "start": { - "line": 53, + "line": 96, "column": 21 }, "end": { - "line": 53, + "line": 96, "column": 25 } } } ], "range": [ - 1209, - 1233 + 2224, + 2248 ], "loc": { "start": { - "line": 53, + "line": 96, "column": 3 }, "end": { - "line": 53, + "line": 96, "column": 27 } } }, "range": [ - 1209, - 1235 + 2224, + 2250 ], "loc": { "start": { - "line": 53, + "line": 96, "column": 3 }, "end": { - "line": 53, + "line": 96, "column": 29 } }, @@ -3561,16 +3781,16 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 1075, - 1101 + 2090, + 2116 ], "loc": { "start": { - "line": 50, + "line": 93, "column": 3 }, "end": { - "line": 50, + "line": 93, "column": 29 } } @@ -3579,16 +3799,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1105, - 1156 + 2120, + 2171 ], "loc": { "start": { - "line": 51, + "line": 94, "column": 3 }, "end": { - "line": 51, + "line": 94, "column": 54 } } @@ -3597,16 +3817,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1160, - 1205 + 2175, + 2220 ], "loc": { "start": { - "line": 52, + "line": 95, "column": 3 }, "end": { - "line": 52, + "line": 95, "column": 48 } } @@ -3615,16 +3835,16 @@ } ], "range": [ - 951, - 1239 + 1974, + 2254 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 29 }, "end": { - "line": 54, + "line": 97, "column": 3 } } @@ -3646,16 +3866,16 @@ "type": "Identifier", "name": "node", "range": [ - 1254, - 1258 + 2269, + 2273 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 13 }, "end": { - "line": 56, + "line": 99, "column": 17 } } @@ -3664,31 +3884,31 @@ "type": "Identifier", "name": "right", "range": [ - 1259, - 1264 + 2274, + 2279 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 18 }, "end": { - "line": 56, + "line": 99, "column": 23 } } }, "range": [ - 1254, - 1264 + 2269, + 2279 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 13 }, "end": { - "line": 56, + "line": 99, "column": 23 } } @@ -3697,63 +3917,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 1265, - 1271 + 2280, + 2286 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 24 }, "end": { - "line": 56, + "line": 99, "column": 30 } } }, "range": [ - 1254, - 1271 + 2269, + 2286 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 13 }, "end": { - "line": 56, + "line": 99, "column": 30 } } }, "arguments": [], "range": [ - 1254, - 1273 + 2269, + 2288 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 13 }, "end": { - "line": 56, + "line": 99, "column": 32 } } }, "prefix": true, "range": [ - 1253, - 1273 + 2268, + 2288 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 12 }, "end": { - "line": 56, + "line": 99, "column": 32 } } @@ -3770,16 +3990,16 @@ "type": "Identifier", "name": "succ", "range": [ - 1416, - 1420 + 2427, + 2431 ], "loc": { "start": { - "line": 60, + "line": 103, "column": 9 }, "end": { - "line": 60, + "line": 103, "column": 13 } } @@ -3791,16 +4011,16 @@ "type": "Identifier", "name": "node", "range": [ - 1423, - 1427 + 2434, + 2438 ], "loc": { "start": { - "line": 60, + "line": 103, "column": 16 }, "end": { - "line": 60, + "line": 103, "column": 20 } } @@ -3809,46 +4029,46 @@ "type": "Identifier", "name": "right", "range": [ - 1428, - 1433 + 2439, + 2444 ], "loc": { "start": { - "line": 60, + "line": 103, "column": 21 }, "end": { - "line": 60, + "line": 103, "column": 26 } } }, "range": [ - 1423, - 1433 + 2434, + 2444 ], "loc": { "start": { - "line": 60, + "line": 103, "column": 16 }, "end": { - "line": 60, + "line": 103, "column": 26 } } }, "range": [ - 1416, - 1433 + 2427, + 2444 ], "loc": { "start": { - "line": 60, + "line": 103, "column": 9 }, "end": { - "line": 60, + "line": 103, "column": 26 } } @@ -3856,35 +4076,35 @@ ], "kind": "const", "range": [ - 1410, - 1435 + 2421, + 2446 ], "loc": { "start": { - "line": 60, + "line": 103, "column": 3 }, "end": { - "line": 60, + "line": 103, "column": 28 } }, "leadingComments": [ { "type": "Line", - "value": " replace node's value with successor's value", + "value": " replace node's key with successor's key", "range": [ - 1281, - 1327 + 2296, + 2338 ], "loc": { "start": { - "line": 57, + "line": 100, "column": 3 }, "end": { - "line": 57, - "column": 49 + "line": 100, + "column": 45 } } }, @@ -3892,16 +4112,16 @@ "type": "Line", "value": " If there is no left child, then there can only be one right", "range": [ - 1331, - 1393 + 2342, + 2404 ], "loc": { "start": { - "line": 58, + "line": 101, "column": 3 }, "end": { - "line": 58, + "line": 101, "column": 65 } } @@ -3910,16 +4130,16 @@ "type": "Line", "value": " child.", "range": [ - 1397, - 1406 + 2408, + 2417 ], "loc": { "start": { - "line": 59, + "line": 102, "column": 3 }, "end": { - "line": 59, + "line": 102, "column": 12 } } @@ -3938,50 +4158,50 @@ "type": "Identifier", "name": "node", "range": [ - 1439, - 1443 + 2450, + 2454 ], "loc": { "start": { - "line": 61, + "line": 104, "column": 3 }, "end": { - "line": 61, + "line": 104, "column": 7 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 1444, - 1449 + 2455, + 2458 ], "loc": { "start": { - "line": 61, + "line": 104, "column": 8 }, "end": { - "line": 61, - "column": 13 + "line": 104, + "column": 11 } } }, "range": [ - 1439, - 1449 + 2450, + 2458 ], "loc": { "start": { - "line": 61, + "line": 104, "column": 3 }, "end": { - "line": 61, - "column": 13 + "line": 104, + "column": 11 } } }, @@ -3992,80 +4212,80 @@ "type": "Identifier", "name": "succ", "range": [ - 1452, - 1456 + 2461, + 2465 ], "loc": { "start": { - "line": 61, - "column": 16 + "line": 104, + "column": 14 }, "end": { - "line": 61, - "column": 20 + "line": 104, + "column": 18 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 1457, - 1462 + 2466, + 2469 ], "loc": { "start": { - "line": 61, - "column": 21 + "line": 104, + "column": 19 }, "end": { - "line": 61, - "column": 26 + "line": 104, + "column": 22 } } }, "range": [ - 1452, - 1462 + 2461, + 2469 ], "loc": { "start": { - "line": 61, - "column": 16 + "line": 104, + "column": 14 }, "end": { - "line": 61, - "column": 26 + "line": 104, + "column": 22 } } }, "range": [ - 1439, - 1462 + 2450, + 2469 ], "loc": { "start": { - "line": 61, + "line": 104, "column": 3 }, "end": { - "line": 61, - "column": 26 + "line": 104, + "column": 22 } } }, "range": [ - 1439, - 1464 + 2450, + 2471 ], "loc": { "start": { - "line": 61, + "line": 104, "column": 3 }, "end": { - "line": 61, - "column": 28 + "line": 104, + "column": 24 } }, "trailingComments": [ @@ -4073,16 +4293,16 @@ "type": "Line", "value": " delete successor node", "range": [ - 1468, - 1492 + 2475, + 2499 ], "loc": { "start": { - "line": 62, + "line": 105, "column": 3 }, "end": { - "line": 62, + "line": 105, "column": 27 } } @@ -4091,16 +4311,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1496, - 1547 + 2503, + 2554 ], "loc": { "start": { - "line": 63, + "line": 106, "column": 3 }, "end": { - "line": 63, + "line": 106, "column": 54 } } @@ -4109,16 +4329,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1551, - 1596 + 2558, + 2603 ], "loc": { "start": { - "line": 64, + "line": 107, "column": 3 }, "end": { - "line": 64, + "line": 107, "column": 48 } } @@ -4133,16 +4353,16 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1600, - 1616 + 2607, + 2623 ], "loc": { "start": { - "line": 65, + "line": 108, "column": 3 }, "end": { - "line": 65, + "line": 108, "column": 19 } } @@ -4152,47 +4372,47 @@ "type": "Identifier", "name": "succ", "range": [ - 1618, - 1622 + 2625, + 2629 ], "loc": { "start": { - "line": 65, + "line": 108, "column": 21 }, "end": { - "line": 65, + "line": 108, "column": 25 } } } ], "range": [ - 1600, - 1624 + 2607, + 2631 ], "loc": { "start": { - "line": 65, + "line": 108, "column": 3 }, "end": { - "line": 65, + "line": 108, "column": 27 } } }, "range": [ - 1600, - 1626 + 2607, + 2633 ], "loc": { "start": { - "line": 65, + "line": 108, "column": 3 }, "end": { - "line": 65, + "line": 108, "column": 29 } }, @@ -4201,16 +4421,16 @@ "type": "Line", "value": " delete successor node", "range": [ - 1468, - 1492 + 2475, + 2499 ], "loc": { "start": { - "line": 62, + "line": 105, "column": 3 }, "end": { - "line": 62, + "line": 105, "column": 27 } } @@ -4219,16 +4439,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1496, - 1547 + 2503, + 2554 ], "loc": { "start": { - "line": 63, + "line": 106, "column": 3 }, "end": { - "line": 63, + "line": 106, "column": 54 } } @@ -4237,16 +4457,16 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1551, - 1596 + 2558, + 2603 ], "loc": { "start": { - "line": 64, + "line": 107, "column": 3 }, "end": { - "line": 64, + "line": 107, "column": 48 } } @@ -4255,16 +4475,16 @@ } ], "range": [ - 1276, - 1630 + 2291, + 2637 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 35 }, "end": { - "line": 66, + "line": 109, "column": 3 } } @@ -4278,16 +4498,16 @@ "type": "Identifier", "name": "node", "range": [ - 1644, - 1648 + 2651, + 2655 ], "loc": { "start": { - "line": 68, + "line": 111, "column": 12 }, "end": { - "line": 68, + "line": 111, "column": 16 } } @@ -4298,16 +4518,16 @@ "object": { "type": "ThisExpression", "range": [ - 1653, - 1657 + 2660, + 2664 ], "loc": { "start": { - "line": 68, + "line": 111, "column": 21 }, "end": { - "line": 68, + "line": 111, "column": 25 } } @@ -4316,46 +4536,46 @@ "type": "Identifier", "name": "root", "range": [ - 1658, - 1662 + 2665, + 2669 ], "loc": { "start": { - "line": 68, + "line": 111, "column": 26 }, "end": { - "line": 68, + "line": 111, "column": 30 } } }, "range": [ - 1653, - 1662 + 2660, + 2669 ], "loc": { "start": { - "line": 68, + "line": 111, "column": 21 }, "end": { - "line": 68, + "line": 111, "column": 30 } } }, "range": [ - 1644, - 1662 + 2651, + 2669 ], "loc": { "start": { - "line": 68, + "line": 111, "column": 12 }, "end": { - "line": 68, + "line": 111, "column": 30 } } @@ -4374,16 +4594,16 @@ "object": { "type": "ThisExpression", "range": [ - 1670, - 1674 + 2677, + 2681 ], "loc": { "start": { - "line": 69, + "line": 112, "column": 3 }, "end": { - "line": 69, + "line": 112, "column": 7 } } @@ -4392,31 +4612,31 @@ "type": "Identifier", "name": "root", "range": [ - 1675, - 1679 + 2682, + 2686 ], "loc": { "start": { - "line": 69, + "line": 112, "column": 8 }, "end": { - "line": 69, + "line": 112, "column": 12 } } }, "range": [ - 1670, - 1679 + 2677, + 2686 ], "loc": { "start": { - "line": 69, + "line": 112, "column": 3 }, "end": { - "line": 69, + "line": 112, "column": 12 } } @@ -4426,62 +4646,62 @@ "value": null, "raw": "null", "range": [ - 1682, - 1686 + 2689, + 2693 ], "loc": { "start": { - "line": 69, + "line": 112, "column": 15 }, "end": { - "line": 69, + "line": 112, "column": 19 } } }, "range": [ - 1670, - 1686 + 2677, + 2693 ], "loc": { "start": { - "line": 69, + "line": 112, "column": 3 }, "end": { - "line": 69, + "line": 112, "column": 19 } } }, "range": [ - 1670, - 1688 + 2677, + 2695 ], "loc": { "start": { - "line": 69, + "line": 112, "column": 3 }, "end": { - "line": 69, + "line": 112, "column": 21 } } } ], "range": [ - 1665, - 1692 + 2672, + 2699 ], "loc": { "start": { - "line": 68, + "line": 111, "column": 33 }, "end": { - "line": 70, + "line": 113, "column": 3 } } @@ -4497,16 +4717,16 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 1706, - 1722 + 2713, + 2729 ], "loc": { "start": { - "line": 73, + "line": 116, "column": 3 }, "end": { - "line": 73, + "line": 116, "column": 19 } } @@ -4516,124 +4736,124 @@ "type": "Identifier", "name": "node", "range": [ - 1724, - 1728 + 2731, + 2735 ], "loc": { "start": { - "line": 73, + "line": 116, "column": 21 }, "end": { - "line": 73, + "line": 116, "column": 25 } } } ], "range": [ - 1706, - 1730 + 2713, + 2737 ], "loc": { "start": { - "line": 73, + "line": 116, "column": 3 }, "end": { - "line": 73, + "line": 116, "column": 27 } } }, "range": [ - 1706, - 1732 + 2713, + 2739 ], "loc": { "start": { - "line": 73, + "line": 116, "column": 3 }, "end": { - "line": 73, + "line": 116, "column": 29 } } } ], "range": [ - 1701, - 1736 + 2708, + 2743 ], "loc": { "start": { - "line": 72, + "line": 115, "column": 7 }, "end": { - "line": 74, + "line": 117, "column": 3 } } }, "range": [ - 1639, - 1736 + 2646, + 2743 ], "loc": { "start": { - "line": 68, + "line": 111, "column": 7 }, "end": { - "line": 74, + "line": 117, "column": 3 } } }, "range": [ - 1248, - 1736 + 2263, + 2743 ], "loc": { "start": { - "line": 56, + "line": 99, "column": 7 }, "end": { - "line": 74, + "line": 117, "column": 3 } } }, "range": [ - 924, - 1736 + 1947, + 2743 ], "loc": { "start": { - "line": 46, + "line": 89, "column": 2 }, "end": { - "line": 74, + "line": 117, "column": 3 } } } ], "range": [ - 919, - 1740 + 1942, + 2747 ], "loc": { "start": { - "line": 44, + "line": 87, "column": 18 }, "end": { - "line": 76, + "line": 119, "column": 2 } } @@ -4641,16 +4861,16 @@ "generator": false, "expression": false, "range": [ - 910, - 1740 + 1933, + 2747 ], "loc": { "start": { - "line": 44, + "line": 87, "column": 9 }, "end": { - "line": 76, + "line": 119, "column": 2 } } @@ -4658,19 +4878,59 @@ "kind": "method", "computed": false, "range": [ - 902, - 1740 + 1925, + 2747 ], "loc": { "start": { - "line": 44, + "line": 87, "column": 1 }, "end": { - "line": 76, + "line": 119, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", + "range": [ + 1818, + 1923 + ], + "loc": { + "start": { + "line": 82, + "column": 1 + }, + "end": { + "line": 86, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", + "range": [ + 2750, + 3162 + ], + "loc": { + "start": { + "line": 121, + "column": 1 + }, + "end": { + "line": 129, + "column": 4 + } + } + } + ], "static": false }, { @@ -4679,16 +4939,16 @@ "type": "Identifier", "name": "remove", "range": [ - 1743, - 1749 + 3164, + 3170 ], "loc": { "start": { - "line": 78, + "line": 130, "column": 1 }, "end": { - "line": 78, + "line": 130, "column": 7 } } @@ -4699,19 +4959,19 @@ "params": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 1752, - 1757 + 3173, + 3176 ], "loc": { "start": { - "line": 78, + "line": 130, "column": 10 }, "end": { - "line": 78, - "column": 15 + "line": 130, + "column": 13 } } } @@ -4728,16 +4988,16 @@ "type": "Identifier", "name": "node", "range": [ - 1771, - 1775 + 3190, + 3194 ], "loc": { "start": { - "line": 80, + "line": 132, "column": 8 }, "end": { - "line": 80, + "line": 132, "column": 12 } } @@ -4750,16 +5010,16 @@ "object": { "type": "ThisExpression", "range": [ - 1778, - 1782 + 3197, + 3201 ], "loc": { "start": { - "line": 80, + "line": 132, "column": 15 }, "end": { - "line": 80, + "line": 132, "column": 19 } } @@ -4768,31 +5028,31 @@ "type": "Identifier", "name": "_search", "range": [ - 1783, - 1790 + 3202, + 3209 ], "loc": { "start": { - "line": 80, + "line": 132, "column": 20 }, "end": { - "line": 80, + "line": 132, "column": 27 } } }, "range": [ - 1778, - 1790 + 3197, + 3209 ], "loc": { "start": { - "line": 80, + "line": 132, "column": 15 }, "end": { - "line": 80, + "line": 132, "column": 27 } } @@ -4800,67 +5060,67 @@ "arguments": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 1792, - 1797 + 3211, + 3214 ], "loc": { "start": { - "line": 80, + "line": 132, "column": 29 }, "end": { - "line": 80, - "column": 34 + "line": 132, + "column": 32 } } } ], "range": [ - 1778, - 1799 + 3197, + 3216 ], "loc": { "start": { - "line": 80, + "line": 132, "column": 15 }, "end": { - "line": 80, - "column": 36 + "line": 132, + "column": 34 } } }, "range": [ - 1771, - 1799 + 3190, + 3216 ], "loc": { "start": { - "line": 80, + "line": 132, "column": 8 }, "end": { - "line": 80, - "column": 36 + "line": 132, + "column": 34 } } } ], "kind": "const", "range": [ - 1765, - 1801 + 3184, + 3218 ], "loc": { "start": { - "line": 80, + "line": 132, "column": 2 }, "end": { - "line": 80, - "column": 38 + "line": 132, + "column": 36 } } }, @@ -4873,16 +5133,16 @@ "type": "Identifier", "name": "node", "range": [ - 1809, - 1813 + 3226, + 3230 ], "loc": { "start": { - "line": 81, + "line": 133, "column": 7 }, "end": { - "line": 81, + "line": 133, "column": 11 } } @@ -4892,31 +5152,31 @@ "value": null, "raw": "null", "range": [ - 1818, - 1822 + 3235, + 3239 ], "loc": { "start": { - "line": 81, + "line": 133, "column": 16 }, "end": { - "line": 81, + "line": 133, "column": 20 } } }, "range": [ - 1809, - 1822 + 3226, + 3239 ], "loc": { "start": { - "line": 81, + "line": 133, "column": 7 }, "end": { - "line": 81, + "line": 133, "column": 20 } } @@ -4928,47 +5188,47 @@ "value": false, "raw": "false", "range": [ - 1832, - 1837 + 3249, + 3254 ], "loc": { "start": { - "line": 81, + "line": 133, "column": 30 }, "end": { - "line": 81, + "line": 133, "column": 35 } } }, "range": [ - 1825, - 1839 + 3242, + 3256 ], "loc": { "start": { - "line": 81, + "line": 133, "column": 23 }, "end": { - "line": 81, + "line": 133, "column": 37 } } }, "alternate": null, "range": [ - 1804, - 1839 + 3221, + 3256 ], "loc": { "start": { - "line": 81, + "line": 133, "column": 2 }, "end": { - "line": 81, + "line": 133, "column": 37 } } @@ -4983,16 +5243,16 @@ "object": { "type": "ThisExpression", "range": [ - 1843, - 1847 + 3260, + 3264 ], "loc": { "start": { - "line": 83, + "line": 135, "column": 2 }, "end": { - "line": 83, + "line": 135, "column": 6 } } @@ -5001,31 +5261,31 @@ "type": "Identifier", "name": "_delete", "range": [ - 1848, - 1855 + 3265, + 3272 ], "loc": { "start": { - "line": 83, + "line": 135, "column": 7 }, "end": { - "line": 83, + "line": 135, "column": 14 } } }, "range": [ - 1843, - 1855 + 3260, + 3272 ], "loc": { "start": { - "line": 83, + "line": 135, "column": 2 }, "end": { - "line": 83, + "line": 135, "column": 14 } } @@ -5035,47 +5295,47 @@ "type": "Identifier", "name": "node", "range": [ - 1857, - 1861 + 3274, + 3278 ], "loc": { "start": { - "line": 83, + "line": 135, "column": 16 }, "end": { - "line": 83, + "line": 135, "column": 20 } } } ], "range": [ - 1843, - 1863 + 3260, + 3280 ], "loc": { "start": { - "line": 83, + "line": 135, "column": 2 }, "end": { - "line": 83, + "line": 135, "column": 22 } } }, "range": [ - 1843, - 1865 + 3260, + 3282 ], "loc": { "start": { - "line": 83, + "line": 135, "column": 2 }, "end": { - "line": 83, + "line": 135, "column": 24 } } @@ -5087,47 +5347,47 @@ "value": true, "raw": "true", "range": [ - 1875, - 1879 + 3292, + 3296 ], "loc": { "start": { - "line": 84, + "line": 136, "column": 9 }, "end": { - "line": 84, + "line": 136, "column": 13 } } }, "range": [ - 1868, - 1881 + 3285, + 3298 ], "loc": { "start": { - "line": 84, + "line": 136, "column": 2 }, "end": { - "line": 84, + "line": 136, "column": 15 } } } ], "range": [ - 1760, - 1885 + 3179, + 3302 ], "loc": { "start": { - "line": 78, - "column": 18 + "line": 130, + "column": 16 }, "end": { - "line": 86, + "line": 138, "column": 2 } } @@ -5135,16 +5395,16 @@ "generator": false, "expression": false, "range": [ - 1750, - 1885 + 3171, + 3302 ], "loc": { "start": { - "line": 78, + "line": 130, "column": 8 }, "end": { - "line": 86, + "line": 138, "column": 2 } } @@ -5152,19 +5412,59 @@ "kind": "method", "computed": false, "range": [ - 1743, - 1885 + 3164, + 3302 ], "loc": { "start": { - "line": 78, + "line": 130, "column": 1 }, "end": { - "line": 86, + "line": 138, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", + "range": [ + 2750, + 3162 + ], + "loc": { + "start": { + "line": 121, + "column": 1 + }, + "end": { + "line": 129, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t ", + "range": [ + 3305, + 3554 + ], + "loc": { + "start": { + "line": 140, + "column": 1 + }, + "end": { + "line": 146, + "column": 4 + } + } + } + ], "static": false }, { @@ -5173,16 +5473,16 @@ "type": "Identifier", "name": "range", "range": [ - 1889, - 1894 + 3557, + 3562 ], "loc": { "start": { - "line": 88, + "line": 147, "column": 2 }, "end": { - "line": 88, + "line": 147, "column": 7 } } @@ -5195,16 +5495,16 @@ "type": "Identifier", "name": "left", "range": [ - 1897, - 1901 + 3565, + 3569 ], "loc": { "start": { - "line": 88, + "line": 147, "column": 10 }, "end": { - "line": 88, + "line": 147, "column": 14 } } @@ -5213,16 +5513,16 @@ "type": "Identifier", "name": "right", "range": [ - 1904, - 1909 + 3572, + 3577 ], "loc": { "start": { - "line": 88, + "line": 147, "column": 17 }, "end": { - "line": 88, + "line": 147, "column": 22 } } @@ -5242,16 +5542,16 @@ "object": { "type": "ThisExpression", "range": [ - 1922, - 1926 + 3590, + 3594 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 7 }, "end": { - "line": 90, + "line": 149, "column": 11 } } @@ -5260,31 +5560,31 @@ "type": "Identifier", "name": "root", "range": [ - 1927, - 1931 + 3595, + 3599 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 12 }, "end": { - "line": 90, + "line": 149, "column": 16 } } }, "range": [ - 1922, - 1931 + 3590, + 3599 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 7 }, "end": { - "line": 90, + "line": 149, "column": 16 } } @@ -5294,31 +5594,31 @@ "value": null, "raw": "null", "range": [ - 1936, - 1940 + 3604, + 3608 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 21 }, "end": { - "line": 90, + "line": 149, "column": 25 } } }, "range": [ - 1922, - 1940 + 3590, + 3608 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 7 }, "end": { - "line": 90, + "line": 149, "column": 25 } } @@ -5333,16 +5633,16 @@ "type": "Identifier", "name": "rangetraversal", "range": [ - 1950, - 1964 + 3618, + 3632 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 35 }, "end": { - "line": 90, + "line": 149, "column": 49 } } @@ -5354,16 +5654,16 @@ "object": { "type": "ThisExpression", "range": [ - 1966, - 1970 + 3634, + 3638 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 51 }, "end": { - "line": 90, + "line": 149, "column": 55 } } @@ -5372,31 +5672,31 @@ "type": "Identifier", "name": "compare", "range": [ - 1971, - 1978 + 3639, + 3646 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 56 }, "end": { - "line": 90, + "line": 149, "column": 63 } } }, "range": [ - 1966, - 1978 + 3634, + 3646 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 51 }, "end": { - "line": 90, + "line": 149, "column": 63 } } @@ -5407,16 +5707,16 @@ "object": { "type": "ThisExpression", "range": [ - 1981, - 1985 + 3649, + 3653 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 66 }, "end": { - "line": 90, + "line": 149, "column": 70 } } @@ -5425,31 +5725,31 @@ "type": "Identifier", "name": "root", "range": [ - 1986, - 1990 + 3654, + 3658 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 71 }, "end": { - "line": 90, + "line": 149, "column": 75 } } }, "range": [ - 1981, - 1990 + 3649, + 3658 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 66 }, "end": { - "line": 90, + "line": 149, "column": 75 } } @@ -5458,16 +5758,16 @@ "type": "Identifier", "name": "left", "range": [ - 1993, - 1997 + 3661, + 3665 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 78 }, "end": { - "line": 90, + "line": 149, "column": 82 } } @@ -5476,95 +5776,95 @@ "type": "Identifier", "name": "right", "range": [ - 2000, - 2005 + 3668, + 3673 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 85 }, "end": { - "line": 90, + "line": 149, "column": 90 } } } ], "range": [ - 1950, - 2007 + 3618, + 3675 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 35 }, "end": { - "line": 90, + "line": 149, "column": 92 } } }, "delegate": true, "range": [ - 1943, - 2007 + 3611, + 3675 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 28 }, "end": { - "line": 90, + "line": 149, "column": 92 } } }, "range": [ - 1943, - 2009 + 3611, + 3677 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 28 }, "end": { - "line": 90, + "line": 149, "column": 94 } } }, "alternate": null, "range": [ - 1917, - 2009 + 3585, + 3677 ], "loc": { "start": { - "line": 90, + "line": 149, "column": 2 }, "end": { - "line": 90, + "line": 149, "column": 94 } } } ], "range": [ - 1912, - 2013 + 3580, + 3681 ], "loc": { "start": { - "line": 88, + "line": 147, "column": 25 }, "end": { - "line": 92, + "line": 151, "column": 2 } } @@ -5572,16 +5872,16 @@ "generator": true, "expression": false, "range": [ - 1895, - 2013 + 3563, + 3681 ], "loc": { "start": { - "line": 88, + "line": 147, "column": 8 }, "end": { - "line": 92, + "line": 151, "column": 2 } } @@ -5589,38 +5889,78 @@ "kind": "method", "computed": false, "range": [ - 1888, - 2013 + 3556, + 3681 ], "loc": { "start": { - "line": 88, + "line": 147, "column": 1 }, "end": { - "line": 92, + "line": 151, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t ", + "range": [ + 3305, + 3554 + ], + "loc": { + "start": { + "line": 140, + "column": 1 + }, + "end": { + "line": 146, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t ", + "range": [ + 3684, + 3780 + ], + "loc": { + "start": { + "line": 153, + "column": 1 + }, + "end": { + "line": 157, + "column": 4 + } + } + } + ], "static": false }, { "type": "MethodDefinition", "key": { "type": "Identifier", - "name": "values", + "name": "items", "range": [ - 2017, - 2023 + 3783, + 3788 ], "loc": { "start": { - "line": 94, + "line": 158, "column": 2 }, "end": { - "line": 94, - "column": 8 + "line": 158, + "column": 7 } } }, @@ -5642,16 +5982,16 @@ "object": { "type": "ThisExpression", "range": [ - 2038, - 2042 + 3803, + 3807 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 7 }, "end": { - "line": 96, + "line": 160, "column": 11 } } @@ -5660,31 +6000,31 @@ "type": "Identifier", "name": "root", "range": [ - 2043, - 2047 + 3808, + 3812 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 12 }, "end": { - "line": 96, + "line": 160, "column": 16 } } }, "range": [ - 2038, - 2047 + 3803, + 3812 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 7 }, "end": { - "line": 96, + "line": 160, "column": 16 } } @@ -5694,31 +6034,31 @@ "value": null, "raw": "null", "range": [ - 2052, - 2056 + 3817, + 3821 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 21 }, "end": { - "line": 96, + "line": 160, "column": 25 } } }, "range": [ - 2038, - 2056 + 3803, + 3821 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 7 }, "end": { - "line": 96, + "line": 160, "column": 25 } } @@ -5733,16 +6073,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 2066, - 2082 + 3831, + 3847 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 35 }, "end": { - "line": 96, + "line": 160, "column": 51 } } @@ -5754,16 +6094,16 @@ "object": { "type": "ThisExpression", "range": [ - 2084, - 2088 + 3849, + 3853 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 53 }, "end": { - "line": 96, + "line": 160, "column": 57 } } @@ -5772,110 +6112,110 @@ "type": "Identifier", "name": "root", "range": [ - 2089, - 2093 + 3854, + 3858 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 58 }, "end": { - "line": 96, + "line": 160, "column": 62 } } }, "range": [ - 2084, - 2093 + 3849, + 3858 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 53 }, "end": { - "line": 96, + "line": 160, "column": 62 } } } ], "range": [ - 2066, - 2095 + 3831, + 3860 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 35 }, "end": { - "line": 96, + "line": 160, "column": 64 } } }, "delegate": true, "range": [ - 2059, - 2095 + 3824, + 3860 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 28 }, "end": { - "line": 96, + "line": 160, "column": 64 } } }, "range": [ - 2059, - 2097 + 3824, + 3862 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 28 }, "end": { - "line": 96, + "line": 160, "column": 66 } } }, "alternate": null, "range": [ - 2033, - 2097 + 3798, + 3862 ], "loc": { "start": { - "line": 96, + "line": 160, "column": 2 }, "end": { - "line": 96, + "line": 160, "column": 66 } } } ], "range": [ - 2028, - 2101 + 3793, + 3866 ], "loc": { "start": { - "line": 94, - "column": 13 + "line": 158, + "column": 12 }, "end": { - "line": 98, + "line": 162, "column": 2 } } @@ -5883,16 +6223,16 @@ "generator": true, "expression": false, "range": [ - 2024, - 2101 + 3789, + 3866 ], "loc": { "start": { - "line": 94, - "column": 9 + "line": 158, + "column": 8 }, "end": { - "line": 98, + "line": 162, "column": 2 } } @@ -5900,19 +6240,59 @@ "kind": "method", "computed": false, "range": [ - 2016, - 2101 + 3782, + 3866 ], "loc": { "start": { - "line": 94, + "line": 158, "column": 1 }, "end": { - "line": 98, + "line": 162, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t ", + "range": [ + 3684, + 3780 + ], + "loc": { + "start": { + "line": 153, + "column": 1 + }, + "end": { + "line": 157, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", + "range": [ + 3869, + 3917 + ], + "loc": { + "start": { + "line": 164, + "column": 1 + }, + "end": { + "line": 166, + "column": 4 + } + } + } + ], "static": false }, { @@ -5924,16 +6304,16 @@ "type": "Identifier", "name": "Symbol", "range": [ - 2105, - 2111 + 3920, + 3926 ], "loc": { "start": { - "line": 100, + "line": 167, "column": 2 }, "end": { - "line": 100, + "line": 167, "column": 8 } } @@ -5942,31 +6322,31 @@ "type": "Identifier", "name": "iterator", "range": [ - 2112, - 2120 + 3927, + 3935 ], "loc": { "start": { - "line": 100, + "line": 167, "column": 9 }, "end": { - "line": 100, + "line": 167, "column": 17 } } }, "range": [ - 2105, - 2120 + 3920, + 3935 ], "loc": { "start": { - "line": 100, + "line": 167, "column": 2 }, "end": { - "line": 100, + "line": 167, "column": 17 } } @@ -5988,96 +6368,96 @@ "object": { "type": "ThisExpression", "range": [ - 2138, - 2142 + 3953, + 3957 ], "loc": { "start": { - "line": 102, + "line": 169, "column": 9 }, "end": { - "line": 102, + "line": 169, "column": 13 } } }, "property": { "type": "Identifier", - "name": "values", + "name": "items", "range": [ - 2143, - 2149 + 3958, + 3963 ], "loc": { "start": { - "line": 102, + "line": 169, "column": 14 }, "end": { - "line": 102, - "column": 20 + "line": 169, + "column": 19 } } }, "range": [ - 2138, - 2149 + 3953, + 3963 ], "loc": { "start": { - "line": 102, + "line": 169, "column": 9 }, "end": { - "line": 102, - "column": 20 + "line": 169, + "column": 19 } } }, "arguments": [], "range": [ - 2138, - 2151 + 3953, + 3965 ], "loc": { "start": { - "line": 102, + "line": 169, "column": 9 }, "end": { - "line": 102, - "column": 22 + "line": 169, + "column": 21 } } }, "range": [ - 2131, - 2153 + 3946, + 3967 ], "loc": { "start": { - "line": 102, + "line": 169, "column": 2 }, "end": { - "line": 102, - "column": 24 + "line": 169, + "column": 23 } } } ], "range": [ - 2126, - 2157 + 3941, + 3971 ], "loc": { "start": { - "line": 100, + "line": 167, "column": 23 }, "end": { - "line": 104, + "line": 171, "column": 2 } } @@ -6085,16 +6465,16 @@ "generator": false, "expression": false, "range": [ - 2122, - 2157 + 3937, + 3971 ], "loc": { "start": { - "line": 100, + "line": 167, "column": 19 }, "end": { - "line": 104, + "line": 171, "column": 2 } } @@ -6102,19 +6482,39 @@ "kind": "method", "computed": true, "range": [ - 2104, - 2157 + 3919, + 3971 ], "loc": { "start": { - "line": 100, + "line": 167, "column": 1 }, "end": { - "line": 104, + "line": 171, "column": 2 } }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "range": [ + 3974, + 4187 + ], + "loc": { + "start": { + "line": 173, + "column": 1 + }, + "end": { + "line": 179, + "column": 4 + } + } + } + ], "static": false }, { @@ -6123,16 +6523,16 @@ "type": "Identifier", "name": "from", "range": [ - 2167, - 2171 + 4196, + 4200 ], "loc": { "start": { - "line": 106, + "line": 180, "column": 8 }, "end": { - "line": 106, + "line": 180, "column": 12 } } @@ -6145,16 +6545,16 @@ "type": "Identifier", "name": "compare", "range": [ - 2174, - 2181 + 4203, + 4210 ], "loc": { "start": { - "line": 106, + "line": 180, "column": 15 }, "end": { - "line": 106, + "line": 180, "column": 22 } } @@ -6163,16 +6563,16 @@ "type": "Identifier", "name": "iterable", "range": [ - 2184, - 2192 + 4213, + 4221 ], "loc": { "start": { - "line": 106, + "line": 180, "column": 25 }, "end": { - "line": 106, + "line": 180, "column": 33 } } @@ -6190,16 +6590,16 @@ "type": "Identifier", "name": "tree", "range": [ - 2206, - 2210 + 4235, + 4239 ], "loc": { "start": { - "line": 108, + "line": 182, "column": 8 }, "end": { - "line": 108, + "line": 182, "column": 12 } } @@ -6210,16 +6610,16 @@ "type": "Identifier", "name": "RedBlackTree", "range": [ - 2217, - 2229 + 4246, + 4258 ], "loc": { "start": { - "line": 108, + "line": 182, "column": 19 }, "end": { - "line": 108, + "line": 182, "column": 31 } } @@ -6229,47 +6629,47 @@ "type": "Identifier", "name": "compare", "range": [ - 2231, - 2238 + 4260, + 4267 ], "loc": { "start": { - "line": 108, + "line": 182, "column": 33 }, "end": { - "line": 108, + "line": 182, "column": 40 } } } ], "range": [ - 2213, - 2240 + 4242, + 4269 ], "loc": { "start": { - "line": 108, + "line": 182, "column": 15 }, "end": { - "line": 108, + "line": 182, "column": 42 } } }, "range": [ - 2206, - 2240 + 4235, + 4269 ], "loc": { "start": { - "line": 108, + "line": 182, "column": 8 }, "end": { - "line": 108, + "line": 182, "column": 42 } } @@ -6277,16 +6677,16 @@ ], "kind": "const", "range": [ - 2200, - 2242 + 4229, + 4271 ], "loc": { "start": { - "line": 108, + "line": 182, "column": 2 }, "end": { - "line": 108, + "line": 182, "column": 44 } } @@ -6302,32 +6702,32 @@ "type": "Identifier", "name": "element", "range": [ - 2258, - 2265 + 4287, + 4294 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 14 }, "end": { - "line": 110, + "line": 184, "column": 21 } } }, "init": null, "range": [ - 2258, - 2265 + 4287, + 4294 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 14 }, "end": { - "line": 110, + "line": 184, "column": 21 } } @@ -6335,16 +6735,16 @@ ], "kind": "const", "range": [ - 2252, - 2265 + 4281, + 4294 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 8 }, "end": { - "line": 110, + "line": 184, "column": 21 } } @@ -6353,16 +6753,16 @@ "type": "Identifier", "name": "iterable", "range": [ - 2269, - 2277 + 4298, + 4306 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 25 }, "end": { - "line": 110, + "line": 184, "column": 33 } } @@ -6378,16 +6778,16 @@ "type": "Identifier", "name": "tree", "range": [ - 2280, - 2284 + 4309, + 4313 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 36 }, "end": { - "line": 110, + "line": 184, "column": 40 } } @@ -6396,31 +6796,31 @@ "type": "Identifier", "name": "add", "range": [ - 2285, - 2288 + 4314, + 4317 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 41 }, "end": { - "line": 110, + "line": 184, "column": 44 } } }, "range": [ - 2280, - 2288 + 4309, + 4317 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 36 }, "end": { - "line": 110, + "line": 184, "column": 44 } } @@ -6430,62 +6830,62 @@ "type": "Identifier", "name": "element", "range": [ - 2290, - 2297 + 4319, + 4326 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 46 }, "end": { - "line": 110, + "line": 184, "column": 53 } } } ], "range": [ - 2280, - 2299 + 4309, + 4328 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 36 }, "end": { - "line": 110, + "line": 184, "column": 55 } } }, "range": [ - 2280, - 2301 + 4309, + 4330 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 36 }, "end": { - "line": 110, + "line": 184, "column": 57 } } }, "range": [ - 2246, - 2301 + 4275, + 4330 ], "loc": { "start": { - "line": 110, + "line": 184, "column": 2 }, "end": { - "line": 110, + "line": 184, "column": 57 } } @@ -6496,47 +6896,47 @@ "type": "Identifier", "name": "tree", "range": [ - 2312, - 2316 + 4341, + 4345 ], "loc": { "start": { - "line": 112, + "line": 186, "column": 9 }, "end": { - "line": 112, + "line": 186, "column": 13 } } }, "range": [ - 2305, - 2318 + 4334, + 4347 ], "loc": { "start": { - "line": 112, + "line": 186, "column": 2 }, "end": { - "line": 112, + "line": 186, "column": 15 } } } ], "range": [ - 2195, - 2322 + 4224, + 4351 ], "loc": { "start": { - "line": 106, + "line": 180, "column": 36 }, "end": { - "line": 114, + "line": 188, "column": 2 } } @@ -6544,16 +6944,16 @@ "generator": false, "expression": false, "range": [ - 2172, - 2322 + 4201, + 4351 ], "loc": { "start": { - "line": 106, + "line": 180, "column": 13 }, "end": { - "line": 114, + "line": 188, "column": 2 } } @@ -6561,76 +6961,135 @@ "kind": "method", "computed": false, "range": [ - 2160, - 2322 + 4189, + 4351 ], "loc": { "start": { - "line": 106, + "line": 180, "column": 1 }, "end": { - "line": 114, + "line": 188, "column": 2 } }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "range": [ + 3974, + 4187 + ], + "loc": { + "start": { + "line": 173, + "column": 1 + }, + "end": { + "line": 179, + "column": 4 + } + } + } + ], "static": true } ], "range": [ - 302, - 2325 + 352, + 4354 ], "loc": { "start": { - "line": 10, + "line": 14, "column": 26 }, "end": { - "line": 116, + "line": 190, "column": 1 } } }, "range": [ - 283, - 2325 + 333, + 4354 ], "loc": { "start": { - "line": 10, + "line": 14, "column": 7 }, "end": { - "line": 116, + "line": 190, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", + "range": [ + 276, + 325 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 276, - 2325 + 326, + 4354 ], "loc": { "start": { - "line": 10, + "line": 14, "column": 0 }, "end": { - "line": 116, + "line": 190, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", + "range": [ + 276, + 325 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 1, - 2325 + 4354 ], "loc": { "start": { @@ -6638,26 +7097,152 @@ "column": 0 }, "end": { - "line": 116, + "line": 190, "column": 1 } }, "comments": [ + { + "type": "Block", + "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", + "range": [ + 276, + 325 + ], + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t ", + "range": [ + 356, + 510 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 21, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t ", + "range": [ + 593, + 672 + ], + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 33, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t ", + "range": [ + 894, + 1120 + ], + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 52, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t ", + "range": [ + 1239, + 1501 + ], + "loc": { + "start": { + "line": 58, + "column": 1 + }, + "end": { + "line": 65, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t ", + "range": [ + 1602, + 1757 + ], + "loc": { + "start": { + "line": 71, + "column": 1 + }, + "end": { + "line": 77, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", + "range": [ + 1818, + 1923 + ], + "loc": { + "start": { + "line": 82, + "column": 1 + }, + "end": { + "line": 86, + "column": 4 + } + } + }, { "type": "Line", - "value": " replace node's value with predecessor's value", + "value": " replace node's key with predecessor's key", "range": [ - 956, - 1004 + 1979, + 2023 ], "loc": { "start": { - "line": 47, + "line": 90, "column": 3 }, "end": { - "line": 47, - "column": 51 + "line": 90, + "column": 47 } } }, @@ -6665,16 +7250,16 @@ "type": "Line", "value": " delete predecessor node", "range": [ - 1075, - 1101 + 2090, + 2116 ], "loc": { "start": { - "line": 50, + "line": 93, "column": 3 }, "end": { - "line": 50, + "line": 93, "column": 29 } } @@ -6683,16 +7268,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1105, - 1156 + 2120, + 2171 ], "loc": { "start": { - "line": 51, + "line": 94, "column": 3 }, "end": { - "line": 51, + "line": 94, "column": 54 } } @@ -6701,35 +7286,35 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1160, - 1205 + 2175, + 2220 ], "loc": { "start": { - "line": 52, + "line": 95, "column": 3 }, "end": { - "line": 52, + "line": 95, "column": 48 } } }, { "type": "Line", - "value": " replace node's value with successor's value", + "value": " replace node's key with successor's key", "range": [ - 1281, - 1327 + 2296, + 2338 ], "loc": { "start": { - "line": 57, + "line": 100, "column": 3 }, "end": { - "line": 57, - "column": 49 + "line": 100, + "column": 45 } } }, @@ -6737,16 +7322,16 @@ "type": "Line", "value": " If there is no left child, then there can only be one right", "range": [ - 1331, - 1393 + 2342, + 2404 ], "loc": { "start": { - "line": 58, + "line": 101, "column": 3 }, "end": { - "line": 58, + "line": 101, "column": 65 } } @@ -6755,16 +7340,16 @@ "type": "Line", "value": " child.", "range": [ - 1397, - 1406 + 2408, + 2417 ], "loc": { "start": { - "line": 59, + "line": 102, "column": 3 }, "end": { - "line": 59, + "line": 102, "column": 12 } } @@ -6773,16 +7358,16 @@ "type": "Line", "value": " delete successor node", "range": [ - 1468, - 1492 + 2475, + 2499 ], "loc": { "start": { - "line": 62, + "line": 105, "column": 3 }, "end": { - "line": 62, + "line": 105, "column": 27 } } @@ -6791,16 +7376,16 @@ "type": "Line", "value": " note: this node can only have one non-leaf child", "range": [ - 1496, - 1547 + 2503, + 2554 ], "loc": { "start": { - "line": 63, + "line": 106, "column": 3 }, "end": { - "line": 63, + "line": 106, "column": 54 } } @@ -6809,19 +7394,109 @@ "type": "Line", "value": " because the tree is a red-black tree", "range": [ - 1551, - 1596 + 2558, + 2603 ], "loc": { "start": { - "line": 64, + "line": 107, "column": 3 }, "end": { - "line": 64, + "line": 107, "column": 48 } } + }, + { + "type": "Block", + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", + "range": [ + 2750, + 3162 + ], + "loc": { + "start": { + "line": 121, + "column": 1 + }, + "end": { + "line": 129, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t ", + "range": [ + 3305, + 3554 + ], + "loc": { + "start": { + "line": 140, + "column": 1 + }, + "end": { + "line": 146, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t ", + "range": [ + 3684, + 3780 + ], + "loc": { + "start": { + "line": 153, + "column": 1 + }, + "end": { + "line": 157, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", + "range": [ + 3869, + 3917 + ], + "loc": { + "start": { + "line": 164, + "column": 1 + }, + "end": { + "line": 166, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "range": [ + 3974, + 4187 + ], + "loc": { + "start": { + "line": 173, + "column": 1 + }, + "end": { + "line": 179, + "column": 4 + } + } } ] } \ No newline at end of file diff --git a/ast/source/color/BLACK.js.json b/ast/source/color/BLACK.js.json index 12e437a..40a1fa0 100644 --- a/ast/source/color/BLACK.js.json +++ b/ast/source/color/BLACK.js.json @@ -12,16 +12,16 @@ "type": "Identifier", "name": "BLACK", "range": [ - 13, - 18 + 44, + 49 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 13 }, "end": { - "line": 1, + "line": 4, "column": 18 } } @@ -31,31 +31,31 @@ "value": 0, "raw": "0", "range": [ - 21, - 22 + 52, + 53 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 21 }, "end": { - "line": 1, + "line": 4, "column": 22 } } }, "range": [ - 13, - 22 + 44, + 53 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 13 }, "end": { - "line": 1, + "line": 4, "column": 22 } } @@ -63,54 +63,112 @@ ], "kind": "const", "range": [ - 7, - 24 + 38, + 55 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 7 }, "end": { - "line": 1, + "line": 4, "column": 24 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Constant for black.\n ", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 24 + 31, + 55 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 1, + "line": 4, "column": 24 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Constant for black.\n ", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 24 + 31, + 55 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 1, + "line": 4, "column": 24 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Constant for black.\n ", + "range": [ + 0, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/color/RED.js.json b/ast/source/color/RED.js.json index 87d4a3b..babc50b 100644 --- a/ast/source/color/RED.js.json +++ b/ast/source/color/RED.js.json @@ -12,16 +12,16 @@ "type": "Identifier", "name": "RED", "range": [ - 13, - 16 + 42, + 45 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 13 }, "end": { - "line": 1, + "line": 4, "column": 16 } } @@ -31,31 +31,31 @@ "value": 1, "raw": "1", "range": [ - 19, - 20 + 48, + 49 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 19 }, "end": { - "line": 1, + "line": 4, "column": 20 } } }, "range": [ - 13, - 20 + 42, + 49 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 13 }, "end": { - "line": 1, + "line": 4, "column": 20 } } @@ -63,54 +63,112 @@ ], "kind": "const", "range": [ - 7, - 22 + 36, + 51 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 7 }, "end": { - "line": 1, + "line": 4, "column": 22 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Constant for red.\n ", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 22 + 29, + 51 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 1, + "line": 4, "column": 22 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Constant for red.\n ", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 22 + 29, + 51 ], "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 1, + "line": 4, "column": 22 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Constant for red.\n ", + "range": [ + 0, + 28 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 3 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/debug/debug.js.json b/ast/source/debug/debug.js.json index f42a39d..b8f2cfc 100644 --- a/ast/source/debug/debug.js.json +++ b/ast/source/debug/debug.js.json @@ -163,7 +163,27 @@ "line": 3, "column": 28 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Recursively constructs a prettyprint string for the red-black tree rooted at\n * root.\n *\n * @param {Node} root - The root of the tree.\n * @returns {String}\n ", + "range": [ + 59, + 238 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -173,16 +193,16 @@ "type": "Identifier", "name": "debug", "range": [ - 75, - 80 + 255, + 260 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 16 }, "end": { - "line": 5, + "line": 12, "column": 21 } } @@ -190,18 +210,18 @@ "params": [ { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 83, - 87 + 263, + 267 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 24 }, "end": { - "line": 5, + "line": 12, "column": 28 } } @@ -219,18 +239,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 99, - 103 + 279, + 283 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 6 }, "end": { - "line": 7, + "line": 14, "column": 10 } } @@ -239,47 +259,47 @@ "type": "Identifier", "name": "isleaf", "range": [ - 104, - 110 + 284, + 290 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 11 }, "end": { - "line": 7, + "line": 14, "column": 17 } } }, "range": [ - 99, - 110 + 279, + 290 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 6 }, "end": { - "line": 7, + "line": 14, "column": 17 } } }, "arguments": [], "range": [ - 99, - 113 + 279, + 293 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 6 }, "end": { - "line": 7, + "line": 14, "column": 20 } } @@ -295,16 +315,16 @@ "type": "Identifier", "name": "chalk", "range": [ - 123, - 128 + 303, + 308 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 30 }, "end": { - "line": 7, + "line": 14, "column": 35 } } @@ -313,31 +333,31 @@ "type": "Identifier", "name": "bgBlack", "range": [ - 129, - 136 + 309, + 316 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 36 }, "end": { - "line": 7, + "line": 14, "column": 43 } } }, "range": [ - 123, - 136 + 303, + 316 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 30 }, "end": { - "line": 7, + "line": 14, "column": 43 } } @@ -348,63 +368,63 @@ "value": "L", "raw": "'L'", "range": [ - 137, - 140 + 317, + 320 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 44 }, "end": { - "line": 7, + "line": 14, "column": 47 } } } ], "range": [ - 123, - 141 + 303, + 321 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 30 }, "end": { - "line": 7, + "line": 14, "column": 48 } } }, "range": [ - 116, - 143 + 296, + 323 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 23 }, "end": { - "line": 7, + "line": 14, "column": 50 } } }, "alternate": null, "range": [ - 94, - 143 + 274, + 323 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 1 }, "end": { - "line": 7, + "line": 14, "column": 50 } } @@ -418,16 +438,16 @@ "type": "Identifier", "name": "repr", "range": [ - 152, - 156 + 332, + 336 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 7 }, "end": { - "line": 9, + "line": 16, "column": 11 } } @@ -442,18 +462,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 159, - 163 + 339, + 343 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 14 }, "end": { - "line": 9, + "line": 16, "column": 18 } } @@ -462,31 +482,31 @@ "type": "Identifier", "name": "color", "range": [ - 164, - 169 + 344, + 349 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 19 }, "end": { - "line": 9, + "line": 16, "column": 24 } } }, "range": [ - 159, - 169 + 339, + 349 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 14 }, "end": { - "line": 9, + "line": 16, "column": 24 } } @@ -495,31 +515,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 174, - 179 + 354, + 359 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 29 }, "end": { - "line": 9, + "line": 16, "column": 34 } } }, "range": [ - 159, - 179 + 339, + 359 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 14 }, "end": { - "line": 9, + "line": 16, "column": 34 } } @@ -533,16 +553,16 @@ "type": "Identifier", "name": "chalk", "range": [ - 182, - 187 + 362, + 367 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 37 }, "end": { - "line": 9, + "line": 16, "column": 42 } } @@ -551,31 +571,31 @@ "type": "Identifier", "name": "bgBlack", "range": [ - 188, - 195 + 368, + 375 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 43 }, "end": { - "line": 9, + "line": 16, "column": 50 } } }, "range": [ - 182, - 195 + 362, + 375 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 37 }, "end": { - "line": 9, + "line": 16, "column": 50 } } @@ -586,68 +606,68 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 196, - 200 + 376, + 380 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 51 }, "end": { - "line": 9, + "line": 16, "column": 55 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 201, - 206 + 381, + 384 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 56 }, "end": { - "line": 9, - "column": 61 + "line": 16, + "column": 59 } } }, "range": [ - 196, - 206 + 376, + 384 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 51 }, "end": { - "line": 9, - "column": 61 + "line": 16, + "column": 59 } } } ], "range": [ - 182, - 207 + 362, + 385 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 37 }, "end": { - "line": 9, - "column": 62 + "line": 16, + "column": 60 } } }, @@ -660,17 +680,17 @@ "type": "Identifier", "name": "chalk", "range": [ - 210, - 215 + 388, + 393 ], "loc": { "start": { - "line": 9, - "column": 65 + "line": 16, + "column": 63 }, "end": { - "line": 9, - "column": 70 + "line": 16, + "column": 68 } } }, @@ -678,32 +698,32 @@ "type": "Identifier", "name": "bgRed", "range": [ - 216, - 221 + 394, + 399 ], "loc": { "start": { - "line": 9, - "column": 71 + "line": 16, + "column": 69 }, "end": { - "line": 9, - "column": 76 + "line": 16, + "column": 74 } } }, "range": [ - 210, - 221 + 388, + 399 ], "loc": { "start": { - "line": 9, - "column": 65 + "line": 16, + "column": 63 }, "end": { - "line": 9, - "column": 76 + "line": 16, + "column": 74 } } }, @@ -713,115 +733,115 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 223, - 227 + 401, + 405 ], "loc": { "start": { - "line": 9, - "column": 78 + "line": 16, + "column": 76 }, "end": { - "line": 9, - "column": 82 + "line": 16, + "column": 80 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 228, - 233 + 406, + 409 ], "loc": { "start": { - "line": 9, - "column": 83 + "line": 16, + "column": 81 }, "end": { - "line": 9, - "column": 88 + "line": 16, + "column": 84 } } }, "range": [ - 223, - 233 + 401, + 409 ], "loc": { "start": { - "line": 9, - "column": 78 + "line": 16, + "column": 76 }, "end": { - "line": 9, - "column": 88 + "line": 16, + "column": 84 } } } ], "range": [ - 210, - 235 + 388, + 411 ], "loc": { "start": { - "line": 9, - "column": 65 + "line": 16, + "column": 63 }, "end": { - "line": 9, - "column": 90 + "line": 16, + "column": 86 } } }, "range": [ - 159, - 235 + 339, + 411 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 14 }, "end": { - "line": 9, - "column": 90 + "line": 16, + "column": 86 } } }, "range": [ - 152, - 235 + 332, + 411 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 7 }, "end": { - "line": 9, - "column": 90 + "line": 16, + "column": 86 } } } ], "kind": "const", "range": [ - 146, - 237 + 326, + 413 ], "loc": { "start": { - "line": 9, + "line": 16, "column": 1 }, "end": { - "line": 9, - "column": 92 + "line": 16, + "column": 88 } } }, @@ -838,16 +858,16 @@ }, "tail": false, "range": [ - 247, - 251 + 423, + 427 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 8 }, "end": { - "line": 11, + "line": 18, "column": 12 } } @@ -860,16 +880,16 @@ }, "tail": false, "range": [ - 267, - 272 + 443, + 448 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 28 }, "end": { - "line": 11, + "line": 18, "column": 33 } } @@ -882,16 +902,16 @@ }, "tail": false, "range": [ - 276, - 281 + 452, + 457 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 37 }, "end": { - "line": 11, + "line": 18, "column": 42 } } @@ -904,16 +924,16 @@ }, "tail": true, "range": [ - 298, - 301 + 474, + 477 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 59 }, "end": { - "line": 11, + "line": 18, "column": 62 } } @@ -926,16 +946,16 @@ "type": "Identifier", "name": "debug", "range": [ - 251, - 256 + 427, + 432 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 12 }, "end": { - "line": 11, + "line": 18, "column": 17 } } @@ -946,18 +966,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 257, - 261 + 433, + 437 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 18 }, "end": { - "line": 11, + "line": 18, "column": 22 } } @@ -966,47 +986,47 @@ "type": "Identifier", "name": "left", "range": [ - 262, - 266 + 438, + 442 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 23 }, "end": { - "line": 11, + "line": 18, "column": 27 } } }, "range": [ - 257, - 266 + 433, + 442 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 18 }, "end": { - "line": 11, + "line": 18, "column": 27 } } } ], "range": [ - 251, - 267 + 427, + 443 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 12 }, "end": { - "line": 11, + "line": 18, "column": 28 } } @@ -1015,16 +1035,16 @@ "type": "Identifier", "name": "repr", "range": [ - 272, - 276 + 448, + 452 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 33 }, "end": { - "line": 11, + "line": 18, "column": 37 } } @@ -1035,16 +1055,16 @@ "type": "Identifier", "name": "debug", "range": [ - 281, - 286 + 457, + 462 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 42 }, "end": { - "line": 11, + "line": 18, "column": 47 } } @@ -1055,18 +1075,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 287, - 291 + 463, + 467 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 48 }, "end": { - "line": 11, + "line": 18, "column": 52 } } @@ -1075,94 +1095,94 @@ "type": "Identifier", "name": "right", "range": [ - 292, - 297 + 468, + 473 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 53 }, "end": { - "line": 11, + "line": 18, "column": 58 } } }, "range": [ - 287, - 297 + 463, + 473 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 48 }, "end": { - "line": 11, + "line": 18, "column": 58 } } } ], "range": [ - 281, - 298 + 457, + 474 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 42 }, "end": { - "line": 11, + "line": 18, "column": 59 } } } ], "range": [ - 247, - 301 + 423, + 477 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 8 }, "end": { - "line": 11, + "line": 18, "column": 62 } } }, "range": [ - 240, - 303 + 416, + 479 ], "loc": { "start": { - "line": 11, + "line": 18, "column": 1 }, "end": { - "line": 11, + "line": 18, "column": 64 } } } ], "range": [ - 90, - 306 + 270, + 482 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 31 }, "end": { - "line": 13, + "line": 20, "column": 1 } } @@ -1170,44 +1190,83 @@ "generator": false, "expression": false, "range": [ - 66, - 306 + 246, + 482 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 7 }, "end": { - "line": 13, + "line": 20, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Recursively constructs a prettyprint string for the red-black tree rooted at\n * root.\n *\n * @param {Node} root - The root of the tree.\n * @returns {String}\n ", + "range": [ + 59, + 238 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 59, - 306 + 239, + 482 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 0 }, "end": { - "line": 13, + "line": 20, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Recursively constructs a prettyprint string for the red-black tree rooted at\n * root.\n *\n * @param {Node} root - The root of the tree.\n * @returns {String}\n ", + "range": [ + 59, + 238 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 306 + 482 ], "loc": { "start": { @@ -1215,9 +1274,28 @@ "column": 0 }, "end": { - "line": 13, + "line": 20, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Recursively constructs a prettyprint string for the red-black tree rooted at\n * root.\n *\n * @param {Node} root - The root of the tree.\n * @returns {String}\n ", + "range": [ + 59, + 238 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/removal/delete_case1.js.json b/ast/source/deletion/delete_case1.js.json similarity index 57% rename from ast/source/removal/delete_case1.js.json rename to ast/source/deletion/delete_case1.js.json index 4b0ecf4..baa5f7c 100644 --- a/ast/source/removal/delete_case1.js.json +++ b/ast/source/deletion/delete_case1.js.json @@ -90,7 +90,27 @@ "line": 1, "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 49, + 262 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -100,16 +120,16 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 65, - 77 + 279, + 291 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 16 }, "end": { - "line": 3, + "line": 11, "column": 28 } } @@ -119,16 +139,16 @@ "type": "Identifier", "name": "n", "range": [ - 80, - 81 + 294, + 295 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 31 }, "end": { - "line": 3, + "line": 11, "column": 32 } } @@ -149,16 +169,16 @@ "type": "Identifier", "name": "n", "range": [ - 96, - 97 + 406, + 407 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 9 }, "end": { - "line": 5, + "line": 15, "column": 10 } } @@ -167,31 +187,31 @@ "type": "Identifier", "name": "parent", "range": [ - 98, - 104 + 408, + 414 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 11 }, "end": { - "line": 5, + "line": 15, "column": 17 } } }, "range": [ - 96, - 104 + 406, + 414 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 9 }, "end": { - "line": 5, + "line": 15, "column": 17 } } @@ -201,31 +221,31 @@ "value": null, "raw": "null", "range": [ - 109, - 113 + 419, + 423 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 22 }, "end": { - "line": 5, + "line": 15, "column": 26 } } }, "range": [ - 96, - 113 + 406, + 423 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 9 }, "end": { - "line": 5, + "line": 15, "column": 26 } } @@ -238,16 +258,16 @@ "type": "Identifier", "name": "delete_case2", "range": [ - 116, - 128 + 426, + 438 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 29 }, "end": { - "line": 5, + "line": 15, "column": 41 } } @@ -257,79 +277,117 @@ "type": "Identifier", "name": "n", "range": [ - 130, - 131 + 440, + 441 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 43 }, "end": { - "line": 5, + "line": 15, "column": 44 } } } ], "range": [ - 116, - 133 + 426, + 443 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 29 }, "end": { - "line": 5, + "line": 15, "column": 46 } } }, "range": [ - 116, - 135 + 426, + 445 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 29 }, "end": { - "line": 5, + "line": 15, "column": 48 } } }, "alternate": null, "range": [ - 91, - 135 + 401, + 445 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 4 }, "end": { - "line": 5, + "line": 15, "column": 48 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " If n is the root, there is nothing to do: all paths go through n, and n", + "range": [ + 305, + 379 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 78 + } + } + }, + { + "type": "Line", + "value": " is black.", + "range": [ + 384, + 396 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 16 + } + } + } + ] } ], "range": [ - 84, - 138 + 298, + 448 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 35 }, "end": { - "line": 7, + "line": 17, "column": 1 } } @@ -337,44 +395,83 @@ "generator": false, "expression": false, "range": [ - 56, - 138 + 270, + 448 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 7 }, "end": { - "line": 7, + "line": 17, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 49, + 262 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 49, - 138 + 263, + 448 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 0 }, "end": { - "line": 7, + "line": 17, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 49, + 262 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 138 + 448 ], "loc": { "start": { @@ -382,9 +479,64 @@ "column": 0 }, "end": { - "line": 7, + "line": 17, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 49, + 262 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "Line", + "value": " If n is the root, there is nothing to do: all paths go through n, and n", + "range": [ + 305, + 379 + ], + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 78 + } + } + }, + { + "type": "Line", + "value": " is black.", + "range": [ + 384, + 396 + ], + "loc": { + "start": { + "line": 14, + "column": 4 + }, + "end": { + "line": 14, + "column": 16 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/removal/delete_case2.js.json b/ast/source/deletion/delete_case2.js.json similarity index 58% rename from ast/source/removal/delete_case2.js.json rename to ast/source/deletion/delete_case2.js.json index e241e54..ee973cb 100644 --- a/ast/source/removal/delete_case2.js.json +++ b/ast/source/deletion/delete_case2.js.json @@ -395,6 +395,117 @@ } } }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case4", + "range": [ + 132, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case4", + "range": [ + 132, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + }, + "range": [ + 132, + 144 + ], + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case4", + "raw": "'./delete_case4'", + "range": [ + 152, + 168 + ], + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 45 + } + } + }, + "range": [ + 123, + 170 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 47 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 172, + 410 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ] + }, { "type": "ExportNamedDeclaration", "declaration": { @@ -403,16 +514,16 @@ "type": "Identifier", "name": "delete_case2", "range": [ - 140, - 152 + 427, + 439 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 16 }, "end": { - "line": 5, + "line": 15, "column": 28 } } @@ -422,17 +533,17 @@ "type": "Identifier", "name": "n", "range": [ - 153, - 154 + 442, + 443 ], "loc": { "start": { - "line": 5, - "column": 29 + "line": 15, + "column": 31 }, "end": { - "line": 5, - "column": 30 + "line": 15, + "column": 32 } } } @@ -449,17 +560,17 @@ "type": "Identifier", "name": "s", "range": [ - 165, - 166 + 459, + 460 ], "loc": { "start": { - "line": 7, - "column": 7 + "line": 17, + "column": 10 }, "end": { - "line": 7, - "column": 8 + "line": 17, + "column": 11 } } }, @@ -469,17 +580,17 @@ "type": "Identifier", "name": "sibling", "range": [ - 169, - 176 + 463, + 470 ], "loc": { "start": { - "line": 7, - "column": 11 + "line": 17, + "column": 14 }, "end": { - "line": 7, - "column": 18 + "line": 17, + "column": 21 } } }, @@ -488,67 +599,87 @@ "type": "Identifier", "name": "n", "range": [ - 177, - 178 + 472, + 473 ], "loc": { "start": { - "line": 7, - "column": 19 + "line": 17, + "column": 23 }, "end": { - "line": 7, - "column": 20 + "line": 17, + "column": 24 } } } ], "range": [ - 169, - 179 + 463, + 475 ], "loc": { "start": { - "line": 7, - "column": 11 + "line": 17, + "column": 14 }, "end": { - "line": 7, - "column": 21 + "line": 17, + "column": 26 } } }, "range": [ - 165, - 179 + 459, + 475 ], "loc": { "start": { - "line": 7, - "column": 7 + "line": 17, + "column": 10 }, "end": { - "line": 7, - "column": 21 + "line": 17, + "column": 26 } } } ], "kind": "const", "range": [ - 159, - 180 + 453, + 477 ], "loc": { "start": { - "line": 7, - "column": 1 + "line": 17, + "column": 4 }, "end": { - "line": 7, - "column": 22 + "line": 17, + "column": 28 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "range": [ + 480, + 848 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 29, + "column": 4 + } + } + } + ] }, { "type": "IfStatement", @@ -562,17 +693,17 @@ "type": "Identifier", "name": "s", "range": [ - 187, - 188 + 858, + 859 ], "loc": { "start": { - "line": 9, - "column": 5 + "line": 30, + "column": 9 }, "end": { - "line": 9, - "column": 6 + "line": 30, + "column": 10 } } }, @@ -580,32 +711,32 @@ "type": "Identifier", "name": "color", "range": [ - 189, - 194 + 860, + 865 ], "loc": { "start": { - "line": 9, - "column": 7 + "line": 30, + "column": 11 }, "end": { - "line": 9, - "column": 12 + "line": 30, + "column": 16 } } }, "range": [ - 187, - 194 + 858, + 865 ], "loc": { "start": { - "line": 9, - "column": 5 + "line": 30, + "column": 9 }, "end": { - "line": 9, - "column": 12 + "line": 30, + "column": 16 } } }, @@ -613,32 +744,32 @@ "type": "Identifier", "name": "RED", "range": [ - 199, - 202 + 870, + 873 ], "loc": { "start": { - "line": 9, - "column": 17 + "line": 30, + "column": 21 }, "end": { - "line": 9, - "column": 20 + "line": 30, + "column": 24 } } }, "range": [ - 187, - 202 + 858, + 873 ], "loc": { "start": { - "line": 9, - "column": 5 + "line": 30, + "column": 9 }, "end": { - "line": 9, - "column": 20 + "line": 30, + "column": 24 } } }, @@ -660,17 +791,17 @@ "type": "Identifier", "name": "n", "range": [ - 208, - 209 + 886, + 887 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 31, + "column": 8 }, "end": { - "line": 10, - "column": 3 + "line": 31, + "column": 9 } } }, @@ -678,32 +809,32 @@ "type": "Identifier", "name": "parent", "range": [ - 210, - 216 + 888, + 894 ], "loc": { "start": { - "line": 10, - "column": 4 + "line": 31, + "column": 10 }, "end": { - "line": 10, - "column": 10 + "line": 31, + "column": 16 } } }, "range": [ - 208, - 216 + 886, + 894 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 31, + "column": 8 }, "end": { - "line": 10, - "column": 10 + "line": 31, + "column": 16 } } }, @@ -711,32 +842,32 @@ "type": "Identifier", "name": "color", "range": [ - 217, - 222 + 895, + 900 ], "loc": { "start": { - "line": 10, - "column": 11 + "line": 31, + "column": 17 }, "end": { - "line": 10, - "column": 16 + "line": 31, + "column": 22 } } }, "range": [ - 208, - 222 + 886, + 900 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 31, + "column": 8 }, "end": { - "line": 10, - "column": 16 + "line": 31, + "column": 22 } } }, @@ -744,47 +875,47 @@ "type": "Identifier", "name": "RED", "range": [ - 225, - 228 + 903, + 906 ], "loc": { "start": { - "line": 10, - "column": 19 + "line": 31, + "column": 25 }, "end": { - "line": 10, - "column": 22 + "line": 31, + "column": 28 } } }, "range": [ - 208, - 228 + 886, + 906 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 31, + "column": 8 }, "end": { - "line": 10, - "column": 22 + "line": 31, + "column": 28 } } }, "range": [ - 208, - 229 + 886, + 908 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 31, + "column": 8 }, "end": { - "line": 10, - "column": 23 + "line": 31, + "column": 30 } } }, @@ -800,17 +931,17 @@ "type": "Identifier", "name": "s", "range": [ - 232, - 233 + 917, + 918 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 32, + "column": 8 }, "end": { - "line": 11, - "column": 3 + "line": 32, + "column": 9 } } }, @@ -818,32 +949,32 @@ "type": "Identifier", "name": "color", "range": [ - 234, - 239 + 919, + 924 ], "loc": { "start": { - "line": 11, - "column": 4 + "line": 32, + "column": 10 }, "end": { - "line": 11, - "column": 9 + "line": 32, + "column": 15 } } }, "range": [ - 232, - 239 + 917, + 924 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 32, + "column": 8 }, "end": { - "line": 11, - "column": 9 + "line": 32, + "column": 15 } } }, @@ -851,47 +982,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 242, - 247 + 927, + 932 ], "loc": { "start": { - "line": 11, - "column": 12 + "line": 32, + "column": 18 }, "end": { - "line": 11, - "column": 17 + "line": 32, + "column": 23 } } }, "range": [ - 232, - 247 + 917, + 932 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 32, + "column": 8 }, "end": { - "line": 11, - "column": 17 + "line": 32, + "column": 23 } } }, "range": [ - 232, - 248 + 917, + 934 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 32, + "column": 8 }, "end": { - "line": 11, - "column": 18 + "line": 32, + "column": 25 } } }, @@ -904,17 +1035,17 @@ "type": "Identifier", "name": "n", "range": [ - 255, - 256 + 948, + 949 ], "loc": { "start": { - "line": 12, - "column": 6 + "line": 33, + "column": 13 }, "end": { - "line": 12, - "column": 7 + "line": 33, + "column": 14 } } }, @@ -928,17 +1059,17 @@ "type": "Identifier", "name": "n", "range": [ - 261, - 262 + 954, + 955 ], "loc": { "start": { - "line": 12, - "column": 12 + "line": 33, + "column": 19 }, "end": { - "line": 12, - "column": 13 + "line": 33, + "column": 20 } } }, @@ -946,32 +1077,32 @@ "type": "Identifier", "name": "parent", "range": [ - 263, - 269 + 956, + 962 ], "loc": { "start": { - "line": 12, - "column": 14 + "line": 33, + "column": 21 }, "end": { - "line": 12, - "column": 20 + "line": 33, + "column": 27 } } }, "range": [ - 261, - 269 + 954, + 962 ], "loc": { "start": { - "line": 12, - "column": 12 + "line": 33, + "column": 19 }, "end": { - "line": 12, - "column": 20 + "line": 33, + "column": 27 } } }, @@ -979,47 +1110,47 @@ "type": "Identifier", "name": "left", "range": [ - 270, - 274 + 963, + 967 ], "loc": { "start": { - "line": 12, - "column": 21 + "line": 33, + "column": 28 }, "end": { - "line": 12, - "column": 25 + "line": 33, + "column": 32 } } }, "range": [ - 261, - 274 + 954, + 967 ], "loc": { "start": { - "line": 12, - "column": 12 + "line": 33, + "column": 19 }, "end": { - "line": 12, - "column": 25 + "line": 33, + "column": 32 } } }, "range": [ - 255, - 274 + 948, + 967 ], "loc": { "start": { - "line": 12, - "column": 6 + "line": 33, + "column": 13 }, "end": { - "line": 12, - "column": 25 + "line": 33, + "column": 32 } } }, @@ -1031,17 +1162,17 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 279, - 290 + 970, + 981 ], "loc": { "start": { - "line": 13, - "column": 3 + "line": 33, + "column": 35 }, "end": { - "line": 13, - "column": 14 + "line": 33, + "column": 46 } } }, @@ -1053,17 +1184,17 @@ "type": "Identifier", "name": "n", "range": [ - 291, - 292 + 983, + 984 ], "loc": { "start": { - "line": 13, - "column": 15 + "line": 33, + "column": 48 }, "end": { - "line": 13, - "column": 16 + "line": 33, + "column": 49 } } }, @@ -1071,63 +1202,63 @@ "type": "Identifier", "name": "parent", "range": [ - 293, - 299 + 985, + 991 ], "loc": { "start": { - "line": 13, - "column": 17 + "line": 33, + "column": 50 }, "end": { - "line": 13, - "column": 23 + "line": 33, + "column": 56 } } }, "range": [ - 291, - 299 + 983, + 991 ], "loc": { "start": { - "line": 13, - "column": 15 + "line": 33, + "column": 48 }, "end": { - "line": 13, - "column": 23 + "line": 33, + "column": 56 } } } ], "range": [ - 279, - 300 + 970, + 993 ], "loc": { "start": { - "line": 13, - "column": 3 + "line": 33, + "column": 35 }, "end": { - "line": 13, - "column": 24 + "line": 33, + "column": 58 } } }, "range": [ - 279, - 301 + 970, + 995 ], "loc": { "start": { - "line": 13, - "column": 3 + "line": 33, + "column": 35 }, "end": { - "line": 13, - "column": 25 + "line": 33, + "column": 60 } } }, @@ -1139,17 +1270,17 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 312, - 324 + 1009, + 1021 ], "loc": { "start": { - "line": 15, - "column": 3 + "line": 34, + "column": 13 }, "end": { - "line": 15, - "column": 15 + "line": 34, + "column": 25 } } }, @@ -1161,17 +1292,17 @@ "type": "Identifier", "name": "n", "range": [ - 325, - 326 + 1023, + 1024 ], "loc": { "start": { - "line": 15, - "column": 16 + "line": 34, + "column": 27 }, "end": { - "line": 15, - "column": 17 + "line": 34, + "column": 28 } } }, @@ -1179,197 +1310,328 @@ "type": "Identifier", "name": "parent", "range": [ - 327, - 333 + 1025, + 1031 ], "loc": { "start": { - "line": 15, - "column": 18 + "line": 34, + "column": 29 }, "end": { - "line": 15, - "column": 24 + "line": 34, + "column": 35 } } }, "range": [ - 325, - 333 + 1023, + 1031 ], "loc": { "start": { - "line": 15, - "column": 16 + "line": 34, + "column": 27 }, "end": { - "line": 15, - "column": 24 + "line": 34, + "column": 35 } } } ], "range": [ - 312, - 334 + 1009, + 1033 ], "loc": { "start": { - "line": 15, - "column": 3 + "line": 34, + "column": 13 }, "end": { - "line": 15, - "column": 25 + "line": 34, + "column": 37 } } }, "range": [ - 312, - 335 + 1009, + 1035 ], "loc": { "start": { - "line": 15, - "column": 3 + "line": 34, + "column": 13 }, "end": { - "line": 15, - "column": 26 + "line": 34, + "column": 39 } } }, "range": [ - 251, - 335 + 943, + 1035 ], "loc": { "start": { - "line": 12, - "column": 2 + "line": 33, + "column": 8 }, "end": { - "line": 15, - "column": 26 + "line": 34, + "column": 39 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case4", + "range": [ + 1044, + 1056 + ], + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 20 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 1058, + 1059 + ], + "loc": { + "start": { + "line": 35, + "column": 22 + }, + "end": { + "line": 35, + "column": 23 + } + } + } + ], + "range": [ + 1044, + 1061 + ], + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 25 + } + } + }, + "range": [ + 1044, + 1063 + ], + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 27 } } } ], "range": [ - 204, - 338 + 876, + 1069 ], "loc": { "start": { - "line": 9, - "column": 22 + "line": 30, + "column": 27 }, "end": { - "line": 16, - "column": 2 + "line": 36, + "column": 5 } - } - }, - "alternate": null, - "range": [ - 183, - 338 - ], - "loc": { - "start": { - "line": 9, - "column": 1 }, - "end": { - "line": 16, - "column": 2 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "delete_case3", - "range": [ - 340, - 352 - ], - "loc": { - "start": { - "line": 17, - "column": 1 - }, - "end": { - "line": 17, - "column": 13 + "trailingComments": [ + { + "type": "Line", + "value": " Otherwise, go to case 3.", + "range": [ + 1075, + 1102 + ], + "loc": { + "start": { + "line": 38, + "column": 4 + }, + "end": { + "line": 38, + "column": 31 + } } } - }, - "arguments": [ - { + ] + }, + "alternate": { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { "type": "Identifier", - "name": "n", + "name": "delete_case3", "range": [ - 353, - 354 + 1112, + 1124 ], "loc": { "start": { - "line": 17, - "column": 14 + "line": 39, + "column": 9 }, "end": { - "line": 17, - "column": 15 + "line": 39, + "column": 21 } } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 1126, + 1127 + ], + "loc": { + "start": { + "line": 39, + "column": 23 + }, + "end": { + "line": 39, + "column": 24 + } + } + } + ], + "range": [ + 1112, + 1129 + ], + "loc": { + "start": { + "line": 39, + "column": 9 + }, + "end": { + "line": 39, + "column": 26 + } } - ], + }, "range": [ - 340, - 355 + 1112, + 1131 ], "loc": { "start": { - "line": 17, - "column": 1 + "line": 39, + "column": 9 }, "end": { - "line": 17, - "column": 16 + "line": 39, + "column": 28 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Otherwise, go to case 3.", + "range": [ + 1075, + 1102 + ], + "loc": { + "start": { + "line": 38, + "column": 4 + }, + "end": { + "line": 38, + "column": 31 + } + } + } + ] }, "range": [ - 340, - 356 + 853, + 1131 ], "loc": { "start": { - "line": 17, - "column": 1 + "line": 30, + "column": 4 }, "end": { - "line": 17, - "column": 17 + "line": 39, + "column": 28 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "range": [ + 480, + 848 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 29, + "column": 4 + } + } + } + ] } ], "range": [ - 156, - 358 + 446, + 1134 ], "loc": { "start": { - "line": 6, - "column": 0 + "line": 15, + "column": 35 }, "end": { - "line": 18, + "line": 41, "column": 1 } } @@ -1377,44 +1639,83 @@ "generator": false, "expression": false, "range": [ - 131, - 358 + 418, + 1134 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 7 }, "end": { - "line": 18, + "line": 41, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 172, + 410 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 124, - 358 + 411, + 1134 ], "loc": { "start": { - "line": 5, + "line": 15, "column": 0 }, "end": { - "line": 18, + "line": 41, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 172, + 410 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 358 + 1134 ], "loc": { "start": { @@ -1422,9 +1723,64 @@ "column": 0 }, "end": { - "line": 18, + "line": 41, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 172, + 410 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "range": [ + 480, + 848 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 29, + "column": 4 + } + } + }, + { + "type": "Line", + "value": " Otherwise, go to case 3.", + "range": [ + 1075, + 1102 + ], + "loc": { + "start": { + "line": 38, + "column": 4 + }, + "end": { + "line": 38, + "column": 31 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/removal/delete_case3.js.json b/ast/source/deletion/delete_case3.js.json similarity index 65% rename from ast/source/removal/delete_case3.js.json rename to ast/source/deletion/delete_case3.js.json index b77b0a2..1ebf66c 100644 --- a/ast/source/removal/delete_case3.js.json +++ b/ast/source/deletion/delete_case3.js.json @@ -378,7 +378,27 @@ "line": 4, "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 143, + 409 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -388,16 +408,16 @@ "type": "Identifier", "name": "delete_case3", "range": [ - 159, - 171 + 426, + 438 ], "loc": { "start": { - "line": 6, + "line": 16, "column": 16 }, "end": { - "line": 6, + "line": 16, "column": 28 } } @@ -407,17 +427,17 @@ "type": "Identifier", "name": "n", "range": [ - 172, - 173 + 441, + 442 ], "loc": { "start": { - "line": 6, - "column": 29 + "line": 16, + "column": 31 }, "end": { - "line": 6, - "column": 30 + "line": 16, + "column": 32 } } } @@ -434,17 +454,17 @@ "type": "Identifier", "name": "s", "range": [ - 184, - 185 + 458, + 459 ], "loc": { "start": { - "line": 8, - "column": 7 + "line": 18, + "column": 10 }, "end": { - "line": 8, - "column": 8 + "line": 18, + "column": 11 } } }, @@ -454,17 +474,17 @@ "type": "Identifier", "name": "sibling", "range": [ - 188, - 195 + 462, + 469 ], "loc": { "start": { - "line": 8, - "column": 11 + "line": 18, + "column": 14 }, "end": { - "line": 8, - "column": 18 + "line": 18, + "column": 21 } } }, @@ -473,83 +493,83 @@ "type": "Identifier", "name": "n", "range": [ - 196, - 197 + 471, + 472 ], "loc": { "start": { - "line": 8, - "column": 19 + "line": 18, + "column": 23 }, "end": { - "line": 8, - "column": 20 + "line": 18, + "column": 24 } } } ], "range": [ - 188, - 198 + 462, + 474 ], "loc": { "start": { - "line": 8, - "column": 11 + "line": 18, + "column": 14 }, "end": { - "line": 8, - "column": 21 + "line": 18, + "column": 26 } } }, "range": [ - 184, - 198 + 458, + 474 ], "loc": { "start": { - "line": 8, - "column": 7 + "line": 18, + "column": 10 }, "end": { - "line": 8, - "column": 21 + "line": 18, + "column": 26 } } } ], "kind": "const", "range": [ - 178, - 199 + 452, + 476 ], "loc": { "start": { - "line": 8, - "column": 1 + "line": 18, + "column": 4 }, "end": { - "line": 8, - "column": 22 + "line": 18, + "column": 28 } }, "trailingComments": [ { - "type": "Line", - "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", + "type": "Block", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n * repaint n's sibling red. Now all root-leaft paths going through n's\n * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", "range": [ - 201, - 262 + 479, + 1027 ], "loc": { "start": { - "line": 9, + "line": 20, "column": 1 }, "end": { - "line": 9, - "column": 62 + "line": 32, + "column": 4 } } } @@ -564,236 +584,128 @@ "type": "LogicalExpression", "operator": "&&", "left": { - "type": "LogicalExpression", - "operator": "&&", + "type": "BinaryExpression", + "operator": "===", "left": { - "type": "BinaryExpression", - "operator": "===", - "left": { + "type": "MemberExpression", + "computed": false, + "object": { "type": "MemberExpression", "computed": false, "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 270, - 271 - ], - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 272, - 278 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 14 - } - } - }, + "type": "Identifier", + "name": "n", "range": [ - 270, - 278 + 1047, + 1048 ], "loc": { "start": { - "line": 11, - "column": 6 + "line": 34, + "column": 10 }, "end": { - "line": 11, - "column": 14 + "line": 34, + "column": 11 } } }, "property": { "type": "Identifier", - "name": "color", + "name": "parent", "range": [ - 279, - 284 + 1049, + 1055 ], "loc": { "start": { - "line": 11, - "column": 15 + "line": 34, + "column": 12 }, "end": { - "line": 11, - "column": 20 + "line": 34, + "column": 18 } } }, "range": [ - 270, - 284 + 1047, + 1055 ], "loc": { "start": { - "line": 11, - "column": 6 + "line": 34, + "column": 10 }, "end": { - "line": 11, - "column": 20 + "line": 34, + "column": 18 } } }, - "right": { + "property": { "type": "Identifier", - "name": "BLACK", + "name": "color", "range": [ - 289, - 294 + 1056, + 1061 ], "loc": { "start": { - "line": 11, - "column": 25 + "line": 34, + "column": 19 }, "end": { - "line": 11, - "column": 30 + "line": 34, + "column": 24 } } }, "range": [ - 270, - 294 + 1047, + 1061 ], "loc": { "start": { - "line": 11, - "column": 6 + "line": 34, + "column": 10 }, "end": { - "line": 11, - "column": 30 + "line": 34, + "column": 24 } } }, "right": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 305, - 306 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 307, - 312 - ], - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 13 - } - } - }, - "range": [ - 305, - 312 - ], - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 13 - } - } - }, - "right": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 317, - 322 - ], - "loc": { - "start": { - "line": 12, - "column": 18 - }, - "end": { - "line": 12, - "column": 23 - } - } - }, + "type": "Identifier", + "name": "BLACK", "range": [ - 305, - 322 + 1066, + 1071 ], "loc": { "start": { - "line": 12, - "column": 6 + "line": 34, + "column": 29 }, "end": { - "line": 12, - "column": 23 + "line": 34, + "column": 34 } } }, "range": [ - 269, - 323 + 1047, + 1071 ], "loc": { "start": { - "line": 11, - "column": 5 + "line": 34, + "column": 10 }, "end": { - "line": 12, - "column": 24 + "line": 34, + "column": 34 } } }, @@ -810,17 +722,17 @@ "type": "Identifier", "name": "s", "range": [ - 333, - 334 + 1087, + 1088 ], "loc": { "start": { - "line": 13, - "column": 6 + "line": 35, + "column": 10 }, "end": { - "line": 13, - "column": 7 + "line": 35, + "column": 11 } } }, @@ -828,32 +740,32 @@ "type": "Identifier", "name": "left", "range": [ - 335, - 339 + 1089, + 1093 ], "loc": { "start": { - "line": 13, - "column": 8 + "line": 35, + "column": 12 }, "end": { - "line": 13, - "column": 12 + "line": 35, + "column": 16 } } }, "range": [ - 333, - 339 + 1087, + 1093 ], "loc": { "start": { - "line": 13, - "column": 6 + "line": 35, + "column": 10 }, "end": { - "line": 13, - "column": 12 + "line": 35, + "column": 16 } } }, @@ -861,32 +773,32 @@ "type": "Identifier", "name": "color", "range": [ - 340, - 345 + 1094, + 1099 ], "loc": { "start": { - "line": 13, - "column": 13 + "line": 35, + "column": 17 }, "end": { - "line": 13, - "column": 18 + "line": 35, + "column": 22 } } }, "range": [ - 333, - 345 + 1087, + 1099 ], "loc": { "start": { - "line": 13, - "column": 6 + "line": 35, + "column": 10 }, "end": { - "line": 13, - "column": 18 + "line": 35, + "column": 22 } } }, @@ -894,47 +806,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 350, - 355 + 1104, + 1109 ], "loc": { "start": { - "line": 13, - "column": 23 + "line": 35, + "column": 27 }, "end": { - "line": 13, - "column": 28 + "line": 35, + "column": 32 } } }, "range": [ - 333, - 355 + 1087, + 1109 ], "loc": { "start": { - "line": 13, - "column": 6 + "line": 35, + "column": 10 }, "end": { - "line": 13, - "column": 28 + "line": 35, + "column": 32 } } }, "range": [ - 269, - 356 + 1045, + 1111 ], "loc": { "start": { - "line": 11, - "column": 5 + "line": 34, + "column": 8 }, "end": { - "line": 13, - "column": 29 + "line": 35, + "column": 34 } } }, @@ -951,17 +863,17 @@ "type": "Identifier", "name": "s", "range": [ - 366, - 367 + 1125, + 1126 ], "loc": { "start": { - "line": 14, - "column": 6 + "line": 36, + "column": 10 }, "end": { - "line": 14, - "column": 7 + "line": 36, + "column": 11 } } }, @@ -969,32 +881,32 @@ "type": "Identifier", "name": "right", "range": [ - 368, - 373 + 1127, + 1132 ], "loc": { "start": { - "line": 14, - "column": 8 + "line": 36, + "column": 12 }, "end": { - "line": 14, - "column": 13 + "line": 36, + "column": 17 } } }, "range": [ - 366, - 373 + 1125, + 1132 ], "loc": { "start": { - "line": 14, - "column": 6 + "line": 36, + "column": 10 }, "end": { - "line": 14, - "column": 13 + "line": 36, + "column": 17 } } }, @@ -1002,32 +914,32 @@ "type": "Identifier", "name": "color", "range": [ - 374, - 379 + 1133, + 1138 ], "loc": { "start": { - "line": 14, - "column": 14 + "line": 36, + "column": 18 }, "end": { - "line": 14, - "column": 19 + "line": 36, + "column": 23 } } }, "range": [ - 366, - 379 + 1125, + 1138 ], "loc": { "start": { - "line": 14, - "column": 6 + "line": 36, + "column": 10 }, "end": { - "line": 14, - "column": 19 + "line": 36, + "column": 23 } } }, @@ -1035,47 +947,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 384, - 389 + 1143, + 1148 ], "loc": { "start": { - "line": 14, - "column": 24 + "line": 36, + "column": 28 }, "end": { - "line": 14, - "column": 29 + "line": 36, + "column": 33 } } }, "range": [ - 366, - 389 + 1125, + 1148 ], "loc": { "start": { - "line": 14, - "column": 6 + "line": 36, + "column": 10 }, "end": { - "line": 14, - "column": 29 + "line": 36, + "column": 33 } } }, "range": [ - 269, - 390 + 1045, + 1150 ], "loc": { "start": { - "line": 11, - "column": 5 + "line": 34, + "column": 8 }, "end": { - "line": 14, - "column": 30 + "line": 36, + "column": 35 } } }, @@ -1094,17 +1006,17 @@ "type": "Identifier", "name": "s", "range": [ - 396, - 397 + 1167, + 1168 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 38, + "column": 8 }, "end": { - "line": 15, - "column": 3 + "line": 38, + "column": 9 } } }, @@ -1112,32 +1024,32 @@ "type": "Identifier", "name": "color", "range": [ - 398, - 403 + 1169, + 1174 ], "loc": { "start": { - "line": 15, - "column": 4 + "line": 38, + "column": 10 }, "end": { - "line": 15, - "column": 9 + "line": 38, + "column": 15 } } }, "range": [ - 396, - 403 + 1167, + 1174 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 38, + "column": 8 }, "end": { - "line": 15, - "column": 9 + "line": 38, + "column": 15 } } }, @@ -1145,47 +1057,47 @@ "type": "Identifier", "name": "RED", "range": [ - 406, - 409 + 1177, + 1180 ], "loc": { "start": { - "line": 15, - "column": 12 + "line": 38, + "column": 18 }, "end": { - "line": 15, - "column": 15 + "line": 38, + "column": 21 } } }, "range": [ - 396, - 409 + 1167, + 1180 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 38, + "column": 8 }, "end": { - "line": 15, - "column": 15 + "line": 38, + "column": 21 } } }, "range": [ - 396, - 410 + 1167, + 1182 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 38, + "column": 8 }, "end": { - "line": 15, - "column": 16 + "line": 38, + "column": 23 } } }, @@ -1197,17 +1109,17 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 413, - 425 + 1191, + 1203 ], "loc": { "start": { - "line": 16, - "column": 2 + "line": 39, + "column": 8 }, "end": { - "line": 16, - "column": 14 + "line": 39, + "column": 20 } } }, @@ -1219,17 +1131,17 @@ "type": "Identifier", "name": "n", "range": [ - 426, - 427 + 1205, + 1206 ], "loc": { "start": { - "line": 16, - "column": 15 + "line": 39, + "column": 22 }, "end": { - "line": 16, - "column": 16 + "line": 39, + "column": 23 } } }, @@ -1237,81 +1149,101 @@ "type": "Identifier", "name": "parent", "range": [ - 428, - 434 + 1207, + 1213 ], "loc": { "start": { - "line": 16, - "column": 17 + "line": 39, + "column": 24 }, "end": { - "line": 16, - "column": 23 + "line": 39, + "column": 30 } } }, "range": [ - 426, - 434 + 1205, + 1213 ], "loc": { "start": { - "line": 16, - "column": 15 + "line": 39, + "column": 22 }, "end": { - "line": 16, - "column": 23 + "line": 39, + "column": 30 } } } ], "range": [ - 413, - 435 + 1191, + 1215 ], "loc": { "start": { - "line": 16, - "column": 2 + "line": 39, + "column": 8 }, "end": { - "line": 16, - "column": 24 + "line": 39, + "column": 32 } } }, "range": [ - 413, - 436 + 1191, + 1217 ], "loc": { "start": { - "line": 16, - "column": 2 + "line": 39, + "column": 8 }, "end": { - "line": 16, - "column": 25 + "line": 39, + "column": 34 } } } ], "range": [ - 392, - 439 + 1157, + 1223 ], "loc": { "start": { - "line": 14, - "column": 32 + "line": 37, + "column": 6 }, "end": { - "line": 17, - "column": 2 + "line": 40, + "column": 5 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": " Otherwise, go to case 4.", + "range": [ + 1229, + 1256 + ], + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 42, + "column": 31 + } + } + } + ] }, "alternate": { "type": "ExpressionStatement", @@ -1321,17 +1253,17 @@ "type": "Identifier", "name": "delete_case4", "range": [ - 449, - 461 + 1266, + 1278 ], "loc": { "start": { - "line": 20, - "column": 2 + "line": 43, + "column": 9 }, "end": { - "line": 20, - "column": 14 + "line": 43, + "column": 21 } } }, @@ -1340,81 +1272,101 @@ "type": "Identifier", "name": "n", "range": [ - 462, - 463 + 1280, + 1281 ], "loc": { "start": { - "line": 20, - "column": 15 + "line": 43, + "column": 23 }, "end": { - "line": 20, - "column": 16 + "line": 43, + "column": 24 } } } ], "range": [ - 449, - 464 + 1266, + 1283 ], "loc": { "start": { - "line": 20, - "column": 2 + "line": 43, + "column": 9 }, "end": { - "line": 20, - "column": 17 + "line": 43, + "column": 26 } } }, "range": [ - 449, - 465 + 1266, + 1285 ], "loc": { "start": { - "line": 20, - "column": 2 + "line": 43, + "column": 9 }, "end": { - "line": 20, - "column": 18 + "line": 43, + "column": 28 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Otherwise, go to case 4.", + "range": [ + 1229, + 1256 + ], + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 42, + "column": 31 + } + } + } + ] }, "range": [ - 265, - 465 + 1032, + 1285 ], "loc": { "start": { - "line": 11, - "column": 1 + "line": 33, + "column": 4 }, "end": { - "line": 20, - "column": 18 + "line": 43, + "column": 28 } }, "leadingComments": [ { - "type": "Line", - "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", + "type": "Block", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n * repaint n's sibling red. Now all root-leaft paths going through n's\n * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", "range": [ - 201, - 262 + 479, + 1027 ], "loc": { "start": { - "line": 9, + "line": 20, "column": 1 }, "end": { - "line": 9, - "column": 62 + "line": 32, + "column": 4 } } } @@ -1422,16 +1374,16 @@ } ], "range": [ - 175, - 467 + 445, + 1288 ], "loc": { "start": { - "line": 7, - "column": 0 + "line": 16, + "column": 35 }, "end": { - "line": 21, + "line": 45, "column": 1 } } @@ -1439,44 +1391,83 @@ "generator": false, "expression": false, "range": [ - 150, - 467 + 417, + 1288 ], "loc": { "start": { - "line": 6, + "line": 16, "column": 7 }, "end": { - "line": 21, + "line": 45, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 143, + 409 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 143, - 467 + 410, + 1288 ], "loc": { "start": { - "line": 6, + "line": 16, "column": 0 }, "end": { - "line": 21, + "line": 45, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 143, + 409 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 467 + 1288 ], "loc": { "start": { @@ -1484,26 +1475,62 @@ "column": 0 }, "end": { - "line": 21, + "line": 45, "column": 1 } }, "comments": [ { - "type": "Line", - "value": "console.log(n.color, n.parent.color, s.color , s.isleaf());", + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 143, + 409 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n * repaint n's sibling red. Now all root-leaft paths going through n's\n * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", "range": [ - 201, - 262 + 479, + 1027 ], "loc": { "start": { - "line": 9, + "line": 20, "column": 1 }, "end": { - "line": 9, - "column": 62 + "line": 32, + "column": 4 + } + } + }, + { + "type": "Line", + "value": " Otherwise, go to case 4.", + "range": [ + 1229, + 1256 + ], + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 42, + "column": 31 } } } diff --git a/ast/source/removal/delete_case4.js.json b/ast/source/deletion/delete_case4.js.json similarity index 61% rename from ast/source/removal/delete_case4.js.json rename to ast/source/deletion/delete_case4.js.json index f153fc1..adc3062 100644 --- a/ast/source/removal/delete_case4.js.json +++ b/ast/source/deletion/delete_case4.js.json @@ -287,7 +287,27 @@ "line": 3, "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 95, + 426 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -297,16 +317,16 @@ "type": "Identifier", "name": "delete_case4", "range": [ - 111, - 123 + 443, + 455 ], "loc": { "start": { - "line": 5, + "line": 16, "column": 16 }, "end": { - "line": 5, + "line": 16, "column": 28 } } @@ -316,17 +336,17 @@ "type": "Identifier", "name": "n", "range": [ - 124, - 125 + 458, + 459 ], "loc": { "start": { - "line": 5, - "column": 29 + "line": 16, + "column": 31 }, "end": { - "line": 5, - "column": 30 + "line": 16, + "column": 32 } } } @@ -343,17 +363,17 @@ "type": "Identifier", "name": "s", "range": [ - 136, - 137 + 475, + 476 ], "loc": { "start": { - "line": 7, - "column": 7 + "line": 18, + "column": 10 }, "end": { - "line": 7, - "column": 8 + "line": 18, + "column": 11 } } }, @@ -363,17 +383,17 @@ "type": "Identifier", "name": "sibling", "range": [ - 140, - 147 + 479, + 486 ], "loc": { "start": { - "line": 7, - "column": 11 + "line": 18, + "column": 14 }, "end": { - "line": 7, - "column": 18 + "line": 18, + "column": 21 } } }, @@ -382,83 +402,83 @@ "type": "Identifier", "name": "n", "range": [ - 148, - 149 + 487, + 488 ], "loc": { "start": { - "line": 7, - "column": 19 + "line": 18, + "column": 22 }, "end": { - "line": 7, - "column": 20 + "line": 18, + "column": 23 } } } ], "range": [ - 140, - 150 + 479, + 489 ], "loc": { "start": { - "line": 7, - "column": 11 + "line": 18, + "column": 14 }, "end": { - "line": 7, - "column": 21 + "line": 18, + "column": 24 } } }, "range": [ - 136, - 150 + 475, + 489 ], "loc": { "start": { - "line": 7, - "column": 7 + "line": 18, + "column": 10 }, "end": { - "line": 7, - "column": 21 + "line": 18, + "column": 24 } } } ], "kind": "const", "range": [ - 130, - 151 + 469, + 490 ], "loc": { "start": { - "line": 7, - "column": 1 + "line": 18, + "column": 4 }, "end": { - "line": 7, - "column": 22 + "line": 18, + "column": 25 } }, "trailingComments": [ { - "type": "Line", - "value": "console.log( s ) ;", + "type": "Block", + "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", "range": [ - 153, - 173 + 493, + 1121 ], "loc": { "start": { - "line": 8, + "line": 20, "column": 1 }, "end": { - "line": 8, - "column": 21 + "line": 33, + "column": 4 } } } @@ -473,236 +493,128 @@ "type": "LogicalExpression", "operator": "&&", "left": { - "type": "LogicalExpression", - "operator": "&&", + "type": "BinaryExpression", + "operator": "===", "left": { - "type": "BinaryExpression", - "operator": "===", - "left": { + "type": "MemberExpression", + "computed": false, + "object": { "type": "MemberExpression", "computed": false, "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 181, - 182 - ], - "loc": { - "start": { - "line": 10, - "column": 6 - }, - "end": { - "line": 10, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 183, - 189 - ], - "loc": { - "start": { - "line": 10, - "column": 8 - }, - "end": { - "line": 10, - "column": 14 - } - } - }, + "type": "Identifier", + "name": "n", "range": [ - 181, - 189 + 1213, + 1214 ], "loc": { "start": { - "line": 10, - "column": 6 + "line": 36, + "column": 10 }, "end": { - "line": 10, - "column": 14 + "line": 36, + "column": 11 } } }, "property": { "type": "Identifier", - "name": "color", + "name": "parent", "range": [ - 190, - 195 + 1215, + 1221 ], "loc": { "start": { - "line": 10, - "column": 15 + "line": 36, + "column": 12 }, "end": { - "line": 10, - "column": 20 + "line": 36, + "column": 18 } } }, "range": [ - 181, - 195 + 1213, + 1221 ], "loc": { "start": { - "line": 10, - "column": 6 + "line": 36, + "column": 10 }, "end": { - "line": 10, - "column": 20 + "line": 36, + "column": 18 } } }, - "right": { + "property": { "type": "Identifier", - "name": "RED", + "name": "color", "range": [ - 200, - 203 + 1222, + 1227 ], "loc": { "start": { - "line": 10, - "column": 25 + "line": 36, + "column": 19 }, "end": { - "line": 10, - "column": 28 + "line": 36, + "column": 24 } } }, "range": [ - 181, - 203 + 1213, + 1227 ], "loc": { "start": { - "line": 10, - "column": 6 + "line": 36, + "column": 10 }, "end": { - "line": 10, - "column": 28 + "line": 36, + "column": 24 } } }, "right": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 214, - 215 - ], - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 216, - 221 - ], - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 13 - } - } - }, - "range": [ - 214, - 221 - ], - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 13 - } - } - }, - "right": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 226, - 231 - ], - "loc": { - "start": { - "line": 11, - "column": 18 - }, - "end": { - "line": 11, - "column": 23 - } - } - }, + "type": "Identifier", + "name": "RED", "range": [ - 214, - 231 + 1232, + 1235 ], "loc": { "start": { - "line": 11, - "column": 6 + "line": 36, + "column": 29 }, "end": { - "line": 11, - "column": 23 + "line": 36, + "column": 32 } } }, "range": [ - 180, - 232 + 1213, + 1235 ], "loc": { "start": { - "line": 10, - "column": 5 + "line": 36, + "column": 10 }, "end": { - "line": 11, - "column": 24 + "line": 36, + "column": 32 } } }, @@ -719,17 +631,17 @@ "type": "Identifier", "name": "s", "range": [ - 242, - 243 + 1251, + 1252 ], "loc": { "start": { - "line": 12, - "column": 6 + "line": 37, + "column": 10 }, "end": { - "line": 12, - "column": 7 + "line": 37, + "column": 11 } } }, @@ -737,32 +649,32 @@ "type": "Identifier", "name": "left", "range": [ - 244, - 248 + 1253, + 1257 ], "loc": { "start": { - "line": 12, - "column": 8 + "line": 37, + "column": 12 }, "end": { - "line": 12, - "column": 12 + "line": 37, + "column": 16 } } }, "range": [ - 242, - 248 + 1251, + 1257 ], "loc": { "start": { - "line": 12, - "column": 6 + "line": 37, + "column": 10 }, "end": { - "line": 12, - "column": 12 + "line": 37, + "column": 16 } } }, @@ -770,32 +682,32 @@ "type": "Identifier", "name": "color", "range": [ - 249, - 254 + 1258, + 1263 ], "loc": { "start": { - "line": 12, - "column": 13 + "line": 37, + "column": 17 }, "end": { - "line": 12, - "column": 18 + "line": 37, + "column": 22 } } }, "range": [ - 242, - 254 + 1251, + 1263 ], "loc": { "start": { - "line": 12, - "column": 6 + "line": 37, + "column": 10 }, "end": { - "line": 12, - "column": 18 + "line": 37, + "column": 22 } } }, @@ -803,47 +715,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 259, - 264 + 1268, + 1273 ], "loc": { "start": { - "line": 12, - "column": 23 + "line": 37, + "column": 27 }, "end": { - "line": 12, - "column": 28 + "line": 37, + "column": 32 } } }, "range": [ - 242, - 264 + 1251, + 1273 ], "loc": { "start": { - "line": 12, - "column": 6 + "line": 37, + "column": 10 }, "end": { - "line": 12, - "column": 28 + "line": 37, + "column": 32 } } }, "range": [ - 180, - 265 + 1211, + 1275 ], "loc": { "start": { - "line": 10, - "column": 5 + "line": 36, + "column": 8 }, "end": { - "line": 12, - "column": 29 + "line": 37, + "column": 34 } } }, @@ -860,17 +772,17 @@ "type": "Identifier", "name": "s", "range": [ - 275, - 276 + 1289, + 1290 ], "loc": { "start": { - "line": 13, - "column": 6 + "line": 38, + "column": 10 }, "end": { - "line": 13, - "column": 7 + "line": 38, + "column": 11 } } }, @@ -878,32 +790,32 @@ "type": "Identifier", "name": "right", "range": [ - 277, - 282 + 1291, + 1296 ], "loc": { "start": { - "line": 13, - "column": 8 + "line": 38, + "column": 12 }, "end": { - "line": 13, - "column": 13 + "line": 38, + "column": 17 } } }, "range": [ - 275, - 282 + 1289, + 1296 ], "loc": { "start": { - "line": 13, - "column": 6 + "line": 38, + "column": 10 }, "end": { - "line": 13, - "column": 13 + "line": 38, + "column": 17 } } }, @@ -911,32 +823,32 @@ "type": "Identifier", "name": "color", "range": [ - 283, - 288 + 1297, + 1302 ], "loc": { "start": { - "line": 13, - "column": 14 + "line": 38, + "column": 18 }, "end": { - "line": 13, - "column": 19 + "line": 38, + "column": 23 } } }, "range": [ - 275, - 288 + 1289, + 1302 ], "loc": { "start": { - "line": 13, - "column": 6 + "line": 38, + "column": 10 }, "end": { - "line": 13, - "column": 19 + "line": 38, + "column": 23 } } }, @@ -944,49 +856,69 @@ "type": "Identifier", "name": "BLACK", "range": [ - 293, - 298 + 1307, + 1312 ], "loc": { "start": { - "line": 13, - "column": 24 + "line": 38, + "column": 28 }, "end": { - "line": 13, - "column": 29 + "line": 38, + "column": 33 } } }, "range": [ - 275, - 298 + 1289, + 1312 ], "loc": { "start": { - "line": 13, - "column": 6 + "line": 38, + "column": 10 }, "end": { - "line": 13, - "column": 29 + "line": 38, + "column": 33 } } }, "range": [ - 180, - 299 + 1211, + 1314 ], "loc": { "start": { - "line": 10, - "column": 5 + "line": 36, + "column": 8 }, "end": { - "line": 13, - "column": 30 + "line": 38, + "column": 35 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " the parent color test is always true when coming from case 2", + "range": [ + 1139, + 1202 + ], + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 71 + } + } + } + ] }, "consequent": { "type": "BlockStatement", @@ -1003,17 +935,17 @@ "type": "Identifier", "name": "s", "range": [ - 305, - 306 + 1331, + 1332 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 40, + "column": 8 }, "end": { - "line": 14, - "column": 3 + "line": 40, + "column": 9 } } }, @@ -1021,32 +953,32 @@ "type": "Identifier", "name": "color", "range": [ - 307, - 312 + 1333, + 1338 ], "loc": { "start": { - "line": 14, - "column": 4 + "line": 40, + "column": 10 }, "end": { - "line": 14, - "column": 9 + "line": 40, + "column": 15 } } }, "range": [ - 305, - 312 + 1331, + 1338 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 40, + "column": 8 }, "end": { - "line": 14, - "column": 9 + "line": 40, + "column": 15 } } }, @@ -1054,47 +986,47 @@ "type": "Identifier", "name": "RED", "range": [ - 315, - 318 + 1341, + 1344 ], "loc": { "start": { - "line": 14, - "column": 12 + "line": 40, + "column": 18 }, "end": { - "line": 14, - "column": 15 + "line": 40, + "column": 21 } } }, "range": [ - 305, - 318 + 1331, + 1344 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 40, + "column": 8 }, "end": { - "line": 14, - "column": 15 + "line": 40, + "column": 21 } } }, "range": [ - 305, - 319 + 1331, + 1345 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 40, + "column": 8 }, "end": { - "line": 14, - "column": 16 + "line": 40, + "column": 22 } } }, @@ -1113,17 +1045,17 @@ "type": "Identifier", "name": "n", "range": [ - 322, - 323 + 1354, + 1355 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 15, - "column": 3 + "line": 41, + "column": 9 } } }, @@ -1131,32 +1063,32 @@ "type": "Identifier", "name": "parent", "range": [ - 324, - 330 + 1356, + 1362 ], "loc": { "start": { - "line": 15, - "column": 4 + "line": 41, + "column": 10 }, "end": { - "line": 15, - "column": 10 + "line": 41, + "column": 16 } } }, "range": [ - 322, - 330 + 1354, + 1362 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 15, - "column": 10 + "line": 41, + "column": 16 } } }, @@ -1164,32 +1096,32 @@ "type": "Identifier", "name": "color", "range": [ - 331, - 336 + 1363, + 1368 ], "loc": { "start": { - "line": 15, - "column": 11 + "line": 41, + "column": 17 }, "end": { - "line": 15, - "column": 16 + "line": 41, + "column": 22 } } }, "range": [ - 322, - 336 + 1354, + 1368 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 15, - "column": 16 + "line": 41, + "column": 22 } } }, @@ -1197,65 +1129,85 @@ "type": "Identifier", "name": "BLACK", "range": [ - 339, - 344 + 1371, + 1376 ], "loc": { "start": { - "line": 15, - "column": 19 + "line": 41, + "column": 25 }, "end": { - "line": 15, - "column": 24 + "line": 41, + "column": 30 } } }, "range": [ - 322, - 344 + 1354, + 1376 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 15, - "column": 24 + "line": 41, + "column": 30 } } }, "range": [ - 322, - 345 + 1354, + 1377 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 15, - "column": 25 + "line": 41, + "column": 31 } } } ], "range": [ - 301, - 348 + 1321, + 1383 ], "loc": { "start": { - "line": 13, - "column": 32 + "line": 39, + "column": 6 }, "end": { - "line": 16, - "column": 2 + "line": 42, + "column": 5 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": " Otherwise, go to case 5.", + "range": [ + 1389, + 1416 + ], + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 31 + } + } + } + ] }, "alternate": { "type": "ExpressionStatement", @@ -1265,17 +1217,17 @@ "type": "Identifier", "name": "delete_case5", "range": [ - 356, - 368 + 1426, + 1438 ], "loc": { "start": { - "line": 17, - "column": 2 + "line": 45, + "column": 9 }, "end": { - "line": 17, - "column": 14 + "line": 45, + "column": 21 } } }, @@ -1284,81 +1236,101 @@ "type": "Identifier", "name": "n", "range": [ - 369, - 370 + 1440, + 1441 ], "loc": { "start": { - "line": 17, - "column": 15 + "line": 45, + "column": 23 }, "end": { - "line": 17, - "column": 16 + "line": 45, + "column": 24 } } } ], "range": [ - 356, - 371 + 1426, + 1443 ], "loc": { "start": { - "line": 17, - "column": 2 + "line": 45, + "column": 9 }, "end": { - "line": 17, - "column": 17 + "line": 45, + "column": 26 } } }, "range": [ - 356, - 372 + 1426, + 1445 ], "loc": { "start": { - "line": 17, - "column": 2 + "line": 45, + "column": 9 }, "end": { - "line": 17, - "column": 18 + "line": 45, + "column": 28 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Otherwise, go to case 5.", + "range": [ + 1389, + 1416 + ], + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 31 + } + } + } + ] }, "range": [ - 176, - 372 + 1126, + 1445 ], "loc": { "start": { - "line": 10, - "column": 1 + "line": 34, + "column": 4 }, "end": { - "line": 17, - "column": 18 + "line": 45, + "column": 28 } }, "leadingComments": [ { - "type": "Line", - "value": "console.log( s ) ;", + "type": "Block", + "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", "range": [ - 153, - 173 + 493, + 1121 ], "loc": { "start": { - "line": 8, + "line": 20, "column": 1 }, "end": { - "line": 8, - "column": 21 + "line": 33, + "column": 4 } } } @@ -1366,16 +1338,16 @@ } ], "range": [ - 127, - 374 + 462, + 1448 ], "loc": { "start": { - "line": 6, - "column": 0 + "line": 16, + "column": 35 }, "end": { - "line": 18, + "line": 47, "column": 1 } } @@ -1383,44 +1355,83 @@ "generator": false, "expression": false, "range": [ - 102, - 374 + 434, + 1448 ], "loc": { "start": { - "line": 5, + "line": 16, "column": 7 }, "end": { - "line": 18, + "line": 47, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 95, + 426 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 95, - 374 + 427, + 1448 ], "loc": { "start": { - "line": 5, + "line": 16, "column": 0 }, "end": { - "line": 18, + "line": 47, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 95, + 426 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 374 + 1448 ], "loc": { "start": { @@ -1428,26 +1439,80 @@ "column": 0 }, "end": { - "line": 18, + "line": 47, "column": 1 } }, "comments": [ { - "type": "Line", - "value": "console.log( s ) ;", + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", "range": [ - 153, - 173 + 95, + 426 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "range": [ + 493, + 1121 ], "loc": { "start": { - "line": 8, + "line": 20, "column": 1 }, "end": { - "line": 8, - "column": 21 + "line": 33, + "column": 4 + } + } + }, + { + "type": "Line", + "value": " the parent color test is always true when coming from case 2", + "range": [ + 1139, + 1202 + ], + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 71 + } + } + }, + { + "type": "Line", + "value": " Otherwise, go to case 5.", + "range": [ + 1389, + 1416 + ], + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 31 } } } diff --git a/ast/source/deletion/delete_case5.js.json b/ast/source/deletion/delete_case5.js.json new file mode 100644 index 0000000..0dc0a5d --- /dev/null +++ b/ast/source/deletion/delete_case5.js.json @@ -0,0 +1,2307 @@ +{ + "type": "Program", + "body": [ + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "imported": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + "range": [ + 9, + 14 + ], + "loc": { + "start": { + "line": 1, + "column": 9 + }, + "end": { + "line": 1, + "column": 14 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "RED", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "imported": { + "type": "Identifier", + "name": "RED", + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + "range": [ + 17, + 20 + ], + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 20 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "sibling", + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "imported": { + "type": "Identifier", + "name": "sibling", + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + "range": [ + 23, + 30 + ], + "loc": { + "start": { + "line": 1, + "column": 23 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 33, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 33, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + "range": [ + 33, + 45 + ], + "loc": { + "start": { + "line": 1, + "column": 33 + }, + "end": { + "line": 1, + "column": 45 + } + } + }, + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 48, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 59 + } + } + }, + "imported": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 48, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 59 + } + } + }, + "range": [ + 48, + 59 + ], + "loc": { + "start": { + "line": 1, + "column": 48 + }, + "end": { + "line": 1, + "column": 59 + } + } + } + ], + "source": { + "type": "Literal", + "value": "..", + "raw": "'..'", + "range": [ + 67, + 71 + ], + "loc": { + "start": { + "line": 1, + "column": 67 + }, + "end": { + "line": 1, + "column": 71 + } + } + }, + "range": [ + 0, + 73 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 73 + } + } + }, + { + "type": "ImportDeclaration", + "specifiers": [ + { + "type": "ImportSpecifier", + "local": { + "type": "Identifier", + "name": "delete_case6", + "range": [ + 84, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "imported": { + "type": "Identifier", + "name": "delete_case6", + "range": [ + 84, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + }, + "range": [ + 84, + 96 + ], + "loc": { + "start": { + "line": 3, + "column": 9 + }, + "end": { + "line": 3, + "column": 21 + } + } + } + ], + "source": { + "type": "Literal", + "value": "./delete_case6", + "raw": "'./delete_case6'", + "range": [ + 104, + 120 + ], + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 45 + } + } + }, + "range": [ + 75, + 122 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 47 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 124, + 443 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ] + }, + { + "type": "ExportNamedDeclaration", + "declaration": { + "type": "FunctionDeclaration", + "id": { + "type": "Identifier", + "name": "delete_case5", + "range": [ + 460, + 472 + ], + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + "params": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 475, + 476 + ], + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 32 + } + } + } + ], + "body": { + "type": "BlockStatement", + "body": [ + { + "type": "VariableDeclaration", + "declarations": [ + { + "type": "VariableDeclarator", + "id": { + "type": "Identifier", + "name": "s", + "range": [ + 492, + 493 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + "init": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "sibling", + "range": [ + 496, + 503 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 505, + 506 + ], + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + } + } + } + ], + "range": [ + 496, + 508 + ], + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + "range": [ + 492, + 508 + ], + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 26 + } + } + } + ], + "kind": "const", + "range": [ + 486, + 510 + ], + "loc": { + "start": { + "line": 18, + "column": 4 + }, + "end": { + "line": 18, + "column": 28 + } + }, + "trailingComments": [ + { + "type": "Line", + "value": " The following statements just force the red n's sibling child to be on", + "range": [ + 516, + 589 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 77 + } + } + }, + { + "type": "Line", + "value": " the left of the left of the parent, or right of the right, so case 6", + "range": [ + 594, + 665 + ], + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 75 + } + } + }, + { + "type": "Line", + "value": " will rotate correctly.", + "range": [ + 670, + 695 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 29 + } + } + }, + { + "type": "Block", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", + "range": [ + 698, + 1130 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 34, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 1142, + 1143 + ], + "loc": { + "start": { + "line": 35, + "column": 11 + }, + "end": { + "line": 35, + "column": 12 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 1148, + 1149 + ], + "loc": { + "start": { + "line": 35, + "column": 17 + }, + "end": { + "line": 35, + "column": 18 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 1150, + 1156 + ], + "loc": { + "start": { + "line": 35, + "column": 19 + }, + "end": { + "line": 35, + "column": 25 + } + } + }, + "range": [ + 1148, + 1156 + ], + "loc": { + "start": { + "line": 35, + "column": 17 + }, + "end": { + "line": 35, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 1157, + 1161 + ], + "loc": { + "start": { + "line": 35, + "column": 26 + }, + "end": { + "line": 35, + "column": 30 + } + } + }, + "range": [ + 1148, + 1161 + ], + "loc": { + "start": { + "line": 35, + "column": 17 + }, + "end": { + "line": 35, + "column": 30 + } + } + }, + "range": [ + 1142, + 1161 + ], + "loc": { + "start": { + "line": 35, + "column": 11 + }, + "end": { + "line": 35, + "column": 30 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 1169, + 1170 + ], + "loc": { + "start": { + "line": 35, + "column": 38 + }, + "end": { + "line": 35, + "column": 39 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 1171, + 1176 + ], + "loc": { + "start": { + "line": 35, + "column": 40 + }, + "end": { + "line": 35, + "column": 45 + } + } + }, + "range": [ + 1169, + 1176 + ], + "loc": { + "start": { + "line": 35, + "column": 38 + }, + "end": { + "line": 35, + "column": 45 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 1177, + 1182 + ], + "loc": { + "start": { + "line": 35, + "column": 46 + }, + "end": { + "line": 35, + "column": 51 + } + } + }, + "range": [ + 1169, + 1182 + ], + "loc": { + "start": { + "line": 35, + "column": 38 + }, + "end": { + "line": 35, + "column": 51 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 1187, + 1192 + ], + "loc": { + "start": { + "line": 35, + "column": 56 + }, + "end": { + "line": 35, + "column": 61 + } + } + }, + "range": [ + 1169, + 1192 + ], + "loc": { + "start": { + "line": 35, + "column": 38 + }, + "end": { + "line": 35, + "column": 61 + } + } + }, + "range": [ + 1140, + 1194 + ], + "loc": { + "start": { + "line": 35, + "column": 9 + }, + "end": { + "line": 35, + "column": 63 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 1207, + 1208 + ], + "loc": { + "start": { + "line": 36, + "column": 8 + }, + "end": { + "line": 36, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 1209, + 1214 + ], + "loc": { + "start": { + "line": 36, + "column": 10 + }, + "end": { + "line": 36, + "column": 15 + } + } + }, + "range": [ + 1207, + 1214 + ], + "loc": { + "start": { + "line": 36, + "column": 8 + }, + "end": { + "line": 36, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 1217, + 1220 + ], + "loc": { + "start": { + "line": 36, + "column": 18 + }, + "end": { + "line": 36, + "column": 21 + } + } + }, + "range": [ + 1207, + 1220 + ], + "loc": { + "start": { + "line": 36, + "column": 8 + }, + "end": { + "line": 36, + "column": 21 + } + } + }, + "range": [ + 1207, + 1222 + ], + "loc": { + "start": { + "line": 36, + "column": 8 + }, + "end": { + "line": 36, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 1231, + 1232 + ], + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 1233, + 1237 + ], + "loc": { + "start": { + "line": 37, + "column": 10 + }, + "end": { + "line": 37, + "column": 14 + } + } + }, + "range": [ + 1231, + 1237 + ], + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 14 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 1238, + 1243 + ], + "loc": { + "start": { + "line": 37, + "column": 15 + }, + "end": { + "line": 37, + "column": 20 + } + } + }, + "range": [ + 1231, + 1243 + ], + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 20 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 1246, + 1251 + ], + "loc": { + "start": { + "line": 37, + "column": 23 + }, + "end": { + "line": 37, + "column": 28 + } + } + }, + "range": [ + 1231, + 1251 + ], + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 28 + } + } + }, + "range": [ + 1231, + 1253 + ], + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 30 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_right", + "range": [ + 1262, + 1274 + ], + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 20 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "s", + "range": [ + 1276, + 1277 + ], + "loc": { + "start": { + "line": 38, + "column": 22 + }, + "end": { + "line": 38, + "column": 23 + } + } + } + ], + "range": [ + 1262, + 1279 + ], + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 25 + } + } + }, + "range": [ + 1262, + 1281 + ], + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 27 + } + } + } + ], + "range": [ + 1197, + 1287 + ], + "loc": { + "start": { + "line": 35, + "column": 66 + }, + "end": { + "line": 39, + "column": 5 + } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * B >B B >B\n\t * / \\ / \\ --> / \\ / \\\n\t * B R - - R = - -\n\t * / \\ / \\ / \\\n\t * - - = = B =\n\t * / \\\n\t * - -\n\t ", + "range": [ + 1290, + 1653 + ], + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 51, + "column": 4 + } + } + } + ] + }, + "alternate": { + "type": "IfStatement", + "test": { + "type": "LogicalExpression", + "operator": "&&", + "left": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "Identifier", + "name": "n", + "range": [ + 1670, + 1671 + ], + "loc": { + "start": { + "line": 52, + "column": 16 + }, + "end": { + "line": 52, + "column": 17 + } + } + }, + "right": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "n", + "range": [ + 1676, + 1677 + ], + "loc": { + "start": { + "line": 52, + "column": 22 + }, + "end": { + "line": 52, + "column": 23 + } + } + }, + "property": { + "type": "Identifier", + "name": "parent", + "range": [ + 1678, + 1684 + ], + "loc": { + "start": { + "line": 52, + "column": 24 + }, + "end": { + "line": 52, + "column": 30 + } + } + }, + "range": [ + 1676, + 1684 + ], + "loc": { + "start": { + "line": 52, + "column": 22 + }, + "end": { + "line": 52, + "column": 30 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 1685, + 1690 + ], + "loc": { + "start": { + "line": 52, + "column": 31 + }, + "end": { + "line": 52, + "column": 36 + } + } + }, + "range": [ + 1676, + 1690 + ], + "loc": { + "start": { + "line": 52, + "column": 22 + }, + "end": { + "line": 52, + "column": 36 + } + } + }, + "range": [ + 1670, + 1690 + ], + "loc": { + "start": { + "line": 52, + "column": 16 + }, + "end": { + "line": 52, + "column": 36 + } + } + }, + "right": { + "type": "BinaryExpression", + "operator": "===", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 1698, + 1699 + ], + "loc": { + "start": { + "line": 52, + "column": 44 + }, + "end": { + "line": 52, + "column": 45 + } + } + }, + "property": { + "type": "Identifier", + "name": "left", + "range": [ + 1700, + 1704 + ], + "loc": { + "start": { + "line": 52, + "column": 46 + }, + "end": { + "line": 52, + "column": 50 + } + } + }, + "range": [ + 1698, + 1704 + ], + "loc": { + "start": { + "line": 52, + "column": 44 + }, + "end": { + "line": 52, + "column": 50 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 1705, + 1710 + ], + "loc": { + "start": { + "line": 52, + "column": 51 + }, + "end": { + "line": 52, + "column": 56 + } + } + }, + "range": [ + 1698, + 1710 + ], + "loc": { + "start": { + "line": 52, + "column": 44 + }, + "end": { + "line": 52, + "column": 56 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 1715, + 1720 + ], + "loc": { + "start": { + "line": 52, + "column": 61 + }, + "end": { + "line": 52, + "column": 66 + } + } + }, + "range": [ + 1698, + 1720 + ], + "loc": { + "start": { + "line": 52, + "column": 44 + }, + "end": { + "line": 52, + "column": 66 + } + } + }, + "range": [ + 1668, + 1722 + ], + "loc": { + "start": { + "line": 52, + "column": 14 + }, + "end": { + "line": 52, + "column": 68 + } + } + }, + "consequent": { + "type": "BlockStatement", + "body": [ + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 1735, + 1736 + ], + "loc": { + "start": { + "line": 53, + "column": 8 + }, + "end": { + "line": 53, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 1737, + 1742 + ], + "loc": { + "start": { + "line": 53, + "column": 10 + }, + "end": { + "line": 53, + "column": 15 + } + } + }, + "range": [ + 1735, + 1742 + ], + "loc": { + "start": { + "line": 53, + "column": 8 + }, + "end": { + "line": 53, + "column": 15 + } + } + }, + "right": { + "type": "Identifier", + "name": "RED", + "range": [ + 1745, + 1748 + ], + "loc": { + "start": { + "line": 53, + "column": 18 + }, + "end": { + "line": 53, + "column": 21 + } + } + }, + "range": [ + 1735, + 1748 + ], + "loc": { + "start": { + "line": 53, + "column": 8 + }, + "end": { + "line": 53, + "column": 21 + } + } + }, + "range": [ + 1735, + 1750 + ], + "loc": { + "start": { + "line": 53, + "column": 8 + }, + "end": { + "line": 53, + "column": 23 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "AssignmentExpression", + "operator": "=", + "left": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "MemberExpression", + "computed": false, + "object": { + "type": "Identifier", + "name": "s", + "range": [ + 1759, + 1760 + ], + "loc": { + "start": { + "line": 54, + "column": 8 + }, + "end": { + "line": 54, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "name": "right", + "range": [ + 1761, + 1766 + ], + "loc": { + "start": { + "line": 54, + "column": 10 + }, + "end": { + "line": 54, + "column": 15 + } + } + }, + "range": [ + 1759, + 1766 + ], + "loc": { + "start": { + "line": 54, + "column": 8 + }, + "end": { + "line": 54, + "column": 15 + } + } + }, + "property": { + "type": "Identifier", + "name": "color", + "range": [ + 1767, + 1772 + ], + "loc": { + "start": { + "line": 54, + "column": 16 + }, + "end": { + "line": 54, + "column": 21 + } + } + }, + "range": [ + 1759, + 1772 + ], + "loc": { + "start": { + "line": 54, + "column": 8 + }, + "end": { + "line": 54, + "column": 21 + } + } + }, + "right": { + "type": "Identifier", + "name": "BLACK", + "range": [ + 1775, + 1780 + ], + "loc": { + "start": { + "line": 54, + "column": 24 + }, + "end": { + "line": 54, + "column": 29 + } + } + }, + "range": [ + 1759, + 1780 + ], + "loc": { + "start": { + "line": 54, + "column": 8 + }, + "end": { + "line": 54, + "column": 29 + } + } + }, + "range": [ + 1759, + 1782 + ], + "loc": { + "start": { + "line": 54, + "column": 8 + }, + "end": { + "line": 54, + "column": 31 + } + } + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "rotate_left", + "range": [ + 1791, + 1802 + ], + "loc": { + "start": { + "line": 55, + "column": 8 + }, + "end": { + "line": 55, + "column": 19 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "s", + "range": [ + 1804, + 1805 + ], + "loc": { + "start": { + "line": 55, + "column": 21 + }, + "end": { + "line": 55, + "column": 22 + } + } + } + ], + "range": [ + 1791, + 1807 + ], + "loc": { + "start": { + "line": 55, + "column": 8 + }, + "end": { + "line": 55, + "column": 24 + } + } + }, + "range": [ + 1791, + 1809 + ], + "loc": { + "start": { + "line": 55, + "column": 8 + }, + "end": { + "line": 55, + "column": 26 + } + } + } + ], + "range": [ + 1725, + 1815 + ], + "loc": { + "start": { + "line": 52, + "column": 71 + }, + "end": { + "line": 56, + "column": 5 + } + } + }, + "alternate": null, + "range": [ + 1663, + 1815 + ], + "loc": { + "start": { + "line": 52, + "column": 9 + }, + "end": { + "line": 56, + "column": 5 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * B >B B >B\n\t * / \\ / \\ --> / \\ / \\\n\t * B R - - R = - -\n\t * / \\ / \\ / \\\n\t * - - = = B =\n\t * / \\\n\t * - -\n\t ", + "range": [ + 1290, + 1653 + ], + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 51, + "column": 4 + } + } + } + ] + }, + "range": [ + 1135, + 1815 + ], + "loc": { + "start": { + "line": 35, + "column": 4 + }, + "end": { + "line": 56, + "column": 5 + } + }, + "leadingComments": [ + { + "type": "Line", + "value": " The following statements just force the red n's sibling child to be on", + "range": [ + 516, + 589 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 77 + } + } + }, + { + "type": "Line", + "value": " the left of the left of the parent, or right of the right, so case 6", + "range": [ + 594, + 665 + ], + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 75 + } + } + }, + { + "type": "Line", + "value": " will rotate correctly.", + "range": [ + 670, + 695 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 29 + } + } + }, + { + "type": "Block", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", + "range": [ + 698, + 1130 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 34, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "delete_case6", + "range": [ + 1821, + 1833 + ], + "loc": { + "start": { + "line": 58, + "column": 4 + }, + "end": { + "line": 58, + "column": 16 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", + "range": [ + 1835, + 1836 + ], + "loc": { + "start": { + "line": 58, + "column": 18 + }, + "end": { + "line": 58, + "column": 19 + } + } + } + ], + "range": [ + 1821, + 1838 + ], + "loc": { + "start": { + "line": 58, + "column": 4 + }, + "end": { + "line": 58, + "column": 21 + } + } + }, + "range": [ + 1821, + 1840 + ], + "loc": { + "start": { + "line": 58, + "column": 4 + }, + "end": { + "line": 58, + "column": 23 + } + } + } + ], + "range": [ + 479, + 1843 + ], + "loc": { + "start": { + "line": 16, + "column": 35 + }, + "end": { + "line": 60, + "column": 1 + } + } + }, + "generator": false, + "expression": false, + "range": [ + 451, + 1843 + ], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 60, + "column": 1 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 124, + 443 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ], + "trailingComments": [] + }, + "specifiers": [], + "source": null, + "range": [ + 444, + 1843 + ], + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 60, + "column": 1 + } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 124, + 443 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ] + } + ], + "sourceType": "module", + "range": [ + 0, + 1843 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 60, + "column": 1 + } + }, + "comments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 124, + 443 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": "Line", + "value": " The following statements just force the red n's sibling child to be on", + "range": [ + 516, + 589 + ], + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 77 + } + } + }, + { + "type": "Line", + "value": " the left of the left of the parent, or right of the right, so case 6", + "range": [ + 594, + 665 + ], + "loc": { + "start": { + "line": 21, + "column": 4 + }, + "end": { + "line": 21, + "column": 75 + } + } + }, + { + "type": "Line", + "value": " will rotate correctly.", + "range": [ + 670, + 695 + ], + "loc": { + "start": { + "line": 22, + "column": 4 + }, + "end": { + "line": 22, + "column": 29 + } + } + }, + { + "type": "Block", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", + "range": [ + 698, + 1130 + ], + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 34, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * B >B B >B\n\t * / \\ / \\ --> / \\ / \\\n\t * B R - - R = - -\n\t * / \\ / \\ / \\\n\t * - - = = B =\n\t * / \\\n\t * - -\n\t ", + "range": [ + 1290, + 1653 + ], + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 51, + "column": 4 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/removal/delete_case6.js.json b/ast/source/deletion/delete_case6.js.json similarity index 61% rename from ast/source/removal/delete_case6.js.json rename to ast/source/deletion/delete_case6.js.json index 3813ca5..b73fc4b 100644 --- a/ast/source/removal/delete_case6.js.json +++ b/ast/source/deletion/delete_case6.js.json @@ -302,7 +302,27 @@ "line": 1, "column": 73 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 75, + 475 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -312,16 +332,16 @@ "type": "Identifier", "name": "delete_case6", "range": [ - 91, - 103 + 492, + 504 ], "loc": { "start": { - "line": 3, + "line": 15, "column": 16 }, "end": { - "line": 3, + "line": 15, "column": 28 } } @@ -331,17 +351,17 @@ "type": "Identifier", "name": "n", "range": [ - 104, - 105 + 507, + 508 ], "loc": { "start": { - "line": 3, - "column": 29 + "line": 15, + "column": 31 }, "end": { - "line": 3, - "column": 30 + "line": 15, + "column": 32 } } } @@ -358,17 +378,17 @@ "type": "Identifier", "name": "s", "range": [ - 116, - 117 + 524, + 525 ], "loc": { "start": { - "line": 5, - "column": 7 + "line": 17, + "column": 10 }, "end": { - "line": 5, - "column": 8 + "line": 17, + "column": 11 } } }, @@ -378,17 +398,17 @@ "type": "Identifier", "name": "sibling", "range": [ - 120, - 127 + 528, + 535 ], "loc": { "start": { - "line": 5, - "column": 11 + "line": 17, + "column": 14 }, "end": { - "line": 5, - "column": 18 + "line": 17, + "column": 21 } } }, @@ -397,67 +417,87 @@ "type": "Identifier", "name": "n", "range": [ - 128, - 129 + 537, + 538 ], "loc": { "start": { - "line": 5, - "column": 19 + "line": 17, + "column": 23 }, "end": { - "line": 5, - "column": 20 + "line": 17, + "column": 24 } } } ], "range": [ - 120, - 130 + 528, + 540 ], "loc": { "start": { - "line": 5, - "column": 11 + "line": 17, + "column": 14 }, "end": { - "line": 5, - "column": 21 + "line": 17, + "column": 26 } } }, "range": [ - 116, - 130 + 524, + 540 ], "loc": { "start": { - "line": 5, - "column": 7 + "line": 17, + "column": 10 }, "end": { - "line": 5, - "column": 21 + "line": 17, + "column": 26 } } } ], "kind": "const", "range": [ - 110, - 131 + 518, + 542 ], "loc": { "start": { - "line": 5, - "column": 1 + "line": 17, + "column": 4 }, "end": { - "line": 5, - "column": 22 + "line": 17, + "column": 28 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n * We can repaint n's sibling's right child in black to fix this.\n * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "range": [ + 545, + 1238 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 35, + "column": 4 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -471,17 +511,17 @@ "type": "Identifier", "name": "s", "range": [ - 134, - 135 + 1244, + 1245 ], "loc": { "start": { - "line": 7, - "column": 1 + "line": 37, + "column": 4 }, "end": { - "line": 7, - "column": 2 + "line": 37, + "column": 5 } } }, @@ -489,32 +529,32 @@ "type": "Identifier", "name": "color", "range": [ - 136, - 141 + 1246, + 1251 ], "loc": { "start": { - "line": 7, - "column": 3 + "line": 37, + "column": 6 }, "end": { - "line": 7, - "column": 8 + "line": 37, + "column": 11 } } }, "range": [ - 134, - 141 + 1244, + 1251 ], "loc": { "start": { - "line": 7, - "column": 1 + "line": 37, + "column": 4 }, "end": { - "line": 7, - "column": 8 + "line": 37, + "column": 11 } } }, @@ -528,17 +568,17 @@ "type": "Identifier", "name": "n", "range": [ - 144, - 145 + 1254, + 1255 ], "loc": { "start": { - "line": 7, - "column": 11 + "line": 37, + "column": 14 }, "end": { - "line": 7, - "column": 12 + "line": 37, + "column": 15 } } }, @@ -546,32 +586,32 @@ "type": "Identifier", "name": "parent", "range": [ - 146, - 152 + 1256, + 1262 ], "loc": { "start": { - "line": 7, - "column": 13 + "line": 37, + "column": 16 }, "end": { - "line": 7, - "column": 19 + "line": 37, + "column": 22 } } }, "range": [ - 144, - 152 + 1254, + 1262 ], "loc": { "start": { - "line": 7, - "column": 11 + "line": 37, + "column": 14 }, "end": { - "line": 7, - "column": 19 + "line": 37, + "column": 22 } } }, @@ -579,64 +619,84 @@ "type": "Identifier", "name": "color", "range": [ - 153, - 158 + 1263, + 1268 ], "loc": { "start": { - "line": 7, - "column": 20 + "line": 37, + "column": 23 }, "end": { - "line": 7, - "column": 25 + "line": 37, + "column": 28 } } }, "range": [ - 144, - 158 + 1254, + 1268 ], "loc": { "start": { - "line": 7, - "column": 11 + "line": 37, + "column": 14 }, "end": { - "line": 7, - "column": 25 + "line": 37, + "column": 28 } } }, "range": [ - 134, - 158 + 1244, + 1268 ], "loc": { "start": { - "line": 7, - "column": 1 + "line": 37, + "column": 4 }, "end": { - "line": 7, - "column": 25 + "line": 37, + "column": 28 } } }, "range": [ - 134, - 159 + 1244, + 1270 ], "loc": { "start": { - "line": 7, - "column": 1 + "line": 37, + "column": 4 }, "end": { - "line": 7, - "column": 26 + "line": 37, + "column": 30 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n * We can repaint n's sibling's right child in black to fix this.\n * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "range": [ + 545, + 1238 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 35, + "column": 4 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -653,17 +713,17 @@ "type": "Identifier", "name": "n", "range": [ - 161, - 162 + 1275, + 1276 ], "loc": { "start": { - "line": 8, - "column": 1 + "line": 38, + "column": 4 }, "end": { - "line": 8, - "column": 2 + "line": 38, + "column": 5 } } }, @@ -671,32 +731,32 @@ "type": "Identifier", "name": "parent", "range": [ - 163, - 169 + 1277, + 1283 ], "loc": { "start": { - "line": 8, - "column": 3 + "line": 38, + "column": 6 }, "end": { - "line": 8, - "column": 9 + "line": 38, + "column": 12 } } }, "range": [ - 161, - 169 + 1275, + 1283 ], "loc": { "start": { - "line": 8, - "column": 1 + "line": 38, + "column": 4 }, "end": { - "line": 8, - "column": 9 + "line": 38, + "column": 12 } } }, @@ -704,32 +764,32 @@ "type": "Identifier", "name": "color", "range": [ - 170, - 175 + 1284, + 1289 ], "loc": { "start": { - "line": 8, - "column": 10 + "line": 38, + "column": 13 }, "end": { - "line": 8, - "column": 15 + "line": 38, + "column": 18 } } }, "range": [ - 161, - 175 + 1275, + 1289 ], "loc": { "start": { - "line": 8, - "column": 1 + "line": 38, + "column": 4 }, "end": { - "line": 8, - "column": 15 + "line": 38, + "column": 18 } } }, @@ -737,47 +797,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 178, - 183 + 1292, + 1297 ], "loc": { "start": { - "line": 8, - "column": 18 + "line": 38, + "column": 21 }, "end": { - "line": 8, - "column": 23 + "line": 38, + "column": 26 } } }, "range": [ - 161, - 183 + 1275, + 1297 ], "loc": { "start": { - "line": 8, - "column": 1 + "line": 38, + "column": 4 }, "end": { - "line": 8, - "column": 23 + "line": 38, + "column": 26 } } }, "range": [ - 161, - 184 + 1275, + 1299 ], "loc": { "start": { - "line": 8, - "column": 1 + "line": 38, + "column": 4 }, "end": { - "line": 8, - "column": 24 + "line": 38, + "column": 28 } } }, @@ -790,17 +850,17 @@ "type": "Identifier", "name": "n", "range": [ - 191, - 192 + 1310, + 1311 ], "loc": { "start": { - "line": 10, - "column": 5 + "line": 40, + "column": 9 }, "end": { - "line": 10, - "column": 6 + "line": 40, + "column": 10 } } }, @@ -814,17 +874,17 @@ "type": "Identifier", "name": "n", "range": [ - 197, - 198 + 1316, + 1317 ], "loc": { "start": { - "line": 10, - "column": 11 + "line": 40, + "column": 15 }, "end": { - "line": 10, - "column": 12 + "line": 40, + "column": 16 } } }, @@ -832,32 +892,32 @@ "type": "Identifier", "name": "parent", "range": [ - 199, - 205 + 1318, + 1324 ], "loc": { "start": { - "line": 10, - "column": 13 + "line": 40, + "column": 17 }, "end": { - "line": 10, - "column": 19 + "line": 40, + "column": 23 } } }, "range": [ - 197, - 205 + 1316, + 1324 ], "loc": { "start": { - "line": 10, - "column": 11 + "line": 40, + "column": 15 }, "end": { - "line": 10, - "column": 19 + "line": 40, + "column": 23 } } }, @@ -865,47 +925,47 @@ "type": "Identifier", "name": "left", "range": [ - 206, - 210 + 1325, + 1329 ], "loc": { "start": { - "line": 10, - "column": 20 + "line": 40, + "column": 24 }, "end": { - "line": 10, - "column": 24 + "line": 40, + "column": 28 } } }, "range": [ - 197, - 210 + 1316, + 1329 ], "loc": { "start": { - "line": 10, - "column": 11 + "line": 40, + "column": 15 }, "end": { - "line": 10, - "column": 24 + "line": 40, + "column": 28 } } }, "range": [ - 191, - 210 + 1310, + 1329 ], "loc": { "start": { - "line": 10, - "column": 5 + "line": 40, + "column": 9 }, "end": { - "line": 10, - "column": 24 + "line": 40, + "column": 28 } } }, @@ -927,17 +987,17 @@ "type": "Identifier", "name": "s", "range": [ - 216, - 217 + 1342, + 1343 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 11, - "column": 3 + "line": 41, + "column": 9 } } }, @@ -945,32 +1005,32 @@ "type": "Identifier", "name": "right", "range": [ - 218, - 223 + 1344, + 1349 ], "loc": { "start": { - "line": 11, - "column": 4 + "line": 41, + "column": 10 }, "end": { - "line": 11, - "column": 9 + "line": 41, + "column": 15 } } }, "range": [ - 216, - 223 + 1342, + 1349 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 11, - "column": 9 + "line": 41, + "column": 15 } } }, @@ -978,32 +1038,32 @@ "type": "Identifier", "name": "color", "range": [ - 224, - 229 + 1350, + 1355 ], "loc": { "start": { - "line": 11, - "column": 10 + "line": 41, + "column": 16 }, "end": { - "line": 11, - "column": 15 + "line": 41, + "column": 21 } } }, "range": [ - 216, - 229 + 1342, + 1355 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 11, - "column": 15 + "line": 41, + "column": 21 } } }, @@ -1011,47 +1071,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 232, - 237 + 1358, + 1363 ], "loc": { "start": { - "line": 11, - "column": 18 + "line": 41, + "column": 24 }, "end": { - "line": 11, - "column": 23 + "line": 41, + "column": 29 } } }, "range": [ - 216, - 237 + 1342, + 1363 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 11, - "column": 23 + "line": 41, + "column": 29 } } }, "range": [ - 216, - 238 + 1342, + 1365 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 41, + "column": 8 }, "end": { - "line": 11, - "column": 24 + "line": 41, + "column": 31 } } }, @@ -1063,17 +1123,17 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 241, - 252 + 1374, + 1385 ], "loc": { "start": { - "line": 12, - "column": 2 + "line": 42, + "column": 8 }, "end": { - "line": 12, - "column": 13 + "line": 42, + "column": 19 } } }, @@ -1085,17 +1145,17 @@ "type": "Identifier", "name": "n", "range": [ - 253, - 254 + 1387, + 1388 ], "loc": { "start": { - "line": 12, - "column": 14 + "line": 42, + "column": 21 }, "end": { - "line": 12, - "column": 15 + "line": 42, + "column": 22 } } }, @@ -1103,81 +1163,101 @@ "type": "Identifier", "name": "parent", "range": [ - 255, - 261 + 1389, + 1395 ], "loc": { "start": { - "line": 12, - "column": 16 + "line": 42, + "column": 23 }, "end": { - "line": 12, - "column": 22 + "line": 42, + "column": 29 } } }, "range": [ - 253, - 261 + 1387, + 1395 ], "loc": { "start": { - "line": 12, - "column": 14 + "line": 42, + "column": 21 }, "end": { - "line": 12, - "column": 22 + "line": 42, + "column": 29 } } } ], "range": [ - 241, - 262 + 1374, + 1397 ], "loc": { "start": { - "line": 12, - "column": 2 + "line": 42, + "column": 8 }, "end": { - "line": 12, - "column": 23 + "line": 42, + "column": 31 } } }, "range": [ - 241, - 263 + 1374, + 1399 ], "loc": { "start": { - "line": 12, - "column": 2 + "line": 42, + "column": 8 }, "end": { - "line": 12, - "column": 24 + "line": 42, + "column": 33 } } } ], "range": [ - 212, - 266 + 1332, + 1405 ], "loc": { "start": { - "line": 10, - "column": 26 + "line": 40, + "column": 31 }, "end": { - "line": 13, - "column": 2 + "line": 43, + "column": 5 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": " symmetric case", + "range": [ + 1411, + 1428 + ], + "loc": { + "start": { + "line": 45, + "column": 4 + }, + "end": { + "line": 45, + "column": 21 + } + } + } + ] }, "alternate": { "type": "BlockStatement", @@ -1197,17 +1277,17 @@ "type": "Identifier", "name": "s", "range": [ - 276, - 277 + 1448, + 1449 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 47, + "column": 8 }, "end": { - "line": 14, - "column": 3 + "line": 47, + "column": 9 } } }, @@ -1215,32 +1295,32 @@ "type": "Identifier", "name": "left", "range": [ - 278, - 282 + 1450, + 1454 ], "loc": { "start": { - "line": 14, - "column": 4 + "line": 47, + "column": 10 }, "end": { - "line": 14, - "column": 8 + "line": 47, + "column": 14 } } }, "range": [ - 276, - 282 + 1448, + 1454 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 47, + "column": 8 }, "end": { - "line": 14, - "column": 8 + "line": 47, + "column": 14 } } }, @@ -1248,32 +1328,32 @@ "type": "Identifier", "name": "color", "range": [ - 283, - 288 + 1455, + 1460 ], "loc": { "start": { - "line": 14, - "column": 9 + "line": 47, + "column": 15 }, "end": { - "line": 14, - "column": 14 + "line": 47, + "column": 20 } } }, "range": [ - 276, - 288 + 1448, + 1460 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 47, + "column": 8 }, "end": { - "line": 14, - "column": 14 + "line": 47, + "column": 20 } } }, @@ -1281,47 +1361,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 291, - 296 + 1463, + 1468 ], "loc": { "start": { - "line": 14, - "column": 17 + "line": 47, + "column": 23 }, "end": { - "line": 14, - "column": 22 + "line": 47, + "column": 28 } } }, "range": [ - 276, - 296 + 1448, + 1468 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 47, + "column": 8 }, "end": { - "line": 14, - "column": 22 + "line": 47, + "column": 28 } } }, "range": [ - 276, - 297 + 1448, + 1470 ], "loc": { "start": { - "line": 14, - "column": 2 + "line": 47, + "column": 8 }, "end": { - "line": 14, - "column": 23 + "line": 47, + "column": 30 } } }, @@ -1333,17 +1413,17 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 300, - 312 + 1479, + 1491 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 48, + "column": 8 }, "end": { - "line": 15, - "column": 14 + "line": 48, + "column": 20 } } }, @@ -1355,17 +1435,17 @@ "type": "Identifier", "name": "n", "range": [ - 313, - 314 + 1493, + 1494 ], "loc": { "start": { - "line": 15, - "column": 15 + "line": 48, + "column": 22 }, "end": { - "line": 15, - "column": 16 + "line": 48, + "column": 23 } } }, @@ -1373,109 +1453,129 @@ "type": "Identifier", "name": "parent", "range": [ - 315, - 321 + 1495, + 1501 ], "loc": { "start": { - "line": 15, - "column": 17 + "line": 48, + "column": 24 }, "end": { - "line": 15, - "column": 23 + "line": 48, + "column": 30 } } }, "range": [ - 313, - 321 + 1493, + 1501 ], "loc": { "start": { - "line": 15, - "column": 15 + "line": 48, + "column": 22 }, "end": { - "line": 15, - "column": 23 + "line": 48, + "column": 30 } } } ], "range": [ - 300, - 322 + 1479, + 1503 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 48, + "column": 8 }, "end": { - "line": 15, - "column": 24 + "line": 48, + "column": 32 } } }, "range": [ - 300, - 323 + 1479, + 1505 ], "loc": { "start": { - "line": 15, - "column": 2 + "line": 48, + "column": 8 }, "end": { - "line": 15, - "column": 25 + "line": 48, + "column": 34 } } } ], "range": [ - 272, - 326 + 1438, + 1511 ], "loc": { "start": { - "line": 13, - "column": 8 + "line": 46, + "column": 9 }, "end": { - "line": 16, - "column": 2 + "line": 49, + "column": 5 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " symmetric case", + "range": [ + 1411, + 1428 + ], + "loc": { + "start": { + "line": 45, + "column": 4 + }, + "end": { + "line": 45, + "column": 21 + } + } + } + ] }, "range": [ - 187, - 326 + 1305, + 1511 ], "loc": { "start": { - "line": 10, - "column": 1 + "line": 40, + "column": 4 }, "end": { - "line": 16, - "column": 2 + "line": 49, + "column": 5 } } } ], "range": [ - 107, - 328 + 511, + 1514 ], "loc": { "start": { - "line": 4, - "column": 0 + "line": 15, + "column": 35 }, "end": { - "line": 17, + "line": 51, "column": 1 } } @@ -1483,44 +1583,83 @@ "generator": false, "expression": false, "range": [ - 82, - 328 + 483, + 1514 ], "loc": { "start": { - "line": 3, + "line": 15, "column": 7 }, "end": { - "line": 17, + "line": 51, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 75, + 475 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 75, - 328 + 476, + 1514 ], "loc": { "start": { - "line": 3, + "line": 15, "column": 0 }, "end": { - "line": 17, + "line": 51, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 75, + 475 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 328 + 1514 ], "loc": { "start": { @@ -1528,9 +1667,64 @@ "column": 0 }, "end": { - "line": 17, + "line": 51, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 75, + 475 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n * We can repaint n's sibling's right child in black to fix this.\n * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "range": [ + 545, + 1238 + ], + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 35, + "column": 4 + } + } + }, + { + "type": "Line", + "value": " symmetric case", + "range": [ + 1411, + 1428 + ], + "loc": { + "start": { + "line": 45, + "column": 4 + }, + "end": { + "line": 45, + "column": 21 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/removal/delete_one_child.js.json b/ast/source/deletion/delete_one_child.js.json similarity index 58% rename from ast/source/removal/delete_one_child.js.json rename to ast/source/deletion/delete_one_child.js.json index c63fbb0..fd3bcf4 100644 --- a/ast/source/removal/delete_one_child.js.json +++ b/ast/source/deletion/delete_one_child.js.json @@ -325,7 +325,27 @@ "line": 4, "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", + "range": [ + 133, + 380 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -335,16 +355,16 @@ "type": "Identifier", "name": "delete_one_child", "range": [ - 149, - 165 + 397, + 413 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 16 }, "end": { - "line": 6, + "line": 15, "column": 32 } } @@ -354,16 +374,16 @@ "type": "Identifier", "name": "n", "range": [ - 168, - 169 + 416, + 417 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 35 }, "end": { - "line": 6, + "line": 15, "column": 36 } } @@ -381,16 +401,16 @@ "type": "Identifier", "name": "child", "range": [ - 504, - 509 + 752, + 757 ], "loc": { "start": { - "line": 14, + "line": 23, "column": 10 }, "end": { - "line": 14, + "line": 23, "column": 15 } } @@ -402,16 +422,16 @@ "type": "Identifier", "name": "n", "range": [ - 512, - 513 + 760, + 761 ], "loc": { "start": { - "line": 14, + "line": 23, "column": 18 }, "end": { - "line": 14, + "line": 23, "column": 19 } } @@ -420,46 +440,46 @@ "type": "Identifier", "name": "left", "range": [ - 514, - 518 + 762, + 766 ], "loc": { "start": { - "line": 14, + "line": 23, "column": 20 }, "end": { - "line": 14, + "line": 23, "column": 24 } } }, "range": [ - 512, - 518 + 760, + 766 ], "loc": { "start": { - "line": 14, + "line": 23, "column": 18 }, "end": { - "line": 14, + "line": 23, "column": 24 } } }, "range": [ - 504, - 518 + 752, + 766 ], "loc": { "start": { - "line": 14, + "line": 23, "column": 10 }, "end": { - "line": 14, + "line": 23, "column": 24 } } @@ -467,16 +487,16 @@ ], "kind": "const", "range": [ - 498, - 520 + 746, + 768 ], "loc": { "start": { - "line": 14, + "line": 23, "column": 4 }, "end": { - "line": 14, + "line": 23, "column": 26 } }, @@ -485,16 +505,16 @@ "type": "Line", "value": " Precondition: n has at most one non-leaf child.", "range": [ - 179, - 229 + 427, + 477 ], "loc": { "start": { - "line": 8, + "line": 17, "column": 4 }, "end": { - "line": 8, + "line": 17, "column": 54 } } @@ -503,16 +523,16 @@ "type": "Line", "value": " assert( n.right.isleaf() || n.left.isleaf());", "range": [ - 234, - 282 + 482, + 530 ], "loc": { "start": { - "line": 9, + "line": 18, "column": 4 }, "end": { - "line": 9, + "line": 18, "column": 52 } } @@ -521,16 +541,16 @@ "type": "Line", "value": " const child = n.right.isleaf() ? n.left : n.right;", "range": [ - 288, - 341 + 536, + 589 ], "loc": { "start": { - "line": 11, + "line": 20, "column": 4 }, "end": { - "line": 11, + "line": 20, "column": 57 } } @@ -539,16 +559,16 @@ "type": "Line", "value": " n.right is always a LEAF because either n is a subtree predecessor or it", "range": [ - 346, - 421 + 594, + 669 ], "loc": { "start": { - "line": 12, + "line": 21, "column": 4 }, "end": { - "line": 12, + "line": 21, "column": 79 } } @@ -557,20 +577,40 @@ "type": "Line", "value": " is the only child of its parent by the red-black tree properties", "range": [ - 426, - 493 + 674, + 741 ], "loc": { "start": { - "line": 13, + "line": 22, "column": 4 }, "end": { - "line": 13, + "line": 22, "column": 71 } } } + ], + "trailingComments": [ + { + "type": "Line", + "value": " replace n with its left child", + "range": [ + 774, + 806 + ], + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 36 + } + } + } ] }, { @@ -581,16 +621,16 @@ "type": "Identifier", "name": "replace_node", "range": [ - 526, - 538 + 811, + 823 ], "loc": { "start": { - "line": 16, + "line": 26, "column": 4 }, "end": { - "line": 16, + "line": 26, "column": 16 } } @@ -600,17 +640,17 @@ "type": "Identifier", "name": "n", "range": [ - 539, - 540 + 825, + 826 ], "loc": { "start": { - "line": 16, - "column": 17 + "line": 26, + "column": 18 }, "end": { - "line": 16, - "column": 18 + "line": 26, + "column": 19 } } }, @@ -618,50 +658,108 @@ "type": "Identifier", "name": "child", "range": [ - 542, - 547 + 829, + 834 ], "loc": { "start": { - "line": 16, - "column": 20 + "line": 26, + "column": 22 }, "end": { - "line": 16, - "column": 25 + "line": 26, + "column": 27 } } } ], "range": [ - 526, - 548 + 811, + 836 ], "loc": { "start": { - "line": 16, + "line": 26, "column": 4 }, "end": { - "line": 16, - "column": 26 + "line": 26, + "column": 29 } } }, "range": [ - 526, - 549 + 811, + 838 ], "loc": { "start": { - "line": 16, + "line": 26, "column": 4 }, "end": { - "line": 16, - "column": 27 + "line": 26, + "column": 31 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " replace n with its left child", + "range": [ + 774, + 806 + ], + "loc": { + "start": { + "line": 25, + "column": 4 + }, + "end": { + "line": 25, + "column": 36 + } + } + } + ], + "trailingComments": [ + { + "type": "Line", + "value": " If n is black, deleting it reduces the black-height of every path going", + "range": [ + 844, + 918 + ], + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 78 + } + } + }, + { + "type": "Line", + "value": " through it by 1.", + "range": [ + 923, + 942 + ], + "loc": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 29, + "column": 23 + } + } + } + ] }, { "type": "IfStatement", @@ -675,17 +773,17 @@ "type": "Identifier", "name": "n", "range": [ - 559, - 560 + 952, + 953 ], "loc": { "start": { - "line": 18, - "column": 8 + "line": 30, + "column": 9 }, "end": { - "line": 18, - "column": 9 + "line": 30, + "column": 10 } } }, @@ -693,32 +791,32 @@ "type": "Identifier", "name": "color", "range": [ - 561, - 566 + 954, + 959 ], "loc": { "start": { - "line": 18, - "column": 10 + "line": 30, + "column": 11 }, "end": { - "line": 18, - "column": 15 + "line": 30, + "column": 16 } } }, "range": [ - 559, - 566 + 952, + 959 ], "loc": { "start": { - "line": 18, - "column": 8 + "line": 30, + "column": 9 }, "end": { - "line": 18, - "column": 15 + "line": 30, + "column": 16 } } }, @@ -726,32 +824,32 @@ "type": "Identifier", "name": "BLACK", "range": [ - 571, - 576 + 964, + 969 ], "loc": { "start": { - "line": 18, - "column": 20 + "line": 30, + "column": 21 }, "end": { - "line": 18, - "column": 25 + "line": 30, + "column": 26 } } }, "range": [ - 559, - 576 + 952, + 969 ], "loc": { "start": { - "line": 18, - "column": 8 + "line": 30, + "column": 9 }, "end": { - "line": 18, - "column": 25 + "line": 30, + "column": 26 } } }, @@ -770,17 +868,17 @@ "type": "Identifier", "name": "child", "range": [ - 592, - 597 + 1156, + 1161 ], "loc": { "start": { - "line": 19, - "column": 12 + "line": 35, + "column": 13 }, "end": { - "line": 19, - "column": 17 + "line": 35, + "column": 18 } } }, @@ -788,32 +886,32 @@ "type": "Identifier", "name": "color", "range": [ - 598, - 603 + 1162, + 1167 ], "loc": { "start": { - "line": 19, - "column": 18 + "line": 35, + "column": 19 }, "end": { - "line": 19, - "column": 23 + "line": 35, + "column": 24 } } }, "range": [ - 592, - 603 + 1156, + 1167 ], "loc": { "start": { - "line": 19, - "column": 12 + "line": 35, + "column": 13 }, "end": { - "line": 19, - "column": 23 + "line": 35, + "column": 24 } } }, @@ -821,32 +919,32 @@ "type": "Identifier", "name": "RED", "range": [ - 608, - 611 + 1172, + 1175 ], "loc": { "start": { - "line": 19, - "column": 28 + "line": 35, + "column": 29 }, "end": { - "line": 19, - "column": 31 + "line": 35, + "column": 32 } } }, "range": [ - 592, - 611 + 1156, + 1175 ], "loc": { "start": { - "line": 19, - "column": 12 + "line": 35, + "column": 13 }, "end": { - "line": 19, - "column": 31 + "line": 35, + "column": 32 } } }, @@ -862,17 +960,17 @@ "type": "Identifier", "name": "child", "range": [ - 613, - 618 + 1178, + 1183 ], "loc": { "start": { - "line": 19, - "column": 33 + "line": 35, + "column": 35 }, "end": { - "line": 19, - "column": 38 + "line": 35, + "column": 40 } } }, @@ -880,32 +978,32 @@ "type": "Identifier", "name": "color", "range": [ - 619, - 624 + 1184, + 1189 ], "loc": { "start": { - "line": 19, - "column": 39 + "line": 35, + "column": 41 }, "end": { - "line": 19, - "column": 44 + "line": 35, + "column": 46 } } }, "range": [ - 613, - 624 + 1178, + 1189 ], "loc": { "start": { - "line": 19, - "column": 33 + "line": 35, + "column": 35 }, "end": { - "line": 19, - "column": 44 + "line": 35, + "column": 46 } } }, @@ -913,49 +1011,69 @@ "type": "Identifier", "name": "BLACK", "range": [ - 627, - 632 + 1192, + 1197 ], "loc": { "start": { - "line": 19, - "column": 47 + "line": 35, + "column": 49 }, "end": { - "line": 19, - "column": 52 + "line": 35, + "column": 54 } } }, "range": [ - 613, - 632 + 1178, + 1197 ], "loc": { "start": { - "line": 19, - "column": 33 + "line": 35, + "column": 35 }, "end": { - "line": 19, - "column": 52 + "line": 35, + "column": 54 } } }, "range": [ - 613, - 633 + 1178, + 1199 ], "loc": { "start": { - "line": 19, - "column": 33 + "line": 35, + "column": 35 }, "end": { - "line": 19, - "column": 53 + "line": 35, + "column": 56 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": " Otherwise, there are more things to fix.", + "range": [ + 1209, + 1252 + ], + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 51 + } + } + } + ] }, "alternate": { "type": "ExpressionStatement", @@ -965,16 +1083,16 @@ "type": "Identifier", "name": "delete_case1", "range": [ - 647, - 659 + 1266, + 1278 ], "loc": { "start": { - "line": 20, + "line": 38, "column": 13 }, "end": { - "line": 20, + "line": 38, "column": 25 } } @@ -984,130 +1102,244 @@ "type": "Identifier", "name": "child", "range": [ - 660, - 665 + 1280, + 1285 ], "loc": { "start": { - "line": 20, - "column": 26 + "line": 38, + "column": 27 }, "end": { - "line": 20, - "column": 31 + "line": 38, + "column": 32 } } } ], "range": [ - 647, - 666 + 1266, + 1287 ], "loc": { "start": { - "line": 20, + "line": 38, "column": 13 }, "end": { - "line": 20, - "column": 32 + "line": 38, + "column": 34 } } }, "range": [ - 647, - 667 + 1266, + 1289 ], "loc": { "start": { - "line": 20, + "line": 38, "column": 13 }, "end": { - "line": 20, - "column": 33 + "line": 38, + "column": 36 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Otherwise, there are more things to fix.", + "range": [ + 1209, + 1252 + ], + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 51 + } + } + } + ] }, "range": [ - 588, - 667 + 1151, + 1289 ], "loc": { "start": { - "line": 19, + "line": 35, "column": 8 }, "end": { - "line": 20, - "column": 33 + "line": 38, + "column": 36 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " We can easily fix this when its left child is an", + "range": [ + 983, + 1034 + ], + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 59 + } + } + }, + { + "type": "Line", + "value": " internal red node: change the color of the left child to black and", + "range": [ + 1043, + 1112 + ], + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 77 + } + } + }, + { + "type": "Line", + "value": " replace n with it.", + "range": [ + 1121, + 1142 + ], + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 29 + } + } + } + ] } ], "range": [ - 578, - 673 + 972, + 1296 ], "loc": { "start": { - "line": 18, - "column": 27 + "line": 30, + "column": 29 }, "end": { - "line": 21, + "line": 40, "column": 5 } } }, "alternate": null, "range": [ - 555, - 673 + 947, + 1296 ], "loc": { "start": { - "line": 18, + "line": 30, "column": 4 }, "end": { - "line": 21, + "line": 40, "column": 5 } }, + "leadingComments": [ + { + "type": "Line", + "value": " If n is black, deleting it reduces the black-height of every path going", + "range": [ + 844, + 918 + ], + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 78 + } + } + }, + { + "type": "Line", + "value": " through it by 1.", + "range": [ + 923, + 942 + ], + "loc": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 29, + "column": 23 + } + } + } + ], "trailingComments": [ { "type": "Line", - "value": "else {", + "value": " else {", "range": [ - 679, - 687 + 1302, + 1311 ], "loc": { "start": { - "line": 23, + "line": 42, "column": 4 }, "end": { - "line": 23, - "column": 12 + "line": 42, + "column": 13 } } }, { "type": "Line", - "value": " If n is RED then its child can only be BLACK. Replacing n with its", + "value": " If n is red then its child can only be black. Replacing n with its", "range": [ - 692, - 764 + 1316, + 1388 ], "loc": { "start": { - "line": 24, + "line": 43, "column": 4 }, "end": { - "line": 24, + "line": 43, "column": 76 } } @@ -1116,35 +1348,35 @@ "type": "Line", "value": " child suffices.", "range": [ - 769, - 790 + 1393, + 1414 ], "loc": { "start": { - "line": 25, + "line": 44, "column": 4 }, "end": { - "line": 25, + "line": 44, "column": 25 } } }, { "type": "Line", - "value": "}", + "value": " }", "range": [ - 795, - 798 + 1419, + 1423 ], "loc": { "start": { - "line": 26, + "line": 45, "column": 4 }, "end": { - "line": 26, - "column": 7 + "line": 45, + "column": 8 } } } @@ -1152,16 +1384,16 @@ } ], "range": [ - 172, - 801 + 420, + 1426 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 39 }, "end": { - "line": 28, + "line": 47, "column": 1 } } @@ -1169,44 +1401,83 @@ "generator": false, "expression": false, "range": [ - 140, - 801 + 388, + 1426 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 7 }, "end": { - "line": 28, + "line": 47, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", + "range": [ + 133, + 380 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 133, - 801 + 381, + 1426 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 0 }, "end": { - "line": 28, + "line": 47, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", + "range": [ + 133, + 380 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 801 + 1426 ], "loc": { "start": { @@ -1214,25 +1485,43 @@ "column": 0 }, "end": { - "line": 28, + "line": 47, "column": 1 } }, "comments": [ + { + "type": "Block", + "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", + "range": [ + 133, + 380 + ], + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, { "type": "Line", "value": " Precondition: n has at most one non-leaf child.", "range": [ - 179, - 229 + 427, + 477 ], "loc": { "start": { - "line": 8, + "line": 17, "column": 4 }, "end": { - "line": 8, + "line": 17, "column": 54 } } @@ -1241,16 +1530,16 @@ "type": "Line", "value": " assert( n.right.isleaf() || n.left.isleaf());", "range": [ - 234, - 282 + 482, + 530 ], "loc": { "start": { - "line": 9, + "line": 18, "column": 4 }, "end": { - "line": 9, + "line": 18, "column": 52 } } @@ -1259,16 +1548,16 @@ "type": "Line", "value": " const child = n.right.isleaf() ? n.left : n.right;", "range": [ - 288, - 341 + 536, + 589 ], "loc": { "start": { - "line": 11, + "line": 20, "column": 4 }, "end": { - "line": 11, + "line": 20, "column": 57 } } @@ -1277,16 +1566,16 @@ "type": "Line", "value": " n.right is always a LEAF because either n is a subtree predecessor or it", "range": [ - 346, - 421 + 594, + 669 ], "loc": { "start": { - "line": 12, + "line": 21, "column": 4 }, "end": { - "line": 12, + "line": 21, "column": 79 } } @@ -1295,52 +1584,178 @@ "type": "Line", "value": " is the only child of its parent by the red-black tree properties", "range": [ - 426, - 493 + 674, + 741 ], "loc": { "start": { - "line": 13, + "line": 22, "column": 4 }, "end": { - "line": 13, + "line": 22, "column": 71 } } }, { "type": "Line", - "value": "else {", + "value": " replace n with its left child", "range": [ - 679, - 687 + 774, + 806 ], "loc": { "start": { - "line": 23, + "line": 25, "column": 4 }, "end": { - "line": 23, - "column": 12 + "line": 25, + "column": 36 } } }, { "type": "Line", - "value": " If n is RED then its child can only be BLACK. Replacing n with its", + "value": " If n is black, deleting it reduces the black-height of every path going", "range": [ - 692, - 764 + 844, + 918 ], "loc": { "start": { - "line": 24, + "line": 28, "column": 4 }, "end": { - "line": 24, + "line": 28, + "column": 78 + } + } + }, + { + "type": "Line", + "value": " through it by 1.", + "range": [ + 923, + 942 + ], + "loc": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 29, + "column": 23 + } + } + }, + { + "type": "Line", + "value": " We can easily fix this when its left child is an", + "range": [ + 983, + 1034 + ], + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 59 + } + } + }, + { + "type": "Line", + "value": " internal red node: change the color of the left child to black and", + "range": [ + 1043, + 1112 + ], + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 77 + } + } + }, + { + "type": "Line", + "value": " replace n with it.", + "range": [ + 1121, + 1142 + ], + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 29 + } + } + }, + { + "type": "Line", + "value": " Otherwise, there are more things to fix.", + "range": [ + 1209, + 1252 + ], + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 51 + } + } + }, + { + "type": "Line", + "value": " else {", + "range": [ + 1302, + 1311 + ], + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 42, + "column": 13 + } + } + }, + { + "type": "Line", + "value": " If n is red then its child can only be black. Replacing n with its", + "range": [ + 1316, + 1388 + ], + "loc": { + "start": { + "line": 43, + "column": 4 + }, + "end": { + "line": 43, "column": 76 } } @@ -1349,35 +1764,35 @@ "type": "Line", "value": " child suffices.", "range": [ - 769, - 790 + 1393, + 1414 ], "loc": { "start": { - "line": 25, + "line": 44, "column": 4 }, "end": { - "line": 25, + "line": 44, "column": 25 } } }, { "type": "Line", - "value": "}", + "value": " }", "range": [ - 795, - 798 + 1419, + 1423 ], "loc": { "start": { - "line": 26, + "line": 45, "column": 4 }, "end": { - "line": 26, - "column": 7 + "line": 45, + "column": 8 } } } diff --git a/ast/source/removal/index.js.json b/ast/source/deletion/index.js.json similarity index 100% rename from ast/source/removal/index.js.json rename to ast/source/deletion/index.js.json diff --git a/ast/source/removal/replace_node.js.json b/ast/source/deletion/replace_node.js.json similarity index 73% rename from ast/source/removal/replace_node.js.json rename to ast/source/deletion/replace_node.js.json index a29da0f..eaf57e3 100644 --- a/ast/source/removal/replace_node.js.json +++ b/ast/source/deletion/replace_node.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "replace_node", "range": [ - 16, - 28 + 168, + 180 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 16 }, "end": { - "line": 1, + "line": 7, "column": 28 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "A", "range": [ - 31, - 32 + 183, + 184 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 31 }, "end": { - "line": 1, + "line": 7, "column": 32 } } @@ -46,16 +46,16 @@ "type": "Identifier", "name": "B", "range": [ - 35, - 36 + 187, + 188 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 35 }, "end": { - "line": 1, + "line": 7, "column": 36 } } @@ -73,16 +73,16 @@ "type": "Identifier", "name": "A", "range": [ - 146, - 147 + 298, + 299 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 6 }, "end": { - "line": 6, + "line": 12, "column": 7 } } @@ -97,16 +97,16 @@ "type": "Identifier", "name": "A", "range": [ - 152, - 153 + 304, + 305 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 12 }, "end": { - "line": 6, + "line": 12, "column": 13 } } @@ -115,31 +115,31 @@ "type": "Identifier", "name": "parent", "range": [ - 154, - 160 + 306, + 312 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 14 }, "end": { - "line": 6, + "line": 12, "column": 20 } } }, "range": [ - 152, - 160 + 304, + 312 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 12 }, "end": { - "line": 6, + "line": 12, "column": 20 } } @@ -148,46 +148,46 @@ "type": "Identifier", "name": "left", "range": [ - 161, - 165 + 313, + 317 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 21 }, "end": { - "line": 6, + "line": 12, "column": 25 } } }, "range": [ - 152, - 165 + 304, + 317 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 12 }, "end": { - "line": 6, + "line": 12, "column": 25 } } }, "range": [ - 146, - 165 + 298, + 317 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 6 }, "end": { - "line": 6, + "line": 12, "column": 25 } } @@ -207,16 +207,16 @@ "type": "Identifier", "name": "A", "range": [ - 168, - 169 + 320, + 321 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 28 }, "end": { - "line": 6, + "line": 12, "column": 29 } } @@ -225,31 +225,31 @@ "type": "Identifier", "name": "parent", "range": [ - 170, - 176 + 322, + 328 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 30 }, "end": { - "line": 6, + "line": 12, "column": 36 } } }, "range": [ - 168, - 176 + 320, + 328 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 28 }, "end": { - "line": 6, + "line": 12, "column": 36 } } @@ -258,31 +258,31 @@ "type": "Identifier", "name": "left", "range": [ - 177, - 181 + 329, + 333 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 37 }, "end": { - "line": 6, + "line": 12, "column": 41 } } }, "range": [ - 168, - 181 + 320, + 333 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 28 }, "end": { - "line": 6, + "line": 12, "column": 41 } } @@ -291,46 +291,46 @@ "type": "Identifier", "name": "B", "range": [ - 184, - 185 + 336, + 337 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 44 }, "end": { - "line": 6, + "line": 12, "column": 45 } } }, "range": [ - 168, - 185 + 320, + 337 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 28 }, "end": { - "line": 6, + "line": 12, "column": 45 } } }, "range": [ - 168, - 187 + 320, + 339 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 28 }, "end": { - "line": 6, + "line": 12, "column": 47 } } @@ -350,16 +350,16 @@ "type": "Identifier", "name": "A", "range": [ - 195, - 196 + 347, + 348 ], "loc": { "start": { - "line": 8, + "line": 14, "column": 6 }, "end": { - "line": 8, + "line": 14, "column": 7 } } @@ -368,31 +368,31 @@ "type": "Identifier", "name": "parent", "range": [ - 197, - 203 + 349, + 355 ], "loc": { "start": { - "line": 8, + "line": 14, "column": 8 }, "end": { - "line": 8, + "line": 14, "column": 14 } } }, "range": [ - 195, - 203 + 347, + 355 ], "loc": { "start": { - "line": 8, + "line": 14, "column": 6 }, "end": { - "line": 8, + "line": 14, "column": 14 } } @@ -401,31 +401,31 @@ "type": "Identifier", "name": "right", "range": [ - 204, - 209 + 356, + 361 ], "loc": { "start": { - "line": 8, + "line": 14, "column": 15 }, "end": { - "line": 8, + "line": 14, "column": 20 } } }, "range": [ - 195, - 209 + 347, + 361 ], "loc": { "start": { - "line": 8, + "line": 14, "column": 6 }, "end": { - "line": 8, + "line": 14, "column": 20 } } @@ -434,61 +434,61 @@ "type": "Identifier", "name": "B", "range": [ - 212, - 213 + 364, + 365 ], "loc": { "start": { - "line": 8, + "line": 14, "column": 23 }, "end": { - "line": 8, + "line": 14, "column": 24 } } }, "range": [ - 195, - 213 + 347, + 365 ], "loc": { "start": { - "line": 8, + "line": 14, "column": 6 }, "end": { - "line": 8, + "line": 14, "column": 24 } } }, "range": [ - 195, - 215 + 347, + 367 ], "loc": { "start": { - "line": 8, + "line": 14, "column": 6 }, "end": { - "line": 8, + "line": 14, "column": 26 } } }, "range": [ - 141, - 215 + 293, + 367 ], "loc": { "start": { - "line": 6, + "line": 12, "column": 1 }, "end": { - "line": 8, + "line": 14, "column": 26 } }, @@ -497,16 +497,16 @@ "type": "Line", "value": " assert( A.parent !== null ) ;", "range": [ - 43, - 75 + 195, + 227 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 1 }, "end": { - "line": 3, + "line": 9, "column": 33 } } @@ -515,16 +515,16 @@ "type": "Line", "value": " we never apply delete_one_child on the root so we are safe", "range": [ - 77, - 138 + 229, + 290 ], "loc": { "start": { - "line": 4, + "line": 10, "column": 1 }, "end": { - "line": 4, + "line": 10, "column": 62 } } @@ -543,16 +543,16 @@ "type": "Identifier", "name": "B", "range": [ - 218, - 219 + 370, + 371 ], "loc": { "start": { - "line": 10, + "line": 16, "column": 1 }, "end": { - "line": 10, + "line": 16, "column": 2 } } @@ -561,31 +561,31 @@ "type": "Identifier", "name": "parent", "range": [ - 220, - 226 + 372, + 378 ], "loc": { "start": { - "line": 10, + "line": 16, "column": 3 }, "end": { - "line": 10, + "line": 16, "column": 9 } } }, "range": [ - 218, - 226 + 370, + 378 ], "loc": { "start": { - "line": 10, + "line": 16, "column": 1 }, "end": { - "line": 10, + "line": 16, "column": 9 } } @@ -597,16 +597,16 @@ "type": "Identifier", "name": "A", "range": [ - 229, - 230 + 381, + 382 ], "loc": { "start": { - "line": 10, + "line": 16, "column": 12 }, "end": { - "line": 10, + "line": 16, "column": 13 } } @@ -615,77 +615,77 @@ "type": "Identifier", "name": "parent", "range": [ - 231, - 237 + 383, + 389 ], "loc": { "start": { - "line": 10, + "line": 16, "column": 14 }, "end": { - "line": 10, + "line": 16, "column": 20 } } }, "range": [ - 229, - 237 + 381, + 389 ], "loc": { "start": { - "line": 10, + "line": 16, "column": 12 }, "end": { - "line": 10, + "line": 16, "column": 20 } } }, "range": [ - 218, - 237 + 370, + 389 ], "loc": { "start": { - "line": 10, + "line": 16, "column": 1 }, "end": { - "line": 10, + "line": 16, "column": 20 } } }, "range": [ - 218, - 239 + 370, + 391 ], "loc": { "start": { - "line": 10, + "line": 16, "column": 1 }, "end": { - "line": 10, + "line": 16, "column": 22 } } } ], "range": [ - 39, - 242 + 191, + 394 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 39 }, "end": { - "line": 12, + "line": 18, "column": 1 } } @@ -693,70 +693,127 @@ "generator": false, "expression": false, "range": [ - 7, - 242 + 159, + 394 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 7 }, "end": { - "line": 12, + "line": 18, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", + "range": [ + 0, + 151 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 242 + 152, + 394 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 0 }, "end": { - "line": 12, + "line": 18, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", + "range": [ + 0, + 151 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 242 + 152, + 394 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 0 }, "end": { - "line": 12, + "line": 18, "column": 1 } }, "comments": [ + { + "type": "Block", + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", + "range": [ + 0, + 151 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, { "type": "Line", "value": " assert( A.parent !== null ) ;", "range": [ - 43, - 75 + 195, + 227 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 1 }, "end": { - "line": 3, + "line": 9, "column": 33 } } @@ -765,16 +822,16 @@ "type": "Line", "value": " we never apply delete_one_child on the root so we are safe", "range": [ - 77, - 138 + 229, + 290 ], "loc": { "start": { - "line": 4, + "line": 10, "column": 1 }, "end": { - "line": 4, + "line": 10, "column": 62 } } diff --git a/ast/source/family/grandparent.js.json b/ast/source/family/grandparent.js.json index 416f915..58f8355 100644 --- a/ast/source/family/grandparent.js.json +++ b/ast/source/family/grandparent.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "grandparent", "range": [ - 16, - 27 + 152, + 163 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 16 }, "end": { - "line": 1, + "line": 7, "column": 27 } } @@ -26,19 +26,19 @@ "params": [ { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 30, - 31 + 166, + 170 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 30 }, "end": { - "line": 1, - "column": 31 + "line": 7, + "column": 34 } } } @@ -56,19 +56,19 @@ "computed": false, "object": { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 148, - 149 + 298, + 302 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 8 }, "end": { - "line": 5, - "column": 9 + "line": 11, + "column": 12 } } }, @@ -76,32 +76,32 @@ "type": "Identifier", "name": "parent", "range": [ - 150, - 156 + 303, + 309 ], "loc": { "start": { - "line": 5, - "column": 10 + "line": 11, + "column": 13 }, "end": { - "line": 5, - "column": 16 + "line": 11, + "column": 19 } } }, "range": [ - 148, - 156 + 298, + 309 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 8 }, "end": { - "line": 5, - "column": 16 + "line": 11, + "column": 19 } } }, @@ -109,83 +109,83 @@ "type": "Identifier", "name": "parent", "range": [ - 157, - 163 + 310, + 316 ], "loc": { "start": { - "line": 5, - "column": 17 + "line": 11, + "column": 20 }, "end": { - "line": 5, - "column": 23 + "line": 11, + "column": 26 } } }, "range": [ - 148, - 163 + 298, + 316 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 8 }, "end": { - "line": 5, - "column": 23 + "line": 11, + "column": 26 } } }, "range": [ - 141, - 164 + 291, + 317 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 1 }, "end": { - "line": 5, - "column": 24 + "line": 11, + "column": 27 } }, "leadingComments": [ { "type": "Line", - "value": "assert((n !== null) && (n.parent !== null));", + "value": " assert((node !== null) && (node.parent !== null));", "range": [ - 38, - 84 + 177, + 230 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 1 }, "end": { - "line": 3, - "column": 47 + "line": 9, + "column": 54 } } }, { "type": "Line", - "value": "We only call this function when n HAS a grandparent", + "value": " We only call this function when node HAS a grandparent", "range": [ - 86, - 139 + 232, + 289 ], "loc": { "start": { - "line": 4, + "line": 10, "column": 1 }, "end": { - "line": 4, - "column": 54 + "line": 10, + "column": 58 } } } @@ -193,16 +193,16 @@ } ], "range": [ - 34, - 167 + 173, + 320 ], "loc": { "start": { - "line": 1, - "column": 34 + "line": 7, + "column": 37 }, "end": { - "line": 7, + "line": 13, "column": 1 } } @@ -210,89 +210,146 @@ "generator": false, "expression": false, "range": [ - 7, - 167 + 143, + 320 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 7 }, "end": { - "line": 7, + "line": 13, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 135 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 167 + 136, + 320 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 0 }, "end": { - "line": 7, + "line": 13, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 135 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 167 + 136, + 320 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 0 }, "end": { - "line": 7, + "line": 13, "column": 1 } }, "comments": [ + { + "type": "Block", + "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 135 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, { "type": "Line", - "value": "assert((n !== null) && (n.parent !== null));", + "value": " assert((node !== null) && (node.parent !== null));", "range": [ - 38, - 84 + 177, + 230 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 1 }, "end": { - "line": 3, - "column": 47 + "line": 9, + "column": 54 } } }, { "type": "Line", - "value": "We only call this function when n HAS a grandparent", + "value": " We only call this function when node HAS a grandparent", "range": [ - 86, - 139 + 232, + 289 ], "loc": { "start": { - "line": 4, + "line": 10, "column": 1 }, "end": { - "line": 4, - "column": 54 + "line": 10, + "column": 58 } } } diff --git a/ast/source/family/predecessor.js.json b/ast/source/family/predecessor.js.json index 86b6f0b..f6397da 100644 --- a/ast/source/family/predecessor.js.json +++ b/ast/source/family/predecessor.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "predecessor", "range": [ - 16, - 27 + 223, + 234 ], "loc": { "start": { - "line": 1, + "line": 8, "column": 16 }, "end": { - "line": 1, + "line": 8, "column": 27 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "node", "range": [ - 30, - 34 + 237, + 241 ], "loc": { "start": { - "line": 1, + "line": 8, "column": 30 }, "end": { - "line": 1, + "line": 8, "column": 34 } } @@ -55,16 +55,16 @@ "type": "Identifier", "name": "pred", "range": [ - 45, - 49 + 288, + 292 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 5 }, "end": { - "line": 3, + "line": 11, "column": 9 } } @@ -76,16 +76,16 @@ "type": "Identifier", "name": "node", "range": [ - 52, - 56 + 295, + 299 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 12 }, "end": { - "line": 3, + "line": 11, "column": 16 } } @@ -94,66 +94,86 @@ "type": "Identifier", "name": "left", "range": [ - 57, - 61 + 300, + 304 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 17 }, "end": { - "line": 3, + "line": 11, "column": 21 } } }, "range": [ - 52, - 61 + 295, + 304 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 12 }, "end": { - "line": 3, + "line": 11, "column": 21 } } }, "range": [ - 45, - 61 + 288, + 304 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 5 }, "end": { - "line": 3, + "line": 11, "column": 21 } } } ], - "kind": "var", + "kind": "let", "range": [ - 41, - 63 + 284, + 306 ], "loc": { "start": { - "line": 3, + "line": 11, "column": 1 }, "end": { - "line": 3, + "line": 11, "column": 23 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " assert( !node.left.isleaf() ) ;", + "range": [ + 248, + 282 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 35 + } + } + } + ] }, { "type": "WhileStatement", @@ -172,16 +192,16 @@ "type": "Identifier", "name": "pred", "range": [ - 75, - 79 + 318, + 322 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 10 }, "end": { - "line": 5, + "line": 13, "column": 14 } } @@ -190,31 +210,31 @@ "type": "Identifier", "name": "right", "range": [ - 80, - 85 + 323, + 328 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 15 }, "end": { - "line": 5, + "line": 13, "column": 20 } } }, "range": [ - 75, - 85 + 318, + 328 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 10 }, "end": { - "line": 5, + "line": 13, "column": 20 } } @@ -223,63 +243,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 86, - 92 + 329, + 335 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 21 }, "end": { - "line": 5, + "line": 13, "column": 27 } } }, "range": [ - 75, - 92 + 318, + 335 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 10 }, "end": { - "line": 5, + "line": 13, "column": 27 } } }, "arguments": [], "range": [ - 75, - 94 + 318, + 337 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 10 }, "end": { - "line": 5, + "line": 13, "column": 29 } } }, "prefix": true, "range": [ - 74, - 94 + 317, + 337 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 9 }, "end": { - "line": 5, + "line": 13, "column": 29 } } @@ -293,16 +313,16 @@ "type": "Identifier", "name": "pred", "range": [ - 97, - 101 + 340, + 344 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 32 }, "end": { - "line": 5, + "line": 13, "column": 36 } } @@ -314,16 +334,16 @@ "type": "Identifier", "name": "pred", "range": [ - 104, - 108 + 347, + 351 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 39 }, "end": { - "line": 5, + "line": 13, "column": 43 } } @@ -332,76 +352,76 @@ "type": "Identifier", "name": "right", "range": [ - 109, - 114 + 352, + 357 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 44 }, "end": { - "line": 5, + "line": 13, "column": 49 } } }, "range": [ - 104, - 114 + 347, + 357 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 39 }, "end": { - "line": 5, + "line": 13, "column": 49 } } }, "range": [ - 97, - 114 + 340, + 357 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 32 }, "end": { - "line": 5, + "line": 13, "column": 49 } } }, "range": [ - 97, - 116 + 340, + 359 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 32 }, "end": { - "line": 5, + "line": 13, "column": 51 } } }, "range": [ - 66, - 116 + 309, + 359 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 1 }, "end": { - "line": 5, + "line": 13, "column": 51 } } @@ -412,47 +432,47 @@ "type": "Identifier", "name": "pred", "range": [ - 126, - 130 + 369, + 373 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 8 }, "end": { - "line": 7, + "line": 15, "column": 12 } } }, "range": [ - 119, - 132 + 362, + 375 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 1 }, "end": { - "line": 7, + "line": 15, "column": 14 } } } ], "range": [ - 37, - 135 + 244, + 378 ], "loc": { "start": { - "line": 1, + "line": 8, "column": 37 }, "end": { - "line": 9, + "line": 17, "column": 1 } } @@ -460,54 +480,130 @@ "generator": false, "expression": false, "range": [ - 7, - 135 + 214, + 378 ], "loc": { "start": { - "line": 1, + "line": 8, "column": 7 }, "end": { - "line": 9, + "line": 17, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 206 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 135 + 207, + 378 ], "loc": { "start": { - "line": 1, + "line": 8, "column": 0 }, "end": { - "line": 9, + "line": 17, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 206 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 135 + 207, + 378 ], "loc": { "start": { - "line": 1, + "line": 8, "column": 0 }, "end": { - "line": 9, + "line": 17, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 206 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 7, + "column": 3 + } + } + }, + { + "type": "Line", + "value": " assert( !node.left.isleaf() ) ;", + "range": [ + 248, + 282 + ], + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 35 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/family/sibling.js.json b/ast/source/family/sibling.js.json index a08dd0b..495f319 100644 --- a/ast/source/family/sibling.js.json +++ b/ast/source/family/sibling.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "sibling", "range": [ - 16, - 23 + 129, + 136 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 16 }, "end": { - "line": 1, + "line": 7, "column": 23 } } @@ -26,19 +26,19 @@ "params": [ { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 26, - 27 + 139, + 143 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 26 }, "end": { - "line": 1, - "column": 27 + "line": 7, + "column": 30 } } } @@ -55,19 +55,19 @@ "operator": "===", "left": { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 175, - 176 + 303, + 307 ], "loc": { "start": { - "line": 7, + "line": 13, "column": 9 }, "end": { - "line": 7, - "column": 10 + "line": 13, + "column": 13 } } }, @@ -79,19 +79,19 @@ "computed": false, "object": { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 181, - 182 + 312, + 316 ], "loc": { "start": { - "line": 7, - "column": 15 + "line": 13, + "column": 18 }, "end": { - "line": 7, - "column": 16 + "line": 13, + "column": 22 } } }, @@ -99,32 +99,32 @@ "type": "Identifier", "name": "parent", "range": [ - 183, - 189 + 317, + 323 ], "loc": { "start": { - "line": 7, - "column": 17 + "line": 13, + "column": 23 }, "end": { - "line": 7, - "column": 23 + "line": 13, + "column": 29 } } }, "range": [ - 181, - 189 + 312, + 323 ], "loc": { "start": { - "line": 7, - "column": 15 + "line": 13, + "column": 18 }, "end": { - "line": 7, - "column": 23 + "line": 13, + "column": 29 } } }, @@ -132,47 +132,47 @@ "type": "Identifier", "name": "left", "range": [ - 190, - 194 + 324, + 328 ], "loc": { "start": { - "line": 7, - "column": 24 + "line": 13, + "column": 30 }, "end": { - "line": 7, - "column": 28 + "line": 13, + "column": 34 } } }, "range": [ - 181, - 194 + 312, + 328 ], "loc": { "start": { - "line": 7, - "column": 15 + "line": 13, + "column": 18 }, "end": { - "line": 7, - "column": 28 + "line": 13, + "column": 34 } } }, "range": [ - 175, - 194 + 303, + 328 ], "loc": { "start": { - "line": 7, + "line": 13, "column": 9 }, "end": { - "line": 7, - "column": 28 + "line": 13, + "column": 34 } } }, @@ -184,19 +184,19 @@ "computed": false, "object": { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 197, - 198 + 331, + 335 ], "loc": { "start": { - "line": 7, - "column": 31 + "line": 13, + "column": 37 }, "end": { - "line": 7, - "column": 32 + "line": 13, + "column": 41 } } }, @@ -204,32 +204,32 @@ "type": "Identifier", "name": "parent", "range": [ - 199, - 205 + 336, + 342 ], "loc": { "start": { - "line": 7, - "column": 33 + "line": 13, + "column": 42 }, "end": { - "line": 7, - "column": 39 + "line": 13, + "column": 48 } } }, "range": [ - 197, - 205 + 331, + 342 ], "loc": { "start": { - "line": 7, - "column": 31 + "line": 13, + "column": 37 }, "end": { - "line": 7, - "column": 39 + "line": 13, + "column": 48 } } }, @@ -237,32 +237,32 @@ "type": "Identifier", "name": "right", "range": [ - 206, - 211 + 343, + 348 ], "loc": { "start": { - "line": 7, - "column": 40 + "line": 13, + "column": 49 }, "end": { - "line": 7, - "column": 45 + "line": 13, + "column": 54 } } }, "range": [ - 197, - 211 + 331, + 348 ], "loc": { "start": { - "line": 7, - "column": 31 + "line": 13, + "column": 37 }, "end": { - "line": 7, - "column": 45 + "line": 13, + "column": 54 } } }, @@ -274,19 +274,19 @@ "computed": false, "object": { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 214, - 215 + 351, + 355 ], "loc": { "start": { - "line": 7, - "column": 48 + "line": 13, + "column": 57 }, "end": { - "line": 7, - "column": 49 + "line": 13, + "column": 61 } } }, @@ -294,32 +294,32 @@ "type": "Identifier", "name": "parent", "range": [ - 216, - 222 + 356, + 362 ], "loc": { "start": { - "line": 7, - "column": 50 + "line": 13, + "column": 62 }, "end": { - "line": 7, - "column": 56 + "line": 13, + "column": 68 } } }, "range": [ - 214, - 222 + 351, + 362 ], "loc": { "start": { - "line": 7, - "column": 48 + "line": 13, + "column": 57 }, "end": { - "line": 7, - "column": 56 + "line": 13, + "column": 68 } } }, @@ -327,116 +327,116 @@ "type": "Identifier", "name": "left", "range": [ - 223, - 227 + 363, + 367 ], "loc": { "start": { - "line": 7, - "column": 57 + "line": 13, + "column": 69 }, "end": { - "line": 7, - "column": 61 + "line": 13, + "column": 73 } } }, "range": [ - 214, - 227 + 351, + 367 ], "loc": { "start": { - "line": 7, - "column": 48 + "line": 13, + "column": 57 }, "end": { - "line": 7, - "column": 61 + "line": 13, + "column": 73 } } }, "range": [ - 175, - 227 + 303, + 367 ], "loc": { "start": { - "line": 7, + "line": 13, "column": 9 }, "end": { - "line": 7, - "column": 61 + "line": 13, + "column": 73 } } }, "range": [ - 167, - 229 + 295, + 369 ], "loc": { "start": { - "line": 7, + "line": 13, "column": 1 }, "end": { - "line": 7, - "column": 63 + "line": 13, + "column": 75 } }, "leadingComments": [ { "type": "Line", - "value": "assert((n !== null) && (n.parent !== null));", + "value": " assert((node !== null) && (node.parent !== null));", "range": [ - 34, - 80 + 150, + 203 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 1 }, "end": { - "line": 3, - "column": 47 + "line": 9, + "column": 54 } } }, { "type": "Line", - "value": "We only use this function when n HAS a sibling so this case can never", + "value": " We only use this function when node HAS a sibling so this case can never", "range": [ - 82, - 153 + 205, + 280 ], "loc": { "start": { - "line": 4, + "line": 10, "column": 1 }, "end": { - "line": 4, - "column": 72 + "line": 10, + "column": 76 } } }, { "type": "Line", - "value": "happen.", + "value": " happen.", "range": [ - 155, - 164 + 282, + 292 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 1 }, "end": { - "line": 5, - "column": 10 + "line": 11, + "column": 11 } } } @@ -444,16 +444,16 @@ } ], "range": [ - 30, - 232 + 146, + 372 ], "loc": { "start": { - "line": 1, - "column": 30 + "line": 7, + "column": 33 }, "end": { - "line": 9, + "line": 15, "column": 1 } } @@ -461,107 +461,164 @@ "generator": false, "expression": false, "range": [ - 7, - 232 + 120, + 372 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 7 }, "end": { - "line": 9, + "line": 15, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 232 + 113, + 372 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 0 }, "end": { - "line": 9, + "line": 15, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 232 + 113, + 372 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 0 }, "end": { - "line": 9, + "line": 15, "column": 1 } }, "comments": [ + { + "type": "Block", + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 0, + 112 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, { "type": "Line", - "value": "assert((n !== null) && (n.parent !== null));", + "value": " assert((node !== null) && (node.parent !== null));", "range": [ - 34, - 80 + 150, + 203 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 1 }, "end": { - "line": 3, - "column": 47 + "line": 9, + "column": 54 } } }, { "type": "Line", - "value": "We only use this function when n HAS a sibling so this case can never", + "value": " We only use this function when node HAS a sibling so this case can never", "range": [ - 82, - 153 + 205, + 280 ], "loc": { "start": { - "line": 4, + "line": 10, "column": 1 }, "end": { - "line": 4, - "column": 72 + "line": 10, + "column": 76 } } }, { "type": "Line", - "value": "happen.", + "value": " happen.", "range": [ - 155, - 164 + 282, + 292 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 1 }, "end": { - "line": 5, - "column": 10 + "line": 11, + "column": 11 } } } diff --git a/ast/source/family/uncle.js.json b/ast/source/family/uncle.js.json index 654e52a..2dcfa0e 100644 --- a/ast/source/family/uncle.js.json +++ b/ast/source/family/uncle.js.json @@ -90,7 +90,27 @@ "line": 1, "column": 45 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 47, + 204 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -100,16 +120,16 @@ "type": "Identifier", "name": "uncle", "range": [ - 63, - 68 + 221, + 226 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 16 }, "end": { - "line": 3, + "line": 10, "column": 21 } } @@ -117,19 +137,19 @@ "params": [ { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 71, - 72 + 229, + 233 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 24 }, "end": { - "line": 3, - "column": 25 + "line": 10, + "column": 28 } } } @@ -146,16 +166,16 @@ "type": "Identifier", "name": "g", "range": [ - 84, - 85 + 245, + 246 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 7 }, "end": { - "line": 4, + "line": 11, "column": 8 } } @@ -166,16 +186,16 @@ "type": "Identifier", "name": "grandparent", "range": [ - 88, - 99 + 249, + 260 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 11 }, "end": { - "line": 4, + "line": 11, "column": 22 } } @@ -183,67 +203,67 @@ "arguments": [ { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 101, - 102 + 262, + 266 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 24 }, "end": { - "line": 4, - "column": 25 + "line": 11, + "column": 28 } } } ], "range": [ - 88, - 104 + 249, + 268 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 11 }, "end": { - "line": 4, - "column": 27 + "line": 11, + "column": 30 } } }, "range": [ - 84, - 104 + 245, + 268 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 7 }, "end": { - "line": 4, - "column": 27 + "line": 11, + "column": 30 } } } ], "kind": "const", "range": [ - 78, - 105 + 239, + 269 ], "loc": { "start": { - "line": 4, + "line": 11, "column": 1 }, "end": { - "line": 4, - "column": 28 + "line": 11, + "column": 31 } }, "trailingComments": [ @@ -251,16 +271,16 @@ "type": "Line", "value": " assert( g !== null ) ;", "range": [ - 107, - 132 + 271, + 296 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 1 }, "end": { - "line": 5, + "line": 12, "column": 26 } } @@ -269,16 +289,16 @@ "type": "Line", "value": " this can never happen", "range": [ - 134, - 158 + 298, + 322 ], "loc": { "start": { - "line": 6, + "line": 13, "column": 1 }, "end": { - "line": 6, + "line": 13, "column": 25 } } @@ -295,19 +315,19 @@ "computed": false, "object": { "type": "Identifier", - "name": "n", + "name": "node", "range": [ - 165, - 166 + 329, + 333 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 6 }, "end": { - "line": 7, - "column": 7 + "line": 14, + "column": 10 } } }, @@ -315,32 +335,32 @@ "type": "Identifier", "name": "parent", "range": [ - 167, - 173 + 334, + 340 ], "loc": { "start": { - "line": 7, - "column": 8 + "line": 14, + "column": 11 }, "end": { - "line": 7, - "column": 14 + "line": 14, + "column": 17 } } }, "range": [ - 165, - 173 + 329, + 340 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 6 }, "end": { - "line": 7, - "column": 14 + "line": 14, + "column": 17 } } }, @@ -351,17 +371,17 @@ "type": "Identifier", "name": "g", "range": [ - 178, - 179 + 345, + 346 ], "loc": { "start": { - "line": 7, - "column": 19 + "line": 14, + "column": 22 }, "end": { - "line": 7, - "column": 20 + "line": 14, + "column": 23 } } }, @@ -369,47 +389,47 @@ "type": "Identifier", "name": "left", "range": [ - 180, - 184 + 347, + 351 ], "loc": { "start": { - "line": 7, - "column": 21 + "line": 14, + "column": 24 }, "end": { - "line": 7, - "column": 25 + "line": 14, + "column": 28 } } }, "range": [ - 178, - 184 + 345, + 351 ], "loc": { "start": { - "line": 7, - "column": 19 + "line": 14, + "column": 22 }, "end": { - "line": 7, - "column": 25 + "line": 14, + "column": 28 } } }, "range": [ - 165, - 184 + 329, + 351 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 6 }, "end": { - "line": 7, - "column": 25 + "line": 14, + "column": 28 } } }, @@ -429,16 +449,16 @@ "type": "Identifier", "name": "g", "range": [ - 197, - 198 + 364, + 365 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 10 }, "end": { - "line": 8, + "line": 15, "column": 11 } } @@ -447,31 +467,31 @@ "type": "Identifier", "name": "right", "range": [ - 199, - 204 + 366, + 371 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 12 }, "end": { - "line": 8, + "line": 15, "column": 17 } } }, "range": [ - 197, - 204 + 364, + 371 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 10 }, "end": { - "line": 8, + "line": 15, "column": 17 } } @@ -480,47 +500,47 @@ "type": "Identifier", "name": "isleaf", "range": [ - 205, - 211 + 372, + 378 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 18 }, "end": { - "line": 8, + "line": 15, "column": 24 } } }, "range": [ - 197, - 211 + 364, + 378 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 10 }, "end": { - "line": 8, + "line": 15, "column": 24 } } }, "arguments": [], "range": [ - 197, - 214 + 364, + 381 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 10 }, "end": { - "line": 8, + "line": 15, "column": 27 } } @@ -530,16 +550,16 @@ "value": null, "raw": "null", "range": [ - 217, - 221 + 384, + 388 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 30 }, "end": { - "line": 8, + "line": 15, "column": 34 } } @@ -551,16 +571,16 @@ "type": "Identifier", "name": "g", "range": [ - 224, - 225 + 391, + 392 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 37 }, "end": { - "line": 8, + "line": 15, "column": 38 } } @@ -569,61 +589,61 @@ "type": "Identifier", "name": "right", "range": [ - 226, - 231 + 393, + 398 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 39 }, "end": { - "line": 8, + "line": 15, "column": 44 } } }, "range": [ - 224, - 231 + 391, + 398 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 37 }, "end": { - "line": 8, + "line": 15, "column": 44 } } }, "range": [ - 197, - 231 + 364, + 398 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 10 }, "end": { - "line": 8, + "line": 15, "column": 44 } } }, "range": [ - 190, - 233 + 357, + 400 ], "loc": { "start": { - "line": 8, + "line": 15, "column": 3 }, "end": { - "line": 8, + "line": 15, "column": 46 } } @@ -644,16 +664,16 @@ "type": "Identifier", "name": "g", "range": [ - 250, - 251 + 417, + 418 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 10 }, "end": { - "line": 10, + "line": 17, "column": 11 } } @@ -662,31 +682,31 @@ "type": "Identifier", "name": "left", "range": [ - 252, - 256 + 419, + 423 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 12 }, "end": { - "line": 10, + "line": 17, "column": 16 } } }, "range": [ - 250, - 256 + 417, + 423 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 10 }, "end": { - "line": 10, + "line": 17, "column": 16 } } @@ -695,47 +715,47 @@ "type": "Identifier", "name": "isleaf", "range": [ - 257, - 263 + 424, + 430 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 17 }, "end": { - "line": 10, + "line": 17, "column": 23 } } }, "range": [ - 250, - 263 + 417, + 430 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 10 }, "end": { - "line": 10, + "line": 17, "column": 23 } } }, "arguments": [], "range": [ - 250, - 266 + 417, + 433 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 10 }, "end": { - "line": 10, + "line": 17, "column": 26 } } @@ -745,16 +765,16 @@ "value": null, "raw": "null", "range": [ - 269, - 273 + 436, + 440 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 29 }, "end": { - "line": 10, + "line": 17, "column": 33 } } @@ -766,16 +786,16 @@ "type": "Identifier", "name": "g", "range": [ - 276, - 277 + 443, + 444 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 36 }, "end": { - "line": 10, + "line": 17, "column": 37 } } @@ -784,76 +804,76 @@ "type": "Identifier", "name": "left", "range": [ - 278, - 282 + 445, + 449 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 38 }, "end": { - "line": 10, + "line": 17, "column": 42 } } }, "range": [ - 276, - 282 + 443, + 449 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 36 }, "end": { - "line": 10, + "line": 17, "column": 42 } } }, "range": [ - 250, - 282 + 417, + 449 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 10 }, "end": { - "line": 10, + "line": 17, "column": 42 } } }, "range": [ - 243, - 284 + 410, + 451 ], "loc": { "start": { - "line": 10, + "line": 17, "column": 3 }, "end": { - "line": 10, + "line": 17, "column": 44 } } }, "range": [ - 160, - 284 + 324, + 451 ], "loc": { "start": { - "line": 7, + "line": 14, "column": 1 }, "end": { - "line": 10, + "line": 17, "column": 44 } }, @@ -862,16 +882,16 @@ "type": "Line", "value": " assert( g !== null ) ;", "range": [ - 107, - 132 + 271, + 296 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 1 }, "end": { - "line": 5, + "line": 12, "column": 26 } } @@ -880,16 +900,16 @@ "type": "Line", "value": " this can never happen", "range": [ - 134, - 158 + 298, + 322 ], "loc": { "start": { - "line": 6, + "line": 13, "column": 1 }, "end": { - "line": 6, + "line": 13, "column": 25 } } @@ -898,16 +918,16 @@ } ], "range": [ - 75, - 286 + 236, + 453 ], "loc": { "start": { - "line": 3, - "column": 28 + "line": 10, + "column": 31 }, "end": { - "line": 11, + "line": 18, "column": 1 } } @@ -915,44 +935,83 @@ "generator": false, "expression": false, "range": [ - 54, - 286 + 212, + 453 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 7 }, "end": { - "line": 11, + "line": 18, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 47, + 204 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 47, - 286 + 205, + 453 ], "loc": { "start": { - "line": 3, + "line": 10, "column": 0 }, "end": { - "line": 11, + "line": 18, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 47, + 204 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 286 + 453 ], "loc": { "start": { @@ -960,25 +1019,43 @@ "column": 0 }, "end": { - "line": 11, + "line": 18, "column": 1 } }, "comments": [ + { + "type": "Block", + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "range": [ + 47, + 204 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, { "type": "Line", "value": " assert( g !== null ) ;", "range": [ - 107, - 132 + 271, + 296 ], "loc": { "start": { - "line": 5, + "line": 12, "column": 1 }, "end": { - "line": 5, + "line": 12, "column": 26 } } @@ -987,16 +1064,16 @@ "type": "Line", "value": " this can never happen", "range": [ - 134, - 158 + 298, + 322 ], "loc": { "start": { - "line": 6, + "line": 13, "column": 1 }, "end": { - "line": 6, + "line": 13, "column": 25 } } diff --git a/ast/source/index.js.json b/ast/source/index.js.json index 907da0b..a3b1a49 100644 --- a/ast/source/index.js.json +++ b/ast/source/index.js.json @@ -113,11 +113,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./family", - "raw": "'./family'", + "value": "./deletion", + "raw": "'./deletion'", "range": [ 90, - 100 + 102 ], "loc": { "start": { @@ -126,13 +126,13 @@ }, "end": { "line": 4, - "column": 24 + "column": 26 } } }, "range": [ 76, - 102 + 104 ], "loc": { "start": { @@ -141,7 +141,7 @@ }, "end": { "line": 4, - "column": 26 + "column": 28 } } }, @@ -149,11 +149,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./insertion", - "raw": "'./insertion'", + "value": "./family", + "raw": "'./family'", "range": [ - 117, - 130 + 119, + 129 ], "loc": { "start": { @@ -162,13 +162,13 @@ }, "end": { "line": 5, - "column": 27 + "column": 24 } } }, "range": [ - 103, - 132 + 105, + 131 ], "loc": { "start": { @@ -177,7 +177,7 @@ }, "end": { "line": 5, - "column": 29 + "column": 26 } } }, @@ -185,11 +185,11 @@ "type": "ExportAllDeclaration", "source": { "type": "Literal", - "value": "./removal", - "raw": "'./removal'", + "value": "./insertion", + "raw": "'./insertion'", "range": [ - 147, - 158 + 146, + 159 ], "loc": { "start": { @@ -198,13 +198,13 @@ }, "end": { "line": 6, - "column": 25 + "column": 27 } } }, "range": [ - 133, - 160 + 132, + 161 ], "loc": { "start": { @@ -213,7 +213,7 @@ }, "end": { "line": 6, - "column": 27 + "column": 29 } } }, @@ -224,8 +224,8 @@ "value": "./rotate", "raw": "'./rotate'", "range": [ - 175, - 185 + 176, + 186 ], "loc": { "start": { @@ -239,8 +239,8 @@ } }, "range": [ - 161, - 187 + 162, + 188 ], "loc": { "start": { @@ -260,8 +260,8 @@ "value": "./search", "raw": "'./search'", "range": [ - 202, - 212 + 203, + 213 ], "loc": { "start": { @@ -275,8 +275,8 @@ } }, "range": [ - 188, - 214 + 189, + 215 ], "loc": { "start": { @@ -296,8 +296,8 @@ "value": "./traversal", "raw": "'./traversal'", "range": [ - 229, - 242 + 230, + 243 ], "loc": { "start": { @@ -311,8 +311,8 @@ } }, "range": [ - 215, - 244 + 216, + 245 ], "loc": { "start": { @@ -329,7 +329,7 @@ "sourceType": "module", "range": [ 0, - 244 + 245 ], "loc": { "start": { diff --git a/ast/source/insertion/insert.js.json b/ast/source/insertion/insert.js.json index daab706..6183171 100644 --- a/ast/source/insertion/insert.js.json +++ b/ast/source/insertion/insert.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "insert", "range": [ - 17, - 23 + 806, + 812 ], "loc": { "start": { - "line": 2, + "line": 18, "column": 16 }, "end": { - "line": 2, + "line": 18, "column": 22 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "compare", "range": [ - 26, - 33 + 815, + 822 ], "loc": { "start": { - "line": 2, + "line": 18, "column": 25 }, "end": { - "line": 2, + "line": 18, "column": 32 } } @@ -46,16 +46,16 @@ "type": "Identifier", "name": "A", "range": [ - 35, - 36 + 824, + 825 ], "loc": { "start": { - "line": 2, + "line": 18, "column": 34 }, "end": { - "line": 2, + "line": 18, "column": 35 } } @@ -64,16 +64,16 @@ "type": "Identifier", "name": "B", "range": [ - 38, - 39 + 827, + 828 ], "loc": { "start": { - "line": 2, + "line": 18, "column": 37 }, "end": { - "line": 2, + "line": 18, "column": 38 } } @@ -89,16 +89,16 @@ "value": true, "raw": "true", "range": [ - 54, - 58 + 843, + 847 ], "loc": { "start": { - "line": 4, + "line": 20, "column": 9 }, "end": { - "line": 4, + "line": 20, "column": 13 } } @@ -117,16 +117,16 @@ "type": "Identifier", "name": "compare", "range": [ - 71, - 78 + 860, + 867 ], "loc": { "start": { - "line": 6, + "line": 22, "column": 7 }, "end": { - "line": 6, + "line": 22, "column": 14 } } @@ -139,50 +139,50 @@ "type": "Identifier", "name": "B", "range": [ - 80, - 81 + 869, + 870 ], "loc": { "start": { - "line": 6, + "line": 22, "column": 16 }, "end": { - "line": 6, + "line": 22, "column": 17 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 82, - 87 + 871, + 874 ], "loc": { "start": { - "line": 6, + "line": 22, "column": 18 }, "end": { - "line": 6, - "column": 23 + "line": 22, + "column": 21 } } }, "range": [ - 80, - 87 + 869, + 874 ], "loc": { "start": { - "line": 6, + "line": 22, "column": 16 }, "end": { - "line": 6, - "column": 23 + "line": 22, + "column": 21 } } }, @@ -193,66 +193,66 @@ "type": "Identifier", "name": "A", "range": [ - 89, - 90 + 876, + 877 ], "loc": { "start": { - "line": 6, - "column": 25 + "line": 22, + "column": 23 }, "end": { - "line": 6, - "column": 26 + "line": 22, + "column": 24 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 91, - 96 + 878, + 881 ], "loc": { "start": { - "line": 6, - "column": 27 + "line": 22, + "column": 25 }, "end": { - "line": 6, - "column": 32 + "line": 22, + "column": 28 } } }, "range": [ - 89, - 96 + 876, + 881 ], "loc": { "start": { - "line": 6, - "column": 25 + "line": 22, + "column": 23 }, "end": { - "line": 6, - "column": 32 + "line": 22, + "column": 28 } } } ], "range": [ - 71, - 98 + 860, + 883 ], "loc": { "start": { - "line": 6, + "line": 22, "column": 7 }, "end": { - "line": 6, - "column": 34 + "line": 22, + "column": 30 } } }, @@ -261,32 +261,32 @@ "value": 0, "raw": "0", "range": [ - 101, - 102 + 886, + 887 ], "loc": { "start": { - "line": 6, - "column": 37 + "line": 22, + "column": 33 }, "end": { - "line": 6, - "column": 38 + "line": 22, + "column": 34 } } }, "range": [ - 71, - 102 + 860, + 887 ], "loc": { "start": { - "line": 6, + "line": 22, "column": 7 }, "end": { - "line": 6, - "column": 38 + "line": 22, + "column": 34 } } }, @@ -302,16 +302,16 @@ "type": "Identifier", "name": "node", "range": [ - 117, - 121 + 902, + 906 ], "loc": { "start": { - "line": 8, + "line": 24, "column": 9 }, "end": { - "line": 8, + "line": 24, "column": 13 } } @@ -323,16 +323,16 @@ "type": "Identifier", "name": "A", "range": [ - 124, - 125 + 909, + 910 ], "loc": { "start": { - "line": 8, + "line": 24, "column": 16 }, "end": { - "line": 8, + "line": 24, "column": 17 } } @@ -341,46 +341,46 @@ "type": "Identifier", "name": "left", "range": [ - 126, - 130 + 911, + 915 ], "loc": { "start": { - "line": 8, + "line": 24, "column": 18 }, "end": { - "line": 8, + "line": 24, "column": 22 } } }, "range": [ - 124, - 130 + 909, + 915 ], "loc": { "start": { - "line": 8, + "line": 24, "column": 16 }, "end": { - "line": 8, + "line": 24, "column": 22 } } }, "range": [ - 117, - 130 + 902, + 915 ], "loc": { "start": { - "line": 8, + "line": 24, "column": 9 }, "end": { - "line": 8, + "line": 24, "column": 22 } } @@ -388,16 +388,16 @@ ], "kind": "const", "range": [ - 111, - 131 + 896, + 916 ], "loc": { "start": { - "line": 8, + "line": 24, "column": 3 }, "end": { - "line": 8, + "line": 24, "column": 23 } } @@ -413,16 +413,16 @@ "type": "Identifier", "name": "node", "range": [ - 141, - 145 + 926, + 930 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 8 }, "end": { - "line": 10, + "line": 26, "column": 12 } } @@ -431,47 +431,47 @@ "type": "Identifier", "name": "isleaf", "range": [ - 146, - 152 + 931, + 937 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 13 }, "end": { - "line": 10, + "line": 26, "column": 19 } } }, "range": [ - 141, - 152 + 926, + 937 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 8 }, "end": { - "line": 10, + "line": 26, "column": 19 } } }, "arguments": [], "range": [ - 141, - 154 + 926, + 939 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 8 }, "end": { - "line": 10, + "line": 26, "column": 21 } } @@ -491,16 +491,16 @@ "type": "Identifier", "name": "A", "range": [ - 163, - 164 + 948, + 949 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 4 }, "end": { - "line": 11, + "line": 27, "column": 5 } } @@ -509,31 +509,31 @@ "type": "Identifier", "name": "left", "range": [ - 165, - 169 + 950, + 954 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 6 }, "end": { - "line": 11, + "line": 27, "column": 10 } } }, "range": [ - 163, - 169 + 948, + 954 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 4 }, "end": { - "line": 11, + "line": 27, "column": 10 } } @@ -542,46 +542,46 @@ "type": "Identifier", "name": "B", "range": [ - 172, - 173 + 957, + 958 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 13 }, "end": { - "line": 11, + "line": 27, "column": 14 } } }, "range": [ - 163, - 173 + 948, + 958 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 4 }, "end": { - "line": 11, + "line": 27, "column": 14 } } }, "range": [ - 163, - 174 + 948, + 959 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 4 }, "end": { - "line": 11, + "line": 27, "column": 15 } } @@ -590,48 +590,48 @@ "type": "BreakStatement", "label": null, "range": [ - 179, - 185 + 964, + 970 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 4 }, "end": { - "line": 12, + "line": 28, "column": 10 } } } ], "range": [ - 157, - 190 + 942, + 975 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 24 }, "end": { - "line": 13, + "line": 29, "column": 4 } } }, "alternate": null, "range": [ - 136, - 190 + 921, + 975 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 3 }, "end": { - "line": 13, + "line": 29, "column": 4 } } @@ -645,16 +645,16 @@ "type": "Identifier", "name": "A", "range": [ - 195, - 196 + 980, + 981 ], "loc": { "start": { - "line": 15, + "line": 31, "column": 3 }, "end": { - "line": 15, + "line": 31, "column": 4 } } @@ -663,62 +663,62 @@ "type": "Identifier", "name": "node", "range": [ - 199, - 203 + 984, + 988 ], "loc": { "start": { - "line": 15, + "line": 31, "column": 7 }, "end": { - "line": 15, + "line": 31, "column": 11 } } }, "range": [ - 195, - 203 + 980, + 988 ], "loc": { "start": { - "line": 15, + "line": 31, "column": 3 }, "end": { - "line": 15, + "line": 31, "column": 11 } } }, "range": [ - 195, - 204 + 980, + 989 ], "loc": { "start": { - "line": 15, + "line": 31, "column": 3 }, "end": { - "line": 15, + "line": 31, "column": 12 } } } ], "range": [ - 105, - 209 + 890, + 994 ], "loc": { "start": { - "line": 6, - "column": 41 + "line": 22, + "column": 37 }, "end": { - "line": 17, + "line": 33, "column": 3 } } @@ -735,16 +735,16 @@ "type": "Identifier", "name": "node", "range": [ - 230, - 234 + 1015, + 1019 ], "loc": { "start": { - "line": 21, + "line": 37, "column": 9 }, "end": { - "line": 21, + "line": 37, "column": 13 } } @@ -756,16 +756,16 @@ "type": "Identifier", "name": "A", "range": [ - 237, - 238 + 1022, + 1023 ], "loc": { "start": { - "line": 21, + "line": 37, "column": 16 }, "end": { - "line": 21, + "line": 37, "column": 17 } } @@ -774,46 +774,46 @@ "type": "Identifier", "name": "right", "range": [ - 239, - 244 + 1024, + 1029 ], "loc": { "start": { - "line": 21, + "line": 37, "column": 18 }, "end": { - "line": 21, + "line": 37, "column": 23 } } }, "range": [ - 237, - 244 + 1022, + 1029 ], "loc": { "start": { - "line": 21, + "line": 37, "column": 16 }, "end": { - "line": 21, + "line": 37, "column": 23 } } }, "range": [ - 230, - 244 + 1015, + 1029 ], "loc": { "start": { - "line": 21, + "line": 37, "column": 9 }, "end": { - "line": 21, + "line": 37, "column": 23 } } @@ -821,16 +821,16 @@ ], "kind": "const", "range": [ - 224, - 245 + 1009, + 1030 ], "loc": { "start": { - "line": 21, + "line": 37, "column": 3 }, "end": { - "line": 21, + "line": 37, "column": 24 } } @@ -846,16 +846,16 @@ "type": "Identifier", "name": "node", "range": [ - 255, - 259 + 1040, + 1044 ], "loc": { "start": { - "line": 23, + "line": 39, "column": 8 }, "end": { - "line": 23, + "line": 39, "column": 12 } } @@ -864,47 +864,47 @@ "type": "Identifier", "name": "isleaf", "range": [ - 260, - 266 + 1045, + 1051 ], "loc": { "start": { - "line": 23, + "line": 39, "column": 13 }, "end": { - "line": 23, + "line": 39, "column": 19 } } }, "range": [ - 255, - 266 + 1040, + 1051 ], "loc": { "start": { - "line": 23, + "line": 39, "column": 8 }, "end": { - "line": 23, + "line": 39, "column": 19 } } }, "arguments": [], "range": [ - 255, - 268 + 1040, + 1053 ], "loc": { "start": { - "line": 23, + "line": 39, "column": 8 }, "end": { - "line": 23, + "line": 39, "column": 21 } } @@ -924,16 +924,16 @@ "type": "Identifier", "name": "A", "range": [ - 277, - 278 + 1062, + 1063 ], "loc": { "start": { - "line": 24, + "line": 40, "column": 4 }, "end": { - "line": 24, + "line": 40, "column": 5 } } @@ -942,31 +942,31 @@ "type": "Identifier", "name": "right", "range": [ - 279, - 284 + 1064, + 1069 ], "loc": { "start": { - "line": 24, + "line": 40, "column": 6 }, "end": { - "line": 24, + "line": 40, "column": 11 } } }, "range": [ - 277, - 284 + 1062, + 1069 ], "loc": { "start": { - "line": 24, + "line": 40, "column": 4 }, "end": { - "line": 24, + "line": 40, "column": 11 } } @@ -975,46 +975,46 @@ "type": "Identifier", "name": "B", "range": [ - 287, - 288 + 1072, + 1073 ], "loc": { "start": { - "line": 24, + "line": 40, "column": 14 }, "end": { - "line": 24, + "line": 40, "column": 15 } } }, "range": [ - 277, - 288 + 1062, + 1073 ], "loc": { "start": { - "line": 24, + "line": 40, "column": 4 }, "end": { - "line": 24, + "line": 40, "column": 15 } } }, "range": [ - 277, - 289 + 1062, + 1074 ], "loc": { "start": { - "line": 24, + "line": 40, "column": 4 }, "end": { - "line": 24, + "line": 40, "column": 16 } } @@ -1023,48 +1023,48 @@ "type": "BreakStatement", "label": null, "range": [ - 294, - 300 + 1079, + 1085 ], "loc": { "start": { - "line": 25, + "line": 41, "column": 4 }, "end": { - "line": 25, + "line": 41, "column": 10 } } } ], "range": [ - 271, - 305 + 1056, + 1090 ], "loc": { "start": { - "line": 23, + "line": 39, "column": 24 }, "end": { - "line": 26, + "line": 42, "column": 4 } } }, "alternate": null, "range": [ - 250, - 305 + 1035, + 1090 ], "loc": { "start": { - "line": 23, + "line": 39, "column": 3 }, "end": { - "line": 26, + "line": 42, "column": 4 } } @@ -1078,16 +1078,16 @@ "type": "Identifier", "name": "A", "range": [ - 310, - 311 + 1095, + 1096 ], "loc": { "start": { - "line": 28, + "line": 44, "column": 3 }, "end": { - "line": 28, + "line": 44, "column": 4 } } @@ -1096,108 +1096,108 @@ "type": "Identifier", "name": "node", "range": [ - 314, - 318 + 1099, + 1103 ], "loc": { "start": { - "line": 28, + "line": 44, "column": 7 }, "end": { - "line": 28, + "line": 44, "column": 11 } } }, "range": [ - 310, - 318 + 1095, + 1103 ], "loc": { "start": { - "line": 28, + "line": 44, "column": 3 }, "end": { - "line": 28, + "line": 44, "column": 11 } } }, "range": [ - 310, - 319 + 1095, + 1104 ], "loc": { "start": { - "line": 28, + "line": 44, "column": 3 }, "end": { - "line": 28, + "line": 44, "column": 12 } } } ], "range": [ - 218, - 324 + 1003, + 1109 ], "loc": { "start": { - "line": 19, + "line": 35, "column": 7 }, "end": { - "line": 30, + "line": 46, "column": 3 } } }, "range": [ - 66, - 324 + 855, + 1109 ], "loc": { "start": { - "line": 6, + "line": 22, "column": 2 }, "end": { - "line": 30, + "line": 46, "column": 3 } } } ], "range": [ - 61, - 328 + 850, + 1113 ], "loc": { "start": { - "line": 4, + "line": 20, "column": 16 }, "end": { - "line": 32, + "line": 48, "column": 2 } } }, "range": [ - 46, - 328 + 835, + 1113 ], "loc": { "start": { - "line": 4, + "line": 20, "column": 1 }, "end": { - "line": 32, + "line": 48, "column": 2 } } @@ -1214,16 +1214,16 @@ "type": "Identifier", "name": "B", "range": [ - 331, - 332 + 1116, + 1117 ], "loc": { "start": { - "line": 34, + "line": 50, "column": 1 }, "end": { - "line": 34, + "line": 50, "column": 2 } } @@ -1232,31 +1232,31 @@ "type": "Identifier", "name": "parent", "range": [ - 333, - 339 + 1118, + 1124 ], "loc": { "start": { - "line": 34, + "line": 50, "column": 3 }, "end": { - "line": 34, + "line": 50, "column": 9 } } }, "range": [ - 331, - 339 + 1116, + 1124 ], "loc": { "start": { - "line": 34, + "line": 50, "column": 1 }, "end": { - "line": 34, + "line": 50, "column": 9 } } @@ -1265,46 +1265,46 @@ "type": "Identifier", "name": "A", "range": [ - 342, - 343 + 1127, + 1128 ], "loc": { "start": { - "line": 34, + "line": 50, "column": 12 }, "end": { - "line": 34, + "line": 50, "column": 13 } } }, "range": [ - 331, - 343 + 1116, + 1128 ], "loc": { "start": { - "line": 34, + "line": 50, "column": 1 }, "end": { - "line": 34, + "line": 50, "column": 13 } } }, "range": [ - 331, - 344 + 1116, + 1129 ], "loc": { "start": { - "line": 34, + "line": 50, "column": 1 }, "end": { - "line": 34, + "line": 50, "column": 14 } } @@ -1315,47 +1315,47 @@ "type": "Identifier", "name": "B", "range": [ - 354, - 355 + 1139, + 1140 ], "loc": { "start": { - "line": 36, + "line": 52, "column": 8 }, "end": { - "line": 36, + "line": 52, "column": 9 } } }, "range": [ - 347, - 356 + 1132, + 1141 ], "loc": { "start": { - "line": 36, + "line": 52, "column": 1 }, "end": { - "line": 36, + "line": 52, "column": 10 } } } ], "range": [ - 42, - 359 + 831, + 1144 ], "loc": { "start": { - "line": 2, + "line": 18, "column": 41 }, "end": { - "line": 38, + "line": 54, "column": 1 } } @@ -1363,54 +1363,112 @@ "generator": false, "expression": false, "range": [ - 8, - 359 + 797, + 1144 ], "loc": { "start": { - "line": 2, + "line": 18, "column": 7 }, "end": { - "line": 38, + "line": 54, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "range": [ + 1, + 789 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 1, - 359 + 790, + 1144 ], "loc": { "start": { - "line": 2, + "line": 18, "column": 0 }, "end": { - "line": 38, + "line": 54, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "range": [ + 1, + 789 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 1, - 359 + 790, + 1144 ], "loc": { "start": { - "line": 2, + "line": 18, "column": 0 }, "end": { - "line": 38, + "line": 54, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "range": [ + 1, + 789 + ], + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/insertion/insert_case1.js.json b/ast/source/insertion/insert_case1.js.json index 69b5607..b18a2ad 100644 --- a/ast/source/insertion/insert_case1.js.json +++ b/ast/source/insertion/insert_case1.js.json @@ -10,16 +10,16 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -28,31 +28,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } }, "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -63,31 +63,31 @@ "value": "..", "raw": "'..'", "range": [ - 23, - 27 + 22, + 26 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 22 }, "end": { - "line": 2, + "line": 1, "column": 26 } } }, "range": [ - 1, - 29 + 0, + 28 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 2, + "line": 1, "column": 28 } } @@ -101,16 +101,16 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 39, - 51 + 38, + 50 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 9 }, "end": { - "line": 3, + "line": 2, "column": 21 } } @@ -119,31 +119,31 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 39, - 51 + 38, + 50 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 9 }, "end": { - "line": 3, + "line": 2, "column": 21 } } }, "range": [ - 39, - 51 + 38, + 50 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 9 }, "end": { - "line": 3, + "line": 2, "column": 21 } } @@ -154,34 +154,54 @@ "value": "./insert_case2", "raw": "'./insert_case2'", "range": [ - 59, - 75 + 58, + 74 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 29 }, "end": { - "line": 3, + "line": 2, "column": 45 } } }, "range": [ - 30, - 77 + 29, + 76 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 0 }, "end": { - "line": 3, + "line": 2, "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 78, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -191,16 +211,16 @@ "type": "Identifier", "name": "insert_case1", "range": [ - 95, - 107 + 177, + 189 ], "loc": { "start": { - "line": 5, + "line": 10, "column": 16 }, "end": { - "line": 5, + "line": 10, "column": 28 } } @@ -210,17 +230,17 @@ "type": "Identifier", "name": "n", "range": [ - 108, - 109 + 192, + 193 ], "loc": { "start": { - "line": 5, - "column": 29 + "line": 10, + "column": 31 }, "end": { - "line": 5, - "column": 30 + "line": 10, + "column": 32 } } } @@ -240,17 +260,17 @@ "type": "Identifier", "name": "n", "range": [ - 118, - 119 + 324, + 325 ], "loc": { "start": { - "line": 7, - "column": 5 + "line": 19, + "column": 6 }, "end": { - "line": 7, - "column": 6 + "line": 19, + "column": 7 } } }, @@ -258,32 +278,32 @@ "type": "Identifier", "name": "parent", "range": [ - 120, - 126 + 326, + 332 ], "loc": { "start": { - "line": 7, - "column": 7 + "line": 19, + "column": 8 }, "end": { - "line": 7, - "column": 13 + "line": 19, + "column": 14 } } }, "range": [ - 118, - 126 + 324, + 332 ], "loc": { "start": { - "line": 7, - "column": 5 + "line": 19, + "column": 6 }, "end": { - "line": 7, - "column": 13 + "line": 19, + "column": 14 } } }, @@ -292,32 +312,32 @@ "value": null, "raw": "null", "range": [ - 131, - 135 + 337, + 341 ], "loc": { "start": { - "line": 7, - "column": 18 + "line": 19, + "column": 19 }, "end": { - "line": 7, - "column": 22 + "line": 19, + "column": 23 } } }, "range": [ - 118, - 135 + 324, + 341 ], "loc": { "start": { - "line": 7, - "column": 5 + "line": 19, + "column": 6 }, "end": { - "line": 7, - "column": 22 + "line": 19, + "column": 23 } } }, @@ -333,17 +353,17 @@ "type": "Identifier", "name": "n", "range": [ - 139, - 140 + 344, + 345 ], "loc": { "start": { - "line": 8, - "column": 2 + "line": 19, + "column": 26 }, "end": { - "line": 8, - "column": 3 + "line": 19, + "column": 27 } } }, @@ -351,32 +371,32 @@ "type": "Identifier", "name": "color", "range": [ - 141, - 146 + 346, + 351 ], "loc": { "start": { - "line": 8, - "column": 4 + "line": 19, + "column": 28 }, "end": { - "line": 8, - "column": 9 + "line": 19, + "column": 33 } } }, "range": [ - 139, - 146 + 344, + 351 ], "loc": { "start": { - "line": 8, - "column": 2 + "line": 19, + "column": 26 }, "end": { - "line": 8, - "column": 9 + "line": 19, + "column": 33 } } }, @@ -384,47 +404,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 149, - 154 + 354, + 359 ], "loc": { "start": { - "line": 8, - "column": 12 + "line": 19, + "column": 36 }, "end": { - "line": 8, - "column": 17 + "line": 19, + "column": 41 } } }, "range": [ - 139, - 154 + 344, + 359 ], "loc": { "start": { - "line": 8, - "column": 2 + "line": 19, + "column": 26 }, "end": { - "line": 8, - "column": 17 + "line": 19, + "column": 41 } } }, "range": [ - 139, - 155 + 344, + 361 ], "loc": { "start": { - "line": 8, - "column": 2 + "line": 19, + "column": 26 }, "end": { - "line": 8, - "column": 18 + "line": 19, + "column": 43 } } }, @@ -436,17 +456,17 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 164, - 176 + 369, + 381 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 21, + "column": 6 }, "end": { - "line": 10, - "column": 14 + "line": 21, + "column": 18 } } }, @@ -455,78 +475,98 @@ "type": "Identifier", "name": "n", "range": [ - 177, - 178 + 383, + 384 ], "loc": { "start": { - "line": 10, - "column": 15 + "line": 21, + "column": 20 }, "end": { - "line": 10, - "column": 16 + "line": 21, + "column": 21 } } } ], "range": [ - 164, - 179 + 369, + 386 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 21, + "column": 6 }, "end": { - "line": 10, - "column": 17 + "line": 21, + "column": 23 } } }, "range": [ - 164, - 180 + 369, + 388 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 21, + "column": 6 }, "end": { - "line": 10, - "column": 18 + "line": 21, + "column": 25 } } }, "range": [ - 114, - 180 + 319, + 388 ], "loc": { "start": { - "line": 7, + "line": 19, "column": 1 }, "end": { - "line": 10, - "column": 18 + "line": 21, + "column": 25 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "range": [ + 200, + 317 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 18, + "column": 4 + } + } + } + ] } ], "range": [ - 111, - 182 + 196, + 391 ], "loc": { "start": { - "line": 6, - "column": 0 + "line": 10, + "column": 35 }, "end": { - "line": 11, + "line": 23, "column": 1 } } @@ -534,54 +574,130 @@ "generator": false, "expression": false, "range": [ - 86, - 182 + 168, + 391 ], "loc": { "start": { - "line": 5, + "line": 10, "column": 7 }, "end": { - "line": 11, + "line": 23, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 78, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 79, - 182 + 161, + 391 ], "loc": { "start": { - "line": 5, + "line": 10, "column": 0 }, "end": { - "line": 11, + "line": 23, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 78, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 1, - 182 + 0, + 391 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 11, + "line": 23, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 78, + 160 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "range": [ + 200, + 317 + ], + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 18, + "column": 4 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/insertion/insert_case2.js.json b/ast/source/insertion/insert_case2.js.json index 7d4a7e8..330a638 100644 --- a/ast/source/insertion/insert_case2.js.json +++ b/ast/source/insertion/insert_case2.js.json @@ -10,16 +10,16 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -28,31 +28,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } }, "range": [ - 10, - 15 + 9, + 14 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 14 } } @@ -63,31 +63,31 @@ "value": "..", "raw": "'..'", "range": [ - 23, - 27 + 22, + 26 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 22 }, "end": { - "line": 2, + "line": 1, "column": 26 } } }, "range": [ - 1, - 29 + 0, + 28 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 2, + "line": 1, "column": 28 } } @@ -101,16 +101,16 @@ "type": "Identifier", "name": "insert_case3", "range": [ - 39, - 51 + 38, + 50 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 9 }, "end": { - "line": 3, + "line": 2, "column": 21 } } @@ -119,31 +119,31 @@ "type": "Identifier", "name": "insert_case3", "range": [ - 39, - 51 + 38, + 50 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 9 }, "end": { - "line": 3, + "line": 2, "column": 21 } } }, "range": [ - 39, - 51 + 38, + 50 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 9 }, "end": { - "line": 3, + "line": 2, "column": 21 } } @@ -154,34 +154,54 @@ "value": "./insert_case3", "raw": "'./insert_case3'", "range": [ - 59, - 75 + 58, + 74 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 29 }, "end": { - "line": 3, + "line": 2, "column": 45 } } }, "range": [ - 30, - 77 + 29, + 76 ], "loc": { "start": { - "line": 3, + "line": 2, "column": 0 }, "end": { - "line": 3, + "line": 2, "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 78, + 198 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -191,16 +211,16 @@ "type": "Identifier", "name": "insert_case2", "range": [ - 95, - 107 + 215, + 227 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 16 }, "end": { - "line": 5, + "line": 11, "column": 28 } } @@ -210,17 +230,17 @@ "type": "Identifier", "name": "n", "range": [ - 108, - 109 + 230, + 231 ], "loc": { "start": { - "line": 5, - "column": 29 + "line": 11, + "column": 31 }, "end": { - "line": 5, - "column": 30 + "line": 11, + "column": 32 } } } @@ -243,17 +263,17 @@ "type": "Identifier", "name": "n", "range": [ - 118, - 119 + 389, + 390 ], "loc": { "start": { - "line": 7, - "column": 5 + "line": 22, + "column": 6 }, "end": { - "line": 7, - "column": 6 + "line": 22, + "column": 7 } } }, @@ -261,32 +281,32 @@ "type": "Identifier", "name": "parent", "range": [ - 120, - 126 + 391, + 397 ], "loc": { "start": { - "line": 7, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 7, - "column": 13 + "line": 22, + "column": 14 } } }, "range": [ - 118, - 126 + 389, + 397 ], "loc": { "start": { - "line": 7, - "column": 5 + "line": 22, + "column": 6 }, "end": { - "line": 7, - "column": 13 + "line": 22, + "column": 14 } } }, @@ -294,32 +314,32 @@ "type": "Identifier", "name": "color", "range": [ - 127, - 132 + 398, + 403 ], "loc": { "start": { - "line": 7, - "column": 14 + "line": 22, + "column": 15 }, "end": { - "line": 7, - "column": 19 + "line": 22, + "column": 20 } } }, "range": [ - 118, - 132 + 389, + 403 ], "loc": { "start": { - "line": 7, - "column": 5 + "line": 22, + "column": 6 }, "end": { - "line": 7, - "column": 19 + "line": 22, + "column": 20 } } }, @@ -327,32 +347,32 @@ "type": "Identifier", "name": "BLACK", "range": [ - 137, - 142 + 408, + 413 ], "loc": { "start": { - "line": 7, - "column": 24 + "line": 22, + "column": 25 }, "end": { - "line": 7, - "column": 29 + "line": 22, + "column": 30 } } }, "range": [ - 118, - 142 + 389, + 413 ], "loc": { "start": { - "line": 7, - "column": 5 + "line": 22, + "column": 6 }, "end": { - "line": 7, - "column": 29 + "line": 22, + "column": 30 } } }, @@ -360,39 +380,19 @@ "type": "ReturnStatement", "argument": null, "range": [ - 146, - 153 + 416, + 424 ], "loc": { "start": { - "line": 8, - "column": 2 + "line": 22, + "column": 33 }, "end": { - "line": 8, - "column": 9 - } - }, - "trailingComments": [ - { - "type": "Block", - "value": " Tree is still valid ", - "range": [ - 154, - 179 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 35 - } - } + "line": 22, + "column": 41 } - ] + } }, "alternate": { "type": "ExpressionStatement", @@ -402,17 +402,17 @@ "type": "Identifier", "name": "insert_case3", "range": [ - 188, - 200 + 432, + 444 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 24, + "column": 6 }, "end": { - "line": 10, - "column": 14 + "line": 24, + "column": 18 } } }, @@ -421,98 +421,98 @@ "type": "Identifier", "name": "n", "range": [ - 201, - 202 + 446, + 447 ], "loc": { "start": { - "line": 10, - "column": 15 + "line": 24, + "column": 20 }, "end": { - "line": 10, - "column": 16 + "line": 24, + "column": 21 } } } ], "range": [ - 188, - 203 + 432, + 449 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 24, + "column": 6 }, "end": { - "line": 10, - "column": 17 + "line": 24, + "column": 23 } } }, "range": [ - 188, - 204 + 432, + 451 ], "loc": { "start": { - "line": 10, - "column": 2 + "line": 24, + "column": 6 }, "end": { - "line": 10, - "column": 18 + "line": 24, + "column": 25 } - }, - "leadingComments": [ - { - "type": "Block", - "value": " Tree is still valid ", - "range": [ - 154, - 179 - ], - "loc": { - "start": { - "line": 8, - "column": 10 - }, - "end": { - "line": 8, - "column": 35 - } - } - } - ] + } }, "range": [ - 114, - 204 + 384, + 451 ], "loc": { "start": { - "line": 7, + "line": 22, "column": 1 }, "end": { - "line": 10, - "column": 18 + "line": 24, + "column": 25 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "range": [ + 238, + 382 + ], + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 21, + "column": 4 + } + } + } + ] } ], "range": [ - 111, - 206 + 234, + 454 ], "loc": { "start": { - "line": 6, - "column": 0 + "line": 11, + "column": 35 }, "end": { - "line": 11, + "line": 26, "column": 1 } } @@ -520,71 +520,128 @@ "generator": false, "expression": false, "range": [ - 86, - 206 + 206, + 454 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 7 }, "end": { - "line": 11, + "line": 26, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 78, + 198 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 79, - 206 + 199, + 454 ], "loc": { "start": { - "line": 5, + "line": 11, "column": 0 }, "end": { - "line": 11, + "line": 26, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 78, + 198 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 1, - 206 + 0, + 454 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 11, + "line": 26, "column": 1 } }, "comments": [ { "type": "Block", - "value": " Tree is still valid ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 78, + 198 + ], + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", "range": [ - 154, - 179 + 238, + 382 ], "loc": { "start": { - "line": 8, - "column": 10 + "line": 13, + "column": 1 }, "end": { - "line": 8, - "column": 35 + "line": 21, + "column": 4 } } } diff --git a/ast/source/insertion/insert_case3.js.json b/ast/source/insertion/insert_case3.js.json index a22765f..939d622 100644 --- a/ast/source/insertion/insert_case3.js.json +++ b/ast/source/insertion/insert_case3.js.json @@ -431,7 +431,27 @@ "line": 3, "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 154, + 300 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -441,16 +461,16 @@ "type": "Identifier", "name": "insert_case3", "range": [ - 170, - 182 + 317, + 329 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 16 }, "end": { - "line": 5, + "line": 13, "column": 28 } } @@ -460,17 +480,17 @@ "type": "Identifier", "name": "n", "range": [ - 183, - 184 + 332, + 333 ], "loc": { "start": { - "line": 5, - "column": 29 + "line": 13, + "column": 31 }, "end": { - "line": 5, - "column": 30 + "line": 13, + "column": 32 } } } @@ -487,16 +507,16 @@ "type": "Identifier", "name": "u", "range": [ - 195, - 196 + 346, + 347 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 7 }, "end": { - "line": 7, + "line": 15, "column": 8 } } @@ -507,16 +527,16 @@ "type": "Identifier", "name": "uncle", "range": [ - 199, - 204 + 350, + 355 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 11 }, "end": { - "line": 7, + "line": 15, "column": 16 } } @@ -526,67 +546,87 @@ "type": "Identifier", "name": "n", "range": [ - 205, - 206 + 357, + 358 ], "loc": { "start": { - "line": 7, - "column": 17 + "line": 15, + "column": 18 }, "end": { - "line": 7, - "column": 18 + "line": 15, + "column": 19 } } } ], "range": [ - 199, - 207 + 350, + 360 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 11 }, "end": { - "line": 7, - "column": 19 + "line": 15, + "column": 21 } } }, "range": [ - 195, - 207 + 346, + 360 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 7 }, "end": { - "line": 7, - "column": 19 + "line": 15, + "column": 21 } } } ], "kind": "const", "range": [ - 189, - 208 + 340, + 362 ], "loc": { "start": { - "line": 7, + "line": 15, "column": 1 }, "end": { - "line": 7, - "column": 20 + "line": 15, + "column": 23 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "range": [ + 365, + 860 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 29, + "column": 4 + } + } + } + ] }, { "type": "IfStatement", @@ -600,17 +640,17 @@ "type": "Identifier", "name": "u", "range": [ - 216, - 217 + 871, + 872 ], "loc": { "start": { - "line": 9, - "column": 6 + "line": 32, + "column": 8 }, "end": { - "line": 9, - "column": 7 + "line": 32, + "column": 9 } } }, @@ -619,32 +659,32 @@ "value": null, "raw": "null", "range": [ - 222, - 226 + 877, + 881 ], "loc": { "start": { - "line": 9, - "column": 12 + "line": 32, + "column": 14 }, "end": { - "line": 9, - "column": 16 + "line": 32, + "column": 18 } } }, "range": [ - 216, - 226 + 871, + 881 ], "loc": { "start": { - "line": 9, - "column": 6 + "line": 32, + "column": 8 }, "end": { - "line": 9, - "column": 16 + "line": 32, + "column": 18 } } }, @@ -658,17 +698,17 @@ "type": "Identifier", "name": "u", "range": [ - 232, - 233 + 889, + 890 ], "loc": { "start": { - "line": 9, - "column": 22 + "line": 32, + "column": 26 }, "end": { - "line": 9, - "column": 23 + "line": 32, + "column": 27 } } }, @@ -676,32 +716,32 @@ "type": "Identifier", "name": "color", "range": [ - 234, - 239 + 891, + 896 ], "loc": { "start": { - "line": 9, - "column": 24 + "line": 32, + "column": 28 }, "end": { - "line": 9, - "column": 29 + "line": 32, + "column": 33 } } }, "range": [ - 232, - 239 + 889, + 896 ], "loc": { "start": { - "line": 9, - "column": 22 + "line": 32, + "column": 26 }, "end": { - "line": 9, - "column": 29 + "line": 32, + "column": 33 } } }, @@ -709,47 +749,47 @@ "type": "Identifier", "name": "RED", "range": [ - 244, - 247 + 901, + 904 ], "loc": { "start": { - "line": 9, - "column": 34 + "line": 32, + "column": 38 }, "end": { - "line": 9, - "column": 37 + "line": 32, + "column": 41 } } }, "range": [ - 232, - 247 + 889, + 904 ], "loc": { "start": { - "line": 9, - "column": 22 + "line": 32, + "column": 26 }, "end": { - "line": 9, - "column": 37 + "line": 32, + "column": 41 } } }, "range": [ - 215, - 248 + 869, + 906 ], "loc": { "start": { - "line": 9, - "column": 5 + "line": 32, + "column": 6 }, "end": { - "line": 9, - "column": 38 + "line": 32, + "column": 43 } } }, @@ -771,16 +811,16 @@ "type": "Identifier", "name": "n", "range": [ - 254, - 255 + 913, + 914 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 2 }, "end": { - "line": 10, + "line": 33, "column": 3 } } @@ -789,31 +829,31 @@ "type": "Identifier", "name": "parent", "range": [ - 256, - 262 + 915, + 921 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 4 }, "end": { - "line": 10, + "line": 33, "column": 10 } } }, "range": [ - 254, - 262 + 913, + 921 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 2 }, "end": { - "line": 10, + "line": 33, "column": 10 } } @@ -822,31 +862,31 @@ "type": "Identifier", "name": "color", "range": [ - 263, - 268 + 922, + 927 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 11 }, "end": { - "line": 10, + "line": 33, "column": 16 } } }, "range": [ - 254, - 268 + 913, + 927 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 2 }, "end": { - "line": 10, + "line": 33, "column": 16 } } @@ -855,47 +895,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 271, - 276 + 930, + 935 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 19 }, "end": { - "line": 10, + "line": 33, "column": 24 } } }, "range": [ - 254, - 276 + 913, + 935 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 2 }, "end": { - "line": 10, + "line": 33, "column": 24 } } }, "range": [ - 254, - 277 + 913, + 937 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 2 }, "end": { - "line": 10, - "column": 25 + "line": 33, + "column": 26 } } }, @@ -911,16 +951,16 @@ "type": "Identifier", "name": "u", "range": [ - 280, - 281 + 940, + 941 ], "loc": { "start": { - "line": 11, + "line": 34, "column": 2 }, "end": { - "line": 11, + "line": 34, "column": 3 } } @@ -929,31 +969,31 @@ "type": "Identifier", "name": "color", "range": [ - 282, - 287 + 942, + 947 ], "loc": { "start": { - "line": 11, + "line": 34, "column": 4 }, "end": { - "line": 11, + "line": 34, "column": 9 } } }, "range": [ - 280, - 287 + 940, + 947 ], "loc": { "start": { - "line": 11, + "line": 34, "column": 2 }, "end": { - "line": 11, + "line": 34, "column": 9 } } @@ -962,47 +1002,47 @@ "type": "Identifier", "name": "BLACK", "range": [ - 290, - 295 + 950, + 955 ], "loc": { "start": { - "line": 11, + "line": 34, "column": 12 }, "end": { - "line": 11, + "line": 34, "column": 17 } } }, "range": [ - 280, - 295 + 940, + 955 ], "loc": { "start": { - "line": 11, + "line": 34, "column": 2 }, "end": { - "line": 11, + "line": 34, "column": 17 } } }, "range": [ - 280, - 296 + 940, + 957 ], "loc": { "start": { - "line": 11, + "line": 34, "column": 2 }, "end": { - "line": 11, - "column": 18 + "line": 34, + "column": 19 } } }, @@ -1015,16 +1055,16 @@ "type": "Identifier", "name": "g", "range": [ - 305, - 306 + 966, + 967 ], "loc": { "start": { - "line": 12, + "line": 35, "column": 8 }, "end": { - "line": 12, + "line": 35, "column": 9 } } @@ -1035,16 +1075,16 @@ "type": "Identifier", "name": "grandparent", "range": [ - 309, - 320 + 970, + 981 ], "loc": { "start": { - "line": 12, + "line": 35, "column": 12 }, "end": { - "line": 12, + "line": 35, "column": 23 } } @@ -1054,65 +1094,65 @@ "type": "Identifier", "name": "n", "range": [ - 321, - 322 + 983, + 984 ], "loc": { "start": { - "line": 12, - "column": 24 + "line": 35, + "column": 25 }, "end": { - "line": 12, - "column": 25 + "line": 35, + "column": 26 } } } ], "range": [ - 309, - 323 + 970, + 986 ], "loc": { "start": { - "line": 12, + "line": 35, "column": 12 }, "end": { - "line": 12, - "column": 26 + "line": 35, + "column": 28 } } }, "range": [ - 305, - 323 + 966, + 986 ], "loc": { "start": { - "line": 12, + "line": 35, "column": 8 }, "end": { - "line": 12, - "column": 26 + "line": 35, + "column": 28 } } } ], "kind": "const", "range": [ - 299, - 324 + 960, + 988 ], "loc": { "start": { - "line": 12, + "line": 35, "column": 2 }, "end": { - "line": 12, - "column": 27 + "line": 35, + "column": 30 } } }, @@ -1128,16 +1168,16 @@ "type": "Identifier", "name": "g", "range": [ - 327, - 328 + 991, + 992 ], "loc": { "start": { - "line": 13, + "line": 36, "column": 2 }, "end": { - "line": 13, + "line": 36, "column": 3 } } @@ -1146,31 +1186,31 @@ "type": "Identifier", "name": "color", "range": [ - 329, - 334 + 993, + 998 ], "loc": { "start": { - "line": 13, + "line": 36, "column": 4 }, "end": { - "line": 13, + "line": 36, "column": 9 } } }, "range": [ - 327, - 334 + 991, + 998 ], "loc": { "start": { - "line": 13, + "line": 36, "column": 2 }, "end": { - "line": 13, + "line": 36, "column": 9 } } @@ -1179,47 +1219,47 @@ "type": "Identifier", "name": "RED", "range": [ - 337, - 340 + 1001, + 1004 ], "loc": { "start": { - "line": 13, + "line": 36, "column": 12 }, "end": { - "line": 13, + "line": 36, "column": 15 } } }, "range": [ - 327, - 340 + 991, + 1004 ], "loc": { "start": { - "line": 13, + "line": 36, "column": 2 }, "end": { - "line": 13, + "line": 36, "column": 15 } } }, "range": [ - 327, - 341 + 991, + 1006 ], "loc": { "start": { - "line": 13, + "line": 36, "column": 2 }, "end": { - "line": 13, - "column": 16 + "line": 36, + "column": 17 } } }, @@ -1231,16 +1271,16 @@ "type": "Identifier", "name": "insert_case1", "range": [ - 344, - 356 + 1009, + 1021 ], "loc": { "start": { - "line": 14, + "line": 37, "column": 2 }, "end": { - "line": 14, + "line": 37, "column": 14 } } @@ -1250,185 +1290,186 @@ "type": "Identifier", "name": "g", "range": [ - 357, - 358 + 1023, + 1024 ], "loc": { "start": { - "line": 14, - "column": 15 + "line": 37, + "column": 16 }, "end": { - "line": 14, - "column": 16 + "line": 37, + "column": 17 } } } ], "range": [ - 344, - 359 + 1009, + 1026 ], "loc": { "start": { - "line": 14, + "line": 37, "column": 2 }, "end": { - "line": 14, - "column": 17 + "line": 37, + "column": 19 } } }, "range": [ - 344, - 360 + 1009, + 1028 ], "loc": { "start": { - "line": 14, + "line": 37, "column": 2 }, "end": { - "line": 14, - "column": 18 + "line": 37, + "column": 21 } } } ], "range": [ - 250, - 363 + 909, + 1031 ], "loc": { "start": { - "line": 9, - "column": 40 + "line": 32, + "column": 46 }, "end": { - "line": 15, + "line": 38, "column": 2 } } }, "alternate": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "insert_case4", - "range": [ - 373, - 385 - ], - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 16, - "column": 14 - } - } + "type": "ExpressionStatement", + "expression": { + "type": "CallExpression", + "callee": { + "type": "Identifier", + "name": "insert_case4", + "range": [ + 1039, + 1051 + ], + "loc": { + "start": { + "line": 40, + "column": 6 }, - "arguments": [ - { - "type": "Identifier", - "name": "n", - "range": [ - 386, - 387 - ], - "loc": { - "start": { - "line": 16, - "column": 15 - }, - "end": { - "line": 16, - "column": 16 - } - } - } - ], + "end": { + "line": 40, + "column": 18 + } + } + }, + "arguments": [ + { + "type": "Identifier", + "name": "n", "range": [ - 373, - 388 + 1053, + 1054 ], "loc": { "start": { - "line": 16, - "column": 2 + "line": 40, + "column": 20 }, "end": { - "line": 16, - "column": 17 + "line": 40, + "column": 21 } } + } + ], + "range": [ + 1039, + 1056 + ], + "loc": { + "start": { + "line": 40, + "column": 6 }, - "range": [ - 373, - 389 - ], - "loc": { - "start": { - "line": 16, - "column": 2 - }, - "end": { - "line": 16, - "column": 18 - } + "end": { + "line": 40, + "column": 23 } } - ], + }, "range": [ - 369, - 392 + 1039, + 1058 ], "loc": { "start": { - "line": 15, - "column": 8 + "line": 40, + "column": 6 }, "end": { - "line": 17, - "column": 2 + "line": 40, + "column": 25 } } }, "range": [ - 211, - 392 + 864, + 1058 ], "loc": { "start": { - "line": 9, + "line": 32, "column": 1 }, "end": { - "line": 17, - "column": 2 + "line": 40, + "column": 25 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "range": [ + 365, + 860 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 29, + "column": 4 + } + } + } + ] } ], "range": [ - 186, - 394 + 336, + 1061 ], "loc": { "start": { - "line": 6, - "column": 0 + "line": 13, + "column": 35 }, "end": { - "line": 18, + "line": 42, "column": 1 } } @@ -1436,44 +1477,83 @@ "generator": false, "expression": false, "range": [ - 161, - 394 + 308, + 1061 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 7 }, "end": { - "line": 18, + "line": 42, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 154, + 300 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 154, - 394 + 301, + 1061 ], "loc": { "start": { - "line": 5, + "line": 13, "column": 0 }, "end": { - "line": 18, + "line": 42, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 154, + 300 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 0, - 394 + 1061 ], "loc": { "start": { @@ -1481,9 +1561,46 @@ "column": 0 }, "end": { - "line": 18, + "line": 42, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 154, + 300 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "range": [ + 365, + 860 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 29, + "column": 4 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/insertion/insert_case4.js.json b/ast/source/insertion/insert_case4.js.json index 17ae8d5..7a5595e 100644 --- a/ast/source/insertion/insert_case4.js.json +++ b/ast/source/insertion/insert_case4.js.json @@ -287,7 +287,27 @@ "line": 3, "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 114, + 374 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -297,16 +317,16 @@ "type": "Identifier", "name": "insert_case4", "range": [ - 130, - 142 + 391, + 403 ], "loc": { "start": { - "line": 5, + "line": 16, "column": 16 }, "end": { - "line": 5, + "line": 16, "column": 28 } } @@ -316,17 +336,17 @@ "type": "Identifier", "name": "n", "range": [ - 143, - 144 + 406, + 407 ], "loc": { "start": { - "line": 5, - "column": 29 + "line": 16, + "column": 31 }, "end": { - "line": 5, - "column": 30 + "line": 16, + "column": 32 } } } @@ -343,16 +363,16 @@ "type": "Identifier", "name": "g", "range": [ - 155, - 156 + 420, + 421 ], "loc": { "start": { - "line": 7, + "line": 18, "column": 7 }, "end": { - "line": 7, + "line": 18, "column": 8 } } @@ -363,16 +383,16 @@ "type": "Identifier", "name": "grandparent", "range": [ - 159, - 170 + 424, + 435 ], "loc": { "start": { - "line": 7, + "line": 18, "column": 11 }, "end": { - "line": 7, + "line": 18, "column": 22 } } @@ -382,67 +402,87 @@ "type": "Identifier", "name": "n", "range": [ - 171, - 172 + 437, + 438 ], "loc": { "start": { - "line": 7, - "column": 23 + "line": 18, + "column": 24 }, "end": { - "line": 7, - "column": 24 + "line": 18, + "column": 25 } } } ], "range": [ - 159, - 173 + 424, + 440 ], "loc": { "start": { - "line": 7, + "line": 18, "column": 11 }, "end": { - "line": 7, - "column": 25 + "line": 18, + "column": 27 } } }, "range": [ - 155, - 173 + 420, + 440 ], "loc": { "start": { - "line": 7, + "line": 18, "column": 7 }, "end": { - "line": 7, - "column": 25 + "line": 18, + "column": 27 } } } ], "kind": "const", "range": [ - 149, - 174 + 414, + 442 ], "loc": { "start": { - "line": 7, + "line": 18, "column": 1 }, "end": { - "line": 7, - "column": 26 + "line": 18, + "column": 29 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "range": [ + 445, + 907 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 32, + "column": 4 + } + } + } + ] }, { "type": "IfStatement", @@ -456,17 +496,17 @@ "type": "Identifier", "name": "n", "range": [ - 182, - 183 + 917, + 918 ], "loc": { "start": { - "line": 9, - "column": 6 + "line": 34, + "column": 8 }, "end": { - "line": 9, - "column": 7 + "line": 34, + "column": 9 } } }, @@ -480,17 +520,17 @@ "type": "Identifier", "name": "n", "range": [ - 188, - 189 + 923, + 924 ], "loc": { "start": { - "line": 9, - "column": 12 + "line": 34, + "column": 14 }, "end": { - "line": 9, - "column": 13 + "line": 34, + "column": 15 } } }, @@ -498,32 +538,32 @@ "type": "Identifier", "name": "parent", "range": [ - 190, - 196 + 925, + 931 ], "loc": { "start": { - "line": 9, - "column": 14 + "line": 34, + "column": 16 }, "end": { - "line": 9, - "column": 20 + "line": 34, + "column": 22 } } }, "range": [ - 188, - 196 + 923, + 931 ], "loc": { "start": { - "line": 9, - "column": 12 + "line": 34, + "column": 14 }, "end": { - "line": 9, - "column": 20 + "line": 34, + "column": 22 } } }, @@ -531,47 +571,47 @@ "type": "Identifier", "name": "right", "range": [ - 197, - 202 + 932, + 937 ], "loc": { "start": { - "line": 9, - "column": 21 + "line": 34, + "column": 23 }, "end": { - "line": 9, - "column": 26 + "line": 34, + "column": 28 } } }, "range": [ - 188, - 202 + 923, + 937 ], "loc": { "start": { - "line": 9, - "column": 12 + "line": 34, + "column": 14 }, "end": { - "line": 9, - "column": 26 + "line": 34, + "column": 28 } } }, "range": [ - 182, - 202 + 917, + 937 ], "loc": { "start": { - "line": 9, - "column": 6 + "line": 34, + "column": 8 }, "end": { - "line": 9, - "column": 26 + "line": 34, + "column": 28 } } }, @@ -585,17 +625,17 @@ "type": "Identifier", "name": "n", "range": [ - 208, - 209 + 945, + 946 ], "loc": { "start": { - "line": 9, - "column": 32 + "line": 34, + "column": 36 }, "end": { - "line": 9, - "column": 33 + "line": 34, + "column": 37 } } }, @@ -603,32 +643,32 @@ "type": "Identifier", "name": "parent", "range": [ - 210, - 216 + 947, + 953 ], "loc": { "start": { - "line": 9, - "column": 34 + "line": 34, + "column": 38 }, "end": { - "line": 9, - "column": 40 + "line": 34, + "column": 44 } } }, "range": [ - 208, - 216 + 945, + 953 ], "loc": { "start": { - "line": 9, - "column": 32 + "line": 34, + "column": 36 }, "end": { - "line": 9, - "column": 40 + "line": 34, + "column": 44 } } }, @@ -639,17 +679,17 @@ "type": "Identifier", "name": "g", "range": [ - 221, - 222 + 958, + 959 ], "loc": { "start": { - "line": 9, - "column": 45 + "line": 34, + "column": 49 }, "end": { - "line": 9, - "column": 46 + "line": 34, + "column": 50 } } }, @@ -657,62 +697,62 @@ "type": "Identifier", "name": "left", "range": [ - 223, - 227 + 960, + 964 ], "loc": { "start": { - "line": 9, - "column": 47 + "line": 34, + "column": 51 }, "end": { - "line": 9, - "column": 51 + "line": 34, + "column": 55 } } }, "range": [ - 221, - 227 + 958, + 964 ], "loc": { "start": { - "line": 9, - "column": 45 + "line": 34, + "column": 49 }, "end": { - "line": 9, - "column": 51 + "line": 34, + "column": 55 } } }, "range": [ - 208, - 227 + 945, + 964 ], "loc": { "start": { - "line": 9, - "column": 32 + "line": 34, + "column": 36 }, "end": { - "line": 9, - "column": 51 + "line": 34, + "column": 55 } } }, "range": [ - 181, - 228 + 915, + 966 ], "loc": { "start": { - "line": 9, - "column": 5 + "line": 34, + "column": 6 }, "end": { - "line": 9, - "column": 52 + "line": 34, + "column": 57 } } }, @@ -727,16 +767,16 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 234, - 245 + 974, + 985 ], "loc": { "start": { - "line": 10, + "line": 36, "column": 2 }, "end": { - "line": 10, + "line": 36, "column": 13 } } @@ -749,17 +789,17 @@ "type": "Identifier", "name": "n", "range": [ - 246, - 247 + 987, + 988 ], "loc": { "start": { - "line": 10, - "column": 14 + "line": 36, + "column": 15 }, "end": { - "line": 10, - "column": 15 + "line": 36, + "column": 16 } } }, @@ -767,99 +807,99 @@ "type": "Identifier", "name": "parent", "range": [ - 248, - 254 + 989, + 995 ], "loc": { "start": { - "line": 10, - "column": 16 + "line": 36, + "column": 17 }, "end": { - "line": 10, - "column": 22 + "line": 36, + "column": 23 } } }, "range": [ - 246, - 254 + 987, + 995 ], "loc": { "start": { - "line": 10, - "column": 14 + "line": 36, + "column": 15 }, "end": { - "line": 10, - "column": 22 + "line": 36, + "column": 23 } } } ], "range": [ - 234, - 255 + 974, + 997 ], "loc": { "start": { - "line": 10, + "line": 36, "column": 2 }, "end": { - "line": 10, - "column": 23 + "line": 36, + "column": 25 } } }, "range": [ - 234, - 256 + 974, + 999 ], "loc": { "start": { - "line": 10, + "line": 36, "column": 2 }, "end": { - "line": 10, - "column": 24 + "line": 36, + "column": 27 } }, "trailingComments": [ { "type": "Block", - "value": "\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n ", + "value": "*\n\t\t * rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", "range": [ - 259, - 496 + 1003, + 1259 ], "loc": { "start": { - "line": 12, - "column": 1 + "line": 38, + "column": 2 }, "end": { - "line": 21, - "column": 3 + "line": 47, + "column": 5 } } }, { "type": "Line", - "value": "n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", "range": [ - 500, - 576 + 1263, + 1340 ], "loc": { "start": { - "line": 23, + "line": 49, "column": 2 }, "end": { - "line": 23, - "column": 78 + "line": 49, + "column": 79 } } } @@ -867,19 +907,39 @@ } ], "range": [ - 230, - 580 + 969, + 1344 ], "loc": { "start": { - "line": 9, - "column": 54 + "line": 34, + "column": 60 }, "end": { - "line": 25, + "line": 51, "column": 2 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a right-left, change it to a right-right\n\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * B R B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - >R = - - = >R\n\t * / \\ / \\\n\t * = = = =\n\t ", + "range": [ + 1347, + 1836 + ], + "loc": { + "start": { + "line": 53, + "column": 1 + }, + "end": { + "line": 65, + "column": 4 + } + } + } + ] }, "alternate": { "type": "IfStatement", @@ -893,16 +953,16 @@ "type": "Identifier", "name": "n", "range": [ - 591, - 592 + 1851, + 1852 ], "loc": { "start": { - "line": 25, + "line": 67, "column": 13 }, "end": { - "line": 25, + "line": 67, "column": 14 } } @@ -917,16 +977,16 @@ "type": "Identifier", "name": "n", "range": [ - 597, - 598 + 1857, + 1858 ], "loc": { "start": { - "line": 25, + "line": 67, "column": 19 }, "end": { - "line": 25, + "line": 67, "column": 20 } } @@ -935,31 +995,31 @@ "type": "Identifier", "name": "parent", "range": [ - 599, - 605 + 1859, + 1865 ], "loc": { "start": { - "line": 25, + "line": 67, "column": 21 }, "end": { - "line": 25, + "line": 67, "column": 27 } } }, "range": [ - 597, - 605 + 1857, + 1865 ], "loc": { "start": { - "line": 25, + "line": 67, "column": 19 }, "end": { - "line": 25, + "line": 67, "column": 27 } } @@ -968,46 +1028,46 @@ "type": "Identifier", "name": "left", "range": [ - 606, - 610 + 1866, + 1870 ], "loc": { "start": { - "line": 25, + "line": 67, "column": 28 }, "end": { - "line": 25, + "line": 67, "column": 32 } } }, "range": [ - 597, - 610 + 1857, + 1870 ], "loc": { "start": { - "line": 25, + "line": 67, "column": 19 }, "end": { - "line": 25, + "line": 67, "column": 32 } } }, "range": [ - 591, - 610 + 1851, + 1870 ], "loc": { "start": { - "line": 25, + "line": 67, "column": 13 }, "end": { - "line": 25, + "line": 67, "column": 32 } } @@ -1022,17 +1082,17 @@ "type": "Identifier", "name": "n", "range": [ - 616, - 617 + 1878, + 1879 ], "loc": { "start": { - "line": 25, - "column": 38 + "line": 67, + "column": 40 }, "end": { - "line": 25, - "column": 39 + "line": 67, + "column": 41 } } }, @@ -1040,32 +1100,32 @@ "type": "Identifier", "name": "parent", "range": [ - 618, - 624 + 1880, + 1886 ], "loc": { "start": { - "line": 25, - "column": 40 + "line": 67, + "column": 42 }, "end": { - "line": 25, - "column": 46 + "line": 67, + "column": 48 } } }, "range": [ - 616, - 624 + 1878, + 1886 ], "loc": { "start": { - "line": 25, - "column": 38 + "line": 67, + "column": 40 }, "end": { - "line": 25, - "column": 46 + "line": 67, + "column": 48 } } }, @@ -1076,17 +1136,17 @@ "type": "Identifier", "name": "g", "range": [ - 629, - 630 + 1891, + 1892 ], "loc": { "start": { - "line": 25, - "column": 51 + "line": 67, + "column": 53 }, "end": { - "line": 25, - "column": 52 + "line": 67, + "column": 54 } } }, @@ -1094,62 +1154,62 @@ "type": "Identifier", "name": "right", "range": [ - 631, - 636 + 1893, + 1898 ], "loc": { "start": { - "line": 25, - "column": 53 + "line": 67, + "column": 55 }, "end": { - "line": 25, - "column": 58 + "line": 67, + "column": 60 } } }, "range": [ - 629, - 636 + 1891, + 1898 ], "loc": { "start": { - "line": 25, - "column": 51 + "line": 67, + "column": 53 }, "end": { - "line": 25, - "column": 58 + "line": 67, + "column": 60 } } }, "range": [ - 616, - 636 + 1878, + 1898 ], "loc": { "start": { - "line": 25, - "column": 38 + "line": 67, + "column": 40 }, "end": { - "line": 25, - "column": 58 + "line": 67, + "column": 60 } } }, "range": [ - 590, - 637 + 1849, + 1900 ], "loc": { "start": { - "line": 25, - "column": 12 + "line": 67, + "column": 11 }, "end": { - "line": 25, - "column": 59 + "line": 67, + "column": 62 } } }, @@ -1164,16 +1224,16 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 643, - 655 + 1908, + 1920 ], "loc": { "start": { - "line": 26, + "line": 69, "column": 2 }, "end": { - "line": 26, + "line": 69, "column": 14 } } @@ -1186,17 +1246,17 @@ "type": "Identifier", "name": "n", "range": [ - 656, - 657 + 1922, + 1923 ], "loc": { "start": { - "line": 26, - "column": 15 + "line": 69, + "column": 16 }, "end": { - "line": 26, - "column": 16 + "line": 69, + "column": 17 } } }, @@ -1204,99 +1264,99 @@ "type": "Identifier", "name": "parent", "range": [ - 658, - 664 + 1924, + 1930 ], "loc": { "start": { - "line": 26, - "column": 17 + "line": 69, + "column": 18 }, "end": { - "line": 26, - "column": 23 + "line": 69, + "column": 24 } } }, "range": [ - 656, - 664 + 1922, + 1930 ], "loc": { "start": { - "line": 26, - "column": 15 + "line": 69, + "column": 16 }, "end": { - "line": 26, - "column": 23 + "line": 69, + "column": 24 } } } ], "range": [ - 643, - 665 + 1908, + 1932 ], "loc": { "start": { - "line": 26, + "line": 69, "column": 2 }, "end": { - "line": 26, - "column": 24 + "line": 69, + "column": 26 } } }, "range": [ - 643, - 666 + 1908, + 1934 ], "loc": { "start": { - "line": 26, + "line": 69, "column": 2 }, "end": { - "line": 26, - "column": 25 + "line": 69, + "column": 28 } }, "trailingComments": [ { "type": "Block", - "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", + "value": "*\n\t\t * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", "range": [ - 669, - 880 + 1938, + 2166 ], "loc": { "start": { - "line": 28, - "column": 1 + "line": 71, + "column": 2 }, "end": { - "line": 36, - "column": 3 + "line": 79, + "column": 5 } } }, { "type": "Line", - "value": "n = n.right;", + "value": " n = n.right ;", "range": [ - 884, - 898 + 2170, + 2186 ], "loc": { "start": { - "line": 38, + "line": 81, "column": 2 }, "end": { - "line": 38, - "column": 16 + "line": 81, + "column": 18 } } } @@ -1304,88 +1364,126 @@ } ], "range": [ - 639, - 901 + 1903, + 2189 ], "loc": { "start": { - "line": 25, - "column": 61 + "line": 67, + "column": 65 }, "end": { - "line": 39, + "line": 82, "column": 2 } } }, "alternate": null, "range": [ - 586, - 901 + 1844, + 2189 ], "loc": { "start": { - "line": 25, - "column": 8 + "line": 67, + "column": 6 }, "end": { - "line": 39, + "line": 82, "column": 2 } }, "leadingComments": [ { "type": "Block", - "value": "\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n ", + "value": "*\n\t\t * rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", "range": [ - 259, - 496 + 1003, + 1259 ], "loc": { "start": { - "line": 12, - "column": 1 + "line": 38, + "column": 2 }, "end": { - "line": 21, - "column": 3 + "line": 47, + "column": 5 } } }, { "type": "Line", - "value": "n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", "range": [ - 500, - 576 + 1263, + 1340 ], "loc": { "start": { - "line": 23, + "line": 49, "column": 2 }, "end": { - "line": 23, - "column": 78 + "line": 49, + "column": 79 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a right-left, change it to a right-right\n\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * B R B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - >R = - - = >R\n\t * / \\ / \\\n\t * = = = =\n\t ", + "range": [ + 1347, + 1836 + ], + "loc": { + "start": { + "line": 53, + "column": 1 + }, + "end": { + "line": 65, + "column": 4 } } } ] }, "range": [ - 177, - 901 + 910, + 2189 ], "loc": { "start": { - "line": 9, + "line": 34, "column": 1 }, "end": { - "line": 39, + "line": 82, "column": 2 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "range": [ + 445, + 907 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 32, + "column": 4 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -1395,16 +1493,16 @@ "type": "Identifier", "name": "insert_case5", "range": [ - 903, - 915 + 2192, + 2204 ], "loc": { "start": { - "line": 40, + "line": 84, "column": 1 }, "end": { - "line": 40, + "line": 84, "column": 13 } } @@ -1414,84 +1512,84 @@ "type": "Identifier", "name": "n", "range": [ - 916, - 917 + 2206, + 2207 ], "loc": { "start": { - "line": 40, - "column": 14 + "line": 84, + "column": 15 }, "end": { - "line": 40, - "column": 15 + "line": 84, + "column": 16 } } } ], "range": [ - 903, - 918 + 2192, + 2209 ], "loc": { "start": { - "line": 40, + "line": 84, "column": 1 }, "end": { - "line": 40, - "column": 16 + "line": 84, + "column": 18 } } }, "range": [ - 903, - 919 + 2192, + 2211 ], "loc": { "start": { - "line": 40, + "line": 84, "column": 1 }, "end": { - "line": 40, - "column": 17 + "line": 84, + "column": 20 } }, "leadingComments": [ { "type": "Block", - "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", + "value": "*\n\t\t * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", "range": [ - 669, - 880 + 1938, + 2166 ], "loc": { "start": { - "line": 28, - "column": 1 + "line": 71, + "column": 2 }, "end": { - "line": 36, - "column": 3 + "line": 79, + "column": 5 } } }, { "type": "Line", - "value": "n = n.right;", + "value": " n = n.right ;", "range": [ - 884, - 898 + 2170, + 2186 ], "loc": { "start": { - "line": 38, + "line": 81, "column": 2 }, "end": { - "line": 38, - "column": 16 + "line": 81, + "column": 18 } } } @@ -1499,16 +1597,16 @@ } ], "range": [ - 146, - 921 + 410, + 2214 ], "loc": { "start": { - "line": 6, - "column": 0 + "line": 16, + "column": 35 }, "end": { - "line": 41, + "line": 86, "column": 1 } } @@ -1516,44 +1614,83 @@ "generator": false, "expression": false, "range": [ - 121, - 921 + 382, + 2214 ], "loc": { "start": { - "line": 5, + "line": 16, "column": 7 }, "end": { - "line": 41, + "line": 86, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 114, + 374 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 114, - 921 + 375, + 2214 ], "loc": { "start": { - "line": 5, + "line": 16, "column": 0 }, "end": { - "line": 41, + "line": 86, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 114, + 374 + ], + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 15, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ 1, - 921 + 2214 ], "loc": { "start": { @@ -1561,80 +1698,134 @@ "column": 0 }, "end": { - "line": 41, + "line": 86, "column": 1 } }, "comments": [ { "type": "Block", - "value": "\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", "range": [ - 259, - 496 + 114, + 374 ], "loc": { "start": { - "line": 12, - "column": 1 + "line": 5, + "column": 0 }, "end": { - "line": 21, + "line": 15, "column": 3 } } }, + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "range": [ + 445, + 907 + ], + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 32, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t\t * rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "range": [ + 1003, + 1259 + ], + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 47, + "column": 5 + } + } + }, { "type": "Line", - "value": "n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", "range": [ - 500, - 576 + 1263, + 1340 ], "loc": { "start": { - "line": 23, + "line": 49, "column": 2 }, "end": { - "line": 23, - "column": 78 + "line": 49, + "column": 79 } } }, { "type": "Block", - "value": "\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n ", + "value": "*\n\t * If the path from g to n makes a right-left, change it to a right-right\n\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * B R B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - >R = - - = >R\n\t * / \\ / \\\n\t * = = = =\n\t ", "range": [ - 669, - 880 + 1347, + 1836 ], "loc": { "start": { - "line": 28, + "line": 53, "column": 1 }, "end": { - "line": 36, - "column": 3 + "line": 65, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t\t * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "range": [ + 1938, + 2166 + ], + "loc": { + "start": { + "line": 71, + "column": 2 + }, + "end": { + "line": 79, + "column": 5 } } }, { "type": "Line", - "value": "n = n.right;", + "value": " n = n.right ;", "range": [ - 884, - 898 + 2170, + 2186 ], "loc": { "start": { - "line": 38, + "line": 81, "column": 2 }, "end": { - "line": 38, - "column": 16 + "line": 81, + "column": 18 } } } diff --git a/ast/source/insertion/insert_case5.js.json b/ast/source/insertion/insert_case5.js.json index f2a10dd..467047b 100644 --- a/ast/source/insertion/insert_case5.js.json +++ b/ast/source/insertion/insert_case5.js.json @@ -10,16 +10,16 @@ "type": "Identifier", "name": "RED", "range": [ - 10, - 13 + 9, + 12 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 12 } } @@ -28,31 +28,31 @@ "type": "Identifier", "name": "RED", "range": [ - 10, - 13 + 9, + 12 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 12 } } }, "range": [ - 10, - 13 + 9, + 12 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 9 }, "end": { - "line": 2, + "line": 1, "column": 12 } } @@ -63,16 +63,16 @@ "type": "Identifier", "name": "BLACK", "range": [ - 16, - 21 + 15, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 15 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -81,31 +81,31 @@ "type": "Identifier", "name": "BLACK", "range": [ - 16, - 21 + 15, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 15 }, "end": { - "line": 2, + "line": 1, "column": 20 } } }, "range": [ - 16, - 21 + 15, + 20 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 15 }, "end": { - "line": 2, + "line": 1, "column": 20 } } @@ -116,16 +116,16 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 24, - 35 + 23, + 34 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 34 } } @@ -134,31 +134,31 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 24, - 35 + 23, + 34 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 34 } } }, "range": [ - 24, - 35 + 23, + 34 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 23 }, "end": { - "line": 2, + "line": 1, "column": 34 } } @@ -169,16 +169,16 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 38, - 50 + 37, + 49 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 37 }, "end": { - "line": 2, + "line": 1, "column": 49 } } @@ -187,31 +187,31 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 38, - 50 + 37, + 49 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 37 }, "end": { - "line": 2, + "line": 1, "column": 49 } } }, "range": [ - 38, - 50 + 37, + 49 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 37 }, "end": { - "line": 2, + "line": 1, "column": 49 } } @@ -222,16 +222,16 @@ "type": "Identifier", "name": "grandparent", "range": [ - 53, - 64 + 52, + 63 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 52 }, "end": { - "line": 2, + "line": 1, "column": 63 } } @@ -240,31 +240,31 @@ "type": "Identifier", "name": "grandparent", "range": [ - 53, - 64 + 52, + 63 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 52 }, "end": { - "line": 2, + "line": 1, "column": 63 } } }, "range": [ - 53, - 64 + 52, + 63 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 52 }, "end": { - "line": 2, + "line": 1, "column": 63 } } @@ -275,34 +275,54 @@ "value": "..", "raw": "'..'", "range": [ - 72, - 76 + 71, + 75 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 71 }, "end": { - "line": 2, + "line": 1, "column": 75 } } }, "range": [ - 1, - 78 + 0, + 77 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 2, + "line": 1, "column": 77 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 79, + 328 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ] }, { "type": "ExportNamedDeclaration", @@ -312,16 +332,16 @@ "type": "Identifier", "name": "insert_case5", "range": [ - 96, - 108 + 345, + 357 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 16 }, "end": { - "line": 4, + "line": 13, "column": 28 } } @@ -331,17 +351,17 @@ "type": "Identifier", "name": "n", "range": [ - 109, - 110 + 360, + 361 ], "loc": { "start": { - "line": 4, - "column": 29 + "line": 13, + "column": 31 }, "end": { - "line": 4, - "column": 30 + "line": 13, + "column": 32 } } } @@ -358,16 +378,16 @@ "type": "Identifier", "name": "g", "range": [ - 121, - 122 + 374, + 375 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 7 }, "end": { - "line": 6, + "line": 15, "column": 8 } } @@ -378,16 +398,16 @@ "type": "Identifier", "name": "grandparent", "range": [ - 125, - 136 + 378, + 389 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 11 }, "end": { - "line": 6, + "line": 15, "column": 22 } } @@ -397,67 +417,87 @@ "type": "Identifier", "name": "n", "range": [ - 137, - 138 + 391, + 392 ], "loc": { "start": { - "line": 6, - "column": 23 + "line": 15, + "column": 24 }, "end": { - "line": 6, - "column": 24 + "line": 15, + "column": 25 } } } ], "range": [ - 125, - 139 + 378, + 394 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 11 }, "end": { - "line": 6, - "column": 25 + "line": 15, + "column": 27 } } }, "range": [ - 121, - 139 + 374, + 394 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 7 }, "end": { - "line": 6, - "column": 25 + "line": 15, + "column": 27 } } } ], "kind": "const", "range": [ - 115, - 140 + 368, + 396 ], "loc": { "start": { - "line": 6, + "line": 15, "column": 1 }, "end": { - "line": 6, - "column": 26 + "line": 15, + "column": 29 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": " repaint n's parent black, n's grandparent red", + "range": [ + 399, + 447 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 49 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -474,16 +514,16 @@ "type": "Identifier", "name": "n", "range": [ - 143, - 144 + 449, + 450 ], "loc": { "start": { - "line": 8, + "line": 18, "column": 1 }, "end": { - "line": 8, + "line": 18, "column": 2 } } @@ -492,31 +532,31 @@ "type": "Identifier", "name": "parent", "range": [ - 145, - 151 + 451, + 457 ], "loc": { "start": { - "line": 8, + "line": 18, "column": 3 }, "end": { - "line": 8, + "line": 18, "column": 9 } } }, "range": [ - 143, - 151 + 449, + 457 ], "loc": { "start": { - "line": 8, + "line": 18, "column": 1 }, "end": { - "line": 8, + "line": 18, "column": 9 } } @@ -525,31 +565,31 @@ "type": "Identifier", "name": "color", "range": [ - 152, - 157 + 458, + 463 ], "loc": { "start": { - "line": 8, + "line": 18, "column": 10 }, "end": { - "line": 8, + "line": 18, "column": 15 } } }, "range": [ - 143, - 157 + 449, + 463 ], "loc": { "start": { - "line": 8, + "line": 18, "column": 1 }, "end": { - "line": 8, + "line": 18, "column": 15 } } @@ -558,49 +598,69 @@ "type": "Identifier", "name": "BLACK", "range": [ - 160, - 165 + 466, + 471 ], "loc": { "start": { - "line": 8, + "line": 18, "column": 18 }, "end": { - "line": 8, + "line": 18, "column": 23 } } }, "range": [ - 143, - 165 + 449, + 471 ], "loc": { "start": { - "line": 8, + "line": 18, "column": 1 }, "end": { - "line": 8, + "line": 18, "column": 23 } } }, "range": [ - 143, - 166 + 449, + 473 ], "loc": { "start": { - "line": 8, + "line": 18, "column": 1 }, "end": { - "line": 8, - "column": 24 + "line": 18, + "column": 25 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " repaint n's parent black, n's grandparent red", + "range": [ + 399, + 447 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 49 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -614,16 +674,16 @@ "type": "Identifier", "name": "g", "range": [ - 168, - 169 + 475, + 476 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 1 }, "end": { - "line": 9, + "line": 19, "column": 2 } } @@ -632,31 +692,31 @@ "type": "Identifier", "name": "color", "range": [ - 170, - 175 + 477, + 482 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 3 }, "end": { - "line": 9, + "line": 19, "column": 8 } } }, "range": [ - 168, - 175 + 475, + 482 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 1 }, "end": { - "line": 9, + "line": 19, "column": 8 } } @@ -665,49 +725,69 @@ "type": "Identifier", "name": "RED", "range": [ - 178, - 181 + 485, + 488 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 11 }, "end": { - "line": 9, + "line": 19, "column": 14 } } }, "range": [ - 168, - 181 + 475, + 488 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 1 }, "end": { - "line": 9, + "line": 19, "column": 14 } } }, "range": [ - 168, - 182 + 475, + 490 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 1 }, "end": { - "line": 9, - "column": 15 + "line": 19, + "column": 16 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t ", + "range": [ + 493, + 908 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 32, + "column": 4 + } + } + } + ] }, { "type": "IfStatement", @@ -718,17 +798,17 @@ "type": "Identifier", "name": "n", "range": [ - 188, - 189 + 915, + 916 ], "loc": { "start": { - "line": 10, - "column": 5 + "line": 33, + "column": 6 }, "end": { - "line": 10, - "column": 6 + "line": 33, + "column": 7 } } }, @@ -742,17 +822,17 @@ "type": "Identifier", "name": "n", "range": [ - 194, - 195 + 921, + 922 ], "loc": { "start": { - "line": 10, - "column": 11 + "line": 33, + "column": 12 }, "end": { - "line": 10, - "column": 12 + "line": 33, + "column": 13 } } }, @@ -760,32 +840,32 @@ "type": "Identifier", "name": "parent", "range": [ - 196, - 202 + 923, + 929 ], "loc": { "start": { - "line": 10, - "column": 13 + "line": 33, + "column": 14 }, "end": { - "line": 10, - "column": 19 + "line": 33, + "column": 20 } } }, "range": [ - 194, - 202 + 921, + 929 ], "loc": { "start": { - "line": 10, - "column": 11 + "line": 33, + "column": 12 }, "end": { - "line": 10, - "column": 19 + "line": 33, + "column": 20 } } }, @@ -793,47 +873,47 @@ "type": "Identifier", "name": "left", "range": [ - 203, - 207 + 930, + 934 ], "loc": { "start": { - "line": 10, - "column": 20 + "line": 33, + "column": 21 }, "end": { - "line": 10, - "column": 24 + "line": 33, + "column": 25 } } }, "range": [ - 194, - 207 + 921, + 934 ], "loc": { "start": { - "line": 10, - "column": 11 + "line": 33, + "column": 12 }, "end": { - "line": 10, - "column": 24 + "line": 33, + "column": 25 } } }, "range": [ - 188, - 207 + 915, + 934 ], "loc": { "start": { - "line": 10, - "column": 5 + "line": 33, + "column": 6 }, "end": { - "line": 10, - "column": 24 + "line": 33, + "column": 25 } } }, @@ -845,17 +925,17 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 211, - 223 + 937, + 949 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 33, + "column": 28 }, "end": { - "line": 11, - "column": 14 + "line": 33, + "column": 40 } } }, @@ -864,50 +944,70 @@ "type": "Identifier", "name": "g", "range": [ - 224, - 225 + 951, + 952 ], "loc": { "start": { - "line": 11, - "column": 15 + "line": 33, + "column": 42 }, "end": { - "line": 11, - "column": 16 + "line": 33, + "column": 43 } } } ], "range": [ - 211, - 226 + 937, + 954 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 33, + "column": 28 }, "end": { - "line": 11, - "column": 17 + "line": 33, + "column": 45 } } }, "range": [ - 211, - 227 + 937, + 956 ], "loc": { "start": { - "line": 11, - "column": 2 + "line": 33, + "column": 28 }, "end": { - "line": 11, - "column": 18 + "line": 33, + "column": 47 } - } + }, + "trailingComments": [ + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t ", + "range": [ + 959, + 1351 + ], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] }, "alternate": { "type": "ExpressionStatement", @@ -917,17 +1017,17 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 236, - 247 + 1358, + 1369 ], "loc": { "start": { - "line": 13, - "column": 2 + "line": 47, + "column": 6 }, "end": { - "line": 13, - "column": 13 + "line": 47, + "column": 17 } } }, @@ -936,78 +1036,118 @@ "type": "Identifier", "name": "g", "range": [ - 248, - 249 + 1371, + 1372 ], "loc": { "start": { - "line": 13, - "column": 14 + "line": 47, + "column": 19 }, "end": { - "line": 13, - "column": 15 + "line": 47, + "column": 20 } } } ], "range": [ - 236, - 250 + 1358, + 1374 ], "loc": { "start": { - "line": 13, - "column": 2 + "line": 47, + "column": 6 }, "end": { - "line": 13, - "column": 16 + "line": 47, + "column": 22 } } }, "range": [ - 236, - 251 + 1358, + 1376 ], "loc": { "start": { - "line": 13, - "column": 2 + "line": 47, + "column": 6 }, "end": { - "line": 13, - "column": 17 + "line": 47, + "column": 24 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t ", + "range": [ + 959, + 1351 + ], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] }, "range": [ - 184, - 251 + 910, + 1376 ], "loc": { "start": { - "line": 10, + "line": 33, "column": 1 }, "end": { - "line": 13, - "column": 17 + "line": 47, + "column": 24 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t ", + "range": [ + 493, + 908 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 32, + "column": 4 + } + } + } + ] } ], "range": [ - 112, - 253 + 364, + 1379 ], "loc": { "start": { - "line": 5, - "column": 0 + "line": 13, + "column": 35 }, "end": { - "line": 14, + "line": 49, "column": 1 } } @@ -1015,54 +1155,166 @@ "generator": false, "expression": false, "range": [ - 87, - 253 + 336, + 1379 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 7 }, "end": { - "line": 14, + "line": 49, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 79, + 328 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 80, - 253 + 329, + 1379 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 0 }, "end": { - "line": 14, + "line": 49, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 79, + 328 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 1, - 253 + 0, + 1379 ], "loc": { "start": { - "line": 2, + "line": 1, "column": 0 }, "end": { - "line": 14, + "line": 49, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "range": [ + 79, + 328 + ], + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": "Line", + "value": " repaint n's parent black, n's grandparent red", + "range": [ + 399, + 447 + ], + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 49 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t ", + "range": [ + 493, + 908 + ], + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 32, + "column": 4 + } + } + }, + { + "type": "Block", + "value": "*\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t ", + "range": [ + 959, + 1351 + ], + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/removal/delete_case5.js.json b/ast/source/removal/delete_case5.js.json deleted file mode 100644 index 0552ef8..0000000 --- a/ast/source/removal/delete_case5.js.json +++ /dev/null @@ -1,2517 +0,0 @@ -{ - "type": "Program", - "body": [ - { - "type": "ImportDeclaration", - "specifiers": [ - { - "type": "ImportSpecifier", - "local": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "imported": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - "range": [ - 9, - 14 - ], - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": "ImportSpecifier", - "local": { - "type": "Identifier", - "name": "RED", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "imported": { - "type": "Identifier", - "name": "RED", - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - "range": [ - 17, - 20 - ], - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 20 - } - } - }, - { - "type": "ImportSpecifier", - "local": { - "type": "Identifier", - "name": "sibling", - "range": [ - 23, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "imported": { - "type": "Identifier", - "name": "sibling", - "range": [ - 23, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - "range": [ - 23, - 30 - ], - "loc": { - "start": { - "line": 1, - "column": 23 - }, - "end": { - "line": 1, - "column": 30 - } - } - }, - { - "type": "ImportSpecifier", - "local": { - "type": "Identifier", - "name": "rotate_right", - "range": [ - 33, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - "imported": { - "type": "Identifier", - "name": "rotate_right", - "range": [ - 33, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - "range": [ - 33, - 45 - ], - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - { - "type": "ImportSpecifier", - "local": { - "type": "Identifier", - "name": "rotate_left", - "range": [ - 48, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 59 - } - } - }, - "imported": { - "type": "Identifier", - "name": "rotate_left", - "range": [ - 48, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 59 - } - } - }, - "range": [ - 48, - 59 - ], - "loc": { - "start": { - "line": 1, - "column": 48 - }, - "end": { - "line": 1, - "column": 59 - } - } - } - ], - "source": { - "type": "Literal", - "value": "..", - "raw": "'..'", - "range": [ - 67, - 71 - ], - "loc": { - "start": { - "line": 1, - "column": 67 - }, - "end": { - "line": 1, - "column": 71 - } - } - }, - "range": [ - 0, - 73 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 73 - } - } - }, - { - "type": "ImportDeclaration", - "specifiers": [ - { - "type": "ImportSpecifier", - "local": { - "type": "Identifier", - "name": "delete_case6", - "range": [ - 84, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - "imported": { - "type": "Identifier", - "name": "delete_case6", - "range": [ - 84, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 21 - } - } - }, - "range": [ - 84, - 96 - ], - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 21 - } - } - } - ], - "source": { - "type": "Literal", - "value": "./delete_case6", - "raw": "'./delete_case6'", - "range": [ - 104, - 120 - ], - "loc": { - "start": { - "line": 3, - "column": 29 - }, - "end": { - "line": 3, - "column": 45 - } - } - }, - "range": [ - 75, - 122 - ], - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - { - "type": "ExportNamedDeclaration", - "declaration": { - "type": "FunctionDeclaration", - "id": { - "type": "Identifier", - "name": "delete_case5", - "range": [ - 140, - 152 - ], - "loc": { - "start": { - "line": 5, - "column": 16 - }, - "end": { - "line": 5, - "column": 28 - } - } - }, - "params": [ - { - "type": "Identifier", - "name": "n", - "range": [ - 153, - 154 - ], - "loc": { - "start": { - "line": 5, - "column": 29 - }, - "end": { - "line": 5, - "column": 30 - } - } - } - ], - "body": { - "type": "BlockStatement", - "body": [ - { - "type": "VariableDeclaration", - "declarations": [ - { - "type": "VariableDeclarator", - "id": { - "type": "Identifier", - "name": "s", - "range": [ - 165, - 166 - ], - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - "init": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "sibling", - "range": [ - 169, - 176 - ], - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 18 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "n", - "range": [ - 177, - 178 - ], - "loc": { - "start": { - "line": 7, - "column": 19 - }, - "end": { - "line": 7, - "column": 20 - } - } - } - ], - "range": [ - 169, - 179 - ], - "loc": { - "start": { - "line": 7, - "column": 11 - }, - "end": { - "line": 7, - "column": 21 - } - } - }, - "range": [ - 165, - 179 - ], - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 21 - } - } - } - ], - "kind": "const", - "range": [ - 159, - 180 - ], - "loc": { - "start": { - "line": 7, - "column": 1 - }, - "end": { - "line": 7, - "column": 22 - } - } - }, - { - "type": "IfStatement", - "test": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 188, - 189 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 7 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 190, - 195 - ], - "loc": { - "start": { - "line": 9, - "column": 8 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - "range": [ - 188, - 195 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 13 - } - } - }, - "right": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 200, - 205 - ], - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 23 - } - } - }, - "range": [ - 188, - 205 - ], - "loc": { - "start": { - "line": 9, - "column": 6 - }, - "end": { - "line": 9, - "column": 23 - } - } - }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "IfStatement", - "test": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "Identifier", - "name": "n", - "range": [ - 561, - 562 - ], - "loc": { - "start": { - "line": 14, - "column": 7 - }, - "end": { - "line": 14, - "column": 8 - } - } - }, - "right": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 567, - 568 - ], - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 14 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 569, - 575 - ], - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 14, - "column": 21 - } - } - }, - "range": [ - 567, - 575 - ], - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 21 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 576, - 580 - ], - "loc": { - "start": { - "line": 14, - "column": 22 - }, - "end": { - "line": 14, - "column": 26 - } - } - }, - "range": [ - 567, - 580 - ], - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 26 - } - } - }, - "range": [ - 561, - 580 - ], - "loc": { - "start": { - "line": 14, - "column": 7 - }, - "end": { - "line": 14, - "column": 26 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 592, - 593 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 594, - 599 - ], - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "range": [ - 592, - 599 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 14 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 600, - 605 - ], - "loc": { - "start": { - "line": 15, - "column": 15 - }, - "end": { - "line": 15, - "column": 20 - } - } - }, - "range": [ - 592, - 605 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 20 - } - } - }, - "right": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 610, - 615 - ], - "loc": { - "start": { - "line": 15, - "column": 25 - }, - "end": { - "line": 15, - "column": 30 - } - } - }, - "range": [ - 592, - 615 - ], - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 30 - } - } - }, - "range": [ - 560, - 616 - ], - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 15, - "column": 31 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 627, - 628 - ], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 8 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 629, - 633 - ], - "loc": { - "start": { - "line": 16, - "column": 9 - }, - "end": { - "line": 16, - "column": 13 - } - } - }, - "range": [ - 627, - 633 - ], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 13 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 634, - 639 - ], - "loc": { - "start": { - "line": 16, - "column": 14 - }, - "end": { - "line": 16, - "column": 19 - } - } - }, - "range": [ - 627, - 639 - ], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 19 - } - } - }, - "right": { - "type": "Identifier", - "name": "RED", - "range": [ - 644, - 647 - ], - "loc": { - "start": { - "line": 16, - "column": 24 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "range": [ - 627, - 647 - ], - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - "range": [ - 560, - 648 - ], - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 16, - "column": 28 - } - } - }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 709, - 710 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 4 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 711, - 716 - ], - "loc": { - "start": { - "line": 17, - "column": 5 - }, - "end": { - "line": 17, - "column": 10 - } - } - }, - "range": [ - 709, - 716 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "RED", - "range": [ - 719, - 722 - ], - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "range": [ - 709, - 722 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - "range": [ - 709, - 723 - ], - "loc": { - "start": { - "line": 17, - "column": 3 - }, - "end": { - "line": 17, - "column": 17 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " this last test is trivial too due to cases 2-4. ", - "range": [ - 652, - 705 - ], - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 85 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 727, - 728 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 4 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 729, - 733 - ], - "loc": { - "start": { - "line": 18, - "column": 5 - }, - "end": { - "line": 18, - "column": 9 - } - } - }, - "range": [ - 727, - 733 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 9 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 734, - 739 - ], - "loc": { - "start": { - "line": 18, - "column": 10 - }, - "end": { - "line": 18, - "column": 15 - } - } - }, - "range": [ - 727, - 739 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 15 - } - } - }, - "right": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 742, - 747 - ], - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "range": [ - 727, - 747 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 23 - } - } - }, - "range": [ - 727, - 748 - ], - "loc": { - "start": { - "line": 18, - "column": 3 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "rotate_right", - "range": [ - 752, - 764 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 15 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "s", - "range": [ - 765, - 766 - ], - "loc": { - "start": { - "line": 19, - "column": 16 - }, - "end": { - "line": 19, - "column": 17 - } - } - } - ], - "range": [ - 752, - 767 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 18 - } - } - }, - "range": [ - 752, - 768 - ], - "loc": { - "start": { - "line": 19, - "column": 3 - }, - "end": { - "line": 19, - "column": 19 - } - } - } - ], - "range": [ - 650, - 772 - ], - "loc": { - "start": { - "line": 16, - "column": 30 - }, - "end": { - "line": 20, - "column": 3 - } - } - }, - "alternate": { - "type": "IfStatement", - "test": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "LogicalExpression", - "operator": "&&", - "left": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "Identifier", - "name": "n", - "range": [ - 783, - 784 - ], - "loc": { - "start": { - "line": 20, - "column": 14 - }, - "end": { - "line": 20, - "column": 15 - } - } - }, - "right": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "n", - "range": [ - 789, - 790 - ], - "loc": { - "start": { - "line": 20, - "column": 20 - }, - "end": { - "line": 20, - "column": 21 - } - } - }, - "property": { - "type": "Identifier", - "name": "parent", - "range": [ - 791, - 797 - ], - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 28 - } - } - }, - "range": [ - 789, - 797 - ], - "loc": { - "start": { - "line": 20, - "column": 20 - }, - "end": { - "line": 20, - "column": 28 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 798, - 803 - ], - "loc": { - "start": { - "line": 20, - "column": 29 - }, - "end": { - "line": 20, - "column": 34 - } - } - }, - "range": [ - 789, - 803 - ], - "loc": { - "start": { - "line": 20, - "column": 20 - }, - "end": { - "line": 20, - "column": 34 - } - } - }, - "range": [ - 783, - 803 - ], - "loc": { - "start": { - "line": 20, - "column": 14 - }, - "end": { - "line": 20, - "column": 34 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 822, - 823 - ], - "loc": { - "start": { - "line": 21, - "column": 14 - }, - "end": { - "line": 21, - "column": 15 - } - } - }, - "property": { - "type": "Identifier", - "name": "left", - "range": [ - 824, - 828 - ], - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - "range": [ - 822, - 828 - ], - "loc": { - "start": { - "line": 21, - "column": 14 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 829, - 834 - ], - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, - "range": [ - 822, - 834 - ], - "loc": { - "start": { - "line": 21, - "column": 14 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, - "right": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 839, - 844 - ], - "loc": { - "start": { - "line": 21, - "column": 31 - }, - "end": { - "line": 21, - "column": 36 - } - } - }, - "range": [ - 822, - 844 - ], - "loc": { - "start": { - "line": 21, - "column": 14 - }, - "end": { - "line": 21, - "column": 36 - } - } - }, - "range": [ - 782, - 845 - ], - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 21, - "column": 37 - } - } - }, - "right": { - "type": "BinaryExpression", - "operator": "===", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 863, - 864 - ], - "loc": { - "start": { - "line": 22, - "column": 14 - }, - "end": { - "line": 22, - "column": 15 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 865, - 870 - ], - "loc": { - "start": { - "line": 22, - "column": 16 - }, - "end": { - "line": 22, - "column": 21 - } - } - }, - "range": [ - 863, - 870 - ], - "loc": { - "start": { - "line": 22, - "column": 14 - }, - "end": { - "line": 22, - "column": 21 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 871, - 876 - ], - "loc": { - "start": { - "line": 22, - "column": 22 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "range": [ - 863, - 876 - ], - "loc": { - "start": { - "line": 22, - "column": 14 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - "right": { - "type": "Identifier", - "name": "RED", - "range": [ - 881, - 884 - ], - "loc": { - "start": { - "line": 22, - "column": 32 - }, - "end": { - "line": 22, - "column": 35 - } - } - }, - "range": [ - 863, - 884 - ], - "loc": { - "start": { - "line": 22, - "column": 14 - }, - "end": { - "line": 22, - "column": 35 - } - } - }, - "range": [ - 782, - 885 - ], - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 22, - "column": 36 - } - } - }, - "consequent": { - "type": "BlockStatement", - "body": [ - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 945, - 946 - ], - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 4 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 947, - 952 - ], - "loc": { - "start": { - "line": 23, - "column": 5 - }, - "end": { - "line": 23, - "column": 10 - } - } - }, - "range": [ - 945, - 952 - ], - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 10 - } - } - }, - "right": { - "type": "Identifier", - "name": "RED", - "range": [ - 955, - 958 - ], - "loc": { - "start": { - "line": 23, - "column": 13 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, - "range": [ - 945, - 958 - ], - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, - "range": [ - 945, - 959 - ], - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 17 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " this last test is trivial too due to cases 2-4. ", - "range": [ - 888, - 941 - ], - "loc": { - "start": { - "line": 22, - "column": 39 - }, - "end": { - "line": 22, - "column": 92 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "AssignmentExpression", - "operator": "=", - "left": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "MemberExpression", - "computed": false, - "object": { - "type": "Identifier", - "name": "s", - "range": [ - 963, - 964 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 4 - } - } - }, - "property": { - "type": "Identifier", - "name": "right", - "range": [ - 965, - 970 - ], - "loc": { - "start": { - "line": 24, - "column": 5 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - "range": [ - 963, - 970 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "name": "color", - "range": [ - 971, - 976 - ], - "loc": { - "start": { - "line": 24, - "column": 11 - }, - "end": { - "line": 24, - "column": 16 - } - } - }, - "range": [ - 963, - 976 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 16 - } - } - }, - "right": { - "type": "Identifier", - "name": "BLACK", - "range": [ - 979, - 984 - ], - "loc": { - "start": { - "line": 24, - "column": 19 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, - "range": [ - 963, - 984 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 24 - } - } - }, - "range": [ - 963, - 985 - ], - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 25 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "rotate_left", - "range": [ - 989, - 1000 - ], - "loc": { - "start": { - "line": 25, - "column": 3 - }, - "end": { - "line": 25, - "column": 14 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "s", - "range": [ - 1001, - 1002 - ], - "loc": { - "start": { - "line": 25, - "column": 15 - }, - "end": { - "line": 25, - "column": 16 - } - } - } - ], - "range": [ - 989, - 1003 - ], - "loc": { - "start": { - "line": 25, - "column": 3 - }, - "end": { - "line": 25, - "column": 17 - } - } - }, - "range": [ - 989, - 1004 - ], - "loc": { - "start": { - "line": 25, - "column": 3 - }, - "end": { - "line": 25, - "column": 18 - } - } - } - ], - "range": [ - 887, - 1008 - ], - "loc": { - "start": { - "line": 22, - "column": 38 - }, - "end": { - "line": 26, - "column": 3 - } - } - }, - "alternate": null, - "range": [ - 778, - 1008 - ], - "loc": { - "start": { - "line": 20, - "column": 9 - }, - "end": { - "line": 26, - "column": 3 - } - } - }, - "range": [ - 556, - 1008 - ], - "loc": { - "start": { - "line": 14, - "column": 2 - }, - "end": { - "line": 26, - "column": 3 - } - }, - "leadingComments": [ - { - "type": "Block", - "value": " this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). ", - "range": [ - 209, - 397 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 11, - "column": 79 - } - } - }, - { - "type": "Block", - "value": " the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. ", - "range": [ - 398, - 553 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 13, - "column": 63 - } - } - } - ] - } - ], - "range": [ - 207, - 1011 - ], - "loc": { - "start": { - "line": 9, - "column": 25 - }, - "end": { - "line": 27, - "column": 2 - } - } - }, - "alternate": null, - "range": [ - 183, - 1011 - ], - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 27, - "column": 2 - } - } - }, - { - "type": "ExpressionStatement", - "expression": { - "type": "CallExpression", - "callee": { - "type": "Identifier", - "name": "delete_case6", - "range": [ - 1013, - 1025 - ], - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 13 - } - } - }, - "arguments": [ - { - "type": "Identifier", - "name": "n", - "range": [ - 1026, - 1027 - ], - "loc": { - "start": { - "line": 28, - "column": 14 - }, - "end": { - "line": 28, - "column": 15 - } - } - } - ], - "range": [ - 1013, - 1028 - ], - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 16 - } - } - }, - "range": [ - 1013, - 1029 - ], - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 17 - } - } - } - ], - "range": [ - 156, - 1031 - ], - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 29, - "column": 1 - } - } - }, - "generator": false, - "expression": false, - "range": [ - 131, - 1031 - ], - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 29, - "column": 1 - } - }, - "leadingComments": [], - "trailingComments": [] - }, - "specifiers": [], - "source": null, - "range": [ - 124, - 1031 - ], - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 29, - "column": 1 - } - } - } - ], - "sourceType": "module", - "range": [ - 0, - 1031 - ], - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 29, - "column": 1 - } - }, - "comments": [ - { - "type": "Block", - "value": " this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). ", - "range": [ - 209, - 397 - ], - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 11, - "column": 79 - } - } - }, - { - "type": "Block", - "value": " the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. ", - "range": [ - 398, - 553 - ], - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 13, - "column": 63 - } - } - }, - { - "type": "Block", - "value": " this last test is trivial too due to cases 2-4. ", - "range": [ - 652, - 705 - ], - "loc": { - "start": { - "line": 16, - "column": 32 - }, - "end": { - "line": 16, - "column": 85 - } - } - }, - { - "type": "Block", - "value": " this last test is trivial too due to cases 2-4. ", - "range": [ - 888, - 941 - ], - "loc": { - "start": { - "line": 22, - "column": 39 - }, - "end": { - "line": 22, - "column": 92 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/rotate/rotate_left.js.json b/ast/source/rotate/rotate_left.js.json index ae6d207..240e8dd 100644 --- a/ast/source/rotate/rotate_left.js.json +++ b/ast/source/rotate/rotate_left.js.json @@ -9,8 +9,8 @@ "type": "Identifier", "name": "rotate_left", "range": [ - 299, - 310 + 348, + 359 ], "loc": { "start": { @@ -28,8 +28,8 @@ "type": "Identifier", "name": "A", "range": [ - 313, - 314 + 362, + 363 ], "loc": { "start": { @@ -55,8 +55,8 @@ "type": "Identifier", "name": "B", "range": [ - 327, - 328 + 376, + 377 ], "loc": { "start": { @@ -76,8 +76,8 @@ "type": "Identifier", "name": "A", "range": [ - 331, - 332 + 380, + 381 ], "loc": { "start": { @@ -94,8 +94,8 @@ "type": "Identifier", "name": "right", "range": [ - 333, - 338 + 382, + 387 ], "loc": { "start": { @@ -109,8 +109,8 @@ } }, "range": [ - 331, - 338 + 380, + 387 ], "loc": { "start": { @@ -124,8 +124,8 @@ } }, "range": [ - 327, - 338 + 376, + 387 ], "loc": { "start": { @@ -141,8 +141,8 @@ ], "kind": "const", "range": [ - 321, - 340 + 370, + 389 ], "loc": { "start": { @@ -164,8 +164,8 @@ "type": "Identifier", "name": "a", "range": [ - 348, - 349 + 397, + 398 ], "loc": { "start": { @@ -185,8 +185,8 @@ "type": "Identifier", "name": "A", "range": [ - 352, - 353 + 401, + 402 ], "loc": { "start": { @@ -203,8 +203,8 @@ "type": "Identifier", "name": "left", "range": [ - 354, - 358 + 403, + 407 ], "loc": { "start": { @@ -218,8 +218,8 @@ } }, "range": [ - 352, - 358 + 401, + 407 ], "loc": { "start": { @@ -233,8 +233,8 @@ } }, "range": [ - 348, - 358 + 397, + 407 ], "loc": { "start": { @@ -250,8 +250,8 @@ ], "kind": "const", "range": [ - 342, - 360 + 391, + 409 ], "loc": { "start": { @@ -273,8 +273,8 @@ "type": "Identifier", "name": "b", "range": [ - 368, - 369 + 417, + 418 ], "loc": { "start": { @@ -294,8 +294,8 @@ "type": "Identifier", "name": "B", "range": [ - 372, - 373 + 421, + 422 ], "loc": { "start": { @@ -312,8 +312,8 @@ "type": "Identifier", "name": "left", "range": [ - 374, - 378 + 423, + 427 ], "loc": { "start": { @@ -327,8 +327,8 @@ } }, "range": [ - 372, - 378 + 421, + 427 ], "loc": { "start": { @@ -342,8 +342,8 @@ } }, "range": [ - 368, - 378 + 417, + 427 ], "loc": { "start": { @@ -359,8 +359,8 @@ ], "kind": "const", "range": [ - 362, - 380 + 411, + 429 ], "loc": { "start": { @@ -382,8 +382,8 @@ "type": "Identifier", "name": "c", "range": [ - 388, - 389 + 437, + 438 ], "loc": { "start": { @@ -403,8 +403,8 @@ "type": "Identifier", "name": "B", "range": [ - 392, - 393 + 441, + 442 ], "loc": { "start": { @@ -421,8 +421,8 @@ "type": "Identifier", "name": "right", "range": [ - 394, - 399 + 443, + 448 ], "loc": { "start": { @@ -436,8 +436,8 @@ } }, "range": [ - 392, - 399 + 441, + 448 ], "loc": { "start": { @@ -451,8 +451,8 @@ } }, "range": [ - 388, - 399 + 437, + 448 ], "loc": { "start": { @@ -468,8 +468,8 @@ ], "kind": "const", "range": [ - 382, - 401 + 431, + 450 ], "loc": { "start": { @@ -497,8 +497,8 @@ "type": "Identifier", "name": "A", "range": [ - 405, - 406 + 454, + 455 ], "loc": { "start": { @@ -513,10 +513,10 @@ }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 407, - 412 + 456, + 459 ], "loc": { "start": { @@ -525,13 +525,13 @@ }, "end": { "line": 23, - "column": 9 + "column": 7 } } }, "range": [ - 405, - 412 + 454, + 459 ], "loc": { "start": { @@ -540,7 +540,7 @@ }, "end": { "line": 23, - "column": 9 + "column": 7 } } }, @@ -551,57 +551,57 @@ "type": "Identifier", "name": "B", "range": [ - 415, - 416 + 462, + 463 ], "loc": { "start": { "line": 23, - "column": 12 + "column": 10 }, "end": { "line": 23, - "column": 13 + "column": 11 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 417, - 422 + 464, + 467 ], "loc": { "start": { "line": 23, - "column": 14 + "column": 12 }, "end": { "line": 23, - "column": 19 + "column": 15 } } }, "range": [ - 415, - 422 + 462, + 467 ], "loc": { "start": { "line": 23, - "column": 12 + "column": 10 }, "end": { "line": 23, - "column": 19 + "column": 15 } } } ], "range": [ - 404, - 423 + 453, + 468 ], "loc": { "start": { @@ -610,7 +610,7 @@ }, "end": { "line": 23, - "column": 20 + "column": 16 } } }, @@ -624,50 +624,50 @@ "type": "Identifier", "name": "B", "range": [ - 427, - 428 + 472, + 473 ], "loc": { "start": { "line": 23, - "column": 24 + "column": 20 }, "end": { "line": 23, - "column": 25 + "column": 21 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 429, - 434 + 474, + 477 ], "loc": { "start": { "line": 23, - "column": 26 + "column": 22 }, "end": { "line": 23, - "column": 31 + "column": 25 } } }, "range": [ - 427, - 434 + 472, + 477 ], "loc": { "start": { "line": 23, - "column": 24 + "column": 20 }, "end": { "line": 23, - "column": 31 + "column": 25 } } }, @@ -678,72 +678,72 @@ "type": "Identifier", "name": "A", "range": [ - 437, - 438 + 480, + 481 ], "loc": { "start": { "line": 23, - "column": 34 + "column": 28 }, "end": { "line": 23, - "column": 35 + "column": 29 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 439, - 444 + 482, + 485 ], "loc": { "start": { "line": 23, - "column": 36 + "column": 30 }, "end": { "line": 23, - "column": 41 + "column": 33 } } }, "range": [ - 437, - 444 + 480, + 485 ], "loc": { "start": { "line": 23, - "column": 34 + "column": 28 }, "end": { "line": 23, - "column": 41 + "column": 33 } } } ], "range": [ - 426, - 445 + 471, + 486 ], "loc": { "start": { "line": 23, - "column": 23 + "column": 19 }, "end": { "line": 23, - "column": 42 + "column": 34 } } }, "range": [ - 404, - 445 + 453, + 486 ], "loc": { "start": { @@ -752,13 +752,13 @@ }, "end": { "line": 23, - "column": 42 + "column": 34 } } }, "range": [ - 404, - 447 + 453, + 488 ], "loc": { "start": { @@ -767,7 +767,7 @@ }, "end": { "line": 23, - "column": 44 + "column": 36 } } }, @@ -786,8 +786,8 @@ "type": "Identifier", "name": "A", "range": [ - 450, - 451 + 491, + 492 ], "loc": { "start": { @@ -804,8 +804,8 @@ "type": "Identifier", "name": "color", "range": [ - 452, - 457 + 493, + 498 ], "loc": { "start": { @@ -819,8 +819,8 @@ } }, "range": [ - 450, - 457 + 491, + 498 ], "loc": { "start": { @@ -840,8 +840,8 @@ "type": "Identifier", "name": "B", "range": [ - 460, - 461 + 501, + 502 ], "loc": { "start": { @@ -858,8 +858,8 @@ "type": "Identifier", "name": "color", "range": [ - 462, - 467 + 503, + 508 ], "loc": { "start": { @@ -873,8 +873,8 @@ } }, "range": [ - 460, - 467 + 501, + 508 ], "loc": { "start": { @@ -889,8 +889,8 @@ } ], "range": [ - 449, - 468 + 490, + 509 ], "loc": { "start": { @@ -913,8 +913,8 @@ "type": "Identifier", "name": "B", "range": [ - 472, - 473 + 513, + 514 ], "loc": { "start": { @@ -931,8 +931,8 @@ "type": "Identifier", "name": "color", "range": [ - 474, - 479 + 515, + 520 ], "loc": { "start": { @@ -946,8 +946,8 @@ } }, "range": [ - 472, - 479 + 513, + 520 ], "loc": { "start": { @@ -967,8 +967,8 @@ "type": "Identifier", "name": "A", "range": [ - 482, - 483 + 523, + 524 ], "loc": { "start": { @@ -985,8 +985,8 @@ "type": "Identifier", "name": "color", "range": [ - 484, - 489 + 525, + 530 ], "loc": { "start": { @@ -1000,8 +1000,8 @@ } }, "range": [ - 482, - 489 + 523, + 530 ], "loc": { "start": { @@ -1016,8 +1016,8 @@ } ], "range": [ - 471, - 490 + 512, + 531 ], "loc": { "start": { @@ -1031,8 +1031,8 @@ } }, "range": [ - 449, - 490 + 490, + 531 ], "loc": { "start": { @@ -1046,8 +1046,8 @@ } }, "range": [ - 449, - 492 + 490, + 533 ], "loc": { "start": { @@ -1072,8 +1072,8 @@ "type": "Identifier", "name": "A", "range": [ - 495, - 496 + 536, + 537 ], "loc": { "start": { @@ -1090,8 +1090,8 @@ "type": "Identifier", "name": "left", "range": [ - 497, - 501 + 538, + 542 ], "loc": { "start": { @@ -1105,8 +1105,8 @@ } }, "range": [ - 495, - 501 + 536, + 542 ], "loc": { "start": { @@ -1123,8 +1123,8 @@ "type": "Identifier", "name": "B", "range": [ - 504, - 505 + 545, + 546 ], "loc": { "start": { @@ -1138,8 +1138,8 @@ } }, "range": [ - 495, - 505 + 536, + 546 ], "loc": { "start": { @@ -1153,8 +1153,8 @@ } }, "range": [ - 495, - 507 + 536, + 548 ], "loc": { "start": { @@ -1179,8 +1179,8 @@ "type": "Identifier", "name": "A", "range": [ - 509, - 510 + 550, + 551 ], "loc": { "start": { @@ -1197,8 +1197,8 @@ "type": "Identifier", "name": "right", "range": [ - 511, - 516 + 552, + 557 ], "loc": { "start": { @@ -1212,8 +1212,8 @@ } }, "range": [ - 509, - 516 + 550, + 557 ], "loc": { "start": { @@ -1230,8 +1230,8 @@ "type": "Identifier", "name": "c", "range": [ - 519, - 520 + 560, + 561 ], "loc": { "start": { @@ -1245,8 +1245,8 @@ } }, "range": [ - 509, - 520 + 550, + 561 ], "loc": { "start": { @@ -1260,8 +1260,8 @@ } }, "range": [ - 509, - 522 + 550, + 563 ], "loc": { "start": { @@ -1286,8 +1286,8 @@ "type": "Identifier", "name": "B", "range": [ - 525, - 526 + 566, + 567 ], "loc": { "start": { @@ -1304,8 +1304,8 @@ "type": "Identifier", "name": "left", "range": [ - 527, - 531 + 568, + 572 ], "loc": { "start": { @@ -1319,8 +1319,8 @@ } }, "range": [ - 525, - 531 + 566, + 572 ], "loc": { "start": { @@ -1337,8 +1337,8 @@ "type": "Identifier", "name": "a", "range": [ - 534, - 535 + 575, + 576 ], "loc": { "start": { @@ -1352,8 +1352,8 @@ } }, "range": [ - 525, - 535 + 566, + 576 ], "loc": { "start": { @@ -1367,8 +1367,8 @@ } }, "range": [ - 525, - 537 + 566, + 578 ], "loc": { "start": { @@ -1393,8 +1393,8 @@ "type": "Identifier", "name": "B", "range": [ - 539, - 540 + 580, + 581 ], "loc": { "start": { @@ -1411,8 +1411,8 @@ "type": "Identifier", "name": "right", "range": [ - 541, - 546 + 582, + 587 ], "loc": { "start": { @@ -1426,8 +1426,8 @@ } }, "range": [ - 539, - 546 + 580, + 587 ], "loc": { "start": { @@ -1444,8 +1444,8 @@ "type": "Identifier", "name": "b", "range": [ - 549, - 550 + 590, + 591 ], "loc": { "start": { @@ -1459,8 +1459,8 @@ } }, "range": [ - 539, - 550 + 580, + 591 ], "loc": { "start": { @@ -1474,8 +1474,8 @@ } }, "range": [ - 539, - 552 + 580, + 593 ], "loc": { "start": { @@ -1500,8 +1500,8 @@ "type": "Identifier", "name": "a", "range": [ - 555, - 556 + 596, + 597 ], "loc": { "start": { @@ -1518,8 +1518,8 @@ "type": "Identifier", "name": "parent", "range": [ - 557, - 563 + 598, + 604 ], "loc": { "start": { @@ -1533,8 +1533,8 @@ } }, "range": [ - 555, - 563 + 596, + 604 ], "loc": { "start": { @@ -1551,8 +1551,8 @@ "type": "Identifier", "name": "B", "range": [ - 566, - 567 + 607, + 608 ], "loc": { "start": { @@ -1566,8 +1566,8 @@ } }, "range": [ - 555, - 567 + 596, + 608 ], "loc": { "start": { @@ -1581,8 +1581,8 @@ } }, "range": [ - 555, - 569 + 596, + 610 ], "loc": { "start": { @@ -1607,8 +1607,8 @@ "type": "Identifier", "name": "b", "range": [ - 571, - 572 + 612, + 613 ], "loc": { "start": { @@ -1625,8 +1625,8 @@ "type": "Identifier", "name": "parent", "range": [ - 573, - 579 + 614, + 620 ], "loc": { "start": { @@ -1640,8 +1640,8 @@ } }, "range": [ - 571, - 579 + 612, + 620 ], "loc": { "start": { @@ -1658,8 +1658,8 @@ "type": "Identifier", "name": "B", "range": [ - 582, - 583 + 623, + 624 ], "loc": { "start": { @@ -1673,8 +1673,8 @@ } }, "range": [ - 571, - 583 + 612, + 624 ], "loc": { "start": { @@ -1688,8 +1688,8 @@ } }, "range": [ - 571, - 585 + 612, + 626 ], "loc": { "start": { @@ -1714,8 +1714,8 @@ "type": "Identifier", "name": "c", "range": [ - 587, - 588 + 628, + 629 ], "loc": { "start": { @@ -1732,8 +1732,8 @@ "type": "Identifier", "name": "parent", "range": [ - 589, - 595 + 630, + 636 ], "loc": { "start": { @@ -1747,8 +1747,8 @@ } }, "range": [ - 587, - 595 + 628, + 636 ], "loc": { "start": { @@ -1765,8 +1765,8 @@ "type": "Identifier", "name": "A", "range": [ - 598, - 599 + 639, + 640 ], "loc": { "start": { @@ -1780,8 +1780,8 @@ } }, "range": [ - 587, - 599 + 628, + 640 ], "loc": { "start": { @@ -1795,8 +1795,8 @@ } }, "range": [ - 587, - 601 + 628, + 642 ], "loc": { "start": { @@ -1811,8 +1811,8 @@ } ], "range": [ - 317, - 603 + 366, + 644 ], "loc": { "start": { @@ -1828,8 +1828,8 @@ "generator": false, "expression": false, "range": [ - 290, - 603 + 339, + 644 ], "loc": { "start": { @@ -1844,10 +1844,10 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", "range": [ 0, - 281 + 330 ], "loc": { "start": { @@ -1866,8 +1866,8 @@ "specifiers": [], "source": null, "range": [ - 283, - 603 + 332, + 644 ], "loc": { "start": { @@ -1882,10 +1882,10 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", "range": [ 0, - 281 + 330 ], "loc": { "start": { @@ -1903,8 +1903,8 @@ ], "sourceType": "module", "range": [ - 283, - 603 + 332, + 644 ], "loc": { "start": { @@ -1919,10 +1919,10 @@ "comments": [ { "type": "Block", - "value": "*\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n ", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", "range": [ 0, - 281 + 330 ], "loc": { "start": { diff --git a/ast/source/rotate/rotate_right.js.json b/ast/source/rotate/rotate_right.js.json index 9377184..b3b46c6 100644 --- a/ast/source/rotate/rotate_right.js.json +++ b/ast/source/rotate/rotate_right.js.json @@ -9,8 +9,8 @@ "type": "Identifier", "name": "rotate_right", "range": [ - 308, - 320 + 357, + 369 ], "loc": { "start": { @@ -28,8 +28,8 @@ "type": "Identifier", "name": "B", "range": [ - 323, - 324 + 372, + 373 ], "loc": { "start": { @@ -55,8 +55,8 @@ "type": "Identifier", "name": "A", "range": [ - 337, - 338 + 386, + 387 ], "loc": { "start": { @@ -76,8 +76,8 @@ "type": "Identifier", "name": "B", "range": [ - 341, - 342 + 390, + 391 ], "loc": { "start": { @@ -94,8 +94,8 @@ "type": "Identifier", "name": "left", "range": [ - 343, - 347 + 392, + 396 ], "loc": { "start": { @@ -109,8 +109,8 @@ } }, "range": [ - 341, - 347 + 390, + 396 ], "loc": { "start": { @@ -124,8 +124,8 @@ } }, "range": [ - 337, - 347 + 386, + 396 ], "loc": { "start": { @@ -141,8 +141,8 @@ ], "kind": "const", "range": [ - 331, - 348 + 380, + 397 ], "loc": { "start": { @@ -164,8 +164,8 @@ "type": "Identifier", "name": "a", "range": [ - 356, - 357 + 405, + 406 ], "loc": { "start": { @@ -185,8 +185,8 @@ "type": "Identifier", "name": "A", "range": [ - 360, - 361 + 409, + 410 ], "loc": { "start": { @@ -203,8 +203,8 @@ "type": "Identifier", "name": "left", "range": [ - 362, - 366 + 411, + 415 ], "loc": { "start": { @@ -218,8 +218,8 @@ } }, "range": [ - 360, - 366 + 409, + 415 ], "loc": { "start": { @@ -233,8 +233,8 @@ } }, "range": [ - 356, - 366 + 405, + 415 ], "loc": { "start": { @@ -250,8 +250,8 @@ ], "kind": "const", "range": [ - 350, - 368 + 399, + 417 ], "loc": { "start": { @@ -273,8 +273,8 @@ "type": "Identifier", "name": "b", "range": [ - 376, - 377 + 425, + 426 ], "loc": { "start": { @@ -294,8 +294,8 @@ "type": "Identifier", "name": "A", "range": [ - 380, - 381 + 429, + 430 ], "loc": { "start": { @@ -312,8 +312,8 @@ "type": "Identifier", "name": "right", "range": [ - 382, - 387 + 431, + 436 ], "loc": { "start": { @@ -327,8 +327,8 @@ } }, "range": [ - 380, - 387 + 429, + 436 ], "loc": { "start": { @@ -342,8 +342,8 @@ } }, "range": [ - 376, - 387 + 425, + 436 ], "loc": { "start": { @@ -359,8 +359,8 @@ ], "kind": "const", "range": [ - 370, - 389 + 419, + 438 ], "loc": { "start": { @@ -382,8 +382,8 @@ "type": "Identifier", "name": "c", "range": [ - 397, - 398 + 446, + 447 ], "loc": { "start": { @@ -403,8 +403,8 @@ "type": "Identifier", "name": "B", "range": [ - 401, - 402 + 450, + 451 ], "loc": { "start": { @@ -421,8 +421,8 @@ "type": "Identifier", "name": "right", "range": [ - 403, - 408 + 452, + 457 ], "loc": { "start": { @@ -436,8 +436,8 @@ } }, "range": [ - 401, - 408 + 450, + 457 ], "loc": { "start": { @@ -451,8 +451,8 @@ } }, "range": [ - 397, - 408 + 446, + 457 ], "loc": { "start": { @@ -468,8 +468,8 @@ ], "kind": "const", "range": [ - 391, - 410 + 440, + 459 ], "loc": { "start": { @@ -497,8 +497,8 @@ "type": "Identifier", "name": "A", "range": [ - 414, - 415 + 463, + 464 ], "loc": { "start": { @@ -513,10 +513,10 @@ }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 416, - 421 + 465, + 468 ], "loc": { "start": { @@ -525,13 +525,13 @@ }, "end": { "line": 23, - "column": 9 + "column": 7 } } }, "range": [ - 414, - 421 + 463, + 468 ], "loc": { "start": { @@ -540,7 +540,7 @@ }, "end": { "line": 23, - "column": 9 + "column": 7 } } }, @@ -551,57 +551,57 @@ "type": "Identifier", "name": "B", "range": [ - 424, - 425 + 471, + 472 ], "loc": { "start": { "line": 23, - "column": 12 + "column": 10 }, "end": { "line": 23, - "column": 13 + "column": 11 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 426, - 431 + 473, + 476 ], "loc": { "start": { "line": 23, - "column": 14 + "column": 12 }, "end": { "line": 23, - "column": 19 + "column": 15 } } }, "range": [ - 424, - 431 + 471, + 476 ], "loc": { "start": { "line": 23, - "column": 12 + "column": 10 }, "end": { "line": 23, - "column": 19 + "column": 15 } } } ], "range": [ - 413, - 432 + 462, + 477 ], "loc": { "start": { @@ -610,7 +610,7 @@ }, "end": { "line": 23, - "column": 20 + "column": 16 } } }, @@ -624,50 +624,50 @@ "type": "Identifier", "name": "B", "range": [ - 436, - 437 + 481, + 482 ], "loc": { "start": { "line": 23, - "column": 24 + "column": 20 }, "end": { "line": 23, - "column": 25 + "column": 21 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 438, - 443 + 483, + 486 ], "loc": { "start": { "line": 23, - "column": 26 + "column": 22 }, "end": { "line": 23, - "column": 31 + "column": 25 } } }, "range": [ - 436, - 443 + 481, + 486 ], "loc": { "start": { "line": 23, - "column": 24 + "column": 20 }, "end": { "line": 23, - "column": 31 + "column": 25 } } }, @@ -678,72 +678,72 @@ "type": "Identifier", "name": "A", "range": [ - 446, - 447 + 489, + 490 ], "loc": { "start": { "line": 23, - "column": 34 + "column": 28 }, "end": { "line": 23, - "column": 35 + "column": 29 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 448, - 453 + 491, + 494 ], "loc": { "start": { "line": 23, - "column": 36 + "column": 30 }, "end": { "line": 23, - "column": 41 + "column": 33 } } }, "range": [ - 446, - 453 + 489, + 494 ], "loc": { "start": { "line": 23, - "column": 34 + "column": 28 }, "end": { "line": 23, - "column": 41 + "column": 33 } } } ], "range": [ - 435, - 454 + 480, + 495 ], "loc": { "start": { "line": 23, - "column": 23 + "column": 19 }, "end": { "line": 23, - "column": 42 + "column": 34 } } }, "range": [ - 413, - 454 + 462, + 495 ], "loc": { "start": { @@ -752,13 +752,13 @@ }, "end": { "line": 23, - "column": 42 + "column": 34 } } }, "range": [ - 413, - 456 + 462, + 497 ], "loc": { "start": { @@ -767,7 +767,7 @@ }, "end": { "line": 23, - "column": 44 + "column": 36 } } }, @@ -786,8 +786,8 @@ "type": "Identifier", "name": "A", "range": [ - 459, - 460 + 500, + 501 ], "loc": { "start": { @@ -804,8 +804,8 @@ "type": "Identifier", "name": "color", "range": [ - 461, - 466 + 502, + 507 ], "loc": { "start": { @@ -819,8 +819,8 @@ } }, "range": [ - 459, - 466 + 500, + 507 ], "loc": { "start": { @@ -840,8 +840,8 @@ "type": "Identifier", "name": "B", "range": [ - 469, - 470 + 510, + 511 ], "loc": { "start": { @@ -858,8 +858,8 @@ "type": "Identifier", "name": "color", "range": [ - 471, - 476 + 512, + 517 ], "loc": { "start": { @@ -873,8 +873,8 @@ } }, "range": [ - 469, - 476 + 510, + 517 ], "loc": { "start": { @@ -889,8 +889,8 @@ } ], "range": [ - 458, - 477 + 499, + 518 ], "loc": { "start": { @@ -913,8 +913,8 @@ "type": "Identifier", "name": "B", "range": [ - 481, - 482 + 522, + 523 ], "loc": { "start": { @@ -931,8 +931,8 @@ "type": "Identifier", "name": "color", "range": [ - 483, - 488 + 524, + 529 ], "loc": { "start": { @@ -946,8 +946,8 @@ } }, "range": [ - 481, - 488 + 522, + 529 ], "loc": { "start": { @@ -967,8 +967,8 @@ "type": "Identifier", "name": "A", "range": [ - 491, - 492 + 532, + 533 ], "loc": { "start": { @@ -985,8 +985,8 @@ "type": "Identifier", "name": "color", "range": [ - 493, - 498 + 534, + 539 ], "loc": { "start": { @@ -1000,8 +1000,8 @@ } }, "range": [ - 491, - 498 + 532, + 539 ], "loc": { "start": { @@ -1016,8 +1016,8 @@ } ], "range": [ - 480, - 499 + 521, + 540 ], "loc": { "start": { @@ -1031,8 +1031,8 @@ } }, "range": [ - 458, - 499 + 499, + 540 ], "loc": { "start": { @@ -1046,8 +1046,8 @@ } }, "range": [ - 458, - 501 + 499, + 542 ], "loc": { "start": { @@ -1072,8 +1072,8 @@ "type": "Identifier", "name": "B", "range": [ - 504, - 505 + 545, + 546 ], "loc": { "start": { @@ -1090,8 +1090,8 @@ "type": "Identifier", "name": "left", "range": [ - 506, - 510 + 547, + 551 ], "loc": { "start": { @@ -1105,8 +1105,8 @@ } }, "range": [ - 504, - 510 + 545, + 551 ], "loc": { "start": { @@ -1123,8 +1123,8 @@ "type": "Identifier", "name": "a", "range": [ - 513, - 514 + 554, + 555 ], "loc": { "start": { @@ -1138,8 +1138,8 @@ } }, "range": [ - 504, - 514 + 545, + 555 ], "loc": { "start": { @@ -1153,8 +1153,8 @@ } }, "range": [ - 504, - 516 + 545, + 557 ], "loc": { "start": { @@ -1179,8 +1179,8 @@ "type": "Identifier", "name": "B", "range": [ - 518, - 519 + 559, + 560 ], "loc": { "start": { @@ -1197,8 +1197,8 @@ "type": "Identifier", "name": "right", "range": [ - 520, - 525 + 561, + 566 ], "loc": { "start": { @@ -1212,8 +1212,8 @@ } }, "range": [ - 518, - 525 + 559, + 566 ], "loc": { "start": { @@ -1230,8 +1230,8 @@ "type": "Identifier", "name": "A", "range": [ - 528, - 529 + 569, + 570 ], "loc": { "start": { @@ -1245,8 +1245,8 @@ } }, "range": [ - 518, - 529 + 559, + 570 ], "loc": { "start": { @@ -1260,8 +1260,8 @@ } }, "range": [ - 518, - 531 + 559, + 572 ], "loc": { "start": { @@ -1286,8 +1286,8 @@ "type": "Identifier", "name": "A", "range": [ - 534, - 535 + 575, + 576 ], "loc": { "start": { @@ -1304,8 +1304,8 @@ "type": "Identifier", "name": "left", "range": [ - 536, - 540 + 577, + 581 ], "loc": { "start": { @@ -1319,8 +1319,8 @@ } }, "range": [ - 534, - 540 + 575, + 581 ], "loc": { "start": { @@ -1337,8 +1337,8 @@ "type": "Identifier", "name": "b", "range": [ - 543, - 544 + 584, + 585 ], "loc": { "start": { @@ -1352,8 +1352,8 @@ } }, "range": [ - 534, - 544 + 575, + 585 ], "loc": { "start": { @@ -1367,8 +1367,8 @@ } }, "range": [ - 534, - 546 + 575, + 587 ], "loc": { "start": { @@ -1393,8 +1393,8 @@ "type": "Identifier", "name": "A", "range": [ - 548, - 549 + 589, + 590 ], "loc": { "start": { @@ -1411,8 +1411,8 @@ "type": "Identifier", "name": "right", "range": [ - 550, - 555 + 591, + 596 ], "loc": { "start": { @@ -1426,8 +1426,8 @@ } }, "range": [ - 548, - 555 + 589, + 596 ], "loc": { "start": { @@ -1444,8 +1444,8 @@ "type": "Identifier", "name": "c", "range": [ - 558, - 559 + 599, + 600 ], "loc": { "start": { @@ -1459,8 +1459,8 @@ } }, "range": [ - 548, - 559 + 589, + 600 ], "loc": { "start": { @@ -1474,8 +1474,8 @@ } }, "range": [ - 548, - 561 + 589, + 602 ], "loc": { "start": { @@ -1500,8 +1500,8 @@ "type": "Identifier", "name": "a", "range": [ - 564, - 565 + 605, + 606 ], "loc": { "start": { @@ -1518,8 +1518,8 @@ "type": "Identifier", "name": "parent", "range": [ - 566, - 572 + 607, + 613 ], "loc": { "start": { @@ -1533,8 +1533,8 @@ } }, "range": [ - 564, - 572 + 605, + 613 ], "loc": { "start": { @@ -1551,8 +1551,8 @@ "type": "Identifier", "name": "B", "range": [ - 575, - 576 + 616, + 617 ], "loc": { "start": { @@ -1566,8 +1566,8 @@ } }, "range": [ - 564, - 576 + 605, + 617 ], "loc": { "start": { @@ -1581,8 +1581,8 @@ } }, "range": [ - 564, - 578 + 605, + 619 ], "loc": { "start": { @@ -1607,8 +1607,8 @@ "type": "Identifier", "name": "b", "range": [ - 580, - 581 + 621, + 622 ], "loc": { "start": { @@ -1625,8 +1625,8 @@ "type": "Identifier", "name": "parent", "range": [ - 582, - 588 + 623, + 629 ], "loc": { "start": { @@ -1640,8 +1640,8 @@ } }, "range": [ - 580, - 588 + 621, + 629 ], "loc": { "start": { @@ -1658,8 +1658,8 @@ "type": "Identifier", "name": "A", "range": [ - 591, - 592 + 632, + 633 ], "loc": { "start": { @@ -1673,8 +1673,8 @@ } }, "range": [ - 580, - 592 + 621, + 633 ], "loc": { "start": { @@ -1688,8 +1688,8 @@ } }, "range": [ - 580, - 594 + 621, + 635 ], "loc": { "start": { @@ -1714,8 +1714,8 @@ "type": "Identifier", "name": "c", "range": [ - 596, - 597 + 637, + 638 ], "loc": { "start": { @@ -1732,8 +1732,8 @@ "type": "Identifier", "name": "parent", "range": [ - 598, - 604 + 639, + 645 ], "loc": { "start": { @@ -1747,8 +1747,8 @@ } }, "range": [ - 596, - 604 + 637, + 645 ], "loc": { "start": { @@ -1765,8 +1765,8 @@ "type": "Identifier", "name": "A", "range": [ - 607, - 608 + 648, + 649 ], "loc": { "start": { @@ -1780,8 +1780,8 @@ } }, "range": [ - 596, - 608 + 637, + 649 ], "loc": { "start": { @@ -1795,8 +1795,8 @@ } }, "range": [ - 596, - 610 + 637, + 651 ], "loc": { "start": { @@ -1811,8 +1811,8 @@ } ], "range": [ - 327, - 613 + 376, + 654 ], "loc": { "start": { @@ -1828,8 +1828,8 @@ "generator": false, "expression": false, "range": [ - 299, - 613 + 348, + 654 ], "loc": { "start": { @@ -1844,10 +1844,10 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", "range": [ 0, - 290 + 339 ], "loc": { "start": { @@ -1866,8 +1866,8 @@ "specifiers": [], "source": null, "range": [ - 292, - 613 + 341, + 654 ], "loc": { "start": { @@ -1882,10 +1882,10 @@ "leadingComments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", "range": [ 0, - 290 + 339 ], "loc": { "start": { @@ -1903,8 +1903,8 @@ ], "sourceType": "module", "range": [ - 292, - 613 + 341, + 654 ], "loc": { "start": { @@ -1919,10 +1919,10 @@ "comments": [ { "type": "Block", - "value": "*\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n ", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", "range": [ 0, - 290 + 339 ], "loc": { "start": { diff --git a/ast/source/search/search.js.json b/ast/source/search/search.js.json index 0ef1d5b..1dd9196 100644 --- a/ast/source/search/search.js.json +++ b/ast/source/search/search.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "search", "range": [ - 16, - 22 + 265, + 271 ], "loc": { "start": { - "line": 1, + "line": 9, "column": 16 }, "end": { - "line": 1, + "line": 9, "column": 22 } } @@ -28,53 +28,53 @@ "type": "Identifier", "name": "compare", "range": [ - 25, - 32 + 274, + 281 ], "loc": { "start": { - "line": 1, + "line": 9, "column": 25 }, "end": { - "line": 1, + "line": 9, "column": 32 } } }, { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 34, - 38 + 283, + 287 ], "loc": { "start": { - "line": 1, + "line": 9, "column": 34 }, "end": { - "line": 1, + "line": 9, "column": 38 } } }, { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 40, - 45 + 289, + 292 ], "loc": { "start": { - "line": 1, + "line": 9, "column": 40 }, "end": { - "line": 1, - "column": 45 + "line": 9, + "column": 43 } } } @@ -89,16 +89,16 @@ "value": true, "raw": "true", "range": [ - 124, - 128 + 307, + 311 ], "loc": { "start": { - "line": 6, + "line": 11, "column": 9 }, "end": { - "line": 6, + "line": 11, "column": 13 } } @@ -115,16 +115,16 @@ "type": "Identifier", "name": "d", "range": [ - 142, - 143 + 325, + 326 ], "loc": { "start": { - "line": 8, + "line": 13, "column": 8 }, "end": { - "line": 8, + "line": 13, "column": 9 } } @@ -135,16 +135,16 @@ "type": "Identifier", "name": "compare", "range": [ - 146, - 153 + 329, + 336 ], "loc": { "start": { - "line": 8, + "line": 13, "column": 12 }, "end": { - "line": 8, + "line": 13, "column": 19 } } @@ -152,19 +152,19 @@ "arguments": [ { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 155, - 160 + 338, + 341 ], "loc": { "start": { - "line": 8, + "line": 13, "column": 21 }, "end": { - "line": 8, - "column": 26 + "line": 13, + "column": 24 } } }, @@ -173,100 +173,100 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 162, - 166 + 343, + 347 ], "loc": { "start": { - "line": 8, - "column": 28 + "line": 13, + "column": 26 }, "end": { - "line": 8, - "column": 32 + "line": 13, + "column": 30 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 167, - 172 + 348, + 351 ], "loc": { "start": { - "line": 8, - "column": 33 + "line": 13, + "column": 31 }, "end": { - "line": 8, - "column": 38 + "line": 13, + "column": 34 } } }, "range": [ - 162, - 172 + 343, + 351 ], "loc": { "start": { - "line": 8, - "column": 28 + "line": 13, + "column": 26 }, "end": { - "line": 8, - "column": 38 + "line": 13, + "column": 34 } } } ], "range": [ - 146, - 174 + 329, + 353 ], "loc": { "start": { - "line": 8, + "line": 13, "column": 12 }, "end": { - "line": 8, - "column": 40 + "line": 13, + "column": 36 } } }, "range": [ - 142, - 174 + 325, + 353 ], "loc": { "start": { - "line": 8, + "line": 13, "column": 8 }, "end": { - "line": 8, - "column": 40 + "line": 13, + "column": 36 } } } ], "kind": "const", "range": [ - 136, - 175 + 319, + 354 ], "loc": { "start": { - "line": 8, + "line": 13, "column": 2 }, "end": { - "line": 8, - "column": 41 + "line": 13, + "column": 37 } } }, @@ -279,16 +279,16 @@ "type": "Identifier", "name": "d", "range": [ - 184, - 185 + 363, + 364 ], "loc": { "start": { - "line": 10, + "line": 15, "column": 7 }, "end": { - "line": 10, + "line": 15, "column": 8 } } @@ -298,31 +298,31 @@ "value": 0, "raw": "0", "range": [ - 190, - 191 + 369, + 370 ], "loc": { "start": { - "line": 10, + "line": 15, "column": 13 }, "end": { - "line": 10, + "line": 15, "column": 14 } } }, "range": [ - 184, - 191 + 363, + 370 ], "loc": { "start": { - "line": 10, + "line": 15, "column": 7 }, "end": { - "line": 10, + "line": 15, "column": 14 } } @@ -334,49 +334,49 @@ "type": "ReturnStatement", "argument": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 206, - 210 + 385, + 389 ], "loc": { "start": { - "line": 11, + "line": 16, "column": 10 }, "end": { - "line": 11, + "line": 16, "column": 14 } } }, "range": [ - 199, - 211 + 378, + 390 ], "loc": { "start": { - "line": 11, + "line": 16, "column": 3 }, "end": { - "line": 11, + "line": 16, "column": 15 } } } ], "range": [ - 194, - 215 + 373, + 394 ], "loc": { "start": { - "line": 10, + "line": 15, "column": 17 }, "end": { - "line": 12, + "line": 17, "column": 3 } } @@ -390,16 +390,16 @@ "type": "Identifier", "name": "d", "range": [ - 229, - 230 + 408, + 409 ], "loc": { "start": { - "line": 14, + "line": 19, "column": 12 }, "end": { - "line": 14, + "line": 19, "column": 13 } } @@ -409,31 +409,31 @@ "value": 0, "raw": "0", "range": [ - 233, - 234 + 412, + 413 ], "loc": { "start": { - "line": 14, + "line": 19, "column": 16 }, "end": { - "line": 14, + "line": 19, "column": 17 } } }, "range": [ - 229, - 234 + 408, + 413 ], "loc": { "start": { - "line": 14, + "line": 19, "column": 12 }, "end": { - "line": 14, + "line": 19, "column": 17 } } @@ -448,18 +448,18 @@ "operator": "=", "left": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 242, - 246 + 421, + 425 ], "loc": { "start": { - "line": 15, + "line": 20, "column": 3 }, "end": { - "line": 15, + "line": 20, "column": 7 } } @@ -469,18 +469,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 249, - 253 + 428, + 432 ], "loc": { "start": { - "line": 15, + "line": 20, "column": 10 }, "end": { - "line": 15, + "line": 20, "column": 14 } } @@ -489,77 +489,77 @@ "type": "Identifier", "name": "left", "range": [ - 254, - 258 + 433, + 437 ], "loc": { "start": { - "line": 15, + "line": 20, "column": 15 }, "end": { - "line": 15, + "line": 20, "column": 19 } } }, "range": [ - 249, - 258 + 428, + 437 ], "loc": { "start": { - "line": 15, + "line": 20, "column": 10 }, "end": { - "line": 15, + "line": 20, "column": 19 } } }, "range": [ - 242, - 258 + 421, + 437 ], "loc": { "start": { - "line": 15, + "line": 20, "column": 3 }, "end": { - "line": 15, + "line": 20, "column": 19 } } }, "range": [ - 242, - 259 + 421, + 438 ], "loc": { "start": { - "line": 15, + "line": 20, "column": 3 }, "end": { - "line": 15, + "line": 20, "column": 20 } } } ], "range": [ - 237, - 263 + 416, + 442 ], "loc": { "start": { - "line": 14, + "line": 19, "column": 20 }, "end": { - "line": 16, + "line": 21, "column": 3 } } @@ -574,18 +574,18 @@ "operator": "=", "left": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 277, - 281 + 456, + 460 ], "loc": { "start": { - "line": 19, + "line": 24, "column": 3 }, "end": { - "line": 19, + "line": 24, "column": 7 } } @@ -595,18 +595,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 284, - 288 + 463, + 467 ], "loc": { "start": { - "line": 19, + "line": 24, "column": 10 }, "end": { - "line": 19, + "line": 24, "column": 14 } } @@ -615,107 +615,107 @@ "type": "Identifier", "name": "right", "range": [ - 289, - 294 + 468, + 473 ], "loc": { "start": { - "line": 19, + "line": 24, "column": 15 }, "end": { - "line": 19, + "line": 24, "column": 20 } } }, "range": [ - 284, - 294 + 463, + 473 ], "loc": { "start": { - "line": 19, + "line": 24, "column": 10 }, "end": { - "line": 19, + "line": 24, "column": 20 } } }, "range": [ - 277, - 294 + 456, + 473 ], "loc": { "start": { - "line": 19, + "line": 24, "column": 3 }, "end": { - "line": 19, + "line": 24, "column": 20 } } }, "range": [ - 277, - 295 + 456, + 474 ], "loc": { "start": { - "line": 19, + "line": 24, "column": 3 }, "end": { - "line": 19, + "line": 24, "column": 21 } } } ], "range": [ - 272, - 299 + 451, + 478 ], "loc": { "start": { - "line": 18, + "line": 23, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 3 } } }, "range": [ - 224, - 299 + 403, + 478 ], "loc": { "start": { - "line": 14, + "line": 19, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 3 } } }, "range": [ - 179, - 299 + 358, + 478 ], "loc": { "start": { - "line": 10, + "line": 15, "column": 2 }, "end": { - "line": 20, + "line": 25, "column": 3 } } @@ -729,18 +729,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 308, - 312 + 487, + 491 ], "loc": { "start": { - "line": 22, + "line": 27, "column": 7 }, "end": { - "line": 22, + "line": 27, "column": 11 } } @@ -749,47 +749,47 @@ "type": "Identifier", "name": "isleaf", "range": [ - 313, - 319 + 492, + 498 ], "loc": { "start": { - "line": 22, + "line": 27, "column": 12 }, "end": { - "line": 22, + "line": 27, "column": 18 } } }, "range": [ - 308, - 319 + 487, + 498 ], "loc": { "start": { - "line": 22, + "line": 27, "column": 7 }, "end": { - "line": 22, + "line": 27, "column": 18 } } }, "arguments": [], "range": [ - 308, - 321 + 487, + 500 ], "loc": { "start": { - "line": 22, + "line": 27, "column": 7 }, "end": { - "line": 22, + "line": 27, "column": 20 } } @@ -804,148 +804,110 @@ "value": null, "raw": "null", "range": [ - 336, - 340 + 515, + 519 ], "loc": { "start": { - "line": 23, + "line": 28, "column": 10 }, "end": { - "line": 23, + "line": 28, "column": 14 } } }, "range": [ - 329, - 341 + 508, + 520 ], "loc": { "start": { - "line": 23, + "line": 28, "column": 3 }, "end": { - "line": 23, + "line": 28, "column": 15 } } } ], "range": [ - 324, - 345 + 503, + 524 ], "loc": { "start": { - "line": 22, + "line": 27, "column": 23 }, "end": { - "line": 24, + "line": 29, "column": 3 } } }, "alternate": null, "range": [ - 303, - 345 + 482, + 524 ], "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 24, + "line": 29, "column": 3 } } } ], "range": [ - 131, - 349 + 314, + 528 ], "loc": { "start": { - "line": 6, + "line": 11, "column": 16 }, "end": { - "line": 26, + "line": 31, "column": 2 } } }, "range": [ - 116, - 349 + 299, + 528 ], "loc": { "start": { - "line": 6, + "line": 11, "column": 1 }, "end": { - "line": 26, + "line": 31, "column": 2 } - }, - "leadingComments": [ - { - "type": "Line", - "value": " scan for first node whose", - "range": [ - 52, - 80 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "Line", - "value": " value equals parameter value", - "range": [ - 82, - 113 - ], - "loc": { - "start": { - "line": 4, - "column": 1 - }, - "end": { - "line": 4, - "column": 32 - } - } - } - ] + } } ], "range": [ - 48, - 352 + 295, + 531 ], "loc": { "start": { - "line": 1, - "column": 48 + "line": 9, + "column": 46 }, "end": { - "line": 28, + "line": 33, "column": 1 } } @@ -953,89 +915,110 @@ "generator": false, "expression": false, "range": [ - 7, - 352 + 256, + 531 ], "loc": { "start": { - "line": 1, + "line": 9, "column": 7 }, "end": { - "line": 28, + "line": 33, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n ", + "range": [ + 0, + 248 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 352 + 249, + 531 ], "loc": { "start": { - "line": 1, + "line": 9, "column": 0 }, "end": { - "line": 28, + "line": 33, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n ", + "range": [ + 0, + 248 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 352 + 249, + 531 ], "loc": { "start": { - "line": 1, + "line": 9, "column": 0 }, "end": { - "line": 28, + "line": 33, "column": 1 } }, "comments": [ { - "type": "Line", - "value": " scan for first node whose", - "range": [ - 52, - 80 - ], - "loc": { - "start": { - "line": 3, - "column": 1 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "Line", - "value": " value equals parameter value", + "type": "Block", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n ", "range": [ - 82, - 113 + 0, + 248 ], "loc": { "start": { - "line": 4, - "column": 1 + "line": 1, + "column": 0 }, "end": { - "line": 4, - "column": 32 + "line": 8, + "column": 3 } } } diff --git a/ast/source/traversal/inordertraversal.js.json b/ast/source/traversal/inordertraversal.js.json index 0c6c76d..66c8aa9 100644 --- a/ast/source/traversal/inordertraversal.js.json +++ b/ast/source/traversal/inordertraversal.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 17, - 33 + 157, + 173 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 17 }, "end": { - "line": 1, + "line": 7, "column": 33 } } @@ -28,16 +28,16 @@ "type": "Identifier", "name": "node", "range": [ - 36, - 40 + 176, + 180 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 36 }, "end": { - "line": 1, + "line": 7, "column": 40 } } @@ -63,16 +63,16 @@ "type": "Identifier", "name": "node", "range": [ - 53, - 57 + 193, + 197 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 7 }, "end": { - "line": 3, + "line": 9, "column": 11 } } @@ -81,31 +81,31 @@ "type": "Identifier", "name": "left", "range": [ - 58, - 62 + 198, + 202 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 12 }, "end": { - "line": 3, + "line": 9, "column": 16 } } }, "range": [ - 53, - 62 + 193, + 202 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 7 }, "end": { - "line": 3, + "line": 9, "column": 16 } } @@ -114,63 +114,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 63, - 69 + 203, + 209 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 17 }, "end": { - "line": 3, + "line": 9, "column": 23 } } }, "range": [ - 53, - 69 + 193, + 209 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 7 }, "end": { - "line": 3, + "line": 9, "column": 23 } } }, "arguments": [], "range": [ - 53, - 71 + 193, + 211 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 7 }, "end": { - "line": 3, + "line": 9, "column": 25 } } }, "prefix": true, "range": [ - 52, - 71 + 192, + 211 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 6 }, "end": { - "line": 3, + "line": 9, "column": 25 } } @@ -188,16 +188,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 85, - 101 + 383, + 399 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 9 }, "end": { - "line": 4, + "line": 13, "column": 25 } } @@ -210,16 +210,16 @@ "type": "Identifier", "name": "node", "range": [ - 103, - 107 + 401, + 405 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 27 }, "end": { - "line": 4, + "line": 13, "column": 31 } } @@ -228,113 +228,189 @@ "type": "Identifier", "name": "left", "range": [ - 108, - 112 + 406, + 410 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 32 }, "end": { - "line": 4, + "line": 13, "column": 36 } } }, "range": [ - 103, - 112 + 401, + 410 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 27 }, "end": { - "line": 4, + "line": 13, "column": 36 } } } ], "range": [ - 85, - 114 + 383, + 412 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 9 }, "end": { - "line": 4, + "line": 13, "column": 38 } } }, "delegate": true, "range": [ - 78, - 114 + 376, + 412 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 2 }, "end": { - "line": 4, + "line": 13, "column": 38 } } }, "range": [ - 78, - 115 + 376, + 413 ], "loc": { "start": { - "line": 4, + "line": 13, "column": 2 }, "end": { - "line": 4, + "line": 13, "column": 39 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Yield the nodes on the left recursively. Those nodes are all smaller", + "range": [ + 218, + 289 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 73 + } + } + }, + { + "type": "Line", + "value": " than (or equal to) the current node by the binary search tree", + "range": [ + 292, + 356 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + { + "type": "Line", + "value": " properties.", + "range": [ + 359, + 373 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 16 + } + } + } + ] } ], "range": [ - 74, - 118 + 214, + 416 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 28 }, "end": { - "line": 5, + "line": 14, "column": 2 } } }, "alternate": null, "range": [ - 47, - 118 + 187, + 416 ], "loc": { "start": { - "line": 3, + "line": 9, "column": 1 }, "end": { - "line": 5, + "line": 14, "column": 2 } - } + }, + "trailingComments": [ + { + "type": "Line", + "value": " Yield the current node.", + "range": [ + 419, + 445 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 27 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -347,83 +423,103 @@ "type": "Identifier", "name": "node", "range": [ - 127, - 131 + 453, + 457 ], "loc": { "start": { - "line": 7, + "line": 17, "column": 7 }, "end": { - "line": 7, + "line": 17, "column": 11 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 132, - 137 + 458, + 461 ], "loc": { "start": { - "line": 7, + "line": 17, "column": 12 }, "end": { - "line": 7, - "column": 17 + "line": 17, + "column": 15 } } }, "range": [ - 127, - 137 + 453, + 461 ], "loc": { "start": { - "line": 7, + "line": 17, "column": 7 }, "end": { - "line": 7, - "column": 17 + "line": 17, + "column": 15 } } }, "delegate": false, "range": [ - 121, - 137 + 447, + 461 ], "loc": { "start": { - "line": 7, + "line": 17, "column": 1 }, "end": { - "line": 7, - "column": 17 + "line": 17, + "column": 15 } } }, "range": [ - 121, - 139 + 447, + 463 ], "loc": { "start": { - "line": 7, + "line": 17, "column": 1 }, "end": { - "line": 7, - "column": 19 + "line": 17, + "column": 17 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Yield the current node.", + "range": [ + 419, + 445 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 27 + } + } + } + ] }, { "type": "IfStatement", @@ -442,16 +538,16 @@ "type": "Identifier", "name": "node", "range": [ - 148, - 152 + 472, + 476 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 7 }, "end": { - "line": 9, + "line": 19, "column": 11 } } @@ -460,31 +556,31 @@ "type": "Identifier", "name": "right", "range": [ - 153, - 158 + 477, + 482 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 12 }, "end": { - "line": 9, + "line": 19, "column": 17 } } }, "range": [ - 148, - 158 + 472, + 482 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 7 }, "end": { - "line": 9, + "line": 19, "column": 17 } } @@ -493,63 +589,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 159, - 165 + 483, + 489 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 18 }, "end": { - "line": 9, + "line": 19, "column": 24 } } }, "range": [ - 148, - 165 + 472, + 489 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 7 }, "end": { - "line": 9, + "line": 19, "column": 24 } } }, "arguments": [], "range": [ - 148, - 167 + 472, + 491 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 7 }, "end": { - "line": 9, + "line": 19, "column": 26 } } }, "prefix": true, "range": [ - 147, - 167 + 471, + 491 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 6 }, "end": { - "line": 9, + "line": 19, "column": 26 } } @@ -567,16 +663,16 @@ "type": "Identifier", "name": "inordertraversal", "range": [ - 181, - 197 + 663, + 679 ], "loc": { "start": { - "line": 10, + "line": 23, "column": 9 }, "end": { - "line": 10, + "line": 23, "column": 25 } } @@ -589,16 +685,16 @@ "type": "Identifier", "name": "node", "range": [ - 199, - 203 + 681, + 685 ], "loc": { "start": { - "line": 10, + "line": 23, "column": 27 }, "end": { - "line": 10, + "line": 23, "column": 31 } } @@ -607,126 +703,182 @@ "type": "Identifier", "name": "right", "range": [ - 204, - 209 + 686, + 691 ], "loc": { "start": { - "line": 10, + "line": 23, "column": 32 }, "end": { - "line": 10, + "line": 23, "column": 37 } } }, "range": [ - 199, - 209 + 681, + 691 ], "loc": { "start": { - "line": 10, + "line": 23, "column": 27 }, "end": { - "line": 10, + "line": 23, "column": 37 } } } ], "range": [ - 181, - 211 + 663, + 693 ], "loc": { "start": { - "line": 10, + "line": 23, "column": 9 }, "end": { - "line": 10, + "line": 23, "column": 39 } } }, "delegate": true, "range": [ - 174, - 211 + 656, + 693 ], "loc": { "start": { - "line": 10, + "line": 23, "column": 2 }, "end": { - "line": 10, + "line": 23, "column": 39 } } }, "range": [ - 174, - 212 + 656, + 694 ], "loc": { "start": { - "line": 10, + "line": 23, "column": 2 }, "end": { - "line": 10, + "line": 23, "column": 40 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Yield the nodes on the right recursively. Those nodes are all larger", + "range": [ + 498, + 569 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 73 + } + } + }, + { + "type": "Line", + "value": " than (or equal to) the current node by the binary search tree", + "range": [ + 572, + 636 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 66 + } + } + }, + { + "type": "Line", + "value": " properties.", + "range": [ + 639, + 653 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 16 + } + } + } + ] } ], "range": [ - 170, - 215 + 494, + 697 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 29 }, "end": { - "line": 11, + "line": 24, "column": 2 } } }, "alternate": null, "range": [ - 142, - 215 + 466, + 697 ], "loc": { "start": { - "line": 9, + "line": 19, "column": 1 }, "end": { - "line": 11, + "line": 24, "column": 2 } } } ], "range": [ - 43, - 218 + 183, + 700 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 43 }, "end": { - "line": 13, + "line": 26, "column": 1 } } @@ -734,54 +886,238 @@ "generator": true, "expression": false, "range": [ - 7, - 218 + 147, + 700 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 7 }, "end": { - "line": 13, + "line": 26, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n ", + "range": [ + 0, + 139 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 218 + 140, + 700 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 26, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n ", + "range": [ + 0, + 139 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 218 + 140, + 700 ], "loc": { "start": { - "line": 1, + "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 26, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n ", + "range": [ + 0, + 139 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": "Line", + "value": " Yield the nodes on the left recursively. Those nodes are all smaller", + "range": [ + 218, + 289 + ], + "loc": { + "start": { + "line": 10, + "column": 2 + }, + "end": { + "line": 10, + "column": 73 + } + } + }, + { + "type": "Line", + "value": " than (or equal to) the current node by the binary search tree", + "range": [ + 292, + 356 + ], + "loc": { + "start": { + "line": 11, + "column": 2 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + { + "type": "Line", + "value": " properties.", + "range": [ + 359, + 373 + ], + "loc": { + "start": { + "line": 12, + "column": 2 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + { + "type": "Line", + "value": " Yield the current node.", + "range": [ + 419, + 445 + ], + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + { + "type": "Line", + "value": " Yield the nodes on the right recursively. Those nodes are all larger", + "range": [ + 498, + 569 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 73 + } + } + }, + { + "type": "Line", + "value": " than (or equal to) the current node by the binary search tree", + "range": [ + 572, + 636 + ], + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 66 + } + } + }, + { + "type": "Line", + "value": " properties.", + "range": [ + 639, + 653 + ], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 16 + } + } + } + ] } \ No newline at end of file diff --git a/ast/source/traversal/rangetraversal.js.json b/ast/source/traversal/rangetraversal.js.json index c4f7185..1446422 100644 --- a/ast/source/traversal/rangetraversal.js.json +++ b/ast/source/traversal/rangetraversal.js.json @@ -9,16 +9,16 @@ "type": "Identifier", "name": "rangetraversal", "range": [ - 17, - 31 + 395, + 409 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 17 }, "end": { - "line": 1, + "line": 11, "column": 31 } } @@ -28,34 +28,34 @@ "type": "Identifier", "name": "compare", "range": [ - 34, - 41 + 412, + 419 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 34 }, "end": { - "line": 1, + "line": 11, "column": 41 } } }, { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 44, - 48 + 422, + 426 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 44 }, "end": { - "line": 1, + "line": 11, "column": 48 } } @@ -64,16 +64,16 @@ "type": "Identifier", "name": "left", "range": [ - 51, - 55 + 429, + 433 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 51 }, "end": { - "line": 1, + "line": 11, "column": 55 } } @@ -82,16 +82,16 @@ "type": "Identifier", "name": "right", "range": [ - 58, - 63 + 436, + 441 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 58 }, "end": { - "line": 1, + "line": 11, "column": 63 } } @@ -111,16 +111,16 @@ "type": "Identifier", "name": "compare", "range": [ - 75, - 82 + 453, + 460 ], "loc": { "start": { - "line": 3, + "line": 13, "column": 6 }, "end": { - "line": 3, + "line": 13, "column": 13 } } @@ -131,52 +131,52 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 84, - 88 + 462, + 466 ], "loc": { "start": { - "line": 3, + "line": 13, "column": 15 }, "end": { - "line": 3, + "line": 13, "column": 19 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 89, - 94 + 467, + 470 ], "loc": { "start": { - "line": 3, + "line": 13, "column": 20 }, "end": { - "line": 3, - "column": 25 + "line": 13, + "column": 23 } } }, "range": [ - 84, - 94 + 462, + 470 ], "loc": { "start": { - "line": 3, + "line": 13, "column": 15 }, "end": { - "line": 3, - "column": 25 + "line": 13, + "column": 23 } } }, @@ -184,33 +184,33 @@ "type": "Identifier", "name": "left", "range": [ - 97, - 101 + 473, + 477 ], "loc": { "start": { - "line": 3, - "column": 28 + "line": 13, + "column": 26 }, "end": { - "line": 3, - "column": 32 + "line": 13, + "column": 30 } } } ], "range": [ - 75, - 103 + 453, + 479 ], "loc": { "start": { - "line": 3, + "line": 13, "column": 6 }, "end": { - "line": 3, - "column": 34 + "line": 13, + "column": 32 } } }, @@ -219,32 +219,32 @@ "value": 0, "raw": "0", "range": [ - 106, - 107 + 482, + 483 ], "loc": { "start": { - "line": 3, - "column": 37 + "line": 13, + "column": 35 }, "end": { - "line": 3, - "column": 38 + "line": 13, + "column": 36 } } }, "range": [ - 75, - 107 + 453, + 483 ], "loc": { "start": { - "line": 3, + "line": 13, "column": 6 }, "end": { - "line": 3, - "column": 38 + "line": 13, + "column": 36 } } }, @@ -266,18 +266,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 120, - 124 + 592, + 596 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 8 }, "end": { - "line": 4, + "line": 16, "column": 12 } } @@ -286,31 +286,31 @@ "type": "Identifier", "name": "right", "range": [ - 125, - 130 + 597, + 602 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 13 }, "end": { - "line": 4, + "line": 16, "column": 18 } } }, "range": [ - 120, - 130 + 592, + 602 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 8 }, "end": { - "line": 4, + "line": 16, "column": 18 } } @@ -319,63 +319,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 131, - 137 + 603, + 609 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 19 }, "end": { - "line": 4, + "line": 16, "column": 25 } } }, "range": [ - 120, - 137 + 592, + 609 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 8 }, "end": { - "line": 4, + "line": 16, "column": 25 } } }, "arguments": [], "range": [ - 120, - 139 + 592, + 611 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 8 }, "end": { - "line": 4, + "line": 16, "column": 27 } } }, "prefix": true, "range": [ - 119, - 139 + 591, + 611 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 7 }, "end": { - "line": 4, + "line": 16, "column": 27 } } @@ -390,16 +390,16 @@ "type": "Identifier", "name": "rangetraversal", "range": [ - 149, - 163 + 621, + 635 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 37 }, "end": { - "line": 4, + "line": 16, "column": 51 } } @@ -409,16 +409,16 @@ "type": "Identifier", "name": "compare", "range": [ - 165, - 172 + 637, + 644 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 53 }, "end": { - "line": 4, + "line": 16, "column": 60 } } @@ -428,18 +428,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 175, - 179 + 647, + 651 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 63 }, "end": { - "line": 4, + "line": 16, "column": 67 } } @@ -448,31 +448,31 @@ "type": "Identifier", "name": "right", "range": [ - 180, - 185 + 652, + 657 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 68 }, "end": { - "line": 4, + "line": 16, "column": 73 } } }, "range": [ - 175, - 185 + 647, + 657 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 63 }, "end": { - "line": 4, + "line": 16, "column": 73 } } @@ -481,16 +481,16 @@ "type": "Identifier", "name": "left", "range": [ - 188, - 192 + 660, + 664 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 76 }, "end": { - "line": 4, + "line": 16, "column": 80 } } @@ -499,95 +499,133 @@ "type": "Identifier", "name": "right", "range": [ - 195, - 200 + 667, + 672 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 83 }, "end": { - "line": 4, + "line": 16, "column": 88 } } } ], "range": [ - 149, - 202 + 621, + 674 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 37 }, "end": { - "line": 4, + "line": 16, "column": 90 } } }, "delegate": true, "range": [ - 142, - 202 + 614, + 674 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 30 }, "end": { - "line": 4, + "line": 16, "column": 90 } } }, "range": [ - 142, - 203 + 614, + 675 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 30 }, "end": { - "line": 4, + "line": 16, "column": 91 } } }, "alternate": null, "range": [ - 114, - 203 + 586, + 675 ], "loc": { "start": { - "line": 4, + "line": 16, "column": 2 }, "end": { - "line": 4, + "line": 16, "column": 91 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " If the root lies to the left of the interval, we can discard the", + "range": [ + 490, + 557 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 69 + } + } + }, + { + "type": "Line", + "value": " entire left subtree.", + "range": [ + 560, + 583 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 25 + } + } + } + ] } ], "range": [ - 110, - 206 + 486, + 678 ], "loc": { "start": { - "line": 3, - "column": 41 + "line": 13, + "column": 39 }, "end": { - "line": 5, + "line": 17, "column": 2 } } @@ -603,16 +641,16 @@ "type": "Identifier", "name": "compare", "range": [ - 218, - 225 + 690, + 697 ], "loc": { "start": { - "line": 6, + "line": 18, "column": 11 }, "end": { - "line": 6, + "line": 18, "column": 18 } } @@ -623,52 +661,52 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 227, - 231 + 699, + 703 ], "loc": { "start": { - "line": 6, + "line": 18, "column": 20 }, "end": { - "line": 6, + "line": 18, "column": 24 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 232, - 237 + 704, + 707 ], "loc": { "start": { - "line": 6, + "line": 18, "column": 25 }, "end": { - "line": 6, - "column": 30 + "line": 18, + "column": 28 } } }, "range": [ - 227, - 237 + 699, + 707 ], "loc": { "start": { - "line": 6, + "line": 18, "column": 20 }, "end": { - "line": 6, - "column": 30 + "line": 18, + "column": 28 } } }, @@ -676,33 +714,33 @@ "type": "Identifier", "name": "right", "range": [ - 240, - 245 + 710, + 715 ], "loc": { "start": { - "line": 6, - "column": 33 + "line": 18, + "column": 31 }, "end": { - "line": 6, - "column": 38 + "line": 18, + "column": 36 } } } ], "range": [ - 218, - 247 + 690, + 717 ], "loc": { "start": { - "line": 6, + "line": 18, "column": 11 }, "end": { - "line": 6, - "column": 40 + "line": 18, + "column": 38 } } }, @@ -711,32 +749,32 @@ "value": 0, "raw": "0", "range": [ - 251, - 252 + 721, + 722 ], "loc": { "start": { - "line": 6, - "column": 44 + "line": 18, + "column": 42 }, "end": { - "line": 6, - "column": 45 + "line": 18, + "column": 43 } } }, "range": [ - 218, - 252 + 690, + 722 ], "loc": { "start": { - "line": 6, + "line": 18, "column": 11 }, "end": { - "line": 6, - "column": 45 + "line": 18, + "column": 43 } } }, @@ -758,18 +796,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 265, - 269 + 833, + 837 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 8 }, "end": { - "line": 7, + "line": 21, "column": 12 } } @@ -778,31 +816,31 @@ "type": "Identifier", "name": "left", "range": [ - 270, - 274 + 838, + 842 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 13 }, "end": { - "line": 7, + "line": 21, "column": 17 } } }, "range": [ - 265, - 274 + 833, + 842 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 8 }, "end": { - "line": 7, + "line": 21, "column": 17 } } @@ -811,63 +849,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 275, - 281 + 843, + 849 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 18 }, "end": { - "line": 7, + "line": 21, "column": 24 } } }, "range": [ - 265, - 281 + 833, + 849 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 8 }, "end": { - "line": 7, + "line": 21, "column": 24 } } }, "arguments": [], "range": [ - 265, - 283 + 833, + 851 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 8 }, "end": { - "line": 7, + "line": 21, "column": 26 } } }, "prefix": true, "range": [ - 264, - 283 + 832, + 851 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 7 }, "end": { - "line": 7, + "line": 21, "column": 26 } } @@ -882,16 +920,16 @@ "type": "Identifier", "name": "rangetraversal", "range": [ - 293, - 307 + 861, + 875 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 36 }, "end": { - "line": 7, + "line": 21, "column": 50 } } @@ -901,16 +939,16 @@ "type": "Identifier", "name": "compare", "range": [ - 309, - 316 + 877, + 884 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 52 }, "end": { - "line": 7, + "line": 21, "column": 59 } } @@ -920,18 +958,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 319, - 323 + 887, + 891 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 62 }, "end": { - "line": 7, + "line": 21, "column": 66 } } @@ -940,31 +978,31 @@ "type": "Identifier", "name": "left", "range": [ - 324, - 328 + 892, + 896 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 67 }, "end": { - "line": 7, + "line": 21, "column": 71 } } }, "range": [ - 319, - 328 + 887, + 896 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 62 }, "end": { - "line": 7, + "line": 21, "column": 71 } } @@ -973,16 +1011,16 @@ "type": "Identifier", "name": "left", "range": [ - 331, - 335 + 899, + 903 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 74 }, "end": { - "line": 7, + "line": 21, "column": 78 } } @@ -991,95 +1029,133 @@ "type": "Identifier", "name": "right", "range": [ - 338, - 343 + 906, + 911 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 81 }, "end": { - "line": 7, + "line": 21, "column": 86 } } } ], "range": [ - 293, - 345 + 861, + 913 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 36 }, "end": { - "line": 7, + "line": 21, "column": 88 } } }, "delegate": true, "range": [ - 286, - 345 + 854, + 913 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 29 }, "end": { - "line": 7, + "line": 21, "column": 88 } } }, "range": [ - 286, - 346 + 854, + 914 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 29 }, "end": { - "line": 7, + "line": 21, "column": 89 } } }, "alternate": null, "range": [ - 259, - 346 + 827, + 914 ], "loc": { "start": { - "line": 7, + "line": 21, "column": 2 }, "end": { - "line": 7, + "line": 21, "column": 89 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " If the root lies to the right of the interval, we can discard the", + "range": [ + 729, + 797 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 70 + } + } + }, + { + "type": "Line", + "value": " entire right subtree.", + "range": [ + 800, + 824 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 26 + } + } + } + ] } ], "range": [ - 255, - 349 + 725, + 917 ], "loc": { "start": { - "line": 6, - "column": 48 + "line": 18, + "column": 46 }, "end": { - "line": 8, + "line": 22, "column": 2 } } @@ -1102,18 +1178,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 366, - 370 + 1015, + 1019 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 8 }, "end": { - "line": 10, + "line": 26, "column": 12 } } @@ -1122,31 +1198,31 @@ "type": "Identifier", "name": "left", "range": [ - 371, - 375 + 1020, + 1024 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 13 }, "end": { - "line": 10, + "line": 26, "column": 17 } } }, "range": [ - 366, - 375 + 1015, + 1024 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 8 }, "end": { - "line": 10, + "line": 26, "column": 17 } } @@ -1155,63 +1231,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 376, - 382 + 1025, + 1031 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 18 }, "end": { - "line": 10, + "line": 26, "column": 24 } } }, "range": [ - 366, - 382 + 1015, + 1031 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 8 }, "end": { - "line": 10, + "line": 26, "column": 24 } } }, "arguments": [], "range": [ - 366, - 384 + 1015, + 1033 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 8 }, "end": { - "line": 10, + "line": 26, "column": 26 } } }, "prefix": true, "range": [ - 365, - 384 + 1014, + 1033 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 7 }, "end": { - "line": 10, + "line": 26, "column": 26 } } @@ -1226,16 +1302,16 @@ "type": "Identifier", "name": "rangetraversal", "range": [ - 394, - 408 + 1043, + 1057 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 36 }, "end": { - "line": 10, + "line": 26, "column": 50 } } @@ -1245,16 +1321,16 @@ "type": "Identifier", "name": "compare", "range": [ - 410, - 417 + 1059, + 1066 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 52 }, "end": { - "line": 10, + "line": 26, "column": 59 } } @@ -1264,18 +1340,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 420, - 424 + 1069, + 1073 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 62 }, "end": { - "line": 10, + "line": 26, "column": 66 } } @@ -1284,31 +1360,31 @@ "type": "Identifier", "name": "left", "range": [ - 425, - 429 + 1074, + 1078 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 67 }, "end": { - "line": 10, + "line": 26, "column": 71 } } }, "range": [ - 420, - 429 + 1069, + 1078 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 62 }, "end": { - "line": 10, + "line": 26, "column": 71 } } @@ -1317,16 +1393,16 @@ "type": "Identifier", "name": "left", "range": [ - 432, - 436 + 1081, + 1085 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 74 }, "end": { - "line": 10, + "line": 26, "column": 78 } } @@ -1335,82 +1411,120 @@ "type": "Identifier", "name": "right", "range": [ - 439, - 444 + 1088, + 1093 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 81 }, "end": { - "line": 10, + "line": 26, "column": 86 } } } ], "range": [ - 394, - 446 + 1043, + 1095 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 36 }, "end": { - "line": 10, + "line": 26, "column": 88 } } }, "delegate": true, "range": [ - 387, - 446 + 1036, + 1095 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 29 }, "end": { - "line": 10, + "line": 26, "column": 88 } } }, "range": [ - 387, - 447 + 1036, + 1096 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 29 }, "end": { - "line": 10, + "line": 26, "column": 89 } } }, "alternate": null, "range": [ - 360, - 447 + 1009, + 1096 ], "loc": { "start": { - "line": 10, + "line": 26, "column": 2 }, "end": { - "line": 10, + "line": 26, "column": 89 } - } + }, + "leadingComments": [ + { + "type": "Line", + "value": " Otherwise just recurse on both subtrees and yield the root in", + "range": [ + 928, + 992 + ], + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 66 + } + } + }, + { + "type": "Line", + "value": " between.", + "range": [ + 995, + 1006 + ], + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 13 + } + } + } + ] }, { "type": "ExpressionStatement", @@ -1421,83 +1535,83 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 456, - 460 + 1105, + 1109 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 8 }, "end": { - "line": 11, + "line": 27, "column": 12 } } }, "property": { "type": "Identifier", - "name": "value", + "name": "key", "range": [ - 461, - 466 + 1110, + 1113 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 13 }, "end": { - "line": 11, - "column": 18 + "line": 27, + "column": 16 } } }, "range": [ - 456, - 466 + 1105, + 1113 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 8 }, "end": { - "line": 11, - "column": 18 + "line": 27, + "column": 16 } } }, "delegate": false, "range": [ - 450, - 466 + 1099, + 1113 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 2 }, "end": { - "line": 11, - "column": 18 + "line": 27, + "column": 16 } } }, "range": [ - 450, - 468 + 1099, + 1115 ], "loc": { "start": { - "line": 11, + "line": 27, "column": 2 }, "end": { - "line": 11, - "column": 20 + "line": 27, + "column": 18 } } }, @@ -1516,18 +1630,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 477, - 481 + 1124, + 1128 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 8 }, "end": { - "line": 12, + "line": 28, "column": 12 } } @@ -1536,31 +1650,31 @@ "type": "Identifier", "name": "right", "range": [ - 482, - 487 + 1129, + 1134 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 13 }, "end": { - "line": 12, + "line": 28, "column": 18 } } }, "range": [ - 477, - 487 + 1124, + 1134 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 8 }, "end": { - "line": 12, + "line": 28, "column": 18 } } @@ -1569,63 +1683,63 @@ "type": "Identifier", "name": "isleaf", "range": [ - 488, - 494 + 1135, + 1141 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 19 }, "end": { - "line": 12, + "line": 28, "column": 25 } } }, "range": [ - 477, - 494 + 1124, + 1141 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 8 }, "end": { - "line": 12, + "line": 28, "column": 25 } } }, "arguments": [], "range": [ - 477, - 496 + 1124, + 1143 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 8 }, "end": { - "line": 12, + "line": 28, "column": 27 } } }, "prefix": true, "range": [ - 476, - 496 + 1123, + 1143 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 7 }, "end": { - "line": 12, + "line": 28, "column": 27 } } @@ -1640,16 +1754,16 @@ "type": "Identifier", "name": "rangetraversal", "range": [ - 506, - 520 + 1153, + 1167 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 37 }, "end": { - "line": 12, + "line": 28, "column": 51 } } @@ -1659,16 +1773,16 @@ "type": "Identifier", "name": "compare", "range": [ - 522, - 529 + 1169, + 1176 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 53 }, "end": { - "line": 12, + "line": 28, "column": 60 } } @@ -1678,18 +1792,18 @@ "computed": false, "object": { "type": "Identifier", - "name": "node", + "name": "root", "range": [ - 532, - 536 + 1179, + 1183 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 63 }, "end": { - "line": 12, + "line": 28, "column": 67 } } @@ -1698,31 +1812,31 @@ "type": "Identifier", "name": "right", "range": [ - 537, - 542 + 1184, + 1189 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 68 }, "end": { - "line": 12, + "line": 28, "column": 73 } } }, "range": [ - 532, - 542 + 1179, + 1189 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 63 }, "end": { - "line": 12, + "line": 28, "column": 73 } } @@ -1731,16 +1845,16 @@ "type": "Identifier", "name": "left", "range": [ - 545, - 549 + 1192, + 1196 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 76 }, "end": { - "line": 12, + "line": 28, "column": 80 } } @@ -1749,141 +1863,141 @@ "type": "Identifier", "name": "right", "range": [ - 552, - 557 + 1199, + 1204 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 83 }, "end": { - "line": 12, + "line": 28, "column": 88 } } } ], "range": [ - 506, - 559 + 1153, + 1206 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 37 }, "end": { - "line": 12, + "line": 28, "column": 90 } } }, "delegate": true, "range": [ - 499, - 559 + 1146, + 1206 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 30 }, "end": { - "line": 12, + "line": 28, "column": 90 } } }, "range": [ - 499, - 560 + 1146, + 1207 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 30 }, "end": { - "line": 12, + "line": 28, "column": 91 } } }, "alternate": null, "range": [ - 471, - 560 + 1118, + 1207 ], "loc": { "start": { - "line": 12, + "line": 28, "column": 2 }, "end": { - "line": 12, + "line": 28, "column": 91 } } } ], "range": [ - 356, - 563 + 924, + 1210 ], "loc": { "start": { - "line": 9, + "line": 23, "column": 6 }, "end": { - "line": 13, + "line": 29, "column": 2 } } }, "range": [ - 213, - 563 + 685, + 1210 ], "loc": { "start": { - "line": 6, + "line": 18, "column": 6 }, "end": { - "line": 13, + "line": 29, "column": 2 } } }, "range": [ - 70, - 563 + 448, + 1210 ], "loc": { "start": { - "line": 3, + "line": 13, "column": 1 }, "end": { - "line": 13, + "line": 29, "column": 2 } } } ], "range": [ - 66, - 566 + 444, + 1213 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 66 }, "end": { - "line": 15, + "line": 31, "column": 1 } } @@ -1891,54 +2005,220 @@ "generator": true, "expression": false, "range": [ - 7, - 566 + 385, + 1213 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 7 }, "end": { - "line": 15, + "line": 31, "column": 1 } }, - "leadingComments": [], + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n ", + "range": [ + 0, + 377 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], "trailingComments": [] }, "specifiers": [], "source": null, "range": [ - 0, - 566 + 378, + 1213 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 0 }, "end": { - "line": 15, + "line": 31, "column": 1 } - } + }, + "leadingComments": [ + { + "type": "Block", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n ", + "range": [ + 0, + 377 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] } ], "sourceType": "module", "range": [ - 0, - 566 + 378, + 1213 ], "loc": { "start": { - "line": 1, + "line": 11, "column": 0 }, "end": { - "line": 15, + "line": 31, "column": 1 } }, - "comments": [] + "comments": [ + { + "type": "Block", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n ", + "range": [ + 0, + 377 + ], + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "Line", + "value": " If the root lies to the left of the interval, we can discard the", + "range": [ + 490, + 557 + ], + "loc": { + "start": { + "line": 14, + "column": 2 + }, + "end": { + "line": 14, + "column": 69 + } + } + }, + { + "type": "Line", + "value": " entire left subtree.", + "range": [ + 560, + 583 + ], + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + { + "type": "Line", + "value": " If the root lies to the right of the interval, we can discard the", + "range": [ + 729, + 797 + ], + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 70 + } + } + }, + { + "type": "Line", + "value": " entire right subtree.", + "range": [ + 800, + 824 + ], + "loc": { + "start": { + "line": 20, + "column": 2 + }, + "end": { + "line": 20, + "column": 26 + } + } + }, + { + "type": "Line", + "value": " Otherwise just recurse on both subtrees and yield the root in", + "range": [ + 928, + 992 + ], + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 66 + } + } + }, + { + "type": "Line", + "value": " between.", + "range": [ + 995, + 1006 + ], + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 13 + } + } + } + ] } \ No newline at end of file diff --git a/badge.svg b/badge.svg index e78bc6e..f23c4ce 100644 --- a/badge.svg +++ b/badge.svg @@ -5,13 +5,13 @@ - - + + document document - 4% - 4% + 95% + 95% diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/adt/RedBlackTree.js~RedBlackTree.html index 8518c62..e631d43 100644 --- a/class/src/adt/RedBlackTree.js~RedBlackTree.html +++ b/class/src/adt/RedBlackTree.js~RedBlackTree.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,13 +68,13 @@
    - + public class - | source + | source
    @@ -94,7 +94,8 @@

    RedBlackTree

    - +

    A RedBlackTree with key-only nodes.

    +
    @@ -121,13 +122,14 @@

    RedBlackTree

    - from(compare: *, iterable: *): * + from(compare: Function, iterable: Iterbale): RedBlackTree

    - +

    Constructs a red-black tree from an input iterable.

    +
    @@ -153,13 +155,14 @@

    RedBlackTree

    - constructor(compare: *) + constructor(compare: Function): RedBlackTree

    - +

    Constructs a new empty red-black tree.

    +
    @@ -248,7 +251,8 @@

    RedBlackTree

    - +
    @@ -267,13 +271,14 @@

    RedBlackTree

    - add(value: *) + add(key: Key)

    - +

    Adds a key to the tree.

    +
    @@ -292,13 +297,14 @@

    RedBlackTree

    - get(value: *): * + get(key: Key): Key

    - +

    Search for the input key in the tree.

    +
    @@ -317,13 +323,15 @@

    RedBlackTree

    - has(value: *): * + has(key: Key): Boolean

    - +

    Returns true if and only if the tree contains the input +key.

    +
    @@ -342,13 +350,14 @@

    RedBlackTree

    - * range(left: *, right: *) + * items(): Iterator

    - +

    Returns an in order iterator over the keys of the tree.

    +
    @@ -367,13 +376,15 @@

    RedBlackTree

    - remove(value: *): boolean + * range(left: Key, right: Key): Iterator

    - +

    Returns an in order iterator over the keys of the tree that lie in the +interval [left, right[.

    +
    @@ -392,13 +403,16 @@

    RedBlackTree

    - * values() + remove(key: Key): Boolean

    - +

    Search for the first node of the tree whose key equals the input key +(with RedBlackTree#_search), then delete that node +(with RedBlackTree#_delete).

    +
    @@ -423,13 +437,14 @@

    RedBlackTree

    - _delete(node: *) + _delete(node: Node)

    - +

    Deletes the input node from the tree.

    +
    @@ -448,13 +463,14 @@

    RedBlackTree

    - _search(value: *): * + _search(key: Key): Node

    - +

    Search for the input key in the tree.

    +
    @@ -478,18 +494,19 @@

    - from(compare: *, iterable: *): * + from(compare: Function, iterable: Iterbale): RedBlackTree - source + source

    - +

    Constructs a red-black tree from an input iterable.

    +
    @@ -503,15 +520,17 @@

    Params:

    compare - * + Function - +

    The comparison function to use.

    + iterable - * + Iterbale - +

    The input iterable.

    + @@ -522,7 +541,7 @@

    Params:

    Return:

    - +
    *RedBlackTree
    @@ -553,18 +572,19 @@

    - constructor(compare: *) + constructor(compare: Function): RedBlackTree - source + source

    - +

    Constructs a new empty red-black tree.

    +
    @@ -578,16 +598,27 @@

    Params:

    compare - * + Function - +

    The comparison function for node keys.

    +
    - +
    +

    Return:

    + + + + + +
    RedBlackTree
    +
    +
    +
    @@ -616,7 +647,7 @@

    - source + source

    @@ -656,7 +687,7 @@

    - source + source

    @@ -699,14 +730,15 @@

    - source + source

    - + @@ -745,18 +777,19 @@

    - add(value: *) + add(key: Key) - source + source

    - +

    Adds a key to the tree.

    +
    @@ -769,10 +802,11 @@

    Params:

    - value - * + key + Key - +

    The key to add.

    + @@ -801,18 +835,21 @@

    - get(value: *): * + get(key: Key): Key - source + source

    - +

    Search for the input key in the tree. Returns the first node key found +in this way (with RedBlackTree#_search. If no such key exists +in the tree, returns null.

    +
    @@ -825,10 +862,11 @@

    Params:

    - value - * + key + Key - +

    The input key.

    + @@ -839,7 +877,7 @@

    Params:

    Return:

    - +
    *Key
    @@ -867,18 +905,20 @@

    - has(value: *): * + has(key: Key): Boolean - source + source

    - +

    Returns true if and only if the tree contains the input +key.

    +
    @@ -891,10 +931,11 @@

    Params:

    - value - * + key + Key - +

    The input key.

    + @@ -905,7 +946,7 @@

    Params:

    Return:

    - +
    *Boolean
    @@ -927,53 +968,42 @@

    Return:

    -

    +

    public * - range(left: *, right: *) + items(): Iterator - source + source

    - +

    Returns an in order iterator over the keys of the tree.

    +
    -
    -

    Params:

    - - - - - - - - - - - - - - - - - - - -
    NameTypeAttributeDescription
    left*
    right*
    -
    +
    - +
    +

    Return:

    + + + + + +
    Iterator
    +
    +
    +
    @@ -989,24 +1019,26 @@

    Params:

    -

    +

    public - - remove(value: *): boolean + * + range(left: Key, right: Key): Iterator - source + source

    - +

    Returns an in order iterator over the keys of the tree that lie in the +interval [left, right[.

    +
    @@ -1019,10 +1051,18 @@

    Params:

    - value - * + left + Key - +

    The left bound of the interval.

    + + + + right + Key + +

    The right bound of the interval.

    + @@ -1033,7 +1073,7 @@

    Params:

    Return:

    - +
    booleanIterator
    @@ -1055,31 +1095,63 @@

    Return:

    -

    +

    public - * - values() + + remove(key: Key): Boolean - source + source

    - +

    Search for the first node of the tree whose key equals the input key +(with RedBlackTree#_search), then delete that node +(with RedBlackTree#_delete). If such a node is found and deleted +then return true. Return false otherwise.

    +
    -
    +
    +

    Params:

    + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    keyKey

    The input key.

    +
    +
    - +
    +

    Return:

    + + + + + +
    Boolean

    Whether the key existed in the tree before removal.

    +
    +
    +
    +
    @@ -1103,18 +1175,19 @@

    - _delete(node: *) + _delete(node: Node) - source + source

    - +

    Deletes the input node from the tree.

    +
    @@ -1128,9 +1201,10 @@

    Params:

    node - * + Node - +

    The input node to delete.

    + @@ -1159,18 +1233,21 @@ - +

    Search for the input key in the tree. +Returns the first node whose key equals the input key. +If no such node exists, returns null.

    +
    @@ -1183,10 +1260,11 @@

    Params:

    - value - * + key + Key - +

    The input key.

    + @@ -1197,7 +1275,7 @@

    Params:

    Return:

    - +
    *Node
    diff --git a/coverage.json b/coverage.json index a707d87..2a48670 100644 --- a/coverage.json +++ b/coverage.json @@ -1,188 +1,130 @@ { - "coverage": "4.76%", + "coverage": "95.23%", "expectCount": 42, - "actualCount": 2, + "actualCount": 40, "files": { "src/color/BLACK.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/adt/Leaf.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 3 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/adt/Node.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 3 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/color/RED.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/adt/RedBlackTree.js": { "expectCount": 14, - "actualCount": 0, + "actualCount": 12, "undocumentLines": [ - 10, - 100, - 44, - 30, - 19, - 14, - 12, - 106, - 35, - 40, - 88, - 78, - 15, - 94 + 24, + 25 ] }, "src/debug/debug.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 5 - ] + "actualCount": 1, + "undocumentLines": [] }, - "src/removal/delete_case1.js": { + "src/deletion/delete_case1.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 3 - ] + "actualCount": 1, + "undocumentLines": [] }, - "src/removal/delete_case2.js": { + "src/deletion/delete_case2.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 5 - ] + "actualCount": 1, + "undocumentLines": [] }, - "src/removal/delete_case3.js": { + "src/deletion/delete_case3.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 6 - ] + "actualCount": 1, + "undocumentLines": [] }, - "src/removal/delete_case4.js": { + "src/deletion/delete_case4.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 5 - ] + "actualCount": 1, + "undocumentLines": [] }, - "src/removal/delete_case5.js": { + "src/deletion/delete_case5.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 5 - ] + "actualCount": 1, + "undocumentLines": [] }, - "src/removal/delete_case6.js": { + "src/deletion/delete_case6.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 3 - ] + "actualCount": 1, + "undocumentLines": [] }, - "src/removal/delete_one_child.js": { + "src/deletion/delete_one_child.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 6 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/family/grandparent.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/traversal/inordertraversal.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/insertion/insert.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 2 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/insertion/insert_case1.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 5 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/insertion/insert_case2.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 5 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/insertion/insert_case3.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 5 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/insertion/insert_case4.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 5 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/insertion/insert_case5.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 4 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/family/predecessor.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/traversal/rangetraversal.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, - "src/removal/replace_node.js": { + "src/deletion/replace_node.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/rotate/rotate_left.js": { "expectCount": 1, @@ -196,24 +138,18 @@ }, "src/search/search.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/family/sibling.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 1 - ] + "actualCount": 1, + "undocumentLines": [] }, "src/family/uncle.js": { "expectCount": 1, - "actualCount": 0, - "undocumentLines": [ - 3 - ] + "actualCount": 1, + "undocumentLines": [] } } } \ No newline at end of file diff --git a/dump.json b/dump.json index e9b42ae..0c75613 100644 --- a/dump.json +++ b/dump.json @@ -10,7 +10,7 @@ "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK } from '..' ;\n\nexport function Leaf ( parent ) {\n\tthis.color = BLACK ;\n\tthis.parent = parent ;\n}\n\nLeaf.prototype.isleaf = function ( ) { return true ; } ;\n" + "content": "import { BLACK } from '..' ;\n\n/**\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n */\nexport function Leaf ( parent ) {\n\tthis.color = BLACK ;\n\tthis.parent = parent ;\n}\n\n/**\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n */\nLeaf.prototype.isleaf = function ( ) { return true ; } ;\n" }, { "__docId__": 1, @@ -24,17 +24,38 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/adt/Leaf.js", "importStyle": "{Leaf}", - "description": null, - "lineNumber": 3, - "undocument": true, + "description": "A black leaf node.", + "lineNumber": 10, + "unknown": [ + { + "tagName": "@constructor", + "tagValue": "" + }, + { + "tagName": "@returns", + "tagValue": "{Leaf}" + } + ], "params": [ { - "name": "parent", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "parent", + "description": "The parent node in the tree." } ], + "return": { + "nullable": null, + "types": [ + "Leaf" + ], + "spread": false, + "description": "" + }, "generator": false }, { @@ -49,14 +70,22 @@ "export": false, "importPath": "aureooms-es-red-black-tree/src/adt/Leaf.js", "importStyle": null, - "description": null, - "lineNumber": 8, - "undocument": true, + "description": "Returns true if the Leaf object is a leaf. This\nalways returns true.", + "lineNumber": 21, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Boolean}" + } + ], "params": [], "return": { + "nullable": null, "types": [ - "boolean" - ] + "Boolean" + ], + "spread": false, + "description": "" }, "generator": false }, @@ -71,7 +100,7 @@ "access": null, "description": null, "lineNumber": 1, - "content": "import { Leaf } from './Leaf' ;\n\nexport function Node ( color , value ) {\n\tthis.color = color ;\n\tthis.left = new Leaf( this ) ;\n\tthis.right = new Leaf( this ) ;\n\tthis.parent = null ;\n\tthis.value = value ;\n}\n\nNode.prototype.isleaf = function ( ) { return false ; } ;\n" + "content": "import { Leaf } from './Leaf' ;\n\n/**\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n */\nexport function Node ( color , key ) {\n\tthis.color = color ;\n\tthis.left = new Leaf( this ) ;\n\tthis.right = new Leaf( this ) ;\n\tthis.parent = null ;\n\tthis.key = key ;\n}\n\n/**\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n */\nNode.prototype.isleaf = function ( ) { return false ; } ;\n" }, { "__docId__": 4, @@ -85,23 +114,48 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/adt/Node.js", "importStyle": "{Node}", - "description": null, - "lineNumber": 3, - "undocument": true, + "description": "An internal node. This node can be red or black.", + "lineNumber": 11, + "unknown": [ + { + "tagName": "@constructor", + "tagValue": "" + }, + { + "tagName": "@returns", + "tagValue": "{Node}" + } + ], "params": [ { - "name": "color", + "nullable": null, "types": [ - "*" - ] + "Number" + ], + "spread": false, + "optional": false, + "name": "color", + "description": "The color of the node." }, { - "name": "value", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "key", + "description": "The key of the node." } ], + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "" + }, "generator": false }, { @@ -116,14 +170,22 @@ "export": false, "importPath": "aureooms-es-red-black-tree/src/adt/Node.js", "importStyle": null, - "description": null, - "lineNumber": 11, - "undocument": true, + "description": "Returns true if the Node object is a leaf. This\nalways returns false.", + "lineNumber": 25, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Boolean}" + } + ], "params": [], "return": { + "nullable": null, "types": [ - "boolean" - ] + "Boolean" + ], + "spread": false, + "description": "" }, "generator": false }, @@ -138,7 +200,7 @@ "access": null, "description": null, "lineNumber": 2, - "content": "\nimport { Node } from './Node' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { search } from '..' ;\nimport { inordertraversal , rangetraversal } from '..' ;\n\nexport class RedBlackTree {\n\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\tadd ( value ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , value ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , value ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\t_search ( value ) {\n\t\tif ( this.root === null ) return null ;\n\t\treturn search( this.compare , this.root , value ) ;\n\t}\n\n\tget ( value ) {\n\t\tconst node = this._search( value ) ;\n\t\treturn node === null ? null : node.value ;\n\t}\n\n\thas ( value ) {\n\t\treturn this._search( value ) !== null ;\n\t}\n\n\t_delete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's value with predecessor's value\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.value = pred.value ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's value with successor's value\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.value = succ.value ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\tremove ( value ) {\n\n\t\tconst node = this._search( value ) ;\n\t\tif ( node === null ) return false ;\n\n\t\tthis._delete( node ) ;\n\t\treturn true ;\n\n\t}\n\n\t*range ( left , right ) {\n\n\t\tif ( this.root !== null ) yield* rangetraversal( this.compare , this.root , left , right ) ;\n\n\t}\n\n\t*values ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\t[Symbol.iterator] ( ) {\n\n\t\treturn this.values() ;\n\n\t}\n\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" + "content": "\nimport { Node } from './Node' ;\nimport { RED , BLACK } from '..' ;\nimport { predecessor } from '..' ;\nimport { insert , insert_case2 } from '..' ;\nimport { delete_one_child } from '..' ;\nimport { search } from '..' ;\nimport { inordertraversal , rangetraversal } from '..' ;\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport class RedBlackTree {\n\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t */\n\tconstructor ( compare ) {\n\n\t\tthis.compare = compare ;\n\t\tthis.root = null ;\n\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t */\n\tadd ( key ) {\n\t\tif ( this.root === null ) {\n\t\t\tthis.root = new Node( BLACK , key ) ;\n\t\t}\n\t\telse {\n\t\t\tconst node = new Node( RED , key ) ;\n\t\t\tinsert( this.compare , this.root , node ) ;\n\t\t\tinsert_case2( node ) ;\n\t\t}\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search ( key ) {\n\t\tif ( this.root === null ) return null ;\n\t\treturn search( this.compare , this.root , key ) ;\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t */\n\tget ( key ) {\n\t\tconst node = this._search( key ) ;\n\t\treturn node === null ? null : node.key ;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t */\n\thas ( key ) {\n\t\treturn this._search( key ) !== null ;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\t_delete ( node ) {\n\n\t\tif ( !node.left.isleaf() ) {\n\t\t\t// replace node's key with predecessor's key\n\t\t\tconst pred = predecessor( node ) ;\n\t\t\tnode.key = pred.key ;\n\t\t\t// delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( pred ) ;\n\t\t}\n\n\t\telse if ( !node.right.isleaf() ) {\n\t\t\t// replace node's key with successor's key\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right ;\n\t\t\tnode.key = succ.key ;\n\t\t\t// delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child( succ ) ;\n\t\t}\n\n\t\telse if ( node === this.root ) {\n\t\t\tthis.root = null ;\n\t\t}\n\n\t\telse {\n\t\t\tdelete_one_child( node ) ;\n\t\t}\n\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove ( key ) {\n\n\t\tconst node = this._search( key ) ;\n\t\tif ( node === null ) return false ;\n\n\t\tthis._delete( node ) ;\n\t\treturn true ;\n\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t */\n\t*range ( left , right ) {\n\n\t\tif ( this.root !== null ) yield* rangetraversal( this.compare , this.root , left , right ) ;\n\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t */\n\t*items ( ) {\n\n\t\tif ( this.root !== null ) yield* inordertraversal( this.root ) ;\n\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator] ( ) {\n\n\t\treturn this.items() ;\n\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from ( compare , iterable ) {\n\n\t\tconst tree = new RedBlackTree( compare ) ;\n\n\t\tfor ( const element of iterable ) tree.add( element ) ;\n\n\t\treturn tree ;\n\n\t}\n\n}\n" }, { "__docId__": 7, @@ -152,9 +214,8 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/adt/RedBlackTree.js", "importStyle": "{RedBlackTree}", - "description": null, - "lineNumber": 10, - "undocument": true, + "description": "A RedBlackTree with key-only nodes.", + "lineNumber": 14, "interface": false }, { @@ -166,17 +227,34 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#constructor", "access": null, - "description": null, - "lineNumber": 12, - "undocument": true, + "description": "Constructs a new empty red-black tree.", + "lineNumber": 22, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{RedBlackTree}" + } + ], "params": [ { - "name": "compare", + "nullable": null, "types": [ - "*" - ] + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function for node keys." } ], + "return": { + "nullable": null, + "types": [ + "RedBlackTree" + ], + "spread": false, + "description": "" + }, "generator": false }, { @@ -189,7 +267,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#compare", "access": null, "description": null, - "lineNumber": 14, + "lineNumber": 24, "undocument": true, "type": { "types": [ @@ -207,7 +285,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", "access": null, "description": null, - "lineNumber": 15, + "lineNumber": 25, "undocument": true, "type": { "types": [ @@ -224,15 +302,18 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#add", "access": null, - "description": null, - "lineNumber": 19, - "undocument": true, + "description": "Adds a key to the tree.", + "lineNumber": 34, "params": [ { - "name": "value", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "key", + "description": "The key to add." } ], "generator": false @@ -247,7 +328,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", "access": null, "description": null, - "lineNumber": 21, + "lineNumber": 36, "undocument": true, "type": { "types": [ @@ -264,21 +345,33 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#_search", "access": null, - "description": null, - "lineNumber": 30, - "undocument": true, + "description": "Search for the input key in the tree.\nReturns the first node whose key equals the input key.\nIf no such node exists, returns null.", + "lineNumber": 53, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node}" + } + ], "params": [ { - "name": "value", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "key", + "description": "The input key." } ], "return": { + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "description": "" }, "generator": false }, @@ -291,21 +384,33 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#get", "access": null, - "description": null, - "lineNumber": 35, - "undocument": true, + "description": "Search for the input key in the tree. Returns the first node key found\nin this way (with {@link RedBlackTree#_search}. If no such key exists\nin the tree, returns null.", + "lineNumber": 66, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Key}" + } + ], "params": [ { - "name": "value", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "key", + "description": "The input key." } ], "return": { + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "description": "" }, "generator": false }, @@ -318,21 +423,33 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#has", "access": null, - "description": null, - "lineNumber": 40, - "undocument": true, + "description": "Returns true if and only if the tree contains the input\nkey.", + "lineNumber": 78, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Boolean}" + } + ], "params": [ { - "name": "value", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "key", + "description": "The input key." } ], "return": { + "nullable": null, "types": [ - "*" - ] + "Boolean" + ], + "spread": false, + "description": "" }, "generator": false }, @@ -345,15 +462,18 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#_delete", "access": null, - "description": null, - "lineNumber": 44, - "undocument": true, + "description": "Deletes the input node from the tree.", + "lineNumber": 87, "params": [ { - "name": "node", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "node", + "description": "The input node to delete." } ], "generator": false @@ -368,7 +488,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", "access": null, "description": null, - "lineNumber": 69, + "lineNumber": 112, "undocument": true, "type": { "types": [ @@ -385,21 +505,33 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#remove", "access": null, - "description": null, - "lineNumber": 78, - "undocument": true, + "description": "Search for the first node of the tree whose key equals the input key\n(with {@link RedBlackTree#_search}), then delete that node\n(with {@link RedBlackTree#_delete}). If such a node is found and deleted\nthen return true. Return false otherwise.", + "lineNumber": 130, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Boolean} - Whether the key existed in the tree before removal." + } + ], "params": [ { - "name": "value", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "key", + "description": "The input key." } ], "return": { + "nullable": null, "types": [ - "boolean" - ] + "Boolean" + ], + "spread": false, + "description": "Whether the key existed in the tree before removal." }, "generator": false }, @@ -412,23 +544,44 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#range", "access": null, - "description": null, - "lineNumber": 88, - "undocument": true, + "description": "Returns an in order iterator over the keys of the tree that lie in the\ninterval [left, right[.", + "lineNumber": 147, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Iterator}" + } + ], "params": [ { - "name": "left", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "left", + "description": "The left bound of the interval." }, { - "name": "right", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "right", + "description": "The right bound of the interval." } ], + "return": { + "nullable": null, + "types": [ + "Iterator" + ], + "spread": false, + "description": "" + }, "generator": true }, { @@ -436,14 +589,27 @@ "kind": "method", "static": false, "variation": null, - "name": "values", + "name": "items", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", - "longname": "src/adt/RedBlackTree.js~RedBlackTree#values", + "longname": "src/adt/RedBlackTree.js~RedBlackTree#items", "access": null, - "description": null, - "lineNumber": 94, - "undocument": true, + "description": "Returns an in order iterator over the keys of the tree.", + "lineNumber": 158, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Iterator}" + } + ], "params": [], + "return": { + "nullable": null, + "types": [ + "Iterator" + ], + "spread": false, + "description": "" + }, "generator": true }, { @@ -455,9 +621,8 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "access": null, - "description": null, - "lineNumber": 100, - "undocument": true, + "description": "Same as {@link RedBlackTree#items}.", + "lineNumber": 167, "params": [], "return": { "types": [ @@ -475,27 +640,43 @@ "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "longname": "src/adt/RedBlackTree.js~RedBlackTree.from", "access": null, - "description": null, - "lineNumber": 106, - "undocument": true, + "description": "Constructs a red-black tree from an input iterable.", + "lineNumber": 180, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{RedBlackTree}" + } + ], "params": [ { - "name": "compare", + "nullable": null, "types": [ - "*" - ] + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function to use." }, { - "name": "iterable", + "nullable": null, "types": [ - "*" - ] + "Iterbale" + ], + "spread": false, + "optional": false, + "name": "iterable", + "description": "The input iterable." } ], "return": { + "nullable": null, "types": [ - "*" - ] + "RedBlackTree" + ], + "spread": false, + "description": "" }, "generator": false }, @@ -522,8 +703,8 @@ "longname": "src/color/BLACK.js", "access": null, "description": null, - "lineNumber": 1, - "content": "export const BLACK = 0 ;\n" + "lineNumber": 4, + "content": "/**\n * Constant for black.\n */\nexport const BLACK = 0 ;\n" }, { "__docId__": 25, @@ -537,9 +718,8 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/color/BLACK.js", "importStyle": "{BLACK}", - "description": null, - "lineNumber": 1, - "undocument": true, + "description": "Constant for black.", + "lineNumber": 4, "type": { "types": [ "number" @@ -556,8 +736,8 @@ "longname": "src/color/RED.js", "access": null, "description": null, - "lineNumber": 1, - "content": "export const RED = 1 ;\n" + "lineNumber": 4, + "content": "/**\n * Constant for red.\n */\nexport const RED = 1 ;\n" }, { "__docId__": 27, @@ -571,9 +751,8 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/color/RED.js", "importStyle": "{RED}", - "description": null, - "lineNumber": 1, - "undocument": true, + "description": "Constant for red.", + "lineNumber": 4, "type": { "types": [ "number" @@ -604,7 +783,7 @@ "access": null, "description": null, "lineNumber": 1, - "content": "import chalk from 'chalk' ;\n\nimport { BLACK } from '..' ;\n\nexport function debug ( node ) {\n\n\tif ( node.isleaf( ) ) return chalk.bgBlack('L') ;\n\n\tconst repr = node.color === BLACK ? chalk.bgBlack(node.value) : chalk.bgRed( node.value ) ;\n\n\treturn `(${debug(node.left)}, ${repr}, ${debug(node.right)})` ;\n\n}\n" + "content": "import chalk from 'chalk' ;\n\nimport { BLACK } from '..' ;\n\n/**\n * Recursively constructs a prettyprint string for the red-black tree rooted at\n * root.\n *\n * @param {Node} root - The root of the tree.\n * @returns {String}\n */\nexport function debug ( root ) {\n\n\tif ( root.isleaf( ) ) return chalk.bgBlack('L') ;\n\n\tconst repr = root.color === BLACK ? chalk.bgBlack(root.key) : chalk.bgRed( root.key ) ;\n\n\treturn `(${debug(root.left)}, ${repr}, ${debug(root.right)})` ;\n\n}\n" }, { "__docId__": 30, @@ -618,21 +797,33 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/debug/debug.js", "importStyle": "{debug}", - "description": null, - "lineNumber": 5, - "undocument": true, + "description": "Recursively constructs a prettyprint string for the red-black tree rooted at\nroot.", + "lineNumber": 12, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{String}" + } + ], "params": [ { - "name": "node", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "root", + "description": "The root of the tree." } ], "return": { + "nullable": null, "types": [ - "string" - ] + "String" + ], + "spread": false, + "description": "" }, "generator": false }, @@ -654,42 +845,40 @@ "kind": "file", "static": true, "variation": null, - "name": "src/family/grandparent.js", + "name": "src/deletion/delete_case1.js", "memberof": null, - "longname": "src/family/grandparent.js", + "longname": "src/deletion/delete_case1.js", "access": null, "description": null, "lineNumber": 1, - "content": "export function grandparent ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only call this function when n HAS a grandparent\n\treturn n.parent.parent;\n\n}\n" + "content": "import { delete_case2 } from './delete_case2' ;\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case1 ( n ) {\n\n // If n is the root, there is nothing to do: all paths go through n, and n\n // is black.\n if ( n.parent !== null ) delete_case2( n ) ;\n\n}\n" }, { "__docId__": 33, "kind": "function", "static": true, "variation": null, - "name": "grandparent", - "memberof": "src/family/grandparent.js", - "longname": "src/family/grandparent.js~grandparent", + "name": "delete_case1", + "memberof": "src/deletion/delete_case1.js", + "longname": "src/deletion/delete_case1.js~delete_case1", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/family/grandparent.js", - "importStyle": "{grandparent}", - "description": null, - "lineNumber": 1, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/deletion/delete_case1.js", + "importStyle": "{delete_case1}", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b", + "lineNumber": 11, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], - "return": { - "types": [ - "*" - ] - }, "generator": false }, { @@ -697,296 +886,307 @@ "kind": "file", "static": true, "variation": null, - "name": "src/family/index.js", + "name": "src/deletion/delete_case2.js", "memberof": null, - "longname": "src/family/index.js", + "longname": "src/deletion/delete_case2.js", "access": null, "description": null, "lineNumber": 1, - "content": "export * from './grandparent' ;\nexport * from './predecessor' ;\nexport * from './sibling' ;\nexport * from './uncle' ;\n" + "content": "import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\nimport { delete_case4 } from './delete_case4' ;\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case2 ( n ) {\n\n const s = sibling( n ) ;\n\n\t/**\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t */\n if ( s.color === RED ) {\n n.parent.color = RED ;\n s.color = BLACK ;\n if ( n === n.parent.left ) rotate_left( n.parent ) ;\n else rotate_right( n.parent ) ;\n delete_case4( n ) ;\n }\n\n // Otherwise, go to case 3.\n else delete_case3( n ) ;\n\n}\n" }, { "__docId__": 35, - "kind": "file", + "kind": "function", "static": true, "variation": null, - "name": "src/family/predecessor.js", - "memberof": null, - "longname": "src/family/predecessor.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export function predecessor ( node ) {\n\n\tvar pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" - }, - { - "__docId__": 36, - "kind": "function", - "static": true, - "variation": null, - "name": "predecessor", - "memberof": "src/family/predecessor.js", - "longname": "src/family/predecessor.js~predecessor", + "name": "delete_case2", + "memberof": "src/deletion/delete_case2.js", + "longname": "src/deletion/delete_case2.js~delete_case2", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/family/predecessor.js", - "importStyle": "{predecessor}", - "description": null, - "lineNumber": 1, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/deletion/delete_case2.js", + "importStyle": "{delete_case2}", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root", + "lineNumber": 15, "params": [ { - "name": "node", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], - "return": { - "types": [ - "*" - ] - }, "generator": false }, { - "__docId__": 37, + "__docId__": 36, "kind": "file", "static": true, "variation": null, - "name": "src/family/sibling.js", + "name": "src/deletion/delete_case3.js", "memberof": null, - "longname": "src/family/sibling.js", + "longname": "src/deletion/delete_case3.js", "access": null, "description": null, "lineNumber": 1, - "content": "export function sibling ( n ) {\n\n\t//assert((n !== null) && (n.parent !== null));\n\t//We only use this function when n HAS a sibling so this case can never\n\t//happen.\n\n\treturn n === n.parent.left ? n.parent.right : n.parent.left ;\n\n}\n" + "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case3 ( n ) {\n\n const s = sibling( n ) ;\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n * repaint n's sibling red. Now all root-leaft paths going through n's\n * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n if (\n ( n.parent.color === BLACK ) &&\n ( s.left.color === BLACK ) &&\n ( s.right.color === BLACK )\n ) {\n s.color = RED ;\n delete_case1( n.parent ) ;\n }\n\n // Otherwise, go to case 4.\n else delete_case4( n ) ;\n\n}\n" }, { - "__docId__": 38, + "__docId__": 37, "kind": "function", "static": true, "variation": null, - "name": "sibling", - "memberof": "src/family/sibling.js", - "longname": "src/family/sibling.js~sibling", + "name": "delete_case3", + "memberof": "src/deletion/delete_case3.js", + "longname": "src/deletion/delete_case3.js~delete_case3", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/family/sibling.js", - "importStyle": "{sibling}", - "description": null, - "lineNumber": 1, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/deletion/delete_case3.js", + "importStyle": "{delete_case3}", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black", + "lineNumber": 16, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], - "return": { - "types": [ - "*" - ] - }, "generator": false }, { - "__docId__": 39, + "__docId__": 38, "kind": "file", "static": true, "variation": null, - "name": "src/family/uncle.js", + "name": "src/deletion/delete_case4.js", "memberof": null, - "longname": "src/family/uncle.js", + "longname": "src/deletion/delete_case4.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { grandparent } from './grandparent' ;\n\nexport function uncle ( n ) {\n\tconst g = grandparent( n );\n\t// assert( g !== null ) ;\n\t// this can never happen\n\tif ( n.parent === g.left )\n\t return g.right.isleaf( ) ? null : g.right ;\n\telse\n\t return g.left.isleaf( ) ? null : g.left ;\n}\n" + "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case4 ( n ) {\n\n const s = sibling(n);\n\n\t/**\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n if (\n // the parent color test is always true when coming from case 2\n ( n.parent.color === RED ) &&\n ( s.left.color === BLACK ) &&\n ( s.right.color === BLACK )\n ) {\n s.color = RED;\n n.parent.color = BLACK;\n }\n\n // Otherwise, go to case 5.\n else delete_case5( n ) ;\n\n}\n" }, { - "__docId__": 40, + "__docId__": 39, "kind": "function", "static": true, "variation": null, - "name": "uncle", - "memberof": "src/family/uncle.js", - "longname": "src/family/uncle.js~uncle", + "name": "delete_case4", + "memberof": "src/deletion/delete_case4.js", + "longname": "src/deletion/delete_case4.js~delete_case4", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/family/uncle.js", - "importStyle": "{uncle}", - "description": null, - "lineNumber": 3, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/deletion/delete_case4.js", + "importStyle": "{delete_case4}", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - n's parent and n's sibling's children cannot all be black", + "lineNumber": 16, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], - "return": { - "types": [ - "*" - ] - }, "generator": false }, { - "__docId__": 41, + "__docId__": 40, "kind": "file", "static": true, "variation": null, - "name": "src/index.js", + "name": "src/deletion/delete_case5.js", "memberof": null, - "longname": "src/index.js", + "longname": "src/deletion/delete_case5.js", "access": null, "description": null, "lineNumber": 1, - "content": "export * from './adt' ;\nexport * from './color' ;\nexport * from './debug' ;\nexport * from './family' ;\nexport * from './insertion' ;\nexport * from './removal' ;\nexport * from './rotate' ;\nexport * from './search' ;\nexport * from './traversal' ;\n" + "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nimport { delete_case6 } from './delete_case6' ;\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case5 ( n ) {\n\n const s = sibling( n ) ;\n\n // The following statements just force the red n's sibling child to be on\n // the left of the left of the parent, or right of the right, so case 6\n // will rotate correctly.\n\n\t/**\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t */\n if ( ( n === n.parent.left ) && ( s.right.color === BLACK ) ) {\n s.color = RED ;\n s.left.color = BLACK ;\n rotate_right( s ) ;\n }\n\n\t/**\n\t * ? ?\n\t * / \\ / \\\n\t * B >B B >B\n\t * / \\ / \\ --> / \\ / \\\n\t * B R - - R = - -\n\t * / \\ / \\ / \\\n\t * - - = = B =\n\t * / \\\n\t * - -\n\t */\n else if ( ( n === n.parent.right ) && ( s.left.color === BLACK ) ) {\n s.color = RED ;\n s.right.color = BLACK ;\n rotate_left( s ) ;\n }\n\n delete_case6( n ) ;\n\n}\n" }, { - "__docId__": 42, - "kind": "file", + "__docId__": 41, + "kind": "function", "static": true, "variation": null, - "name": "src/insertion/index.js", - "memberof": null, - "longname": "src/insertion/index.js", + "name": "delete_case5", + "memberof": "src/deletion/delete_case5.js", + "longname": "src/deletion/delete_case5.js~delete_case5", "access": null, - "description": null, - "lineNumber": 1, - "content": "export * from './insert' ;\nexport * from './insert_case1' ;\nexport * from './insert_case2' ;\nexport * from './insert_case3' ;\nexport * from './insert_case4' ;\nexport * from './insert_case5' ;\n" + "export": true, + "importPath": "aureooms-es-red-black-tree/src/deletion/delete_case5.js", + "importStyle": "{delete_case5}", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - at least one of n's sibling's children is red", + "lineNumber": 16, + "params": [ + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." + } + ], + "generator": false }, { - "__docId__": 43, + "__docId__": 42, "kind": "file", "static": true, "variation": null, - "name": "src/insertion/insert.js", + "name": "src/deletion/delete_case6.js", "memberof": null, - "longname": "src/insertion/insert.js", + "longname": "src/deletion/delete_case6.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nexport function insert ( compare, A, B ) {\n\n\twhile ( true ) {\n\n\t\tif ( compare( B.value, A.value ) < 0 ) {\n\n\t\t\tconst node = A.left;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t\telse {\n\n\t\t\tconst node = A.right;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n\n}\n" + "lineNumber": 1, + "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case6 ( n ) {\n\n const s = sibling( n ) ;\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n * We can repaint n's sibling's right child in black to fix this.\n * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n s.color = n.parent.color ;\n n.parent.color = BLACK ;\n\n if ( n === n.parent.left ) {\n s.right.color = BLACK ;\n rotate_left( n.parent ) ;\n }\n\n // symmetric case\n else {\n s.left.color = BLACK ;\n rotate_right( n.parent ) ;\n }\n\n}\n" }, { - "__docId__": 44, + "__docId__": 43, "kind": "function", "static": true, "variation": null, - "name": "insert", - "memberof": "src/insertion/insert.js", - "longname": "src/insertion/insert.js~insert", + "name": "delete_case6", + "memberof": "src/deletion/delete_case6.js", + "longname": "src/deletion/delete_case6.js~delete_case6", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/insertion/insert.js", - "importStyle": "{insert}", - "description": null, - "lineNumber": 2, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/deletion/delete_case6.js", + "importStyle": "{delete_case6}", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - if n is a left child, the right child of n's sibling is red\n - if n is a right child, the left child of n's sibling is red", + "lineNumber": 15, "params": [ { - "name": "compare", - "types": [ - "*" - ] - }, - { - "name": "A", - "types": [ - "*" - ] - }, - { - "name": "B", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], - "return": { - "types": [ - "*" - ] - }, "generator": false }, { - "__docId__": 45, + "__docId__": 44, "kind": "file", "static": true, "variation": null, - "name": "src/insertion/insert_case1.js", + "name": "src/deletion/delete_one_child.js", "memberof": null, - "longname": "src/insertion/insert_case1.js", + "longname": "src/deletion/delete_one_child.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { BLACK } from '..' ;\nimport { insert_case2 } from './insert_case2' ;\n\nexport function insert_case1(n)\n{\n if (n.parent === null)\n n.color = BLACK;\n else\n insert_case2(n);\n}\n" + "lineNumber": 1, + "content": "import { BLACK , RED } from '..' ;\n\nimport { replace_node } from './replace_node' ;\nimport { delete_case1 } from './delete_case1' ;\n\n/**\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n */\nexport function delete_one_child ( n ) {\n\n // Precondition: n has at most one non-leaf child.\n // assert( n.right.isleaf() || n.left.isleaf());\n\n // const child = n.right.isleaf() ? n.left : n.right;\n // n.right is always a LEAF because either n is a subtree predecessor or it\n // is the only child of its parent by the red-black tree properties\n const child = n.left ;\n\n // replace n with its left child\n replace_node( n , child ) ;\n\n // If n is black, deleting it reduces the black-height of every path going\n // through it by 1.\n if ( n.color === BLACK ) {\n\n // We can easily fix this when its left child is an\n // internal red node: change the color of the left child to black and\n // replace n with it.\n if ( child.color === RED ) child.color = BLACK ;\n\n // Otherwise, there are more things to fix.\n else delete_case1( child ) ;\n\n }\n\n // else {\n // If n is red then its child can only be black. Replacing n with its\n // child suffices.\n // }\n\n}\n" }, { - "__docId__": 46, + "__docId__": 45, "kind": "function", "static": true, "variation": null, - "name": "insert_case1", - "memberof": "src/insertion/insert_case1.js", - "longname": "src/insertion/insert_case1.js~insert_case1", + "name": "delete_one_child", + "memberof": "src/deletion/delete_one_child.js", + "longname": "src/deletion/delete_one_child.js~delete_one_child", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case1.js", - "importStyle": "{insert_case1}", - "description": null, - "lineNumber": 5, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/deletion/delete_one_child.js", + "importStyle": "{delete_one_child}", + "description": "Delete a node n that has at most a single non-leaf child.\n\nPrecondition:\n - n has at most one non-leaf child.\n - if n has a non-leaf child, then it is its left child.", + "lineNumber": 15, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The node to delete." } ], "generator": false }, + { + "__docId__": 46, + "kind": "file", + "static": true, + "variation": null, + "name": "src/deletion/index.js", + "memberof": null, + "longname": "src/deletion/index.js", + "access": null, + "description": null, + "lineNumber": 1, + "content": "export * from './delete_case1' ;\nexport * from './delete_case2' ;\nexport * from './delete_case3' ;\nexport * from './delete_case4' ;\nexport * from './delete_case5' ;\nexport * from './delete_case6' ;\nexport * from './delete_one_child' ;\nexport * from './replace_node' ;\n" + }, { "__docId__": 47, "kind": "file", "static": true, "variation": null, - "name": "src/insertion/insert_case2.js", + "name": "src/deletion/replace_node.js", "memberof": null, - "longname": "src/insertion/insert_case2.js", + "longname": "src/deletion/replace_node.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { BLACK } from '..' ;\nimport { insert_case3 } from './insert_case3' ;\n\nexport function insert_case2(n)\n{\n if (n.parent.color === BLACK)\n return; /* Tree is still valid */\n else\n insert_case3(n);\n}\n" + "lineNumber": 7, + "content": "/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n */\nexport function replace_node ( A , B ) {\n\n\t// assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif ( A === A.parent.left ) A.parent.left = B ;\n\n\telse A.parent.right = B ;\n\n\tB.parent = A.parent ;\n\n}\n" }, { "__docId__": 48, "kind": "function", "static": true, "variation": null, - "name": "insert_case2", - "memberof": "src/insertion/insert_case2.js", - "longname": "src/insertion/insert_case2.js~insert_case2", + "name": "replace_node", + "memberof": "src/deletion/replace_node.js", + "longname": "src/deletion/replace_node.js~replace_node", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case2.js", - "importStyle": "{insert_case2}", - "description": null, - "lineNumber": 5, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/deletion/replace_node.js", + "importStyle": "{replace_node}", + "description": "Replaces node A by node B.", + "lineNumber": 7, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "A", + "description": "The node to replace." + }, + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "B", + "description": "The replacement node." } ], "generator": false @@ -996,37 +1196,54 @@ "kind": "file", "static": true, "variation": null, - "name": "src/insertion/insert_case3.js", + "name": "src/family/grandparent.js", "memberof": null, - "longname": "src/insertion/insert_case3.js", + "longname": "src/family/grandparent.js", "access": null, "description": null, - "lineNumber": 1, - "content": "import { BLACK , RED , uncle , grandparent } from '..' ;\nimport { insert_case1 } from './insert_case1' ;\nimport { insert_case4 } from './insert_case4' ;\n\nexport function insert_case3(n)\n{\n const u = uncle(n);\n\n if ((u !== null) && (u.color === RED)) {\n n.parent.color = BLACK;\n u.color = BLACK;\n const g = grandparent(n);\n g.color = RED;\n insert_case1(g);\n } else {\n insert_case4(n);\n }\n}\n" + "lineNumber": 7, + "content": "/**\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport function grandparent ( node ) {\n\n\t// assert((node !== null) && (node.parent !== null));\n\t// We only call this function when node HAS a grandparent\n\treturn node.parent.parent;\n\n}\n" }, { "__docId__": 50, "kind": "function", "static": true, "variation": null, - "name": "insert_case3", - "memberof": "src/insertion/insert_case3.js", - "longname": "src/insertion/insert_case3.js~insert_case3", + "name": "grandparent", + "memberof": "src/family/grandparent.js", + "longname": "src/family/grandparent.js~grandparent", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case3.js", - "importStyle": "{insert_case3}", - "description": null, - "lineNumber": 5, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/family/grandparent.js", + "importStyle": "{grandparent}", + "description": "Computes the grandparent (parent of parent) of the input node.", + "lineNumber": 7, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node}" + } + ], "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "node", + "description": "The input node." } ], + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "" + }, "generator": false }, { @@ -1034,396 +1251,481 @@ "kind": "file", "static": true, "variation": null, - "name": "src/insertion/insert_case4.js", + "name": "src/family/index.js", "memberof": null, - "longname": "src/insertion/insert_case4.js", + "longname": "src/family/index.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { rotate_left , rotate_right , grandparent } from '..' ;\nimport { insert_case5 } from './insert_case5' ;\n\nexport function insert_case4(n)\n{\n const g = grandparent(n);\n\n if ((n === n.parent.right) && (n.parent === g.left)) {\n rotate_left(n.parent);\n\n /*\n * rotate_left can be the below because of already having *g = grandparent(n)\n *\n * saved_p=g.left, *saved_left_n=n.left;\n * g.left=n;\n * n.left=saved_p;\n * saved_p.right=saved_left_n;\n *\n * and modify the parent's nodes properly\n */\n\n //n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\n } else if ((n === n.parent.left) && (n.parent === g.right)) {\n rotate_right(n.parent);\n\n /*\n * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n *\n * saved_p=g.right, *saved_right_n=n.right;\n * g.right=n;\n * n.right=saved_p;\n * saved_p.left=saved_right_n;\n *\n */\n\n //n = n.right;\n }\n insert_case5(n);\n}\n" + "lineNumber": 1, + "content": "export * from './grandparent' ;\nexport * from './predecessor' ;\nexport * from './sibling' ;\nexport * from './uncle' ;\n" }, { "__docId__": 52, + "kind": "file", + "static": true, + "variation": null, + "name": "src/family/predecessor.js", + "memberof": null, + "longname": "src/family/predecessor.js", + "access": null, + "description": null, + "lineNumber": 8, + "content": "/**\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport function predecessor ( node ) {\n\n\t// assert( !node.left.isleaf() ) ;\n\tlet pred = node.left ;\n\n\twhile ( !pred.right.isleaf() ) pred = pred.right ;\n\n\treturn pred ;\n\n}\n" + }, + { + "__docId__": 53, "kind": "function", "static": true, "variation": null, - "name": "insert_case4", - "memberof": "src/insertion/insert_case4.js", - "longname": "src/insertion/insert_case4.js~insert_case4", + "name": "predecessor", + "memberof": "src/family/predecessor.js", + "longname": "src/family/predecessor.js~predecessor", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case4.js", - "importStyle": "{insert_case4}", - "description": null, - "lineNumber": 5, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/family/predecessor.js", + "importStyle": "{predecessor}", + "description": "Computes the predecessor of the input node, in the subtree rooted at the\ninput node, when this predecessor is guaranteed to exist.", + "lineNumber": 8, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node}" + } + ], "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "node", + "description": "The input node." } ], + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "" + }, "generator": false }, { - "__docId__": 53, + "__docId__": 54, "kind": "file", "static": true, "variation": null, - "name": "src/insertion/insert_case5.js", + "name": "src/family/sibling.js", "memberof": null, - "longname": "src/insertion/insert_case5.js", + "longname": "src/family/sibling.js", "access": null, "description": null, - "lineNumber": 2, - "content": "\nimport { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;\n\nexport function insert_case5(n)\n{\n const g = grandparent(n);\n\n n.parent.color = BLACK;\n g.color = RED;\n if (n === n.parent.left)\n rotate_right(g);\n else\n rotate_left(g);\n}\n" + "lineNumber": 7, + "content": "/**\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport function sibling ( node ) {\n\n\t// assert((node !== null) && (node.parent !== null));\n\t// We only use this function when node HAS a sibling so this case can never\n\t// happen.\n\n\treturn node === node.parent.left ? node.parent.right : node.parent.left ;\n\n}\n" }, { - "__docId__": 54, + "__docId__": 55, "kind": "function", "static": true, "variation": null, - "name": "insert_case5", - "memberof": "src/insertion/insert_case5.js", - "longname": "src/insertion/insert_case5.js~insert_case5", + "name": "sibling", + "memberof": "src/family/sibling.js", + "longname": "src/family/sibling.js~sibling", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case5.js", - "importStyle": "{insert_case5}", - "description": null, - "lineNumber": 4, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/family/sibling.js", + "importStyle": "{sibling}", + "description": "Computes the sibling of the input node.", + "lineNumber": 7, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node}" + } + ], "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "node", + "description": "The input node." } ], + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "" + }, "generator": false }, { - "__docId__": 55, + "__docId__": 56, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case1.js", + "name": "src/family/uncle.js", "memberof": null, - "longname": "src/removal/delete_case1.js", + "longname": "src/family/uncle.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { delete_case2 } from './delete_case2' ;\n\nexport function delete_case1 ( n ) {\n\n if ( n.parent !== null ) delete_case2( n ) ;\n\n}\n" + "content": "import { grandparent } from './grandparent' ;\n\n/**\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport function uncle ( node ) {\n\tconst g = grandparent( node );\n\t// assert( g !== null ) ;\n\t// this can never happen\n\tif ( node.parent === g.left )\n\t return g.right.isleaf( ) ? null : g.right ;\n\telse\n\t return g.left.isleaf( ) ? null : g.left ;\n}\n" }, { - "__docId__": 56, + "__docId__": 57, "kind": "function", "static": true, "variation": null, - "name": "delete_case1", - "memberof": "src/removal/delete_case1.js", - "longname": "src/removal/delete_case1.js~delete_case1", + "name": "uncle", + "memberof": "src/family/uncle.js", + "longname": "src/family/uncle.js~uncle", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case1.js", - "importStyle": "{delete_case1}", - "description": null, - "lineNumber": 3, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/family/uncle.js", + "importStyle": "{uncle}", + "description": "Computes the uncle of the input node when the grandparent is guaranteed to\nexist.", + "lineNumber": 10, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node}" + } + ], "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "node", + "description": "The input node." } ], + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "" + }, "generator": false }, { - "__docId__": 57, + "__docId__": 58, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case2.js", + "name": "src/index.js", "memberof": null, - "longname": "src/removal/delete_case2.js", + "longname": "src/index.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;\n\nimport { delete_case3 } from './delete_case3' ;\n\nexport function delete_case2(n)\n{\n const s = sibling(n);\n\n if (s.color === RED) {\n n.parent.color = RED;\n s.color = BLACK;\n if (n === n.parent.left)\n rotate_left(n.parent);\n else\n rotate_right(n.parent);\n }\n delete_case3(n);\n}\n" + "content": "export * from './adt' ;\nexport * from './color' ;\nexport * from './debug' ;\nexport * from './deletion' ;\nexport * from './family' ;\nexport * from './insertion' ;\nexport * from './rotate' ;\nexport * from './search' ;\nexport * from './traversal' ;\n" }, { - "__docId__": 58, - "kind": "function", + "__docId__": 59, + "kind": "file", "static": true, "variation": null, - "name": "delete_case2", - "memberof": "src/removal/delete_case2.js", - "longname": "src/removal/delete_case2.js~delete_case2", + "name": "src/insertion/index.js", + "memberof": null, + "longname": "src/insertion/index.js", "access": null, - "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case2.js", - "importStyle": "{delete_case2}", "description": null, - "lineNumber": 5, - "undocument": true, - "params": [ - { - "name": "n", - "types": [ - "*" - ] - } - ], - "generator": false + "lineNumber": 1, + "content": "export * from './insert' ;\nexport * from './insert_case1' ;\nexport * from './insert_case2' ;\nexport * from './insert_case3' ;\nexport * from './insert_case4' ;\nexport * from './insert_case5' ;\n" }, { - "__docId__": 59, + "__docId__": 60, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case3.js", + "name": "src/insertion/insert.js", "memberof": null, - "longname": "src/removal/delete_case3.js", + "longname": "src/insertion/insert.js", "access": null, "description": null, - "lineNumber": 1, - "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case1 } from './delete_case1' ;\nimport { delete_case4 } from './delete_case4' ;\n\nexport function delete_case3(n)\n{\n const s = sibling(n);\n //console.log(n.color, n.parent.color, s.color , s.isleaf());\n\n if ((n.parent.color === BLACK) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n delete_case1(n.parent);\n }\n\n else\n delete_case4(n);\n}\n" + "lineNumber": 18, + "content": "\n/**\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n */\nexport function insert ( compare, A, B ) {\n\n\twhile ( true ) {\n\n\t\tif ( compare( B.key, A.key ) < 0 ) {\n\n\t\t\tconst node = A.left;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t\telse {\n\n\t\t\tconst node = A.right;\n\n\t\t\tif ( node.isleaf() ) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\n\t\t}\n\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n\n}\n" }, { - "__docId__": 60, + "__docId__": 61, "kind": "function", "static": true, "variation": null, - "name": "delete_case3", - "memberof": "src/removal/delete_case3.js", - "longname": "src/removal/delete_case3.js~delete_case3", + "name": "insert", + "memberof": "src/insertion/insert.js", + "longname": "src/insertion/insert.js~insert", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case3.js", - "importStyle": "{delete_case3}", - "description": null, - "lineNumber": 6, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert.js", + "importStyle": "{insert}", + "description": "Walks the tree rooted at A down the only path that satisfies\nthe following property: if at a node C we make a left (resp.\nright), then B < C (resp. B >= C). Once we hit the\nend of the path, we can add node B at this position. By the\nproperty of the path, the tree rooted at A is still a binary\nsearch tree.\nFor our red-black tree, all that is left to do is fix the red-black tree\nproperties in case they have been violated by this insertion. This is fixed\nby {@link insert_case1}.", + "lineNumber": 18, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node} B - The node that has been inserted." + } + ], "params": [ { - "name": "n", + "nullable": null, "types": [ "*" - ] + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function to use." + }, + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "A", + "description": "The root of the tree." + }, + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "B", + "description": "The node to insert." } ], + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "B - The node that has been inserted." + }, "generator": false }, { - "__docId__": 61, + "__docId__": 62, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case4.js", + "name": "src/insertion/insert_case1.js", "memberof": null, - "longname": "src/removal/delete_case4.js", + "longname": "src/insertion/insert_case1.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK , RED , sibling } from '..' ;\n\nimport { delete_case5 } from './delete_case5' ;\n\nexport function delete_case4(n)\n{\n const s = sibling(n);\n //console.log( s ) ;\n\n if ((n.parent.color === RED) &&\n (s.color === BLACK) &&\n (s.left.color === BLACK) &&\n (s.right.color === BLACK)) {\n s.color = RED;\n n.parent.color = BLACK;\n } else\n delete_case5(n);\n}\n" + "content": "import { BLACK } from '..' ;\nimport { insert_case2 } from './insert_case2' ;\n\n/**\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case1 ( n ) {\n\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif ( n.parent === null ) n.color = BLACK ;\n\n\telse insert_case2( n ) ;\n\n}\n" }, { - "__docId__": 62, + "__docId__": 63, "kind": "function", "static": true, "variation": null, - "name": "delete_case4", - "memberof": "src/removal/delete_case4.js", - "longname": "src/removal/delete_case4.js~delete_case4", + "name": "insert_case1", + "memberof": "src/insertion/insert_case1.js", + "longname": "src/insertion/insert_case1.js~insert_case1", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case4.js", - "importStyle": "{delete_case4}", - "description": null, - "lineNumber": 5, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case1.js", + "importStyle": "{insert_case1}", + "description": "Preconditions:\n - n is red.", + "lineNumber": 10, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], "generator": false }, { - "__docId__": 63, + "__docId__": 64, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case5.js", + "name": "src/insertion/insert_case2.js", "memberof": null, - "longname": "src/removal/delete_case5.js", + "longname": "src/insertion/insert_case2.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nimport { delete_case6 } from './delete_case6' ;\n\nexport function delete_case5(n)\n{\n const s = sibling(n);\n\n if (s.color === BLACK) { /* this if statement is trivial,\ndue to case 2 (even though case 2 changed the sibling to a sibling's child,\nthe sibling's child can't be red, since no red parent can have a red child). */\n/* the following statements just force the red to be on the left of the left of the parent,\n or right of the right, so case six will rotate correctly. */\n if ((n === n.parent.left) &&\n (s.right.color === BLACK) &&\n (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.left.color = BLACK;\n rotate_right(s);\n } else if ((n === n.parent.right) &&\n (s.left.color === BLACK) &&\n (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */\n s.color = RED;\n s.right.color = BLACK;\n rotate_left(s);\n }\n }\n delete_case6(n);\n}\n" + "content": "import { BLACK } from '..' ;\nimport { insert_case3 } from './insert_case3' ;\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case2 ( n ) {\n\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\tif ( n.parent.color === BLACK ) return ;\n\n\telse insert_case3( n ) ;\n\n}\n" }, { - "__docId__": 64, + "__docId__": 65, "kind": "function", "static": true, "variation": null, - "name": "delete_case5", - "memberof": "src/removal/delete_case5.js", - "longname": "src/removal/delete_case5.js~delete_case5", + "name": "insert_case2", + "memberof": "src/insertion/insert_case2.js", + "longname": "src/insertion/insert_case2.js~insert_case2", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case5.js", - "importStyle": "{delete_case5}", - "description": null, - "lineNumber": 5, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case2.js", + "importStyle": "{insert_case2}", + "description": "Preconditions:\n - n is red.\n - n is not the root of the tree.", + "lineNumber": 11, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], "generator": false }, { - "__docId__": 65, + "__docId__": 66, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_case6.js", + "name": "src/insertion/insert_case3.js", "memberof": null, - "longname": "src/removal/delete_case6.js", + "longname": "src/insertion/insert_case3.js", "access": null, "description": null, "lineNumber": 1, - "content": "import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;\n\nexport function delete_case6(n)\n{\n const s = sibling(n);\n\n s.color = n.parent.color;\n n.parent.color = BLACK;\n\n if (n === n.parent.left) {\n s.right.color = BLACK;\n rotate_left(n.parent);\n } else {\n s.left.color = BLACK;\n rotate_right(n.parent);\n }\n}\n" + "content": "import { BLACK , RED , uncle , grandparent } from '..' ;\nimport { insert_case1 } from './insert_case1' ;\nimport { insert_case4 } from './insert_case4' ;\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case3 ( n ) {\n\n\tconst u = uncle( n ) ;\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\n\tif ( ( u !== null ) && ( u.color === RED ) ) {\n\t\tn.parent.color = BLACK ;\n\t\tu.color = BLACK ;\n\t\tconst g = grandparent( n ) ;\n\t\tg.color = RED ;\n\t\tinsert_case1( g ) ;\n\t}\n\n\telse insert_case4( n ) ;\n\n}\n" }, { - "__docId__": 66, + "__docId__": 67, "kind": "function", "static": true, "variation": null, - "name": "delete_case6", - "memberof": "src/removal/delete_case6.js", - "longname": "src/removal/delete_case6.js~delete_case6", + "name": "insert_case3", + "memberof": "src/insertion/insert_case3.js", + "longname": "src/insertion/insert_case3.js~insert_case3", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_case6.js", - "importStyle": "{delete_case6}", - "description": null, - "lineNumber": 3, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case3.js", + "importStyle": "{insert_case3}", + "description": "Preconditions:\n - n is red.\n - n is not the root of the tree.\n - n's parent is red.", + "lineNumber": 13, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], "generator": false }, { - "__docId__": 67, + "__docId__": 68, "kind": "file", "static": true, "variation": null, - "name": "src/removal/delete_one_child.js", + "name": "src/insertion/insert_case4.js", "memberof": null, - "longname": "src/removal/delete_one_child.js", + "longname": "src/insertion/insert_case4.js", "access": null, "description": null, - "lineNumber": 1, - "content": "import { BLACK , RED } from '..' ;\n\nimport { replace_node } from './replace_node' ;\nimport { delete_case1 } from './delete_case1' ;\n\nexport function delete_one_child ( n ) {\n\n // Precondition: n has at most one non-leaf child.\n // assert( n.right.isleaf() || n.left.isleaf());\n\n // const child = n.right.isleaf() ? n.left : n.right;\n // n.right is always a LEAF because either n is a subtree predecessor or it\n // is the only child of its parent by the red-black tree properties\n const child = n.left ;\n\n replace_node(n, child);\n\n if (n.color === BLACK) {\n if (child.color === RED) child.color = BLACK;\n else delete_case1(child);\n }\n\n //else {\n // If n is RED then its child can only be BLACK. Replacing n with its\n // child suffices.\n //}\n\n}\n" + "lineNumber": 2, + "content": "\nimport { rotate_left , rotate_right , grandparent } from '..' ;\nimport { insert_case5 } from './insert_case5' ;\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case4 ( n ) {\n\n\tconst g = grandparent( n ) ;\n\n\t/**\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\tif ( ( n === n.parent.right ) && ( n.parent === g.left ) ) {\n\n\t\trotate_left( n.parent ) ;\n\n\t\t/**\n\t\t * rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\n\t}\n\n\t/**\n\t * If the path from g to n makes a right-left, change it to a right-right\n\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * B R B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - >R = - - = >R\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\telse if ( ( n === n.parent.left ) && ( n.parent === g.right ) ) {\n\n\t\trotate_right( n.parent ) ;\n\n\t\t/**\n\t\t * rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t}\n\n\tinsert_case5( n ) ;\n\n}\n" }, { - "__docId__": 68, + "__docId__": 69, "kind": "function", "static": true, "variation": null, - "name": "delete_one_child", - "memberof": "src/removal/delete_one_child.js", - "longname": "src/removal/delete_one_child.js~delete_one_child", + "name": "insert_case4", + "memberof": "src/insertion/insert_case4.js", + "longname": "src/insertion/insert_case4.js~insert_case4", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/delete_one_child.js", - "importStyle": "{delete_one_child}", - "description": null, - "lineNumber": 6, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case4.js", + "importStyle": "{insert_case4}", + "description": "Preconditions:\n - n is red.\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n\nHere we fix the input subtree to pass the preconditions of {@link insert_case5}.", + "lineNumber": 16, "params": [ { - "name": "n", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], "generator": false }, - { - "__docId__": 69, - "kind": "file", - "static": true, - "variation": null, - "name": "src/removal/index.js", - "memberof": null, - "longname": "src/removal/index.js", - "access": null, - "description": null, - "lineNumber": 1, - "content": "export * from './delete_case1' ;\nexport * from './delete_case2' ;\nexport * from './delete_case3' ;\nexport * from './delete_case4' ;\nexport * from './delete_case5' ;\nexport * from './delete_case6' ;\nexport * from './delete_one_child' ;\nexport * from './replace_node' ;\n" - }, { "__docId__": 70, "kind": "file", "static": true, "variation": null, - "name": "src/removal/replace_node.js", + "name": "src/insertion/insert_case5.js", "memberof": null, - "longname": "src/removal/replace_node.js", + "longname": "src/insertion/insert_case5.js", "access": null, "description": null, "lineNumber": 1, - "content": "export function replace_node ( A , B ) {\n\n\t// assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif ( A === A.parent.left ) A.parent.left = B ;\n\n\telse A.parent.right = B ;\n\n\tB.parent = A.parent ;\n\n}\n" + "content": "import { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case5 ( n ) {\n\n\tconst g = grandparent( n ) ;\n\n\t// repaint n's parent black, n's grandparent red\n\tn.parent.color = BLACK ;\n\tg.color = RED ;\n\n\t/**\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t */\n\tif ( n === n.parent.left ) rotate_right( g ) ;\n\n\t/**\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t */\n\telse rotate_left( g ) ;\n\n}\n" }, { "__docId__": 71, "kind": "function", "static": true, "variation": null, - "name": "replace_node", - "memberof": "src/removal/replace_node.js", - "longname": "src/removal/replace_node.js~replace_node", + "name": "insert_case5", + "memberof": "src/insertion/insert_case5.js", + "longname": "src/insertion/insert_case5.js~insert_case5", "access": null, "export": true, - "importPath": "aureooms-es-red-black-tree/src/removal/replace_node.js", - "importStyle": "{replace_node}", - "description": null, - "lineNumber": 1, - "undocument": true, + "importPath": "aureooms-es-red-black-tree/src/insertion/insert_case5.js", + "importStyle": "{insert_case5}", + "description": "Preconditions:\n - n is red.\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n - the path from n to its grandparent makes a left-left or right-right.", + "lineNumber": 13, "params": [ { - "name": "A", - "types": [ - "*" - ] - }, - { - "name": "B", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], "generator": false @@ -1452,7 +1754,7 @@ "access": null, "description": null, "lineNumber": 16, - "content": "/**\n * Rotate tree left.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A root of the tree\n *\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" + "content": "/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nexport function rotate_left ( A ) {\n\n\tconst B = A.right ;\n\tconst a = A.left ;\n\tconst b = B.left ;\n\tconst c = B.right ;\n\n\t[A.key , B.key] = [B.key , A.key] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tA.left = B ;\n\tA.right = c ;\n\n\tB.left = a ;\n\tB.right = b ;\n\n\ta.parent = B ;\n\tb.parent = B ;\n\tc.parent = A ;\n}\n" }, { "__docId__": 74, @@ -1466,7 +1768,7 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/rotate/rotate_left.js", "importStyle": "{rotate_left}", - "description": "Rotate tree left.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", + "description": "Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n/!\\ This swaps the references to A and B.\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", "lineNumber": 16, "params": [ { @@ -1477,7 +1779,7 @@ "spread": false, "optional": false, "name": "A", - "description": "root of the tree" + "description": "The root of the tree." } ], "generator": false @@ -1493,7 +1795,7 @@ "access": null, "description": null, "lineNumber": 16, - "content": "/**\n * Rotate tree right.\n * (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B root of the tree\n *\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.value , B.value] = [B.value , A.value] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" + "content": "/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nexport function rotate_right ( B ) {\n\n\tconst A = B.left;\n\tconst a = A.left ;\n\tconst b = A.right ;\n\tconst c = B.right ;\n\n\t[A.key , B.key] = [B.key , A.key] ;\n\t[A.color , B.color] = [B.color , A.color] ;\n\n\tB.left = a ;\n\tB.right = A ;\n\n\tA.left = b ;\n\tA.right = c ;\n\n\ta.parent = B ;\n\tb.parent = A ;\n\tc.parent = A ;\n\n}\n" }, { "__docId__": 76, @@ -1507,7 +1809,7 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/rotate/rotate_right.js", "importStyle": "{rotate_right}", - "description": "Rotate tree right.\n(see https://en.wikipedia.org/wiki/Tree_rotation)\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", + "description": "Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n/!\\ This swaps the references to A and B.\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", "lineNumber": 16, "params": [ { @@ -1518,7 +1820,7 @@ "spread": false, "optional": false, "name": "B", - "description": "root of the tree" + "description": "The root of the tree." } ], "generator": false @@ -1546,8 +1848,8 @@ "longname": "src/search/search.js", "access": null, "description": null, - "lineNumber": 1, - "content": "export function search ( compare, node, value ) {\n\n\t// scan for first node whose\n\t// value equals parameter value\n\n\twhile ( true ) {\n\n\t\tconst d = compare( value, node.value );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn node;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\tnode = node.left;\n\t\t}\n\n\t\telse {\n\t\t\tnode = node.right;\n\t\t}\n\n\t\tif ( node.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" + "lineNumber": 9, + "content": "/**\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n */\nexport function search ( compare, root, key ) {\n\n\twhile ( true ) {\n\n\t\tconst d = compare( key, root.key );\n\n\t\tif ( d === 0 ) {\n\t\t\treturn root;\n\t\t}\n\n\t\telse if ( d < 0 ) {\n\t\t\troot = root.left;\n\t\t}\n\n\t\telse {\n\t\t\troot = root.right;\n\t\t}\n\n\t\tif ( root.isleaf() ) {\n\t\t\treturn null;\n\t\t}\n\n\t}\n\n}\n" }, { "__docId__": 79, @@ -1561,33 +1863,53 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/search/search.js", "importStyle": "{search}", - "description": null, - "lineNumber": 1, - "undocument": true, + "description": "Search for the first node whose key equals key.", + "lineNumber": 9, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node}" + } + ], "params": [ { - "name": "compare", + "nullable": null, "types": [ - "*" - ] + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function." }, { - "name": "node", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "root", + "description": "The root of the tree to scan." }, { - "name": "value", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "key", + "description": "The key to search for." } ], "return": { + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "description": "" }, "generator": false }, @@ -1614,8 +1936,8 @@ "longname": "src/traversal/inordertraversal.js", "access": null, "description": null, - "lineNumber": 1, - "content": "export function* inordertraversal ( node ) {\n\n\tif ( !node.left.isleaf() ) {\n\t\tyield *inordertraversal( node.left );\n\t}\n\n\tyield node.value ;\n\n\tif ( !node.right.isleaf() ) {\n\t\tyield* inordertraversal( node.right );\n\t}\n\n}\n" + "lineNumber": 7, + "content": "/**\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n */\nexport function* inordertraversal ( node ) {\n\n\tif ( !node.left.isleaf() ) {\n\t\t// Yield the nodes on the left recursively. Those nodes are all smaller\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tyield *inordertraversal( node.left );\n\t}\n\n\t// Yield the current node.\n\tyield node.key ;\n\n\tif ( !node.right.isleaf() ) {\n\t\t// Yield the nodes on the right recursively. Those nodes are all larger\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tyield* inordertraversal( node.right );\n\t}\n\n}\n" }, { "__docId__": 82, @@ -1629,17 +1951,34 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/traversal/inordertraversal.js", "importStyle": "{inordertraversal}", - "description": null, - "lineNumber": 1, - "undocument": true, + "description": "Traverses the tree rooted at node in order.", + "lineNumber": 7, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Iterator}" + } + ], "params": [ { - "name": "node", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "node", + "description": "The root of the tree." } ], + "return": { + "nullable": null, + "types": [ + "Iterator" + ], + "spread": false, + "description": "" + }, "generator": true }, { @@ -1652,8 +1991,8 @@ "longname": "src/traversal/rangetraversal.js", "access": null, "description": null, - "lineNumber": 1, - "content": "export function* rangetraversal ( compare , node , left , right ) {\n\n\tif ( compare( node.value , left ) < 0 ) {\n\t\tif ( !node.right.isleaf() ) yield *rangetraversal( compare , node.right , left , right );\n\t}\n\telse if ( compare( node.value , right ) >= 0 ) {\n\t\tif ( !node.left.isleaf() ) yield *rangetraversal( compare , node.left , left , right );\n\t}\n\telse {\n\t\tif ( !node.left.isleaf() ) yield *rangetraversal( compare , node.left , left , right );\n\t\tyield node.value ;\n\t\tif ( !node.right.isleaf() ) yield *rangetraversal( compare , node.right , left , right );\n\t}\n\n}\n" + "lineNumber": 11, + "content": "/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n */\nexport function* rangetraversal ( compare , root , left , right ) {\n\n\tif ( compare( root.key , left ) < 0 ) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif ( !root.right.isleaf() ) yield *rangetraversal( compare , root.right , left , right );\n\t}\n\telse if ( compare( root.key , right ) >= 0 ) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif ( !root.left.isleaf() ) yield *rangetraversal( compare , root.left , left , right );\n\t}\n\telse {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif ( !root.left.isleaf() ) yield *rangetraversal( compare , root.left , left , right );\n\t\tyield root.key ;\n\t\tif ( !root.right.isleaf() ) yield *rangetraversal( compare , root.right , left , right );\n\t}\n\n}\n" }, { "__docId__": 84, @@ -1667,35 +2006,64 @@ "export": true, "importPath": "aureooms-es-red-black-tree/src/traversal/rangetraversal.js", "importStyle": "{rangetraversal}", - "description": null, - "lineNumber": 1, - "undocument": true, + "description": "Yields all the keys in the tree rooted at root that lie in the\ninterval [left, right[, in order.", + "lineNumber": 11, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Iterator}" + } + ], "params": [ { - "name": "compare", + "nullable": null, "types": [ - "*" - ] + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function." }, { - "name": "node", + "nullable": null, "types": [ - "*" - ] + "Node" + ], + "spread": false, + "optional": false, + "name": "root", + "description": "The root of the tree." }, { - "name": "left", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "left", + "description": "The lower bound of the interval." }, { - "name": "right", + "nullable": null, "types": [ - "*" - ] + "Key" + ], + "spread": false, + "optional": false, + "name": "right", + "description": "The upper bound of the interval." } ], + "return": { + "nullable": null, + "types": [ + "Iterator" + ], + "spread": false, + "description": "" + }, "generator": true }, { diff --git a/file/src/adt/Leaf.js.html b/file/src/adt/Leaf.js.html index 10b0bae..57a048d 100644 --- a/file/src/adt/Leaf.js.html +++ b/file/src/adt/Leaf.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -70,11 +70,24 @@

    src/adt/Leaf.js

    import { BLACK } from '..' ;
     
    +/**
    + * A black leaf node.
    + *
    + * @constructor
    + * @param {Node} parent - The parent node in the tree.
    + * @returns {Leaf}
    + */
     export function Leaf ( parent ) {
     	this.color = BLACK ;
     	this.parent = parent ;
     }
     
    +/**
    + * Returns <code>true</code> if the <code>Leaf</code> object is a leaf. This
    + * always returns <code>true</code>.
    + *
    + * @returns {Boolean}
    + */
     Leaf.prototype.isleaf = function ( ) { return true ; } ;
     
    diff --git a/file/src/adt/Node.js.html b/file/src/adt/Node.js.html index 2d0eb96..faf5c2a 100644 --- a/file/src/adt/Node.js.html +++ b/file/src/adt/Node.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -70,14 +70,28 @@

    src/adt/Node.js

    import { Leaf } from './Leaf' ;
     
    -export function Node ( color , value ) {
    +/**
    + * An internal node. This node can be red or black.
    + *
    + * @constructor
    + * @param {Number} color - The color of the node.
    + * @param {Key} key - The key of the node.
    + * @returns {Node}
    + */
    +export function Node ( color , key ) {
     	this.color = color ;
     	this.left = new Leaf( this ) ;
     	this.right = new Leaf( this ) ;
     	this.parent = null ;
    -	this.value = value ;
    +	this.key = key ;
     }
     
    +/**
    + * Returns <code>true</code> if the <code>Node</code> object is a leaf. This
    + * always returns <code>false</code>.
    + *
    + * @returns {Boolean}
    + */
     Node.prototype.isleaf = function ( ) { return false ; } ;
     
    diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/adt/RedBlackTree.js.html index 7f3bd61..6166a40 100644 --- a/file/src/adt/RedBlackTree.js.html +++ b/file/src/adt/RedBlackTree.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -77,8 +77,18 @@ import { search } from '..' ; import { inordertraversal , rangetraversal } from '..' ; +/** + * A RedBlackTree with key-only nodes. + * + */ export class RedBlackTree { + /** + * Constructs a new empty red-black tree. + * + * @param {Function} compare - The comparison function for node keys. + * @returns {RedBlackTree} + */ constructor ( compare ) { this.compare = compare ; @@ -86,37 +96,70 @@ } - add ( value ) { + /** + * Adds a key to the tree. + * + * @param {Key} key - The key to add. + */ + add ( key ) { if ( this.root === null ) { - this.root = new Node( BLACK , value ) ; + this.root = new Node( BLACK , key ) ; } else { - const node = new Node( RED , value ) ; + const node = new Node( RED , key ) ; insert( this.compare , this.root , node ) ; insert_case2( node ) ; } } - _search ( value ) { + /** + * Search for the input key in the tree. + * Returns the first node whose key equals the input key. + * If no such node exists, returns <code>null</code>. + * + * @param {Key} key - The input key. + * @returns {Node} + */ + _search ( key ) { if ( this.root === null ) return null ; - return search( this.compare , this.root , value ) ; + return search( this.compare , this.root , key ) ; } - get ( value ) { - const node = this._search( value ) ; - return node === null ? null : node.value ; + /** + * Search for the input key in the tree. Returns the first node key found + * in this way (with {@link RedBlackTree#_search}. If no such key exists + * in the tree, returns <code>null</code>. + * + * @param {Key} key - The input key. + * @returns {Key} + */ + get ( key ) { + const node = this._search( key ) ; + return node === null ? null : node.key ; } - has ( value ) { - return this._search( value ) !== null ; + /** + * Returns <code>true</code> if and only if the tree contains the input + * key. + * + * @param {Key} key - The input key. + * @returns {Boolean} + */ + has ( key ) { + return this._search( key ) !== null ; } + /** + * Deletes the input node from the tree. + * + * @param {Node} node - The input node to delete. + */ _delete ( node ) { if ( !node.left.isleaf() ) { - // replace node's value with predecessor's value + // replace node's key with predecessor's key const pred = predecessor( node ) ; - node.value = pred.value ; + node.key = pred.key ; // delete predecessor node // note: this node can only have one non-leaf child // because the tree is a red-black tree @@ -124,11 +167,11 @@ } else if ( !node.right.isleaf() ) { - // replace node's value with successor's value + // replace node's key with successor's key // If there is no left child, then there can only be one right // child. const succ = node.right ; - node.value = succ.value ; + node.key = succ.key ; // delete successor node // note: this node can only have one non-leaf child // because the tree is a red-black tree @@ -145,9 +188,18 @@ } - remove ( value ) { - - const node = this._search( value ) ; + /** + * Search for the first node of the tree whose key equals the input key + * (with {@link RedBlackTree#_search}), then delete that node + * (with {@link RedBlackTree#_delete}). If such a node is found and deleted + * then return <code>true</code>. Return <code>false</code> otherwise. + * + * @param {Key} key - The input key. + * @returns {Boolean} - Whether the key existed in the tree before removal. + */ + remove ( key ) { + + const node = this._search( key ) ; if ( node === null ) return false ; this._delete( node ) ; @@ -155,24 +207,46 @@ } + /** + * Returns an in order iterator over the keys of the tree that lie in the + * interval [left, right[. + * @param {Key} left - The left bound of the interval. + * @param {Key} right - The right bound of the interval. + * @returns {Iterator} + */ *range ( left , right ) { if ( this.root !== null ) yield* rangetraversal( this.compare , this.root , left , right ) ; } - *values ( ) { + /** + * Returns an in order iterator over the keys of the tree. + * + * @returns {Iterator} + */ + *items ( ) { if ( this.root !== null ) yield* inordertraversal( this.root ) ; } + /** + * Same as {@link RedBlackTree#items}. + */ [Symbol.iterator] ( ) { - return this.values() ; + return this.items() ; } + /** + * Constructs a red-black tree from an input iterable. + * + * @param {Function} compare - The comparison function to use. + * @param {Iterbale} iterable - The input iterable. + * @returns {RedBlackTree} + */ static from ( compare , iterable ) { const tree = new RedBlackTree( compare ) ; diff --git a/file/src/adt/index.js.html b/file/src/adt/index.js.html index d2e29de..5392fa2 100644 --- a/file/src/adt/index.js.html +++ b/file/src/adt/index.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/file/src/color/BLACK.js.html b/file/src/color/BLACK.js.html index 1e3d6af..1dbaee8 100644 --- a/file/src/color/BLACK.js.html +++ b/file/src/color/BLACK.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,7 +68,10 @@

    src/color/BLACK.js

    -
    export const BLACK = 0 ;
    +
    /**
    + * Constant for black.
    + */
    +export const BLACK = 0 ;
     
    diff --git a/file/src/color/RED.js.html b/file/src/color/RED.js.html index 0a6e68a..77196e6 100644 --- a/file/src/color/RED.js.html +++ b/file/src/color/RED.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,7 +68,10 @@

    src/color/RED.js

    -
    export const RED = 1 ;
    +
    /**
    + * Constant for red.
    + */
    +export const RED = 1 ;
     
    diff --git a/file/src/color/index.js.html b/file/src/color/index.js.html index 3aef541..b22ff13 100644 --- a/file/src/color/index.js.html +++ b/file/src/color/index.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/file/src/debug/debug.js.html b/file/src/debug/debug.js.html index 1d0fdd3..52623ae 100644 --- a/file/src/debug/debug.js.html +++ b/file/src/debug/debug.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -72,13 +72,20 @@ import { BLACK } from '..' ; -export function debug ( node ) { +/** + * Recursively constructs a prettyprint string for the red-black tree rooted at + * <code>root</code>. + * + * @param {Node} root - The root of the tree. + * @returns {String} + */ +export function debug ( root ) { - if ( node.isleaf( ) ) return chalk.bgBlack('L') ; + if ( root.isleaf( ) ) return chalk.bgBlack('L') ; - const repr = node.color === BLACK ? chalk.bgBlack(node.value) : chalk.bgRed( node.value ) ; + const repr = root.color === BLACK ? chalk.bgBlack(root.key) : chalk.bgRed( root.key ) ; - return `(${debug(node.left)}, ${repr}, ${debug(node.right)})` ; + return `(${debug(root.left)}, ${repr}, ${debug(root.right)})` ; }
    diff --git a/file/src/debug/index.js.html b/file/src/debug/index.js.html index 11717ee..a485e80 100644 --- a/file/src/debug/index.js.html +++ b/file/src/debug/index.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/file/src/removal/delete_case1.js.html b/file/src/deletion/delete_case1.js.html similarity index 92% rename from file/src/removal/delete_case1.js.html rename to file/src/deletion/delete_case1.js.html index dda98eb..26a20d1 100644 --- a/file/src/removal/delete_case1.js.html +++ b/file/src/deletion/delete_case1.js.html @@ -3,7 +3,7 @@ - src/removal/delete_case1.js | aureooms/es-red-black-tree API Document + src/deletion/delete_case1.js | aureooms/es-red-black-tree API Document @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,11 +67,21 @@
    -

    src/removal/delete_case1.js

    +

    src/deletion/delete_case1.js

    import { delete_case2 } from './delete_case2' ;
     
    +/**
    + * Preconditions:
    + *   - n is black
    + *   - all root-leaf paths going through n have a black height of b - 1
    + *   - all other root-leaf paths have a black height of b
    + *
    + * @param {Node} n - The input node.
    + */
     export function delete_case1 ( n ) {
     
    +    // If n is the root, there is nothing to do: all paths go through n, and n
    +    // is black.
         if ( n.parent !== null ) delete_case2( n ) ;
     
     }
    diff --git a/file/src/removal/delete_case2.js.html b/file/src/deletion/delete_case2.js.html
    similarity index 85%
    rename from file/src/removal/delete_case2.js.html
    rename to file/src/deletion/delete_case2.js.html
    index 3ede65d..0c0016f 100644
    --- a/file/src/removal/delete_case2.js.html
    +++ b/file/src/deletion/delete_case2.js.html
    @@ -3,7 +3,7 @@
     
       
       
    -  src/removal/delete_case2.js | aureooms/es-red-black-tree API Document
    +  src/deletion/delete_case2.js | aureooms/es-red-black-tree API Document
       
       
       
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,24 +67,47 @@
    -

    src/removal/delete_case2.js

    +

    src/deletion/delete_case2.js

    import { BLACK , RED , sibling , rotate_left , rotate_right } from '..' ;
     
     import { delete_case3 } from './delete_case3' ;
    +import { delete_case4 } from './delete_case4' ;
    +
    +/**
    + * Preconditions:
    + *   - n is black
    + *   - all root-leaf paths going through n have a black height of b - 1
    + *   - all other root-leaf paths have a black height of b
    + *   - n is not the root
    + *
    + * @param {Node} n - The input node.
    + */
    +export function delete_case2 ( n ) {
    +
    +    const s = sibling( n ) ;
    +
    +	/**
    +	 * If n's sibling is red, prepare for and go to case 4.
    +	 *
    +	 *           B                       B
    +	 *         /   \                  /     \
    +	 *      >B       R               R       B
    +	 *      / \     / \     -->    /   \    / \
    +	 *     -   -  B     B        >B     B  =   =
    +	 *           / \   / \       / \   / \
    +	 *          =   = =   =     -   - =   =
    +	 */
    +    if ( s.color === RED ) {
    +        n.parent.color = RED ;
    +        s.color = BLACK ;
    +        if ( n === n.parent.left ) rotate_left( n.parent ) ;
    +        else rotate_right( n.parent ) ;
    +        delete_case4( n ) ;
    +    }
     
    -export function delete_case2(n)
    -{
    - const s = sibling(n);
    +    // Otherwise, go to case 3.
    +    else delete_case3( n ) ;
     
    - if (s.color === RED) {
    -  n.parent.color = RED;
    -  s.color = BLACK;
    -  if (n === n.parent.left)
    -   rotate_left(n.parent);
    -  else
    -   rotate_right(n.parent);
    - }
    - delete_case3(n);
     }
     
    diff --git a/file/src/removal/delete_case3.js.html b/file/src/deletion/delete_case3.js.html similarity index 83% rename from file/src/removal/delete_case3.js.html rename to file/src/deletion/delete_case3.js.html index 9274682..cbca730 100644 --- a/file/src/removal/delete_case3.js.html +++ b/file/src/deletion/delete_case3.js.html @@ -3,7 +3,7 @@ - src/removal/delete_case3.js | aureooms/es-red-black-tree API Document + src/deletion/delete_case3.js | aureooms/es-red-black-tree API Document @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,27 +67,51 @@
    -

    src/removal/delete_case3.js

    +

    src/deletion/delete_case3.js

    import { BLACK , RED , sibling } from '..' ;
     
     import { delete_case1 } from './delete_case1' ;
     import { delete_case4 } from './delete_case4' ;
     
    -export function delete_case3(n)
    -{
    - const s = sibling(n);
    - //console.log(n.color, n.parent.color, s.color , s.isleaf());
    +/**
    + * Preconditions:
    + *   - n is black
    + *   - all root-leaf paths going through n have a black height of b - 1
    + *   - all other root-leaf paths have a black height of b
    + *   - n is not the root
    + *   - n's sibling is black
    + *
    + * @param {Node} n - The input node.
    + */
    +export function delete_case3 ( n ) {
    +
    +    const s = sibling( n ) ;
    +
    +	/**
    +	 * If n's parent is black and n's sibling's children are black, then
    +     * repaint n's sibling red. Now all root-leaft paths going through n's
    +     * parent have a black height of b - 1. We recurse thus on n's parent.
    +	 *
    +	 *           B                      >B
    +	 *         /   \                  /     \
    +	 *      >B       B               B       R
    +	 *      / \     / \     -->    /   \    / \
    +	 *     -   -  B     B         -     - B     B
    +	 *           / \   / \               / \   / \
    +	 *          -   - -   -             -   - -   -
    +	 */
    +    if (
    +        ( n.parent.color === BLACK ) &&
    +        ( s.left.color === BLACK ) &&
    +        ( s.right.color === BLACK )
    +    ) {
    +        s.color = RED ;
    +        delete_case1( n.parent ) ;
    +    }
     
    - if ((n.parent.color === BLACK) &&
    -     (s.color === BLACK) &&
    -     (s.left.color === BLACK) &&
    -     (s.right.color === BLACK)) {
    -  s.color = RED;
    -  delete_case1(n.parent);
    - }
    +    // Otherwise, go to case 4.
    +    else delete_case4( n ) ;
     
    - else
    -  delete_case4(n);
     }
     
    diff --git a/file/src/removal/delete_case4.js.html b/file/src/deletion/delete_case4.js.html similarity index 81% rename from file/src/removal/delete_case4.js.html rename to file/src/deletion/delete_case4.js.html index 63f27bd..0dd6b33 100644 --- a/file/src/removal/delete_case4.js.html +++ b/file/src/deletion/delete_case4.js.html @@ -3,7 +3,7 @@ - src/removal/delete_case4.js | aureooms/es-red-black-tree API Document + src/deletion/delete_case4.js | aureooms/es-red-black-tree API Document @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,24 +67,53 @@
    -

    src/removal/delete_case4.js

    +

    src/deletion/delete_case4.js

    import { BLACK , RED , sibling } from '..' ;
     
     import { delete_case5 } from './delete_case5' ;
     
    -export function delete_case4(n)
    -{
    - const s = sibling(n);
    - //console.log( s ) ;
    +/**
    + * Preconditions:
    + *   - n is black
    + *   - all root-leaf paths going through n have a black height of b - 1
    + *   - all other root-leaf paths have a black height of b
    + *   - n is not the root
    + *   - n's sibling is black
    + *   - n's parent and n's sibling's children cannot all be black
    + *
    + * @param {Node} n - The input node.
    + */
    +export function delete_case4 ( n ) {
    +
    +    const s = sibling(n);
    +
    +	/**
    +	 * If n's parent is red and n's sibling's children are black, then swap n's
    +	 * parent and n's sibling color. All root-leaf paths going through n have
    +	 * now a black height of b. All other root-leaf paths have their black
    +	 * height unchanged. Red-black properties are respected. We are done.
    +	 *
    +	 *           R                       B
    +	 *         /   \                  /     \
    +	 *      >B       B              >B        R
    +	 *      / \     / \     -->     / \      / \
    +	 *     -   -  B     B          -   -   B     B
    +	 *           / \   / \                / \   / \
    +	 *          -   - -   -              -   - -   -
    +	 */
    +    if (
    +        // the parent color test is always true when coming from case 2
    +        ( n.parent.color === RED ) &&
    +        ( s.left.color === BLACK ) &&
    +        ( s.right.color === BLACK )
    +    ) {
    +        s.color = RED;
    +        n.parent.color = BLACK;
    +    }
    +
    +    // Otherwise, go to case 5.
    +    else delete_case5( n ) ;
     
    - if ((n.parent.color === RED) &&
    -     (s.color === BLACK) &&
    -     (s.left.color === BLACK) &&
    -     (s.right.color === BLACK)) {
    -  s.color = RED;
    -  n.parent.color = BLACK;
    - } else
    -  delete_case5(n);
     }
     
    diff --git a/file/src/removal/delete_case5.js.html b/file/src/deletion/delete_case5.js.html similarity index 78% rename from file/src/removal/delete_case5.js.html rename to file/src/deletion/delete_case5.js.html index 389d4ac..dd4320a 100644 --- a/file/src/removal/delete_case5.js.html +++ b/file/src/deletion/delete_case5.js.html @@ -3,7 +3,7 @@ - src/removal/delete_case5.js | aureooms/es-red-black-tree API Document + src/deletion/delete_case5.js | aureooms/es-red-black-tree API Document @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,35 +67,66 @@
    -

    src/removal/delete_case5.js

    +

    src/deletion/delete_case5.js

    import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;
     
     import { delete_case6 } from './delete_case6' ;
     
    -export function delete_case5(n)
    -{
    - const s = sibling(n);
    +/**
    + * Preconditions:
    + *   - n is black
    + *   - all root-leaf paths going through n have a black height of b - 1
    + *   - all other root-leaf paths have a black height of b
    + *   - n is not the root
    + *   - n's sibling is black
    + *   - at least one of n's sibling's children is red
    + *
    + * @param {Node} n - The input node.
    + */
    +export function delete_case5 ( n ) {
    +
    +    const s = sibling( n ) ;
    +
    +    // The following statements just force the red n's sibling child to be on
    +    // the left of the left of the parent, or right of the right, so case 6
    +    // will rotate correctly.
    +
    +	/**
    +	 *           ?                       ?
    +	 *         /   \                  /     \
    +	 *      >B       B              >B        B
    +	 *      / \     / \     -->     / \      / \
    +	 *     -   -  R     B          -   -   =     R
    +	 *           / \   / \                      / \
    +	 *          =   = -   -                    =   B
    +	 *                                            / \
    +	 *                                           -   -
    +	 */
    +    if ( ( n === n.parent.left ) && ( s.right.color === BLACK ) ) {
    +        s.color = RED ;
    +        s.left.color = BLACK ;
    +        rotate_right( s ) ;
    +    }
    +
    +	/**
    +	 *           ?                       ?
    +	 *         /   \                  /     \
    +	 *       B      >B               B       >B
    +	 *      / \     / \     -->     / \      / \
    +	 *    B     R  -   -          R     =   -   -
    +	 *   / \   / \               / \
    +	 *  -   - =   =             B   =
    +	 *                         / \
    +	 *                        -   -
    +	 */
    +    else if ( ( n === n.parent.right ) && ( s.left.color === BLACK ) ) {
    +        s.color = RED ;
    +        s.right.color = BLACK ;
    +        rotate_left( s ) ;
    +    }
    +
    +    delete_case6( n ) ;
     
    - if  (s.color === BLACK) { /* this if statement is trivial,
    -due to case 2 (even though case 2 changed the sibling to a sibling's child,
    -the sibling's child can't be red, since no red parent can have a red child). */
    -/* the following statements just force the red to be on the left of the left of the parent,
    -   or right of the right, so case six will rotate correctly. */
    -  if ((n === n.parent.left) &&
    -      (s.right.color === BLACK) &&
    -      (s.left.color === RED)) { /* this last test is trivial too due to cases 2-4. */
    -   s.color = RED;
    -   s.left.color = BLACK;
    -   rotate_right(s);
    -  } else if ((n === n.parent.right) &&
    -             (s.left.color === BLACK) &&
    -             (s.right.color === RED)) {/* this last test is trivial too due to cases 2-4. */
    -   s.color = RED;
    -   s.right.color = BLACK;
    -   rotate_left(s);
    -  }
    - }
    - delete_case6(n);
     }
     
    diff --git a/file/src/removal/delete_case6.js.html b/file/src/deletion/delete_case6.js.html similarity index 81% rename from file/src/removal/delete_case6.js.html rename to file/src/deletion/delete_case6.js.html index 902f5e6..9116a3a 100644 --- a/file/src/removal/delete_case6.js.html +++ b/file/src/deletion/delete_case6.js.html @@ -3,7 +3,7 @@ - src/removal/delete_case6.js | aureooms/es-red-black-tree API Document + src/deletion/delete_case6.js | aureooms/es-red-black-tree API Document @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,23 +67,57 @@
    -

    src/removal/delete_case6.js

    +

    src/deletion/delete_case6.js

    import { BLACK , RED , sibling , rotate_right , rotate_left } from '..' ;
     
    -export function delete_case6(n)
    -{
    - const s = sibling(n);
    +/**
    + * Preconditions:
    + *   - n is black
    + *   - all root-leaf paths going through n have a black height of b - 1
    + *   - all other root-leaf paths have a black height of b
    + *   - n is not the root
    + *   - n's sibling is black
    + *   - if n is a left child, the right child of n's sibling is red
    + *   - if n is a right child, the left child of n's sibling is red
    + *
    + * @param {Node} n - The input node.
    + */
    +export function delete_case6 ( n ) {
    +
    +    const s = sibling( n ) ;
    +
    +	/**
    +	 * Increment the black height of all root-leaf paths going through n by
    +	 * rotating at n's parent. This decrements the black height of all
    +	 * root-leaft paths going through n's sibling's right child.
    +     * We can repaint n's sibling's right child in black to fix this.
    +     * We are done.
    +	 *
    +	 *           ?                          ?
    +	 *        /     \                     /   \
    +	 *      >B        B                 B       B
    +	 *      / \      / \               / \     / \
    +	 *     -   -   =     R     -->   >B   =   =   B
    +	 *                  / \          / \         / \
    +	 *                 =   B        -   -       -   -
    +	 *                    / \
    +	 *                   -   -
    +	 */
    +
    +    s.color = n.parent.color ;
    +    n.parent.color = BLACK ;
    +
    +    if ( n === n.parent.left ) {
    +        s.right.color = BLACK ;
    +        rotate_left( n.parent ) ;
    +    }
     
    - s.color = n.parent.color;
    - n.parent.color = BLACK;
    +    // symmetric case
    +    else {
    +        s.left.color = BLACK ;
    +        rotate_right( n.parent ) ;
    +    }
     
    - if (n === n.parent.left) {
    -  s.right.color = BLACK;
    -  rotate_left(n.parent);
    - } else {
    -  s.left.color = BLACK;
    -  rotate_right(n.parent);
    - }
     }
     
    diff --git a/file/src/removal/delete_one_child.js.html b/file/src/deletion/delete_one_child.js.html similarity index 87% rename from file/src/removal/delete_one_child.js.html rename to file/src/deletion/delete_one_child.js.html index d0ee55c..40f0a32 100644 --- a/file/src/removal/delete_one_child.js.html +++ b/file/src/deletion/delete_one_child.js.html @@ -3,7 +3,7 @@ - src/removal/delete_one_child.js | aureooms/es-red-black-tree API Document + src/deletion/delete_one_child.js | aureooms/es-red-black-tree API Document @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,12 +67,21 @@
    -

    src/removal/delete_one_child.js

    +

    src/deletion/delete_one_child.js

    import { BLACK , RED } from '..' ;
     
     import { replace_node } from './replace_node' ;
     import { delete_case1 } from './delete_case1' ;
     
    +/**
    + * Delete a node <code>n</code> that has at most a single non-leaf child.
    + *
    + * Precondition:
    + *   - n has at most one non-leaf child.
    + *   - if n has a non-leaf child, then it is its left child.
    + *
    + * @param {Node} n - The node to delete.
    + */
     export function delete_one_child ( n ) {
     
         // Precondition: n has at most one non-leaf child.
    @@ -83,17 +92,27 @@
         // is the only child of its parent by the red-black tree properties
         const child = n.left ;
     
    -    replace_node(n, child);
    +    // replace n with its left child
    +    replace_node( n , child ) ;
    +
    +    // If n is black, deleting it reduces the black-height of every path going
    +    // through it by 1.
    +    if ( n.color === BLACK ) {
    +
    +        // We can easily fix this when its left child is an
    +        // internal red node: change the color of the left child to black and
    +        // replace n with it.
    +        if ( child.color === RED ) child.color = BLACK ;
    +
    +        // Otherwise, there are more things to fix.
    +        else delete_case1( child ) ;
     
    -    if (n.color === BLACK) {
    -        if (child.color === RED) child.color = BLACK;
    -        else delete_case1(child);
         }
     
    -    //else {
    -    //    If n is RED then its child can only be BLACK. Replacing n with its
    +    // else {
    +    //    If n is red then its child can only be black. Replacing n with its
         //    child suffices.
    -    //}
    +    // }
     
     }
     
    diff --git a/file/src/removal/index.js.html b/file/src/deletion/index.js.html similarity index 96% rename from file/src/removal/index.js.html rename to file/src/deletion/index.js.html index c5de7a7..226dff8 100644 --- a/file/src/removal/index.js.html +++ b/file/src/deletion/index.js.html @@ -3,7 +3,7 @@ - src/removal/index.js | aureooms/es-red-black-tree API Document + src/deletion/index.js | aureooms/es-red-black-tree API Document @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,7 +67,7 @@
    -

    src/removal/index.js

    +

    src/deletion/index.js

    export * from './delete_case1' ;
     export * from './delete_case2' ;
     export * from './delete_case3' ;
    diff --git a/file/src/removal/replace_node.js.html b/file/src/deletion/replace_node.js.html
    similarity index 93%
    rename from file/src/removal/replace_node.js.html
    rename to file/src/deletion/replace_node.js.html
    index ea59d62..bfbc99c 100644
    --- a/file/src/removal/replace_node.js.html
    +++ b/file/src/deletion/replace_node.js.html
    @@ -3,7 +3,7 @@
     
       
       
    -  src/removal/replace_node.js | aureooms/es-red-black-tree API Document
    +  src/deletion/replace_node.js | aureooms/es-red-black-tree API Document
       
       
       
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,8 +67,14 @@
    -

    src/removal/replace_node.js

    -
    export function replace_node ( A , B ) {
    +

    src/deletion/replace_node.js

    +
    /**
    + * Replaces node <code>A</code> by node <code>B</code>.
    + *
    + * @param {Node} A - The node to replace.
    + * @param {Node} B - The replacement node.
    + */
    +export function replace_node ( A , B ) {
     
     	// assert( A.parent !== null ) ;
     	// we never apply delete_one_child on the root so we are safe
    diff --git a/file/src/family/grandparent.js.html b/file/src/family/grandparent.js.html
    index cef2568..c6e9f3e 100644
    --- a/file/src/family/grandparent.js.html
    +++ b/file/src/family/grandparent.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,11 +68,17 @@

    src/family/grandparent.js

    -
    export function grandparent ( n ) {
    +
    /**
    + * Computes the grandparent (parent of parent) of the input node.
    + *
    + * @param {Node} node - The input node.
    + * @returns {Node}
    + */
    +export function grandparent ( node ) {
     
    -	//assert((n !== null) && (n.parent !== null));
    -	//We only call this function when n HAS a grandparent
    -	return n.parent.parent;
    +	// assert((node !== null) && (node.parent !== null));
    +	// We only call this function when node HAS a grandparent
    +	return node.parent.parent;
     
     }
     
    diff --git a/file/src/family/index.js.html b/file/src/family/index.js.html index f0311f6..aa047e7 100644 --- a/file/src/family/index.js.html +++ b/file/src/family/index.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/file/src/family/predecessor.js.html b/file/src/family/predecessor.js.html index 7028872..5f716c1 100644 --- a/file/src/family/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,9 +68,17 @@

    src/family/predecessor.js

    -
    export function predecessor ( node ) {
    +
    /**
    + * Computes the predecessor of the input node, in the subtree rooted at the
    + * input node, when this predecessor is guaranteed to exist.
    + *
    + * @param {Node} node - The input node.
    + * @returns {Node}
    + */
    +export function predecessor ( node ) {
     
    -	var pred = node.left ;
    +	// assert( !node.left.isleaf() ) ;
    +	let pred = node.left ;
     
     	while ( !pred.right.isleaf() ) pred = pred.right ;
     
    diff --git a/file/src/family/sibling.js.html b/file/src/family/sibling.js.html
    index 990ce4a..f58d0e5 100644
    --- a/file/src/family/sibling.js.html
    +++ b/file/src/family/sibling.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,13 +68,19 @@

    src/family/sibling.js

    -
    export function sibling ( n ) {
    +
    /**
    + * Computes the sibling of the input node.
    + *
    + * @param {Node} node - The input node.
    + * @returns {Node}
    + */
    +export function sibling ( node ) {
     
    -	//assert((n !== null) && (n.parent !== null));
    -	//We only use this function when n HAS a sibling so this case can never
    -	//happen.
    +	// assert((node !== null) && (node.parent !== null));
    +	// We only use this function when node HAS a sibling so this case can never
    +	// happen.
     
    -	return  n === n.parent.left ? n.parent.right : n.parent.left ;
    +	return  node === node.parent.left ? node.parent.right : node.parent.left ;
     
     }
     
    diff --git a/file/src/family/uncle.js.html b/file/src/family/uncle.js.html index fbacdaf..c0b1b2a 100644 --- a/file/src/family/uncle.js.html +++ b/file/src/family/uncle.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -70,11 +70,18 @@

    src/family/uncle.js

    import { grandparent } from './grandparent' ;
     
    -export function uncle ( n ) {
    -	const g = grandparent( n );
    +/**
    + * Computes the uncle of the input node when the grandparent is guaranteed to
    + * exist.
    + *
    + * @param {Node} node - The input node.
    + * @returns {Node}
    + */
    +export function uncle ( node ) {
    +	const g = grandparent( node );
     	// assert( g !== null ) ;
     	// this can never happen
    -	if ( n.parent === g.left )
    +	if ( node.parent === g.left )
     	  return g.right.isleaf( ) ? null : g.right ;
     	else
     	  return g.left.isleaf( ) ? null : g.left ;
    diff --git a/file/src/index.js.html b/file/src/index.js.html
    index 8984476..52cdadd 100644
    --- a/file/src/index.js.html
    +++ b/file/src/index.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -71,9 +71,9 @@
    export * from './adt' ;
     export * from './color' ;
     export * from './debug' ;
    +export * from './deletion' ;
     export * from './family' ;
     export * from './insertion' ;
    -export * from './removal' ;
     export * from './rotate' ;
     export * from './search' ;
     export * from './traversal' ;
    diff --git a/file/src/insertion/index.js.html b/file/src/insertion/index.js.html
    index 4363d37..8fb03c2 100644
    --- a/file/src/insertion/index.js.html
    +++ b/file/src/insertion/index.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/file/src/insertion/insert.js.html b/file/src/insertion/insert.js.html index e831010..03d0a3d 100644 --- a/file/src/insertion/insert.js.html +++ b/file/src/insertion/insert.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -69,11 +69,27 @@

    src/insertion/insert.js

    
    +/**
    + * Walks the tree rooted at <code>A</code> down the only path that satisfies
    + * the following property: if at a node <code>C</code> we make a left (resp.
    + * right), then <code>B < C</code> (resp. <code>B >= C</code>). Once we hit the
    + * end of the path, we can add node <code>B</code> at this position. By the
    + * property of the path, the tree rooted at <code>A</code> is still a binary
    + * search tree.
    + * For our red-black tree, all that is left to do is fix the red-black tree
    + * properties in case they have been violated by this insertion. This is fixed
    + * by {@link insert_case1}.
    + *
    + * @param compare - The comparison function to use.
    + * @param {Node} A - The root of the tree.
    + * @param {Node} B - The node to insert.
    + * @returns {Node} B - The node that has been inserted.
    + */
     export function insert ( compare, A, B ) {
     
     	while ( true ) {
     
    -		if ( compare( B.value, A.value ) < 0 ) {
    +		if ( compare( B.key, A.key ) < 0 ) {
     
     			const node = A.left;
     
    diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html
    index 356da41..ba2c258 100644
    --- a/file/src/insertion/insert_case1.js.html
    +++ b/file/src/insertion/insert_case1.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,16 +68,28 @@

    src/insertion/insert_case1.js

    -
    
    -import { BLACK } from '..' ;
    +
    import { BLACK } from '..' ;
     import { insert_case2 } from './insert_case2' ;
     
    -export function insert_case1(n)
    -{
    - if (n.parent === null)
    -  n.color = BLACK;
    - else
    -  insert_case2(n);
    +/**
    + * Preconditions:
    + *   - n is red.
    + *
    + * @param {Node} n - The input node.
    + */
    +export function insert_case1 ( n ) {
    +
    +	/**
    +	 * If n is the root of the tree, paint it black and we are done.
    +	 *
    +	 *      >R
    +	 *      / \
    +	 *     -   -
    +	 */
    +	if ( n.parent === null ) n.color = BLACK ;
    +
    +	else insert_case2( n ) ;
    +
     }
     
    diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index d592703..eb9413b 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,16 +68,31 @@

    src/insertion/insert_case2.js

    -
    
    -import { BLACK } from '..' ;
    +
    import { BLACK } from '..' ;
     import { insert_case3 } from './insert_case3' ;
     
    -export function insert_case2(n)
    -{
    - if (n.parent.color === BLACK)
    -  return; /* Tree is still valid */
    - else
    -  insert_case3(n);
    +/**
    + * Preconditions:
    + *   - n is red.
    + *   - n is not the root of the tree.
    + *
    + * @param {Node} n - The input node.
    + */
    +export function insert_case2 ( n ) {
    +
    +	/**
    +	 * If the parent of n is black then we have nothing to do.
    +	 *
    +	 *         B
    +	 *        / \
    +	 *      >R   -
    +	 *      / \
    +	 *     -   -
    +	 */
    +	if ( n.parent.color === BLACK ) return ;
    +
    +	else insert_case3( n ) ;
    +
     }
     
    diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index 3691f80..40d4d67 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -72,19 +72,43 @@ import { insert_case1 } from './insert_case1' ; import { insert_case4 } from './insert_case4' ; -export function insert_case3(n) -{ - const u = uncle(n); +/** + * Preconditions: + * - n is red. + * - n is not the root of the tree. + * - n's parent is red. + * + * @param {Node} n - The input node. + */ +export function insert_case3 ( n ) { + + const u = uncle( n ) ; + + /** + * If n has a non-leaf uncle and this uncle is red then we simply + * repaint the parent and the uncle of n in black, the grandparent of + * n in red, then call insert_case1 on n's grandparent. + * + * B >R + * / \ / \ + * R R B B + * / \ / \ --> / \ / \ + * >R - - - R - - - + * / \ / \ + * - - - - + */ + + + if ( ( u !== null ) && ( u.color === RED ) ) { + n.parent.color = BLACK ; + u.color = BLACK ; + const g = grandparent( n ) ; + g.color = RED ; + insert_case1( g ) ; + } + + else insert_case4( n ) ; - if ((u !== null) && (u.color === RED)) { - n.parent.color = BLACK; - u.color = BLACK; - const g = grandparent(n); - g.color = RED; - insert_case1(g); - } else { - insert_case4(n); - } }
    diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index 6d1c56a..1a88017 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -72,42 +72,87 @@ import { rotate_left , rotate_right , grandparent } from '..' ; import { insert_case5 } from './insert_case5' ; -export function insert_case4(n) -{ - const g = grandparent(n); - - if ((n === n.parent.right) && (n.parent === g.left)) { - rotate_left(n.parent); - - /* - * rotate_left can be the below because of already having *g = grandparent(n) +/** + * Preconditions: + * - n is red. + * - n is not the root of the tree. + * - n's parent is red. + * - n's uncle is black. * - * saved_p=g.left, *saved_left_n=n.left; - * g.left=n; - * n.left=saved_p; - * saved_p.right=saved_left_n; + * Here we fix the input subtree to pass the preconditions of {@link insert_case5}. * - * and modify the parent's nodes properly + * @param {Node} n - The input node. */ +export function insert_case4 ( n ) { - //n = n.left; /!\ need to fix rotate, so that we can safely reference a node + const g = grandparent( n ) ; - } else if ((n === n.parent.left) && (n.parent === g.right)) { - rotate_right(n.parent); + /** + * If the path from g to n makes a left-right, change it to a left-left + * with {@link rotate_left}. Then call {@link insert_case5} on the old + * parent of n. + * + * B B + * / \ / \ + * R B R B + * / \ / \ --> / \ / \ + * = >R - - >R = - - + * / \ / \ + * = = = = + */ - /* - * rotate_right can be the below to take advantage of already having *g = grandparent(n) - * - * saved_p=g.right, *saved_right_n=n.right; - * g.right=n; - * n.right=saved_p; - * saved_p.left=saved_right_n; - * - */ + if ( ( n === n.parent.right ) && ( n.parent === g.left ) ) { + + rotate_left( n.parent ) ; + + /** + * rotate_left can be the below because of already having *g = grandparent(n) + * + * saved_p=g.left, *saved_left_n=n.left; + * g.left=n; + * n.left=saved_p; + * saved_p.right=saved_left_n; + * + * and modify the parent's nodes properly + */ + + // n = n.left; /!\ need to fix rotate, so that we can safely reference a node + + } + + /** + * If the path from g to n makes a right-left, change it to a right-right + * with {@link rotate_right}. Then call {@link insert_case5} on the old + * parent of n. + * + * B B + * / \ / \ + * B R B R + * / \ / \ --> / \ / \ + * - - >R = - - = >R + * / \ / \ + * = = = = + */ + + else if ( ( n === n.parent.left ) && ( n.parent === g.right ) ) { + + rotate_right( n.parent ) ; + + /** + * rotate_right can be the below to take advantage of already having *g = grandparent(n) + * + * saved_p=g.right, *saved_right_n=n.right; + * g.right=n; + * n.right=saved_p; + * saved_p.left=saved_right_n; + * + */ + + // n = n.right ; + } + + insert_case5( n ) ; - //n = n.right; - } - insert_case5(n); }
    diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case5.js.html index 9c26808..8e09d69 100644 --- a/file/src/insertion/insert_case5.js.html +++ b/file/src/insertion/insert_case5.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,19 +68,54 @@

    src/insertion/insert_case5.js

    -
    
    -import { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;
    +
    import { RED , BLACK , rotate_left , rotate_right , grandparent } from '..' ;
    +
    +/**
    + * Preconditions:
    + *   - n is red.
    + *   - n is not the root of the tree.
    + *   - n's parent is red.
    + *   - n's uncle is black.
    + *   - the path from n to its grandparent makes a left-left or right-right.
    + *
    + * @param {Node} n - The input node.
    + */
    +export function insert_case5 ( n ) {
    +
    +	const g = grandparent( n ) ;
    +
    +	// repaint n's parent black, n's grandparent red
    +	n.parent.color = BLACK ;
    +	g.color = RED ;
    +
    +	/**
    +	 * If the path from g to n makes a left-left, {@link rotate_right} at g.
    +	 * We are done.
    +	 *
    +	 *             R                     B
    +	 *           /   \                 /   \
    +	 *         B       B            >R       R
    +	 *        / \     / \   -->     / \     / \
    +	 *      >R   =   -   -         =   =   =   B
    +	 *      / \                               / \
    +	 *     =   =                             -   -
    +	 */
    +	if ( n === n.parent.left ) rotate_right( g ) ;
     
    -export function insert_case5(n)
    -{
    - const g = grandparent(n);
    +	/**
    +	 * If the path from g to n makes a right-right, {@link rotate_left} at g.
    +	 * We are done.
    +	 *
    +	 *             R                     B
    +	 *           /   \                 /   \
    +	 *         B       B             R      >R
    +	 *        / \     / \   -->     / \     / \
    +	 *       -   -   =  >R         B   =   =   =
    +	 *                  / \       / \
    +	 *                 =   =     -   -
    +	 */
    +	else rotate_left( g ) ;
     
    - n.parent.color = BLACK;
    - g.color = RED;
    - if (n === n.parent.left)
    -  rotate_right(g);
    - else
    -  rotate_left(g);
     }
     
    diff --git a/file/src/rotate/index.js.html b/file/src/rotate/index.js.html index 2ca7def..e8dc9cf 100644 --- a/file/src/rotate/index.js.html +++ b/file/src/rotate/index.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/file/src/rotate/rotate_left.js.html b/file/src/rotate/rotate_left.js.html index 1ba24bb..953b140 100644 --- a/file/src/rotate/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -69,8 +69,8 @@

    src/rotate/rotate_left.js

    /**
    - * Rotate tree left.
    - * (see https://en.wikipedia.org/wiki/Tree_rotation)
    + * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)
    + * /!\ This swaps the references to A and B.
      *
      *         A                B
      *        / \              / \
    @@ -79,7 +79,7 @@
      *         b   c        a   b
      *
      *
    - * @param {Node} A root of the tree
    + * @param {Node} A - The root of the tree.
      *
      */
     
    @@ -90,7 +90,7 @@
     	const b = B.left ;
     	const c = B.right ;
     
    -	[A.value , B.value] = [B.value , A.value] ;
    +	[A.key , B.key] = [B.key , A.key] ;
     	[A.color , B.color] = [B.color , A.color] ;
     
     	A.left = B ;
    diff --git a/file/src/rotate/rotate_right.js.html b/file/src/rotate/rotate_right.js.html
    index e3f858a..b325fa6 100644
    --- a/file/src/rotate/rotate_right.js.html
    +++ b/file/src/rotate/rotate_right.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -69,8 +69,8 @@

    src/rotate/rotate_right.js

    /**
    - * Rotate tree right.
    - * (see https://en.wikipedia.org/wiki/Tree_rotation)
    + * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)
    + * /!\ This swaps the references to A and B.
      *
      *         B                A
      *        / \              / \
    @@ -79,7 +79,7 @@
      *     a   b                b   c
      *
      *
    - * @param {Node} B root of the tree
    + * @param {Node} B - The root of the tree.
      *
      */
     
    @@ -90,7 +90,7 @@
     	const b = A.right ;
     	const c = B.right ;
     
    -	[A.value , B.value] = [B.value , A.value] ;
    +	[A.key , B.key] = [B.key , A.key] ;
     	[A.color , B.color] = [B.color , A.color] ;
     
     	B.left = a ;
    diff --git a/file/src/search/index.js.html b/file/src/search/index.js.html
    index 2ebd363..2965426 100644
    --- a/file/src/search/index.js.html
    +++ b/file/src/search/index.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/file/src/search/search.js.html b/file/src/search/search.js.html index 4434125..ec97afd 100644 --- a/file/src/search/search.js.html +++ b/file/src/search/search.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,28 +68,33 @@

    src/search/search.js

    -
    export function search ( compare, node, value ) {
    -
    -	// scan for first node whose
    -	// value equals parameter value
    +
    /**
    + * Search for the first node whose key equals <code>key</code>.
    + *
    + * @param {Function} compare - The comparison function.
    + * @param {Node} root - The root of the tree to scan.
    + * @param {Key} key - The key to search for.
    + * @returns {Node}
    + */
    +export function search ( compare, root, key ) {
     
     	while ( true ) {
     
    -		const d = compare( value, node.value );
    +		const d = compare( key, root.key );
     
     		if ( d === 0 ) {
    -			return node;
    +			return root;
     		}
     
     		else if ( d < 0 ) {
    -			node = node.left;
    +			root = root.left;
     		}
     
     		else {
    -			node = node.right;
    +			root = root.right;
     		}
     
    -		if ( node.isleaf() ) {
    +		if ( root.isleaf() ) {
     			return null;
     		}
     
    diff --git a/file/src/traversal/index.js.html b/file/src/traversal/index.js.html
    index ef07e7b..7a6da3b 100644
    --- a/file/src/traversal/index.js.html
    +++ b/file/src/traversal/index.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/file/src/traversal/inordertraversal.js.html b/file/src/traversal/inordertraversal.js.html index 0ba5cfc..7781ddd 100644 --- a/file/src/traversal/inordertraversal.js.html +++ b/file/src/traversal/inordertraversal.js.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,15 +68,28 @@

    src/traversal/inordertraversal.js

    -
    export function* inordertraversal ( node ) {
    +
    /**
    + * Traverses the tree rooted at <code>node</code> in order.
    + *
    + * @param {Node} node - The root of the tree.
    + * @returns {Iterator}
    + */
    +export function* inordertraversal ( node ) {
     
     	if ( !node.left.isleaf() ) {
    +		// Yield the nodes on the left recursively. Those nodes are all smaller
    +		// than (or equal to) the current node by the binary search tree
    +		// properties.
     		yield *inordertraversal( node.left );
     	}
     
    -	yield node.value ;
    +	// Yield the current node.
    +	yield node.key ;
     
     	if ( !node.right.isleaf() ) {
    +		// Yield the nodes on the right recursively. Those nodes are all larger
    +		// than (or equal to) the current node by the binary search tree
    +		// properties.
     		yield* inordertraversal( node.right );
     	}
     
    diff --git a/file/src/traversal/rangetraversal.js.html b/file/src/traversal/rangetraversal.js.html
    index d73ce07..1902022 100644
    --- a/file/src/traversal/rangetraversal.js.html
    +++ b/file/src/traversal/rangetraversal.js.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -68,18 +68,34 @@

    src/traversal/rangetraversal.js

    -
    export function* rangetraversal ( compare , node , left , right ) {
    +
    /**
    + * Yields all the keys in the tree rooted at <code>root</code> that lie in the
    + * interval <code>[left, right[</code>, in order.
    + *
    + * @param {Function} compare - The comparison function.
    + * @param {Node} root - The root of the tree.
    + * @param {Key} left - The lower bound of the interval.
    + * @param {Key} right - The upper bound of the interval.
    + * @returns {Iterator}
    + */
    +export function* rangetraversal ( compare , root , left , right ) {
     
    -	if ( compare( node.value , left ) < 0 ) {
    -		if ( !node.right.isleaf() ) yield *rangetraversal( compare , node.right , left , right );
    +	if ( compare( root.key , left ) < 0 ) {
    +		// If the root lies to the left of the interval, we can discard the
    +		// entire left subtree.
    +		if ( !root.right.isleaf() ) yield *rangetraversal( compare , root.right , left , right );
     	}
    -	else if ( compare( node.value , right ) >= 0 ) {
    -		if ( !node.left.isleaf() ) yield *rangetraversal( compare , node.left , left , right );
    +	else if ( compare( root.key , right ) >= 0 ) {
    +		// If the root lies to the right of the interval, we can discard the
    +		// entire right subtree.
    +		if ( !root.left.isleaf() ) yield *rangetraversal( compare , root.left , left , right );
     	}
     	else {
    -		if ( !node.left.isleaf() ) yield *rangetraversal( compare , node.left , left , right );
    -		yield node.value ;
    -		if ( !node.right.isleaf() ) yield *rangetraversal( compare , node.right , left , right );
    +		// Otherwise just recurse on both subtrees and yield the root in
    +		// between.
    +		if ( !root.left.isleaf() ) yield *rangetraversal( compare , root.left , left , right );
    +		yield root.key ;
    +		if ( !root.right.isleaf() ) yield *rangetraversal( compare , root.right , left , right );
     	}
     
     }
    diff --git a/function/index.html b/function/index.html
    index 7dde221..22a5047 100644
    --- a/function/index.html
    +++ b/function/index.html
    @@ -40,6 +40,14 @@
     
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -83,13 +83,14 @@

    - Leaf(parent: *) + Leaf(parent: Node): Leaf

    - +

    A black leaf node.

    +
    @@ -108,13 +109,14 @@

    - Node(color: *, value: *) + Node(color: Number, key: Key): Node

    - +

    An internal node.

    +
    @@ -133,13 +135,15 @@

    - debug(node: *): string + debug(root: Node): String

    - +

    Recursively constructs a prettyprint string for the red-black tree rooted at +root.

    +
    @@ -158,13 +162,19 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    +
    @@ -183,13 +193,20 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    +
    @@ -208,13 +225,21 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    +
    @@ -233,13 +258,22 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • n's parent and n's sibling's children cannot all be black
    • +
    +
    @@ -258,13 +292,22 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • at least one of n's sibling's children is red
    • +
    +
    @@ -283,13 +326,23 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • if n is a left child, the right child of n's sibling is red
    • +
    • if n is a right child, the left child of n's sibling is red
    • +
    +
    @@ -308,13 +361,14 @@
    - +

    Delete a node n that has at most a single non-leaf child.

    +
    @@ -333,13 +387,14 @@

    - grandparent(n: *): * + grandparent(node: Node): Node

    - +

    Computes the grandparent (parent of parent) of the input node.

    +
    @@ -358,13 +413,14 @@

    - * inordertraversal(node: *) + * inordertraversal(node: Node): Iterator

    - +

    Traverses the tree rooted at node in order.

    +
    @@ -383,13 +439,15 @@

    - insert(compare: *, A: *, B: *): * + insert(compare: *, A: Node, B: Node): Node

    - +

    Walks the tree rooted at A down the only path that satisfies +the following property: if at a node C we make a left (resp.

    +
    @@ -408,13 +466,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -433,13 +495,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -458,13 +524,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -483,13 +553,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -508,13 +582,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -533,13 +611,15 @@

    - predecessor(node: *): * + predecessor(node: Node): Node

    - +

    Computes the predecessor of the input node, in the subtree rooted at the +input node, when this predecessor is guaranteed to exist.

    +
    @@ -558,13 +638,15 @@

    - * rangetraversal(compare: *, node: *, left: *, right: *) + * rangetraversal(compare: Function, root: Node, left: Key, right: Key): Iterator

    - +

    Yields all the keys in the tree rooted at root that lie in the +interval [left, right[, in order.

    +
    @@ -583,13 +665,14 @@

    - replace_node(A: *, B: *) + replace_node(A: Node, B: Node)

    - +

    Replaces node A by node B.

    +
    @@ -660,13 +743,14 @@

    - search(compare: *, node: *, value: *): * + search(compare: Function, root: Node, key: Key): Node

    - +

    Search for the first node whose key equals key.

    +
    @@ -685,13 +769,14 @@

    - sibling(n: *): * + sibling(node: Node): Node

    - +

    Computes the sibling of the input node.

    +
    @@ -710,13 +795,15 @@

    - uncle(n: *): * + uncle(node: Node): Node

    - +

    Computes the uncle of the input node when the grandparent is guaranteed to +exist.

    +
    @@ -736,18 +823,19 @@

    - Leaf(parent: *) + Leaf(parent: Node): Leaf - source + source

    - - + +

    A black leaf node.

    +
    @@ -761,16 +849,27 @@

    Params:

    parent - * + Node - +

    The parent node in the tree.

    +
    - +
    +

    Return:

    + + + + + +
    Leaf
    +
    +
    +
    @@ -792,18 +891,19 @@

    - Node(color: *, value: *) + Node(color: Number, key: Key): Node - source + source

    - - + +

    An internal node. This node can be red or black.

    +
    @@ -817,22 +917,34 @@

    Params:

    color - * + Number - +

    The color of the node.

    + - value - * + key + Key - +

    The key of the node.

    +
    - +
    +

    Return:

    + + + + + +
    Node
    +
    +
    +
    @@ -854,18 +966,20 @@

    - debug(node: *): string + debug(root: Node): String - source + source

    - - + +

    Recursively constructs a prettyprint string for the red-black tree rooted at +root.

    +
    @@ -878,10 +992,11 @@

    Params:

    - node - * + root + Node - +

    The root of the tree.

    + @@ -892,7 +1007,7 @@

    Params:

    Return:

    - +
    stringString
    @@ -920,18 +1035,24 @@

    - delete_case1(n: *) + delete_case1(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    +
    @@ -945,9 +1066,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -976,18 +1098,25 @@

    - delete_case2(n: *) + delete_case2(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    +
    @@ -1001,9 +1130,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1032,18 +1162,26 @@

    - delete_case3(n: *) + delete_case3(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    +
    @@ -1057,9 +1195,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1088,18 +1227,27 @@

    - delete_case4(n: *) + delete_case4(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • n's parent and n's sibling's children cannot all be black
    • +
    +
    @@ -1113,9 +1261,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1144,18 +1293,27 @@

    - delete_case5(n: *) + delete_case5(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • at least one of n's sibling's children is red
    • +
    +
    @@ -1169,9 +1327,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1200,18 +1359,28 @@

    - delete_case6(n: *) + delete_case6(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • if n is a left child, the right child of n's sibling is red
    • +
    • if n is a right child, the left child of n's sibling is red
    • +
    +
    @@ -1225,9 +1394,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1256,18 +1426,24 @@

    - delete_one_child(n: *) + delete_one_child(n: Node) - source + source

    - - + +

    Delete a node n that has at most a single non-leaf child.

    +

    Precondition:

    +
      +
    • n has at most one non-leaf child.
    • +
    • if n has a non-leaf child, then it is its left child.
    • +
    +
    @@ -1281,9 +1457,10 @@

    Params:

    n - * + Node - +

    The node to delete.

    + @@ -1312,18 +1489,19 @@

    - grandparent(n: *): * + grandparent(node: Node): Node - source + source

    - - + +

    Computes the grandparent (parent of parent) of the input node.

    +
    @@ -1336,10 +1514,11 @@

    Params:

    - n - * + node + Node - +

    The input node.

    + @@ -1350,7 +1529,7 @@

    Params:

    Return:

    - +
    *Node
    @@ -1378,18 +1557,19 @@

    * - inordertraversal(node: *) + inordertraversal(node: Node): Iterator - source + source

    - - + +

    Traverses the tree rooted at node in order.

    +
    @@ -1403,16 +1583,27 @@

    Params:

    node - * + Node - +

    The root of the tree.

    +
    - +
    +

    Return:

    + + + + + +
    Iterator
    +
    +
    +
    @@ -1434,18 +1625,27 @@

    - insert(compare: *, A: *, B: *): * + insert(compare: *, A: Node, B: Node): Node - source + source

    - - + +

    Walks the tree rooted at A down the only path that satisfies +the following property: if at a node C we make a left (resp. +right), then B < C (resp. B >= C). Once we hit the +end of the path, we can add node B at this position. By the +property of the path, the tree rooted at A is still a binary +search tree. +For our red-black tree, all that is left to do is fix the red-black tree +properties in case they have been violated by this insertion. This is fixed +by insert_case1.

    +
    @@ -1461,19 +1661,22 @@

    Params:

    compare * - +

    The comparison function to use.

    + A - * + Node - +

    The root of the tree.

    + B - * + Node - +

    The node to insert.

    + @@ -1484,8 +1687,9 @@

    Params:

    Return:

    - - + +
    *Node

    B - The node that has been inserted.

    +
    @@ -1512,18 +1716,22 @@

    - insert_case1(n: *) + insert_case1(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -1537,9 +1745,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1568,18 +1777,23 @@

    - insert_case2(n: *) + insert_case2(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is red.
    • +
    • n is not the root of the tree.
    • +
    +
    @@ -1593,9 +1807,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1624,18 +1839,24 @@

    - insert_case3(n: *) + insert_case3(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is red.
    • +
    • n is not the root of the tree.
    • +
    • n's parent is red.
    • +
    +
    @@ -1649,9 +1870,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1680,18 +1902,26 @@

    - insert_case4(n: *) + insert_case4(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is red.
    • +
    • n is not the root of the tree.
    • +
    • n's parent is red.
    • +
    • n's uncle is black.
    • +
    +

    Here we fix the input subtree to pass the preconditions of insert_case5.

    +
    @@ -1705,9 +1935,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1736,18 +1967,26 @@

    - insert_case5(n: *) + insert_case5(n: Node) - source + source

    - - + +

    Preconditions:

    +
      +
    • n is red.
    • +
    • n is not the root of the tree.
    • +
    • n's parent is red.
    • +
    • n's uncle is black.
    • +
    • the path from n to its grandparent makes a left-left or right-right.
    • +
    +
    @@ -1761,9 +2000,10 @@

    Params:

    n - * + Node - +

    The input node.

    + @@ -1792,18 +2032,20 @@

    - predecessor(node: *): * + predecessor(node: Node): Node - source + source

    - - + +

    Computes the predecessor of the input node, in the subtree rooted at the +input node, when this predecessor is guaranteed to exist.

    +
    @@ -1817,9 +2059,10 @@

    Params:

    node - * + Node - +

    The input node.

    + @@ -1830,7 +2073,7 @@

    Params:

    Return:

    - +
    *Node
    @@ -1858,18 +2101,20 @@

    * - rangetraversal(compare: *, node: *, left: *, right: *) + rangetraversal(compare: Function, root: Node, left: Key, right: Key): Iterator - source + source

    - - + +

    Yields all the keys in the tree rooted at root that lie in the +interval [left, right[, in order.

    +
    @@ -1883,34 +2128,48 @@

    Params:

    compare - * + Function - +

    The comparison function.

    + - node - * + root + Node - +

    The root of the tree.

    + left - * + Key - +

    The lower bound of the interval.

    + right - * + Key - +

    The upper bound of the interval.

    +
    - +
    +

    Return:

    + + + + + +
    Iterator
    +
    +
    +
    @@ -1932,18 +2191,19 @@

    - replace_node(A: *, B: *) + replace_node(A: Node, B: Node) - source + source

    - - + +

    Replaces node A by node B.

    +
    @@ -1957,15 +2217,17 @@

    Params:

    A - * + Node - +

    The node to replace.

    + B - * + Node - +

    The replacement node.

    + @@ -2005,8 +2267,8 @@

    -

    Rotate tree left. -(see https://en.wikipedia.org/wiki/Tree_rotation)

    +

    Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation) +/!\ This swaps the references to A and B.

        A                B
        / \              / \
       a   B     ->     A   c
    @@ -2028,7 +2290,7 @@ 

    Params:

    A Node -

    root of the tree

    +

    The root of the tree.

    @@ -2069,8 +2331,8 @@

    -

    Rotate tree right. -(see https://en.wikipedia.org/wiki/Tree_rotation)

    +

    Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation) +/!\ This swaps the references to A and B.

        B                A
        / \              / \
       A   c     ->     a   B
    @@ -2092,7 +2354,7 @@ 

    Params:

    B Node -

    root of the tree

    +

    The root of the tree.

    @@ -2122,18 +2384,19 @@ - - + +

    Search for the first node whose key equals key.

    +
    @@ -2147,21 +2410,24 @@

    Params:

    compare - * + Function - +

    The comparison function.

    + - node - * + root + Node - +

    The root of the tree to scan.

    + - value - * + key + Key - +

    The key to search for.

    + @@ -2172,7 +2438,7 @@

    Params:

    Return:

    - +
    *Node
    @@ -2200,18 +2466,19 @@

    - sibling(n: *): * + sibling(node: Node): Node - source + source

    - - + +

    Computes the sibling of the input node.

    +
    @@ -2224,10 +2491,11 @@

    Params:

    - n - * + node + Node - +

    The input node.

    + @@ -2238,7 +2506,7 @@

    Params:

    Return:

    - +
    *Node
    @@ -2266,18 +2534,20 @@

    - uncle(n: *): * + uncle(node: Node): Node - source + source

    - - + +

    Computes the uncle of the input node when the grandparent is guaranteed to +exist.

    +
    @@ -2290,10 +2560,11 @@

    Params:

    - n - * + node + Node - +

    The input node.

    + @@ -2304,7 +2575,7 @@

    Params:

    Return:

    - +
    *Node
    diff --git a/identifiers.html b/identifiers.html index ff6f304..8524ad8 100644 --- a/identifiers.html +++ b/identifiers.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -89,7 +89,8 @@
    - +

    A RedBlackTree with key-only nodes.

    +
    @@ -116,13 +117,14 @@

    - Leaf(parent: *) + Leaf(parent: Node): Leaf

    - +

    A black leaf node.

    +
    @@ -141,13 +143,14 @@

    - Node(color: *, value: *) + Node(color: Number, key: Key): Node

    - +

    An internal node.

    +
    @@ -166,13 +169,15 @@

    - debug(node: *): string + debug(root: Node): String

    - +

    Recursively constructs a prettyprint string for the red-black tree rooted at +root.

    +
    @@ -191,13 +196,19 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    +
    @@ -216,13 +227,20 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    +
    @@ -241,13 +259,21 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    +
    @@ -266,13 +292,22 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • n's parent and n's sibling's children cannot all be black
    • +
    +
    @@ -291,13 +326,22 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • at least one of n's sibling's children is red
    • +
    +
    @@ -316,13 +360,23 @@
    - +

    Preconditions:

    +
      +
    • n is black
    • +
    • all root-leaf paths going through n have a black height of b - 1
    • +
    • all other root-leaf paths have a black height of b
    • +
    • n is not the root
    • +
    • n's sibling is black
    • +
    • if n is a left child, the right child of n's sibling is red
    • +
    • if n is a right child, the left child of n's sibling is red
    • +
    +
    @@ -341,13 +395,14 @@
    - +

    Delete a node n that has at most a single non-leaf child.

    +
    @@ -366,13 +421,14 @@

    - grandparent(n: *): * + grandparent(node: Node): Node

    - +

    Computes the grandparent (parent of parent) of the input node.

    +
    @@ -391,13 +447,14 @@

    - * inordertraversal(node: *) + * inordertraversal(node: Node): Iterator

    - +

    Traverses the tree rooted at node in order.

    +
    @@ -416,13 +473,15 @@

    - insert(compare: *, A: *, B: *): * + insert(compare: *, A: Node, B: Node): Node

    - +

    Walks the tree rooted at A down the only path that satisfies +the following property: if at a node C we make a left (resp.

    +
    @@ -441,13 +500,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -466,13 +529,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -491,13 +558,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -516,13 +587,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -541,13 +616,17 @@
    - +

    Preconditions:

    +
      +
    • n is red.
    • +
    +
    @@ -566,13 +645,15 @@

    - predecessor(node: *): * + predecessor(node: Node): Node

    - +

    Computes the predecessor of the input node, in the subtree rooted at the +input node, when this predecessor is guaranteed to exist.

    +
    @@ -591,13 +672,15 @@

    - * rangetraversal(compare: *, node: *, left: *, right: *) + * rangetraversal(compare: Function, root: Node, left: Key, right: Key): Iterator

    - +

    Yields all the keys in the tree rooted at root that lie in the +interval [left, right[, in order.

    +
    @@ -616,13 +699,14 @@

    - replace_node(A: *, B: *) + replace_node(A: Node, B: Node)

    - +

    Replaces node A by node B.

    +
    @@ -693,13 +777,14 @@

    - search(compare: *, node: *, value: *): * + search(compare: Function, root: Node, key: Key): Node

    - +

    Search for the first node whose key equals key.

    +
    @@ -718,13 +803,14 @@

    - sibling(n: *): * + sibling(node: Node): Node

    - +

    Computes the sibling of the input node.

    +
    @@ -743,13 +829,15 @@

    - uncle(n: *): * + uncle(node: Node): Node

    - +

    Computes the uncle of the input node when the grandparent is guaranteed to +exist.

    +
    @@ -781,7 +869,8 @@
    - +

    Constant for black.

    +
    @@ -806,7 +895,8 @@
    - +

    Constant for red.

    +
    diff --git a/index.html b/index.html index 4ceabcb..2742ebb 100644 --- a/index.html +++ b/index.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • diff --git a/script/search_index.js b/script/search_index.js index a58adad..9c5283c 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -36,45 +36,45 @@ window.esdocSearchIndex = [ "function" ], [ - "aureooms-es-red-black-tree/src/removal/delete_case1.js~delete_case1", + "aureooms-es-red-black-tree/src/deletion/delete_case1.js~delete_case1", "function/index.html#static-function-delete_case1", - "delete_case1 aureooms-es-red-black-tree/src/removal/delete_case1.js", + "delete_case1 aureooms-es-red-black-tree/src/deletion/delete_case1.js", "function" ], [ - "aureooms-es-red-black-tree/src/removal/delete_case2.js~delete_case2", + "aureooms-es-red-black-tree/src/deletion/delete_case2.js~delete_case2", "function/index.html#static-function-delete_case2", - "delete_case2 aureooms-es-red-black-tree/src/removal/delete_case2.js", + "delete_case2 aureooms-es-red-black-tree/src/deletion/delete_case2.js", "function" ], [ - "aureooms-es-red-black-tree/src/removal/delete_case3.js~delete_case3", + "aureooms-es-red-black-tree/src/deletion/delete_case3.js~delete_case3", "function/index.html#static-function-delete_case3", - "delete_case3 aureooms-es-red-black-tree/src/removal/delete_case3.js", + "delete_case3 aureooms-es-red-black-tree/src/deletion/delete_case3.js", "function" ], [ - "aureooms-es-red-black-tree/src/removal/delete_case4.js~delete_case4", + "aureooms-es-red-black-tree/src/deletion/delete_case4.js~delete_case4", "function/index.html#static-function-delete_case4", - "delete_case4 aureooms-es-red-black-tree/src/removal/delete_case4.js", + "delete_case4 aureooms-es-red-black-tree/src/deletion/delete_case4.js", "function" ], [ - "aureooms-es-red-black-tree/src/removal/delete_case5.js~delete_case5", + "aureooms-es-red-black-tree/src/deletion/delete_case5.js~delete_case5", "function/index.html#static-function-delete_case5", - "delete_case5 aureooms-es-red-black-tree/src/removal/delete_case5.js", + "delete_case5 aureooms-es-red-black-tree/src/deletion/delete_case5.js", "function" ], [ - "aureooms-es-red-black-tree/src/removal/delete_case6.js~delete_case6", + "aureooms-es-red-black-tree/src/deletion/delete_case6.js~delete_case6", "function/index.html#static-function-delete_case6", - "delete_case6 aureooms-es-red-black-tree/src/removal/delete_case6.js", + "delete_case6 aureooms-es-red-black-tree/src/deletion/delete_case6.js", "function" ], [ - "aureooms-es-red-black-tree/src/removal/delete_one_child.js~delete_one_child", + "aureooms-es-red-black-tree/src/deletion/delete_one_child.js~delete_one_child", "function/index.html#static-function-delete_one_child", - "delete_one_child aureooms-es-red-black-tree/src/removal/delete_one_child.js", + "delete_one_child aureooms-es-red-black-tree/src/deletion/delete_one_child.js", "function" ], [ @@ -138,9 +138,9 @@ window.esdocSearchIndex = [ "function" ], [ - "aureooms-es-red-black-tree/src/removal/replace_node.js~replace_node", + "aureooms-es-red-black-tree/src/deletion/replace_node.js~replace_node", "function/index.html#static-function-replace_node", - "replace_node aureooms-es-red-black-tree/src/removal/replace_node.js", + "replace_node aureooms-es-red-black-tree/src/deletion/replace_node.js", "function" ], [ @@ -569,6 +569,12 @@ window.esdocSearchIndex = [ "src/adt/RedBlackTree.js~RedBlackTree#has", "method" ], + [ + "src/adt/redblacktree.js~redblacktree#items", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-items", + "src/adt/RedBlackTree.js~RedBlackTree#items", + "method" + ], [ "src/adt/redblacktree.js~redblacktree#range", "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-range", @@ -587,12 +593,6 @@ window.esdocSearchIndex = [ "src/adt/RedBlackTree.js~RedBlackTree#root", "member" ], - [ - "src/adt/redblacktree.js~redblacktree#values", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-values", - "src/adt/RedBlackTree.js~RedBlackTree#values", - "method" - ], [ "src/adt/redblacktree.js~redblacktree.from", "class/src/adt/RedBlackTree.js~RedBlackTree.html#static-method-from", @@ -635,6 +635,60 @@ window.esdocSearchIndex = [ "src/debug/index.js", "file" ], + [ + "src/deletion/delete_case1.js", + "file/src/deletion/delete_case1.js.html", + "src/deletion/delete_case1.js", + "file" + ], + [ + "src/deletion/delete_case2.js", + "file/src/deletion/delete_case2.js.html", + "src/deletion/delete_case2.js", + "file" + ], + [ + "src/deletion/delete_case3.js", + "file/src/deletion/delete_case3.js.html", + "src/deletion/delete_case3.js", + "file" + ], + [ + "src/deletion/delete_case4.js", + "file/src/deletion/delete_case4.js.html", + "src/deletion/delete_case4.js", + "file" + ], + [ + "src/deletion/delete_case5.js", + "file/src/deletion/delete_case5.js.html", + "src/deletion/delete_case5.js", + "file" + ], + [ + "src/deletion/delete_case6.js", + "file/src/deletion/delete_case6.js.html", + "src/deletion/delete_case6.js", + "file" + ], + [ + "src/deletion/delete_one_child.js", + "file/src/deletion/delete_one_child.js.html", + "src/deletion/delete_one_child.js", + "file" + ], + [ + "src/deletion/index.js", + "file/src/deletion/index.js.html", + "src/deletion/index.js", + "file" + ], + [ + "src/deletion/replace_node.js", + "file/src/deletion/replace_node.js.html", + "src/deletion/replace_node.js", + "file" + ], [ "src/family/grandparent.js", "file/src/family/grandparent.js.html", @@ -713,60 +767,6 @@ window.esdocSearchIndex = [ "src/insertion/insert_case5.js", "file" ], - [ - "src/removal/delete_case1.js", - "file/src/removal/delete_case1.js.html", - "src/removal/delete_case1.js", - "file" - ], - [ - "src/removal/delete_case2.js", - "file/src/removal/delete_case2.js.html", - "src/removal/delete_case2.js", - "file" - ], - [ - "src/removal/delete_case3.js", - "file/src/removal/delete_case3.js.html", - "src/removal/delete_case3.js", - "file" - ], - [ - "src/removal/delete_case4.js", - "file/src/removal/delete_case4.js.html", - "src/removal/delete_case4.js", - "file" - ], - [ - "src/removal/delete_case5.js", - "file/src/removal/delete_case5.js.html", - "src/removal/delete_case5.js", - "file" - ], - [ - "src/removal/delete_case6.js", - "file/src/removal/delete_case6.js.html", - "src/removal/delete_case6.js", - "file" - ], - [ - "src/removal/delete_one_child.js", - "file/src/removal/delete_one_child.js.html", - "src/removal/delete_one_child.js", - "file" - ], - [ - "src/removal/index.js", - "file/src/removal/index.js.html", - "src/removal/index.js", - "file" - ], - [ - "src/removal/replace_node.js", - "file/src/removal/replace_node.js.html", - "src/removal/replace_node.js", - "file" - ], [ "src/rotate/index.js", "file/src/rotate/index.js.html", diff --git a/source.html b/source.html index d1d5d28..0b7acf1 100644 --- a/source.html +++ b/source.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -67,7 +67,7 @@
    -

    Source 2/42

    +

    Source 40/42

    @@ -83,28 +83,28 @@ - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + @@ -112,23 +112,23 @@ - + - + - - - - + + + + - + - - - - + + + + @@ -136,15 +136,15 @@ - + - + - - - - + + + + @@ -152,15 +152,87 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + + + + @@ -168,39 +240,39 @@ - + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - + @@ -208,127 +280,55 @@ - + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -336,23 +336,23 @@ - + - + - + - + - + @@ -360,15 +360,15 @@ - + - + - - - - + + + + @@ -376,23 +376,23 @@ - + - + - - - - + + + + - + - - - - + + + +
    src/adt/Leaf.jssrc/adt/Leaf.js Leaf0 %0/1170 byte82016-07-06 10:42:11 (UTC)100 %1/1440 byte212016-07-07 13:36:30 (UTC)
    src/adt/Node.jssrc/adt/Node.js Node0 %0/1266 byte112016-07-06 10:42:11 (UTC)100 %1/1599 byte252016-07-07 13:48:31 (UTC)
    src/adt/RedBlackTree.jssrc/adt/RedBlackTree.js RedBlackTree0 %0/142326 byte1162016-07-06 10:42:11 (UTC)85 %12/144355 byte1902016-07-07 14:47:21 (UTC)
    src/adt/index.js- 83 byte 32016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/color/BLACK.jssrc/color/BLACK.js BLACK0 %0/125 byte12016-07-06 10:42:11 (UTC)100 %1/156 byte42016-07-07 14:47:49 (UTC)
    src/color/RED.jssrc/color/RED.js RED0 %0/123 byte12016-07-06 10:42:11 (UTC)100 %1/152 byte42016-07-07 14:48:01 (UTC)
    src/color/index.js- 50 byte 22016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/debug/debug.jssrc/debug/debug.js debug0 %0/1307 byte132016-07-06 10:42:11 (UTC)100 %1/1483 byte202016-07-07 14:50:33 (UTC)
    src/debug/index.js- 26 byte 12016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/deletion/delete_case1.jsdelete_case1100 %1/1449 byte172016-07-01 13:06:21 (UTC)
    src/deletion/delete_case2.jsdelete_case2100 %1/11135 byte412016-07-01 13:59:23 (UTC)
    src/deletion/delete_case3.jsdelete_case3100 %1/11289 byte452016-07-01 14:06:01 (UTC)
    src/deletion/delete_case4.jsdelete_case4100 %1/11449 byte472016-07-01 14:32:44 (UTC)
    src/deletion/delete_case5.jsdelete_case5100 %1/11844 byte602016-07-01 14:42:36 (UTC)
    src/deletion/delete_case6.jsdelete_case6100 %1/11515 byte512016-07-01 15:33:14 (UTC)
    src/deletion/delete_one_child.jsdelete_one_child100 %1/11427 byte472016-07-01 12:53:31 (UTC)
    src/deletion/index.js--268 byte82016-07-07 18:49:16 (UTC)
    src/deletion/replace_node.jsreplace_node100 %1/1395 byte182016-07-07 18:51:41 (UTC)
    src/family/grandparent.jssrc/family/grandparent.js grandparent0 %0/1168 byte72016-07-06 10:42:11 (UTC)100 %1/1321 byte132016-07-07 14:54:12 (UTC)
    src/family/index.js- 118 byte 42016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/family/predecessor.jssrc/family/predecessor.js predecessor0 %0/1136 byte92016-07-06 10:42:11 (UTC)100 %1/1379 byte172016-07-07 15:00:29 (UTC)
    src/family/sibling.jssrc/family/sibling.js sibling0 %0/1233 byte92016-07-06 10:42:11 (UTC)100 %1/1373 byte152016-07-07 15:01:55 (UTC)
    src/family/uncle.jssrc/family/uncle.js uncle0 %0/1287 byte112016-07-06 10:42:11 (UTC)100 %1/1454 byte182016-07-07 15:07:05 (UTC)
    src/index.js - -245 byte246 byte 92016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/insertion/index.js- 192 byte 62016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/insertion/insert.jssrc/insertion/insert.js insert0 %0/1360 byte382016-07-06 10:42:11 (UTC)100 %1/11145 byte542016-07-07 13:49:31 (UTC)
    src/insertion/insert_case1.jssrc/insertion/insert_case1.js insert_case10 %0/1183 byte112016-07-06 10:42:11 (UTC)100 %1/1392 byte232016-07-07 16:33:57 (UTC)
    src/insertion/insert_case2.jssrc/insertion/insert_case2.js insert_case20 %0/1207 byte112016-07-06 10:42:11 (UTC)100 %1/1455 byte262016-07-07 16:34:06 (UTC)
    src/insertion/insert_case3.jssrc/insertion/insert_case3.js insert_case30 %0/1395 byte182016-07-06 10:42:11 (UTC)100 %1/11062 byte422016-07-07 16:33:16 (UTC)
    src/insertion/insert_case4.jssrc/insertion/insert_case4.js insert_case40 %0/1922 byte412016-07-06 10:42:11 (UTC)100 %1/12215 byte862016-07-07 16:15:21 (UTC)
    src/insertion/insert_case5.jssrc/insertion/insert_case5.js insert_case50 %0/1254 byte142016-07-06 10:42:11 (UTC)
    src/removal/delete_case1.jsdelete_case10 %0/1139 byte72016-07-06 10:42:11 (UTC)
    src/removal/delete_case2.jsdelete_case20 %0/1359 byte182016-07-06 10:42:11 (UTC)
    src/removal/delete_case3.jsdelete_case30 %0/1468 byte212016-07-06 10:42:11 (UTC)
    src/removal/delete_case4.jsdelete_case40 %0/1375 byte182016-07-06 10:42:11 (UTC)
    src/removal/delete_case5.jsdelete_case50 %0/11032 byte292016-07-06 10:42:11 (UTC)
    src/removal/delete_case6.jsdelete_case60 %0/1329 byte172016-07-06 10:42:11 (UTC)
    src/removal/delete_one_child.jsdelete_one_child0 %0/1802 byte282016-07-06 10:42:11 (UTC)
    src/removal/index.js--268 byte82016-07-06 10:42:11 (UTC)
    src/removal/replace_node.jsreplace_node0 %0/1243 byte122016-07-06 10:42:11 (UTC)100 %1/11380 byte492016-07-07 16:32:23 (UTC)
    src/rotate/index.js- 65 byte 22016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/rotate/rotate_left.js rotate_left 100 %1/1604 byte645 byte 352016-07-06 10:46:34 (UTC)2016-07-07 15:05:23 (UTC)
    src/rotate/rotate_right.js rotate_right 100 %1/1614 byte655 byte 362016-07-06 10:46:08 (UTC)2016-07-07 15:05:09 (UTC)
    src/search/index.js- 27 byte 12016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/search/search.jssrc/search/search.js search0 %0/1353 byte282016-07-06 10:42:11 (UTC)100 %1/1532 byte332016-07-07 13:47:51 (UTC)
    src/traversal/index.js- 72 byte 22016-07-06 10:42:11 (UTC)2016-07-07 18:49:16 (UTC)
    src/traversal/inordertraversal.jssrc/traversal/inordertraversal.js inordertraversal0 %0/1219 byte132016-07-06 10:42:11 (UTC)100 %1/1701 byte262016-07-07 13:49:55 (UTC)
    src/traversal/rangetraversal.jssrc/traversal/rangetraversal.js rangetraversal0 %0/1567 byte152016-07-06 10:42:11 (UTC)100 %1/11214 byte312016-07-07 13:48:49 (UTC)
    diff --git a/variable/index.html b/variable/index.html index f90aacd..fc377ac 100644 --- a/variable/index.html +++ b/variable/index.html @@ -40,6 +40,14 @@
  • VBLACK
  • VRED
  • Fdebug
  • +
  • Fdelete_case1
  • +
  • Fdelete_case2
  • +
  • Fdelete_case3
  • +
  • Fdelete_case4
  • +
  • Fdelete_case5
  • +
  • Fdelete_case6
  • +
  • Fdelete_one_child
  • +
  • Freplace_node
  • Fgrandparent
  • Fpredecessor
  • Fsibling
  • @@ -50,14 +58,6 @@
  • Finsert_case3
  • Finsert_case4
  • Finsert_case5
  • -
  • Fdelete_case1
  • -
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • -
  • Fdelete_case5
  • -
  • Fdelete_case6
  • -
  • Fdelete_one_child
  • -
  • Freplace_node
  • Frotate_left
  • Frotate_right
  • Fsearch
  • @@ -89,7 +89,8 @@
    - +

    Constant for black.

    +
    @@ -114,7 +115,8 @@
    - +

    Constant for red.

    +
    @@ -138,14 +140,15 @@

    - source + source

    - - + +

    Constant for black.

    +
    @@ -178,14 +181,15 @@

    - source + source

    - - + +

    Constant for red.

    +
    From 467ce5dbd4a847fb48f309ff2ccdd9d1303a2100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Tue, 1 Nov 2016 22:01:09 +0100 Subject: [PATCH 12/26] esdoc update --- .../src/adt/RedBlackTree.js~RedBlackTree.html | 2 +- file/src/adt/Leaf.js.html | 2 +- file/src/adt/Node.js.html | 2 +- file/src/adt/RedBlackTree.js.html | 2 +- file/src/adt/index.js.html | 2 +- file/src/color/BLACK.js.html | 2 +- file/src/color/RED.js.html | 2 +- file/src/color/index.js.html | 2 +- file/src/debug/debug.js.html | 2 +- file/src/debug/index.js.html | 2 +- file/src/deletion/delete_case1.js.html | 2 +- file/src/deletion/delete_case2.js.html | 2 +- file/src/deletion/delete_case3.js.html | 2 +- file/src/deletion/delete_case4.js.html | 2 +- file/src/deletion/delete_case5.js.html | 2 +- file/src/deletion/delete_case6.js.html | 2 +- file/src/deletion/delete_one_child.js.html | 2 +- file/src/deletion/index.js.html | 2 +- file/src/deletion/replace_node.js.html | 2 +- file/src/family/grandparent.js.html | 2 +- file/src/family/index.js.html | 2 +- file/src/family/predecessor.js.html | 2 +- file/src/family/sibling.js.html | 2 +- file/src/family/uncle.js.html | 2 +- file/src/index.js.html | 2 +- file/src/insertion/index.js.html | 2 +- file/src/insertion/insert.js.html | 2 +- file/src/insertion/insert_case1.js.html | 2 +- file/src/insertion/insert_case2.js.html | 2 +- file/src/insertion/insert_case3.js.html | 2 +- file/src/insertion/insert_case4.js.html | 2 +- file/src/insertion/insert_case5.js.html | 2 +- file/src/rotate/index.js.html | 2 +- file/src/rotate/rotate_left.js.html | 2 +- file/src/rotate/rotate_right.js.html | 2 +- file/src/search/index.js.html | 2 +- file/src/search/search.js.html | 2 +- file/src/traversal/index.js.html | 2 +- file/src/traversal/inordertraversal.js.html | 2 +- file/src/traversal/rangetraversal.js.html | 2 +- function/index.html | 2 +- identifiers.html | 2 +- index.html | 2 +- manual/example.html | 2 +- manual/index.html | 2 +- manual/installation.html | 6 +- manual/overview.html | 2 +- manual/usage.html | 2 +- package.json | 40 ++++++---- source.html | 80 +++++++++---------- variable/index.html | 2 +- 51 files changed, 114 insertions(+), 108 deletions(-) diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/adt/RedBlackTree.js~RedBlackTree.html index e631d43..e152a43 100644 --- a/class/src/adt/RedBlackTree.js~RedBlackTree.html +++ b/class/src/adt/RedBlackTree.js~RedBlackTree.html @@ -1300,7 +1300,7 @@

    Return:

    diff --git a/file/src/adt/Leaf.js.html b/file/src/adt/Leaf.js.html index 57a048d..891e930 100644 --- a/file/src/adt/Leaf.js.html +++ b/file/src/adt/Leaf.js.html @@ -94,7 +94,7 @@
    diff --git a/file/src/adt/Node.js.html b/file/src/adt/Node.js.html index faf5c2a..e1230fe 100644 --- a/file/src/adt/Node.js.html +++ b/file/src/adt/Node.js.html @@ -98,7 +98,7 @@
    diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/adt/RedBlackTree.js.html index 6166a40..577ddfd 100644 --- a/file/src/adt/RedBlackTree.js.html +++ b/file/src/adt/RedBlackTree.js.html @@ -263,7 +263,7 @@

    diff --git a/file/src/adt/index.js.html b/file/src/adt/index.js.html index 5392fa2..320518d 100644 --- a/file/src/adt/index.js.html +++ b/file/src/adt/index.js.html @@ -76,7 +76,7 @@
    diff --git a/file/src/color/BLACK.js.html b/file/src/color/BLACK.js.html index 1dbaee8..55c1653 100644 --- a/file/src/color/BLACK.js.html +++ b/file/src/color/BLACK.js.html @@ -77,7 +77,7 @@

    diff --git a/file/src/color/RED.js.html b/file/src/color/RED.js.html index 77196e6..a158ba7 100644 --- a/file/src/color/RED.js.html +++ b/file/src/color/RED.js.html @@ -77,7 +77,7 @@
    diff --git a/file/src/color/index.js.html b/file/src/color/index.js.html index b22ff13..e0923c3 100644 --- a/file/src/color/index.js.html +++ b/file/src/color/index.js.html @@ -75,7 +75,7 @@
    diff --git a/file/src/debug/debug.js.html b/file/src/debug/debug.js.html index 52623ae..017466f 100644 --- a/file/src/debug/debug.js.html +++ b/file/src/debug/debug.js.html @@ -93,7 +93,7 @@
    diff --git a/file/src/debug/index.js.html b/file/src/debug/index.js.html index a485e80..d43e1ae 100644 --- a/file/src/debug/index.js.html +++ b/file/src/debug/index.js.html @@ -74,7 +74,7 @@
    diff --git a/file/src/deletion/delete_case1.js.html b/file/src/deletion/delete_case1.js.html index 26a20d1..ac79730 100644 --- a/file/src/deletion/delete_case1.js.html +++ b/file/src/deletion/delete_case1.js.html @@ -90,7 +90,7 @@
    diff --git a/file/src/deletion/delete_case2.js.html b/file/src/deletion/delete_case2.js.html index 0c0016f..bbedbc3 100644 --- a/file/src/deletion/delete_case2.js.html +++ b/file/src/deletion/delete_case2.js.html @@ -114,7 +114,7 @@
    diff --git a/file/src/deletion/delete_case3.js.html b/file/src/deletion/delete_case3.js.html index cbca730..d0ce0c7 100644 --- a/file/src/deletion/delete_case3.js.html +++ b/file/src/deletion/delete_case3.js.html @@ -118,7 +118,7 @@
    diff --git a/file/src/deletion/delete_case4.js.html b/file/src/deletion/delete_case4.js.html index 0dd6b33..1ddd945 100644 --- a/file/src/deletion/delete_case4.js.html +++ b/file/src/deletion/delete_case4.js.html @@ -120,7 +120,7 @@
    diff --git a/file/src/deletion/delete_case5.js.html b/file/src/deletion/delete_case5.js.html index dd4320a..957f830 100644 --- a/file/src/deletion/delete_case5.js.html +++ b/file/src/deletion/delete_case5.js.html @@ -133,7 +133,7 @@
    diff --git a/file/src/deletion/delete_case6.js.html b/file/src/deletion/delete_case6.js.html index 9116a3a..00b3845 100644 --- a/file/src/deletion/delete_case6.js.html +++ b/file/src/deletion/delete_case6.js.html @@ -124,7 +124,7 @@
    diff --git a/file/src/deletion/delete_one_child.js.html b/file/src/deletion/delete_one_child.js.html index 40f0a32..5112441 100644 --- a/file/src/deletion/delete_one_child.js.html +++ b/file/src/deletion/delete_one_child.js.html @@ -120,7 +120,7 @@
    diff --git a/file/src/deletion/index.js.html b/file/src/deletion/index.js.html index 226dff8..7b12170 100644 --- a/file/src/deletion/index.js.html +++ b/file/src/deletion/index.js.html @@ -81,7 +81,7 @@
    diff --git a/file/src/deletion/replace_node.js.html b/file/src/deletion/replace_node.js.html index bfbc99c..a116bee 100644 --- a/file/src/deletion/replace_node.js.html +++ b/file/src/deletion/replace_node.js.html @@ -91,7 +91,7 @@
    diff --git a/file/src/family/grandparent.js.html b/file/src/family/grandparent.js.html index c6e9f3e..611d503 100644 --- a/file/src/family/grandparent.js.html +++ b/file/src/family/grandparent.js.html @@ -86,7 +86,7 @@
    diff --git a/file/src/family/index.js.html b/file/src/family/index.js.html index aa047e7..b03c201 100644 --- a/file/src/family/index.js.html +++ b/file/src/family/index.js.html @@ -77,7 +77,7 @@
    diff --git a/file/src/family/predecessor.js.html b/file/src/family/predecessor.js.html index 5f716c1..728cd3f 100644 --- a/file/src/family/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -90,7 +90,7 @@
    diff --git a/file/src/family/sibling.js.html b/file/src/family/sibling.js.html index f58d0e5..0b53d4b 100644 --- a/file/src/family/sibling.js.html +++ b/file/src/family/sibling.js.html @@ -88,7 +88,7 @@
    diff --git a/file/src/family/uncle.js.html b/file/src/family/uncle.js.html index c0b1b2a..16b750e 100644 --- a/file/src/family/uncle.js.html +++ b/file/src/family/uncle.js.html @@ -91,7 +91,7 @@
    diff --git a/file/src/index.js.html b/file/src/index.js.html index 52cdadd..4a8b968 100644 --- a/file/src/index.js.html +++ b/file/src/index.js.html @@ -82,7 +82,7 @@
    diff --git a/file/src/insertion/index.js.html b/file/src/insertion/index.js.html index 8fb03c2..31df863 100644 --- a/file/src/insertion/index.js.html +++ b/file/src/insertion/index.js.html @@ -79,7 +79,7 @@
    diff --git a/file/src/insertion/insert.js.html b/file/src/insertion/insert.js.html index 03d0a3d..836d6d7 100644 --- a/file/src/insertion/insert.js.html +++ b/file/src/insertion/insert.js.html @@ -127,7 +127,7 @@
    diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html index ba2c258..5e3b93e 100644 --- a/file/src/insertion/insert_case1.js.html +++ b/file/src/insertion/insert_case1.js.html @@ -96,7 +96,7 @@
    diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index eb9413b..c8bba09 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -99,7 +99,7 @@
    diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index 40d4d67..ce3d52c 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -115,7 +115,7 @@
    diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index 1a88017..88d2781 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -159,7 +159,7 @@
    diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case5.js.html index 8e09d69..8430d22 100644 --- a/file/src/insertion/insert_case5.js.html +++ b/file/src/insertion/insert_case5.js.html @@ -122,7 +122,7 @@
    diff --git a/file/src/rotate/index.js.html b/file/src/rotate/index.js.html index e8dc9cf..dce9e12 100644 --- a/file/src/rotate/index.js.html +++ b/file/src/rotate/index.js.html @@ -75,7 +75,7 @@
    diff --git a/file/src/rotate/rotate_left.js.html b/file/src/rotate/rotate_left.js.html index 953b140..79a5065 100644 --- a/file/src/rotate/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -108,7 +108,7 @@
    diff --git a/file/src/rotate/rotate_right.js.html b/file/src/rotate/rotate_right.js.html index b325fa6..0f729ab 100644 --- a/file/src/rotate/rotate_right.js.html +++ b/file/src/rotate/rotate_right.js.html @@ -109,7 +109,7 @@
    diff --git a/file/src/search/index.js.html b/file/src/search/index.js.html index 2965426..1bc4ed5 100644 --- a/file/src/search/index.js.html +++ b/file/src/search/index.js.html @@ -74,7 +74,7 @@
    diff --git a/file/src/search/search.js.html b/file/src/search/search.js.html index ec97afd..e234789 100644 --- a/file/src/search/search.js.html +++ b/file/src/search/search.js.html @@ -106,7 +106,7 @@
    diff --git a/file/src/traversal/index.js.html b/file/src/traversal/index.js.html index 7a6da3b..9961846 100644 --- a/file/src/traversal/index.js.html +++ b/file/src/traversal/index.js.html @@ -75,7 +75,7 @@
    diff --git a/file/src/traversal/inordertraversal.js.html b/file/src/traversal/inordertraversal.js.html index 7781ddd..3d09a22 100644 --- a/file/src/traversal/inordertraversal.js.html +++ b/file/src/traversal/inordertraversal.js.html @@ -99,7 +99,7 @@
    diff --git a/file/src/traversal/rangetraversal.js.html b/file/src/traversal/rangetraversal.js.html index 1902022..1aeaf36 100644 --- a/file/src/traversal/rangetraversal.js.html +++ b/file/src/traversal/rangetraversal.js.html @@ -104,7 +104,7 @@
    diff --git a/function/index.html b/function/index.html index 22a5047..9b5a9c2 100644 --- a/function/index.html +++ b/function/index.html @@ -2600,7 +2600,7 @@

    Return:

    diff --git a/identifiers.html b/identifiers.html index 8524ad8..3bbc932 100644 --- a/identifiers.html +++ b/identifiers.html @@ -912,7 +912,7 @@ diff --git a/index.html b/index.html index 2742ebb..b6029a8 100644 --- a/index.html +++ b/index.html @@ -85,7 +85,7 @@ diff --git a/manual/example.html b/manual/example.html index 5e1a90c..0a0dbcc 100644 --- a/manual/example.html +++ b/manual/example.html @@ -84,7 +84,7 @@

    Referen diff --git a/manual/index.html b/manual/index.html index a3c1e25..a9fbc82 100644 --- a/manual/index.html +++ b/manual/index.html @@ -116,7 +116,7 @@

    Referen diff --git a/manual/installation.html b/manual/installation.html index 2db23bf..b50dd81 100644 --- a/manual/installation.html +++ b/manual/installation.html @@ -83,9 +83,7 @@

    Referen jspm or npm.

    jspm

    -
    jspm install github:aureooms/es-red-black-tree
    -# or
    -jspm install npm:aureooms-es-red-black-tree
    +
    jspm install npm:aureooms-es-red-black-tree
     

    npm

    npm install aureooms-es-red-black-tree --save
    @@ -95,7 +93,7 @@ 

    npm

    diff --git a/manual/overview.html b/manual/overview.html index d8dc893..5ed4e5b 100644 --- a/manual/overview.html +++ b/manual/overview.html @@ -84,7 +84,7 @@

    Referen diff --git a/manual/usage.html b/manual/usage.html index 2f0eaf5..ac54494 100644 --- a/manual/usage.html +++ b/manual/usage.html @@ -102,7 +102,7 @@

    npm

    diff --git a/package.json b/package.json index 2ffe1a7..c2226d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aureooms-es-red-black-tree", - "version": "1.0.2", + "version": "2.0.5", "author": "aureooms", "license": "AGPL-3.0", "description": "red-black tree library for JavaScript", @@ -19,10 +19,12 @@ "url": "https://github.com/aureooms/es-red-black-tree/issues" }, "scripts": { - "test": "./node_modules/.bin/ava ./test/src --concurrency 4", - "cover": "./node_modules/.bin/nyc --reporter=lcov npm test" + "build": "babel src -d lib", + "prepublish": "npm run build", + "test": "ava ./test/src --concurrency 4", + "cover": "nyc --reporter=lcov npm test" }, - "main": "src/index.js", + "main": "lib/index.js", "dependencies": { "chalk": "^1.1.3" }, @@ -30,16 +32,16 @@ "aureooms-js-compare": "^1.4.5", "aureooms-js-itertools": "^1.3.0", "aureooms-js-random": "^1.0.2", - "ava": "^0.15.2", - "babel-cli": "^6.5.1", - "babel-plugin-transform-runtime": "^6.5.2", - "babel-polyfill": "^6.5.0", - "babel-preset-es2015": "^6.5.0", - "babel-preset-es2016": "^6.11.3", - "codeclimate-test-reporter": "^0.3.1", - "coveralls": "^2.11.6", - "esdoc": "^0.4.5", - "nyc": "^7.0.0" + "ava": "^0.16.0", + "babel-cli": "^6.16.0", + "babel-plugin-transform-runtime": "^6.15.0", + "babel-polyfill": "^6.16.0", + "babel-preset-latest": "^6.16.0", + "codeclimate-test-reporter": "^0.4.0", + "coveralls": "^2.11.14", + "esdoc": "^0.4.8", + "jspm": "^0.16.46", + "nyc": "^8.3.1" }, "ava": { "require": [ @@ -49,13 +51,19 @@ }, "babel": { "presets": [ - "es2015", - "es2016" + "latest" ], "env": { "development": { "sourceMaps": "inline" } } + }, + "jspm": { + "devDependencies": { + "babel": "npm:babel-core@^5.8.24", + "babel-runtime": "npm:babel-runtime@^5.8.24", + "core-js": "npm:core-js@^1.1.4" + } } } diff --git a/source.html b/source.html index 0b7acf1..85ac56e 100644 --- a/source.html +++ b/source.html @@ -88,7 +88,7 @@ 100 %1/1 440 byte 21 - 2016-07-07 13:36:30 (UTC) + 2016-07-01 19:26:16 (UTC) src/adt/Node.js @@ -96,7 +96,7 @@ 100 %1/1 599 byte 25 - 2016-07-07 13:48:31 (UTC) + 2016-07-01 19:26:16 (UTC) src/adt/RedBlackTree.js @@ -104,7 +104,7 @@ 85 %12/14 4355 byte 190 - 2016-07-07 14:47:21 (UTC) + 2016-07-01 19:26:16 (UTC) src/adt/index.js @@ -112,7 +112,7 @@ - 83 byte 3 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/color/BLACK.js @@ -120,7 +120,7 @@ 100 %1/1 56 byte 4 - 2016-07-07 14:47:49 (UTC) + 2016-07-01 19:26:16 (UTC) src/color/RED.js @@ -128,7 +128,7 @@ 100 %1/1 52 byte 4 - 2016-07-07 14:48:01 (UTC) + 2016-07-01 19:26:16 (UTC) src/color/index.js @@ -136,7 +136,7 @@ - 50 byte 2 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/debug/debug.js @@ -144,7 +144,7 @@ 100 %1/1 483 byte 20 - 2016-07-07 14:50:33 (UTC) + 2016-07-01 19:26:16 (UTC) src/debug/index.js @@ -152,7 +152,7 @@ - 26 byte 1 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/delete_case1.js @@ -160,7 +160,7 @@ 100 %1/1 449 byte 17 - 2016-07-01 13:06:21 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/delete_case2.js @@ -168,7 +168,7 @@ 100 %1/1 1135 byte 41 - 2016-07-01 13:59:23 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/delete_case3.js @@ -176,7 +176,7 @@ 100 %1/1 1289 byte 45 - 2016-07-01 14:06:01 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/delete_case4.js @@ -184,7 +184,7 @@ 100 %1/1 1449 byte 47 - 2016-07-01 14:32:44 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/delete_case5.js @@ -192,7 +192,7 @@ 100 %1/1 1844 byte 60 - 2016-07-01 14:42:36 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/delete_case6.js @@ -200,7 +200,7 @@ 100 %1/1 1515 byte 51 - 2016-07-01 15:33:14 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/delete_one_child.js @@ -208,7 +208,7 @@ 100 %1/1 1427 byte 47 - 2016-07-01 12:53:31 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/index.js @@ -216,7 +216,7 @@ - 268 byte 8 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/deletion/replace_node.js @@ -224,7 +224,7 @@ 100 %1/1 395 byte 18 - 2016-07-07 18:51:41 (UTC) + 2016-07-01 19:26:16 (UTC) src/family/grandparent.js @@ -232,7 +232,7 @@ 100 %1/1 321 byte 13 - 2016-07-07 14:54:12 (UTC) + 2016-07-01 19:26:16 (UTC) src/family/index.js @@ -240,7 +240,7 @@ - 118 byte 4 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/family/predecessor.js @@ -248,7 +248,7 @@ 100 %1/1 379 byte 17 - 2016-07-07 15:00:29 (UTC) + 2016-07-01 19:26:16 (UTC) src/family/sibling.js @@ -256,7 +256,7 @@ 100 %1/1 373 byte 15 - 2016-07-07 15:01:55 (UTC) + 2016-07-01 19:26:16 (UTC) src/family/uncle.js @@ -264,7 +264,7 @@ 100 %1/1 454 byte 18 - 2016-07-07 15:07:05 (UTC) + 2016-07-01 19:26:16 (UTC) src/index.js @@ -272,7 +272,7 @@ - 246 byte 9 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/insertion/index.js @@ -280,7 +280,7 @@ - 192 byte 6 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/insertion/insert.js @@ -288,7 +288,7 @@ 100 %1/1 1145 byte 54 - 2016-07-07 13:49:31 (UTC) + 2016-07-01 19:26:16 (UTC) src/insertion/insert_case1.js @@ -296,7 +296,7 @@ 100 %1/1 392 byte 23 - 2016-07-07 16:33:57 (UTC) + 2016-07-01 19:26:16 (UTC) src/insertion/insert_case2.js @@ -304,7 +304,7 @@ 100 %1/1 455 byte 26 - 2016-07-07 16:34:06 (UTC) + 2016-07-01 19:26:16 (UTC) src/insertion/insert_case3.js @@ -312,7 +312,7 @@ 100 %1/1 1062 byte 42 - 2016-07-07 16:33:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/insertion/insert_case4.js @@ -320,7 +320,7 @@ 100 %1/1 2215 byte 86 - 2016-07-07 16:15:21 (UTC) + 2016-07-01 19:26:16 (UTC) src/insertion/insert_case5.js @@ -328,7 +328,7 @@ 100 %1/1 1380 byte 49 - 2016-07-07 16:32:23 (UTC) + 2016-07-01 19:26:16 (UTC) src/rotate/index.js @@ -336,7 +336,7 @@ - 65 byte 2 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/rotate/rotate_left.js @@ -344,7 +344,7 @@ 100 %1/1 645 byte 35 - 2016-07-07 15:05:23 (UTC) + 2016-07-01 19:26:16 (UTC) src/rotate/rotate_right.js @@ -352,7 +352,7 @@ 100 %1/1 655 byte 36 - 2016-07-07 15:05:09 (UTC) + 2016-07-01 19:26:16 (UTC) src/search/index.js @@ -360,7 +360,7 @@ - 27 byte 1 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/search/search.js @@ -368,7 +368,7 @@ 100 %1/1 532 byte 33 - 2016-07-07 13:47:51 (UTC) + 2016-07-01 19:26:16 (UTC) src/traversal/index.js @@ -376,7 +376,7 @@ - 72 byte 2 - 2016-07-07 18:49:16 (UTC) + 2016-07-01 19:26:16 (UTC) src/traversal/inordertraversal.js @@ -384,7 +384,7 @@ 100 %1/1 701 byte 26 - 2016-07-07 13:49:55 (UTC) + 2016-07-01 19:26:16 (UTC) src/traversal/rangetraversal.js @@ -392,14 +392,14 @@ 100 %1/1 1214 byte 31 - 2016-07-07 13:48:49 (UTC) + 2016-07-01 19:26:16 (UTC) diff --git a/variable/index.html b/variable/index.html index fc377ac..eaa993a 100644 --- a/variable/index.html +++ b/variable/index.html @@ -215,7 +215,7 @@

    From ae917fb8b0df2df2b0d023f5580b0a722b0adfdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Tue, 1 Nov 2016 22:19:48 +0100 Subject: [PATCH 13/26] esdoc update --- manual/example.html | 4 +-- manual/index.html | 8 ++--- manual/installation.html | 4 +-- manual/overview.html | 4 +-- manual/usage.html | 27 +++++--------- source.html | 78 ++++++++++++++++++++-------------------- 6 files changed, 53 insertions(+), 72 deletions(-) diff --git a/manual/example.html b/manual/example.html index 0a0dbcc..5a54f2a 100644 --- a/manual/example.html +++ b/manual/example.html @@ -51,9 +51,7 @@

    Usage

    +

    Example

    diff --git a/manual/index.html b/manual/index.html index a9fbc82..73d489d 100644 --- a/manual/index.html +++ b/manual/index.html @@ -51,9 +51,7 @@

    Usage

    +

    Example

    @@ -93,9 +91,7 @@

    Usage

    +

    Example

    diff --git a/manual/installation.html b/manual/installation.html index b50dd81..c2b3988 100644 --- a/manual/installation.html +++ b/manual/installation.html @@ -51,9 +51,7 @@

    Usage

    +

    Example

    diff --git a/manual/overview.html b/manual/overview.html index 5ed4e5b..74a741e 100644 --- a/manual/overview.html +++ b/manual/overview.html @@ -51,9 +51,7 @@

    Usage

    +

    Example

    diff --git a/manual/usage.html b/manual/usage.html index ac54494..d1ab943 100644 --- a/manual/usage.html +++ b/manual/usage.html @@ -51,9 +51,7 @@

    Usage

    +

    Example

    @@ -79,24 +77,17 @@

    Referen » Usage

    -

    Depending on the syntax used by this code you will need to pass the source -through a transpiler, for example babel.

    -

    jspm

    -

    Configure jspm to transpile all the code. Then

    -
    let redblacktree = require( 'github:aureooms/es-red-black-tree' ) ;
    +  

    The code needs a ES2015+ polyfill to work, for example +babel-polyfill.

    +
    require( 'babel-polyfill' ) ;
     // or
    -import redblacktree from 'aureooms-es-red-black-tree' ;
    +import 'babel-polyfill' ;
     
    -

    npm

    -

    Configure your code to transpile dependencies on the fly (for example with -babel-register). Then you can

    -
    import redblacktree from 'aureooms-es-red-black-tree' ;
    +

    Then

    +
    const redblacktree = require( 'aureooms-js-red-black-tree' ) ;
    +// or
    +import redblacktree from 'aureooms-js-red-black-tree' ;
     
    -

    Additionally, for the browser, you can configure -rollup, -browserify, -or webpack to transpile and package the -dependencies with your code.

    diff --git a/source.html b/source.html index 85ac56e..89ed5c7 100644 --- a/source.html +++ b/source.html @@ -88,7 +88,7 @@ 100 %1/1 440 byte 21 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/adt/Node.js @@ -96,7 +96,7 @@ 100 %1/1 599 byte 25 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/adt/RedBlackTree.js @@ -104,7 +104,7 @@ 85 %12/14 4355 byte 190 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/adt/index.js @@ -112,7 +112,7 @@ - 83 byte 3 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/color/BLACK.js @@ -120,7 +120,7 @@ 100 %1/1 56 byte 4 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/color/RED.js @@ -128,7 +128,7 @@ 100 %1/1 52 byte 4 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/color/index.js @@ -136,7 +136,7 @@ - 50 byte 2 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/debug/debug.js @@ -144,7 +144,7 @@ 100 %1/1 483 byte 20 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/debug/index.js @@ -152,7 +152,7 @@ - 26 byte 1 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/delete_case1.js @@ -160,7 +160,7 @@ 100 %1/1 449 byte 17 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/delete_case2.js @@ -168,7 +168,7 @@ 100 %1/1 1135 byte 41 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/delete_case3.js @@ -176,7 +176,7 @@ 100 %1/1 1289 byte 45 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/delete_case4.js @@ -184,7 +184,7 @@ 100 %1/1 1449 byte 47 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/delete_case5.js @@ -192,7 +192,7 @@ 100 %1/1 1844 byte 60 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/delete_case6.js @@ -200,7 +200,7 @@ 100 %1/1 1515 byte 51 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/delete_one_child.js @@ -208,7 +208,7 @@ 100 %1/1 1427 byte 47 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/index.js @@ -216,7 +216,7 @@ - 268 byte 8 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/deletion/replace_node.js @@ -224,7 +224,7 @@ 100 %1/1 395 byte 18 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/family/grandparent.js @@ -232,7 +232,7 @@ 100 %1/1 321 byte 13 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/family/index.js @@ -240,7 +240,7 @@ - 118 byte 4 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/family/predecessor.js @@ -248,7 +248,7 @@ 100 %1/1 379 byte 17 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/family/sibling.js @@ -256,7 +256,7 @@ 100 %1/1 373 byte 15 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/family/uncle.js @@ -264,7 +264,7 @@ 100 %1/1 454 byte 18 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/index.js @@ -272,7 +272,7 @@ - 246 byte 9 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/insertion/index.js @@ -280,7 +280,7 @@ - 192 byte 6 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/insertion/insert.js @@ -288,7 +288,7 @@ 100 %1/1 1145 byte 54 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/insertion/insert_case1.js @@ -296,7 +296,7 @@ 100 %1/1 392 byte 23 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/insertion/insert_case2.js @@ -304,7 +304,7 @@ 100 %1/1 455 byte 26 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/insertion/insert_case3.js @@ -312,7 +312,7 @@ 100 %1/1 1062 byte 42 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/insertion/insert_case4.js @@ -320,7 +320,7 @@ 100 %1/1 2215 byte 86 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/insertion/insert_case5.js @@ -328,7 +328,7 @@ 100 %1/1 1380 byte 49 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/rotate/index.js @@ -336,7 +336,7 @@ - 65 byte 2 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/rotate/rotate_left.js @@ -344,7 +344,7 @@ 100 %1/1 645 byte 35 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/rotate/rotate_right.js @@ -352,7 +352,7 @@ 100 %1/1 655 byte 36 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/search/index.js @@ -360,7 +360,7 @@ - 27 byte 1 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/search/search.js @@ -368,7 +368,7 @@ 100 %1/1 532 byte 33 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/traversal/index.js @@ -376,7 +376,7 @@ - 72 byte 2 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/traversal/inordertraversal.js @@ -384,7 +384,7 @@ 100 %1/1 701 byte 26 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) src/traversal/rangetraversal.js @@ -392,7 +392,7 @@ 100 %1/1 1214 byte 31 - 2016-07-01 19:26:16 (UTC) + 2016-11-03 21:01:16 (UTC) From fb9f2094b736db471dadf5f73bccb69467531845 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Tue, 1 Nov 2016 23:55:40 +0100 Subject: [PATCH 14/26] esdoc update --- package.json | 6 ++-- source.html | 78 ++++++++++++++++++++++++++-------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/package.json b/package.json index c2226d0..88eb651 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "aureooms-es-red-black-tree", - "version": "2.0.5", - "author": "aureooms", + "version": "2.0.6", + "author": "Aurélien Ooms ", "license": "AGPL-3.0", "description": "red-black tree library for JavaScript", "keywords": [ @@ -21,7 +21,7 @@ "scripts": { "build": "babel src -d lib", "prepublish": "npm run build", - "test": "ava ./test/src --concurrency 4", + "test": "ava ./test/src", "cover": "nyc --reporter=lcov npm test" }, "main": "lib/index.js", diff --git a/source.html b/source.html index 89ed5c7..38d3cf6 100644 --- a/source.html +++ b/source.html @@ -88,7 +88,7 @@ 100 %1/1 440 byte 21 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/adt/Node.js @@ -96,7 +96,7 @@ 100 %1/1 599 byte 25 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/adt/RedBlackTree.js @@ -104,7 +104,7 @@ 85 %12/14 4355 byte 190 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/adt/index.js @@ -112,7 +112,7 @@ - 83 byte 3 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/color/BLACK.js @@ -120,7 +120,7 @@ 100 %1/1 56 byte 4 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/color/RED.js @@ -128,7 +128,7 @@ 100 %1/1 52 byte 4 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/color/index.js @@ -136,7 +136,7 @@ - 50 byte 2 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/debug/debug.js @@ -144,7 +144,7 @@ 100 %1/1 483 byte 20 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/debug/index.js @@ -152,7 +152,7 @@ - 26 byte 1 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/delete_case1.js @@ -160,7 +160,7 @@ 100 %1/1 449 byte 17 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/delete_case2.js @@ -168,7 +168,7 @@ 100 %1/1 1135 byte 41 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/delete_case3.js @@ -176,7 +176,7 @@ 100 %1/1 1289 byte 45 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/delete_case4.js @@ -184,7 +184,7 @@ 100 %1/1 1449 byte 47 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/delete_case5.js @@ -192,7 +192,7 @@ 100 %1/1 1844 byte 60 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/delete_case6.js @@ -200,7 +200,7 @@ 100 %1/1 1515 byte 51 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/delete_one_child.js @@ -208,7 +208,7 @@ 100 %1/1 1427 byte 47 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/index.js @@ -216,7 +216,7 @@ - 268 byte 8 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/deletion/replace_node.js @@ -224,7 +224,7 @@ 100 %1/1 395 byte 18 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/family/grandparent.js @@ -232,7 +232,7 @@ 100 %1/1 321 byte 13 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/family/index.js @@ -240,7 +240,7 @@ - 118 byte 4 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/family/predecessor.js @@ -248,7 +248,7 @@ 100 %1/1 379 byte 17 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/family/sibling.js @@ -256,7 +256,7 @@ 100 %1/1 373 byte 15 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/family/uncle.js @@ -264,7 +264,7 @@ 100 %1/1 454 byte 18 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/index.js @@ -272,7 +272,7 @@ - 246 byte 9 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/insertion/index.js @@ -280,7 +280,7 @@ - 192 byte 6 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/insertion/insert.js @@ -288,7 +288,7 @@ 100 %1/1 1145 byte 54 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/insertion/insert_case1.js @@ -296,7 +296,7 @@ 100 %1/1 392 byte 23 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/insertion/insert_case2.js @@ -304,7 +304,7 @@ 100 %1/1 455 byte 26 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/insertion/insert_case3.js @@ -312,7 +312,7 @@ 100 %1/1 1062 byte 42 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/insertion/insert_case4.js @@ -320,7 +320,7 @@ 100 %1/1 2215 byte 86 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/insertion/insert_case5.js @@ -328,7 +328,7 @@ 100 %1/1 1380 byte 49 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/rotate/index.js @@ -336,7 +336,7 @@ - 65 byte 2 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/rotate/rotate_left.js @@ -344,7 +344,7 @@ 100 %1/1 645 byte 35 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/rotate/rotate_right.js @@ -352,7 +352,7 @@ 100 %1/1 655 byte 36 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/search/index.js @@ -360,7 +360,7 @@ - 27 byte 1 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/search/search.js @@ -368,7 +368,7 @@ 100 %1/1 532 byte 33 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/traversal/index.js @@ -376,7 +376,7 @@ - 72 byte 2 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/traversal/inordertraversal.js @@ -384,7 +384,7 @@ 100 %1/1 701 byte 26 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) src/traversal/rangetraversal.js @@ -392,7 +392,7 @@ 100 %1/1 1214 byte 31 - 2016-11-03 21:01:16 (UTC) + 2016-11-03 21:19:53 (UTC) From 816180b3ad7c51ee04f80f14d3d4e16dd12d3da4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Sat, 5 Nov 2016 19:49:37 +0100 Subject: [PATCH 15/26] esdoc update --- manual/installation.html | 2 +- manual/usage.html | 4 +- package.json | 81 ++++++++++++++++++---------------------- source.html | 78 +++++++++++++++++++------------------- 4 files changed, 78 insertions(+), 87 deletions(-) diff --git a/manual/installation.html b/manual/installation.html index c2b3988..2381e3e 100644 --- a/manual/installation.html +++ b/manual/installation.html @@ -77,7 +77,7 @@

    Referen » Installation -

    Can be managed through +

    Can be managed using jspm or npm.

    jspm

    diff --git a/manual/usage.html b/manual/usage.html index d1ab943..7227ce3 100644 --- a/manual/usage.html +++ b/manual/usage.html @@ -84,9 +84,9 @@

    Referen import 'babel-polyfill' ;

    Then

    -
    const redblacktree = require( 'aureooms-js-red-black-tree' ) ;
    +
    const redblacktree = require( 'aureooms-es-red-black-tree' ) ;
     // or
    -import redblacktree from 'aureooms-js-red-black-tree' ;
    +import redblacktree from 'aureooms-es-red-black-tree' ;
     
    diff --git a/package.json b/package.json index 88eb651..0668178 100644 --- a/package.json +++ b/package.json @@ -1,69 +1,60 @@ { "name": "aureooms-es-red-black-tree", + "description": "Red-black tree library for JavaScript", "version": "2.0.6", "author": "Aurélien Ooms ", - "license": "AGPL-3.0", - "description": "red-black tree library for JavaScript", - "keywords": [ - "balanced binary search tree", - "bst", - "data structure", - "red-black tree" - ], - "homepage": "https://aureooms.github.io/es-red-black-tree", - "repository": { - "type": "git", - "url": "https://github.com/aureooms/es-red-black-tree" + "ava": { + "require": [ + "babel-polyfill", + "babel-register" + ] + }, + "babel": { + "presets": [ + "latest" + ], + "env": { + "development": { + "sourceMaps": "inline" + } + } }, "bugs": { "url": "https://github.com/aureooms/es-red-black-tree/issues" }, - "scripts": { - "build": "babel src -d lib", - "prepublish": "npm run build", - "test": "ava ./test/src", - "cover": "nyc --reporter=lcov npm test" - }, - "main": "lib/index.js", "dependencies": { "chalk": "^1.1.3" }, "devDependencies": { "aureooms-js-compare": "^1.4.5", - "aureooms-js-itertools": "^1.3.0", + "aureooms-js-itertools": "^3.0.0", "aureooms-js-random": "^1.0.2", "ava": "^0.16.0", - "babel-cli": "^6.16.0", - "babel-plugin-transform-runtime": "^6.15.0", + "babel-cli": "^6.18.0", "babel-polyfill": "^6.16.0", "babel-preset-latest": "^6.16.0", "codeclimate-test-reporter": "^0.4.0", "coveralls": "^2.11.14", "esdoc": "^0.4.8", - "jspm": "^0.16.46", - "nyc": "^8.3.1" + "nyc": "^8.4.0" }, - "ava": { - "require": [ - "babel-polyfill", - "babel-register" - ] - }, - "babel": { - "presets": [ - "latest" - ], - "env": { - "development": { - "sourceMaps": "inline" - } - } + "homepage": "https://aureooms.github.io/es-red-black-tree", + "keywords": [ + "balanced binary search tree", + "bst", + "data structure", + "red-black tree" + ], + "license": "AGPL-3.0", + "main": "lib/index.js", + "repository": { + "type": "git", + "url": "https://github.com/aureooms/es-red-black-tree" }, - "jspm": { - "devDependencies": { - "babel": "npm:babel-core@^5.8.24", - "babel-runtime": "npm:babel-runtime@^5.8.24", - "core-js": "npm:core-js@^1.1.4" - } + "scripts": { + "build": "babel src -d lib", + "cover": "nyc --reporter=lcov npm test", + "prepublish": "npm run build", + "test": "ava ./test/src" } } diff --git a/source.html b/source.html index 38d3cf6..3e04a00 100644 --- a/source.html +++ b/source.html @@ -88,7 +88,7 @@ 100 %1/1 440 byte 21 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC)
    src/adt/Node.js @@ -96,7 +96,7 @@ 100 %1/1 599 byte 25 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/adt/RedBlackTree.js @@ -104,7 +104,7 @@ 85 %12/14 4355 byte 190 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/adt/index.js @@ -112,7 +112,7 @@ - 83 byte 3 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/color/BLACK.js @@ -120,7 +120,7 @@ 100 %1/1 56 byte 4 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/color/RED.js @@ -128,7 +128,7 @@ 100 %1/1 52 byte 4 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/color/index.js @@ -136,7 +136,7 @@ - 50 byte 2 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/debug/debug.js @@ -144,7 +144,7 @@ 100 %1/1 483 byte 20 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/debug/index.js @@ -152,7 +152,7 @@ - 26 byte 1 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/delete_case1.js @@ -160,7 +160,7 @@ 100 %1/1 449 byte 17 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/delete_case2.js @@ -168,7 +168,7 @@ 100 %1/1 1135 byte 41 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/delete_case3.js @@ -176,7 +176,7 @@ 100 %1/1 1289 byte 45 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/delete_case4.js @@ -184,7 +184,7 @@ 100 %1/1 1449 byte 47 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/delete_case5.js @@ -192,7 +192,7 @@ 100 %1/1 1844 byte 60 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/delete_case6.js @@ -200,7 +200,7 @@ 100 %1/1 1515 byte 51 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/delete_one_child.js @@ -208,7 +208,7 @@ 100 %1/1 1427 byte 47 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/index.js @@ -216,7 +216,7 @@ - 268 byte 8 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/deletion/replace_node.js @@ -224,7 +224,7 @@ 100 %1/1 395 byte 18 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/family/grandparent.js @@ -232,7 +232,7 @@ 100 %1/1 321 byte 13 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/family/index.js @@ -240,7 +240,7 @@ - 118 byte 4 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/family/predecessor.js @@ -248,7 +248,7 @@ 100 %1/1 379 byte 17 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/family/sibling.js @@ -256,7 +256,7 @@ 100 %1/1 373 byte 15 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/family/uncle.js @@ -264,7 +264,7 @@ 100 %1/1 454 byte 18 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/index.js @@ -272,7 +272,7 @@ - 246 byte 9 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/insertion/index.js @@ -280,7 +280,7 @@ - 192 byte 6 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/insertion/insert.js @@ -288,7 +288,7 @@ 100 %1/1 1145 byte 54 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/insertion/insert_case1.js @@ -296,7 +296,7 @@ 100 %1/1 392 byte 23 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/insertion/insert_case2.js @@ -304,7 +304,7 @@ 100 %1/1 455 byte 26 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/insertion/insert_case3.js @@ -312,7 +312,7 @@ 100 %1/1 1062 byte 42 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/insertion/insert_case4.js @@ -320,7 +320,7 @@ 100 %1/1 2215 byte 86 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/insertion/insert_case5.js @@ -328,7 +328,7 @@ 100 %1/1 1380 byte 49 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/rotate/index.js @@ -336,7 +336,7 @@ - 65 byte 2 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/rotate/rotate_left.js @@ -344,7 +344,7 @@ 100 %1/1 645 byte 35 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/rotate/rotate_right.js @@ -352,7 +352,7 @@ 100 %1/1 655 byte 36 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/search/index.js @@ -360,7 +360,7 @@ - 27 byte 1 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/search/search.js @@ -368,7 +368,7 @@ 100 %1/1 532 byte 33 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/traversal/index.js @@ -376,7 +376,7 @@ - 72 byte 2 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/traversal/inordertraversal.js @@ -384,7 +384,7 @@ 100 %1/1 701 byte 26 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) src/traversal/rangetraversal.js @@ -392,7 +392,7 @@ 100 %1/1 1214 byte 31 - 2016-11-03 21:19:53 (UTC) + 2016-11-03 22:55:43 (UTC) From 95ce0df3dc07bdd939ce490c82c82b8b329d18c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Ooms?= Date: Thu, 24 Nov 2016 16:54:07 +0100 Subject: [PATCH 16/26] esdoc update --- .../src/adt/RedBlackTree.js~RedBlackTree.html | 6 +- dump.json | 62 +++++----- file/src/adt/Leaf.js.html | 4 +- file/src/adt/Node.js.html | 4 +- file/src/adt/RedBlackTree.js.html | 4 +- file/src/adt/index.js.html | 4 +- file/src/color/BLACK.js.html | 4 +- file/src/color/RED.js.html | 4 +- file/src/color/index.js.html | 4 +- file/src/debug/debug.js.html | 4 +- file/src/debug/index.js.html | 4 +- file/src/deletion/delete_case1.js.html | 4 +- file/src/deletion/delete_case2.js.html | 4 +- file/src/deletion/delete_case3.js.html | 4 +- file/src/deletion/delete_case4.js.html | 4 +- file/src/deletion/delete_case5.js.html | 4 +- file/src/deletion/delete_case6.js.html | 4 +- file/src/deletion/delete_one_child.js.html | 4 +- file/src/deletion/index.js.html | 4 +- file/src/deletion/replace_node.js.html | 4 +- file/src/family/grandparent.js.html | 4 +- file/src/family/index.js.html | 4 +- file/src/family/predecessor.js.html | 4 +- file/src/family/sibling.js.html | 4 +- file/src/family/uncle.js.html | 4 +- file/src/index.js.html | 4 +- file/src/insertion/index.js.html | 4 +- file/src/insertion/insert.js.html | 4 +- file/src/insertion/insert_case1.js.html | 4 +- file/src/insertion/insert_case2.js.html | 4 +- file/src/insertion/insert_case3.js.html | 4 +- file/src/insertion/insert_case4.js.html | 4 +- file/src/insertion/insert_case5.js.html | 4 +- file/src/rotate/index.js.html | 4 +- file/src/rotate/rotate_left.js.html | 4 +- file/src/rotate/rotate_right.js.html | 4 +- file/src/search/index.js.html | 4 +- file/src/search/search.js.html | 4 +- file/src/traversal/index.js.html | 4 +- file/src/traversal/inordertraversal.js.html | 4 +- file/src/traversal/rangetraversal.js.html | 4 +- function/index.html | 56 ++++----- identifiers.html | 4 +- index.html | 28 ++--- manual/example.html | 2 +- manual/index.html | 2 +- manual/installation.html | 6 +- manual/overview.html | 2 +- manual/usage.html | 6 +- package.json | 18 +-- script/search_index.js | 116 +++++++++--------- source.html | 82 ++++++------- user/script/0-header.js | 4 +- variable/index.html | 8 +- 54 files changed, 279 insertions(+), 279 deletions(-) diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/adt/RedBlackTree.js~RedBlackTree.html index e152a43..4f75fd8 100644 --- a/class/src/adt/RedBlackTree.js~RedBlackTree.html +++ b/class/src/adt/RedBlackTree.js~RedBlackTree.html @@ -3,7 +3,7 @@ - RedBlackTree | aureooms/es-red-black-tree API Document + RedBlackTree | aureooms/js-red-black-tree API Document @@ -21,7 +21,7 @@ Reference Source Test - Repository + Repository

    Then

    -
    const redblacktree = require( 'aureooms-es-red-black-tree' ) ;
    +
    const redblacktree = require( 'aureooms-js-red-black-tree' ) ;
     // or
    -import redblacktree from 'aureooms-es-red-black-tree' ;
    +import redblacktree from 'aureooms-js-red-black-tree' ;
     
    diff --git a/package.json b/package.json index 0668178..f5e62aa 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "aureooms-es-red-black-tree", + "name": "aureooms-js-red-black-tree", "description": "Red-black tree library for JavaScript", - "version": "2.0.6", + "version": "2.0.7", "author": "Aurélien Ooms ", "ava": { "require": [ @@ -20,25 +20,25 @@ } }, "bugs": { - "url": "https://github.com/aureooms/es-red-black-tree/issues" + "url": "https://github.com/aureooms/js-red-black-tree/issues" }, "dependencies": { "chalk": "^1.1.3" }, "devDependencies": { "aureooms-js-compare": "^1.4.5", - "aureooms-js-itertools": "^3.0.0", + "aureooms-js-itertools": "^3.1.1", "aureooms-js-random": "^1.0.2", - "ava": "^0.16.0", + "ava": "^0.17.0", "babel-cli": "^6.18.0", "babel-polyfill": "^6.16.0", "babel-preset-latest": "^6.16.0", "codeclimate-test-reporter": "^0.4.0", - "coveralls": "^2.11.14", + "coveralls": "^2.11.15", "esdoc": "^0.4.8", - "nyc": "^8.4.0" + "nyc": "^10.0.0" }, - "homepage": "https://aureooms.github.io/es-red-black-tree", + "homepage": "https://aureooms.github.io/js-red-black-tree", "keywords": [ "balanced binary search tree", "bst", @@ -49,7 +49,7 @@ "main": "lib/index.js", "repository": { "type": "git", - "url": "https://github.com/aureooms/es-red-black-tree" + "url": "https://github.com/aureooms/js-red-black-tree" }, "scripts": { "build": "babel src -d lib", diff --git a/script/search_index.js b/script/search_index.js index 9c5283c..8615ca2 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -1,176 +1,176 @@ window.esdocSearchIndex = [ [ - "aureooms-es-red-black-tree/src/color/black.js~black", + "aureooms-js-red-black-tree/src/color/black.js~black", "variable/index.html#static-variable-BLACK", - "BLACK aureooms-es-red-black-tree/src/color/BLACK.js", + "BLACK aureooms-js-red-black-tree/src/color/BLACK.js", "variable" ], [ - "aureooms-es-red-black-tree/src/adt/leaf.js~leaf", + "aureooms-js-red-black-tree/src/adt/leaf.js~leaf", "function/index.html#static-function-Leaf", - "Leaf aureooms-es-red-black-tree/src/adt/Leaf.js", + "Leaf aureooms-js-red-black-tree/src/adt/Leaf.js", "function" ], [ - "aureooms-es-red-black-tree/src/adt/node.js~node", + "aureooms-js-red-black-tree/src/adt/node.js~node", "function/index.html#static-function-Node", - "Node aureooms-es-red-black-tree/src/adt/Node.js", + "Node aureooms-js-red-black-tree/src/adt/Node.js", "function" ], [ - "aureooms-es-red-black-tree/src/color/red.js~red", + "aureooms-js-red-black-tree/src/color/red.js~red", "variable/index.html#static-variable-RED", - "RED aureooms-es-red-black-tree/src/color/RED.js", + "RED aureooms-js-red-black-tree/src/color/RED.js", "variable" ], [ - "aureooms-es-red-black-tree/src/adt/redblacktree.js~redblacktree", + "aureooms-js-red-black-tree/src/adt/redblacktree.js~redblacktree", "class/src/adt/RedBlackTree.js~RedBlackTree.html", - "RedBlackTree aureooms-es-red-black-tree/src/adt/RedBlackTree.js", + "RedBlackTree aureooms-js-red-black-tree/src/adt/RedBlackTree.js", "class" ], [ - "aureooms-es-red-black-tree/src/debug/debug.js~debug", + "aureooms-js-red-black-tree/src/debug/debug.js~debug", "function/index.html#static-function-debug", - "debug aureooms-es-red-black-tree/src/debug/debug.js", + "debug aureooms-js-red-black-tree/src/debug/debug.js", "function" ], [ - "aureooms-es-red-black-tree/src/deletion/delete_case1.js~delete_case1", + "aureooms-js-red-black-tree/src/deletion/delete_case1.js~delete_case1", "function/index.html#static-function-delete_case1", - "delete_case1 aureooms-es-red-black-tree/src/deletion/delete_case1.js", + "delete_case1 aureooms-js-red-black-tree/src/deletion/delete_case1.js", "function" ], [ - "aureooms-es-red-black-tree/src/deletion/delete_case2.js~delete_case2", + "aureooms-js-red-black-tree/src/deletion/delete_case2.js~delete_case2", "function/index.html#static-function-delete_case2", - "delete_case2 aureooms-es-red-black-tree/src/deletion/delete_case2.js", + "delete_case2 aureooms-js-red-black-tree/src/deletion/delete_case2.js", "function" ], [ - "aureooms-es-red-black-tree/src/deletion/delete_case3.js~delete_case3", + "aureooms-js-red-black-tree/src/deletion/delete_case3.js~delete_case3", "function/index.html#static-function-delete_case3", - "delete_case3 aureooms-es-red-black-tree/src/deletion/delete_case3.js", + "delete_case3 aureooms-js-red-black-tree/src/deletion/delete_case3.js", "function" ], [ - "aureooms-es-red-black-tree/src/deletion/delete_case4.js~delete_case4", + "aureooms-js-red-black-tree/src/deletion/delete_case4.js~delete_case4", "function/index.html#static-function-delete_case4", - "delete_case4 aureooms-es-red-black-tree/src/deletion/delete_case4.js", + "delete_case4 aureooms-js-red-black-tree/src/deletion/delete_case4.js", "function" ], [ - "aureooms-es-red-black-tree/src/deletion/delete_case5.js~delete_case5", + "aureooms-js-red-black-tree/src/deletion/delete_case5.js~delete_case5", "function/index.html#static-function-delete_case5", - "delete_case5 aureooms-es-red-black-tree/src/deletion/delete_case5.js", + "delete_case5 aureooms-js-red-black-tree/src/deletion/delete_case5.js", "function" ], [ - "aureooms-es-red-black-tree/src/deletion/delete_case6.js~delete_case6", + "aureooms-js-red-black-tree/src/deletion/delete_case6.js~delete_case6", "function/index.html#static-function-delete_case6", - "delete_case6 aureooms-es-red-black-tree/src/deletion/delete_case6.js", + "delete_case6 aureooms-js-red-black-tree/src/deletion/delete_case6.js", "function" ], [ - "aureooms-es-red-black-tree/src/deletion/delete_one_child.js~delete_one_child", + "aureooms-js-red-black-tree/src/deletion/delete_one_child.js~delete_one_child", "function/index.html#static-function-delete_one_child", - "delete_one_child aureooms-es-red-black-tree/src/deletion/delete_one_child.js", + "delete_one_child aureooms-js-red-black-tree/src/deletion/delete_one_child.js", "function" ], [ - "aureooms-es-red-black-tree/src/family/grandparent.js~grandparent", + "aureooms-js-red-black-tree/src/family/grandparent.js~grandparent", "function/index.html#static-function-grandparent", - "grandparent aureooms-es-red-black-tree/src/family/grandparent.js", + "grandparent aureooms-js-red-black-tree/src/family/grandparent.js", "function" ], [ - "aureooms-es-red-black-tree/src/traversal/inordertraversal.js~inordertraversal", + "aureooms-js-red-black-tree/src/traversal/inordertraversal.js~inordertraversal", "function/index.html#static-function-inordertraversal", - "inordertraversal aureooms-es-red-black-tree/src/traversal/inordertraversal.js", + "inordertraversal aureooms-js-red-black-tree/src/traversal/inordertraversal.js", "function" ], [ - "aureooms-es-red-black-tree/src/insertion/insert.js~insert", + "aureooms-js-red-black-tree/src/insertion/insert.js~insert", "function/index.html#static-function-insert", - "insert aureooms-es-red-black-tree/src/insertion/insert.js", + "insert aureooms-js-red-black-tree/src/insertion/insert.js", "function" ], [ - "aureooms-es-red-black-tree/src/insertion/insert_case1.js~insert_case1", + "aureooms-js-red-black-tree/src/insertion/insert_case1.js~insert_case1", "function/index.html#static-function-insert_case1", - "insert_case1 aureooms-es-red-black-tree/src/insertion/insert_case1.js", + "insert_case1 aureooms-js-red-black-tree/src/insertion/insert_case1.js", "function" ], [ - "aureooms-es-red-black-tree/src/insertion/insert_case2.js~insert_case2", + "aureooms-js-red-black-tree/src/insertion/insert_case2.js~insert_case2", "function/index.html#static-function-insert_case2", - "insert_case2 aureooms-es-red-black-tree/src/insertion/insert_case2.js", + "insert_case2 aureooms-js-red-black-tree/src/insertion/insert_case2.js", "function" ], [ - "aureooms-es-red-black-tree/src/insertion/insert_case3.js~insert_case3", + "aureooms-js-red-black-tree/src/insertion/insert_case3.js~insert_case3", "function/index.html#static-function-insert_case3", - "insert_case3 aureooms-es-red-black-tree/src/insertion/insert_case3.js", + "insert_case3 aureooms-js-red-black-tree/src/insertion/insert_case3.js", "function" ], [ - "aureooms-es-red-black-tree/src/insertion/insert_case4.js~insert_case4", + "aureooms-js-red-black-tree/src/insertion/insert_case4.js~insert_case4", "function/index.html#static-function-insert_case4", - "insert_case4 aureooms-es-red-black-tree/src/insertion/insert_case4.js", + "insert_case4 aureooms-js-red-black-tree/src/insertion/insert_case4.js", "function" ], [ - "aureooms-es-red-black-tree/src/insertion/insert_case5.js~insert_case5", + "aureooms-js-red-black-tree/src/insertion/insert_case5.js~insert_case5", "function/index.html#static-function-insert_case5", - "insert_case5 aureooms-es-red-black-tree/src/insertion/insert_case5.js", + "insert_case5 aureooms-js-red-black-tree/src/insertion/insert_case5.js", "function" ], [ - "aureooms-es-red-black-tree/src/family/predecessor.js~predecessor", + "aureooms-js-red-black-tree/src/family/predecessor.js~predecessor", "function/index.html#static-function-predecessor", - "predecessor aureooms-es-red-black-tree/src/family/predecessor.js", + "predecessor aureooms-js-red-black-tree/src/family/predecessor.js", "function" ], [ - "aureooms-es-red-black-tree/src/traversal/rangetraversal.js~rangetraversal", + "aureooms-js-red-black-tree/src/traversal/rangetraversal.js~rangetraversal", "function/index.html#static-function-rangetraversal", - "rangetraversal aureooms-es-red-black-tree/src/traversal/rangetraversal.js", + "rangetraversal aureooms-js-red-black-tree/src/traversal/rangetraversal.js", "function" ], [ - "aureooms-es-red-black-tree/src/deletion/replace_node.js~replace_node", + "aureooms-js-red-black-tree/src/deletion/replace_node.js~replace_node", "function/index.html#static-function-replace_node", - "replace_node aureooms-es-red-black-tree/src/deletion/replace_node.js", + "replace_node aureooms-js-red-black-tree/src/deletion/replace_node.js", "function" ], [ - "aureooms-es-red-black-tree/src/rotate/rotate_left.js~rotate_left", + "aureooms-js-red-black-tree/src/rotate/rotate_left.js~rotate_left", "function/index.html#static-function-rotate_left", - "rotate_left aureooms-es-red-black-tree/src/rotate/rotate_left.js", + "rotate_left aureooms-js-red-black-tree/src/rotate/rotate_left.js", "function" ], [ - "aureooms-es-red-black-tree/src/rotate/rotate_right.js~rotate_right", + "aureooms-js-red-black-tree/src/rotate/rotate_right.js~rotate_right", "function/index.html#static-function-rotate_right", - "rotate_right aureooms-es-red-black-tree/src/rotate/rotate_right.js", + "rotate_right aureooms-js-red-black-tree/src/rotate/rotate_right.js", "function" ], [ - "aureooms-es-red-black-tree/src/search/search.js~search", + "aureooms-js-red-black-tree/src/search/search.js~search", "function/index.html#static-function-search", - "search aureooms-es-red-black-tree/src/search/search.js", + "search aureooms-js-red-black-tree/src/search/search.js", "function" ], [ - "aureooms-es-red-black-tree/src/family/sibling.js~sibling", + "aureooms-js-red-black-tree/src/family/sibling.js~sibling", "function/index.html#static-function-sibling", - "sibling aureooms-es-red-black-tree/src/family/sibling.js", + "sibling aureooms-js-red-black-tree/src/family/sibling.js", "function" ], [ - "aureooms-es-red-black-tree/src/family/uncle.js~uncle", + "aureooms-js-red-black-tree/src/family/uncle.js~uncle", "function/index.html#static-function-uncle", - "uncle aureooms-es-red-black-tree/src/family/uncle.js", + "uncle aureooms-js-red-black-tree/src/family/uncle.js", "function" ], [ diff --git a/source.html b/source.html index 3e04a00..8b93de8 100644 --- a/source.html +++ b/source.html @@ -3,7 +3,7 @@ - Source | aureooms/es-red-black-tree API Document + Source | aureooms/js-red-black-tree API Document @@ -21,7 +21,7 @@
    Reference Source Test - Repository + Repository
    diff --git a/file/src/adt/Node.js.html b/file/src/adt/Node.js.html index 8b523ea..b3c67ca 100644 --- a/file/src/adt/Node.js.html +++ b/file/src/adt/Node.js.html @@ -74,7 +74,7 @@ * @returns {Node} */ export function Node(color, key) { - this.color = color; + this._color = color; this.left = new Leaf(this); this.right = new Leaf(this); this.parent = null; @@ -87,7 +87,7 @@ * * @returns {Boolean} */ -Node.prototype.isleaf = function () { +Node.prototype.isLeaf = function () { return false; };
    diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/adt/RedBlackTree.js.html index b19771c..c00cf7f 100644 --- a/file/src/adt/RedBlackTree.js.html +++ b/file/src/adt/RedBlackTree.js.html @@ -87,6 +87,15 @@ this.root = null; } + /** + * Tells whether the tree is empty. + * + * @returns {boolean} true if empty, false otherwise. + */ + isEmpty() { + return this.root === null; + } + /** * Adds a key to the tree. * @@ -145,7 +154,7 @@ * @param {Node} node - The input node to delete. */ _delete(node) { - if (!node.left.isleaf()) { + if (!node.left.isLeaf()) { // Replace node's key with predecessor's key const pred = predecessor(node); node.key = pred.key; @@ -153,7 +162,7 @@ // note: this node can only have one non-leaf child // because the tree is a red-black tree delete_one_child(pred); - } else if (!node.right.isleaf()) { + } else if (!node.right.isLeaf()) { // Replace node's key with successor's key // If there is no left child, then there can only be one right // child. diff --git a/file/src/debug/debug.js.html b/file/src/debug/debug.js.html index 8447757..a1d1939 100644 --- a/file/src/debug/debug.js.html +++ b/file/src/debug/debug.js.html @@ -66,23 +66,29 @@
    import {BLACK} from '../color/BLACK.js';
     
     /**
    - * Recursively constructs a prettyprint string for the red-black tree rooted at
    - * <code>root</code>.
    + * Builds a debug function from color handlers.
      *
    - * @param {Node} root - The root of the tree.
    - * @returns {String}
    + * @param {Object} colors The colors to use.
    + * @returns {Function} The debug function.
      */
    -export function _debug({red, black}) {
    +export const _debug = ({red, black}) => {
    +	/**
    +	 * Recursively constructs a prettyprint string for the red-black tree rooted at
    +	 * <code>root</code>.
    +	 *
    +	 * @param {Node} root - The root of the tree.
    +	 * @returns {string}
    +	 */
     	const debug = (root) => {
    -		if (root.isleaf()) return black('L');
    +		if (root.isLeaf()) return black('L');
     
    -		const repr = root.color === BLACK ? black(root.key) : red(root.key);
    +		const repr = root._color === BLACK ? black(root.key) : red(root.key);
     
     		return `(${debug(root.left)}, ${repr}, ${debug(root.right)})`;
     	};
     
     	return debug;
    -}
    +};
     
    diff --git a/file/src/deletion/delete_case1.js.html b/file/src/deletion/delete_case1.js.html index 9b036a1..a082fd0 100644 --- a/file/src/deletion/delete_case1.js.html +++ b/file/src/deletion/delete_case1.js.html @@ -73,11 +73,11 @@ * * @param {Node} n - The input node. */ -export function delete_case1(n) { +export const delete_case1 = (n) => { // If n is the root, there is nothing to do: all paths go through n, and n // is black. if (n.parent !== null) delete_case2(n); -} +};
    diff --git a/file/src/deletion/delete_case2.js.html b/file/src/deletion/delete_case2.js.html index b0e6976..4ce123a 100644 --- a/file/src/deletion/delete_case2.js.html +++ b/file/src/deletion/delete_case2.js.html @@ -79,7 +79,7 @@ * * @param {Node} n - The input node. */ -export function delete_case2(n) { +export const delete_case2 = (n) => { const s = sibling(n); /** @@ -93,9 +93,9 @@ * / \ / \ / \ / \ * = = = = - - = = */ - if (s.color === RED) { - n.parent.color = RED; - s.color = BLACK; + if (s._color === RED) { + n.parent._color = RED; + s._color = BLACK; if (n === n.parent.left) rotate_left(n.parent); else rotate_right(n.parent); delete_case4(n); @@ -103,7 +103,7 @@ // Otherwise, go to case 3. else delete_case3(n); -} +};
    diff --git a/file/src/deletion/delete_case3.js.html b/file/src/deletion/delete_case3.js.html index 5eb72ed..8f6ce6e 100644 --- a/file/src/deletion/delete_case3.js.html +++ b/file/src/deletion/delete_case3.js.html @@ -79,7 +79,7 @@ * * @param {Node} n - The input node. */ -export function delete_case3(n) { +export const delete_case3 = (n) => { const s = sibling(n); /** @@ -96,17 +96,17 @@ * - - - - - - - - */ if ( - n.parent.color === BLACK && - s.left.color === BLACK && - s.right.color === BLACK + n.parent._color === BLACK && + s.left._color === BLACK && + s.right._color === BLACK ) { - s.color = RED; + s._color = RED; delete_case1(n.parent); } // Otherwise, go to case 4. else delete_case4(n); -} +};
    diff --git a/file/src/deletion/delete_case4.js.html b/file/src/deletion/delete_case4.js.html index 6ad4dec..21b6de6 100644 --- a/file/src/deletion/delete_case4.js.html +++ b/file/src/deletion/delete_case4.js.html @@ -79,7 +79,7 @@ * * @param {Node} n - The input node. */ -export function delete_case4(n) { +export const delete_case4 = (n) => { const s = sibling(n); /** @@ -98,17 +98,17 @@ */ if ( // The parent color test is always true when coming from case 2 - n.parent.color === RED && - s.left.color === BLACK && - s.right.color === BLACK + n.parent._color === RED && + s.left._color === BLACK && + s.right._color === BLACK ) { - s.color = RED; - n.parent.color = BLACK; + s._color = RED; + n.parent._color = BLACK; } // Otherwise, go to case 5. else delete_case5(n); -} +};
    diff --git a/file/src/deletion/delete_case5.js.html b/file/src/deletion/delete_case5.js.html index 7f80c94..f17d5ea 100644 --- a/file/src/deletion/delete_case5.js.html +++ b/file/src/deletion/delete_case5.js.html @@ -80,7 +80,7 @@ * * @param {Node} n - The input node. */ -export function delete_case5(n) { +export const delete_case5 = (n) => { const s = sibling(n); // The following statements just force the red n's sibling child to be on @@ -98,11 +98,11 @@ * / \ * - - */ - if (n === n.parent.left && s.right.color === BLACK) { - s.color = RED; - s.left.color = BLACK; + if (n === n.parent.left && s.right._color === BLACK) { + s._color = RED; + s.left._color = BLACK; rotate_right(s); - } else if (n === n.parent.right && s.left.color === BLACK) { + } else if (n === n.parent.right && s.left._color === BLACK) { /** * ? ? * / \ / \ @@ -114,13 +114,13 @@ * / \ * - - */ - s.color = RED; - s.right.color = BLACK; + s._color = RED; + s.right._color = BLACK; rotate_left(s); } delete_case6(n); -} +}; diff --git a/file/src/deletion/delete_case6.js.html b/file/src/deletion/delete_case6.js.html index e7d3c6b..ff99ae3 100644 --- a/file/src/deletion/delete_case6.js.html +++ b/file/src/deletion/delete_case6.js.html @@ -79,7 +79,7 @@ * * @param {Node} n - The input node. */ -export function delete_case6(n) { +export const delete_case6 = (n) => { const s = sibling(n); /** @@ -100,20 +100,20 @@ * - - */ - s.color = n.parent.color; - n.parent.color = BLACK; + s._color = n.parent._color; + n.parent._color = BLACK; if (n === n.parent.left) { - s.right.color = BLACK; + s.right._color = BLACK; rotate_left(n.parent); } // Symmetric case else { - s.left.color = BLACK; + s.left._color = BLACK; rotate_right(n.parent); } -} +}; diff --git a/file/src/deletion/delete_one_child.js.html b/file/src/deletion/delete_one_child.js.html index 9b994a1..06b9c80 100644 --- a/file/src/deletion/delete_one_child.js.html +++ b/file/src/deletion/delete_one_child.js.html @@ -77,11 +77,11 @@ * * @param {Node} n - The node to delete. */ -export function delete_one_child(n) { +export const delete_one_child = (n) => { // Precondition: n has at most one non-leaf child. - // assert( n.right.isleaf() || n.left.isleaf()); + // assert( n.right.isLeaf() || n.left.isLeaf()); - // const child = n.right.isleaf() ? n.left : n.right; + // const child = n.right.isLeaf() ? n.left : n.right; // n.right is always a LEAF because either n is a subtree predecessor or it // is the only child of its parent by the red-black tree properties const child = n.left; @@ -91,11 +91,11 @@ // If n is black, deleting it reduces the black-height of every path going // through it by 1. - if (n.color === BLACK) { + if (n._color === BLACK) { // We can easily fix this when its left child is an // internal red node: change the color of the left child to black and // replace n with it. - if (child.color === RED) child.color = BLACK; + if (child._color === RED) child._color = BLACK; // Otherwise, there are more things to fix. else delete_case1(child); } @@ -104,7 +104,7 @@ // If n is red then its child can only be black. Replacing n with its // child suffices. // } -} +}; diff --git a/file/src/deletion/replace_node.js.html b/file/src/deletion/replace_node.js.html index faf13ec..c9f2402 100644 --- a/file/src/deletion/replace_node.js.html +++ b/file/src/deletion/replace_node.js.html @@ -69,7 +69,7 @@ * @param {Node} A - The node to replace. * @param {Node} B - The replacement node. */ -export function replace_node(A, B) { +export const replace_node = (A, B) => { // Assert( A.parent !== null ) ; // we never apply delete_one_child on the root so we are safe @@ -77,7 +77,7 @@ else A.parent.right = B; B.parent = A.parent; -} +}; diff --git a/file/src/family/grandparent.js.html b/file/src/family/grandparent.js.html index bdabc00..2ba4928 100644 --- a/file/src/family/grandparent.js.html +++ b/file/src/family/grandparent.js.html @@ -69,11 +69,11 @@ * @param {Node} node - The input node. * @returns {Node} */ -export function grandparent(node) { +export const grandparent = (node) => { // Assert((node !== null) && (node.parent !== null)); // We only call this function when node HAS a grandparent return node.parent.parent; -} +}; diff --git a/file/src/family/predecessor.js.html b/file/src/family/predecessor.js.html index 6eecff6..088b0bc 100644 --- a/file/src/family/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -70,14 +70,14 @@ * @param {Node} node - The input node. * @returns {Node} */ -export function predecessor(node) { - // Assert( !node.left.isleaf() ) ; +export const predecessor = (node) => { + // Assert( !node.left.isLeaf() ) ; let pred = node.left; - while (!pred.right.isleaf()) pred = pred.right; + while (!pred.right.isLeaf()) pred = pred.right; return pred; -} +}; diff --git a/file/src/family/sibling.js.html b/file/src/family/sibling.js.html index 40a48b5..0c33ca9 100644 --- a/file/src/family/sibling.js.html +++ b/file/src/family/sibling.js.html @@ -69,13 +69,13 @@ * @param {Node} node - The input node. * @returns {Node} */ -export function sibling(node) { +export const sibling = (node) => { // Assert((node !== null) && (node.parent !== null)); // We only use this function when node HAS a sibling so this case can never // happen. return node === node.parent.left ? node.parent.right : node.parent.left; -} +}; diff --git a/file/src/family/uncle.js.html b/file/src/family/uncle.js.html index c390ff7..01c7322 100644 --- a/file/src/family/uncle.js.html +++ b/file/src/family/uncle.js.html @@ -72,13 +72,13 @@ * @param {Node} node - The input node. * @returns {Node} */ -export function uncle(node) { +export const uncle = (node) => { const g = grandparent(node); // Assert( g !== null ) ; // this can never happen - if (node.parent === g.left) return g.right.isleaf() ? null : g.right; - return g.left.isleaf() ? null : g.left; -} + if (node.parent === g.left) return g.right.isLeaf() ? null : g.right; + return g.left.isLeaf() ? null : g.left; +}; diff --git a/file/src/insertion/insert.js.html b/file/src/insertion/insert.js.html index fe75c01..799c011 100644 --- a/file/src/insertion/insert.js.html +++ b/file/src/insertion/insert.js.html @@ -79,12 +79,12 @@ * @param {Node} B - The node to insert. * @returns {Node} B - The node that has been inserted. */ -export function insert(compare, A, B) { +export const insert = (compare, A, B) => { while (true) { if (compare(B.key, A.key) < 0) { const node = A.left; - if (node.isleaf()) { + if (node.isLeaf()) { A.left = B; break; } @@ -93,7 +93,7 @@ } else { const node = A.right; - if (node.isleaf()) { + if (node.isLeaf()) { A.right = B; break; } @@ -105,7 +105,7 @@ B.parent = A; return B; -} +}; diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html index 3cd36bb..35ac274 100644 --- a/file/src/insertion/insert_case1.js.html +++ b/file/src/insertion/insert_case1.js.html @@ -72,7 +72,7 @@ * * @param {Node} n - The input node. */ -export function insert_case1(n) { +export const insert_case1 = (n) => { /** * If n is the root of the tree, paint it black and we are done. * @@ -80,9 +80,9 @@ * / \ * - - */ - if (n.parent === null) n.color = BLACK; + if (n.parent === null) n._color = BLACK; else insert_case2(n); -} +}; diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index 4328578..63d77df 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -73,7 +73,7 @@ * * @param {Node} n - The input node. */ -export function insert_case2(n) { +export const insert_case2 = (n) => { /** * If the parent of n is black then we have nothing to do. * @@ -83,10 +83,10 @@ * / \ * - - */ - if (n.parent.color === BLACK) return; + if (n.parent._color === BLACK) return; insert_case3(n); -} +}; diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index cd884bc..bf72548 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -76,7 +76,7 @@ * * @param {Node} n - The input node. */ -export function insert_case3(n) { +export const insert_case3 = (n) => { const u = uncle(n); /** @@ -93,14 +93,14 @@ * - - - - */ - if (u !== null && u.color === RED) { - n.parent.color = BLACK; - u.color = BLACK; + if (u !== null && u._color === RED) { + n.parent._color = BLACK; + u._color = BLACK; const g = grandparent(n); - g.color = RED; + g._color = RED; insert_case1(g); } else insert_case4(n); -} +}; diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index 63c4c24..185ed12 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -78,7 +78,7 @@ * * @param {Node} n - The input node. */ -export function insert_case4(n) { +export const insert_case4 = (n) => { const g = grandparent(n); /** @@ -140,7 +140,7 @@ } insert_case5(n); -} +}; diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case5.js.html index 78278a5..c604c3d 100644 --- a/file/src/insertion/insert_case5.js.html +++ b/file/src/insertion/insert_case5.js.html @@ -77,12 +77,12 @@ * * @param {Node} n - The input node. */ -export function insert_case5(n) { +export const insert_case5 = (n) => { const g = grandparent(n); // Repaint n's parent black, n's grandparent red - n.parent.color = BLACK; - g.color = RED; + n.parent._color = BLACK; + g._color = RED; /** * If the path from g to n makes a left-left, {@link rotate_right} at g. @@ -109,7 +109,7 @@ * / \ / \ * = = - - */ else rotate_left(g); -} +}; diff --git a/file/src/rotate/rotate_left.js.html b/file/src/rotate/rotate_left.js.html index e53a0aa..182aa8a 100644 --- a/file/src/rotate/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -78,14 +78,14 @@ * */ -export function rotate_left(A) { +export const rotate_left = (A) => { const B = A.right; const a = A.left; const b = B.left; const c = B.right; [A.key, B.key] = [B.key, A.key]; - [A.color, B.color] = [B.color, A.color]; + [A._color, B._color] = [B._color, A._color]; A.left = B; A.right = c; @@ -96,7 +96,7 @@ a.parent = B; b.parent = B; c.parent = A; -} +}; diff --git a/file/src/rotate/rotate_right.js.html b/file/src/rotate/rotate_right.js.html index 37f135f..3e03a2f 100644 --- a/file/src/rotate/rotate_right.js.html +++ b/file/src/rotate/rotate_right.js.html @@ -78,14 +78,14 @@ * */ -export function rotate_right(B) { +export const rotate_right = (B) => { const A = B.left; const a = A.left; const b = A.right; const c = B.right; [A.key, B.key] = [B.key, A.key]; - [A.color, B.color] = [B.color, A.color]; + [A._color, B._color] = [B._color, A._color]; B.left = a; B.right = A; @@ -96,7 +96,7 @@ a.parent = B; b.parent = A; c.parent = A; -} +}; diff --git a/file/src/search/search.js.html b/file/src/search/search.js.html index 90ae47c..e5cfea3 100644 --- a/file/src/search/search.js.html +++ b/file/src/search/search.js.html @@ -71,7 +71,7 @@ * @param {Key} key - The key to search for. * @returns {Node} */ -export function search(compare, root, key) { +export const search = (compare, root, key) => { while (true) { const d = compare(key, root.key); @@ -81,11 +81,11 @@ root = d < 0 ? root.left : root.right; - if (root.isleaf()) { + if (root.isLeaf()) { return null; } } -} +}; diff --git a/file/src/traversal/inordertraversal.js.html b/file/src/traversal/inordertraversal.js.html index 0ef448f..a9e6013 100644 --- a/file/src/traversal/inordertraversal.js.html +++ b/file/src/traversal/inordertraversal.js.html @@ -70,7 +70,7 @@ * @returns {Iterator} */ export function* inordertraversal(node) { - if (!node.left.isleaf()) { + if (!node.left.isLeaf()) { // Yield the nodes on the left recursively. Those nodes are all smaller // than (or equal to) the current node by the binary search tree // properties. @@ -80,7 +80,7 @@ // Yield the current node. yield node.key; - if (!node.right.isleaf()) { + if (!node.right.isLeaf()) { // Yield the nodes on the right recursively. Those nodes are all larger // than (or equal to) the current node by the binary search tree // properties. diff --git a/file/src/traversal/rangetraversal.js.html b/file/src/traversal/rangetraversal.js.html index e260d64..c65d357 100644 --- a/file/src/traversal/rangetraversal.js.html +++ b/file/src/traversal/rangetraversal.js.html @@ -77,20 +77,20 @@ if (compare(root.key, left) < 0) { // If the root lies to the left of the interval, we can discard the // entire left subtree. - if (!root.right.isleaf()) + if (!root.right.isLeaf()) yield* rangetraversal(compare, root.right, left, right); } else if (compare(root.key, right) >= 0) { // If the root lies to the right of the interval, we can discard the // entire right subtree. - if (!root.left.isleaf()) + if (!root.left.isLeaf()) yield* rangetraversal(compare, root.left, left, right); } else { // Otherwise just recurse on both subtrees and yield the root in // between. - if (!root.left.isleaf()) + if (!root.left.isLeaf()) yield* rangetraversal(compare, root.left, left, right); yield root.key; - if (!root.right.isleaf()) + if (!root.right.isLeaf()) yield* rangetraversal(compare, root.right, left, right); } } diff --git a/function/index.html b/function/index.html index 086ca1f..0b44d2f 100644 --- a/function/index.html +++ b/function/index.html @@ -874,14 +874,13 @@ - _debug(root: Node): String + _debug(colors: Object): Function

    -

    Recursively constructs a prettyprint string for the red-black tree rooted at -root.

    +

    Builds a debug function from color handlers.

    @@ -2711,19 +2710,18 @@

    - _debug(root: Node): String + _debug(colors: Object): Function - source + source

    - + -

    Recursively constructs a prettyprint string for the red-black tree rooted at -root.

    +

    Builds a debug function from color handlers.

    @@ -2737,10 +2735,10 @@

    Params:

    - root - Node + colors + Object -

    The root of the tree.

    +

    The colors to use.

    @@ -2753,8 +2751,9 @@

    Return:

    - - + +
    StringFunction

    The debug function.

    +
    diff --git a/identifiers.html b/identifiers.html index 2f6e3cf..e73aab8 100644 --- a/identifiers.html +++ b/identifiers.html @@ -252,14 +252,13 @@

    debug

    F - _debug(root: Node): String + _debug(colors: Object): Function

    -

    Recursively constructs a prettyprint string for the red-black tree rooted at -root.

    +

    Builds a debug function from color handlers.

    diff --git a/index.json b/index.json index c05ec51..e4d0d13 100644 --- a/index.json +++ b/index.json @@ -567,7 +567,7 @@ "__docId__": 48, "kind": "file", "name": "src/adt/Leaf.js", - "content": "import {BLACK} from '../color/BLACK.js';\n\n/**\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n */\nexport function Leaf(parent) {\n\tthis.color = BLACK;\n\tthis.parent = parent;\n}\n\n/**\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n */\nLeaf.prototype.isleaf = function () {\n\treturn true;\n};\n", + "content": "import {BLACK} from '../color/BLACK.js';\n\n/**\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n */\nexport function Leaf(parent) {\n\tthis._color = BLACK;\n\tthis.parent = parent;\n}\n\n/**\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n */\nLeaf.prototype.isLeaf = function () {\n\treturn true;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/adt/Leaf.js", "access": "public", @@ -623,12 +623,12 @@ { "__docId__": 50, "kind": "function", - "name": "isleaf", + "name": "isLeaf", "memberof": "src/adt/Leaf.js", "generator": false, "async": false, "static": true, - "longname": "src/adt/Leaf.js~isleaf", + "longname": "src/adt/Leaf.js~isLeaf", "access": "public", "export": false, "importPath": "@aureooms/js-red-black-tree/src/adt/Leaf.js", @@ -656,7 +656,7 @@ "__docId__": 51, "kind": "file", "name": "src/adt/Node.js", - "content": "import {Leaf} from './Leaf.js';\n\n/**\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n */\nexport function Node(color, key) {\n\tthis.color = color;\n\tthis.left = new Leaf(this);\n\tthis.right = new Leaf(this);\n\tthis.parent = null;\n\tthis.key = key;\n}\n\n/**\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n */\nNode.prototype.isleaf = function () {\n\treturn false;\n};\n", + "content": "import {Leaf} from './Leaf.js';\n\n/**\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n */\nexport function Node(color, key) {\n\tthis._color = color;\n\tthis.left = new Leaf(this);\n\tthis.right = new Leaf(this);\n\tthis.parent = null;\n\tthis.key = key;\n}\n\n/**\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n */\nNode.prototype.isLeaf = function () {\n\treturn false;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/adt/Node.js", "access": "public", @@ -722,12 +722,12 @@ { "__docId__": 53, "kind": "function", - "name": "isleaf", + "name": "isLeaf", "memberof": "src/adt/Node.js", "generator": false, "async": false, "static": true, - "longname": "src/adt/Node.js~isleaf", + "longname": "src/adt/Node.js~isLeaf", "access": "public", "export": false, "importPath": "@aureooms/js-red-black-tree/src/adt/Node.js", @@ -755,7 +755,7 @@ "__docId__": 54, "kind": "file", "name": "src/adt/RedBlackTree.js", - "content": "import {Node} from './Node.js';\nimport {BLACK, RED} from '../color/index.js';\nimport {predecessor} from '../family/predecessor.js';\nimport {insert, insert_case2} from '../insertion/index.js';\nimport {delete_one_child} from '../deletion/index.js';\nimport {search} from '../search/index.js';\nimport {inordertraversal, rangetraversal} from '../traversal/index.js';\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport class RedBlackTree {\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t */\n\tconstructor(compare) {\n\t\tthis.compare = compare;\n\t\tthis.root = null;\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t */\n\tadd(key) {\n\t\tif (this.root === null) {\n\t\t\tthis.root = new Node(BLACK, key);\n\t\t} else {\n\t\t\tconst node = new Node(RED, key);\n\t\t\tinsert(this.compare, this.root, node);\n\t\t\tinsert_case2(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search(key) {\n\t\tif (this.root === null) return null;\n\t\treturn search(this.compare, this.root, key);\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t */\n\tget(key) {\n\t\tconst node = this._search(key);\n\t\treturn node === null ? null : node.key;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t */\n\thas(key) {\n\t\treturn this._search(key) !== null;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\t_delete(node) {\n\t\tif (!node.left.isleaf()) {\n\t\t\t// Replace node's key with predecessor's key\n\t\t\tconst pred = predecessor(node);\n\t\t\tnode.key = pred.key;\n\t\t\t// Delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(pred);\n\t\t} else if (!node.right.isleaf()) {\n\t\t\t// Replace node's key with successor's key\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right;\n\t\t\tnode.key = succ.key;\n\t\t\t// Delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(succ);\n\t\t} else if (node === this.root) {\n\t\t\tthis.root = null;\n\t\t} else {\n\t\t\tdelete_one_child(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove(key) {\n\t\tconst node = this._search(key);\n\t\tif (node === null) return false;\n\n\t\tthis._delete(node);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t */\n\t*range(left, right) {\n\t\tif (this.root !== null)\n\t\t\tyield* rangetraversal(this.compare, this.root, left, right);\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t */\n\t*items() {\n\t\tif (this.root !== null) yield* inordertraversal(this.root);\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator]() {\n\t\treturn this.items();\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from(compare, iterable) {\n\t\tconst tree = new RedBlackTree(compare);\n\n\t\tfor (const element of iterable) tree.add(element);\n\n\t\treturn tree;\n\t}\n}\n", + "content": "import {Node} from './Node.js';\nimport {BLACK, RED} from '../color/index.js';\nimport {predecessor} from '../family/predecessor.js';\nimport {insert, insert_case2} from '../insertion/index.js';\nimport {delete_one_child} from '../deletion/index.js';\nimport {search} from '../search/index.js';\nimport {inordertraversal, rangetraversal} from '../traversal/index.js';\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport class RedBlackTree {\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t */\n\tconstructor(compare) {\n\t\tthis.compare = compare;\n\t\tthis.root = null;\n\t}\n\n\t/**\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t */\n\tisEmpty() {\n\t\treturn this.root === null;\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t */\n\tadd(key) {\n\t\tif (this.root === null) {\n\t\t\tthis.root = new Node(BLACK, key);\n\t\t} else {\n\t\t\tconst node = new Node(RED, key);\n\t\t\tinsert(this.compare, this.root, node);\n\t\t\tinsert_case2(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search(key) {\n\t\tif (this.root === null) return null;\n\t\treturn search(this.compare, this.root, key);\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t */\n\tget(key) {\n\t\tconst node = this._search(key);\n\t\treturn node === null ? null : node.key;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t */\n\thas(key) {\n\t\treturn this._search(key) !== null;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\t_delete(node) {\n\t\tif (!node.left.isLeaf()) {\n\t\t\t// Replace node's key with predecessor's key\n\t\t\tconst pred = predecessor(node);\n\t\t\tnode.key = pred.key;\n\t\t\t// Delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(pred);\n\t\t} else if (!node.right.isLeaf()) {\n\t\t\t// Replace node's key with successor's key\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right;\n\t\t\tnode.key = succ.key;\n\t\t\t// Delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(succ);\n\t\t} else if (node === this.root) {\n\t\t\tthis.root = null;\n\t\t} else {\n\t\t\tdelete_one_child(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove(key) {\n\t\tconst node = this._search(key);\n\t\tif (node === null) return false;\n\n\t\tthis._delete(node);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t */\n\t*range(left, right) {\n\t\tif (this.root !== null)\n\t\t\tyield* rangetraversal(this.compare, this.root, left, right);\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t */\n\t*items() {\n\t\tif (this.root !== null) yield* inordertraversal(this.root);\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator]() {\n\t\treturn this.items();\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from(compare, iterable) {\n\t\tconst tree = new RedBlackTree(compare);\n\n\t\tfor (const element of iterable) tree.add(element);\n\n\t\treturn tree;\n\t}\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/adt/RedBlackTree.js", "access": "public", @@ -853,6 +853,34 @@ { "__docId__": 59, "kind": "method", + "name": "isEmpty", + "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "generator": false, + "async": false, + "static": false, + "longname": "src/adt/RedBlackTree.js~RedBlackTree#isEmpty", + "access": "public", + "description": "Tells whether the tree is empty.", + "lineNumber": 30, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{boolean} true if empty, false otherwise." + } + ], + "return": { + "nullable": null, + "types": [ + "boolean" + ], + "spread": false, + "description": "true if empty, false otherwise." + }, + "params": [] + }, + { + "__docId__": 60, + "kind": "method", "name": "add", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", "generator": false, @@ -861,7 +889,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#add", "access": "public", "description": "Adds a key to the tree.", - "lineNumber": 30, + "lineNumber": 39, "params": [ { "nullable": null, @@ -877,7 +905,7 @@ "return": null }, { - "__docId__": 61, + "__docId__": 62, "kind": "method", "name": "_search", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -887,7 +915,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#_search", "access": "private", "description": "Search for the input key in the tree.\nReturns the first node whose key equals the input key.\nIf no such node exists, returns null.", - "lineNumber": 48, + "lineNumber": 57, "unknown": [ { "tagName": "@returns", @@ -916,7 +944,7 @@ } }, { - "__docId__": 62, + "__docId__": 63, "kind": "method", "name": "get", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -926,7 +954,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#get", "access": "public", "description": "Search for the input key in the tree. Returns the first node key found\nin this way (with {@link RedBlackTree#_search}. If no such key exists\nin the tree, returns null.", - "lineNumber": 61, + "lineNumber": 70, "unknown": [ { "tagName": "@returns", @@ -955,7 +983,7 @@ } }, { - "__docId__": 63, + "__docId__": 64, "kind": "method", "name": "has", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -965,7 +993,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#has", "access": "public", "description": "Returns true if and only if the tree contains the input\nkey.", - "lineNumber": 73, + "lineNumber": 82, "unknown": [ { "tagName": "@returns", @@ -994,7 +1022,7 @@ } }, { - "__docId__": 64, + "__docId__": 65, "kind": "method", "name": "_delete", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -1004,7 +1032,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#_delete", "access": "private", "description": "Deletes the input node from the tree.", - "lineNumber": 82, + "lineNumber": 91, "params": [ { "nullable": null, @@ -1020,7 +1048,7 @@ "return": null }, { - "__docId__": 66, + "__docId__": 67, "kind": "method", "name": "remove", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -1030,7 +1058,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#remove", "access": "public", "description": "Search for the first node of the tree whose key equals the input key\n(with {@link RedBlackTree#_search}), then delete that node\n(with {@link RedBlackTree#_delete}). If such a node is found and deleted\nthen return true. Return false otherwise.", - "lineNumber": 117, + "lineNumber": 126, "unknown": [ { "tagName": "@returns", @@ -1059,7 +1087,7 @@ } }, { - "__docId__": 67, + "__docId__": 68, "kind": "method", "name": "range", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -1069,7 +1097,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#range", "access": "public", "description": "Returns an in order iterator over the keys of the tree that lie in the\ninterval [left, right[.", - "lineNumber": 132, + "lineNumber": 141, "unknown": [ { "tagName": "@returns", @@ -1108,7 +1136,7 @@ } }, { - "__docId__": 68, + "__docId__": 69, "kind": "method", "name": "items", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -1118,7 +1146,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#items", "access": "public", "description": "Returns an in order iterator over the keys of the tree.", - "lineNumber": 142, + "lineNumber": 151, "unknown": [ { "tagName": "@returns", @@ -1136,7 +1164,7 @@ "params": [] }, { - "__docId__": 69, + "__docId__": 70, "kind": "method", "name": "[Symbol.iterator]", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -1146,7 +1174,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "access": "public", "description": "Same as {@link RedBlackTree#items}.", - "lineNumber": 149, + "lineNumber": 158, "params": [], "return": { "types": [ @@ -1155,7 +1183,7 @@ } }, { - "__docId__": 70, + "__docId__": 71, "kind": "method", "name": "from", "memberof": "src/adt/RedBlackTree.js~RedBlackTree", @@ -1165,7 +1193,7 @@ "longname": "src/adt/RedBlackTree.js~RedBlackTree.from", "access": "public", "description": "Constructs a red-black tree from an input iterable.", - "lineNumber": 160, + "lineNumber": 169, "unknown": [ { "tagName": "@returns", @@ -1204,7 +1232,7 @@ } }, { - "__docId__": 71, + "__docId__": 72, "kind": "file", "name": "src/adt/index.js", "content": "export * from './Leaf.js';\nexport * from './Node.js';\nexport * from './RedBlackTree.js';\n", @@ -1215,7 +1243,7 @@ "lineNumber": 1 }, { - "__docId__": 72, + "__docId__": 73, "kind": "file", "name": "src/color/BLACK.js", "content": "/**\n * Constant for black.\n */\nexport const BLACK = 0;\n", @@ -1226,7 +1254,7 @@ "lineNumber": 1 }, { - "__docId__": 73, + "__docId__": 74, "kind": "variable", "name": "BLACK", "memberof": "src/color/BLACK.js", @@ -1245,7 +1273,7 @@ } }, { - "__docId__": 74, + "__docId__": 75, "kind": "file", "name": "src/color/RED.js", "content": "/**\n * Constant for red.\n */\nexport const RED = 1;\n", @@ -1256,7 +1284,7 @@ "lineNumber": 1 }, { - "__docId__": 75, + "__docId__": 76, "kind": "variable", "name": "RED", "memberof": "src/color/RED.js", @@ -1275,7 +1303,7 @@ } }, { - "__docId__": 76, + "__docId__": 77, "kind": "file", "name": "src/color/index.js", "content": "export * from './BLACK.js';\nexport * from './RED.js';\n", @@ -1286,10 +1314,10 @@ "lineNumber": 1 }, { - "__docId__": 77, + "__docId__": 78, "kind": "file", "name": "src/debug/debug.js", - "content": "import {BLACK} from '../color/BLACK.js';\n\n/**\n * Recursively constructs a prettyprint string for the red-black tree rooted at\n * root.\n *\n * @param {Node} root - The root of the tree.\n * @returns {String}\n */\nexport function _debug({red, black}) {\n\tconst debug = (root) => {\n\t\tif (root.isleaf()) return black('L');\n\n\t\tconst repr = root.color === BLACK ? black(root.key) : red(root.key);\n\n\t\treturn `(${debug(root.left)}, ${repr}, ${debug(root.right)})`;\n\t};\n\n\treturn debug;\n}\n", + "content": "import {BLACK} from '../color/BLACK.js';\n\n/**\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n */\nexport const _debug = ({red, black}) => {\n\t/**\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t */\n\tconst debug = (root) => {\n\t\tif (root.isLeaf()) return black('L');\n\n\t\tconst repr = root._color === BLACK ? black(root.key) : red(root.key);\n\n\t\treturn `(${debug(root.left)}, ${repr}, ${debug(root.right)})`;\n\t};\n\n\treturn debug;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/debug/debug.js", "access": "public", @@ -1297,7 +1325,7 @@ "lineNumber": 1 }, { - "__docId__": 78, + "__docId__": 79, "kind": "function", "name": "_debug", "memberof": "src/debug/debug.js", @@ -1309,37 +1337,37 @@ "export": true, "importPath": "@aureooms/js-red-black-tree/src/debug/debug.js", "importStyle": "{_debug}", - "description": "Recursively constructs a prettyprint string for the red-black tree rooted at\nroot.", - "lineNumber": 10, + "description": "Builds a debug function from color handlers.", + "lineNumber": 9, "unknown": [ { "tagName": "@returns", - "tagValue": "{String}" + "tagValue": "{Function} The debug function." } ], "params": [ { "nullable": null, "types": [ - "Node" + "Object" ], "spread": false, "optional": false, - "name": "root", - "description": "The root of the tree." + "name": "colors", + "description": "The colors to use." } ], "return": { "nullable": null, "types": [ - "String" + "Function" ], "spread": false, - "description": "" + "description": "The debug function." } }, { - "__docId__": 79, + "__docId__": 80, "kind": "file", "name": "src/debug/index.js", "content": "export * from './debug.js';\n", @@ -1350,10 +1378,10 @@ "lineNumber": 1 }, { - "__docId__": 80, + "__docId__": 81, "kind": "file", "name": "src/deletion/delete_case1.js", - "content": "import {delete_case2} from './delete_case2.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case1(n) {\n\t// If n is the root, there is nothing to do: all paths go through n, and n\n\t// is black.\n\tif (n.parent !== null) delete_case2(n);\n}\n", + "content": "import {delete_case2} from './delete_case2.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case1 = (n) => {\n\t// If n is the root, there is nothing to do: all paths go through n, and n\n\t// is black.\n\tif (n.parent !== null) delete_case2(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case1.js", "access": "public", @@ -1361,7 +1389,7 @@ "lineNumber": 1 }, { - "__docId__": 81, + "__docId__": 82, "kind": "function", "name": "delete_case1", "memberof": "src/deletion/delete_case1.js", @@ -1390,10 +1418,10 @@ "return": null }, { - "__docId__": 82, + "__docId__": 83, "kind": "file", "name": "src/deletion/delete_case2.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case3} from './delete_case3.js';\nimport {delete_case4} from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case2(n) {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t */\n\tif (s.color === RED) {\n\t\tn.parent.color = RED;\n\t\ts.color = BLACK;\n\t\tif (n === n.parent.left) rotate_left(n.parent);\n\t\telse rotate_right(n.parent);\n\t\tdelete_case4(n);\n\t}\n\n\t// Otherwise, go to case 3.\n\telse delete_case3(n);\n}\n", + "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case3} from './delete_case3.js';\nimport {delete_case4} from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case2 = (n) => {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t */\n\tif (s._color === RED) {\n\t\tn.parent._color = RED;\n\t\ts._color = BLACK;\n\t\tif (n === n.parent.left) rotate_left(n.parent);\n\t\telse rotate_right(n.parent);\n\t\tdelete_case4(n);\n\t}\n\n\t// Otherwise, go to case 3.\n\telse delete_case3(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case2.js", "access": "public", @@ -1401,7 +1429,7 @@ "lineNumber": 1 }, { - "__docId__": 83, + "__docId__": 84, "kind": "function", "name": "delete_case2", "memberof": "src/deletion/delete_case2.js", @@ -1430,10 +1458,10 @@ "return": null }, { - "__docId__": 84, + "__docId__": 85, "kind": "file", "name": "src/deletion/delete_case3.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case1} from './delete_case1.js';\nimport {delete_case4} from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case3(n) {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\tn.parent.color === BLACK &&\n\t\ts.left.color === BLACK &&\n\t\ts.right.color === BLACK\n\t) {\n\t\ts.color = RED;\n\t\tdelete_case1(n.parent);\n\t}\n\n\t// Otherwise, go to case 4.\n\telse delete_case4(n);\n}\n", + "content": "import {BLACK, RED} from '../color/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case1} from './delete_case1.js';\nimport {delete_case4} from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case3 = (n) => {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\tn.parent._color === BLACK &&\n\t\ts.left._color === BLACK &&\n\t\ts.right._color === BLACK\n\t) {\n\t\ts._color = RED;\n\t\tdelete_case1(n.parent);\n\t}\n\n\t// Otherwise, go to case 4.\n\telse delete_case4(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case3.js", "access": "public", @@ -1441,7 +1469,7 @@ "lineNumber": 1 }, { - "__docId__": 85, + "__docId__": 86, "kind": "function", "name": "delete_case3", "memberof": "src/deletion/delete_case3.js", @@ -1470,10 +1498,10 @@ "return": null }, { - "__docId__": 86, + "__docId__": 87, "kind": "file", "name": "src/deletion/delete_case4.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case5} from './delete_case5.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case4(n) {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\t// The parent color test is always true when coming from case 2\n\t\tn.parent.color === RED &&\n\t\ts.left.color === BLACK &&\n\t\ts.right.color === BLACK\n\t) {\n\t\ts.color = RED;\n\t\tn.parent.color = BLACK;\n\t}\n\n\t// Otherwise, go to case 5.\n\telse delete_case5(n);\n}\n", + "content": "import {BLACK, RED} from '../color/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case5} from './delete_case5.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case4 = (n) => {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\t// The parent color test is always true when coming from case 2\n\t\tn.parent._color === RED &&\n\t\ts.left._color === BLACK &&\n\t\ts.right._color === BLACK\n\t) {\n\t\ts._color = RED;\n\t\tn.parent._color = BLACK;\n\t}\n\n\t// Otherwise, go to case 5.\n\telse delete_case5(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case4.js", "access": "public", @@ -1481,7 +1509,7 @@ "lineNumber": 1 }, { - "__docId__": 87, + "__docId__": 88, "kind": "function", "name": "delete_case4", "memberof": "src/deletion/delete_case4.js", @@ -1510,10 +1538,10 @@ "return": null }, { - "__docId__": 88, + "__docId__": 89, "kind": "file", "name": "src/deletion/delete_case5.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case6} from './delete_case6.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case5(n) {\n\tconst s = sibling(n);\n\n\t// The following statements just force the red n's sibling child to be on\n\t// the left of the left of the parent, or right of the right, so case 6\n\t// will rotate correctly.\n\n\t/**\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t */\n\tif (n === n.parent.left && s.right.color === BLACK) {\n\t\ts.color = RED;\n\t\ts.left.color = BLACK;\n\t\trotate_right(s);\n\t} else if (n === n.parent.right && s.left.color === BLACK) {\n\t\t/**\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t */\n\t\ts.color = RED;\n\t\ts.right.color = BLACK;\n\t\trotate_left(s);\n\t}\n\n\tdelete_case6(n);\n}\n", + "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case6} from './delete_case6.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case5 = (n) => {\n\tconst s = sibling(n);\n\n\t// The following statements just force the red n's sibling child to be on\n\t// the left of the left of the parent, or right of the right, so case 6\n\t// will rotate correctly.\n\n\t/**\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t */\n\tif (n === n.parent.left && s.right._color === BLACK) {\n\t\ts._color = RED;\n\t\ts.left._color = BLACK;\n\t\trotate_right(s);\n\t} else if (n === n.parent.right && s.left._color === BLACK) {\n\t\t/**\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t */\n\t\ts._color = RED;\n\t\ts.right._color = BLACK;\n\t\trotate_left(s);\n\t}\n\n\tdelete_case6(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case5.js", "access": "public", @@ -1521,7 +1549,7 @@ "lineNumber": 1 }, { - "__docId__": 89, + "__docId__": 90, "kind": "function", "name": "delete_case5", "memberof": "src/deletion/delete_case5.js", @@ -1550,10 +1578,10 @@ "return": null }, { - "__docId__": 90, + "__docId__": 91, "kind": "file", "name": "src/deletion/delete_case6.js", - "content": "import {BLACK} from '../color/BLACK.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n */\nexport function delete_case6(n) {\n\tconst s = sibling(n);\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n\ts.color = n.parent.color;\n\tn.parent.color = BLACK;\n\n\tif (n === n.parent.left) {\n\t\ts.right.color = BLACK;\n\t\trotate_left(n.parent);\n\t}\n\n\t// Symmetric case\n\telse {\n\t\ts.left.color = BLACK;\n\t\trotate_right(n.parent);\n\t}\n}\n", + "content": "import {BLACK} from '../color/BLACK.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case6 = (n) => {\n\tconst s = sibling(n);\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n\ts._color = n.parent._color;\n\tn.parent._color = BLACK;\n\n\tif (n === n.parent.left) {\n\t\ts.right._color = BLACK;\n\t\trotate_left(n.parent);\n\t}\n\n\t// Symmetric case\n\telse {\n\t\ts.left._color = BLACK;\n\t\trotate_right(n.parent);\n\t}\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case6.js", "access": "public", @@ -1561,7 +1589,7 @@ "lineNumber": 1 }, { - "__docId__": 91, + "__docId__": 92, "kind": "function", "name": "delete_case6", "memberof": "src/deletion/delete_case6.js", @@ -1590,10 +1618,10 @@ "return": null }, { - "__docId__": 92, + "__docId__": 93, "kind": "file", "name": "src/deletion/delete_one_child.js", - "content": "import {BLACK, RED} from '../color/index.js';\n\nimport {replace_node} from './replace_node.js';\nimport {delete_case1} from './delete_case1.js';\n\n/**\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n */\nexport function delete_one_child(n) {\n\t// Precondition: n has at most one non-leaf child.\n\t// assert( n.right.isleaf() || n.left.isleaf());\n\n\t// const child = n.right.isleaf() ? n.left : n.right;\n\t// n.right is always a LEAF because either n is a subtree predecessor or it\n\t// is the only child of its parent by the red-black tree properties\n\tconst child = n.left;\n\n\t// Replace n with its left child\n\treplace_node(n, child);\n\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1.\n\tif (n.color === BLACK) {\n\t\t// We can easily fix this when its left child is an\n\t\t// internal red node: change the color of the left child to black and\n\t\t// replace n with it.\n\t\tif (child.color === RED) child.color = BLACK;\n\t\t// Otherwise, there are more things to fix.\n\t\telse delete_case1(child);\n\t}\n\n\t// Else {\n\t// If n is red then its child can only be black. Replacing n with its\n\t// child suffices.\n\t// }\n}\n", + "content": "import {BLACK, RED} from '../color/index.js';\n\nimport {replace_node} from './replace_node.js';\nimport {delete_case1} from './delete_case1.js';\n\n/**\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n */\nexport const delete_one_child = (n) => {\n\t// Precondition: n has at most one non-leaf child.\n\t// assert( n.right.isLeaf() || n.left.isLeaf());\n\n\t// const child = n.right.isLeaf() ? n.left : n.right;\n\t// n.right is always a LEAF because either n is a subtree predecessor or it\n\t// is the only child of its parent by the red-black tree properties\n\tconst child = n.left;\n\n\t// Replace n with its left child\n\treplace_node(n, child);\n\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1.\n\tif (n._color === BLACK) {\n\t\t// We can easily fix this when its left child is an\n\t\t// internal red node: change the color of the left child to black and\n\t\t// replace n with it.\n\t\tif (child._color === RED) child._color = BLACK;\n\t\t// Otherwise, there are more things to fix.\n\t\telse delete_case1(child);\n\t}\n\n\t// Else {\n\t// If n is red then its child can only be black. Replacing n with its\n\t// child suffices.\n\t// }\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_one_child.js", "access": "public", @@ -1601,7 +1629,7 @@ "lineNumber": 1 }, { - "__docId__": 93, + "__docId__": 94, "kind": "function", "name": "delete_one_child", "memberof": "src/deletion/delete_one_child.js", @@ -1630,7 +1658,7 @@ "return": null }, { - "__docId__": 94, + "__docId__": 95, "kind": "file", "name": "src/deletion/index.js", "content": "export * from './delete_case1.js';\nexport * from './delete_case2.js';\nexport * from './delete_case3.js';\nexport * from './delete_case4.js';\nexport * from './delete_case5.js';\nexport * from './delete_case6.js';\nexport * from './delete_one_child.js';\nexport * from './replace_node.js';\n", @@ -1641,10 +1669,10 @@ "lineNumber": 1 }, { - "__docId__": 95, + "__docId__": 96, "kind": "file", "name": "src/deletion/replace_node.js", - "content": "/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n */\nexport function replace_node(A, B) {\n\t// Assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif (A === A.parent.left) A.parent.left = B;\n\telse A.parent.right = B;\n\n\tB.parent = A.parent;\n}\n", + "content": "/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n */\nexport const replace_node = (A, B) => {\n\t// Assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif (A === A.parent.left) A.parent.left = B;\n\telse A.parent.right = B;\n\n\tB.parent = A.parent;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/replace_node.js", "access": "public", @@ -1652,7 +1680,7 @@ "lineNumber": 1 }, { - "__docId__": 96, + "__docId__": 97, "kind": "function", "name": "replace_node", "memberof": "src/deletion/replace_node.js", @@ -1691,10 +1719,10 @@ "return": null }, { - "__docId__": 97, + "__docId__": 98, "kind": "file", "name": "src/family/grandparent.js", - "content": "/**\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport function grandparent(node) {\n\t// Assert((node !== null) && (node.parent !== null));\n\t// We only call this function when node HAS a grandparent\n\treturn node.parent.parent;\n}\n", + "content": "/**\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport const grandparent = (node) => {\n\t// Assert((node !== null) && (node.parent !== null));\n\t// We only call this function when node HAS a grandparent\n\treturn node.parent.parent;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/grandparent.js", "access": "public", @@ -1702,7 +1730,7 @@ "lineNumber": 1 }, { - "__docId__": 98, + "__docId__": 99, "kind": "function", "name": "grandparent", "memberof": "src/family/grandparent.js", @@ -1744,7 +1772,7 @@ } }, { - "__docId__": 99, + "__docId__": 100, "kind": "file", "name": "src/family/index.js", "content": "export * from './grandparent.js';\nexport * from './predecessor.js';\nexport * from './sibling.js';\nexport * from './uncle.js';\n", @@ -1755,10 +1783,10 @@ "lineNumber": 1 }, { - "__docId__": 100, + "__docId__": 101, "kind": "file", "name": "src/family/predecessor.js", - "content": "/**\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport function predecessor(node) {\n\t// Assert( !node.left.isleaf() ) ;\n\tlet pred = node.left;\n\n\twhile (!pred.right.isleaf()) pred = pred.right;\n\n\treturn pred;\n}\n", + "content": "/**\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport const predecessor = (node) => {\n\t// Assert( !node.left.isLeaf() ) ;\n\tlet pred = node.left;\n\n\twhile (!pred.right.isLeaf()) pred = pred.right;\n\n\treturn pred;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/predecessor.js", "access": "public", @@ -1766,7 +1794,7 @@ "lineNumber": 1 }, { - "__docId__": 101, + "__docId__": 102, "kind": "function", "name": "predecessor", "memberof": "src/family/predecessor.js", @@ -1808,10 +1836,10 @@ } }, { - "__docId__": 102, + "__docId__": 103, "kind": "file", "name": "src/family/sibling.js", - "content": "/**\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport function sibling(node) {\n\t// Assert((node !== null) && (node.parent !== null));\n\t// We only use this function when node HAS a sibling so this case can never\n\t// happen.\n\n\treturn node === node.parent.left ? node.parent.right : node.parent.left;\n}\n", + "content": "/**\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport const sibling = (node) => {\n\t// Assert((node !== null) && (node.parent !== null));\n\t// We only use this function when node HAS a sibling so this case can never\n\t// happen.\n\n\treturn node === node.parent.left ? node.parent.right : node.parent.left;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/sibling.js", "access": "public", @@ -1819,7 +1847,7 @@ "lineNumber": 1 }, { - "__docId__": 103, + "__docId__": 104, "kind": "function", "name": "sibling", "memberof": "src/family/sibling.js", @@ -1861,10 +1889,10 @@ } }, { - "__docId__": 104, + "__docId__": 105, "kind": "file", "name": "src/family/uncle.js", - "content": "import {grandparent} from './grandparent.js';\n\n/**\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport function uncle(node) {\n\tconst g = grandparent(node);\n\t// Assert( g !== null ) ;\n\t// this can never happen\n\tif (node.parent === g.left) return g.right.isleaf() ? null : g.right;\n\treturn g.left.isleaf() ? null : g.left;\n}\n", + "content": "import {grandparent} from './grandparent.js';\n\n/**\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport const uncle = (node) => {\n\tconst g = grandparent(node);\n\t// Assert( g !== null ) ;\n\t// this can never happen\n\tif (node.parent === g.left) return g.right.isLeaf() ? null : g.right;\n\treturn g.left.isLeaf() ? null : g.left;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/uncle.js", "access": "public", @@ -1872,7 +1900,7 @@ "lineNumber": 1 }, { - "__docId__": 105, + "__docId__": 106, "kind": "function", "name": "uncle", "memberof": "src/family/uncle.js", @@ -1914,7 +1942,7 @@ } }, { - "__docId__": 106, + "__docId__": 107, "kind": "file", "name": "src/index.js", "content": "export * from './adt/index.js';\nexport * from './color/index.js';\nexport * from './debug/index.js';\nexport * from './deletion/index.js';\nexport * from './family/index.js';\nexport * from './insertion/index.js';\nexport * from './rotate/index.js';\nexport * from './search/index.js';\nexport * from './traversal/index.js';\n", @@ -1925,7 +1953,7 @@ "lineNumber": 1 }, { - "__docId__": 107, + "__docId__": 108, "kind": "file", "name": "src/insertion/index.js", "content": "export * from './insert.js';\nexport * from './insert_case1.js';\nexport * from './insert_case2.js';\nexport * from './insert_case3.js';\nexport * from './insert_case4.js';\nexport * from './insert_case5.js';\n", @@ -1936,10 +1964,10 @@ "lineNumber": 1 }, { - "__docId__": 108, + "__docId__": 109, "kind": "file", "name": "src/insertion/insert.js", - "content": "/**\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n */\nexport function insert(compare, A, B) {\n\twhile (true) {\n\t\tif (compare(B.key, A.key) < 0) {\n\t\t\tconst node = A.left;\n\n\t\t\tif (node.isleaf()) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\t\t} else {\n\t\t\tconst node = A.right;\n\n\t\t\tif (node.isleaf()) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\t\t}\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n}\n", + "content": "/**\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n */\nexport const insert = (compare, A, B) => {\n\twhile (true) {\n\t\tif (compare(B.key, A.key) < 0) {\n\t\t\tconst node = A.left;\n\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\t\t} else {\n\t\t\tconst node = A.right;\n\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\t\t}\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert.js", "access": "public", @@ -1947,7 +1975,7 @@ "lineNumber": 1 }, { - "__docId__": 109, + "__docId__": 110, "kind": "function", "name": "insert", "memberof": "src/insertion/insert.js", @@ -2009,10 +2037,10 @@ } }, { - "__docId__": 110, + "__docId__": 111, "kind": "file", "name": "src/insertion/insert_case1.js", - "content": "import {BLACK} from '../color/BLACK.js';\nimport {insert_case2} from './insert_case2.js';\n\n/**\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case1(n) {\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent === null) n.color = BLACK;\n\telse insert_case2(n);\n}\n", + "content": "import {BLACK} from '../color/BLACK.js';\nimport {insert_case2} from './insert_case2.js';\n\n/**\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case1 = (n) => {\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent === null) n._color = BLACK;\n\telse insert_case2(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case1.js", "access": "public", @@ -2020,7 +2048,7 @@ "lineNumber": 1 }, { - "__docId__": 111, + "__docId__": 112, "kind": "function", "name": "insert_case1", "memberof": "src/insertion/insert_case1.js", @@ -2049,10 +2077,10 @@ "return": null }, { - "__docId__": 112, + "__docId__": 113, "kind": "file", "name": "src/insertion/insert_case2.js", - "content": "import {BLACK} from '../color/BLACK.js';\nimport {insert_case3} from './insert_case3.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case2(n) {\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent.color === BLACK) return;\n\n\tinsert_case3(n);\n}\n", + "content": "import {BLACK} from '../color/BLACK.js';\nimport {insert_case3} from './insert_case3.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case2 = (n) => {\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent._color === BLACK) return;\n\n\tinsert_case3(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case2.js", "access": "public", @@ -2060,7 +2088,7 @@ "lineNumber": 1 }, { - "__docId__": 113, + "__docId__": 114, "kind": "function", "name": "insert_case2", "memberof": "src/insertion/insert_case2.js", @@ -2089,10 +2117,10 @@ "return": null }, { - "__docId__": 114, + "__docId__": 115, "kind": "file", "name": "src/insertion/insert_case3.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {uncle, grandparent} from '../family/index.js';\nimport {insert_case1} from './insert_case1.js';\nimport {insert_case4} from './insert_case4.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case3(n) {\n\tconst u = uncle(n);\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\tif (u !== null && u.color === RED) {\n\t\tn.parent.color = BLACK;\n\t\tu.color = BLACK;\n\t\tconst g = grandparent(n);\n\t\tg.color = RED;\n\t\tinsert_case1(g);\n\t} else insert_case4(n);\n}\n", + "content": "import {BLACK, RED} from '../color/index.js';\nimport {uncle, grandparent} from '../family/index.js';\nimport {insert_case1} from './insert_case1.js';\nimport {insert_case4} from './insert_case4.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case3 = (n) => {\n\tconst u = uncle(n);\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\tif (u !== null && u._color === RED) {\n\t\tn.parent._color = BLACK;\n\t\tu._color = BLACK;\n\t\tconst g = grandparent(n);\n\t\tg._color = RED;\n\t\tinsert_case1(g);\n\t} else insert_case4(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case3.js", "access": "public", @@ -2100,7 +2128,7 @@ "lineNumber": 1 }, { - "__docId__": 115, + "__docId__": 116, "kind": "function", "name": "insert_case3", "memberof": "src/insertion/insert_case3.js", @@ -2129,10 +2157,10 @@ "return": null }, { - "__docId__": 116, + "__docId__": 117, "kind": "file", "name": "src/insertion/insert_case4.js", - "content": "import {rotate_left, rotate_right} from '../rotate/index.js';\nimport {grandparent} from '../family/grandparent.js';\nimport {insert_case5} from './insert_case5.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case4(n) {\n\tconst g = grandparent(n);\n\n\t/**\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\tif (n === n.parent.right && n.parent === g.left) {\n\t\trotate_left(n.parent);\n\n\t\t/**\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\t} else if (n === n.parent.left && n.parent === g.right) {\n\t\t/**\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_right(n.parent);\n\n\t\t/**\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t}\n\n\tinsert_case5(n);\n}\n", + "content": "import {rotate_left, rotate_right} from '../rotate/index.js';\nimport {grandparent} from '../family/grandparent.js';\nimport {insert_case5} from './insert_case5.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case4 = (n) => {\n\tconst g = grandparent(n);\n\n\t/**\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\tif (n === n.parent.right && n.parent === g.left) {\n\t\trotate_left(n.parent);\n\n\t\t/**\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\t} else if (n === n.parent.left && n.parent === g.right) {\n\t\t/**\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_right(n.parent);\n\n\t\t/**\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t}\n\n\tinsert_case5(n);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case4.js", "access": "public", @@ -2140,7 +2168,7 @@ "lineNumber": 1 }, { - "__docId__": 117, + "__docId__": 118, "kind": "function", "name": "insert_case4", "memberof": "src/insertion/insert_case4.js", @@ -2169,10 +2197,10 @@ "return": null }, { - "__docId__": 118, + "__docId__": 119, "kind": "file", "name": "src/insertion/insert_case5.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {grandparent} from '../family/grandparent.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n */\nexport function insert_case5(n) {\n\tconst g = grandparent(n);\n\n\t// Repaint n's parent black, n's grandparent red\n\tn.parent.color = BLACK;\n\tg.color = RED;\n\n\t/**\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t */\n\tif (n === n.parent.left) rotate_right(g);\n\t/**\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t */ else rotate_left(g);\n}\n", + "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {grandparent} from '../family/grandparent.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case5 = (n) => {\n\tconst g = grandparent(n);\n\n\t// Repaint n's parent black, n's grandparent red\n\tn.parent._color = BLACK;\n\tg._color = RED;\n\n\t/**\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t */\n\tif (n === n.parent.left) rotate_right(g);\n\t/**\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t */ else rotate_left(g);\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case5.js", "access": "public", @@ -2180,7 +2208,7 @@ "lineNumber": 1 }, { - "__docId__": 119, + "__docId__": 120, "kind": "function", "name": "insert_case5", "memberof": "src/insertion/insert_case5.js", @@ -2209,7 +2237,7 @@ "return": null }, { - "__docId__": 120, + "__docId__": 121, "kind": "file", "name": "src/rotate/index.js", "content": "export * from './rotate_left.js';\nexport * from './rotate_right.js';\n", @@ -2220,10 +2248,10 @@ "lineNumber": 1 }, { - "__docId__": 121, + "__docId__": 122, "kind": "file", "name": "src/rotate/rotate_left.js", - "content": "/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nexport function rotate_left(A) {\n\tconst B = A.right;\n\tconst a = A.left;\n\tconst b = B.left;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A.color, B.color] = [B.color, A.color];\n\n\tA.left = B;\n\tA.right = c;\n\n\tB.left = a;\n\tB.right = b;\n\n\ta.parent = B;\n\tb.parent = B;\n\tc.parent = A;\n}\n", + "content": "/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nexport const rotate_left = (A) => {\n\tconst B = A.right;\n\tconst a = A.left;\n\tconst b = B.left;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tA.left = B;\n\tA.right = c;\n\n\tB.left = a;\n\tB.right = b;\n\n\ta.parent = B;\n\tb.parent = B;\n\tc.parent = A;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_left.js", "access": "public", @@ -2231,7 +2259,7 @@ "lineNumber": 1 }, { - "__docId__": 122, + "__docId__": 123, "kind": "function", "name": "rotate_left", "memberof": "src/rotate/rotate_left.js", @@ -2260,10 +2288,10 @@ "return": null }, { - "__docId__": 123, + "__docId__": 124, "kind": "file", "name": "src/rotate/rotate_right.js", - "content": "/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nexport function rotate_right(B) {\n\tconst A = B.left;\n\tconst a = A.left;\n\tconst b = A.right;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A.color, B.color] = [B.color, A.color];\n\n\tB.left = a;\n\tB.right = A;\n\n\tA.left = b;\n\tA.right = c;\n\n\ta.parent = B;\n\tb.parent = A;\n\tc.parent = A;\n}\n", + "content": "/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nexport const rotate_right = (B) => {\n\tconst A = B.left;\n\tconst a = A.left;\n\tconst b = A.right;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tB.left = a;\n\tB.right = A;\n\n\tA.left = b;\n\tA.right = c;\n\n\ta.parent = B;\n\tb.parent = A;\n\tc.parent = A;\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_right.js", "access": "public", @@ -2271,7 +2299,7 @@ "lineNumber": 1 }, { - "__docId__": 124, + "__docId__": 125, "kind": "function", "name": "rotate_right", "memberof": "src/rotate/rotate_right.js", @@ -2300,7 +2328,7 @@ "return": null }, { - "__docId__": 125, + "__docId__": 126, "kind": "file", "name": "src/search/index.js", "content": "export * from './search.js';\n", @@ -2311,10 +2339,10 @@ "lineNumber": 1 }, { - "__docId__": 126, + "__docId__": 127, "kind": "file", "name": "src/search/search.js", - "content": "/**\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n */\nexport function search(compare, root, key) {\n\twhile (true) {\n\t\tconst d = compare(key, root.key);\n\n\t\tif (d === 0) {\n\t\t\treturn root;\n\t\t}\n\n\t\troot = d < 0 ? root.left : root.right;\n\n\t\tif (root.isleaf()) {\n\t\t\treturn null;\n\t\t}\n\t}\n}\n", + "content": "/**\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n */\nexport const search = (compare, root, key) => {\n\twhile (true) {\n\t\tconst d = compare(key, root.key);\n\n\t\tif (d === 0) {\n\t\t\treturn root;\n\t\t}\n\n\t\troot = d < 0 ? root.left : root.right;\n\n\t\tif (root.isLeaf()) {\n\t\t\treturn null;\n\t\t}\n\t}\n};\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/search/search.js", "access": "public", @@ -2322,7 +2350,7 @@ "lineNumber": 1 }, { - "__docId__": 127, + "__docId__": 128, "kind": "function", "name": "search", "memberof": "src/search/search.js", @@ -2384,7 +2412,7 @@ } }, { - "__docId__": 128, + "__docId__": 129, "kind": "file", "name": "src/traversal/index.js", "content": "export * from './inordertraversal.js';\nexport * from './rangetraversal.js';\n", @@ -2395,10 +2423,10 @@ "lineNumber": 1 }, { - "__docId__": 129, + "__docId__": 130, "kind": "file", "name": "src/traversal/inordertraversal.js", - "content": "/**\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n */\nexport function* inordertraversal(node) {\n\tif (!node.left.isleaf()) {\n\t\t// Yield the nodes on the left recursively. Those nodes are all smaller\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tyield* inordertraversal(node.left);\n\t}\n\n\t// Yield the current node.\n\tyield node.key;\n\n\tif (!node.right.isleaf()) {\n\t\t// Yield the nodes on the right recursively. Those nodes are all larger\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tyield* inordertraversal(node.right);\n\t}\n}\n", + "content": "/**\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n */\nexport function* inordertraversal(node) {\n\tif (!node.left.isLeaf()) {\n\t\t// Yield the nodes on the left recursively. Those nodes are all smaller\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tyield* inordertraversal(node.left);\n\t}\n\n\t// Yield the current node.\n\tyield node.key;\n\n\tif (!node.right.isLeaf()) {\n\t\t// Yield the nodes on the right recursively. Those nodes are all larger\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tyield* inordertraversal(node.right);\n\t}\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/inordertraversal.js", "access": "public", @@ -2406,7 +2434,7 @@ "lineNumber": 1 }, { - "__docId__": 130, + "__docId__": 131, "kind": "function", "name": "inordertraversal", "memberof": "src/traversal/inordertraversal.js", @@ -2448,10 +2476,10 @@ } }, { - "__docId__": 131, + "__docId__": 132, "kind": "file", "name": "src/traversal/rangetraversal.js", - "content": "/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n */\nexport function* rangetraversal(compare, root, left, right) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (!root.right.isleaf())\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t} else if (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (!root.left.isleaf())\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t} else {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif (!root.left.isleaf())\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\tyield root.key;\n\t\tif (!root.right.isleaf())\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t}\n}\n", + "content": "/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n */\nexport function* rangetraversal(compare, root, left, right) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (!root.right.isLeaf())\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t} else if (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (!root.left.isLeaf())\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t} else {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif (!root.left.isLeaf())\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\tyield root.key;\n\t\tif (!root.right.isLeaf())\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t}\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/rangetraversal.js", "access": "public", @@ -2459,7 +2487,7 @@ "lineNumber": 1 }, { - "__docId__": 132, + "__docId__": 133, "kind": "function", "name": "rangetraversal", "memberof": "src/traversal/rangetraversal.js", @@ -2540,7 +2568,7 @@ }, { "kind": "packageJSON", - "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"4.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"c8 --all --src src --reporter=lcov npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.13\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.8\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.6.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"5.2.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"test\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"development\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"production\": {\n \"plugins\": [\n \"babel-plugin-unassert\",\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", + "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"5.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"c8 --all --src src --reporter=lcov npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.13\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.8\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.6.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"5.2.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"test\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"development\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"production\": {\n \"plugins\": [\n \"babel-plugin-unassert\",\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/package.json", "name": "package.json", "static": true, diff --git a/script/search_index.js b/script/search_index.js index bd0c5fe..7f7c576 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -521,6 +521,12 @@ window.esdocSearchIndex = [ "src/adt/RedBlackTree.js~RedBlackTree#has", "method" ], + [ + "src/adt/redblacktree.js~redblacktree#isempty", + "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-isEmpty", + "src/adt/RedBlackTree.js~RedBlackTree#isEmpty", + "method" + ], [ "src/adt/redblacktree.js~redblacktree#items", "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-items", diff --git a/source.html b/source.html index 5081148..729c531 100644 --- a/source.html +++ b/source.html @@ -62,7 +62,7 @@
    -

    Source 42/44

    +

    Source 43/45

    @@ -81,25 +81,25 @@ - + - + - + - + - - - - + + + + @@ -107,7 +107,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -123,7 +123,7 @@ - + @@ -131,15 +131,15 @@ - + - - - + + + @@ -147,63 +147,63 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -211,23 +211,23 @@ - + - + - + - + - + @@ -235,31 +235,31 @@ - + - + - + - + - + - + - + @@ -267,7 +267,7 @@ - + @@ -275,55 +275,55 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -331,23 +331,23 @@ - + - + - + - + - + @@ -355,15 +355,15 @@ - + - + - + @@ -371,7 +371,7 @@ - + @@ -379,7 +379,7 @@ - + @@ -387,7 +387,7 @@ - +
    src/adt/Leaf.js Leaf 100 %2/2445 byte446 byte 232021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/adt/Node.js Node 100 %2/2584 byte585 byte 272021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/adt/RedBlackTree.js RedBlackTree85 %12/144295 byte1672021-03-01 20:30:16 (UTC)86 %13/154447 byte1762021-03-02 14:23:08 (UTC)
    src/adt/index.js- 89 byte 32021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/color/BLACK.js100 %1/1 55 byte 42021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/color/RED.js100 %1/1 51 byte 42021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/color/index.js- 54 byte 22021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/debug/debug.js _debug 100 %1/1488 byte202021-03-01 20:30:16 (UTC)647 byte262021-03-02 14:23:08 (UTC)
    src/debug/index.js- 28 byte 12021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/delete_case1.js delete_case1 100 %1/1430 byte434 byte 152021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/delete_case2.js delete_case2 100 %1/11144 byte1151 byte 412021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/delete_case3.js delete_case3 100 %1/11255 byte1263 byte 442021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/delete_case4.js delete_case4 100 %1/11422 byte1431 byte 462021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/delete_case5.js delete_case5 100 %1/11829 byte1839 byte 582021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/delete_case6.js delete_case6 100 %1/11516 byte1525 byte 512021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/delete_one_child.js delete_one_child 100 %1/11333 byte1340 byte 422021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/index.js- 284 byte 82021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/deletion/replace_node.js replace_node 100 %1/1383 byte387 byte 152021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/family/grandparent.js grandparent 100 %1/1316 byte320 byte 112021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/family/index.js- 126 byte 42021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/family/predecessor.js predecessor 100 %1/1369 byte373 byte 152021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/family/sibling.js sibling 100 %1/1366 byte370 byte 132021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/family/uncle.js uncle 100 %1/1432 byte436 byte 162021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/index.js- 318 byte 92021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/insertion/index.js- 204 byte 62021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/insertion/insert.js insert 100 %1/11120 byte1124 byte 432021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/insertion/insert_case1.js insert_case1 100 %1/1392 byte397 byte 202021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/insertion/insert_case2.js insert_case2 100 %1/1451 byte456 byte 242021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/insertion/insert_case3.js insert_case3 100 %1/11073 byte1081 byte 382021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/insertion/insert_case4.js insert_case4 100 %1/12236 byte2240 byte 782021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/insertion/insert_case5.js insert_case5 100 %1/11444 byte1450 byte 472021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/rotate/index.js- 69 byte 22021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/rotate/rotate_left.js rotate_left 100 %1/1624 byte632 byte 342021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/rotate/rotate_right.js rotate_right 100 %1/1634 byte642 byte 342021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/search/index.js- 29 byte 12021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/search/search.js search 100 %1/1475 byte479 byte 232021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/traversal/index.js- 76 byte 22021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/traversal/inordertraversal.js100 %1/1 687 byte 242021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    src/traversal/rangetraversal.js100 %1/1 1177 byte 312021-03-01 20:30:16 (UTC)2021-03-02 14:23:08 (UTC)
    From 48882ceae4fcf0b51c3521920f106ae75f0f3a4b Mon Sep 17 00:00:00 2001 From: aureooms Date: Mon, 29 Mar 2021 15:06:17 +0000 Subject: [PATCH 21/26] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20au?= =?UTF-8?q?reooms/js-red-black-tree@5ab26adc0bcbed3eacbc4fd6312dd043114eba?= =?UTF-8?q?ef=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.json | 2 +- source.html | 78 ++++++++++++++++++++++++++--------------------------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/index.json b/index.json index e4d0d13..a5c5d17 100644 --- a/index.json +++ b/index.json @@ -2568,7 +2568,7 @@ }, { "kind": "packageJSON", - "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"5.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"c8 --all --src src --reporter=lcov npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.13\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.8\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.6.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"5.2.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"test\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"development\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"production\": {\n \"plugins\": [\n \"babel-plugin-unassert\",\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", + "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"6.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"esmodule\": \"dist/index.modern.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"c8 --all --src src --reporter=lcov npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.13\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.8\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.6.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"5.2.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"test\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"development\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"production\": {\n \"plugins\": [\n \"babel-plugin-unassert\",\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/package.json", "name": "package.json", "static": true, diff --git a/source.html b/source.html index 729c531..7163c32 100644 --- a/source.html +++ b/source.html @@ -83,7 +83,7 @@ 100 %2/2 446 byte 23 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/adt/Node.js @@ -91,7 +91,7 @@ 100 %2/2 585 byte 27 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/adt/RedBlackTree.js @@ -99,7 +99,7 @@ 86 %13/15 4447 byte 176 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/adt/index.js @@ -107,7 +107,7 @@ - 89 byte 3 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/color/BLACK.js @@ -115,7 +115,7 @@ 100 %1/1 55 byte 4 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/color/RED.js @@ -123,7 +123,7 @@ 100 %1/1 51 byte 4 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/color/index.js @@ -131,7 +131,7 @@ - 54 byte 2 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/debug/debug.js @@ -139,7 +139,7 @@ 100 %1/1 647 byte 26 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/debug/index.js @@ -147,7 +147,7 @@ - 28 byte 1 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/delete_case1.js @@ -155,7 +155,7 @@ 100 %1/1 434 byte 15 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/delete_case2.js @@ -163,7 +163,7 @@ 100 %1/1 1151 byte 41 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/delete_case3.js @@ -171,7 +171,7 @@ 100 %1/1 1263 byte 44 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/delete_case4.js @@ -179,7 +179,7 @@ 100 %1/1 1431 byte 46 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/delete_case5.js @@ -187,7 +187,7 @@ 100 %1/1 1839 byte 58 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/delete_case6.js @@ -195,7 +195,7 @@ 100 %1/1 1525 byte 51 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/delete_one_child.js @@ -203,7 +203,7 @@ 100 %1/1 1340 byte 42 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/index.js @@ -211,7 +211,7 @@ - 284 byte 8 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/deletion/replace_node.js @@ -219,7 +219,7 @@ 100 %1/1 387 byte 15 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/family/grandparent.js @@ -227,7 +227,7 @@ 100 %1/1 320 byte 11 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/family/index.js @@ -235,7 +235,7 @@ - 126 byte 4 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/family/predecessor.js @@ -243,7 +243,7 @@ 100 %1/1 373 byte 15 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/family/sibling.js @@ -251,7 +251,7 @@ 100 %1/1 370 byte 13 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/family/uncle.js @@ -259,7 +259,7 @@ 100 %1/1 436 byte 16 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/index.js @@ -267,7 +267,7 @@ - 318 byte 9 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/insertion/index.js @@ -275,7 +275,7 @@ - 204 byte 6 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/insertion/insert.js @@ -283,7 +283,7 @@ 100 %1/1 1124 byte 43 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/insertion/insert_case1.js @@ -291,7 +291,7 @@ 100 %1/1 397 byte 20 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/insertion/insert_case2.js @@ -299,7 +299,7 @@ 100 %1/1 456 byte 24 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/insertion/insert_case3.js @@ -307,7 +307,7 @@ 100 %1/1 1081 byte 38 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/insertion/insert_case4.js @@ -315,7 +315,7 @@ 100 %1/1 2240 byte 78 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/insertion/insert_case5.js @@ -323,7 +323,7 @@ 100 %1/1 1450 byte 47 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/rotate/index.js @@ -331,7 +331,7 @@ - 69 byte 2 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/rotate/rotate_left.js @@ -339,7 +339,7 @@ 100 %1/1 632 byte 34 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/rotate/rotate_right.js @@ -347,7 +347,7 @@ 100 %1/1 642 byte 34 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/search/index.js @@ -355,7 +355,7 @@ - 29 byte 1 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/search/search.js @@ -363,7 +363,7 @@ 100 %1/1 479 byte 23 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/traversal/index.js @@ -371,7 +371,7 @@ - 76 byte 2 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/traversal/inordertraversal.js @@ -379,7 +379,7 @@ 100 %1/1 687 byte 24 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) src/traversal/rangetraversal.js @@ -387,7 +387,7 @@ 100 %1/1 1177 byte 31 - 2021-03-02 14:23:08 (UTC) + 2021-03-02 15:05:30 (UTC) From 5e58121ddd89eb87f348d2a37cb49e2a88aab0e9 Mon Sep 17 00:00:00 2001 From: aureooms Date: Tue, 30 Mar 2021 09:15:25 +0000 Subject: [PATCH 22/26] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20au?= =?UTF-8?q?reooms/js-red-black-tree@62102386b73bc52a2ad585c091cb2a6d50d99a?= =?UTF-8?q?8f=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ast/source/adt/index.js.json | 570 - ast/source/api/empty.js.json | 885 ++ ast/source/api/from.js.json | 885 ++ ast/source/color/BLACK.js.json | 350 +- ast/source/color/RED.js.json | 350 +- ast/source/color/index.js.json | 401 - ast/source/debug/_debug.js.json | 7257 ++++++++++ ast/source/debug/debug.js.json | 4013 ------ ast/source/debug/index.js.json | 232 - ast/source/deletion/delete_case1.js.json | 3557 ++++- ast/source/deletion/delete_case2.js.json | 6962 +++++++--- ast/source/deletion/delete_case3.js.json | 7174 +++++++--- ast/source/deletion/delete_case4.js.json | 8745 +++++++++--- ast/source/deletion/delete_case5.js.json | 10367 ++++++++++---- ast/source/deletion/delete_case6.js.json | 9311 ++++++++++--- ast/source/deletion/delete_one_child.js.json | 7090 +++++++--- ast/source/deletion/index.js.json | 1415 -- ast/source/deletion/replace_node.js.json | 4529 +++++-- ast/source/family/grandparent.js.json | 3023 ++++- ast/source/family/index.js.json | 739 - ast/source/family/predecessor.js.json | 3444 ++++- ast/source/family/sibling.js.json | 3359 ++++- ast/source/family/uncle.js.json | 4216 ++++-- ast/source/index.js.json | 9585 ++++++++++++- ast/source/insertion/index.js.json | 1077 -- ast/source/insertion/insert.js.json | 4368 ++++-- ast/source/insertion/insert_case1.js.json | 4494 ++++++- ast/source/insertion/insert_case2.js.json | 4886 ++++++- ast/source/insertion/insert_case3.js.json | 7931 ++++++++--- ast/source/insertion/insert_case4.js.json | 8598 +++++++++--- ast/source/insertion/insert_case5.js.json | 11163 +++++++++++++--- ast/source/rotate/index.js.json | 401 - ast/source/rotate/rotate_left.js.json | 6904 +++++++--- ast/source/rotate/rotate_right.js.json | 6994 +++++++--- ast/source/search/index.js.json | 232 - ast/source/search/search.js.json | 4938 +++++-- ast/source/traversal/index.js.json | 401 - ast/source/traversal/inordertraversal.js.json | 3139 +++-- ast/source/traversal/rangetraversal.js.json | 6716 ++++++---- ast/source/{adt => types}/Leaf.js.json | 1662 ++- ast/source/{adt => types}/Node.js.json | 1540 ++- .../{adt => types}/RedBlackTree.js.json | 9524 +++++++------ badge.svg | 4 +- .../RedBlackTree.js~RedBlackTree.html | 240 +- coverage.json | 43 +- .../{adt/index.js.html => api/empty.js.html} | 23 +- .../{debug/index.js.html => api/from.js.html} | 21 +- file/src/color/BLACK.js.html | 11 +- file/src/color/RED.js.html | 11 +- file/src/color/index.js.html | 84 - .../debug/{debug.js.html => _debug.js.html} | 31 +- file/src/deletion/delete_case1.js.html | 27 +- file/src/deletion/delete_case2.js.html | 33 +- file/src/deletion/delete_case3.js.html | 31 +- file/src/deletion/delete_case4.js.html | 32 +- file/src/deletion/delete_case5.js.html | 33 +- file/src/deletion/delete_case6.js.html | 32 +- file/src/deletion/delete_one_child.js.html | 47 +- file/src/deletion/index.js.html | 90 - file/src/deletion/replace_node.js.html | 26 +- file/src/family/grandparent.js.html | 21 +- file/src/family/index.js.html | 86 - file/src/family/predecessor.js.html | 24 +- file/src/family/sibling.js.html | 28 +- file/src/family/uncle.js.html | 28 +- file/src/index.js.html | 48 +- file/src/insertion/index.js.html | 88 - file/src/insertion/insert.js.html | 21 +- file/src/insertion/insert_case1.js.html | 24 +- file/src/insertion/insert_case2.js.html | 26 +- file/src/insertion/insert_case3.js.html | 33 +- file/src/insertion/insert_case4.js.html | 30 +- file/src/insertion/insert_case5.js.html | 89 +- file/src/rotate/index.js.html | 84 - file/src/rotate/rotate_left.js.html | 19 +- file/src/rotate/rotate_right.js.html | 19 +- file/src/search/index.js.html | 83 - file/src/search/search.js.html | 27 +- file/src/traversal/index.js.html | 84 - file/src/traversal/inordertraversal.js.html | 20 +- file/src/traversal/rangetraversal.js.html | 38 +- file/src/{adt => types}/Leaf.js.html | 24 +- file/src/{adt => types}/Node.js.html | 28 +- file/src/{adt => types}/RedBlackTree.js.html | 68 +- function/index.html | 246 +- identifiers.html | 179 +- index.html | 19 +- index.json | 2122 ++- manual/index.html | 4 +- manual/usage.html | 4 +- script/search_index.js | 300 +- source.html | 300 +- variable/index.html | 158 +- 93 files changed, 139588 insertions(+), 49030 deletions(-) delete mode 100644 ast/source/adt/index.js.json create mode 100644 ast/source/api/empty.js.json create mode 100644 ast/source/api/from.js.json delete mode 100644 ast/source/color/index.js.json create mode 100644 ast/source/debug/_debug.js.json delete mode 100644 ast/source/debug/debug.js.json delete mode 100644 ast/source/debug/index.js.json delete mode 100644 ast/source/deletion/index.js.json delete mode 100644 ast/source/family/index.js.json delete mode 100644 ast/source/insertion/index.js.json delete mode 100644 ast/source/rotate/index.js.json delete mode 100644 ast/source/search/index.js.json delete mode 100644 ast/source/traversal/index.js.json rename ast/source/{adt => types}/Leaf.js.json (57%) rename ast/source/{adt => types}/Node.js.json (73%) rename ast/source/{adt => types}/RedBlackTree.js.json (76%) rename class/src/{adt => types}/RedBlackTree.js~RedBlackTree.html (75%) rename file/src/{adt/index.js.html => api/empty.js.html} (89%) rename file/src/{debug/index.js.html => api/from.js.html} (89%) delete mode 100644 file/src/color/index.js.html rename file/src/debug/{debug.js.html => _debug.js.html} (87%) delete mode 100644 file/src/deletion/index.js.html delete mode 100644 file/src/family/index.js.html delete mode 100644 file/src/insertion/index.js.html delete mode 100644 file/src/rotate/index.js.html delete mode 100644 file/src/search/index.js.html delete mode 100644 file/src/traversal/index.js.html rename file/src/{adt => types}/Leaf.js.html (88%) rename file/src/{adt => types}/Node.js.html (87%) rename file/src/{adt => types}/RedBlackTree.js.html (84%) diff --git a/ast/source/adt/index.js.json b/ast/source/adt/index.js.json deleted file mode 100644 index 9423bd7..0000000 --- a/ast/source/adt/index.js.json +++ /dev/null @@ -1,570 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 89, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 89, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 4, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - }, - "extra": { - "rawValue": "./Leaf.js", - "raw": "'./Leaf.js'" - }, - "value": "./Leaf.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 27, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 26 - } - }, - "source": { - "type": "StringLiteral", - "start": 41, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "extra": { - "rawValue": "./Node.js", - "raw": "'./Node.js'" - }, - "value": "./Node.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 54, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 68, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "extra": { - "rawValue": "./RedBlackTree.js", - "raw": "'./RedBlackTree.js'" - }, - "value": "./RedBlackTree.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./Leaf.js", - "start": 14, - "end": 25, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 25 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 25, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 25 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 27, - "end": 33, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 34, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./Node.js", - "start": 41, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 26 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 54, - "end": 60, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 61, - "end": 62, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 63, - "end": 67, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./RedBlackTree.js", - "start": 68, - "end": 87, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 87, - "end": 88, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 89, - "end": 89, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/api/empty.js.json b/ast/source/api/empty.js.json new file mode 100644 index 0000000..2210c0d --- /dev/null +++ b/ast/source/api/empty.js.json @@ -0,0 +1,885 @@ +{ + "type": "File", + "start": 0, + "end": 176, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 176, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 25, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "extra": { + "rawValue": "../types/RedBlackTree.js", + "raw": "'../types/RedBlackTree.js'" + }, + "value": "../types/RedBlackTree.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.empty}.\n * @function empty\n ", + "start": 54, + "end": 119, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 120, + "end": 153, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 126, + "end": 152, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 126, + "end": 131, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 11 + }, + "identifierName": "empty" + }, + "name": "empty", + "leadingComments": null + }, + "init": { + "type": "MemberExpression", + "start": 134, + "end": 152, + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 32 + } + }, + "object": { + "type": "Identifier", + "start": 134, + "end": 146, + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 26 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + }, + "property": { + "type": "Identifier", + "start": 147, + "end": 152, + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 32 + }, + "identifierName": "empty" + }, + "name": "empty" + }, + "computed": false + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 154, + "end": 175, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 21 + } + }, + "declaration": { + "type": "Identifier", + "start": 169, + "end": 174, + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 20 + }, + "identifierName": "empty" + }, + "name": "empty" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 154, + "end": 175, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 21 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 120, + "end": 153, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 33 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 126, + "end": 152, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 32 + } + }, + "id": { + "type": "Identifier", + "start": 126, + "end": 131, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 11 + }, + "identifierName": "empty" + }, + "name": "empty", + "leadingComments": null + }, + "init": { + "type": "MemberExpression", + "start": 134, + "end": 152, + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 32 + } + }, + "object": { + "type": "Identifier", + "start": 134, + "end": 146, + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 26 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + }, + "property": { + "type": "Identifier", + "start": 147, + "end": 152, + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 32 + }, + "identifierName": "empty" + }, + "name": "empty" + }, + "computed": false + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.empty}.\n * @function empty\n ", + "start": 54, + "end": 119, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.empty}.\n * @function empty\n ", + "start": 54, + "end": 119, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RedBlackTree", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/RedBlackTree.js", + "start": 25, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 51, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.empty}.\n * @function empty\n ", + "start": 54, + "end": 119, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 120, + "end": 125, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "empty", + "start": 126, + "end": 131, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 11 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 132, + "end": 133, + "loc": { + "start": { + "line": 7, + "column": 12 + }, + "end": { + "line": 7, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RedBlackTree", + "start": 134, + "end": 146, + "loc": { + "start": { + "line": 7, + "column": 14 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 146, + "end": 147, + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "empty", + "start": 147, + "end": 152, + "loc": { + "start": { + "line": 7, + "column": 27 + }, + "end": { + "line": 7, + "column": 32 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 152, + "end": 153, + "loc": { + "start": { + "line": 7, + "column": 32 + }, + "end": { + "line": 7, + "column": 33 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 154, + "end": 160, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 161, + "end": 168, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "empty", + "start": 169, + "end": 174, + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 174, + "end": 175, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 21 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 176, + "end": 176, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/api/from.js.json b/ast/source/api/from.js.json new file mode 100644 index 0000000..0e7da00 --- /dev/null +++ b/ast/source/api/from.js.json @@ -0,0 +1,885 @@ +{ + "type": "File", + "start": 0, + "end": 171, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 171, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 52 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 25, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 51 + } + }, + "extra": { + "rawValue": "../types/RedBlackTree.js", + "raw": "'../types/RedBlackTree.js'" + }, + "value": "../types/RedBlackTree.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.from}.\n * @function from\n ", + "start": 54, + "end": 117, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 118, + "end": 149, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 31 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 124, + "end": 148, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 124, + "end": 128, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 10 + }, + "identifierName": "from" + }, + "name": "from", + "leadingComments": null + }, + "init": { + "type": "MemberExpression", + "start": 131, + "end": 148, + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "object": { + "type": "Identifier", + "start": 131, + "end": 143, + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 25 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + }, + "property": { + "type": "Identifier", + "start": 144, + "end": 148, + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 30 + }, + "identifierName": "from" + }, + "name": "from" + }, + "computed": false + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 150, + "end": 170, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 20 + } + }, + "declaration": { + "type": "Identifier", + "start": 165, + "end": 169, + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 19 + }, + "identifierName": "from" + }, + "name": "from" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 150, + "end": 170, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 20 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 118, + "end": 149, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 31 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 124, + "end": 148, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "id": { + "type": "Identifier", + "start": 124, + "end": 128, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 10 + }, + "identifierName": "from" + }, + "name": "from", + "leadingComments": null + }, + "init": { + "type": "MemberExpression", + "start": 131, + "end": 148, + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 30 + } + }, + "object": { + "type": "Identifier", + "start": 131, + "end": 143, + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 25 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + }, + "property": { + "type": "Identifier", + "start": 144, + "end": 148, + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 30 + }, + "identifierName": "from" + }, + "name": "from" + }, + "computed": false + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.from}.\n * @function from\n ", + "start": 54, + "end": 117, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.from}.\n * @function from\n ", + "start": 54, + "end": 117, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RedBlackTree", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 20, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 20 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/RedBlackTree.js", + "start": 25, + "end": 51, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 51 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 51, + "end": 52, + "loc": { + "start": { + "line": 1, + "column": 51 + }, + "end": { + "line": 1, + "column": 52 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.from}.\n * @function from\n ", + "start": 54, + "end": 117, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 118, + "end": 123, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 124, + "end": 128, + "loc": { + "start": { + "line": 7, + "column": 6 + }, + "end": { + "line": 7, + "column": 10 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 129, + "end": 130, + "loc": { + "start": { + "line": 7, + "column": 11 + }, + "end": { + "line": 7, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RedBlackTree", + "start": 131, + "end": 143, + "loc": { + "start": { + "line": 7, + "column": 13 + }, + "end": { + "line": 7, + "column": 25 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 143, + "end": 144, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 144, + "end": 148, + "loc": { + "start": { + "line": 7, + "column": 26 + }, + "end": { + "line": 7, + "column": 30 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 148, + "end": 149, + "loc": { + "start": { + "line": 7, + "column": 30 + }, + "end": { + "line": 7, + "column": 31 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 150, + "end": 156, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 157, + "end": 164, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 165, + "end": 169, + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 169, + "end": 170, + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 20 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 171, + "end": 171, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/color/BLACK.js.json b/ast/source/color/BLACK.js.json index d4487a8..94ee85a 100644 --- a/ast/source/color/BLACK.js.json +++ b/ast/source/color/BLACK.js.json @@ -1,37 +1,37 @@ { "type": "File", "start": 0, - "end": 55, + "end": 70, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 5, + "line": 6, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 55, + "end": 70, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 5, + "line": 6, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", + "type": "Identifier", "start": 31, - "end": 54, + "end": 47, "loc": { "start": { "line": 4, @@ -39,52 +39,160 @@ }, "end": { "line": 4, - "column": 23 + "column": 16 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 37, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "id": { + "type": "Identifier", + "start": 37, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 11 + }, + "identifierName": "BLACK" + }, + "name": "BLACK", + "leadingComments": null + }, + "init": { + "type": "NumericLiteral", + "start": 45, + "end": 46, + "loc": { + "start": { + "line": 4, + "column": 14 + }, + "end": { + "line": 4, + "column": 15 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 48, + "end": 69, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 21 + } + }, + "declaration": { + "type": "Identifier", + "start": 63, + "end": 68, + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 20 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 48, + "end": 69, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 21 } }, - "specifiers": [], - "source": null, "declaration": { "type": "VariableDeclaration", - "start": 38, - "end": 54, + "start": 31, + "end": 47, "loc": { "start": { "line": 4, - "column": 7 + "column": 0 }, "end": { "line": 4, - "column": 23 + "column": 16 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 44, - "end": 53, + "start": 37, + "end": 46, "loc": { "start": { "line": 4, - "column": 13 + "column": 6 }, "end": { "line": 4, - "column": 22 + "column": 15 } }, "id": { "type": "Identifier", - "start": 44, - "end": 49, + "start": 37, + "end": 42, "loc": { "start": { "line": 4, - "column": 13 + "column": 6 }, "end": { "line": 4, - "column": 18 + "column": 11 }, "identifierName": "BLACK" }, @@ -93,16 +201,16 @@ }, "init": { "type": "NumericLiteral", - "start": 52, - "end": 53, + "start": 45, + "end": 46, "loc": { "start": { "line": 4, - "column": 21 + "column": 14 }, "end": { "line": 4, - "column": 22 + "column": 15 } }, "extra": { @@ -134,25 +242,7 @@ } ], "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Constant for black.\n ", - "start": 0, - "end": 30, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } - } - ] + } } ], "directives": [] @@ -194,8 +284,8 @@ }, { "type": { - "label": "export", - "keyword": "export", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -206,9 +296,9 @@ "binop": null, "updateContext": null }, - "value": "export", + "value": "const", "start": 31, - "end": 37, + "end": 36, "loc": { "start": { "line": 4, @@ -216,41 +306,66 @@ }, "end": { "line": 4, - "column": 6 + "column": 5 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 37, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "const", - "start": 38, - "end": 43, + "value": "=", + "start": 43, + "end": 44, "loc": { "start": { "line": 4, - "column": 7 + "column": 12 }, "end": { "line": 4, - "column": 12 + "column": 13 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -258,54 +373,55 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "BLACK", - "start": 44, - "end": 49, + "value": 0, + "start": 45, + "end": 46, "loc": { "start": { "line": 4, - "column": 13 + "column": 14 }, "end": { "line": 4, - "column": 18 + "column": 15 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 50, - "end": 51, + "start": 46, + "end": 47, "loc": { "start": { "line": 4, - "column": 19 + "column": 15 }, "end": { "line": 4, - "column": 20 + "column": 16 } } }, { "type": { - "label": "num", + "label": "export", + "keyword": "export", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -314,17 +430,71 @@ "binop": null, "updateContext": null }, - "value": 0, - "start": 52, - "end": 53, + "value": "export", + "start": 48, + "end": 54, "loc": { "start": { - "line": 4, - "column": 21 + "line": 5, + "column": 0 }, "end": { - "line": 4, - "column": 22 + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 55, + "end": 62, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 63, + "end": 68, + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 20 } } }, @@ -341,16 +511,16 @@ "binop": null, "updateContext": null }, - "start": 53, - "end": 54, + "start": 68, + "end": 69, "loc": { "start": { - "line": 4, - "column": 22 + "line": 5, + "column": 20 }, "end": { - "line": 4, - "column": 23 + "line": 5, + "column": 21 } } }, @@ -367,15 +537,15 @@ "binop": null, "updateContext": null }, - "start": 55, - "end": 55, + "start": 70, + "end": 70, "loc": { "start": { - "line": 5, + "line": 6, "column": 0 }, "end": { - "line": 5, + "line": 6, "column": 0 } } diff --git a/ast/source/color/RED.js.json b/ast/source/color/RED.js.json index c3a6128..6c129ec 100644 --- a/ast/source/color/RED.js.json +++ b/ast/source/color/RED.js.json @@ -1,37 +1,37 @@ { "type": "File", "start": 0, - "end": 51, + "end": 64, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 5, + "line": 6, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 51, + "end": 64, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 5, + "line": 6, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", + "type": "Identifier", "start": 29, - "end": 50, + "end": 43, "loc": { "start": { "line": 4, @@ -39,52 +39,160 @@ }, "end": { "line": 4, - "column": 21 + "column": 14 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 35, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "id": { + "type": "Identifier", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + }, + "identifierName": "RED" + }, + "name": "RED", + "leadingComments": null + }, + "init": { + "type": "NumericLiteral", + "start": 41, + "end": 42, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 13 + } + }, + "extra": { + "rawValue": 1, + "raw": "1" + }, + "value": 1 + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 44, + "end": 63, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "declaration": { + "type": "Identifier", + "start": 59, + "end": 62, + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 18 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 44, + "end": 63, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 19 } }, - "specifiers": [], - "source": null, "declaration": { "type": "VariableDeclaration", - "start": 36, - "end": 50, + "start": 29, + "end": 43, "loc": { "start": { "line": 4, - "column": 7 + "column": 0 }, "end": { "line": 4, - "column": 21 + "column": 14 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 42, - "end": 49, + "start": 35, + "end": 42, "loc": { "start": { "line": 4, - "column": 13 + "column": 6 }, "end": { "line": 4, - "column": 20 + "column": 13 } }, "id": { "type": "Identifier", - "start": 42, - "end": 45, + "start": 35, + "end": 38, "loc": { "start": { "line": 4, - "column": 13 + "column": 6 }, "end": { "line": 4, - "column": 16 + "column": 9 }, "identifierName": "RED" }, @@ -93,16 +201,16 @@ }, "init": { "type": "NumericLiteral", - "start": 48, - "end": 49, + "start": 41, + "end": 42, "loc": { "start": { "line": 4, - "column": 19 + "column": 12 }, "end": { "line": 4, - "column": 20 + "column": 13 } }, "extra": { @@ -134,25 +242,7 @@ } ], "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Constant for red.\n ", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 3 - } - } - } - ] + } } ], "directives": [] @@ -194,8 +284,8 @@ }, { "type": { - "label": "export", - "keyword": "export", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -206,9 +296,9 @@ "binop": null, "updateContext": null }, - "value": "export", + "value": "const", "start": 29, - "end": 35, + "end": 34, "loc": { "start": { "line": 4, @@ -216,41 +306,66 @@ }, "end": { "line": 4, - "column": 6 + "column": 5 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "value": "RED", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 4, + "column": 6 + }, + "end": { + "line": 4, + "column": 9 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "const", - "start": 36, - "end": 41, + "value": "=", + "start": 39, + "end": 40, "loc": { "start": { "line": 4, - "column": 7 + "column": 10 }, "end": { "line": 4, - "column": 12 + "column": 11 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -258,54 +373,55 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 42, - "end": 45, + "value": 1, + "start": 41, + "end": 42, "loc": { "start": { "line": 4, - "column": 13 + "column": 12 }, "end": { "line": 4, - "column": 16 + "column": 13 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 46, - "end": 47, + "start": 42, + "end": 43, "loc": { "start": { "line": 4, - "column": 17 + "column": 13 }, "end": { "line": 4, - "column": 18 + "column": 14 } } }, { "type": { - "label": "num", + "label": "export", + "keyword": "export", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -314,17 +430,71 @@ "binop": null, "updateContext": null }, - "value": 1, - "start": 48, - "end": 49, + "value": "export", + "start": 44, + "end": 50, "loc": { "start": { - "line": 4, - "column": 19 + "line": 5, + "column": 0 }, "end": { - "line": 4, - "column": 20 + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 51, + "end": 58, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 59, + "end": 62, + "loc": { + "start": { + "line": 5, + "column": 15 + }, + "end": { + "line": 5, + "column": 18 } } }, @@ -341,16 +511,16 @@ "binop": null, "updateContext": null }, - "start": 49, - "end": 50, + "start": 62, + "end": 63, "loc": { "start": { - "line": 4, - "column": 20 + "line": 5, + "column": 18 }, "end": { - "line": 4, - "column": 21 + "line": 5, + "column": 19 } } }, @@ -367,15 +537,15 @@ "binop": null, "updateContext": null }, - "start": 51, - "end": 51, + "start": 64, + "end": 64, "loc": { "start": { - "line": 5, + "line": 6, "column": 0 }, "end": { - "line": 5, + "line": 6, "column": 0 } } diff --git a/ast/source/color/index.js.json b/ast/source/color/index.js.json deleted file mode 100644 index 8a8b8f5..0000000 --- a/ast/source/color/index.js.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 54, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "extra": { - "rawValue": "./BLACK.js", - "raw": "'./BLACK.js'" - }, - "value": "./BLACK.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 28, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 25 - } - }, - "source": { - "type": "StringLiteral", - "start": 42, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 24 - } - }, - "extra": { - "rawValue": "./RED.js", - "raw": "'./RED.js'" - }, - "value": "./RED.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./BLACK.js", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 28, - "end": 34, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 35, - "end": 36, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 37, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./RED.js", - "start": 42, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 24 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 52, - "end": 53, - "loc": { - "start": { - "line": 2, - "column": 24 - }, - "end": { - "line": 2, - "column": 25 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 54, - "end": 54, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/debug/_debug.js.json b/ast/source/debug/_debug.js.json new file mode 100644 index 0000000..a57a4d8 --- /dev/null +++ b/ast/source/debug/_debug.js.json @@ -0,0 +1,7257 @@ +{ + "type": "File", + "start": 0, + "end": 901, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 38, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 901, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 38, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 83, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + } + }, + { + "type": "ImportDeclaration", + "start": 103, + "end": 141, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 110, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 110, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 12 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 121, + "end": 140, + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", + "start": 143, + "end": 289, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 290, + "end": 876, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 35, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 296, + "end": 875, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 35, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 296, + "end": 302, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "_debug" + }, + "name": "_debug", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 305, + "end": 875, + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 35, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 28 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 307, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 20 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 307, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 20 + }, + "identifierName": "red" + }, + "name": "red" + }, + "value": { + "type": "Identifier", + "start": 307, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 20 + }, + "identifierName": "red" + }, + "name": "red" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 312, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 27 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 312, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 27 + }, + "identifierName": "black" + }, + "name": "black" + }, + "value": { + "type": "Identifier", + "start": 312, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 27 + }, + "identifierName": "black" + }, + "name": "black" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 323, + "end": 875, + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 35, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 518, + "end": 857, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 32, + "column": 3 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 524, + "end": 856, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 32, + "column": 2 + } + }, + "id": { + "type": "Identifier", + "start": 524, + "end": 529, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 12 + }, + "identifierName": "debug" + }, + "name": "debug", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 532, + "end": 856, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 32, + "column": 2 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 533, + "end": 537, + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 20 + }, + "identifierName": "root" + }, + "name": "root" + } + ], + "body": { + "type": "BlockStatement", + "start": 542, + "end": 856, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 32, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 546, + "end": 599, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 55 + } + }, + "expression": { + "type": "CallExpression", + "start": 546, + "end": 598, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 54 + } + }, + "callee": { + "type": "Identifier", + "start": 546, + "end": 552, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 553, + "end": 597, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 53 + } + }, + "left": { + "type": "BinaryExpression", + "start": 553, + "end": 573, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 13 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 569, + "end": 573, + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 29 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 577, + "end": 597, + "loc": { + "start": { + "line": 21, + "column": 33 + }, + "end": { + "line": 21, + "column": 53 + } + }, + "left": { + "type": "Identifier", + "start": 577, + "end": 581, + "loc": { + "start": { + "line": 21, + "column": 33 + }, + "end": { + "line": 21, + "column": 37 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 593, + "end": 597, + "loc": { + "start": { + "line": 21, + "column": 49 + }, + "end": { + "line": 21, + "column": 53 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 602, + "end": 681, + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "test": { + "type": "CallExpression", + "start": 606, + "end": 619, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 19 + } + }, + "callee": { + "type": "MemberExpression", + "start": 606, + "end": 617, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 606, + "end": 610, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 611, + "end": 617, + "loc": { + "start": { + "line": 22, + "column": 11 + }, + "end": { + "line": 22, + "column": 17 + }, + "identifierName": "isLeaf" + }, + "name": "isLeaf" + }, + "computed": false + }, + "arguments": [] + }, + "consequent": { + "type": "BlockStatement", + "start": 621, + "end": 681, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 626, + "end": 655, + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 626, + "end": 654, + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 626, + "end": 632, + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 633, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 633, + "end": 637, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 649, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 30 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + ] + } + }, + { + "type": "ReturnStatement", + "start": 659, + "end": 677, + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 21 + } + }, + "argument": { + "type": "CallExpression", + "start": 666, + "end": 676, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 20 + } + }, + "callee": { + "type": "Identifier", + "start": 666, + "end": 671, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "black" + }, + "name": "black" + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 672, + "end": 675, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 19 + } + }, + "extra": { + "rawValue": "L", + "raw": "'L'" + }, + "value": "L" + } + ] + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 685, + "end": 714, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 685, + "end": 713, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "callee": { + "type": "Identifier", + "start": 685, + "end": 691, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 692, + "end": 712, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 692, + "end": 696, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 13 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 708, + "end": 712, + "loc": { + "start": { + "line": 27, + "column": 25 + }, + "end": { + "line": 27, + "column": 29 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 718, + "end": 787, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 71 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 724, + "end": 786, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 70 + } + }, + "id": { + "type": "Identifier", + "start": 724, + "end": 728, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 12 + }, + "identifierName": "repr" + }, + "name": "repr" + }, + "init": { + "type": "ConditionalExpression", + "start": 731, + "end": 786, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 70 + } + }, + "test": { + "type": "BinaryExpression", + "start": 731, + "end": 752, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 36 + } + }, + "left": { + "type": "MemberExpression", + "start": 731, + "end": 742, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 19 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 736, + "end": 742, + "loc": { + "start": { + "line": 29, + "column": 20 + }, + "end": { + "line": 29, + "column": 26 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 747, + "end": 752, + "loc": { + "start": { + "line": 29, + "column": 31 + }, + "end": { + "line": 29, + "column": 36 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "consequent": { + "type": "CallExpression", + "start": 755, + "end": 770, + "loc": { + "start": { + "line": 29, + "column": 39 + }, + "end": { + "line": 29, + "column": 54 + } + }, + "callee": { + "type": "Identifier", + "start": 755, + "end": 760, + "loc": { + "start": { + "line": 29, + "column": 39 + }, + "end": { + "line": 29, + "column": 44 + }, + "identifierName": "black" + }, + "name": "black" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 761, + "end": 769, + "loc": { + "start": { + "line": 29, + "column": 45 + }, + "end": { + "line": 29, + "column": 53 + } + }, + "object": { + "type": "Identifier", + "start": 761, + "end": 765, + "loc": { + "start": { + "line": 29, + "column": 45 + }, + "end": { + "line": 29, + "column": 49 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 766, + "end": 769, + "loc": { + "start": { + "line": 29, + "column": 50 + }, + "end": { + "line": 29, + "column": 53 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + }, + "alternate": { + "type": "CallExpression", + "start": 773, + "end": 786, + "loc": { + "start": { + "line": 29, + "column": 57 + }, + "end": { + "line": 29, + "column": 70 + } + }, + "callee": { + "type": "Identifier", + "start": 773, + "end": 776, + "loc": { + "start": { + "line": 29, + "column": 57 + }, + "end": { + "line": 29, + "column": 60 + }, + "identifierName": "red" + }, + "name": "red" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 777, + "end": 785, + "loc": { + "start": { + "line": 29, + "column": 61 + }, + "end": { + "line": 29, + "column": 69 + } + }, + "object": { + "type": "Identifier", + "start": 777, + "end": 781, + "loc": { + "start": { + "line": 29, + "column": 61 + }, + "end": { + "line": 29, + "column": 65 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 782, + "end": 785, + "loc": { + "start": { + "line": 29, + "column": 66 + }, + "end": { + "line": 29, + "column": 69 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + } + } + } + ], + "kind": "const" + }, + { + "type": "ReturnStatement", + "start": 791, + "end": 853, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 64 + } + }, + "argument": { + "type": "TemplateLiteral", + "start": 798, + "end": 852, + "loc": { + "start": { + "line": 31, + "column": 9 + }, + "end": { + "line": 31, + "column": 63 + } + }, + "expressions": [ + { + "type": "CallExpression", + "start": 802, + "end": 818, + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 802, + "end": 807, + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 18 + }, + "identifierName": "debug" + }, + "name": "debug" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 808, + "end": 817, + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 808, + "end": 812, + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 23 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 813, + "end": 817, + "loc": { + "start": { + "line": 31, + "column": 24 + }, + "end": { + "line": 31, + "column": 28 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + ] + }, + { + "type": "Identifier", + "start": 823, + "end": 827, + "loc": { + "start": { + "line": 31, + "column": 34 + }, + "end": { + "line": 31, + "column": 38 + }, + "identifierName": "repr" + }, + "name": "repr" + }, + { + "type": "CallExpression", + "start": 832, + "end": 849, + "loc": { + "start": { + "line": 31, + "column": 43 + }, + "end": { + "line": 31, + "column": 60 + } + }, + "callee": { + "type": "Identifier", + "start": 832, + "end": 837, + "loc": { + "start": { + "line": 31, + "column": 43 + }, + "end": { + "line": 31, + "column": 48 + }, + "identifierName": "debug" + }, + "name": "debug" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 838, + "end": 848, + "loc": { + "start": { + "line": 31, + "column": 49 + }, + "end": { + "line": 31, + "column": 59 + } + }, + "object": { + "type": "Identifier", + "start": 838, + "end": 842, + "loc": { + "start": { + "line": 31, + "column": 49 + }, + "end": { + "line": 31, + "column": 53 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 843, + "end": 848, + "loc": { + "start": { + "line": 31, + "column": 54 + }, + "end": { + "line": 31, + "column": 59 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + ] + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 799, + "end": 800, + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 11 + } + }, + "value": { + "raw": "(", + "cooked": "(" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 819, + "end": 821, + "loc": { + "start": { + "line": 31, + "column": 30 + }, + "end": { + "line": 31, + "column": 32 + } + }, + "value": { + "raw": ", ", + "cooked": ", " + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 828, + "end": 830, + "loc": { + "start": { + "line": 31, + "column": 39 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "value": { + "raw": ", ", + "cooked": ", " + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 850, + "end": 851, + "loc": { + "start": { + "line": 31, + "column": 61 + }, + "end": { + "line": 31, + "column": 62 + } + }, + "value": { + "raw": ")", + "cooked": ")" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t ", + "start": 326, + "end": 516, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 19, + "column": 4 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 860, + "end": 873, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 14 + } + }, + "argument": { + "type": "Identifier", + "start": 867, + "end": 872, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 13 + }, + "identifierName": "debug" + }, + "name": "debug" + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 878, + "end": 900, + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 22 + } + }, + "declaration": { + "type": "Identifier", + "start": 893, + "end": 899, + "loc": { + "start": { + "line": 37, + "column": 15 + }, + "end": { + "line": 37, + "column": 21 + }, + "identifierName": "_debug" + }, + "name": "_debug" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 878, + "end": 900, + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 22 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 290, + "end": 876, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 35, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 296, + "end": 875, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 35, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 296, + "end": 302, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "_debug" + }, + "name": "_debug", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 305, + "end": 875, + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 35, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 296, + "end": 302, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "_debug" + }, + "name": "_debug", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 28 + } + }, + "properties": [ + { + "type": "ObjectProperty", + "start": 307, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 20 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 307, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 20 + }, + "identifierName": "red" + }, + "name": "red" + }, + "value": { + "type": "Identifier", + "start": 307, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 20 + }, + "identifierName": "red" + }, + "name": "red" + }, + "extra": { + "shorthand": true + } + }, + { + "type": "ObjectProperty", + "start": 312, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 27 + } + }, + "method": false, + "shorthand": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 312, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 27 + }, + "identifierName": "black" + }, + "name": "black" + }, + "value": { + "type": "Identifier", + "start": 312, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 27 + }, + "identifierName": "black" + }, + "name": "black" + }, + "extra": { + "shorthand": true + } + } + ] + } + ], + "body": { + "type": "BlockStatement", + "start": 323, + "end": 875, + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 35, + "column": 1 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 518, + "end": 857, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 32, + "column": 3 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 524, + "end": 856, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 32, + "column": 2 + } + }, + "id": { + "type": "Identifier", + "start": 524, + "end": 529, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 12 + }, + "identifierName": "debug" + }, + "name": "debug", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 532, + "end": 856, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 32, + "column": 2 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 533, + "end": 537, + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 20 + }, + "identifierName": "root" + }, + "name": "root" + } + ], + "body": { + "type": "BlockStatement", + "start": 542, + "end": 856, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 32, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 546, + "end": 599, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 55 + } + }, + "expression": { + "type": "CallExpression", + "start": 546, + "end": 598, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 54 + } + }, + "callee": { + "type": "Identifier", + "start": 546, + "end": 552, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 553, + "end": 597, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 53 + } + }, + "left": { + "type": "BinaryExpression", + "start": 553, + "end": 573, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 13 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 569, + "end": 573, + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 29 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 577, + "end": 597, + "loc": { + "start": { + "line": 21, + "column": 33 + }, + "end": { + "line": 21, + "column": 53 + } + }, + "left": { + "type": "Identifier", + "start": 577, + "end": 581, + "loc": { + "start": { + "line": 21, + "column": 33 + }, + "end": { + "line": 21, + "column": 37 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 593, + "end": 597, + "loc": { + "start": { + "line": 21, + "column": 49 + }, + "end": { + "line": 21, + "column": 53 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 602, + "end": 681, + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "test": { + "type": "CallExpression", + "start": 606, + "end": 619, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 19 + } + }, + "callee": { + "type": "MemberExpression", + "start": 606, + "end": 617, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 606, + "end": 610, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 611, + "end": 617, + "loc": { + "start": { + "line": 22, + "column": 11 + }, + "end": { + "line": 22, + "column": 17 + }, + "identifierName": "isLeaf" + }, + "name": "isLeaf" + }, + "computed": false + }, + "arguments": [] + }, + "consequent": { + "type": "BlockStatement", + "start": 621, + "end": 681, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 626, + "end": 655, + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 626, + "end": 654, + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 626, + "end": 632, + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 633, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 633, + "end": 637, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 649, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 30 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + ] + } + }, + { + "type": "ReturnStatement", + "start": 659, + "end": 677, + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 21 + } + }, + "argument": { + "type": "CallExpression", + "start": 666, + "end": 676, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 20 + } + }, + "callee": { + "type": "Identifier", + "start": 666, + "end": 671, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "black" + }, + "name": "black" + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 672, + "end": 675, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 19 + } + }, + "extra": { + "rawValue": "L", + "raw": "'L'" + }, + "value": "L" + } + ] + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 685, + "end": 714, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 685, + "end": 713, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "callee": { + "type": "Identifier", + "start": 685, + "end": 691, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 692, + "end": 712, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 692, + "end": 696, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 13 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 708, + "end": 712, + "loc": { + "start": { + "line": 27, + "column": 25 + }, + "end": { + "line": 27, + "column": 29 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 718, + "end": 787, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 71 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 724, + "end": 786, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 70 + } + }, + "id": { + "type": "Identifier", + "start": 724, + "end": 728, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 12 + }, + "identifierName": "repr" + }, + "name": "repr" + }, + "init": { + "type": "ConditionalExpression", + "start": 731, + "end": 786, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 70 + } + }, + "test": { + "type": "BinaryExpression", + "start": 731, + "end": 752, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 36 + } + }, + "left": { + "type": "MemberExpression", + "start": 731, + "end": 742, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 19 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 736, + "end": 742, + "loc": { + "start": { + "line": 29, + "column": 20 + }, + "end": { + "line": 29, + "column": 26 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 747, + "end": 752, + "loc": { + "start": { + "line": 29, + "column": 31 + }, + "end": { + "line": 29, + "column": 36 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "consequent": { + "type": "CallExpression", + "start": 755, + "end": 770, + "loc": { + "start": { + "line": 29, + "column": 39 + }, + "end": { + "line": 29, + "column": 54 + } + }, + "callee": { + "type": "Identifier", + "start": 755, + "end": 760, + "loc": { + "start": { + "line": 29, + "column": 39 + }, + "end": { + "line": 29, + "column": 44 + }, + "identifierName": "black" + }, + "name": "black" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 761, + "end": 769, + "loc": { + "start": { + "line": 29, + "column": 45 + }, + "end": { + "line": 29, + "column": 53 + } + }, + "object": { + "type": "Identifier", + "start": 761, + "end": 765, + "loc": { + "start": { + "line": 29, + "column": 45 + }, + "end": { + "line": 29, + "column": 49 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 766, + "end": 769, + "loc": { + "start": { + "line": 29, + "column": 50 + }, + "end": { + "line": 29, + "column": 53 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + }, + "alternate": { + "type": "CallExpression", + "start": 773, + "end": 786, + "loc": { + "start": { + "line": 29, + "column": 57 + }, + "end": { + "line": 29, + "column": 70 + } + }, + "callee": { + "type": "Identifier", + "start": 773, + "end": 776, + "loc": { + "start": { + "line": 29, + "column": 57 + }, + "end": { + "line": 29, + "column": 60 + }, + "identifierName": "red" + }, + "name": "red" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 777, + "end": 785, + "loc": { + "start": { + "line": 29, + "column": 61 + }, + "end": { + "line": 29, + "column": 69 + } + }, + "object": { + "type": "Identifier", + "start": 777, + "end": 781, + "loc": { + "start": { + "line": 29, + "column": 61 + }, + "end": { + "line": 29, + "column": 65 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 782, + "end": 785, + "loc": { + "start": { + "line": 29, + "column": 66 + }, + "end": { + "line": 29, + "column": 69 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + } + } + } + ], + "kind": "const" + }, + { + "type": "ReturnStatement", + "start": 791, + "end": 853, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 64 + } + }, + "argument": { + "type": "TemplateLiteral", + "start": 798, + "end": 852, + "loc": { + "start": { + "line": 31, + "column": 9 + }, + "end": { + "line": 31, + "column": 63 + } + }, + "expressions": [ + { + "type": "CallExpression", + "start": 802, + "end": 818, + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 802, + "end": 807, + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 18 + }, + "identifierName": "debug" + }, + "name": "debug" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 808, + "end": 817, + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 808, + "end": 812, + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 23 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 813, + "end": 817, + "loc": { + "start": { + "line": 31, + "column": 24 + }, + "end": { + "line": 31, + "column": 28 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + ] + }, + { + "type": "Identifier", + "start": 823, + "end": 827, + "loc": { + "start": { + "line": 31, + "column": 34 + }, + "end": { + "line": 31, + "column": 38 + }, + "identifierName": "repr" + }, + "name": "repr" + }, + { + "type": "CallExpression", + "start": 832, + "end": 849, + "loc": { + "start": { + "line": 31, + "column": 43 + }, + "end": { + "line": 31, + "column": 60 + } + }, + "callee": { + "type": "Identifier", + "start": 832, + "end": 837, + "loc": { + "start": { + "line": 31, + "column": 43 + }, + "end": { + "line": 31, + "column": 48 + }, + "identifierName": "debug" + }, + "name": "debug" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 838, + "end": 848, + "loc": { + "start": { + "line": 31, + "column": 49 + }, + "end": { + "line": 31, + "column": 59 + } + }, + "object": { + "type": "Identifier", + "start": 838, + "end": 842, + "loc": { + "start": { + "line": 31, + "column": 49 + }, + "end": { + "line": 31, + "column": 53 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 843, + "end": 848, + "loc": { + "start": { + "line": 31, + "column": 54 + }, + "end": { + "line": 31, + "column": 59 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + ] + } + ], + "quasis": [ + { + "type": "TemplateElement", + "start": 799, + "end": 800, + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 11 + } + }, + "value": { + "raw": "(", + "cooked": "(" + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 819, + "end": 821, + "loc": { + "start": { + "line": 31, + "column": 30 + }, + "end": { + "line": 31, + "column": 32 + } + }, + "value": { + "raw": ", ", + "cooked": ", " + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 828, + "end": 830, + "loc": { + "start": { + "line": 31, + "column": 39 + }, + "end": { + "line": 31, + "column": 41 + } + }, + "value": { + "raw": ", ", + "cooked": ", " + }, + "tail": false + }, + { + "type": "TemplateElement", + "start": 850, + "end": 851, + "loc": { + "start": { + "line": 31, + "column": 61 + }, + "end": { + "line": 31, + "column": 62 + } + }, + "value": { + "raw": ")", + "cooked": ")" + }, + "tail": true + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t ", + "start": 326, + "end": 516, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 19, + "column": 4 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 860, + "end": 873, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 14 + } + }, + "argument": { + "type": "Identifier", + "start": 867, + "end": 872, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 13 + }, + "identifierName": "debug" + }, + "name": "debug" + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", + "start": 143, + "end": 289, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", + "start": 143, + "end": 289, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t ", + "start": 326, + "end": 516, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 19, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 78, + "end": 82, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 83, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 103, + "end": 109, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 110, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 13 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 121, + "end": 140, + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 140, + "end": 141, + "loc": { + "start": { + "line": 4, + "column": 37 + }, + "end": { + "line": 4, + "column": 38 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", + "start": 143, + "end": 289, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 290, + "end": 295, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_debug", + "start": 296, + "end": 302, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 303, + "end": 304, + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 305, + "end": 306, + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 306, + "end": 307, + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "red", + "start": 307, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 17 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 310, + "end": 311, + "loc": { + "start": { + "line": 12, + "column": 20 + }, + "end": { + "line": 12, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "black", + "start": 312, + "end": 317, + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 27 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 317, + "end": 318, + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 28 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 318, + "end": 319, + "loc": { + "start": { + "line": 12, + "column": 28 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 320, + "end": 322, + "loc": { + "start": { + "line": 12, + "column": 30 + }, + "end": { + "line": 12, + "column": 32 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 323, + "end": 324, + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t ", + "start": 326, + "end": 516, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 19, + "column": 4 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 518, + "end": 523, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "debug", + "start": 524, + "end": 529, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 12 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 530, + "end": 531, + "loc": { + "start": { + "line": 20, + "column": 13 + }, + "end": { + "line": 20, + "column": 14 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 532, + "end": 533, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 533, + "end": 537, + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 537, + "end": 538, + "loc": { + "start": { + "line": 20, + "column": 20 + }, + "end": { + "line": 20, + "column": 21 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 539, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 542, + "end": 543, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 546, + "end": 552, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 552, + "end": 553, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 13 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 558, + "end": 568, + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 21, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 569, + "end": 573, + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 29 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 574, + "end": 576, + "loc": { + "start": { + "line": 21, + "column": 30 + }, + "end": { + "line": 21, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 577, + "end": 581, + "loc": { + "start": { + "line": 21, + "column": 33 + }, + "end": { + "line": 21, + "column": 37 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 582, + "end": 592, + "loc": { + "start": { + "line": 21, + "column": 38 + }, + "end": { + "line": 21, + "column": 48 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 593, + "end": 597, + "loc": { + "start": { + "line": 21, + "column": 49 + }, + "end": { + "line": 21, + "column": 53 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 597, + "end": 598, + "loc": { + "start": { + "line": 21, + "column": 53 + }, + "end": { + "line": 21, + "column": 54 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 598, + "end": 599, + "loc": { + "start": { + "line": 21, + "column": 54 + }, + "end": { + "line": 21, + "column": 55 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 602, + "end": 604, + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 605, + "end": 606, + "loc": { + "start": { + "line": 22, + "column": 5 + }, + "end": { + "line": 22, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 606, + "end": 610, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 610, + "end": 611, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "isLeaf", + "start": 611, + "end": 617, + "loc": { + "start": { + "line": 22, + "column": 11 + }, + "end": { + "line": 22, + "column": 17 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 617, + "end": 618, + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 618, + "end": 619, + "loc": { + "start": { + "line": 22, + "column": 18 + }, + "end": { + "line": 22, + "column": 19 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 619, + "end": 620, + "loc": { + "start": { + "line": 22, + "column": 19 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 621, + "end": 622, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 626, + "end": 632, + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 632, + "end": 633, + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 633, + "end": 637, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 14 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 638, + "end": 648, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 649, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 653, + "end": 654, + "loc": { + "start": { + "line": 23, + "column": 30 + }, + "end": { + "line": 23, + "column": 31 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 654, + "end": 655, + "loc": { + "start": { + "line": 23, + "column": 31 + }, + "end": { + "line": 23, + "column": 32 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 659, + "end": 665, + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "black", + "start": 666, + "end": 671, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 671, + "end": 672, + "loc": { + "start": { + "line": 24, + "column": 15 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "L", + "start": 672, + "end": 675, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 19 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 675, + "end": 676, + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 676, + "end": 677, + "loc": { + "start": { + "line": 24, + "column": 20 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 680, + "end": 681, + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 685, + "end": 691, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 691, + "end": 692, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 692, + "end": 696, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 13 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 697, + "end": 707, + "loc": { + "start": { + "line": 27, + "column": 14 + }, + "end": { + "line": 27, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 708, + "end": 712, + "loc": { + "start": { + "line": 27, + "column": 25 + }, + "end": { + "line": 27, + "column": 29 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 712, + "end": 713, + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 713, + "end": 714, + "loc": { + "start": { + "line": 27, + "column": 30 + }, + "end": { + "line": 27, + "column": 31 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 718, + "end": 723, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "repr", + "start": 724, + "end": 728, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 12 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 729, + "end": 730, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 29, + "column": 15 + }, + "end": { + "line": 29, + "column": 19 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 735, + "end": 736, + "loc": { + "start": { + "line": 29, + "column": 19 + }, + "end": { + "line": 29, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 736, + "end": 742, + "loc": { + "start": { + "line": 29, + "column": 20 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 743, + "end": 746, + "loc": { + "start": { + "line": 29, + "column": 27 + }, + "end": { + "line": 29, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 747, + "end": 752, + "loc": { + "start": { + "line": 29, + "column": 31 + }, + "end": { + "line": 29, + "column": 36 + } + } + }, + { + "type": { + "label": "?", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 753, + "end": 754, + "loc": { + "start": { + "line": 29, + "column": 37 + }, + "end": { + "line": 29, + "column": 38 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "black", + "start": 755, + "end": 760, + "loc": { + "start": { + "line": 29, + "column": 39 + }, + "end": { + "line": 29, + "column": 44 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 760, + "end": 761, + "loc": { + "start": { + "line": 29, + "column": 44 + }, + "end": { + "line": 29, + "column": 45 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 761, + "end": 765, + "loc": { + "start": { + "line": 29, + "column": 45 + }, + "end": { + "line": 29, + "column": 49 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 765, + "end": 766, + "loc": { + "start": { + "line": 29, + "column": 49 + }, + "end": { + "line": 29, + "column": 50 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 766, + "end": 769, + "loc": { + "start": { + "line": 29, + "column": 50 + }, + "end": { + "line": 29, + "column": 53 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 769, + "end": 770, + "loc": { + "start": { + "line": 29, + "column": 53 + }, + "end": { + "line": 29, + "column": 54 + } + } + }, + { + "type": { + "label": ":", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 771, + "end": 772, + "loc": { + "start": { + "line": 29, + "column": 55 + }, + "end": { + "line": 29, + "column": 56 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "red", + "start": 773, + "end": 776, + "loc": { + "start": { + "line": 29, + "column": 57 + }, + "end": { + "line": 29, + "column": 60 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 776, + "end": 777, + "loc": { + "start": { + "line": 29, + "column": 60 + }, + "end": { + "line": 29, + "column": 61 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 777, + "end": 781, + "loc": { + "start": { + "line": 29, + "column": 61 + }, + "end": { + "line": 29, + "column": 65 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 781, + "end": 782, + "loc": { + "start": { + "line": 29, + "column": 65 + }, + "end": { + "line": 29, + "column": 66 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 782, + "end": 785, + "loc": { + "start": { + "line": 29, + "column": 66 + }, + "end": { + "line": 29, + "column": 69 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 785, + "end": 786, + "loc": { + "start": { + "line": 29, + "column": 69 + }, + "end": { + "line": 29, + "column": 70 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 786, + "end": 787, + "loc": { + "start": { + "line": 29, + "column": 70 + }, + "end": { + "line": 29, + "column": 71 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 791, + "end": 797, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 8 + } + } + }, + { + "type": { + "label": "`", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 798, + "end": 799, + "loc": { + "start": { + "line": 31, + "column": 9 + }, + "end": { + "line": 31, + "column": 10 + } + } + }, + { + "type": { + "label": "template", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "(", + "start": 799, + "end": 800, + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 11 + } + } + }, + { + "type": { + "label": "${", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 800, + "end": 802, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "debug", + "start": 802, + "end": 807, + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 18 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 807, + "end": 808, + "loc": { + "start": { + "line": 31, + "column": 18 + }, + "end": { + "line": 31, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 808, + "end": 812, + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 23 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 812, + "end": 813, + "loc": { + "start": { + "line": 31, + "column": 23 + }, + "end": { + "line": 31, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 813, + "end": 817, + "loc": { + "start": { + "line": 31, + "column": 24 + }, + "end": { + "line": 31, + "column": 28 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 817, + "end": 818, + "loc": { + "start": { + "line": 31, + "column": 28 + }, + "end": { + "line": 31, + "column": 29 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 818, + "end": 819, + "loc": { + "start": { + "line": 31, + "column": 29 + }, + "end": { + "line": 31, + "column": 30 + } + } + }, + { + "type": { + "label": "template", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": ", ", + "start": 819, + "end": 821, + "loc": { + "start": { + "line": 31, + "column": 30 + }, + "end": { + "line": 31, + "column": 32 + } + } + }, + { + "type": { + "label": "${", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 821, + "end": 823, + "loc": { + "start": { + "line": 31, + "column": 32 + }, + "end": { + "line": 31, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "repr", + "start": 823, + "end": 827, + "loc": { + "start": { + "line": 31, + "column": 34 + }, + "end": { + "line": 31, + "column": 38 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 827, + "end": 828, + "loc": { + "start": { + "line": 31, + "column": 38 + }, + "end": { + "line": 31, + "column": 39 + } + } + }, + { + "type": { + "label": "template", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": ", ", + "start": 828, + "end": 830, + "loc": { + "start": { + "line": 31, + "column": 39 + }, + "end": { + "line": 31, + "column": 41 + } + } + }, + { + "type": { + "label": "${", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 830, + "end": 832, + "loc": { + "start": { + "line": 31, + "column": 41 + }, + "end": { + "line": 31, + "column": 43 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "debug", + "start": 832, + "end": 837, + "loc": { + "start": { + "line": 31, + "column": 43 + }, + "end": { + "line": 31, + "column": 48 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 837, + "end": 838, + "loc": { + "start": { + "line": 31, + "column": 48 + }, + "end": { + "line": 31, + "column": 49 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 838, + "end": 842, + "loc": { + "start": { + "line": 31, + "column": 49 + }, + "end": { + "line": 31, + "column": 53 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 842, + "end": 843, + "loc": { + "start": { + "line": 31, + "column": 53 + }, + "end": { + "line": 31, + "column": 54 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 843, + "end": 848, + "loc": { + "start": { + "line": 31, + "column": 54 + }, + "end": { + "line": 31, + "column": 59 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 848, + "end": 849, + "loc": { + "start": { + "line": 31, + "column": 59 + }, + "end": { + "line": 31, + "column": 60 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 849, + "end": 850, + "loc": { + "start": { + "line": 31, + "column": 60 + }, + "end": { + "line": 31, + "column": 61 + } + } + }, + { + "type": { + "label": "template", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": ")", + "start": 850, + "end": 851, + "loc": { + "start": { + "line": 31, + "column": 61 + }, + "end": { + "line": 31, + "column": 62 + } + } + }, + { + "type": { + "label": "`", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 851, + "end": 852, + "loc": { + "start": { + "line": 31, + "column": 62 + }, + "end": { + "line": 31, + "column": 63 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 852, + "end": 853, + "loc": { + "start": { + "line": 31, + "column": 63 + }, + "end": { + "line": 31, + "column": 64 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 855, + "end": 856, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 856, + "end": 857, + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 3 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 860, + "end": 866, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "debug", + "start": 867, + "end": 872, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 13 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 872, + "end": 873, + "loc": { + "start": { + "line": 34, + "column": 13 + }, + "end": { + "line": 34, + "column": 14 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 874, + "end": 875, + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 1 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 875, + "end": 876, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 2 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 878, + "end": 884, + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 885, + "end": 892, + "loc": { + "start": { + "line": 37, + "column": 7 + }, + "end": { + "line": 37, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_debug", + "start": 893, + "end": 899, + "loc": { + "start": { + "line": 37, + "column": 15 + }, + "end": { + "line": 37, + "column": 21 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 899, + "end": 900, + "loc": { + "start": { + "line": 37, + "column": 21 + }, + "end": { + "line": 37, + "column": 22 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 901, + "end": 901, + "loc": { + "start": { + "line": 38, + "column": 0 + }, + "end": { + "line": 38, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/debug/debug.js.json b/ast/source/debug/debug.js.json deleted file mode 100644 index dd1060d..0000000 --- a/ast/source/debug/debug.js.json +++ /dev/null @@ -1,4013 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 647, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 27, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 647, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 27, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ImportDeclaration", - "start": 0, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 40 - } - }, - "specifiers": [ - { - "type": "ImportSpecifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "imported": { - "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "local": { - "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 20, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 39 - } - }, - "extra": { - "rawValue": "../color/BLACK.js", - "raw": "'../color/BLACK.js'" - }, - "value": "../color/BLACK.js" - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 42, - "end": 188, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 8, - "column": 3 - } - } - } - ] - }, - { - "type": "ExportNamedDeclaration", - "start": 189, - "end": 646, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 26, - "column": 2 - } - }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 196, - "end": 646, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 26, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 202, - "end": 645, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 26, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 202, - "end": 208, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 19 - }, - "identifierName": "_debug" - }, - "name": "_debug", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 211, - "end": 645, - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 26, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 202, - "end": 208, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 19 - }, - "identifierName": "_debug" - }, - "name": "_debug", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "ObjectPattern", - "start": 212, - "end": 224, - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 35 - } - }, - "properties": [ - { - "type": "ObjectProperty", - "start": 213, - "end": 216, - "loc": { - "start": { - "line": 9, - "column": 24 - }, - "end": { - "line": 9, - "column": 27 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 213, - "end": 216, - "loc": { - "start": { - "line": 9, - "column": 24 - }, - "end": { - "line": 9, - "column": 27 - }, - "identifierName": "red" - }, - "name": "red" - }, - "value": { - "type": "Identifier", - "start": 213, - "end": 216, - "loc": { - "start": { - "line": 9, - "column": 24 - }, - "end": { - "line": 9, - "column": 27 - }, - "identifierName": "red" - }, - "name": "red" - }, - "extra": { - "shorthand": true - } - }, - { - "type": "ObjectProperty", - "start": 218, - "end": 223, - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 9, - "column": 34 - } - }, - "method": false, - "shorthand": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 218, - "end": 223, - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 9, - "column": 34 - }, - "identifierName": "black" - }, - "name": "black" - }, - "value": { - "type": "Identifier", - "start": 218, - "end": 223, - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 9, - "column": 34 - }, - "identifierName": "black" - }, - "name": "black" - }, - "extra": { - "shorthand": true - } - } - ] - } - ], - "body": { - "type": "BlockStatement", - "start": 229, - "end": 645, - "loc": { - "start": { - "line": 9, - "column": 40 - }, - "end": { - "line": 26, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 419, - "end": 627, - "loc": { - "start": { - "line": 17, - "column": 1 - }, - "end": { - "line": 23, - "column": 3 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 425, - "end": 626, - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 23, - "column": 2 - } - }, - "id": { - "type": "Identifier", - "start": 425, - "end": 430, - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 12 - }, - "identifierName": "debug" - }, - "name": "debug", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 433, - "end": 626, - "loc": { - "start": { - "line": 17, - "column": 15 - }, - "end": { - "line": 23, - "column": 2 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 434, - "end": 438, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 20 - }, - "identifierName": "root" - }, - "name": "root" - } - ], - "body": { - "type": "BlockStatement", - "start": 443, - "end": 626, - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 23, - "column": 2 - } - }, - "body": [ - { - "type": "IfStatement", - "start": 447, - "end": 484, - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 18, - "column": 39 - } - }, - "test": { - "type": "CallExpression", - "start": 451, - "end": 464, - "loc": { - "start": { - "line": 18, - "column": 6 - }, - "end": { - "line": 18, - "column": 19 - } - }, - "callee": { - "type": "MemberExpression", - "start": 451, - "end": 462, - "loc": { - "start": { - "line": 18, - "column": 6 - }, - "end": { - "line": 18, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 451, - "end": 455, - "loc": { - "start": { - "line": 18, - "column": 6 - }, - "end": { - "line": 18, - "column": 10 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 456, - "end": 462, - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 17 - }, - "identifierName": "isLeaf" - }, - "name": "isLeaf" - }, - "computed": false - }, - "arguments": [] - }, - "consequent": { - "type": "ReturnStatement", - "start": 466, - "end": 484, - "loc": { - "start": { - "line": 18, - "column": 21 - }, - "end": { - "line": 18, - "column": 39 - } - }, - "argument": { - "type": "CallExpression", - "start": 473, - "end": 483, - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 38 - } - }, - "callee": { - "type": "Identifier", - "start": 473, - "end": 478, - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 33 - }, - "identifierName": "black" - }, - "name": "black" - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 479, - "end": 482, - "loc": { - "start": { - "line": 18, - "column": 34 - }, - "end": { - "line": 18, - "column": 37 - } - }, - "extra": { - "rawValue": "L", - "raw": "'L'" - }, - "value": "L" - } - ] - } - }, - "alternate": null - }, - { - "type": "VariableDeclaration", - "start": 488, - "end": 557, - "loc": { - "start": { - "line": 20, - "column": 2 - }, - "end": { - "line": 20, - "column": 71 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 494, - "end": 556, - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 70 - } - }, - "id": { - "type": "Identifier", - "start": 494, - "end": 498, - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 12 - }, - "identifierName": "repr" - }, - "name": "repr" - }, - "init": { - "type": "ConditionalExpression", - "start": 501, - "end": 556, - "loc": { - "start": { - "line": 20, - "column": 15 - }, - "end": { - "line": 20, - "column": 70 - } - }, - "test": { - "type": "BinaryExpression", - "start": 501, - "end": 522, - "loc": { - "start": { - "line": 20, - "column": 15 - }, - "end": { - "line": 20, - "column": 36 - } - }, - "left": { - "type": "MemberExpression", - "start": 501, - "end": 512, - "loc": { - "start": { - "line": 20, - "column": 15 - }, - "end": { - "line": 20, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 501, - "end": 505, - "loc": { - "start": { - "line": 20, - "column": 15 - }, - "end": { - "line": 20, - "column": 19 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 506, - "end": 512, - "loc": { - "start": { - "line": 20, - "column": 20 - }, - "end": { - "line": 20, - "column": 26 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 517, - "end": 522, - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 36 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - "consequent": { - "type": "CallExpression", - "start": 525, - "end": 540, - "loc": { - "start": { - "line": 20, - "column": 39 - }, - "end": { - "line": 20, - "column": 54 - } - }, - "callee": { - "type": "Identifier", - "start": 525, - "end": 530, - "loc": { - "start": { - "line": 20, - "column": 39 - }, - "end": { - "line": 20, - "column": 44 - }, - "identifierName": "black" - }, - "name": "black" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 531, - "end": 539, - "loc": { - "start": { - "line": 20, - "column": 45 - }, - "end": { - "line": 20, - "column": 53 - } - }, - "object": { - "type": "Identifier", - "start": 531, - "end": 535, - "loc": { - "start": { - "line": 20, - "column": 45 - }, - "end": { - "line": 20, - "column": 49 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 536, - "end": 539, - "loc": { - "start": { - "line": 20, - "column": 50 - }, - "end": { - "line": 20, - "column": 53 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - } - ] - }, - "alternate": { - "type": "CallExpression", - "start": 543, - "end": 556, - "loc": { - "start": { - "line": 20, - "column": 57 - }, - "end": { - "line": 20, - "column": 70 - } - }, - "callee": { - "type": "Identifier", - "start": 543, - "end": 546, - "loc": { - "start": { - "line": 20, - "column": 57 - }, - "end": { - "line": 20, - "column": 60 - }, - "identifierName": "red" - }, - "name": "red" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 547, - "end": 555, - "loc": { - "start": { - "line": 20, - "column": 61 - }, - "end": { - "line": 20, - "column": 69 - } - }, - "object": { - "type": "Identifier", - "start": 547, - "end": 551, - "loc": { - "start": { - "line": 20, - "column": 61 - }, - "end": { - "line": 20, - "column": 65 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 552, - "end": 555, - "loc": { - "start": { - "line": 20, - "column": 66 - }, - "end": { - "line": 20, - "column": 69 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - } - ] - } - } - } - ], - "kind": "const" - }, - { - "type": "ReturnStatement", - "start": 561, - "end": 623, - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 64 - } - }, - "argument": { - "type": "TemplateLiteral", - "start": 568, - "end": 622, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 63 - } - }, - "expressions": [ - { - "type": "CallExpression", - "start": 572, - "end": 588, - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 29 - } - }, - "callee": { - "type": "Identifier", - "start": 572, - "end": 577, - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 18 - }, - "identifierName": "debug" - }, - "name": "debug" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 578, - "end": 587, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 28 - } - }, - "object": { - "type": "Identifier", - "start": 578, - "end": 582, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 23 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 583, - "end": 587, - "loc": { - "start": { - "line": 22, - "column": 24 - }, - "end": { - "line": 22, - "column": 28 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - ] - }, - { - "type": "Identifier", - "start": 593, - "end": 597, - "loc": { - "start": { - "line": 22, - "column": 34 - }, - "end": { - "line": 22, - "column": 38 - }, - "identifierName": "repr" - }, - "name": "repr" - }, - { - "type": "CallExpression", - "start": 602, - "end": 619, - "loc": { - "start": { - "line": 22, - "column": 43 - }, - "end": { - "line": 22, - "column": 60 - } - }, - "callee": { - "type": "Identifier", - "start": 602, - "end": 607, - "loc": { - "start": { - "line": 22, - "column": 43 - }, - "end": { - "line": 22, - "column": 48 - }, - "identifierName": "debug" - }, - "name": "debug" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 608, - "end": 618, - "loc": { - "start": { - "line": 22, - "column": 49 - }, - "end": { - "line": 22, - "column": 59 - } - }, - "object": { - "type": "Identifier", - "start": 608, - "end": 612, - "loc": { - "start": { - "line": 22, - "column": 49 - }, - "end": { - "line": 22, - "column": 53 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 613, - "end": 618, - "loc": { - "start": { - "line": 22, - "column": 54 - }, - "end": { - "line": 22, - "column": 59 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } - ] - } - ], - "quasis": [ - { - "type": "TemplateElement", - "start": 569, - "end": 570, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 11 - } - }, - "value": { - "raw": "(", - "cooked": "(" - }, - "tail": false - }, - { - "type": "TemplateElement", - "start": 589, - "end": 591, - "loc": { - "start": { - "line": 22, - "column": 30 - }, - "end": { - "line": 22, - "column": 32 - } - }, - "value": { - "raw": ", ", - "cooked": ", " - }, - "tail": false - }, - { - "type": "TemplateElement", - "start": 598, - "end": 600, - "loc": { - "start": { - "line": 22, - "column": 39 - }, - "end": { - "line": 22, - "column": 41 - } - }, - "value": { - "raw": ", ", - "cooked": ", " - }, - "tail": false - }, - { - "type": "TemplateElement", - "start": 620, - "end": 621, - "loc": { - "start": { - "line": 22, - "column": 61 - }, - "end": { - "line": 22, - "column": 62 - } - }, - "value": { - "raw": ")", - "cooked": ")" - }, - "tail": true - } - ] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t ", - "start": 232, - "end": 417, - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 16, - "column": 4 - } - } - } - ] - }, - { - "type": "ReturnStatement", - "start": 630, - "end": 643, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 14 - } - }, - "argument": { - "type": "Identifier", - "start": 637, - "end": 642, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 13 - }, - "identifierName": "debug" - }, - "name": "debug" - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 42, - "end": 188, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 8, - "column": 3 - } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 42, - "end": 188, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 8, - "column": 3 - } - } - } - ] - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 42, - "end": 188, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 8, - "column": 3 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t ", - "start": 232, - "end": 417, - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 16, - "column": 4 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 13, - "end": 14, - "loc": { - "start": { - "line": 1, - "column": 13 - }, - "end": { - "line": 1, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 15, - "end": 19, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 19 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/BLACK.js", - "start": 20, - "end": 39, - "loc": { - "start": { - "line": 1, - "column": 20 - }, - "end": { - "line": 1, - "column": 39 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 39, - "end": 40, - "loc": { - "start": { - "line": 1, - "column": 39 - }, - "end": { - "line": 1, - "column": 40 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 42, - "end": 188, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 8, - "column": 3 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 189, - "end": 195, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 6 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 196, - "end": 201, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_debug", - "start": 202, - "end": 208, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 19 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 209, - "end": 210, - "loc": { - "start": { - "line": 9, - "column": 20 - }, - "end": { - "line": 9, - "column": 21 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 211, - "end": 212, - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 9, - "column": 23 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 212, - "end": 213, - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 24 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "red", - "start": 213, - "end": 216, - "loc": { - "start": { - "line": 9, - "column": 24 - }, - "end": { - "line": 9, - "column": 27 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 216, - "end": 217, - "loc": { - "start": { - "line": 9, - "column": 27 - }, - "end": { - "line": 9, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "black", - "start": 218, - "end": 223, - "loc": { - "start": { - "line": 9, - "column": 29 - }, - "end": { - "line": 9, - "column": 34 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 223, - "end": 224, - "loc": { - "start": { - "line": 9, - "column": 34 - }, - "end": { - "line": 9, - "column": 35 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 224, - "end": 225, - "loc": { - "start": { - "line": 9, - "column": 35 - }, - "end": { - "line": 9, - "column": 36 - } - } - }, - { - "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 226, - "end": 228, - "loc": { - "start": { - "line": 9, - "column": 37 - }, - "end": { - "line": 9, - "column": 39 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 229, - "end": 230, - "loc": { - "start": { - "line": 9, - "column": 40 - }, - "end": { - "line": 9, - "column": 41 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t ", - "start": 232, - "end": 417, - "loc": { - "start": { - "line": 10, - "column": 1 - }, - "end": { - "line": 16, - "column": 4 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 419, - "end": 424, - "loc": { - "start": { - "line": 17, - "column": 1 - }, - "end": { - "line": 17, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "debug", - "start": 425, - "end": 430, - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 12 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 431, - "end": 432, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 14 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 433, - "end": 434, - "loc": { - "start": { - "line": 17, - "column": 15 - }, - "end": { - "line": 17, - "column": 16 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 434, - "end": 438, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 20 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 438, - "end": 439, - "loc": { - "start": { - "line": 17, - "column": 20 - }, - "end": { - "line": 17, - "column": 21 - } - } - }, - { - "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 440, - "end": 442, - "loc": { - "start": { - "line": 17, - "column": 22 - }, - "end": { - "line": 17, - "column": 24 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 443, - "end": 444, - "loc": { - "start": { - "line": 17, - "column": 25 - }, - "end": { - "line": 17, - "column": 26 - } - } - }, - { - "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "if", - "start": 447, - "end": 449, - "loc": { - "start": { - "line": 18, - "column": 2 - }, - "end": { - "line": 18, - "column": 4 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 450, - "end": 451, - "loc": { - "start": { - "line": 18, - "column": 5 - }, - "end": { - "line": 18, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 451, - "end": 455, - "loc": { - "start": { - "line": 18, - "column": 6 - }, - "end": { - "line": 18, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 455, - "end": 456, - "loc": { - "start": { - "line": 18, - "column": 10 - }, - "end": { - "line": 18, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "isLeaf", - "start": 456, - "end": 462, - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 17 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 462, - "end": 463, - "loc": { - "start": { - "line": 18, - "column": 17 - }, - "end": { - "line": 18, - "column": 18 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 463, - "end": 464, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 19 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 464, - "end": 465, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 20 - } - } - }, - { - "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "return", - "start": 466, - "end": 472, - "loc": { - "start": { - "line": 18, - "column": 21 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "black", - "start": 473, - "end": 478, - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 18, - "column": 33 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 478, - "end": 479, - "loc": { - "start": { - "line": 18, - "column": 33 - }, - "end": { - "line": 18, - "column": 34 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "L", - "start": 479, - "end": 482, - "loc": { - "start": { - "line": 18, - "column": 34 - }, - "end": { - "line": 18, - "column": 37 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 482, - "end": 483, - "loc": { - "start": { - "line": 18, - "column": 37 - }, - "end": { - "line": 18, - "column": 38 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 483, - "end": 484, - "loc": { - "start": { - "line": 18, - "column": 38 - }, - "end": { - "line": 18, - "column": 39 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 488, - "end": 493, - "loc": { - "start": { - "line": 20, - "column": 2 - }, - "end": { - "line": 20, - "column": 7 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "repr", - "start": 494, - "end": 498, - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 12 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 499, - "end": 500, - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 20, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 501, - "end": 505, - "loc": { - "start": { - "line": 20, - "column": 15 - }, - "end": { - "line": 20, - "column": 19 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 505, - "end": 506, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 506, - "end": 512, - "loc": { - "start": { - "line": 20, - "column": 20 - }, - "end": { - "line": 20, - "column": 26 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 513, - "end": 516, - "loc": { - "start": { - "line": 20, - "column": 27 - }, - "end": { - "line": 20, - "column": 30 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 517, - "end": 522, - "loc": { - "start": { - "line": 20, - "column": 31 - }, - "end": { - "line": 20, - "column": 36 - } - } - }, - { - "type": { - "label": "?", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 523, - "end": 524, - "loc": { - "start": { - "line": 20, - "column": 37 - }, - "end": { - "line": 20, - "column": 38 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "black", - "start": 525, - "end": 530, - "loc": { - "start": { - "line": 20, - "column": 39 - }, - "end": { - "line": 20, - "column": 44 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 530, - "end": 531, - "loc": { - "start": { - "line": 20, - "column": 44 - }, - "end": { - "line": 20, - "column": 45 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 531, - "end": 535, - "loc": { - "start": { - "line": 20, - "column": 45 - }, - "end": { - "line": 20, - "column": 49 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 535, - "end": 536, - "loc": { - "start": { - "line": 20, - "column": 49 - }, - "end": { - "line": 20, - "column": 50 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "key", - "start": 536, - "end": 539, - "loc": { - "start": { - "line": 20, - "column": 50 - }, - "end": { - "line": 20, - "column": 53 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 539, - "end": 540, - "loc": { - "start": { - "line": 20, - "column": 53 - }, - "end": { - "line": 20, - "column": 54 - } - } - }, - { - "type": { - "label": ":", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 541, - "end": 542, - "loc": { - "start": { - "line": 20, - "column": 55 - }, - "end": { - "line": 20, - "column": 56 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "red", - "start": 543, - "end": 546, - "loc": { - "start": { - "line": 20, - "column": 57 - }, - "end": { - "line": 20, - "column": 60 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 546, - "end": 547, - "loc": { - "start": { - "line": 20, - "column": 60 - }, - "end": { - "line": 20, - "column": 61 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 547, - "end": 551, - "loc": { - "start": { - "line": 20, - "column": 61 - }, - "end": { - "line": 20, - "column": 65 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 551, - "end": 552, - "loc": { - "start": { - "line": 20, - "column": 65 - }, - "end": { - "line": 20, - "column": 66 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "key", - "start": 552, - "end": 555, - "loc": { - "start": { - "line": 20, - "column": 66 - }, - "end": { - "line": 20, - "column": 69 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 555, - "end": 556, - "loc": { - "start": { - "line": 20, - "column": 69 - }, - "end": { - "line": 20, - "column": 70 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 556, - "end": 557, - "loc": { - "start": { - "line": 20, - "column": 70 - }, - "end": { - "line": 20, - "column": 71 - } - } - }, - { - "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "return", - "start": 561, - "end": 567, - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 8 - } - } - }, - { - "type": { - "label": "`", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 568, - "end": 569, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 10 - } - } - }, - { - "type": { - "label": "template", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "(", - "start": 569, - "end": 570, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 11 - } - } - }, - { - "type": { - "label": "${", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 570, - "end": 572, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "debug", - "start": 572, - "end": 577, - "loc": { - "start": { - "line": 22, - "column": 13 - }, - "end": { - "line": 22, - "column": 18 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 577, - "end": 578, - "loc": { - "start": { - "line": 22, - "column": 18 - }, - "end": { - "line": 22, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 578, - "end": 582, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 23 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 582, - "end": 583, - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 583, - "end": 587, - "loc": { - "start": { - "line": 22, - "column": 24 - }, - "end": { - "line": 22, - "column": 28 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 587, - "end": 588, - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 22, - "column": 29 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 588, - "end": 589, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 30 - } - } - }, - { - "type": { - "label": "template", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": ", ", - "start": 589, - "end": 591, - "loc": { - "start": { - "line": 22, - "column": 30 - }, - "end": { - "line": 22, - "column": 32 - } - } - }, - { - "type": { - "label": "${", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 591, - "end": 593, - "loc": { - "start": { - "line": 22, - "column": 32 - }, - "end": { - "line": 22, - "column": 34 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "repr", - "start": 593, - "end": 597, - "loc": { - "start": { - "line": 22, - "column": 34 - }, - "end": { - "line": 22, - "column": 38 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 597, - "end": 598, - "loc": { - "start": { - "line": 22, - "column": 38 - }, - "end": { - "line": 22, - "column": 39 - } - } - }, - { - "type": { - "label": "template", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": ", ", - "start": 598, - "end": 600, - "loc": { - "start": { - "line": 22, - "column": 39 - }, - "end": { - "line": 22, - "column": 41 - } - } - }, - { - "type": { - "label": "${", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 600, - "end": 602, - "loc": { - "start": { - "line": 22, - "column": 41 - }, - "end": { - "line": 22, - "column": 43 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "debug", - "start": 602, - "end": 607, - "loc": { - "start": { - "line": 22, - "column": 43 - }, - "end": { - "line": 22, - "column": 48 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 607, - "end": 608, - "loc": { - "start": { - "line": 22, - "column": 48 - }, - "end": { - "line": 22, - "column": 49 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 608, - "end": 612, - "loc": { - "start": { - "line": 22, - "column": 49 - }, - "end": { - "line": 22, - "column": 53 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 612, - "end": 613, - "loc": { - "start": { - "line": 22, - "column": 53 - }, - "end": { - "line": 22, - "column": 54 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 613, - "end": 618, - "loc": { - "start": { - "line": 22, - "column": 54 - }, - "end": { - "line": 22, - "column": 59 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 618, - "end": 619, - "loc": { - "start": { - "line": 22, - "column": 59 - }, - "end": { - "line": 22, - "column": 60 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 619, - "end": 620, - "loc": { - "start": { - "line": 22, - "column": 60 - }, - "end": { - "line": 22, - "column": 61 - } - } - }, - { - "type": { - "label": "template", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": ")", - "start": 620, - "end": 621, - "loc": { - "start": { - "line": 22, - "column": 61 - }, - "end": { - "line": 22, - "column": 62 - } - } - }, - { - "type": { - "label": "`", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 621, - "end": 622, - "loc": { - "start": { - "line": 22, - "column": 62 - }, - "end": { - "line": 22, - "column": 63 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 622, - "end": 623, - "loc": { - "start": { - "line": 22, - "column": 63 - }, - "end": { - "line": 22, - "column": 64 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 625, - "end": 626, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 2 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 626, - "end": 627, - "loc": { - "start": { - "line": 23, - "column": 2 - }, - "end": { - "line": 23, - "column": 3 - } - } - }, - { - "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "return", - "start": 630, - "end": 636, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 7 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "debug", - "start": 637, - "end": 642, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 13 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 642, - "end": 643, - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 14 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 644, - "end": 645, - "loc": { - "start": { - "line": 26, - "column": 0 - }, - "end": { - "line": 26, - "column": 1 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 645, - "end": 646, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 2 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 647, - "end": 647, - "loc": { - "start": { - "line": 27, - "column": 0 - }, - "end": { - "line": 27, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/debug/index.js.json b/ast/source/debug/index.js.json deleted file mode 100644 index 7656f10..0000000 --- a/ast/source/debug/index.js.json +++ /dev/null @@ -1,232 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - }, - "extra": { - "rawValue": "./debug.js", - "raw": "'./debug.js'" - }, - "value": "./debug.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./debug.js", - "start": 14, - "end": 26, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 26, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 26 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 28, - "end": 28, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/deletion/delete_case1.js.json b/ast/source/deletion/delete_case1.js.json index 7d8bc1d..cfe820c 100644 --- a/ast/source/deletion/delete_case1.js.json +++ b/ast/source/deletion/delete_case1.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 434, + "end": 692, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 16, + "line": 25, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 434, + "end": 692, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 16, + "line": 25, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 47, + "end": 28, "loc": { "start": { "line": 1, @@ -39,53 +39,312 @@ }, "end": { "line": 1, - "column": 47 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, - "end": 20, + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 20 + "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, - "end": 20, + "start": 7, + "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 20 + "column": 13 }, - "identifierName": "delete_case2" + "identifierName": "assert" }, - "name": "delete_case2" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 20, + "start": 36, + "end": 41, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 20 + "line": 2, + "column": 12 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 68, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 85, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 105, + "end": 141, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 112, + "end": 116, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 112, + "end": 116, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 122, + "end": 140, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + } + }, + { + "type": "ImportDeclaration", + "start": 142, + "end": 187, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 149, + "end": 161, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 149, + "end": 161, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 }, "identifierName": "delete_case2" }, @@ -95,16 +354,16 @@ ], "source": { "type": "StringLiteral", - "start": 27, - "end": 46, + "start": 167, + "end": 186, "loc": { "start": { - "line": 1, - "column": 27 + "line": 5, + "column": 25 }, "end": { - "line": 1, - "column": 46 + "line": 5, + "column": 44 } }, "extra": { @@ -116,16 +375,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", - "start": 49, - "end": 262, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 189, + "end": 407, "loc": { "start": { - "line": 3, + "line": 7, "column": 0 }, "end": { - "line": 10, + "line": 14, "column": 3 } } @@ -133,444 +392,2349 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 263, - "end": 433, + "type": "Identifier", + "start": 408, + "end": 661, "loc": { "start": { - "line": 11, + "line": 15, "column": 0 }, "end": { - "line": 15, + "line": 22, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 270, - "end": 433, - "loc": { - "start": { - "line": 11, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 414, + "end": 660, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 22, + "column": 1 + } }, - "end": { - "line": 15, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 276, - "end": 432, + "id": { + "type": "Identifier", + "start": 414, + "end": 426, "loc": { "start": { - "line": 11, - "column": 13 + "line": 15, + "column": 6 }, "end": { "line": 15, + "column": 18 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 429, + "end": 660, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 22, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 276, - "end": 288, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 25 + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 430, + "end": 431, + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + }, + "identifierName": "n" }, - "identifierName": "delete_case1" - }, - "name": "delete_case1", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 291, - "end": 432, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 436, + "end": 660, "loc": { "start": { - "line": 11, + "line": 15, "column": 28 }, "end": { - "line": 15, + "line": 22, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 276, - "end": 288, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 25 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 292, - "end": 293, + "type": "ExpressionStatement", + "start": 439, + "end": 486, "loc": { "start": { - "line": 11, - "column": 29 + "line": 16, + "column": 1 }, "end": { - "line": 11, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 298, - "end": 432, - "loc": { - "start": { - "line": 11, - "column": 35 + "line": 16, + "column": 48 + } }, - "end": { - "line": 15, - "column": 1 - } - }, - "body": [ - { - "type": "IfStatement", - "start": 391, - "end": 430, + "expression": { + "type": "CallExpression", + "start": 439, + "end": 485, "loc": { "start": { - "line": 14, + "line": 16, "column": 1 }, "end": { - "line": 14, - "column": 40 + "line": 16, + "column": 47 } }, - "test": { - "type": "BinaryExpression", - "start": 395, - "end": 412, + "callee": { + "type": "Identifier", + "start": 439, + "end": 445, "loc": { "start": { - "line": 14, - "column": 5 + "line": 16, + "column": 1 }, "end": { - "line": 14, - "column": 22 - } + "line": 16, + "column": 7 + }, + "identifierName": "assert" }, - "left": { - "type": "MemberExpression", - "start": 395, - "end": 403, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 446, + "end": 484, "loc": { "start": { - "line": 14, - "column": 5 + "line": 16, + "column": 8 }, "end": { - "line": 14, - "column": 13 + "line": 16, + "column": 46 } }, - "object": { - "type": "Identifier", - "start": 395, - "end": 396, + "left": { + "type": "BinaryExpression", + "start": 446, + "end": 463, "loc": { "start": { - "line": 14, - "column": 5 + "line": 16, + "column": 8 }, "end": { - "line": 14, - "column": 6 + "line": 16, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 446, + "end": 447, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n", - "leadingComments": null + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 459, + "end": 463, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } }, - "property": { - "type": "Identifier", - "start": 397, - "end": 403, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 467, + "end": 484, "loc": { "start": { - "line": 14, - "column": 7 + "line": 16, + "column": 29 }, "end": { - "line": 14, - "column": 13 - }, - "identifierName": "parent" + "line": 16, + "column": 46 + } }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 408, - "end": 412, - "loc": { - "start": { - "line": 14, - "column": 18 + "left": { + "type": "Identifier", + "start": 467, + "end": 468, + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" }, - "end": { - "line": 14, - "column": 22 + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 480, + "end": 484, + "loc": { + "start": { + "line": 16, + "column": 42 + }, + "end": { + "line": 16, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" } } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 488, + "end": 515, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 488, + "end": 514, + "loc": { + "start": { + "line": 17, + "column": 1 }, - "leadingComments": null + "end": { + "line": 17, + "column": 27 + } }, - "consequent": { - "type": "ExpressionStatement", - "start": 414, - "end": 430, + "callee": { + "type": "Identifier", + "start": 488, + "end": 494, "loc": { "start": { - "line": 14, - "column": 24 + "line": 17, + "column": 1 }, "end": { - "line": 14, - "column": 40 - } + "line": 17, + "column": 7 + }, + "identifierName": "assert" }, - "expression": { - "type": "CallExpression", - "start": 414, - "end": 429, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 495, + "end": 513, "loc": { "start": { - "line": 14, - "column": 24 + "line": 17, + "column": 8 }, "end": { - "line": 14, - "column": 39 + "line": 17, + "column": 26 } }, - "callee": { - "type": "Identifier", - "start": 414, - "end": 426, + "left": { + "type": "MemberExpression", + "start": 495, + "end": 503, "loc": { "start": { - "line": 14, - "column": 24 + "line": 17, + "column": 8 }, "end": { - "line": 14, - "column": 36 - }, - "identifierName": "delete_case2" + "line": 17, + "column": 16 + } }, - "name": "delete_case2" - }, - "arguments": [ - { + "object": { "type": "Identifier", - "start": 427, - "end": 428, + "start": 495, + "end": 496, "loc": { "start": { - "line": 14, - "column": 37 + "line": 17, + "column": 8 }, "end": { - "line": 14, - "column": 38 + "line": 17, + "column": 9 }, "identifierName": "n" }, "name": "n" - } - ] + }, + "property": { + "type": "Identifier", + "start": 497, + "end": 503, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 508, + "end": 513, + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 517, + "end": 561, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 45 + } } }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is the root, there is nothing to do: all paths go through n, and n", - "start": 301, - "end": 375, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 563, + "end": 597, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 599, + "end": 617, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 19 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 619, + "end": 658, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 40 + } + }, + "test": { + "type": "BinaryExpression", + "start": 623, + "end": 640, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 623, + "end": 631, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 623, + "end": 624, "loc": { "start": { - "line": 12, - "column": 1 + "line": 21, + "column": 5 }, "end": { - "line": 12, - "column": 75 - } - } + "line": 21, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null }, - { - "type": "CommentLine", - "value": " is black.", - "start": 377, - "end": 389, + "property": { + "type": "Identifier", + "start": 625, + "end": 631, "loc": { "start": { - "line": 13, - "column": 1 + "line": 21, + "column": 7 }, "end": { - "line": 13, + "line": 21, "column": 13 - } + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 636, + "end": 640, + "loc": { + "start": { + "line": 21, + "column": 18 + }, + "end": { + "line": 21, + "column": 22 } } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", - "start": 49, - "end": 262, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", - "start": 49, - "end": 262, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - } - ] + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 642, + "end": 658, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 40 + } + }, + "expression": { + "type": "CallExpression", + "start": 642, + "end": 657, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 39 + } + }, + "callee": { + "type": "Identifier", + "start": 642, + "end": 654, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 36 + }, + "identifierName": "delete_case2" + }, + "name": "delete_case2" + }, + "arguments": [ + { + "type": "Identifier", + "start": 655, + "end": 656, + "loc": { + "start": { + "line": 21, + "column": 37 + }, + "end": { + "line": 21, + "column": 38 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 517, + "end": 561, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 563, + "end": 597, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 599, + "end": 617, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 19 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 663, + "end": 691, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 678, + "end": 690, + "loc": { + "start": { + "line": 24, + "column": 15 + }, + "end": { + "line": 24, + "column": 27 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 663, + "end": 691, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 408, + "end": 661, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 22, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 414, + "end": 660, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 414, + "end": 426, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 18 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 429, + "end": 660, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 414, + "end": 426, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 18 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 430, + "end": 431, + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 436, + "end": 660, + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 22, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 439, + "end": 486, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 439, + "end": 485, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 439, + "end": 445, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 446, + "end": 484, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 446, + "end": 463, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 446, + "end": 447, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 459, + "end": 463, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 467, + "end": 484, + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 467, + "end": 468, + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 480, + "end": 484, + "loc": { + "start": { + "line": 16, + "column": 42 + }, + "end": { + "line": 16, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 488, + "end": 515, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 488, + "end": 514, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 488, + "end": 494, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 495, + "end": 513, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 495, + "end": 503, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 495, + "end": 496, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 497, + "end": 503, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 508, + "end": 513, + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 517, + "end": 561, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 563, + "end": 597, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 599, + "end": 617, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 19 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 619, + "end": 658, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 40 + } + }, + "test": { + "type": "BinaryExpression", + "start": 623, + "end": 640, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 623, + "end": 631, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 623, + "end": 624, + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 625, + "end": 631, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 636, + "end": 640, + "loc": { + "start": { + "line": 21, + "column": 18 + }, + "end": { + "line": 21, + "column": 22 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 642, + "end": 658, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 40 + } + }, + "expression": { + "type": "CallExpression", + "start": 642, + "end": 657, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 39 + } + }, + "callee": { + "type": "Identifier", + "start": 642, + "end": 654, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 36 + }, + "identifierName": "delete_case2" + }, + "name": "delete_case2" + }, + "arguments": [ + { + "type": "Identifier", + "start": 655, + "end": 656, + "loc": { + "start": { + "line": 21, + "column": 37 + }, + "end": { + "line": 21, + "column": 38 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 517, + "end": 561, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 563, + "end": 597, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 599, + "end": 617, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 19 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 189, + "end": 407, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 189, + "end": 407, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 517, + "end": 561, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 563, + "end": 597, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 599, + "end": 617, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 19 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 80, + "end": 84, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 85, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 112, + "end": 116, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 117, + "end": 121, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 122, + "end": 140, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 140, + "end": 141, + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 142, + "end": 148, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case2", + "start": 149, + "end": 161, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 162, + "end": 166, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case2.js", + "start": 167, + "end": 186, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 186, + "end": 187, + "loc": { + "start": { + "line": 5, + "column": 44 + }, + "end": { + "line": 5, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 189, + "end": 407, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 408, + "end": 413, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case1", + "start": 414, + "end": 426, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", - "start": 49, - "end": 262, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 429, + "end": 430, "loc": { "start": { - "line": 3, - "column": 0 + "line": 15, + "column": 21 }, "end": { - "line": 10, - "column": 3 + "line": 15, + "column": 22 } } }, { - "type": "CommentLine", - "value": " If n is the root, there is nothing to do: all paths go through n, and n", - "start": 301, - "end": 375, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 430, + "end": 431, "loc": { "start": { - "line": 12, - "column": 1 + "line": 15, + "column": 22 }, "end": { - "line": 12, - "column": 75 + "line": 15, + "column": 23 } } }, { - "type": "CommentLine", - "value": " is black.", - "start": 377, - "end": 389, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 431, + "end": 432, "loc": { "start": { - "line": 13, - "column": 1 + "line": 15, + "column": 23 }, "end": { - "line": 13, - "column": 13 + "line": 15, + "column": 24 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": "=>", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -579,17 +2743,16 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "start": 433, + "end": 435, "loc": { "start": { - "line": 1, - "column": 0 + "line": 15, + "column": 25 }, "end": { - "line": 1, - "column": 6 + "line": 15, + "column": 27 } } }, @@ -605,15 +2768,66 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "start": 436, + "end": 437, "loc": { "start": { - "line": 1, + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 439, + "end": 445, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 445, + "end": 446, + "loc": { + "start": { + "line": 16, "column": 7 }, "end": { - "line": 1, + "line": 16, "column": 8 } } @@ -630,42 +2844,45 @@ "postfix": false, "binop": null }, - "value": "delete_case2", - "start": 8, - "end": 20, + "value": "n", + "start": 446, + "end": 447, "loc": { "start": { - "line": 1, + "line": 16, "column": 8 }, "end": { - "line": 1, - "column": 20 + "line": 16, + "column": 9 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 20, - "end": 21, + "value": "instanceof", + "start": 448, + "end": 458, "loc": { "start": { - "line": 1, - "column": 20 + "line": 16, + "column": 10 }, "end": { - "line": 1, - "column": 21 + "line": 16, + "column": 20 } } }, @@ -681,23 +2898,50 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 22, - "end": 26, + "value": "Node", + "start": 459, + "end": 463, "loc": { "start": { - "line": 1, - "column": 22 + "line": 16, + "column": 21 }, "end": { - "line": 1, + "line": 16, + "column": 25 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 464, + "end": 466, + "loc": { + "start": { + "line": 16, "column": 26 + }, + "end": { + "line": 16, + "column": 28 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -705,20 +2949,98 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": null + }, + "value": "n", + "start": 467, + "end": 468, + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 30 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, "updateContext": null }, - "value": "./delete_case2.js", - "start": 27, - "end": 46, + "value": "instanceof", + "start": 469, + "end": 479, + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 41 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 480, + "end": 484, + "loc": { + "start": { + "line": 16, + "column": 42 + }, + "end": { + "line": 16, + "column": 46 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 484, + "end": 485, "loc": { "start": { - "line": 1, - "column": 27 + "line": 16, + "column": 46 }, "end": { - "line": 1, - "column": 46 + "line": 16, + "column": 47 } } }, @@ -735,88 +3057,67 @@ "binop": null, "updateContext": null }, - "start": 46, - "end": 47, + "start": 485, + "end": 486, "loc": { "start": { - "line": 1, - "column": 46 - }, - "end": { - "line": 1, + "line": 16, "column": 47 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", - "start": 49, - "end": 262, - "loc": { - "start": { - "line": 3, - "column": 0 }, "end": { - "line": 10, - "column": 3 + "line": 16, + "column": 48 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 263, - "end": 269, + "value": "assert", + "start": 488, + "end": 494, "loc": { "start": { - "line": 11, - "column": 0 + "line": 17, + "column": 1 }, "end": { - "line": 11, - "column": 6 + "line": 17, + "column": 7 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 270, - "end": 275, + "start": 494, + "end": 495, "loc": { "start": { - "line": 11, + "line": 17, "column": 7 }, "end": { - "line": 11, - "column": 12 + "line": 17, + "column": 8 } } }, @@ -832,51 +3133,50 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 276, - "end": 288, + "value": "n", + "start": 495, + "end": 496, "loc": { "start": { - "line": 11, - "column": 13 + "line": 17, + "column": 8 }, "end": { - "line": 11, - "column": 25 + "line": 17, + "column": 9 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 289, - "end": 290, + "start": 496, + "end": 497, "loc": { "start": { - "line": 11, - "column": 26 + "line": 17, + "column": 9 }, "end": { - "line": 11, - "column": 27 + "line": 17, + "column": 10 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -885,16 +3185,44 @@ "postfix": false, "binop": null }, - "start": 291, - "end": 292, + "value": "_color", + "start": 497, + "end": 503, "loc": { "start": { - "line": 11, - "column": 28 + "line": 17, + "column": 10 }, "end": { - "line": 11, - "column": 29 + "line": 17, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 504, + "end": 507, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 20 } } }, @@ -910,17 +3238,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 292, - "end": 293, + "value": "BLACK", + "start": 508, + "end": 513, "loc": { "start": { - "line": 11, - "column": 29 + "line": 17, + "column": 21 }, "end": { - "line": 11, - "column": 30 + "line": 17, + "column": 26 } } }, @@ -936,22 +3264,22 @@ "postfix": false, "binop": null }, - "start": 293, - "end": 294, + "start": 513, + "end": 514, "loc": { "start": { - "line": 11, - "column": 30 + "line": 17, + "column": 26 }, "end": { - "line": 11, - "column": 31 + "line": 17, + "column": 27 } } }, { "type": { - "label": "=>", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -962,73 +3290,64 @@ "binop": null, "updateContext": null }, - "start": 295, - "end": 297, + "start": 514, + "end": 515, "loc": { "start": { - "line": 11, - "column": 32 + "line": 17, + "column": 27 }, "end": { - "line": 11, - "column": 34 + "line": 17, + "column": 28 } } }, { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 298, - "end": 299, + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 517, + "end": 561, "loc": { "start": { - "line": 11, - "column": 35 + "line": 18, + "column": 1 }, "end": { - "line": 11, - "column": 36 + "line": 18, + "column": 45 } } }, { "type": "CommentLine", - "value": " If n is the root, there is nothing to do: all paths go through n, and n", - "start": 301, - "end": 375, + "value": " - all paths go through n, and", + "start": 563, + "end": 597, "loc": { "start": { - "line": 12, + "line": 19, "column": 1 }, "end": { - "line": 12, - "column": 75 + "line": 19, + "column": 35 } } }, { "type": "CommentLine", - "value": " is black.", - "start": 377, - "end": 389, + "value": " - n is black.", + "start": 599, + "end": 617, "loc": { "start": { - "line": 13, + "line": 20, "column": 1 }, "end": { - "line": 13, - "column": 13 + "line": 20, + "column": 19 } } }, @@ -1047,15 +3366,15 @@ "updateContext": null }, "value": "if", - "start": 391, - "end": 393, + "start": 619, + "end": 621, "loc": { "start": { - "line": 14, + "line": 21, "column": 1 }, "end": { - "line": 14, + "line": 21, "column": 3 } } @@ -1072,15 +3391,15 @@ "postfix": false, "binop": null }, - "start": 394, - "end": 395, + "start": 622, + "end": 623, "loc": { "start": { - "line": 14, + "line": 21, "column": 4 }, "end": { - "line": 14, + "line": 21, "column": 5 } } @@ -1098,15 +3417,15 @@ "binop": null }, "value": "n", - "start": 395, - "end": 396, + "start": 623, + "end": 624, "loc": { "start": { - "line": 14, + "line": 21, "column": 5 }, "end": { - "line": 14, + "line": 21, "column": 6 } } @@ -1124,15 +3443,15 @@ "binop": null, "updateContext": null }, - "start": 396, - "end": 397, + "start": 624, + "end": 625, "loc": { "start": { - "line": 14, + "line": 21, "column": 6 }, "end": { - "line": 14, + "line": 21, "column": 7 } } @@ -1150,15 +3469,15 @@ "binop": null }, "value": "parent", - "start": 397, - "end": 403, + "start": 625, + "end": 631, "loc": { "start": { - "line": 14, + "line": 21, "column": 7 }, "end": { - "line": 14, + "line": 21, "column": 13 } } @@ -1177,15 +3496,15 @@ "updateContext": null }, "value": "!==", - "start": 404, - "end": 407, + "start": 632, + "end": 635, "loc": { "start": { - "line": 14, + "line": 21, "column": 14 }, "end": { - "line": 14, + "line": 21, "column": 17 } } @@ -1205,15 +3524,15 @@ "updateContext": null }, "value": "null", - "start": 408, - "end": 412, + "start": 636, + "end": 640, "loc": { "start": { - "line": 14, + "line": 21, "column": 18 }, "end": { - "line": 14, + "line": 21, "column": 22 } } @@ -1230,15 +3549,15 @@ "postfix": false, "binop": null }, - "start": 412, - "end": 413, + "start": 640, + "end": 641, "loc": { "start": { - "line": 14, + "line": 21, "column": 22 }, "end": { - "line": 14, + "line": 21, "column": 23 } } @@ -1256,15 +3575,15 @@ "binop": null }, "value": "delete_case2", - "start": 414, - "end": 426, + "start": 642, + "end": 654, "loc": { "start": { - "line": 14, + "line": 21, "column": 24 }, "end": { - "line": 14, + "line": 21, "column": 36 } } @@ -1281,15 +3600,15 @@ "postfix": false, "binop": null }, - "start": 426, - "end": 427, + "start": 654, + "end": 655, "loc": { "start": { - "line": 14, + "line": 21, "column": 36 }, "end": { - "line": 14, + "line": 21, "column": 37 } } @@ -1307,15 +3626,15 @@ "binop": null }, "value": "n", - "start": 427, - "end": 428, + "start": 655, + "end": 656, "loc": { "start": { - "line": 14, + "line": 21, "column": 37 }, "end": { - "line": 14, + "line": 21, "column": 38 } } @@ -1332,15 +3651,15 @@ "postfix": false, "binop": null }, - "start": 428, - "end": 429, + "start": 656, + "end": 657, "loc": { "start": { - "line": 14, + "line": 21, "column": 38 }, "end": { - "line": 14, + "line": 21, "column": 39 } } @@ -1358,15 +3677,15 @@ "binop": null, "updateContext": null }, - "start": 429, - "end": 430, + "start": 657, + "end": 658, "loc": { "start": { - "line": 14, + "line": 21, "column": 39 }, "end": { - "line": 14, + "line": 21, "column": 40 } } @@ -1383,15 +3702,15 @@ "postfix": false, "binop": null }, - "start": 431, - "end": 432, + "start": 659, + "end": 660, "loc": { "start": { - "line": 15, + "line": 22, "column": 0 }, "end": { - "line": 15, + "line": 22, "column": 1 } } @@ -1409,19 +3728,127 @@ "binop": null, "updateContext": null }, - "start": 432, - "end": 433, + "start": 660, + "end": 661, "loc": { "start": { - "line": 15, + "line": 22, "column": 1 }, "end": { - "line": 15, + "line": 22, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 663, + "end": 669, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 670, + "end": 677, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case1", + "start": 678, + "end": 690, + "loc": { + "start": { + "line": 24, + "column": 15 + }, + "end": { + "line": 24, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 690, + "end": 691, + "loc": { + "start": { + "line": 24, + "column": 27 + }, + "end": { + "line": 24, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -1435,15 +3862,15 @@ "binop": null, "updateContext": null }, - "start": 434, - "end": 434, + "start": 692, + "end": 692, "loc": { "start": { - "line": 16, + "line": 25, "column": 0 }, "end": { - "line": 16, + "line": 25, "column": 0 } } diff --git a/ast/source/deletion/delete_case2.js.json b/ast/source/deletion/delete_case2.js.json index 3684273..390f9f5 100644 --- a/ast/source/deletion/delete_case2.js.json +++ b/ast/source/deletion/delete_case2.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1151, + "end": 1455, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 42, + "line": 53, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1151, + "end": 1455, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 42, + "line": 53, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 45, + "end": 28, "loc": { "start": { "line": 1, @@ -39,134 +39,68 @@ }, "end": { "line": 1, - "column": 45 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { - "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - { - "type": "ImportSpecifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "imported": { - "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "RED" - }, - "name": "RED" - }, - "local": { - "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "RED" + "identifierName": "assert" }, - "name": "RED" + "name": "assert" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 44, + "start": 19, + "end": 27, "loc": { "start": { "line": 1, - "column": 25 + "column": 19 }, "end": { "line": 1, - "column": 44 + "column": 27 } }, "extra": { - "rawValue": "../color/index.js", - "raw": "'../color/index.js'" + "rawValue": "assert", + "raw": "'assert'" }, - "value": "../color/index.js" + "value": "assert" } }, { "type": "ImportDeclaration", - "start": 46, - "end": 107, + "start": 29, + "end": 67, "loc": { "start": { "line": 2, @@ -174,220 +108,206 @@ }, "end": { "line": 2, - "column": 61 + "column": 38 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 54, - "end": 65, + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, "loc": { "start": { "line": 2, - "column": 8 + "column": 7 }, "end": { "line": 2, - "column": 19 + "column": 12 } }, - "imported": { - "type": "Identifier", - "start": 54, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, "local": { "type": "Identifier", - "start": 54, - "end": 65, + "start": 36, + "end": 41, "loc": { "start": { "line": 2, - "column": 8 + "column": 7 }, "end": { "line": 2, - "column": 19 + "column": 12 }, - "identifierName": "rotate_left" + "identifierName": "BLACK" }, - "name": "rotate_left" + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 } }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 68, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 34 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 67, - "end": 79, + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 78, "loc": { "start": { - "line": 2, - "column": 21 + "line": 3, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 3, + "column": 10 } }, - "imported": { - "type": "Identifier", - "start": 67, - "end": 79, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 33 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - }, "local": { "type": "Identifier", - "start": 67, - "end": 79, + "start": 75, + "end": 78, "loc": { "start": { - "line": 2, - "column": 21 + "line": 3, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 3, + "column": 10 }, - "identifierName": "rotate_right" + "identifierName": "RED" }, - "name": "rotate_right" + "name": "RED" } } ], "source": { "type": "StringLiteral", - "start": 86, - "end": 106, + "start": 84, + "end": 101, "loc": { "start": { - "line": 2, - "column": 40 + "line": 3, + "column": 16 }, "end": { - "line": 2, - "column": 60 + "line": 3, + "column": 33 } }, "extra": { - "rawValue": "../rotate/index.js", - "raw": "'../rotate/index.js'" + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" }, - "value": "../rotate/index.js" + "value": "../color/RED.js" } }, { "type": "ImportDeclaration", - "start": 108, - "end": 153, + "start": 103, + "end": 139, "loc": { "start": { - "line": 3, + "line": 4, "column": 0 }, "end": { - "line": 3, - "column": 45 + "line": 4, + "column": 36 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 116, - "end": 123, + "type": "ImportDefaultSpecifier", + "start": 110, + "end": 114, "loc": { "start": { - "line": 3, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 3, - "column": 15 + "line": 4, + "column": 11 } }, - "imported": { - "type": "Identifier", - "start": 116, - "end": 123, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "sibling" - }, - "name": "sibling" - }, "local": { "type": "Identifier", - "start": 116, - "end": 123, + "start": 110, + "end": 114, "loc": { "start": { - "line": 3, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 3, - "column": 15 + "line": 4, + "column": 11 }, - "identifierName": "sibling" + "identifierName": "Node" }, - "name": "sibling" + "name": "Node" } } ], "source": { "type": "StringLiteral", - "start": 130, - "end": 152, + "start": 120, + "end": 138, "loc": { "start": { - "line": 3, - "column": 22 + "line": 4, + "column": 17 }, "end": { - "line": 3, - "column": 44 + "line": 4, + "column": 35 } }, "extra": { - "rawValue": "../family/sibling.js", - "raw": "'../family/sibling.js'" + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" }, - "value": "../family/sibling.js" + "value": "../types/Node.js" } }, { "type": "ImportDeclaration", - "start": 155, - "end": 202, + "start": 140, + "end": 176, "loc": { "start": { "line": 5, @@ -395,85 +315,68 @@ }, "end": { "line": 5, - "column": 47 + "column": 36 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 163, - "end": 175, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 151, "loc": { "start": { "line": 5, - "column": 8 + "column": 7 }, "end": { "line": 5, - "column": 20 + "column": 11 } }, - "imported": { - "type": "Identifier", - "start": 163, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 20 - }, - "identifierName": "delete_case3" - }, - "name": "delete_case3" - }, "local": { "type": "Identifier", - "start": 163, - "end": 175, + "start": 147, + "end": 151, "loc": { "start": { "line": 5, - "column": 8 + "column": 7 }, "end": { "line": 5, - "column": 20 + "column": 11 }, - "identifierName": "delete_case3" + "identifierName": "Leaf" }, - "name": "delete_case3" + "name": "Leaf" } } ], "source": { "type": "StringLiteral", - "start": 182, - "end": 201, + "start": 157, + "end": 175, "loc": { "start": { "line": 5, - "column": 27 + "column": 17 }, "end": { "line": 5, - "column": 46 + "column": 35 } }, "extra": { - "rawValue": "./delete_case3.js", - "raw": "'./delete_case3.js'" + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" }, - "value": "./delete_case3.js" + "value": "../types/Leaf.js" } }, { "type": "ImportDeclaration", - "start": 203, - "end": 250, + "start": 177, + "end": 228, "loc": { "start": { "line": 6, @@ -481,1316 +384,4470 @@ }, "end": { "line": 6, - "column": 47 + "column": 51 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 211, - "end": 223, + "type": "ImportDefaultSpecifier", + "start": 184, + "end": 195, "loc": { "start": { "line": 6, - "column": 8 + "column": 7 }, "end": { "line": 6, - "column": 20 + "column": 18 } }, - "imported": { - "type": "Identifier", - "start": 211, - "end": 223, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 20 - }, - "identifierName": "delete_case4" - }, - "name": "delete_case4" - }, "local": { "type": "Identifier", - "start": 211, - "end": 223, + "start": 184, + "end": 195, "loc": { "start": { "line": 6, - "column": 8 + "column": 7 }, "end": { "line": 6, - "column": 20 + "column": 18 }, - "identifierName": "delete_case4" + "identifierName": "rotate_left" }, - "name": "delete_case4" + "name": "rotate_left" } } ], "source": { "type": "StringLiteral", - "start": 230, - "end": 249, + "start": 201, + "end": 227, "loc": { "start": { "line": 6, - "column": 27 + "column": 24 }, "end": { "line": 6, - "column": 46 + "column": 50 } }, "extra": { - "rawValue": "./delete_case4.js", - "raw": "'./delete_case4.js'" + "rawValue": "../rotate/rotate_left.js", + "raw": "'../rotate/rotate_left.js'" }, - "value": "./delete_case4.js" + "value": "../rotate/rotate_left.js" + } + }, + { + "type": "ImportDeclaration", + "start": 229, + "end": 282, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 53 + } }, - "trailingComments": [ + "specifiers": [ { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", - "start": 252, - "end": 490, + "type": "ImportDefaultSpecifier", + "start": 236, + "end": 248, "loc": { "start": { - "line": 8, - "column": 0 + "line": 7, + "column": 7 }, "end": { - "line": 16, - "column": 3 + "line": 7, + "column": 19 } + }, + "local": { + "type": "Identifier", + "start": 236, + "end": 248, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" } } - ] + ], + "source": { + "type": "StringLiteral", + "start": 254, + "end": 281, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 52 + } + }, + "extra": { + "rawValue": "../rotate/rotate_right.js", + "raw": "'../rotate/rotate_right.js'" + }, + "value": "../rotate/rotate_right.js" + } }, { - "type": "ExportNamedDeclaration", - "start": 491, - "end": 1150, + "type": "ImportDeclaration", + "start": 283, + "end": 326, "loc": { "start": { - "line": 17, + "line": 8, "column": 0 }, "end": { - "line": 41, - "column": 2 + "line": 8, + "column": 43 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 498, - "end": 1150, - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 41, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 504, - "end": 1149, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 290, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + }, + "local": { + "type": "Identifier", + "start": 290, + "end": 297, "loc": { "start": { - "line": 17, - "column": 13 + "line": 8, + "column": 7 }, "end": { - "line": 41, - "column": 1 - } + "line": 8, + "column": 14 + }, + "identifierName": "sibling" }, - "id": { - "type": "Identifier", - "start": 504, - "end": 516, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 25 - }, - "identifierName": "delete_case2" + "name": "sibling" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 303, + "end": 325, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 42 + } + }, + "extra": { + "rawValue": "../family/sibling.js", + "raw": "'../family/sibling.js'" + }, + "value": "../family/sibling.js" + } + }, + { + "type": "ImportDeclaration", + "start": 328, + "end": 373, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 335, + "end": 347, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 335, + "end": 347, + "loc": { + "start": { + "line": 10, + "column": 7 }, - "name": "delete_case2", - "leadingComments": null + "end": { + "line": 10, + "column": 19 + }, + "identifierName": "delete_case3" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 519, - "end": 1149, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 41, - "column": 1 - } + "name": "delete_case3" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 353, + "end": 372, + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 44 + } + }, + "extra": { + "rawValue": "./delete_case3.js", + "raw": "'./delete_case3.js'" + }, + "value": "./delete_case3.js" + } + }, + { + "type": "ImportDeclaration", + "start": 374, + "end": 419, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 381, + "end": 393, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 381, + "end": 393, + "loc": { + "start": { + "line": 11, + "column": 7 }, - "id": { + "end": { + "line": 11, + "column": 19 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 399, + "end": 418, + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 44 + } + }, + "extra": { + "rawValue": "./delete_case4.js", + "raw": "'./delete_case4.js'" + }, + "value": "./delete_case4.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 421, + "end": 664, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 665, + "end": 1424, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 50, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 671, + "end": 1423, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 671, + "end": 683, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + }, + "identifierName": "delete_case2" + }, + "name": "delete_case2", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 686, + "end": 1423, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 504, - "end": 516, + "start": 687, + "end": 688, "loc": { "start": { - "line": 17, - "column": 13 + "line": 22, + "column": 22 }, "end": { - "line": 17, - "column": 25 + "line": 22, + "column": 23 }, - "identifierName": "delete_case2" + "identifierName": "n" }, - "name": "delete_case2", - "leadingComments": null + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 693, + "end": 1423, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 50, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 520, - "end": 521, + "type": "ExpressionStatement", + "start": 696, + "end": 743, "loc": { "start": { - "line": 17, - "column": 29 + "line": 23, + "column": 1 }, "end": { - "line": 17, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 526, - "end": 1149, - "loc": { - "start": { - "line": 17, - "column": 35 + "line": 23, + "column": 48 + } }, - "end": { - "line": 41, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 529, - "end": 550, + "expression": { + "type": "CallExpression", + "start": 696, + "end": 742, "loc": { "start": { - "line": 18, + "line": 23, "column": 1 }, "end": { - "line": 18, - "column": 22 + "line": 23, + "column": 47 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 696, + "end": 702, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 535, - "end": 549, + "type": "LogicalExpression", + "start": 703, + "end": 741, "loc": { "start": { - "line": 18, - "column": 7 + "line": 23, + "column": 8 }, "end": { - "line": 18, - "column": 21 + "line": 23, + "column": 46 } }, - "id": { - "type": "Identifier", - "start": 535, - "end": 536, + "left": { + "type": "BinaryExpression", + "start": 703, + "end": 720, "loc": { "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, + "line": 23, "column": 8 }, - "identifierName": "s" - }, - "name": "s" + "end": { + "line": 23, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 703, + "end": 704, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 716, + "end": 720, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } }, - "init": { - "type": "CallExpression", - "start": 539, - "end": 549, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 724, + "end": 741, "loc": { "start": { - "line": 18, - "column": 11 + "line": 23, + "column": 29 }, "end": { - "line": 18, - "column": 21 + "line": 23, + "column": 46 } }, - "callee": { + "left": { "type": "Identifier", - "start": 539, - "end": 546, + "start": 724, + "end": 725, "loc": { "start": { - "line": 18, - "column": 11 + "line": 23, + "column": 29 }, "end": { - "line": 18, - "column": 18 + "line": 23, + "column": 30 }, - "identifierName": "sibling" + "identifierName": "n" }, - "name": "sibling" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 547, - "end": 548, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 20 - }, - "identifierName": "n" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 737, + "end": 741, + "loc": { + "start": { + "line": 23, + "column": 42 }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 553, - "end": 921, - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 30, - "column": 4 + "end": { + "line": 23, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" } } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 745, + "end": 772, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 28 + } }, - { - "type": "IfStatement", - "start": 923, - "end": 1147, + "expression": { + "type": "CallExpression", + "start": 745, + "end": 771, "loc": { "start": { - "line": 31, + "line": 24, "column": 1 }, "end": { - "line": 40, - "column": 22 + "line": 24, + "column": 27 } }, - "test": { - "type": "BinaryExpression", - "start": 927, - "end": 943, + "callee": { + "type": "Identifier", + "start": 745, + "end": 751, "loc": { "start": { - "line": 31, - "column": 5 + "line": 24, + "column": 1 }, "end": { - "line": 31, - "column": 21 - } + "line": 24, + "column": 7 + }, + "identifierName": "assert" }, - "left": { - "type": "MemberExpression", - "start": 927, - "end": 935, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 752, + "end": 770, "loc": { "start": { - "line": 31, - "column": 5 + "line": 24, + "column": 8 }, "end": { - "line": 31, - "column": 13 + "line": 24, + "column": 26 } }, - "object": { - "type": "Identifier", - "start": 927, - "end": 928, + "left": { + "type": "MemberExpression", + "start": 752, + "end": 760, "loc": { "start": { - "line": 31, - "column": 5 + "line": 24, + "column": 8 }, "end": { - "line": 31, - "column": 6 + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 752, + "end": 753, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "s" + "name": "n" }, - "name": "s", - "leadingComments": null + "property": { + "type": "Identifier", + "start": 754, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 929, - "end": 935, + "start": 765, + "end": 770, "loc": { "start": { - "line": 31, - "column": 7 + "line": 24, + "column": 21 }, "end": { - "line": 31, - "column": 13 + "line": 24, + "column": 26 }, - "identifierName": "_color" + "identifierName": "BLACK" }, - "name": "_color" + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 774, + "end": 800, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 774, + "end": 799, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 774, + "end": 780, + "loc": { + "start": { + "line": 25, + "column": 1 }, - "computed": false, - "leadingComments": null + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 940, - "end": 943, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 781, + "end": 798, "loc": { "start": { - "line": 31, - "column": 18 + "line": 25, + "column": 8 }, "end": { - "line": 31, - "column": 21 + "line": 25, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 781, + "end": 789, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } }, - "identifierName": "RED" + "object": { + "type": "Identifier", + "start": 781, + "end": 782, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 783, + "end": 789, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "name": "RED" - }, - "leadingComments": null + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 794, + "end": 798, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 803, + "end": 824, + "loc": { + "start": { + "line": 27, + "column": 1 }, - "consequent": { - "type": "BlockStatement", - "start": 945, - "end": 1094, + "end": { + "line": 27, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 809, + "end": 823, "loc": { "start": { - "line": 31, - "column": 23 + "line": 27, + "column": 7 }, "end": { - "line": 37, - "column": 2 + "line": 27, + "column": 21 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 949, - "end": 971, + "id": { + "type": "Identifier", + "start": 809, + "end": 810, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 813, + "end": 823, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 813, + "end": 820, "loc": { "start": { - "line": 32, - "column": 2 + "line": 27, + "column": 11 }, "end": { - "line": 32, - "column": 24 - } + "line": 27, + "column": 18 + }, + "identifierName": "sibling" }, - "expression": { - "type": "AssignmentExpression", - "start": 949, - "end": 970, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 821, + "end": 822, "loc": { "start": { - "line": 32, - "column": 2 + "line": 27, + "column": 19 }, "end": { - "line": 32, - "column": 23 - } + "line": 27, + "column": 20 + }, + "identifierName": "n" }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 949, - "end": 964, - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 949, - "end": 957, - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 949, - "end": 950, - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 951, - "end": 957, - "loc": { - "start": { - "line": 32, - "column": 4 - }, - "end": { - "line": 32, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 958, - "end": 964, - "loc": { - "start": { - "line": 32, - "column": 11 - }, - "end": { - "line": 32, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 967, - "end": 970, - "loc": { - "start": { - "line": 32, - "column": 20 - }, - "end": { - "line": 32, - "column": 23 - }, - "identifierName": "RED" - }, - "name": "RED" - } + "name": "n" } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 827, + "end": 1195, + "loc": { + "start": { + "line": 29, + "column": 1 }, - { - "type": "ExpressionStatement", - "start": 974, - "end": 991, + "end": { + "line": 39, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1197, + "end": 1421, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 49, + "column": 22 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1201, + "end": 1217, + "loc": { + "start": { + "line": 40, + "column": 5 + }, + "end": { + "line": 40, + "column": 21 + } + }, + "left": { + "type": "MemberExpression", + "start": 1201, + "end": 1209, + "loc": { + "start": { + "line": 40, + "column": 5 + }, + "end": { + "line": 40, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 1201, + "end": 1202, + "loc": { + "start": { + "line": 40, + "column": 5 + }, + "end": { + "line": 40, + "column": 6 + }, + "identifierName": "s" + }, + "name": "s", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1203, + "end": 1209, + "loc": { + "start": { + "line": 40, + "column": 7 + }, + "end": { + "line": 40, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1214, + "end": 1217, + "loc": { + "start": { + "line": 40, + "column": 18 + }, + "end": { + "line": 40, + "column": 21 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1219, + "end": 1368, + "loc": { + "start": { + "line": 40, + "column": 23 + }, + "end": { + "line": 46, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1223, + "end": 1245, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1223, + "end": 1244, "loc": { "start": { - "line": 33, + "line": 41, "column": 2 }, "end": { - "line": 33, - "column": 19 + "line": 41, + "column": 23 } }, - "expression": { - "type": "AssignmentExpression", - "start": 974, - "end": 990, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1223, + "end": 1238, "loc": { "start": { - "line": 33, + "line": 41, "column": 2 }, "end": { - "line": 33, - "column": 18 + "line": 41, + "column": 17 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 974, - "end": 982, + "start": 1223, + "end": 1231, "loc": { "start": { - "line": 33, + "line": 41, "column": 2 }, "end": { - "line": 33, + "line": 41, "column": 10 } }, "object": { "type": "Identifier", - "start": 974, - "end": 975, + "start": 1223, + "end": 1224, "loc": { "start": { - "line": 33, + "line": 41, "column": 2 }, "end": { - "line": 33, + "line": 41, "column": 3 }, - "identifierName": "s" + "identifierName": "n" }, - "name": "s" + "name": "n" }, "property": { "type": "Identifier", - "start": 976, - "end": 982, + "start": 1225, + "end": 1231, "loc": { "start": { - "line": 33, + "line": 41, "column": 4 }, "end": { - "line": 33, + "line": 41, "column": 10 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false }, - "right": { + "property": { "type": "Identifier", - "start": 985, - "end": 990, + "start": 1232, + "end": 1238, "loc": { "start": { - "line": 33, - "column": 13 + "line": 41, + "column": 11 }, "end": { - "line": 33, - "column": 18 + "line": 41, + "column": 17 }, - "identifierName": "BLACK" + "identifierName": "_color" }, - "name": "BLACK" - } + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1241, + "end": 1244, + "loc": { + "start": { + "line": 41, + "column": 20 + }, + "end": { + "line": 41, + "column": 23 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1248, + "end": 1265, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 42, + "column": 19 } }, - { - "type": "IfStatement", - "start": 994, - "end": 1072, + "expression": { + "type": "AssignmentExpression", + "start": 1248, + "end": 1264, "loc": { "start": { - "line": 34, + "line": 42, "column": 2 }, "end": { - "line": 35, - "column": 30 + "line": 42, + "column": 18 } }, - "test": { - "type": "BinaryExpression", - "start": 998, - "end": 1017, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1248, + "end": 1256, "loc": { "start": { - "line": 34, - "column": 6 + "line": 42, + "column": 2 }, "end": { - "line": 34, - "column": 25 + "line": 42, + "column": 10 } }, - "left": { + "object": { "type": "Identifier", - "start": 998, - "end": 999, + "start": 1248, + "end": 1249, "loc": { "start": { - "line": 34, - "column": 6 + "line": 42, + "column": 2 }, "end": { - "line": 34, - "column": 7 + "line": 42, + "column": 3 }, - "identifierName": "n" + "identifierName": "s" }, - "name": "n" + "name": "s" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1004, - "end": 1017, + "property": { + "type": "Identifier", + "start": 1250, + "end": 1256, "loc": { "start": { - "line": 34, - "column": 12 + "line": 42, + "column": 4 }, "end": { - "line": 34, - "column": 25 - } - }, - "object": { - "type": "MemberExpression", - "start": 1004, - "end": 1012, - "loc": { - "start": { - "line": 34, - "column": 12 - }, - "end": { - "line": 34, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 1004, - "end": 1005, - "loc": { - "start": { - "line": 34, - "column": 12 - }, - "end": { - "line": 34, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1006, - "end": 1012, - "loc": { - "start": { - "line": 34, - "column": 14 - }, - "end": { - "line": 34, - "column": 20 - }, - "identifierName": "parent" - }, - "name": "parent" + "line": 42, + "column": 10 }, - "computed": false + "identifierName": "_color" }, - "property": { - "type": "Identifier", - "start": 1013, - "end": 1017, - "loc": { - "start": { - "line": 34, - "column": 21 - }, - "end": { - "line": 34, - "column": 25 - }, - "identifierName": "left" - }, - "name": "left" + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1259, + "end": 1264, + "loc": { + "start": { + "line": 42, + "column": 13 }, - "computed": false + "end": { + "line": 42, + "column": 18 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1268, + "end": 1346, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 44, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1272, + "end": 1291, + "loc": { + "start": { + "line": 43, + "column": 6 + }, + "end": { + "line": 43, + "column": 25 } }, - "consequent": { - "type": "ExpressionStatement", - "start": 1019, - "end": 1041, + "left": { + "type": "Identifier", + "start": 1272, + "end": 1273, "loc": { "start": { - "line": 34, - "column": 27 + "line": 43, + "column": 6 }, "end": { - "line": 34, - "column": 49 + "line": 43, + "column": 7 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1278, + "end": 1291, + "loc": { + "start": { + "line": 43, + "column": 12 + }, + "end": { + "line": 43, + "column": 25 } }, - "expression": { - "type": "CallExpression", - "start": 1019, - "end": 1040, + "object": { + "type": "MemberExpression", + "start": 1278, + "end": 1286, "loc": { "start": { - "line": 34, - "column": 27 + "line": 43, + "column": 12 }, "end": { - "line": 34, - "column": 48 + "line": 43, + "column": 20 } }, - "callee": { + "object": { "type": "Identifier", - "start": 1019, - "end": 1030, + "start": 1278, + "end": 1279, "loc": { "start": { - "line": 34, - "column": 27 + "line": 43, + "column": 12 }, "end": { - "line": 34, - "column": 38 + "line": 43, + "column": 13 }, - "identifierName": "rotate_left" + "identifierName": "n" }, - "name": "rotate_left" + "name": "n" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1031, - "end": 1039, - "loc": { - "start": { - "line": 34, - "column": 39 - }, - "end": { - "line": 34, - "column": 47 - } - }, - "object": { - "type": "Identifier", - "start": 1031, - "end": 1032, - "loc": { - "start": { - "line": 34, - "column": 39 - }, - "end": { - "line": 34, - "column": 40 - }, - "identifierName": "n" - }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1280, + "end": 1286, + "loc": { + "start": { + "line": 43, + "column": 14 }, - "property": { - "type": "Identifier", - "start": 1033, - "end": 1039, - "loc": { - "start": { - "line": 34, - "column": 41 - }, - "end": { - "line": 34, - "column": 47 - }, - "identifierName": "parent" - }, - "name": "parent" + "end": { + "line": 43, + "column": 20 }, - "computed": false - } - ] + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1287, + "end": 1291, + "loc": { + "start": { + "line": 43, + "column": 21 + }, + "end": { + "line": 43, + "column": 25 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1293, + "end": 1315, + "loc": { + "start": { + "line": 43, + "column": 27 + }, + "end": { + "line": 43, + "column": 49 } }, - "alternate": { - "type": "ExpressionStatement", - "start": 1049, - "end": 1072, + "expression": { + "type": "CallExpression", + "start": 1293, + "end": 1314, "loc": { "start": { - "line": 35, - "column": 7 + "line": 43, + "column": 27 }, "end": { - "line": 35, - "column": 30 + "line": 43, + "column": 48 } }, - "expression": { - "type": "CallExpression", - "start": 1049, - "end": 1071, + "callee": { + "type": "Identifier", + "start": 1293, + "end": 1304, "loc": { "start": { - "line": 35, - "column": 7 + "line": 43, + "column": 27 }, "end": { - "line": 35, - "column": 29 - } + "line": 43, + "column": 38 + }, + "identifierName": "rotate_left" }, - "callee": { - "type": "Identifier", - "start": 1049, - "end": 1061, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1305, + "end": 1313, "loc": { "start": { - "line": 35, - "column": 7 + "line": 43, + "column": 39 }, "end": { - "line": 35, - "column": 19 - }, - "identifierName": "rotate_right" + "line": 43, + "column": 47 + } }, - "name": "rotate_right" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1062, - "end": 1070, + "object": { + "type": "Identifier", + "start": 1305, + "end": 1306, "loc": { "start": { - "line": 35, - "column": 20 + "line": 43, + "column": 39 }, "end": { - "line": 35, - "column": 28 - } - }, - "object": { - "type": "Identifier", - "start": 1062, - "end": 1063, - "loc": { - "start": { - "line": 35, - "column": 20 - }, - "end": { - "line": 35, - "column": 21 - }, - "identifierName": "n" + "line": 43, + "column": 40 }, - "name": "n" + "identifierName": "n" }, - "property": { - "type": "Identifier", - "start": 1064, - "end": 1070, - "loc": { - "start": { - "line": 35, - "column": 22 - }, - "end": { - "line": 35, - "column": 28 - }, - "identifierName": "parent" + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1307, + "end": 1313, + "loc": { + "start": { + "line": 43, + "column": 41 }, - "name": "parent" + "end": { + "line": 43, + "column": 47 + }, + "identifierName": "parent" }, - "computed": false - } - ] - } + "name": "parent" + }, + "computed": false + } + ] } }, - { + "alternate": { "type": "ExpressionStatement", - "start": 1075, - "end": 1091, + "start": 1323, + "end": 1346, "loc": { "start": { - "line": 36, - "column": 2 + "line": 44, + "column": 7 }, "end": { - "line": 36, - "column": 18 + "line": 44, + "column": 30 } }, "expression": { "type": "CallExpression", - "start": 1075, - "end": 1090, + "start": 1323, + "end": 1345, "loc": { "start": { - "line": 36, - "column": 2 + "line": 44, + "column": 7 }, "end": { - "line": 36, - "column": 17 + "line": 44, + "column": 29 } }, "callee": { "type": "Identifier", - "start": 1075, - "end": 1087, + "start": 1323, + "end": 1335, "loc": { "start": { - "line": 36, - "column": 2 + "line": 44, + "column": 7 }, "end": { - "line": 36, - "column": 14 + "line": 44, + "column": 19 }, - "identifierName": "delete_case4" + "identifierName": "rotate_right" }, - "name": "delete_case4" + "name": "rotate_right" }, "arguments": [ { - "type": "Identifier", - "start": 1088, - "end": 1089, + "type": "MemberExpression", + "start": 1336, + "end": 1344, "loc": { "start": { - "line": 36, - "column": 15 + "line": 44, + "column": 20 }, "end": { - "line": 36, - "column": 16 + "line": 44, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 1336, + "end": 1337, + "loc": { + "start": { + "line": 44, + "column": 20 + }, + "end": { + "line": 44, + "column": 21 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" - } - ] - } - } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 3.", - "start": 1097, - "end": 1124, - "loc": { - "start": { - "line": 39, - "column": 1 - }, - "end": { - "line": 39, - "column": 28 - } + "property": { + "type": "Identifier", + "start": 1338, + "end": 1344, + "loc": { + "start": { + "line": 44, + "column": 22 + }, + "end": { + "line": 44, + "column": 28 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] } } - ] - }, - "alternate": { - "type": "ExpressionStatement", - "start": 1131, - "end": 1147, - "loc": { - "start": { - "line": 40, - "column": 6 - }, - "end": { - "line": 40, - "column": 22 - } }, - "expression": { - "type": "CallExpression", - "start": 1131, - "end": 1146, + { + "type": "ExpressionStatement", + "start": 1349, + "end": 1365, "loc": { "start": { - "line": 40, - "column": 6 + "line": 45, + "column": 2 }, "end": { - "line": 40, - "column": 21 + "line": 45, + "column": 18 } }, - "callee": { - "type": "Identifier", - "start": 1131, - "end": 1143, + "expression": { + "type": "CallExpression", + "start": 1349, + "end": 1364, "loc": { "start": { - "line": 40, - "column": 6 + "line": 45, + "column": 2 }, "end": { - "line": 40, - "column": 18 - }, - "identifierName": "delete_case3" + "line": 45, + "column": 17 + } }, - "name": "delete_case3", - "leadingComments": null - }, - "arguments": [ - { + "callee": { "type": "Identifier", - "start": 1144, - "end": 1145, + "start": 1349, + "end": 1361, "loc": { "start": { - "line": 40, - "column": 19 + "line": 45, + "column": 2 }, "end": { - "line": 40, - "column": 20 + "line": 45, + "column": 14 }, - "identifierName": "n" + "identifierName": "delete_case4" }, - "name": "n" + "name": "delete_case4" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1362, + "end": 1363, + "loc": { + "start": { + "line": 45, + "column": 15 + }, + "end": { + "line": 45, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1371, + "end": 1398, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 28 } - ], + } + } + ] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1405, + "end": 1421, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 1405, + "end": 1420, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 1405, + "end": 1417, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 18 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3", "leadingComments": null }, - "leadingComments": [ + "arguments": [ { - "type": "CommentLine", - "value": " Otherwise, go to case 3.", - "start": 1097, - "end": 1124, + "type": "Identifier", + "start": 1418, + "end": 1419, "loc": { "start": { - "line": 39, - "column": 1 + "line": 49, + "column": 19 }, "end": { - "line": 39, - "column": 28 - } - } + "line": 49, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" } - ] + ], + "leadingComments": null }, "leadingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 553, - "end": 921, + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1371, + "end": 1398, "loc": { "start": { - "line": 20, + "line": 48, "column": 1 }, "end": { - "line": 30, - "column": 4 + "line": 48, + "column": 28 } } } ] - } - ], - "directives": [] - } - }, - "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 827, + "end": 1195, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 39, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1426, + "end": 1454, + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 1441, + "end": 1453, + "loc": { + "start": { + "line": 52, + "column": 15 + }, + "end": { + "line": 52, + "column": 27 + }, + "identifierName": "delete_case2" + }, + "name": "delete_case2" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1426, + "end": 1454, + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 665, + "end": 1424, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 50, + "column": 2 } - ], - "kind": "const", - "leadingComments": [ + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", - "start": 252, - "end": 490, + "type": "VariableDeclarator", + "start": 671, + "end": 1423, "loc": { "start": { - "line": 8, - "column": 0 + "line": 22, + "column": 6 }, "end": { - "line": 16, - "column": 3 + "line": 50, + "column": 1 } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", - "start": 252, - "end": 490, - "loc": { - "start": { - "line": 8, - "column": 0 }, - "end": { - "line": 16, - "column": 3 - } - } - } - ] - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", - "start": 252, - "end": 490, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 16, - "column": 3 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 553, - "end": 921, + "id": { + "type": "Identifier", + "start": 671, + "end": 683, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + }, + "identifierName": "delete_case2" + }, + "name": "delete_case2", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 686, + "end": 1423, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 671, + "end": 683, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + }, + "identifierName": "delete_case2" + }, + "name": "delete_case2", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 687, + "end": 688, + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 693, + "end": 1423, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 696, + "end": 743, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 696, + "end": 742, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 696, + "end": 702, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 703, + "end": 741, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 703, + "end": 720, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 703, + "end": 704, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 716, + "end": 720, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 724, + "end": 741, + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 724, + "end": 725, + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 737, + "end": 741, + "loc": { + "start": { + "line": 23, + "column": 42 + }, + "end": { + "line": 23, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 745, + "end": 772, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 745, + "end": 771, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 745, + "end": 751, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 752, + "end": 770, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 752, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 752, + "end": 753, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 754, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 765, + "end": 770, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 774, + "end": 800, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 774, + "end": 799, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 774, + "end": 780, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 781, + "end": 798, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 781, + "end": 789, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 781, + "end": 782, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 783, + "end": 789, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 794, + "end": 798, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 803, + "end": 824, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 809, + "end": 823, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 809, + "end": 810, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 813, + "end": 823, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 813, + "end": 820, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 821, + "end": 822, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 827, + "end": 1195, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 39, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1197, + "end": 1421, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 49, + "column": 22 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1201, + "end": 1217, + "loc": { + "start": { + "line": 40, + "column": 5 + }, + "end": { + "line": 40, + "column": 21 + } + }, + "left": { + "type": "MemberExpression", + "start": 1201, + "end": 1209, + "loc": { + "start": { + "line": 40, + "column": 5 + }, + "end": { + "line": 40, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 1201, + "end": 1202, + "loc": { + "start": { + "line": 40, + "column": 5 + }, + "end": { + "line": 40, + "column": 6 + }, + "identifierName": "s" + }, + "name": "s", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1203, + "end": 1209, + "loc": { + "start": { + "line": 40, + "column": 7 + }, + "end": { + "line": 40, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1214, + "end": 1217, + "loc": { + "start": { + "line": 40, + "column": 18 + }, + "end": { + "line": 40, + "column": 21 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1219, + "end": 1368, + "loc": { + "start": { + "line": 40, + "column": 23 + }, + "end": { + "line": 46, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1223, + "end": 1245, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1223, + "end": 1244, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 23 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1223, + "end": 1238, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1223, + "end": 1231, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1223, + "end": 1224, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1225, + "end": 1231, + "loc": { + "start": { + "line": 41, + "column": 4 + }, + "end": { + "line": 41, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1232, + "end": 1238, + "loc": { + "start": { + "line": 41, + "column": 11 + }, + "end": { + "line": 41, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1241, + "end": 1244, + "loc": { + "start": { + "line": 41, + "column": 20 + }, + "end": { + "line": 41, + "column": 23 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1248, + "end": 1265, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 42, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1248, + "end": 1264, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 42, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1248, + "end": 1256, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 42, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1248, + "end": 1249, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 42, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1250, + "end": 1256, + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 42, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1259, + "end": 1264, + "loc": { + "start": { + "line": 42, + "column": 13 + }, + "end": { + "line": 42, + "column": 18 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1268, + "end": 1346, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 44, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1272, + "end": 1291, + "loc": { + "start": { + "line": 43, + "column": 6 + }, + "end": { + "line": 43, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 1272, + "end": 1273, + "loc": { + "start": { + "line": 43, + "column": 6 + }, + "end": { + "line": 43, + "column": 7 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1278, + "end": 1291, + "loc": { + "start": { + "line": 43, + "column": 12 + }, + "end": { + "line": 43, + "column": 25 + } + }, + "object": { + "type": "MemberExpression", + "start": 1278, + "end": 1286, + "loc": { + "start": { + "line": 43, + "column": 12 + }, + "end": { + "line": 43, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 1278, + "end": 1279, + "loc": { + "start": { + "line": 43, + "column": 12 + }, + "end": { + "line": 43, + "column": 13 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1280, + "end": 1286, + "loc": { + "start": { + "line": 43, + "column": 14 + }, + "end": { + "line": 43, + "column": 20 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1287, + "end": 1291, + "loc": { + "start": { + "line": 43, + "column": 21 + }, + "end": { + "line": 43, + "column": 25 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1293, + "end": 1315, + "loc": { + "start": { + "line": 43, + "column": 27 + }, + "end": { + "line": 43, + "column": 49 + } + }, + "expression": { + "type": "CallExpression", + "start": 1293, + "end": 1314, + "loc": { + "start": { + "line": 43, + "column": 27 + }, + "end": { + "line": 43, + "column": 48 + } + }, + "callee": { + "type": "Identifier", + "start": 1293, + "end": 1304, + "loc": { + "start": { + "line": 43, + "column": 27 + }, + "end": { + "line": 43, + "column": 38 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1305, + "end": 1313, + "loc": { + "start": { + "line": 43, + "column": 39 + }, + "end": { + "line": 43, + "column": 47 + } + }, + "object": { + "type": "Identifier", + "start": 1305, + "end": 1306, + "loc": { + "start": { + "line": 43, + "column": 39 + }, + "end": { + "line": 43, + "column": 40 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1307, + "end": 1313, + "loc": { + "start": { + "line": 43, + "column": 41 + }, + "end": { + "line": 43, + "column": 47 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1323, + "end": 1346, + "loc": { + "start": { + "line": 44, + "column": 7 + }, + "end": { + "line": 44, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 1323, + "end": 1345, + "loc": { + "start": { + "line": 44, + "column": 7 + }, + "end": { + "line": 44, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 1323, + "end": 1335, + "loc": { + "start": { + "line": 44, + "column": 7 + }, + "end": { + "line": 44, + "column": 19 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1336, + "end": 1344, + "loc": { + "start": { + "line": 44, + "column": 20 + }, + "end": { + "line": 44, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 1336, + "end": 1337, + "loc": { + "start": { + "line": 44, + "column": 20 + }, + "end": { + "line": 44, + "column": 21 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1338, + "end": 1344, + "loc": { + "start": { + "line": 44, + "column": 22 + }, + "end": { + "line": 44, + "column": 28 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 1349, + "end": 1365, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1349, + "end": 1364, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1349, + "end": 1361, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 14 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1362, + "end": 1363, + "loc": { + "start": { + "line": 45, + "column": 15 + }, + "end": { + "line": 45, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1371, + "end": 1398, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 28 + } + } + } + ] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1405, + "end": 1421, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 1405, + "end": 1420, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 1405, + "end": 1417, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 18 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1418, + "end": 1419, + "loc": { + "start": { + "line": 49, + "column": 19 + }, + "end": { + "line": 49, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1371, + "end": 1398, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 28 + } + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 827, + "end": 1195, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 39, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 421, + "end": 664, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 421, + "end": 664, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 827, + "end": 1195, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 39, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1371, + "end": 1398, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 28 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 75, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 103, + "end": 109, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 115, + "end": 119, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 120, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 147, + "end": 151, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 152, + "end": 156, + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 175, + "end": 176, + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 177, + "end": 183, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 184, + "end": 195, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 196, + "end": 200, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_left.js", + "start": 201, + "end": 227, + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 227, + "end": 228, + "loc": { + "start": { + "line": 6, + "column": 50 + }, + "end": { + "line": 6, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 229, + "end": 235, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 236, + "end": 248, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 249, + "end": 253, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_right.js", + "start": 254, + "end": 281, "loc": { "start": { - "line": 20, - "column": 1 + "line": 7, + "column": 25 }, "end": { - "line": 30, - "column": 4 + "line": 7, + "column": 52 } } }, { - "type": "CommentLine", - "value": " Otherwise, go to case 3.", - "start": 1097, - "end": 1124, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 281, + "end": 282, "loc": { "start": { - "line": 39, - "column": 1 + "line": 7, + "column": 52 }, "end": { - "line": 39, - "column": 28 + "line": 7, + "column": 53 } } - } - ], - "tokens": [ + }, { "type": { "label": "import", @@ -1806,23 +4863,23 @@ "updateContext": null }, "value": "import", - "start": 0, - "end": 6, + "start": 283, + "end": 289, "loc": { "start": { - "line": 1, + "line": 8, "column": 0 }, "end": { - "line": 1, + "line": 8, "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1831,16 +4888,17 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "value": "sibling", + "start": 290, + "end": 297, "loc": { "start": { - "line": 1, + "line": 8, "column": 7 }, "end": { - "line": 1, - "column": 8 + "line": 8, + "column": 14 } } }, @@ -1856,23 +4914,50 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "from", + "start": 298, + "end": 302, "loc": { "start": { - "line": 1, - "column": 8 + "line": 8, + "column": 15 }, "end": { - "line": 1, - "column": 13 + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/sibling.js", + "start": 303, + "end": 325, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 42 } } }, { "type": { - "label": ",", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1883,22 +4968,23 @@ "binop": null, "updateContext": null }, - "start": 13, - "end": 14, + "start": 325, + "end": 326, "loc": { "start": { - "line": 1, - "column": 13 + "line": 8, + "column": 42 }, "end": { - "line": 1, - "column": 14 + "line": 8, + "column": 43 } } }, { "type": { - "label": "name", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1906,27 +4992,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 15, - "end": 18, + "value": "import", + "start": 328, + "end": 334, "loc": { "start": { - "line": 1, - "column": 15 + "line": 10, + "column": 0 }, "end": { - "line": 1, - "column": 18 + "line": 10, + "column": 6 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1934,15 +5021,16 @@ "postfix": false, "binop": null }, - "start": 18, - "end": 19, + "value": "delete_case3", + "start": 335, + "end": 347, "loc": { "start": { - "line": 1, - "column": 18 + "line": 10, + "column": 7 }, "end": { - "line": 1, + "line": 10, "column": 19 } } @@ -1960,15 +5048,15 @@ "binop": null }, "value": "from", - "start": 20, - "end": 24, + "start": 348, + "end": 352, "loc": { "start": { - "line": 1, + "line": 10, "column": 20 }, "end": { - "line": 1, + "line": 10, "column": 24 } } @@ -1986,16 +5074,16 @@ "binop": null, "updateContext": null }, - "value": "../color/index.js", - "start": 25, - "end": 44, + "value": "./delete_case3.js", + "start": 353, + "end": 372, "loc": { "start": { - "line": 1, + "line": 10, "column": 25 }, "end": { - "line": 1, + "line": 10, "column": 44 } } @@ -2013,15 +5101,15 @@ "binop": null, "updateContext": null }, - "start": 44, - "end": 45, + "start": 372, + "end": 373, "loc": { "start": { - "line": 1, + "line": 10, "column": 44 }, "end": { - "line": 1, + "line": 10, "column": 45 } } @@ -2041,23 +5129,23 @@ "updateContext": null }, "value": "import", - "start": 46, - "end": 52, + "start": 374, + "end": 380, "loc": { "start": { - "line": 2, + "line": 11, "column": 0 }, "end": { - "line": 2, + "line": 11, "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2066,16 +5154,17 @@ "postfix": false, "binop": null }, - "start": 53, - "end": 54, + "value": "delete_case4", + "start": 381, + "end": 393, "loc": { "start": { - "line": 2, + "line": 11, "column": 7 }, "end": { - "line": 2, - "column": 8 + "line": 11, + "column": 19 } } }, @@ -2091,25 +5180,25 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 54, - "end": 65, + "value": "from", + "start": 394, + "end": 398, "loc": { "start": { - "line": 2, - "column": 8 + "line": 11, + "column": 20 }, "end": { - "line": 2, - "column": 19 + "line": 11, + "column": 24 } } }, { "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, + "label": "string", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2118,48 +5207,66 @@ "binop": null, "updateContext": null }, - "start": 65, - "end": 66, + "value": "./delete_case4.js", + "start": 399, + "end": 418, "loc": { "start": { - "line": 2, - "column": 19 + "line": 11, + "column": 25 }, "end": { - "line": 2, - "column": 20 + "line": 11, + "column": 44 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "rotate_right", - "start": 67, - "end": 79, + "start": 418, + "end": 419, "loc": { "start": { - "line": 2, - "column": 21 + "line": 11, + "column": 44 }, "end": { - "line": 2, - "column": 33 + "line": 11, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 421, + "end": 664, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 } } }, { "type": { - "label": "}", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2167,18 +5274,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 79, - "end": 80, + "value": "const", + "start": 665, + "end": 670, "loc": { "start": { - "line": 2, - "column": 33 + "line": 22, + "column": 0 }, "end": { - "line": 2, - "column": 34 + "line": 22, + "column": 5 } } }, @@ -2194,77 +5303,75 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 81, - "end": 85, + "value": "delete_case2", + "start": 671, + "end": 683, "loc": { "start": { - "line": 2, - "column": 35 + "line": 22, + "column": 6 }, "end": { - "line": 2, - "column": 39 + "line": 22, + "column": 18 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "../rotate/index.js", - "start": 86, - "end": 106, + "value": "=", + "start": 684, + "end": 685, "loc": { "start": { - "line": 2, - "column": 40 + "line": 22, + "column": 19 }, "end": { - "line": 2, - "column": 60 + "line": 22, + "column": 20 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 106, - "end": 107, + "start": 686, + "end": 687, "loc": { "start": { - "line": 2, - "column": 60 + "line": 22, + "column": 21 }, "end": { - "line": 2, - "column": 61 + "line": 22, + "column": 22 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2272,52 +5379,77 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 108, - "end": 114, + "value": "n", + "start": 687, + "end": 688, + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 688, + "end": 689, "loc": { "start": { - "line": 3, - "column": 0 + "line": 22, + "column": 23 }, "end": { - "line": 3, - "column": 6 + "line": 22, + "column": 24 } } }, { "type": { - "label": "{", + "label": "=>", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 115, - "end": 116, + "start": 690, + "end": 692, "loc": { "start": { - "line": 3, - "column": 7 + "line": 22, + "column": 25 }, "end": { - "line": 3, - "column": 8 + "line": 22, + "column": 27 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2326,25 +5458,24 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 116, - "end": 123, + "start": 693, + "end": 694, "loc": { "start": { - "line": 3, - "column": 8 + "line": 22, + "column": 28 }, "end": { - "line": 3, - "column": 15 + "line": 22, + "column": 29 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2352,23 +5483,24 @@ "postfix": false, "binop": null }, - "start": 123, - "end": 124, + "value": "assert", + "start": 696, + "end": 702, "loc": { "start": { - "line": 3, - "column": 15 + "line": 23, + "column": 1 }, "end": { - "line": 3, - "column": 16 + "line": 23, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2377,23 +5509,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 125, - "end": 129, + "start": 702, + "end": 703, "loc": { "start": { - "line": 3, - "column": 17 + "line": 23, + "column": 7 }, "end": { - "line": 3, - "column": 21 + "line": 23, + "column": 8 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2401,26 +5532,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/sibling.js", - "start": 130, - "end": 152, + "value": "n", + "start": 703, + "end": 704, "loc": { "start": { - "line": 3, - "column": 22 + "line": 23, + "column": 8 }, "end": { - "line": 3, - "column": 44 + "line": 23, + "column": 9 } } }, { "type": { - "label": ";", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2428,26 +5559,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 152, - "end": 153, + "value": "instanceof", + "start": 705, + "end": 715, "loc": { "start": { - "line": 3, - "column": 44 + "line": 23, + "column": 10 }, "end": { - "line": 3, - "column": 45 + "line": 23, + "column": 20 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2455,45 +5586,46 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 155, - "end": 161, + "value": "Node", + "start": 716, + "end": 720, "loc": { "start": { - "line": 5, - "column": 0 + "line": 23, + "column": 21 }, "end": { - "line": 5, - "column": 6 + "line": 23, + "column": 25 } } }, { "type": { - "label": "{", + "label": "||", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 1, + "updateContext": null }, - "start": 162, - "end": 163, + "value": "||", + "start": 721, + "end": 723, "loc": { "start": { - "line": 5, - "column": 7 + "line": 23, + "column": 26 }, "end": { - "line": 5, - "column": 8 + "line": 23, + "column": 28 } } }, @@ -2509,42 +5641,45 @@ "postfix": false, "binop": null }, - "value": "delete_case3", - "start": 163, - "end": 175, + "value": "n", + "start": 724, + "end": 725, "loc": { "start": { - "line": 5, - "column": 8 + "line": 23, + "column": 29 }, "end": { - "line": 5, - "column": 20 + "line": 23, + "column": 30 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 175, - "end": 176, + "value": "instanceof", + "start": 726, + "end": 736, "loc": { "start": { - "line": 5, - "column": 20 + "line": 23, + "column": 31 }, "end": { - "line": 5, - "column": 21 + "line": 23, + "column": 41 } } }, @@ -2560,44 +5695,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 177, - "end": 181, + "value": "Leaf", + "start": 737, + "end": 741, "loc": { "start": { - "line": 5, - "column": 22 + "line": 23, + "column": 42 }, "end": { - "line": 5, - "column": 26 + "line": 23, + "column": 46 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./delete_case3.js", - "start": 182, - "end": 201, + "start": 741, + "end": 742, "loc": { "start": { - "line": 5, - "column": 27 + "line": 23, + "column": 46 }, "end": { - "line": 5, - "column": 46 + "line": 23, + "column": 47 } } }, @@ -2614,23 +5747,22 @@ "binop": null, "updateContext": null }, - "start": 201, - "end": 202, + "start": 742, + "end": 743, "loc": { "start": { - "line": 5, - "column": 46 + "line": 23, + "column": 47 }, "end": { - "line": 5, - "column": 47 + "line": 23, + "column": 48 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2638,26 +5770,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 203, - "end": 209, + "value": "assert", + "start": 745, + "end": 751, "loc": { "start": { - "line": 6, - "column": 0 + "line": 24, + "column": 1 }, "end": { - "line": 6, - "column": 6 + "line": 24, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -2667,15 +5798,15 @@ "postfix": false, "binop": null }, - "start": 210, - "end": 211, + "start": 751, + "end": 752, "loc": { "start": { - "line": 6, + "line": 24, "column": 7 }, "end": { - "line": 6, + "line": 24, "column": 8 } } @@ -2692,23 +5823,23 @@ "postfix": false, "binop": null }, - "value": "delete_case4", - "start": 211, - "end": 223, + "value": "n", + "start": 752, + "end": 753, "loc": { "start": { - "line": 6, + "line": 24, "column": 8 }, "end": { - "line": 6, - "column": 20 + "line": 24, + "column": 9 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2716,18 +5847,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 223, - "end": 224, + "start": 753, + "end": 754, "loc": { "start": { - "line": 6, - "column": 20 + "line": 24, + "column": 9 }, "end": { - "line": 6, - "column": 21 + "line": 24, + "column": 10 } } }, @@ -2743,23 +5875,50 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 225, - "end": 229, + "value": "_color", + "start": 754, + "end": 760, "loc": { "start": { - "line": 6, - "column": 22 + "line": 24, + "column": 10 }, "end": { - "line": 6, - "column": 26 + "line": 24, + "column": 16 } } }, { "type": { - "label": "string", + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 761, + "end": 764, + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2767,118 +5926,121 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./delete_case4.js", - "start": 230, - "end": 249, + "value": "BLACK", + "start": 765, + "end": 770, "loc": { "start": { - "line": 6, - "column": 27 + "line": 24, + "column": 21 }, "end": { - "line": 6, - "column": 46 + "line": 24, + "column": 26 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 249, - "end": 250, + "start": 770, + "end": 771, "loc": { "start": { - "line": 6, - "column": 46 + "line": 24, + "column": 26 }, "end": { - "line": 6, - "column": 47 + "line": 24, + "column": 27 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", - "start": 252, - "end": 490, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 771, + "end": 772, "loc": { "start": { - "line": 8, - "column": 0 + "line": 24, + "column": 27 }, "end": { - "line": 16, - "column": 3 + "line": 24, + "column": 28 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 491, - "end": 497, + "value": "assert", + "start": 774, + "end": 780, "loc": { "start": { - "line": 17, - "column": 0 + "line": 25, + "column": 1 }, "end": { - "line": 17, - "column": 6 + "line": 25, + "column": 7 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 498, - "end": 503, + "start": 780, + "end": 781, "loc": { "start": { - "line": 17, + "line": 25, "column": 7 }, "end": { - "line": 17, - "column": 12 + "line": 25, + "column": 8 } } }, @@ -2894,51 +6056,50 @@ "postfix": false, "binop": null }, - "value": "delete_case2", - "start": 504, - "end": 516, + "value": "n", + "start": 781, + "end": 782, "loc": { "start": { - "line": 17, - "column": 13 + "line": 25, + "column": 8 }, "end": { - "line": 17, - "column": 25 + "line": 25, + "column": 9 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 517, - "end": 518, + "start": 782, + "end": 783, "loc": { "start": { - "line": 17, - "column": 26 + "line": 25, + "column": 9 }, "end": { - "line": 17, - "column": 27 + "line": 25, + "column": 10 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2947,118 +6108,123 @@ "postfix": false, "binop": null }, - "start": 519, - "end": 520, + "value": "parent", + "start": 783, + "end": 789, "loc": { "start": { - "line": 17, - "column": 28 + "line": 25, + "column": 10 }, "end": { - "line": 17, - "column": 29 + "line": 25, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "n", - "start": 520, - "end": 521, + "value": "!==", + "start": 790, + "end": 793, "loc": { "start": { - "line": 17, - "column": 29 + "line": 25, + "column": 17 }, "end": { - "line": 17, - "column": 30 + "line": 25, + "column": 20 } } }, { "type": { - "label": ")", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 521, - "end": 522, + "value": "null", + "start": 794, + "end": 798, "loc": { "start": { - "line": 17, - "column": 30 + "line": 25, + "column": 21 }, "end": { - "line": 17, - "column": 31 + "line": 25, + "column": 25 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 523, - "end": 525, + "start": 798, + "end": 799, "loc": { "start": { - "line": 17, - "column": 32 + "line": 25, + "column": 25 }, "end": { - "line": 17, - "column": 34 + "line": 25, + "column": 26 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 526, - "end": 527, + "start": 799, + "end": 800, "loc": { "start": { - "line": 17, - "column": 35 + "line": 25, + "column": 26 }, "end": { - "line": 17, - "column": 36 + "line": 25, + "column": 27 } } }, @@ -3077,15 +6243,15 @@ "updateContext": null }, "value": "const", - "start": 529, - "end": 534, + "start": 803, + "end": 808, "loc": { "start": { - "line": 18, + "line": 27, "column": 1 }, "end": { - "line": 18, + "line": 27, "column": 6 } } @@ -3103,15 +6269,15 @@ "binop": null }, "value": "s", - "start": 535, - "end": 536, + "start": 809, + "end": 810, "loc": { "start": { - "line": 18, + "line": 27, "column": 7 }, "end": { - "line": 18, + "line": 27, "column": 8 } } @@ -3130,15 +6296,15 @@ "updateContext": null }, "value": "=", - "start": 537, - "end": 538, + "start": 811, + "end": 812, "loc": { "start": { - "line": 18, + "line": 27, "column": 9 }, "end": { - "line": 18, + "line": 27, "column": 10 } } @@ -3156,15 +6322,15 @@ "binop": null }, "value": "sibling", - "start": 539, - "end": 546, + "start": 813, + "end": 820, "loc": { "start": { - "line": 18, + "line": 27, "column": 11 }, "end": { - "line": 18, + "line": 27, "column": 18 } } @@ -3181,15 +6347,15 @@ "postfix": false, "binop": null }, - "start": 546, - "end": 547, + "start": 820, + "end": 821, "loc": { "start": { - "line": 18, + "line": 27, "column": 18 }, "end": { - "line": 18, + "line": 27, "column": 19 } } @@ -3207,15 +6373,15 @@ "binop": null }, "value": "n", - "start": 547, - "end": 548, + "start": 821, + "end": 822, "loc": { "start": { - "line": 18, + "line": 27, "column": 19 }, "end": { - "line": 18, + "line": 27, "column": 20 } } @@ -3232,15 +6398,15 @@ "postfix": false, "binop": null }, - "start": 548, - "end": 549, + "start": 822, + "end": 823, "loc": { "start": { - "line": 18, + "line": 27, "column": 20 }, "end": { - "line": 18, + "line": 27, "column": 21 } } @@ -3258,15 +6424,15 @@ "binop": null, "updateContext": null }, - "start": 549, - "end": 550, + "start": 823, + "end": 824, "loc": { "start": { - "line": 18, + "line": 27, "column": 21 }, "end": { - "line": 18, + "line": 27, "column": 22 } } @@ -3274,15 +6440,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 553, - "end": 921, + "start": 827, + "end": 1195, "loc": { "start": { - "line": 20, + "line": 29, "column": 1 }, "end": { - "line": 30, + "line": 39, "column": 4 } } @@ -3302,15 +6468,15 @@ "updateContext": null }, "value": "if", - "start": 923, - "end": 925, + "start": 1197, + "end": 1199, "loc": { "start": { - "line": 31, + "line": 40, "column": 1 }, "end": { - "line": 31, + "line": 40, "column": 3 } } @@ -3327,15 +6493,15 @@ "postfix": false, "binop": null }, - "start": 926, - "end": 927, + "start": 1200, + "end": 1201, "loc": { "start": { - "line": 31, + "line": 40, "column": 4 }, "end": { - "line": 31, + "line": 40, "column": 5 } } @@ -3353,15 +6519,15 @@ "binop": null }, "value": "s", - "start": 927, - "end": 928, + "start": 1201, + "end": 1202, "loc": { "start": { - "line": 31, + "line": 40, "column": 5 }, "end": { - "line": 31, + "line": 40, "column": 6 } } @@ -3379,15 +6545,15 @@ "binop": null, "updateContext": null }, - "start": 928, - "end": 929, + "start": 1202, + "end": 1203, "loc": { "start": { - "line": 31, + "line": 40, "column": 6 }, "end": { - "line": 31, + "line": 40, "column": 7 } } @@ -3405,15 +6571,15 @@ "binop": null }, "value": "_color", - "start": 929, - "end": 935, + "start": 1203, + "end": 1209, "loc": { "start": { - "line": 31, + "line": 40, "column": 7 }, "end": { - "line": 31, + "line": 40, "column": 13 } } @@ -3432,15 +6598,15 @@ "updateContext": null }, "value": "===", - "start": 936, - "end": 939, + "start": 1210, + "end": 1213, "loc": { "start": { - "line": 31, + "line": 40, "column": 14 }, "end": { - "line": 31, + "line": 40, "column": 17 } } @@ -3458,15 +6624,15 @@ "binop": null }, "value": "RED", - "start": 940, - "end": 943, + "start": 1214, + "end": 1217, "loc": { "start": { - "line": 31, + "line": 40, "column": 18 }, "end": { - "line": 31, + "line": 40, "column": 21 } } @@ -3483,15 +6649,15 @@ "postfix": false, "binop": null }, - "start": 943, - "end": 944, + "start": 1217, + "end": 1218, "loc": { "start": { - "line": 31, + "line": 40, "column": 21 }, "end": { - "line": 31, + "line": 40, "column": 22 } } @@ -3508,15 +6674,15 @@ "postfix": false, "binop": null }, - "start": 945, - "end": 946, + "start": 1219, + "end": 1220, "loc": { "start": { - "line": 31, + "line": 40, "column": 23 }, "end": { - "line": 31, + "line": 40, "column": 24 } } @@ -3534,15 +6700,15 @@ "binop": null }, "value": "n", - "start": 949, - "end": 950, + "start": 1223, + "end": 1224, "loc": { "start": { - "line": 32, + "line": 41, "column": 2 }, "end": { - "line": 32, + "line": 41, "column": 3 } } @@ -3560,15 +6726,15 @@ "binop": null, "updateContext": null }, - "start": 950, - "end": 951, + "start": 1224, + "end": 1225, "loc": { "start": { - "line": 32, + "line": 41, "column": 3 }, "end": { - "line": 32, + "line": 41, "column": 4 } } @@ -3586,15 +6752,15 @@ "binop": null }, "value": "parent", - "start": 951, - "end": 957, + "start": 1225, + "end": 1231, "loc": { "start": { - "line": 32, + "line": 41, "column": 4 }, "end": { - "line": 32, + "line": 41, "column": 10 } } @@ -3612,15 +6778,15 @@ "binop": null, "updateContext": null }, - "start": 957, - "end": 958, + "start": 1231, + "end": 1232, "loc": { "start": { - "line": 32, + "line": 41, "column": 10 }, "end": { - "line": 32, + "line": 41, "column": 11 } } @@ -3638,15 +6804,15 @@ "binop": null }, "value": "_color", - "start": 958, - "end": 964, + "start": 1232, + "end": 1238, "loc": { "start": { - "line": 32, + "line": 41, "column": 11 }, "end": { - "line": 32, + "line": 41, "column": 17 } } @@ -3665,15 +6831,15 @@ "updateContext": null }, "value": "=", - "start": 965, - "end": 966, + "start": 1239, + "end": 1240, "loc": { "start": { - "line": 32, + "line": 41, "column": 18 }, "end": { - "line": 32, + "line": 41, "column": 19 } } @@ -3691,15 +6857,15 @@ "binop": null }, "value": "RED", - "start": 967, - "end": 970, + "start": 1241, + "end": 1244, "loc": { "start": { - "line": 32, + "line": 41, "column": 20 }, "end": { - "line": 32, + "line": 41, "column": 23 } } @@ -3717,15 +6883,15 @@ "binop": null, "updateContext": null }, - "start": 970, - "end": 971, + "start": 1244, + "end": 1245, "loc": { "start": { - "line": 32, + "line": 41, "column": 23 }, "end": { - "line": 32, + "line": 41, "column": 24 } } @@ -3743,15 +6909,15 @@ "binop": null }, "value": "s", - "start": 974, - "end": 975, + "start": 1248, + "end": 1249, "loc": { "start": { - "line": 33, + "line": 42, "column": 2 }, "end": { - "line": 33, + "line": 42, "column": 3 } } @@ -3769,15 +6935,15 @@ "binop": null, "updateContext": null }, - "start": 975, - "end": 976, + "start": 1249, + "end": 1250, "loc": { "start": { - "line": 33, + "line": 42, "column": 3 }, "end": { - "line": 33, + "line": 42, "column": 4 } } @@ -3795,15 +6961,15 @@ "binop": null }, "value": "_color", - "start": 976, - "end": 982, + "start": 1250, + "end": 1256, "loc": { "start": { - "line": 33, + "line": 42, "column": 4 }, "end": { - "line": 33, + "line": 42, "column": 10 } } @@ -3822,15 +6988,15 @@ "updateContext": null }, "value": "=", - "start": 983, - "end": 984, + "start": 1257, + "end": 1258, "loc": { "start": { - "line": 33, + "line": 42, "column": 11 }, "end": { - "line": 33, + "line": 42, "column": 12 } } @@ -3848,15 +7014,15 @@ "binop": null }, "value": "BLACK", - "start": 985, - "end": 990, + "start": 1259, + "end": 1264, "loc": { "start": { - "line": 33, + "line": 42, "column": 13 }, "end": { - "line": 33, + "line": 42, "column": 18 } } @@ -3874,15 +7040,15 @@ "binop": null, "updateContext": null }, - "start": 990, - "end": 991, + "start": 1264, + "end": 1265, "loc": { "start": { - "line": 33, + "line": 42, "column": 18 }, "end": { - "line": 33, + "line": 42, "column": 19 } } @@ -3902,15 +7068,15 @@ "updateContext": null }, "value": "if", - "start": 994, - "end": 996, + "start": 1268, + "end": 1270, "loc": { "start": { - "line": 34, + "line": 43, "column": 2 }, "end": { - "line": 34, + "line": 43, "column": 4 } } @@ -3927,15 +7093,15 @@ "postfix": false, "binop": null }, - "start": 997, - "end": 998, + "start": 1271, + "end": 1272, "loc": { "start": { - "line": 34, + "line": 43, "column": 5 }, "end": { - "line": 34, + "line": 43, "column": 6 } } @@ -3953,15 +7119,15 @@ "binop": null }, "value": "n", - "start": 998, - "end": 999, + "start": 1272, + "end": 1273, "loc": { "start": { - "line": 34, + "line": 43, "column": 6 }, "end": { - "line": 34, + "line": 43, "column": 7 } } @@ -3980,15 +7146,15 @@ "updateContext": null }, "value": "===", - "start": 1000, - "end": 1003, + "start": 1274, + "end": 1277, "loc": { "start": { - "line": 34, + "line": 43, "column": 8 }, "end": { - "line": 34, + "line": 43, "column": 11 } } @@ -4006,15 +7172,15 @@ "binop": null }, "value": "n", - "start": 1004, - "end": 1005, + "start": 1278, + "end": 1279, "loc": { "start": { - "line": 34, + "line": 43, "column": 12 }, "end": { - "line": 34, + "line": 43, "column": 13 } } @@ -4032,15 +7198,15 @@ "binop": null, "updateContext": null }, - "start": 1005, - "end": 1006, + "start": 1279, + "end": 1280, "loc": { "start": { - "line": 34, + "line": 43, "column": 13 }, "end": { - "line": 34, + "line": 43, "column": 14 } } @@ -4058,15 +7224,15 @@ "binop": null }, "value": "parent", - "start": 1006, - "end": 1012, + "start": 1280, + "end": 1286, "loc": { "start": { - "line": 34, + "line": 43, "column": 14 }, "end": { - "line": 34, + "line": 43, "column": 20 } } @@ -4084,15 +7250,15 @@ "binop": null, "updateContext": null }, - "start": 1012, - "end": 1013, + "start": 1286, + "end": 1287, "loc": { "start": { - "line": 34, + "line": 43, "column": 20 }, "end": { - "line": 34, + "line": 43, "column": 21 } } @@ -4110,15 +7276,15 @@ "binop": null }, "value": "left", - "start": 1013, - "end": 1017, + "start": 1287, + "end": 1291, "loc": { "start": { - "line": 34, + "line": 43, "column": 21 }, "end": { - "line": 34, + "line": 43, "column": 25 } } @@ -4135,15 +7301,15 @@ "postfix": false, "binop": null }, - "start": 1017, - "end": 1018, + "start": 1291, + "end": 1292, "loc": { "start": { - "line": 34, + "line": 43, "column": 25 }, "end": { - "line": 34, + "line": 43, "column": 26 } } @@ -4161,15 +7327,15 @@ "binop": null }, "value": "rotate_left", - "start": 1019, - "end": 1030, + "start": 1293, + "end": 1304, "loc": { "start": { - "line": 34, + "line": 43, "column": 27 }, "end": { - "line": 34, + "line": 43, "column": 38 } } @@ -4186,15 +7352,15 @@ "postfix": false, "binop": null }, - "start": 1030, - "end": 1031, + "start": 1304, + "end": 1305, "loc": { "start": { - "line": 34, + "line": 43, "column": 38 }, "end": { - "line": 34, + "line": 43, "column": 39 } } @@ -4212,15 +7378,15 @@ "binop": null }, "value": "n", - "start": 1031, - "end": 1032, + "start": 1305, + "end": 1306, "loc": { "start": { - "line": 34, + "line": 43, "column": 39 }, "end": { - "line": 34, + "line": 43, "column": 40 } } @@ -4238,15 +7404,15 @@ "binop": null, "updateContext": null }, - "start": 1032, - "end": 1033, + "start": 1306, + "end": 1307, "loc": { "start": { - "line": 34, + "line": 43, "column": 40 }, "end": { - "line": 34, + "line": 43, "column": 41 } } @@ -4264,15 +7430,15 @@ "binop": null }, "value": "parent", - "start": 1033, - "end": 1039, + "start": 1307, + "end": 1313, "loc": { "start": { - "line": 34, + "line": 43, "column": 41 }, "end": { - "line": 34, + "line": 43, "column": 47 } } @@ -4289,15 +7455,15 @@ "postfix": false, "binop": null }, - "start": 1039, - "end": 1040, + "start": 1313, + "end": 1314, "loc": { "start": { - "line": 34, + "line": 43, "column": 47 }, "end": { - "line": 34, + "line": 43, "column": 48 } } @@ -4315,15 +7481,15 @@ "binop": null, "updateContext": null }, - "start": 1040, - "end": 1041, + "start": 1314, + "end": 1315, "loc": { "start": { - "line": 34, + "line": 43, "column": 48 }, "end": { - "line": 34, + "line": 43, "column": 49 } } @@ -4343,15 +7509,15 @@ "updateContext": null }, "value": "else", - "start": 1044, - "end": 1048, + "start": 1318, + "end": 1322, "loc": { "start": { - "line": 35, + "line": 44, "column": 2 }, "end": { - "line": 35, + "line": 44, "column": 6 } } @@ -4369,15 +7535,15 @@ "binop": null }, "value": "rotate_right", - "start": 1049, - "end": 1061, + "start": 1323, + "end": 1335, "loc": { "start": { - "line": 35, + "line": 44, "column": 7 }, "end": { - "line": 35, + "line": 44, "column": 19 } } @@ -4394,15 +7560,15 @@ "postfix": false, "binop": null }, - "start": 1061, - "end": 1062, + "start": 1335, + "end": 1336, "loc": { "start": { - "line": 35, + "line": 44, "column": 19 }, "end": { - "line": 35, + "line": 44, "column": 20 } } @@ -4420,15 +7586,15 @@ "binop": null }, "value": "n", - "start": 1062, - "end": 1063, + "start": 1336, + "end": 1337, "loc": { "start": { - "line": 35, + "line": 44, "column": 20 }, "end": { - "line": 35, + "line": 44, "column": 21 } } @@ -4446,15 +7612,15 @@ "binop": null, "updateContext": null }, - "start": 1063, - "end": 1064, + "start": 1337, + "end": 1338, "loc": { "start": { - "line": 35, + "line": 44, "column": 21 }, "end": { - "line": 35, + "line": 44, "column": 22 } } @@ -4472,15 +7638,15 @@ "binop": null }, "value": "parent", - "start": 1064, - "end": 1070, + "start": 1338, + "end": 1344, "loc": { "start": { - "line": 35, + "line": 44, "column": 22 }, "end": { - "line": 35, + "line": 44, "column": 28 } } @@ -4497,15 +7663,15 @@ "postfix": false, "binop": null }, - "start": 1070, - "end": 1071, + "start": 1344, + "end": 1345, "loc": { "start": { - "line": 35, + "line": 44, "column": 28 }, "end": { - "line": 35, + "line": 44, "column": 29 } } @@ -4523,15 +7689,15 @@ "binop": null, "updateContext": null }, - "start": 1071, - "end": 1072, + "start": 1345, + "end": 1346, "loc": { "start": { - "line": 35, + "line": 44, "column": 29 }, "end": { - "line": 35, + "line": 44, "column": 30 } } @@ -4549,15 +7715,15 @@ "binop": null }, "value": "delete_case4", - "start": 1075, - "end": 1087, + "start": 1349, + "end": 1361, "loc": { "start": { - "line": 36, + "line": 45, "column": 2 }, "end": { - "line": 36, + "line": 45, "column": 14 } } @@ -4574,15 +7740,15 @@ "postfix": false, "binop": null }, - "start": 1087, - "end": 1088, + "start": 1361, + "end": 1362, "loc": { "start": { - "line": 36, + "line": 45, "column": 14 }, "end": { - "line": 36, + "line": 45, "column": 15 } } @@ -4600,15 +7766,15 @@ "binop": null }, "value": "n", - "start": 1088, - "end": 1089, + "start": 1362, + "end": 1363, "loc": { "start": { - "line": 36, + "line": 45, "column": 15 }, "end": { - "line": 36, + "line": 45, "column": 16 } } @@ -4625,15 +7791,15 @@ "postfix": false, "binop": null }, - "start": 1089, - "end": 1090, + "start": 1363, + "end": 1364, "loc": { "start": { - "line": 36, + "line": 45, "column": 16 }, "end": { - "line": 36, + "line": 45, "column": 17 } } @@ -4651,15 +7817,15 @@ "binop": null, "updateContext": null }, - "start": 1090, - "end": 1091, + "start": 1364, + "end": 1365, "loc": { "start": { - "line": 36, + "line": 45, "column": 17 }, "end": { - "line": 36, + "line": 45, "column": 18 } } @@ -4676,15 +7842,15 @@ "postfix": false, "binop": null }, - "start": 1093, - "end": 1094, + "start": 1367, + "end": 1368, "loc": { "start": { - "line": 37, + "line": 46, "column": 1 }, "end": { - "line": 37, + "line": 46, "column": 2 } } @@ -4692,15 +7858,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1097, - "end": 1124, + "start": 1371, + "end": 1398, "loc": { "start": { - "line": 39, + "line": 48, "column": 1 }, "end": { - "line": 39, + "line": 48, "column": 28 } } @@ -4720,15 +7886,15 @@ "updateContext": null }, "value": "else", - "start": 1126, - "end": 1130, + "start": 1400, + "end": 1404, "loc": { "start": { - "line": 40, + "line": 49, "column": 1 }, "end": { - "line": 40, + "line": 49, "column": 5 } } @@ -4746,15 +7912,15 @@ "binop": null }, "value": "delete_case3", - "start": 1131, - "end": 1143, + "start": 1405, + "end": 1417, "loc": { "start": { - "line": 40, + "line": 49, "column": 6 }, "end": { - "line": 40, + "line": 49, "column": 18 } } @@ -4771,15 +7937,15 @@ "postfix": false, "binop": null }, - "start": 1143, - "end": 1144, + "start": 1417, + "end": 1418, "loc": { "start": { - "line": 40, + "line": 49, "column": 18 }, "end": { - "line": 40, + "line": 49, "column": 19 } } @@ -4797,15 +7963,15 @@ "binop": null }, "value": "n", - "start": 1144, - "end": 1145, + "start": 1418, + "end": 1419, "loc": { "start": { - "line": 40, + "line": 49, "column": 19 }, "end": { - "line": 40, + "line": 49, "column": 20 } } @@ -4822,15 +7988,15 @@ "postfix": false, "binop": null }, - "start": 1145, - "end": 1146, + "start": 1419, + "end": 1420, "loc": { "start": { - "line": 40, + "line": 49, "column": 20 }, "end": { - "line": 40, + "line": 49, "column": 21 } } @@ -4848,15 +8014,15 @@ "binop": null, "updateContext": null }, - "start": 1146, - "end": 1147, + "start": 1420, + "end": 1421, "loc": { "start": { - "line": 40, + "line": 49, "column": 21 }, "end": { - "line": 40, + "line": 49, "column": 22 } } @@ -4873,15 +8039,15 @@ "postfix": false, "binop": null }, - "start": 1148, - "end": 1149, + "start": 1422, + "end": 1423, "loc": { "start": { - "line": 41, + "line": 50, "column": 0 }, "end": { - "line": 41, + "line": 50, "column": 1 } } @@ -4899,19 +8065,127 @@ "binop": null, "updateContext": null }, - "start": 1149, - "end": 1150, + "start": 1423, + "end": 1424, "loc": { "start": { - "line": 41, + "line": 50, "column": 1 }, "end": { - "line": 41, + "line": 50, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1426, + "end": 1432, + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1433, + "end": 1440, + "loc": { + "start": { + "line": 52, + "column": 7 + }, + "end": { + "line": 52, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case2", + "start": 1441, + "end": 1453, + "loc": { + "start": { + "line": 52, + "column": 15 + }, + "end": { + "line": 52, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1453, + "end": 1454, + "loc": { + "start": { + "line": 52, + "column": 27 + }, + "end": { + "line": 52, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -4925,15 +8199,15 @@ "binop": null, "updateContext": null }, - "start": 1151, - "end": 1151, + "start": 1455, + "end": 1455, "loc": { "start": { - "line": 42, + "line": 53, "column": 0 }, "end": { - "line": 42, + "line": 53, "column": 0 } } diff --git a/ast/source/deletion/delete_case3.js.json b/ast/source/deletion/delete_case3.js.json index 3eac76c..e18b370 100644 --- a/ast/source/deletion/delete_case3.js.json +++ b/ast/source/deletion/delete_case3.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1263, + "end": 1579, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 45, + "line": 56, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1263, + "end": 1579, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 45, + "line": 56, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 45, + "end": 28, "loc": { "start": { "line": 1, @@ -39,188 +39,381 @@ }, "end": { "line": 1, - "column": 45 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 41, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 12 }, "identifierName": "BLACK" }, "name": "BLACK" } + } + ], + "source": { + "type": "StringLiteral", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 68, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 }, + "end": { + "line": 3, + "column": 34 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 15, - "end": 18, + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 10 } }, - "imported": { + "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 75, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 10 }, "identifierName": "RED" }, "name": "RED" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "extra": { + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" + }, + "value": "../color/RED.js" + } + }, + { + "type": "ImportDeclaration", + "start": 103, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 110, + "end": 114, "loc": { "start": { - "line": 1, - "column": 15 + "line": 4, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 4, + "column": 11 }, - "identifierName": "RED" + "identifierName": "Node" }, - "name": "RED" + "name": "Node" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 44, + "start": 120, + "end": 138, "loc": { "start": { - "line": 1, - "column": 25 + "line": 4, + "column": 17 }, "end": { - "line": 1, - "column": 44 + "line": 4, + "column": 35 } }, "extra": { - "rawValue": "../color/index.js", - "raw": "'../color/index.js'" + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" }, - "value": "../color/index.js" + "value": "../types/Node.js" } }, { "type": "ImportDeclaration", - "start": 46, - "end": 91, + "start": 140, + "end": 176, "loc": { "start": { - "line": 2, + "line": 5, "column": 0 }, "end": { - "line": 2, - "column": 45 + "line": 5, + "column": 36 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 54, - "end": 61, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 151, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 15 + "line": 5, + "column": 11 } }, - "imported": { + "local": { "type": "Identifier", - "start": 54, - "end": 61, + "start": 147, + "end": 151, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 15 + "line": 5, + "column": 11 }, - "identifierName": "sibling" + "identifierName": "Leaf" }, - "name": "sibling" + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + } + }, + { + "type": "ImportDeclaration", + "start": 177, + "end": 220, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 43 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 184, + "end": 191, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 14 + } }, "local": { "type": "Identifier", - "start": 54, - "end": 61, + "start": 184, + "end": 191, "loc": { "start": { - "line": 2, - "column": 8 + "line": 6, + "column": 7 }, "end": { - "line": 2, - "column": 15 + "line": 6, + "column": 14 }, "identifierName": "sibling" }, @@ -230,16 +423,16 @@ ], "source": { "type": "StringLiteral", - "start": 68, - "end": 90, + "start": 197, + "end": 219, "loc": { "start": { - "line": 2, - "column": 22 + "line": 6, + "column": 20 }, "end": { - "line": 2, - "column": 44 + "line": 6, + "column": 42 } }, "extra": { @@ -251,62 +444,45 @@ }, { "type": "ImportDeclaration", - "start": 93, - "end": 140, + "start": 222, + "end": 267, "loc": { "start": { - "line": 4, + "line": 8, "column": 0 }, "end": { - "line": 4, - "column": 47 + "line": 8, + "column": 45 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 101, - "end": 113, + "type": "ImportDefaultSpecifier", + "start": 229, + "end": 241, "loc": { "start": { - "line": 4, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 4, - "column": 20 + "line": 8, + "column": 19 } }, - "imported": { - "type": "Identifier", - "start": 101, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 20 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1" - }, "local": { "type": "Identifier", - "start": 101, - "end": 113, + "start": 229, + "end": 241, "loc": { "start": { - "line": 4, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 4, - "column": 20 + "line": 8, + "column": 19 }, "identifierName": "delete_case1" }, @@ -316,16 +492,16 @@ ], "source": { "type": "StringLiteral", - "start": 120, - "end": 139, + "start": 247, + "end": 266, "loc": { "start": { - "line": 4, - "column": 27 + "line": 8, + "column": 25 }, "end": { - "line": 4, - "column": 46 + "line": 8, + "column": 44 } }, "extra": { @@ -337,62 +513,45 @@ }, { "type": "ImportDeclaration", - "start": 141, - "end": 188, + "start": 268, + "end": 313, "loc": { "start": { - "line": 5, + "line": 9, "column": 0 }, "end": { - "line": 5, - "column": 47 + "line": 9, + "column": 45 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 149, - "end": 161, + "type": "ImportDefaultSpecifier", + "start": 275, + "end": 287, "loc": { "start": { - "line": 5, - "column": 8 + "line": 9, + "column": 7 }, "end": { - "line": 5, - "column": 20 + "line": 9, + "column": 19 } }, - "imported": { - "type": "Identifier", - "start": 149, - "end": 161, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 20 - }, - "identifierName": "delete_case4" - }, - "name": "delete_case4" - }, "local": { "type": "Identifier", - "start": 149, - "end": 161, + "start": 275, + "end": 287, "loc": { "start": { - "line": 5, - "column": 8 + "line": 9, + "column": 7 }, "end": { - "line": 5, - "column": 20 + "line": 9, + "column": 19 }, "identifierName": "delete_case4" }, @@ -402,16 +561,16 @@ ], "source": { "type": "StringLiteral", - "start": 168, - "end": 187, + "start": 293, + "end": 312, "loc": { "start": { - "line": 5, - "column": 27 + "line": 9, + "column": 25 }, "end": { - "line": 5, - "column": 46 + "line": 9, + "column": 44 } }, "extra": { @@ -423,16 +582,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", - "start": 190, - "end": 456, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 315, + "end": 586, "loc": { "start": { - "line": 7, + "line": 11, "column": 0 }, "end": { - "line": 16, + "line": 20, "column": 3 } } @@ -440,1099 +599,4685 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 457, - "end": 1262, + "type": "Identifier", + "start": 587, + "end": 1548, "loc": { "start": { - "line": 17, + "line": 21, "column": 0 }, "end": { - "line": 44, + "line": 53, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 464, - "end": 1262, - "loc": { - "start": { - "line": 17, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 593, + "end": 1547, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 53, + "column": 1 + } }, - "end": { - "line": 44, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 470, - "end": 1261, + "id": { + "type": "Identifier", + "start": 593, + "end": 605, "loc": { "start": { - "line": 17, - "column": 13 + "line": 21, + "column": 6 }, "end": { - "line": 44, - "column": 1 - } + "line": 21, + "column": 18 + }, + "identifierName": "delete_case3" }, - "id": { - "type": "Identifier", - "start": 470, - "end": 482, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 25 - }, - "identifierName": "delete_case3" + "name": "delete_case3", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 608, + "end": 1547, + "loc": { + "start": { + "line": 21, + "column": 21 }, - "name": "delete_case3", - "leadingComments": null + "end": { + "line": 53, + "column": 1 + } }, - "init": { - "type": "ArrowFunctionExpression", - "start": 485, - "end": 1261, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 44, - "column": 1 - } - }, - "id": { + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 470, - "end": 482, + "start": 609, + "end": 610, "loc": { "start": { - "line": 17, - "column": 13 + "line": 21, + "column": 22 }, "end": { - "line": 17, - "column": 25 + "line": 21, + "column": 23 }, - "identifierName": "delete_case3" + "identifierName": "n" }, - "name": "delete_case3", - "leadingComments": null + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 615, + "end": 1547, + "loc": { + "start": { + "line": 21, + "column": 28 + }, + "end": { + "line": 53, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 486, - "end": 487, + "type": "ExpressionStatement", + "start": 618, + "end": 665, "loc": { "start": { - "line": 17, - "column": 29 + "line": 22, + "column": 1 }, "end": { - "line": 17, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 492, - "end": 1261, - "loc": { - "start": { - "line": 17, - "column": 35 + "line": 22, + "column": 48 + } }, - "end": { - "line": 44, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 495, - "end": 516, + "expression": { + "type": "CallExpression", + "start": 618, + "end": 664, "loc": { "start": { - "line": 18, + "line": 22, "column": 1 }, "end": { - "line": 18, - "column": 22 + "line": 22, + "column": 47 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 618, + "end": 624, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 501, - "end": 515, + "type": "LogicalExpression", + "start": 625, + "end": 663, "loc": { "start": { - "line": 18, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 18, - "column": 21 + "line": 22, + "column": 46 } }, - "id": { - "type": "Identifier", - "start": 501, - "end": 502, + "left": { + "type": "BinaryExpression", + "start": 625, + "end": 642, "loc": { "start": { - "line": 18, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 18, - "column": 8 + "line": 22, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 625, + "end": 626, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "s" + "name": "n" }, - "name": "s" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 638, + "end": 642, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } }, - "init": { - "type": "CallExpression", - "start": 505, - "end": 515, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 646, + "end": 663, "loc": { "start": { - "line": 18, - "column": 11 + "line": 22, + "column": 29 }, "end": { - "line": 18, - "column": 21 + "line": 22, + "column": 46 } }, - "callee": { + "left": { "type": "Identifier", - "start": 505, - "end": 512, + "start": 646, + "end": 647, "loc": { "start": { - "line": 18, - "column": 11 + "line": 22, + "column": 29 }, "end": { - "line": 18, - "column": 18 + "line": 22, + "column": 30 }, - "identifierName": "sibling" + "identifierName": "n" }, - "name": "sibling" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 513, - "end": 514, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 20 - }, - "identifierName": "n" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 659, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 42 }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 519, - "end": 1061, - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 32, - "column": 4 + "end": { + "line": 22, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" } } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 667, + "end": 694, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 28 + } }, - { - "type": "IfStatement", - "start": 1063, - "end": 1259, + "expression": { + "type": "CallExpression", + "start": 667, + "end": 693, "loc": { "start": { - "line": 33, + "line": 23, "column": 1 }, "end": { - "line": 43, - "column": 22 + "line": 23, + "column": 27 } }, - "test": { - "type": "LogicalExpression", - "start": 1070, - "end": 1154, + "callee": { + "type": "Identifier", + "start": 667, + "end": 673, "loc": { "start": { - "line": 34, - "column": 2 + "line": 23, + "column": 1 }, "end": { - "line": 36, - "column": 26 - } + "line": 23, + "column": 7 + }, + "identifierName": "assert" }, - "left": { - "type": "LogicalExpression", - "start": 1070, - "end": 1124, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 674, + "end": 692, "loc": { "start": { - "line": 34, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 35, - "column": 25 + "line": 23, + "column": 26 } }, "left": { - "type": "BinaryExpression", - "start": 1070, - "end": 1095, + "type": "MemberExpression", + "start": 674, + "end": 682, "loc": { "start": { - "line": 34, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 34, - "column": 27 + "line": 23, + "column": 16 } }, - "left": { - "type": "MemberExpression", - "start": 1070, - "end": 1085, + "object": { + "type": "Identifier", + "start": 674, + "end": 675, "loc": { "start": { - "line": 34, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 34, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1070, - "end": 1078, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 34, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1070, - "end": 1071, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 34, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1072, - "end": 1078, - "loc": { - "start": { - "line": 34, - "column": 4 - }, - "end": { - "line": 34, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1079, - "end": 1085, - "loc": { - "start": { - "line": 34, - "column": 11 - }, - "end": { - "line": 34, - "column": 17 - }, - "identifierName": "_color" + "line": 23, + "column": 9 }, - "name": "_color" + "identifierName": "n" }, - "computed": false, - "leadingComments": null + "name": "n" }, - "operator": "===", - "right": { + "property": { "type": "Identifier", - "start": 1090, - "end": 1095, + "start": 676, + "end": 682, "loc": { "start": { - "line": 34, - "column": 22 + "line": 23, + "column": 10 }, "end": { - "line": 34, - "column": 27 + "line": 23, + "column": 16 }, - "identifierName": "BLACK" + "identifierName": "_color" }, - "name": "BLACK" + "name": "_color" }, - "leadingComments": null + "computed": false }, - "operator": "&&", + "operator": "===", "right": { - "type": "BinaryExpression", - "start": 1101, - "end": 1124, + "type": "Identifier", + "start": 687, + "end": 692, "loc": { "start": { - "line": 35, - "column": 2 + "line": 23, + "column": 21 }, "end": { - "line": 35, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 1101, - "end": 1114, - "loc": { - "start": { - "line": 35, - "column": 2 - }, - "end": { - "line": 35, - "column": 15 - } - }, - "object": { - "type": "MemberExpression", - "start": 1101, - "end": 1107, - "loc": { - "start": { - "line": 35, - "column": 2 - }, - "end": { - "line": 35, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1101, - "end": 1102, - "loc": { - "start": { - "line": 35, - "column": 2 - }, - "end": { - "line": 35, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1103, - "end": 1107, - "loc": { - "start": { - "line": 35, - "column": 4 - }, - "end": { - "line": 35, - "column": 8 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1108, - "end": 1114, - "loc": { - "start": { - "line": 35, - "column": 9 - }, - "end": { - "line": 35, - "column": 15 - }, - "identifierName": "_color" - }, - "name": "_color" + "line": 23, + "column": 26 }, - "computed": false + "identifierName": "BLACK" }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1119, - "end": 1124, - "loc": { - "start": { - "line": 35, - "column": 20 - }, - "end": { - "line": 35, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 696, + "end": 722, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 696, + "end": 721, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 696, + "end": 702, + "loc": { + "start": { + "line": 24, + "column": 1 }, - "leadingComments": null + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "&&", - "right": { + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 1130, - "end": 1154, + "start": 703, + "end": 720, "loc": { "start": { - "line": 36, - "column": 2 + "line": 24, + "column": 8 }, "end": { - "line": 36, - "column": 26 + "line": 24, + "column": 25 } }, "left": { "type": "MemberExpression", - "start": 1130, - "end": 1144, + "start": 703, + "end": 711, "loc": { "start": { - "line": 36, - "column": 2 + "line": 24, + "column": 8 }, "end": { - "line": 36, + "line": 24, "column": 16 } }, "object": { - "type": "MemberExpression", - "start": 1130, - "end": 1137, + "type": "Identifier", + "start": 703, + "end": 704, "loc": { "start": { - "line": 36, - "column": 2 + "line": 24, + "column": 8 }, "end": { - "line": 36, + "line": 24, "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1130, - "end": 1131, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1132, - "end": 1137, - "loc": { - "start": { - "line": 36, - "column": 4 - }, - "end": { - "line": 36, - "column": 9 - }, - "identifierName": "right" }, - "name": "right" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1138, - "end": 1144, + "start": 705, + "end": 711, "loc": { "start": { - "line": 36, + "line": 24, "column": 10 }, "end": { - "line": 36, + "line": 24, "column": 16 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false }, - "operator": "===", + "operator": "!==", "right": { - "type": "Identifier", - "start": 1149, - "end": 1154, + "type": "NullLiteral", + "start": 716, + "end": 720, "loc": { "start": { - "line": 36, + "line": 24, "column": 21 }, "end": { - "line": 36, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" + "line": 24, + "column": 25 + } + } } - }, - "leadingComments": null + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 724, + "end": 745, + "loc": { + "start": { + "line": 25, + "column": 1 }, - "consequent": { - "type": "BlockStatement", - "start": 1158, - "end": 1206, + "end": { + "line": 25, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 730, + "end": 744, "loc": { "start": { - "line": 37, - "column": 3 + "line": 25, + "column": 7 }, "end": { - "line": 40, - "column": 2 + "line": 25, + "column": 21 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1162, - "end": 1177, + "id": { + "type": "Identifier", + "start": 730, + "end": 731, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 734, + "end": 744, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 734, + "end": 741, "loc": { "start": { - "line": 38, - "column": 2 + "line": 25, + "column": 11 }, "end": { - "line": 38, - "column": 17 - } + "line": 25, + "column": 18 + }, + "identifierName": "sibling" }, - "expression": { - "type": "AssignmentExpression", - "start": 1162, - "end": 1176, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 742, + "end": 743, "loc": { "start": { - "line": 38, - "column": 2 + "line": 25, + "column": 19 }, "end": { - "line": 38, - "column": 16 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1162, - "end": 1170, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1162, - "end": 1163, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" + "line": 25, + "column": 20 }, - "property": { - "type": "Identifier", - "start": 1164, - "end": 1170, - "loc": { - "start": { - "line": 38, - "column": 4 - }, - "end": { - "line": 38, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "identifierName": "n" }, - "right": { - "type": "Identifier", - "start": 1173, - "end": 1176, - "loc": { - "start": { - "line": 38, - "column": 13 - }, - "end": { - "line": 38, - "column": 16 - }, - "identifierName": "RED" - }, - "name": "RED" - } + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 747, + "end": 773, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 747, + "end": 772, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 747, + "end": 753, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 754, + "end": 771, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 25 } }, - { - "type": "ExpressionStatement", - "start": 1180, - "end": 1203, + "left": { + "type": "Identifier", + "start": 754, + "end": 755, "loc": { "start": { - "line": 39, - "column": 2 + "line": 26, + "column": 8 }, "end": { - "line": 39, - "column": 25 - } - }, - "expression": { - "type": "CallExpression", - "start": 1180, - "end": 1202, - "loc": { - "start": { - "line": 39, - "column": 2 - }, - "end": { - "line": 39, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 1180, - "end": 1192, - "loc": { - "start": { - "line": 39, - "column": 2 - }, - "end": { - "line": 39, - "column": 14 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1" + "line": 26, + "column": 9 }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1193, - "end": 1201, - "loc": { - "start": { - "line": 39, - "column": 15 - }, - "end": { - "line": 39, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1193, - "end": 1194, - "loc": { - "start": { - "line": 39, - "column": 15 - }, - "end": { - "line": 39, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1195, - "end": 1201, - "loc": { - "start": { - "line": 39, - "column": 17 - }, - "end": { - "line": 39, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } - } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1209, - "end": 1236, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 767, + "end": 771, "loc": { "start": { - "line": 42, - "column": 1 + "line": 26, + "column": 21 }, "end": { - "line": 42, - "column": 28 - } - } + "line": 26, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" } - ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 775, + "end": 802, + "loc": { + "start": { + "line": 27, + "column": 1 }, - "alternate": { - "type": "ExpressionStatement", - "start": 1243, - "end": 1259, + "end": { + "line": 27, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 775, + "end": 801, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 775, + "end": 781, "loc": { "start": { - "line": 43, - "column": 6 + "line": 27, + "column": 1 }, "end": { - "line": 43, - "column": 22 - } + "line": 27, + "column": 7 + }, + "identifierName": "assert" }, - "expression": { - "type": "CallExpression", - "start": 1243, - "end": 1258, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 782, + "end": 800, "loc": { "start": { - "line": 43, - "column": 6 + "line": 27, + "column": 8 }, "end": { - "line": 43, - "column": 21 + "line": 27, + "column": 26 } }, - "callee": { - "type": "Identifier", - "start": 1243, - "end": 1255, + "left": { + "type": "MemberExpression", + "start": 782, + "end": 790, "loc": { "start": { - "line": 43, - "column": 6 + "line": 27, + "column": 8 }, "end": { - "line": 43, - "column": 18 + "line": 27, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 782, + "end": 783, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "s" }, - "identifierName": "delete_case4" + "name": "s" }, - "name": "delete_case4", - "leadingComments": null - }, - "arguments": [ - { + "property": { "type": "Identifier", - "start": 1256, - "end": 1257, + "start": 784, + "end": 790, "loc": { "start": { - "line": 43, - "column": 19 + "line": 27, + "column": 10 }, "end": { - "line": 43, - "column": 20 + "line": 27, + "column": 16 }, - "identifierName": "n" + "identifierName": "_color" }, - "name": "n" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1209, - "end": 1236, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 795, + "end": 800, "loc": { "start": { - "line": 42, - "column": 1 + "line": 27, + "column": 21 }, "end": { - "line": 42, - "column": 28 - } - } - } - ] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 519, - "end": 1061, - "loc": { - "start": { - "line": 20, - "column": 1 + "line": 27, + "column": 26 + }, + "identifierName": "BLACK" }, - "end": { - "line": 32, - "column": 4 - } + "name": "BLACK" } } ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 805, + "end": 1347, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 41, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1349, + "end": 1545, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 52, + "column": 22 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1356, + "end": 1440, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 45, + "column": 26 + } + }, + "left": { + "type": "LogicalExpression", + "start": 1356, + "end": 1410, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 44, + "column": 25 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1356, + "end": 1381, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 27 + } + }, + "left": { + "type": "MemberExpression", + "start": 1356, + "end": 1371, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1356, + "end": 1364, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1356, + "end": 1357, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1358, + "end": 1364, + "loc": { + "start": { + "line": 43, + "column": 4 + }, + "end": { + "line": 43, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1365, + "end": 1371, + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 43, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1376, + "end": 1381, + "loc": { + "start": { + "line": 43, + "column": 22 + }, + "end": { + "line": 43, + "column": 27 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1387, + "end": 1410, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1387, + "end": 1400, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 15 + } + }, + "object": { + "type": "MemberExpression", + "start": 1387, + "end": 1393, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1387, + "end": 1388, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1389, + "end": 1393, + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 8 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1394, + "end": 1400, + "loc": { + "start": { + "line": 44, + "column": 9 + }, + "end": { + "line": 44, + "column": 15 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1405, + "end": 1410, + "loc": { + "start": { + "line": 44, + "column": 20 + }, + "end": { + "line": 44, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1416, + "end": 1440, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 1416, + "end": 1430, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 1416, + "end": 1423, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1416, + "end": 1417, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1418, + "end": 1423, + "loc": { + "start": { + "line": 45, + "column": 4 + }, + "end": { + "line": 45, + "column": 9 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1424, + "end": 1430, + "loc": { + "start": { + "line": 45, + "column": 10 + }, + "end": { + "line": 45, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1435, + "end": 1440, + "loc": { + "start": { + "line": 45, + "column": 21 + }, + "end": { + "line": 45, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1444, + "end": 1492, + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 49, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1448, + "end": 1463, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1448, + "end": 1462, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1448, + "end": 1456, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1448, + "end": 1449, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1450, + "end": 1456, + "loc": { + "start": { + "line": 47, + "column": 4 + }, + "end": { + "line": 47, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1459, + "end": 1462, + "loc": { + "start": { + "line": 47, + "column": 13 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1466, + "end": 1489, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 1466, + "end": 1488, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 1466, + "end": 1478, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 14 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1479, + "end": 1487, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 1479, + "end": 1480, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1481, + "end": 1487, + "loc": { + "start": { + "line": 48, + "column": 17 + }, + "end": { + "line": 48, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } + } + ], + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 4.", + "start": 1495, + "end": 1522, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 28 + } + } + } + ] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1529, + "end": 1545, + "loc": { + "start": { + "line": 52, + "column": 6 + }, + "end": { + "line": 52, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 1529, + "end": 1544, + "loc": { + "start": { + "line": 52, + "column": 6 + }, + "end": { + "line": 52, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 1529, + "end": 1541, + "loc": { + "start": { + "line": 52, + "column": 6 + }, + "end": { + "line": 52, + "column": 18 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1542, + "end": 1543, + "loc": { + "start": { + "line": 52, + "column": 19 + }, + "end": { + "line": 52, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 4.", + "start": 1495, + "end": 1522, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 28 + } + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 805, + "end": 1347, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 41, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1550, + "end": 1578, + "loc": { + "start": { + "line": 55, + "column": 0 + }, + "end": { + "line": 55, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 1565, + "end": 1577, + "loc": { + "start": { + "line": 55, + "column": 15 + }, + "end": { + "line": 55, + "column": 27 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1550, + "end": 1578, + "loc": { + "start": { + "line": 55, + "column": 0 + }, + "end": { + "line": 55, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 587, + "end": 1548, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 53, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 593, + "end": 1547, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 53, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 593, + "end": 605, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 608, + "end": 1547, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 53, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 593, + "end": 605, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 615, + "end": 1547, + "loc": { + "start": { + "line": 21, + "column": 28 + }, + "end": { + "line": 53, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 618, + "end": 665, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 618, + "end": 664, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 618, + "end": 624, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 625, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 625, + "end": 642, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 625, + "end": 626, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 638, + "end": 642, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 646, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 646, + "end": 647, + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 659, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 42 + }, + "end": { + "line": 22, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 667, + "end": 694, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 667, + "end": 693, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 667, + "end": 673, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 674, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 674, + "end": 682, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 674, + "end": 675, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 676, + "end": 682, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 687, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 696, + "end": 722, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 696, + "end": 721, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 696, + "end": 702, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 703, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 703, + "end": 711, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 703, + "end": 704, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 705, + "end": 711, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 716, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 724, + "end": 745, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 730, + "end": 744, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 730, + "end": 731, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 734, + "end": 744, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 734, + "end": 741, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 742, + "end": 743, + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 747, + "end": 773, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 747, + "end": 772, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 747, + "end": 753, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 754, + "end": 771, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 754, + "end": 755, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 767, + "end": 771, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 775, + "end": 802, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 775, + "end": 801, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 775, + "end": 781, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 782, + "end": 800, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 782, + "end": 790, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 782, + "end": 783, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 784, + "end": 790, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 795, + "end": 800, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 805, + "end": 1347, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 41, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1349, + "end": 1545, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 52, + "column": 22 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1356, + "end": 1440, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 45, + "column": 26 + } + }, + "left": { + "type": "LogicalExpression", + "start": 1356, + "end": 1410, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 44, + "column": 25 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1356, + "end": 1381, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 27 + } + }, + "left": { + "type": "MemberExpression", + "start": 1356, + "end": 1371, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1356, + "end": 1364, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1356, + "end": 1357, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1358, + "end": 1364, + "loc": { + "start": { + "line": 43, + "column": 4 + }, + "end": { + "line": 43, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1365, + "end": 1371, + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 43, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1376, + "end": 1381, + "loc": { + "start": { + "line": 43, + "column": 22 + }, + "end": { + "line": 43, + "column": 27 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1387, + "end": 1410, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1387, + "end": 1400, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 15 + } + }, + "object": { + "type": "MemberExpression", + "start": 1387, + "end": 1393, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1387, + "end": 1388, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1389, + "end": 1393, + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 8 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1394, + "end": 1400, + "loc": { + "start": { + "line": 44, + "column": 9 + }, + "end": { + "line": 44, + "column": 15 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1405, + "end": 1410, + "loc": { + "start": { + "line": 44, + "column": 20 + }, + "end": { + "line": 44, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1416, + "end": 1440, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 1416, + "end": 1430, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 1416, + "end": 1423, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1416, + "end": 1417, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1418, + "end": 1423, + "loc": { + "start": { + "line": 45, + "column": 4 + }, + "end": { + "line": 45, + "column": 9 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1424, + "end": 1430, + "loc": { + "start": { + "line": 45, + "column": 10 + }, + "end": { + "line": 45, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1435, + "end": 1440, + "loc": { + "start": { + "line": 45, + "column": 21 + }, + "end": { + "line": 45, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1444, + "end": 1492, + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 49, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1448, + "end": 1463, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1448, + "end": 1462, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1448, + "end": 1456, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1448, + "end": 1449, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1450, + "end": 1456, + "loc": { + "start": { + "line": 47, + "column": 4 + }, + "end": { + "line": 47, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1459, + "end": 1462, + "loc": { + "start": { + "line": 47, + "column": 13 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1466, + "end": 1489, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 1466, + "end": 1488, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 1466, + "end": 1478, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 14 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1479, + "end": 1487, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 1479, + "end": 1480, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1481, + "end": 1487, + "loc": { + "start": { + "line": 48, + "column": 17 + }, + "end": { + "line": 48, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } + } + ], + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 4.", + "start": 1495, + "end": 1522, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 28 + } + } + } + ] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1529, + "end": 1545, + "loc": { + "start": { + "line": 52, + "column": 6 + }, + "end": { + "line": 52, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 1529, + "end": 1544, + "loc": { + "start": { + "line": 52, + "column": 6 + }, + "end": { + "line": 52, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 1529, + "end": 1541, + "loc": { + "start": { + "line": 52, + "column": 6 + }, + "end": { + "line": 52, + "column": 18 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1542, + "end": 1543, + "loc": { + "start": { + "line": 52, + "column": 19 + }, + "end": { + "line": 52, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 4.", + "start": 1495, + "end": 1522, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 28 + } + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 805, + "end": 1347, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 41, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], "kind": "const", "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", - "start": 190, - "end": 456, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 315, + "end": 586, "loc": { "start": { - "line": 7, + "line": 11, "column": 0 }, "end": { - "line": 16, + "line": 20, "column": 3 } } } ], "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 315, + "end": 586, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 805, + "end": 1347, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 41, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise, go to case 4.", + "start": 1495, + "end": 1522, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 28 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 75, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 103, + "end": 109, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 115, + "end": 119, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 120, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 147, + "end": 151, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 152, + "end": 156, + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 175, + "end": 176, + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 177, + "end": 183, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 184, + "end": 191, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 192, + "end": 196, + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/sibling.js", + "start": 197, + "end": 219, + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 42 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 219, + "end": 220, + "loc": { + "start": { + "line": 6, + "column": 42 + }, + "end": { + "line": 6, + "column": 43 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 222, + "end": 228, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case1", + "start": 229, + "end": 241, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 242, + "end": 246, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case1.js", + "start": 247, + "end": 266, + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 266, + "end": 267, + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 45 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 268, + "end": 274, + "loc": { + "start": { + "line": 9, + "column": 0 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", - "start": 190, - "end": 456, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 16, - "column": 3 - } - } - } - ] + "end": { + "line": 9, + "column": 6 + } } - ], - "directives": [] - }, - "comments": [ + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case4", + "start": 275, + "end": 287, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 288, + "end": 292, + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case4.js", + "start": 293, + "end": 312, + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 312, + "end": 313, + "loc": { + "start": { + "line": 9, + "column": 44 + }, + "end": { + "line": 9, + "column": 45 + } + } + }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", - "start": 190, - "end": 456, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 315, + "end": 586, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 587, + "end": 592, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case3", + "start": 593, + "end": 605, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 606, + "end": 607, + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 608, + "end": 609, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 610, + "end": 611, "loc": { "start": { - "line": 7, - "column": 0 + "line": 21, + "column": 23 }, "end": { - "line": 16, - "column": 3 + "line": 21, + "column": 24 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 519, - "end": 1061, + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 612, + "end": 614, "loc": { "start": { - "line": 20, - "column": 1 + "line": 21, + "column": 25 }, "end": { - "line": 32, - "column": 4 + "line": 21, + "column": 27 } } }, { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1209, - "end": 1236, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 615, + "end": 616, "loc": { "start": { - "line": 42, - "column": 1 + "line": 21, + "column": 28 }, "end": { - "line": 42, - "column": 28 + "line": 21, + "column": 29 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1540,26 +5285,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "assert", + "start": 618, + "end": 624, "loc": { "start": { - "line": 1, - "column": 0 + "line": 22, + "column": 1 }, "end": { - "line": 1, - "column": 6 + "line": 22, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1569,15 +5313,15 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "start": 624, + "end": 625, "loc": { "start": { - "line": 1, + "line": 22, "column": 7 }, "end": { - "line": 1, + "line": 22, "column": 8 } } @@ -1594,23 +5338,24 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "n", + "start": 625, + "end": 626, "loc": { "start": { - "line": 1, + "line": 22, "column": 8 }, "end": { - "line": 1, - "column": 13 + "line": 22, + "column": 9 } } }, { "type": { - "label": ",", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1618,19 +5363,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 13, - "end": 14, + "value": "instanceof", + "start": 627, + "end": 637, "loc": { "start": { - "line": 1, - "column": 13 + "line": 22, + "column": 10 }, "end": { - "line": 1, - "column": 14 + "line": 22, + "column": 20 } } }, @@ -1646,42 +5392,44 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 15, - "end": 18, + "value": "Node", + "start": 638, + "end": 642, "loc": { "start": { - "line": 1, - "column": 15 + "line": 22, + "column": 21 }, "end": { - "line": 1, - "column": 18 + "line": 22, + "column": 25 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "||", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 1, + "updateContext": null }, - "start": 18, - "end": 19, + "value": "||", + "start": 643, + "end": 645, "loc": { "start": { - "line": 1, - "column": 18 + "line": 22, + "column": 26 }, "end": { - "line": 1, - "column": 19 + "line": 22, + "column": 28 } } }, @@ -1697,23 +5445,51 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 20, - "end": 24, + "value": "n", + "start": 646, + "end": 647, "loc": { "start": { - "line": 1, - "column": 20 + "line": 22, + "column": 29 }, "end": { - "line": 1, - "column": 24 + "line": 22, + "column": 30 } } }, { "type": { - "label": "string", + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 648, + "end": 658, + "loc": { + "start": { + "line": 22, + "column": 31 + }, + "end": { + "line": 22, + "column": 41 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1721,20 +5497,44 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/index.js", - "start": 25, - "end": 44, + "value": "Leaf", + "start": 659, + "end": 663, "loc": { "start": { - "line": 1, - "column": 25 + "line": 22, + "column": 42 }, "end": { - "line": 1, - "column": 44 + "line": 22, + "column": 46 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 663, + "end": 664, + "loc": { + "start": { + "line": 22, + "column": 46 + }, + "end": { + "line": 22, + "column": 47 } } }, @@ -1751,23 +5551,22 @@ "binop": null, "updateContext": null }, - "start": 44, - "end": 45, + "start": 664, + "end": 665, "loc": { "start": { - "line": 1, - "column": 44 + "line": 22, + "column": 47 }, "end": { - "line": 1, - "column": 45 + "line": 22, + "column": 48 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1775,26 +5574,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 46, - "end": 52, + "value": "assert", + "start": 667, + "end": 673, "loc": { "start": { - "line": 2, - "column": 0 + "line": 23, + "column": 1 }, "end": { - "line": 2, - "column": 6 + "line": 23, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1804,15 +5602,15 @@ "postfix": false, "binop": null }, - "start": 53, - "end": 54, + "start": 673, + "end": 674, "loc": { "start": { - "line": 2, + "line": 23, "column": 7 }, "end": { - "line": 2, + "line": 23, "column": 8 } } @@ -1829,23 +5627,23 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 54, - "end": 61, + "value": "n", + "start": 674, + "end": 675, "loc": { "start": { - "line": 2, + "line": 23, "column": 8 }, "end": { - "line": 2, - "column": 15 + "line": 23, + "column": 9 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1853,18 +5651,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 61, - "end": 62, + "start": 675, + "end": 676, "loc": { "start": { - "line": 2, - "column": 15 + "line": 23, + "column": 9 }, "end": { - "line": 2, - "column": 16 + "line": 23, + "column": 10 } } }, @@ -1880,23 +5679,50 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 63, - "end": 67, + "value": "_color", + "start": 676, + "end": 682, "loc": { "start": { - "line": 2, + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 683, + "end": 686, + "loc": { + "start": { + "line": 23, "column": 17 }, "end": { - "line": 2, - "column": 21 + "line": 23, + "column": 20 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1904,20 +5730,44 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/sibling.js", - "start": 68, - "end": 90, + "value": "BLACK", + "start": 687, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 26 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 692, + "end": 693, "loc": { "start": { - "line": 2, - "column": 22 + "line": 23, + "column": 26 }, "end": { - "line": 2, - "column": 44 + "line": 23, + "column": 27 } } }, @@ -1934,23 +5784,22 @@ "binop": null, "updateContext": null }, - "start": 90, - "end": 91, + "start": 693, + "end": 694, "loc": { "start": { - "line": 2, - "column": 44 + "line": 23, + "column": 27 }, "end": { - "line": 2, - "column": 45 + "line": 23, + "column": 28 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1958,26 +5807,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 93, - "end": 99, + "value": "assert", + "start": 696, + "end": 702, "loc": { "start": { - "line": 4, - "column": 0 + "line": 24, + "column": 1 }, "end": { - "line": 4, - "column": 6 + "line": 24, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1987,15 +5835,15 @@ "postfix": false, "binop": null }, - "start": 100, - "end": 101, + "start": 702, + "end": 703, "loc": { "start": { - "line": 4, + "line": 24, "column": 7 }, "end": { - "line": 4, + "line": 24, "column": 8 } } @@ -2012,23 +5860,23 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 101, - "end": 113, + "value": "n", + "start": 703, + "end": 704, "loc": { "start": { - "line": 4, + "line": 24, "column": 8 }, "end": { - "line": 4, - "column": 20 + "line": 24, + "column": 9 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2036,18 +5884,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 113, - "end": 114, + "start": 704, + "end": 705, "loc": { "start": { - "line": 4, - "column": 20 + "line": 24, + "column": 9 }, "end": { - "line": 4, - "column": 21 + "line": 24, + "column": 10 } } }, @@ -2063,23 +5912,51 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 115, - "end": 119, + "value": "parent", + "start": 705, + "end": 711, "loc": { "start": { - "line": 4, - "column": 22 + "line": 24, + "column": 10 }, "end": { - "line": 4, - "column": 26 + "line": 24, + "column": 16 } } }, { "type": { - "label": "string", + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 712, + "end": 715, + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2090,52 +5967,50 @@ "binop": null, "updateContext": null }, - "value": "./delete_case1.js", - "start": 120, - "end": 139, + "value": "null", + "start": 716, + "end": 720, "loc": { "start": { - "line": 4, - "column": 27 + "line": 24, + "column": 21 }, "end": { - "line": 4, - "column": 46 + "line": 24, + "column": 25 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 139, - "end": 140, + "start": 720, + "end": 721, "loc": { "start": { - "line": 4, - "column": 46 + "line": 24, + "column": 25 }, "end": { - "line": 4, - "column": 47 + "line": 24, + "column": 26 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2144,42 +6019,44 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 141, - "end": 147, + "start": 721, + "end": 722, "loc": { "start": { - "line": 5, - "column": 0 + "line": 24, + "column": 26 }, "end": { - "line": 5, - "column": 6 + "line": 24, + "column": 27 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 148, - "end": 149, + "value": "const", + "start": 724, + "end": 729, "loc": { "start": { - "line": 5, - "column": 7 + "line": 25, + "column": 1 }, "end": { - "line": 5, - "column": 8 + "line": 25, + "column": 6 } } }, @@ -2195,42 +6072,44 @@ "postfix": false, "binop": null }, - "value": "delete_case4", - "start": 149, - "end": 161, + "value": "s", + "start": 730, + "end": 731, "loc": { "start": { - "line": 5, - "column": 8 + "line": 25, + "column": 7 }, "end": { - "line": 5, - "column": 20 + "line": 25, + "column": 8 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 161, - "end": 162, + "value": "=", + "start": 732, + "end": 733, "loc": { "start": { - "line": 5, - "column": 20 + "line": 25, + "column": 9 }, "end": { - "line": 5, - "column": 21 + "line": 25, + "column": 10 } } }, @@ -2246,94 +6125,100 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 163, - "end": 167, + "value": "sibling", + "start": 734, + "end": 741, "loc": { "start": { - "line": 5, - "column": 22 + "line": 25, + "column": 11 }, "end": { - "line": 5, - "column": 26 + "line": 25, + "column": 18 } } }, { "type": { - "label": "string", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./delete_case4.js", - "start": 168, - "end": 187, + "start": 741, + "end": 742, "loc": { "start": { - "line": 5, - "column": 27 + "line": 25, + "column": 18 }, "end": { - "line": 5, - "column": 46 + "line": 25, + "column": 19 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 187, - "end": 188, + "value": "n", + "start": 742, + "end": 743, "loc": { "start": { - "line": 5, - "column": 46 + "line": 25, + "column": 19 }, "end": { - "line": 5, - "column": 47 + "line": 25, + "column": 20 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", - "start": 190, - "end": 456, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 743, + "end": 744, "loc": { "start": { - "line": 7, - "column": 0 + "line": 25, + "column": 20 }, "end": { - "line": 16, - "column": 3 + "line": 25, + "column": 21 } } }, { "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2343,52 +6228,49 @@ "binop": null, "updateContext": null }, - "value": "export", - "start": 457, - "end": 463, + "start": 744, + "end": 745, "loc": { "start": { - "line": 17, - "column": 0 + "line": 25, + "column": 21 }, "end": { - "line": 17, - "column": 6 + "line": 25, + "column": 22 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 464, - "end": 469, + "value": "assert", + "start": 747, + "end": 753, "loc": { "start": { - "line": 17, - "column": 7 + "line": 26, + "column": 1 }, "end": { - "line": 17, - "column": 12 + "line": 26, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2397,69 +6279,70 @@ "postfix": false, "binop": null }, - "value": "delete_case3", - "start": 470, - "end": 482, + "start": 753, + "end": 754, "loc": { "start": { - "line": 17, - "column": 13 + "line": 26, + "column": 7 }, "end": { - "line": 17, - "column": 25 + "line": 26, + "column": 8 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 483, - "end": 484, + "value": "s", + "start": 754, + "end": 755, "loc": { "start": { - "line": 17, - "column": 26 + "line": 26, + "column": 8 }, "end": { - "line": 17, - "column": 27 + "line": 26, + "column": 9 } } }, { "type": { - "label": "(", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 485, - "end": 486, + "value": "instanceof", + "start": 756, + "end": 766, "loc": { "start": { - "line": 17, - "column": 28 + "line": 26, + "column": 10 }, "end": { - "line": 17, - "column": 29 + "line": 26, + "column": 20 } } }, @@ -2475,17 +6358,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 486, - "end": 487, + "value": "Node", + "start": 767, + "end": 771, "loc": { "start": { - "line": 17, - "column": 29 + "line": 26, + "column": 21 }, "end": { - "line": 17, - "column": 30 + "line": 26, + "column": 25 } } }, @@ -2501,22 +6384,22 @@ "postfix": false, "binop": null }, - "start": 487, - "end": 488, + "start": 771, + "end": 772, "loc": { "start": { - "line": 17, - "column": 30 + "line": 26, + "column": 25 }, "end": { - "line": 17, - "column": 31 + "line": 26, + "column": 26 } } }, { "type": { - "label": "=>", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2527,23 +6410,23 @@ "binop": null, "updateContext": null }, - "start": 489, - "end": 491, + "start": 772, + "end": 773, "loc": { "start": { - "line": 17, - "column": 32 + "line": 26, + "column": 26 }, "end": { - "line": 17, - "column": 34 + "line": 26, + "column": 27 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2552,44 +6435,42 @@ "postfix": false, "binop": null }, - "start": 492, - "end": 493, + "value": "assert", + "start": 775, + "end": 781, "loc": { "start": { - "line": 17, - "column": 35 + "line": 27, + "column": 1 }, "end": { - "line": 17, - "column": 36 + "line": 27, + "column": 7 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 495, - "end": 500, + "start": 781, + "end": 782, "loc": { "start": { - "line": 18, - "column": 1 + "line": 27, + "column": 7 }, "end": { - "line": 18, - "column": 6 + "line": 27, + "column": 8 } } }, @@ -2606,42 +6487,41 @@ "binop": null }, "value": "s", - "start": 501, - "end": 502, + "start": 782, + "end": 783, "loc": { "start": { - "line": 18, - "column": 7 + "line": 27, + "column": 8 }, "end": { - "line": 18, - "column": 8 + "line": 27, + "column": 9 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 503, - "end": 504, + "start": 783, + "end": 784, "loc": { "start": { - "line": 18, + "line": 27, "column": 9 }, "end": { - "line": 18, + "line": 27, "column": 10 } } @@ -2658,42 +6538,44 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 505, - "end": 512, + "value": "_color", + "start": 784, + "end": 790, "loc": { "start": { - "line": 18, - "column": 11 + "line": 27, + "column": 10 }, "end": { - "line": 18, - "column": 18 + "line": 27, + "column": 16 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 512, - "end": 513, + "value": "===", + "start": 791, + "end": 794, "loc": { "start": { - "line": 18, - "column": 18 + "line": 27, + "column": 17 }, "end": { - "line": 18, - "column": 19 + "line": 27, + "column": 20 } } }, @@ -2709,17 +6591,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 513, - "end": 514, + "value": "BLACK", + "start": 795, + "end": 800, "loc": { "start": { - "line": 18, - "column": 19 + "line": 27, + "column": 21 }, "end": { - "line": 18, - "column": 20 + "line": 27, + "column": 26 } } }, @@ -2735,16 +6617,16 @@ "postfix": false, "binop": null }, - "start": 514, - "end": 515, + "start": 800, + "end": 801, "loc": { "start": { - "line": 18, - "column": 20 + "line": 27, + "column": 26 }, "end": { - "line": 18, - "column": 21 + "line": 27, + "column": 27 } } }, @@ -2761,31 +6643,31 @@ "binop": null, "updateContext": null }, - "start": 515, - "end": 516, + "start": 801, + "end": 802, "loc": { "start": { - "line": 18, - "column": 21 + "line": 27, + "column": 27 }, "end": { - "line": 18, - "column": 22 + "line": 27, + "column": 28 } } }, { "type": "CommentBlock", "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 519, - "end": 1061, + "start": 805, + "end": 1347, "loc": { "start": { - "line": 20, + "line": 29, "column": 1 }, "end": { - "line": 32, + "line": 41, "column": 4 } } @@ -2805,15 +6687,15 @@ "updateContext": null }, "value": "if", - "start": 1063, - "end": 1065, + "start": 1349, + "end": 1351, "loc": { "start": { - "line": 33, + "line": 42, "column": 1 }, "end": { - "line": 33, + "line": 42, "column": 3 } } @@ -2830,15 +6712,15 @@ "postfix": false, "binop": null }, - "start": 1066, - "end": 1067, + "start": 1352, + "end": 1353, "loc": { "start": { - "line": 33, + "line": 42, "column": 4 }, "end": { - "line": 33, + "line": 42, "column": 5 } } @@ -2856,15 +6738,15 @@ "binop": null }, "value": "n", - "start": 1070, - "end": 1071, + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 34, + "line": 43, "column": 2 }, "end": { - "line": 34, + "line": 43, "column": 3 } } @@ -2882,15 +6764,15 @@ "binop": null, "updateContext": null }, - "start": 1071, - "end": 1072, + "start": 1357, + "end": 1358, "loc": { "start": { - "line": 34, + "line": 43, "column": 3 }, "end": { - "line": 34, + "line": 43, "column": 4 } } @@ -2908,15 +6790,15 @@ "binop": null }, "value": "parent", - "start": 1072, - "end": 1078, + "start": 1358, + "end": 1364, "loc": { "start": { - "line": 34, + "line": 43, "column": 4 }, "end": { - "line": 34, + "line": 43, "column": 10 } } @@ -2934,15 +6816,15 @@ "binop": null, "updateContext": null }, - "start": 1078, - "end": 1079, + "start": 1364, + "end": 1365, "loc": { "start": { - "line": 34, + "line": 43, "column": 10 }, "end": { - "line": 34, + "line": 43, "column": 11 } } @@ -2960,15 +6842,15 @@ "binop": null }, "value": "_color", - "start": 1079, - "end": 1085, + "start": 1365, + "end": 1371, "loc": { "start": { - "line": 34, + "line": 43, "column": 11 }, "end": { - "line": 34, + "line": 43, "column": 17 } } @@ -2987,15 +6869,15 @@ "updateContext": null }, "value": "===", - "start": 1086, - "end": 1089, + "start": 1372, + "end": 1375, "loc": { "start": { - "line": 34, + "line": 43, "column": 18 }, "end": { - "line": 34, + "line": 43, "column": 21 } } @@ -3013,15 +6895,15 @@ "binop": null }, "value": "BLACK", - "start": 1090, - "end": 1095, + "start": 1376, + "end": 1381, "loc": { "start": { - "line": 34, + "line": 43, "column": 22 }, "end": { - "line": 34, + "line": 43, "column": 27 } } @@ -3040,15 +6922,15 @@ "updateContext": null }, "value": "&&", - "start": 1096, - "end": 1098, + "start": 1382, + "end": 1384, "loc": { "start": { - "line": 34, + "line": 43, "column": 28 }, "end": { - "line": 34, + "line": 43, "column": 30 } } @@ -3066,15 +6948,15 @@ "binop": null }, "value": "s", - "start": 1101, - "end": 1102, + "start": 1387, + "end": 1388, "loc": { "start": { - "line": 35, + "line": 44, "column": 2 }, "end": { - "line": 35, + "line": 44, "column": 3 } } @@ -3092,15 +6974,15 @@ "binop": null, "updateContext": null }, - "start": 1102, - "end": 1103, + "start": 1388, + "end": 1389, "loc": { "start": { - "line": 35, + "line": 44, "column": 3 }, "end": { - "line": 35, + "line": 44, "column": 4 } } @@ -3118,15 +7000,15 @@ "binop": null }, "value": "left", - "start": 1103, - "end": 1107, + "start": 1389, + "end": 1393, "loc": { "start": { - "line": 35, + "line": 44, "column": 4 }, "end": { - "line": 35, + "line": 44, "column": 8 } } @@ -3144,15 +7026,15 @@ "binop": null, "updateContext": null }, - "start": 1107, - "end": 1108, + "start": 1393, + "end": 1394, "loc": { "start": { - "line": 35, + "line": 44, "column": 8 }, "end": { - "line": 35, + "line": 44, "column": 9 } } @@ -3170,15 +7052,15 @@ "binop": null }, "value": "_color", - "start": 1108, - "end": 1114, + "start": 1394, + "end": 1400, "loc": { "start": { - "line": 35, + "line": 44, "column": 9 }, "end": { - "line": 35, + "line": 44, "column": 15 } } @@ -3197,15 +7079,15 @@ "updateContext": null }, "value": "===", - "start": 1115, - "end": 1118, + "start": 1401, + "end": 1404, "loc": { "start": { - "line": 35, + "line": 44, "column": 16 }, "end": { - "line": 35, + "line": 44, "column": 19 } } @@ -3223,15 +7105,15 @@ "binop": null }, "value": "BLACK", - "start": 1119, - "end": 1124, + "start": 1405, + "end": 1410, "loc": { "start": { - "line": 35, + "line": 44, "column": 20 }, "end": { - "line": 35, + "line": 44, "column": 25 } } @@ -3250,15 +7132,15 @@ "updateContext": null }, "value": "&&", - "start": 1125, - "end": 1127, + "start": 1411, + "end": 1413, "loc": { "start": { - "line": 35, + "line": 44, "column": 26 }, "end": { - "line": 35, + "line": 44, "column": 28 } } @@ -3276,15 +7158,15 @@ "binop": null }, "value": "s", - "start": 1130, - "end": 1131, + "start": 1416, + "end": 1417, "loc": { "start": { - "line": 36, + "line": 45, "column": 2 }, "end": { - "line": 36, + "line": 45, "column": 3 } } @@ -3302,15 +7184,15 @@ "binop": null, "updateContext": null }, - "start": 1131, - "end": 1132, + "start": 1417, + "end": 1418, "loc": { "start": { - "line": 36, + "line": 45, "column": 3 }, "end": { - "line": 36, + "line": 45, "column": 4 } } @@ -3328,15 +7210,15 @@ "binop": null }, "value": "right", - "start": 1132, - "end": 1137, + "start": 1418, + "end": 1423, "loc": { "start": { - "line": 36, + "line": 45, "column": 4 }, "end": { - "line": 36, + "line": 45, "column": 9 } } @@ -3354,15 +7236,15 @@ "binop": null, "updateContext": null }, - "start": 1137, - "end": 1138, + "start": 1423, + "end": 1424, "loc": { "start": { - "line": 36, + "line": 45, "column": 9 }, "end": { - "line": 36, + "line": 45, "column": 10 } } @@ -3380,15 +7262,15 @@ "binop": null }, "value": "_color", - "start": 1138, - "end": 1144, + "start": 1424, + "end": 1430, "loc": { "start": { - "line": 36, + "line": 45, "column": 10 }, "end": { - "line": 36, + "line": 45, "column": 16 } } @@ -3407,15 +7289,15 @@ "updateContext": null }, "value": "===", - "start": 1145, - "end": 1148, + "start": 1431, + "end": 1434, "loc": { "start": { - "line": 36, + "line": 45, "column": 17 }, "end": { - "line": 36, + "line": 45, "column": 20 } } @@ -3433,15 +7315,15 @@ "binop": null }, "value": "BLACK", - "start": 1149, - "end": 1154, + "start": 1435, + "end": 1440, "loc": { "start": { - "line": 36, + "line": 45, "column": 21 }, "end": { - "line": 36, + "line": 45, "column": 26 } } @@ -3458,15 +7340,15 @@ "postfix": false, "binop": null }, - "start": 1156, - "end": 1157, + "start": 1442, + "end": 1443, "loc": { "start": { - "line": 37, + "line": 46, "column": 1 }, "end": { - "line": 37, + "line": 46, "column": 2 } } @@ -3483,15 +7365,15 @@ "postfix": false, "binop": null }, - "start": 1158, - "end": 1159, + "start": 1444, + "end": 1445, "loc": { "start": { - "line": 37, + "line": 46, "column": 3 }, "end": { - "line": 37, + "line": 46, "column": 4 } } @@ -3509,15 +7391,15 @@ "binop": null }, "value": "s", - "start": 1162, - "end": 1163, + "start": 1448, + "end": 1449, "loc": { "start": { - "line": 38, + "line": 47, "column": 2 }, "end": { - "line": 38, + "line": 47, "column": 3 } } @@ -3535,15 +7417,15 @@ "binop": null, "updateContext": null }, - "start": 1163, - "end": 1164, + "start": 1449, + "end": 1450, "loc": { "start": { - "line": 38, + "line": 47, "column": 3 }, "end": { - "line": 38, + "line": 47, "column": 4 } } @@ -3561,15 +7443,15 @@ "binop": null }, "value": "_color", - "start": 1164, - "end": 1170, + "start": 1450, + "end": 1456, "loc": { "start": { - "line": 38, + "line": 47, "column": 4 }, "end": { - "line": 38, + "line": 47, "column": 10 } } @@ -3588,15 +7470,15 @@ "updateContext": null }, "value": "=", - "start": 1171, - "end": 1172, + "start": 1457, + "end": 1458, "loc": { "start": { - "line": 38, + "line": 47, "column": 11 }, "end": { - "line": 38, + "line": 47, "column": 12 } } @@ -3614,15 +7496,15 @@ "binop": null }, "value": "RED", - "start": 1173, - "end": 1176, + "start": 1459, + "end": 1462, "loc": { "start": { - "line": 38, + "line": 47, "column": 13 }, "end": { - "line": 38, + "line": 47, "column": 16 } } @@ -3640,15 +7522,15 @@ "binop": null, "updateContext": null }, - "start": 1176, - "end": 1177, + "start": 1462, + "end": 1463, "loc": { "start": { - "line": 38, + "line": 47, "column": 16 }, "end": { - "line": 38, + "line": 47, "column": 17 } } @@ -3666,15 +7548,15 @@ "binop": null }, "value": "delete_case1", - "start": 1180, - "end": 1192, + "start": 1466, + "end": 1478, "loc": { "start": { - "line": 39, + "line": 48, "column": 2 }, "end": { - "line": 39, + "line": 48, "column": 14 } } @@ -3691,15 +7573,15 @@ "postfix": false, "binop": null }, - "start": 1192, - "end": 1193, + "start": 1478, + "end": 1479, "loc": { "start": { - "line": 39, + "line": 48, "column": 14 }, "end": { - "line": 39, + "line": 48, "column": 15 } } @@ -3717,15 +7599,15 @@ "binop": null }, "value": "n", - "start": 1193, - "end": 1194, + "start": 1479, + "end": 1480, "loc": { "start": { - "line": 39, + "line": 48, "column": 15 }, "end": { - "line": 39, + "line": 48, "column": 16 } } @@ -3743,15 +7625,15 @@ "binop": null, "updateContext": null }, - "start": 1194, - "end": 1195, + "start": 1480, + "end": 1481, "loc": { "start": { - "line": 39, + "line": 48, "column": 16 }, "end": { - "line": 39, + "line": 48, "column": 17 } } @@ -3769,15 +7651,15 @@ "binop": null }, "value": "parent", - "start": 1195, - "end": 1201, + "start": 1481, + "end": 1487, "loc": { "start": { - "line": 39, + "line": 48, "column": 17 }, "end": { - "line": 39, + "line": 48, "column": 23 } } @@ -3794,15 +7676,15 @@ "postfix": false, "binop": null }, - "start": 1201, - "end": 1202, + "start": 1487, + "end": 1488, "loc": { "start": { - "line": 39, + "line": 48, "column": 23 }, "end": { - "line": 39, + "line": 48, "column": 24 } } @@ -3820,15 +7702,15 @@ "binop": null, "updateContext": null }, - "start": 1202, - "end": 1203, + "start": 1488, + "end": 1489, "loc": { "start": { - "line": 39, + "line": 48, "column": 24 }, "end": { - "line": 39, + "line": 48, "column": 25 } } @@ -3845,15 +7727,15 @@ "postfix": false, "binop": null }, - "start": 1205, - "end": 1206, + "start": 1491, + "end": 1492, "loc": { "start": { - "line": 40, + "line": 49, "column": 1 }, "end": { - "line": 40, + "line": 49, "column": 2 } } @@ -3861,15 +7743,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 4.", - "start": 1209, - "end": 1236, + "start": 1495, + "end": 1522, "loc": { "start": { - "line": 42, + "line": 51, "column": 1 }, "end": { - "line": 42, + "line": 51, "column": 28 } } @@ -3889,15 +7771,15 @@ "updateContext": null }, "value": "else", - "start": 1238, - "end": 1242, + "start": 1524, + "end": 1528, "loc": { "start": { - "line": 43, + "line": 52, "column": 1 }, "end": { - "line": 43, + "line": 52, "column": 5 } } @@ -3915,15 +7797,15 @@ "binop": null }, "value": "delete_case4", - "start": 1243, - "end": 1255, + "start": 1529, + "end": 1541, "loc": { "start": { - "line": 43, + "line": 52, "column": 6 }, "end": { - "line": 43, + "line": 52, "column": 18 } } @@ -3940,15 +7822,15 @@ "postfix": false, "binop": null }, - "start": 1255, - "end": 1256, + "start": 1541, + "end": 1542, "loc": { "start": { - "line": 43, + "line": 52, "column": 18 }, "end": { - "line": 43, + "line": 52, "column": 19 } } @@ -3966,15 +7848,15 @@ "binop": null }, "value": "n", - "start": 1256, - "end": 1257, + "start": 1542, + "end": 1543, "loc": { "start": { - "line": 43, + "line": 52, "column": 19 }, "end": { - "line": 43, + "line": 52, "column": 20 } } @@ -3991,15 +7873,15 @@ "postfix": false, "binop": null }, - "start": 1257, - "end": 1258, + "start": 1543, + "end": 1544, "loc": { "start": { - "line": 43, + "line": 52, "column": 20 }, "end": { - "line": 43, + "line": 52, "column": 21 } } @@ -4017,15 +7899,15 @@ "binop": null, "updateContext": null }, - "start": 1258, - "end": 1259, + "start": 1544, + "end": 1545, "loc": { "start": { - "line": 43, + "line": 52, "column": 21 }, "end": { - "line": 43, + "line": 52, "column": 22 } } @@ -4042,15 +7924,15 @@ "postfix": false, "binop": null }, - "start": 1260, - "end": 1261, + "start": 1546, + "end": 1547, "loc": { "start": { - "line": 44, + "line": 53, "column": 0 }, "end": { - "line": 44, + "line": 53, "column": 1 } } @@ -4068,19 +7950,127 @@ "binop": null, "updateContext": null }, - "start": 1261, - "end": 1262, + "start": 1547, + "end": 1548, "loc": { "start": { - "line": 44, + "line": 53, "column": 1 }, "end": { - "line": 44, + "line": 53, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1550, + "end": 1556, + "loc": { + "start": { + "line": 55, + "column": 0 + }, + "end": { + "line": 55, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1557, + "end": 1564, + "loc": { + "start": { + "line": 55, + "column": 7 + }, + "end": { + "line": 55, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case3", + "start": 1565, + "end": 1577, + "loc": { + "start": { + "line": 55, + "column": 15 + }, + "end": { + "line": 55, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1577, + "end": 1578, + "loc": { + "start": { + "line": 55, + "column": 27 + }, + "end": { + "line": 55, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -4094,15 +8084,15 @@ "binop": null, "updateContext": null }, - "start": 1263, - "end": 1263, + "start": 1579, + "end": 1579, "loc": { "start": { - "line": 45, + "line": 56, "column": 0 }, "end": { - "line": 45, + "line": 56, "column": 0 } } diff --git a/ast/source/deletion/delete_case4.js.json b/ast/source/deletion/delete_case4.js.json index 8a3b0b8..373e269 100644 --- a/ast/source/deletion/delete_case4.js.json +++ b/ast/source/deletion/delete_case4.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1431, + "end": 1840, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 47, + "line": 61, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1431, + "end": 1840, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 47, + "line": 61, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 45, + "end": 28, "loc": { "start": { "line": 1, @@ -39,188 +39,381 @@ }, "end": { "line": 1, - "column": 45 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 41, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 12 }, "identifierName": "BLACK" }, "name": "BLACK" } + } + ], + "source": { + "type": "StringLiteral", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 68, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 }, + "end": { + "line": 3, + "column": 34 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 15, - "end": 18, + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 10 } }, - "imported": { + "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 75, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 10 }, "identifierName": "RED" }, "name": "RED" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "extra": { + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" + }, + "value": "../color/RED.js" + } + }, + { + "type": "ImportDeclaration", + "start": 103, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 110, + "end": 114, "loc": { "start": { - "line": 1, - "column": 15 + "line": 4, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 4, + "column": 11 }, - "identifierName": "RED" + "identifierName": "Node" }, - "name": "RED" + "name": "Node" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 44, + "start": 120, + "end": 138, "loc": { "start": { - "line": 1, - "column": 25 + "line": 4, + "column": 17 }, "end": { - "line": 1, - "column": 44 + "line": 4, + "column": 35 } }, "extra": { - "rawValue": "../color/index.js", - "raw": "'../color/index.js'" + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" }, - "value": "../color/index.js" + "value": "../types/Node.js" } }, { "type": "ImportDeclaration", - "start": 46, - "end": 91, + "start": 140, + "end": 176, "loc": { "start": { - "line": 2, + "line": 5, "column": 0 }, "end": { - "line": 2, - "column": 45 + "line": 5, + "column": 36 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 54, - "end": 61, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 151, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 15 + "line": 5, + "column": 11 } }, - "imported": { + "local": { "type": "Identifier", - "start": 54, - "end": 61, + "start": 147, + "end": 151, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 15 + "line": 5, + "column": 11 }, - "identifierName": "sibling" + "identifierName": "Leaf" }, - "name": "sibling" + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + } + }, + { + "type": "ImportDeclaration", + "start": 177, + "end": 220, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 43 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 184, + "end": 191, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 14 + } }, "local": { "type": "Identifier", - "start": 54, - "end": 61, + "start": 184, + "end": 191, "loc": { "start": { - "line": 2, - "column": 8 + "line": 6, + "column": 7 }, "end": { - "line": 2, - "column": 15 + "line": 6, + "column": 14 }, "identifierName": "sibling" }, @@ -230,16 +423,16 @@ ], "source": { "type": "StringLiteral", - "start": 68, - "end": 90, + "start": 197, + "end": 219, "loc": { "start": { - "line": 2, - "column": 22 + "line": 6, + "column": 20 }, "end": { - "line": 2, - "column": 44 + "line": 6, + "column": 42 } }, "extra": { @@ -251,62 +444,45 @@ }, { "type": "ImportDeclaration", - "start": 93, - "end": 140, + "start": 222, + "end": 267, "loc": { "start": { - "line": 4, + "line": 8, "column": 0 }, "end": { - "line": 4, - "column": 47 + "line": 8, + "column": 45 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 101, - "end": 113, + "type": "ImportDefaultSpecifier", + "start": 229, + "end": 241, "loc": { "start": { - "line": 4, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 4, - "column": 20 + "line": 8, + "column": 19 } }, - "imported": { - "type": "Identifier", - "start": 101, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 20 - }, - "identifierName": "delete_case5" - }, - "name": "delete_case5" - }, "local": { "type": "Identifier", - "start": 101, - "end": 113, + "start": 229, + "end": 241, "loc": { "start": { - "line": 4, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 4, - "column": 20 + "line": 8, + "column": 19 }, "identifierName": "delete_case5" }, @@ -316,16 +492,16 @@ ], "source": { "type": "StringLiteral", - "start": 120, - "end": 139, + "start": 247, + "end": 266, "loc": { "start": { - "line": 4, - "column": 27 + "line": 8, + "column": 25 }, "end": { - "line": 4, - "column": 46 + "line": 8, + "column": 44 } }, "extra": { @@ -337,16 +513,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", - "start": 142, - "end": 473, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 269, + "end": 605, "loc": { "start": { - "line": 6, + "line": 10, "column": 0 }, "end": { - "line": 16, + "line": 20, "column": 3 } } @@ -354,854 +530,990 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 474, - "end": 1430, + "type": "Identifier", + "start": 606, + "end": 1809, "loc": { "start": { - "line": 17, + "line": 21, "column": 0 }, "end": { - "line": 46, + "line": 58, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 481, - "end": 1430, - "loc": { - "start": { - "line": 17, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 612, + "end": 1808, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 58, + "column": 1 + } }, - "end": { - "line": 46, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 487, - "end": 1429, + "id": { + "type": "Identifier", + "start": 612, + "end": 624, "loc": { "start": { - "line": 17, - "column": 13 + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 627, + "end": 1808, + "loc": { + "start": { + "line": 21, + "column": 21 }, "end": { - "line": 46, + "line": 58, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 487, - "end": 499, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 25 + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 628, + "end": 629, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 23 + }, + "identifierName": "n" }, - "identifierName": "delete_case4" - }, - "name": "delete_case4", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 502, - "end": 1429, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 634, + "end": 1808, "loc": { "start": { - "line": 17, + "line": 21, "column": 28 }, "end": { - "line": 46, + "line": 58, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 487, - "end": 499, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 25 - }, - "identifierName": "delete_case4" - }, - "name": "delete_case4", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 503, - "end": 504, + "type": "ExpressionStatement", + "start": 637, + "end": 684, "loc": { "start": { - "line": 17, - "column": 29 + "line": 22, + "column": 1 }, "end": { - "line": 17, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 509, - "end": 1429, - "loc": { - "start": { - "line": 17, - "column": 35 + "line": 22, + "column": 48 + } }, - "end": { - "line": 46, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 512, - "end": 533, + "expression": { + "type": "CallExpression", + "start": 637, + "end": 683, "loc": { "start": { - "line": 18, + "line": 22, "column": 1 }, "end": { - "line": 18, - "column": 22 + "line": 22, + "column": 47 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 637, + "end": 643, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 518, - "end": 532, + "type": "LogicalExpression", + "start": 644, + "end": 682, "loc": { "start": { - "line": 18, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 18, - "column": 21 + "line": 22, + "column": 46 } }, - "id": { - "type": "Identifier", - "start": 518, - "end": 519, + "left": { + "type": "BinaryExpression", + "start": 644, + "end": 661, "loc": { "start": { - "line": 18, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 18, - "column": 8 + "line": 22, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 644, + "end": 645, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "s" + "name": "n" }, - "name": "s" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 657, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } }, - "init": { - "type": "CallExpression", - "start": 522, - "end": 532, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 665, + "end": 682, "loc": { "start": { - "line": 18, - "column": 11 + "line": 22, + "column": 29 }, "end": { - "line": 18, - "column": 21 + "line": 22, + "column": 46 } }, - "callee": { + "left": { "type": "Identifier", - "start": 522, - "end": 529, + "start": 665, + "end": 666, "loc": { "start": { - "line": 18, - "column": 11 + "line": 22, + "column": 29 }, "end": { - "line": 18, - "column": 18 + "line": 22, + "column": 30 }, - "identifierName": "sibling" + "identifierName": "n" }, - "name": "sibling" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 530, - "end": 531, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 20 - }, - "identifierName": "n" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 678, + "end": 682, + "loc": { + "start": { + "line": 22, + "column": 42 }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 536, - "end": 1164, - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 33, - "column": 4 + "end": { + "line": 22, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" } } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 686, + "end": 713, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 28 + } }, - { - "type": "IfStatement", - "start": 1166, - "end": 1427, + "expression": { + "type": "CallExpression", + "start": 686, + "end": 712, "loc": { "start": { - "line": 34, + "line": 23, "column": 1 }, "end": { - "line": 45, - "column": 22 + "line": 23, + "column": 27 } }, - "test": { - "type": "LogicalExpression", - "start": 1239, - "end": 1321, + "callee": { + "type": "Identifier", + "start": 686, + "end": 692, "loc": { "start": { - "line": 36, - "column": 2 + "line": 23, + "column": 1 }, "end": { - "line": 38, - "column": 26 - } + "line": 23, + "column": 7 + }, + "identifierName": "assert" }, - "left": { - "type": "LogicalExpression", - "start": 1239, - "end": 1291, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 693, + "end": 711, "loc": { "start": { - "line": 36, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 37, - "column": 25 + "line": 23, + "column": 26 } }, "left": { - "type": "BinaryExpression", - "start": 1239, - "end": 1262, + "type": "MemberExpression", + "start": 693, + "end": 701, "loc": { "start": { - "line": 36, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 36, - "column": 25 + "line": 23, + "column": 16 } }, - "left": { - "type": "MemberExpression", - "start": 1239, - "end": 1254, + "object": { + "type": "Identifier", + "start": 693, + "end": 694, "loc": { "start": { - "line": 36, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 36, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1239, - "end": 1247, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1239, - "end": 1240, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1241, - "end": 1247, - "loc": { - "start": { - "line": 36, - "column": 4 - }, - "end": { - "line": 36, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1248, - "end": 1254, - "loc": { - "start": { - "line": 36, - "column": 11 - }, - "end": { - "line": 36, - "column": 17 - }, - "identifierName": "_color" + "line": 23, + "column": 9 }, - "name": "_color" + "identifierName": "n" }, - "computed": false, - "leadingComments": null + "name": "n" }, - "operator": "===", - "right": { + "property": { "type": "Identifier", - "start": 1259, - "end": 1262, + "start": 695, + "end": 701, "loc": { "start": { - "line": 36, - "column": 22 + "line": 23, + "column": 10 }, "end": { - "line": 36, - "column": 25 + "line": 23, + "column": 16 }, - "identifierName": "RED" + "identifierName": "_color" }, - "name": "RED" + "name": "_color" }, - "leadingComments": null + "computed": false }, - "operator": "&&", + "operator": "===", "right": { - "type": "BinaryExpression", - "start": 1268, - "end": 1291, + "type": "Identifier", + "start": 706, + "end": 711, "loc": { "start": { - "line": 37, - "column": 2 + "line": 23, + "column": 21 }, "end": { - "line": 37, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 1268, - "end": 1281, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 15 - } + "line": 23, + "column": 26 }, - "object": { - "type": "MemberExpression", - "start": 1268, - "end": 1274, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1268, - "end": 1269, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1270, - "end": 1274, - "loc": { - "start": { - "line": 37, - "column": 4 - }, - "end": { - "line": 37, - "column": 8 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1275, - "end": 1281, - "loc": { - "start": { - "line": 37, - "column": 9 - }, - "end": { - "line": 37, - "column": 15 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "identifierName": "BLACK" }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1286, - "end": 1291, - "loc": { - "start": { - "line": 37, - "column": 20 - }, - "end": { - "line": 37, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 715, + "end": 741, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 715, + "end": 740, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 715, + "end": 721, + "loc": { + "start": { + "line": 24, + "column": 1 }, - "leadingComments": null + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "&&", - "right": { + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 1297, - "end": 1321, + "start": 722, + "end": 739, "loc": { "start": { - "line": 38, - "column": 2 + "line": 24, + "column": 8 }, "end": { - "line": 38, - "column": 26 + "line": 24, + "column": 25 } }, "left": { "type": "MemberExpression", - "start": 1297, - "end": 1311, + "start": 722, + "end": 730, "loc": { "start": { - "line": 38, - "column": 2 + "line": 24, + "column": 8 }, "end": { - "line": 38, + "line": 24, "column": 16 } }, "object": { - "type": "MemberExpression", - "start": 1297, - "end": 1304, + "type": "Identifier", + "start": 722, + "end": 723, "loc": { "start": { - "line": 38, - "column": 2 + "line": 24, + "column": 8 }, "end": { - "line": 38, + "line": 24, "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1297, - "end": 1298, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1299, - "end": 1304, - "loc": { - "start": { - "line": 38, - "column": 4 - }, - "end": { - "line": 38, - "column": 9 - }, - "identifierName": "right" }, - "name": "right" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1305, - "end": 1311, + "start": 724, + "end": 730, "loc": { "start": { - "line": 38, + "line": 24, "column": 10 }, "end": { - "line": 38, + "line": 24, "column": 16 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false }, - "operator": "===", + "operator": "!==", "right": { - "type": "Identifier", - "start": 1316, - "end": 1321, + "type": "NullLiteral", + "start": 735, + "end": 739, "loc": { "start": { - "line": 38, + "line": 24, "column": 21 }, "end": { - "line": 38, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " The parent color test is always true when coming from case 2", - "start": 1173, - "end": 1236, - "loc": { - "start": { - "line": 35, - "column": 2 - }, - "end": { - "line": 35, - "column": 65 + "line": 24, + "column": 25 } } } - ] + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 743, + "end": 764, + "loc": { + "start": { + "line": 25, + "column": 1 }, - "consequent": { - "type": "BlockStatement", - "start": 1325, - "end": 1374, + "end": { + "line": 25, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 749, + "end": 763, "loc": { "start": { - "line": 39, - "column": 3 + "line": 25, + "column": 7 }, "end": { - "line": 42, - "column": 2 + "line": 25, + "column": 21 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1329, - "end": 1344, + "id": { + "type": "Identifier", + "start": 749, + "end": 750, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 753, + "end": 763, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 753, + "end": 760, "loc": { "start": { - "line": 40, - "column": 2 + "line": 25, + "column": 11 }, "end": { - "line": 40, - "column": 17 - } + "line": 25, + "column": 18 + }, + "identifierName": "sibling" }, - "expression": { - "type": "AssignmentExpression", - "start": 1329, - "end": 1343, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 761, + "end": 762, "loc": { "start": { - "line": 40, - "column": 2 + "line": 25, + "column": 19 }, "end": { - "line": 40, - "column": 16 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1329, - "end": 1337, - "loc": { - "start": { - "line": 40, - "column": 2 - }, - "end": { - "line": 40, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1329, - "end": 1330, - "loc": { - "start": { - "line": 40, - "column": 2 - }, - "end": { - "line": 40, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1331, - "end": 1337, - "loc": { - "start": { - "line": 40, - "column": 4 - }, - "end": { - "line": 40, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" + "line": 25, + "column": 20 }, - "computed": false + "identifierName": "n" }, - "right": { - "type": "Identifier", - "start": 1340, - "end": 1343, - "loc": { - "start": { - "line": 40, - "column": 13 - }, - "end": { - "line": 40, - "column": 16 - }, - "identifierName": "RED" - }, - "name": "RED" - } + "name": "n" } - }, - { - "type": "ExpressionStatement", - "start": 1347, - "end": 1371, - "loc": { + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 766, + "end": 792, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 766, + "end": 791, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 766, + "end": 772, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 773, + "end": 790, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 773, + "end": 774, + "loc": { "start": { - "line": 41, - "column": 2 + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 786, + "end": 790, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 794, + "end": 821, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 794, + "end": 820, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 794, + "end": 800, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 801, + "end": 819, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 801, + "end": 809, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 801, + "end": 802, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 803, + "end": 809, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 814, + "end": 819, + "loc": { + "start": { + "line": 27, + "column": 21 }, "end": { - "line": 41, + "line": 27, "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 823, + "end": 912, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 30, + "column": 3 + } + }, + "expression": { + "type": "CallExpression", + "start": 823, + "end": 911, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + } + }, + "callee": { + "type": "Identifier", + "start": 823, + "end": 829, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 833, + "end": 907, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 76 + } + }, + "left": { + "type": "LogicalExpression", + "start": 833, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 50 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1347, - "end": 1370, + "left": { + "type": "BinaryExpression", + "start": 833, + "end": 856, "loc": { "start": { - "line": 41, + "line": 29, "column": 2 }, "end": { - "line": 41, + "line": 29, "column": 25 } }, - "operator": "=", "left": { "type": "MemberExpression", - "start": 1347, - "end": 1362, + "start": 833, + "end": 848, "loc": { "start": { - "line": 41, + "line": 29, "column": 2 }, "end": { - "line": 41, + "line": 29, "column": 17 } }, "object": { "type": "MemberExpression", - "start": 1347, - "end": 1355, + "start": 833, + "end": 841, "loc": { "start": { - "line": 41, + "line": 29, "column": 2 }, "end": { - "line": 41, + "line": 29, "column": 10 } }, "object": { "type": "Identifier", - "start": 1347, - "end": 1348, + "start": 833, + "end": 834, "loc": { "start": { - "line": 41, + "line": 29, "column": 2 }, "end": { - "line": 41, + "line": 29, "column": 3 }, "identifierName": "n" @@ -1210,15 +1522,15 @@ }, "property": { "type": "Identifier", - "start": 1349, - "end": 1355, + "start": 835, + "end": 841, "loc": { "start": { - "line": 41, + "line": 29, "column": 4 }, "end": { - "line": 41, + "line": 29, "column": 10 }, "identifierName": "parent" @@ -1229,15 +1541,15 @@ }, "property": { "type": "Identifier", - "start": 1356, - "end": 1362, + "start": 842, + "end": 848, "loc": { "start": { - "line": 41, + "line": 29, "column": 11 }, "end": { - "line": 41, + "line": 29, "column": 17 }, "identifierName": "_color" @@ -1246,272 +1558,5385 @@ }, "computed": false }, + "operator": "===", "right": { "type": "Identifier", - "start": 1365, - "end": 1370, + "start": 853, + "end": 856, "loc": { "start": { - "line": 41, - "column": 20 + "line": 29, + "column": 22 }, "end": { - "line": 41, + "line": 29, "column": 25 }, - "identifierName": "BLACK" + "identifierName": "RED" }, - "name": "BLACK" - } - } - } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1377, - "end": 1404, - "loc": { - "start": { - "line": 44, - "column": 1 - }, - "end": { - "line": 44, - "column": 28 + "name": "RED" } - } - } - ] - }, - "alternate": { - "type": "ExpressionStatement", - "start": 1411, - "end": 1427, - "loc": { - "start": { - "line": 45, - "column": 6 - }, - "end": { - "line": 45, - "column": 22 - } - }, - "expression": { - "type": "CallExpression", - "start": 1411, - "end": 1426, - "loc": { - "start": { - "line": 45, - "column": 6 - }, - "end": { - "line": 45, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 1411, - "end": 1423, - "loc": { - "start": { - "line": 45, - "column": 6 - }, - "end": { - "line": 45, - "column": 18 - }, - "identifierName": "delete_case5" }, - "name": "delete_case5", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1424, - "end": 1425, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 860, + "end": 881, "loc": { "start": { - "line": 45, - "column": 19 + "line": 29, + "column": 29 }, "end": { - "line": 45, - "column": 20 - }, - "identifierName": "n" + "line": 29, + "column": 50 + } }, - "name": "n" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1377, - "end": 1404, - "loc": { + "left": { + "type": "MemberExpression", + "start": 860, + "end": 873, + "loc": { + "start": { + "line": 29, + "column": 29 + }, + "end": { + "line": 29, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 860, + "end": 866, + "loc": { + "start": { + "line": 29, + "column": 29 + }, + "end": { + "line": 29, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 860, + "end": 861, + "loc": { + "start": { + "line": 29, + "column": 29 + }, + "end": { + "line": 29, + "column": 30 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 862, + "end": 866, + "loc": { + "start": { + "line": 29, + "column": 31 + }, + "end": { + "line": 29, + "column": 35 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 867, + "end": 873, + "loc": { + "start": { + "line": 29, + "column": 36 + }, + "end": { + "line": 29, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 878, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 47 + }, + "end": { + "line": 29, + "column": 50 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 885, + "end": 907, + "loc": { "start": { - "line": 44, - "column": 1 + "line": 29, + "column": 54 }, "end": { - "line": 44, - "column": 28 + "line": 29, + "column": 76 } + }, + "left": { + "type": "MemberExpression", + "start": 885, + "end": 899, + "loc": { + "start": { + "line": 29, + "column": 54 + }, + "end": { + "line": 29, + "column": 68 + } + }, + "object": { + "type": "MemberExpression", + "start": 885, + "end": 892, + "loc": { + "start": { + "line": 29, + "column": 54 + }, + "end": { + "line": 29, + "column": 61 + } + }, + "object": { + "type": "Identifier", + "start": 885, + "end": 886, + "loc": { + "start": { + "line": 29, + "column": 54 + }, + "end": { + "line": 29, + "column": 55 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 887, + "end": 892, + "loc": { + "start": { + "line": 29, + "column": 56 + }, + "end": { + "line": 29, + "column": 61 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 893, + "end": 899, + "loc": { + "start": { + "line": 29, + "column": 62 + }, + "end": { + "line": 29, + "column": 68 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 904, + "end": 907, + "loc": { + "start": { + "line": 29, + "column": 73 + }, + "end": { + "line": 29, + "column": 76 + }, + "identifierName": "RED" + }, + "name": "RED" } } - ] + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 915, + "end": 1543, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1545, + "end": 1806, + "loc": { + "start": { + "line": 46, + "column": 1 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 536, - "end": 1164, + "end": { + "line": 57, + "column": 22 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1618, + "end": 1700, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 50, + "column": 26 + } + }, + "left": { + "type": "LogicalExpression", + "start": 1618, + "end": 1670, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 49, + "column": 25 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1618, + "end": 1641, "loc": { "start": { - "line": 20, - "column": 1 + "line": 48, + "column": 2 }, "end": { - "line": 33, - "column": 4 + "line": 48, + "column": 25 } - } - } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", - "start": 142, - "end": 473, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 16, - "column": 3 - } - } - } - ], - "trailingComments": [] + }, + "left": { + "type": "MemberExpression", + "start": 1618, + "end": 1633, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1618, + "end": 1626, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1618, + "end": 1619, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1620, + "end": 1626, + "loc": { + "start": { + "line": 48, + "column": 4 + }, + "end": { + "line": 48, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1627, + "end": 1633, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1638, + "end": 1641, + "loc": { + "start": { + "line": 48, + "column": 22 + }, + "end": { + "line": 48, + "column": 25 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1647, + "end": 1670, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1647, + "end": 1660, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 15 + } + }, + "object": { + "type": "MemberExpression", + "start": 1647, + "end": 1653, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1647, + "end": 1648, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1649, + "end": 1653, + "loc": { + "start": { + "line": 49, + "column": 4 + }, + "end": { + "line": 49, + "column": 8 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1654, + "end": 1660, + "loc": { + "start": { + "line": 49, + "column": 9 + }, + "end": { + "line": 49, + "column": 15 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1665, + "end": 1670, + "loc": { + "start": { + "line": 49, + "column": 20 + }, + "end": { + "line": 49, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1676, + "end": 1700, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 1676, + "end": 1690, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 1676, + "end": 1683, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1676, + "end": 1677, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1678, + "end": 1683, + "loc": { + "start": { + "line": 50, + "column": 4 + }, + "end": { + "line": 50, + "column": 9 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1684, + "end": 1690, + "loc": { + "start": { + "line": 50, + "column": 10 + }, + "end": { + "line": 50, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1695, + "end": 1700, + "loc": { + "start": { + "line": 50, + "column": 21 + }, + "end": { + "line": 50, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " The parent color test is always true when coming from case 2", + "start": 1552, + "end": 1615, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 65 + } + } + } + ] + }, + "consequent": { + "type": "BlockStatement", + "start": 1704, + "end": 1753, + "loc": { + "start": { + "line": 51, + "column": 3 + }, + "end": { + "line": 54, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1708, + "end": 1723, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1708, + "end": 1722, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1708, + "end": 1716, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1708, + "end": 1709, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1710, + "end": 1716, + "loc": { + "start": { + "line": 52, + "column": 4 + }, + "end": { + "line": 52, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1719, + "end": 1722, + "loc": { + "start": { + "line": 52, + "column": 13 + }, + "end": { + "line": 52, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1726, + "end": 1750, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 26 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1726, + "end": 1749, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 25 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1726, + "end": 1741, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1726, + "end": 1734, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1726, + "end": 1727, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1728, + "end": 1734, + "loc": { + "start": { + "line": 53, + "column": 4 + }, + "end": { + "line": 53, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1735, + "end": 1741, + "loc": { + "start": { + "line": 53, + "column": 11 + }, + "end": { + "line": 53, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1744, + "end": 1749, + "loc": { + "start": { + "line": 53, + "column": 20 + }, + "end": { + "line": 53, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ], + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 5.", + "start": 1756, + "end": 1783, + "loc": { + "start": { + "line": 56, + "column": 1 + }, + "end": { + "line": 56, + "column": 28 + } + } + } + ] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1790, + "end": 1806, + "loc": { + "start": { + "line": 57, + "column": 6 + }, + "end": { + "line": 57, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 1790, + "end": 1805, + "loc": { + "start": { + "line": 57, + "column": 6 + }, + "end": { + "line": 57, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 1790, + "end": 1802, + "loc": { + "start": { + "line": 57, + "column": 6 + }, + "end": { + "line": 57, + "column": 18 + }, + "identifierName": "delete_case5" + }, + "name": "delete_case5", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1803, + "end": 1804, + "loc": { + "start": { + "line": 57, + "column": 19 + }, + "end": { + "line": 57, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 5.", + "start": 1756, + "end": 1783, + "loc": { + "start": { + "line": 56, + "column": 1 + }, + "end": { + "line": 56, + "column": 28 + } + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 915, + "end": 1543, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1811, + "end": 1839, + "loc": { + "start": { + "line": 60, + "column": 0 + }, + "end": { + "line": 60, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 1826, + "end": 1838, + "loc": { + "start": { + "line": 60, + "column": 15 + }, + "end": { + "line": 60, + "column": 27 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1811, + "end": 1839, + "loc": { + "start": { + "line": 60, + "column": 0 + }, + "end": { + "line": 60, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 606, + "end": 1809, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 58, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 612, + "end": 1808, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 58, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 612, + "end": 624, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 627, + "end": 1808, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 58, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 612, + "end": 624, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 628, + "end": 629, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 634, + "end": 1808, + "loc": { + "start": { + "line": 21, + "column": 28 + }, + "end": { + "line": 58, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 637, + "end": 684, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 637, + "end": 683, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 637, + "end": 643, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 644, + "end": 682, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 644, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 644, + "end": 645, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 657, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 665, + "end": 682, + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 665, + "end": 666, + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 678, + "end": 682, + "loc": { + "start": { + "line": 22, + "column": 42 + }, + "end": { + "line": 22, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 686, + "end": 713, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 686, + "end": 712, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 686, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 693, + "end": 711, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 693, + "end": 701, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 693, + "end": 694, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 695, + "end": 701, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 706, + "end": 711, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 715, + "end": 741, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 715, + "end": 740, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 715, + "end": 721, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 722, + "end": 739, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 722, + "end": 730, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 722, + "end": 723, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 724, + "end": 730, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 735, + "end": 739, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 743, + "end": 764, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 749, + "end": 763, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 749, + "end": 750, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 753, + "end": 763, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 753, + "end": 760, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 761, + "end": 762, + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 766, + "end": 792, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 766, + "end": 791, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 766, + "end": 772, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 773, + "end": 790, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 773, + "end": 774, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 786, + "end": 790, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 794, + "end": 821, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 794, + "end": 820, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 794, + "end": 800, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 801, + "end": 819, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 801, + "end": 809, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 801, + "end": 802, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 803, + "end": 809, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 814, + "end": 819, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 823, + "end": 912, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 30, + "column": 3 + } + }, + "expression": { + "type": "CallExpression", + "start": 823, + "end": 911, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + } + }, + "callee": { + "type": "Identifier", + "start": 823, + "end": 829, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 833, + "end": 907, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 76 + } + }, + "left": { + "type": "LogicalExpression", + "start": 833, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 50 + } + }, + "left": { + "type": "BinaryExpression", + "start": 833, + "end": 856, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 833, + "end": 848, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 833, + "end": 841, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 833, + "end": 834, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 835, + "end": 841, + "loc": { + "start": { + "line": 29, + "column": 4 + }, + "end": { + "line": 29, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 842, + "end": 848, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 853, + "end": 856, + "loc": { + "start": { + "line": 29, + "column": 22 + }, + "end": { + "line": 29, + "column": 25 + }, + "identifierName": "RED" + }, + "name": "RED" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 860, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 29 + }, + "end": { + "line": 29, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 860, + "end": 873, + "loc": { + "start": { + "line": 29, + "column": 29 + }, + "end": { + "line": 29, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 860, + "end": 866, + "loc": { + "start": { + "line": 29, + "column": 29 + }, + "end": { + "line": 29, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 860, + "end": 861, + "loc": { + "start": { + "line": 29, + "column": 29 + }, + "end": { + "line": 29, + "column": 30 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 862, + "end": 866, + "loc": { + "start": { + "line": 29, + "column": 31 + }, + "end": { + "line": 29, + "column": 35 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 867, + "end": 873, + "loc": { + "start": { + "line": 29, + "column": 36 + }, + "end": { + "line": 29, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 878, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 47 + }, + "end": { + "line": 29, + "column": 50 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 885, + "end": 907, + "loc": { + "start": { + "line": 29, + "column": 54 + }, + "end": { + "line": 29, + "column": 76 + } + }, + "left": { + "type": "MemberExpression", + "start": 885, + "end": 899, + "loc": { + "start": { + "line": 29, + "column": 54 + }, + "end": { + "line": 29, + "column": 68 + } + }, + "object": { + "type": "MemberExpression", + "start": 885, + "end": 892, + "loc": { + "start": { + "line": 29, + "column": 54 + }, + "end": { + "line": 29, + "column": 61 + } + }, + "object": { + "type": "Identifier", + "start": 885, + "end": 886, + "loc": { + "start": { + "line": 29, + "column": 54 + }, + "end": { + "line": 29, + "column": 55 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 887, + "end": 892, + "loc": { + "start": { + "line": 29, + "column": 56 + }, + "end": { + "line": 29, + "column": 61 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 893, + "end": 899, + "loc": { + "start": { + "line": 29, + "column": 62 + }, + "end": { + "line": 29, + "column": 68 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 904, + "end": 907, + "loc": { + "start": { + "line": 29, + "column": 73 + }, + "end": { + "line": 29, + "column": 76 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 915, + "end": 1543, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1545, + "end": 1806, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 57, + "column": 22 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1618, + "end": 1700, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 50, + "column": 26 + } + }, + "left": { + "type": "LogicalExpression", + "start": 1618, + "end": 1670, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 49, + "column": 25 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1618, + "end": 1641, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1618, + "end": 1633, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1618, + "end": 1626, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1618, + "end": 1619, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1620, + "end": 1626, + "loc": { + "start": { + "line": 48, + "column": 4 + }, + "end": { + "line": 48, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1627, + "end": 1633, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1638, + "end": 1641, + "loc": { + "start": { + "line": 48, + "column": 22 + }, + "end": { + "line": 48, + "column": 25 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1647, + "end": 1670, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1647, + "end": 1660, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 15 + } + }, + "object": { + "type": "MemberExpression", + "start": 1647, + "end": 1653, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1647, + "end": 1648, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1649, + "end": 1653, + "loc": { + "start": { + "line": 49, + "column": 4 + }, + "end": { + "line": 49, + "column": 8 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1654, + "end": 1660, + "loc": { + "start": { + "line": 49, + "column": 9 + }, + "end": { + "line": 49, + "column": 15 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1665, + "end": 1670, + "loc": { + "start": { + "line": 49, + "column": 20 + }, + "end": { + "line": 49, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1676, + "end": 1700, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 1676, + "end": 1690, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 1676, + "end": 1683, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1676, + "end": 1677, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1678, + "end": 1683, + "loc": { + "start": { + "line": 50, + "column": 4 + }, + "end": { + "line": 50, + "column": 9 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1684, + "end": 1690, + "loc": { + "start": { + "line": 50, + "column": 10 + }, + "end": { + "line": 50, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1695, + "end": 1700, + "loc": { + "start": { + "line": 50, + "column": 21 + }, + "end": { + "line": 50, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " The parent color test is always true when coming from case 2", + "start": 1552, + "end": 1615, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 65 + } + } + } + ] + }, + "consequent": { + "type": "BlockStatement", + "start": 1704, + "end": 1753, + "loc": { + "start": { + "line": 51, + "column": 3 + }, + "end": { + "line": 54, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1708, + "end": 1723, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1708, + "end": 1722, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1708, + "end": 1716, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1708, + "end": 1709, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1710, + "end": 1716, + "loc": { + "start": { + "line": 52, + "column": 4 + }, + "end": { + "line": 52, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1719, + "end": 1722, + "loc": { + "start": { + "line": 52, + "column": 13 + }, + "end": { + "line": 52, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1726, + "end": 1750, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 26 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1726, + "end": 1749, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 25 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1726, + "end": 1741, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1726, + "end": 1734, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1726, + "end": 1727, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1728, + "end": 1734, + "loc": { + "start": { + "line": 53, + "column": 4 + }, + "end": { + "line": 53, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1735, + "end": 1741, + "loc": { + "start": { + "line": 53, + "column": 11 + }, + "end": { + "line": 53, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1744, + "end": 1749, + "loc": { + "start": { + "line": 53, + "column": 20 + }, + "end": { + "line": 53, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ], + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 5.", + "start": 1756, + "end": 1783, + "loc": { + "start": { + "line": 56, + "column": 1 + }, + "end": { + "line": 56, + "column": 28 + } + } + } + ] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1790, + "end": 1806, + "loc": { + "start": { + "line": 57, + "column": 6 + }, + "end": { + "line": 57, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 1790, + "end": 1805, + "loc": { + "start": { + "line": 57, + "column": 6 + }, + "end": { + "line": 57, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 1790, + "end": 1802, + "loc": { + "start": { + "line": 57, + "column": 6 + }, + "end": { + "line": 57, + "column": 18 + }, + "identifierName": "delete_case5" + }, + "name": "delete_case5", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1803, + "end": 1804, + "loc": { + "start": { + "line": 57, + "column": 19 + }, + "end": { + "line": 57, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 5.", + "start": 1756, + "end": 1783, + "loc": { + "start": { + "line": 56, + "column": 1 + }, + "end": { + "line": 56, + "column": 28 + } + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 915, + "end": 1543, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 269, + "end": 605, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 269, + "end": 605, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 915, + "end": 1543, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " The parent color test is always true when coming from case 2", + "start": 1552, + "end": 1615, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 65 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise, go to case 5.", + "start": 1756, + "end": 1783, + "loc": { + "start": { + "line": 56, + "column": 1 + }, + "end": { + "line": 56, + "column": 28 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 75, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 103, + "end": 109, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 115, + "end": 119, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 120, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 147, + "end": 151, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 152, + "end": 156, + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 175, + "end": 176, + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 177, + "end": 183, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 184, + "end": 191, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 192, + "end": 196, + "loc": { + "start": { + "line": 6, + "column": 15 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/sibling.js", + "start": 197, + "end": 219, + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 42 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 219, + "end": 220, + "loc": { + "start": { + "line": 6, + "column": 42 + }, + "end": { + "line": 6, + "column": 43 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 222, + "end": 228, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case5", + "start": 229, + "end": 241, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 242, + "end": 246, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case5.js", + "start": 247, + "end": 266, + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 266, + "end": 267, + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 269, + "end": 605, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 606, + "end": 611, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case4", + "start": 612, + "end": 624, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 625, + "end": 626, + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 627, + "end": 628, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 628, + "end": 629, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 629, + "end": 630, + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 631, + "end": 633, + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 634, + "end": 635, + "loc": { + "start": { + "line": 21, + "column": 28 + }, + "end": { + "line": 21, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 637, + "end": 643, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 643, + "end": 644, + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 644, + "end": 645, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 646, + "end": 656, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 657, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 662, + "end": 664, + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 665, + "end": 666, + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 30 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 667, + "end": 677, + "loc": { + "start": { + "line": 22, + "column": 31 + }, + "end": { + "line": 22, + "column": 41 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 678, + "end": 682, + "loc": { + "start": { + "line": 22, + "column": 42 + }, + "end": { + "line": 22, + "column": 46 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 682, + "end": 683, + "loc": { + "start": { + "line": 22, + "column": 46 + }, + "end": { + "line": 22, + "column": 47 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 683, + "end": 684, + "loc": { + "start": { + "line": 22, + "column": 47 + }, + "end": { + "line": 22, + "column": 48 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 686, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 692, + "end": 693, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 693, + "end": 694, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 694, + "end": 695, + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 695, + "end": 701, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 702, + "end": 705, + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 706, + "end": 711, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 26 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 711, + "end": 712, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 712, + "end": 713, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 715, + "end": 721, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 721, + "end": 722, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 722, + "end": 723, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 723, + "end": 724, + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 724, + "end": 730, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 731, + "end": 734, + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 735, + "end": 739, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 739, + "end": 740, + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 740, + "end": 741, + "loc": { + "start": { + "line": 24, + "column": 26 + }, + "end": { + "line": 24, + "column": 27 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 743, + "end": 748, + "loc": { + "start": { + "line": 25, + "column": 1 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", - "start": 142, - "end": 473, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 16, - "column": 3 - } - } - } - ] + "end": { + "line": 25, + "column": 6 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", - "start": 142, - "end": 473, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "s", + "start": 749, + "end": 750, "loc": { "start": { - "line": 6, - "column": 0 + "line": 25, + "column": 7 }, "end": { - "line": 16, - "column": 3 + "line": 25, + "column": 8 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 536, - "end": 1164, + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 751, + "end": 752, "loc": { "start": { - "line": 20, - "column": 1 + "line": 25, + "column": 9 }, "end": { - "line": 33, - "column": 4 + "line": 25, + "column": 10 } } }, { - "type": "CommentLine", - "value": " The parent color test is always true when coming from case 2", - "start": 1173, - "end": 1236, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 753, + "end": 760, "loc": { "start": { - "line": 35, - "column": 2 + "line": 25, + "column": 11 }, "end": { - "line": 35, - "column": 65 + "line": 25, + "column": 18 } } }, { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1377, - "end": 1404, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 760, + "end": 761, "loc": { "start": { - "line": 44, - "column": 1 + "line": 25, + "column": 18 }, "end": { - "line": 44, - "column": 28 + "line": 25, + "column": 19 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1519,26 +6944,102 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "value": "n", + "start": 761, + "end": 762, + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 20 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 762, + "end": 763, + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 21 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "start": 763, + "end": 764, "loc": { "start": { - "line": 1, - "column": 0 + "line": 25, + "column": 21 }, "end": { - "line": 1, - "column": 6 + "line": 25, + "column": 22 } } }, { "type": { - "label": "{", + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 766, + "end": 772, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + } + } + }, + { + "type": { + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1548,15 +7049,15 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "start": 772, + "end": 773, "loc": { "start": { - "line": 1, + "line": 26, "column": 7 }, "end": { - "line": 1, + "line": 26, "column": 8 } } @@ -1573,23 +7074,24 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "s", + "start": 773, + "end": 774, "loc": { "start": { - "line": 1, + "line": 26, "column": 8 }, "end": { - "line": 1, - "column": 13 + "line": 26, + "column": 9 } } }, { "type": { - "label": ",", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1597,19 +7099,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 13, - "end": 14, + "value": "instanceof", + "start": 775, + "end": 785, "loc": { "start": { - "line": 1, - "column": 13 + "line": 26, + "column": 10 }, "end": { - "line": 1, - "column": 14 + "line": 26, + "column": 20 } } }, @@ -1623,27 +7126,78 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null + }, + "value": "Node", + "start": 786, + "end": 790, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 790, + "end": 791, + "loc": { + "start": { + "line": 26, + "column": 25 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 15, - "end": 18, + "start": 791, + "end": 792, "loc": { "start": { - "line": 1, - "column": 15 + "line": 26, + "column": 26 }, "end": { - "line": 1, - "column": 18 + "line": 26, + "column": 27 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1651,23 +7205,24 @@ "postfix": false, "binop": null }, - "start": 18, - "end": 19, + "value": "assert", + "start": 794, + "end": 800, "loc": { "start": { - "line": 1, - "column": 18 + "line": 27, + "column": 1 }, "end": { - "line": 1, - "column": 19 + "line": 27, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1676,23 +7231,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 20, - "end": 24, + "start": 800, + "end": 801, "loc": { "start": { - "line": 1, - "column": 20 + "line": 27, + "column": 7 }, "end": { - "line": 1, - "column": 24 + "line": 27, + "column": 8 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1700,27 +7254,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/index.js", - "start": 25, - "end": 44, + "value": "s", + "start": 801, + "end": 802, "loc": { "start": { - "line": 1, - "column": 25 + "line": 27, + "column": 8 }, "end": { - "line": 1, - "column": 44 + "line": 27, + "column": 9 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1730,23 +7283,22 @@ "binop": null, "updateContext": null }, - "start": 44, - "end": 45, + "start": 802, + "end": 803, "loc": { "start": { - "line": 1, - "column": 44 + "line": 27, + "column": 9 }, "end": { - "line": 1, - "column": 45 + "line": 27, + "column": 10 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1754,45 +7306,46 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 46, - "end": 52, + "value": "_color", + "start": 803, + "end": 809, "loc": { "start": { - "line": 2, - "column": 0 + "line": 27, + "column": 10 }, "end": { - "line": 2, - "column": 6 + "line": 27, + "column": 16 } } }, { "type": { - "label": "{", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 53, - "end": 54, + "value": "===", + "start": 810, + "end": 813, "loc": { "start": { - "line": 2, - "column": 7 + "line": 27, + "column": 17 }, "end": { - "line": 2, - "column": 8 + "line": 27, + "column": 20 } } }, @@ -1808,23 +7361,23 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 54, - "end": 61, + "value": "BLACK", + "start": 814, + "end": 819, "loc": { "start": { - "line": 2, - "column": 8 + "line": 27, + "column": 21 }, "end": { - "line": 2, - "column": 15 + "line": 27, + "column": 26 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1834,48 +7387,48 @@ "postfix": false, "binop": null }, - "start": 61, - "end": 62, + "start": 819, + "end": 820, "loc": { "start": { - "line": 2, - "column": 15 + "line": 27, + "column": 26 }, "end": { - "line": 2, - "column": 16 + "line": 27, + "column": 27 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 63, - "end": 67, + "start": 820, + "end": 821, "loc": { "start": { - "line": 2, - "column": 17 + "line": 27, + "column": 27 }, "end": { - "line": 2, - "column": 21 + "line": 27, + "column": 28 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1883,53 +7436,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/sibling.js", - "start": 68, - "end": 90, + "value": "assert", + "start": 823, + "end": 829, "loc": { "start": { - "line": 2, - "column": 22 + "line": 28, + "column": 1 }, "end": { - "line": 2, - "column": 44 + "line": 28, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 90, - "end": 91, + "start": 829, + "end": 830, "loc": { "start": { - "line": 2, - "column": 44 + "line": 28, + "column": 7 }, "end": { - "line": 2, - "column": 45 + "line": 28, + "column": 8 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1937,45 +7487,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 93, - "end": 99, + "value": "n", + "start": 833, + "end": 834, "loc": { "start": { - "line": 4, - "column": 0 + "line": 29, + "column": 2 }, "end": { - "line": 4, - "column": 6 + "line": 29, + "column": 3 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 100, - "end": 101, + "start": 834, + "end": 835, "loc": { "start": { - "line": 4, - "column": 7 + "line": 29, + "column": 3 }, "end": { - "line": 4, - "column": 8 + "line": 29, + "column": 4 } } }, @@ -1991,23 +7541,23 @@ "postfix": false, "binop": null }, - "value": "delete_case5", - "start": 101, - "end": 113, + "value": "parent", + "start": 835, + "end": 841, "loc": { "start": { - "line": 4, - "column": 8 + "line": 29, + "column": 4 }, "end": { - "line": 4, - "column": 20 + "line": 29, + "column": 10 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2015,18 +7565,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 113, - "end": 114, + "start": 841, + "end": 842, "loc": { "start": { - "line": 4, - "column": 20 + "line": 29, + "column": 10 }, "end": { - "line": 4, - "column": 21 + "line": 29, + "column": 11 } } }, @@ -2042,121 +7593,129 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 115, - "end": 119, + "value": "_color", + "start": 842, + "end": 848, "loc": { "start": { - "line": 4, - "column": 22 + "line": 29, + "column": 11 }, "end": { - "line": 4, - "column": 26 + "line": 29, + "column": 17 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "./delete_case5.js", - "start": 120, - "end": 139, + "value": "===", + "start": 849, + "end": 852, "loc": { "start": { - "line": 4, - "column": 27 + "line": 29, + "column": 18 }, "end": { - "line": 4, - "column": 46 + "line": 29, + "column": 21 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 139, - "end": 140, + "value": "RED", + "start": 853, + "end": 856, "loc": { "start": { - "line": 4, - "column": 46 + "line": 29, + "column": 22 }, "end": { - "line": 4, - "column": 47 + "line": 29, + "column": 25 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n ", - "start": 142, - "end": 473, + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 857, + "end": 859, "loc": { "start": { - "line": 6, - "column": 0 + "line": 29, + "column": 26 }, "end": { - "line": 16, - "column": 3 + "line": 29, + "column": 28 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 474, - "end": 480, + "value": "s", + "start": 860, + "end": 861, "loc": { "start": { - "line": 17, - "column": 0 + "line": 29, + "column": 29 }, "end": { - "line": 17, - "column": 6 + "line": 29, + "column": 30 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2167,17 +7726,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 481, - "end": 486, + "start": 861, + "end": 862, "loc": { "start": { - "line": 17, - "column": 7 + "line": 29, + "column": 30 }, "end": { - "line": 17, - "column": 12 + "line": 29, + "column": 31 } } }, @@ -2193,51 +7751,50 @@ "postfix": false, "binop": null }, - "value": "delete_case4", - "start": 487, - "end": 499, + "value": "left", + "start": 862, + "end": 866, "loc": { "start": { - "line": 17, - "column": 13 + "line": 29, + "column": 31 }, "end": { - "line": 17, - "column": 25 + "line": 29, + "column": 35 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 500, - "end": 501, + "start": 866, + "end": 867, "loc": { "start": { - "line": 17, - "column": 26 + "line": 29, + "column": 35 }, "end": { - "line": 17, - "column": 27 + "line": 29, + "column": 36 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2246,50 +7803,52 @@ "postfix": false, "binop": null }, - "start": 502, - "end": 503, + "value": "_color", + "start": 867, + "end": 873, "loc": { "start": { - "line": 17, - "column": 28 + "line": 29, + "column": 36 }, "end": { - "line": 17, - "column": 29 + "line": 29, + "column": 42 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "n", - "start": 503, - "end": 504, + "value": "===", + "start": 874, + "end": 877, "loc": { "start": { - "line": 17, - "column": 29 + "line": 29, + "column": 43 }, "end": { - "line": 17, - "column": 30 + "line": 29, + "column": 46 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2297,22 +7856,23 @@ "postfix": false, "binop": null }, - "start": 504, - "end": 505, + "value": "RED", + "start": 878, + "end": 881, "loc": { "start": { - "line": 17, - "column": 30 + "line": 29, + "column": 47 }, "end": { - "line": 17, - "column": 31 + "line": 29, + "column": 50 } } }, { "type": { - "label": "=>", + "label": "||", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2320,26 +7880,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "start": 506, - "end": 508, + "value": "||", + "start": 882, + "end": 884, "loc": { "start": { - "line": 17, - "column": 32 + "line": 29, + "column": 51 }, "end": { - "line": 17, - "column": 34 + "line": 29, + "column": 53 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2348,23 +7909,23 @@ "postfix": false, "binop": null }, - "start": 509, - "end": 510, + "value": "s", + "start": 885, + "end": 886, "loc": { "start": { - "line": 17, - "column": 35 + "line": 29, + "column": 54 }, "end": { - "line": 17, - "column": 36 + "line": 29, + "column": 55 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2375,17 +7936,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 512, - "end": 517, + "start": 886, + "end": 887, "loc": { "start": { - "line": 18, - "column": 1 + "line": 29, + "column": 55 }, "end": { - "line": 18, - "column": 6 + "line": 29, + "column": 56 } } }, @@ -2401,44 +7961,43 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 518, - "end": 519, + "value": "right", + "start": 887, + "end": 892, "loc": { "start": { - "line": 18, - "column": 7 + "line": 29, + "column": 56 }, "end": { - "line": 18, - "column": 8 + "line": 29, + "column": 61 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 520, - "end": 521, + "start": 892, + "end": 893, "loc": { "start": { - "line": 18, - "column": 9 + "line": 29, + "column": 61 }, "end": { - "line": 18, - "column": 10 + "line": 29, + "column": 62 } } }, @@ -2454,42 +8013,44 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 522, - "end": 529, + "value": "_color", + "start": 893, + "end": 899, "loc": { "start": { - "line": 18, - "column": 11 + "line": 29, + "column": 62 }, "end": { - "line": 18, - "column": 18 + "line": 29, + "column": 68 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 529, - "end": 530, + "value": "===", + "start": 900, + "end": 903, "loc": { "start": { - "line": 18, - "column": 18 + "line": 29, + "column": 69 }, "end": { - "line": 18, - "column": 19 + "line": 29, + "column": 72 } } }, @@ -2505,17 +8066,43 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 530, - "end": 531, + "value": "RED", + "start": 904, + "end": 907, "loc": { "start": { - "line": 18, - "column": 19 + "line": 29, + "column": 73 }, "end": { - "line": 18, - "column": 20 + "line": 29, + "column": 76 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 907, + "end": 908, + "loc": { + "start": { + "line": 29, + "column": 76 + }, + "end": { + "line": 29, + "column": 77 } } }, @@ -2531,16 +8118,16 @@ "postfix": false, "binop": null }, - "start": 531, - "end": 532, + "start": 910, + "end": 911, "loc": { "start": { - "line": 18, - "column": 20 + "line": 30, + "column": 1 }, "end": { - "line": 18, - "column": 21 + "line": 30, + "column": 2 } } }, @@ -2557,31 +8144,31 @@ "binop": null, "updateContext": null }, - "start": 532, - "end": 533, + "start": 911, + "end": 912, "loc": { "start": { - "line": 18, - "column": 21 + "line": 30, + "column": 2 }, "end": { - "line": 18, - "column": 22 + "line": 30, + "column": 3 } } }, { "type": "CommentBlock", "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 536, - "end": 1164, + "start": 915, + "end": 1543, "loc": { "start": { - "line": 20, + "line": 32, "column": 1 }, "end": { - "line": 33, + "line": 45, "column": 4 } } @@ -2601,15 +8188,15 @@ "updateContext": null }, "value": "if", - "start": 1166, - "end": 1168, + "start": 1545, + "end": 1547, "loc": { "start": { - "line": 34, + "line": 46, "column": 1 }, "end": { - "line": 34, + "line": 46, "column": 3 } } @@ -2626,15 +8213,15 @@ "postfix": false, "binop": null }, - "start": 1169, - "end": 1170, + "start": 1548, + "end": 1549, "loc": { "start": { - "line": 34, + "line": 46, "column": 4 }, "end": { - "line": 34, + "line": 46, "column": 5 } } @@ -2642,15 +8229,15 @@ { "type": "CommentLine", "value": " The parent color test is always true when coming from case 2", - "start": 1173, - "end": 1236, + "start": 1552, + "end": 1615, "loc": { "start": { - "line": 35, + "line": 47, "column": 2 }, "end": { - "line": 35, + "line": 47, "column": 65 } } @@ -2668,15 +8255,15 @@ "binop": null }, "value": "n", - "start": 1239, - "end": 1240, + "start": 1618, + "end": 1619, "loc": { "start": { - "line": 36, + "line": 48, "column": 2 }, "end": { - "line": 36, + "line": 48, "column": 3 } } @@ -2694,15 +8281,15 @@ "binop": null, "updateContext": null }, - "start": 1240, - "end": 1241, + "start": 1619, + "end": 1620, "loc": { "start": { - "line": 36, + "line": 48, "column": 3 }, "end": { - "line": 36, + "line": 48, "column": 4 } } @@ -2720,15 +8307,15 @@ "binop": null }, "value": "parent", - "start": 1241, - "end": 1247, + "start": 1620, + "end": 1626, "loc": { "start": { - "line": 36, + "line": 48, "column": 4 }, "end": { - "line": 36, + "line": 48, "column": 10 } } @@ -2746,15 +8333,15 @@ "binop": null, "updateContext": null }, - "start": 1247, - "end": 1248, + "start": 1626, + "end": 1627, "loc": { "start": { - "line": 36, + "line": 48, "column": 10 }, "end": { - "line": 36, + "line": 48, "column": 11 } } @@ -2772,15 +8359,15 @@ "binop": null }, "value": "_color", - "start": 1248, - "end": 1254, + "start": 1627, + "end": 1633, "loc": { "start": { - "line": 36, + "line": 48, "column": 11 }, "end": { - "line": 36, + "line": 48, "column": 17 } } @@ -2799,15 +8386,15 @@ "updateContext": null }, "value": "===", - "start": 1255, - "end": 1258, + "start": 1634, + "end": 1637, "loc": { "start": { - "line": 36, + "line": 48, "column": 18 }, "end": { - "line": 36, + "line": 48, "column": 21 } } @@ -2825,15 +8412,15 @@ "binop": null }, "value": "RED", - "start": 1259, - "end": 1262, + "start": 1638, + "end": 1641, "loc": { "start": { - "line": 36, + "line": 48, "column": 22 }, "end": { - "line": 36, + "line": 48, "column": 25 } } @@ -2852,15 +8439,15 @@ "updateContext": null }, "value": "&&", - "start": 1263, - "end": 1265, + "start": 1642, + "end": 1644, "loc": { "start": { - "line": 36, + "line": 48, "column": 26 }, "end": { - "line": 36, + "line": 48, "column": 28 } } @@ -2878,15 +8465,15 @@ "binop": null }, "value": "s", - "start": 1268, - "end": 1269, + "start": 1647, + "end": 1648, "loc": { "start": { - "line": 37, + "line": 49, "column": 2 }, "end": { - "line": 37, + "line": 49, "column": 3 } } @@ -2904,15 +8491,15 @@ "binop": null, "updateContext": null }, - "start": 1269, - "end": 1270, + "start": 1648, + "end": 1649, "loc": { "start": { - "line": 37, + "line": 49, "column": 3 }, "end": { - "line": 37, + "line": 49, "column": 4 } } @@ -2930,15 +8517,15 @@ "binop": null }, "value": "left", - "start": 1270, - "end": 1274, + "start": 1649, + "end": 1653, "loc": { "start": { - "line": 37, + "line": 49, "column": 4 }, "end": { - "line": 37, + "line": 49, "column": 8 } } @@ -2956,15 +8543,15 @@ "binop": null, "updateContext": null }, - "start": 1274, - "end": 1275, + "start": 1653, + "end": 1654, "loc": { "start": { - "line": 37, + "line": 49, "column": 8 }, "end": { - "line": 37, + "line": 49, "column": 9 } } @@ -2982,15 +8569,15 @@ "binop": null }, "value": "_color", - "start": 1275, - "end": 1281, + "start": 1654, + "end": 1660, "loc": { "start": { - "line": 37, + "line": 49, "column": 9 }, "end": { - "line": 37, + "line": 49, "column": 15 } } @@ -3009,15 +8596,15 @@ "updateContext": null }, "value": "===", - "start": 1282, - "end": 1285, + "start": 1661, + "end": 1664, "loc": { "start": { - "line": 37, + "line": 49, "column": 16 }, "end": { - "line": 37, + "line": 49, "column": 19 } } @@ -3035,15 +8622,15 @@ "binop": null }, "value": "BLACK", - "start": 1286, - "end": 1291, + "start": 1665, + "end": 1670, "loc": { "start": { - "line": 37, + "line": 49, "column": 20 }, "end": { - "line": 37, + "line": 49, "column": 25 } } @@ -3062,15 +8649,15 @@ "updateContext": null }, "value": "&&", - "start": 1292, - "end": 1294, + "start": 1671, + "end": 1673, "loc": { "start": { - "line": 37, + "line": 49, "column": 26 }, "end": { - "line": 37, + "line": 49, "column": 28 } } @@ -3088,15 +8675,15 @@ "binop": null }, "value": "s", - "start": 1297, - "end": 1298, + "start": 1676, + "end": 1677, "loc": { "start": { - "line": 38, + "line": 50, "column": 2 }, "end": { - "line": 38, + "line": 50, "column": 3 } } @@ -3114,15 +8701,15 @@ "binop": null, "updateContext": null }, - "start": 1298, - "end": 1299, + "start": 1677, + "end": 1678, "loc": { "start": { - "line": 38, + "line": 50, "column": 3 }, "end": { - "line": 38, + "line": 50, "column": 4 } } @@ -3140,15 +8727,15 @@ "binop": null }, "value": "right", - "start": 1299, - "end": 1304, + "start": 1678, + "end": 1683, "loc": { "start": { - "line": 38, + "line": 50, "column": 4 }, "end": { - "line": 38, + "line": 50, "column": 9 } } @@ -3166,15 +8753,15 @@ "binop": null, "updateContext": null }, - "start": 1304, - "end": 1305, + "start": 1683, + "end": 1684, "loc": { "start": { - "line": 38, + "line": 50, "column": 9 }, "end": { - "line": 38, + "line": 50, "column": 10 } } @@ -3192,15 +8779,15 @@ "binop": null }, "value": "_color", - "start": 1305, - "end": 1311, + "start": 1684, + "end": 1690, "loc": { "start": { - "line": 38, + "line": 50, "column": 10 }, "end": { - "line": 38, + "line": 50, "column": 16 } } @@ -3219,15 +8806,15 @@ "updateContext": null }, "value": "===", - "start": 1312, - "end": 1315, + "start": 1691, + "end": 1694, "loc": { "start": { - "line": 38, + "line": 50, "column": 17 }, "end": { - "line": 38, + "line": 50, "column": 20 } } @@ -3245,15 +8832,15 @@ "binop": null }, "value": "BLACK", - "start": 1316, - "end": 1321, + "start": 1695, + "end": 1700, "loc": { "start": { - "line": 38, + "line": 50, "column": 21 }, "end": { - "line": 38, + "line": 50, "column": 26 } } @@ -3270,15 +8857,15 @@ "postfix": false, "binop": null }, - "start": 1323, - "end": 1324, + "start": 1702, + "end": 1703, "loc": { "start": { - "line": 39, + "line": 51, "column": 1 }, "end": { - "line": 39, + "line": 51, "column": 2 } } @@ -3295,15 +8882,15 @@ "postfix": false, "binop": null }, - "start": 1325, - "end": 1326, + "start": 1704, + "end": 1705, "loc": { "start": { - "line": 39, + "line": 51, "column": 3 }, "end": { - "line": 39, + "line": 51, "column": 4 } } @@ -3321,15 +8908,15 @@ "binop": null }, "value": "s", - "start": 1329, - "end": 1330, + "start": 1708, + "end": 1709, "loc": { "start": { - "line": 40, + "line": 52, "column": 2 }, "end": { - "line": 40, + "line": 52, "column": 3 } } @@ -3347,15 +8934,15 @@ "binop": null, "updateContext": null }, - "start": 1330, - "end": 1331, + "start": 1709, + "end": 1710, "loc": { "start": { - "line": 40, + "line": 52, "column": 3 }, "end": { - "line": 40, + "line": 52, "column": 4 } } @@ -3373,15 +8960,15 @@ "binop": null }, "value": "_color", - "start": 1331, - "end": 1337, + "start": 1710, + "end": 1716, "loc": { "start": { - "line": 40, + "line": 52, "column": 4 }, "end": { - "line": 40, + "line": 52, "column": 10 } } @@ -3400,15 +8987,15 @@ "updateContext": null }, "value": "=", - "start": 1338, - "end": 1339, + "start": 1717, + "end": 1718, "loc": { "start": { - "line": 40, + "line": 52, "column": 11 }, "end": { - "line": 40, + "line": 52, "column": 12 } } @@ -3426,15 +9013,15 @@ "binop": null }, "value": "RED", - "start": 1340, - "end": 1343, + "start": 1719, + "end": 1722, "loc": { "start": { - "line": 40, + "line": 52, "column": 13 }, "end": { - "line": 40, + "line": 52, "column": 16 } } @@ -3452,15 +9039,15 @@ "binop": null, "updateContext": null }, - "start": 1343, - "end": 1344, + "start": 1722, + "end": 1723, "loc": { "start": { - "line": 40, + "line": 52, "column": 16 }, "end": { - "line": 40, + "line": 52, "column": 17 } } @@ -3478,15 +9065,15 @@ "binop": null }, "value": "n", - "start": 1347, - "end": 1348, + "start": 1726, + "end": 1727, "loc": { "start": { - "line": 41, + "line": 53, "column": 2 }, "end": { - "line": 41, + "line": 53, "column": 3 } } @@ -3504,15 +9091,15 @@ "binop": null, "updateContext": null }, - "start": 1348, - "end": 1349, + "start": 1727, + "end": 1728, "loc": { "start": { - "line": 41, + "line": 53, "column": 3 }, "end": { - "line": 41, + "line": 53, "column": 4 } } @@ -3530,15 +9117,15 @@ "binop": null }, "value": "parent", - "start": 1349, - "end": 1355, + "start": 1728, + "end": 1734, "loc": { "start": { - "line": 41, + "line": 53, "column": 4 }, "end": { - "line": 41, + "line": 53, "column": 10 } } @@ -3556,15 +9143,15 @@ "binop": null, "updateContext": null }, - "start": 1355, - "end": 1356, + "start": 1734, + "end": 1735, "loc": { "start": { - "line": 41, + "line": 53, "column": 10 }, "end": { - "line": 41, + "line": 53, "column": 11 } } @@ -3582,15 +9169,15 @@ "binop": null }, "value": "_color", - "start": 1356, - "end": 1362, + "start": 1735, + "end": 1741, "loc": { "start": { - "line": 41, + "line": 53, "column": 11 }, "end": { - "line": 41, + "line": 53, "column": 17 } } @@ -3609,15 +9196,15 @@ "updateContext": null }, "value": "=", - "start": 1363, - "end": 1364, + "start": 1742, + "end": 1743, "loc": { "start": { - "line": 41, + "line": 53, "column": 18 }, "end": { - "line": 41, + "line": 53, "column": 19 } } @@ -3635,15 +9222,15 @@ "binop": null }, "value": "BLACK", - "start": 1365, - "end": 1370, + "start": 1744, + "end": 1749, "loc": { "start": { - "line": 41, + "line": 53, "column": 20 }, "end": { - "line": 41, + "line": 53, "column": 25 } } @@ -3661,15 +9248,15 @@ "binop": null, "updateContext": null }, - "start": 1370, - "end": 1371, + "start": 1749, + "end": 1750, "loc": { "start": { - "line": 41, + "line": 53, "column": 25 }, "end": { - "line": 41, + "line": 53, "column": 26 } } @@ -3686,15 +9273,15 @@ "postfix": false, "binop": null }, - "start": 1373, - "end": 1374, + "start": 1752, + "end": 1753, "loc": { "start": { - "line": 42, + "line": 54, "column": 1 }, "end": { - "line": 42, + "line": 54, "column": 2 } } @@ -3702,15 +9289,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 5.", - "start": 1377, - "end": 1404, + "start": 1756, + "end": 1783, "loc": { "start": { - "line": 44, + "line": 56, "column": 1 }, "end": { - "line": 44, + "line": 56, "column": 28 } } @@ -3730,15 +9317,15 @@ "updateContext": null }, "value": "else", - "start": 1406, - "end": 1410, + "start": 1785, + "end": 1789, "loc": { "start": { - "line": 45, + "line": 57, "column": 1 }, "end": { - "line": 45, + "line": 57, "column": 5 } } @@ -3756,15 +9343,15 @@ "binop": null }, "value": "delete_case5", - "start": 1411, - "end": 1423, + "start": 1790, + "end": 1802, "loc": { "start": { - "line": 45, + "line": 57, "column": 6 }, "end": { - "line": 45, + "line": 57, "column": 18 } } @@ -3781,15 +9368,15 @@ "postfix": false, "binop": null }, - "start": 1423, - "end": 1424, + "start": 1802, + "end": 1803, "loc": { "start": { - "line": 45, + "line": 57, "column": 18 }, "end": { - "line": 45, + "line": 57, "column": 19 } } @@ -3807,15 +9394,15 @@ "binop": null }, "value": "n", - "start": 1424, - "end": 1425, + "start": 1803, + "end": 1804, "loc": { "start": { - "line": 45, + "line": 57, "column": 19 }, "end": { - "line": 45, + "line": 57, "column": 20 } } @@ -3832,15 +9419,15 @@ "postfix": false, "binop": null }, - "start": 1425, - "end": 1426, + "start": 1804, + "end": 1805, "loc": { "start": { - "line": 45, + "line": 57, "column": 20 }, "end": { - "line": 45, + "line": 57, "column": 21 } } @@ -3858,15 +9445,15 @@ "binop": null, "updateContext": null }, - "start": 1426, - "end": 1427, + "start": 1805, + "end": 1806, "loc": { "start": { - "line": 45, + "line": 57, "column": 21 }, "end": { - "line": 45, + "line": 57, "column": 22 } } @@ -3883,15 +9470,15 @@ "postfix": false, "binop": null }, - "start": 1428, - "end": 1429, + "start": 1807, + "end": 1808, "loc": { "start": { - "line": 46, + "line": 58, "column": 0 }, "end": { - "line": 46, + "line": 58, "column": 1 } } @@ -3909,19 +9496,127 @@ "binop": null, "updateContext": null }, - "start": 1429, - "end": 1430, + "start": 1808, + "end": 1809, "loc": { "start": { - "line": 46, + "line": 58, "column": 1 }, "end": { - "line": 46, + "line": 58, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1811, + "end": 1817, + "loc": { + "start": { + "line": 60, + "column": 0 + }, + "end": { + "line": 60, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1818, + "end": 1825, + "loc": { + "start": { + "line": 60, + "column": 7 + }, + "end": { + "line": 60, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case4", + "start": 1826, + "end": 1838, + "loc": { + "start": { + "line": 60, + "column": 15 + }, + "end": { + "line": 60, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1838, + "end": 1839, + "loc": { + "start": { + "line": 60, + "column": 27 + }, + "end": { + "line": 60, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -3935,15 +9630,15 @@ "binop": null, "updateContext": null }, - "start": 1431, - "end": 1431, + "start": 1840, + "end": 1840, "loc": { "start": { - "line": 47, + "line": 61, "column": 0 }, "end": { - "line": 47, + "line": 61, "column": 0 } } diff --git a/ast/source/deletion/delete_case5.js.json b/ast/source/deletion/delete_case5.js.json index aee3d40..68f4687 100644 --- a/ast/source/deletion/delete_case5.js.json +++ b/ast/source/deletion/delete_case5.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1839, + "end": 2259, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 59, + "line": 72, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1839, + "end": 2259, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 59, + "line": 72, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 45, + "end": 28, "loc": { "start": { "line": 1, @@ -39,134 +39,68 @@ }, "end": { "line": 1, - "column": 45 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { - "type": "Identifier", - "start": 8, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - { - "type": "ImportSpecifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - } - }, - "imported": { - "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "RED" - }, - "name": "RED" - }, - "local": { - "type": "Identifier", - "start": 15, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 15 - }, - "end": { - "line": 1, - "column": 18 - }, - "identifierName": "RED" + "identifierName": "assert" }, - "name": "RED" + "name": "assert" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 44, + "start": 19, + "end": 27, "loc": { "start": { "line": 1, - "column": 25 + "column": 19 }, "end": { "line": 1, - "column": 44 + "column": 27 } }, "extra": { - "rawValue": "../color/index.js", - "raw": "'../color/index.js'" + "rawValue": "assert", + "raw": "'assert'" }, - "value": "../color/index.js" + "value": "assert" } }, { "type": "ImportDeclaration", - "start": 46, - "end": 107, + "start": 29, + "end": 67, "loc": { "start": { "line": 2, @@ -174,220 +108,206 @@ }, "end": { "line": 2, - "column": 61 + "column": 38 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 54, - "end": 65, + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, "loc": { "start": { "line": 2, - "column": 8 + "column": 7 }, "end": { "line": 2, - "column": 19 + "column": 12 } }, - "imported": { - "type": "Identifier", - "start": 54, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, "local": { "type": "Identifier", - "start": 54, - "end": 65, + "start": 36, + "end": 41, "loc": { "start": { "line": 2, - "column": 8 + "column": 7 }, "end": { "line": 2, - "column": 19 + "column": 12 }, - "identifierName": "rotate_left" + "identifierName": "BLACK" }, - "name": "rotate_left" + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 } }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 68, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 34 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 67, - "end": 79, + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 78, "loc": { "start": { - "line": 2, - "column": 21 + "line": 3, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 3, + "column": 10 } }, - "imported": { - "type": "Identifier", - "start": 67, - "end": 79, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 33 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - }, "local": { "type": "Identifier", - "start": 67, - "end": 79, + "start": 75, + "end": 78, "loc": { "start": { - "line": 2, - "column": 21 + "line": 3, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 3, + "column": 10 }, - "identifierName": "rotate_right" + "identifierName": "RED" }, - "name": "rotate_right" + "name": "RED" } } ], "source": { "type": "StringLiteral", - "start": 86, - "end": 106, + "start": 84, + "end": 101, "loc": { "start": { - "line": 2, - "column": 40 + "line": 3, + "column": 16 }, "end": { - "line": 2, - "column": 60 + "line": 3, + "column": 33 } }, "extra": { - "rawValue": "../rotate/index.js", - "raw": "'../rotate/index.js'" + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" }, - "value": "../rotate/index.js" + "value": "../color/RED.js" } }, { "type": "ImportDeclaration", - "start": 108, - "end": 153, + "start": 103, + "end": 139, "loc": { "start": { - "line": 3, + "line": 4, "column": 0 }, "end": { - "line": 3, - "column": 45 + "line": 4, + "column": 36 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 116, - "end": 123, + "type": "ImportDefaultSpecifier", + "start": 110, + "end": 114, "loc": { "start": { - "line": 3, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 3, - "column": 15 + "line": 4, + "column": 11 } }, - "imported": { - "type": "Identifier", - "start": 116, - "end": 123, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 15 - }, - "identifierName": "sibling" - }, - "name": "sibling" - }, "local": { "type": "Identifier", - "start": 116, - "end": 123, + "start": 110, + "end": 114, "loc": { "start": { - "line": 3, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 3, - "column": 15 + "line": 4, + "column": 11 }, - "identifierName": "sibling" + "identifierName": "Node" }, - "name": "sibling" + "name": "Node" } } ], "source": { "type": "StringLiteral", - "start": 130, - "end": 152, + "start": 120, + "end": 138, "loc": { "start": { - "line": 3, - "column": 22 + "line": 4, + "column": 17 }, "end": { - "line": 3, - "column": 44 + "line": 4, + "column": 35 } }, "extra": { - "rawValue": "../family/sibling.js", - "raw": "'../family/sibling.js'" + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" }, - "value": "../family/sibling.js" + "value": "../types/Node.js" } }, { "type": "ImportDeclaration", - "start": 155, - "end": 202, + "start": 140, + "end": 176, "loc": { "start": { "line": 5, @@ -395,635 +315,1187 @@ }, "end": { "line": 5, - "column": 47 + "column": 36 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 163, - "end": 175, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 151, "loc": { "start": { "line": 5, - "column": 8 + "column": 7 }, "end": { "line": 5, - "column": 20 + "column": 11 } }, - "imported": { - "type": "Identifier", - "start": 163, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 20 - }, - "identifierName": "delete_case6" - }, - "name": "delete_case6" - }, "local": { "type": "Identifier", - "start": 163, - "end": 175, + "start": 147, + "end": 151, "loc": { "start": { "line": 5, - "column": 8 + "column": 7 }, "end": { "line": 5, - "column": 20 + "column": 11 }, - "identifierName": "delete_case6" + "identifierName": "Leaf" }, - "name": "delete_case6" + "name": "Leaf" } } ], "source": { "type": "StringLiteral", - "start": 182, - "end": 201, + "start": 157, + "end": 175, "loc": { "start": { "line": 5, - "column": 27 + "column": 17 }, "end": { "line": 5, - "column": 46 + "column": 35 } }, "extra": { - "rawValue": "./delete_case6.js", - "raw": "'./delete_case6.js'" + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" }, - "value": "./delete_case6.js" + "value": "../types/Leaf.js" + } + }, + { + "type": "ImportDeclaration", + "start": 177, + "end": 228, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 51 + } }, - "trailingComments": [ + "specifiers": [ { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", - "start": 204, - "end": 523, + "type": "ImportDefaultSpecifier", + "start": 184, + "end": 195, "loc": { "start": { - "line": 7, - "column": 0 + "line": 6, + "column": 7 }, "end": { - "line": 17, - "column": 3 + "line": 6, + "column": 18 } + }, + "local": { + "type": "Identifier", + "start": 184, + "end": 195, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" } } - ] + ], + "source": { + "type": "StringLiteral", + "start": 201, + "end": 227, + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 50 + } + }, + "extra": { + "rawValue": "../rotate/rotate_left.js", + "raw": "'../rotate/rotate_left.js'" + }, + "value": "../rotate/rotate_left.js" + } }, { - "type": "ExportNamedDeclaration", - "start": 524, - "end": 1838, + "type": "ImportDeclaration", + "start": 229, + "end": 282, "loc": { "start": { - "line": 18, + "line": 7, "column": 0 }, "end": { - "line": 58, - "column": 2 + "line": 7, + "column": 53 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 531, - "end": 1838, - "loc": { - "start": { - "line": 18, - "column": 7 + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 236, + "end": 248, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } }, - "end": { - "line": 58, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 537, - "end": 1837, + "local": { + "type": "Identifier", + "start": 236, + "end": 248, "loc": { "start": { - "line": 18, - "column": 13 + "line": 7, + "column": 7 }, "end": { - "line": 58, - "column": 1 - } + "line": 7, + "column": 19 + }, + "identifierName": "rotate_right" }, - "id": { - "type": "Identifier", - "start": 537, - "end": 549, - "loc": { - "start": { - "line": 18, - "column": 13 - }, - "end": { - "line": 18, - "column": 25 - }, - "identifierName": "delete_case5" + "name": "rotate_right" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 254, + "end": 281, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 52 + } + }, + "extra": { + "rawValue": "../rotate/rotate_right.js", + "raw": "'../rotate/rotate_right.js'" + }, + "value": "../rotate/rotate_right.js" + } + }, + { + "type": "ImportDeclaration", + "start": 283, + "end": 326, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 43 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 290, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + }, + "local": { + "type": "Identifier", + "start": 290, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 }, - "name": "delete_case5", - "leadingComments": null + "end": { + "line": 8, + "column": 14 + }, + "identifierName": "sibling" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 552, - "end": 1837, - "loc": { - "start": { - "line": 18, - "column": 28 - }, - "end": { - "line": 58, - "column": 1 - } + "name": "sibling" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 303, + "end": 325, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 42 + } + }, + "extra": { + "rawValue": "../family/sibling.js", + "raw": "'../family/sibling.js'" + }, + "value": "../family/sibling.js" + } + }, + { + "type": "ImportDeclaration", + "start": 328, + "end": 373, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 335, + "end": 347, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 335, + "end": 347, + "loc": { + "start": { + "line": 10, + "column": 7 }, - "id": { + "end": { + "line": 10, + "column": 19 + }, + "identifierName": "delete_case6" + }, + "name": "delete_case6" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 353, + "end": 372, + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 44 + } + }, + "extra": { + "rawValue": "./delete_case6.js", + "raw": "'./delete_case6.js'" + }, + "value": "./delete_case6.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 375, + "end": 699, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 700, + "end": 2228, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 69, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 706, + "end": 2227, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 69, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 706, + "end": 718, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 18 + }, + "identifierName": "delete_case5" + }, + "name": "delete_case5", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 721, + "end": 2227, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 69, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 537, - "end": 549, + "start": 722, + "end": 723, "loc": { "start": { - "line": 18, - "column": 13 + "line": 23, + "column": 22 }, "end": { - "line": 18, - "column": 25 + "line": 23, + "column": 23 }, - "identifierName": "delete_case5" + "identifierName": "n" }, - "name": "delete_case5", - "leadingComments": null + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 728, + "end": 2227, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 69, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 553, - "end": 554, + "type": "ExpressionStatement", + "start": 731, + "end": 778, "loc": { "start": { - "line": 18, - "column": 29 + "line": 24, + "column": 1 }, "end": { - "line": 18, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 559, - "end": 1837, - "loc": { - "start": { - "line": 18, - "column": 35 + "line": 24, + "column": 48 + } }, - "end": { - "line": 58, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 562, - "end": 583, + "expression": { + "type": "CallExpression", + "start": 731, + "end": 777, "loc": { "start": { - "line": 19, + "line": 24, "column": 1 }, "end": { - "line": 19, - "column": 22 + "line": 24, + "column": 47 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 731, + "end": 737, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 568, - "end": 582, + "type": "LogicalExpression", + "start": 738, + "end": 776, "loc": { "start": { - "line": 19, - "column": 7 + "line": 24, + "column": 8 }, "end": { - "line": 19, - "column": 21 + "line": 24, + "column": 46 } }, - "id": { - "type": "Identifier", - "start": 568, - "end": 569, + "left": { + "type": "BinaryExpression", + "start": 738, + "end": 755, "loc": { "start": { - "line": 19, - "column": 7 - }, - "end": { - "line": 19, + "line": 24, "column": 8 }, - "identifierName": "s" - }, - "name": "s" - }, - "init": { - "type": "CallExpression", - "start": 572, - "end": 582, - "loc": { - "start": { - "line": 19, - "column": 11 - }, "end": { - "line": 19, - "column": 21 + "line": 24, + "column": 25 } }, - "callee": { + "left": { "type": "Identifier", - "start": 572, - "end": 579, + "start": 738, + "end": 739, "loc": { "start": { - "line": 19, - "column": 11 + "line": 24, + "column": 8 }, "end": { - "line": 19, - "column": 18 + "line": 24, + "column": 9 }, - "identifierName": "sibling" + "identifierName": "n" }, - "name": "sibling" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 580, - "end": 581, - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 20 - }, - "identifierName": "n" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 751, + "end": 755, + "loc": { + "start": { + "line": 24, + "column": 21 }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 586, - "end": 659, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 661, - "end": 732, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 72 + "end": { + "line": 24, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" } - } - }, - { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 734, - "end": 759, - "loc": { - "start": { - "line": 23, - "column": 1 + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 759, + "end": 776, + "loc": { + "start": { + "line": 24, + "column": 29 + }, + "end": { + "line": 24, + "column": 46 + } }, - "end": { - "line": 23, - "column": 26 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 762, - "end": 1194, - "loc": { - "start": { - "line": 25, - "column": 1 + "left": { + "type": "Identifier", + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 29 + }, + "end": { + "line": 24, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" }, - "end": { - "line": 35, - "column": 4 + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 772, + "end": 776, + "loc": { + "start": { + "line": 24, + "column": 42 + }, + "end": { + "line": 24, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" } } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 780, + "end": 807, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 28 + } }, - { - "type": "IfStatement", - "start": 1196, - "end": 1816, + "expression": { + "type": "CallExpression", + "start": 780, + "end": 806, "loc": { "start": { - "line": 36, + "line": 25, "column": 1 }, "end": { - "line": 55, - "column": 2 + "line": 25, + "column": 27 } }, - "test": { - "type": "LogicalExpression", - "start": 1200, - "end": 1247, + "callee": { + "type": "Identifier", + "start": 780, + "end": 786, "loc": { "start": { - "line": 36, - "column": 5 + "line": 25, + "column": 1 }, "end": { - "line": 36, - "column": 52 - } + "line": 25, + "column": 7 + }, + "identifierName": "assert" }, - "left": { + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 1200, - "end": 1219, + "start": 787, + "end": 805, "loc": { "start": { - "line": 36, - "column": 5 + "line": 25, + "column": 8 }, "end": { - "line": 36, - "column": 24 + "line": 25, + "column": 26 } }, "left": { - "type": "Identifier", - "start": 1200, - "end": 1201, - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "operator": "===", - "right": { "type": "MemberExpression", - "start": 1206, - "end": 1219, + "start": 787, + "end": 795, "loc": { "start": { - "line": 36, - "column": 11 + "line": 25, + "column": 8 }, "end": { - "line": 36, - "column": 24 + "line": 25, + "column": 16 } }, "object": { - "type": "MemberExpression", - "start": 1206, - "end": 1214, + "type": "Identifier", + "start": 787, + "end": 788, "loc": { "start": { - "line": 36, - "column": 11 + "line": 25, + "column": 8 }, "end": { - "line": 36, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 1206, - "end": 1207, - "loc": { - "start": { - "line": 36, - "column": 11 - }, - "end": { - "line": 36, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1208, - "end": 1214, - "loc": { - "start": { - "line": 36, - "column": 13 - }, - "end": { - "line": 36, - "column": 19 - }, - "identifierName": "parent" + "line": 25, + "column": 9 }, - "name": "parent" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1215, - "end": 1219, + "start": 789, + "end": 795, "loc": { "start": { - "line": 36, - "column": 20 + "line": 25, + "column": 10 }, "end": { - "line": 36, - "column": 24 + "line": 25, + "column": 16 }, - "identifierName": "left" + "identifierName": "_color" }, - "name": "left" + "name": "_color" }, "computed": false }, - "leadingComments": null + "operator": "===", + "right": { + "type": "Identifier", + "start": 800, + "end": 805, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 809, + "end": 835, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 809, + "end": 834, + "loc": { + "start": { + "line": 26, + "column": 1 }, - "operator": "&&", - "right": { + "end": { + "line": 26, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 809, + "end": 815, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 1223, - "end": 1247, + "start": 816, + "end": 833, "loc": { "start": { - "line": 36, - "column": 28 + "line": 26, + "column": 8 }, "end": { - "line": 36, - "column": 52 + "line": 26, + "column": 25 } }, "left": { "type": "MemberExpression", - "start": 1223, - "end": 1237, + "start": 816, + "end": 824, "loc": { "start": { - "line": 36, - "column": 28 + "line": 26, + "column": 8 }, "end": { - "line": 36, - "column": 42 + "line": 26, + "column": 16 } }, "object": { - "type": "MemberExpression", - "start": 1223, - "end": 1230, + "type": "Identifier", + "start": 816, + "end": 817, "loc": { "start": { - "line": 36, - "column": 28 + "line": 26, + "column": 8 }, "end": { - "line": 36, - "column": 35 - } + "line": 26, + "column": 9 + }, + "identifierName": "n" }, - "object": { - "type": "Identifier", - "start": 1223, - "end": 1224, - "loc": { - "start": { - "line": 36, - "column": 28 - }, - "end": { - "line": 36, - "column": 29 - }, - "identifierName": "s" + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 818, + "end": 824, + "loc": { + "start": { + "line": 26, + "column": 10 }, - "name": "s" + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "parent" }, - "property": { - "type": "Identifier", - "start": 1225, - "end": 1230, - "loc": { - "start": { - "line": 36, - "column": 30 - }, - "end": { - "line": 36, - "column": 35 - }, - "identifierName": "right" + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 829, + "end": 833, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 837, + "end": 858, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 843, + "end": 857, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 843, + "end": 844, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 847, + "end": 857, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 847, + "end": 854, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 855, + "end": 856, + "loc": { + "start": { + "line": 27, + "column": 19 }, - "name": "right" + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "n" }, - "computed": false + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 860, + "end": 886, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 860, + "end": 885, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 860, + "end": 866, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 867, + "end": 884, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 867, + "end": 868, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 880, + "end": 884, + "loc": { + "start": { + "line": 28, + "column": 21 + }, + "end": { + "line": 28, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 888, + "end": 915, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 888, + "end": 914, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 888, + "end": 894, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 895, + "end": 913, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 895, + "end": 903, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 895, + "end": 896, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" }, "property": { "type": "Identifier", - "start": 1231, - "end": 1237, + "start": 897, + "end": 903, "loc": { "start": { - "line": 36, - "column": 36 + "line": 29, + "column": 10 }, "end": { - "line": 36, - "column": 42 + "line": 29, + "column": 16 }, "identifierName": "_color" }, @@ -1034,94 +1506,139 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1242, - "end": 1247, + "start": 908, + "end": 913, "loc": { "start": { - "line": 36, - "column": 47 + "line": 29, + "column": 21 }, "end": { - "line": 36, - "column": 52 + "line": 29, + "column": 26 }, "identifierName": "BLACK" }, "name": "BLACK" } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 917, + "end": 973, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 57 + } + }, + "expression": { + "type": "CallExpression", + "start": 917, + "end": 972, + "loc": { + "start": { + "line": 30, + "column": 1 }, - "leadingComments": null + "end": { + "line": 30, + "column": 56 + } }, - "consequent": { - "type": "BlockStatement", - "start": 1249, - "end": 1315, + "callee": { + "type": "Identifier", + "start": 917, + "end": 923, "loc": { "start": { - "line": 36, - "column": 54 + "line": 30, + "column": 1 }, "end": { - "line": 40, - "column": 2 - } + "line": 30, + "column": 7 + }, + "identifierName": "assert" }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1253, - "end": 1268, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 924, + "end": 971, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 55 + } + }, + "left": { + "type": "BinaryExpression", + "start": 924, + "end": 945, "loc": { "start": { - "line": 37, - "column": 2 + "line": 30, + "column": 8 }, "end": { - "line": 37, - "column": 17 + "line": 30, + "column": 29 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1253, - "end": 1267, + "left": { + "type": "MemberExpression", + "start": 924, + "end": 937, "loc": { "start": { - "line": 37, - "column": 2 + "line": 30, + "column": 8 }, "end": { - "line": 37, - "column": 16 + "line": 30, + "column": 21 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 1253, - "end": 1261, + "start": 924, + "end": 930, "loc": { "start": { - "line": 37, - "column": 2 + "line": 30, + "column": 8 }, "end": { - "line": 37, - "column": 10 + "line": 30, + "column": 14 } }, "object": { "type": "Identifier", - "start": 1253, - "end": 1254, + "start": 924, + "end": 925, "loc": { "start": { - "line": 37, - "column": 2 + "line": 30, + "column": 8 }, "end": { - "line": 37, - "column": 3 + "line": 30, + "column": 9 }, "identifierName": "s" }, @@ -1129,441 +1646,695 @@ }, "property": { "type": "Identifier", - "start": 1255, - "end": 1261, + "start": 926, + "end": 930, "loc": { "start": { - "line": 37, - "column": 4 + "line": 30, + "column": 10 }, "end": { - "line": 37, - "column": 10 + "line": 30, + "column": 14 }, - "identifierName": "_color" + "identifierName": "left" }, - "name": "_color" + "name": "left" }, "computed": false }, - "right": { + "property": { "type": "Identifier", - "start": 1264, - "end": 1267, + "start": 931, + "end": 937, "loc": { "start": { - "line": 37, - "column": 13 + "line": 30, + "column": 15 }, "end": { - "line": 37, - "column": 16 + "line": 30, + "column": 21 }, - "identifierName": "RED" + "identifierName": "_color" }, - "name": "RED" - } + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 942, + "end": 945, + "loc": { + "start": { + "line": 30, + "column": 26 + }, + "end": { + "line": 30, + "column": 29 + }, + "identifierName": "RED" + }, + "name": "RED" } }, - { - "type": "ExpressionStatement", - "start": 1271, - "end": 1293, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 949, + "end": 971, "loc": { "start": { - "line": 38, - "column": 2 + "line": 30, + "column": 33 }, "end": { - "line": 38, - "column": 24 + "line": 30, + "column": 55 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1271, - "end": 1292, + "left": { + "type": "MemberExpression", + "start": 949, + "end": 963, "loc": { "start": { - "line": 38, - "column": 2 + "line": 30, + "column": 33 }, "end": { - "line": 38, - "column": 23 + "line": 30, + "column": 47 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 1271, - "end": 1284, + "start": 949, + "end": 956, "loc": { "start": { - "line": 38, - "column": 2 + "line": 30, + "column": 33 }, "end": { - "line": 38, - "column": 15 + "line": 30, + "column": 40 } }, "object": { - "type": "MemberExpression", - "start": 1271, - "end": 1277, + "type": "Identifier", + "start": 949, + "end": 950, "loc": { "start": { - "line": 38, - "column": 2 + "line": 30, + "column": 33 }, "end": { - "line": 38, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1271, - "end": 1272, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1273, - "end": 1277, - "loc": { - "start": { - "line": 38, - "column": 4 - }, - "end": { - "line": 38, - "column": 8 - }, - "identifierName": "left" + "line": 30, + "column": 34 }, - "name": "left" + "identifierName": "s" }, - "computed": false + "name": "s" }, "property": { "type": "Identifier", - "start": 1278, - "end": 1284, + "start": 951, + "end": 956, "loc": { "start": { - "line": 38, - "column": 9 + "line": 30, + "column": 35 }, "end": { - "line": 38, - "column": 15 + "line": 30, + "column": 40 }, - "identifierName": "_color" + "identifierName": "right" }, - "name": "_color" + "name": "right" }, "computed": false }, - "right": { + "property": { "type": "Identifier", - "start": 1287, - "end": 1292, + "start": 957, + "end": 963, "loc": { "start": { - "line": 38, - "column": 18 + "line": 30, + "column": 41 }, "end": { - "line": 38, - "column": 23 + "line": 30, + "column": 47 }, - "identifierName": "BLACK" + "identifierName": "_color" }, - "name": "BLACK" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1296, - "end": 1312, - "loc": { - "start": { - "line": 39, - "column": 2 + "name": "_color" }, - "end": { - "line": 39, - "column": 18 - } + "computed": false }, - "expression": { - "type": "CallExpression", - "start": 1296, - "end": 1311, + "operator": "===", + "right": { + "type": "Identifier", + "start": 968, + "end": 971, "loc": { "start": { - "line": 39, - "column": 2 + "line": 30, + "column": 52 }, "end": { - "line": 39, - "column": 17 - } - }, - "callee": { - "type": "Identifier", - "start": 1296, - "end": 1308, - "loc": { - "start": { - "line": 39, - "column": 2 - }, - "end": { - "line": 39, - "column": 14 - }, - "identifierName": "rotate_right" + "line": 30, + "column": 55 }, - "name": "rotate_right" + "identifierName": "RED" }, - "arguments": [ - { - "type": "Identifier", - "start": 1309, - "end": 1310, - "loc": { - "start": { - "line": 39, - "column": 15 - }, - "end": { - "line": 39, - "column": 16 - }, - "identifierName": "s" - }, - "name": "s" - } - ] + "name": "RED" } } - ], - "directives": [] + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " The following statements just force the red n's sibling child to be on", + "start": 976, + "end": 1049, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 74 + } + } }, - "alternate": { - "type": "IfStatement", - "start": 1321, - "end": 1816, + { + "type": "CommentLine", + "value": " the left of the left of the parent, or right of the right, so case 6", + "start": 1051, + "end": 1122, "loc": { "start": { - "line": 40, - "column": 8 + "line": 33, + "column": 1 }, "end": { - "line": 55, - "column": 2 + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " will rotate correctly.", + "start": 1124, + "end": 1149, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 26 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", + "start": 1152, + "end": 1584, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1586, + "end": 2206, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 66, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1590, + "end": 1637, + "loc": { + "start": { + "line": 47, + "column": 5 }, - "test": { - "type": "LogicalExpression", - "start": 1325, - "end": 1372, + "end": { + "line": 47, + "column": 52 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1590, + "end": 1609, + "loc": { + "start": { + "line": 47, + "column": 5 + }, + "end": { + "line": 47, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 1590, + "end": 1591, "loc": { "start": { - "line": 40, - "column": 12 + "line": 47, + "column": 5 }, "end": { - "line": 40, - "column": 59 + "line": 47, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1596, + "end": 1609, + "loc": { + "start": { + "line": 47, + "column": 11 + }, + "end": { + "line": 47, + "column": 24 } }, - "left": { - "type": "BinaryExpression", - "start": 1325, - "end": 1345, + "object": { + "type": "MemberExpression", + "start": 1596, + "end": 1604, "loc": { "start": { - "line": 40, - "column": 12 + "line": 47, + "column": 11 }, "end": { - "line": 40, - "column": 32 + "line": 47, + "column": 19 } }, - "left": { + "object": { "type": "Identifier", - "start": 1325, - "end": 1326, + "start": 1596, + "end": 1597, "loc": { "start": { - "line": 40, - "column": 12 + "line": 47, + "column": 11 }, "end": { - "line": 40, - "column": 13 + "line": 47, + "column": 12 }, "identifierName": "n" }, "name": "n" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1331, - "end": 1345, + "property": { + "type": "Identifier", + "start": 1598, + "end": 1604, "loc": { "start": { - "line": 40, - "column": 18 + "line": 47, + "column": 13 }, "end": { - "line": 40, - "column": 32 - } - }, - "object": { - "type": "MemberExpression", - "start": 1331, - "end": 1339, - "loc": { - "start": { - "line": 40, - "column": 18 - }, - "end": { - "line": 40, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 1331, - "end": 1332, - "loc": { - "start": { - "line": 40, - "column": 18 - }, - "end": { - "line": 40, - "column": 19 - }, - "identifierName": "n" - }, - "name": "n" + "line": 47, + "column": 19 }, - "property": { - "type": "Identifier", - "start": 1333, - "end": 1339, - "loc": { - "start": { - "line": 40, - "column": 20 - }, - "end": { - "line": 40, - "column": 26 - }, - "identifierName": "parent" - }, - "name": "parent" + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1605, + "end": 1609, + "loc": { + "start": { + "line": 47, + "column": 20 + }, + "end": { + "line": 47, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1613, + "end": 1637, + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 52 + } + }, + "left": { + "type": "MemberExpression", + "start": 1613, + "end": 1627, + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 1613, + "end": 1620, + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 1613, + "end": 1614, + "loc": { + "start": { + "line": 47, + "column": 28 }, - "computed": false + "end": { + "line": 47, + "column": 29 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1615, + "end": 1620, + "loc": { + "start": { + "line": 47, + "column": 30 + }, + "end": { + "line": 47, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1621, + "end": 1627, + "loc": { + "start": { + "line": 47, + "column": 36 + }, + "end": { + "line": 47, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1632, + "end": 1637, + "loc": { + "start": { + "line": 47, + "column": 47 + }, + "end": { + "line": 47, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1639, + "end": 1705, + "loc": { + "start": { + "line": 47, + "column": 54 + }, + "end": { + "line": 51, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1643, + "end": 1658, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1643, + "end": 1657, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1643, + "end": 1651, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1643, + "end": 1644, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" }, "property": { "type": "Identifier", - "start": 1340, - "end": 1345, + "start": 1645, + "end": 1651, "loc": { "start": { - "line": 40, - "column": 27 + "line": 48, + "column": 4 }, "end": { - "line": 40, - "column": 32 + "line": 48, + "column": 10 }, - "identifierName": "right" + "identifierName": "_color" }, - "name": "right" + "name": "_color" }, "computed": false + }, + "right": { + "type": "Identifier", + "start": 1654, + "end": 1657, + "loc": { + "start": { + "line": 48, + "column": 13 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1661, + "end": 1683, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 24 } }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1349, - "end": 1372, + "expression": { + "type": "AssignmentExpression", + "start": 1661, + "end": 1682, "loc": { "start": { - "line": 40, - "column": 36 + "line": 49, + "column": 2 }, "end": { - "line": 40, - "column": 59 + "line": 49, + "column": 23 } }, + "operator": "=", "left": { "type": "MemberExpression", - "start": 1349, - "end": 1362, + "start": 1661, + "end": 1674, "loc": { "start": { - "line": 40, - "column": 36 + "line": 49, + "column": 2 }, "end": { - "line": 40, - "column": 49 + "line": 49, + "column": 15 } }, "object": { "type": "MemberExpression", - "start": 1349, - "end": 1355, + "start": 1661, + "end": 1667, "loc": { "start": { - "line": 40, - "column": 36 + "line": 49, + "column": 2 }, "end": { - "line": 40, - "column": 42 + "line": 49, + "column": 8 } }, "object": { "type": "Identifier", - "start": 1349, - "end": 1350, + "start": 1661, + "end": 1662, "loc": { "start": { - "line": 40, - "column": 36 + "line": 49, + "column": 2 }, "end": { - "line": 40, - "column": 37 + "line": 49, + "column": 3 }, "identifierName": "s" }, @@ -1571,16 +2342,16 @@ }, "property": { "type": "Identifier", - "start": 1351, - "end": 1355, + "start": 1663, + "end": 1667, "loc": { "start": { - "line": 40, - "column": 38 + "line": 49, + "column": 4 }, "end": { - "line": 40, - "column": 42 + "line": 49, + "column": 8 }, "identifierName": "left" }, @@ -1590,16 +2361,16 @@ }, "property": { "type": "Identifier", - "start": 1356, - "end": 1362, + "start": 1668, + "end": 1674, "loc": { "start": { - "line": 40, - "column": 43 + "line": 49, + "column": 9 }, "end": { - "line": 40, - "column": 49 + "line": 49, + "column": 15 }, "identifierName": "_color" }, @@ -1607,19 +2378,18 @@ }, "computed": false }, - "operator": "===", "right": { "type": "Identifier", - "start": 1367, - "end": 1372, + "start": 1677, + "end": 1682, "loc": { "start": { - "line": 40, - "column": 54 + "line": 49, + "column": 18 }, "end": { - "line": 40, - "column": 59 + "line": 49, + "column": 23 }, "identifierName": "BLACK" }, @@ -1627,628 +2397,5491 @@ } } }, - "consequent": { - "type": "BlockStatement", - "start": 1374, - "end": 1816, + { + "type": "ExpressionStatement", + "start": 1686, + "end": 1702, "loc": { "start": { - "line": 40, - "column": 61 + "line": 50, + "column": 2 }, "end": { - "line": 55, - "column": 2 + "line": 50, + "column": 18 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1754, - "end": 1769, + "expression": { + "type": "CallExpression", + "start": 1686, + "end": 1701, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1686, + "end": 1698, "loc": { "start": { - "line": 52, + "line": 50, "column": 2 }, "end": { - "line": 52, - "column": 17 - } + "line": 50, + "column": 14 + }, + "identifierName": "rotate_right" }, - "expression": { - "type": "AssignmentExpression", - "start": 1754, - "end": 1768, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1699, + "end": 1700, "loc": { "start": { - "line": 52, - "column": 2 + "line": 50, + "column": 15 }, "end": { - "line": 52, + "line": 50, "column": 16 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1754, - "end": 1762, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1754, - "end": 1755, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s", - "leadingComments": null }, - "property": { - "type": "Identifier", - "start": 1756, - "end": 1762, - "loc": { - "start": { - "line": 52, - "column": 4 - }, - "end": { - "line": 52, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 1765, - "end": 1768, - "loc": { - "start": { - "line": 52, - "column": 13 - }, - "end": { - "line": 52, - "column": 16 - }, - "identifierName": "RED" - }, - "name": "RED" + "identifierName": "s" }, - "leadingComments": null + "name": "s" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "IfStatement", + "start": 1711, + "end": 2206, + "loc": { + "start": { + "line": 51, + "column": 8 + }, + "end": { + "line": 66, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1715, + "end": 1762, + "loc": { + "start": { + "line": 51, + "column": 12 + }, + "end": { + "line": 51, + "column": 59 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1715, + "end": 1735, + "loc": { + "start": { + "line": 51, + "column": 12 + }, + "end": { + "line": 51, + "column": 32 + } + }, + "left": { + "type": "Identifier", + "start": 1715, + "end": 1716, + "loc": { + "start": { + "line": 51, + "column": 12 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", - "start": 1378, - "end": 1751, - "loc": { - "start": { - "line": 41, - "column": 2 - }, - "end": { - "line": 51, - "column": 5 - } - } - } - ] + "end": { + "line": 51, + "column": 13 + }, + "identifierName": "n" }, - { - "type": "ExpressionStatement", - "start": 1772, - "end": 1795, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1721, + "end": 1735, + "loc": { + "start": { + "line": 51, + "column": 18 + }, + "end": { + "line": 51, + "column": 32 + } + }, + "object": { + "type": "MemberExpression", + "start": 1721, + "end": 1729, "loc": { "start": { - "line": 53, - "column": 2 + "line": 51, + "column": 18 }, "end": { - "line": 53, - "column": 25 + "line": 51, + "column": 26 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1772, - "end": 1794, + "object": { + "type": "Identifier", + "start": 1721, + "end": 1722, "loc": { "start": { - "line": 53, - "column": 2 + "line": 51, + "column": 18 }, "end": { - "line": 53, - "column": 24 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1772, - "end": 1786, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 16 - } + "line": 51, + "column": 19 }, - "object": { - "type": "MemberExpression", - "start": 1772, - "end": 1779, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1772, - "end": 1773, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1774, - "end": 1779, - "loc": { - "start": { - "line": 53, - "column": 4 - }, - "end": { - "line": 53, - "column": 9 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1723, + "end": 1729, + "loc": { + "start": { + "line": 51, + "column": 20 }, - "property": { - "type": "Identifier", - "start": 1780, - "end": 1786, - "loc": { - "start": { - "line": 53, - "column": 10 - }, - "end": { - "line": 53, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 51, + "column": 26 }, - "computed": false + "identifierName": "parent" }, - "right": { - "type": "Identifier", - "start": 1789, - "end": 1794, - "loc": { - "start": { - "line": 53, - "column": 19 - }, - "end": { - "line": 53, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1730, + "end": 1735, + "loc": { + "start": { + "line": 51, + "column": 27 + }, + "end": { + "line": 51, + "column": 32 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1739, + "end": 1762, + "loc": { + "start": { + "line": 51, + "column": 36 + }, + "end": { + "line": 51, + "column": 59 + } + }, + "left": { + "type": "MemberExpression", + "start": 1739, + "end": 1752, + "loc": { + "start": { + "line": 51, + "column": 36 + }, + "end": { + "line": 51, + "column": 49 } }, - { - "type": "ExpressionStatement", - "start": 1798, - "end": 1813, + "object": { + "type": "MemberExpression", + "start": 1739, + "end": 1745, "loc": { "start": { - "line": 54, - "column": 2 + "line": 51, + "column": 36 }, "end": { - "line": 54, - "column": 17 + "line": 51, + "column": 42 } }, - "expression": { - "type": "CallExpression", - "start": 1798, - "end": 1812, + "object": { + "type": "Identifier", + "start": 1739, + "end": 1740, "loc": { "start": { - "line": 54, - "column": 2 + "line": 51, + "column": 36 }, "end": { - "line": 54, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 1798, - "end": 1809, - "loc": { - "start": { - "line": 54, - "column": 2 - }, - "end": { - "line": 54, - "column": 13 - }, - "identifierName": "rotate_left" + "line": 51, + "column": 37 }, - "name": "rotate_left" + "identifierName": "s" }, - "arguments": [ - { - "type": "Identifier", - "start": 1810, - "end": 1811, - "loc": { - "start": { - "line": 54, - "column": 14 - }, - "end": { - "line": 54, - "column": 15 - }, - "identifierName": "s" - }, - "name": "s" - } - ] - } - } - ], - "directives": [] - }, - "alternate": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 586, - "end": 659, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 661, - "end": 732, - "loc": { - "start": { - "line": 22, - "column": 1 + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1741, + "end": 1745, + "loc": { + "start": { + "line": 51, + "column": 38 + }, + "end": { + "line": 51, + "column": 42 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "end": { - "line": 22, - "column": 72 - } - } - }, - { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 734, - "end": 759, - "loc": { - "start": { - "line": 23, - "column": 1 + "property": { + "type": "Identifier", + "start": 1746, + "end": 1752, + "loc": { + "start": { + "line": 51, + "column": 43 + }, + "end": { + "line": 51, + "column": 49 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "end": { - "line": 23, - "column": 26 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 762, - "end": 1194, - "loc": { - "start": { - "line": 25, - "column": 1 + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1757, + "end": 1762, + "loc": { + "start": { + "line": 51, + "column": 54 + }, + "end": { + "line": 51, + "column": 59 + }, + "identifierName": "BLACK" }, - "end": { - "line": 35, - "column": 4 - } + "name": "BLACK" } } - ] - }, - { - "type": "ExpressionStatement", - "start": 1819, - "end": 1835, - "loc": { - "start": { - "line": 57, - "column": 1 - }, - "end": { - "line": 57, - "column": 17 - } }, - "expression": { - "type": "CallExpression", - "start": 1819, - "end": 1834, + "consequent": { + "type": "BlockStatement", + "start": 1764, + "end": 2206, "loc": { "start": { - "line": 57, - "column": 1 + "line": 51, + "column": 61 }, "end": { - "line": 57, - "column": 16 + "line": 66, + "column": 2 } }, - "callee": { - "type": "Identifier", - "start": 1819, - "end": 1831, - "loc": { - "start": { - "line": 57, - "column": 1 + "body": [ + { + "type": "ExpressionStatement", + "start": 2144, + "end": 2159, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 17 + } }, - "end": { - "line": 57, - "column": 13 + "expression": { + "type": "AssignmentExpression", + "start": 2144, + "end": 2158, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 2144, + "end": 2152, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 2144, + "end": 2145, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 2146, + "end": 2152, + "loc": { + "start": { + "line": 63, + "column": 4 + }, + "end": { + "line": 63, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 2155, + "end": 2158, + "loc": { + "start": { + "line": 63, + "column": 13 + }, + "end": { + "line": 63, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null }, - "identifierName": "delete_case6" + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", + "start": 1768, + "end": 2141, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 + } + } + } + ] }, - "name": "delete_case6" - }, - "arguments": [ { - "type": "Identifier", - "start": 1832, - "end": 1833, + "type": "ExpressionStatement", + "start": 2162, + "end": 2185, "loc": { "start": { - "line": 57, - "column": 14 + "line": 64, + "column": 2 }, "end": { - "line": 57, - "column": 15 - }, - "identifierName": "n" + "line": 64, + "column": 25 + } }, - "name": "n" - } - ] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", - "start": 204, - "end": 523, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - } - ], - "trailingComments": [] + "expression": { + "type": "AssignmentExpression", + "start": 2162, + "end": 2184, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 2162, + "end": 2176, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 2162, + "end": 2169, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 2162, + "end": 2163, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 2164, + "end": 2169, + "loc": { + "start": { + "line": 64, + "column": 4 + }, + "end": { + "line": 64, + "column": 9 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 2170, + "end": 2176, + "loc": { + "start": { + "line": 64, + "column": 10 + }, + "end": { + "line": 64, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 2179, + "end": 2184, + "loc": { + "start": { + "line": 64, + "column": 19 + }, + "end": { + "line": 64, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 2188, + "end": 2203, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2188, + "end": 2202, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2188, + "end": 2199, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 13 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2200, + "end": 2201, + "loc": { + "start": { + "line": 65, + "column": 14 + }, + "end": { + "line": 65, + "column": 15 + }, + "identifierName": "s" + }, + "name": "s" + } + ] + } + } + ], + "directives": [] + }, + "alternate": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " The following statements just force the red n's sibling child to be on", + "start": 976, + "end": 1049, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 74 + } + } + }, + { + "type": "CommentLine", + "value": " the left of the left of the parent, or right of the right, so case 6", + "start": 1051, + "end": 1122, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " will rotate correctly.", + "start": 1124, + "end": 1149, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 26 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", + "start": 1152, + "end": 1584, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 2209, + "end": 2225, + "loc": { + "start": { + "line": 68, + "column": 1 + }, + "end": { + "line": 68, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2209, + "end": 2224, + "loc": { + "start": { + "line": 68, + "column": 1 + }, + "end": { + "line": 68, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2209, + "end": 2221, + "loc": { + "start": { + "line": 68, + "column": 1 + }, + "end": { + "line": 68, + "column": 13 + }, + "identifierName": "delete_case6" + }, + "name": "delete_case6" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2222, + "end": 2223, + "loc": { + "start": { + "line": 68, + "column": 14 + }, + "end": { + "line": 68, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 2230, + "end": 2258, + "loc": { + "start": { + "line": 71, + "column": 0 + }, + "end": { + "line": 71, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 2245, + "end": 2257, + "loc": { + "start": { + "line": 71, + "column": 15 + }, + "end": { + "line": 71, + "column": 27 + }, + "identifierName": "delete_case5" + }, + "name": "delete_case5" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 2230, + "end": 2258, + "loc": { + "start": { + "line": 71, + "column": 0 + }, + "end": { + "line": 71, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 700, + "end": 2228, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 69, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 706, + "end": 2227, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 69, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 706, + "end": 718, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 18 + }, + "identifierName": "delete_case5" + }, + "name": "delete_case5", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 721, + "end": 2227, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 69, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 706, + "end": 718, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 18 + }, + "identifierName": "delete_case5" + }, + "name": "delete_case5", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 722, + "end": 723, + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 728, + "end": 2227, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 69, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 731, + "end": 778, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 731, + "end": 777, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 731, + "end": 737, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 738, + "end": 776, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 738, + "end": 755, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 738, + "end": 739, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 751, + "end": 755, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 759, + "end": 776, + "loc": { + "start": { + "line": 24, + "column": 29 + }, + "end": { + "line": 24, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 29 + }, + "end": { + "line": 24, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 772, + "end": 776, + "loc": { + "start": { + "line": 24, + "column": 42 + }, + "end": { + "line": 24, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 780, + "end": 807, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 780, + "end": 806, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 780, + "end": 786, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 787, + "end": 805, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 787, + "end": 795, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 787, + "end": 788, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 789, + "end": 795, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 800, + "end": 805, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 809, + "end": 835, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 809, + "end": 834, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 809, + "end": 815, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 816, + "end": 833, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 816, + "end": 824, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 816, + "end": 817, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 818, + "end": 824, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 829, + "end": 833, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 837, + "end": 858, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 843, + "end": 857, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 843, + "end": 844, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 847, + "end": 857, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 847, + "end": 854, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 855, + "end": 856, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 860, + "end": 886, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 860, + "end": 885, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 860, + "end": 866, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 867, + "end": 884, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 867, + "end": 868, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 880, + "end": 884, + "loc": { + "start": { + "line": 28, + "column": 21 + }, + "end": { + "line": 28, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 888, + "end": 915, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 888, + "end": 914, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 888, + "end": 894, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 895, + "end": 913, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 895, + "end": 903, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 895, + "end": 896, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 897, + "end": 903, + "loc": { + "start": { + "line": 29, + "column": 10 + }, + "end": { + "line": 29, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 908, + "end": 913, + "loc": { + "start": { + "line": 29, + "column": 21 + }, + "end": { + "line": 29, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 917, + "end": 973, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 57 + } + }, + "expression": { + "type": "CallExpression", + "start": 917, + "end": 972, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 56 + } + }, + "callee": { + "type": "Identifier", + "start": 917, + "end": 923, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 924, + "end": 971, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 55 + } + }, + "left": { + "type": "BinaryExpression", + "start": 924, + "end": 945, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 29 + } + }, + "left": { + "type": "MemberExpression", + "start": 924, + "end": 937, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 924, + "end": 930, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 924, + "end": 925, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 926, + "end": 930, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 931, + "end": 937, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 942, + "end": 945, + "loc": { + "start": { + "line": 30, + "column": 26 + }, + "end": { + "line": 30, + "column": 29 + }, + "identifierName": "RED" + }, + "name": "RED" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 949, + "end": 971, + "loc": { + "start": { + "line": 30, + "column": 33 + }, + "end": { + "line": 30, + "column": 55 + } + }, + "left": { + "type": "MemberExpression", + "start": 949, + "end": 963, + "loc": { + "start": { + "line": 30, + "column": 33 + }, + "end": { + "line": 30, + "column": 47 + } + }, + "object": { + "type": "MemberExpression", + "start": 949, + "end": 956, + "loc": { + "start": { + "line": 30, + "column": 33 + }, + "end": { + "line": 30, + "column": 40 + } + }, + "object": { + "type": "Identifier", + "start": 949, + "end": 950, + "loc": { + "start": { + "line": 30, + "column": 33 + }, + "end": { + "line": 30, + "column": 34 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 951, + "end": 956, + "loc": { + "start": { + "line": 30, + "column": 35 + }, + "end": { + "line": 30, + "column": 40 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 957, + "end": 963, + "loc": { + "start": { + "line": 30, + "column": 41 + }, + "end": { + "line": 30, + "column": 47 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 968, + "end": 971, + "loc": { + "start": { + "line": 30, + "column": 52 + }, + "end": { + "line": 30, + "column": 55 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " The following statements just force the red n's sibling child to be on", + "start": 976, + "end": 1049, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 74 + } + } + }, + { + "type": "CommentLine", + "value": " the left of the left of the parent, or right of the right, so case 6", + "start": 1051, + "end": 1122, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " will rotate correctly.", + "start": 1124, + "end": 1149, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 26 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", + "start": 1152, + "end": 1584, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1586, + "end": 2206, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 66, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1590, + "end": 1637, + "loc": { + "start": { + "line": 47, + "column": 5 + }, + "end": { + "line": 47, + "column": 52 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1590, + "end": 1609, + "loc": { + "start": { + "line": 47, + "column": 5 + }, + "end": { + "line": 47, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 1590, + "end": 1591, + "loc": { + "start": { + "line": 47, + "column": 5 + }, + "end": { + "line": 47, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1596, + "end": 1609, + "loc": { + "start": { + "line": 47, + "column": 11 + }, + "end": { + "line": 47, + "column": 24 + } + }, + "object": { + "type": "MemberExpression", + "start": 1596, + "end": 1604, + "loc": { + "start": { + "line": 47, + "column": 11 + }, + "end": { + "line": 47, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 1596, + "end": 1597, + "loc": { + "start": { + "line": 47, + "column": 11 + }, + "end": { + "line": 47, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1598, + "end": 1604, + "loc": { + "start": { + "line": 47, + "column": 13 + }, + "end": { + "line": 47, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1605, + "end": 1609, + "loc": { + "start": { + "line": 47, + "column": 20 + }, + "end": { + "line": 47, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1613, + "end": 1637, + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 52 + } + }, + "left": { + "type": "MemberExpression", + "start": 1613, + "end": 1627, + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 1613, + "end": 1620, + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 1613, + "end": 1614, + "loc": { + "start": { + "line": 47, + "column": 28 + }, + "end": { + "line": 47, + "column": 29 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1615, + "end": 1620, + "loc": { + "start": { + "line": 47, + "column": 30 + }, + "end": { + "line": 47, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1621, + "end": 1627, + "loc": { + "start": { + "line": 47, + "column": 36 + }, + "end": { + "line": 47, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1632, + "end": 1637, + "loc": { + "start": { + "line": 47, + "column": 47 + }, + "end": { + "line": 47, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1639, + "end": 1705, + "loc": { + "start": { + "line": 47, + "column": 54 + }, + "end": { + "line": 51, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1643, + "end": 1658, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1643, + "end": 1657, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1643, + "end": 1651, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1643, + "end": 1644, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1645, + "end": 1651, + "loc": { + "start": { + "line": 48, + "column": 4 + }, + "end": { + "line": 48, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1654, + "end": 1657, + "loc": { + "start": { + "line": 48, + "column": 13 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1661, + "end": 1683, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1661, + "end": 1682, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 23 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1661, + "end": 1674, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 15 + } + }, + "object": { + "type": "MemberExpression", + "start": 1661, + "end": 1667, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1661, + "end": 1662, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1663, + "end": 1667, + "loc": { + "start": { + "line": 49, + "column": 4 + }, + "end": { + "line": 49, + "column": 8 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1668, + "end": 1674, + "loc": { + "start": { + "line": 49, + "column": 9 + }, + "end": { + "line": 49, + "column": 15 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1677, + "end": 1682, + "loc": { + "start": { + "line": 49, + "column": 18 + }, + "end": { + "line": 49, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1686, + "end": 1702, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1686, + "end": 1701, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1686, + "end": 1698, + "loc": { + "start": { + "line": 50, + "column": 2 + }, + "end": { + "line": 50, + "column": 14 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1699, + "end": 1700, + "loc": { + "start": { + "line": 50, + "column": 15 + }, + "end": { + "line": 50, + "column": 16 + }, + "identifierName": "s" + }, + "name": "s" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "IfStatement", + "start": 1711, + "end": 2206, + "loc": { + "start": { + "line": 51, + "column": 8 + }, + "end": { + "line": 66, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1715, + "end": 1762, + "loc": { + "start": { + "line": 51, + "column": 12 + }, + "end": { + "line": 51, + "column": 59 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1715, + "end": 1735, + "loc": { + "start": { + "line": 51, + "column": 12 + }, + "end": { + "line": 51, + "column": 32 + } + }, + "left": { + "type": "Identifier", + "start": 1715, + "end": 1716, + "loc": { + "start": { + "line": 51, + "column": 12 + }, + "end": { + "line": 51, + "column": 13 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1721, + "end": 1735, + "loc": { + "start": { + "line": 51, + "column": 18 + }, + "end": { + "line": 51, + "column": 32 + } + }, + "object": { + "type": "MemberExpression", + "start": 1721, + "end": 1729, + "loc": { + "start": { + "line": 51, + "column": 18 + }, + "end": { + "line": 51, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 1721, + "end": 1722, + "loc": { + "start": { + "line": 51, + "column": 18 + }, + "end": { + "line": 51, + "column": 19 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1723, + "end": 1729, + "loc": { + "start": { + "line": 51, + "column": 20 + }, + "end": { + "line": 51, + "column": 26 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1730, + "end": 1735, + "loc": { + "start": { + "line": 51, + "column": 27 + }, + "end": { + "line": 51, + "column": 32 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1739, + "end": 1762, + "loc": { + "start": { + "line": 51, + "column": 36 + }, + "end": { + "line": 51, + "column": 59 + } + }, + "left": { + "type": "MemberExpression", + "start": 1739, + "end": 1752, + "loc": { + "start": { + "line": 51, + "column": 36 + }, + "end": { + "line": 51, + "column": 49 + } + }, + "object": { + "type": "MemberExpression", + "start": 1739, + "end": 1745, + "loc": { + "start": { + "line": 51, + "column": 36 + }, + "end": { + "line": 51, + "column": 42 + } + }, + "object": { + "type": "Identifier", + "start": 1739, + "end": 1740, + "loc": { + "start": { + "line": 51, + "column": 36 + }, + "end": { + "line": 51, + "column": 37 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1741, + "end": 1745, + "loc": { + "start": { + "line": 51, + "column": 38 + }, + "end": { + "line": 51, + "column": 42 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1746, + "end": 1752, + "loc": { + "start": { + "line": 51, + "column": 43 + }, + "end": { + "line": 51, + "column": 49 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1757, + "end": 1762, + "loc": { + "start": { + "line": 51, + "column": 54 + }, + "end": { + "line": 51, + "column": 59 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1764, + "end": 2206, + "loc": { + "start": { + "line": 51, + "column": 61 + }, + "end": { + "line": 66, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2144, + "end": 2159, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 2144, + "end": 2158, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 2144, + "end": 2152, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 2144, + "end": 2145, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 2146, + "end": 2152, + "loc": { + "start": { + "line": 63, + "column": 4 + }, + "end": { + "line": 63, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 2155, + "end": 2158, + "loc": { + "start": { + "line": 63, + "column": 13 + }, + "end": { + "line": 63, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", + "start": 1768, + "end": 2141, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 2162, + "end": 2185, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 2162, + "end": 2184, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 2162, + "end": 2176, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 2162, + "end": 2169, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 2162, + "end": 2163, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 2164, + "end": 2169, + "loc": { + "start": { + "line": 64, + "column": 4 + }, + "end": { + "line": 64, + "column": 9 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 2170, + "end": 2176, + "loc": { + "start": { + "line": 64, + "column": 10 + }, + "end": { + "line": 64, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 2179, + "end": 2184, + "loc": { + "start": { + "line": 64, + "column": 19 + }, + "end": { + "line": 64, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 2188, + "end": 2203, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2188, + "end": 2202, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2188, + "end": 2199, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 13 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2200, + "end": 2201, + "loc": { + "start": { + "line": 65, + "column": 14 + }, + "end": { + "line": 65, + "column": 15 + }, + "identifierName": "s" + }, + "name": "s" + } + ] + } + } + ], + "directives": [] + }, + "alternate": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " The following statements just force the red n's sibling child to be on", + "start": 976, + "end": 1049, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 74 + } + } + }, + { + "type": "CommentLine", + "value": " the left of the left of the parent, or right of the right, so case 6", + "start": 1051, + "end": 1122, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " will rotate correctly.", + "start": 1124, + "end": 1149, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 26 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", + "start": 1152, + "end": 1584, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 2209, + "end": 2225, + "loc": { + "start": { + "line": 68, + "column": 1 + }, + "end": { + "line": 68, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2209, + "end": 2224, + "loc": { + "start": { + "line": 68, + "column": 1 + }, + "end": { + "line": 68, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2209, + "end": 2221, + "loc": { + "start": { + "line": 68, + "column": 1 + }, + "end": { + "line": 68, + "column": 13 + }, + "identifierName": "delete_case6" + }, + "name": "delete_case6" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2222, + "end": 2223, + "loc": { + "start": { + "line": 68, + "column": 14 + }, + "end": { + "line": 68, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 375, + "end": 699, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 375, + "end": 699, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " The following statements just force the red n's sibling child to be on", + "start": 976, + "end": 1049, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 74 + } + } + }, + { + "type": "CommentLine", + "value": " the left of the left of the parent, or right of the right, so case 6", + "start": 1051, + "end": 1122, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " will rotate correctly.", + "start": 1124, + "end": 1149, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 26 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", + "start": 1152, + "end": 1584, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", + "start": 1768, + "end": 2141, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 75, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 103, + "end": 109, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 115, + "end": 119, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 120, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 147, + "end": 151, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 152, + "end": 156, + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 175, + "end": 176, + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 177, + "end": 183, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 184, + "end": 195, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 196, + "end": 200, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_left.js", + "start": 201, + "end": 227, + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 227, + "end": 228, + "loc": { + "start": { + "line": 6, + "column": 50 + }, + "end": { + "line": 6, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 229, + "end": 235, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 236, + "end": 248, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 249, + "end": 253, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_right.js", + "start": 254, + "end": 281, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 52 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 281, + "end": 282, + "loc": { + "start": { + "line": 7, + "column": 52 + }, + "end": { + "line": 7, + "column": 53 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 283, + "end": 289, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 290, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 298, + "end": 302, + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/sibling.js", + "start": 303, + "end": 325, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 325, + "end": 326, + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 328, + "end": 334, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case6", + "start": 335, + "end": 347, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 348, + "end": 352, + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case6.js", + "start": 353, + "end": 372, + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 372, + "end": 373, + "loc": { + "start": { + "line": 10, + "column": 44 + }, + "end": { + "line": 10, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 375, + "end": 699, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 700, + "end": 705, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case5", + "start": 706, + "end": 718, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 719, + "end": 720, + "loc": { + "start": { + "line": 23, + "column": 19 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 721, + "end": 722, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 722, + "end": 723, + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 723, + "end": 724, + "loc": { + "start": { + "line": 23, + "column": 23 + }, + "end": { + "line": 23, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 725, + "end": 727, + "loc": { + "start": { + "line": 23, + "column": 25 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 728, + "end": 729, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 731, + "end": 737, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 737, + "end": 738, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 738, + "end": 739, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 740, + "end": 750, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 751, + "end": 755, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 756, + "end": 758, + "loc": { + "start": { + "line": 24, + "column": 26 + }, + "end": { + "line": 24, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 29 + }, + "end": { + "line": 24, + "column": 30 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 761, + "end": 771, + "loc": { + "start": { + "line": 24, + "column": 31 + }, + "end": { + "line": 24, + "column": 41 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 772, + "end": 776, + "loc": { + "start": { + "line": 24, + "column": 42 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", - "start": 204, - "end": 523, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - } - ] + "end": { + "line": 24, + "column": 46 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", - "start": 204, - "end": 523, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 776, + "end": 777, "loc": { "start": { - "line": 7, - "column": 0 + "line": 24, + "column": 46 }, "end": { - "line": 17, - "column": 3 + "line": 24, + "column": 47 } } }, { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 586, - "end": 659, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 777, + "end": 778, "loc": { "start": { - "line": 21, - "column": 1 + "line": 24, + "column": 47 }, "end": { - "line": 21, - "column": 74 + "line": 24, + "column": 48 } } }, { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 661, - "end": 732, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 780, + "end": 786, "loc": { "start": { - "line": 22, + "line": 25, "column": 1 }, "end": { - "line": 22, - "column": 72 + "line": 25, + "column": 7 } } }, { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 734, - "end": 759, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 786, + "end": 787, "loc": { "start": { - "line": 23, - "column": 1 + "line": 25, + "column": 7 }, "end": { - "line": 23, + "line": 25, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 787, + "end": 788, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 788, + "end": 789, + "loc": { + "start": { + "line": 25, + "column": 9 + }, + "end": { + "line": 25, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 789, + "end": 795, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 796, + "end": 799, + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 800, + "end": 805, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, "column": 26 } } }, { - "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 762, - "end": 1194, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 805, + "end": 806, "loc": { "start": { "line": 25, - "column": 1 + "column": 26 }, "end": { - "line": 35, - "column": 4 + "line": 25, + "column": 27 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", - "start": 1378, - "end": 1751, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 806, + "end": 807, "loc": { "start": { - "line": 41, - "column": 2 + "line": 25, + "column": 27 }, "end": { - "line": 51, - "column": 5 + "line": 25, + "column": 28 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2256,26 +7889,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "assert", + "start": 809, + "end": 815, "loc": { "start": { - "line": 1, - "column": 0 + "line": 26, + "column": 1 }, "end": { - "line": 1, - "column": 6 + "line": 26, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -2285,15 +7917,15 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "start": 815, + "end": 816, "loc": { "start": { - "line": 1, + "line": 26, "column": 7 }, "end": { - "line": 1, + "line": 26, "column": 8 } } @@ -2310,24 +7942,24 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "n", + "start": 816, + "end": 817, "loc": { "start": { - "line": 1, + "line": 26, "column": 8 }, "end": { - "line": 1, - "column": 13 + "line": 26, + "column": 9 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2337,16 +7969,16 @@ "binop": null, "updateContext": null }, - "start": 13, - "end": 14, + "start": 817, + "end": 818, "loc": { "start": { - "line": 1, - "column": 13 + "line": 26, + "column": 9 }, "end": { - "line": 1, - "column": 14 + "line": 26, + "column": 10 } } }, @@ -2362,48 +7994,51 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 15, - "end": 18, + "value": "parent", + "start": 818, + "end": 824, "loc": { "start": { - "line": 1, - "column": 15 + "line": 26, + "column": 10 }, "end": { - "line": 1, - "column": 18 + "line": 26, + "column": 16 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 18, - "end": 19, + "value": "!==", + "start": 825, + "end": 828, "loc": { "start": { - "line": 1, - "column": 18 + "line": 26, + "column": 17 }, "end": { - "line": 1, - "column": 19 + "line": 26, + "column": 20 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2411,46 +8046,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 20, - "end": 24, + "value": "null", + "start": 829, + "end": 833, "loc": { "start": { - "line": 1, - "column": 20 + "line": 26, + "column": 21 }, "end": { - "line": 1, - "column": 24 + "line": 26, + "column": 25 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/index.js", - "start": 25, - "end": 44, + "start": 833, + "end": 834, "loc": { "start": { - "line": 1, + "line": 26, "column": 25 }, "end": { - "line": 1, - "column": 44 + "line": 26, + "column": 26 } } }, @@ -2467,25 +8101,25 @@ "binop": null, "updateContext": null }, - "start": 44, - "end": 45, + "start": 834, + "end": 835, "loc": { "start": { - "line": 1, - "column": 44 + "line": 26, + "column": 26 }, "end": { - "line": 1, - "column": 45 + "line": 26, + "column": 27 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2494,24 +8128,24 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 46, - "end": 52, + "value": "const", + "start": 837, + "end": 842, "loc": { "start": { - "line": 2, - "column": 0 + "line": 27, + "column": 1 }, "end": { - "line": 2, + "line": 27, "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2520,19 +8154,47 @@ "postfix": false, "binop": null }, - "start": 53, - "end": 54, + "value": "s", + "start": 843, + "end": 844, "loc": { "start": { - "line": 2, + "line": 27, "column": 7 }, "end": { - "line": 2, + "line": 27, "column": 8 } } }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 845, + "end": 846, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + } + } + }, { "type": { "label": "name", @@ -2545,43 +8207,42 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 54, - "end": 65, + "value": "sibling", + "start": 847, + "end": 854, "loc": { "start": { - "line": 2, - "column": 8 + "line": 27, + "column": 11 }, "end": { - "line": 2, - "column": 19 + "line": 27, + "column": 18 } } }, { "type": { - "label": ",", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 65, - "end": 66, + "start": 854, + "end": 855, "loc": { "start": { - "line": 2, - "column": 19 + "line": 27, + "column": 18 }, "end": { - "line": 2, - "column": 20 + "line": 27, + "column": 19 } } }, @@ -2597,23 +8258,23 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 67, - "end": 79, + "value": "n", + "start": 855, + "end": 856, "loc": { "start": { - "line": 2, - "column": 21 + "line": 27, + "column": 19 }, "end": { - "line": 2, - "column": 33 + "line": 27, + "column": 20 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2623,48 +8284,48 @@ "postfix": false, "binop": null }, - "start": 79, - "end": 80, + "start": 856, + "end": 857, "loc": { "start": { - "line": 2, - "column": 33 + "line": 27, + "column": 20 }, "end": { - "line": 2, - "column": 34 + "line": 27, + "column": 21 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 81, - "end": 85, + "start": 857, + "end": 858, "loc": { "start": { - "line": 2, - "column": 35 + "line": 27, + "column": 21 }, "end": { - "line": 2, - "column": 39 + "line": 27, + "column": 22 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2672,53 +8333,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../rotate/index.js", - "start": 86, - "end": 106, + "value": "assert", + "start": 860, + "end": 866, "loc": { "start": { - "line": 2, - "column": 40 + "line": 28, + "column": 1 }, "end": { - "line": 2, - "column": 60 + "line": 28, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 106, - "end": 107, + "start": 866, + "end": 867, "loc": { "start": { - "line": 2, - "column": 60 + "line": 28, + "column": 7 }, "end": { - "line": 2, - "column": 61 + "line": 28, + "column": 8 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2726,27 +8384,54 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 108, - "end": 114, + "value": "s", + "start": 867, + "end": 868, "loc": { "start": { - "line": 3, - "column": 0 + "line": 28, + "column": 8 }, "end": { - "line": 3, - "column": 6 + "line": 28, + "column": 9 } } }, { "type": { - "label": "{", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 869, + "end": 879, + "loc": { + "start": { + "line": 28, + "column": 10 + }, + "end": { + "line": 28, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2755,24 +8440,25 @@ "postfix": false, "binop": null }, - "start": 115, - "end": 116, + "value": "Node", + "start": 880, + "end": 884, "loc": { "start": { - "line": 3, - "column": 7 + "line": 28, + "column": 21 }, "end": { - "line": 3, - "column": 8 + "line": 28, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2780,42 +8466,42 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 116, - "end": 123, + "start": 884, + "end": 885, "loc": { "start": { - "line": 3, - "column": 8 + "line": 28, + "column": 25 }, "end": { - "line": 3, - "column": 15 + "line": 28, + "column": 26 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 123, - "end": 124, + "start": 885, + "end": 886, "loc": { "start": { - "line": 3, - "column": 15 + "line": 28, + "column": 26 }, "end": { - "line": 3, - "column": 16 + "line": 28, + "column": 27 } } }, @@ -2831,79 +8517,76 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 125, - "end": 129, + "value": "assert", + "start": 888, + "end": 894, "loc": { "start": { - "line": 3, - "column": 17 + "line": 29, + "column": 1 }, "end": { - "line": 3, - "column": 21 + "line": 29, + "column": 7 } } }, { "type": { - "label": "string", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/sibling.js", - "start": 130, - "end": 152, + "start": 894, + "end": 895, "loc": { "start": { - "line": 3, - "column": 22 + "line": 29, + "column": 7 }, "end": { - "line": 3, - "column": 44 + "line": 29, + "column": 8 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 152, - "end": 153, + "value": "s", + "start": 895, + "end": 896, "loc": { "start": { - "line": 3, - "column": 44 + "line": 29, + "column": 8 }, "end": { - "line": 3, - "column": 45 + "line": 29, + "column": 9 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2912,24 +8595,23 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 155, - "end": 161, + "start": 896, + "end": 897, "loc": { "start": { - "line": 5, - "column": 0 + "line": 29, + "column": 9 }, "end": { - "line": 5, - "column": 6 + "line": 29, + "column": 10 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2938,50 +8620,52 @@ "postfix": false, "binop": null }, - "start": 162, - "end": 163, + "value": "_color", + "start": 897, + "end": 903, "loc": { "start": { - "line": 5, - "column": 7 + "line": 29, + "column": 10 }, "end": { - "line": 5, - "column": 8 + "line": 29, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "delete_case6", - "start": 163, - "end": 175, + "value": "===", + "start": 904, + "end": 907, "loc": { "start": { - "line": 5, - "column": 8 + "line": 29, + "column": 17 }, "end": { - "line": 5, + "line": 29, "column": 20 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2989,24 +8673,25 @@ "postfix": false, "binop": null }, - "start": 175, - "end": 176, + "value": "BLACK", + "start": 908, + "end": 913, "loc": { "start": { - "line": 5, - "column": 20 + "line": 29, + "column": 21 }, "end": { - "line": 5, - "column": 21 + "line": 29, + "column": 26 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3014,25 +8699,24 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 177, - "end": 181, + "start": 913, + "end": 914, "loc": { "start": { - "line": 5, - "column": 22 + "line": 29, + "column": 26 }, "end": { - "line": 5, - "column": 26 + "line": 29, + "column": 27 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3041,94 +8725,99 @@ "binop": null, "updateContext": null }, - "value": "./delete_case6.js", - "start": 182, - "end": 201, + "start": 914, + "end": 915, "loc": { "start": { - "line": 5, + "line": 29, "column": 27 }, "end": { - "line": 5, - "column": 46 + "line": 29, + "column": 28 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 201, - "end": 202, + "value": "assert", + "start": 917, + "end": 923, "loc": { "start": { - "line": 5, - "column": 46 + "line": 30, + "column": 1 }, "end": { - "line": 5, - "column": 47 + "line": 30, + "column": 7 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n ", - "start": 204, - "end": 523, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 923, + "end": 924, "loc": { "start": { - "line": 7, - "column": 0 + "line": 30, + "column": 7 }, "end": { - "line": 17, - "column": 3 + "line": 30, + "column": 8 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 524, - "end": 530, + "value": "s", + "start": 924, + "end": 925, "loc": { "start": { - "line": 18, - "column": 0 + "line": 30, + "column": 8 }, "end": { - "line": 18, - "column": 6 + "line": 30, + "column": 9 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3139,17 +8828,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 531, - "end": 536, + "start": 925, + "end": 926, "loc": { "start": { - "line": 18, - "column": 7 + "line": 30, + "column": 9 }, "end": { - "line": 18, - "column": 12 + "line": 30, + "column": 10 } } }, @@ -3165,51 +8853,50 @@ "postfix": false, "binop": null }, - "value": "delete_case5", - "start": 537, - "end": 549, + "value": "left", + "start": 926, + "end": 930, "loc": { "start": { - "line": 18, - "column": 13 + "line": 30, + "column": 10 }, "end": { - "line": 18, - "column": 25 + "line": 30, + "column": 14 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 550, - "end": 551, + "start": 930, + "end": 931, "loc": { "start": { - "line": 18, - "column": 26 + "line": 30, + "column": 14 }, "end": { - "line": 18, - "column": 27 + "line": 30, + "column": 15 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3218,50 +8905,52 @@ "postfix": false, "binop": null }, - "start": 552, - "end": 553, + "value": "_color", + "start": 931, + "end": 937, "loc": { "start": { - "line": 18, - "column": 28 + "line": 30, + "column": 15 }, "end": { - "line": 18, - "column": 29 + "line": 30, + "column": 21 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "n", - "start": 553, - "end": 554, + "value": "===", + "start": 938, + "end": 941, "loc": { "start": { - "line": 18, - "column": 29 + "line": 30, + "column": 22 }, "end": { - "line": 18, - "column": 30 + "line": 30, + "column": 25 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3269,22 +8958,23 @@ "postfix": false, "binop": null }, - "start": 554, - "end": 555, + "value": "RED", + "start": 942, + "end": 945, "loc": { "start": { - "line": 18, - "column": 30 + "line": 30, + "column": 26 }, "end": { - "line": 18, - "column": 31 + "line": 30, + "column": 29 } } }, { "type": { - "label": "=>", + "label": "||", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3292,26 +8982,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "start": 556, - "end": 558, + "value": "||", + "start": 946, + "end": 948, "loc": { "start": { - "line": 18, - "column": 32 + "line": 30, + "column": 30 }, "end": { - "line": 18, - "column": 34 + "line": 30, + "column": 32 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3320,23 +9011,23 @@ "postfix": false, "binop": null }, - "start": 559, - "end": 560, + "value": "s", + "start": 949, + "end": 950, "loc": { "start": { - "line": 18, - "column": 35 + "line": 30, + "column": 33 }, "end": { - "line": 18, - "column": 36 + "line": 30, + "column": 34 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3347,17 +9038,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 562, - "end": 567, + "start": 950, + "end": 951, "loc": { "start": { - "line": 19, - "column": 1 + "line": 30, + "column": 34 }, "end": { - "line": 19, - "column": 6 + "line": 30, + "column": 35 } } }, @@ -3373,44 +9063,43 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 568, - "end": 569, + "value": "right", + "start": 951, + "end": 956, "loc": { "start": { - "line": 19, - "column": 7 + "line": 30, + "column": 35 }, "end": { - "line": 19, - "column": 8 + "line": 30, + "column": 40 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 570, - "end": 571, + "start": 956, + "end": 957, "loc": { "start": { - "line": 19, - "column": 9 + "line": 30, + "column": 40 }, "end": { - "line": 19, - "column": 10 + "line": 30, + "column": 41 } } }, @@ -3426,42 +9115,44 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 572, - "end": 579, + "value": "_color", + "start": 957, + "end": 963, "loc": { "start": { - "line": 19, - "column": 11 + "line": 30, + "column": 41 }, "end": { - "line": 19, - "column": 18 + "line": 30, + "column": 47 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 579, - "end": 580, + "value": "===", + "start": 964, + "end": 967, "loc": { "start": { - "line": 19, - "column": 18 + "line": 30, + "column": 48 }, "end": { - "line": 19, - "column": 19 + "line": 30, + "column": 51 } } }, @@ -3477,17 +9168,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 580, - "end": 581, + "value": "RED", + "start": 968, + "end": 971, "loc": { "start": { - "line": 19, - "column": 19 + "line": 30, + "column": 52 }, "end": { - "line": 19, - "column": 20 + "line": 30, + "column": 55 } } }, @@ -3503,16 +9194,16 @@ "postfix": false, "binop": null }, - "start": 581, - "end": 582, + "start": 971, + "end": 972, "loc": { "start": { - "line": 19, - "column": 20 + "line": 30, + "column": 55 }, "end": { - "line": 19, - "column": 21 + "line": 30, + "column": 56 } } }, @@ -3529,31 +9220,31 @@ "binop": null, "updateContext": null }, - "start": 582, - "end": 583, + "start": 972, + "end": 973, "loc": { "start": { - "line": 19, - "column": 21 + "line": 30, + "column": 56 }, "end": { - "line": 19, - "column": 22 + "line": 30, + "column": 57 } } }, { "type": "CommentLine", "value": " The following statements just force the red n's sibling child to be on", - "start": 586, - "end": 659, + "start": 976, + "end": 1049, "loc": { "start": { - "line": 21, + "line": 32, "column": 1 }, "end": { - "line": 21, + "line": 32, "column": 74 } } @@ -3561,15 +9252,15 @@ { "type": "CommentLine", "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 661, - "end": 732, + "start": 1051, + "end": 1122, "loc": { "start": { - "line": 22, + "line": 33, "column": 1 }, "end": { - "line": 22, + "line": 33, "column": 72 } } @@ -3577,15 +9268,15 @@ { "type": "CommentLine", "value": " will rotate correctly.", - "start": 734, - "end": 759, + "start": 1124, + "end": 1149, "loc": { "start": { - "line": 23, + "line": 34, "column": 1 }, "end": { - "line": 23, + "line": 34, "column": 26 } } @@ -3593,15 +9284,15 @@ { "type": "CommentBlock", "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 762, - "end": 1194, + "start": 1152, + "end": 1584, "loc": { "start": { - "line": 25, + "line": 36, "column": 1 }, "end": { - "line": 35, + "line": 46, "column": 4 } } @@ -3621,15 +9312,15 @@ "updateContext": null }, "value": "if", - "start": 1196, - "end": 1198, + "start": 1586, + "end": 1588, "loc": { "start": { - "line": 36, + "line": 47, "column": 1 }, "end": { - "line": 36, + "line": 47, "column": 3 } } @@ -3646,15 +9337,15 @@ "postfix": false, "binop": null }, - "start": 1199, - "end": 1200, + "start": 1589, + "end": 1590, "loc": { "start": { - "line": 36, + "line": 47, "column": 4 }, "end": { - "line": 36, + "line": 47, "column": 5 } } @@ -3672,15 +9363,15 @@ "binop": null }, "value": "n", - "start": 1200, - "end": 1201, + "start": 1590, + "end": 1591, "loc": { "start": { - "line": 36, + "line": 47, "column": 5 }, "end": { - "line": 36, + "line": 47, "column": 6 } } @@ -3699,15 +9390,15 @@ "updateContext": null }, "value": "===", - "start": 1202, - "end": 1205, + "start": 1592, + "end": 1595, "loc": { "start": { - "line": 36, + "line": 47, "column": 7 }, "end": { - "line": 36, + "line": 47, "column": 10 } } @@ -3725,15 +9416,15 @@ "binop": null }, "value": "n", - "start": 1206, - "end": 1207, + "start": 1596, + "end": 1597, "loc": { "start": { - "line": 36, + "line": 47, "column": 11 }, "end": { - "line": 36, + "line": 47, "column": 12 } } @@ -3751,15 +9442,15 @@ "binop": null, "updateContext": null }, - "start": 1207, - "end": 1208, + "start": 1597, + "end": 1598, "loc": { "start": { - "line": 36, + "line": 47, "column": 12 }, "end": { - "line": 36, + "line": 47, "column": 13 } } @@ -3777,15 +9468,15 @@ "binop": null }, "value": "parent", - "start": 1208, - "end": 1214, + "start": 1598, + "end": 1604, "loc": { "start": { - "line": 36, + "line": 47, "column": 13 }, "end": { - "line": 36, + "line": 47, "column": 19 } } @@ -3803,15 +9494,15 @@ "binop": null, "updateContext": null }, - "start": 1214, - "end": 1215, + "start": 1604, + "end": 1605, "loc": { "start": { - "line": 36, + "line": 47, "column": 19 }, "end": { - "line": 36, + "line": 47, "column": 20 } } @@ -3829,15 +9520,15 @@ "binop": null }, "value": "left", - "start": 1215, - "end": 1219, + "start": 1605, + "end": 1609, "loc": { "start": { - "line": 36, + "line": 47, "column": 20 }, "end": { - "line": 36, + "line": 47, "column": 24 } } @@ -3856,15 +9547,15 @@ "updateContext": null }, "value": "&&", - "start": 1220, - "end": 1222, + "start": 1610, + "end": 1612, "loc": { "start": { - "line": 36, + "line": 47, "column": 25 }, "end": { - "line": 36, + "line": 47, "column": 27 } } @@ -3882,15 +9573,15 @@ "binop": null }, "value": "s", - "start": 1223, - "end": 1224, + "start": 1613, + "end": 1614, "loc": { "start": { - "line": 36, + "line": 47, "column": 28 }, "end": { - "line": 36, + "line": 47, "column": 29 } } @@ -3908,15 +9599,15 @@ "binop": null, "updateContext": null }, - "start": 1224, - "end": 1225, + "start": 1614, + "end": 1615, "loc": { "start": { - "line": 36, + "line": 47, "column": 29 }, "end": { - "line": 36, + "line": 47, "column": 30 } } @@ -3934,15 +9625,15 @@ "binop": null }, "value": "right", - "start": 1225, - "end": 1230, + "start": 1615, + "end": 1620, "loc": { "start": { - "line": 36, + "line": 47, "column": 30 }, "end": { - "line": 36, + "line": 47, "column": 35 } } @@ -3960,15 +9651,15 @@ "binop": null, "updateContext": null }, - "start": 1230, - "end": 1231, + "start": 1620, + "end": 1621, "loc": { "start": { - "line": 36, + "line": 47, "column": 35 }, "end": { - "line": 36, + "line": 47, "column": 36 } } @@ -3986,15 +9677,15 @@ "binop": null }, "value": "_color", - "start": 1231, - "end": 1237, + "start": 1621, + "end": 1627, "loc": { "start": { - "line": 36, + "line": 47, "column": 36 }, "end": { - "line": 36, + "line": 47, "column": 42 } } @@ -4013,15 +9704,15 @@ "updateContext": null }, "value": "===", - "start": 1238, - "end": 1241, + "start": 1628, + "end": 1631, "loc": { "start": { - "line": 36, + "line": 47, "column": 43 }, "end": { - "line": 36, + "line": 47, "column": 46 } } @@ -4039,15 +9730,15 @@ "binop": null }, "value": "BLACK", - "start": 1242, - "end": 1247, + "start": 1632, + "end": 1637, "loc": { "start": { - "line": 36, + "line": 47, "column": 47 }, "end": { - "line": 36, + "line": 47, "column": 52 } } @@ -4064,15 +9755,15 @@ "postfix": false, "binop": null }, - "start": 1247, - "end": 1248, + "start": 1637, + "end": 1638, "loc": { "start": { - "line": 36, + "line": 47, "column": 52 }, "end": { - "line": 36, + "line": 47, "column": 53 } } @@ -4089,15 +9780,15 @@ "postfix": false, "binop": null }, - "start": 1249, - "end": 1250, + "start": 1639, + "end": 1640, "loc": { "start": { - "line": 36, + "line": 47, "column": 54 }, "end": { - "line": 36, + "line": 47, "column": 55 } } @@ -4115,15 +9806,15 @@ "binop": null }, "value": "s", - "start": 1253, - "end": 1254, + "start": 1643, + "end": 1644, "loc": { "start": { - "line": 37, + "line": 48, "column": 2 }, "end": { - "line": 37, + "line": 48, "column": 3 } } @@ -4141,15 +9832,15 @@ "binop": null, "updateContext": null }, - "start": 1254, - "end": 1255, + "start": 1644, + "end": 1645, "loc": { "start": { - "line": 37, + "line": 48, "column": 3 }, "end": { - "line": 37, + "line": 48, "column": 4 } } @@ -4167,15 +9858,15 @@ "binop": null }, "value": "_color", - "start": 1255, - "end": 1261, + "start": 1645, + "end": 1651, "loc": { "start": { - "line": 37, + "line": 48, "column": 4 }, "end": { - "line": 37, + "line": 48, "column": 10 } } @@ -4194,15 +9885,15 @@ "updateContext": null }, "value": "=", - "start": 1262, - "end": 1263, + "start": 1652, + "end": 1653, "loc": { "start": { - "line": 37, + "line": 48, "column": 11 }, "end": { - "line": 37, + "line": 48, "column": 12 } } @@ -4220,15 +9911,15 @@ "binop": null }, "value": "RED", - "start": 1264, - "end": 1267, + "start": 1654, + "end": 1657, "loc": { "start": { - "line": 37, + "line": 48, "column": 13 }, "end": { - "line": 37, + "line": 48, "column": 16 } } @@ -4246,15 +9937,15 @@ "binop": null, "updateContext": null }, - "start": 1267, - "end": 1268, + "start": 1657, + "end": 1658, "loc": { "start": { - "line": 37, + "line": 48, "column": 16 }, "end": { - "line": 37, + "line": 48, "column": 17 } } @@ -4272,15 +9963,15 @@ "binop": null }, "value": "s", - "start": 1271, - "end": 1272, + "start": 1661, + "end": 1662, "loc": { "start": { - "line": 38, + "line": 49, "column": 2 }, "end": { - "line": 38, + "line": 49, "column": 3 } } @@ -4298,15 +9989,15 @@ "binop": null, "updateContext": null }, - "start": 1272, - "end": 1273, + "start": 1662, + "end": 1663, "loc": { "start": { - "line": 38, + "line": 49, "column": 3 }, "end": { - "line": 38, + "line": 49, "column": 4 } } @@ -4324,15 +10015,15 @@ "binop": null }, "value": "left", - "start": 1273, - "end": 1277, + "start": 1663, + "end": 1667, "loc": { "start": { - "line": 38, + "line": 49, "column": 4 }, "end": { - "line": 38, + "line": 49, "column": 8 } } @@ -4350,15 +10041,15 @@ "binop": null, "updateContext": null }, - "start": 1277, - "end": 1278, + "start": 1667, + "end": 1668, "loc": { "start": { - "line": 38, + "line": 49, "column": 8 }, "end": { - "line": 38, + "line": 49, "column": 9 } } @@ -4376,15 +10067,15 @@ "binop": null }, "value": "_color", - "start": 1278, - "end": 1284, + "start": 1668, + "end": 1674, "loc": { "start": { - "line": 38, + "line": 49, "column": 9 }, "end": { - "line": 38, + "line": 49, "column": 15 } } @@ -4403,15 +10094,15 @@ "updateContext": null }, "value": "=", - "start": 1285, - "end": 1286, + "start": 1675, + "end": 1676, "loc": { "start": { - "line": 38, + "line": 49, "column": 16 }, "end": { - "line": 38, + "line": 49, "column": 17 } } @@ -4429,15 +10120,15 @@ "binop": null }, "value": "BLACK", - "start": 1287, - "end": 1292, + "start": 1677, + "end": 1682, "loc": { "start": { - "line": 38, + "line": 49, "column": 18 }, "end": { - "line": 38, + "line": 49, "column": 23 } } @@ -4455,15 +10146,15 @@ "binop": null, "updateContext": null }, - "start": 1292, - "end": 1293, + "start": 1682, + "end": 1683, "loc": { "start": { - "line": 38, + "line": 49, "column": 23 }, "end": { - "line": 38, + "line": 49, "column": 24 } } @@ -4481,15 +10172,15 @@ "binop": null }, "value": "rotate_right", - "start": 1296, - "end": 1308, + "start": 1686, + "end": 1698, "loc": { "start": { - "line": 39, + "line": 50, "column": 2 }, "end": { - "line": 39, + "line": 50, "column": 14 } } @@ -4506,15 +10197,15 @@ "postfix": false, "binop": null }, - "start": 1308, - "end": 1309, + "start": 1698, + "end": 1699, "loc": { "start": { - "line": 39, + "line": 50, "column": 14 }, "end": { - "line": 39, + "line": 50, "column": 15 } } @@ -4532,15 +10223,15 @@ "binop": null }, "value": "s", - "start": 1309, - "end": 1310, + "start": 1699, + "end": 1700, "loc": { "start": { - "line": 39, + "line": 50, "column": 15 }, "end": { - "line": 39, + "line": 50, "column": 16 } } @@ -4557,15 +10248,15 @@ "postfix": false, "binop": null }, - "start": 1310, - "end": 1311, + "start": 1700, + "end": 1701, "loc": { "start": { - "line": 39, + "line": 50, "column": 16 }, "end": { - "line": 39, + "line": 50, "column": 17 } } @@ -4583,15 +10274,15 @@ "binop": null, "updateContext": null }, - "start": 1311, - "end": 1312, + "start": 1701, + "end": 1702, "loc": { "start": { - "line": 39, + "line": 50, "column": 17 }, "end": { - "line": 39, + "line": 50, "column": 18 } } @@ -4608,15 +10299,15 @@ "postfix": false, "binop": null }, - "start": 1314, - "end": 1315, + "start": 1704, + "end": 1705, "loc": { "start": { - "line": 40, + "line": 51, "column": 1 }, "end": { - "line": 40, + "line": 51, "column": 2 } } @@ -4636,15 +10327,15 @@ "updateContext": null }, "value": "else", - "start": 1316, - "end": 1320, + "start": 1706, + "end": 1710, "loc": { "start": { - "line": 40, + "line": 51, "column": 3 }, "end": { - "line": 40, + "line": 51, "column": 7 } } @@ -4664,15 +10355,15 @@ "updateContext": null }, "value": "if", - "start": 1321, - "end": 1323, + "start": 1711, + "end": 1713, "loc": { "start": { - "line": 40, + "line": 51, "column": 8 }, "end": { - "line": 40, + "line": 51, "column": 10 } } @@ -4689,15 +10380,15 @@ "postfix": false, "binop": null }, - "start": 1324, - "end": 1325, + "start": 1714, + "end": 1715, "loc": { "start": { - "line": 40, + "line": 51, "column": 11 }, "end": { - "line": 40, + "line": 51, "column": 12 } } @@ -4715,15 +10406,15 @@ "binop": null }, "value": "n", - "start": 1325, - "end": 1326, + "start": 1715, + "end": 1716, "loc": { "start": { - "line": 40, + "line": 51, "column": 12 }, "end": { - "line": 40, + "line": 51, "column": 13 } } @@ -4742,15 +10433,15 @@ "updateContext": null }, "value": "===", - "start": 1327, - "end": 1330, + "start": 1717, + "end": 1720, "loc": { "start": { - "line": 40, + "line": 51, "column": 14 }, "end": { - "line": 40, + "line": 51, "column": 17 } } @@ -4768,15 +10459,15 @@ "binop": null }, "value": "n", - "start": 1331, - "end": 1332, + "start": 1721, + "end": 1722, "loc": { "start": { - "line": 40, + "line": 51, "column": 18 }, "end": { - "line": 40, + "line": 51, "column": 19 } } @@ -4794,15 +10485,15 @@ "binop": null, "updateContext": null }, - "start": 1332, - "end": 1333, + "start": 1722, + "end": 1723, "loc": { "start": { - "line": 40, + "line": 51, "column": 19 }, "end": { - "line": 40, + "line": 51, "column": 20 } } @@ -4820,15 +10511,15 @@ "binop": null }, "value": "parent", - "start": 1333, - "end": 1339, + "start": 1723, + "end": 1729, "loc": { "start": { - "line": 40, + "line": 51, "column": 20 }, "end": { - "line": 40, + "line": 51, "column": 26 } } @@ -4846,15 +10537,15 @@ "binop": null, "updateContext": null }, - "start": 1339, - "end": 1340, + "start": 1729, + "end": 1730, "loc": { "start": { - "line": 40, + "line": 51, "column": 26 }, "end": { - "line": 40, + "line": 51, "column": 27 } } @@ -4872,15 +10563,15 @@ "binop": null }, "value": "right", - "start": 1340, - "end": 1345, + "start": 1730, + "end": 1735, "loc": { "start": { - "line": 40, + "line": 51, "column": 27 }, "end": { - "line": 40, + "line": 51, "column": 32 } } @@ -4899,15 +10590,15 @@ "updateContext": null }, "value": "&&", - "start": 1346, - "end": 1348, + "start": 1736, + "end": 1738, "loc": { "start": { - "line": 40, + "line": 51, "column": 33 }, "end": { - "line": 40, + "line": 51, "column": 35 } } @@ -4925,15 +10616,15 @@ "binop": null }, "value": "s", - "start": 1349, - "end": 1350, + "start": 1739, + "end": 1740, "loc": { "start": { - "line": 40, + "line": 51, "column": 36 }, "end": { - "line": 40, + "line": 51, "column": 37 } } @@ -4951,15 +10642,15 @@ "binop": null, "updateContext": null }, - "start": 1350, - "end": 1351, + "start": 1740, + "end": 1741, "loc": { "start": { - "line": 40, + "line": 51, "column": 37 }, "end": { - "line": 40, + "line": 51, "column": 38 } } @@ -4977,15 +10668,15 @@ "binop": null }, "value": "left", - "start": 1351, - "end": 1355, + "start": 1741, + "end": 1745, "loc": { "start": { - "line": 40, + "line": 51, "column": 38 }, "end": { - "line": 40, + "line": 51, "column": 42 } } @@ -5003,15 +10694,15 @@ "binop": null, "updateContext": null }, - "start": 1355, - "end": 1356, + "start": 1745, + "end": 1746, "loc": { "start": { - "line": 40, + "line": 51, "column": 42 }, "end": { - "line": 40, + "line": 51, "column": 43 } } @@ -5029,15 +10720,15 @@ "binop": null }, "value": "_color", - "start": 1356, - "end": 1362, + "start": 1746, + "end": 1752, "loc": { "start": { - "line": 40, + "line": 51, "column": 43 }, "end": { - "line": 40, + "line": 51, "column": 49 } } @@ -5056,15 +10747,15 @@ "updateContext": null }, "value": "===", - "start": 1363, - "end": 1366, + "start": 1753, + "end": 1756, "loc": { "start": { - "line": 40, + "line": 51, "column": 50 }, "end": { - "line": 40, + "line": 51, "column": 53 } } @@ -5082,15 +10773,15 @@ "binop": null }, "value": "BLACK", - "start": 1367, - "end": 1372, + "start": 1757, + "end": 1762, "loc": { "start": { - "line": 40, + "line": 51, "column": 54 }, "end": { - "line": 40, + "line": 51, "column": 59 } } @@ -5107,15 +10798,15 @@ "postfix": false, "binop": null }, - "start": 1372, - "end": 1373, + "start": 1762, + "end": 1763, "loc": { "start": { - "line": 40, + "line": 51, "column": 59 }, "end": { - "line": 40, + "line": 51, "column": 60 } } @@ -5132,15 +10823,15 @@ "postfix": false, "binop": null }, - "start": 1374, - "end": 1375, + "start": 1764, + "end": 1765, "loc": { "start": { - "line": 40, + "line": 51, "column": 61 }, "end": { - "line": 40, + "line": 51, "column": 62 } } @@ -5148,15 +10839,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", - "start": 1378, - "end": 1751, + "start": 1768, + "end": 2141, "loc": { "start": { - "line": 41, + "line": 52, "column": 2 }, "end": { - "line": 51, + "line": 62, "column": 5 } } @@ -5174,15 +10865,15 @@ "binop": null }, "value": "s", - "start": 1754, - "end": 1755, + "start": 2144, + "end": 2145, "loc": { "start": { - "line": 52, + "line": 63, "column": 2 }, "end": { - "line": 52, + "line": 63, "column": 3 } } @@ -5200,15 +10891,15 @@ "binop": null, "updateContext": null }, - "start": 1755, - "end": 1756, + "start": 2145, + "end": 2146, "loc": { "start": { - "line": 52, + "line": 63, "column": 3 }, "end": { - "line": 52, + "line": 63, "column": 4 } } @@ -5226,15 +10917,15 @@ "binop": null }, "value": "_color", - "start": 1756, - "end": 1762, + "start": 2146, + "end": 2152, "loc": { "start": { - "line": 52, + "line": 63, "column": 4 }, "end": { - "line": 52, + "line": 63, "column": 10 } } @@ -5253,15 +10944,15 @@ "updateContext": null }, "value": "=", - "start": 1763, - "end": 1764, + "start": 2153, + "end": 2154, "loc": { "start": { - "line": 52, + "line": 63, "column": 11 }, "end": { - "line": 52, + "line": 63, "column": 12 } } @@ -5279,15 +10970,15 @@ "binop": null }, "value": "RED", - "start": 1765, - "end": 1768, + "start": 2155, + "end": 2158, "loc": { "start": { - "line": 52, + "line": 63, "column": 13 }, "end": { - "line": 52, + "line": 63, "column": 16 } } @@ -5305,15 +10996,15 @@ "binop": null, "updateContext": null }, - "start": 1768, - "end": 1769, + "start": 2158, + "end": 2159, "loc": { "start": { - "line": 52, + "line": 63, "column": 16 }, "end": { - "line": 52, + "line": 63, "column": 17 } } @@ -5331,15 +11022,15 @@ "binop": null }, "value": "s", - "start": 1772, - "end": 1773, + "start": 2162, + "end": 2163, "loc": { "start": { - "line": 53, + "line": 64, "column": 2 }, "end": { - "line": 53, + "line": 64, "column": 3 } } @@ -5357,15 +11048,15 @@ "binop": null, "updateContext": null }, - "start": 1773, - "end": 1774, + "start": 2163, + "end": 2164, "loc": { "start": { - "line": 53, + "line": 64, "column": 3 }, "end": { - "line": 53, + "line": 64, "column": 4 } } @@ -5383,15 +11074,15 @@ "binop": null }, "value": "right", - "start": 1774, - "end": 1779, + "start": 2164, + "end": 2169, "loc": { "start": { - "line": 53, + "line": 64, "column": 4 }, "end": { - "line": 53, + "line": 64, "column": 9 } } @@ -5409,15 +11100,15 @@ "binop": null, "updateContext": null }, - "start": 1779, - "end": 1780, + "start": 2169, + "end": 2170, "loc": { "start": { - "line": 53, + "line": 64, "column": 9 }, "end": { - "line": 53, + "line": 64, "column": 10 } } @@ -5435,15 +11126,15 @@ "binop": null }, "value": "_color", - "start": 1780, - "end": 1786, + "start": 2170, + "end": 2176, "loc": { "start": { - "line": 53, + "line": 64, "column": 10 }, "end": { - "line": 53, + "line": 64, "column": 16 } } @@ -5462,15 +11153,15 @@ "updateContext": null }, "value": "=", - "start": 1787, - "end": 1788, + "start": 2177, + "end": 2178, "loc": { "start": { - "line": 53, + "line": 64, "column": 17 }, "end": { - "line": 53, + "line": 64, "column": 18 } } @@ -5488,15 +11179,15 @@ "binop": null }, "value": "BLACK", - "start": 1789, - "end": 1794, + "start": 2179, + "end": 2184, "loc": { "start": { - "line": 53, + "line": 64, "column": 19 }, "end": { - "line": 53, + "line": 64, "column": 24 } } @@ -5514,15 +11205,15 @@ "binop": null, "updateContext": null }, - "start": 1794, - "end": 1795, + "start": 2184, + "end": 2185, "loc": { "start": { - "line": 53, + "line": 64, "column": 24 }, "end": { - "line": 53, + "line": 64, "column": 25 } } @@ -5540,15 +11231,15 @@ "binop": null }, "value": "rotate_left", - "start": 1798, - "end": 1809, + "start": 2188, + "end": 2199, "loc": { "start": { - "line": 54, + "line": 65, "column": 2 }, "end": { - "line": 54, + "line": 65, "column": 13 } } @@ -5565,15 +11256,15 @@ "postfix": false, "binop": null }, - "start": 1809, - "end": 1810, + "start": 2199, + "end": 2200, "loc": { "start": { - "line": 54, + "line": 65, "column": 13 }, "end": { - "line": 54, + "line": 65, "column": 14 } } @@ -5591,15 +11282,15 @@ "binop": null }, "value": "s", - "start": 1810, - "end": 1811, + "start": 2200, + "end": 2201, "loc": { "start": { - "line": 54, + "line": 65, "column": 14 }, "end": { - "line": 54, + "line": 65, "column": 15 } } @@ -5616,15 +11307,15 @@ "postfix": false, "binop": null }, - "start": 1811, - "end": 1812, + "start": 2201, + "end": 2202, "loc": { "start": { - "line": 54, + "line": 65, "column": 15 }, "end": { - "line": 54, + "line": 65, "column": 16 } } @@ -5642,15 +11333,15 @@ "binop": null, "updateContext": null }, - "start": 1812, - "end": 1813, + "start": 2202, + "end": 2203, "loc": { "start": { - "line": 54, + "line": 65, "column": 16 }, "end": { - "line": 54, + "line": 65, "column": 17 } } @@ -5667,15 +11358,15 @@ "postfix": false, "binop": null }, - "start": 1815, - "end": 1816, + "start": 2205, + "end": 2206, "loc": { "start": { - "line": 55, + "line": 66, "column": 1 }, "end": { - "line": 55, + "line": 66, "column": 2 } } @@ -5693,15 +11384,15 @@ "binop": null }, "value": "delete_case6", - "start": 1819, - "end": 1831, + "start": 2209, + "end": 2221, "loc": { "start": { - "line": 57, + "line": 68, "column": 1 }, "end": { - "line": 57, + "line": 68, "column": 13 } } @@ -5718,15 +11409,15 @@ "postfix": false, "binop": null }, - "start": 1831, - "end": 1832, + "start": 2221, + "end": 2222, "loc": { "start": { - "line": 57, + "line": 68, "column": 13 }, "end": { - "line": 57, + "line": 68, "column": 14 } } @@ -5744,15 +11435,15 @@ "binop": null }, "value": "n", - "start": 1832, - "end": 1833, + "start": 2222, + "end": 2223, "loc": { "start": { - "line": 57, + "line": 68, "column": 14 }, "end": { - "line": 57, + "line": 68, "column": 15 } } @@ -5769,15 +11460,15 @@ "postfix": false, "binop": null }, - "start": 1833, - "end": 1834, + "start": 2223, + "end": 2224, "loc": { "start": { - "line": 57, + "line": 68, "column": 15 }, "end": { - "line": 57, + "line": 68, "column": 16 } } @@ -5795,15 +11486,15 @@ "binop": null, "updateContext": null }, - "start": 1834, - "end": 1835, + "start": 2224, + "end": 2225, "loc": { "start": { - "line": 57, + "line": 68, "column": 16 }, "end": { - "line": 57, + "line": 68, "column": 17 } } @@ -5820,15 +11511,15 @@ "postfix": false, "binop": null }, - "start": 1836, - "end": 1837, + "start": 2226, + "end": 2227, "loc": { "start": { - "line": 58, + "line": 69, "column": 0 }, "end": { - "line": 58, + "line": 69, "column": 1 } } @@ -5846,19 +11537,127 @@ "binop": null, "updateContext": null }, - "start": 1837, - "end": 1838, + "start": 2227, + "end": 2228, "loc": { "start": { - "line": 58, + "line": 69, "column": 1 }, "end": { - "line": 58, + "line": 69, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 2230, + "end": 2236, + "loc": { + "start": { + "line": 71, + "column": 0 + }, + "end": { + "line": 71, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 2237, + "end": 2244, + "loc": { + "start": { + "line": 71, + "column": 7 + }, + "end": { + "line": 71, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case5", + "start": 2245, + "end": 2257, + "loc": { + "start": { + "line": 71, + "column": 15 + }, + "end": { + "line": 71, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2257, + "end": 2258, + "loc": { + "start": { + "line": 71, + "column": 27 + }, + "end": { + "line": 71, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -5872,15 +11671,15 @@ "binop": null, "updateContext": null }, - "start": 1839, - "end": 1839, + "start": 2259, + "end": 2259, "loc": { "start": { - "line": 59, + "line": 72, "column": 0 }, "end": { - "line": 59, + "line": 72, "column": 0 } } diff --git a/ast/source/deletion/delete_case6.js.json b/ast/source/deletion/delete_case6.js.json index 4712c80..a4e5b6f 100644 --- a/ast/source/deletion/delete_case6.js.json +++ b/ast/source/deletion/delete_case6.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1525, + "end": 1961, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 52, + "line": 66, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1525, + "end": 1961, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 52, + "line": 66, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 40, + "end": 28, "loc": { "start": { "line": 1, @@ -39,53 +39,105 @@ }, "end": { "line": 1, - "column": 40 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 41, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 12 }, "identifierName": "BLACK" }, @@ -95,16 +147,16 @@ ], "source": { "type": "StringLiteral", - "start": 20, - "end": 39, + "start": 47, + "end": 66, "loc": { "start": { - "line": 1, - "column": 20 + "line": 2, + "column": 18 }, "end": { - "line": 1, - "column": 39 + "line": 2, + "column": 37 } }, "extra": { @@ -116,197 +168,390 @@ }, { "type": "ImportDeclaration", - "start": 41, + "start": 68, "end": 102, "loc": { "start": { - "line": 2, + "line": 3, "column": 0 }, "end": { - "line": 2, - "column": 61 + "line": 3, + "column": 34 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 49, - "end": 60, + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 78, "loc": { "start": { - "line": 2, - "column": 8 + "line": 3, + "column": 7 }, "end": { - "line": 2, - "column": 19 + "line": 3, + "column": 10 } }, - "imported": { + "local": { "type": "Identifier", - "start": 49, - "end": 60, + "start": 75, + "end": 78, "loc": { "start": { - "line": 2, - "column": 8 + "line": 3, + "column": 7 }, "end": { - "line": 2, - "column": 19 + "line": 3, + "column": 10 }, - "identifierName": "rotate_left" + "identifierName": "RED" }, - "name": "rotate_left" + "name": "RED" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "extra": { + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" + }, + "value": "../color/RED.js" + } + }, + { + "type": "ImportDeclaration", + "start": 103, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 49, - "end": 60, + "start": 110, + "end": 114, "loc": { "start": { - "line": 2, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 2, - "column": 19 + "line": 4, + "column": 11 }, - "identifierName": "rotate_left" + "identifierName": "Node" }, - "name": "rotate_left" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 120, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 } }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 140, + "end": 176, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 36 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 62, - "end": 74, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 151, "loc": { "start": { - "line": 2, - "column": 21 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 5, + "column": 11 } }, - "imported": { + "local": { "type": "Identifier", - "start": 62, - "end": 74, + "start": 147, + "end": 151, "loc": { "start": { - "line": 2, - "column": 21 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 5, + "column": 11 }, - "identifierName": "rotate_right" + "identifierName": "Leaf" }, - "name": "rotate_right" + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + } + }, + { + "type": "ImportDeclaration", + "start": 177, + "end": 228, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 51 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 184, + "end": 195, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + } }, "local": { "type": "Identifier", - "start": 62, - "end": 74, + "start": 184, + "end": 195, "loc": { "start": { - "line": 2, - "column": 21 + "line": 6, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 6, + "column": 18 }, - "identifierName": "rotate_right" + "identifierName": "rotate_left" }, - "name": "rotate_right" + "name": "rotate_left" } } ], "source": { "type": "StringLiteral", - "start": 81, - "end": 101, + "start": 201, + "end": 227, "loc": { "start": { - "line": 2, - "column": 40 + "line": 6, + "column": 24 }, "end": { - "line": 2, - "column": 60 + "line": 6, + "column": 50 } }, "extra": { - "rawValue": "../rotate/index.js", - "raw": "'../rotate/index.js'" + "rawValue": "../rotate/rotate_left.js", + "raw": "'../rotate/rotate_left.js'" }, - "value": "../rotate/index.js" + "value": "../rotate/rotate_left.js" } }, { "type": "ImportDeclaration", - "start": 103, - "end": 148, + "start": 229, + "end": 282, "loc": { "start": { - "line": 3, + "line": 7, "column": 0 }, "end": { - "line": 3, - "column": 45 + "line": 7, + "column": 53 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 111, - "end": 118, + "type": "ImportDefaultSpecifier", + "start": 236, + "end": 248, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 15 + "line": 7, + "column": 19 } }, - "imported": { + "local": { "type": "Identifier", - "start": 111, - "end": 118, + "start": 236, + "end": 248, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 15 + "line": 7, + "column": 19 }, - "identifierName": "sibling" + "identifierName": "rotate_right" }, - "name": "sibling" + "name": "rotate_right" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 254, + "end": 281, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 52 + } + }, + "extra": { + "rawValue": "../rotate/rotate_right.js", + "raw": "'../rotate/rotate_right.js'" + }, + "value": "../rotate/rotate_right.js" + } + }, + { + "type": "ImportDeclaration", + "start": 283, + "end": 326, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 43 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 290, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } }, "local": { "type": "Identifier", - "start": 111, - "end": 118, + "start": 290, + "end": 297, "loc": { "start": { - "line": 3, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 3, - "column": 15 + "line": 8, + "column": 14 }, "identifierName": "sibling" }, @@ -316,16 +561,16 @@ ], "source": { "type": "StringLiteral", - "start": 125, - "end": 147, + "start": 303, + "end": 325, "loc": { "start": { - "line": 3, - "column": 22 + "line": 8, + "column": 20 }, "end": { - "line": 3, - "column": 44 + "line": 8, + "column": 42 } }, "extra": { @@ -337,16 +582,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", - "start": 150, - "end": 550, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 328, + "end": 733, "loc": { "start": { - "line": 5, + "line": 10, "column": 0 }, "end": { - "line": 16, + "line": 21, "column": 3 } } @@ -354,377 +599,487 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 551, - "end": 1524, + "type": "Identifier", + "start": 734, + "end": 1930, "loc": { "start": { - "line": 17, + "line": 22, "column": 0 }, "end": { - "line": 51, + "line": 63, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 558, - "end": 1524, - "loc": { - "start": { - "line": 17, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 740, + "end": 1929, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 63, + "column": 1 + } }, - "end": { - "line": 51, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 564, - "end": 1523, + "id": { + "type": "Identifier", + "start": 740, + "end": 752, "loc": { "start": { - "line": 17, - "column": 13 + "line": 22, + "column": 6 }, "end": { - "line": 51, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 564, - "end": 576, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 25 - }, - "identifierName": "delete_case6" + "line": 22, + "column": 18 }, - "name": "delete_case6", - "leadingComments": null + "identifierName": "delete_case6" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 579, - "end": 1523, - "loc": { - "start": { - "line": 17, - "column": 28 - }, - "end": { - "line": 51, - "column": 1 - } + "name": "delete_case6", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 755, + "end": 1929, + "loc": { + "start": { + "line": 22, + "column": 21 }, - "id": { + "end": { + "line": 63, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 564, - "end": 576, + "start": 756, + "end": 757, "loc": { "start": { - "line": 17, - "column": 13 + "line": 22, + "column": 22 }, "end": { - "line": 17, - "column": 25 + "line": 22, + "column": 23 }, - "identifierName": "delete_case6" + "identifierName": "n" }, - "name": "delete_case6", - "leadingComments": null + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 762, + "end": 1929, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 63, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 580, - "end": 581, + "type": "ExpressionStatement", + "start": 765, + "end": 812, "loc": { "start": { - "line": 17, - "column": 29 + "line": 23, + "column": 1 }, "end": { - "line": 17, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 586, - "end": 1523, - "loc": { - "start": { - "line": 17, - "column": 35 + "line": 23, + "column": 48 + } }, - "end": { - "line": 51, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 589, - "end": 610, + "expression": { + "type": "CallExpression", + "start": 765, + "end": 811, "loc": { "start": { - "line": 18, + "line": 23, "column": 1 }, "end": { - "line": 18, - "column": 22 + "line": 23, + "column": 47 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 765, + "end": 771, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 595, - "end": 609, + "type": "LogicalExpression", + "start": 772, + "end": 810, "loc": { "start": { - "line": 18, - "column": 7 + "line": 23, + "column": 8 }, "end": { - "line": 18, - "column": 21 + "line": 23, + "column": 46 } }, - "id": { - "type": "Identifier", - "start": 595, - "end": 596, + "left": { + "type": "BinaryExpression", + "start": 772, + "end": 789, "loc": { "start": { - "line": 18, - "column": 7 + "line": 23, + "column": 8 }, "end": { - "line": 18, - "column": 8 + "line": 23, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 772, + "end": 773, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "s" + "name": "n" }, - "name": "s" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 785, + "end": 789, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } }, - "init": { - "type": "CallExpression", - "start": 599, - "end": 609, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 793, + "end": 810, "loc": { "start": { - "line": 18, - "column": 11 + "line": 23, + "column": 29 }, "end": { - "line": 18, - "column": 21 + "line": 23, + "column": 46 } }, - "callee": { + "left": { "type": "Identifier", - "start": 599, - "end": 606, + "start": 793, + "end": 794, "loc": { "start": { - "line": 18, - "column": 11 + "line": 23, + "column": 29 }, "end": { - "line": 18, - "column": 18 + "line": 23, + "column": 30 }, - "identifierName": "sibling" + "identifierName": "n" }, - "name": "sibling" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 607, - "end": 608, - "loc": { - "start": { - "line": 18, - "column": 19 - }, - "end": { - "line": 18, - "column": 20 - }, - "identifierName": "n" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 806, + "end": 810, + "loc": { + "start": { + "line": 23, + "column": 42 }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 613, - "end": 1300, - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 36, - "column": 4 + "end": { + "line": 23, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" } } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 814, + "end": 841, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 28 + } }, - { - "type": "ExpressionStatement", - "start": 1303, - "end": 1330, + "expression": { + "type": "CallExpression", + "start": 814, + "end": 840, "loc": { "start": { - "line": 38, + "line": 24, "column": 1 }, "end": { - "line": 38, - "column": 28 + "line": 24, + "column": 27 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1303, - "end": 1329, + "callee": { + "type": "Identifier", + "start": 814, + "end": 820, "loc": { "start": { - "line": 38, + "line": 24, "column": 1 }, "end": { - "line": 38, - "column": 27 - } + "line": 24, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1303, - "end": 1311, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 821, + "end": 839, "loc": { "start": { - "line": 38, - "column": 1 + "line": 24, + "column": 8 }, "end": { - "line": 38, - "column": 9 + "line": 24, + "column": 26 } }, - "object": { - "type": "Identifier", - "start": 1303, - "end": 1304, + "left": { + "type": "MemberExpression", + "start": 821, + "end": 829, "loc": { "start": { - "line": 38, - "column": 1 + "line": 24, + "column": 8 }, "end": { - "line": 38, - "column": 2 + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 821, + "end": 822, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "s" + "name": "n" }, - "name": "s", - "leadingComments": null + "property": { + "type": "Identifier", + "start": 823, + "end": 829, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 1305, - "end": 1311, + "start": 834, + "end": 839, "loc": { "start": { - "line": 38, - "column": 3 + "line": 24, + "column": 21 }, "end": { - "line": 38, - "column": 9 + "line": 24, + "column": 26 }, - "identifierName": "_color" + "identifierName": "BLACK" }, - "name": "_color" + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 843, + "end": 869, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 843, + "end": 868, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 843, + "end": 849, + "loc": { + "start": { + "line": 25, + "column": 1 }, - "computed": false, - "leadingComments": null + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" }, - "right": { - "type": "MemberExpression", - "start": 1314, - "end": 1329, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 850, + "end": 867, "loc": { "start": { - "line": 38, - "column": 12 + "line": 25, + "column": 8 }, "end": { - "line": 38, - "column": 27 + "line": 25, + "column": 25 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 1314, - "end": 1322, + "start": 850, + "end": 858, "loc": { "start": { - "line": 38, - "column": 12 + "line": 25, + "column": 8 }, "end": { - "line": 38, - "column": 20 + "line": 25, + "column": 16 } }, "object": { "type": "Identifier", - "start": 1314, - "end": 1315, + "start": 850, + "end": 851, "loc": { "start": { - "line": 38, - "column": 12 + "line": 25, + "column": 8 }, "end": { - "line": 38, - "column": 13 + "line": 25, + "column": 9 }, "identifierName": "n" }, @@ -732,16 +1087,16 @@ }, "property": { "type": "Identifier", - "start": 1316, - "end": 1322, + "start": 852, + "end": 858, "loc": { "start": { - "line": 38, - "column": 14 + "line": 25, + "column": 10 }, "end": { - "line": 38, - "column": 20 + "line": 25, + "column": 16 }, "identifierName": "parent" }, @@ -749,950 +1104,6007 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 1323, - "end": 1329, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 863, + "end": 867, "loc": { "start": { - "line": 38, + "line": 25, "column": 21 }, "end": { - "line": 38, - "column": 27 - }, - "identifierName": "_color" + "line": 25, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 871, + "end": 892, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 877, + "end": 891, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 877, + "end": 878, + "loc": { + "start": { + "line": 26, + "column": 7 }, - "name": "_color" + "end": { + "line": 26, + "column": 8 + }, + "identifierName": "s" }, - "computed": false + "name": "s" }, - "leadingComments": null + "init": { + "type": "CallExpression", + "start": 881, + "end": 891, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 881, + "end": 888, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 889, + "end": 890, + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 894, + "end": 920, + "loc": { + "start": { + "line": 27, + "column": 1 }, - "leadingComments": [ + "end": { + "line": 27, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 894, + "end": 919, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 894, + "end": 900, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 613, - "end": 1300, + "type": "BinaryExpression", + "start": 901, + "end": 918, "loc": { "start": { - "line": 20, - "column": 1 + "line": 27, + "column": 8 }, "end": { - "line": 36, - "column": 4 + "line": 27, + "column": 25 } + }, + "left": { + "type": "Identifier", + "start": 901, + "end": 902, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 914, + "end": 918, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 922, + "end": 949, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 28 + } }, - { - "type": "ExpressionStatement", - "start": 1332, - "end": 1356, + "expression": { + "type": "CallExpression", + "start": 922, + "end": 948, "loc": { "start": { - "line": 39, + "line": 28, "column": 1 }, "end": { - "line": 39, - "column": 25 + "line": 28, + "column": 27 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1332, - "end": 1355, + "callee": { + "type": "Identifier", + "start": 922, + "end": 928, "loc": { "start": { - "line": 39, + "line": 28, "column": 1 }, "end": { - "line": 39, - "column": 24 - } + "line": 28, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1332, - "end": 1347, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 929, + "end": 947, "loc": { "start": { - "line": 39, - "column": 1 + "line": 28, + "column": 8 }, "end": { - "line": 39, - "column": 16 + "line": 28, + "column": 26 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 1332, - "end": 1340, + "start": 929, + "end": 937, "loc": { "start": { - "line": 39, - "column": 1 + "line": 28, + "column": 8 }, "end": { - "line": 39, - "column": 9 + "line": 28, + "column": 16 } }, "object": { "type": "Identifier", - "start": 1332, - "end": 1333, + "start": 929, + "end": 930, "loc": { "start": { - "line": 39, - "column": 1 + "line": 28, + "column": 8 }, "end": { - "line": 39, - "column": 2 + "line": 28, + "column": 9 }, - "identifierName": "n" + "identifierName": "s" }, - "name": "n" + "name": "s" }, "property": { "type": "Identifier", - "start": 1334, - "end": 1340, + "start": 931, + "end": 937, "loc": { "start": { - "line": 39, - "column": 3 + "line": 28, + "column": 10 }, "end": { - "line": 39, - "column": 9 + "line": 28, + "column": 16 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 1341, - "end": 1347, + "start": 942, + "end": 947, "loc": { "start": { - "line": 39, - "column": 10 + "line": 28, + "column": 21 }, "end": { - "line": 39, - "column": 16 + "line": 28, + "column": 26 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1350, - "end": 1355, - "loc": { - "start": { - "line": 39, - "column": 19 - }, - "end": { - "line": 39, - "column": 24 + "identifierName": "BLACK" }, - "identifierName": "BLACK" + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 952, + "end": 1639, + "loc": { + "start": { + "line": 30, + "column": 1 }, - "name": "BLACK" + "end": { + "line": 46, + "column": 4 + } } } + ] + }, + { + "type": "ExpressionStatement", + "start": 1642, + "end": 1669, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 28 + } }, - { - "type": "IfStatement", - "start": 1359, - "end": 1521, + "expression": { + "type": "AssignmentExpression", + "start": 1642, + "end": 1668, "loc": { "start": { - "line": 41, + "line": 48, "column": 1 }, "end": { - "line": 50, - "column": 2 + "line": 48, + "column": 27 } }, - "test": { - "type": "BinaryExpression", - "start": 1363, - "end": 1382, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1642, + "end": 1650, "loc": { "start": { - "line": 41, - "column": 5 + "line": 48, + "column": 1 }, "end": { - "line": 41, - "column": 24 + "line": 48, + "column": 9 } }, - "left": { + "object": { "type": "Identifier", - "start": 1363, - "end": 1364, + "start": 1642, + "end": 1643, "loc": { "start": { - "line": 41, - "column": 5 + "line": 48, + "column": 1 }, "end": { - "line": 41, - "column": 6 + "line": 48, + "column": 2 }, - "identifierName": "n" + "identifierName": "s" }, - "name": "n" + "name": "s", + "leadingComments": null }, - "operator": "===", - "right": { + "property": { + "type": "Identifier", + "start": 1644, + "end": 1650, + "loc": { + "start": { + "line": 48, + "column": 3 + }, + "end": { + "line": 48, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "MemberExpression", + "start": 1653, + "end": 1668, + "loc": { + "start": { + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 27 + } + }, + "object": { "type": "MemberExpression", - "start": 1369, - "end": 1382, + "start": 1653, + "end": 1661, "loc": { "start": { - "line": 41, - "column": 11 + "line": 48, + "column": 12 }, "end": { - "line": 41, - "column": 24 + "line": 48, + "column": 20 } }, "object": { - "type": "MemberExpression", - "start": 1369, - "end": 1377, + "type": "Identifier", + "start": 1653, + "end": 1654, "loc": { "start": { - "line": 41, - "column": 11 + "line": 48, + "column": 12 }, "end": { - "line": 41, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 1369, - "end": 1370, - "loc": { - "start": { - "line": 41, - "column": 11 - }, - "end": { - "line": 41, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1371, - "end": 1377, - "loc": { - "start": { - "line": 41, - "column": 13 - }, - "end": { - "line": 41, - "column": 19 - }, - "identifierName": "parent" + "line": 48, + "column": 13 }, - "name": "parent" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1378, - "end": 1382, + "start": 1655, + "end": 1661, "loc": { "start": { - "line": 41, + "line": 48, + "column": 14 + }, + "end": { + "line": 48, "column": 20 }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1662, + "end": 1668, + "loc": { + "start": { + "line": 48, + "column": 21 + }, + "end": { + "line": 48, + "column": 27 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 952, + "end": 1639, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1671, + "end": 1695, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1671, + "end": 1694, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1671, + "end": 1686, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 1671, + "end": 1679, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1671, + "end": 1672, + "loc": { + "start": { + "line": 49, + "column": 1 + }, "end": { - "line": 41, - "column": 24 + "line": 49, + "column": 2 }, - "identifierName": "left" + "identifierName": "n" }, - "name": "left" + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1673, + "end": 1679, + "loc": { + "start": { + "line": 49, + "column": 3 + }, + "end": { + "line": 49, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" }, "computed": false + }, + "property": { + "type": "Identifier", + "start": 1680, + "end": 1686, + "loc": { + "start": { + "line": 49, + "column": 10 + }, + "end": { + "line": 49, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1689, + "end": 1694, + "loc": { + "start": { + "line": 49, + "column": 19 + }, + "end": { + "line": 49, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1698, + "end": 1927, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 62, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1702, + "end": 1721, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 24 } }, - "consequent": { - "type": "BlockStatement", - "start": 1384, - "end": 1439, + "left": { + "type": "Identifier", + "start": 1702, + "end": 1703, "loc": { "start": { - "line": 41, - "column": 26 + "line": 51, + "column": 5 }, "end": { - "line": 44, - "column": 2 + "line": 51, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1708, + "end": 1721, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 24 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1388, - "end": 1411, + "object": { + "type": "MemberExpression", + "start": 1708, + "end": 1716, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 1708, + "end": 1709, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1710, + "end": 1716, + "loc": { + "start": { + "line": 51, + "column": 13 + }, + "end": { + "line": 51, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1717, + "end": 1721, + "loc": { + "start": { + "line": 51, + "column": 20 + }, + "end": { + "line": 51, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1723, + "end": 1812, + "loc": { + "start": { + "line": 51, + "column": 26 + }, + "end": { + "line": 55, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1727, + "end": 1758, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 1727, + "end": 1757, "loc": { "start": { - "line": 42, + "line": 52, "column": 2 }, "end": { - "line": 42, - "column": 25 + "line": 52, + "column": 32 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1388, - "end": 1410, + "callee": { + "type": "Identifier", + "start": 1727, + "end": 1733, "loc": { "start": { - "line": 42, + "line": 52, "column": 2 }, "end": { - "line": 42, - "column": 24 - } + "line": 52, + "column": 8 + }, + "identifierName": "assert" }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1388, - "end": 1402, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1734, + "end": 1756, "loc": { "start": { - "line": 42, - "column": 2 + "line": 52, + "column": 9 }, "end": { - "line": 42, - "column": 16 + "line": 52, + "column": 31 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 1388, - "end": 1395, + "start": 1734, + "end": 1748, "loc": { "start": { - "line": 42, - "column": 2 + "line": 52, + "column": 9 }, "end": { - "line": 42, - "column": 9 + "line": 52, + "column": 23 } }, "object": { - "type": "Identifier", - "start": 1388, - "end": 1389, + "type": "MemberExpression", + "start": 1734, + "end": 1741, "loc": { "start": { - "line": 42, - "column": 2 + "line": 52, + "column": 9 }, "end": { - "line": 42, - "column": 3 + "line": 52, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1734, + "end": 1735, + "loc": { + "start": { + "line": 52, + "column": 9 + }, + "end": { + "line": 52, + "column": 10 + }, + "identifierName": "s" }, - "identifierName": "s" + "name": "s" }, - "name": "s" + "property": { + "type": "Identifier", + "start": 1736, + "end": 1741, + "loc": { + "start": { + "line": 52, + "column": 11 + }, + "end": { + "line": 52, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 1390, - "end": 1395, + "start": 1742, + "end": 1748, "loc": { "start": { - "line": 42, - "column": 4 + "line": 52, + "column": 17 }, "end": { - "line": 42, - "column": 9 + "line": 52, + "column": 23 }, - "identifierName": "right" + "identifierName": "_color" }, - "name": "right" + "name": "_color" }, "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 1396, - "end": 1402, + "start": 1753, + "end": 1756, "loc": { "start": { - "line": 42, - "column": 10 + "line": 52, + "column": 28 }, "end": { - "line": 42, - "column": 16 + "line": 52, + "column": 31 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1405, - "end": 1410, - "loc": { - "start": { - "line": 42, - "column": 19 - }, - "end": { - "line": 42, - "column": 24 + "identifierName": "RED" }, - "identifierName": "BLACK" - }, - "name": "BLACK" + "name": "RED" + } } - } - }, - { - "type": "ExpressionStatement", - "start": 1414, - "end": 1436, - "loc": { - "start": { - "line": 43, - "column": 2 + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1761, + "end": 1784, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1761, + "end": 1783, + "loc": { + "start": { + "line": 53, + "column": 2 }, "end": { - "line": 43, + "line": 53, "column": 24 } }, - "expression": { - "type": "CallExpression", - "start": 1414, - "end": 1435, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1761, + "end": 1775, "loc": { "start": { - "line": 43, + "line": 53, "column": 2 }, "end": { - "line": 43, - "column": 23 + "line": 53, + "column": 16 } }, - "callee": { - "type": "Identifier", - "start": 1414, - "end": 1425, + "object": { + "type": "MemberExpression", + "start": 1761, + "end": 1768, "loc": { "start": { - "line": 43, + "line": 53, "column": 2 }, "end": { - "line": 43, - "column": 13 - }, - "identifierName": "rotate_left" + "line": 53, + "column": 9 + } }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1426, - "end": 1434, + "object": { + "type": "Identifier", + "start": 1761, + "end": 1762, "loc": { "start": { - "line": 43, - "column": 14 + "line": 53, + "column": 2 }, "end": { - "line": 43, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 1426, - "end": 1427, - "loc": { - "start": { - "line": 43, - "column": 14 - }, - "end": { - "line": 43, - "column": 15 - }, - "identifierName": "n" + "line": 53, + "column": 3 }, - "name": "n" + "identifierName": "s" }, - "property": { - "type": "Identifier", - "start": 1428, - "end": 1434, - "loc": { - "start": { - "line": 43, - "column": 16 - }, - "end": { - "line": 43, - "column": 22 - }, - "identifierName": "parent" + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1763, + "end": 1768, + "loc": { + "start": { + "line": 53, + "column": 4 }, - "name": "parent" + "end": { + "line": 53, + "column": 9 + }, + "identifierName": "right" }, - "computed": false - } - ] + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1769, + "end": 1775, + "loc": { + "start": { + "line": 53, + "column": 10 + }, + "end": { + "line": 53, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1778, + "end": 1783, + "loc": { + "start": { + "line": 53, + "column": 19 + }, + "end": { + "line": 53, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1442, - "end": 1459, + }, + { + "type": "ExpressionStatement", + "start": 1787, + "end": 1809, + "loc": { + "start": { + "line": 54, + "column": 2 + }, + "end": { + "line": 54, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1787, + "end": 1808, "loc": { "start": { - "line": 46, - "column": 1 + "line": 54, + "column": 2 }, "end": { - "line": 46, - "column": 18 + "line": 54, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1787, + "end": 1798, + "loc": { + "start": { + "line": 54, + "column": 2 + }, + "end": { + "line": 54, + "column": 13 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1799, + "end": 1807, + "loc": { + "start": { + "line": 54, + "column": 14 + }, + "end": { + "line": 54, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 1799, + "end": 1800, + "loc": { + "start": { + "line": 54, + "column": 14 + }, + "end": { + "line": 54, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1801, + "end": 1807, + "loc": { + "start": { + "line": 54, + "column": 16 + }, + "end": { + "line": 54, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } + ] + } + } + ], + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1815, + "end": 1832, + "loc": { + "start": { + "line": 57, + "column": 1 + }, + "end": { + "line": 57, + "column": 18 } } - ] + } + ] + }, + "alternate": { + "type": "BlockStatement", + "start": 1839, + "end": 1927, + "loc": { + "start": { + "line": 58, + "column": 6 + }, + "end": { + "line": 62, + "column": 2 + } }, - "alternate": { - "type": "BlockStatement", - "start": 1466, - "end": 1521, - "loc": { - "start": { - "line": 47, - "column": 6 + "body": [ + { + "type": "ExpressionStatement", + "start": 1843, + "end": 1873, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 32 + } }, - "end": { - "line": 50, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1470, - "end": 1492, + "expression": { + "type": "CallExpression", + "start": 1843, + "end": 1872, "loc": { "start": { - "line": 48, + "line": 59, "column": 2 }, "end": { - "line": 48, - "column": 24 + "line": 59, + "column": 31 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1470, - "end": 1491, + "callee": { + "type": "Identifier", + "start": 1843, + "end": 1849, "loc": { "start": { - "line": 48, + "line": 59, "column": 2 }, "end": { - "line": 48, - "column": 23 - } + "line": 59, + "column": 8 + }, + "identifierName": "assert" }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1470, - "end": 1483, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1850, + "end": 1871, "loc": { "start": { - "line": 48, - "column": 2 + "line": 59, + "column": 9 }, "end": { - "line": 48, - "column": 15 + "line": 59, + "column": 30 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 1470, - "end": 1476, + "start": 1850, + "end": 1863, "loc": { "start": { - "line": 48, - "column": 2 + "line": 59, + "column": 9 }, "end": { - "line": 48, - "column": 8 + "line": 59, + "column": 22 } }, "object": { - "type": "Identifier", - "start": 1470, - "end": 1471, + "type": "MemberExpression", + "start": 1850, + "end": 1856, "loc": { "start": { - "line": 48, - "column": 2 + "line": 59, + "column": 9 }, "end": { - "line": 48, - "column": 3 + "line": 59, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1850, + "end": 1851, + "loc": { + "start": { + "line": 59, + "column": 9 + }, + "end": { + "line": 59, + "column": 10 + }, + "identifierName": "s" }, - "identifierName": "s" + "name": "s" }, - "name": "s", - "leadingComments": null + "property": { + "type": "Identifier", + "start": 1852, + "end": 1856, + "loc": { + "start": { + "line": 59, + "column": 11 + }, + "end": { + "line": 59, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 1472, - "end": 1476, + "start": 1857, + "end": 1863, "loc": { "start": { - "line": 48, - "column": 4 + "line": 59, + "column": 16 }, "end": { - "line": 48, - "column": 8 + "line": 59, + "column": 22 }, - "identifierName": "left" + "identifierName": "_color" }, - "name": "left" + "name": "_color" }, - "computed": false, - "leadingComments": null + "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 1477, - "end": 1483, + "start": 1868, + "end": 1871, "loc": { "start": { - "line": 48, - "column": 9 + "line": 59, + "column": 27 }, "end": { - "line": 48, - "column": 15 + "line": 59, + "column": 30 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 1486, - "end": 1491, - "loc": { - "start": { - "line": 48, - "column": 18 - }, - "end": { - "line": 48, - "column": 23 + "identifierName": "RED" }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, + "name": "RED" + } + } + ], "leadingComments": null }, - { - "type": "ExpressionStatement", - "start": 1495, - "end": 1518, + "leadingComments": null + }, + { + "type": "ExpressionStatement", + "start": 1876, + "end": 1898, + "loc": { + "start": { + "line": 60, + "column": 2 + }, + "end": { + "line": 60, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1876, + "end": 1897, "loc": { "start": { - "line": 49, + "line": 60, "column": 2 }, "end": { - "line": 49, - "column": 25 + "line": 60, + "column": 23 } }, - "expression": { - "type": "CallExpression", - "start": 1495, - "end": 1517, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1876, + "end": 1889, "loc": { "start": { - "line": 49, + "line": 60, "column": 2 }, "end": { - "line": 49, - "column": 24 + "line": 60, + "column": 15 } }, - "callee": { - "type": "Identifier", - "start": 1495, - "end": 1507, + "object": { + "type": "MemberExpression", + "start": 1876, + "end": 1882, "loc": { "start": { - "line": 49, + "line": 60, "column": 2 }, "end": { - "line": 49, - "column": 14 - }, - "identifierName": "rotate_right" + "line": 60, + "column": 8 + } }, - "name": "rotate_right" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1508, - "end": 1516, + "object": { + "type": "Identifier", + "start": 1876, + "end": 1877, "loc": { "start": { - "line": 49, - "column": 15 + "line": 60, + "column": 2 }, "end": { - "line": 49, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1508, - "end": 1509, - "loc": { - "start": { - "line": 49, - "column": 15 - }, - "end": { - "line": 49, - "column": 16 - }, - "identifierName": "n" + "line": 60, + "column": 3 }, - "name": "n" + "identifierName": "s" }, - "property": { - "type": "Identifier", - "start": 1510, - "end": 1516, - "loc": { - "start": { - "line": 49, - "column": 17 - }, - "end": { - "line": 49, - "column": 23 - }, - "identifierName": "parent" + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1878, + "end": 1882, + "loc": { + "start": { + "line": 60, + "column": 4 }, - "name": "parent" + "end": { + "line": 60, + "column": 8 + }, + "identifierName": "left" }, - "computed": false - } - ] + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1883, + "end": 1889, + "loc": { + "start": { + "line": 60, + "column": 9 + }, + "end": { + "line": 60, + "column": 15 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1892, + "end": 1897, + "loc": { + "start": { + "line": 60, + "column": 18 + }, + "end": { + "line": 60, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } } - ], - "directives": [], - "leadingComments": [ - { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1442, - "end": 1459, + }, + { + "type": "ExpressionStatement", + "start": 1901, + "end": 1924, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 61, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 1901, + "end": 1923, "loc": { "start": { - "line": 46, - "column": 1 + "line": 61, + "column": 2 }, "end": { - "line": 46, - "column": 18 + "line": 61, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 1901, + "end": 1913, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 61, + "column": 14 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1914, + "end": 1922, + "loc": { + "start": { + "line": 61, + "column": 15 + }, + "end": { + "line": 61, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 1914, + "end": 1915, + "loc": { + "start": { + "line": 61, + "column": 15 + }, + "end": { + "line": 61, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1916, + "end": 1922, + "loc": { + "start": { + "line": 61, + "column": 17 + }, + "end": { + "line": 61, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } + ] + } + } + ], + "directives": [], + "leadingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1815, + "end": 1832, + "loc": { + "start": { + "line": 57, + "column": 1 + }, + "end": { + "line": 57, + "column": 18 } } - ] - } + } + ] } - ], - "directives": [] - } - }, - "leadingComments": null + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1932, + "end": 1960, + "loc": { + "start": { + "line": 65, + "column": 0 + }, + "end": { + "line": 65, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 1947, + "end": 1959, + "loc": { + "start": { + "line": 65, + "column": 15 + }, + "end": { + "line": 65, + "column": 27 + }, + "identifierName": "delete_case6" + }, + "name": "delete_case6" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1932, + "end": 1960, + "loc": { + "start": { + "line": 65, + "column": 0 + }, + "end": { + "line": 65, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 734, + "end": 1930, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 63, + "column": 2 } - ], - "kind": "const", - "leadingComments": [ + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", - "start": 150, - "end": 550, + "type": "VariableDeclarator", + "start": 740, + "end": 1929, "loc": { "start": { - "line": 5, - "column": 0 + "line": 22, + "column": 6 }, "end": { - "line": 16, - "column": 3 + "line": 63, + "column": 1 } - } - } - ], - "trailingComments": [] + }, + "id": { + "type": "Identifier", + "start": 740, + "end": 752, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + }, + "identifierName": "delete_case6" + }, + "name": "delete_case6", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 755, + "end": 1929, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 63, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 740, + "end": 752, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + }, + "identifierName": "delete_case6" + }, + "name": "delete_case6", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 756, + "end": 757, + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 762, + "end": 1929, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 63, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 765, + "end": 812, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 765, + "end": 811, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 765, + "end": 771, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 772, + "end": 810, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 772, + "end": 789, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 772, + "end": 773, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 785, + "end": 789, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 793, + "end": 810, + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 793, + "end": 794, + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 806, + "end": 810, + "loc": { + "start": { + "line": 23, + "column": 42 + }, + "end": { + "line": 23, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 814, + "end": 841, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 814, + "end": 840, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 814, + "end": 820, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 821, + "end": 839, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 821, + "end": 829, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 821, + "end": 822, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 823, + "end": 829, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 834, + "end": 839, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 843, + "end": 869, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 843, + "end": 868, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 843, + "end": 849, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 850, + "end": 867, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 850, + "end": 858, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 850, + "end": 851, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 852, + "end": 858, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 863, + "end": 867, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 871, + "end": 892, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 877, + "end": 891, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 877, + "end": 878, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 881, + "end": 891, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 881, + "end": 888, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 889, + "end": 890, + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 894, + "end": 920, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 894, + "end": 919, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 894, + "end": 900, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 901, + "end": 918, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 901, + "end": 902, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 914, + "end": 918, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 922, + "end": 949, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 922, + "end": 948, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 922, + "end": 928, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 929, + "end": 947, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 929, + "end": 937, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 929, + "end": 930, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 931, + "end": 937, + "loc": { + "start": { + "line": 28, + "column": 10 + }, + "end": { + "line": 28, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 942, + "end": 947, + "loc": { + "start": { + "line": 28, + "column": 21 + }, + "end": { + "line": 28, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 952, + "end": 1639, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1642, + "end": 1669, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 28 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1642, + "end": 1668, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 27 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1642, + "end": 1650, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1642, + "end": 1643, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 2 + }, + "identifierName": "s" + }, + "name": "s", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1644, + "end": 1650, + "loc": { + "start": { + "line": 48, + "column": 3 + }, + "end": { + "line": 48, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "MemberExpression", + "start": 1653, + "end": 1668, + "loc": { + "start": { + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 27 + } + }, + "object": { + "type": "MemberExpression", + "start": 1653, + "end": 1661, + "loc": { + "start": { + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 1653, + "end": 1654, + "loc": { + "start": { + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 13 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1655, + "end": 1661, + "loc": { + "start": { + "line": 48, + "column": 14 + }, + "end": { + "line": 48, + "column": 20 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1662, + "end": 1668, + "loc": { + "start": { + "line": 48, + "column": 21 + }, + "end": { + "line": 48, + "column": 27 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 952, + "end": 1639, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1671, + "end": 1695, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1671, + "end": 1694, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1671, + "end": 1686, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 1671, + "end": 1679, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1671, + "end": 1672, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 2 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1673, + "end": 1679, + "loc": { + "start": { + "line": 49, + "column": 3 + }, + "end": { + "line": 49, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1680, + "end": 1686, + "loc": { + "start": { + "line": 49, + "column": 10 + }, + "end": { + "line": 49, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1689, + "end": 1694, + "loc": { + "start": { + "line": 49, + "column": 19 + }, + "end": { + "line": 49, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1698, + "end": 1927, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 62, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1702, + "end": 1721, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 1702, + "end": 1703, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1708, + "end": 1721, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 24 + } + }, + "object": { + "type": "MemberExpression", + "start": 1708, + "end": 1716, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 1708, + "end": 1709, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1710, + "end": 1716, + "loc": { + "start": { + "line": 51, + "column": 13 + }, + "end": { + "line": 51, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1717, + "end": 1721, + "loc": { + "start": { + "line": 51, + "column": 20 + }, + "end": { + "line": 51, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1723, + "end": 1812, + "loc": { + "start": { + "line": 51, + "column": 26 + }, + "end": { + "line": 55, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1727, + "end": 1758, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 1727, + "end": 1757, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 1727, + "end": 1733, + "loc": { + "start": { + "line": 52, + "column": 2 + }, + "end": { + "line": 52, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1734, + "end": 1756, + "loc": { + "start": { + "line": 52, + "column": 9 + }, + "end": { + "line": 52, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 1734, + "end": 1748, + "loc": { + "start": { + "line": 52, + "column": 9 + }, + "end": { + "line": 52, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 1734, + "end": 1741, + "loc": { + "start": { + "line": 52, + "column": 9 + }, + "end": { + "line": 52, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1734, + "end": 1735, + "loc": { + "start": { + "line": 52, + "column": 9 + }, + "end": { + "line": 52, + "column": 10 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1736, + "end": 1741, + "loc": { + "start": { + "line": 52, + "column": 11 + }, + "end": { + "line": 52, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1742, + "end": 1748, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1753, + "end": 1756, + "loc": { + "start": { + "line": 52, + "column": 28 + }, + "end": { + "line": 52, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1761, + "end": 1784, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1761, + "end": 1783, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1761, + "end": 1775, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 1761, + "end": 1768, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1761, + "end": 1762, + "loc": { + "start": { + "line": 53, + "column": 2 + }, + "end": { + "line": 53, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1763, + "end": 1768, + "loc": { + "start": { + "line": 53, + "column": 4 + }, + "end": { + "line": 53, + "column": 9 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1769, + "end": 1775, + "loc": { + "start": { + "line": 53, + "column": 10 + }, + "end": { + "line": 53, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1778, + "end": 1783, + "loc": { + "start": { + "line": 53, + "column": 19 + }, + "end": { + "line": 53, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1787, + "end": 1809, + "loc": { + "start": { + "line": 54, + "column": 2 + }, + "end": { + "line": 54, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1787, + "end": 1808, + "loc": { + "start": { + "line": 54, + "column": 2 + }, + "end": { + "line": 54, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1787, + "end": 1798, + "loc": { + "start": { + "line": 54, + "column": 2 + }, + "end": { + "line": 54, + "column": 13 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1799, + "end": 1807, + "loc": { + "start": { + "line": 54, + "column": 14 + }, + "end": { + "line": 54, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 1799, + "end": 1800, + "loc": { + "start": { + "line": 54, + "column": 14 + }, + "end": { + "line": 54, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1801, + "end": 1807, + "loc": { + "start": { + "line": 54, + "column": 16 + }, + "end": { + "line": 54, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } + } + ], + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1815, + "end": 1832, + "loc": { + "start": { + "line": 57, + "column": 1 + }, + "end": { + "line": 57, + "column": 18 + } + } + } + ] + }, + "alternate": { + "type": "BlockStatement", + "start": 1839, + "end": 1927, + "loc": { + "start": { + "line": 58, + "column": 6 + }, + "end": { + "line": 62, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1843, + "end": 1873, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 1843, + "end": 1872, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 1843, + "end": 1849, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1850, + "end": 1871, + "loc": { + "start": { + "line": 59, + "column": 9 + }, + "end": { + "line": 59, + "column": 30 + } + }, + "left": { + "type": "MemberExpression", + "start": 1850, + "end": 1863, + "loc": { + "start": { + "line": 59, + "column": 9 + }, + "end": { + "line": 59, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 1850, + "end": 1856, + "loc": { + "start": { + "line": 59, + "column": 9 + }, + "end": { + "line": 59, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1850, + "end": 1851, + "loc": { + "start": { + "line": 59, + "column": 9 + }, + "end": { + "line": 59, + "column": 10 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1852, + "end": 1856, + "loc": { + "start": { + "line": 59, + "column": 11 + }, + "end": { + "line": 59, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1857, + "end": 1863, + "loc": { + "start": { + "line": 59, + "column": 16 + }, + "end": { + "line": 59, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1868, + "end": 1871, + "loc": { + "start": { + "line": 59, + "column": 27 + }, + "end": { + "line": 59, + "column": 30 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ], + "leadingComments": null + }, + "leadingComments": null + }, + { + "type": "ExpressionStatement", + "start": 1876, + "end": 1898, + "loc": { + "start": { + "line": 60, + "column": 2 + }, + "end": { + "line": 60, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1876, + "end": 1897, + "loc": { + "start": { + "line": 60, + "column": 2 + }, + "end": { + "line": 60, + "column": 23 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1876, + "end": 1889, + "loc": { + "start": { + "line": 60, + "column": 2 + }, + "end": { + "line": 60, + "column": 15 + } + }, + "object": { + "type": "MemberExpression", + "start": 1876, + "end": 1882, + "loc": { + "start": { + "line": 60, + "column": 2 + }, + "end": { + "line": 60, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1876, + "end": 1877, + "loc": { + "start": { + "line": 60, + "column": 2 + }, + "end": { + "line": 60, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1878, + "end": 1882, + "loc": { + "start": { + "line": 60, + "column": 4 + }, + "end": { + "line": 60, + "column": 8 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1883, + "end": 1889, + "loc": { + "start": { + "line": 60, + "column": 9 + }, + "end": { + "line": 60, + "column": 15 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1892, + "end": 1897, + "loc": { + "start": { + "line": 60, + "column": 18 + }, + "end": { + "line": 60, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1901, + "end": 1924, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 61, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 1901, + "end": 1923, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 61, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 1901, + "end": 1913, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 61, + "column": 14 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1914, + "end": 1922, + "loc": { + "start": { + "line": 61, + "column": 15 + }, + "end": { + "line": 61, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 1914, + "end": 1915, + "loc": { + "start": { + "line": 61, + "column": 15 + }, + "end": { + "line": 61, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1916, + "end": 1922, + "loc": { + "start": { + "line": 61, + "column": 17 + }, + "end": { + "line": 61, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } + } + ], + "directives": [], + "leadingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1815, + "end": 1832, + "loc": { + "start": { + "line": 57, + "column": 1 + }, + "end": { + "line": 57, + "column": 18 + } + } + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 328, + "end": 733, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 328, + "end": 733, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 952, + "end": 1639, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 46, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1815, + "end": 1832, + "loc": { + "start": { + "line": 57, + "column": 1 + }, + "end": { + "line": 57, + "column": 18 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 75, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 103, + "end": 109, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 115, + "end": 119, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 120, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 147, + "end": 151, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 152, + "end": 156, + "loc": { + "start": { + "line": 5, + "column": 12 + }, + "end": { + "line": 5, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 175, + "end": 176, + "loc": { + "start": { + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 177, + "end": 183, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 184, + "end": 195, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 196, + "end": 200, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_left.js", + "start": 201, + "end": 227, + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 227, + "end": 228, + "loc": { + "start": { + "line": 6, + "column": 50 + }, + "end": { + "line": 6, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 229, + "end": 235, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 236, + "end": 248, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 249, + "end": 253, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_right.js", + "start": 254, + "end": 281, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 52 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 281, + "end": 282, + "loc": { + "start": { + "line": 7, + "column": 52 + }, + "end": { + "line": 7, + "column": 53 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 283, + "end": 289, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 290, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 298, + "end": 302, + "loc": { + "start": { + "line": 8, + "column": 15 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/sibling.js", + "start": 303, + "end": 325, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 42 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 325, + "end": 326, + "loc": { + "start": { + "line": 8, + "column": 42 + }, + "end": { + "line": 8, + "column": 43 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n ", + "start": 328, + "end": 733, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 734, + "end": 739, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case6", + "start": 740, + "end": 752, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 753, + "end": 754, + "loc": { + "start": { + "line": 22, + "column": 19 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 755, + "end": 756, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 756, + "end": 757, + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 757, + "end": 758, + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 759, + "end": 761, + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 762, + "end": 763, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 22, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 765, + "end": 771, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 771, + "end": 772, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 772, + "end": 773, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 774, + "end": 784, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 785, + "end": 789, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 25 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 790, + "end": 792, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 793, + "end": 794, + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 795, + "end": 805, + "loc": { + "start": { + "line": 23, + "column": 31 + }, + "end": { + "line": 23, + "column": 41 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 806, + "end": 810, + "loc": { + "start": { + "line": 23, + "column": 42 + }, + "end": { + "line": 23, + "column": 46 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 810, + "end": 811, + "loc": { + "start": { + "line": 23, + "column": 46 + }, + "end": { + "line": 23, + "column": 47 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 811, + "end": 812, + "loc": { + "start": { + "line": 23, + "column": 47 + }, + "end": { + "line": 23, + "column": 48 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 814, + "end": 820, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 820, + "end": 821, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 821, + "end": 822, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 822, + "end": 823, + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 823, + "end": 829, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 830, + "end": 833, + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 834, + "end": 839, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 839, + "end": 840, + "loc": { + "start": { + "line": 24, + "column": 26 + }, + "end": { + "line": 24, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 840, + "end": 841, + "loc": { + "start": { + "line": 24, + "column": 27 + }, + "end": { + "line": 24, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 843, + "end": 849, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 849, + "end": 850, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 850, + "end": 851, + "loc": { + "start": { + "line": 25, + "column": 8 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", - "start": 150, - "end": 550, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 16, - "column": 3 - } - } - } - ] + "end": { + "line": 25, + "column": 9 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", - "start": 150, - "end": 550, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 851, + "end": 852, "loc": { "start": { - "line": 5, - "column": 0 + "line": 25, + "column": 9 }, "end": { - "line": 16, - "column": 3 + "line": 25, + "column": 10 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 613, - "end": 1300, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 852, + "end": 858, "loc": { "start": { - "line": 20, - "column": 1 + "line": 25, + "column": 10 }, "end": { - "line": 36, - "column": 4 + "line": 25, + "column": 16 } } }, { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1442, - "end": 1459, + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 859, + "end": 862, "loc": { "start": { - "line": 46, - "column": 1 + "line": 25, + "column": 17 }, "end": { - "line": 46, - "column": 18 + "line": 25, + "column": 20 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1703,24 +7115,103 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "null", + "start": 863, + "end": 867, "loc": { "start": { - "line": 1, - "column": 0 + "line": 25, + "column": 21 }, "end": { - "line": 1, - "column": 6 + "line": 25, + "column": 25 } } }, { "type": { - "label": "{", + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 867, + "end": 868, + "loc": { + "start": { + "line": 25, + "column": 25 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": { + "label": ";", "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 868, + "end": 869, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 871, + "end": 876, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1729,19 +7220,47 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "value": "s", + "start": 877, + "end": 878, "loc": { "start": { - "line": 1, + "line": 26, "column": 7 }, "end": { - "line": 1, + "line": 26, "column": 8 } } }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 879, + "end": 880, + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 10 + } + } + }, { "type": { "label": "name", @@ -1754,25 +7273,25 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "sibling", + "start": 881, + "end": 888, "loc": { "start": { - "line": 1, - "column": 8 + "line": 26, + "column": 11 }, "end": { - "line": 1, - "column": 13 + "line": 26, + "column": 18 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1780,16 +7299,16 @@ "postfix": false, "binop": null }, - "start": 13, - "end": 14, + "start": 888, + "end": 889, "loc": { "start": { - "line": 1, - "column": 13 + "line": 26, + "column": 18 }, "end": { - "line": 1, - "column": 14 + "line": 26, + "column": 19 } } }, @@ -1805,44 +7324,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 15, - "end": 19, + "value": "n", + "start": 889, + "end": 890, "loc": { "start": { - "line": 1, - "column": 15 + "line": 26, + "column": 19 }, "end": { - "line": 1, - "column": 19 + "line": 26, + "column": 20 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/BLACK.js", - "start": 20, - "end": 39, + "start": 890, + "end": 891, "loc": { "start": { - "line": 1, + "line": 26, "column": 20 }, "end": { - "line": 1, - "column": 39 + "line": 26, + "column": 21 } } }, @@ -1859,23 +7376,22 @@ "binop": null, "updateContext": null }, - "start": 39, - "end": 40, + "start": 891, + "end": 892, "loc": { "start": { - "line": 1, - "column": 39 + "line": 26, + "column": 21 }, "end": { - "line": 1, - "column": 40 + "line": 26, + "column": 22 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1883,26 +7399,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 41, - "end": 47, + "value": "assert", + "start": 894, + "end": 900, "loc": { "start": { - "line": 2, - "column": 0 + "line": 27, + "column": 1 }, "end": { - "line": 2, - "column": 6 + "line": 27, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1912,15 +7427,15 @@ "postfix": false, "binop": null }, - "start": 48, - "end": 49, + "start": 900, + "end": 901, "loc": { "start": { - "line": 2, + "line": 27, "column": 7 }, "end": { - "line": 2, + "line": 27, "column": 8 } } @@ -1937,23 +7452,24 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 49, - "end": 60, + "value": "s", + "start": 901, + "end": 902, "loc": { "start": { - "line": 2, + "line": 27, "column": 8 }, "end": { - "line": 2, - "column": 19 + "line": 27, + "column": 9 } } }, { "type": { - "label": ",", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1961,18 +7477,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 60, - "end": 61, + "value": "instanceof", + "start": 903, + "end": 913, "loc": { "start": { - "line": 2, - "column": 19 + "line": 27, + "column": 10 }, "end": { - "line": 2, + "line": 27, "column": 20 } } @@ -1989,23 +7506,23 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 62, - "end": 74, + "value": "Node", + "start": 914, + "end": 918, "loc": { "start": { - "line": 2, + "line": 27, "column": 21 }, "end": { - "line": 2, - "column": 33 + "line": 27, + "column": 25 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2015,48 +7532,48 @@ "postfix": false, "binop": null }, - "start": 74, - "end": 75, + "start": 918, + "end": 919, "loc": { "start": { - "line": 2, - "column": 33 + "line": 27, + "column": 25 }, "end": { - "line": 2, - "column": 34 + "line": 27, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 76, - "end": 80, + "start": 919, + "end": 920, "loc": { "start": { - "line": 2, - "column": 35 + "line": 27, + "column": 26 }, "end": { - "line": 2, - "column": 39 + "line": 27, + "column": 27 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2064,53 +7581,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../rotate/index.js", - "start": 81, - "end": 101, + "value": "assert", + "start": 922, + "end": 928, "loc": { "start": { - "line": 2, - "column": 40 + "line": 28, + "column": 1 }, "end": { - "line": 2, - "column": 60 + "line": 28, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 101, - "end": 102, + "start": 928, + "end": 929, "loc": { "start": { - "line": 2, - "column": 60 + "line": 28, + "column": 7 }, "end": { - "line": 2, - "column": 61 + "line": 28, + "column": 8 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2118,45 +7632,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 103, - "end": 109, + "value": "s", + "start": 929, + "end": 930, "loc": { "start": { - "line": 3, - "column": 0 + "line": 28, + "column": 8 }, "end": { - "line": 3, - "column": 6 + "line": 28, + "column": 9 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 110, - "end": 111, + "start": 930, + "end": 931, "loc": { "start": { - "line": 3, - "column": 7 + "line": 28, + "column": 9 }, "end": { - "line": 3, - "column": 8 + "line": 28, + "column": 10 } } }, @@ -2172,42 +7686,44 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 111, - "end": 118, + "value": "_color", + "start": 931, + "end": 937, "loc": { "start": { - "line": 3, - "column": 8 + "line": 28, + "column": 10 }, "end": { - "line": 3, - "column": 15 + "line": 28, + "column": 16 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 118, - "end": 119, + "value": "===", + "start": 938, + "end": 941, "loc": { "start": { - "line": 3, - "column": 15 + "line": 28, + "column": 17 }, "end": { - "line": 3, - "column": 16 + "line": 28, + "column": 20 } } }, @@ -2223,44 +7739,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 120, - "end": 124, + "value": "BLACK", + "start": 942, + "end": 947, "loc": { "start": { - "line": 3, - "column": 17 + "line": 28, + "column": 21 }, "end": { - "line": 3, - "column": 21 + "line": 28, + "column": 26 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/sibling.js", - "start": 125, - "end": 147, + "start": 947, + "end": 948, "loc": { "start": { - "line": 3, - "column": 22 + "line": 28, + "column": 26 }, "end": { - "line": 3, - "column": 44 + "line": 28, + "column": 27 } } }, @@ -2277,67 +7791,64 @@ "binop": null, "updateContext": null }, - "start": 147, - "end": 148, + "start": 948, + "end": 949, "loc": { "start": { - "line": 3, - "column": 44 + "line": 28, + "column": 27 }, "end": { - "line": 3, - "column": 45 + "line": 28, + "column": 28 } } }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", - "start": 150, - "end": 550, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 952, + "end": 1639, "loc": { "start": { - "line": 5, - "column": 0 + "line": 30, + "column": 1 }, "end": { - "line": 16, - "column": 3 + "line": 46, + "column": 4 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 551, - "end": 557, + "value": "s", + "start": 1642, + "end": 1643, "loc": { "start": { - "line": 17, - "column": 0 + "line": 48, + "column": 1 }, "end": { - "line": 17, - "column": 6 + "line": 48, + "column": 2 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2348,17 +7859,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 558, - "end": 563, + "start": 1643, + "end": 1644, "loc": { "start": { - "line": 17, - "column": 7 + "line": 48, + "column": 2 }, "end": { - "line": 17, - "column": 12 + "line": 48, + "column": 3 } } }, @@ -2374,17 +7884,17 @@ "postfix": false, "binop": null }, - "value": "delete_case6", - "start": 564, - "end": 576, + "value": "_color", + "start": 1644, + "end": 1650, "loc": { "start": { - "line": 17, - "column": 13 + "line": 48, + "column": 3 }, "end": { - "line": 17, - "column": 25 + "line": 48, + "column": 9 } } }, @@ -2402,23 +7912,23 @@ "updateContext": null }, "value": "=", - "start": 577, - "end": 578, + "start": 1651, + "end": 1652, "loc": { "start": { - "line": 17, - "column": 26 + "line": 48, + "column": 10 }, "end": { - "line": 17, - "column": 27 + "line": 48, + "column": 11 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2427,50 +7937,103 @@ "postfix": false, "binop": null }, - "start": 579, - "end": 580, + "value": "n", + "start": 1653, + "end": 1654, "loc": { "start": { - "line": 17, - "column": 28 + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 13 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1654, + "end": 1655, + "loc": { + "start": { + "line": 48, + "column": 13 + }, + "end": { + "line": 48, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1655, + "end": 1661, + "loc": { + "start": { + "line": 48, + "column": 14 }, "end": { - "line": 17, - "column": 29 + "line": 48, + "column": 20 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 580, - "end": 581, + "start": 1661, + "end": 1662, "loc": { "start": { - "line": 17, - "column": 29 + "line": 48, + "column": 20 }, "end": { - "line": 17, - "column": 30 + "line": 48, + "column": 21 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2478,22 +8041,23 @@ "postfix": false, "binop": null }, - "start": 581, - "end": 582, + "value": "_color", + "start": 1662, + "end": 1668, "loc": { "start": { - "line": 17, - "column": 30 + "line": 48, + "column": 21 }, "end": { - "line": 17, - "column": 31 + "line": 48, + "column": 27 } } }, { "type": { - "label": "=>", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2504,23 +8068,23 @@ "binop": null, "updateContext": null }, - "start": 583, - "end": 585, + "start": 1668, + "end": 1669, "loc": { "start": { - "line": 17, - "column": 32 + "line": 48, + "column": 27 }, "end": { - "line": 17, - "column": 34 + "line": 48, + "column": 28 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2529,23 +8093,23 @@ "postfix": false, "binop": null }, - "start": 586, - "end": 587, + "value": "n", + "start": 1671, + "end": 1672, "loc": { "start": { - "line": 17, - "column": 35 + "line": 49, + "column": 1 }, "end": { - "line": 17, - "column": 36 + "line": 49, + "column": 2 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2556,17 +8120,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 589, - "end": 594, + "start": 1672, + "end": 1673, "loc": { "start": { - "line": 18, - "column": 1 + "line": 49, + "column": 2 }, "end": { - "line": 18, - "column": 6 + "line": 49, + "column": 3 } } }, @@ -2582,43 +8145,42 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 595, - "end": 596, + "value": "parent", + "start": 1673, + "end": 1679, "loc": { "start": { - "line": 18, - "column": 7 + "line": 49, + "column": 3 }, "end": { - "line": 18, - "column": 8 + "line": 49, + "column": 9 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 597, - "end": 598, + "start": 1679, + "end": 1680, "loc": { "start": { - "line": 18, + "line": 49, "column": 9 }, "end": { - "line": 18, + "line": 49, "column": 10 } } @@ -2635,42 +8197,44 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 599, - "end": 606, + "value": "_color", + "start": 1680, + "end": 1686, "loc": { "start": { - "line": 18, - "column": 11 + "line": 49, + "column": 10 }, "end": { - "line": 18, - "column": 18 + "line": 49, + "column": 16 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 606, - "end": 607, + "value": "=", + "start": 1687, + "end": 1688, "loc": { "start": { - "line": 18, - "column": 18 + "line": 49, + "column": 17 }, "end": { - "line": 18, - "column": 19 + "line": 49, + "column": 18 } } }, @@ -2686,49 +8250,51 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 607, - "end": 608, + "value": "BLACK", + "start": 1689, + "end": 1694, "loc": { "start": { - "line": 18, + "line": 49, "column": 19 }, "end": { - "line": 18, - "column": 20 + "line": 49, + "column": 24 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 608, - "end": 609, + "start": 1694, + "end": 1695, "loc": { "start": { - "line": 18, - "column": 20 + "line": 49, + "column": 24 }, "end": { - "line": 18, - "column": 21 + "line": 49, + "column": 25 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": "if", + "keyword": "if", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2738,32 +8304,42 @@ "binop": null, "updateContext": null }, - "start": 609, - "end": 610, + "value": "if", + "start": 1698, + "end": 1700, "loc": { "start": { - "line": 18, - "column": 21 + "line": 51, + "column": 1 }, "end": { - "line": 18, - "column": 22 + "line": 51, + "column": 3 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 613, - "end": 1300, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1701, + "end": 1702, "loc": { "start": { - "line": 20, - "column": 1 + "line": 51, + "column": 4 }, "end": { - "line": 36, - "column": 4 + "line": 51, + "column": 5 } } }, @@ -2779,43 +8355,44 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1303, - "end": 1304, + "value": "n", + "start": 1702, + "end": 1703, "loc": { "start": { - "line": 38, - "column": 1 + "line": 51, + "column": 5 }, "end": { - "line": 38, - "column": 2 + "line": 51, + "column": 6 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1304, - "end": 1305, + "value": "===", + "start": 1704, + "end": 1707, "loc": { "start": { - "line": 38, - "column": 2 + "line": 51, + "column": 7 }, "end": { - "line": 38, - "column": 3 + "line": 51, + "column": 10 } } }, @@ -2831,44 +8408,43 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1305, - "end": 1311, + "value": "n", + "start": 1708, + "end": 1709, "loc": { "start": { - "line": 38, - "column": 3 + "line": 51, + "column": 11 }, "end": { - "line": 38, - "column": 9 + "line": 51, + "column": 12 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 1312, - "end": 1313, + "start": 1709, + "end": 1710, "loc": { "start": { - "line": 38, - "column": 10 + "line": 51, + "column": 12 }, "end": { - "line": 38, - "column": 11 + "line": 51, + "column": 13 } } }, @@ -2884,17 +8460,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1314, - "end": 1315, + "value": "parent", + "start": 1710, + "end": 1716, "loc": { "start": { - "line": 38, - "column": 12 + "line": 51, + "column": 13 }, "end": { - "line": 38, - "column": 13 + "line": 51, + "column": 19 } } }, @@ -2911,16 +8487,16 @@ "binop": null, "updateContext": null }, - "start": 1315, - "end": 1316, + "start": 1716, + "end": 1717, "loc": { "start": { - "line": 38, - "column": 13 + "line": 51, + "column": 19 }, "end": { - "line": 38, - "column": 14 + "line": 51, + "column": 20 } } }, @@ -2936,23 +8512,23 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1316, - "end": 1322, + "value": "left", + "start": 1717, + "end": 1721, "loc": { "start": { - "line": 38, - "column": 14 + "line": 51, + "column": 20 }, "end": { - "line": 38, - "column": 20 + "line": 51, + "column": 24 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2960,19 +8536,43 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1322, - "end": 1323, + "start": 1721, + "end": 1722, "loc": { "start": { - "line": 38, - "column": 20 + "line": 51, + "column": 24 }, "end": { - "line": 38, - "column": 21 + "line": 51, + "column": 25 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1723, + "end": 1724, + "loc": { + "start": { + "line": 51, + "column": 26 + }, + "end": { + "line": 51, + "column": 27 } } }, @@ -2988,43 +8588,42 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1323, - "end": 1329, + "value": "assert", + "start": 1727, + "end": 1733, "loc": { "start": { - "line": 38, - "column": 21 + "line": 52, + "column": 2 }, "end": { - "line": 38, - "column": 27 + "line": 52, + "column": 8 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1329, - "end": 1330, + "start": 1733, + "end": 1734, "loc": { "start": { - "line": 38, - "column": 27 + "line": 52, + "column": 8 }, "end": { - "line": 38, - "column": 28 + "line": 52, + "column": 9 } } }, @@ -3040,17 +8639,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1332, - "end": 1333, + "value": "s", + "start": 1734, + "end": 1735, "loc": { "start": { - "line": 39, - "column": 1 + "line": 52, + "column": 9 }, "end": { - "line": 39, - "column": 2 + "line": 52, + "column": 10 } } }, @@ -3067,16 +8666,16 @@ "binop": null, "updateContext": null }, - "start": 1333, - "end": 1334, + "start": 1735, + "end": 1736, "loc": { "start": { - "line": 39, - "column": 2 + "line": 52, + "column": 10 }, "end": { - "line": 39, - "column": 3 + "line": 52, + "column": 11 } } }, @@ -3092,17 +8691,17 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1334, - "end": 1340, + "value": "right", + "start": 1736, + "end": 1741, "loc": { "start": { - "line": 39, - "column": 3 + "line": 52, + "column": 11 }, "end": { - "line": 39, - "column": 9 + "line": 52, + "column": 16 } } }, @@ -3119,16 +8718,16 @@ "binop": null, "updateContext": null }, - "start": 1340, - "end": 1341, + "start": 1741, + "end": 1742, "loc": { "start": { - "line": 39, - "column": 9 + "line": 52, + "column": 16 }, "end": { - "line": 39, - "column": 10 + "line": 52, + "column": 17 } } }, @@ -3145,43 +8744,43 @@ "binop": null }, "value": "_color", - "start": 1341, - "end": 1347, + "start": 1742, + "end": 1748, "loc": { "start": { - "line": 39, - "column": 10 + "line": 52, + "column": 17 }, "end": { - "line": 39, - "column": 16 + "line": 52, + "column": 23 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 1348, - "end": 1349, + "value": "===", + "start": 1749, + "end": 1752, "loc": { "start": { - "line": 39, - "column": 17 + "line": 52, + "column": 24 }, "end": { - "line": 39, - "column": 18 + "line": 52, + "column": 27 } } }, @@ -3197,51 +8796,49 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1350, - "end": 1355, + "value": "RED", + "start": 1753, + "end": 1756, "loc": { "start": { - "line": 39, - "column": 19 + "line": 52, + "column": 28 }, "end": { - "line": 39, - "column": 24 + "line": 52, + "column": 31 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1355, - "end": 1356, + "start": 1756, + "end": 1757, "loc": { "start": { - "line": 39, - "column": 24 + "line": 52, + "column": 31 }, "end": { - "line": 39, - "column": 25 + "line": 52, + "column": 32 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3251,42 +8848,16 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 1359, - "end": 1361, - "loc": { - "start": { - "line": 41, - "column": 1 - }, - "end": { - "line": 41, - "column": 3 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1362, - "end": 1363, + "start": 1757, + "end": 1758, "loc": { "start": { - "line": 41, - "column": 4 + "line": 52, + "column": 32 }, "end": { - "line": 41, - "column": 5 + "line": 52, + "column": 33 } } }, @@ -3302,44 +8873,43 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1363, - "end": 1364, + "value": "s", + "start": 1761, + "end": 1762, "loc": { "start": { - "line": 41, - "column": 5 + "line": 53, + "column": 2 }, "end": { - "line": 41, - "column": 6 + "line": 53, + "column": 3 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1365, - "end": 1368, + "start": 1762, + "end": 1763, "loc": { "start": { - "line": 41, - "column": 7 + "line": 53, + "column": 3 }, "end": { - "line": 41, - "column": 10 + "line": 53, + "column": 4 } } }, @@ -3355,17 +8925,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1369, - "end": 1370, + "value": "right", + "start": 1763, + "end": 1768, "loc": { "start": { - "line": 41, - "column": 11 + "line": 53, + "column": 4 }, "end": { - "line": 41, - "column": 12 + "line": 53, + "column": 9 } } }, @@ -3382,16 +8952,16 @@ "binop": null, "updateContext": null }, - "start": 1370, - "end": 1371, + "start": 1768, + "end": 1769, "loc": { "start": { - "line": 41, - "column": 12 + "line": 53, + "column": 9 }, "end": { - "line": 41, - "column": 13 + "line": 53, + "column": 10 } } }, @@ -3407,43 +8977,44 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1371, - "end": 1377, + "value": "_color", + "start": 1769, + "end": 1775, "loc": { "start": { - "line": 41, - "column": 13 + "line": 53, + "column": 10 }, "end": { - "line": 41, - "column": 19 + "line": 53, + "column": 16 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 1377, - "end": 1378, + "value": "=", + "start": 1776, + "end": 1777, "loc": { "start": { - "line": 41, - "column": 19 + "line": 53, + "column": 17 }, "end": { - "line": 41, - "column": 20 + "line": 53, + "column": 18 } } }, @@ -3459,48 +9030,75 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1378, - "end": 1382, + "value": "BLACK", + "start": 1778, + "end": 1783, "loc": { "start": { - "line": 41, - "column": 20 + "line": 53, + "column": 19 }, "end": { - "line": 41, + "line": 53, "column": 24 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1382, - "end": 1383, + "start": 1783, + "end": 1784, "loc": { "start": { - "line": 41, + "line": 53, "column": 24 }, "end": { - "line": 41, + "line": 53, "column": 25 } } }, { "type": { - "label": "{", + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 1787, + "end": 1798, + "loc": { + "start": { + "line": 54, + "column": 2 + }, + "end": { + "line": 54, + "column": 13 + } + } + }, + { + "type": { + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -3510,16 +9108,16 @@ "postfix": false, "binop": null }, - "start": 1384, - "end": 1385, + "start": 1798, + "end": 1799, "loc": { "start": { - "line": 41, - "column": 26 + "line": 54, + "column": 13 }, "end": { - "line": 41, - "column": 27 + "line": 54, + "column": 14 } } }, @@ -3535,17 +9133,17 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1388, - "end": 1389, + "value": "n", + "start": 1799, + "end": 1800, "loc": { "start": { - "line": 42, - "column": 2 + "line": 54, + "column": 14 }, "end": { - "line": 42, - "column": 3 + "line": 54, + "column": 15 } } }, @@ -3562,16 +9160,16 @@ "binop": null, "updateContext": null }, - "start": 1389, - "end": 1390, + "start": 1800, + "end": 1801, "loc": { "start": { - "line": 42, - "column": 3 + "line": 54, + "column": 15 }, "end": { - "line": 42, - "column": 4 + "line": 54, + "column": 16 } } }, @@ -3587,23 +9185,23 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1390, - "end": 1395, + "value": "parent", + "start": 1801, + "end": 1807, "loc": { "start": { - "line": 42, - "column": 4 + "line": 54, + "column": 16 }, "end": { - "line": 42, - "column": 9 + "line": 54, + "column": 22 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3611,124 +9209,138 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1395, - "end": 1396, + "start": 1807, + "end": 1808, "loc": { "start": { - "line": 42, - "column": 9 + "line": 54, + "column": 22 }, "end": { - "line": 42, - "column": 10 + "line": 54, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_color", - "start": 1396, - "end": 1402, + "start": 1808, + "end": 1809, "loc": { "start": { - "line": 42, - "column": 10 + "line": 54, + "column": 23 }, "end": { - "line": 42, - "column": 16 + "line": 54, + "column": 24 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 1403, - "end": 1404, + "start": 1811, + "end": 1812, + "loc": { + "start": { + "line": 55, + "column": 1 + }, + "end": { + "line": 55, + "column": 2 + } + } + }, + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1815, + "end": 1832, "loc": { "start": { - "line": 42, - "column": 17 + "line": 57, + "column": 1 }, "end": { - "line": 42, + "line": 57, "column": 18 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "BLACK", - "start": 1405, - "end": 1410, + "value": "else", + "start": 1834, + "end": 1838, "loc": { "start": { - "line": 42, - "column": 19 + "line": 58, + "column": 1 }, "end": { - "line": 42, - "column": 24 + "line": 58, + "column": 5 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1410, - "end": 1411, + "start": 1839, + "end": 1840, "loc": { "start": { - "line": 42, - "column": 24 + "line": 58, + "column": 6 }, "end": { - "line": 42, - "column": 25 + "line": 58, + "column": 7 } } }, @@ -3744,17 +9356,17 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 1414, - "end": 1425, + "value": "assert", + "start": 1843, + "end": 1849, "loc": { "start": { - "line": 43, + "line": 59, "column": 2 }, "end": { - "line": 43, - "column": 13 + "line": 59, + "column": 8 } } }, @@ -3770,16 +9382,16 @@ "postfix": false, "binop": null }, - "start": 1425, - "end": 1426, + "start": 1849, + "end": 1850, "loc": { "start": { - "line": 43, - "column": 13 + "line": 59, + "column": 8 }, "end": { - "line": 43, - "column": 14 + "line": 59, + "column": 9 } } }, @@ -3795,17 +9407,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1426, - "end": 1427, + "value": "s", + "start": 1850, + "end": 1851, "loc": { "start": { - "line": 43, - "column": 14 + "line": 59, + "column": 9 }, "end": { - "line": 43, - "column": 15 + "line": 59, + "column": 10 } } }, @@ -3822,16 +9434,16 @@ "binop": null, "updateContext": null }, - "start": 1427, - "end": 1428, + "start": 1851, + "end": 1852, "loc": { "start": { - "line": 43, - "column": 15 + "line": 59, + "column": 10 }, "end": { - "line": 43, - "column": 16 + "line": 59, + "column": 11 } } }, @@ -3847,23 +9459,23 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1428, - "end": 1434, + "value": "left", + "start": 1852, + "end": 1856, "loc": { "start": { - "line": 43, - "column": 16 + "line": 59, + "column": 11 }, "end": { - "line": 43, - "column": 22 + "line": 59, + "column": 15 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3871,138 +9483,149 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1434, - "end": 1435, + "start": 1856, + "end": 1857, "loc": { "start": { - "line": 43, - "column": 22 + "line": 59, + "column": 15 }, "end": { - "line": 43, - "column": 23 + "line": 59, + "column": 16 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1435, - "end": 1436, + "value": "_color", + "start": 1857, + "end": 1863, "loc": { "start": { - "line": 43, - "column": 23 + "line": 59, + "column": 16 }, "end": { - "line": 43, - "column": 24 + "line": 59, + "column": 22 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 1438, - "end": 1439, + "value": "===", + "start": 1864, + "end": 1867, "loc": { "start": { - "line": 44, - "column": 1 + "line": 59, + "column": 23 }, "end": { - "line": 44, - "column": 2 + "line": 59, + "column": 26 } } }, { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1442, - "end": 1459, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 1868, + "end": 1871, "loc": { "start": { - "line": 46, - "column": 1 + "line": 59, + "column": 27 }, "end": { - "line": 46, - "column": 18 + "line": 59, + "column": 30 } } }, { "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "else", - "start": 1461, - "end": 1465, + "start": 1871, + "end": 1872, "loc": { "start": { - "line": 47, - "column": 1 + "line": 59, + "column": 30 }, "end": { - "line": 47, - "column": 5 + "line": 59, + "column": 31 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1466, - "end": 1467, + "start": 1872, + "end": 1873, "loc": { "start": { - "line": 47, - "column": 6 + "line": 59, + "column": 31 }, "end": { - "line": 47, - "column": 7 + "line": 59, + "column": 32 } } }, @@ -4019,15 +9642,15 @@ "binop": null }, "value": "s", - "start": 1470, - "end": 1471, + "start": 1876, + "end": 1877, "loc": { "start": { - "line": 48, + "line": 60, "column": 2 }, "end": { - "line": 48, + "line": 60, "column": 3 } } @@ -4045,15 +9668,15 @@ "binop": null, "updateContext": null }, - "start": 1471, - "end": 1472, + "start": 1877, + "end": 1878, "loc": { "start": { - "line": 48, + "line": 60, "column": 3 }, "end": { - "line": 48, + "line": 60, "column": 4 } } @@ -4071,15 +9694,15 @@ "binop": null }, "value": "left", - "start": 1472, - "end": 1476, + "start": 1878, + "end": 1882, "loc": { "start": { - "line": 48, + "line": 60, "column": 4 }, "end": { - "line": 48, + "line": 60, "column": 8 } } @@ -4097,15 +9720,15 @@ "binop": null, "updateContext": null }, - "start": 1476, - "end": 1477, + "start": 1882, + "end": 1883, "loc": { "start": { - "line": 48, + "line": 60, "column": 8 }, "end": { - "line": 48, + "line": 60, "column": 9 } } @@ -4123,15 +9746,15 @@ "binop": null }, "value": "_color", - "start": 1477, - "end": 1483, + "start": 1883, + "end": 1889, "loc": { "start": { - "line": 48, + "line": 60, "column": 9 }, "end": { - "line": 48, + "line": 60, "column": 15 } } @@ -4150,15 +9773,15 @@ "updateContext": null }, "value": "=", - "start": 1484, - "end": 1485, + "start": 1890, + "end": 1891, "loc": { "start": { - "line": 48, + "line": 60, "column": 16 }, "end": { - "line": 48, + "line": 60, "column": 17 } } @@ -4176,15 +9799,15 @@ "binop": null }, "value": "BLACK", - "start": 1486, - "end": 1491, + "start": 1892, + "end": 1897, "loc": { "start": { - "line": 48, + "line": 60, "column": 18 }, "end": { - "line": 48, + "line": 60, "column": 23 } } @@ -4202,15 +9825,15 @@ "binop": null, "updateContext": null }, - "start": 1491, - "end": 1492, + "start": 1897, + "end": 1898, "loc": { "start": { - "line": 48, + "line": 60, "column": 23 }, "end": { - "line": 48, + "line": 60, "column": 24 } } @@ -4228,15 +9851,15 @@ "binop": null }, "value": "rotate_right", - "start": 1495, - "end": 1507, + "start": 1901, + "end": 1913, "loc": { "start": { - "line": 49, + "line": 61, "column": 2 }, "end": { - "line": 49, + "line": 61, "column": 14 } } @@ -4253,15 +9876,15 @@ "postfix": false, "binop": null }, - "start": 1507, - "end": 1508, + "start": 1913, + "end": 1914, "loc": { "start": { - "line": 49, + "line": 61, "column": 14 }, "end": { - "line": 49, + "line": 61, "column": 15 } } @@ -4279,15 +9902,15 @@ "binop": null }, "value": "n", - "start": 1508, - "end": 1509, + "start": 1914, + "end": 1915, "loc": { "start": { - "line": 49, + "line": 61, "column": 15 }, "end": { - "line": 49, + "line": 61, "column": 16 } } @@ -4305,15 +9928,15 @@ "binop": null, "updateContext": null }, - "start": 1509, - "end": 1510, + "start": 1915, + "end": 1916, "loc": { "start": { - "line": 49, + "line": 61, "column": 16 }, "end": { - "line": 49, + "line": 61, "column": 17 } } @@ -4331,15 +9954,15 @@ "binop": null }, "value": "parent", - "start": 1510, - "end": 1516, + "start": 1916, + "end": 1922, "loc": { "start": { - "line": 49, + "line": 61, "column": 17 }, "end": { - "line": 49, + "line": 61, "column": 23 } } @@ -4356,15 +9979,15 @@ "postfix": false, "binop": null }, - "start": 1516, - "end": 1517, + "start": 1922, + "end": 1923, "loc": { "start": { - "line": 49, + "line": 61, "column": 23 }, "end": { - "line": 49, + "line": 61, "column": 24 } } @@ -4382,15 +10005,15 @@ "binop": null, "updateContext": null }, - "start": 1517, - "end": 1518, + "start": 1923, + "end": 1924, "loc": { "start": { - "line": 49, + "line": 61, "column": 24 }, "end": { - "line": 49, + "line": 61, "column": 25 } } @@ -4407,15 +10030,15 @@ "postfix": false, "binop": null }, - "start": 1520, - "end": 1521, + "start": 1926, + "end": 1927, "loc": { "start": { - "line": 50, + "line": 62, "column": 1 }, "end": { - "line": 50, + "line": 62, "column": 2 } } @@ -4432,15 +10055,15 @@ "postfix": false, "binop": null }, - "start": 1522, - "end": 1523, + "start": 1928, + "end": 1929, "loc": { "start": { - "line": 51, + "line": 63, "column": 0 }, "end": { - "line": 51, + "line": 63, "column": 1 } } @@ -4458,19 +10081,127 @@ "binop": null, "updateContext": null }, - "start": 1523, - "end": 1524, + "start": 1929, + "end": 1930, "loc": { "start": { - "line": 51, + "line": 63, "column": 1 }, "end": { - "line": 51, + "line": 63, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1932, + "end": 1938, + "loc": { + "start": { + "line": 65, + "column": 0 + }, + "end": { + "line": 65, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1939, + "end": 1946, + "loc": { + "start": { + "line": 65, + "column": 7 + }, + "end": { + "line": 65, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case6", + "start": 1947, + "end": 1959, + "loc": { + "start": { + "line": 65, + "column": 15 + }, + "end": { + "line": 65, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1959, + "end": 1960, + "loc": { + "start": { + "line": 65, + "column": 27 + }, + "end": { + "line": 65, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -4484,15 +10215,15 @@ "binop": null, "updateContext": null }, - "start": 1525, - "end": 1525, + "start": 1961, + "end": 1961, "loc": { "start": { - "line": 52, + "line": 66, "column": 0 }, "end": { - "line": 52, + "line": 66, "column": 0 } } diff --git a/ast/source/deletion/delete_one_child.js.json b/ast/source/deletion/delete_one_child.js.json index 5102244..18a561b 100644 --- a/ast/source/deletion/delete_one_child.js.json +++ b/ast/source/deletion/delete_one_child.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1340, + "end": 1555, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 43, + "line": 52, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1340, + "end": 1555, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 43, + "line": 52, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 45, + "end": 28, "loc": { "start": { "line": 1, @@ -39,188 +39,381 @@ }, "end": { "line": 1, - "column": 45 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 41, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 12 }, "identifierName": "BLACK" }, "name": "BLACK" } + } + ], + "source": { + "type": "StringLiteral", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 68, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 }, + "end": { + "line": 3, + "column": 34 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 15, - "end": 18, + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 10 } }, - "imported": { + "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 75, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 10 }, "identifierName": "RED" }, "name": "RED" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + }, + "extra": { + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" + }, + "value": "../color/RED.js" + } + }, + { + "type": "ImportDeclaration", + "start": 103, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 110, + "end": 114, "loc": { "start": { - "line": 1, - "column": 15 + "line": 4, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 4, + "column": 11 }, - "identifierName": "RED" + "identifierName": "Node" }, - "name": "RED" + "name": "Node" } } ], "source": { "type": "StringLiteral", - "start": 25, - "end": 44, + "start": 120, + "end": 138, "loc": { "start": { - "line": 1, - "column": 25 + "line": 4, + "column": 17 }, "end": { - "line": 1, - "column": 44 + "line": 4, + "column": 35 } }, "extra": { - "rawValue": "../color/index.js", - "raw": "'../color/index.js'" + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" }, - "value": "../color/index.js" + "value": "../types/Node.js" } }, { "type": "ImportDeclaration", - "start": 47, - "end": 94, + "start": 140, + "end": 176, "loc": { "start": { - "line": 3, + "line": 5, "column": 0 }, "end": { - "line": 3, - "column": 47 + "line": 5, + "column": 36 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 55, - "end": 67, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 151, "loc": { "start": { - "line": 3, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 5, + "column": 11 } }, - "imported": { + "local": { "type": "Identifier", - "start": 55, - "end": 67, + "start": 147, + "end": 151, "loc": { "start": { - "line": 3, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 5, + "column": 11 }, - "identifierName": "replace_node" + "identifierName": "Leaf" }, - "name": "replace_node" + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 157, + "end": 175, + "loc": { + "start": { + "line": 5, + "column": 17 + }, + "end": { + "line": 5, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + } + }, + { + "type": "ImportDeclaration", + "start": 178, + "end": 223, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 185, + "end": 197, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } }, "local": { "type": "Identifier", - "start": 55, - "end": 67, + "start": 185, + "end": 197, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 7, + "column": 19 }, "identifierName": "replace_node" }, @@ -230,16 +423,16 @@ ], "source": { "type": "StringLiteral", - "start": 74, - "end": 93, + "start": 203, + "end": 222, "loc": { "start": { - "line": 3, - "column": 27 + "line": 7, + "column": 25 }, "end": { - "line": 3, - "column": 46 + "line": 7, + "column": 44 } }, "extra": { @@ -251,62 +444,45 @@ }, { "type": "ImportDeclaration", - "start": 95, - "end": 142, + "start": 224, + "end": 269, "loc": { "start": { - "line": 4, + "line": 8, "column": 0 }, "end": { - "line": 4, - "column": 47 + "line": 8, + "column": 45 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 103, - "end": 115, + "type": "ImportDefaultSpecifier", + "start": 231, + "end": 243, "loc": { "start": { - "line": 4, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 4, - "column": 20 + "line": 8, + "column": 19 } }, - "imported": { - "type": "Identifier", - "start": 103, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 20 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1" - }, "local": { "type": "Identifier", - "start": 103, - "end": 115, + "start": 231, + "end": 243, "loc": { "start": { - "line": 4, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 4, - "column": 20 + "line": 8, + "column": 19 }, "identifierName": "delete_case1" }, @@ -316,16 +492,16 @@ ], "source": { "type": "StringLiteral", - "start": 122, - "end": 141, + "start": 249, + "end": 268, "loc": { "start": { - "line": 4, - "column": 27 + "line": 8, + "column": 25 }, "end": { - "line": 4, - "column": 46 + "line": 8, + "column": 44 } }, "extra": { @@ -337,16 +513,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", - "start": 144, - "end": 391, + "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n ", + "start": 271, + "end": 558, "loc": { "start": { - "line": 6, + "line": 10, "column": 0 }, "end": { - "line": 14, + "line": 19, "column": 3 } } @@ -354,746 +530,1316 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 392, - "end": 1339, + "type": "Identifier", + "start": 559, + "end": 1520, "loc": { "start": { - "line": 15, + "line": 20, "column": 0 }, "end": { - "line": 42, + "line": 49, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 399, - "end": 1339, - "loc": { - "start": { - "line": 15, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 565, + "end": 1519, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 49, + "column": 1 + } }, - "end": { - "line": 42, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 405, - "end": 1338, + "id": { + "type": "Identifier", + "start": 565, + "end": 581, "loc": { "start": { - "line": 15, - "column": 13 + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 22 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 584, + "end": 1519, + "loc": { + "start": { + "line": 20, + "column": 25 }, "end": { - "line": 42, + "line": 49, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 405, - "end": 421, - "loc": { - "start": { - "line": 15, - "column": 13 - }, - "end": { - "line": 15, - "column": 29 + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 585, + "end": 586, + "loc": { + "start": { + "line": 20, + "column": 26 + }, + "end": { + "line": 20, + "column": 27 + }, + "identifierName": "n" }, - "identifierName": "delete_one_child" - }, - "name": "delete_one_child", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 424, - "end": 1338, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 591, + "end": 1519, "loc": { "start": { - "line": 15, + "line": 20, "column": 32 }, "end": { - "line": 42, + "line": 49, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 405, - "end": 421, - "loc": { - "start": { - "line": 15, - "column": 13 - }, - "end": { - "line": 15, - "column": 29 + "body": [ + { + "type": "ExpressionStatement", + "start": 594, + "end": 620, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 27 + } }, - "identifierName": "delete_one_child" - }, - "name": "delete_one_child", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 425, - "end": 426, - "loc": { - "start": { - "line": 15, - "column": 33 - }, - "end": { - "line": 15, - "column": 34 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 431, - "end": 1338, - "loc": { - "start": { - "line": 15, - "column": 39 - }, - "end": { - "line": 42, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 738, - "end": 759, + "expression": { + "type": "CallExpression", + "start": 594, + "end": 619, "loc": { "start": { - "line": 22, + "line": 21, "column": 1 }, "end": { - "line": 22, - "column": 22 + "line": 21, + "column": 26 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 594, + "end": 600, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 744, - "end": 758, + "type": "BinaryExpression", + "start": 601, + "end": 618, "loc": { "start": { - "line": 22, - "column": 7 + "line": 21, + "column": 8 }, "end": { - "line": 22, - "column": 21 + "line": 21, + "column": 25 } }, - "id": { + "left": { "type": "Identifier", - "start": 744, - "end": 749, + "start": 601, + "end": 602, "loc": { "start": { - "line": 22, - "column": 7 + "line": 21, + "column": 8 }, "end": { - "line": 22, - "column": 12 + "line": 21, + "column": 9 }, - "identifierName": "child" + "identifierName": "n" }, - "name": "child", - "leadingComments": null + "name": "n" }, - "init": { - "type": "MemberExpression", - "start": 752, - "end": 758, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 614, + "end": 618, "loc": { "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, + "line": 21, "column": 21 - } - }, - "object": { - "type": "Identifier", - "start": 752, - "end": 753, - "loc": { - "start": { - "line": 22, - "column": 15 - }, - "end": { - "line": 22, - "column": 16 - }, - "identifierName": "n" }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 754, - "end": 758, - "loc": { - "start": { - "line": 22, - "column": 17 - }, - "end": { - "line": 22, - "column": 21 - }, - "identifierName": "left" + "end": { + "line": 21, + "column": 25 }, - "name": "left" - }, - "computed": false - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentLine", - "value": " Precondition: n has at most one non-leaf child.", - "start": 434, - "end": 484, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 51 - } - } - }, - { - "type": "CommentLine", - "value": " assert( n.right.isLeaf() || n.left.isLeaf());", - "start": 486, - "end": 534, - "loc": { - "start": { - "line": 17, - "column": 1 + "identifierName": "Node" }, - "end": { - "line": 17, - "column": 49 - } + "name": "Node" } - }, - { - "type": "CommentLine", - "value": " const child = n.right.isLeaf() ? n.left : n.right;", - "start": 537, - "end": 590, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 54 - } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Precondition: n's right child is a leaf.", + "start": 622, + "end": 665, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 44 } - }, - { - "type": "CommentLine", - "value": " n.right is always a LEAF because either n is a subtree predecessor or it", - "start": 592, - "end": 667, - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 20, - "column": 76 - } + } + }, + { + "type": "CommentLine", + "value": " The right child of n is always a LEAF because either n is a subtree", + "start": 667, + "end": 737, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 71 } - }, - { - "type": "CommentLine", - "value": " is the only child of its parent by the red-black tree properties", - "start": 669, - "end": 736, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 68 - } + } + }, + { + "type": "CommentLine", + "value": " predecessor or it is the only child of its parent by the red-black tree", + "start": 739, + "end": 813, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 75 } } - ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Replace n with its left child", - "start": 762, - "end": 794, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 33 - } + }, + { + "type": "CommentLine", + "value": " properties", + "start": 815, + "end": 828, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 14 } } - ] + } + ] + }, + { + "type": "ExpressionStatement", + "start": 830, + "end": 862, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 33 + } }, - { - "type": "ExpressionStatement", - "start": 796, - "end": 819, + "expression": { + "type": "CallExpression", + "start": 830, + "end": 861, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, - "column": 24 + "line": 26, + "column": 32 } }, - "expression": { - "type": "CallExpression", - "start": 796, - "end": 818, + "callee": { + "type": "Identifier", + "start": 830, + "end": 836, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, - "column": 23 - } + "line": 26, + "column": 7 + }, + "identifierName": "assert" }, - "callee": { - "type": "Identifier", - "start": 796, - "end": 808, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 837, + "end": 860, "loc": { "start": { - "line": 25, - "column": 1 + "line": 26, + "column": 8 }, "end": { - "line": 25, - "column": 13 - }, - "identifierName": "replace_node" + "line": 26, + "column": 31 + } }, - "name": "replace_node", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 809, - "end": 810, + "left": { + "type": "MemberExpression", + "start": 837, + "end": 844, "loc": { "start": { - "line": 25, - "column": 14 + "line": 26, + "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 837, + "end": 838, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 839, + "end": 844, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 812, - "end": 817, + "start": 856, + "end": 860, "loc": { "start": { - "line": 25, - "column": 17 + "line": 26, + "column": 27 }, "end": { - "line": 25, - "column": 22 + "line": 26, + "column": 31 }, - "identifierName": "child" + "identifierName": "Leaf" }, - "name": "child" + "name": "Leaf" } - ], - "leadingComments": null + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Precondition: n's right child is a leaf.", + "start": 622, + "end": 665, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 44 + } + } }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Replace n with its left child", - "start": 762, - "end": 794, + { + "type": "CommentLine", + "value": " The right child of n is always a LEAF because either n is a subtree", + "start": 667, + "end": 737, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 71 + } + } + }, + { + "type": "CommentLine", + "value": " predecessor or it is the only child of its parent by the red-black tree", + "start": 739, + "end": 813, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " properties", + "start": 815, + "end": 828, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 14 + } + } + } + ] + }, + { + "type": "VariableDeclaration", + "start": 865, + "end": 886, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 871, + "end": 885, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 871, + "end": 876, "loc": { "start": { - "line": 24, - "column": 1 + "line": 28, + "column": 7 }, "end": { - "line": 24, - "column": 33 + "line": 28, + "column": 12 + }, + "identifierName": "child" + }, + "name": "child" + }, + "init": { + "type": "MemberExpression", + "start": 879, + "end": 885, + "loc": { + "start": { + "line": 28, + "column": 15 + }, + "end": { + "line": 28, + "column": 21 } + }, + "object": { + "type": "Identifier", + "start": 879, + "end": 880, + "loc": { + "start": { + "line": 28, + "column": 15 + }, + "end": { + "line": 28, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 881, + "end": 885, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentLine", + "value": " Replace n with its left child", + "start": 889, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 33 } } - ], - "trailingComments": [ + } + ] + }, + { + "type": "ExpressionStatement", + "start": 923, + "end": 946, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 923, + "end": 945, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 923, + "end": 935, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + }, + "identifierName": "replace_node" + }, + "name": "replace_node", + "leadingComments": null + }, + "arguments": [ { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 822, - "end": 896, + "type": "Identifier", + "start": 936, + "end": 937, "loc": { "start": { - "line": 27, - "column": 1 + "line": 31, + "column": 14 }, "end": { - "line": 27, - "column": 75 - } - } + "line": 31, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" }, { - "type": "CommentLine", - "value": " through it by 1.", - "start": 898, - "end": 917, + "type": "Identifier", + "start": 939, + "end": 944, "loc": { "start": { - "line": 28, - "column": 1 + "line": 31, + "column": 17 }, "end": { - "line": 28, - "column": 20 - } + "line": 31, + "column": 22 + }, + "identifierName": "child" + }, + "name": "child" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Replace n with its left child", + "start": 889, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 33 } } - ] + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 949, + "end": 1023, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1.", + "start": 1025, + "end": 1044, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 20 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1046, + "end": 1517, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 48, + "column": 2 + } }, - { - "type": "IfStatement", - "start": 919, - "end": 1221, + "test": { + "type": "BinaryExpression", + "start": 1050, + "end": 1068, "loc": { "start": { - "line": 29, - "column": 1 + "line": 35, + "column": 5 }, "end": { - "line": 36, - "column": 2 + "line": 35, + "column": 23 } }, - "test": { - "type": "BinaryExpression", - "start": 923, - "end": 941, + "left": { + "type": "MemberExpression", + "start": 1050, + "end": 1058, "loc": { "start": { - "line": 29, + "line": 35, "column": 5 }, "end": { - "line": 29, - "column": 23 + "line": 35, + "column": 13 } }, - "left": { - "type": "MemberExpression", - "start": 923, - "end": 931, + "object": { + "type": "Identifier", + "start": 1050, + "end": 1051, "loc": { "start": { - "line": 29, + "line": 35, "column": 5 }, "end": { - "line": 29, - "column": 13 - } - }, - "object": { - "type": "Identifier", - "start": 923, - "end": 924, - "loc": { - "start": { - "line": 29, - "column": 5 - }, - "end": { - "line": 29, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 925, - "end": 931, - "loc": { - "start": { - "line": 29, - "column": 7 - }, - "end": { - "line": 29, - "column": 13 - }, - "identifierName": "_color" + "line": 35, + "column": 6 }, - "name": "_color" + "identifierName": "n" }, - "computed": false, + "name": "n", "leadingComments": null }, - "operator": "===", - "right": { + "property": { "type": "Identifier", - "start": 936, - "end": 941, + "start": 1052, + "end": 1058, "loc": { "start": { - "line": 29, - "column": 18 + "line": 35, + "column": 7 }, "end": { - "line": 29, - "column": 23 + "line": 35, + "column": 13 }, - "identifierName": "BLACK" + "identifierName": "_color" }, - "name": "BLACK" + "name": "_color" }, + "computed": false, "leadingComments": null }, - "consequent": { - "type": "BlockStatement", - "start": 943, - "end": 1221, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1063, + "end": 1068, "loc": { "start": { - "line": 29, - "column": 25 + "line": 35, + "column": 18 }, "end": { - "line": 36, - "column": 2 - } + "line": 35, + "column": 23 + }, + "identifierName": "BLACK" }, - "body": [ - { - "type": "IfStatement", - "start": 1097, - "end": 1218, - "loc": { - "start": { - "line": 33, - "column": 2 - }, - "end": { - "line": 35, - "column": 27 - } - }, - "test": { - "type": "BinaryExpression", - "start": 1101, - "end": 1121, - "loc": { - "start": { - "line": 33, - "column": 6 - }, - "end": { - "line": 33, - "column": 26 + "name": "BLACK" + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1070, + "end": 1357, + "loc": { + "start": { + "line": 35, + "column": 25 + }, + "end": { + "line": 44, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 1224, + "end": 1354, + "loc": { + "start": { + "line": 39, + "column": 2 + }, + "end": { + "line": 43, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1228, + "end": 1248, + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 1228, + "end": 1240, + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 18 } }, - "left": { - "type": "MemberExpression", - "start": 1101, - "end": 1113, + "object": { + "type": "Identifier", + "start": 1228, + "end": 1233, "loc": { "start": { - "line": 33, + "line": 39, "column": 6 }, "end": { - "line": 33, + "line": 39, + "column": 11 + }, + "identifierName": "child" + }, + "name": "child", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1234, + "end": 1240, + "loc": { + "start": { + "line": 39, + "column": 12 + }, + "end": { + "line": 39, "column": 18 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1245, + "end": 1248, + "loc": { + "start": { + "line": 39, + "column": 23 + }, + "end": { + "line": 39, + "column": 26 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1250, + "end": 1271, + "loc": { + "start": { + "line": 39, + "column": 28 + }, + "end": { + "line": 39, + "column": 49 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1250, + "end": 1270, + "loc": { + "start": { + "line": 39, + "column": 28 + }, + "end": { + "line": 39, + "column": 48 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1250, + "end": 1262, + "loc": { + "start": { + "line": 39, + "column": 28 + }, + "end": { + "line": 39, + "column": 40 } }, "object": { "type": "Identifier", - "start": 1101, - "end": 1106, + "start": 1250, + "end": 1255, "loc": { "start": { - "line": 33, - "column": 6 + "line": 39, + "column": 28 }, "end": { - "line": 33, - "column": 11 + "line": 39, + "column": 33 }, "identifierName": "child" }, - "name": "child", - "leadingComments": null + "name": "child" }, "property": { "type": "Identifier", - "start": 1107, - "end": 1113, + "start": 1256, + "end": 1262, "loc": { "start": { - "line": 33, - "column": 12 + "line": 39, + "column": 34 }, "end": { - "line": 33, - "column": 18 + "line": 39, + "column": 40 }, "identifierName": "_color" }, "name": "_color" }, - "computed": false, - "leadingComments": null + "computed": false }, - "operator": "===", "right": { "type": "Identifier", - "start": 1118, - "end": 1121, + "start": 1265, + "end": 1270, "loc": { "start": { - "line": 33, - "column": 23 + "line": 39, + "column": 43 }, "end": { - "line": 33, - "column": 26 + "line": 39, + "column": 48 }, - "identifierName": "RED" + "identifierName": "BLACK" }, - "name": "RED" + "name": "BLACK" + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, there are more things to fix.", + "start": 1274, + "end": 1317, + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 45 + } + } + } + ] + }, + "alternate": { + "type": "BlockStatement", + "start": 1325, + "end": 1354, + "loc": { + "start": { + "line": 41, + "column": 7 }, - "leadingComments": null + "end": { + "line": 43, + "column": 3 + } }, - "consequent": { - "type": "ExpressionStatement", - "start": 1123, - "end": 1144, + "body": [ + { + "type": "ExpressionStatement", + "start": 1330, + "end": 1350, + "loc": { + "start": { + "line": 42, + "column": 3 + }, + "end": { + "line": 42, + "column": 23 + } + }, + "expression": { + "type": "CallExpression", + "start": 1330, + "end": 1349, + "loc": { + "start": { + "line": 42, + "column": 3 + }, + "end": { + "line": 42, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 1330, + "end": 1342, + "loc": { + "start": { + "line": 42, + "column": 3 + }, + "end": { + "line": 42, + "column": 15 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1343, + "end": 1348, + "loc": { + "start": { + "line": 42, + "column": 16 + }, + "end": { + "line": 42, + "column": 21 + }, + "identifierName": "child" + }, + "name": "child" + } + ], + "leadingComments": null + }, + "leadingComments": null + } + ], + "directives": [], + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, there are more things to fix.", + "start": 1274, + "end": 1317, + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 45 + } + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " We can easily fix this when its left child is an", + "start": 1074, + "end": 1125, "loc": { "start": { - "line": 33, - "column": 28 + "line": 36, + "column": 2 }, "end": { - "line": 33, - "column": 49 + "line": 36, + "column": 53 + } + } + }, + { + "type": "CommentLine", + "value": " internal red node: change the color of the left child to black and", + "start": 1128, + "end": 1197, + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 37, + "column": 71 + } + } + }, + { + "type": "CommentLine", + "value": " replace n with it.", + "start": 1200, + "end": 1221, + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 23 } + } + } + ] + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 1363, + "end": 1517, + "loc": { + "start": { + "line": 44, + "column": 8 + }, + "end": { + "line": 48, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1483, + "end": 1514, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 1483, + "end": 1513, + "loc": { + "start": { + "line": 47, + "column": 2 }, - "expression": { - "type": "AssignmentExpression", - "start": 1123, - "end": 1143, + "end": { + "line": 47, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 1483, + "end": 1489, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1490, + "end": 1512, "loc": { "start": { - "line": 33, - "column": 28 + "line": 47, + "column": 9 }, "end": { - "line": 33, - "column": 48 + "line": 47, + "column": 31 } }, - "operator": "=", "left": { "type": "MemberExpression", - "start": 1123, - "end": 1135, + "start": 1490, + "end": 1502, "loc": { "start": { - "line": 33, - "column": 28 + "line": 47, + "column": 9 }, "end": { - "line": 33, - "column": 40 + "line": 47, + "column": 21 } }, "object": { "type": "Identifier", - "start": 1123, - "end": 1128, + "start": 1490, + "end": 1495, "loc": { "start": { - "line": 33, - "column": 28 + "line": 47, + "column": 9 }, "end": { - "line": 33, - "column": 33 + "line": 47, + "column": 14 }, "identifierName": "child" }, @@ -1101,16 +1847,16 @@ }, "property": { "type": "Identifier", - "start": 1129, - "end": 1135, + "start": 1496, + "end": 1502, "loc": { "start": { - "line": 33, - "column": 34 + "line": 47, + "column": 15 }, "end": { - "line": 33, - "column": 40 + "line": 47, + "column": 21 }, "identifierName": "_color" }, @@ -1118,617 +1864,2977 @@ }, "computed": false }, + "operator": "===", "right": { "type": "Identifier", - "start": 1138, - "end": 1143, + "start": 1507, + "end": 1512, "loc": { "start": { - "line": 33, - "column": 43 + "line": 47, + "column": 26 }, "end": { - "line": 33, - "column": 48 + "line": 47, + "column": 31 }, "identifierName": "BLACK" }, "name": "BLACK" } - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1147, - "end": 1190, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 34, - "column": 45 - } - } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is red then its child can only be black. Replacing n with its", + "start": 1367, + "end": 1439, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 74 } - ] + } }, - "alternate": { - "type": "ExpressionStatement", - "start": 1198, - "end": 1218, + { + "type": "CommentLine", + "value": " child suffices. This is a NO-OP.", + "start": 1442, + "end": 1480, "loc": { "start": { - "line": 35, - "column": 7 + "line": 46, + "column": 2 }, "end": { - "line": 35, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 1198, - "end": 1217, - "loc": { - "start": { - "line": 35, - "column": 7 - }, - "end": { - "line": 35, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 1198, - "end": 1210, - "loc": { - "start": { - "line": 35, - "column": 7 - }, - "end": { - "line": 35, - "column": 19 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1211, - "end": 1216, - "loc": { - "start": { - "line": 35, - "column": 20 - }, - "end": { - "line": 35, - "column": 25 - }, - "identifierName": "child" - }, - "name": "child" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1147, - "end": 1190, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 34, - "column": 45 - } - } - } - ] - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " We can easily fix this when its left child is an", - "start": 947, - "end": 998, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 30, - "column": 53 - } - } - }, - { - "type": "CommentLine", - "value": " internal red node: change the color of the left child to black and", - "start": 1001, - "end": 1070, - "loc": { - "start": { - "line": 31, - "column": 2 - }, - "end": { - "line": 31, - "column": 71 - } - } - }, - { - "type": "CommentLine", - "value": " replace n with it.", - "start": 1073, - "end": 1094, - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 23 - } + "line": 46, + "column": 40 } } - ] - } - ], - "directives": [], - "trailingComments": null - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 822, - "end": 896, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " through it by 1.", - "start": 898, - "end": 917, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 20 } - } + ] } ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Else {", - "start": 1224, - "end": 1233, - "loc": { - "start": { - "line": 38, - "column": 1 - }, - "end": { - "line": 38, - "column": 10 - } - } - }, - { - "type": "CommentLine", - "value": " If n is red then its child can only be black. Replacing n with its", - "start": 1235, - "end": 1307, - "loc": { - "start": { - "line": 39, - "column": 1 - }, - "end": { - "line": 39, - "column": 73 - } - } - }, - { - "type": "CommentLine", - "value": " child suffices.", - "start": 1309, - "end": 1330, - "loc": { - "start": { - "line": 40, - "column": 1 - }, - "end": { - "line": 40, - "column": 22 - } + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 949, + "end": 1023, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 75 } - }, - { - "type": "CommentLine", - "value": " }", - "start": 1332, - "end": 1336, - "loc": { - "start": { - "line": 41, - "column": 1 - }, - "end": { - "line": 41, - "column": 5 - } + } + }, + { + "type": "CommentLine", + "value": " through it by 1.", + "start": 1025, + "end": 1044, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 20 } } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1522, + "end": 1554, + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 32 + } + }, + "declaration": { + "type": "Identifier", + "start": 1537, + "end": 1553, + "loc": { + "start": { + "line": 51, + "column": 15 + }, + "end": { + "line": 51, + "column": 31 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1522, + "end": 1554, + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 32 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 559, + "end": 1520, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 49, + "column": 2 } - ], - "kind": "const", - "leadingComments": [ + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", - "start": 144, - "end": 391, + "type": "VariableDeclarator", + "start": 565, + "end": 1519, "loc": { "start": { - "line": 6, - "column": 0 + "line": 20, + "column": 6 }, "end": { - "line": 14, - "column": 3 + "line": 49, + "column": 1 } - } - } - ], - "trailingComments": [] + }, + "id": { + "type": "Identifier", + "start": 565, + "end": 581, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 22 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 584, + "end": 1519, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 49, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 565, + "end": 581, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 22 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 585, + "end": 586, + "loc": { + "start": { + "line": 20, + "column": 26 + }, + "end": { + "line": 20, + "column": 27 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 591, + "end": 1519, + "loc": { + "start": { + "line": 20, + "column": 32 + }, + "end": { + "line": 49, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 594, + "end": 620, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 594, + "end": 619, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 594, + "end": 600, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 601, + "end": 618, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 601, + "end": 602, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 614, + "end": 618, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Precondition: n's right child is a leaf.", + "start": 622, + "end": 665, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 44 + } + } + }, + { + "type": "CommentLine", + "value": " The right child of n is always a LEAF because either n is a subtree", + "start": 667, + "end": 737, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 71 + } + } + }, + { + "type": "CommentLine", + "value": " predecessor or it is the only child of its parent by the red-black tree", + "start": 739, + "end": 813, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " properties", + "start": 815, + "end": 828, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 14 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 830, + "end": 862, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 830, + "end": 861, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 830, + "end": 836, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 837, + "end": 860, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 837, + "end": 844, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 837, + "end": 838, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 839, + "end": 844, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 856, + "end": 860, + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 31 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Precondition: n's right child is a leaf.", + "start": 622, + "end": 665, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 44 + } + } + }, + { + "type": "CommentLine", + "value": " The right child of n is always a LEAF because either n is a subtree", + "start": 667, + "end": 737, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 71 + } + } + }, + { + "type": "CommentLine", + "value": " predecessor or it is the only child of its parent by the red-black tree", + "start": 739, + "end": 813, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " properties", + "start": 815, + "end": 828, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 14 + } + } + } + ] + }, + { + "type": "VariableDeclaration", + "start": 865, + "end": 886, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 871, + "end": 885, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 871, + "end": 876, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 12 + }, + "identifierName": "child" + }, + "name": "child" + }, + "init": { + "type": "MemberExpression", + "start": 879, + "end": 885, + "loc": { + "start": { + "line": 28, + "column": 15 + }, + "end": { + "line": 28, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 879, + "end": 880, + "loc": { + "start": { + "line": 28, + "column": 15 + }, + "end": { + "line": 28, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 881, + "end": 885, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentLine", + "value": " Replace n with its left child", + "start": 889, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 33 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 923, + "end": 946, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 923, + "end": 945, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 923, + "end": 935, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + }, + "identifierName": "replace_node" + }, + "name": "replace_node", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 936, + "end": 937, + "loc": { + "start": { + "line": 31, + "column": 14 + }, + "end": { + "line": 31, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + }, + { + "type": "Identifier", + "start": 939, + "end": 944, + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 22 + }, + "identifierName": "child" + }, + "name": "child" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Replace n with its left child", + "start": 889, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 33 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 949, + "end": 1023, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1.", + "start": 1025, + "end": 1044, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 20 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1046, + "end": 1517, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 48, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1050, + "end": 1068, + "loc": { + "start": { + "line": 35, + "column": 5 + }, + "end": { + "line": 35, + "column": 23 + } + }, + "left": { + "type": "MemberExpression", + "start": 1050, + "end": 1058, + "loc": { + "start": { + "line": 35, + "column": 5 + }, + "end": { + "line": 35, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 1050, + "end": 1051, + "loc": { + "start": { + "line": 35, + "column": 5 + }, + "end": { + "line": 35, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1052, + "end": 1058, + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1063, + "end": 1068, + "loc": { + "start": { + "line": 35, + "column": 18 + }, + "end": { + "line": 35, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1070, + "end": 1357, + "loc": { + "start": { + "line": 35, + "column": 25 + }, + "end": { + "line": 44, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 1224, + "end": 1354, + "loc": { + "start": { + "line": 39, + "column": 2 + }, + "end": { + "line": 43, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1228, + "end": 1248, + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 1228, + "end": 1240, + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 1228, + "end": 1233, + "loc": { + "start": { + "line": 39, + "column": 6 + }, + "end": { + "line": 39, + "column": 11 + }, + "identifierName": "child" + }, + "name": "child", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1234, + "end": 1240, + "loc": { + "start": { + "line": 39, + "column": 12 + }, + "end": { + "line": 39, + "column": 18 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1245, + "end": 1248, + "loc": { + "start": { + "line": 39, + "column": 23 + }, + "end": { + "line": 39, + "column": 26 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1250, + "end": 1271, + "loc": { + "start": { + "line": 39, + "column": 28 + }, + "end": { + "line": 39, + "column": 49 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1250, + "end": 1270, + "loc": { + "start": { + "line": 39, + "column": 28 + }, + "end": { + "line": 39, + "column": 48 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1250, + "end": 1262, + "loc": { + "start": { + "line": 39, + "column": 28 + }, + "end": { + "line": 39, + "column": 40 + } + }, + "object": { + "type": "Identifier", + "start": 1250, + "end": 1255, + "loc": { + "start": { + "line": 39, + "column": 28 + }, + "end": { + "line": 39, + "column": 33 + }, + "identifierName": "child" + }, + "name": "child" + }, + "property": { + "type": "Identifier", + "start": 1256, + "end": 1262, + "loc": { + "start": { + "line": 39, + "column": 34 + }, + "end": { + "line": 39, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1265, + "end": 1270, + "loc": { + "start": { + "line": 39, + "column": 43 + }, + "end": { + "line": 39, + "column": 48 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, there are more things to fix.", + "start": 1274, + "end": 1317, + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 45 + } + } + } + ] + }, + "alternate": { + "type": "BlockStatement", + "start": 1325, + "end": 1354, + "loc": { + "start": { + "line": 41, + "column": 7 + }, + "end": { + "line": 43, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1330, + "end": 1350, + "loc": { + "start": { + "line": 42, + "column": 3 + }, + "end": { + "line": 42, + "column": 23 + } + }, + "expression": { + "type": "CallExpression", + "start": 1330, + "end": 1349, + "loc": { + "start": { + "line": 42, + "column": 3 + }, + "end": { + "line": 42, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 1330, + "end": 1342, + "loc": { + "start": { + "line": 42, + "column": 3 + }, + "end": { + "line": 42, + "column": 15 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1343, + "end": 1348, + "loc": { + "start": { + "line": 42, + "column": 16 + }, + "end": { + "line": 42, + "column": 21 + }, + "identifierName": "child" + }, + "name": "child" + } + ], + "leadingComments": null + }, + "leadingComments": null + } + ], + "directives": [], + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, there are more things to fix.", + "start": 1274, + "end": 1317, + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 45 + } + } + } + ] + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " We can easily fix this when its left child is an", + "start": 1074, + "end": 1125, + "loc": { + "start": { + "line": 36, + "column": 2 + }, + "end": { + "line": 36, + "column": 53 + } + } + }, + { + "type": "CommentLine", + "value": " internal red node: change the color of the left child to black and", + "start": 1128, + "end": 1197, + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 37, + "column": 71 + } + } + }, + { + "type": "CommentLine", + "value": " replace n with it.", + "start": 1200, + "end": 1221, + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 23 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 1363, + "end": 1517, + "loc": { + "start": { + "line": 44, + "column": 8 + }, + "end": { + "line": 48, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1483, + "end": 1514, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 1483, + "end": 1513, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 1483, + "end": 1489, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1490, + "end": 1512, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 1490, + "end": 1502, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 1490, + "end": 1495, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 14 + }, + "identifierName": "child" + }, + "name": "child" + }, + "property": { + "type": "Identifier", + "start": 1496, + "end": 1502, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1507, + "end": 1512, + "loc": { + "start": { + "line": 47, + "column": 26 + }, + "end": { + "line": 47, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is red then its child can only be black. Replacing n with its", + "start": 1367, + "end": 1439, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 74 + } + } + }, + { + "type": "CommentLine", + "value": " child suffices. This is a NO-OP.", + "start": 1442, + "end": 1480, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 40 + } + } + } + ] + } + ], + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 949, + "end": 1023, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1.", + "start": 1025, + "end": 1044, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 20 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n ", + "start": 271, + "end": 558, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n ", + "start": 271, + "end": 558, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " Precondition: n's right child is a leaf.", + "start": 622, + "end": 665, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 44 + } + } + }, + { + "type": "CommentLine", + "value": " The right child of n is always a LEAF because either n is a subtree", + "start": 667, + "end": 737, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 71 + } + } + }, + { + "type": "CommentLine", + "value": " predecessor or it is the only child of its parent by the red-black tree", + "start": 739, + "end": 813, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " properties", + "start": 815, + "end": 828, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 14 + } + } + }, + { + "type": "CommentLine", + "value": " Replace n with its left child", + "start": 889, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 33 + } + } + }, + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 949, + "end": 1023, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1.", + "start": 1025, + "end": 1044, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 20 + } + } + }, + { + "type": "CommentLine", + "value": " We can easily fix this when its left child is an", + "start": 1074, + "end": 1125, + "loc": { + "start": { + "line": 36, + "column": 2 + }, + "end": { + "line": 36, + "column": 53 + } + } + }, + { + "type": "CommentLine", + "value": " internal red node: change the color of the left child to black and", + "start": 1128, + "end": 1197, + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 37, + "column": 71 + } + } + }, + { + "type": "CommentLine", + "value": " replace n with it.", + "start": 1200, + "end": 1221, + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 23 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise, there are more things to fix.", + "start": 1274, + "end": 1317, + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " If n is red then its child can only be black. Replacing n with its", + "start": 1367, + "end": 1439, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 74 + } + } + }, + { + "type": "CommentLine", + "value": " child suffices. This is a NO-OP.", + "start": 1442, + "end": 1480, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 40 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 75, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 103, + "end": 109, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 115, + "end": 119, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 120, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 17 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", - "start": 144, - "end": 391, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 14, - "column": 3 - } - } - } - ] + "end": { + "line": 4, + "column": 35 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", - "start": 144, - "end": 391, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 14, - "column": 3 + "line": 5, + "column": 6 } } }, { - "type": "CommentLine", - "value": " Precondition: n has at most one non-leaf child.", - "start": 434, - "end": 484, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 147, + "end": 151, "loc": { "start": { - "line": 16, - "column": 1 + "line": 5, + "column": 7 }, "end": { - "line": 16, - "column": 51 + "line": 5, + "column": 11 } } }, { - "type": "CommentLine", - "value": " assert( n.right.isLeaf() || n.left.isLeaf());", - "start": 486, - "end": 534, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 152, + "end": 156, "loc": { "start": { - "line": 17, - "column": 1 + "line": 5, + "column": 12 }, "end": { - "line": 17, - "column": 49 + "line": 5, + "column": 16 } } }, { - "type": "CommentLine", - "value": " const child = n.right.isLeaf() ? n.left : n.right;", - "start": 537, - "end": 590, + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 157, + "end": 175, "loc": { "start": { - "line": 19, - "column": 1 + "line": 5, + "column": 17 }, "end": { - "line": 19, - "column": 54 + "line": 5, + "column": 35 } } }, { - "type": "CommentLine", - "value": " n.right is always a LEAF because either n is a subtree predecessor or it", - "start": 592, - "end": 667, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 175, + "end": 176, "loc": { "start": { - "line": 20, - "column": 1 + "line": 5, + "column": 35 + }, + "end": { + "line": 5, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 178, + "end": 184, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "replace_node", + "start": 185, + "end": 197, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 198, + "end": 202, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./replace_node.js", + "start": 203, + "end": 222, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 222, + "end": 223, + "loc": { + "start": { + "line": 7, + "column": 44 }, "end": { - "line": 20, - "column": 76 + "line": 7, + "column": 45 } } }, { - "type": "CommentLine", - "value": " is the only child of its parent by the red-black tree properties", - "start": 669, - "end": 736, + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 224, + "end": 230, "loc": { "start": { - "line": 21, - "column": 1 + "line": 8, + "column": 0 }, "end": { - "line": 21, - "column": 68 + "line": 8, + "column": 6 } } }, { - "type": "CommentLine", - "value": " Replace n with its left child", - "start": 762, - "end": 794, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case1", + "start": 231, + "end": 243, "loc": { "start": { - "line": 24, - "column": 1 + "line": 8, + "column": 7 }, "end": { - "line": 24, - "column": 33 + "line": 8, + "column": 19 } } }, { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 822, - "end": 896, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 244, + "end": 248, "loc": { "start": { - "line": 27, - "column": 1 + "line": 8, + "column": 20 }, "end": { - "line": 27, - "column": 75 + "line": 8, + "column": 24 } } }, { - "type": "CommentLine", - "value": " through it by 1.", - "start": 898, - "end": 917, + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case1.js", + "start": 249, + "end": 268, "loc": { "start": { - "line": 28, - "column": 1 + "line": 8, + "column": 25 }, "end": { - "line": 28, - "column": 20 + "line": 8, + "column": 44 } } }, { - "type": "CommentLine", - "value": " We can easily fix this when its left child is an", - "start": 947, - "end": 998, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 268, + "end": 269, "loc": { "start": { - "line": 30, - "column": 2 + "line": 8, + "column": 44 }, "end": { - "line": 30, - "column": 53 + "line": 8, + "column": 45 } } }, { - "type": "CommentLine", - "value": " internal red node: change the color of the left child to black and", - "start": 1001, - "end": 1070, + "type": "CommentBlock", + "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n ", + "start": 271, + "end": 558, "loc": { "start": { - "line": 31, - "column": 2 + "line": 10, + "column": 0 }, "end": { - "line": 31, - "column": 71 + "line": 19, + "column": 3 } } }, { - "type": "CommentLine", - "value": " replace n with it.", - "start": 1073, - "end": 1094, + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 559, + "end": 564, "loc": { "start": { - "line": 32, - "column": 2 + "line": 20, + "column": 0 }, "end": { - "line": 32, - "column": 23 + "line": 20, + "column": 5 } } }, { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1147, - "end": 1190, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_one_child", + "start": 565, + "end": 581, "loc": { "start": { - "line": 34, - "column": 2 + "line": 20, + "column": 6 }, "end": { - "line": 34, - "column": 45 + "line": 20, + "column": 22 } } }, { - "type": "CommentLine", - "value": " Else {", - "start": 1224, - "end": 1233, + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 582, + "end": 583, "loc": { "start": { - "line": 38, - "column": 1 + "line": 20, + "column": 23 }, "end": { - "line": 38, - "column": 10 + "line": 20, + "column": 24 } } }, { - "type": "CommentLine", - "value": " If n is red then its child can only be black. Replacing n with its", - "start": 1235, - "end": 1307, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 584, + "end": 585, "loc": { "start": { - "line": 39, - "column": 1 + "line": 20, + "column": 25 }, "end": { - "line": 39, - "column": 73 + "line": 20, + "column": 26 } } }, { - "type": "CommentLine", - "value": " child suffices.", - "start": 1309, - "end": 1330, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 585, + "end": 586, "loc": { "start": { - "line": 40, - "column": 1 + "line": 20, + "column": 26 }, "end": { - "line": 40, - "column": 22 + "line": 20, + "column": 27 } } }, { - "type": "CommentLine", - "value": " }", - "start": 1332, - "end": 1336, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 586, + "end": 587, "loc": { "start": { - "line": 41, - "column": 1 + "line": 20, + "column": 27 }, "end": { - "line": 41, - "column": 5 + "line": 20, + "column": 28 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": "=>", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1736,18 +4842,17 @@ "postfix": false, "binop": null, "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, + }, + "start": 588, + "end": 590, "loc": { "start": { - "line": 1, - "column": 0 + "line": 20, + "column": 29 }, "end": { - "line": 1, - "column": 6 + "line": 20, + "column": 31 } } }, @@ -1763,16 +4868,16 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "start": 591, + "end": 592, "loc": { "start": { - "line": 1, - "column": 7 + "line": 20, + "column": 32 }, "end": { - "line": 1, - "column": 8 + "line": 20, + "column": 33 } } }, @@ -1788,43 +4893,42 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "assert", + "start": 594, + "end": 600, "loc": { "start": { - "line": 1, - "column": 8 + "line": 21, + "column": 1 }, "end": { - "line": 1, - "column": 13 + "line": 21, + "column": 7 } } }, { "type": { - "label": ",", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 13, - "end": 14, + "start": 600, + "end": 601, "loc": { "start": { - "line": 1, - "column": 13 + "line": 21, + "column": 7 }, "end": { - "line": 1, - "column": 14 + "line": 21, + "column": 8 } } }, @@ -1840,42 +4944,45 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 15, - "end": 18, + "value": "n", + "start": 601, + "end": 602, "loc": { "start": { - "line": 1, - "column": 15 + "line": 21, + "column": 8 }, "end": { - "line": 1, - "column": 18 + "line": 21, + "column": 9 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 18, - "end": 19, + "value": "instanceof", + "start": 603, + "end": 613, "loc": { "start": { - "line": 1, - "column": 18 + "line": 21, + "column": 10 }, "end": { - "line": 1, - "column": 19 + "line": 21, + "column": 20 } } }, @@ -1891,44 +4998,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 20, - "end": 24, + "value": "Node", + "start": 614, + "end": 618, "loc": { "start": { - "line": 1, - "column": 20 + "line": 21, + "column": 21 }, "end": { - "line": 1, - "column": 24 + "line": 21, + "column": 25 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/index.js", - "start": 25, - "end": 44, + "start": 618, + "end": 619, "loc": { "start": { - "line": 1, + "line": 21, "column": 25 }, "end": { - "line": 1, - "column": 44 + "line": 21, + "column": 26 } } }, @@ -1945,69 +5050,80 @@ "binop": null, "updateContext": null }, - "start": 44, - "end": 45, + "start": 619, + "end": 620, "loc": { "start": { - "line": 1, + "line": 21, + "column": 26 + }, + "end": { + "line": 21, + "column": 27 + } + } + }, + { + "type": "CommentLine", + "value": " Precondition: n's right child is a leaf.", + "start": 622, + "end": 665, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, "column": 44 + } + } + }, + { + "type": "CommentLine", + "value": " The right child of n is always a LEAF because either n is a subtree", + "start": 667, + "end": 737, + "loc": { + "start": { + "line": 23, + "column": 1 }, "end": { - "line": 1, - "column": 45 + "line": 23, + "column": 71 } } }, { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 47, - "end": 53, + "type": "CommentLine", + "value": " predecessor or it is the only child of its parent by the red-black tree", + "start": 739, + "end": 813, "loc": { "start": { - "line": 3, - "column": 0 + "line": 24, + "column": 1 }, "end": { - "line": 3, - "column": 6 + "line": 24, + "column": 75 } } }, { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 54, - "end": 55, + "type": "CommentLine", + "value": " properties", + "start": 815, + "end": 828, "loc": { "start": { - "line": 3, - "column": 7 + "line": 25, + "column": 1 }, "end": { - "line": 3, - "column": 8 + "line": 25, + "column": 14 } } }, @@ -2023,25 +5139,25 @@ "postfix": false, "binop": null }, - "value": "replace_node", - "start": 55, - "end": 67, + "value": "assert", + "start": 830, + "end": 836, "loc": { "start": { - "line": 3, - "column": 8 + "line": 26, + "column": 1 }, "end": { - "line": 3, - "column": 20 + "line": 26, + "column": 7 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2049,16 +5165,16 @@ "postfix": false, "binop": null }, - "start": 67, - "end": 68, + "start": 836, + "end": 837, "loc": { "start": { - "line": 3, - "column": 20 + "line": 26, + "column": 7 }, "end": { - "line": 3, - "column": 21 + "line": 26, + "column": 8 } } }, @@ -2074,25 +5190,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 69, - "end": 73, + "value": "n", + "start": 837, + "end": 838, "loc": { "start": { - "line": 3, - "column": 22 + "line": 26, + "column": 8 }, "end": { - "line": 3, - "column": 26 + "line": 26, + "column": 9 } } }, { "type": { - "label": "string", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2101,78 +5217,77 @@ "binop": null, "updateContext": null }, - "value": "./replace_node.js", - "start": 74, - "end": 93, + "start": 838, + "end": 839, "loc": { "start": { - "line": 3, - "column": 27 + "line": 26, + "column": 9 }, "end": { - "line": 3, - "column": 46 + "line": 26, + "column": 10 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 93, - "end": 94, + "value": "right", + "start": 839, + "end": 844, "loc": { "start": { - "line": 3, - "column": 46 + "line": 26, + "column": 10 }, "end": { - "line": 3, - "column": 47 + "line": 26, + "column": 15 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "import", - "start": 95, - "end": 101, + "value": "instanceof", + "start": 845, + "end": 855, "loc": { "start": { - "line": 4, - "column": 0 + "line": 26, + "column": 16 }, "end": { - "line": 4, - "column": 6 + "line": 26, + "column": 26 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2181,24 +5296,25 @@ "postfix": false, "binop": null }, - "start": 102, - "end": 103, + "value": "Leaf", + "start": 856, + "end": 860, "loc": { "start": { - "line": 4, - "column": 7 + "line": 26, + "column": 27 }, "end": { - "line": 4, - "column": 8 + "line": 26, + "column": 31 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2206,74 +5322,76 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 103, - "end": 115, + "start": 860, + "end": 861, "loc": { "start": { - "line": 4, - "column": 8 + "line": 26, + "column": 31 }, "end": { - "line": 4, - "column": 20 + "line": 26, + "column": 32 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 115, - "end": 116, + "start": 861, + "end": 862, "loc": { "start": { - "line": 4, - "column": 20 + "line": 26, + "column": 32 }, "end": { - "line": 4, - "column": 21 + "line": 26, + "column": 33 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 117, - "end": 121, + "value": "const", + "start": 865, + "end": 870, "loc": { "start": { - "line": 4, - "column": 22 + "line": 28, + "column": 1 }, "end": { - "line": 4, - "column": 26 + "line": 28, + "column": 6 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2281,97 +5399,78 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./delete_case1.js", - "start": 122, - "end": 141, + "value": "child", + "start": 871, + "end": 876, "loc": { "start": { - "line": 4, - "column": 27 + "line": 28, + "column": 7 }, "end": { - "line": 4, - "column": 46 + "line": 28, + "column": 12 } } }, { "type": { - "label": ";", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 141, - "end": 142, - "loc": { - "start": { - "line": 4, - "column": 46 - }, - "end": { - "line": 4, - "column": 47 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n ", - "start": 144, - "end": 391, + "value": "=", + "start": 877, + "end": 878, "loc": { "start": { - "line": 6, - "column": 0 + "line": 28, + "column": 13 }, "end": { - "line": 14, - "column": 3 + "line": 28, + "column": 14 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 392, - "end": 398, + "value": "n", + "start": 879, + "end": 880, "loc": { "start": { - "line": 15, - "column": 0 + "line": 28, + "column": 15 }, "end": { - "line": 15, - "column": 6 + "line": 28, + "column": 16 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2382,17 +5481,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 399, - "end": 404, + "start": 880, + "end": 881, "loc": { "start": { - "line": 15, - "column": 7 + "line": 28, + "column": 16 }, "end": { - "line": 15, - "column": 12 + "line": 28, + "column": 17 } } }, @@ -2408,51 +5506,66 @@ "postfix": false, "binop": null }, - "value": "delete_one_child", - "start": 405, - "end": 421, + "value": "left", + "start": 881, + "end": 885, "loc": { "start": { - "line": 15, - "column": 13 + "line": 28, + "column": 17 }, "end": { - "line": 15, - "column": 29 + "line": 28, + "column": 21 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 422, - "end": 423, + "start": 885, + "end": 886, "loc": { "start": { - "line": 15, - "column": 30 + "line": 28, + "column": 21 }, "end": { - "line": 15, - "column": 31 + "line": 28, + "column": 22 + } + } + }, + { + "type": "CommentLine", + "value": " Replace n with its left child", + "start": 889, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 33 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2461,23 +5574,24 @@ "postfix": false, "binop": null }, - "start": 424, - "end": 425, + "value": "replace_node", + "start": 923, + "end": 935, "loc": { "start": { - "line": 15, - "column": 32 + "line": 31, + "column": 1 }, "end": { - "line": 15, - "column": 33 + "line": 31, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2486,25 +5600,24 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 425, - "end": 426, + "start": 935, + "end": 936, "loc": { "start": { - "line": 15, - "column": 33 + "line": 31, + "column": 13 }, "end": { - "line": 15, - "column": 34 + "line": 31, + "column": 14 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2512,22 +5625,23 @@ "postfix": false, "binop": null }, - "start": 426, - "end": 427, + "value": "n", + "start": 936, + "end": 937, "loc": { "start": { - "line": 15, - "column": 34 + "line": 31, + "column": 14 }, "end": { - "line": 15, - "column": 35 + "line": 31, + "column": 15 } } }, { "type": { - "label": "=>", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2538,23 +5652,23 @@ "binop": null, "updateContext": null }, - "start": 428, - "end": 430, + "start": 937, + "end": 938, "loc": { "start": { - "line": 15, - "column": 36 + "line": 31, + "column": 15 }, "end": { - "line": 15, - "column": 38 + "line": 31, + "column": 16 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2563,177 +5677,153 @@ "postfix": false, "binop": null }, - "start": 431, - "end": 432, - "loc": { - "start": { - "line": 15, - "column": 39 - }, - "end": { - "line": 15, - "column": 40 - } - } - }, - { - "type": "CommentLine", - "value": " Precondition: n has at most one non-leaf child.", - "start": 434, - "end": 484, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 51 - } - } - }, - { - "type": "CommentLine", - "value": " assert( n.right.isLeaf() || n.left.isLeaf());", - "start": 486, - "end": 534, + "value": "child", + "start": 939, + "end": 944, "loc": { "start": { - "line": 17, - "column": 1 + "line": 31, + "column": 17 }, "end": { - "line": 17, - "column": 49 + "line": 31, + "column": 22 } } }, { - "type": "CommentLine", - "value": " const child = n.right.isLeaf() ? n.left : n.right;", - "start": 537, - "end": 590, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 944, + "end": 945, "loc": { "start": { - "line": 19, - "column": 1 + "line": 31, + "column": 22 }, "end": { - "line": 19, - "column": 54 + "line": 31, + "column": 23 } } }, { - "type": "CommentLine", - "value": " n.right is always a LEAF because either n is a subtree predecessor or it", - "start": 592, - "end": 667, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 945, + "end": 946, "loc": { "start": { - "line": 20, - "column": 1 + "line": 31, + "column": 23 }, "end": { - "line": 20, - "column": 76 + "line": 31, + "column": 24 } } }, { "type": "CommentLine", - "value": " is the only child of its parent by the red-black tree properties", - "start": 669, - "end": 736, + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 949, + "end": 1023, "loc": { "start": { - "line": 21, + "line": 33, "column": 1 }, "end": { - "line": 21, - "column": 68 + "line": 33, + "column": 75 } } }, { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 738, - "end": 743, + "type": "CommentLine", + "value": " through it by 1.", + "start": 1025, + "end": 1044, "loc": { "start": { - "line": 22, + "line": 34, "column": 1 }, "end": { - "line": 22, - "column": 6 + "line": 34, + "column": 20 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "child", - "start": 744, - "end": 749, + "value": "if", + "start": 1046, + "end": 1048, "loc": { "start": { - "line": 22, - "column": 7 + "line": 35, + "column": 1 }, "end": { - "line": 22, - "column": 12 + "line": 35, + "column": 3 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 750, - "end": 751, + "start": 1049, + "end": 1050, "loc": { "start": { - "line": 22, - "column": 13 + "line": 35, + "column": 4 }, "end": { - "line": 22, - "column": 14 + "line": 35, + "column": 5 } } }, @@ -2750,16 +5840,16 @@ "binop": null }, "value": "n", - "start": 752, - "end": 753, + "start": 1050, + "end": 1051, "loc": { "start": { - "line": 22, - "column": 15 + "line": 35, + "column": 5 }, "end": { - "line": 22, - "column": 16 + "line": 35, + "column": 6 } } }, @@ -2776,16 +5866,16 @@ "binop": null, "updateContext": null }, - "start": 753, - "end": 754, + "start": 1051, + "end": 1052, "loc": { "start": { - "line": 22, - "column": 16 + "line": 35, + "column": 6 }, "end": { - "line": 22, - "column": 17 + "line": 35, + "column": 7 } } }, @@ -2801,23 +5891,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 754, - "end": 758, + "value": "_color", + "start": 1052, + "end": 1058, "loc": { "start": { - "line": 22, - "column": 17 + "line": 35, + "column": 7 }, "end": { - "line": 22, - "column": 21 + "line": 35, + "column": 13 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2825,35 +5915,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 758, - "end": 759, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - { - "type": "CommentLine", - "value": " Replace n with its left child", - "start": 762, - "end": 794, + "value": "===", + "start": 1059, + "end": 1062, "loc": { "start": { - "line": 24, - "column": 1 + "line": 35, + "column": 14 }, "end": { - "line": 24, - "column": 33 + "line": 35, + "column": 17 } } }, @@ -2869,25 +5944,25 @@ "postfix": false, "binop": null }, - "value": "replace_node", - "start": 796, - "end": 808, + "value": "BLACK", + "start": 1063, + "end": 1068, "loc": { "start": { - "line": 25, - "column": 1 + "line": 35, + "column": 18 }, "end": { - "line": 25, - "column": 13 + "line": 35, + "column": 23 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2895,23 +5970,23 @@ "postfix": false, "binop": null }, - "start": 808, - "end": 809, + "start": 1068, + "end": 1069, "loc": { "start": { - "line": 25, - "column": 13 + "line": 35, + "column": 23 }, "end": { - "line": 25, - "column": 14 + "line": 35, + "column": 24 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2920,24 +5995,72 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 809, - "end": 810, + "start": 1070, + "end": 1071, "loc": { "start": { - "line": 25, - "column": 14 + "line": 35, + "column": 25 }, "end": { - "line": 25, - "column": 15 + "line": 35, + "column": 26 + } + } + }, + { + "type": "CommentLine", + "value": " We can easily fix this when its left child is an", + "start": 1074, + "end": 1125, + "loc": { + "start": { + "line": 36, + "column": 2 + }, + "end": { + "line": 36, + "column": 53 + } + } + }, + { + "type": "CommentLine", + "value": " internal red node: change the color of the left child to black and", + "start": 1128, + "end": 1197, + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 37, + "column": 71 + } + } + }, + { + "type": "CommentLine", + "value": " replace n with it.", + "start": 1200, + "end": 1221, + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 23 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": "if", + "keyword": "if", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2947,23 +6070,24 @@ "binop": null, "updateContext": null }, - "start": 810, - "end": 811, + "value": "if", + "start": 1224, + "end": 1226, "loc": { "start": { - "line": 25, - "column": 15 + "line": 39, + "column": 2 }, "end": { - "line": 25, - "column": 16 + "line": 39, + "column": 4 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2972,25 +6096,24 @@ "postfix": false, "binop": null }, - "value": "child", - "start": 812, - "end": 817, + "start": 1227, + "end": 1228, "loc": { "start": { - "line": 25, - "column": 17 + "line": 39, + "column": 5 }, "end": { - "line": 25, - "column": 22 + "line": 39, + "column": 6 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2998,23 +6121,24 @@ "postfix": false, "binop": null }, - "start": 817, - "end": 818, + "value": "child", + "start": 1228, + "end": 1233, "loc": { "start": { - "line": 25, - "column": 22 + "line": 39, + "column": 6 }, "end": { - "line": 25, - "column": 23 + "line": 39, + "column": 11 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3024,101 +6148,69 @@ "binop": null, "updateContext": null }, - "start": 818, - "end": 819, - "loc": { - "start": { - "line": 25, - "column": 23 - }, - "end": { - "line": 25, - "column": 24 - } - } - }, - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 822, - "end": 896, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " through it by 1.", - "start": 898, - "end": 917, + "start": 1233, + "end": 1234, "loc": { "start": { - "line": 28, - "column": 1 + "line": 39, + "column": 11 }, "end": { - "line": 28, - "column": 20 + "line": 39, + "column": 12 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 919, - "end": 921, + "value": "_color", + "start": 1234, + "end": 1240, "loc": { "start": { - "line": 29, - "column": 1 + "line": 39, + "column": 12 }, "end": { - "line": 29, - "column": 3 + "line": 39, + "column": 18 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 922, - "end": 923, + "value": "===", + "start": 1241, + "end": 1244, "loc": { "start": { - "line": 29, - "column": 4 + "line": 39, + "column": 19 }, "end": { - "line": 29, - "column": 5 + "line": 39, + "column": 22 } } }, @@ -3134,23 +6226,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 923, - "end": 924, + "value": "RED", + "start": 1245, + "end": 1248, "loc": { "start": { - "line": 29, - "column": 5 + "line": 39, + "column": 23 }, "end": { - "line": 29, - "column": 6 + "line": 39, + "column": 26 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3158,19 +6250,18 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 924, - "end": 925, + "start": 1248, + "end": 1249, "loc": { "start": { - "line": 29, - "column": 6 + "line": 39, + "column": 26 }, "end": { - "line": 29, - "column": 7 + "line": 39, + "column": 27 } } }, @@ -3186,44 +6277,43 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 925, - "end": 931, + "value": "child", + "start": 1250, + "end": 1255, "loc": { "start": { - "line": 29, - "column": 7 + "line": 39, + "column": 28 }, "end": { - "line": 29, - "column": 13 + "line": 39, + "column": 33 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 932, - "end": 935, + "start": 1255, + "end": 1256, "loc": { "start": { - "line": 29, - "column": 14 + "line": 39, + "column": 33 }, "end": { - "line": 29, - "column": 17 + "line": 39, + "column": 34 } } }, @@ -3239,49 +6329,51 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 936, - "end": 941, + "value": "_color", + "start": 1256, + "end": 1262, "loc": { "start": { - "line": 29, - "column": 18 + "line": 39, + "column": 34 }, "end": { - "line": 29, - "column": 23 + "line": 39, + "column": 40 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 941, - "end": 942, + "value": "=", + "start": 1263, + "end": 1264, "loc": { "start": { - "line": 29, - "column": 23 + "line": 39, + "column": 41 }, "end": { - "line": 29, - "column": 24 + "line": 39, + "column": 42 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3290,72 +6382,67 @@ "postfix": false, "binop": null }, - "start": 943, - "end": 944, - "loc": { - "start": { - "line": 29, - "column": 25 - }, - "end": { - "line": 29, - "column": 26 - } - } - }, - { - "type": "CommentLine", - "value": " We can easily fix this when its left child is an", - "start": 947, - "end": 998, + "value": "BLACK", + "start": 1265, + "end": 1270, "loc": { "start": { - "line": 30, - "column": 2 + "line": 39, + "column": 43 }, "end": { - "line": 30, - "column": 53 + "line": 39, + "column": 48 } } }, { - "type": "CommentLine", - "value": " internal red node: change the color of the left child to black and", - "start": 1001, - "end": 1070, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1270, + "end": 1271, "loc": { "start": { - "line": 31, - "column": 2 + "line": 39, + "column": 48 }, "end": { - "line": 31, - "column": 71 + "line": 39, + "column": 49 } } }, { "type": "CommentLine", - "value": " replace n with it.", - "start": 1073, - "end": 1094, + "value": " Otherwise, there are more things to fix.", + "start": 1274, + "end": 1317, "loc": { "start": { - "line": 32, + "line": 40, "column": 2 }, "end": { - "line": 32, - "column": 23 + "line": 40, + "column": 45 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, + "label": "else", + "keyword": "else", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3365,23 +6452,23 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 1097, - "end": 1099, + "value": "else", + "start": 1320, + "end": 1324, "loc": { "start": { - "line": 33, + "line": 41, "column": 2 }, "end": { - "line": 33, - "column": 4 + "line": 41, + "column": 6 } } }, { "type": { - "label": "(", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -3391,16 +6478,16 @@ "postfix": false, "binop": null }, - "start": 1100, - "end": 1101, + "start": 1325, + "end": 1326, "loc": { "start": { - "line": 33, - "column": 5 + "line": 41, + "column": 7 }, "end": { - "line": 33, - "column": 6 + "line": 41, + "column": 8 } } }, @@ -3416,43 +6503,42 @@ "postfix": false, "binop": null }, - "value": "child", - "start": 1101, - "end": 1106, + "value": "delete_case1", + "start": 1330, + "end": 1342, "loc": { "start": { - "line": 33, - "column": 6 + "line": 42, + "column": 3 }, "end": { - "line": 33, - "column": 11 + "line": 42, + "column": 15 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1106, - "end": 1107, + "start": 1342, + "end": 1343, "loc": { "start": { - "line": 33, - "column": 11 + "line": 42, + "column": 15 }, "end": { - "line": 33, - "column": 12 + "line": 42, + "column": 16 } } }, @@ -3468,76 +6554,74 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1107, - "end": 1113, + "value": "child", + "start": 1343, + "end": 1348, "loc": { "start": { - "line": 33, - "column": 12 + "line": 42, + "column": 16 }, "end": { - "line": 33, - "column": 18 + "line": 42, + "column": 21 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 1114, - "end": 1117, + "start": 1348, + "end": 1349, "loc": { "start": { - "line": 33, - "column": 19 + "line": 42, + "column": 21 }, "end": { - "line": 33, + "line": 42, "column": 22 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 1118, - "end": 1121, + "start": 1349, + "end": 1350, "loc": { "start": { - "line": 33, - "column": 23 + "line": 42, + "column": 22 }, "end": { - "line": 33, - "column": 26 + "line": 42, + "column": 23 } } }, { "type": { - "label": ")", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3547,24 +6631,24 @@ "postfix": false, "binop": null }, - "start": 1121, - "end": 1122, + "start": 1353, + "end": 1354, "loc": { "start": { - "line": 33, - "column": 26 + "line": 43, + "column": 2 }, "end": { - "line": 33, - "column": 27 + "line": 43, + "column": 3 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3572,24 +6656,24 @@ "postfix": false, "binop": null }, - "value": "child", - "start": 1123, - "end": 1128, + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 33, - "column": 28 + "line": 44, + "column": 1 }, "end": { - "line": 33, - "column": 33 + "line": 44, + "column": 2 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "else", + "keyword": "else", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3599,23 +6683,24 @@ "binop": null, "updateContext": null }, - "start": 1128, - "end": 1129, + "value": "else", + "start": 1358, + "end": 1362, "loc": { "start": { - "line": 33, - "column": 33 + "line": 44, + "column": 3 }, "end": { - "line": 33, - "column": 34 + "line": 44, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3624,44 +6709,48 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1129, - "end": 1135, + "start": 1363, + "end": 1364, "loc": { "start": { - "line": 33, - "column": 34 + "line": 44, + "column": 8 }, "end": { - "line": 33, - "column": 40 + "line": 44, + "column": 9 } } }, { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1136, - "end": 1137, + "type": "CommentLine", + "value": " If n is red then its child can only be black. Replacing n with its", + "start": 1367, + "end": 1439, "loc": { "start": { - "line": 33, - "column": 41 + "line": 45, + "column": 2 }, "end": { - "line": 33, - "column": 42 + "line": 45, + "column": 74 + } + } + }, + { + "type": "CommentLine", + "value": " child suffices. This is a NO-OP.", + "start": 1442, + "end": 1480, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 40 } } }, @@ -3677,67 +6766,75 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1138, - "end": 1143, + "value": "assert", + "start": 1483, + "end": 1489, "loc": { "start": { - "line": 33, - "column": 43 + "line": 47, + "column": 2 }, "end": { - "line": 33, - "column": 48 + "line": 47, + "column": 8 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1143, - "end": 1144, + "start": 1489, + "end": 1490, "loc": { "start": { - "line": 33, - "column": 48 + "line": 47, + "column": 8 }, "end": { - "line": 33, - "column": 49 + "line": 47, + "column": 9 } } }, { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1147, - "end": 1190, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "child", + "start": 1490, + "end": 1495, "loc": { "start": { - "line": 34, - "column": 2 + "line": 47, + "column": 9 }, "end": { - "line": 34, - "column": 45 + "line": 47, + "column": 14 } } }, { "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3747,17 +6844,16 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1193, - "end": 1197, + "start": 1495, + "end": 1496, "loc": { "start": { - "line": 35, - "column": 2 + "line": 47, + "column": 14 }, "end": { - "line": 35, - "column": 6 + "line": 47, + "column": 15 } } }, @@ -3773,42 +6869,44 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 1198, - "end": 1210, + "value": "_color", + "start": 1496, + "end": 1502, "loc": { "start": { - "line": 35, - "column": 7 + "line": 47, + "column": 15 }, "end": { - "line": 35, - "column": 19 + "line": 47, + "column": 21 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 1210, - "end": 1211, + "value": "===", + "start": 1503, + "end": 1506, "loc": { "start": { - "line": 35, - "column": 19 + "line": 47, + "column": 22 }, "end": { - "line": 35, - "column": 20 + "line": 47, + "column": 25 } } }, @@ -3824,17 +6922,17 @@ "postfix": false, "binop": null }, - "value": "child", - "start": 1211, - "end": 1216, + "value": "BLACK", + "start": 1507, + "end": 1512, "loc": { "start": { - "line": 35, - "column": 20 + "line": 47, + "column": 26 }, "end": { - "line": 35, - "column": 25 + "line": 47, + "column": 31 } } }, @@ -3850,16 +6948,16 @@ "postfix": false, "binop": null }, - "start": 1216, - "end": 1217, + "start": 1512, + "end": 1513, "loc": { "start": { - "line": 35, - "column": 25 + "line": 47, + "column": 31 }, "end": { - "line": 35, - "column": 26 + "line": 47, + "column": 32 } } }, @@ -3876,16 +6974,16 @@ "binop": null, "updateContext": null }, - "start": 1217, - "end": 1218, + "start": 1513, + "end": 1514, "loc": { "start": { - "line": 35, - "column": 26 + "line": 47, + "column": 32 }, "end": { - "line": 35, - "column": 27 + "line": 47, + "column": 33 } } }, @@ -3901,88 +6999,131 @@ "postfix": false, "binop": null }, - "start": 1220, - "end": 1221, + "start": 1516, + "end": 1517, "loc": { "start": { - "line": 36, + "line": 48, "column": 1 }, "end": { - "line": 36, + "line": 48, "column": 2 } } }, { - "type": "CommentLine", - "value": " Else {", - "start": 1224, - "end": 1233, + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1518, + "end": 1519, "loc": { "start": { - "line": 38, - "column": 1 + "line": 49, + "column": 0 }, "end": { - "line": 38, - "column": 10 + "line": 49, + "column": 1 } } }, { - "type": "CommentLine", - "value": " If n is red then its child can only be black. Replacing n with its", - "start": 1235, - "end": 1307, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1519, + "end": 1520, "loc": { "start": { - "line": 39, + "line": 49, "column": 1 }, "end": { - "line": 39, - "column": 73 + "line": 49, + "column": 2 } } }, { - "type": "CommentLine", - "value": " child suffices.", - "start": 1309, - "end": 1330, + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1522, + "end": 1528, "loc": { "start": { - "line": 40, - "column": 1 + "line": 51, + "column": 0 }, "end": { - "line": 40, - "column": 22 + "line": 51, + "column": 6 } } }, { - "type": "CommentLine", - "value": " }", - "start": 1332, - "end": 1336, + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1529, + "end": 1536, "loc": { "start": { - "line": 41, - "column": 1 + "line": 51, + "column": 7 }, "end": { - "line": 41, - "column": 5 + "line": 51, + "column": 14 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3990,16 +7131,17 @@ "postfix": false, "binop": null }, - "start": 1337, - "end": 1338, + "value": "delete_one_child", + "start": 1537, + "end": 1553, "loc": { "start": { - "line": 42, - "column": 0 + "line": 51, + "column": 15 }, "end": { - "line": 42, - "column": 1 + "line": 51, + "column": 31 } } }, @@ -4016,16 +7158,16 @@ "binop": null, "updateContext": null }, - "start": 1338, - "end": 1339, + "start": 1553, + "end": 1554, "loc": { "start": { - "line": 42, - "column": 1 + "line": 51, + "column": 31 }, "end": { - "line": 42, - "column": 2 + "line": 51, + "column": 32 } } }, @@ -4042,15 +7184,15 @@ "binop": null, "updateContext": null }, - "start": 1340, - "end": 1340, + "start": 1555, + "end": 1555, "loc": { "start": { - "line": 43, + "line": 52, "column": 0 }, "end": { - "line": 43, + "line": 52, "column": 0 } } diff --git a/ast/source/deletion/index.js.json b/ast/source/deletion/index.js.json deleted file mode 100644 index 2082bdd..0000000 --- a/ast/source/deletion/index.js.json +++ /dev/null @@ -1,1415 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 284, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 284, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 9, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "extra": { - "rawValue": "./delete_case1.js", - "raw": "'./delete_case1.js'" - }, - "value": "./delete_case1.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 35, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 49, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "extra": { - "rawValue": "./delete_case2.js", - "raw": "'./delete_case2.js'" - }, - "value": "./delete_case2.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 70, - "end": 104, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 84, - "end": 103, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "extra": { - "rawValue": "./delete_case3.js", - "raw": "'./delete_case3.js'" - }, - "value": "./delete_case3.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 105, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 119, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 33 - } - }, - "extra": { - "rawValue": "./delete_case4.js", - "raw": "'./delete_case4.js'" - }, - "value": "./delete_case4.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 140, - "end": 174, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 154, - "end": 173, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 33 - } - }, - "extra": { - "rawValue": "./delete_case5.js", - "raw": "'./delete_case5.js'" - }, - "value": "./delete_case5.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 175, - "end": 209, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 189, - "end": 208, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 33 - } - }, - "extra": { - "rawValue": "./delete_case6.js", - "raw": "'./delete_case6.js'" - }, - "value": "./delete_case6.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 210, - "end": 248, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 38 - } - }, - "source": { - "type": "StringLiteral", - "start": 224, - "end": 247, - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 37 - } - }, - "extra": { - "rawValue": "./delete_one_child.js", - "raw": "'./delete_one_child.js'" - }, - "value": "./delete_one_child.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 249, - "end": 283, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 263, - "end": 282, - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 33 - } - }, - "extra": { - "rawValue": "./replace_node.js", - "raw": "'./replace_node.js'" - }, - "value": "./replace_node.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_case1.js", - "start": 14, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 33, - "end": 34, - "loc": { - "start": { - "line": 1, - "column": 33 - }, - "end": { - "line": 1, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 35, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 42, - "end": 43, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 44, - "end": 48, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_case2.js", - "start": 49, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 68, - "end": 69, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 70, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 77, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 79, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_case3.js", - "start": 84, - "end": 103, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 103, - "end": 104, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 105, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 112, - "end": 113, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 114, - "end": 118, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_case4.js", - "start": 119, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 138, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 33 - }, - "end": { - "line": 4, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 147, - "end": 148, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 149, - "end": 153, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_case5.js", - "start": 154, - "end": 173, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 173, - "end": 174, - "loc": { - "start": { - "line": 5, - "column": 33 - }, - "end": { - "line": 5, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 175, - "end": 181, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 182, - "end": 183, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 184, - "end": 188, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_case6.js", - "start": 189, - "end": 208, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 208, - "end": 209, - "loc": { - "start": { - "line": 6, - "column": 33 - }, - "end": { - "line": 6, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 210, - "end": 216, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 217, - "end": 218, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 219, - "end": 223, - "loc": { - "start": { - "line": 7, - "column": 9 - }, - "end": { - "line": 7, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_one_child.js", - "start": 224, - "end": 247, - "loc": { - "start": { - "line": 7, - "column": 14 - }, - "end": { - "line": 7, - "column": 37 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 247, - "end": 248, - "loc": { - "start": { - "line": 7, - "column": 37 - }, - "end": { - "line": 7, - "column": 38 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 249, - "end": 255, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 256, - "end": 257, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 258, - "end": 262, - "loc": { - "start": { - "line": 8, - "column": 9 - }, - "end": { - "line": 8, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./replace_node.js", - "start": 263, - "end": 282, - "loc": { - "start": { - "line": 8, - "column": 14 - }, - "end": { - "line": 8, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 282, - "end": 283, - "loc": { - "start": { - "line": 8, - "column": 33 - }, - "end": { - "line": 8, - "column": 34 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 284, - "end": 284, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/deletion/replace_node.js.json b/ast/source/deletion/replace_node.js.json index cd61130..e48a198 100644 --- a/ast/source/deletion/replace_node.js.json +++ b/ast/source/deletion/replace_node.js.json @@ -1,629 +1,793 @@ { "type": "File", "start": 0, - "end": 387, + "end": 575, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 16, + "line": 24, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 387, + "end": 575, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 16, + "line": 24, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 152, - "end": 386, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 7, + "line": 1, "column": 0 }, "end": { - "line": 15, - "column": 2 + "line": 1, + "column": 28 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 159, - "end": 386, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, "loc": { "start": { - "line": 7, - "column": 7 + "line": 1, + "column": 19 }, "end": { - "line": 15, - "column": 2 + "line": 1, + "column": 27 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 165, - "end": 385, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, "loc": { "start": { - "line": 7, - "column": 13 + "line": 2, + "column": 7 }, "end": { - "line": 15, - "column": 1 - } + "line": 2, + "column": 11 + }, + "identifierName": "Node" }, - "id": { - "type": "Identifier", - "start": 165, - "end": 177, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 25 - }, - "identifierName": "replace_node" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 }, - "name": "replace_node", - "leadingComments": null + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "Leaf" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 180, - "end": 385, - "loc": { - "start": { - "line": 7, - "column": 28 - }, - "end": { - "line": 15, - "column": 1 - } + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 83, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n ", + "start": 104, + "end": 260, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 261, + "end": 544, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 21, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 267, + "end": 543, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 267, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 6 }, - "id": { + "end": { + "line": 11, + "column": 18 + }, + "identifierName": "replace_node" + }, + "name": "replace_node", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 282, + "end": 543, + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 165, - "end": 177, + "start": 283, + "end": 284, "loc": { "start": { - "line": 7, - "column": 13 + "line": 11, + "column": 22 }, "end": { - "line": 7, - "column": 25 + "line": 11, + "column": 23 }, - "identifierName": "replace_node" + "identifierName": "A" }, - "name": "replace_node", - "leadingComments": null + "name": "A" }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 181, - "end": 182, - "loc": { - "start": { - "line": 7, - "column": 29 - }, - "end": { - "line": 7, - "column": 30 - }, - "identifierName": "A" + { + "type": "Identifier", + "start": 286, + "end": 287, + "loc": { + "start": { + "line": 11, + "column": 25 }, - "name": "A" + "end": { + "line": 11, + "column": 26 + }, + "identifierName": "B" + }, + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 292, + "end": 543, + "loc": { + "start": { + "line": 11, + "column": 31 }, + "end": { + "line": 21, + "column": 1 + } + }, + "body": [ { - "type": "Identifier", - "start": 184, - "end": 185, + "type": "ExpressionStatement", + "start": 295, + "end": 321, "loc": { "start": { - "line": 7, - "column": 32 + "line": 12, + "column": 1 }, "end": { - "line": 7, - "column": 33 - }, - "identifierName": "B" - }, - "name": "B" - } - ], - "body": { - "type": "BlockStatement", - "start": 190, - "end": 385, - "loc": { - "start": { - "line": 7, - "column": 38 + "line": 12, + "column": 27 + } }, - "end": { - "line": 15, - "column": 1 - } - }, - "body": [ - { - "type": "IfStatement", - "start": 291, - "end": 360, + "expression": { + "type": "CallExpression", + "start": 295, + "end": 320, "loc": { "start": { - "line": 11, + "line": 12, "column": 1 }, "end": { "line": 12, - "column": 25 + "column": 26 } }, - "test": { - "type": "BinaryExpression", + "callee": { + "type": "Identifier", "start": 295, - "end": 314, + "end": 301, "loc": { "start": { - "line": 11, - "column": 5 + "line": 12, + "column": 1 }, "end": { - "line": 11, - "column": 24 - } - }, - "left": { - "type": "Identifier", - "start": 295, - "end": 296, - "loc": { - "start": { - "line": 11, - "column": 5 - }, - "end": { - "line": 11, - "column": 6 - }, - "identifierName": "A" + "line": 12, + "column": 7 }, - "name": "A", - "leadingComments": null + "identifierName": "assert" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 301, - "end": 314, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 302, + "end": 319, "loc": { "start": { - "line": 11, - "column": 11 + "line": 12, + "column": 8 }, "end": { - "line": 11, - "column": 24 + "line": 12, + "column": 25 } }, - "object": { - "type": "MemberExpression", - "start": 301, - "end": 309, + "left": { + "type": "Identifier", + "start": 302, + "end": 303, "loc": { "start": { - "line": 11, - "column": 11 + "line": 12, + "column": 8 }, "end": { - "line": 11, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 301, - "end": 302, - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 12 - }, - "identifierName": "A" + "line": 12, + "column": 9 }, - "name": "A" + "identifierName": "A" }, - "property": { - "type": "Identifier", - "start": 303, - "end": 309, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 19 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false + "name": "A" }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 310, - "end": 314, + "start": 315, + "end": 319, "loc": { "start": { - "line": 11, - "column": 20 + "line": 12, + "column": 21 }, "end": { - "line": 11, - "column": 24 + "line": 12, + "column": 25 }, - "identifierName": "left" + "identifierName": "Node" }, - "name": "left" - }, - "computed": false + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 323, + "end": 370, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 323, + "end": 369, + "loc": { + "start": { + "line": 13, + "column": 1 }, - "leadingComments": null + "end": { + "line": 13, + "column": 47 + } }, - "consequent": { - "type": "ExpressionStatement", - "start": 316, - "end": 334, + "callee": { + "type": "Identifier", + "start": 323, + "end": 329, "loc": { "start": { - "line": 11, - "column": 26 + "line": 13, + "column": 1 }, "end": { - "line": 11, - "column": 44 - } + "line": 13, + "column": 7 + }, + "identifierName": "assert" }, - "expression": { - "type": "AssignmentExpression", - "start": 316, - "end": 333, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 330, + "end": 368, "loc": { "start": { - "line": 11, - "column": 26 + "line": 13, + "column": 8 }, "end": { - "line": 11, - "column": 43 + "line": 13, + "column": 46 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 316, - "end": 329, + "type": "BinaryExpression", + "start": 330, + "end": 347, "loc": { "start": { - "line": 11, - "column": 26 + "line": 13, + "column": 8 }, "end": { - "line": 11, - "column": 39 + "line": 13, + "column": 25 } }, - "object": { - "type": "MemberExpression", - "start": 316, - "end": 324, + "left": { + "type": "Identifier", + "start": 330, + "end": 331, "loc": { "start": { - "line": 11, - "column": 26 + "line": 13, + "column": 8 }, "end": { - "line": 11, - "column": 34 - } - }, - "object": { - "type": "Identifier", - "start": 316, - "end": 317, - "loc": { - "start": { - "line": 11, - "column": 26 - }, - "end": { - "line": 11, - "column": 27 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 318, - "end": 324, - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 34 - }, - "identifierName": "parent" + "line": 13, + "column": 9 }, - "name": "parent" + "identifierName": "B" }, - "computed": false + "name": "B" }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 325, - "end": 329, + "start": 343, + "end": 347, "loc": { "start": { - "line": 11, - "column": 35 + "line": 13, + "column": 21 }, "end": { - "line": 11, - "column": 39 + "line": 13, + "column": 25 }, - "identifierName": "left" + "identifierName": "Node" }, - "name": "left" - }, - "computed": false + "name": "Node" + } }, + "operator": "||", "right": { - "type": "Identifier", - "start": 332, - "end": 333, + "type": "BinaryExpression", + "start": 351, + "end": 368, "loc": { "start": { - "line": 11, - "column": 42 + "line": 13, + "column": 29 }, "end": { - "line": 11, - "column": 43 + "line": 13, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 351, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 13, + "column": 30 + }, + "identifierName": "B" }, - "identifierName": "B" + "name": "B" }, - "name": "B" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 364, + "end": 368, + "loc": { + "start": { + "line": 13, + "column": 42 + }, + "end": { + "line": 13, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } } } - }, - "alternate": { - "type": "ExpressionStatement", - "start": 341, - "end": 360, + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " We never apply delete_one_child on the root", + "start": 372, + "end": 418, "loc": { "start": { - "line": 12, - "column": 6 + "line": 14, + "column": 1 }, "end": { - "line": 12, - "column": 25 + "line": 14, + "column": 47 } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 420, + "end": 446, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 420, + "end": 445, + "loc": { + "start": { + "line": 15, + "column": 1 }, - "expression": { - "type": "AssignmentExpression", - "start": 341, - "end": 359, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 427, + "end": 444, "loc": { "start": { - "line": 12, - "column": 6 + "line": 15, + "column": 8 }, "end": { - "line": 12, - "column": 24 + "line": 15, + "column": 25 } }, - "operator": "=", "left": { "type": "MemberExpression", - "start": 341, - "end": 355, + "start": 427, + "end": 435, "loc": { "start": { - "line": 12, - "column": 6 + "line": 15, + "column": 8 }, "end": { - "line": 12, - "column": 20 + "line": 15, + "column": 16 } }, "object": { - "type": "MemberExpression", - "start": 341, - "end": 349, + "type": "Identifier", + "start": 427, + "end": 428, "loc": { "start": { - "line": 12, - "column": 6 + "line": 15, + "column": 8 }, "end": { - "line": 12, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 341, - "end": 342, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 7 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 343, - "end": 349, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 14 - }, - "identifierName": "parent" + "line": 15, + "column": 9 }, - "name": "parent" + "identifierName": "A" }, - "computed": false + "name": "A" }, "property": { "type": "Identifier", - "start": 350, - "end": 355, + "start": 429, + "end": 435, "loc": { "start": { - "line": 12, - "column": 15 + "line": 15, + "column": 10 }, "end": { - "line": 12, - "column": 20 + "line": 15, + "column": 16 }, - "identifierName": "right" + "identifierName": "parent" }, - "name": "right" + "name": "parent" }, "computed": false }, + "operator": "!==", "right": { - "type": "Identifier", - "start": 358, - "end": 359, + "type": "NullLiteral", + "start": 440, + "end": 444, "loc": { "start": { - "line": 12, - "column": 23 + "line": 15, + "column": 21 }, "end": { - "line": 12, - "column": 24 - }, - "identifierName": "B" - }, - "name": "B" - } - } - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Assert( A.parent !== null ) ;", - "start": 193, - "end": 225, - "loc": { - "start": { - "line": 8, - "column": 1 - }, - "end": { - "line": 8, - "column": 33 - } - } - }, - { - "type": "CommentLine", - "value": " we never apply delete_one_child on the root so we are safe", - "start": 227, - "end": 288, - "loc": { - "start": { - "line": 9, - "column": 1 - }, - "end": { - "line": 9, - "column": 62 + "line": 15, + "column": 25 + } } } } - ] + ], + "leadingComments": null }, - { - "type": "ExpressionStatement", - "start": 363, - "end": 383, - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 21 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 363, - "end": 382, + "leadingComments": [ + { + "type": "CommentLine", + "value": " We never apply delete_one_child on the root", + "start": 372, + "end": 418, "loc": { "start": { "line": 14, @@ -631,53 +795,115 @@ }, "end": { "line": 14, - "column": 20 + "column": 47 } + } + } + ] + }, + { + "type": "IfStatement", + "start": 449, + "end": 518, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 18, + "column": 25 + } + }, + "test": { + "type": "BinaryExpression", + "start": 453, + "end": 472, + "loc": { + "start": { + "line": 17, + "column": 5 }, - "operator": "=", - "left": { + "end": { + "line": 17, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 453, + "end": 454, + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 459, + "end": 472, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "object": { "type": "MemberExpression", - "start": 363, - "end": 371, + "start": 459, + "end": 467, "loc": { "start": { - "line": 14, - "column": 1 + "line": 17, + "column": 11 }, "end": { - "line": 14, - "column": 9 + "line": 17, + "column": 19 } }, "object": { "type": "Identifier", - "start": 363, - "end": 364, + "start": 459, + "end": 460, "loc": { "start": { - "line": 14, - "column": 1 + "line": 17, + "column": 11 }, "end": { - "line": 14, - "column": 2 + "line": 17, + "column": 12 }, - "identifierName": "B" + "identifierName": "A" }, - "name": "B" + "name": "A" }, "property": { "type": "Identifier", - "start": 365, - "end": 371, + "start": 461, + "end": 467, "loc": { "start": { - "line": 14, - "column": 3 + "line": 17, + "column": 13 }, "end": { - "line": 14, - "column": 9 + "line": 17, + "column": 19 }, "identifierName": "parent" }, @@ -685,228 +911,2703 @@ }, "computed": false }, + "property": { + "type": "Identifier", + "start": 468, + "end": 472, + "loc": { + "start": { + "line": 17, + "column": 20 + }, + "end": { + "line": 17, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 474, + "end": 492, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 44 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 474, + "end": 491, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 43 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 474, + "end": 487, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 39 + } + }, + "object": { + "type": "MemberExpression", + "start": 474, + "end": 482, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 34 + } + }, + "object": { + "type": "Identifier", + "start": 474, + "end": 475, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 27 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 476, + "end": 482, + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 34 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 483, + "end": 487, + "loc": { + "start": { + "line": 17, + "column": 35 + }, + "end": { + "line": 17, + "column": 39 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, "right": { + "type": "Identifier", + "start": 490, + "end": 491, + "loc": { + "start": { + "line": 17, + "column": 42 + }, + "end": { + "line": 17, + "column": 43 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 499, + "end": 518, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 499, + "end": 517, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 24 + } + }, + "operator": "=", + "left": { "type": "MemberExpression", - "start": 374, - "end": 382, + "start": 499, + "end": 513, "loc": { "start": { - "line": 14, - "column": 12 + "line": 18, + "column": 6 }, "end": { - "line": 14, + "line": 18, "column": 20 } }, "object": { - "type": "Identifier", - "start": 374, - "end": 375, + "type": "MemberExpression", + "start": 499, + "end": 507, "loc": { "start": { - "line": 14, - "column": 12 + "line": 18, + "column": 6 }, "end": { - "line": 14, - "column": 13 + "line": 18, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 499, + "end": 500, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "A" }, - "identifierName": "A" + "name": "A" }, - "name": "A" + "property": { + "type": "Identifier", + "start": 501, + "end": 507, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 14 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 376, - "end": 382, + "start": 508, + "end": 513, "loc": { "start": { - "line": 14, - "column": 14 + "line": 18, + "column": 15 }, "end": { - "line": 14, + "line": 18, "column": 20 }, - "identifierName": "parent" + "identifierName": "right" }, - "name": "parent" + "name": "right" }, "computed": false + }, + "right": { + "type": "Identifier", + "start": 516, + "end": 517, + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + }, + "identifierName": "B" + }, + "name": "B" } } } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", - "start": 0, - "end": 151, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", - "start": 0, - "end": 151, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } + }, + { + "type": "ExpressionStatement", + "start": 521, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 521, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 20 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 521, + "end": 529, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 521, + "end": 522, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 523, + "end": 529, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "MemberExpression", + "start": 532, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 532, + "end": 533, + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 534, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 20, + "column": 20 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null } - ] + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 546, + "end": 574, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 561, + "end": 573, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 27 + }, + "identifierName": "replace_node" + }, + "name": "replace_node" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 546, + "end": 574, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 261, + "end": 544, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 21, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 267, + "end": 543, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 267, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 18 + }, + "identifierName": "replace_node" + }, + "name": "replace_node", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 282, + "end": 543, + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 267, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 18 + }, + "identifierName": "replace_node" + }, + "name": "replace_node", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 283, + "end": 284, + "loc": { + "start": { + "line": 11, + "column": 22 + }, + "end": { + "line": 11, + "column": 23 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 286, + "end": 287, + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 26 + }, + "identifierName": "B" + }, + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 292, + "end": 543, + "loc": { + "start": { + "line": 11, + "column": 31 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 295, + "end": 321, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 295, + "end": 320, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 295, + "end": 301, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 302, + "end": 319, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 302, + "end": 303, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 315, + "end": 319, + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 323, + "end": 370, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 323, + "end": 369, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 323, + "end": 329, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 330, + "end": 368, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 330, + "end": 347, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 330, + "end": 331, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 343, + "end": 347, + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 351, + "end": 368, + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 13, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 351, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 13, + "column": 30 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 364, + "end": 368, + "loc": { + "start": { + "line": 13, + "column": 42 + }, + "end": { + "line": 13, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " We never apply delete_one_child on the root", + "start": 372, + "end": 418, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 47 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 420, + "end": 446, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 420, + "end": 445, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 427, + "end": 444, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 427, + "end": 435, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 429, + "end": 435, + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 440, + "end": 444, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + } + } + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " We never apply delete_one_child on the root", + "start": 372, + "end": 418, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 47 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 449, + "end": 518, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 18, + "column": 25 + } + }, + "test": { + "type": "BinaryExpression", + "start": 453, + "end": 472, + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 453, + "end": 454, + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 459, + "end": 472, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "object": { + "type": "MemberExpression", + "start": 459, + "end": 467, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 459, + "end": 460, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 461, + "end": 467, + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 468, + "end": 472, + "loc": { + "start": { + "line": 17, + "column": 20 + }, + "end": { + "line": 17, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 474, + "end": 492, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 44 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 474, + "end": 491, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 43 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 474, + "end": 487, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 39 + } + }, + "object": { + "type": "MemberExpression", + "start": 474, + "end": 482, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 34 + } + }, + "object": { + "type": "Identifier", + "start": 474, + "end": 475, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 27 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 476, + "end": 482, + "loc": { + "start": { + "line": 17, + "column": 28 + }, + "end": { + "line": 17, + "column": 34 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 483, + "end": 487, + "loc": { + "start": { + "line": 17, + "column": 35 + }, + "end": { + "line": 17, + "column": 39 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 490, + "end": 491, + "loc": { + "start": { + "line": 17, + "column": 42 + }, + "end": { + "line": 17, + "column": 43 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 499, + "end": 518, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 499, + "end": 517, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 499, + "end": 513, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 20 + } + }, + "object": { + "type": "MemberExpression", + "start": 499, + "end": 507, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 499, + "end": 500, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 501, + "end": 507, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 14 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 508, + "end": 513, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 516, + "end": 517, + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 24 + }, + "identifierName": "B" + }, + "name": "B" + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 521, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 521, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 20 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 521, + "end": 529, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 521, + "end": 522, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 523, + "end": 529, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "MemberExpression", + "start": 532, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 532, + "end": 533, + "loc": { + "start": { + "line": 20, + "column": 12 + }, + "end": { + "line": 20, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 534, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 20, + "column": 20 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n ", + "start": 104, + "end": 260, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n ", + "start": 104, + "end": 260, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " We never apply delete_one_child on the root", + "start": 372, + "end": 418, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 47 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 78, + "end": 82, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 83, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n ", + "start": 104, + "end": 260, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 261, + "end": 266, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "replace_node", + "start": 267, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 280, + "end": 281, + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 11, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 282, + "end": 283, + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 283, + "end": 284, + "loc": { + "start": { + "line": 11, + "column": 22 + }, + "end": { + "line": 11, + "column": 23 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 284, + "end": 285, + "loc": { + "start": { + "line": 11, + "column": 23 + }, + "end": { + "line": 11, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 286, + "end": 287, + "loc": { + "start": { + "line": 11, + "column": 25 + }, + "end": { + "line": 11, + "column": 26 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 287, + "end": 288, + "loc": { + "start": { + "line": 11, + "column": 26 + }, + "end": { + "line": 11, + "column": 27 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 289, + "end": 291, + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 30 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 292, + "end": 293, + "loc": { + "start": { + "line": 11, + "column": 31 + }, + "end": { + "line": 11, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 295, + "end": 301, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 301, + "end": 302, + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 302, + "end": 303, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 304, + "end": 314, + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 315, + "end": 319, + "loc": { + "start": { + "line": 12, + "column": 21 + }, + "end": { + "line": 12, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 319, + "end": 320, + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 26 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", - "start": 0, - "end": 151, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 320, + "end": 321, "loc": { "start": { - "line": 1, - "column": 0 + "line": 12, + "column": 26 }, "end": { - "line": 6, - "column": 3 + "line": 12, + "column": 27 } } }, { - "type": "CommentLine", - "value": " Assert( A.parent !== null ) ;", - "start": 193, - "end": 225, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 323, + "end": 329, "loc": { "start": { - "line": 8, + "line": 13, "column": 1 }, "end": { - "line": 8, - "column": 33 + "line": 13, + "column": 7 } } }, { - "type": "CommentLine", - "value": " we never apply delete_one_child on the root so we are safe", - "start": 227, - "end": 288, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 329, + "end": 330, "loc": { "start": { - "line": 9, - "column": 1 + "line": 13, + "column": 7 }, "end": { - "line": 9, - "column": 62 + "line": 13, + "column": 8 } } - } - ], - "tokens": [ + }, { - "type": "CommentBlock", - "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", - "start": 0, - "end": 151, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 330, + "end": 331, "loc": { "start": { - "line": 1, - "column": 0 + "line": 13, + "column": 8 }, "end": { - "line": 6, - "column": 3 + "line": 13, + "column": 9 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 332, + "end": 342, + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 343, + "end": 347, + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "value": "export", - "start": 152, - "end": 158, + "value": "||", + "start": 348, + "end": 350, "loc": { "start": { - "line": 7, - "column": 0 + "line": 13, + "column": 26 }, "end": { - "line": 7, - "column": 6 + "line": 13, + "column": 28 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 351, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 13, + "column": 30 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "const", - "start": 159, - "end": 164, + "value": "instanceof", + "start": 353, + "end": 363, "loc": { "start": { - "line": 7, - "column": 7 + "line": 13, + "column": 31 }, "end": { - "line": 7, - "column": 12 + "line": 13, + "column": 41 } } }, @@ -922,44 +3623,110 @@ "postfix": false, "binop": null }, - "value": "replace_node", - "start": 165, - "end": 177, + "value": "Leaf", + "start": 364, + "end": 368, "loc": { "start": { - "line": 7, - "column": 13 + "line": 13, + "column": 42 }, "end": { - "line": 7, - "column": 25 + "line": 13, + "column": 46 } } }, { "type": { - "label": "=", + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 368, + "end": 369, + "loc": { + "start": { + "line": 13, + "column": 46 + }, + "end": { + "line": 13, + "column": 47 + } + } + }, + { + "type": { + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 178, - "end": 179, + "start": 369, + "end": 370, "loc": { "start": { - "line": 7, - "column": 26 + "line": 13, + "column": 47 }, "end": { - "line": 7, - "column": 27 + "line": 13, + "column": 48 + } + } + }, + { + "type": "CommentLine", + "value": " We never apply delete_one_child on the root", + "start": 372, + "end": 418, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 47 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 } } }, @@ -975,16 +3742,16 @@ "postfix": false, "binop": null }, - "start": 180, - "end": 181, + "start": 426, + "end": 427, "loc": { "start": { - "line": 7, - "column": 28 + "line": 15, + "column": 7 }, "end": { - "line": 7, - "column": 29 + "line": 15, + "column": 8 } } }, @@ -1001,23 +3768,23 @@ "binop": null }, "value": "A", - "start": 181, - "end": 182, + "start": 427, + "end": 428, "loc": { "start": { - "line": 7, - "column": 29 + "line": 15, + "column": 8 }, "end": { - "line": 7, - "column": 30 + "line": 15, + "column": 9 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1027,16 +3794,16 @@ "binop": null, "updateContext": null }, - "start": 182, - "end": 183, + "start": 428, + "end": 429, "loc": { "start": { - "line": 7, - "column": 30 + "line": 15, + "column": 9 }, "end": { - "line": 7, - "column": 31 + "line": 15, + "column": 10 } } }, @@ -1052,50 +3819,53 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 184, - "end": 185, + "value": "parent", + "start": 429, + "end": 435, "loc": { "start": { - "line": 7, - "column": 32 + "line": 15, + "column": 10 }, "end": { - "line": 7, - "column": 33 + "line": 15, + "column": 16 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 185, - "end": 186, + "value": "!==", + "start": 436, + "end": 439, "loc": { "start": { - "line": 7, - "column": 33 + "line": 15, + "column": 17 }, "end": { - "line": 7, - "column": 34 + "line": 15, + "column": 20 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1104,24 +3874,25 @@ "binop": null, "updateContext": null }, - "start": 187, - "end": 189, + "value": "null", + "start": 440, + "end": 444, "loc": { "start": { - "line": 7, - "column": 35 + "line": 15, + "column": 21 }, "end": { - "line": 7, - "column": 37 + "line": 15, + "column": 25 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1129,48 +3900,42 @@ "postfix": false, "binop": null }, - "start": 190, - "end": 191, - "loc": { - "start": { - "line": 7, - "column": 38 - }, - "end": { - "line": 7, - "column": 39 - } - } - }, - { - "type": "CommentLine", - "value": " Assert( A.parent !== null ) ;", - "start": 193, - "end": 225, + "start": 444, + "end": 445, "loc": { "start": { - "line": 8, - "column": 1 + "line": 15, + "column": 25 }, "end": { - "line": 8, - "column": 33 + "line": 15, + "column": 26 } } }, { - "type": "CommentLine", - "value": " we never apply delete_one_child on the root so we are safe", - "start": 227, - "end": 288, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 445, + "end": 446, "loc": { "start": { - "line": 9, - "column": 1 + "line": 15, + "column": 26 }, "end": { - "line": 9, - "column": 62 + "line": 15, + "column": 27 } } }, @@ -1189,15 +3954,15 @@ "updateContext": null }, "value": "if", - "start": 291, - "end": 293, + "start": 449, + "end": 451, "loc": { "start": { - "line": 11, + "line": 17, "column": 1 }, "end": { - "line": 11, + "line": 17, "column": 3 } } @@ -1214,15 +3979,15 @@ "postfix": false, "binop": null }, - "start": 294, - "end": 295, + "start": 452, + "end": 453, "loc": { "start": { - "line": 11, + "line": 17, "column": 4 }, "end": { - "line": 11, + "line": 17, "column": 5 } } @@ -1240,15 +4005,15 @@ "binop": null }, "value": "A", - "start": 295, - "end": 296, + "start": 453, + "end": 454, "loc": { "start": { - "line": 11, + "line": 17, "column": 5 }, "end": { - "line": 11, + "line": 17, "column": 6 } } @@ -1267,15 +4032,15 @@ "updateContext": null }, "value": "===", - "start": 297, - "end": 300, + "start": 455, + "end": 458, "loc": { "start": { - "line": 11, + "line": 17, "column": 7 }, "end": { - "line": 11, + "line": 17, "column": 10 } } @@ -1293,15 +4058,15 @@ "binop": null }, "value": "A", - "start": 301, - "end": 302, + "start": 459, + "end": 460, "loc": { "start": { - "line": 11, + "line": 17, "column": 11 }, "end": { - "line": 11, + "line": 17, "column": 12 } } @@ -1319,15 +4084,15 @@ "binop": null, "updateContext": null }, - "start": 302, - "end": 303, + "start": 460, + "end": 461, "loc": { "start": { - "line": 11, + "line": 17, "column": 12 }, "end": { - "line": 11, + "line": 17, "column": 13 } } @@ -1345,15 +4110,15 @@ "binop": null }, "value": "parent", - "start": 303, - "end": 309, + "start": 461, + "end": 467, "loc": { "start": { - "line": 11, + "line": 17, "column": 13 }, "end": { - "line": 11, + "line": 17, "column": 19 } } @@ -1371,15 +4136,15 @@ "binop": null, "updateContext": null }, - "start": 309, - "end": 310, + "start": 467, + "end": 468, "loc": { "start": { - "line": 11, + "line": 17, "column": 19 }, "end": { - "line": 11, + "line": 17, "column": 20 } } @@ -1397,15 +4162,15 @@ "binop": null }, "value": "left", - "start": 310, - "end": 314, + "start": 468, + "end": 472, "loc": { "start": { - "line": 11, + "line": 17, "column": 20 }, "end": { - "line": 11, + "line": 17, "column": 24 } } @@ -1422,15 +4187,15 @@ "postfix": false, "binop": null }, - "start": 314, - "end": 315, + "start": 472, + "end": 473, "loc": { "start": { - "line": 11, + "line": 17, "column": 24 }, "end": { - "line": 11, + "line": 17, "column": 25 } } @@ -1448,15 +4213,15 @@ "binop": null }, "value": "A", - "start": 316, - "end": 317, + "start": 474, + "end": 475, "loc": { "start": { - "line": 11, + "line": 17, "column": 26 }, "end": { - "line": 11, + "line": 17, "column": 27 } } @@ -1474,15 +4239,15 @@ "binop": null, "updateContext": null }, - "start": 317, - "end": 318, + "start": 475, + "end": 476, "loc": { "start": { - "line": 11, + "line": 17, "column": 27 }, "end": { - "line": 11, + "line": 17, "column": 28 } } @@ -1500,15 +4265,15 @@ "binop": null }, "value": "parent", - "start": 318, - "end": 324, + "start": 476, + "end": 482, "loc": { "start": { - "line": 11, + "line": 17, "column": 28 }, "end": { - "line": 11, + "line": 17, "column": 34 } } @@ -1526,15 +4291,15 @@ "binop": null, "updateContext": null }, - "start": 324, - "end": 325, + "start": 482, + "end": 483, "loc": { "start": { - "line": 11, + "line": 17, "column": 34 }, "end": { - "line": 11, + "line": 17, "column": 35 } } @@ -1552,15 +4317,15 @@ "binop": null }, "value": "left", - "start": 325, - "end": 329, + "start": 483, + "end": 487, "loc": { "start": { - "line": 11, + "line": 17, "column": 35 }, "end": { - "line": 11, + "line": 17, "column": 39 } } @@ -1579,15 +4344,15 @@ "updateContext": null }, "value": "=", - "start": 330, - "end": 331, + "start": 488, + "end": 489, "loc": { "start": { - "line": 11, + "line": 17, "column": 40 }, "end": { - "line": 11, + "line": 17, "column": 41 } } @@ -1605,15 +4370,15 @@ "binop": null }, "value": "B", - "start": 332, - "end": 333, + "start": 490, + "end": 491, "loc": { "start": { - "line": 11, + "line": 17, "column": 42 }, "end": { - "line": 11, + "line": 17, "column": 43 } } @@ -1631,15 +4396,15 @@ "binop": null, "updateContext": null }, - "start": 333, - "end": 334, + "start": 491, + "end": 492, "loc": { "start": { - "line": 11, + "line": 17, "column": 43 }, "end": { - "line": 11, + "line": 17, "column": 44 } } @@ -1659,15 +4424,15 @@ "updateContext": null }, "value": "else", - "start": 336, - "end": 340, + "start": 494, + "end": 498, "loc": { "start": { - "line": 12, + "line": 18, "column": 1 }, "end": { - "line": 12, + "line": 18, "column": 5 } } @@ -1685,15 +4450,15 @@ "binop": null }, "value": "A", - "start": 341, - "end": 342, + "start": 499, + "end": 500, "loc": { "start": { - "line": 12, + "line": 18, "column": 6 }, "end": { - "line": 12, + "line": 18, "column": 7 } } @@ -1711,15 +4476,15 @@ "binop": null, "updateContext": null }, - "start": 342, - "end": 343, + "start": 500, + "end": 501, "loc": { "start": { - "line": 12, + "line": 18, "column": 7 }, "end": { - "line": 12, + "line": 18, "column": 8 } } @@ -1737,15 +4502,15 @@ "binop": null }, "value": "parent", - "start": 343, - "end": 349, + "start": 501, + "end": 507, "loc": { "start": { - "line": 12, + "line": 18, "column": 8 }, "end": { - "line": 12, + "line": 18, "column": 14 } } @@ -1763,15 +4528,15 @@ "binop": null, "updateContext": null }, - "start": 349, - "end": 350, + "start": 507, + "end": 508, "loc": { "start": { - "line": 12, + "line": 18, "column": 14 }, "end": { - "line": 12, + "line": 18, "column": 15 } } @@ -1789,15 +4554,15 @@ "binop": null }, "value": "right", - "start": 350, - "end": 355, + "start": 508, + "end": 513, "loc": { "start": { - "line": 12, + "line": 18, "column": 15 }, "end": { - "line": 12, + "line": 18, "column": 20 } } @@ -1816,15 +4581,15 @@ "updateContext": null }, "value": "=", - "start": 356, - "end": 357, + "start": 514, + "end": 515, "loc": { "start": { - "line": 12, + "line": 18, "column": 21 }, "end": { - "line": 12, + "line": 18, "column": 22 } } @@ -1842,15 +4607,15 @@ "binop": null }, "value": "B", - "start": 358, - "end": 359, + "start": 516, + "end": 517, "loc": { "start": { - "line": 12, + "line": 18, "column": 23 }, "end": { - "line": 12, + "line": 18, "column": 24 } } @@ -1868,15 +4633,15 @@ "binop": null, "updateContext": null }, - "start": 359, - "end": 360, + "start": 517, + "end": 518, "loc": { "start": { - "line": 12, + "line": 18, "column": 24 }, "end": { - "line": 12, + "line": 18, "column": 25 } } @@ -1894,15 +4659,15 @@ "binop": null }, "value": "B", - "start": 363, - "end": 364, + "start": 521, + "end": 522, "loc": { "start": { - "line": 14, + "line": 20, "column": 1 }, "end": { - "line": 14, + "line": 20, "column": 2 } } @@ -1920,15 +4685,15 @@ "binop": null, "updateContext": null }, - "start": 364, - "end": 365, + "start": 522, + "end": 523, "loc": { "start": { - "line": 14, + "line": 20, "column": 2 }, "end": { - "line": 14, + "line": 20, "column": 3 } } @@ -1946,15 +4711,15 @@ "binop": null }, "value": "parent", - "start": 365, - "end": 371, + "start": 523, + "end": 529, "loc": { "start": { - "line": 14, + "line": 20, "column": 3 }, "end": { - "line": 14, + "line": 20, "column": 9 } } @@ -1973,15 +4738,15 @@ "updateContext": null }, "value": "=", - "start": 372, - "end": 373, + "start": 530, + "end": 531, "loc": { "start": { - "line": 14, + "line": 20, "column": 10 }, "end": { - "line": 14, + "line": 20, "column": 11 } } @@ -1999,15 +4764,15 @@ "binop": null }, "value": "A", - "start": 374, - "end": 375, + "start": 532, + "end": 533, "loc": { "start": { - "line": 14, + "line": 20, "column": 12 }, "end": { - "line": 14, + "line": 20, "column": 13 } } @@ -2025,15 +4790,15 @@ "binop": null, "updateContext": null }, - "start": 375, - "end": 376, + "start": 533, + "end": 534, "loc": { "start": { - "line": 14, + "line": 20, "column": 13 }, "end": { - "line": 14, + "line": 20, "column": 14 } } @@ -2051,15 +4816,15 @@ "binop": null }, "value": "parent", - "start": 376, - "end": 382, + "start": 534, + "end": 540, "loc": { "start": { - "line": 14, + "line": 20, "column": 14 }, "end": { - "line": 14, + "line": 20, "column": 20 } } @@ -2077,15 +4842,15 @@ "binop": null, "updateContext": null }, - "start": 382, - "end": 383, + "start": 540, + "end": 541, "loc": { "start": { - "line": 14, + "line": 20, "column": 20 }, "end": { - "line": 14, + "line": 20, "column": 21 } } @@ -2102,15 +4867,15 @@ "postfix": false, "binop": null }, - "start": 384, - "end": 385, + "start": 542, + "end": 543, "loc": { "start": { - "line": 15, + "line": 21, "column": 0 }, "end": { - "line": 15, + "line": 21, "column": 1 } } @@ -2128,19 +4893,127 @@ "binop": null, "updateContext": null }, - "start": 385, - "end": 386, + "start": 543, + "end": 544, "loc": { "start": { - "line": 15, + "line": 21, "column": 1 }, "end": { - "line": 15, + "line": 21, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 546, + "end": 552, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 553, + "end": 560, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "replace_node", + "start": 561, + "end": 573, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 573, + "end": 574, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -2154,15 +5027,15 @@ "binop": null, "updateContext": null }, - "start": 387, - "end": 387, + "start": 575, + "end": 575, "loc": { "start": { - "line": 16, + "line": 24, "column": 0 }, "end": { - "line": 16, + "line": 24, "column": 0 } } diff --git a/ast/source/family/grandparent.js.json b/ast/source/family/grandparent.js.json index bc64728..7a9cc30 100644 --- a/ast/source/family/grandparent.js.json +++ b/ast/source/family/grandparent.js.json @@ -1,470 +1,2559 @@ { "type": "File", "start": 0, - "end": 320, + "end": 454, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 12, + "line": 19, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 320, + "end": 454, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 12, + "line": 19, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 136, - "end": 319, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 7, + "line": 1, "column": 0 }, "end": { - "line": 11, - "column": 2 + "line": 1, + "column": 28 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 143, - "end": 319, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, "loc": { "start": { - "line": 7, - "column": 7 + "line": 1, + "column": 19 }, "end": { - "line": 11, - "column": 2 + "line": 1, + "column": 27 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 149, - "end": 318, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, "loc": { "start": { - "line": 7, - "column": 13 + "line": 2, + "column": 7 }, "end": { - "line": 11, - "column": 1 - } + "line": 2, + "column": 11 + }, + "identifierName": "Node" }, - "id": { - "type": "Identifier", - "start": 149, - "end": 160, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 24 - }, - "identifierName": "grandparent" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 202, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 203, + "end": 424, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 16, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 209, + "end": 423, + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 16, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 209, + "end": 220, + "loc": { + "start": { + "line": 10, + "column": 6 }, - "name": "grandparent", - "leadingComments": null + "end": { + "line": 10, + "column": 17 + }, + "identifierName": "grandparent" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 163, - "end": 318, - "loc": { - "start": { - "line": 7, - "column": 27 - }, - "end": { - "line": 11, - "column": 1 - } + "name": "grandparent", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 223, + "end": 423, + "loc": { + "start": { + "line": 10, + "column": 20 }, - "id": { + "end": { + "line": 16, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 149, - "end": 160, + "start": 224, + "end": 228, "loc": { "start": { - "line": 7, - "column": 13 + "line": 10, + "column": 21 }, "end": { - "line": 7, - "column": 24 + "line": 10, + "column": 25 }, - "identifierName": "grandparent" + "identifierName": "node" }, - "name": "grandparent", - "leadingComments": null + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 233, + "end": 423, + "loc": { + "start": { + "line": 10, + "column": 30 + }, + "end": { + "line": 16, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 164, - "end": 168, + "type": "ExpressionStatement", + "start": 236, + "end": 265, "loc": { "start": { - "line": 7, - "column": 28 + "line": 11, + "column": 1 }, "end": { - "line": 7, - "column": 32 - }, - "identifierName": "node" - }, - "name": "node" - } - ], - "body": { - "type": "BlockStatement", - "start": 173, - "end": 318, - "loc": { - "start": { - "line": 7, - "column": 37 + "line": 11, + "column": 30 + } }, - "end": { - "line": 11, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 290, - "end": 316, + "expression": { + "type": "CallExpression", + "start": 236, + "end": 264, "loc": { "start": { - "line": 10, + "line": 11, "column": 1 }, "end": { - "line": 10, - "column": 27 + "line": 11, + "column": 29 } }, - "argument": { - "type": "MemberExpression", - "start": 297, - "end": 315, + "callee": { + "type": "Identifier", + "start": 236, + "end": 242, "loc": { "start": { - "line": 10, - "column": 8 + "line": 11, + "column": 1 }, "end": { - "line": 10, - "column": 26 - } + "line": 11, + "column": 7 + }, + "identifierName": "assert" }, - "object": { - "type": "MemberExpression", - "start": 297, - "end": 308, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 243, + "end": 263, "loc": { "start": { - "line": 10, + "line": 11, "column": 8 }, "end": { - "line": 10, - "column": 19 + "line": 11, + "column": 28 } }, - "object": { + "left": { "type": "Identifier", - "start": 297, - "end": 301, + "start": 243, + "end": 247, "loc": { "start": { - "line": 10, + "line": 11, "column": 8 }, "end": { - "line": 10, + "line": 11, "column": 12 }, "identifierName": "node" }, - "name": "node", - "leadingComments": null + "name": "node" }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 302, - "end": 308, + "start": 259, + "end": 263, "loc": { "start": { - "line": 10, - "column": 13 + "line": 11, + "column": 24 }, "end": { - "line": 10, - "column": 19 + "line": 11, + "column": 28 }, - "identifierName": "parent" + "identifierName": "Node" }, - "name": "parent" + "name": "Node" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " We only call this function when node HAS a grandparent", + "start": 267, + "end": 324, + "loc": { + "start": { + "line": 12, + "column": 1 }, - "computed": false, - "leadingComments": null + "end": { + "line": 12, + "column": 58 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 326, + "end": 355, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 326, + "end": 354, + "loc": { + "start": { + "line": 13, + "column": 1 }, - "property": { - "type": "Identifier", - "start": 309, - "end": 315, - "loc": { - "start": { - "line": 10, - "column": 20 - }, - "end": { - "line": 10, - "column": 26 - }, - "identifierName": "parent" + "end": { + "line": 13, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 326, + "end": 332, + "loc": { + "start": { + "line": 13, + "column": 1 }, - "name": "parent" + "end": { + "line": 13, + "column": 7 + }, + "identifierName": "assert" }, - "computed": false, + "name": "assert", "leadingComments": null }, - "leadingComments": [ + "arguments": [ { - "type": "CommentLine", - "value": " Assert((node !== null) && (node.parent !== null));", - "start": 176, - "end": 229, + "type": "BinaryExpression", + "start": 333, + "end": 353, "loc": { "start": { - "line": 8, - "column": 1 + "line": 13, + "column": 8 }, "end": { - "line": 8, - "column": 54 + "line": 13, + "column": 28 } - } - }, - { - "type": "CommentLine", - "value": " We only call this function when node HAS a grandparent", - "start": 231, - "end": 288, - "loc": { - "start": { - "line": 9, - "column": 1 + }, + "left": { + "type": "MemberExpression", + "start": 333, + "end": 344, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 19 + } }, - "end": { - "line": 9, - "column": 58 + "object": { + "type": "Identifier", + "start": 333, + "end": 337, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 338, + "end": 344, + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 349, + "end": 353, + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 28 + } } } } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 135, - "loc": { - "start": { - "line": 1, - "column": 0 + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " We only call this function when node HAS a grandparent", + "start": 267, + "end": 324, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 58 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 357, + "end": 393, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 37 + } + }, + "expression": { + "type": "CallExpression", + "start": 357, + "end": 392, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 357, + "end": 363, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 364, + "end": 391, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 35 + } + }, + "left": { + "type": "MemberExpression", + "start": 364, + "end": 382, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 26 + } + }, + "object": { + "type": "MemberExpression", + "start": 364, + "end": 375, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 364, + "end": 368, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 369, + "end": 375, + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 376, + "end": 382, + "loc": { + "start": { + "line": 14, + "column": 20 + }, + "end": { + "line": 14, + "column": 26 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 387, + "end": 391, + "loc": { + "start": { + "line": 14, + "column": 31 + }, + "end": { + "line": 14, + "column": 35 + } + } + } + } + ] + } + }, + { + "type": "ReturnStatement", + "start": 395, + "end": 421, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "argument": { + "type": "MemberExpression", + "start": 402, + "end": 420, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "object": { + "type": "MemberExpression", + "start": 402, + "end": 413, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 402, + "end": 406, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 407, + "end": 413, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 414, + "end": 420, + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 26 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 426, + "end": 453, + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 27 + } + }, + "declaration": { + "type": "Identifier", + "start": 441, + "end": 452, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 426, + "end": 453, + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 27 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 203, + "end": 424, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 16, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 209, + "end": 423, + "loc": { + "start": { + "line": 10, + "column": 6 }, "end": { - "line": 6, - "column": 3 + "line": 16, + "column": 1 } - } - } - ], - "trailingComments": [] + }, + "id": { + "type": "Identifier", + "start": 209, + "end": 220, + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 17 + }, + "identifierName": "grandparent" + }, + "name": "grandparent", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 223, + "end": 423, + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 16, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 209, + "end": 220, + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 17 + }, + "identifierName": "grandparent" + }, + "name": "grandparent", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 224, + "end": 228, + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 25 + }, + "identifierName": "node" + }, + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 233, + "end": 423, + "loc": { + "start": { + "line": 10, + "column": 30 + }, + "end": { + "line": 16, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 236, + "end": 265, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 236, + "end": 264, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 236, + "end": 242, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 243, + "end": 263, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 243, + "end": 247, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 259, + "end": 263, + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 28 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " We only call this function when node HAS a grandparent", + "start": 267, + "end": 324, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 58 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 326, + "end": 355, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 326, + "end": 354, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 326, + "end": 332, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 333, + "end": 353, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 28 + } + }, + "left": { + "type": "MemberExpression", + "start": 333, + "end": 344, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 333, + "end": 337, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 338, + "end": 344, + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 349, + "end": 353, + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 28 + } + } + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " We only call this function when node HAS a grandparent", + "start": 267, + "end": 324, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 58 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 357, + "end": 393, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 37 + } + }, + "expression": { + "type": "CallExpression", + "start": 357, + "end": 392, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 357, + "end": 363, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 364, + "end": 391, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 35 + } + }, + "left": { + "type": "MemberExpression", + "start": 364, + "end": 382, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 26 + } + }, + "object": { + "type": "MemberExpression", + "start": 364, + "end": 375, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 364, + "end": 368, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 369, + "end": 375, + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 376, + "end": 382, + "loc": { + "start": { + "line": 14, + "column": 20 + }, + "end": { + "line": 14, + "column": 26 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 387, + "end": 391, + "loc": { + "start": { + "line": 14, + "column": 31 + }, + "end": { + "line": 14, + "column": 35 + } + } + } + } + ] + } + }, + { + "type": "ReturnStatement", + "start": 395, + "end": 421, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "argument": { + "type": "MemberExpression", + "start": 402, + "end": 420, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "object": { + "type": "MemberExpression", + "start": 402, + "end": 413, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 402, + "end": 406, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 407, + "end": 413, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 414, + "end": 420, + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 26 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 202, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 202, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " We only call this function when node HAS a grandparent", + "start": 267, + "end": 324, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 58 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 202, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 203, + "end": 208, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 209, + "end": 220, + "loc": { + "start": { + "line": 10, + "column": 6 + }, + "end": { + "line": 10, + "column": 17 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 221, + "end": 222, + "loc": { + "start": { + "line": 10, + "column": 18 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 223, + "end": 224, + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 224, + "end": 228, + "loc": { + "start": { + "line": 10, + "column": 21 + }, + "end": { + "line": 10, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 228, + "end": 229, + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 26 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 230, + "end": 232, + "loc": { + "start": { + "line": 10, + "column": 27 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 233, + "end": 234, + "loc": { + "start": { + "line": 10, + "column": 30 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 236, + "end": 242, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 242, + "end": 243, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 243, + "end": 247, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 248, + "end": 258, + "loc": { + "start": { + "line": 11, + "column": 13 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 135, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } - } - ] + "end": { + "line": 11, + "column": 23 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 135, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 259, + "end": 263, "loc": { "start": { - "line": 1, - "column": 0 + "line": 11, + "column": 24 }, "end": { - "line": 6, - "column": 3 + "line": 11, + "column": 28 } } }, { - "type": "CommentLine", - "value": " Assert((node !== null) && (node.parent !== null));", - "start": 176, - "end": 229, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 263, + "end": 264, "loc": { "start": { - "line": 8, - "column": 1 + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 264, + "end": 265, + "loc": { + "start": { + "line": 11, + "column": 29 }, "end": { - "line": 8, - "column": 54 + "line": 11, + "column": 30 } } }, { "type": "CommentLine", "value": " We only call this function when node HAS a grandparent", - "start": 231, - "end": 288, + "start": 267, + "end": 324, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 58 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 326, + "end": 332, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 332, + "end": 333, + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 333, + "end": 337, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 337, + "end": 338, + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 338, + "end": 344, + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 345, + "end": 348, + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 349, + "end": 353, + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 28 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 353, + "end": 354, "loc": { "start": { - "line": 9, - "column": 1 + "line": 13, + "column": 28 }, "end": { - "line": 9, - "column": 58 + "line": 13, + "column": 29 } } - } - ], - "tokens": [ + }, { - "type": "CommentBlock", - "value": "*\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 135, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 354, + "end": 355, "loc": { "start": { - "line": 1, - "column": 0 + "line": 13, + "column": 29 }, "end": { - "line": 6, - "column": 3 + "line": 13, + "column": 30 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 136, - "end": 142, + "value": "assert", + "start": 357, + "end": 363, "loc": { "start": { - "line": 7, - "column": 0 + "line": 14, + "column": 1 }, "end": { - "line": 7, - "column": 6 + "line": 14, + "column": 7 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 143, - "end": 148, + "start": 363, + "end": 364, "loc": { "start": { - "line": 7, + "line": 14, "column": 7 }, "end": { - "line": 7, - "column": 12 + "line": 14, + "column": 8 } } }, @@ -480,51 +2569,50 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 149, - "end": 160, + "value": "node", + "start": 364, + "end": 368, "loc": { "start": { - "line": 7, - "column": 13 + "line": 14, + "column": 8 }, "end": { - "line": 7, - "column": 24 + "line": 14, + "column": 12 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 161, - "end": 162, + "start": 368, + "end": 369, "loc": { "start": { - "line": 7, - "column": 25 + "line": 14, + "column": 12 }, "end": { - "line": 7, - "column": 26 + "line": 14, + "column": 13 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -533,50 +2621,51 @@ "postfix": false, "binop": null }, - "start": 163, - "end": 164, + "value": "parent", + "start": 369, + "end": 375, "loc": { "start": { - "line": 7, - "column": 27 + "line": 14, + "column": 13 }, "end": { - "line": 7, - "column": 28 + "line": 14, + "column": 19 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 164, - "end": 168, + "start": 375, + "end": 376, "loc": { "start": { - "line": 7, - "column": 28 + "line": 14, + "column": 19 }, "end": { - "line": 7, - "column": 32 + "line": 14, + "column": 20 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -584,22 +2673,23 @@ "postfix": false, "binop": null }, - "start": 168, - "end": 169, + "value": "parent", + "start": 376, + "end": 382, "loc": { "start": { - "line": 7, - "column": 32 + "line": 14, + "column": 20 }, "end": { - "line": 7, - "column": 33 + "line": 14, + "column": 26 } } }, { "type": { - "label": "=>", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -607,76 +2697,99 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 170, - "end": 172, + "value": "!==", + "start": 383, + "end": 386, "loc": { "start": { - "line": 7, - "column": 34 + "line": 14, + "column": 27 }, "end": { - "line": 7, - "column": 36 + "line": 14, + "column": 30 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "null", + "keyword": "null", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 173, - "end": 174, + "value": "null", + "start": 387, + "end": 391, "loc": { "start": { - "line": 7, - "column": 37 + "line": 14, + "column": 31 }, "end": { - "line": 7, - "column": 38 + "line": 14, + "column": 35 } } }, { - "type": "CommentLine", - "value": " Assert((node !== null) && (node.parent !== null));", - "start": 176, - "end": 229, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 391, + "end": 392, "loc": { "start": { - "line": 8, - "column": 1 + "line": 14, + "column": 35 }, "end": { - "line": 8, - "column": 54 + "line": 14, + "column": 36 } } }, { - "type": "CommentLine", - "value": " We only call this function when node HAS a grandparent", - "start": 231, - "end": 288, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 392, + "end": 393, "loc": { "start": { - "line": 9, - "column": 1 + "line": 14, + "column": 36 }, "end": { - "line": 9, - "column": 58 + "line": 14, + "column": 37 } } }, @@ -695,15 +2808,15 @@ "updateContext": null }, "value": "return", - "start": 290, - "end": 296, + "start": 395, + "end": 401, "loc": { "start": { - "line": 10, + "line": 15, "column": 1 }, "end": { - "line": 10, + "line": 15, "column": 7 } } @@ -721,15 +2834,15 @@ "binop": null }, "value": "node", - "start": 297, - "end": 301, + "start": 402, + "end": 406, "loc": { "start": { - "line": 10, + "line": 15, "column": 8 }, "end": { - "line": 10, + "line": 15, "column": 12 } } @@ -747,15 +2860,15 @@ "binop": null, "updateContext": null }, - "start": 301, - "end": 302, + "start": 406, + "end": 407, "loc": { "start": { - "line": 10, + "line": 15, "column": 12 }, "end": { - "line": 10, + "line": 15, "column": 13 } } @@ -773,15 +2886,15 @@ "binop": null }, "value": "parent", - "start": 302, - "end": 308, + "start": 407, + "end": 413, "loc": { "start": { - "line": 10, + "line": 15, "column": 13 }, "end": { - "line": 10, + "line": 15, "column": 19 } } @@ -799,15 +2912,15 @@ "binop": null, "updateContext": null }, - "start": 308, - "end": 309, + "start": 413, + "end": 414, "loc": { "start": { - "line": 10, + "line": 15, "column": 19 }, "end": { - "line": 10, + "line": 15, "column": 20 } } @@ -825,15 +2938,15 @@ "binop": null }, "value": "parent", - "start": 309, - "end": 315, + "start": 414, + "end": 420, "loc": { "start": { - "line": 10, + "line": 15, "column": 20 }, "end": { - "line": 10, + "line": 15, "column": 26 } } @@ -851,15 +2964,15 @@ "binop": null, "updateContext": null }, - "start": 315, - "end": 316, + "start": 420, + "end": 421, "loc": { "start": { - "line": 10, + "line": 15, "column": 26 }, "end": { - "line": 10, + "line": 15, "column": 27 } } @@ -876,15 +2989,15 @@ "postfix": false, "binop": null }, - "start": 317, - "end": 318, + "start": 422, + "end": 423, "loc": { "start": { - "line": 11, + "line": 16, "column": 0 }, "end": { - "line": 11, + "line": 16, "column": 1 } } @@ -902,19 +3015,127 @@ "binop": null, "updateContext": null }, - "start": 318, - "end": 319, + "start": 423, + "end": 424, "loc": { "start": { - "line": 11, + "line": 16, "column": 1 }, "end": { - "line": 11, + "line": 16, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 426, + "end": 432, + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 433, + "end": 440, + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 441, + "end": 452, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 452, + "end": 453, + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, { "type": { "label": "eof", @@ -928,15 +3149,15 @@ "binop": null, "updateContext": null }, - "start": 320, - "end": 320, + "start": 454, + "end": 454, "loc": { "start": { - "line": 12, + "line": 19, "column": 0 }, "end": { - "line": 12, + "line": 19, "column": 0 } } diff --git a/ast/source/family/index.js.json b/ast/source/family/index.js.json deleted file mode 100644 index 8a39a08..0000000 --- a/ast/source/family/index.js.json +++ /dev/null @@ -1,739 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 126, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 126, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 5, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "extra": { - "rawValue": "./grandparent.js", - "raw": "'./grandparent.js'" - }, - "value": "./grandparent.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 34, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "source": { - "type": "StringLiteral", - "start": 48, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 32 - } - }, - "extra": { - "rawValue": "./predecessor.js", - "raw": "'./predecessor.js'" - }, - "value": "./predecessor.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 68, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 29 - } - }, - "source": { - "type": "StringLiteral", - "start": 82, - "end": 96, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "extra": { - "rawValue": "./sibling.js", - "raw": "'./sibling.js'" - }, - "value": "./sibling.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 98, - "end": 125, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 27 - } - }, - "source": { - "type": "StringLiteral", - "start": 112, - "end": 124, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 26 - } - }, - "extra": { - "rawValue": "./uncle.js", - "raw": "'./uncle.js'" - }, - "value": "./uncle.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./grandparent.js", - "start": 14, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 43, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./predecessor.js", - "start": 48, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 32 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 32 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 68, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 75, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 77, - "end": 81, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./sibling.js", - "start": 82, - "end": 96, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 96, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 98, - "end": 104, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 105, - "end": 106, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 107, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./uncle.js", - "start": 112, - "end": 124, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 124, - "end": 125, - "loc": { - "start": { - "line": 4, - "column": 26 - }, - "end": { - "line": 4, - "column": 27 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 126, - "end": 126, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/family/predecessor.js.json b/ast/source/family/predecessor.js.json index ac05a29..5125887 100644 --- a/ast/source/family/predecessor.js.json +++ b/ast/source/family/predecessor.js.json @@ -1,238 +1,374 @@ { "type": "File", "start": 0, - "end": 373, + "end": 507, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 16, + "line": 24, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 373, + "end": 507, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 16, + "line": 24, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 207, - "end": 372, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 8, + "line": 1, "column": 0 }, "end": { - "line": 15, - "column": 2 + "line": 1, + "column": 28 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 214, - "end": 372, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, "loc": { "start": { - "line": 8, - "column": 7 + "line": 1, + "column": 19 }, "end": { - "line": 15, - "column": 2 + "line": 1, + "column": 27 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 220, - "end": 371, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, "loc": { "start": { - "line": 8, - "column": 13 + "line": 2, + "column": 7 }, "end": { - "line": 15, - "column": 1 - } + "line": 2, + "column": 11 + }, + "identifierName": "Node" }, - "id": { - "type": "Identifier", - "start": 220, - "end": 231, - "loc": { - "start": { - "line": 8, - "column": 13 - }, - "end": { - "line": 8, - "column": 24 - }, - "identifierName": "predecessor" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 273, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 274, + "end": 477, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 21, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 280, + "end": 476, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 280, + "end": 291, + "loc": { + "start": { + "line": 11, + "column": 6 }, - "name": "predecessor", - "leadingComments": null + "end": { + "line": 11, + "column": 17 + }, + "identifierName": "predecessor" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 234, - "end": 371, - "loc": { - "start": { - "line": 8, - "column": 27 - }, - "end": { - "line": 15, - "column": 1 - } + "name": "predecessor", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 294, + "end": 476, + "loc": { + "start": { + "line": 11, + "column": 20 }, - "id": { + "end": { + "line": 21, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 220, - "end": 231, + "start": 295, + "end": 299, "loc": { "start": { - "line": 8, - "column": 13 + "line": 11, + "column": 21 }, "end": { - "line": 8, - "column": 24 + "line": 11, + "column": 25 }, - "identifierName": "predecessor" + "identifierName": "node" }, - "name": "predecessor", - "leadingComments": null + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 304, + "end": 476, + "loc": { + "start": { + "line": 11, + "column": 30 + }, + "end": { + "line": 21, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 235, - "end": 239, + "type": "ExpressionStatement", + "start": 307, + "end": 341, "loc": { "start": { - "line": 8, - "column": 28 + "line": 12, + "column": 1 }, "end": { - "line": 8, - "column": 32 - }, - "identifierName": "node" - }, - "name": "node" - } - ], - "body": { - "type": "BlockStatement", - "start": 244, - "end": 371, - "loc": { - "start": { - "line": 8, - "column": 37 + "line": 12, + "column": 35 + } }, - "end": { - "line": 15, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 283, - "end": 304, + "expression": { + "type": "CallExpression", + "start": 307, + "end": 340, "loc": { "start": { - "line": 10, + "line": 12, "column": 1 }, "end": { - "line": 10, - "column": 22 + "line": 12, + "column": 34 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 307, + "end": 313, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 287, - "end": 303, + "type": "BinaryExpression", + "start": 314, + "end": 339, "loc": { "start": { - "line": 10, - "column": 5 + "line": 12, + "column": 8 }, "end": { - "line": 10, - "column": 21 + "line": 12, + "column": 33 } }, - "id": { - "type": "Identifier", - "start": 287, - "end": 291, - "loc": { - "start": { - "line": 10, - "column": 5 - }, - "end": { - "line": 10, - "column": 9 - }, - "identifierName": "pred" - }, - "name": "pred", - "leadingComments": null - }, - "init": { + "left": { "type": "MemberExpression", - "start": 294, - "end": 303, + "start": 314, + "end": 323, "loc": { "start": { - "line": 10, - "column": 12 + "line": 12, + "column": 8 }, "end": { - "line": 10, - "column": 21 + "line": 12, + "column": 17 } }, "object": { "type": "Identifier", - "start": 294, - "end": 298, + "start": 314, + "end": 318, "loc": { "start": { - "line": 10, - "column": 12 + "line": 12, + "column": 8 }, "end": { - "line": 10, - "column": 16 + "line": 12, + "column": 12 }, "identifierName": "node" }, @@ -240,16 +376,16 @@ }, "property": { "type": "Identifier", - "start": 299, - "end": 303, + "start": 319, + "end": 323, "loc": { "start": { - "line": 10, - "column": 17 + "line": 12, + "column": 13 }, "end": { - "line": 10, - "column": 21 + "line": 12, + "column": 17 }, "identifierName": "left" }, @@ -257,398 +393,2092 @@ }, "computed": false }, - "leadingComments": null - } - ], - "kind": "let", - "leadingComments": [ - { - "type": "CommentLine", - "value": " Assert( !node.left.isLeaf() ) ;", - "start": 247, - "end": 281, - "loc": { - "start": { - "line": 9, - "column": 1 + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 335, + "end": 339, + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 33 + }, + "identifierName": "Node" }, - "end": { - "line": 9, - "column": 35 - } + "name": "Node" } } ] - }, - { - "type": "WhileStatement", - "start": 307, - "end": 354, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 48 - } + } + }, + { + "type": "VariableDeclaration", + "start": 343, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 }, - "test": { - "type": "UnaryExpression", - "start": 314, - "end": 334, + "end": { + "line": 13, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 347, + "end": 363, "loc": { "start": { - "line": 12, - "column": 8 + "line": 13, + "column": 5 }, "end": { - "line": 12, - "column": 28 + "line": 13, + "column": 21 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 315, - "end": 334, + "id": { + "type": "Identifier", + "start": 347, + "end": 351, "loc": { "start": { - "line": 12, - "column": 9 + "line": 13, + "column": 5 }, "end": { - "line": 12, - "column": 28 - } + "line": 13, + "column": 9 + }, + "identifierName": "pred" }, - "callee": { + "name": "pred" + }, + "init": { + "type": "MemberExpression", + "start": 354, + "end": 363, + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 354, + "end": 358, + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 16 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 359, + "end": 363, + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "let" + }, + { + "type": "WhileStatement", + "start": 367, + "end": 459, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + }, + "test": { + "type": "UnaryExpression", + "start": 374, + "end": 394, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "operator": "!", + "prefix": true, + "argument": { + "type": "CallExpression", + "start": 375, + "end": 394, + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "callee": { + "type": "MemberExpression", + "start": 375, + "end": 392, + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "object": { "type": "MemberExpression", - "start": 315, - "end": 332, + "start": 375, + "end": 385, "loc": { "start": { - "line": 12, + "line": 15, "column": 9 }, "end": { - "line": 12, - "column": 26 + "line": 15, + "column": 19 } }, "object": { - "type": "MemberExpression", - "start": 315, - "end": 325, + "type": "Identifier", + "start": 375, + "end": 379, "loc": { "start": { - "line": 12, + "line": 15, "column": 9 }, "end": { - "line": 12, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 315, - "end": 319, - "loc": { - "start": { - "line": 12, - "column": 9 - }, - "end": { - "line": 12, - "column": 13 - }, - "identifierName": "pred" + "line": 15, + "column": 13 }, - "name": "pred" - }, - "property": { - "type": "Identifier", - "start": 320, - "end": 325, - "loc": { - "start": { - "line": 12, - "column": 14 - }, - "end": { - "line": 12, - "column": 19 - }, - "identifierName": "right" - }, - "name": "right" + "identifierName": "pred" }, - "computed": false + "name": "pred" }, "property": { "type": "Identifier", - "start": 326, - "end": 332, + "start": 380, + "end": 385, "loc": { "start": { - "line": 12, - "column": 20 + "line": 15, + "column": 14 }, "end": { - "line": 12, - "column": 26 + "line": 15, + "column": 19 }, - "identifierName": "isLeaf" + "identifierName": "right" }, - "name": "isLeaf" + "name": "right" }, "computed": false }, - "arguments": [] + "property": { + "type": "Identifier", + "start": 386, + "end": 392, + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 26 + }, + "identifierName": "isLeaf" + }, + "name": "isLeaf" + }, + "computed": false }, - "extra": { - "parenthesizedArgument": false - } + "arguments": [] }, - "body": { - "type": "ExpressionStatement", - "start": 336, - "end": 354, - "loc": { - "start": { - "line": 12, - "column": 30 - }, - "end": { - "line": 12, - "column": 48 - } + "extra": { + "parenthesizedArgument": false + } + }, + "body": { + "type": "BlockStatement", + "start": 396, + "end": 459, + "loc": { + "start": { + "line": 15, + "column": 30 }, - "expression": { - "type": "AssignmentExpression", - "start": 336, - "end": 353, + "end": { + "line": 18, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 400, + "end": 435, "loc": { "start": { - "line": 12, - "column": 30 + "line": 16, + "column": 2 }, "end": { - "line": 12, - "column": 47 + "line": 16, + "column": 37 } }, - "operator": "=", - "left": { - "type": "Identifier", - "start": 336, - "end": 340, + "expression": { + "type": "CallExpression", + "start": 400, + "end": 434, "loc": { "start": { - "line": 12, - "column": 30 + "line": 16, + "column": 2 }, "end": { - "line": 12, - "column": 34 + "line": 16, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 400, + "end": 406, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 8 + }, + "identifierName": "assert" }, - "identifierName": "pred" + "name": "assert" }, - "name": "pred" + "arguments": [ + { + "type": "BinaryExpression", + "start": 407, + "end": 433, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 35 + } + }, + "left": { + "type": "MemberExpression", + "start": 407, + "end": 417, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 407, + "end": 411, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 13 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 412, + "end": 417, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 429, + "end": 433, + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 35 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 438, + "end": 456, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 20 + } }, - "right": { - "type": "MemberExpression", - "start": 343, - "end": 353, + "expression": { + "type": "AssignmentExpression", + "start": 438, + "end": 455, "loc": { "start": { - "line": 12, - "column": 37 + "line": 17, + "column": 2 }, "end": { - "line": 12, - "column": 47 + "line": 17, + "column": 19 } }, - "object": { + "operator": "=", + "left": { "type": "Identifier", - "start": 343, - "end": 347, + "start": 438, + "end": 442, "loc": { "start": { - "line": 12, - "column": 37 + "line": 17, + "column": 2 }, "end": { - "line": 12, - "column": 41 + "line": 17, + "column": 6 }, "identifierName": "pred" }, "name": "pred" }, - "property": { - "type": "Identifier", - "start": 348, - "end": 353, + "right": { + "type": "MemberExpression", + "start": 445, + "end": 455, "loc": { "start": { - "line": 12, - "column": 42 + "line": 17, + "column": 9 }, "end": { - "line": 12, - "column": 47 + "line": 17, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 445, + "end": 449, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 13 + }, + "identifierName": "pred" }, - "identifierName": "right" + "name": "pred" }, - "name": "right" - }, - "computed": false + "property": { + "type": "Identifier", + "start": 450, + "end": 455, + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 19 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } } } + ], + "directives": [] + } + }, + { + "type": "ReturnStatement", + "start": 462, + "end": 474, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 13 } }, - { - "type": "ReturnStatement", - "start": 357, - "end": 369, + "argument": { + "type": "Identifier", + "start": 469, + "end": 473, "loc": { "start": { - "line": 14, - "column": 1 + "line": 20, + "column": 8 }, "end": { - "line": 14, - "column": 13 - } - }, - "argument": { - "type": "Identifier", - "start": 364, - "end": 368, - "loc": { - "start": { - "line": 14, - "column": 8 - }, - "end": { - "line": 14, - "column": 12 - }, - "identifierName": "pred" + "line": 20, + "column": 12 }, - "name": "pred" - } + "identifierName": "pred" + }, + "name": "pred" } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 479, + "end": 506, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "declaration": { + "type": "Identifier", + "start": 494, + "end": 505, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 26 + }, + "identifierName": "predecessor" + }, + "name": "predecessor" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 479, + "end": 506, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 274, + "end": 477, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 21, + "column": 2 + } + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 206, + "type": "VariableDeclarator", + "start": 280, + "end": 476, "loc": { "start": { - "line": 1, - "column": 0 + "line": 11, + "column": 6 }, "end": { - "line": 7, - "column": 3 + "line": 21, + "column": 1 } - } - } - ], - "trailingComments": [] + }, + "id": { + "type": "Identifier", + "start": 280, + "end": 291, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 17 + }, + "identifierName": "predecessor" + }, + "name": "predecessor", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 294, + "end": 476, + "loc": { + "start": { + "line": 11, + "column": 20 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 280, + "end": 291, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 17 + }, + "identifierName": "predecessor" + }, + "name": "predecessor", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 295, + "end": 299, + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 25 + }, + "identifierName": "node" + }, + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 304, + "end": 476, + "loc": { + "start": { + "line": 11, + "column": 30 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 307, + "end": 341, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 35 + } + }, + "expression": { + "type": "CallExpression", + "start": 307, + "end": 340, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 34 + } + }, + "callee": { + "type": "Identifier", + "start": 307, + "end": 313, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 314, + "end": 339, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 33 + } + }, + "left": { + "type": "MemberExpression", + "start": 314, + "end": 323, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 314, + "end": 318, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 319, + "end": 323, + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 335, + "end": 339, + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 33 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 343, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 347, + "end": 363, + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 347, + "end": 351, + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 9 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "init": { + "type": "MemberExpression", + "start": 354, + "end": 363, + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 354, + "end": 358, + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 16 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 359, + "end": 363, + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "let" + }, + { + "type": "WhileStatement", + "start": 367, + "end": 459, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + }, + "test": { + "type": "UnaryExpression", + "start": 374, + "end": 394, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "operator": "!", + "prefix": true, + "argument": { + "type": "CallExpression", + "start": 375, + "end": 394, + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "callee": { + "type": "MemberExpression", + "start": 375, + "end": 392, + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "object": { + "type": "MemberExpression", + "start": 375, + "end": 385, + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 375, + "end": 379, + "loc": { + "start": { + "line": 15, + "column": 9 + }, + "end": { + "line": 15, + "column": 13 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 380, + "end": 385, + "loc": { + "start": { + "line": 15, + "column": 14 + }, + "end": { + "line": 15, + "column": 19 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 386, + "end": 392, + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 26 + }, + "identifierName": "isLeaf" + }, + "name": "isLeaf" + }, + "computed": false + }, + "arguments": [] + }, + "extra": { + "parenthesizedArgument": false + } + }, + "body": { + "type": "BlockStatement", + "start": 396, + "end": 459, + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 18, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 400, + "end": 435, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 37 + } + }, + "expression": { + "type": "CallExpression", + "start": 400, + "end": 434, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 400, + "end": 406, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 407, + "end": 433, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 35 + } + }, + "left": { + "type": "MemberExpression", + "start": 407, + "end": 417, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 407, + "end": 411, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 13 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 412, + "end": 417, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 19 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 429, + "end": 433, + "loc": { + "start": { + "line": 16, + "column": 31 + }, + "end": { + "line": 16, + "column": 35 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 438, + "end": 456, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 20 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 438, + "end": 455, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 19 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 438, + "end": 442, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 6 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "right": { + "type": "MemberExpression", + "start": 445, + "end": 455, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 445, + "end": 449, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 13 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 450, + "end": 455, + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 19 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + } + ], + "directives": [] + } + }, + { + "type": "ReturnStatement", + "start": 462, + "end": 474, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 13 + } + }, + "argument": { + "type": "Identifier", + "start": 469, + "end": 473, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 12 + }, + "identifierName": "pred" + }, + "name": "pred" + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 273, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 273, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 273, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 274, + "end": 279, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "predecessor", + "start": 280, + "end": 291, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 292, + "end": 293, + "loc": { + "start": { + "line": 11, + "column": 18 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 294, + "end": 295, + "loc": { + "start": { + "line": 11, + "column": 20 + }, + "end": { + "line": 11, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 295, + "end": 299, + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 299, + "end": 300, + "loc": { + "start": { + "line": 11, + "column": 25 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 206, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 3 - } - } - } - ] + "end": { + "line": 11, + "column": 26 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 206, + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 301, + "end": 303, "loc": { "start": { - "line": 1, - "column": 0 + "line": 11, + "column": 27 }, "end": { - "line": 7, - "column": 3 + "line": 11, + "column": 29 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 304, + "end": 305, + "loc": { + "start": { + "line": 11, + "column": 30 + }, + "end": { + "line": 11, + "column": 31 } } }, { - "type": "CommentLine", - "value": " Assert( !node.left.isLeaf() ) ;", - "start": 247, - "end": 281, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 307, + "end": 313, "loc": { "start": { - "line": 9, + "line": 12, "column": 1 }, "end": { - "line": 9, - "column": 35 + "line": 12, + "column": 7 } } - } - ], - "tokens": [ + }, { - "type": "CommentBlock", - "value": "*\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 206, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 313, + "end": 314, "loc": { "start": { - "line": 1, - "column": 0 + "line": 12, + "column": 7 }, "end": { - "line": 7, - "column": 3 + "line": 12, + "column": 8 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 314, + "end": 318, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 318, + "end": 319, + "loc": { + "start": { + "line": 12, + "column": 12 + }, + "end": { + "line": 12, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 319, + "end": 323, + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 17 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 324, + "end": 334, + "loc": { + "start": { + "line": 12, + "column": 18 + }, + "end": { + "line": 12, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 335, + "end": 339, + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 33 + } + } + }, + { + "type": { + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -656,27 +2486,51 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "start": 339, + "end": 340, + "loc": { + "start": { + "line": 12, + "column": 33 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "export", - "start": 207, - "end": 213, + "start": 340, + "end": 341, "loc": { "start": { - "line": 8, - "column": 0 + "line": 12, + "column": 34 }, "end": { - "line": 8, - "column": 6 + "line": 12, + "column": 35 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "let", + "keyword": "let", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -687,17 +2541,17 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 214, - "end": 219, + "value": "let", + "start": 343, + "end": 346, "loc": { "start": { - "line": 8, - "column": 7 + "line": 13, + "column": 1 }, "end": { - "line": 8, - "column": 12 + "line": 13, + "column": 4 } } }, @@ -713,17 +2567,17 @@ "postfix": false, "binop": null }, - "value": "predecessor", - "start": 220, - "end": 231, + "value": "pred", + "start": 347, + "end": 351, "loc": { "start": { - "line": 8, - "column": 13 + "line": 13, + "column": 5 }, "end": { - "line": 8, - "column": 24 + "line": 13, + "column": 9 } } }, @@ -741,23 +2595,23 @@ "updateContext": null }, "value": "=", - "start": 232, - "end": 233, + "start": 352, + "end": 353, "loc": { "start": { - "line": 8, - "column": 25 + "line": 13, + "column": 10 }, "end": { - "line": 8, - "column": 26 + "line": 13, + "column": 11 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -766,50 +2620,51 @@ "postfix": false, "binop": null }, - "start": 234, - "end": 235, + "value": "node", + "start": 354, + "end": 358, "loc": { "start": { - "line": 8, - "column": 27 + "line": 13, + "column": 12 }, "end": { - "line": 8, - "column": 28 + "line": 13, + "column": 16 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 235, - "end": 239, + "start": 358, + "end": 359, "loc": { "start": { - "line": 8, - "column": 28 + "line": 13, + "column": 16 }, "end": { - "line": 8, - "column": 32 + "line": 13, + "column": 17 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -817,22 +2672,23 @@ "postfix": false, "binop": null }, - "start": 239, - "end": 240, + "value": "left", + "start": 359, + "end": 363, "loc": { "start": { - "line": 8, - "column": 32 + "line": 13, + "column": 17 }, "end": { - "line": 8, - "column": 33 + "line": 13, + "column": 21 } } }, { "type": { - "label": "=>", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -843,85 +2699,96 @@ "binop": null, "updateContext": null }, - "start": 241, - "end": 243, + "start": 363, + "end": 364, "loc": { "start": { - "line": 8, - "column": 34 + "line": 13, + "column": 21 }, "end": { - "line": 8, - "column": 36 + "line": 13, + "column": 22 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "while", + "keyword": "while", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, - "isLoop": false, + "isLoop": true, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 244, - "end": 245, + "value": "while", + "start": 367, + "end": 372, "loc": { "start": { - "line": 8, - "column": 37 + "line": 15, + "column": 1 }, "end": { - "line": 8, - "column": 38 + "line": 15, + "column": 6 } } }, { - "type": "CommentLine", - "value": " Assert( !node.left.isLeaf() ) ;", - "start": 247, - "end": 281, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 373, + "end": 374, "loc": { "start": { - "line": 9, - "column": 1 + "line": 15, + "column": 7 }, "end": { - "line": 9, - "column": 35 + "line": 15, + "column": 8 } } }, { "type": { - "label": "let", - "keyword": "let", - "beforeExpr": false, - "startsExpr": false, + "label": "prefix", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": false, + "prefix": true, "postfix": false, "binop": null, "updateContext": null }, - "value": "let", - "start": 283, - "end": 286, + "value": "!", + "start": 374, + "end": 375, "loc": { "start": { - "line": 10, - "column": 1 + "line": 15, + "column": 8 }, "end": { - "line": 10, - "column": 4 + "line": 15, + "column": 9 } } }, @@ -938,43 +2805,42 @@ "binop": null }, "value": "pred", - "start": 287, - "end": 291, + "start": 375, + "end": 379, "loc": { "start": { - "line": 10, - "column": 5 + "line": 15, + "column": 9 }, "end": { - "line": 10, - "column": 9 + "line": 15, + "column": 13 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 292, - "end": 293, + "start": 379, + "end": 380, "loc": { "start": { - "line": 10, - "column": 10 + "line": 15, + "column": 13 }, "end": { - "line": 10, - "column": 11 + "line": 15, + "column": 14 } } }, @@ -990,17 +2856,17 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 294, - "end": 298, + "value": "right", + "start": 380, + "end": 385, "loc": { "start": { - "line": 10, - "column": 12 + "line": 15, + "column": 14 }, "end": { - "line": 10, - "column": 16 + "line": 15, + "column": 19 } } }, @@ -1017,16 +2883,16 @@ "binop": null, "updateContext": null }, - "start": 298, - "end": 299, + "start": 385, + "end": 386, "loc": { "start": { - "line": 10, - "column": 16 + "line": 15, + "column": 19 }, "end": { - "line": 10, - "column": 17 + "line": 15, + "column": 20 } } }, @@ -1042,77 +2908,98 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 299, - "end": 303, + "value": "isLeaf", + "start": 386, + "end": 392, "loc": { "start": { - "line": 10, - "column": 17 + "line": 15, + "column": 20 }, "end": { - "line": 10, - "column": 21 + "line": 15, + "column": 26 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 392, + "end": 393, + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 303, - "end": 304, + "start": 393, + "end": 394, "loc": { "start": { - "line": 10, - "column": 21 + "line": 15, + "column": 27 }, "end": { - "line": 10, - "column": 22 + "line": 15, + "column": 28 } } }, { "type": { - "label": "while", - "keyword": "while", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, - "isLoop": true, + "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "while", - "start": 307, - "end": 312, + "start": 394, + "end": 395, "loc": { "start": { - "line": 12, - "column": 1 + "line": 15, + "column": 28 }, "end": { - "line": 12, - "column": 6 + "line": 15, + "column": 29 } } }, { "type": { - "label": "(", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1122,42 +3009,66 @@ "postfix": false, "binop": null }, - "start": 313, - "end": 314, + "start": 396, + "end": 397, + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 400, + "end": 406, "loc": { "start": { - "line": 12, - "column": 7 + "line": 16, + "column": 2 }, "end": { - "line": 12, + "line": 16, "column": 8 } } }, { "type": { - "label": "prefix", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": true, + "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "!", - "start": 314, - "end": 315, + "start": 406, + "end": 407, "loc": { "start": { - "line": 12, + "line": 16, "column": 8 }, "end": { - "line": 12, + "line": 16, "column": 9 } } @@ -1175,15 +3086,15 @@ "binop": null }, "value": "pred", - "start": 315, - "end": 319, + "start": 407, + "end": 411, "loc": { "start": { - "line": 12, + "line": 16, "column": 9 }, "end": { - "line": 12, + "line": 16, "column": 13 } } @@ -1201,15 +3112,15 @@ "binop": null, "updateContext": null }, - "start": 319, - "end": 320, + "start": 411, + "end": 412, "loc": { "start": { - "line": 12, + "line": 16, "column": 13 }, "end": { - "line": 12, + "line": 16, "column": 14 } } @@ -1227,42 +3138,44 @@ "binop": null }, "value": "right", - "start": 320, - "end": 325, + "start": 412, + "end": 417, "loc": { "start": { - "line": 12, + "line": 16, "column": 14 }, "end": { - "line": 12, + "line": 16, "column": 19 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 325, - "end": 326, + "value": "instanceof", + "start": 418, + "end": 428, "loc": { "start": { - "line": 12, - "column": 19 + "line": 16, + "column": 20 }, "end": { - "line": 12, - "column": 20 + "line": 16, + "column": 30 } } }, @@ -1278,42 +3191,17 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 326, - "end": 332, - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 332, - "end": 333, + "value": "Node", + "start": 429, + "end": 433, "loc": { "start": { - "line": 12, - "column": 26 + "line": 16, + "column": 31 }, "end": { - "line": 12, - "column": 27 + "line": 16, + "column": 35 } } }, @@ -1329,41 +3217,42 @@ "postfix": false, "binop": null }, - "start": 333, - "end": 334, + "start": 433, + "end": 434, "loc": { "start": { - "line": 12, - "column": 27 + "line": 16, + "column": 35 }, "end": { - "line": 12, - "column": 28 + "line": 16, + "column": 36 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 334, - "end": 335, + "start": 434, + "end": 435, "loc": { "start": { - "line": 12, - "column": 28 + "line": 16, + "column": 36 }, "end": { - "line": 12, - "column": 29 + "line": 16, + "column": 37 } } }, @@ -1380,16 +3269,16 @@ "binop": null }, "value": "pred", - "start": 336, - "end": 340, + "start": 438, + "end": 442, "loc": { "start": { - "line": 12, - "column": 30 + "line": 17, + "column": 2 }, "end": { - "line": 12, - "column": 34 + "line": 17, + "column": 6 } } }, @@ -1407,16 +3296,16 @@ "updateContext": null }, "value": "=", - "start": 341, - "end": 342, + "start": 443, + "end": 444, "loc": { "start": { - "line": 12, - "column": 35 + "line": 17, + "column": 7 }, "end": { - "line": 12, - "column": 36 + "line": 17, + "column": 8 } } }, @@ -1433,16 +3322,16 @@ "binop": null }, "value": "pred", - "start": 343, - "end": 347, + "start": 445, + "end": 449, "loc": { "start": { - "line": 12, - "column": 37 + "line": 17, + "column": 9 }, "end": { - "line": 12, - "column": 41 + "line": 17, + "column": 13 } } }, @@ -1459,16 +3348,16 @@ "binop": null, "updateContext": null }, - "start": 347, - "end": 348, + "start": 449, + "end": 450, "loc": { "start": { - "line": 12, - "column": 41 + "line": 17, + "column": 13 }, "end": { - "line": 12, - "column": 42 + "line": 17, + "column": 14 } } }, @@ -1485,16 +3374,16 @@ "binop": null }, "value": "right", - "start": 348, - "end": 353, + "start": 450, + "end": 455, "loc": { "start": { - "line": 12, - "column": 42 + "line": 17, + "column": 14 }, "end": { - "line": 12, - "column": 47 + "line": 17, + "column": 19 } } }, @@ -1511,16 +3400,41 @@ "binop": null, "updateContext": null }, - "start": 353, - "end": 354, + "start": 455, + "end": 456, "loc": { "start": { - "line": 12, - "column": 47 + "line": 17, + "column": 19 }, "end": { - "line": 12, - "column": 48 + "line": 17, + "column": 20 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 458, + "end": 459, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 } } }, @@ -1539,15 +3453,15 @@ "updateContext": null }, "value": "return", - "start": 357, - "end": 363, + "start": 462, + "end": 468, "loc": { "start": { - "line": 14, + "line": 20, "column": 1 }, "end": { - "line": 14, + "line": 20, "column": 7 } } @@ -1565,15 +3479,15 @@ "binop": null }, "value": "pred", - "start": 364, - "end": 368, + "start": 469, + "end": 473, "loc": { "start": { - "line": 14, + "line": 20, "column": 8 }, "end": { - "line": 14, + "line": 20, "column": 12 } } @@ -1591,15 +3505,15 @@ "binop": null, "updateContext": null }, - "start": 368, - "end": 369, + "start": 473, + "end": 474, "loc": { "start": { - "line": 14, + "line": 20, "column": 12 }, "end": { - "line": 14, + "line": 20, "column": 13 } } @@ -1616,15 +3530,15 @@ "postfix": false, "binop": null }, - "start": 370, - "end": 371, + "start": 475, + "end": 476, "loc": { "start": { - "line": 15, + "line": 21, "column": 0 }, "end": { - "line": 15, + "line": 21, "column": 1 } } @@ -1642,19 +3556,127 @@ "binop": null, "updateContext": null }, - "start": 371, - "end": 372, + "start": 476, + "end": 477, "loc": { "start": { - "line": 15, + "line": 21, "column": 1 }, "end": { - "line": 15, + "line": 21, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 479, + "end": 485, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 486, + "end": 493, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "predecessor", + "start": 494, + "end": 505, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 505, + "end": 506, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, { "type": { "label": "eof", @@ -1668,15 +3690,15 @@ "binop": null, "updateContext": null }, - "start": 373, - "end": 373, + "start": 507, + "end": 507, "loc": { "start": { - "line": 16, + "line": 24, "column": 0 }, "end": { - "line": 16, + "line": 24, "column": 0 } } diff --git a/ast/source/family/sibling.js.json b/ast/source/family/sibling.js.json index 117ffc4..022e874 100644 --- a/ast/source/family/sibling.js.json +++ b/ast/source/family/sibling.js.json @@ -1,169 +1,375 @@ { "type": "File", "start": 0, - "end": 370, + "end": 499, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 14, + "line": 20, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 370, + "end": 499, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 14, + "line": 20, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 113, - "end": 369, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 7, + "line": 1, "column": 0 }, "end": { - "line": 13, - "column": 2 + "line": 1, + "column": 28 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 120, - "end": 369, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, "loc": { "start": { - "line": 7, - "column": 7 + "line": 1, + "column": 19 }, "end": { - "line": 13, - "column": 2 + "line": 1, + "column": 27 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 126, - "end": 368, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, "loc": { "start": { - "line": 7, - "column": 13 + "line": 2, + "column": 7 }, "end": { - "line": 13, - "column": 1 - } + "line": 2, + "column": 11 + }, + "identifierName": "Node" }, - "id": { - "type": "Identifier", - "start": 126, - "end": 133, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 20 - }, - "identifierName": "sibling" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 }, - "name": "sibling", - "leadingComments": null + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "Leaf" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 136, - "end": 368, - "loc": { - "start": { - "line": 7, - "column": 23 - }, - "end": { - "line": 13, - "column": 1 - } + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 83, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n ", + "start": 104, + "end": 226, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 227, + "end": 473, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 17, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 233, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 17, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 233, + "end": 240, + "loc": { + "start": { + "line": 11, + "column": 6 }, - "id": { + "end": { + "line": 11, + "column": 13 + }, + "identifierName": "sibling" + }, + "name": "sibling", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 243, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 17, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 126, - "end": 133, + "start": 244, + "end": 248, "loc": { "start": { - "line": 7, - "column": 13 + "line": 11, + "column": 17 }, "end": { - "line": 7, - "column": 20 + "line": 11, + "column": 21 }, - "identifierName": "sibling" + "identifierName": "node" }, - "name": "sibling", - "leadingComments": null + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 253, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 26 + }, + "end": { + "line": 17, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 137, - "end": 141, + "type": "ExpressionStatement", + "start": 256, + "end": 309, "loc": { "start": { - "line": 7, - "column": 24 + "line": 12, + "column": 1 }, "end": { - "line": 7, - "column": 28 - }, - "identifierName": "node" - }, - "name": "node" - } - ], - "body": { - "type": "BlockStatement", - "start": 146, - "end": 368, - "loc": { - "start": { - "line": 7, - "column": 33 + "line": 12, + "column": 54 + } }, - "end": { - "line": 13, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 294, - "end": 366, + "expression": { + "type": "CallExpression", + "start": 256, + "end": 308, "loc": { "start": { "line": 12, @@ -171,27 +377,31 @@ }, "end": { "line": 12, - "column": 73 + "column": 53 } }, - "argument": { - "type": "ConditionalExpression", - "start": 301, - "end": 365, + "callee": { + "type": "Identifier", + "start": 256, + "end": 262, "loc": { "start": { "line": 12, - "column": 8 + "column": 1 }, "end": { "line": 12, - "column": 72 - } + "column": 7 + }, + "identifierName": "assert" }, - "test": { - "type": "BinaryExpression", - "start": 301, - "end": 326, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 263, + "end": 307, "loc": { "start": { "line": 12, @@ -199,13 +409,13 @@ }, "end": { "line": 12, - "column": 33 + "column": 52 } }, "left": { - "type": "Identifier", - "start": 301, - "end": 305, + "type": "BinaryExpression", + "start": 263, + "end": 283, "loc": { "start": { "line": 12, @@ -213,139 +423,205 @@ }, "end": { "line": 12, - "column": 12 + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 263, + "end": 267, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "node" }, - "identifierName": "node" + "name": "node" }, - "name": "node", - "leadingComments": null + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 279, + "end": 283, + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 28 + }, + "identifierName": "Node" + }, + "name": "Node" + } }, - "operator": "===", + "operator": "||", "right": { - "type": "MemberExpression", - "start": 310, - "end": 326, + "type": "BinaryExpression", + "start": 287, + "end": 307, "loc": { "start": { "line": 12, - "column": 17 + "column": 32 }, "end": { "line": 12, - "column": 33 + "column": 52 } }, - "object": { - "type": "MemberExpression", - "start": 310, - "end": 321, + "left": { + "type": "Identifier", + "start": 287, + "end": 291, "loc": { "start": { "line": 12, - "column": 17 + "column": 32 }, "end": { "line": 12, - "column": 28 - } - }, - "object": { - "type": "Identifier", - "start": 310, - "end": 314, - "loc": { - "start": { - "line": 12, - "column": 17 - }, - "end": { - "line": 12, - "column": 21 - }, - "identifierName": "node" + "column": 36 }, - "name": "node" + "identifierName": "node" }, - "property": { - "type": "Identifier", - "start": 315, - "end": 321, - "loc": { - "start": { - "line": 12, - "column": 22 - }, - "end": { - "line": 12, - "column": 28 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false + "name": "node" }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 322, - "end": 326, + "start": 303, + "end": 307, "loc": { "start": { "line": 12, - "column": 29 + "column": 48 }, "end": { "line": 12, - "column": 33 + "column": 52 }, - "identifierName": "left" + "identifierName": "Leaf" }, - "name": "left" - }, - "computed": false + "name": "Leaf" + } + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " We only use this function when node HAS a sibling.", + "start": 311, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 }, - "leadingComments": null + "end": { + "line": 13, + "column": 54 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 366, + "end": 395, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 366, + "end": 394, + "loc": { + "start": { + "line": 14, + "column": 1 }, - "consequent": { - "type": "MemberExpression", - "start": 329, - "end": 346, + "end": { + "line": 14, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 366, + "end": 372, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 373, + "end": 393, "loc": { "start": { - "line": 12, - "column": 36 + "line": 14, + "column": 8 }, "end": { - "line": 12, - "column": 53 + "line": 14, + "column": 28 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 329, - "end": 340, + "start": 373, + "end": 384, "loc": { "start": { - "line": 12, - "column": 36 + "line": 14, + "column": 8 }, "end": { - "line": 12, - "column": 47 + "line": 14, + "column": 19 } }, "object": { "type": "Identifier", - "start": 329, - "end": 333, + "start": 373, + "end": 377, "loc": { "start": { - "line": 12, - "column": 36 + "line": 14, + "column": 8 }, "end": { - "line": 12, - "column": 40 + "line": 14, + "column": 12 }, "identifierName": "node" }, @@ -353,16 +629,16 @@ }, "property": { "type": "Identifier", - "start": 334, - "end": 340, + "start": 378, + "end": 384, "loc": { "start": { - "line": 12, - "column": 41 + "line": 14, + "column": 13 }, "end": { - "line": 12, - "column": 47 + "line": 14, + "column": 19 }, "identifierName": "parent" }, @@ -370,65 +646,145 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 341, - "end": 346, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 389, + "end": 393, "loc": { "start": { - "line": 12, - "column": 48 + "line": 14, + "column": 24 }, "end": { - "line": 12, - "column": 53 - }, - "identifierName": "right" + "line": 14, + "column": 28 + } + } + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " We only use this function when node HAS a sibling.", + "start": 311, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 54 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 398, + "end": 470, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 73 + } + }, + "argument": { + "type": "ConditionalExpression", + "start": 405, + "end": 469, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 72 + } + }, + "test": { + "type": "BinaryExpression", + "start": 405, + "end": 430, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "left": { + "type": "Identifier", + "start": 405, + "end": 409, + "loc": { + "start": { + "line": 16, + "column": 8 }, - "name": "right" + "end": { + "line": 16, + "column": 12 + }, + "identifierName": "node" }, - "computed": false + "name": "node" }, - "alternate": { + "operator": "===", + "right": { "type": "MemberExpression", - "start": 349, - "end": 365, + "start": 414, + "end": 430, "loc": { "start": { - "line": 12, - "column": 56 + "line": 16, + "column": 17 }, "end": { - "line": 12, - "column": 72 + "line": 16, + "column": 33 } }, "object": { "type": "MemberExpression", - "start": 349, - "end": 360, + "start": 414, + "end": 425, "loc": { "start": { - "line": 12, - "column": 56 + "line": 16, + "column": 17 }, "end": { - "line": 12, - "column": 67 + "line": 16, + "column": 28 } }, "object": { "type": "Identifier", - "start": 349, - "end": 353, + "start": 414, + "end": 418, "loc": { "start": { - "line": 12, - "column": 56 + "line": 16, + "column": 17 }, "end": { - "line": 12, - "column": 60 + "line": 16, + "column": 21 }, "identifierName": "node" }, @@ -436,16 +792,16 @@ }, "property": { "type": "Identifier", - "start": 354, - "end": 360, + "start": 419, + "end": 425, "loc": { "start": { - "line": 12, - "column": 61 + "line": 16, + "column": 22 }, "end": { - "line": 12, - "column": 67 + "line": 16, + "column": 28 }, "identifierName": "parent" }, @@ -455,262 +811,1913 @@ }, "property": { "type": "Identifier", - "start": 361, - "end": 365, + "start": 426, + "end": 430, "loc": { "start": { - "line": 12, - "column": 68 + "line": 16, + "column": 29 }, "end": { - "line": 12, - "column": 72 + "line": 16, + "column": 33 }, "identifierName": "left" }, "name": "left" }, "computed": false - }, - "leadingComments": null + } }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Assert((node !== null) && (node.parent !== null));", - "start": 149, - "end": 202, + "consequent": { + "type": "MemberExpression", + "start": 433, + "end": 450, + "loc": { + "start": { + "line": 16, + "column": 36 + }, + "end": { + "line": 16, + "column": 53 + } + }, + "object": { + "type": "MemberExpression", + "start": 433, + "end": 444, "loc": { "start": { - "line": 8, - "column": 1 + "line": 16, + "column": 36 }, "end": { - "line": 8, - "column": 54 + "line": 16, + "column": 47 } - } + }, + "object": { + "type": "Identifier", + "start": 433, + "end": 437, + "loc": { + "start": { + "line": 16, + "column": 36 + }, + "end": { + "line": 16, + "column": 40 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 438, + "end": 444, + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 47 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - { - "type": "CommentLine", - "value": " We only use this function when node HAS a sibling so this case can never", - "start": 204, - "end": 279, + "property": { + "type": "Identifier", + "start": 445, + "end": 450, "loc": { "start": { - "line": 9, - "column": 1 + "line": 16, + "column": 48 }, "end": { - "line": 9, - "column": 76 - } + "line": 16, + "column": 53 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "alternate": { + "type": "MemberExpression", + "start": 453, + "end": 469, + "loc": { + "start": { + "line": 16, + "column": 56 + }, + "end": { + "line": 16, + "column": 72 } }, - { - "type": "CommentLine", - "value": " happen.", - "start": 281, - "end": 291, + "object": { + "type": "MemberExpression", + "start": 453, + "end": 464, "loc": { "start": { - "line": 10, - "column": 1 + "line": 16, + "column": 56 }, "end": { - "line": 10, - "column": 11 + "line": 16, + "column": 67 } - } - } - ] + }, + "object": { + "type": "Identifier", + "start": 453, + "end": 457, + "loc": { + "start": { + "line": 16, + "column": 56 + }, + "end": { + "line": 16, + "column": 60 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 458, + "end": 464, + "loc": { + "start": { + "line": 16, + "column": 61 + }, + "end": { + "line": 16, + "column": 67 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 465, + "end": 469, + "loc": { + "start": { + "line": 16, + "column": 68 + }, + "end": { + "line": 16, + "column": 72 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 112, - "loc": { - "start": { - "line": 1, - "column": 0 + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 475, + "end": 498, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 23 + } + }, + "declaration": { + "type": "Identifier", + "start": 490, + "end": 497, + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 22 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 475, + "end": 498, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 23 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 227, + "end": 473, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 17, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 233, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 6 }, "end": { - "line": 6, - "column": 3 + "line": 17, + "column": 1 } - } - } - ], - "trailingComments": [] + }, + "id": { + "type": "Identifier", + "start": 233, + "end": 240, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 13 + }, + "identifierName": "sibling" + }, + "name": "sibling", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 243, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 17, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 233, + "end": 240, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 13 + }, + "identifierName": "sibling" + }, + "name": "sibling", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 244, + "end": 248, + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 21 + }, + "identifierName": "node" + }, + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 253, + "end": 472, + "loc": { + "start": { + "line": 11, + "column": 26 + }, + "end": { + "line": 17, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 256, + "end": 309, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 54 + } + }, + "expression": { + "type": "CallExpression", + "start": 256, + "end": 308, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 53 + } + }, + "callee": { + "type": "Identifier", + "start": 256, + "end": 262, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 263, + "end": 307, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 52 + } + }, + "left": { + "type": "BinaryExpression", + "start": 263, + "end": 283, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 263, + "end": 267, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 279, + "end": 283, + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 28 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 287, + "end": 307, + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 12, + "column": 52 + } + }, + "left": { + "type": "Identifier", + "start": 287, + "end": 291, + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 12, + "column": 36 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 303, + "end": 307, + "loc": { + "start": { + "line": 12, + "column": 48 + }, + "end": { + "line": 12, + "column": 52 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " We only use this function when node HAS a sibling.", + "start": 311, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 54 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 366, + "end": 395, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 366, + "end": 394, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 366, + "end": 372, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 373, + "end": 393, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 28 + } + }, + "left": { + "type": "MemberExpression", + "start": 373, + "end": 384, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 373, + "end": 377, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 378, + "end": 384, + "loc": { + "start": { + "line": 14, + "column": 13 + }, + "end": { + "line": 14, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 389, + "end": 393, + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 28 + } + } + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " We only use this function when node HAS a sibling.", + "start": 311, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 54 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 398, + "end": 470, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 73 + } + }, + "argument": { + "type": "ConditionalExpression", + "start": 405, + "end": 469, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 72 + } + }, + "test": { + "type": "BinaryExpression", + "start": 405, + "end": 430, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "left": { + "type": "Identifier", + "start": 405, + "end": 409, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 414, + "end": 430, + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 33 + } + }, + "object": { + "type": "MemberExpression", + "start": 414, + "end": 425, + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 414, + "end": 418, + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 21 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 419, + "end": 425, + "loc": { + "start": { + "line": 16, + "column": 22 + }, + "end": { + "line": 16, + "column": 28 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 426, + "end": 430, + "loc": { + "start": { + "line": 16, + "column": 29 + }, + "end": { + "line": 16, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "MemberExpression", + "start": 433, + "end": 450, + "loc": { + "start": { + "line": 16, + "column": 36 + }, + "end": { + "line": 16, + "column": 53 + } + }, + "object": { + "type": "MemberExpression", + "start": 433, + "end": 444, + "loc": { + "start": { + "line": 16, + "column": 36 + }, + "end": { + "line": 16, + "column": 47 + } + }, + "object": { + "type": "Identifier", + "start": 433, + "end": 437, + "loc": { + "start": { + "line": 16, + "column": 36 + }, + "end": { + "line": 16, + "column": 40 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 438, + "end": 444, + "loc": { + "start": { + "line": 16, + "column": 41 + }, + "end": { + "line": 16, + "column": 47 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 445, + "end": 450, + "loc": { + "start": { + "line": 16, + "column": 48 + }, + "end": { + "line": 16, + "column": 53 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "alternate": { + "type": "MemberExpression", + "start": 453, + "end": 469, + "loc": { + "start": { + "line": 16, + "column": 56 + }, + "end": { + "line": 16, + "column": 72 + } + }, + "object": { + "type": "MemberExpression", + "start": 453, + "end": 464, + "loc": { + "start": { + "line": 16, + "column": 56 + }, + "end": { + "line": 16, + "column": 67 + } + }, + "object": { + "type": "Identifier", + "start": 453, + "end": 457, + "loc": { + "start": { + "line": 16, + "column": 56 + }, + "end": { + "line": 16, + "column": 60 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 458, + "end": 464, + "loc": { + "start": { + "line": 16, + "column": 61 + }, + "end": { + "line": 16, + "column": 67 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 465, + "end": 469, + "loc": { + "start": { + "line": 16, + "column": 68 + }, + "end": { + "line": 16, + "column": 72 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n ", + "start": 104, + "end": 226, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n ", + "start": 104, + "end": 226, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " We only use this function when node HAS a sibling.", + "start": 311, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 54 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 78, + "end": 82, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 83, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n ", + "start": 104, + "end": 226, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 227, + "end": 232, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 233, + "end": 240, + "loc": { + "start": { + "line": 11, + "column": 6 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 241, + "end": 242, + "loc": { + "start": { + "line": 11, + "column": 14 + }, + "end": { + "line": 11, + "column": 15 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 243, + "end": 244, + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 244, + "end": 248, + "loc": { + "start": { + "line": 11, + "column": 17 + }, + "end": { + "line": 11, + "column": 21 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 248, + "end": 249, + "loc": { + "start": { + "line": 11, + "column": 21 + }, + "end": { + "line": 11, + "column": 22 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 250, + "end": 252, + "loc": { + "start": { + "line": 11, + "column": 23 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 112, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } - } - ] + "end": { + "line": 11, + "column": 25 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 112, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 253, + "end": 254, "loc": { "start": { - "line": 1, - "column": 0 + "line": 11, + "column": 26 }, "end": { - "line": 6, - "column": 3 + "line": 11, + "column": 27 } } }, { - "type": "CommentLine", - "value": " Assert((node !== null) && (node.parent !== null));", - "start": 149, - "end": 202, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 256, + "end": 262, "loc": { "start": { - "line": 8, + "line": 12, "column": 1 }, "end": { - "line": 8, - "column": 54 + "line": 12, + "column": 7 } } }, { - "type": "CommentLine", - "value": " We only use this function when node HAS a sibling so this case can never", - "start": 204, - "end": 279, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 262, + "end": 263, "loc": { "start": { - "line": 9, - "column": 1 + "line": 12, + "column": 7 }, "end": { - "line": 9, - "column": 76 + "line": 12, + "column": 8 } } }, { - "type": "CommentLine", - "value": " happen.", - "start": 281, - "end": 291, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 263, + "end": 267, "loc": { "start": { - "line": 10, - "column": 1 + "line": 12, + "column": 8 }, "end": { - "line": 10, - "column": 11 + "line": 12, + "column": 12 } } - } - ], - "tokens": [ + }, { - "type": "CommentBlock", - "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 0, - "end": 112, + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 268, + "end": 278, "loc": { "start": { - "line": 1, - "column": 0 + "line": 12, + "column": 13 }, "end": { - "line": 6, - "column": 3 + "line": 12, + "column": 23 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 279, + "end": 283, + "loc": { + "start": { + "line": 12, + "column": 24 + }, + "end": { + "line": 12, + "column": 28 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "value": "export", - "start": 113, - "end": 119, + "value": "||", + "start": 284, + "end": 286, "loc": { "start": { - "line": 7, - "column": 0 + "line": 12, + "column": 29 }, "end": { - "line": 7, - "column": 6 + "line": 12, + "column": 31 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 287, + "end": 291, + "loc": { + "start": { + "line": 12, + "column": 32 + }, + "end": { + "line": 12, + "column": 36 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "const", - "start": 120, - "end": 125, + "value": "instanceof", + "start": 292, + "end": 302, "loc": { "start": { - "line": 7, - "column": 7 + "line": 12, + "column": 37 }, "end": { - "line": 7, - "column": 12 + "line": 12, + "column": 47 } } }, @@ -726,44 +2733,110 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 126, - "end": 133, + "value": "Leaf", + "start": 303, + "end": 307, "loc": { "start": { - "line": 7, - "column": 13 + "line": 12, + "column": 48 }, "end": { - "line": 7, - "column": 20 + "line": 12, + "column": 52 } } }, { "type": { - "label": "=", + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 307, + "end": 308, + "loc": { + "start": { + "line": 12, + "column": 52 + }, + "end": { + "line": 12, + "column": 53 + } + } + }, + { + "type": { + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 308, + "end": 309, + "loc": { + "start": { + "line": 12, + "column": 53 + }, + "end": { + "line": 12, + "column": 54 + } + } + }, + { + "type": "CommentLine", + "value": " We only use this function when node HAS a sibling.", + "start": 311, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 54 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 134, - "end": 135, + "value": "assert", + "start": 366, + "end": 372, "loc": { "start": { - "line": 7, - "column": 21 + "line": 14, + "column": 1 }, "end": { - "line": 7, - "column": 22 + "line": 14, + "column": 7 } } }, @@ -779,16 +2852,16 @@ "postfix": false, "binop": null }, - "start": 136, - "end": 137, + "start": 372, + "end": 373, "loc": { "start": { - "line": 7, - "column": 23 + "line": 14, + "column": 7 }, "end": { - "line": 7, - "column": 24 + "line": 14, + "column": 8 } } }, @@ -805,22 +2878,22 @@ "binop": null }, "value": "node", - "start": 137, - "end": 141, + "start": 373, + "end": 377, "loc": { "start": { - "line": 7, - "column": 24 + "line": 14, + "column": 8 }, "end": { - "line": 7, - "column": 28 + "line": 14, + "column": 12 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -828,117 +2901,151 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 141, - "end": 142, + "start": 377, + "end": 378, "loc": { "start": { - "line": 7, - "column": 28 + "line": 14, + "column": 12 }, "end": { - "line": 7, - "column": 29 + "line": 14, + "column": 13 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 143, - "end": 145, + "value": "parent", + "start": 378, + "end": 384, "loc": { "start": { - "line": 7, - "column": 30 + "line": 14, + "column": 13 }, "end": { - "line": 7, - "column": 32 + "line": 14, + "column": 19 } } }, { "type": { - "label": "{", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 146, - "end": 147, + "value": "!==", + "start": 385, + "end": 388, "loc": { "start": { - "line": 7, - "column": 33 + "line": 14, + "column": 20 }, "end": { - "line": 7, - "column": 34 + "line": 14, + "column": 23 } } }, { - "type": "CommentLine", - "value": " Assert((node !== null) && (node.parent !== null));", - "start": 149, - "end": 202, + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 389, + "end": 393, "loc": { "start": { - "line": 8, - "column": 1 + "line": 14, + "column": 24 }, "end": { - "line": 8, - "column": 54 + "line": 14, + "column": 28 } } }, { - "type": "CommentLine", - "value": " We only use this function when node HAS a sibling so this case can never", - "start": 204, - "end": 279, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 393, + "end": 394, "loc": { "start": { - "line": 9, - "column": 1 + "line": 14, + "column": 28 }, "end": { - "line": 9, - "column": 76 + "line": 14, + "column": 29 } } }, { - "type": "CommentLine", - "value": " happen.", - "start": 281, - "end": 291, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 394, + "end": 395, "loc": { "start": { - "line": 10, - "column": 1 + "line": 14, + "column": 29 }, "end": { - "line": 10, - "column": 11 + "line": 14, + "column": 30 } } }, @@ -957,15 +3064,15 @@ "updateContext": null }, "value": "return", - "start": 294, - "end": 300, + "start": 398, + "end": 404, "loc": { "start": { - "line": 12, + "line": 16, "column": 1 }, "end": { - "line": 12, + "line": 16, "column": 7 } } @@ -983,15 +3090,15 @@ "binop": null }, "value": "node", - "start": 301, - "end": 305, + "start": 405, + "end": 409, "loc": { "start": { - "line": 12, + "line": 16, "column": 8 }, "end": { - "line": 12, + "line": 16, "column": 12 } } @@ -1010,15 +3117,15 @@ "updateContext": null }, "value": "===", - "start": 306, - "end": 309, + "start": 410, + "end": 413, "loc": { "start": { - "line": 12, + "line": 16, "column": 13 }, "end": { - "line": 12, + "line": 16, "column": 16 } } @@ -1036,15 +3143,15 @@ "binop": null }, "value": "node", - "start": 310, - "end": 314, + "start": 414, + "end": 418, "loc": { "start": { - "line": 12, + "line": 16, "column": 17 }, "end": { - "line": 12, + "line": 16, "column": 21 } } @@ -1062,15 +3169,15 @@ "binop": null, "updateContext": null }, - "start": 314, - "end": 315, + "start": 418, + "end": 419, "loc": { "start": { - "line": 12, + "line": 16, "column": 21 }, "end": { - "line": 12, + "line": 16, "column": 22 } } @@ -1088,15 +3195,15 @@ "binop": null }, "value": "parent", - "start": 315, - "end": 321, + "start": 419, + "end": 425, "loc": { "start": { - "line": 12, + "line": 16, "column": 22 }, "end": { - "line": 12, + "line": 16, "column": 28 } } @@ -1114,15 +3221,15 @@ "binop": null, "updateContext": null }, - "start": 321, - "end": 322, + "start": 425, + "end": 426, "loc": { "start": { - "line": 12, + "line": 16, "column": 28 }, "end": { - "line": 12, + "line": 16, "column": 29 } } @@ -1140,15 +3247,15 @@ "binop": null }, "value": "left", - "start": 322, - "end": 326, + "start": 426, + "end": 430, "loc": { "start": { - "line": 12, + "line": 16, "column": 29 }, "end": { - "line": 12, + "line": 16, "column": 33 } } @@ -1166,15 +3273,15 @@ "binop": null, "updateContext": null }, - "start": 327, - "end": 328, + "start": 431, + "end": 432, "loc": { "start": { - "line": 12, + "line": 16, "column": 34 }, "end": { - "line": 12, + "line": 16, "column": 35 } } @@ -1192,15 +3299,15 @@ "binop": null }, "value": "node", - "start": 329, - "end": 333, + "start": 433, + "end": 437, "loc": { "start": { - "line": 12, + "line": 16, "column": 36 }, "end": { - "line": 12, + "line": 16, "column": 40 } } @@ -1218,15 +3325,15 @@ "binop": null, "updateContext": null }, - "start": 333, - "end": 334, + "start": 437, + "end": 438, "loc": { "start": { - "line": 12, + "line": 16, "column": 40 }, "end": { - "line": 12, + "line": 16, "column": 41 } } @@ -1244,15 +3351,15 @@ "binop": null }, "value": "parent", - "start": 334, - "end": 340, + "start": 438, + "end": 444, "loc": { "start": { - "line": 12, + "line": 16, "column": 41 }, "end": { - "line": 12, + "line": 16, "column": 47 } } @@ -1270,15 +3377,15 @@ "binop": null, "updateContext": null }, - "start": 340, - "end": 341, + "start": 444, + "end": 445, "loc": { "start": { - "line": 12, + "line": 16, "column": 47 }, "end": { - "line": 12, + "line": 16, "column": 48 } } @@ -1296,15 +3403,15 @@ "binop": null }, "value": "right", - "start": 341, - "end": 346, + "start": 445, + "end": 450, "loc": { "start": { - "line": 12, + "line": 16, "column": 48 }, "end": { - "line": 12, + "line": 16, "column": 53 } } @@ -1322,15 +3429,15 @@ "binop": null, "updateContext": null }, - "start": 347, - "end": 348, + "start": 451, + "end": 452, "loc": { "start": { - "line": 12, + "line": 16, "column": 54 }, "end": { - "line": 12, + "line": 16, "column": 55 } } @@ -1348,15 +3455,15 @@ "binop": null }, "value": "node", - "start": 349, - "end": 353, + "start": 453, + "end": 457, "loc": { "start": { - "line": 12, + "line": 16, "column": 56 }, "end": { - "line": 12, + "line": 16, "column": 60 } } @@ -1374,15 +3481,15 @@ "binop": null, "updateContext": null }, - "start": 353, - "end": 354, + "start": 457, + "end": 458, "loc": { "start": { - "line": 12, + "line": 16, "column": 60 }, "end": { - "line": 12, + "line": 16, "column": 61 } } @@ -1400,15 +3507,15 @@ "binop": null }, "value": "parent", - "start": 354, - "end": 360, + "start": 458, + "end": 464, "loc": { "start": { - "line": 12, + "line": 16, "column": 61 }, "end": { - "line": 12, + "line": 16, "column": 67 } } @@ -1426,15 +3533,15 @@ "binop": null, "updateContext": null }, - "start": 360, - "end": 361, + "start": 464, + "end": 465, "loc": { "start": { - "line": 12, + "line": 16, "column": 67 }, "end": { - "line": 12, + "line": 16, "column": 68 } } @@ -1452,15 +3559,15 @@ "binop": null }, "value": "left", - "start": 361, - "end": 365, + "start": 465, + "end": 469, "loc": { "start": { - "line": 12, + "line": 16, "column": 68 }, "end": { - "line": 12, + "line": 16, "column": 72 } } @@ -1478,15 +3585,15 @@ "binop": null, "updateContext": null }, - "start": 365, - "end": 366, + "start": 469, + "end": 470, "loc": { "start": { - "line": 12, + "line": 16, "column": 72 }, "end": { - "line": 12, + "line": 16, "column": 73 } } @@ -1503,15 +3610,15 @@ "postfix": false, "binop": null }, - "start": 367, - "end": 368, + "start": 471, + "end": 472, "loc": { "start": { - "line": 13, + "line": 17, "column": 0 }, "end": { - "line": 13, + "line": 17, "column": 1 } } @@ -1529,19 +3636,127 @@ "binop": null, "updateContext": null }, - "start": 368, - "end": 369, + "start": 472, + "end": 473, "loc": { "start": { - "line": 13, + "line": 17, "column": 1 }, "end": { - "line": 13, + "line": 17, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 475, + "end": 481, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 482, + "end": 489, + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 490, + "end": 497, + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 497, + "end": 498, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, { "type": { "label": "eof", @@ -1555,15 +3770,15 @@ "binop": null, "updateContext": null }, - "start": 370, - "end": 370, + "start": 499, + "end": 499, "loc": { "start": { - "line": 14, + "line": 20, "column": 0 }, "end": { - "line": 14, + "line": 20, "column": 0 } } diff --git a/ast/source/family/uncle.js.json b/ast/source/family/uncle.js.json index cc5fb25..a18e99c 100644 --- a/ast/source/family/uncle.js.json +++ b/ast/source/family/uncle.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 436, + "end": 559, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 17, + "line": 23, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 436, + "end": 559, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 17, + "line": 23, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 45, + "end": 28, "loc": { "start": { "line": 1, @@ -39,53 +39,243 @@ }, "end": { "line": 1, - "column": 45 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, - "end": 19, + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 19 + "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, - "end": 19, + "start": 7, + "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 19 + "column": 13 }, - "identifierName": "grandparent" + "identifierName": "assert" }, - "name": "grandparent" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 19, + "start": 36, + "end": 40, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 19 + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 83, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Leaf.js", + "raw": "'../types/Leaf.js'" + }, + "value": "../types/Leaf.js" + } + }, + { + "type": "ImportDeclaration", + "start": 103, + "end": 146, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 43 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 110, + "end": 121, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "local": { + "type": "Identifier", + "start": 110, + "end": 121, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 18 }, "identifierName": "grandparent" }, @@ -95,16 +285,16 @@ ], "source": { "type": "StringLiteral", - "start": 26, - "end": 44, + "start": 127, + "end": 145, "loc": { "start": { - "line": 1, - "column": 26 + "line": 4, + "column": 24 }, "end": { - "line": 1, - "column": 44 + "line": 4, + "column": 42 } }, "extra": { @@ -116,16 +306,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 47, - "end": 204, + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n ", + "start": 148, + "end": 310, "loc": { "start": { - "line": 3, + "line": 6, "column": 0 }, "end": { - "line": 9, + "line": 12, "column": 3 } } @@ -133,573 +323,603 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 205, - "end": 435, + "type": "Identifier", + "start": 311, + "end": 535, "loc": { "start": { - "line": 10, + "line": 13, "column": 0 }, "end": { - "line": 16, + "line": 20, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 212, - "end": 435, - "loc": { - "start": { - "line": 10, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 317, + "end": 534, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 20, + "column": 1 + } }, - "end": { - "line": 16, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 218, - "end": 434, + "id": { + "type": "Identifier", + "start": 317, + "end": 322, "loc": { "start": { - "line": 10, - "column": 13 + "line": 13, + "column": 6 }, "end": { - "line": 16, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 218, - "end": 223, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 18 - }, - "identifierName": "uncle" + "line": 13, + "column": 11 }, - "name": "uncle", - "leadingComments": null + "identifierName": "uncle" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 226, - "end": 434, - "loc": { - "start": { - "line": 10, - "column": 21 - }, - "end": { - "line": 16, - "column": 1 - } + "name": "uncle", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 325, + "end": 534, + "loc": { + "start": { + "line": 13, + "column": 14 }, - "id": { + "end": { + "line": 20, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 218, - "end": 223, + "start": 326, + "end": 330, "loc": { "start": { - "line": 10, - "column": 13 + "line": 13, + "column": 15 }, "end": { - "line": 10, - "column": 18 + "line": 13, + "column": 19 }, - "identifierName": "uncle" + "identifierName": "node" }, - "name": "uncle", - "leadingComments": null + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 335, + "end": 534, + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 20, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 227, - "end": 231, + "type": "ExpressionStatement", + "start": 338, + "end": 367, "loc": { "start": { - "line": 10, - "column": 22 + "line": 14, + "column": 1 }, "end": { - "line": 10, - "column": 26 - }, - "identifierName": "node" - }, - "name": "node" - } - ], - "body": { - "type": "BlockStatement", - "start": 236, - "end": 434, - "loc": { - "start": { - "line": 10, - "column": 31 + "line": 14, + "column": 30 + } }, - "end": { - "line": 16, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 239, - "end": 267, + "expression": { + "type": "CallExpression", + "start": 338, + "end": 366, "loc": { "start": { - "line": 11, + "line": 14, "column": 1 }, "end": { - "line": 11, + "line": 14, "column": 29 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 338, + "end": 344, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 245, - "end": 266, + "type": "BinaryExpression", + "start": 345, + "end": 365, "loc": { "start": { - "line": 11, - "column": 7 + "line": 14, + "column": 8 }, "end": { - "line": 11, + "line": 14, "column": 28 } }, - "id": { + "left": { "type": "Identifier", - "start": 245, - "end": 246, + "start": 345, + "end": 349, "loc": { "start": { - "line": 11, - "column": 7 + "line": 14, + "column": 8 }, "end": { - "line": 11, - "column": 8 + "line": 14, + "column": 12 }, - "identifierName": "g" + "identifierName": "node" }, - "name": "g" + "name": "node" }, - "init": { - "type": "CallExpression", - "start": 249, - "end": 266, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 361, + "end": 365, "loc": { "start": { - "line": 11, - "column": 11 + "line": 14, + "column": 24 }, "end": { - "line": 11, + "line": 14, "column": 28 - } - }, - "callee": { - "type": "Identifier", - "start": 249, - "end": 260, - "loc": { - "start": { - "line": 11, - "column": 11 - }, - "end": { - "line": 11, - "column": 22 - }, - "identifierName": "grandparent" }, - "name": "grandparent" + "identifierName": "Node" }, - "arguments": [ - { - "type": "Identifier", - "start": 261, - "end": 265, - "loc": { - "start": { - "line": 11, - "column": 23 - }, - "end": { - "line": 11, - "column": 27 - }, - "identifierName": "node" - }, - "name": "node" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentLine", - "value": " Assert( g !== null ) ;", - "start": 269, - "end": 294, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - { - "type": "CommentLine", - "value": " this can never happen", - "start": 296, - "end": 320, - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 25 - } + "name": "Node" } } ] - }, - { - "type": "IfStatement", - "start": 322, - "end": 391, - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 70 - } + } + }, + { + "type": "VariableDeclaration", + "start": 369, + "end": 397, + "loc": { + "start": { + "line": 15, + "column": 1 }, - "test": { - "type": "BinaryExpression", - "start": 326, - "end": 348, + "end": { + "line": 15, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 375, + "end": 396, "loc": { "start": { - "line": 14, - "column": 5 + "line": 15, + "column": 7 }, "end": { - "line": 14, - "column": 27 + "line": 15, + "column": 28 } }, - "left": { - "type": "MemberExpression", - "start": 326, - "end": 337, + "id": { + "type": "Identifier", + "start": 375, + "end": 376, "loc": { "start": { - "line": 14, - "column": 5 + "line": 15, + "column": 7 }, "end": { - "line": 14, - "column": 16 + "line": 15, + "column": 8 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 379, + "end": 396, + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 28 } }, - "object": { + "callee": { "type": "Identifier", - "start": 326, - "end": 330, + "start": 379, + "end": 390, "loc": { "start": { - "line": 14, - "column": 5 + "line": 15, + "column": 11 }, "end": { - "line": 14, - "column": 9 + "line": 15, + "column": 22 }, - "identifierName": "node" + "identifierName": "grandparent" }, - "name": "node", - "leadingComments": null + "name": "grandparent" }, - "property": { - "type": "Identifier", - "start": 331, - "end": 337, - "loc": { - "start": { - "line": 14, - "column": 10 - }, - "end": { - "line": 14, - "column": 16 + "arguments": [ + { + "type": "Identifier", + "start": 391, + "end": 395, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 27 + }, + "identifierName": "node" }, - "identifierName": "parent" - }, - "name": "parent" + "name": "node" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 399, + "end": 418, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 399, + "end": 417, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 399, + "end": 405, + "loc": { + "start": { + "line": 16, + "column": 1 }, - "computed": false, - "leadingComments": null + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 342, - "end": 348, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 406, + "end": 416, "loc": { "start": { - "line": 14, - "column": 21 + "line": 16, + "column": 8 }, "end": { - "line": 14, - "column": 27 + "line": 16, + "column": 18 } }, - "object": { + "left": { "type": "Identifier", - "start": 342, - "end": 343, + "start": 406, + "end": 407, "loc": { "start": { - "line": 14, - "column": 21 + "line": 16, + "column": 8 }, "end": { - "line": 14, - "column": 22 + "line": 16, + "column": 9 }, "identifierName": "g" }, "name": "g" }, - "property": { - "type": "Identifier", - "start": 344, - "end": 348, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 412, + "end": 416, "loc": { "start": { - "line": 14, - "column": 23 + "line": 16, + "column": 14 }, "end": { - "line": 14, - "column": 27 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "leadingComments": null + "line": 16, + "column": 18 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 420, + "end": 472, + "loc": { + "start": { + "line": 17, + "column": 1 }, - "consequent": { - "type": "ReturnStatement", - "start": 350, - "end": 391, + "end": { + "line": 17, + "column": 53 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 426, + "end": 471, "loc": { "start": { - "line": 14, - "column": 29 + "line": 17, + "column": 7 }, "end": { - "line": 14, - "column": 70 + "line": 17, + "column": 52 } }, - "argument": { + "id": { + "type": "Identifier", + "start": 426, + "end": 427, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + }, + "identifierName": "u" + }, + "name": "u" + }, + "init": { "type": "ConditionalExpression", - "start": 357, - "end": 390, + "start": 430, + "end": 471, "loc": { "start": { - "line": 14, - "column": 36 + "line": 17, + "column": 11 }, "end": { - "line": 14, - "column": 69 + "line": 17, + "column": 52 } }, "test": { - "type": "CallExpression", - "start": 357, - "end": 373, + "type": "BinaryExpression", + "start": 430, + "end": 452, "loc": { "start": { - "line": 14, - "column": 36 + "line": 17, + "column": 11 }, "end": { - "line": 14, - "column": 52 + "line": 17, + "column": 33 } }, - "callee": { + "left": { "type": "MemberExpression", - "start": 357, - "end": 371, + "start": 430, + "end": 441, "loc": { "start": { - "line": 14, - "column": 36 + "line": 17, + "column": 11 }, "end": { - "line": 14, - "column": 50 + "line": 17, + "column": 22 } }, "object": { - "type": "MemberExpression", - "start": 357, - "end": 364, + "type": "Identifier", + "start": 430, + "end": 434, "loc": { "start": { - "line": 14, - "column": 36 + "line": 17, + "column": 11 }, "end": { - "line": 14, - "column": 43 - } + "line": 17, + "column": 15 + }, + "identifierName": "node" }, - "object": { - "type": "Identifier", - "start": 357, - "end": 358, - "loc": { - "start": { - "line": 14, - "column": 36 - }, - "end": { - "line": 14, - "column": 37 - }, - "identifierName": "g" + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 435, + "end": 441, + "loc": { + "start": { + "line": 17, + "column": 16 }, - "name": "g" + "end": { + "line": 17, + "column": 22 + }, + "identifierName": "parent" }, - "property": { - "type": "Identifier", - "start": 359, - "end": 364, - "loc": { - "start": { - "line": 14, - "column": 38 - }, - "end": { - "line": 14, - "column": 43 - }, - "identifierName": "right" + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 446, + "end": 452, + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 446, + "end": 447, + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 28 }, - "name": "right" + "identifierName": "g" }, - "computed": false + "name": "g" }, "property": { "type": "Identifier", - "start": 365, - "end": 371, + "start": 448, + "end": 452, "loc": { "start": { - "line": 14, - "column": 44 + "line": 17, + "column": 29 }, "end": { - "line": 14, - "column": 50 + "line": 17, + "column": 33 }, - "identifierName": "isLeaf" + "identifierName": "left" }, - "name": "isLeaf" + "name": "left" }, "computed": false - }, - "arguments": [] - }, - "consequent": { - "type": "NullLiteral", - "start": 376, - "end": 380, - "loc": { - "start": { - "line": 14, - "column": 55 - }, - "end": { - "line": 14, - "column": 59 - } } }, - "alternate": { + "consequent": { "type": "MemberExpression", - "start": 383, - "end": 390, + "start": 455, + "end": 462, "loc": { "start": { - "line": 14, - "column": 62 + "line": 17, + "column": 36 }, "end": { - "line": 14, - "column": 69 + "line": 17, + "column": 43 } }, "object": { "type": "Identifier", - "start": 383, - "end": 384, + "start": 455, + "end": 456, "loc": { "start": { - "line": 14, - "column": 62 + "line": 17, + "column": 36 }, "end": { - "line": 14, - "column": 63 + "line": 17, + "column": 37 }, "identifierName": "g" }, @@ -707,356 +927,1677 @@ }, "property": { "type": "Identifier", - "start": 385, - "end": 390, + "start": 457, + "end": 462, "loc": { "start": { - "line": 14, - "column": 64 + "line": 17, + "column": 38 }, "end": { - "line": 14, - "column": 69 + "line": 17, + "column": 43 }, "identifierName": "right" }, "name": "right" }, "computed": false - } - } - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Assert( g !== null ) ;", - "start": 269, - "end": 294, - "loc": { - "start": { - "line": 12, - "column": 1 + }, + "alternate": { + "type": "MemberExpression", + "start": 465, + "end": 471, + "loc": { + "start": { + "line": 17, + "column": 46 + }, + "end": { + "line": 17, + "column": 52 + } }, - "end": { - "line": 12, - "column": 26 - } - } - }, - { - "type": "CommentLine", - "value": " this can never happen", - "start": 296, - "end": 320, - "loc": { - "start": { - "line": 13, - "column": 1 + "object": { + "type": "Identifier", + "start": 465, + "end": 466, + "loc": { + "start": { + "line": 17, + "column": 46 + }, + "end": { + "line": 17, + "column": 47 + }, + "identifierName": "g" + }, + "name": "g" }, - "end": { - "line": 13, - "column": 25 - } + "property": { + "type": "Identifier", + "start": 467, + "end": 471, + "loc": { + "start": { + "line": 17, + "column": 48 + }, + "end": { + "line": 17, + "column": 52 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false } } - ] + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 474, + "end": 521, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 48 + } }, - { - "type": "ReturnStatement", - "start": 393, - "end": 432, + "expression": { + "type": "CallExpression", + "start": 474, + "end": 520, "loc": { "start": { - "line": 15, + "line": 18, "column": 1 }, "end": { - "line": 15, - "column": 40 + "line": 18, + "column": 47 } }, - "argument": { - "type": "ConditionalExpression", - "start": 400, - "end": 431, + "callee": { + "type": "Identifier", + "start": 474, + "end": 480, "loc": { "start": { - "line": 15, - "column": 8 + "line": 18, + "column": 1 }, "end": { - "line": 15, - "column": 39 - } + "line": 18, + "column": 7 + }, + "identifierName": "assert" }, - "test": { - "type": "CallExpression", - "start": 400, - "end": 415, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 481, + "end": 519, "loc": { "start": { - "line": 15, + "line": 18, "column": 8 }, "end": { - "line": 15, - "column": 23 + "line": 18, + "column": 46 } }, - "callee": { - "type": "MemberExpression", - "start": 400, - "end": 413, + "left": { + "type": "BinaryExpression", + "start": 481, + "end": 498, "loc": { "start": { - "line": 15, + "line": 18, "column": 8 }, "end": { - "line": 15, - "column": 21 + "line": 18, + "column": 25 } }, - "object": { - "type": "MemberExpression", - "start": 400, - "end": 406, + "left": { + "type": "Identifier", + "start": 481, + "end": 482, "loc": { "start": { - "line": 15, + "line": 18, "column": 8 }, "end": { - "line": 15, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 400, - "end": 401, - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 9 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 402, - "end": 406, - "loc": { - "start": { - "line": 15, - "column": 10 - }, - "end": { - "line": 15, - "column": 14 - }, - "identifierName": "left" + "line": 18, + "column": 9 }, - "name": "left" + "identifierName": "u" }, - "computed": false + "name": "u" }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 407, - "end": 413, + "start": 494, + "end": 498, "loc": { "start": { - "line": 15, - "column": 15 + "line": 18, + "column": 21 }, "end": { - "line": 15, - "column": 21 + "line": 18, + "column": 25 }, - "identifierName": "isLeaf" + "identifierName": "Node" }, - "name": "isLeaf" - }, - "computed": false - }, - "arguments": [] - }, - "consequent": { - "type": "NullLiteral", - "start": 418, - "end": 422, - "loc": { - "start": { - "line": 15, - "column": 26 - }, - "end": { - "line": 15, - "column": 30 - } - } - }, - "alternate": { - "type": "MemberExpression", - "start": 425, - "end": 431, - "loc": { - "start": { - "line": 15, - "column": 33 - }, - "end": { - "line": 15, - "column": 39 + "name": "Node" } }, - "object": { - "type": "Identifier", - "start": 425, - "end": 426, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 502, + "end": 519, "loc": { "start": { - "line": 15, - "column": 33 + "line": 18, + "column": 29 }, "end": { - "line": 15, - "column": 34 - }, - "identifierName": "g" + "line": 18, + "column": 46 + } }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 427, - "end": 431, - "loc": { - "start": { - "line": 15, - "column": 35 - }, - "end": { - "line": 15, - "column": 39 + "left": { + "type": "Identifier", + "start": 502, + "end": 503, + "loc": { + "start": { + "line": 18, + "column": 29 + }, + "end": { + "line": 18, + "column": 30 + }, + "identifierName": "u" }, - "identifierName": "left" + "name": "u" }, - "name": "left" - }, - "computed": false + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 515, + "end": 519, + "loc": { + "start": { + "line": 18, + "column": 42 + }, + "end": { + "line": 18, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } } + ] + } + }, + { + "type": "ReturnStatement", + "start": 523, + "end": 532, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 10 } + }, + "argument": { + "type": "Identifier", + "start": 530, + "end": 531, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 9 + }, + "identifierName": "u" + }, + "name": "u" } - ], - "directives": [] - } - }, - "leadingComments": null + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 537, + "end": 558, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 21 + } + }, + "declaration": { + "type": "Identifier", + "start": 552, + "end": 557, + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 20 + }, + "identifierName": "uncle" + }, + "name": "uncle" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 537, + "end": 558, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 21 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 311, + "end": 535, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 20, + "column": 2 } - ], - "kind": "const", - "leadingComments": [ + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 47, - "end": 204, + "type": "VariableDeclarator", + "start": 317, + "end": 534, "loc": { "start": { - "line": 3, - "column": 0 + "line": 13, + "column": 6 }, "end": { - "line": 9, - "column": 3 + "line": 20, + "column": 1 } - } - } - ], - "trailingComments": [] + }, + "id": { + "type": "Identifier", + "start": 317, + "end": 322, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 11 + }, + "identifierName": "uncle" + }, + "name": "uncle", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 325, + "end": 534, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 317, + "end": 322, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 11 + }, + "identifierName": "uncle" + }, + "name": "uncle", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 326, + "end": 330, + "loc": { + "start": { + "line": 13, + "column": 15 + }, + "end": { + "line": 13, + "column": 19 + }, + "identifierName": "node" + }, + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 335, + "end": 534, + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 338, + "end": 367, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 338, + "end": 366, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 338, + "end": 344, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 345, + "end": 365, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 345, + "end": 349, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 361, + "end": 365, + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 28 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 369, + "end": 397, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 29 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 375, + "end": 396, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "id": { + "type": "Identifier", + "start": 375, + "end": 376, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 379, + "end": 396, + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "callee": { + "type": "Identifier", + "start": 379, + "end": 390, + "loc": { + "start": { + "line": 15, + "column": 11 + }, + "end": { + "line": 15, + "column": 22 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 391, + "end": 395, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 27 + }, + "identifierName": "node" + }, + "name": "node" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 399, + "end": 418, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 399, + "end": 417, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 399, + "end": 405, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 406, + "end": 416, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 406, + "end": 407, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "g" + }, + "name": "g" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 412, + "end": 416, + "loc": { + "start": { + "line": 16, + "column": 14 + }, + "end": { + "line": 16, + "column": 18 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 420, + "end": 472, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 53 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 426, + "end": 471, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 52 + } + }, + "id": { + "type": "Identifier", + "start": 426, + "end": 427, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + }, + "identifierName": "u" + }, + "name": "u" + }, + "init": { + "type": "ConditionalExpression", + "start": 430, + "end": 471, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 52 + } + }, + "test": { + "type": "BinaryExpression", + "start": 430, + "end": 452, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 33 + } + }, + "left": { + "type": "MemberExpression", + "start": 430, + "end": 441, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 430, + "end": 434, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 17, + "column": 15 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 435, + "end": 441, + "loc": { + "start": { + "line": 17, + "column": 16 + }, + "end": { + "line": 17, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 446, + "end": 452, + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 446, + "end": 447, + "loc": { + "start": { + "line": 17, + "column": 27 + }, + "end": { + "line": 17, + "column": 28 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 448, + "end": 452, + "loc": { + "start": { + "line": 17, + "column": 29 + }, + "end": { + "line": 17, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "MemberExpression", + "start": 455, + "end": 462, + "loc": { + "start": { + "line": 17, + "column": 36 + }, + "end": { + "line": 17, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 455, + "end": 456, + "loc": { + "start": { + "line": 17, + "column": 36 + }, + "end": { + "line": 17, + "column": 37 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 457, + "end": 462, + "loc": { + "start": { + "line": 17, + "column": 38 + }, + "end": { + "line": 17, + "column": 43 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "alternate": { + "type": "MemberExpression", + "start": 465, + "end": 471, + "loc": { + "start": { + "line": 17, + "column": 46 + }, + "end": { + "line": 17, + "column": 52 + } + }, + "object": { + "type": "Identifier", + "start": 465, + "end": 466, + "loc": { + "start": { + "line": 17, + "column": 46 + }, + "end": { + "line": 17, + "column": 47 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 467, + "end": 471, + "loc": { + "start": { + "line": 17, + "column": 48 + }, + "end": { + "line": 17, + "column": 52 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 474, + "end": 521, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 474, + "end": 520, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 474, + "end": 480, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 481, + "end": 519, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 481, + "end": 498, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 481, + "end": 482, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "u" + }, + "name": "u" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 494, + "end": 498, + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 502, + "end": 519, + "loc": { + "start": { + "line": 18, + "column": 29 + }, + "end": { + "line": 18, + "column": 46 + } + }, + "left": { + "type": "Identifier", + "start": 502, + "end": 503, + "loc": { + "start": { + "line": 18, + "column": 29 + }, + "end": { + "line": 18, + "column": 30 + }, + "identifierName": "u" + }, + "name": "u" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 515, + "end": 519, + "loc": { + "start": { + "line": 18, + "column": 42 + }, + "end": { + "line": 18, + "column": 46 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + } + ] + } + }, + { + "type": "ReturnStatement", + "start": 523, + "end": 532, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 10 + } + }, + "argument": { + "type": "Identifier", + "start": 530, + "end": 531, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 9 + }, + "identifierName": "u" + }, + "name": "u" + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n ", + "start": 148, + "end": 310, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n ", + "start": 148, + "end": 310, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Leaf", + "start": 73, + "end": 77, + "loc": { + "start": { + "line": 3, + "column": 7 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 47, - "end": 204, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 9, - "column": 3 - } - } - } - ] + "end": { + "line": 3, + "column": 11 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 47, - "end": 204, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 78, + "end": 82, "loc": { "start": { "line": 3, - "column": 0 + "column": 12 }, "end": { - "line": 9, - "column": 3 + "line": 3, + "column": 16 } } }, { - "type": "CommentLine", - "value": " Assert( g !== null ) ;", - "start": 269, - "end": 294, + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Leaf.js", + "start": 83, + "end": 101, "loc": { "start": { - "line": 12, - "column": 1 + "line": 3, + "column": 17 }, "end": { - "line": 12, - "column": 26 + "line": 3, + "column": 35 } } }, { - "type": "CommentLine", - "value": " this can never happen", - "start": 296, - "end": 320, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, "loc": { "start": { - "line": 13, - "column": 1 + "line": 3, + "column": 35 }, "end": { - "line": 13, - "column": 25 + "line": 3, + "column": 36 } } - } - ], - "tokens": [ + }, { "type": { "label": "import", @@ -1072,23 +2613,23 @@ "updateContext": null }, "value": "import", - "start": 0, - "end": 6, + "start": 103, + "end": 109, "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 1, + "line": 4, "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1097,16 +2638,17 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "value": "grandparent", + "start": 110, + "end": 121, "loc": { "start": { - "line": 1, + "line": 4, "column": 7 }, "end": { - "line": 1, - "column": 8 + "line": 4, + "column": 18 } } }, @@ -1122,42 +2664,114 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 8, - "end": 19, + "value": "from", + "start": 122, + "end": 126, "loc": { "start": { - "line": 1, - "column": 8 + "line": 4, + "column": 19 }, "end": { - "line": 1, - "column": 19 + "line": 4, + "column": 23 } } }, { "type": { - "label": "}", + "label": "string", "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./grandparent.js", + "start": 127, + "end": 145, + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 42 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 19, - "end": 20, + "start": 145, + "end": 146, "loc": { "start": { - "line": 1, - "column": 19 + "line": 4, + "column": 42 }, "end": { - "line": 1, - "column": 20 + "line": 4, + "column": 43 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n ", + "start": 148, + "end": 310, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 311, + "end": 316, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 5 } } }, @@ -1173,23 +2787,75 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 21, - "end": 25, + "value": "uncle", + "start": 317, + "end": 322, "loc": { "start": { - "line": 1, - "column": 21 + "line": 13, + "column": 6 }, "end": { - "line": 1, - "column": 25 + "line": 13, + "column": 11 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 323, + "end": 324, + "loc": { + "start": { + "line": 13, + "column": 12 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 325, + "end": 326, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 15 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1197,70 +2863,51 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./grandparent.js", - "start": 26, - "end": 44, + "value": "node", + "start": 326, + "end": 330, "loc": { "start": { - "line": 1, - "column": 26 + "line": 13, + "column": 15 }, "end": { - "line": 1, - "column": 44 + "line": 13, + "column": 19 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 44, - "end": 45, - "loc": { - "start": { - "line": 1, - "column": 44 - }, - "end": { - "line": 1, - "column": 45 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", - "start": 47, - "end": 204, + "start": 330, + "end": 331, "loc": { "start": { - "line": 3, - "column": 0 + "line": 13, + "column": 19 }, "end": { - "line": 9, - "column": 3 + "line": 13, + "column": 20 } } }, { "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, + "label": "=>", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1270,45 +2917,41 @@ "binop": null, "updateContext": null }, - "value": "export", - "start": 205, - "end": 211, + "start": 332, + "end": 334, "loc": { "start": { - "line": 10, - "column": 0 + "line": 13, + "column": 21 }, "end": { - "line": 10, - "column": 6 + "line": 13, + "column": 23 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 212, - "end": 217, + "start": 335, + "end": 336, "loc": { "start": { - "line": 10, - "column": 7 + "line": 13, + "column": 24 }, "end": { - "line": 10, - "column": 12 + "line": 13, + "column": 25 } } }, @@ -1324,51 +2967,49 @@ "postfix": false, "binop": null }, - "value": "uncle", - "start": 218, - "end": 223, + "value": "assert", + "start": 338, + "end": 344, "loc": { "start": { - "line": 10, - "column": 13 + "line": 14, + "column": 1 }, "end": { - "line": 10, - "column": 18 + "line": 14, + "column": 7 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 224, - "end": 225, + "start": 344, + "end": 345, "loc": { "start": { - "line": 10, - "column": 19 + "line": 14, + "column": 7 }, "end": { - "line": 10, - "column": 20 + "line": 14, + "column": 8 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1377,50 +3018,53 @@ "postfix": false, "binop": null }, - "start": 226, - "end": 227, + "value": "node", + "start": 345, + "end": 349, "loc": { "start": { - "line": 10, - "column": 21 + "line": 14, + "column": 8 }, "end": { - "line": 10, - "column": 22 + "line": 14, + "column": 12 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "value": "node", - "start": 227, - "end": 231, + "value": "instanceof", + "start": 350, + "end": 360, "loc": { "start": { - "line": 10, - "column": 22 + "line": 14, + "column": 13 }, "end": { - "line": 10, - "column": 26 + "line": 14, + "column": 23 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1428,67 +3072,68 @@ "postfix": false, "binop": null }, - "start": 231, - "end": 232, + "value": "Node", + "start": 361, + "end": 365, "loc": { "start": { - "line": 10, - "column": 26 + "line": 14, + "column": 24 }, "end": { - "line": 10, - "column": 27 + "line": 14, + "column": 28 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 233, - "end": 235, + "start": 365, + "end": 366, "loc": { "start": { - "line": 10, + "line": 14, "column": 28 }, "end": { - "line": 10, - "column": 30 + "line": 14, + "column": 29 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 236, - "end": 237, + "start": 366, + "end": 367, "loc": { "start": { - "line": 10, - "column": 31 + "line": 14, + "column": 29 }, "end": { - "line": 10, - "column": 32 + "line": 14, + "column": 30 } } }, @@ -1507,15 +3152,15 @@ "updateContext": null }, "value": "const", - "start": 239, - "end": 244, + "start": 369, + "end": 374, "loc": { "start": { - "line": 11, + "line": 15, "column": 1 }, "end": { - "line": 11, + "line": 15, "column": 6 } } @@ -1533,15 +3178,15 @@ "binop": null }, "value": "g", - "start": 245, - "end": 246, + "start": 375, + "end": 376, "loc": { "start": { - "line": 11, + "line": 15, "column": 7 }, "end": { - "line": 11, + "line": 15, "column": 8 } } @@ -1560,15 +3205,15 @@ "updateContext": null }, "value": "=", - "start": 247, - "end": 248, + "start": 377, + "end": 378, "loc": { "start": { - "line": 11, + "line": 15, "column": 9 }, "end": { - "line": 11, + "line": 15, "column": 10 } } @@ -1586,15 +3231,15 @@ "binop": null }, "value": "grandparent", - "start": 249, - "end": 260, + "start": 379, + "end": 390, "loc": { "start": { - "line": 11, + "line": 15, "column": 11 }, "end": { - "line": 11, + "line": 15, "column": 22 } } @@ -1611,15 +3256,15 @@ "postfix": false, "binop": null }, - "start": 260, - "end": 261, + "start": 390, + "end": 391, "loc": { "start": { - "line": 11, + "line": 15, "column": 22 }, "end": { - "line": 11, + "line": 15, "column": 23 } } @@ -1637,15 +3282,15 @@ "binop": null }, "value": "node", - "start": 261, - "end": 265, + "start": 391, + "end": 395, "loc": { "start": { - "line": 11, + "line": 15, "column": 23 }, "end": { - "line": 11, + "line": 15, "column": 27 } } @@ -1662,15 +3307,15 @@ "postfix": false, "binop": null }, - "start": 265, - "end": 266, + "start": 395, + "end": 396, "loc": { "start": { - "line": 11, + "line": 15, "column": 27 }, "end": { - "line": 11, + "line": 15, "column": 28 } } @@ -1688,57 +3333,129 @@ "binop": null, "updateContext": null }, - "start": 266, - "end": 267, + "start": 396, + "end": 397, "loc": { "start": { - "line": 11, + "line": 15, "column": 28 }, "end": { - "line": 11, + "line": 15, "column": 29 } } }, { - "type": "CommentLine", - "value": " Assert( g !== null ) ;", - "start": 269, - "end": 294, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 399, + "end": 405, "loc": { "start": { - "line": 12, + "line": 16, "column": 1 }, "end": { - "line": 12, - "column": 26 + "line": 16, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 405, + "end": 406, + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "g", + "start": 406, + "end": 407, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 } } }, { - "type": "CommentLine", - "value": " this can never happen", - "start": 296, - "end": 320, + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 408, + "end": 411, "loc": { "start": { - "line": 13, - "column": 1 + "line": 16, + "column": 10 }, "end": { - "line": 13, - "column": 25 + "line": 16, + "column": 13 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1747,25 +3464,25 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 322, - "end": 324, + "value": "null", + "start": 412, + "end": 416, "loc": { "start": { - "line": 14, - "column": 1 + "line": 16, + "column": 14 }, "end": { - "line": 14, - "column": 3 + "line": 16, + "column": 18 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1773,48 +3490,49 @@ "postfix": false, "binop": null }, - "start": 325, - "end": 326, + "start": 416, + "end": 417, "loc": { "start": { - "line": 14, - "column": 4 + "line": 16, + "column": 18 }, "end": { - "line": 14, - "column": 5 + "line": 16, + "column": 19 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 326, - "end": 330, + "start": 417, + "end": 418, "loc": { "start": { - "line": 14, - "column": 5 + "line": 16, + "column": 19 }, "end": { - "line": 14, - "column": 9 + "line": 16, + "column": 20 } } }, { "type": { - "label": ".", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1825,16 +3543,17 @@ "binop": null, "updateContext": null }, - "start": 330, - "end": 331, + "value": "const", + "start": 420, + "end": 425, "loc": { "start": { - "line": 14, - "column": 9 + "line": 17, + "column": 1 }, "end": { - "line": 14, - "column": 10 + "line": 17, + "column": 6 } } }, @@ -1850,44 +3569,44 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 331, - "end": 337, + "value": "u", + "start": 426, + "end": 427, "loc": { "start": { - "line": 14, - "column": 10 + "line": 17, + "column": 7 }, "end": { - "line": 14, - "column": 16 + "line": 17, + "column": 8 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 338, - "end": 341, + "value": "=", + "start": 428, + "end": 429, "loc": { "start": { - "line": 14, - "column": 17 + "line": 17, + "column": 9 }, "end": { - "line": 14, - "column": 20 + "line": 17, + "column": 10 } } }, @@ -1903,17 +3622,17 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 342, - "end": 343, + "value": "node", + "start": 430, + "end": 434, "loc": { "start": { - "line": 14, - "column": 21 + "line": 17, + "column": 11 }, "end": { - "line": 14, - "column": 22 + "line": 17, + "column": 15 } } }, @@ -1930,16 +3649,16 @@ "binop": null, "updateContext": null }, - "start": 343, - "end": 344, + "start": 434, + "end": 435, "loc": { "start": { - "line": 14, - "column": 22 + "line": 17, + "column": 15 }, "end": { - "line": 14, - "column": 23 + "line": 17, + "column": 16 } } }, @@ -1955,49 +3674,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 344, - "end": 348, - "loc": { - "start": { - "line": 14, - "column": 23 - }, - "end": { - "line": 14, - "column": 27 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 348, - "end": 349, + "value": "parent", + "start": 435, + "end": 441, "loc": { "start": { - "line": 14, - "column": 27 + "line": 17, + "column": 16 }, "end": { - "line": 14, - "column": 28 + "line": 17, + "column": 22 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2005,20 +3698,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "return", - "start": 350, - "end": 356, + "value": "===", + "start": 442, + "end": 445, "loc": { "start": { - "line": 14, - "column": 29 + "line": 17, + "column": 23 }, "end": { - "line": 14, - "column": 35 + "line": 17, + "column": 26 } } }, @@ -2035,16 +3728,16 @@ "binop": null }, "value": "g", - "start": 357, - "end": 358, + "start": 446, + "end": 447, "loc": { "start": { - "line": 14, - "column": 36 + "line": 17, + "column": 27 }, "end": { - "line": 14, - "column": 37 + "line": 17, + "column": 28 } } }, @@ -2061,16 +3754,16 @@ "binop": null, "updateContext": null }, - "start": 358, - "end": 359, + "start": 447, + "end": 448, "loc": { "start": { - "line": 14, - "column": 37 + "line": 17, + "column": 28 }, "end": { - "line": 14, - "column": 38 + "line": 17, + "column": 29 } } }, @@ -2086,24 +3779,24 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 359, - "end": 364, + "value": "left", + "start": 448, + "end": 452, "loc": { "start": { - "line": 14, - "column": 38 + "line": 17, + "column": 29 }, "end": { - "line": 14, - "column": 43 + "line": 17, + "column": 33 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "?", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2113,16 +3806,16 @@ "binop": null, "updateContext": null }, - "start": 364, - "end": 365, + "start": 453, + "end": 454, "loc": { "start": { - "line": 14, - "column": 43 + "line": 17, + "column": 34 }, "end": { - "line": 14, - "column": 44 + "line": 17, + "column": 35 } } }, @@ -2138,50 +3831,51 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 365, - "end": 371, + "value": "g", + "start": 455, + "end": 456, "loc": { "start": { - "line": 14, - "column": 44 + "line": 17, + "column": 36 }, "end": { - "line": 14, - "column": 50 + "line": 17, + "column": 37 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 371, - "end": 372, + "start": 456, + "end": 457, "loc": { "start": { - "line": 14, - "column": 50 + "line": 17, + "column": 37 }, "end": { - "line": 14, - "column": 51 + "line": 17, + "column": 38 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2189,22 +3883,23 @@ "postfix": false, "binop": null }, - "start": 372, - "end": 373, + "value": "right", + "start": 457, + "end": 462, "loc": { "start": { - "line": 14, - "column": 51 + "line": 17, + "column": 38 }, "end": { - "line": 14, - "column": 52 + "line": 17, + "column": 43 } } }, { "type": { - "label": "?", + "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2215,23 +3910,22 @@ "binop": null, "updateContext": null }, - "start": 374, - "end": 375, + "start": 463, + "end": 464, "loc": { "start": { - "line": 14, - "column": 53 + "line": 17, + "column": 44 }, "end": { - "line": 14, - "column": 54 + "line": 17, + "column": 45 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2239,27 +3933,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 376, - "end": 380, + "value": "g", + "start": 465, + "end": 466, "loc": { "start": { - "line": 14, - "column": 55 + "line": 17, + "column": 46 }, "end": { - "line": 14, - "column": 59 + "line": 17, + "column": 47 } } }, { "type": { - "label": ":", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2269,16 +3962,16 @@ "binop": null, "updateContext": null }, - "start": 381, - "end": 382, + "start": 466, + "end": 467, "loc": { "start": { - "line": 14, - "column": 60 + "line": 17, + "column": 47 }, "end": { - "line": 14, - "column": 61 + "line": 17, + "column": 48 } } }, @@ -2294,24 +3987,24 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 383, - "end": 384, + "value": "left", + "start": 467, + "end": 471, "loc": { "start": { - "line": 14, - "column": 62 + "line": 17, + "column": 48 }, "end": { - "line": 14, - "column": 63 + "line": 17, + "column": 52 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2321,16 +4014,16 @@ "binop": null, "updateContext": null }, - "start": 384, - "end": 385, + "start": 471, + "end": 472, "loc": { "start": { - "line": 14, - "column": 63 + "line": 17, + "column": 52 }, "end": { - "line": 14, - "column": 64 + "line": 17, + "column": 53 } } }, @@ -2346,50 +4039,75 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 385, - "end": 390, + "value": "assert", + "start": 474, + "end": 480, "loc": { "start": { - "line": 14, - "column": 64 + "line": 18, + "column": 1 }, "end": { - "line": 14, - "column": 69 + "line": 18, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 390, - "end": 391, + "start": 480, + "end": 481, "loc": { "start": { - "line": 14, - "column": 69 + "line": 18, + "column": 7 }, "end": { - "line": 14, - "column": 70 + "line": 18, + "column": 8 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "u", + "start": 481, + "end": 482, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2397,20 +4115,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "return", - "start": 393, - "end": 399, + "value": "instanceof", + "start": 483, + "end": 493, "loc": { "start": { - "line": 15, - "column": 1 + "line": 18, + "column": 10 }, "end": { - "line": 15, - "column": 7 + "line": 18, + "column": 20 } } }, @@ -2426,43 +4144,44 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 400, - "end": 401, + "value": "Node", + "start": 494, + "end": 498, "loc": { "start": { - "line": 15, - "column": 8 + "line": 18, + "column": 21 }, "end": { - "line": 15, - "column": 9 + "line": 18, + "column": 25 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "||", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "start": 401, - "end": 402, + "value": "||", + "start": 499, + "end": 501, "loc": { "start": { - "line": 15, - "column": 9 + "line": 18, + "column": 26 }, "end": { - "line": 15, - "column": 10 + "line": 18, + "column": 28 } } }, @@ -2478,43 +4197,45 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 402, - "end": 406, + "value": "u", + "start": 502, + "end": 503, "loc": { "start": { - "line": 15, - "column": 10 + "line": 18, + "column": 29 }, "end": { - "line": 15, - "column": 14 + "line": 18, + "column": 30 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 406, - "end": 407, + "value": "instanceof", + "start": 504, + "end": 514, "loc": { "start": { - "line": 15, - "column": 14 + "line": 18, + "column": 31 }, "end": { - "line": 15, - "column": 15 + "line": 18, + "column": 41 } } }, @@ -2530,25 +4251,25 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 407, - "end": 413, + "value": "Leaf", + "start": 515, + "end": 519, "loc": { "start": { - "line": 15, - "column": 15 + "line": 18, + "column": 42 }, "end": { - "line": 15, - "column": 21 + "line": 18, + "column": 46 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2556,47 +4277,49 @@ "postfix": false, "binop": null }, - "start": 413, - "end": 414, + "start": 519, + "end": 520, "loc": { "start": { - "line": 15, - "column": 21 + "line": 18, + "column": 46 }, "end": { - "line": 15, - "column": 22 + "line": 18, + "column": 47 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 414, - "end": 415, + "start": 520, + "end": 521, "loc": { "start": { - "line": 15, - "column": 22 + "line": 18, + "column": 47 }, "end": { - "line": 15, - "column": 23 + "line": 18, + "column": 48 } } }, { "type": { - "label": "?", + "label": "return", + "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2607,23 +4330,23 @@ "binop": null, "updateContext": null }, - "start": 416, - "end": 417, + "value": "return", + "start": 523, + "end": 529, "loc": { "start": { - "line": 15, - "column": 24 + "line": 19, + "column": 1 }, "end": { - "line": 15, - "column": 25 + "line": 19, + "column": 7 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2631,26 +4354,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 418, - "end": 422, + "value": "u", + "start": 530, + "end": 531, "loc": { "start": { - "line": 15, - "column": 26 + "line": 19, + "column": 8 }, "end": { - "line": 15, - "column": 30 + "line": 19, + "column": 9 } } }, { "type": { - "label": ":", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2661,24 +4383,24 @@ "binop": null, "updateContext": null }, - "start": 423, - "end": 424, + "start": 531, + "end": 532, "loc": { "start": { - "line": 15, - "column": 31 + "line": 19, + "column": 9 }, "end": { - "line": 15, - "column": 32 + "line": 19, + "column": 10 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2686,24 +4408,23 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 425, - "end": 426, + "start": 533, + "end": 534, "loc": { "start": { - "line": 15, - "column": 33 + "line": 20, + "column": 0 }, "end": { - "line": 15, - "column": 34 + "line": 20, + "column": 1 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2713,48 +4434,51 @@ "binop": null, "updateContext": null }, - "start": 426, - "end": 427, + "start": 534, + "end": 535, "loc": { "start": { - "line": 15, - "column": 34 + "line": 20, + "column": 1 }, "end": { - "line": 15, - "column": 35 + "line": 20, + "column": 2 } } }, { "type": { - "label": "name", + "label": "export", + "keyword": "export", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "left", - "start": 427, - "end": 431, + "value": "export", + "start": 537, + "end": 543, "loc": { "start": { - "line": 15, - "column": 35 + "line": 22, + "column": 0 }, "end": { - "line": 15, - "column": 39 + "line": 22, + "column": 6 } } }, { "type": { - "label": ";", + "label": "default", + "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2765,24 +4489,25 @@ "binop": null, "updateContext": null }, - "start": 431, - "end": 432, + "value": "default", + "start": 544, + "end": 551, "loc": { "start": { - "line": 15, - "column": 39 + "line": 22, + "column": 7 }, "end": { - "line": 15, - "column": 40 + "line": 22, + "column": 14 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2790,16 +4515,17 @@ "postfix": false, "binop": null }, - "start": 433, - "end": 434, + "value": "uncle", + "start": 552, + "end": 557, "loc": { "start": { - "line": 16, - "column": 0 + "line": 22, + "column": 15 }, "end": { - "line": 16, - "column": 1 + "line": 22, + "column": 20 } } }, @@ -2816,16 +4542,16 @@ "binop": null, "updateContext": null }, - "start": 434, - "end": 435, + "start": 557, + "end": 558, "loc": { "start": { - "line": 16, - "column": 1 + "line": 22, + "column": 20 }, "end": { - "line": 16, - "column": 2 + "line": 22, + "column": 21 } } }, @@ -2842,15 +4568,15 @@ "binop": null, "updateContext": null }, - "start": 436, - "end": 436, + "start": 559, + "end": 559, "loc": { "start": { - "line": 17, + "line": 23, "column": 0 }, "end": { - "line": 17, + "line": 23, "column": 0 } } diff --git a/ast/source/index.js.json b/ast/source/index.js.json index 99326ea..6b83814 100644 --- a/ast/source/index.js.json +++ b/ast/source/index.js.json @@ -1,37 +1,37 @@ { "type": "File", "start": 0, - "end": 318, + "end": 1934, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 10, + "line": 32, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 318, + "end": 1934, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 10, + "line": 32, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportAllDeclaration", + "type": "ExportNamedDeclaration", "start": 0, - "end": 31, + "end": 48, "loc": { "start": { "line": 1, @@ -39,34 +39,86 @@ }, "end": { "line": 1, - "column": 31 + "column": 48 } }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 8, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "local": { + "type": "Identifier", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + }, + "identifierName": "empty" + }, + "name": "empty" + } + } + ], "source": { "type": "StringLiteral", - "start": 14, - "end": 30, + "start": 31, + "end": 47, "loc": { "start": { "line": 1, - "column": 14 + "column": 31 }, "end": { "line": 1, - "column": 30 + "column": 47 } }, "extra": { - "rawValue": "./adt/index.js", - "raw": "'./adt/index.js'" + "rawValue": "./api/empty.js", + "raw": "'./api/empty.js'" }, - "value": "./adt/index.js" + "value": "./api/empty.js" } }, { - "type": "ExportAllDeclaration", - "start": 32, - "end": 65, + "type": "ExportNamedDeclaration", + "start": 49, + "end": 95, "loc": { "start": { "line": 2, @@ -74,34 +126,86 @@ }, "end": { "line": 2, - "column": 33 + "column": 46 } }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 57, + "end": 72, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 57, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 68, + "end": 72, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 23 + }, + "identifierName": "from" + }, + "name": "from" + } + } + ], "source": { "type": "StringLiteral", - "start": 46, - "end": 64, + "start": 79, + "end": 94, "loc": { "start": { "line": 2, - "column": 14 + "column": 30 }, "end": { "line": 2, - "column": 32 + "column": 45 } }, "extra": { - "rawValue": "./color/index.js", - "raw": "'./color/index.js'" + "rawValue": "./api/from.js", + "raw": "'./api/from.js'" }, - "value": "./color/index.js" + "value": "./api/from.js" } }, { - "type": "ExportAllDeclaration", - "start": 66, - "end": 99, + "type": "ExportNamedDeclaration", + "start": 96, + "end": 146, "loc": { "start": { "line": 3, @@ -109,34 +213,86 @@ }, "end": { "line": 3, - "column": 33 + "column": 50 } }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 104, + "end": 120, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 24 + } + }, + "local": { + "type": "Identifier", + "start": 104, + "end": 111, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 115, + "end": 120, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ], "source": { "type": "StringLiteral", - "start": 80, - "end": 98, + "start": 127, + "end": 145, "loc": { "start": { "line": 3, - "column": 14 + "column": 31 }, "end": { "line": 3, - "column": 32 + "column": 49 } }, "extra": { - "rawValue": "./debug/index.js", - "raw": "'./debug/index.js'" + "rawValue": "./color/BLACK.js", + "raw": "'./color/BLACK.js'" }, - "value": "./debug/index.js" + "value": "./color/BLACK.js" } }, { - "type": "ExportAllDeclaration", - "start": 100, - "end": 136, + "type": "ExportNamedDeclaration", + "start": 147, + "end": 193, "loc": { "start": { "line": 4, @@ -144,34 +300,86 @@ }, "end": { "line": 4, - "column": 36 + "column": 46 } }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 155, + "end": 169, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 22 + } + }, + "local": { + "type": "Identifier", + "start": 155, + "end": 162, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 166, + "end": 169, + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 22 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ], "source": { "type": "StringLiteral", - "start": 114, - "end": 135, + "start": 176, + "end": 192, "loc": { "start": { "line": 4, - "column": 14 + "column": 29 }, "end": { "line": 4, - "column": 35 + "column": 45 } }, "extra": { - "rawValue": "./deletion/index.js", - "raw": "'./deletion/index.js'" + "rawValue": "./color/RED.js", + "raw": "'./color/RED.js'" }, - "value": "./deletion/index.js" + "value": "./color/RED.js" } }, { - "type": "ExportAllDeclaration", - "start": 137, - "end": 171, + "type": "ExportNamedDeclaration", + "start": 194, + "end": 246, "loc": { "start": { "line": 5, @@ -179,34 +387,86 @@ }, "end": { "line": 5, - "column": 34 + "column": 52 } }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 202, + "end": 219, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 25 + } + }, + "local": { + "type": "Identifier", + "start": 202, + "end": 209, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 213, + "end": 219, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 25 + }, + "identifierName": "_debug" + }, + "name": "_debug" + } + } + ], "source": { "type": "StringLiteral", - "start": 151, - "end": 170, + "start": 226, + "end": 245, "loc": { "start": { "line": 5, - "column": 14 + "column": 32 }, "end": { "line": 5, - "column": 33 + "column": 51 } }, "extra": { - "rawValue": "./family/index.js", - "raw": "'./family/index.js'" + "rawValue": "./debug/_debug.js", + "raw": "'./debug/_debug.js'" }, - "value": "./family/index.js" + "value": "./debug/_debug.js" } }, { - "type": "ExportAllDeclaration", - "start": 172, - "end": 209, + "type": "ExportNamedDeclaration", + "start": 247, + "end": 314, "loc": { "start": { "line": 6, @@ -214,34 +474,86 @@ }, "end": { "line": 6, - "column": 37 + "column": 67 } }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 255, + "end": 278, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 255, + "end": 262, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 266, + "end": 278, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 31 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1" + } + } + ], "source": { "type": "StringLiteral", - "start": 186, - "end": 208, + "start": 285, + "end": 313, "loc": { "start": { "line": 6, - "column": 14 + "column": 38 }, "end": { "line": 6, - "column": 36 + "column": 66 } }, "extra": { - "rawValue": "./insertion/index.js", - "raw": "'./insertion/index.js'" + "rawValue": "./deletion/delete_case1.js", + "raw": "'./deletion/delete_case1.js'" }, - "value": "./insertion/index.js" + "value": "./deletion/delete_case1.js" } }, { - "type": "ExportAllDeclaration", - "start": 210, - "end": 244, + "type": "ExportNamedDeclaration", + "start": 315, + "end": 382, "loc": { "start": { "line": 7, @@ -249,34 +561,86 @@ }, "end": { "line": 7, - "column": 34 + "column": 67 } }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 323, + "end": 346, + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 323, + "end": 330, + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 334, + "end": 346, + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 31 + }, + "identifierName": "delete_case2" + }, + "name": "delete_case2" + } + } + ], "source": { "type": "StringLiteral", - "start": 224, - "end": 243, + "start": 353, + "end": 381, "loc": { "start": { "line": 7, - "column": 14 + "column": 38 }, "end": { "line": 7, - "column": 33 + "column": 66 } }, "extra": { - "rawValue": "./rotate/index.js", - "raw": "'./rotate/index.js'" + "rawValue": "./deletion/delete_case2.js", + "raw": "'./deletion/delete_case2.js'" }, - "value": "./rotate/index.js" + "value": "./deletion/delete_case2.js" } }, { - "type": "ExportAllDeclaration", - "start": 245, - "end": 279, + "type": "ExportNamedDeclaration", + "start": 383, + "end": 450, "loc": { "start": { "line": 8, @@ -284,34 +648,86 @@ }, "end": { "line": 8, - "column": 34 + "column": 67 } }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 391, + "end": 414, + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 391, + "end": 398, + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 402, + "end": 414, + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 31 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3" + } + } + ], "source": { "type": "StringLiteral", - "start": 259, - "end": 278, + "start": 421, + "end": 449, "loc": { "start": { "line": 8, - "column": 14 + "column": 38 }, "end": { "line": 8, - "column": 33 + "column": 66 } }, "extra": { - "rawValue": "./search/index.js", - "raw": "'./search/index.js'" + "rawValue": "./deletion/delete_case3.js", + "raw": "'./deletion/delete_case3.js'" }, - "value": "./search/index.js" + "value": "./deletion/delete_case3.js" } }, { - "type": "ExportAllDeclaration", - "start": 280, - "end": 317, + "type": "ExportNamedDeclaration", + "start": 451, + "end": 518, "loc": { "start": { "line": 9, @@ -319,87 +735,8081 @@ }, "end": { "line": 9, - "column": 37 + "column": 67 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 459, + "end": 482, + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 459, + "end": 466, + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 470, + "end": 482, + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 31 + }, + "identifierName": "delete_case4" + }, + "name": "delete_case4" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 489, + "end": 517, + "loc": { + "start": { + "line": 9, + "column": 38 + }, + "end": { + "line": 9, + "column": 66 + } + }, + "extra": { + "rawValue": "./deletion/delete_case4.js", + "raw": "'./deletion/delete_case4.js'" + }, + "value": "./deletion/delete_case4.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 519, + "end": 586, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 67 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 527, + "end": 550, + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 527, + "end": 534, + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 538, + "end": 550, + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 31 + }, + "identifierName": "delete_case5" + }, + "name": "delete_case5" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 557, + "end": 585, + "loc": { + "start": { + "line": 10, + "column": 38 + }, + "end": { + "line": 10, + "column": 66 + } + }, + "extra": { + "rawValue": "./deletion/delete_case5.js", + "raw": "'./deletion/delete_case5.js'" + }, + "value": "./deletion/delete_case5.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 587, + "end": 654, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 67 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 595, + "end": 618, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 595, + "end": 602, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 606, + "end": 618, + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 11, + "column": 31 + }, + "identifierName": "delete_case6" + }, + "name": "delete_case6" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 625, + "end": 653, + "loc": { + "start": { + "line": 11, + "column": 38 + }, + "end": { + "line": 11, + "column": 66 + } + }, + "extra": { + "rawValue": "./deletion/delete_case6.js", + "raw": "'./deletion/delete_case6.js'" + }, + "value": "./deletion/delete_case6.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 655, + "end": 730, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 75 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 663, + "end": 690, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 35 + } + }, + "local": { + "type": "Identifier", + "start": 663, + "end": 670, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 674, + "end": 690, + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 35 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 697, + "end": 729, + "loc": { + "start": { + "line": 12, + "column": 42 + }, + "end": { + "line": 12, + "column": 74 + } + }, + "extra": { + "rawValue": "./deletion/delete_one_child.js", + "raw": "'./deletion/delete_one_child.js'" + }, + "value": "./deletion/delete_one_child.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 731, + "end": 798, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 67 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 739, + "end": 762, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 739, + "end": 746, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 750, + "end": 762, + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 31 + }, + "identifierName": "replace_node" + }, + "name": "replace_node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 769, + "end": 797, + "loc": { + "start": { + "line": 13, + "column": 38 + }, + "end": { + "line": 13, + "column": 66 + } + }, + "extra": { + "rawValue": "./deletion/replace_node.js", + "raw": "'./deletion/replace_node.js'" + }, + "value": "./deletion/replace_node.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 799, + "end": 862, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 63 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 807, + "end": 829, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 30 + } + }, + "local": { + "type": "Identifier", + "start": 807, + "end": 814, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 818, + "end": 829, + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 30 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 836, + "end": 861, + "loc": { + "start": { + "line": 14, + "column": 37 + }, + "end": { + "line": 14, + "column": 62 + } + }, + "extra": { + "rawValue": "./family/grandparent.js", + "raw": "'./family/grandparent.js'" + }, + "value": "./family/grandparent.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 863, + "end": 926, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 63 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 871, + "end": 893, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 30 + } + }, + "local": { + "type": "Identifier", + "start": 871, + "end": 878, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 882, + "end": 893, + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 30 + }, + "identifierName": "predecessor" + }, + "name": "predecessor" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 900, + "end": 925, + "loc": { + "start": { + "line": 15, + "column": 37 + }, + "end": { + "line": 15, + "column": 62 + } + }, + "extra": { + "rawValue": "./family/predecessor.js", + "raw": "'./family/predecessor.js'" + }, + "value": "./family/predecessor.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 927, + "end": 982, + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 55 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 935, + "end": 953, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "local": { + "type": "Identifier", + "start": 935, + "end": 942, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 946, + "end": 953, + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 26 + }, + "identifierName": "sibling" + }, + "name": "sibling" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 960, + "end": 981, + "loc": { + "start": { + "line": 16, + "column": 33 + }, + "end": { + "line": 16, + "column": 54 + } + }, + "extra": { + "rawValue": "./family/sibling.js", + "raw": "'./family/sibling.js'" + }, + "value": "./family/sibling.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 983, + "end": 1034, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 51 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 991, + "end": 1007, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "local": { + "type": "Identifier", + "start": 991, + "end": 998, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1002, + "end": 1007, + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 24 + }, + "identifierName": "uncle" + }, + "name": "uncle" + } } + ], + "source": { + "type": "StringLiteral", + "start": 1014, + "end": 1033, + "loc": { + "start": { + "line": 17, + "column": 31 + }, + "end": { + "line": 17, + "column": 50 + } + }, + "extra": { + "rawValue": "./family/uncle.js", + "raw": "'./family/uncle.js'" + }, + "value": "./family/uncle.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1035, + "end": 1091, + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 56 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1043, + "end": 1060, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 25 + } + }, + "local": { + "type": "Identifier", + "start": 1043, + "end": 1050, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1054, + "end": 1060, + "loc": { + "start": { + "line": 18, + "column": 19 + }, + "end": { + "line": 18, + "column": 25 + }, + "identifierName": "insert" + }, + "name": "insert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1067, + "end": 1090, + "loc": { + "start": { + "line": 18, + "column": 32 + }, + "end": { + "line": 18, + "column": 55 + } + }, + "extra": { + "rawValue": "./insertion/insert.js", + "raw": "'./insertion/insert.js'" + }, + "value": "./insertion/insert.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1092, + "end": 1160, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 68 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1100, + "end": 1123, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 1100, + "end": 1107, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1111, + "end": 1123, + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 31 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1130, + "end": 1159, + "loc": { + "start": { + "line": 19, + "column": 38 + }, + "end": { + "line": 19, + "column": 67 + } + }, + "extra": { + "rawValue": "./insertion/insert_case1.js", + "raw": "'./insertion/insert_case1.js'" + }, + "value": "./insertion/insert_case1.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1161, + "end": 1229, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 68 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1169, + "end": 1192, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 1169, + "end": 1176, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1180, + "end": 1192, + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 31 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1199, + "end": 1228, + "loc": { + "start": { + "line": 20, + "column": 38 + }, + "end": { + "line": 20, + "column": 67 + } + }, + "extra": { + "rawValue": "./insertion/insert_case2.js", + "raw": "'./insertion/insert_case2.js'" + }, + "value": "./insertion/insert_case2.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1230, + "end": 1298, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 68 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1238, + "end": 1261, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 1238, + "end": 1245, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1249, + "end": 1261, + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 31 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1268, + "end": 1297, + "loc": { + "start": { + "line": 21, + "column": 38 + }, + "end": { + "line": 21, + "column": 67 + } + }, + "extra": { + "rawValue": "./insertion/insert_case3.js", + "raw": "'./insertion/insert_case3.js'" + }, + "value": "./insertion/insert_case3.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1299, + "end": 1367, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 68 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1307, + "end": 1330, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 1307, + "end": 1314, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1318, + "end": 1330, + "loc": { + "start": { + "line": 22, + "column": 19 + }, + "end": { + "line": 22, + "column": 31 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1337, + "end": 1366, + "loc": { + "start": { + "line": 22, + "column": 38 + }, + "end": { + "line": 22, + "column": 67 + } + }, + "extra": { + "rawValue": "./insertion/insert_case4.js", + "raw": "'./insertion/insert_case4.js'" + }, + "value": "./insertion/insert_case4.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1368, + "end": 1436, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 68 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1376, + "end": 1399, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 1376, + "end": 1383, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1387, + "end": 1399, + "loc": { + "start": { + "line": 23, + "column": 19 + }, + "end": { + "line": 23, + "column": 31 + }, + "identifierName": "insert_case5" + }, + "name": "insert_case5" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1406, + "end": 1435, + "loc": { + "start": { + "line": 23, + "column": 38 + }, + "end": { + "line": 23, + "column": 67 + } + }, + "extra": { + "rawValue": "./insertion/insert_case5.js", + "raw": "'./insertion/insert_case5.js'" + }, + "value": "./insertion/insert_case5.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1437, + "end": 1500, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 63 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1445, + "end": 1467, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 30 + } + }, + "local": { + "type": "Identifier", + "start": 1445, + "end": 1452, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1456, + "end": 1467, + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 30 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1474, + "end": 1499, + "loc": { + "start": { + "line": 24, + "column": 37 + }, + "end": { + "line": 24, + "column": 62 + } + }, + "extra": { + "rawValue": "./rotate/rotate_left.js", + "raw": "'./rotate/rotate_left.js'" + }, + "value": "./rotate/rotate_left.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1501, + "end": 1566, + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 65 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1509, + "end": 1532, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 1509, + "end": 1516, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1520, + "end": 1532, + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 31 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1539, + "end": 1565, + "loc": { + "start": { + "line": 25, + "column": 38 + }, + "end": { + "line": 25, + "column": 64 + } + }, + "extra": { + "rawValue": "./rotate/rotate_right.js", + "raw": "'./rotate/rotate_right.js'" + }, + "value": "./rotate/rotate_right.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1567, + "end": 1620, + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 53 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1575, + "end": 1592, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "local": { + "type": "Identifier", + "start": 1575, + "end": 1582, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1586, + "end": 1592, + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "search" + }, + "name": "search" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1599, + "end": 1619, + "loc": { + "start": { + "line": 26, + "column": 32 + }, + "end": { + "line": 26, + "column": 52 + } + }, + "extra": { + "rawValue": "./search/search.js", + "raw": "'./search/search.js'" + }, + "value": "./search/search.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1621, + "end": 1697, + "loc": { + "start": { + "line": 27, + "column": 0 + }, + "end": { + "line": 27, + "column": 76 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1629, + "end": 1656, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 35 + } + }, + "local": { + "type": "Identifier", + "start": 1629, + "end": 1636, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1640, + "end": 1656, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 35 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1663, + "end": 1696, + "loc": { + "start": { + "line": 27, + "column": 42 + }, + "end": { + "line": 27, + "column": 75 + } + }, + "extra": { + "rawValue": "./traversal/inordertraversal.js", + "raw": "'./traversal/inordertraversal.js'" + }, + "value": "./traversal/inordertraversal.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1698, + "end": 1770, + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 72 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1706, + "end": 1731, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 33 + } + }, + "local": { + "type": "Identifier", + "start": 1706, + "end": 1713, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1717, + "end": 1731, + "loc": { + "start": { + "line": 28, + "column": 19 + }, + "end": { + "line": 28, + "column": 33 + }, + "identifierName": "rangetraversal" + }, + "name": "rangetraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1738, + "end": 1769, + "loc": { + "start": { + "line": 28, + "column": 40 + }, + "end": { + "line": 28, + "column": 71 + } + }, + "extra": { + "rawValue": "./traversal/rangetraversal.js", + "raw": "'./traversal/rangetraversal.js'" + }, + "value": "./traversal/rangetraversal.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1771, + "end": 1819, + "loc": { + "start": { + "line": 29, + "column": 0 + }, + "end": { + "line": 29, + "column": 48 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1779, + "end": 1794, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 1779, + "end": 1786, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1790, + "end": 1794, + "loc": { + "start": { + "line": 29, + "column": 19 + }, + "end": { + "line": 29, + "column": 23 + }, + "identifierName": "Leaf" + }, + "name": "Leaf" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1801, + "end": 1818, + "loc": { + "start": { + "line": 29, + "column": 30 + }, + "end": { + "line": 29, + "column": 47 + } + }, + "extra": { + "rawValue": "./types/Leaf.js", + "raw": "'./types/Leaf.js'" + }, + "value": "./types/Leaf.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1820, + "end": 1868, + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 48 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1828, + "end": 1843, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 1828, + "end": 1835, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1839, + "end": 1843, + "loc": { + "start": { + "line": 30, + "column": 19 + }, + "end": { + "line": 30, + "column": 23 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1850, + "end": 1867, + "loc": { + "start": { + "line": 30, + "column": 30 + }, + "end": { + "line": 30, + "column": 47 + } + }, + "extra": { + "rawValue": "./types/Node.js", + "raw": "'./types/Node.js'" + }, + "value": "./types/Node.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1869, + "end": 1933, + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 64 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1877, + "end": 1900, + "loc": { + "start": { + "line": 31, + "column": 8 + }, + "end": { + "line": 31, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 1877, + "end": 1884, + "loc": { + "start": { + "line": 31, + "column": 8 + }, + "end": { + "line": 31, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1888, + "end": 1900, + "loc": { + "start": { + "line": 31, + "column": 19 + }, + "end": { + "line": 31, + "column": 31 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1907, + "end": 1932, + "loc": { + "start": { + "line": 31, + "column": 38 + }, + "end": { + "line": 31, + "column": 63 + } + }, + "extra": { + "rawValue": "./types/RedBlackTree.js", + "raw": "'./types/RedBlackTree.js'" + }, + "value": "./types/RedBlackTree.js" + } + } + ], + "directives": [] + }, + "comments": [], + "tokens": [ + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "empty", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./api/empty.js", + "start": 31, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 49, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 57, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 65, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 68, + "end": 72, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 72, + "end": 73, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 74, + "end": 78, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./api/from.js", + "start": 79, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 94, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 46 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 96, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 104, + "end": 111, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 112, + "end": 114, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 115, + "end": 120, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 120, + "end": 121, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 122, + "end": 126, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./color/BLACK.js", + "start": 127, + "end": 145, + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 145, + "end": 146, + "loc": { + "start": { + "line": 3, + "column": 49 + }, + "end": { + "line": 3, + "column": 50 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 147, + "end": 153, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 154, + "end": 155, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 155, + "end": 162, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 163, + "end": 165, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 166, + "end": 169, + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 169, + "end": 170, + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 171, + "end": 175, + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./color/RED.js", + "start": 176, + "end": 192, + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 45 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 192, + "end": 193, + "loc": { + "start": { + "line": 4, + "column": 45 + }, + "end": { + "line": 4, + "column": 46 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 194, + "end": 200, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 201, + "end": 202, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 202, + "end": 209, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 210, + "end": 212, + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_debug", + "start": 213, + "end": 219, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 219, + "end": 220, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 221, + "end": 225, + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./debug/_debug.js", + "start": 226, + "end": 245, + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 245, + "end": 246, + "loc": { + "start": { + "line": 5, + "column": 51 + }, + "end": { + "line": 5, + "column": 52 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 247, + "end": 253, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 254, + "end": 255, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 255, + "end": 262, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 263, + "end": 265, + "loc": { + "start": { + "line": 6, + "column": 16 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case1", + "start": 266, + "end": 278, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 278, + "end": 279, + "loc": { + "start": { + "line": 6, + "column": 31 + }, + "end": { + "line": 6, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 280, + "end": 284, + "loc": { + "start": { + "line": 6, + "column": 33 + }, + "end": { + "line": 6, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./deletion/delete_case1.js", + "start": 285, + "end": 313, + "loc": { + "start": { + "line": 6, + "column": 38 + }, + "end": { + "line": 6, + "column": 66 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 313, + "end": 314, + "loc": { + "start": { + "line": 6, + "column": 66 + }, + "end": { + "line": 6, + "column": 67 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 315, + "end": 321, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 323, + "end": 330, + "loc": { + "start": { + "line": 7, + "column": 8 + }, + "end": { + "line": 7, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 331, + "end": 333, + "loc": { + "start": { + "line": 7, + "column": 16 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case2", + "start": 334, + "end": 346, + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 346, + "end": 347, + "loc": { + "start": { + "line": 7, + "column": 31 + }, + "end": { + "line": 7, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 348, + "end": 352, + "loc": { + "start": { + "line": 7, + "column": 33 + }, + "end": { + "line": 7, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./deletion/delete_case2.js", + "start": 353, + "end": 381, + "loc": { + "start": { + "line": 7, + "column": 38 + }, + "end": { + "line": 7, + "column": 66 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 381, + "end": 382, + "loc": { + "start": { + "line": 7, + "column": 66 + }, + "end": { + "line": 7, + "column": 67 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 383, + "end": 389, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 390, + "end": 391, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 391, + "end": 398, + "loc": { + "start": { + "line": 8, + "column": 8 + }, + "end": { + "line": 8, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 399, + "end": 401, + "loc": { + "start": { + "line": 8, + "column": 16 + }, + "end": { + "line": 8, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case3", + "start": 402, + "end": 414, + "loc": { + "start": { + "line": 8, + "column": 19 + }, + "end": { + "line": 8, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 414, + "end": 415, + "loc": { + "start": { + "line": 8, + "column": 31 + }, + "end": { + "line": 8, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 416, + "end": 420, + "loc": { + "start": { + "line": 8, + "column": 33 + }, + "end": { + "line": 8, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./deletion/delete_case3.js", + "start": 421, + "end": 449, + "loc": { + "start": { + "line": 8, + "column": 38 + }, + "end": { + "line": 8, + "column": 66 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 449, + "end": 450, + "loc": { + "start": { + "line": 8, + "column": 66 + }, + "end": { + "line": 8, + "column": 67 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 451, + "end": 457, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 458, + "end": 459, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 459, + "end": 466, + "loc": { + "start": { + "line": 9, + "column": 8 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 467, + "end": 469, + "loc": { + "start": { + "line": 9, + "column": 16 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case4", + "start": 470, + "end": 482, + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 482, + "end": 483, + "loc": { + "start": { + "line": 9, + "column": 31 + }, + "end": { + "line": 9, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 484, + "end": 488, + "loc": { + "start": { + "line": 9, + "column": 33 + }, + "end": { + "line": 9, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./deletion/delete_case4.js", + "start": 489, + "end": 517, + "loc": { + "start": { + "line": 9, + "column": 38 + }, + "end": { + "line": 9, + "column": 66 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 517, + "end": 518, + "loc": { + "start": { + "line": 9, + "column": 66 + }, + "end": { + "line": 9, + "column": 67 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 519, + "end": 525, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 526, + "end": 527, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 527, + "end": 534, + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 535, + "end": 537, + "loc": { + "start": { + "line": 10, + "column": 16 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case5", + "start": 538, + "end": 550, + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 550, + "end": 551, + "loc": { + "start": { + "line": 10, + "column": 31 + }, + "end": { + "line": 10, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 552, + "end": 556, + "loc": { + "start": { + "line": 10, + "column": 33 + }, + "end": { + "line": 10, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./deletion/delete_case5.js", + "start": 557, + "end": 585, + "loc": { + "start": { + "line": 10, + "column": 38 + }, + "end": { + "line": 10, + "column": 66 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 585, + "end": 586, + "loc": { + "start": { + "line": 10, + "column": 66 + }, + "end": { + "line": 10, + "column": 67 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 587, + "end": 593, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 594, + "end": 595, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 595, + "end": 602, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 603, + "end": 605, + "loc": { + "start": { + "line": 11, + "column": 16 + }, + "end": { + "line": 11, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case6", + "start": 606, + "end": 618, + "loc": { + "start": { + "line": 11, + "column": 19 + }, + "end": { + "line": 11, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 618, + "end": 619, + "loc": { + "start": { + "line": 11, + "column": 31 + }, + "end": { + "line": 11, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 620, + "end": 624, + "loc": { + "start": { + "line": 11, + "column": 33 + }, + "end": { + "line": 11, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./deletion/delete_case6.js", + "start": 625, + "end": 653, + "loc": { + "start": { + "line": 11, + "column": 38 + }, + "end": { + "line": 11, + "column": 66 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 653, + "end": 654, + "loc": { + "start": { + "line": 11, + "column": 66 + }, + "end": { + "line": 11, + "column": 67 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 655, + "end": 661, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 662, + "end": 663, + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 663, + "end": 670, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 671, + "end": 673, + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_one_child", + "start": 674, + "end": 690, + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 35 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 690, + "end": 691, + "loc": { + "start": { + "line": 12, + "column": 35 + }, + "end": { + "line": 12, + "column": 36 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 692, + "end": 696, + "loc": { + "start": { + "line": 12, + "column": 37 + }, + "end": { + "line": 12, + "column": 41 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./deletion/delete_one_child.js", + "start": 697, + "end": 729, + "loc": { + "start": { + "line": 12, + "column": 42 + }, + "end": { + "line": 12, + "column": 74 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 729, + "end": 730, + "loc": { + "start": { + "line": 12, + "column": 74 + }, + "end": { + "line": 12, + "column": 75 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 731, + "end": 737, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 738, + "end": 739, + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 739, + "end": 746, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 747, + "end": 749, + "loc": { + "start": { + "line": 13, + "column": 16 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "replace_node", + "start": 750, + "end": 762, + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 762, + "end": 763, + "loc": { + "start": { + "line": 13, + "column": 31 + }, + "end": { + "line": 13, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 764, + "end": 768, + "loc": { + "start": { + "line": 13, + "column": 33 + }, + "end": { + "line": 13, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./deletion/replace_node.js", + "start": 769, + "end": 797, + "loc": { + "start": { + "line": 13, + "column": 38 + }, + "end": { + "line": 13, + "column": 66 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 797, + "end": 798, + "loc": { + "start": { + "line": 13, + "column": 66 + }, + "end": { + "line": 13, + "column": 67 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 799, + "end": 805, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 806, + "end": 807, + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 807, + "end": 814, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 815, + "end": 817, + "loc": { + "start": { + "line": 14, + "column": 16 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 818, + "end": 829, + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 829, + "end": 830, + "loc": { + "start": { + "line": 14, + "column": 30 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 831, + "end": 835, + "loc": { + "start": { + "line": 14, + "column": 32 + }, + "end": { + "line": 14, + "column": 36 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./family/grandparent.js", + "start": 836, + "end": 861, + "loc": { + "start": { + "line": 14, + "column": 37 + }, + "end": { + "line": 14, + "column": 62 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 861, + "end": 862, + "loc": { + "start": { + "line": 14, + "column": 62 + }, + "end": { + "line": 14, + "column": 63 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 863, + "end": 869, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 870, + "end": 871, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 871, + "end": 878, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 879, + "end": 881, + "loc": { + "start": { + "line": 15, + "column": 16 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "predecessor", + "start": 882, + "end": 893, + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 893, + "end": 894, + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 895, + "end": 899, + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 36 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./family/predecessor.js", + "start": 900, + "end": 925, + "loc": { + "start": { + "line": 15, + "column": 37 + }, + "end": { + "line": 15, + "column": 62 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 925, + "end": 926, + "loc": { + "start": { + "line": 15, + "column": 62 + }, + "end": { + "line": 15, + "column": 63 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 927, + "end": 933, + "loc": { + "start": { + "line": 16, + "column": 0 + }, + "end": { + "line": 16, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 934, + "end": 935, + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 935, + "end": 942, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 943, + "end": 945, + "loc": { + "start": { + "line": 16, + "column": 16 + }, + "end": { + "line": 16, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 946, + "end": 953, + "loc": { + "start": { + "line": 16, + "column": 19 + }, + "end": { + "line": 16, + "column": 26 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 953, + "end": 954, + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 955, + "end": 959, + "loc": { + "start": { + "line": 16, + "column": 28 + }, + "end": { + "line": 16, + "column": 32 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./family/sibling.js", + "start": 960, + "end": 981, + "loc": { + "start": { + "line": 16, + "column": 33 + }, + "end": { + "line": 16, + "column": 54 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 981, + "end": 982, + "loc": { + "start": { + "line": 16, + "column": 54 + }, + "end": { + "line": 16, + "column": 55 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 983, + "end": 989, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 990, + "end": 991, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 991, + "end": 998, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 999, + "end": 1001, + "loc": { + "start": { + "line": 17, + "column": 16 + }, + "end": { + "line": 17, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "uncle", + "start": 1002, + "end": 1007, + "loc": { + "start": { + "line": 17, + "column": 19 + }, + "end": { + "line": 17, + "column": 24 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1007, + "end": 1008, + "loc": { + "start": { + "line": 17, + "column": 24 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1009, + "end": 1013, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 30 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./family/uncle.js", + "start": 1014, + "end": 1033, + "loc": { + "start": { + "line": 17, + "column": 31 + }, + "end": { + "line": 17, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1033, + "end": 1034, + "loc": { + "start": { + "line": 17, + "column": 50 + }, + "end": { + "line": 17, + "column": 51 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1035, + "end": 1041, + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1042, + "end": 1043, + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1043, + "end": 1050, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1051, + "end": 1053, + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert", + "start": 1054, + "end": 1060, + "loc": { + "start": { + "line": 18, + "column": 19 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1060, + "end": 1061, + "loc": { + "start": { + "line": 18, + "column": 25 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1062, + "end": 1066, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 31 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insertion/insert.js", + "start": 1067, + "end": 1090, + "loc": { + "start": { + "line": 18, + "column": 32 + }, + "end": { + "line": 18, + "column": 55 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1090, + "end": 1091, + "loc": { + "start": { + "line": 18, + "column": 55 + }, + "end": { + "line": 18, + "column": 56 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1092, + "end": 1098, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1099, + "end": 1100, + "loc": { + "start": { + "line": 19, + "column": 7 + }, + "end": { + "line": 19, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1100, + "end": 1107, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1108, + "end": 1110, + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case1", + "start": 1111, + "end": 1123, + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1123, + "end": 1124, + "loc": { + "start": { + "line": 19, + "column": 31 + }, + "end": { + "line": 19, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1125, + "end": 1129, + "loc": { + "start": { + "line": 19, + "column": 33 + }, + "end": { + "line": 19, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insertion/insert_case1.js", + "start": 1130, + "end": 1159, + "loc": { + "start": { + "line": 19, + "column": 38 + }, + "end": { + "line": 19, + "column": 67 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1159, + "end": 1160, + "loc": { + "start": { + "line": 19, + "column": 67 + }, + "end": { + "line": 19, + "column": 68 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1161, + "end": 1167, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1168, + "end": 1169, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1169, + "end": 1176, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1177, + "end": 1179, + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case2", + "start": 1180, + "end": 1192, + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1192, + "end": 1193, + "loc": { + "start": { + "line": 20, + "column": 31 + }, + "end": { + "line": 20, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1194, + "end": 1198, + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 20, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insertion/insert_case2.js", + "start": 1199, + "end": 1228, + "loc": { + "start": { + "line": 20, + "column": 38 + }, + "end": { + "line": 20, + "column": 67 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1228, + "end": 1229, + "loc": { + "start": { + "line": 20, + "column": 67 + }, + "end": { + "line": 20, + "column": 68 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1230, + "end": 1236, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1237, + "end": 1238, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1238, + "end": 1245, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1246, + "end": 1248, + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case3", + "start": 1249, + "end": 1261, + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1261, + "end": 1262, + "loc": { + "start": { + "line": 21, + "column": 31 + }, + "end": { + "line": 21, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1263, + "end": 1267, + "loc": { + "start": { + "line": 21, + "column": 33 + }, + "end": { + "line": 21, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insertion/insert_case3.js", + "start": 1268, + "end": 1297, + "loc": { + "start": { + "line": 21, + "column": 38 + }, + "end": { + "line": 21, + "column": 67 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1297, + "end": 1298, + "loc": { + "start": { + "line": 21, + "column": 67 + }, + "end": { + "line": 21, + "column": 68 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1299, + "end": 1305, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1306, + "end": 1307, + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1307, + "end": 1314, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1315, + "end": 1317, + "loc": { + "start": { + "line": 22, + "column": 16 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case4", + "start": 1318, + "end": 1330, + "loc": { + "start": { + "line": 22, + "column": 19 + }, + "end": { + "line": 22, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1330, + "end": 1331, + "loc": { + "start": { + "line": 22, + "column": 31 + }, + "end": { + "line": 22, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1332, + "end": 1336, + "loc": { + "start": { + "line": 22, + "column": 33 + }, + "end": { + "line": 22, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insertion/insert_case4.js", + "start": 1337, + "end": 1366, + "loc": { + "start": { + "line": 22, + "column": 38 + }, + "end": { + "line": 22, + "column": 67 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1366, + "end": 1367, + "loc": { + "start": { + "line": 22, + "column": 67 + }, + "end": { + "line": 22, + "column": 68 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1368, + "end": 1374, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1375, + "end": 1376, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1376, + "end": 1383, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1384, + "end": 1386, + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case5", + "start": 1387, + "end": 1399, + "loc": { + "start": { + "line": 23, + "column": 19 + }, + "end": { + "line": 23, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1399, + "end": 1400, + "loc": { + "start": { + "line": 23, + "column": 31 + }, + "end": { + "line": 23, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1401, + "end": 1405, + "loc": { + "start": { + "line": 23, + "column": 33 + }, + "end": { + "line": 23, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insertion/insert_case5.js", + "start": 1406, + "end": 1435, + "loc": { + "start": { + "line": 23, + "column": 38 + }, + "end": { + "line": 23, + "column": 67 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1435, + "end": 1436, + "loc": { + "start": { + "line": 23, + "column": 67 + }, + "end": { + "line": 23, + "column": 68 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1437, + "end": 1443, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1444, + "end": 1445, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1445, + "end": 1452, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1453, + "end": 1455, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 1456, + "end": 1467, + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 30 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1467, + "end": 1468, + "loc": { + "start": { + "line": 24, + "column": 30 + }, + "end": { + "line": 24, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1469, + "end": 1473, + "loc": { + "start": { + "line": 24, + "column": 32 + }, + "end": { + "line": 24, + "column": 36 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./rotate/rotate_left.js", + "start": 1474, + "end": 1499, + "loc": { + "start": { + "line": 24, + "column": 37 + }, + "end": { + "line": 24, + "column": 62 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1499, + "end": 1500, + "loc": { + "start": { + "line": 24, + "column": 62 + }, + "end": { + "line": 24, + "column": 63 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1501, + "end": 1507, + "loc": { + "start": { + "line": 25, + "column": 0 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1508, + "end": 1509, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1509, + "end": 1516, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1517, + "end": 1519, + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 1520, + "end": 1532, + "loc": { + "start": { + "line": 25, + "column": 19 + }, + "end": { + "line": 25, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1532, + "end": 1533, + "loc": { + "start": { + "line": 25, + "column": 31 + }, + "end": { + "line": 25, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1534, + "end": 1538, + "loc": { + "start": { + "line": 25, + "column": 33 + }, + "end": { + "line": 25, + "column": 37 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./rotate/rotate_right.js", + "start": 1539, + "end": 1565, + "loc": { + "start": { + "line": 25, + "column": 38 + }, + "end": { + "line": 25, + "column": 64 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1565, + "end": 1566, + "loc": { + "start": { + "line": 25, + "column": 64 + }, + "end": { + "line": 25, + "column": 65 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1567, + "end": 1573, + "loc": { + "start": { + "line": 26, + "column": 0 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1574, + "end": 1575, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1575, + "end": 1582, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1583, + "end": 1585, + "loc": { + "start": { + "line": 26, + "column": 16 }, - "source": { - "type": "StringLiteral", - "start": 294, - "end": 316, - "loc": { - "start": { - "line": 9, - "column": 14 - }, - "end": { - "line": 9, - "column": 36 - } - }, - "extra": { - "rawValue": "./traversal/index.js", - "raw": "'./traversal/index.js'" - }, - "value": "./traversal/index.js" + "end": { + "line": 26, + "column": 18 } } - ], - "directives": [] - }, - "comments": [], - "tokens": [ + }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 0, - "end": 6, + "value": "search", + "start": 1586, + "end": 1592, "loc": { "start": { - "line": 1, - "column": 0 + "line": 26, + "column": 19 }, "end": { - "line": 1, - "column": 6 + "line": 26, + "column": 25 } } }, { "type": { - "label": "*", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 7, - "end": 8, + "start": 1592, + "end": 1593, "loc": { "start": { - "line": 1, - "column": 7 + "line": 26, + "column": 25 }, "end": { - "line": 1, - "column": 8 + "line": 26, + "column": 26 } } }, @@ -416,16 +8826,16 @@ "binop": null }, "value": "from", - "start": 9, - "end": 13, + "start": 1594, + "end": 1598, "loc": { "start": { - "line": 1, - "column": 9 + "line": 26, + "column": 27 }, "end": { - "line": 1, - "column": 13 + "line": 26, + "column": 31 } } }, @@ -442,17 +8852,17 @@ "binop": null, "updateContext": null }, - "value": "./adt/index.js", - "start": 14, - "end": 30, + "value": "./search/search.js", + "start": 1599, + "end": 1619, "loc": { "start": { - "line": 1, - "column": 14 + "line": 26, + "column": 32 }, "end": { - "line": 1, - "column": 30 + "line": 26, + "column": 52 } } }, @@ -469,16 +8879,16 @@ "binop": null, "updateContext": null }, - "start": 30, - "end": 31, + "start": 1619, + "end": 1620, "loc": { "start": { - "line": 1, - "column": 30 + "line": 26, + "column": 52 }, "end": { - "line": 1, - "column": 31 + "line": 26, + "column": 53 } } }, @@ -497,43 +8907,146 @@ "updateContext": null }, "value": "export", - "start": 32, - "end": 38, + "start": 1621, + "end": 1627, "loc": { "start": { - "line": 2, + "line": 27, "column": 0 }, "end": { - "line": 2, + "line": 27, "column": 6 } } }, { "type": { - "label": "*", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 39, - "end": 40, + "start": 1628, + "end": 1629, "loc": { "start": { - "line": 2, + "line": 27, "column": 7 }, "end": { - "line": 2, + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1629, + "end": 1636, + "loc": { + "start": { + "line": 27, "column": 8 + }, + "end": { + "line": 27, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1637, + "end": 1639, + "loc": { + "start": { + "line": 27, + "column": 16 + }, + "end": { + "line": 27, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "inordertraversal", + "start": 1640, + "end": 1656, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 35 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1656, + "end": 1657, + "loc": { + "start": { + "line": 27, + "column": 35 + }, + "end": { + "line": 27, + "column": 36 } } }, @@ -550,16 +9063,16 @@ "binop": null }, "value": "from", - "start": 41, - "end": 45, + "start": 1658, + "end": 1662, "loc": { "start": { - "line": 2, - "column": 9 + "line": 27, + "column": 37 }, "end": { - "line": 2, - "column": 13 + "line": 27, + "column": 41 } } }, @@ -576,17 +9089,17 @@ "binop": null, "updateContext": null }, - "value": "./color/index.js", - "start": 46, - "end": 64, + "value": "./traversal/inordertraversal.js", + "start": 1663, + "end": 1696, "loc": { "start": { - "line": 2, - "column": 14 + "line": 27, + "column": 42 }, "end": { - "line": 2, - "column": 32 + "line": 27, + "column": 75 } } }, @@ -603,16 +9116,16 @@ "binop": null, "updateContext": null }, - "start": 64, - "end": 65, + "start": 1696, + "end": 1697, "loc": { "start": { - "line": 2, - "column": 32 + "line": 27, + "column": 75 }, "end": { - "line": 2, - "column": 33 + "line": 27, + "column": 76 } } }, @@ -631,43 +9144,69 @@ "updateContext": null }, "value": "export", - "start": 66, - "end": 72, + "start": 1698, + "end": 1704, "loc": { "start": { - "line": 3, + "line": 28, "column": 0 }, "end": { - "line": 3, + "line": 28, "column": 6 } } }, { "type": { - "label": "*", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 73, - "end": 74, + "start": 1705, + "end": 1706, "loc": { "start": { - "line": 3, + "line": 28, "column": 7 }, "end": { - "line": 3, + "line": 28, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1706, + "end": 1713, + "loc": { + "start": { + "line": 28, "column": 8 + }, + "end": { + "line": 28, + "column": 15 } } }, @@ -683,23 +9222,23 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 75, - "end": 79, + "value": "as", + "start": 1714, + "end": 1716, "loc": { "start": { - "line": 3, - "column": 9 + "line": 28, + "column": 16 }, "end": { - "line": 3, - "column": 13 + "line": 28, + "column": 18 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -707,54 +9246,104 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./debug/index.js", - "start": 80, - "end": 98, + "value": "rangetraversal", + "start": 1717, + "end": 1731, "loc": { "start": { - "line": 3, - "column": 14 + "line": 28, + "column": 19 }, "end": { - "line": 3, - "column": 32 + "line": 28, + "column": 33 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "start": 1731, + "end": 1732, + "loc": { + "start": { + "line": 28, + "column": 33 + }, + "end": { + "line": 28, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1733, + "end": 1737, + "loc": { + "start": { + "line": 28, + "column": 35 + }, + "end": { + "line": 28, + "column": 39 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "start": 98, - "end": 99, + "value": "./traversal/rangetraversal.js", + "start": 1738, + "end": 1769, "loc": { "start": { - "line": 3, - "column": 32 + "line": 28, + "column": 40 }, "end": { - "line": 3, - "column": 33 + "line": 28, + "column": 71 } } }, { "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -764,51 +9353,51 @@ "binop": null, "updateContext": null }, - "value": "export", - "start": 100, - "end": 106, + "start": 1769, + "end": 1770, "loc": { "start": { - "line": 4, - "column": 0 + "line": 28, + "column": 71 }, "end": { - "line": 4, - "column": 6 + "line": 28, + "column": 72 } } }, { "type": { - "label": "*", - "beforeExpr": true, + "label": "export", + "keyword": "export", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, + "binop": null, "updateContext": null }, - "value": "*", - "start": 107, - "end": 108, + "value": "export", + "start": 1771, + "end": 1777, "loc": { "start": { - "line": 4, - "column": 7 + "line": 29, + "column": 0 }, "end": { - "line": 4, - "column": 8 + "line": 29, + "column": 6 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -817,25 +9406,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 109, - "end": 113, + "start": 1778, + "end": 1779, "loc": { "start": { - "line": 4, - "column": 9 + "line": 29, + "column": 7 }, "end": { - "line": 4, - "column": 13 + "line": 29, + "column": 8 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -844,98 +9433,94 @@ "binop": null, "updateContext": null }, - "value": "./deletion/index.js", - "start": 114, - "end": 135, + "value": "default", + "start": 1779, + "end": 1786, "loc": { "start": { - "line": 4, - "column": 14 + "line": 29, + "column": 8 }, "end": { - "line": 4, - "column": 35 + "line": 29, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 135, - "end": 136, + "value": "as", + "start": 1787, + "end": 1789, "loc": { "start": { - "line": 4, - "column": 35 + "line": 29, + "column": 16 }, "end": { - "line": 4, - "column": 36 + "line": 29, + "column": 18 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 137, - "end": 143, + "value": "Leaf", + "start": 1790, + "end": 1794, "loc": { "start": { - "line": 5, - "column": 0 + "line": 29, + "column": 19 }, "end": { - "line": 5, - "column": 6 + "line": 29, + "column": 23 } } }, { "type": { - "label": "*", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 144, - "end": 145, + "start": 1794, + "end": 1795, "loc": { "start": { - "line": 5, - "column": 7 + "line": 29, + "column": 23 }, "end": { - "line": 5, - "column": 8 + "line": 29, + "column": 24 } } }, @@ -952,16 +9537,16 @@ "binop": null }, "value": "from", - "start": 146, - "end": 150, + "start": 1796, + "end": 1800, "loc": { "start": { - "line": 5, - "column": 9 + "line": 29, + "column": 25 }, "end": { - "line": 5, - "column": 13 + "line": 29, + "column": 29 } } }, @@ -978,17 +9563,17 @@ "binop": null, "updateContext": null }, - "value": "./family/index.js", - "start": 151, - "end": 170, + "value": "./types/Leaf.js", + "start": 1801, + "end": 1818, "loc": { "start": { - "line": 5, - "column": 14 + "line": 29, + "column": 30 }, "end": { - "line": 5, - "column": 33 + "line": 29, + "column": 47 } } }, @@ -1005,16 +9590,16 @@ "binop": null, "updateContext": null }, - "start": 170, - "end": 171, + "start": 1818, + "end": 1819, "loc": { "start": { - "line": 5, - "column": 33 + "line": 29, + "column": 47 }, "end": { - "line": 5, - "column": 34 + "line": 29, + "column": 48 } } }, @@ -1033,50 +9618,23 @@ "updateContext": null }, "value": "export", - "start": 172, - "end": 178, + "start": 1820, + "end": 1826, "loc": { "start": { - "line": 6, + "line": 30, "column": 0 }, "end": { - "line": 6, + "line": 30, "column": 6 } } }, { "type": { - "label": "*", + "label": "{", "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 179, - "end": 180, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1085,25 +9643,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 181, - "end": 185, + "start": 1827, + "end": 1828, "loc": { "start": { - "line": 6, - "column": 9 + "line": 30, + "column": 7 }, "end": { - "line": 6, - "column": 13 + "line": 30, + "column": 8 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1112,98 +9670,94 @@ "binop": null, "updateContext": null }, - "value": "./insertion/index.js", - "start": 186, - "end": 208, + "value": "default", + "start": 1828, + "end": 1835, "loc": { "start": { - "line": 6, - "column": 14 + "line": 30, + "column": 8 }, "end": { - "line": 6, - "column": 36 + "line": 30, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 208, - "end": 209, + "value": "as", + "start": 1836, + "end": 1838, "loc": { "start": { - "line": 6, - "column": 36 + "line": 30, + "column": 16 }, "end": { - "line": 6, - "column": 37 + "line": 30, + "column": 18 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 210, - "end": 216, + "value": "Node", + "start": 1839, + "end": 1843, "loc": { "start": { - "line": 7, - "column": 0 + "line": 30, + "column": 19 }, "end": { - "line": 7, - "column": 6 + "line": 30, + "column": 23 } } }, { "type": { - "label": "*", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 217, - "end": 218, + "start": 1843, + "end": 1844, "loc": { "start": { - "line": 7, - "column": 7 + "line": 30, + "column": 23 }, "end": { - "line": 7, - "column": 8 + "line": 30, + "column": 24 } } }, @@ -1220,16 +9774,16 @@ "binop": null }, "value": "from", - "start": 219, - "end": 223, + "start": 1845, + "end": 1849, "loc": { "start": { - "line": 7, - "column": 9 + "line": 30, + "column": 25 }, "end": { - "line": 7, - "column": 13 + "line": 30, + "column": 29 } } }, @@ -1246,17 +9800,17 @@ "binop": null, "updateContext": null }, - "value": "./rotate/index.js", - "start": 224, - "end": 243, + "value": "./types/Node.js", + "start": 1850, + "end": 1867, "loc": { "start": { - "line": 7, - "column": 14 + "line": 30, + "column": 30 }, "end": { - "line": 7, - "column": 33 + "line": 30, + "column": 47 } } }, @@ -1273,16 +9827,16 @@ "binop": null, "updateContext": null }, - "start": 243, - "end": 244, + "start": 1867, + "end": 1868, "loc": { "start": { - "line": 7, - "column": 33 + "line": 30, + "column": 47 }, "end": { - "line": 7, - "column": 34 + "line": 30, + "column": 48 } } }, @@ -1301,50 +9855,23 @@ "updateContext": null }, "value": "export", - "start": 245, - "end": 251, + "start": 1869, + "end": 1875, "loc": { "start": { - "line": 8, + "line": 31, "column": 0 }, "end": { - "line": 8, + "line": 31, "column": 6 } } }, { "type": { - "label": "*", + "label": "{", "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 252, - "end": 253, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1353,25 +9880,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 254, - "end": 258, + "start": 1876, + "end": 1877, "loc": { "start": { - "line": 8, - "column": 9 + "line": 31, + "column": 7 }, "end": { - "line": 8, - "column": 13 + "line": 31, + "column": 8 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1380,98 +9907,94 @@ "binop": null, "updateContext": null }, - "value": "./search/index.js", - "start": 259, - "end": 278, + "value": "default", + "start": 1877, + "end": 1884, "loc": { "start": { - "line": 8, - "column": 14 + "line": 31, + "column": 8 }, "end": { - "line": 8, - "column": 33 + "line": 31, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 278, - "end": 279, + "value": "as", + "start": 1885, + "end": 1887, "loc": { "start": { - "line": 8, - "column": 33 + "line": 31, + "column": 16 }, "end": { - "line": 8, - "column": 34 + "line": 31, + "column": 18 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 280, - "end": 286, + "value": "RedBlackTree", + "start": 1888, + "end": 1900, "loc": { "start": { - "line": 9, - "column": 0 + "line": 31, + "column": 19 }, "end": { - "line": 9, - "column": 6 + "line": 31, + "column": 31 } } }, { "type": { - "label": "*", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 287, - "end": 288, + "start": 1900, + "end": 1901, "loc": { "start": { - "line": 9, - "column": 7 + "line": 31, + "column": 31 }, "end": { - "line": 9, - "column": 8 + "line": 31, + "column": 32 } } }, @@ -1488,16 +10011,16 @@ "binop": null }, "value": "from", - "start": 289, - "end": 293, + "start": 1902, + "end": 1906, "loc": { "start": { - "line": 9, - "column": 9 + "line": 31, + "column": 33 }, "end": { - "line": 9, - "column": 13 + "line": 31, + "column": 37 } } }, @@ -1514,17 +10037,17 @@ "binop": null, "updateContext": null }, - "value": "./traversal/index.js", - "start": 294, - "end": 316, + "value": "./types/RedBlackTree.js", + "start": 1907, + "end": 1932, "loc": { "start": { - "line": 9, - "column": 14 + "line": 31, + "column": 38 }, "end": { - "line": 9, - "column": 36 + "line": 31, + "column": 63 } } }, @@ -1541,16 +10064,16 @@ "binop": null, "updateContext": null }, - "start": 316, - "end": 317, + "start": 1932, + "end": 1933, "loc": { "start": { - "line": 9, - "column": 36 + "line": 31, + "column": 63 }, "end": { - "line": 9, - "column": 37 + "line": 31, + "column": 64 } } }, @@ -1567,15 +10090,15 @@ "binop": null, "updateContext": null }, - "start": 318, - "end": 318, + "start": 1934, + "end": 1934, "loc": { "start": { - "line": 10, + "line": 32, "column": 0 }, "end": { - "line": 10, + "line": 32, "column": 0 } } diff --git a/ast/source/insertion/index.js.json b/ast/source/insertion/index.js.json deleted file mode 100644 index 9796146..0000000 --- a/ast/source/insertion/index.js.json +++ /dev/null @@ -1,1077 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 204, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 204, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 7, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "extra": { - "rawValue": "./insert.js", - "raw": "'./insert.js'" - }, - "value": "./insert.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 29, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 43, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "extra": { - "rawValue": "./insert_case1.js", - "raw": "'./insert_case1.js'" - }, - "value": "./insert_case1.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 64, - "end": 98, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 78, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "extra": { - "rawValue": "./insert_case2.js", - "raw": "'./insert_case2.js'" - }, - "value": "./insert_case2.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 99, - "end": 133, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 113, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 33 - } - }, - "extra": { - "rawValue": "./insert_case3.js", - "raw": "'./insert_case3.js'" - }, - "value": "./insert_case3.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 134, - "end": 168, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 148, - "end": 167, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 33 - } - }, - "extra": { - "rawValue": "./insert_case4.js", - "raw": "'./insert_case4.js'" - }, - "value": "./insert_case4.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 169, - "end": 203, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 183, - "end": 202, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 33 - } - }, - "extra": { - "rawValue": "./insert_case5.js", - "raw": "'./insert_case5.js'" - }, - "value": "./insert_case5.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./insert.js", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 36, - "end": 37, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 38, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./insert_case1.js", - "start": 43, - "end": 62, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 62, - "end": 63, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 64, - "end": 70, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 71, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 73, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 9 - }, - "end": { - "line": 3, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./insert_case2.js", - "start": 78, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 14 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 97, - "end": 98, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 99, - "end": 105, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 106, - "end": 107, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 108, - "end": 112, - "loc": { - "start": { - "line": 4, - "column": 9 - }, - "end": { - "line": 4, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./insert_case3.js", - "start": 113, - "end": 132, - "loc": { - "start": { - "line": 4, - "column": 14 - }, - "end": { - "line": 4, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 132, - "end": 133, - "loc": { - "start": { - "line": 4, - "column": 33 - }, - "end": { - "line": 4, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 134, - "end": 140, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 141, - "end": 142, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 143, - "end": 147, - "loc": { - "start": { - "line": 5, - "column": 9 - }, - "end": { - "line": 5, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./insert_case4.js", - "start": 148, - "end": 167, - "loc": { - "start": { - "line": 5, - "column": 14 - }, - "end": { - "line": 5, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 167, - "end": 168, - "loc": { - "start": { - "line": 5, - "column": 33 - }, - "end": { - "line": 5, - "column": 34 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 169, - "end": 175, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 176, - "end": 177, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 178, - "end": 182, - "loc": { - "start": { - "line": 6, - "column": 9 - }, - "end": { - "line": 6, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./insert_case5.js", - "start": 183, - "end": 202, - "loc": { - "start": { - "line": 6, - "column": 14 - }, - "end": { - "line": 6, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 202, - "end": 203, - "loc": { - "start": { - "line": 6, - "column": 33 - }, - "end": { - "line": 6, - "column": 34 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 204, - "end": 204, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/insertion/insert.js.json b/ast/source/insertion/insert.js.json index 386256d..10a3b37 100644 --- a/ast/source/insertion/insert.js.json +++ b/ast/source/insertion/insert.js.json @@ -1,90 +1,1780 @@ { "type": "File", "start": 0, - "end": 1124, + "end": 1285, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 44, + "line": 51, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1124, + "end": 1285, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 44, + "line": 51, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 789, - "end": 1123, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 17, + "line": 1, "column": 0 }, "end": { - "line": 43, + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "start": 67, + "end": 866, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 867, + "end": 1260, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 48, "column": 2 } }, - "specifiers": [], - "source": null, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 873, + "end": 1259, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 48, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 873, + "end": 879, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 12 + }, + "identifierName": "insert" + }, + "name": "insert", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 882, + "end": 1259, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 48, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 883, + "end": 890, + "loc": { + "start": { + "line": 20, + "column": 16 + }, + "end": { + "line": 20, + "column": 23 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "Identifier", + "start": 892, + "end": 893, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 26 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 895, + "end": 896, + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 20, + "column": 29 + }, + "identifierName": "B" + }, + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 901, + "end": 1259, + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 48, + "column": 1 + } + }, + "body": [ + { + "type": "WhileStatement", + "start": 904, + "end": 1229, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 43, + "column": 2 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 911, + "end": 915, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 12 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 917, + "end": 1229, + "loc": { + "start": { + "line": 21, + "column": 14 + }, + "end": { + "line": 43, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 921, + "end": 1226, + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 42, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 925, + "end": 950, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 31 + } + }, + "left": { + "type": "CallExpression", + "start": 925, + "end": 946, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 925, + "end": 932, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 13 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 933, + "end": 938, + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 933, + "end": 934, + "loc": { + "start": { + "line": 22, + "column": 14 + }, + "end": { + "line": 22, + "column": 15 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 935, + "end": 938, + "loc": { + "start": { + "line": 22, + "column": 16 + }, + "end": { + "line": 22, + "column": 19 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 940, + "end": 945, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 940, + "end": 941, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 22 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 942, + "end": 945, + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 26 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 949, + "end": 950, + "loc": { + "start": { + "line": 22, + "column": 30 + }, + "end": { + "line": 22, + "column": 31 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "consequent": { + "type": "BlockStatement", + "start": 952, + "end": 1085, + "loc": { + "start": { + "line": 22, + "column": 33 + }, + "end": { + "line": 32, + "column": 3 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 957, + "end": 977, + "loc": { + "start": { + "line": 23, + "column": 3 + }, + "end": { + "line": 23, + "column": 23 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 963, + "end": 976, + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "id": { + "type": "Identifier", + "start": 963, + "end": 967, + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 13 + }, + "identifierName": "node" + }, + "name": "node" + }, + "init": { + "type": "MemberExpression", + "start": 970, + "end": 976, + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 970, + "end": 971, + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 17 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 972, + "end": 976, + "loc": { + "start": { + "line": 23, + "column": 18 + }, + "end": { + "line": 23, + "column": 22 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 982, + "end": 1034, + "loc": { + "start": { + "line": 25, + "column": 3 + }, + "end": { + "line": 28, + "column": 4 + } + }, + "test": { + "type": "CallExpression", + "start": 986, + "end": 999, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 20 + } + }, + "callee": { + "type": "MemberExpression", + "start": 986, + "end": 997, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 986, + "end": 990, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 11 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 991, + "end": 997, + "loc": { + "start": { + "line": 25, + "column": 12 + }, + "end": { + "line": 25, + "column": 18 + }, + "identifierName": "isLeaf" + }, + "name": "isLeaf" + }, + "computed": false + }, + "arguments": [] + }, + "consequent": { + "type": "BlockStatement", + "start": 1001, + "end": 1034, + "loc": { + "start": { + "line": 25, + "column": 22 + }, + "end": { + "line": 28, + "column": 4 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1007, + "end": 1018, + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1007, + "end": 1017, + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1007, + "end": 1013, + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1007, + "end": 1008, + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1009, + "end": 1013, + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 10 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1016, + "end": 1017, + "loc": { + "start": { + "line": 26, + "column": 13 + }, + "end": { + "line": 26, + "column": 14 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "BreakStatement", + "start": 1023, + "end": 1029, + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 10 + } + }, + "label": null + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 1039, + "end": 1068, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 1039, + "end": 1067, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 1039, + "end": 1045, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1046, + "end": 1066, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 1046, + "end": 1050, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1062, + "end": 1066, + "loc": { + "start": { + "line": 30, + "column": 26 + }, + "end": { + "line": 30, + "column": 30 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1072, + "end": 1081, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1072, + "end": 1080, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 1072, + "end": 1073, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 4 + }, + "identifierName": "A" + }, + "name": "A" + }, + "right": { + "type": "Identifier", + "start": 1076, + "end": 1080, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 11 + }, + "identifierName": "node" + }, + "name": "node" + } + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 1091, + "end": 1226, + "loc": { + "start": { + "line": 32, + "column": 9 + }, + "end": { + "line": 42, + "column": 3 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 1096, + "end": 1117, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 1102, + "end": 1116, + "loc": { + "start": { + "line": 33, + "column": 9 + }, + "end": { + "line": 33, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 1102, + "end": 1106, + "loc": { + "start": { + "line": 33, + "column": 9 + }, + "end": { + "line": 33, + "column": 13 + }, + "identifierName": "node" + }, + "name": "node" + }, + "init": { + "type": "MemberExpression", + "start": 1109, + "end": 1116, + "loc": { + "start": { + "line": 33, + "column": 16 + }, + "end": { + "line": 33, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 1109, + "end": 1110, + "loc": { + "start": { + "line": 33, + "column": 16 + }, + "end": { + "line": 33, + "column": 17 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1111, + "end": 1116, + "loc": { + "start": { + "line": 33, + "column": 18 + }, + "end": { + "line": 33, + "column": 23 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 1122, + "end": 1175, + "loc": { + "start": { + "line": 35, + "column": 3 + }, + "end": { + "line": 38, + "column": 4 + } + }, + "test": { + "type": "CallExpression", + "start": 1126, + "end": 1139, + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 20 + } + }, + "callee": { + "type": "MemberExpression", + "start": 1126, + "end": 1137, + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 1126, + "end": 1130, + "loc": { + "start": { + "line": 35, + "column": 7 + }, + "end": { + "line": 35, + "column": 11 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 1131, + "end": 1137, + "loc": { + "start": { + "line": 35, + "column": 12 + }, + "end": { + "line": 35, + "column": 18 + }, + "identifierName": "isLeaf" + }, + "name": "isLeaf" + }, + "computed": false + }, + "arguments": [] + }, + "consequent": { + "type": "BlockStatement", + "start": 1141, + "end": 1175, + "loc": { + "start": { + "line": 35, + "column": 22 + }, + "end": { + "line": 38, + "column": 4 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1147, + "end": 1159, + "loc": { + "start": { + "line": 36, + "column": 4 + }, + "end": { + "line": 36, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1147, + "end": 1158, + "loc": { + "start": { + "line": 36, + "column": 4 + }, + "end": { + "line": 36, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1147, + "end": 1154, + "loc": { + "start": { + "line": 36, + "column": 4 + }, + "end": { + "line": 36, + "column": 11 + } + }, + "object": { + "type": "Identifier", + "start": 1147, + "end": 1148, + "loc": { + "start": { + "line": 36, + "column": 4 + }, + "end": { + "line": 36, + "column": 5 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1149, + "end": 1154, + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 11 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1157, + "end": 1158, + "loc": { + "start": { + "line": 36, + "column": 14 + }, + "end": { + "line": 36, + "column": 15 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "BreakStatement", + "start": 1164, + "end": 1170, + "loc": { + "start": { + "line": 37, + "column": 4 + }, + "end": { + "line": 37, + "column": 10 + } + }, + "label": null + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 1180, + "end": 1209, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 1180, + "end": 1208, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 1180, + "end": 1186, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1187, + "end": 1207, + "loc": { + "start": { + "line": 40, + "column": 10 + }, + "end": { + "line": 40, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 1187, + "end": 1191, + "loc": { + "start": { + "line": 40, + "column": 10 + }, + "end": { + "line": 40, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1203, + "end": 1207, + "loc": { + "start": { + "line": 40, + "column": 26 + }, + "end": { + "line": 40, + "column": 30 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1213, + "end": 1222, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1213, + "end": 1221, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 1213, + "end": 1214, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 4 + }, + "identifierName": "A" + }, + "name": "A" + }, + "right": { + "type": "Identifier", + "start": 1217, + "end": 1221, + "loc": { + "start": { + "line": 41, + "column": 7 + }, + "end": { + "line": 41, + "column": 11 + }, + "identifierName": "node" + }, + "name": "node" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + { + "type": "ExpressionStatement", + "start": 1232, + "end": 1245, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1232, + "end": 1244, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1232, + "end": 1240, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1232, + "end": 1233, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1234, + "end": 1240, + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1243, + "end": 1244, + "loc": { + "start": { + "line": 45, + "column": 12 + }, + "end": { + "line": 45, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ReturnStatement", + "start": 1248, + "end": 1257, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 10 + } + }, + "argument": { + "type": "Identifier", + "start": 1255, + "end": 1256, + "loc": { + "start": { + "line": 47, + "column": 8 + }, + "end": { + "line": 47, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1262, + "end": 1284, + "loc": { + "start": { + "line": 50, + "column": 0 + }, + "end": { + "line": 50, + "column": 22 + } + }, + "declaration": { + "type": "Identifier", + "start": 1277, + "end": 1283, + "loc": { + "start": { + "line": 50, + "column": 15 + }, + "end": { + "line": 50, + "column": 21 + }, + "identifierName": "insert" + }, + "name": "insert" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1262, + "end": 1284, + "loc": { + "start": { + "line": 50, + "column": 0 + }, + "end": { + "line": 50, + "column": 22 + } + }, "declaration": { "type": "VariableDeclaration", - "start": 796, - "end": 1123, + "start": 867, + "end": 1260, "loc": { "start": { - "line": 17, - "column": 7 + "line": 20, + "column": 0 }, "end": { - "line": 43, + "line": 48, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 802, - "end": 1122, + "start": 873, + "end": 1259, "loc": { "start": { - "line": 17, - "column": 13 + "line": 20, + "column": 6 }, "end": { - "line": 43, + "line": 48, "column": 1 } }, "id": { "type": "Identifier", - "start": 802, - "end": 808, + "start": 873, + "end": 879, "loc": { "start": { - "line": 17, - "column": 13 + "line": 20, + "column": 6 }, "end": { - "line": 17, - "column": 19 + "line": 20, + "column": 12 }, "identifierName": "insert" }, @@ -93,30 +1783,30 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 811, - "end": 1122, + "start": 882, + "end": 1259, "loc": { "start": { - "line": 17, - "column": 22 + "line": 20, + "column": 15 }, "end": { - "line": 43, + "line": 48, "column": 1 } }, "id": { "type": "Identifier", - "start": 802, - "end": 808, + "start": 873, + "end": 879, "loc": { "start": { - "line": 17, - "column": 13 + "line": 20, + "column": 6 }, "end": { - "line": 17, - "column": 19 + "line": 20, + "column": 12 }, "identifierName": "insert" }, @@ -129,16 +1819,16 @@ "params": [ { "type": "Identifier", - "start": 812, - "end": 819, + "start": 883, + "end": 890, "loc": { "start": { - "line": 17, - "column": 23 + "line": 20, + "column": 16 }, "end": { - "line": 17, - "column": 30 + "line": 20, + "column": 23 }, "identifierName": "compare" }, @@ -146,16 +1836,16 @@ }, { "type": "Identifier", - "start": 821, - "end": 822, + "start": 892, + "end": 893, "loc": { "start": { - "line": 17, - "column": 32 + "line": 20, + "column": 25 }, "end": { - "line": 17, - "column": 33 + "line": 20, + "column": 26 }, "identifierName": "A" }, @@ -163,16 +1853,16 @@ }, { "type": "Identifier", - "start": 824, - "end": 825, + "start": 895, + "end": 896, "loc": { "start": { - "line": 17, - "column": 35 + "line": 20, + "column": 28 }, "end": { - "line": 17, - "column": 36 + "line": 20, + "column": 29 }, "identifierName": "B" }, @@ -181,44 +1871,44 @@ ], "body": { "type": "BlockStatement", - "start": 830, - "end": 1122, + "start": 901, + "end": 1259, "loc": { "start": { - "line": 17, - "column": 41 + "line": 20, + "column": 34 }, "end": { - "line": 43, + "line": 48, "column": 1 } }, "body": [ { "type": "WhileStatement", - "start": 833, - "end": 1092, + "start": 904, + "end": 1229, "loc": { "start": { - "line": 18, + "line": 21, "column": 1 }, "end": { - "line": 38, + "line": 43, "column": 2 } }, "test": { "type": "BooleanLiteral", - "start": 840, - "end": 844, + "start": 911, + "end": 915, "loc": { "start": { - "line": 18, + "line": 21, "column": 8 }, "end": { - "line": 18, + "line": 21, "column": 12 } }, @@ -226,72 +1916,72 @@ }, "body": { "type": "BlockStatement", - "start": 846, - "end": 1092, + "start": 917, + "end": 1229, "loc": { "start": { - "line": 18, + "line": 21, "column": 14 }, "end": { - "line": 38, + "line": 43, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 850, - "end": 1089, + "start": 921, + "end": 1226, "loc": { "start": { - "line": 19, + "line": 22, "column": 2 }, "end": { - "line": 37, + "line": 42, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 854, - "end": 879, + "start": 925, + "end": 950, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 19, + "line": 22, "column": 31 } }, "left": { "type": "CallExpression", - "start": 854, - "end": 875, + "start": 925, + "end": 946, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 19, + "line": 22, "column": 27 } }, "callee": { "type": "Identifier", - "start": 854, - "end": 861, + "start": 925, + "end": 932, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 19, + "line": 22, "column": 13 }, "identifierName": "compare" @@ -301,29 +1991,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 862, - "end": 867, + "start": 933, + "end": 938, "loc": { "start": { - "line": 19, + "line": 22, "column": 14 }, "end": { - "line": 19, + "line": 22, "column": 19 } }, "object": { "type": "Identifier", - "start": 862, - "end": 863, + "start": 933, + "end": 934, "loc": { "start": { - "line": 19, + "line": 22, "column": 14 }, "end": { - "line": 19, + "line": 22, "column": 15 }, "identifierName": "B" @@ -332,15 +2022,15 @@ }, "property": { "type": "Identifier", - "start": 864, - "end": 867, + "start": 935, + "end": 938, "loc": { "start": { - "line": 19, + "line": 22, "column": 16 }, "end": { - "line": 19, + "line": 22, "column": 19 }, "identifierName": "key" @@ -351,29 +2041,29 @@ }, { "type": "MemberExpression", - "start": 869, - "end": 874, + "start": 940, + "end": 945, "loc": { "start": { - "line": 19, + "line": 22, "column": 21 }, "end": { - "line": 19, + "line": 22, "column": 26 } }, "object": { "type": "Identifier", - "start": 869, - "end": 870, + "start": 940, + "end": 941, "loc": { "start": { - "line": 19, + "line": 22, "column": 21 }, "end": { - "line": 19, + "line": 22, "column": 22 }, "identifierName": "A" @@ -382,15 +2072,15 @@ }, "property": { "type": "Identifier", - "start": 871, - "end": 874, + "start": 942, + "end": 945, "loc": { "start": { - "line": 19, + "line": 22, "column": 23 }, "end": { - "line": 19, + "line": 22, "column": 26 }, "identifierName": "key" @@ -404,15 +2094,15 @@ "operator": "<", "right": { "type": "NumericLiteral", - "start": 878, - "end": 879, + "start": 949, + "end": 950, "loc": { "start": { - "line": 19, + "line": 22, "column": 30 }, "end": { - "line": 19, + "line": 22, "column": 31 } }, @@ -425,59 +2115,59 @@ }, "consequent": { "type": "BlockStatement", - "start": 881, - "end": 981, + "start": 952, + "end": 1085, "loc": { "start": { - "line": 19, + "line": 22, "column": 33 }, "end": { - "line": 28, + "line": 32, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 886, - "end": 906, + "start": 957, + "end": 977, "loc": { "start": { - "line": 20, + "line": 23, "column": 3 }, "end": { - "line": 20, + "line": 23, "column": 23 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 892, - "end": 905, + "start": 963, + "end": 976, "loc": { "start": { - "line": 20, + "line": 23, "column": 9 }, "end": { - "line": 20, + "line": 23, "column": 22 } }, "id": { "type": "Identifier", - "start": 892, - "end": 896, + "start": 963, + "end": 967, "loc": { "start": { - "line": 20, + "line": 23, "column": 9 }, "end": { - "line": 20, + "line": 23, "column": 13 }, "identifierName": "node" @@ -486,29 +2176,29 @@ }, "init": { "type": "MemberExpression", - "start": 899, - "end": 905, + "start": 970, + "end": 976, "loc": { "start": { - "line": 20, + "line": 23, "column": 16 }, "end": { - "line": 20, + "line": 23, "column": 22 } }, "object": { "type": "Identifier", - "start": 899, - "end": 900, + "start": 970, + "end": 971, "loc": { "start": { - "line": 20, + "line": 23, "column": 16 }, "end": { - "line": 20, + "line": 23, "column": 17 }, "identifierName": "A" @@ -517,15 +2207,15 @@ }, "property": { "type": "Identifier", - "start": 901, - "end": 905, + "start": 972, + "end": 976, "loc": { "start": { - "line": 20, + "line": 23, "column": 18 }, "end": { - "line": 20, + "line": 23, "column": 22 }, "identifierName": "left" @@ -540,57 +2230,57 @@ }, { "type": "IfStatement", - "start": 911, - "end": 963, + "start": 982, + "end": 1034, "loc": { "start": { - "line": 22, + "line": 25, "column": 3 }, "end": { - "line": 25, + "line": 28, "column": 4 } }, "test": { "type": "CallExpression", - "start": 915, - "end": 928, + "start": 986, + "end": 999, "loc": { "start": { - "line": 22, + "line": 25, "column": 7 }, "end": { - "line": 22, + "line": 25, "column": 20 } }, "callee": { "type": "MemberExpression", - "start": 915, - "end": 926, + "start": 986, + "end": 997, "loc": { "start": { - "line": 22, + "line": 25, "column": 7 }, "end": { - "line": 22, + "line": 25, "column": 18 } }, "object": { "type": "Identifier", - "start": 915, - "end": 919, + "start": 986, + "end": 990, "loc": { "start": { - "line": 22, + "line": 25, "column": 7 }, "end": { - "line": 22, + "line": 25, "column": 11 }, "identifierName": "node" @@ -599,15 +2289,15 @@ }, "property": { "type": "Identifier", - "start": 920, - "end": 926, + "start": 991, + "end": 997, "loc": { "start": { - "line": 22, + "line": 25, "column": 12 }, "end": { - "line": 22, + "line": 25, "column": 18 }, "identifierName": "isLeaf" @@ -620,73 +2310,73 @@ }, "consequent": { "type": "BlockStatement", - "start": 930, - "end": 963, + "start": 1001, + "end": 1034, "loc": { "start": { - "line": 22, + "line": 25, "column": 22 }, "end": { - "line": 25, + "line": 28, "column": 4 } }, "body": [ { "type": "ExpressionStatement", - "start": 936, - "end": 947, + "start": 1007, + "end": 1018, "loc": { "start": { - "line": 23, + "line": 26, "column": 4 }, "end": { - "line": 23, + "line": 26, "column": 15 } }, "expression": { "type": "AssignmentExpression", - "start": 936, - "end": 946, + "start": 1007, + "end": 1017, "loc": { "start": { - "line": 23, + "line": 26, "column": 4 }, "end": { - "line": 23, + "line": 26, "column": 14 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 936, - "end": 942, + "start": 1007, + "end": 1013, "loc": { "start": { - "line": 23, + "line": 26, "column": 4 }, "end": { - "line": 23, + "line": 26, "column": 10 } }, "object": { "type": "Identifier", - "start": 936, - "end": 937, + "start": 1007, + "end": 1008, "loc": { "start": { - "line": 23, + "line": 26, "column": 4 }, "end": { - "line": 23, + "line": 26, "column": 5 }, "identifierName": "A" @@ -695,15 +2385,15 @@ }, "property": { "type": "Identifier", - "start": 938, - "end": 942, + "start": 1009, + "end": 1013, "loc": { "start": { - "line": 23, + "line": 26, "column": 6 }, "end": { - "line": 23, + "line": 26, "column": 10 }, "identifierName": "left" @@ -714,15 +2404,15 @@ }, "right": { "type": "Identifier", - "start": 945, - "end": 946, + "start": 1016, + "end": 1017, "loc": { "start": { - "line": 23, + "line": 26, "column": 13 }, "end": { - "line": 23, + "line": 26, "column": 14 }, "identifierName": "B" @@ -733,15 +2423,15 @@ }, { "type": "BreakStatement", - "start": 952, - "end": 958, + "start": 1023, + "end": 1029, "loc": { "start": { - "line": 24, + "line": 27, "column": 4 }, "end": { - "line": 24, + "line": 27, "column": 10 } }, @@ -754,44 +2444,143 @@ }, { "type": "ExpressionStatement", - "start": 968, - "end": 977, + "start": 1039, + "end": 1068, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 1039, + "end": 1067, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 1039, + "end": 1045, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1046, + "end": 1066, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 1046, + "end": 1050, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1062, + "end": 1066, + "loc": { + "start": { + "line": 30, + "column": 26 + }, + "end": { + "line": 30, + "column": 30 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1072, + "end": 1081, "loc": { "start": { - "line": 27, + "line": 31, "column": 3 }, "end": { - "line": 27, + "line": 31, "column": 12 } }, "expression": { "type": "AssignmentExpression", - "start": 968, - "end": 976, + "start": 1072, + "end": 1080, "loc": { "start": { - "line": 27, + "line": 31, "column": 3 }, "end": { - "line": 27, + "line": 31, "column": 11 } }, "operator": "=", "left": { "type": "Identifier", - "start": 968, - "end": 969, + "start": 1072, + "end": 1073, "loc": { "start": { - "line": 27, + "line": 31, "column": 3 }, "end": { - "line": 27, + "line": 31, "column": 4 }, "identifierName": "A" @@ -800,15 +2589,15 @@ }, "right": { "type": "Identifier", - "start": 972, - "end": 976, + "start": 1076, + "end": 1080, "loc": { "start": { - "line": 27, + "line": 31, "column": 7 }, "end": { - "line": 27, + "line": 31, "column": 11 }, "identifierName": "node" @@ -822,59 +2611,59 @@ }, "alternate": { "type": "BlockStatement", - "start": 987, - "end": 1089, + "start": 1091, + "end": 1226, "loc": { "start": { - "line": 28, + "line": 32, "column": 9 }, "end": { - "line": 37, + "line": 42, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 992, - "end": 1013, + "start": 1096, + "end": 1117, "loc": { "start": { - "line": 29, + "line": 33, "column": 3 }, "end": { - "line": 29, + "line": 33, "column": 24 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 998, - "end": 1012, + "start": 1102, + "end": 1116, "loc": { "start": { - "line": 29, + "line": 33, "column": 9 }, "end": { - "line": 29, + "line": 33, "column": 23 } }, "id": { "type": "Identifier", - "start": 998, - "end": 1002, + "start": 1102, + "end": 1106, "loc": { "start": { - "line": 29, + "line": 33, "column": 9 }, "end": { - "line": 29, + "line": 33, "column": 13 }, "identifierName": "node" @@ -883,29 +2672,29 @@ }, "init": { "type": "MemberExpression", - "start": 1005, - "end": 1012, + "start": 1109, + "end": 1116, "loc": { "start": { - "line": 29, + "line": 33, "column": 16 }, "end": { - "line": 29, + "line": 33, "column": 23 } }, "object": { "type": "Identifier", - "start": 1005, - "end": 1006, + "start": 1109, + "end": 1110, "loc": { "start": { - "line": 29, + "line": 33, "column": 16 }, "end": { - "line": 29, + "line": 33, "column": 17 }, "identifierName": "A" @@ -914,15 +2703,15 @@ }, "property": { "type": "Identifier", - "start": 1007, - "end": 1012, + "start": 1111, + "end": 1116, "loc": { "start": { - "line": 29, + "line": 33, "column": 18 }, "end": { - "line": 29, + "line": 33, "column": 23 }, "identifierName": "right" @@ -937,57 +2726,57 @@ }, { "type": "IfStatement", - "start": 1018, - "end": 1071, + "start": 1122, + "end": 1175, "loc": { "start": { - "line": 31, + "line": 35, "column": 3 }, "end": { - "line": 34, + "line": 38, "column": 4 } }, "test": { "type": "CallExpression", - "start": 1022, - "end": 1035, + "start": 1126, + "end": 1139, "loc": { "start": { - "line": 31, + "line": 35, "column": 7 }, "end": { - "line": 31, + "line": 35, "column": 20 } }, "callee": { "type": "MemberExpression", - "start": 1022, - "end": 1033, + "start": 1126, + "end": 1137, "loc": { "start": { - "line": 31, + "line": 35, "column": 7 }, "end": { - "line": 31, + "line": 35, "column": 18 } }, "object": { "type": "Identifier", - "start": 1022, - "end": 1026, + "start": 1126, + "end": 1130, "loc": { "start": { - "line": 31, + "line": 35, "column": 7 }, "end": { - "line": 31, + "line": 35, "column": 11 }, "identifierName": "node" @@ -996,15 +2785,15 @@ }, "property": { "type": "Identifier", - "start": 1027, - "end": 1033, + "start": 1131, + "end": 1137, "loc": { "start": { - "line": 31, + "line": 35, "column": 12 }, "end": { - "line": 31, + "line": 35, "column": 18 }, "identifierName": "isLeaf" @@ -1017,73 +2806,73 @@ }, "consequent": { "type": "BlockStatement", - "start": 1037, - "end": 1071, + "start": 1141, + "end": 1175, "loc": { "start": { - "line": 31, + "line": 35, "column": 22 }, "end": { - "line": 34, + "line": 38, "column": 4 } }, "body": [ { "type": "ExpressionStatement", - "start": 1043, - "end": 1055, + "start": 1147, + "end": 1159, "loc": { "start": { - "line": 32, + "line": 36, "column": 4 }, "end": { - "line": 32, + "line": 36, "column": 16 } }, "expression": { "type": "AssignmentExpression", - "start": 1043, - "end": 1054, + "start": 1147, + "end": 1158, "loc": { "start": { - "line": 32, + "line": 36, "column": 4 }, "end": { - "line": 32, + "line": 36, "column": 15 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1043, - "end": 1050, + "start": 1147, + "end": 1154, "loc": { "start": { - "line": 32, + "line": 36, "column": 4 }, "end": { - "line": 32, + "line": 36, "column": 11 } }, "object": { "type": "Identifier", - "start": 1043, - "end": 1044, + "start": 1147, + "end": 1148, "loc": { "start": { - "line": 32, + "line": 36, "column": 4 }, "end": { - "line": 32, + "line": 36, "column": 5 }, "identifierName": "A" @@ -1092,15 +2881,15 @@ }, "property": { "type": "Identifier", - "start": 1045, - "end": 1050, + "start": 1149, + "end": 1154, "loc": { "start": { - "line": 32, + "line": 36, "column": 6 }, "end": { - "line": 32, + "line": 36, "column": 11 }, "identifierName": "right" @@ -1111,15 +2900,15 @@ }, "right": { "type": "Identifier", - "start": 1053, - "end": 1054, + "start": 1157, + "end": 1158, "loc": { "start": { - "line": 32, + "line": 36, "column": 14 }, "end": { - "line": 32, + "line": 36, "column": 15 }, "identifierName": "B" @@ -1130,15 +2919,15 @@ }, { "type": "BreakStatement", - "start": 1060, - "end": 1066, + "start": 1164, + "end": 1170, "loc": { "start": { - "line": 33, + "line": 37, "column": 4 }, "end": { - "line": 33, + "line": 37, "column": 10 } }, @@ -1151,44 +2940,143 @@ }, { "type": "ExpressionStatement", - "start": 1076, - "end": 1085, + "start": 1180, + "end": 1209, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 1180, + "end": 1208, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 1180, + "end": 1186, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1187, + "end": 1207, + "loc": { + "start": { + "line": 40, + "column": 10 + }, + "end": { + "line": 40, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 1187, + "end": 1191, + "loc": { + "start": { + "line": 40, + "column": 10 + }, + "end": { + "line": 40, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1203, + "end": 1207, + "loc": { + "start": { + "line": 40, + "column": 26 + }, + "end": { + "line": 40, + "column": 30 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1213, + "end": 1222, "loc": { "start": { - "line": 36, + "line": 41, "column": 3 }, "end": { - "line": 36, + "line": 41, "column": 12 } }, "expression": { "type": "AssignmentExpression", - "start": 1076, - "end": 1084, + "start": 1213, + "end": 1221, "loc": { "start": { - "line": 36, + "line": 41, "column": 3 }, "end": { - "line": 36, + "line": 41, "column": 11 } }, "operator": "=", "left": { "type": "Identifier", - "start": 1076, - "end": 1077, + "start": 1213, + "end": 1214, "loc": { "start": { - "line": 36, + "line": 41, "column": 3 }, "end": { - "line": 36, + "line": 41, "column": 4 }, "identifierName": "A" @@ -1197,15 +3085,15 @@ }, "right": { "type": "Identifier", - "start": 1080, - "end": 1084, + "start": 1217, + "end": 1221, "loc": { "start": { - "line": 36, + "line": 41, "column": 7 }, "end": { - "line": 36, + "line": 41, "column": 11 }, "identifierName": "node" @@ -1224,58 +3112,58 @@ }, { "type": "ExpressionStatement", - "start": 1095, - "end": 1108, + "start": 1232, + "end": 1245, "loc": { "start": { - "line": 40, + "line": 45, "column": 1 }, "end": { - "line": 40, + "line": 45, "column": 14 } }, "expression": { "type": "AssignmentExpression", - "start": 1095, - "end": 1107, + "start": 1232, + "end": 1244, "loc": { "start": { - "line": 40, + "line": 45, "column": 1 }, "end": { - "line": 40, + "line": 45, "column": 13 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1095, - "end": 1103, + "start": 1232, + "end": 1240, "loc": { "start": { - "line": 40, + "line": 45, "column": 1 }, "end": { - "line": 40, + "line": 45, "column": 9 } }, "object": { "type": "Identifier", - "start": 1095, - "end": 1096, + "start": 1232, + "end": 1233, "loc": { "start": { - "line": 40, + "line": 45, "column": 1 }, "end": { - "line": 40, + "line": 45, "column": 2 }, "identifierName": "B" @@ -1284,15 +3172,15 @@ }, "property": { "type": "Identifier", - "start": 1097, - "end": 1103, + "start": 1234, + "end": 1240, "loc": { "start": { - "line": 40, + "line": 45, "column": 3 }, "end": { - "line": 40, + "line": 45, "column": 9 }, "identifierName": "parent" @@ -1303,15 +3191,15 @@ }, "right": { "type": "Identifier", - "start": 1106, - "end": 1107, + "start": 1243, + "end": 1244, "loc": { "start": { - "line": 40, + "line": 45, "column": 12 }, "end": { - "line": 40, + "line": 45, "column": 13 }, "identifierName": "A" @@ -1322,29 +3210,29 @@ }, { "type": "ReturnStatement", - "start": 1111, - "end": 1120, + "start": 1248, + "end": 1257, "loc": { "start": { - "line": 42, + "line": 47, "column": 1 }, "end": { - "line": 42, + "line": 47, "column": 10 } }, "argument": { "type": "Identifier", - "start": 1118, - "end": 1119, + "start": 1255, + "end": 1256, "loc": { "start": { - "line": 42, + "line": 47, "column": 8 }, "end": { - "line": 42, + "line": 47, "column": 9 }, "identifierName": "B" @@ -1363,85 +3251,290 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", - "start": 0, - "end": 788, + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "start": 67, + "end": 866, "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 16, + "line": 19, "column": 3 } } } ], "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "start": 67, + "end": 866, + "loc": { + "start": { + "line": 4, + "column": 0 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", - "start": 0, - "end": 788, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 16, - "column": 3 - } - } - } - ] + "end": { + "line": 19, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", - "start": 0, - "end": 788, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, "loc": { "start": { - "line": 1, - "column": 0 + "line": 2, + "column": 7 }, "end": { - "line": 16, - "column": 3 + "line": 2, + "column": 11 } } - } - ], - "tokens": [ + }, { - "type": "CommentBlock", - "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", - "start": 0, - "end": 788, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, "loc": { "start": { - "line": 1, - "column": 0 + "line": 2, + "column": 12 }, "end": { - "line": 16, - "column": 3 + "line": 2, + "column": 16 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "string", "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1451,17 +3544,32 @@ "binop": null, "updateContext": null }, - "value": "export", - "start": 789, - "end": 795, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "start": 67, + "end": 866, "loc": { "start": { - "line": 17, + "line": 4, "column": 0 }, "end": { - "line": 17, - "column": 6 + "line": 19, + "column": 3 } } }, @@ -1480,16 +3588,16 @@ "updateContext": null }, "value": "const", - "start": 796, - "end": 801, + "start": 867, + "end": 872, "loc": { "start": { - "line": 17, - "column": 7 + "line": 20, + "column": 0 }, "end": { - "line": 17, - "column": 12 + "line": 20, + "column": 5 } } }, @@ -1506,16 +3614,16 @@ "binop": null }, "value": "insert", - "start": 802, - "end": 808, + "start": 873, + "end": 879, "loc": { "start": { - "line": 17, - "column": 13 + "line": 20, + "column": 6 }, "end": { - "line": 17, - "column": 19 + "line": 20, + "column": 12 } } }, @@ -1533,16 +3641,16 @@ "updateContext": null }, "value": "=", - "start": 809, - "end": 810, + "start": 880, + "end": 881, "loc": { "start": { - "line": 17, - "column": 20 + "line": 20, + "column": 13 }, "end": { - "line": 17, - "column": 21 + "line": 20, + "column": 14 } } }, @@ -1558,16 +3666,16 @@ "postfix": false, "binop": null }, - "start": 811, - "end": 812, + "start": 882, + "end": 883, "loc": { "start": { - "line": 17, - "column": 22 + "line": 20, + "column": 15 }, "end": { - "line": 17, - "column": 23 + "line": 20, + "column": 16 } } }, @@ -1584,16 +3692,16 @@ "binop": null }, "value": "compare", - "start": 812, - "end": 819, + "start": 883, + "end": 890, "loc": { "start": { - "line": 17, - "column": 23 + "line": 20, + "column": 16 }, "end": { - "line": 17, - "column": 30 + "line": 20, + "column": 23 } } }, @@ -1610,16 +3718,16 @@ "binop": null, "updateContext": null }, - "start": 819, - "end": 820, + "start": 890, + "end": 891, "loc": { "start": { - "line": 17, - "column": 30 + "line": 20, + "column": 23 }, "end": { - "line": 17, - "column": 31 + "line": 20, + "column": 24 } } }, @@ -1636,16 +3744,16 @@ "binop": null }, "value": "A", - "start": 821, - "end": 822, + "start": 892, + "end": 893, "loc": { "start": { - "line": 17, - "column": 32 + "line": 20, + "column": 25 }, "end": { - "line": 17, - "column": 33 + "line": 20, + "column": 26 } } }, @@ -1662,16 +3770,16 @@ "binop": null, "updateContext": null }, - "start": 822, - "end": 823, + "start": 893, + "end": 894, "loc": { "start": { - "line": 17, - "column": 33 + "line": 20, + "column": 26 }, "end": { - "line": 17, - "column": 34 + "line": 20, + "column": 27 } } }, @@ -1688,16 +3796,16 @@ "binop": null }, "value": "B", - "start": 824, - "end": 825, + "start": 895, + "end": 896, "loc": { "start": { - "line": 17, - "column": 35 + "line": 20, + "column": 28 }, "end": { - "line": 17, - "column": 36 + "line": 20, + "column": 29 } } }, @@ -1713,16 +3821,16 @@ "postfix": false, "binop": null }, - "start": 825, - "end": 826, + "start": 896, + "end": 897, "loc": { "start": { - "line": 17, - "column": 36 + "line": 20, + "column": 29 }, "end": { - "line": 17, - "column": 37 + "line": 20, + "column": 30 } } }, @@ -1739,16 +3847,16 @@ "binop": null, "updateContext": null }, - "start": 827, - "end": 829, + "start": 898, + "end": 900, "loc": { "start": { - "line": 17, - "column": 38 + "line": 20, + "column": 31 }, "end": { - "line": 17, - "column": 40 + "line": 20, + "column": 33 } } }, @@ -1764,16 +3872,16 @@ "postfix": false, "binop": null }, - "start": 830, - "end": 831, + "start": 901, + "end": 902, "loc": { "start": { - "line": 17, - "column": 41 + "line": 20, + "column": 34 }, "end": { - "line": 17, - "column": 42 + "line": 20, + "column": 35 } } }, @@ -1792,15 +3900,15 @@ "updateContext": null }, "value": "while", - "start": 833, - "end": 838, + "start": 904, + "end": 909, "loc": { "start": { - "line": 18, + "line": 21, "column": 1 }, "end": { - "line": 18, + "line": 21, "column": 6 } } @@ -1817,15 +3925,15 @@ "postfix": false, "binop": null }, - "start": 839, - "end": 840, + "start": 910, + "end": 911, "loc": { "start": { - "line": 18, + "line": 21, "column": 7 }, "end": { - "line": 18, + "line": 21, "column": 8 } } @@ -1845,15 +3953,15 @@ "updateContext": null }, "value": "true", - "start": 840, - "end": 844, + "start": 911, + "end": 915, "loc": { "start": { - "line": 18, + "line": 21, "column": 8 }, "end": { - "line": 18, + "line": 21, "column": 12 } } @@ -1870,15 +3978,15 @@ "postfix": false, "binop": null }, - "start": 844, - "end": 845, + "start": 915, + "end": 916, "loc": { "start": { - "line": 18, + "line": 21, "column": 12 }, "end": { - "line": 18, + "line": 21, "column": 13 } } @@ -1895,15 +4003,15 @@ "postfix": false, "binop": null }, - "start": 846, - "end": 847, + "start": 917, + "end": 918, "loc": { "start": { - "line": 18, + "line": 21, "column": 14 }, "end": { - "line": 18, + "line": 21, "column": 15 } } @@ -1923,15 +4031,15 @@ "updateContext": null }, "value": "if", - "start": 850, - "end": 852, + "start": 921, + "end": 923, "loc": { "start": { - "line": 19, + "line": 22, "column": 2 }, "end": { - "line": 19, + "line": 22, "column": 4 } } @@ -1948,15 +4056,15 @@ "postfix": false, "binop": null }, - "start": 853, - "end": 854, + "start": 924, + "end": 925, "loc": { "start": { - "line": 19, + "line": 22, "column": 5 }, "end": { - "line": 19, + "line": 22, "column": 6 } } @@ -1974,15 +4082,15 @@ "binop": null }, "value": "compare", - "start": 854, - "end": 861, + "start": 925, + "end": 932, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 19, + "line": 22, "column": 13 } } @@ -1999,15 +4107,15 @@ "postfix": false, "binop": null }, - "start": 861, - "end": 862, + "start": 932, + "end": 933, "loc": { "start": { - "line": 19, + "line": 22, "column": 13 }, "end": { - "line": 19, + "line": 22, "column": 14 } } @@ -2025,15 +4133,15 @@ "binop": null }, "value": "B", - "start": 862, - "end": 863, + "start": 933, + "end": 934, "loc": { "start": { - "line": 19, + "line": 22, "column": 14 }, "end": { - "line": 19, + "line": 22, "column": 15 } } @@ -2051,15 +4159,15 @@ "binop": null, "updateContext": null }, - "start": 863, - "end": 864, + "start": 934, + "end": 935, "loc": { "start": { - "line": 19, + "line": 22, "column": 15 }, "end": { - "line": 19, + "line": 22, "column": 16 } } @@ -2077,15 +4185,15 @@ "binop": null }, "value": "key", - "start": 864, - "end": 867, + "start": 935, + "end": 938, "loc": { "start": { - "line": 19, + "line": 22, "column": 16 }, "end": { - "line": 19, + "line": 22, "column": 19 } } @@ -2103,15 +4211,15 @@ "binop": null, "updateContext": null }, - "start": 867, - "end": 868, + "start": 938, + "end": 939, "loc": { "start": { - "line": 19, + "line": 22, "column": 19 }, "end": { - "line": 19, + "line": 22, "column": 20 } } @@ -2129,15 +4237,15 @@ "binop": null }, "value": "A", - "start": 869, - "end": 870, + "start": 940, + "end": 941, "loc": { "start": { - "line": 19, + "line": 22, "column": 21 }, "end": { - "line": 19, + "line": 22, "column": 22 } } @@ -2155,15 +4263,15 @@ "binop": null, "updateContext": null }, - "start": 870, - "end": 871, + "start": 941, + "end": 942, "loc": { "start": { - "line": 19, + "line": 22, "column": 22 }, "end": { - "line": 19, + "line": 22, "column": 23 } } @@ -2181,15 +4289,15 @@ "binop": null }, "value": "key", - "start": 871, - "end": 874, + "start": 942, + "end": 945, "loc": { "start": { - "line": 19, + "line": 22, "column": 23 }, "end": { - "line": 19, + "line": 22, "column": 26 } } @@ -2206,15 +4314,15 @@ "postfix": false, "binop": null }, - "start": 874, - "end": 875, + "start": 945, + "end": 946, "loc": { "start": { - "line": 19, + "line": 22, "column": 26 }, "end": { - "line": 19, + "line": 22, "column": 27 } } @@ -2233,15 +4341,15 @@ "updateContext": null }, "value": "<", - "start": 876, - "end": 877, + "start": 947, + "end": 948, "loc": { "start": { - "line": 19, + "line": 22, "column": 28 }, "end": { - "line": 19, + "line": 22, "column": 29 } } @@ -2260,15 +4368,15 @@ "updateContext": null }, "value": 0, - "start": 878, - "end": 879, + "start": 949, + "end": 950, "loc": { "start": { - "line": 19, + "line": 22, "column": 30 }, "end": { - "line": 19, + "line": 22, "column": 31 } } @@ -2285,15 +4393,15 @@ "postfix": false, "binop": null }, - "start": 879, - "end": 880, + "start": 950, + "end": 951, "loc": { "start": { - "line": 19, + "line": 22, "column": 31 }, "end": { - "line": 19, + "line": 22, "column": 32 } } @@ -2310,15 +4418,15 @@ "postfix": false, "binop": null }, - "start": 881, - "end": 882, + "start": 952, + "end": 953, "loc": { "start": { - "line": 19, + "line": 22, "column": 33 }, "end": { - "line": 19, + "line": 22, "column": 34 } } @@ -2338,15 +4446,15 @@ "updateContext": null }, "value": "const", - "start": 886, - "end": 891, + "start": 957, + "end": 962, "loc": { "start": { - "line": 20, + "line": 23, "column": 3 }, "end": { - "line": 20, + "line": 23, "column": 8 } } @@ -2364,15 +4472,15 @@ "binop": null }, "value": "node", - "start": 892, - "end": 896, + "start": 963, + "end": 967, "loc": { "start": { - "line": 20, + "line": 23, "column": 9 }, "end": { - "line": 20, + "line": 23, "column": 13 } } @@ -2391,15 +4499,15 @@ "updateContext": null }, "value": "=", - "start": 897, - "end": 898, + "start": 968, + "end": 969, "loc": { "start": { - "line": 20, + "line": 23, "column": 14 }, "end": { - "line": 20, + "line": 23, "column": 15 } } @@ -2417,15 +4525,15 @@ "binop": null }, "value": "A", - "start": 899, - "end": 900, + "start": 970, + "end": 971, "loc": { "start": { - "line": 20, + "line": 23, "column": 16 }, "end": { - "line": 20, + "line": 23, "column": 17 } } @@ -2443,15 +4551,15 @@ "binop": null, "updateContext": null }, - "start": 900, - "end": 901, + "start": 971, + "end": 972, "loc": { "start": { - "line": 20, + "line": 23, "column": 17 }, "end": { - "line": 20, + "line": 23, "column": 18 } } @@ -2469,15 +4577,15 @@ "binop": null }, "value": "left", - "start": 901, - "end": 905, + "start": 972, + "end": 976, "loc": { "start": { - "line": 20, + "line": 23, "column": 18 }, "end": { - "line": 20, + "line": 23, "column": 22 } } @@ -2495,15 +4603,15 @@ "binop": null, "updateContext": null }, - "start": 905, - "end": 906, + "start": 976, + "end": 977, "loc": { "start": { - "line": 20, + "line": 23, "column": 22 }, "end": { - "line": 20, + "line": 23, "column": 23 } } @@ -2523,15 +4631,15 @@ "updateContext": null }, "value": "if", - "start": 911, - "end": 913, + "start": 982, + "end": 984, "loc": { "start": { - "line": 22, + "line": 25, "column": 3 }, "end": { - "line": 22, + "line": 25, "column": 5 } } @@ -2548,15 +4656,15 @@ "postfix": false, "binop": null }, - "start": 914, - "end": 915, + "start": 985, + "end": 986, "loc": { "start": { - "line": 22, + "line": 25, "column": 6 }, "end": { - "line": 22, + "line": 25, "column": 7 } } @@ -2574,15 +4682,15 @@ "binop": null }, "value": "node", - "start": 915, - "end": 919, + "start": 986, + "end": 990, "loc": { "start": { - "line": 22, + "line": 25, "column": 7 }, "end": { - "line": 22, + "line": 25, "column": 11 } } @@ -2600,15 +4708,15 @@ "binop": null, "updateContext": null }, - "start": 919, - "end": 920, + "start": 990, + "end": 991, "loc": { "start": { - "line": 22, + "line": 25, "column": 11 }, "end": { - "line": 22, + "line": 25, "column": 12 } } @@ -2626,15 +4734,15 @@ "binop": null }, "value": "isLeaf", - "start": 920, - "end": 926, + "start": 991, + "end": 997, "loc": { "start": { - "line": 22, + "line": 25, "column": 12 }, "end": { - "line": 22, + "line": 25, "column": 18 } } @@ -2651,15 +4759,15 @@ "postfix": false, "binop": null }, - "start": 926, - "end": 927, + "start": 997, + "end": 998, "loc": { "start": { - "line": 22, + "line": 25, "column": 18 }, "end": { - "line": 22, + "line": 25, "column": 19 } } @@ -2676,15 +4784,15 @@ "postfix": false, "binop": null }, - "start": 927, - "end": 928, + "start": 998, + "end": 999, "loc": { "start": { - "line": 22, + "line": 25, "column": 19 }, "end": { - "line": 22, + "line": 25, "column": 20 } } @@ -2701,15 +4809,15 @@ "postfix": false, "binop": null }, - "start": 928, - "end": 929, + "start": 999, + "end": 1000, "loc": { "start": { - "line": 22, + "line": 25, "column": 20 }, "end": { - "line": 22, + "line": 25, "column": 21 } } @@ -2726,15 +4834,15 @@ "postfix": false, "binop": null }, - "start": 930, - "end": 931, + "start": 1001, + "end": 1002, "loc": { "start": { - "line": 22, + "line": 25, "column": 22 }, "end": { - "line": 22, + "line": 25, "column": 23 } } @@ -2752,15 +4860,15 @@ "binop": null }, "value": "A", - "start": 936, - "end": 937, + "start": 1007, + "end": 1008, "loc": { "start": { - "line": 23, + "line": 26, "column": 4 }, "end": { - "line": 23, + "line": 26, "column": 5 } } @@ -2778,15 +4886,15 @@ "binop": null, "updateContext": null }, - "start": 937, - "end": 938, + "start": 1008, + "end": 1009, "loc": { "start": { - "line": 23, + "line": 26, "column": 5 }, "end": { - "line": 23, + "line": 26, "column": 6 } } @@ -2804,15 +4912,15 @@ "binop": null }, "value": "left", - "start": 938, - "end": 942, + "start": 1009, + "end": 1013, "loc": { "start": { - "line": 23, + "line": 26, "column": 6 }, "end": { - "line": 23, + "line": 26, "column": 10 } } @@ -2831,15 +4939,15 @@ "updateContext": null }, "value": "=", - "start": 943, - "end": 944, + "start": 1014, + "end": 1015, "loc": { "start": { - "line": 23, + "line": 26, "column": 11 }, "end": { - "line": 23, + "line": 26, "column": 12 } } @@ -2857,15 +4965,15 @@ "binop": null }, "value": "B", - "start": 945, - "end": 946, + "start": 1016, + "end": 1017, "loc": { "start": { - "line": 23, + "line": 26, "column": 13 }, "end": { - "line": 23, + "line": 26, "column": 14 } } @@ -2883,15 +4991,15 @@ "binop": null, "updateContext": null }, - "start": 946, - "end": 947, + "start": 1017, + "end": 1018, "loc": { "start": { - "line": 23, + "line": 26, "column": 14 }, "end": { - "line": 23, + "line": 26, "column": 15 } } @@ -2911,15 +5019,15 @@ "updateContext": null }, "value": "break", - "start": 952, - "end": 957, + "start": 1023, + "end": 1028, "loc": { "start": { - "line": 24, + "line": 27, "column": 4 }, "end": { - "line": 24, + "line": 27, "column": 9 } } @@ -2937,15 +5045,15 @@ "binop": null, "updateContext": null }, - "start": 957, - "end": 958, + "start": 1028, + "end": 1029, "loc": { "start": { - "line": 24, + "line": 27, "column": 9 }, "end": { - "line": 24, + "line": 27, "column": 10 } } @@ -2962,19 +5070,201 @@ "postfix": false, "binop": null }, - "start": 962, - "end": 963, + "start": 1033, + "end": 1034, "loc": { "start": { - "line": 25, + "line": 28, "column": 3 }, "end": { - "line": 25, + "line": 28, "column": 4 } } }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 1039, + "end": 1045, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1045, + "end": 1046, + "loc": { + "start": { + "line": 30, + "column": 9 + }, + "end": { + "line": 30, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 1046, + "end": 1050, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 14 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 1051, + "end": 1061, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 1062, + "end": 1066, + "loc": { + "start": { + "line": 30, + "column": 26 + }, + "end": { + "line": 30, + "column": 30 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1066, + "end": 1067, + "loc": { + "start": { + "line": 30, + "column": 30 + }, + "end": { + "line": 30, + "column": 31 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1067, + "end": 1068, + "loc": { + "start": { + "line": 30, + "column": 31 + }, + "end": { + "line": 30, + "column": 32 + } + } + }, { "type": { "label": "name", @@ -2988,15 +5278,15 @@ "binop": null }, "value": "A", - "start": 968, - "end": 969, + "start": 1072, + "end": 1073, "loc": { "start": { - "line": 27, + "line": 31, "column": 3 }, "end": { - "line": 27, + "line": 31, "column": 4 } } @@ -3015,15 +5305,15 @@ "updateContext": null }, "value": "=", - "start": 970, - "end": 971, + "start": 1074, + "end": 1075, "loc": { "start": { - "line": 27, + "line": 31, "column": 5 }, "end": { - "line": 27, + "line": 31, "column": 6 } } @@ -3041,15 +5331,15 @@ "binop": null }, "value": "node", - "start": 972, - "end": 976, + "start": 1076, + "end": 1080, "loc": { "start": { - "line": 27, + "line": 31, "column": 7 }, "end": { - "line": 27, + "line": 31, "column": 11 } } @@ -3067,15 +5357,15 @@ "binop": null, "updateContext": null }, - "start": 976, - "end": 977, + "start": 1080, + "end": 1081, "loc": { "start": { - "line": 27, + "line": 31, "column": 11 }, "end": { - "line": 27, + "line": 31, "column": 12 } } @@ -3092,15 +5382,15 @@ "postfix": false, "binop": null }, - "start": 980, - "end": 981, + "start": 1084, + "end": 1085, "loc": { "start": { - "line": 28, + "line": 32, "column": 2 }, "end": { - "line": 28, + "line": 32, "column": 3 } } @@ -3120,15 +5410,15 @@ "updateContext": null }, "value": "else", - "start": 982, - "end": 986, + "start": 1086, + "end": 1090, "loc": { "start": { - "line": 28, + "line": 32, "column": 4 }, "end": { - "line": 28, + "line": 32, "column": 8 } } @@ -3145,15 +5435,15 @@ "postfix": false, "binop": null }, - "start": 987, - "end": 988, + "start": 1091, + "end": 1092, "loc": { "start": { - "line": 28, + "line": 32, "column": 9 }, "end": { - "line": 28, + "line": 32, "column": 10 } } @@ -3173,15 +5463,15 @@ "updateContext": null }, "value": "const", - "start": 992, - "end": 997, + "start": 1096, + "end": 1101, "loc": { "start": { - "line": 29, + "line": 33, "column": 3 }, "end": { - "line": 29, + "line": 33, "column": 8 } } @@ -3199,15 +5489,15 @@ "binop": null }, "value": "node", - "start": 998, - "end": 1002, + "start": 1102, + "end": 1106, "loc": { "start": { - "line": 29, + "line": 33, "column": 9 }, "end": { - "line": 29, + "line": 33, "column": 13 } } @@ -3226,15 +5516,15 @@ "updateContext": null }, "value": "=", - "start": 1003, - "end": 1004, + "start": 1107, + "end": 1108, "loc": { "start": { - "line": 29, + "line": 33, "column": 14 }, "end": { - "line": 29, + "line": 33, "column": 15 } } @@ -3252,15 +5542,15 @@ "binop": null }, "value": "A", - "start": 1005, - "end": 1006, + "start": 1109, + "end": 1110, "loc": { "start": { - "line": 29, + "line": 33, "column": 16 }, "end": { - "line": 29, + "line": 33, "column": 17 } } @@ -3278,15 +5568,15 @@ "binop": null, "updateContext": null }, - "start": 1006, - "end": 1007, + "start": 1110, + "end": 1111, "loc": { "start": { - "line": 29, + "line": 33, "column": 17 }, "end": { - "line": 29, + "line": 33, "column": 18 } } @@ -3304,15 +5594,15 @@ "binop": null }, "value": "right", - "start": 1007, - "end": 1012, + "start": 1111, + "end": 1116, "loc": { "start": { - "line": 29, + "line": 33, "column": 18 }, "end": { - "line": 29, + "line": 33, "column": 23 } } @@ -3330,15 +5620,15 @@ "binop": null, "updateContext": null }, - "start": 1012, - "end": 1013, + "start": 1116, + "end": 1117, "loc": { "start": { - "line": 29, + "line": 33, "column": 23 }, "end": { - "line": 29, + "line": 33, "column": 24 } } @@ -3358,15 +5648,15 @@ "updateContext": null }, "value": "if", - "start": 1018, - "end": 1020, + "start": 1122, + "end": 1124, "loc": { "start": { - "line": 31, + "line": 35, "column": 3 }, "end": { - "line": 31, + "line": 35, "column": 5 } } @@ -3383,15 +5673,15 @@ "postfix": false, "binop": null }, - "start": 1021, - "end": 1022, + "start": 1125, + "end": 1126, "loc": { "start": { - "line": 31, + "line": 35, "column": 6 }, "end": { - "line": 31, + "line": 35, "column": 7 } } @@ -3409,15 +5699,15 @@ "binop": null }, "value": "node", - "start": 1022, - "end": 1026, + "start": 1126, + "end": 1130, "loc": { "start": { - "line": 31, + "line": 35, "column": 7 }, "end": { - "line": 31, + "line": 35, "column": 11 } } @@ -3435,15 +5725,15 @@ "binop": null, "updateContext": null }, - "start": 1026, - "end": 1027, + "start": 1130, + "end": 1131, "loc": { "start": { - "line": 31, + "line": 35, "column": 11 }, "end": { - "line": 31, + "line": 35, "column": 12 } } @@ -3461,15 +5751,15 @@ "binop": null }, "value": "isLeaf", - "start": 1027, - "end": 1033, + "start": 1131, + "end": 1137, "loc": { "start": { - "line": 31, + "line": 35, "column": 12 }, "end": { - "line": 31, + "line": 35, "column": 18 } } @@ -3486,15 +5776,15 @@ "postfix": false, "binop": null }, - "start": 1033, - "end": 1034, + "start": 1137, + "end": 1138, "loc": { "start": { - "line": 31, + "line": 35, "column": 18 }, "end": { - "line": 31, + "line": 35, "column": 19 } } @@ -3511,15 +5801,15 @@ "postfix": false, "binop": null }, - "start": 1034, - "end": 1035, + "start": 1138, + "end": 1139, "loc": { "start": { - "line": 31, + "line": 35, "column": 19 }, "end": { - "line": 31, + "line": 35, "column": 20 } } @@ -3536,15 +5826,15 @@ "postfix": false, "binop": null }, - "start": 1035, - "end": 1036, + "start": 1139, + "end": 1140, "loc": { "start": { - "line": 31, + "line": 35, "column": 20 }, "end": { - "line": 31, + "line": 35, "column": 21 } } @@ -3561,15 +5851,15 @@ "postfix": false, "binop": null }, - "start": 1037, - "end": 1038, + "start": 1141, + "end": 1142, "loc": { "start": { - "line": 31, + "line": 35, "column": 22 }, "end": { - "line": 31, + "line": 35, "column": 23 } } @@ -3587,22 +5877,207 @@ "binop": null }, "value": "A", - "start": 1043, - "end": 1044, + "start": 1147, + "end": 1148, + "loc": { + "start": { + "line": 36, + "column": 4 + }, + "end": { + "line": 36, + "column": 5 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1148, + "end": 1149, + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1149, + "end": 1154, + "loc": { + "start": { + "line": 36, + "column": 6 + }, + "end": { + "line": 36, + "column": 11 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1155, + "end": 1156, + "loc": { + "start": { + "line": 36, + "column": 12 + }, + "end": { + "line": 36, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1157, + "end": 1158, + "loc": { + "start": { + "line": 36, + "column": 14 + }, + "end": { + "line": 36, + "column": 15 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1158, + "end": 1159, + "loc": { + "start": { + "line": 36, + "column": 15 + }, + "end": { + "line": 36, + "column": 16 + } + } + }, + { + "type": { + "label": "break", + "keyword": "break", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "break", + "start": 1164, + "end": 1169, + "loc": { + "start": { + "line": 37, + "column": 4 + }, + "end": { + "line": 37, + "column": 9 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1169, + "end": 1170, "loc": { "start": { - "line": 32, - "column": 4 + "line": 37, + "column": 9 }, "end": { - "line": 32, - "column": 5 + "line": 37, + "column": 10 } } }, { "type": { - "label": ".", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3610,19 +6085,18 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1044, - "end": 1045, + "start": 1174, + "end": 1175, "loc": { "start": { - "line": 32, - "column": 5 + "line": 38, + "column": 3 }, "end": { - "line": 32, - "column": 6 + "line": 38, + "column": 4 } } }, @@ -3638,44 +6112,42 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1045, - "end": 1050, + "value": "assert", + "start": 1180, + "end": 1186, "loc": { "start": { - "line": 32, - "column": 6 + "line": 40, + "column": 3 }, "end": { - "line": 32, - "column": 11 + "line": 40, + "column": 9 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 1051, - "end": 1052, + "start": 1186, + "end": 1187, "loc": { "start": { - "line": 32, - "column": 12 + "line": 40, + "column": 9 }, "end": { - "line": 32, - "column": 13 + "line": 40, + "column": 10 } } }, @@ -3691,23 +6163,24 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 1053, - "end": 1054, + "value": "node", + "start": 1187, + "end": 1191, "loc": { "start": { - "line": 32, - "column": 14 + "line": 40, + "column": 10 }, "end": { - "line": 32, - "column": 15 + "line": 40, + "column": 14 } } }, { "type": { - "label": ";", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3715,98 +6188,97 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 1054, - "end": 1055, + "value": "instanceof", + "start": 1192, + "end": 1202, "loc": { "start": { - "line": 32, + "line": 40, "column": 15 }, "end": { - "line": 32, - "column": 16 + "line": 40, + "column": 25 } } }, { "type": { - "label": "break", - "keyword": "break", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "break", - "start": 1060, - "end": 1065, + "value": "Node", + "start": 1203, + "end": 1207, "loc": { "start": { - "line": 33, - "column": 4 + "line": 40, + "column": 26 }, "end": { - "line": 33, - "column": 9 + "line": 40, + "column": 30 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1065, - "end": 1066, + "start": 1207, + "end": 1208, "loc": { "start": { - "line": 33, - "column": 9 + "line": 40, + "column": 30 }, "end": { - "line": 33, - "column": 10 + "line": 40, + "column": 31 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1070, - "end": 1071, + "start": 1208, + "end": 1209, "loc": { "start": { - "line": 34, - "column": 3 + "line": 40, + "column": 31 }, "end": { - "line": 34, - "column": 4 + "line": 40, + "column": 32 } } }, @@ -3823,15 +6295,15 @@ "binop": null }, "value": "A", - "start": 1076, - "end": 1077, + "start": 1213, + "end": 1214, "loc": { "start": { - "line": 36, + "line": 41, "column": 3 }, "end": { - "line": 36, + "line": 41, "column": 4 } } @@ -3850,15 +6322,15 @@ "updateContext": null }, "value": "=", - "start": 1078, - "end": 1079, + "start": 1215, + "end": 1216, "loc": { "start": { - "line": 36, + "line": 41, "column": 5 }, "end": { - "line": 36, + "line": 41, "column": 6 } } @@ -3876,15 +6348,15 @@ "binop": null }, "value": "node", - "start": 1080, - "end": 1084, + "start": 1217, + "end": 1221, "loc": { "start": { - "line": 36, + "line": 41, "column": 7 }, "end": { - "line": 36, + "line": 41, "column": 11 } } @@ -3902,15 +6374,15 @@ "binop": null, "updateContext": null }, - "start": 1084, - "end": 1085, + "start": 1221, + "end": 1222, "loc": { "start": { - "line": 36, + "line": 41, "column": 11 }, "end": { - "line": 36, + "line": 41, "column": 12 } } @@ -3927,15 +6399,15 @@ "postfix": false, "binop": null }, - "start": 1088, - "end": 1089, + "start": 1225, + "end": 1226, "loc": { "start": { - "line": 37, + "line": 42, "column": 2 }, "end": { - "line": 37, + "line": 42, "column": 3 } } @@ -3952,15 +6424,15 @@ "postfix": false, "binop": null }, - "start": 1091, - "end": 1092, + "start": 1228, + "end": 1229, "loc": { "start": { - "line": 38, + "line": 43, "column": 1 }, "end": { - "line": 38, + "line": 43, "column": 2 } } @@ -3978,15 +6450,15 @@ "binop": null }, "value": "B", - "start": 1095, - "end": 1096, + "start": 1232, + "end": 1233, "loc": { "start": { - "line": 40, + "line": 45, "column": 1 }, "end": { - "line": 40, + "line": 45, "column": 2 } } @@ -4004,15 +6476,15 @@ "binop": null, "updateContext": null }, - "start": 1096, - "end": 1097, + "start": 1233, + "end": 1234, "loc": { "start": { - "line": 40, + "line": 45, "column": 2 }, "end": { - "line": 40, + "line": 45, "column": 3 } } @@ -4030,15 +6502,15 @@ "binop": null }, "value": "parent", - "start": 1097, - "end": 1103, + "start": 1234, + "end": 1240, "loc": { "start": { - "line": 40, + "line": 45, "column": 3 }, "end": { - "line": 40, + "line": 45, "column": 9 } } @@ -4057,15 +6529,15 @@ "updateContext": null }, "value": "=", - "start": 1104, - "end": 1105, + "start": 1241, + "end": 1242, "loc": { "start": { - "line": 40, + "line": 45, "column": 10 }, "end": { - "line": 40, + "line": 45, "column": 11 } } @@ -4083,15 +6555,15 @@ "binop": null }, "value": "A", - "start": 1106, - "end": 1107, + "start": 1243, + "end": 1244, "loc": { "start": { - "line": 40, + "line": 45, "column": 12 }, "end": { - "line": 40, + "line": 45, "column": 13 } } @@ -4109,15 +6581,15 @@ "binop": null, "updateContext": null }, - "start": 1107, - "end": 1108, + "start": 1244, + "end": 1245, "loc": { "start": { - "line": 40, + "line": 45, "column": 13 }, "end": { - "line": 40, + "line": 45, "column": 14 } } @@ -4137,15 +6609,15 @@ "updateContext": null }, "value": "return", - "start": 1111, - "end": 1117, + "start": 1248, + "end": 1254, "loc": { "start": { - "line": 42, + "line": 47, "column": 1 }, "end": { - "line": 42, + "line": 47, "column": 7 } } @@ -4163,15 +6635,15 @@ "binop": null }, "value": "B", - "start": 1118, - "end": 1119, + "start": 1255, + "end": 1256, "loc": { "start": { - "line": 42, + "line": 47, "column": 8 }, "end": { - "line": 42, + "line": 47, "column": 9 } } @@ -4189,15 +6661,15 @@ "binop": null, "updateContext": null }, - "start": 1119, - "end": 1120, + "start": 1256, + "end": 1257, "loc": { "start": { - "line": 42, + "line": 47, "column": 9 }, "end": { - "line": 42, + "line": 47, "column": 10 } } @@ -4214,15 +6686,15 @@ "postfix": false, "binop": null }, - "start": 1121, - "end": 1122, + "start": 1258, + "end": 1259, "loc": { "start": { - "line": 43, + "line": 48, "column": 0 }, "end": { - "line": 43, + "line": 48, "column": 1 } } @@ -4240,19 +6712,127 @@ "binop": null, "updateContext": null }, - "start": 1122, - "end": 1123, + "start": 1259, + "end": 1260, "loc": { "start": { - "line": 43, + "line": 48, "column": 1 }, "end": { - "line": 43, + "line": 48, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1262, + "end": 1268, + "loc": { + "start": { + "line": 50, + "column": 0 + }, + "end": { + "line": 50, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1269, + "end": 1276, + "loc": { + "start": { + "line": 50, + "column": 7 + }, + "end": { + "line": 50, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert", + "start": 1277, + "end": 1283, + "loc": { + "start": { + "line": 50, + "column": 15 + }, + "end": { + "line": 50, + "column": 21 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1283, + "end": 1284, + "loc": { + "start": { + "line": 50, + "column": 21 + }, + "end": { + "line": 50, + "column": 22 + } + } + }, { "type": { "label": "eof", @@ -4266,15 +6846,15 @@ "binop": null, "updateContext": null }, - "start": 1124, - "end": 1124, + "start": 1285, + "end": 1285, "loc": { "start": { - "line": 44, + "line": 51, "column": 0 }, "end": { - "line": 44, + "line": 51, "column": 0 } } diff --git a/ast/source/insertion/insert_case1.js.json b/ast/source/insertion/insert_case1.js.json index 9c52ab9..153742a 100644 --- a/ast/source/insertion/insert_case1.js.json +++ b/ast/source/insertion/insert_case1.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 397, + "end": 671, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 21, + "line": 31, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 397, + "end": 671, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 21, + "line": 31, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 40, + "end": 28, "loc": { "start": { "line": 1, @@ -39,53 +39,174 @@ }, "end": { "line": 1, - "column": 40 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 40, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 }, "identifierName": "BLACK" }, @@ -95,16 +216,16 @@ ], "source": { "type": "StringLiteral", - "start": 20, - "end": 39, + "start": 84, + "end": 103, "loc": { "start": { - "line": 1, - "column": 20 + "line": 3, + "column": 18 }, "end": { - "line": 1, - "column": 39 + "line": 3, + "column": 37 } }, "extra": { @@ -116,62 +237,114 @@ }, { "type": "ImportDeclaration", - "start": 41, - "end": 88, + "start": 105, + "end": 139, "loc": { "start": { - "line": 2, + "line": 4, "column": 0 }, "end": { - "line": 2, - "column": 47 + "line": 4, + "column": 34 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 49, - "end": 61, + "type": "ImportDefaultSpecifier", + "start": 112, + "end": 115, "loc": { "start": { - "line": 2, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 2, - "column": 20 + "line": 4, + "column": 10 } }, - "imported": { + "local": { "type": "Identifier", - "start": 49, - "end": 61, + "start": 112, + "end": 115, "loc": { "start": { - "line": 2, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 2, - "column": 20 + "line": 4, + "column": 10 }, - "identifierName": "insert_case2" + "identifierName": "RED" }, - "name": "insert_case2" + "name": "RED" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + }, + "extra": { + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" + }, + "value": "../color/RED.js" + } + }, + { + "type": "ImportDeclaration", + "start": 140, + "end": 185, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 159, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } }, "local": { "type": "Identifier", - "start": 49, - "end": 61, + "start": 147, + "end": 159, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 20 + "line": 5, + "column": 19 }, "identifierName": "insert_case2" }, @@ -181,16 +354,16 @@ ], "source": { "type": "StringLiteral", - "start": 68, - "end": 87, + "start": 165, + "end": 184, "loc": { "start": { - "line": 2, - "column": 27 + "line": 5, + "column": 25 }, "end": { - "line": 2, - "column": 46 + "line": 5, + "column": 44 } }, "extra": { @@ -202,16 +375,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 172, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 299, "loc": { "start": { - "line": 4, + "line": 7, "column": 0 }, "end": { - "line": 9, + "line": 13, "column": 3 } } @@ -219,290 +392,289 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 173, - "end": 396, + "type": "Identifier", + "start": 300, + "end": 640, "loc": { "start": { - "line": 10, + "line": 14, "column": 0 }, "end": { - "line": 20, + "line": 28, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 180, - "end": 396, - "loc": { - "start": { - "line": 10, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 306, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 28, + "column": 1 + } }, - "end": { - "line": 20, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 186, - "end": 395, + "id": { + "type": "Identifier", + "start": 306, + "end": 318, "loc": { "start": { - "line": 10, - "column": 13 + "line": 14, + "column": 6 }, "end": { - "line": 20, + "line": 14, + "column": 18 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 321, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 28, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 186, - "end": 198, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 25 + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + }, + "identifierName": "n" }, - "identifierName": "insert_case1" - }, - "name": "insert_case1", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 201, - "end": 395, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 328, + "end": 639, "loc": { "start": { - "line": 10, + "line": 14, "column": 28 }, "end": { - "line": 20, + "line": 28, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 186, - "end": 198, - "loc": { - "start": { - "line": 10, - "column": 13 - }, - "end": { - "line": 10, - "column": 25 - }, - "identifierName": "insert_case1" - }, - "name": "insert_case1", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 202, - "end": 203, + "type": "ExpressionStatement", + "start": 331, + "end": 357, "loc": { "start": { - "line": 10, - "column": 29 + "line": 15, + "column": 1 }, "end": { - "line": 10, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 208, - "end": 395, - "loc": { - "start": { - "line": 10, - "column": 35 + "line": 15, + "column": 27 + } }, - "end": { - "line": 20, - "column": 1 - } - }, - "body": [ - { - "type": "IfStatement", - "start": 330, - "end": 393, + "expression": { + "type": "CallExpression", + "start": 331, + "end": 356, "loc": { "start": { - "line": 18, + "line": 15, "column": 1 }, "end": { - "line": 19, - "column": 22 + "line": 15, + "column": 26 } }, - "test": { - "type": "BinaryExpression", - "start": 334, - "end": 351, + "callee": { + "type": "Identifier", + "start": 331, + "end": 337, "loc": { "start": { - "line": 18, - "column": 5 + "line": 15, + "column": 1 }, "end": { - "line": 18, - "column": 22 - } + "line": 15, + "column": 7 + }, + "identifierName": "assert" }, - "left": { - "type": "MemberExpression", - "start": 334, - "end": 342, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 338, + "end": 355, "loc": { "start": { - "line": 18, - "column": 5 + "line": 15, + "column": 8 }, "end": { - "line": 18, - "column": 13 + "line": 15, + "column": 25 } }, - "object": { + "left": { "type": "Identifier", - "start": 334, - "end": 335, + "start": 338, + "end": 339, "loc": { "start": { - "line": 18, - "column": 5 + "line": 15, + "column": 8 }, "end": { - "line": 18, - "column": 6 + "line": 15, + "column": 9 }, "identifierName": "n" }, - "name": "n", - "leadingComments": null + "name": "n" }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 336, - "end": 342, + "start": 351, + "end": 355, "loc": { "start": { - "line": 18, - "column": 7 + "line": 15, + "column": 21 }, "end": { - "line": 18, - "column": 13 + "line": 15, + "column": 25 }, - "identifierName": "parent" + "identifierName": "Node" }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "NullLiteral", - "start": 347, - "end": 351, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 22 - } + "name": "Node" } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 359, + "end": 384, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 359, + "end": 383, + "loc": { + "start": { + "line": 16, + "column": 1 }, - "leadingComments": null + "end": { + "line": 16, + "column": 25 + } }, - "consequent": { - "type": "ExpressionStatement", - "start": 353, - "end": 370, + "callee": { + "type": "Identifier", + "start": 359, + "end": 365, "loc": { "start": { - "line": 18, - "column": 24 + "line": 16, + "column": 1 }, "end": { - "line": 18, - "column": 41 - } + "line": 16, + "column": 7 + }, + "identifierName": "assert" }, - "expression": { - "type": "AssignmentExpression", - "start": 353, - "end": 369, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 366, + "end": 382, "loc": { "start": { - "line": 18, - "column": 24 + "line": 16, + "column": 8 }, "end": { - "line": 18, - "column": 40 + "line": 16, + "column": 24 } }, - "operator": "=", "left": { "type": "MemberExpression", - "start": 353, - "end": 361, + "start": 366, + "end": 374, "loc": { "start": { - "line": 18, - "column": 24 + "line": 16, + "column": 8 }, "end": { - "line": 18, - "column": 32 + "line": 16, + "column": 16 } }, "object": { "type": "Identifier", - "start": 353, - "end": 354, + "start": 366, + "end": 367, "loc": { "start": { - "line": 18, - "column": 24 + "line": 16, + "column": 8 }, "end": { - "line": 18, - "column": 25 + "line": 16, + "column": 9 }, "identifierName": "n" }, @@ -510,16 +682,16 @@ }, "property": { "type": "Identifier", - "start": 355, - "end": 361, + "start": 368, + "end": 374, "loc": { "start": { - "line": 18, - "column": 26 + "line": 16, + "column": 10 }, "end": { - "line": 18, - "column": 32 + "line": 16, + "column": 16 }, "identifierName": "_color" }, @@ -527,227 +699,2992 @@ }, "computed": false }, + "operator": "===", "right": { "type": "Identifier", - "start": 364, - "end": 369, + "start": 379, + "end": 382, "loc": { "start": { - "line": 18, - "column": 35 + "line": 16, + "column": 21 }, "end": { - "line": 18, - "column": 40 + "line": 16, + "column": 24 }, - "identifierName": "BLACK" + "identifierName": "RED" }, - "name": "BLACK" + "name": "RED" } } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 386, + "end": 418, + "loc": { + "start": { + "line": 17, + "column": 1 }, - "alternate": { - "type": "ExpressionStatement", - "start": 377, - "end": 393, + "end": { + "line": 17, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 386, + "end": 417, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 386, + "end": 392, "loc": { "start": { - "line": 19, - "column": 6 + "line": 17, + "column": 1 }, "end": { - "line": 19, - "column": 22 - } + "line": 17, + "column": 7 + }, + "identifierName": "assert" }, - "expression": { - "type": "CallExpression", - "start": 377, - "end": 392, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 393, + "end": 416, "loc": { "start": { - "line": 19, - "column": 6 + "line": 17, + "column": 8 }, "end": { - "line": 19, - "column": 21 + "line": 17, + "column": 31 } }, - "callee": { - "type": "Identifier", - "start": 377, - "end": 389, + "left": { + "type": "MemberExpression", + "start": 393, + "end": 406, "loc": { "start": { - "line": 19, - "column": 6 + "line": 17, + "column": 8 }, "end": { - "line": 19, - "column": 18 + "line": 17, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 393, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 14 + } }, - "identifierName": "insert_case2" + "object": { + "type": "Identifier", + "start": 393, + "end": 394, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 395, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "name": "insert_case2" - }, - "arguments": [ - { + "property": { "type": "Identifier", - "start": 390, - "end": 391, + "start": 400, + "end": 406, "loc": { "start": { - "line": 19, - "column": 19 + "line": 17, + "column": 15 }, "end": { - "line": 19, - "column": 20 + "line": 17, + "column": 21 }, - "identifierName": "n" + "identifierName": "_color" }, - "name": "n" - } - ] + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 411, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 420, + "end": 453, + "loc": { + "start": { + "line": 18, + "column": 1 }, - "leadingComments": [ + "end": { + "line": 18, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 420, + "end": 452, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 211, - "end": 328, + "type": "BinaryExpression", + "start": 427, + "end": 451, "loc": { "start": { - "line": 11, - "column": 1 + "line": 18, + "column": 8 }, "end": { - "line": 17, - "column": 4 + "line": 18, + "column": 32 } + }, + "left": { + "type": "MemberExpression", + "start": 427, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 427, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 429, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 435, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 446, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } } ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 172, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 9, - "column": 3 - } - } - } + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 574, + "end": 637, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "test": { + "type": "BinaryExpression", + "start": 578, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 578, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 578, + "end": 579, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 580, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 591, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 22 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 597, + "end": 614, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 41 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 597, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 40 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 597, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 32 + } + }, + "object": { + "type": "Identifier", + "start": 597, + "end": 598, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 599, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 32 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 608, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 40 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 621, + "end": 637, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 621, + "end": 636, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 621, + "end": 633, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2" + }, + "arguments": [ + { + "type": "Identifier", + "start": 634, + "end": 635, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 642, + "end": 670, + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 657, + "end": 669, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 27 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 642, + "end": 670, + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 300, + "end": 640, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 28, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 306, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 321, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 328, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 331, + "end": 357, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 331, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 331, + "end": 337, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 338, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 338, + "end": 339, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 351, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 359, + "end": 384, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 359, + "end": 383, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 359, + "end": 365, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 366, + "end": 382, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 366, + "end": 374, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 366, + "end": 367, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 368, + "end": 374, + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 379, + "end": 382, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 386, + "end": 418, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 386, + "end": 417, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 386, + "end": 392, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 393, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 393, + "end": 406, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 393, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 393, + "end": 394, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 395, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 400, + "end": 406, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 411, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 420, + "end": 453, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 420, + "end": 452, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 427, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 427, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 427, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 429, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 435, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 446, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 574, + "end": 637, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "test": { + "type": "BinaryExpression", + "start": 578, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 578, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 578, + "end": 579, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 580, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 591, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 22 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 597, + "end": 614, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 41 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 597, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 40 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 597, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 32 + } + }, + "object": { + "type": "Identifier", + "start": 597, + "end": 598, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 599, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 32 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 608, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 40 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 621, + "end": 637, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 621, + "end": 636, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 621, + "end": 633, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2" + }, + "arguments": [ + { + "type": "Identifier", + "start": 634, + "end": 635, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 299, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } ], "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 299, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case2", + "start": 147, + "end": 159, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 160, + "end": 164, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case2.js", + "start": 165, + "end": 184, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 184, + "end": 185, + "loc": { + "start": { + "line": 5, + "column": 44 + }, + "end": { + "line": 5, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 299, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 300, + "end": 305, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case1", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 319, + "end": 320, + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 321, + "end": 322, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 323, + "end": 324, + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 325, + "end": 327, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 328, + "end": 329, + "loc": { + "start": { + "line": 14, + "column": 28 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 172, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 9, - "column": 3 - } - } - } - ] + "end": { + "line": 14, + "column": 29 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 172, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 331, + "end": 337, "loc": { "start": { - "line": 4, - "column": 0 + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 337, + "end": 338, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 338, + "end": 339, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 340, + "end": 350, + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 351, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 355, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 356, + "end": 357, + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 359, + "end": 365, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 365, + "end": 366, + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 366, + "end": 367, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 367, + "end": 368, + "loc": { + "start": { + "line": 16, + "column": 9 }, "end": { - "line": 9, - "column": 3 + "line": 16, + "column": 10 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 211, - "end": 328, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 368, + "end": 374, "loc": { "start": { - "line": 11, - "column": 1 + "line": 16, + "column": 10 }, "end": { - "line": 17, - "column": 4 + "line": 16, + "column": 16 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "===", + "start": 375, + "end": 378, "loc": { "start": { - "line": 1, - "column": 0 + "line": 16, + "column": 17 }, "end": { - "line": 1, - "column": 6 + "line": 16, + "column": 20 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -756,24 +3693,25 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "value": "RED", + "start": 379, + "end": 382, "loc": { "start": { - "line": 1, - "column": 7 + "line": 16, + "column": 21 }, "end": { - "line": 1, - "column": 8 + "line": 16, + "column": 24 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -781,42 +3719,42 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "start": 382, + "end": 383, "loc": { "start": { - "line": 1, - "column": 8 + "line": 16, + "column": 24 }, "end": { - "line": 1, - "column": 13 + "line": 16, + "column": 25 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 13, - "end": 14, + "start": 383, + "end": 384, "loc": { "start": { - "line": 1, - "column": 13 + "line": 16, + "column": 25 }, "end": { - "line": 1, - "column": 14 + "line": 16, + "column": 26 } } }, @@ -832,23 +3770,48 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 15, - "end": 19, + "value": "assert", + "start": 386, + "end": 392, "loc": { "start": { - "line": 1, - "column": 15 + "line": 17, + "column": 1 }, "end": { - "line": 1, - "column": 19 + "line": 17, + "column": 7 } } }, { "type": { - "label": "string", + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 392, + "end": 393, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -856,27 +3819,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/BLACK.js", - "start": 20, - "end": 39, + "value": "n", + "start": 393, + "end": 394, "loc": { "start": { - "line": 1, - "column": 20 + "line": 17, + "column": 8 }, "end": { - "line": 1, - "column": 39 + "line": 17, + "column": 9 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -886,23 +3848,22 @@ "binop": null, "updateContext": null }, - "start": 39, - "end": 40, + "start": 394, + "end": 395, "loc": { "start": { - "line": 1, - "column": 39 + "line": 17, + "column": 9 }, "end": { - "line": 1, - "column": 40 + "line": 17, + "column": 10 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -910,45 +3871,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 41, - "end": 47, + "value": "left", + "start": 395, + "end": 399, "loc": { "start": { - "line": 2, - "column": 0 + "line": 17, + "column": 10 }, "end": { - "line": 2, - "column": 6 + "line": 17, + "column": 14 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 48, - "end": 49, + "start": 399, + "end": 400, "loc": { "start": { - "line": 2, - "column": 7 + "line": 17, + "column": 14 }, "end": { - "line": 2, - "column": 8 + "line": 17, + "column": 15 } } }, @@ -964,42 +3925,44 @@ "postfix": false, "binop": null }, - "value": "insert_case2", - "start": 49, - "end": 61, + "value": "_color", + "start": 400, + "end": 406, "loc": { "start": { - "line": 2, - "column": 8 + "line": 17, + "column": 15 }, "end": { - "line": 2, - "column": 20 + "line": 17, + "column": 21 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 61, - "end": 62, + "value": "===", + "start": 407, + "end": 410, "loc": { "start": { - "line": 2, - "column": 20 + "line": 17, + "column": 22 }, "end": { - "line": 2, - "column": 21 + "line": 17, + "column": 25 } } }, @@ -1015,44 +3978,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 63, - "end": 67, + "value": "BLACK", + "start": 411, + "end": 416, "loc": { "start": { - "line": 2, - "column": 22 + "line": 17, + "column": 26 }, "end": { - "line": 2, - "column": 26 + "line": 17, + "column": 31 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./insert_case2.js", - "start": 68, - "end": 87, + "start": 416, + "end": 417, "loc": { "start": { - "line": 2, - "column": 27 + "line": 17, + "column": 31 }, "end": { - "line": 2, - "column": 46 + "line": 17, + "column": 32 } } }, @@ -1069,67 +4030,99 @@ "binop": null, "updateContext": null }, - "start": 87, - "end": 88, + "start": 417, + "end": 418, "loc": { "start": { - "line": 2, - "column": 46 + "line": 17, + "column": 32 }, "end": { - "line": 2, - "column": 47 + "line": 17, + "column": 33 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 172, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 426, + "end": 427, "loc": { "start": { - "line": 4, - "column": 0 + "line": 18, + "column": 7 }, "end": { - "line": 9, - "column": 3 + "line": 18, + "column": 8 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 173, - "end": 179, + "value": "n", + "start": 427, + "end": 428, "loc": { "start": { - "line": 10, - "column": 0 + "line": 18, + "column": 8 }, "end": { - "line": 10, - "column": 6 + "line": 18, + "column": 9 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1140,17 +4133,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 180, - "end": 185, + "start": 428, + "end": 429, "loc": { "start": { - "line": 10, - "column": 7 + "line": 18, + "column": 9 }, "end": { - "line": 10, - "column": 12 + "line": 18, + "column": 10 } } }, @@ -1166,51 +4158,50 @@ "postfix": false, "binop": null }, - "value": "insert_case1", - "start": 186, - "end": 198, + "value": "right", + "start": 429, + "end": 434, "loc": { "start": { - "line": 10, - "column": 13 + "line": 18, + "column": 10 }, "end": { - "line": 10, - "column": 25 + "line": 18, + "column": 15 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 199, - "end": 200, + "start": 434, + "end": 435, "loc": { "start": { - "line": 10, - "column": 26 + "line": 18, + "column": 15 }, "end": { - "line": 10, - "column": 27 + "line": 18, + "column": 16 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1219,50 +4210,52 @@ "postfix": false, "binop": null }, - "start": 201, - "end": 202, + "value": "_color", + "start": 435, + "end": 441, "loc": { "start": { - "line": 10, - "column": 28 + "line": 18, + "column": 16 }, "end": { - "line": 10, - "column": 29 + "line": 18, + "column": 22 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "n", - "start": 202, - "end": 203, + "value": "===", + "start": 442, + "end": 445, "loc": { "start": { - "line": 10, - "column": 29 + "line": 18, + "column": 23 }, "end": { - "line": 10, - "column": 30 + "line": 18, + "column": 26 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1270,82 +4263,83 @@ "postfix": false, "binop": null }, - "start": 203, - "end": 204, + "value": "BLACK", + "start": 446, + "end": 451, "loc": { "start": { - "line": 10, - "column": 30 + "line": 18, + "column": 27 }, "end": { - "line": 10, - "column": 31 + "line": 18, + "column": 32 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 205, - "end": 207, + "start": 451, + "end": 452, "loc": { "start": { - "line": 10, + "line": 18, "column": 32 }, "end": { - "line": 10, - "column": 34 + "line": 18, + "column": 33 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 208, - "end": 209, + "start": 452, + "end": 453, "loc": { "start": { - "line": 10, - "column": 35 + "line": 18, + "column": 33 }, "end": { - "line": 10, - "column": 36 + "line": 18, + "column": 34 } } }, { "type": "CommentBlock", "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 211, - "end": 328, + "start": 455, + "end": 572, "loc": { "start": { - "line": 11, + "line": 19, "column": 1 }, "end": { - "line": 17, + "line": 25, "column": 4 } } @@ -1365,15 +4359,15 @@ "updateContext": null }, "value": "if", - "start": 330, - "end": 332, + "start": 574, + "end": 576, "loc": { "start": { - "line": 18, + "line": 26, "column": 1 }, "end": { - "line": 18, + "line": 26, "column": 3 } } @@ -1390,15 +4384,15 @@ "postfix": false, "binop": null }, - "start": 333, - "end": 334, + "start": 577, + "end": 578, "loc": { "start": { - "line": 18, + "line": 26, "column": 4 }, "end": { - "line": 18, + "line": 26, "column": 5 } } @@ -1416,15 +4410,15 @@ "binop": null }, "value": "n", - "start": 334, - "end": 335, + "start": 578, + "end": 579, "loc": { "start": { - "line": 18, + "line": 26, "column": 5 }, "end": { - "line": 18, + "line": 26, "column": 6 } } @@ -1442,15 +4436,15 @@ "binop": null, "updateContext": null }, - "start": 335, - "end": 336, + "start": 579, + "end": 580, "loc": { "start": { - "line": 18, + "line": 26, "column": 6 }, "end": { - "line": 18, + "line": 26, "column": 7 } } @@ -1468,15 +4462,15 @@ "binop": null }, "value": "parent", - "start": 336, - "end": 342, + "start": 580, + "end": 586, "loc": { "start": { - "line": 18, + "line": 26, "column": 7 }, "end": { - "line": 18, + "line": 26, "column": 13 } } @@ -1495,15 +4489,15 @@ "updateContext": null }, "value": "===", - "start": 343, - "end": 346, + "start": 587, + "end": 590, "loc": { "start": { - "line": 18, + "line": 26, "column": 14 }, "end": { - "line": 18, + "line": 26, "column": 17 } } @@ -1523,15 +4517,15 @@ "updateContext": null }, "value": "null", - "start": 347, - "end": 351, + "start": 591, + "end": 595, "loc": { "start": { - "line": 18, + "line": 26, "column": 18 }, "end": { - "line": 18, + "line": 26, "column": 22 } } @@ -1548,15 +4542,15 @@ "postfix": false, "binop": null }, - "start": 351, - "end": 352, + "start": 595, + "end": 596, "loc": { "start": { - "line": 18, + "line": 26, "column": 22 }, "end": { - "line": 18, + "line": 26, "column": 23 } } @@ -1574,15 +4568,15 @@ "binop": null }, "value": "n", - "start": 353, - "end": 354, + "start": 597, + "end": 598, "loc": { "start": { - "line": 18, + "line": 26, "column": 24 }, "end": { - "line": 18, + "line": 26, "column": 25 } } @@ -1600,15 +4594,15 @@ "binop": null, "updateContext": null }, - "start": 354, - "end": 355, + "start": 598, + "end": 599, "loc": { "start": { - "line": 18, + "line": 26, "column": 25 }, "end": { - "line": 18, + "line": 26, "column": 26 } } @@ -1626,15 +4620,15 @@ "binop": null }, "value": "_color", - "start": 355, - "end": 361, + "start": 599, + "end": 605, "loc": { "start": { - "line": 18, + "line": 26, "column": 26 }, "end": { - "line": 18, + "line": 26, "column": 32 } } @@ -1653,15 +4647,15 @@ "updateContext": null }, "value": "=", - "start": 362, - "end": 363, + "start": 606, + "end": 607, "loc": { "start": { - "line": 18, + "line": 26, "column": 33 }, "end": { - "line": 18, + "line": 26, "column": 34 } } @@ -1679,15 +4673,15 @@ "binop": null }, "value": "BLACK", - "start": 364, - "end": 369, + "start": 608, + "end": 613, "loc": { "start": { - "line": 18, + "line": 26, "column": 35 }, "end": { - "line": 18, + "line": 26, "column": 40 } } @@ -1705,15 +4699,15 @@ "binop": null, "updateContext": null }, - "start": 369, - "end": 370, + "start": 613, + "end": 614, "loc": { "start": { - "line": 18, + "line": 26, "column": 40 }, "end": { - "line": 18, + "line": 26, "column": 41 } } @@ -1733,15 +4727,15 @@ "updateContext": null }, "value": "else", - "start": 372, - "end": 376, + "start": 616, + "end": 620, "loc": { "start": { - "line": 19, + "line": 27, "column": 1 }, "end": { - "line": 19, + "line": 27, "column": 5 } } @@ -1759,15 +4753,15 @@ "binop": null }, "value": "insert_case2", - "start": 377, - "end": 389, + "start": 621, + "end": 633, "loc": { "start": { - "line": 19, + "line": 27, "column": 6 }, "end": { - "line": 19, + "line": 27, "column": 18 } } @@ -1784,15 +4778,15 @@ "postfix": false, "binop": null }, - "start": 389, - "end": 390, + "start": 633, + "end": 634, "loc": { "start": { - "line": 19, + "line": 27, "column": 18 }, "end": { - "line": 19, + "line": 27, "column": 19 } } @@ -1810,15 +4804,15 @@ "binop": null }, "value": "n", - "start": 390, - "end": 391, + "start": 634, + "end": 635, "loc": { "start": { - "line": 19, + "line": 27, "column": 19 }, "end": { - "line": 19, + "line": 27, "column": 20 } } @@ -1835,15 +4829,15 @@ "postfix": false, "binop": null }, - "start": 391, - "end": 392, + "start": 635, + "end": 636, "loc": { "start": { - "line": 19, + "line": 27, "column": 20 }, "end": { - "line": 19, + "line": 27, "column": 21 } } @@ -1861,15 +4855,15 @@ "binop": null, "updateContext": null }, - "start": 392, - "end": 393, + "start": 636, + "end": 637, "loc": { "start": { - "line": 19, + "line": 27, "column": 21 }, "end": { - "line": 19, + "line": 27, "column": 22 } } @@ -1886,15 +4880,15 @@ "postfix": false, "binop": null }, - "start": 394, - "end": 395, + "start": 638, + "end": 639, "loc": { "start": { - "line": 20, + "line": 28, "column": 0 }, "end": { - "line": 20, + "line": 28, "column": 1 } } @@ -1912,19 +4906,127 @@ "binop": null, "updateContext": null }, - "start": 395, - "end": 396, + "start": 639, + "end": 640, "loc": { "start": { - "line": 20, + "line": 28, "column": 1 }, "end": { - "line": 20, + "line": 28, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 642, + "end": 648, + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 649, + "end": 656, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case1", + "start": 657, + "end": 669, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 669, + "end": 670, + "loc": { + "start": { + "line": 30, + "column": 27 + }, + "end": { + "line": 30, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -1938,15 +5040,15 @@ "binop": null, "updateContext": null }, - "start": 397, - "end": 397, + "start": 671, + "end": 671, "loc": { "start": { - "line": 21, + "line": 31, "column": 0 }, "end": { - "line": 21, + "line": 31, "column": 0 } } diff --git a/ast/source/insertion/insert_case2.js.json b/ast/source/insertion/insert_case2.js.json index 75d4a2a..3cfb841 100644 --- a/ast/source/insertion/insert_case2.js.json +++ b/ast/source/insertion/insert_case2.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 456, + "end": 759, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 25, + "line": 37, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 456, + "end": 759, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 25, + "line": 37, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 40, + "end": 28, "loc": { "start": { "line": 1, @@ -39,53 +39,174 @@ }, "end": { "line": 1, - "column": 40 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 40, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 }, "identifierName": "BLACK" }, @@ -95,16 +216,16 @@ ], "source": { "type": "StringLiteral", - "start": 20, - "end": 39, + "start": 84, + "end": 103, "loc": { "start": { - "line": 1, - "column": 20 + "line": 3, + "column": 18 }, "end": { - "line": 1, - "column": 39 + "line": 3, + "column": 37 } }, "extra": { @@ -116,62 +237,114 @@ }, { "type": "ImportDeclaration", - "start": 41, - "end": 88, + "start": 105, + "end": 139, "loc": { "start": { - "line": 2, + "line": 4, "column": 0 }, "end": { - "line": 2, - "column": 47 + "line": 4, + "column": 34 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 49, - "end": 61, + "type": "ImportDefaultSpecifier", + "start": 112, + "end": 115, "loc": { "start": { - "line": 2, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 2, - "column": 20 + "line": 4, + "column": 10 } }, - "imported": { + "local": { "type": "Identifier", - "start": 49, - "end": 61, + "start": 112, + "end": 115, "loc": { "start": { - "line": 2, - "column": 8 + "line": 4, + "column": 7 }, "end": { - "line": 2, - "column": 20 + "line": 4, + "column": 10 }, - "identifierName": "insert_case3" + "identifierName": "RED" }, - "name": "insert_case3" + "name": "RED" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + }, + "extra": { + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" + }, + "value": "../color/RED.js" + } + }, + { + "type": "ImportDeclaration", + "start": 140, + "end": 185, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 159, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } }, "local": { "type": "Identifier", - "start": 49, - "end": 61, + "start": 147, + "end": 159, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 20 + "line": 5, + "column": 19 }, "identifierName": "insert_case3" }, @@ -181,16 +354,16 @@ ], "source": { "type": "StringLiteral", - "start": 68, - "end": 87, + "start": 165, + "end": 184, "loc": { "start": { - "line": 2, - "column": 27 + "line": 5, + "column": 25 }, "end": { - "line": 2, - "column": 46 + "line": 5, + "column": 44 } }, "extra": { @@ -202,16 +375,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 210, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 337, "loc": { "start": { - "line": 4, + "line": 7, "column": 0 }, "end": { - "line": 10, + "line": 14, "column": 3 } } @@ -219,464 +392,3624 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 211, - "end": 455, + "type": "Identifier", + "start": 338, + "end": 728, "loc": { "start": { - "line": 11, + "line": 15, "column": 0 }, "end": { - "line": 24, + "line": 34, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 218, - "end": 455, - "loc": { - "start": { - "line": 11, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 344, + "end": 727, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 34, + "column": 1 + } }, - "end": { - "line": 24, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 224, - "end": 454, + "id": { + "type": "Identifier", + "start": 344, + "end": 356, "loc": { "start": { - "line": 11, - "column": 13 + "line": 15, + "column": 6 }, "end": { - "line": 24, + "line": 15, + "column": 18 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 359, + "end": 727, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 34, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 224, - "end": 236, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 25 + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 360, + "end": 361, + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + }, + "identifierName": "n" }, - "identifierName": "insert_case2" - }, - "name": "insert_case2", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 239, - "end": 454, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 366, + "end": 727, "loc": { "start": { - "line": 11, + "line": 15, "column": 28 }, "end": { - "line": 24, + "line": 34, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 224, - "end": 236, - "loc": { - "start": { - "line": 11, - "column": 13 - }, - "end": { - "line": 11, - "column": 25 - }, - "identifierName": "insert_case2" - }, - "name": "insert_case2", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 240, - "end": 241, + "type": "ExpressionStatement", + "start": 369, + "end": 395, "loc": { "start": { - "line": 11, - "column": 29 + "line": 16, + "column": 1 }, "end": { - "line": 11, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 246, - "end": 454, - "loc": { - "start": { - "line": 11, - "column": 35 + "line": 16, + "column": 27 + } }, - "end": { - "line": 24, - "column": 1 - } - }, - "body": [ - { - "type": "IfStatement", - "start": 395, - "end": 433, + "expression": { + "type": "CallExpression", + "start": 369, + "end": 394, "loc": { "start": { - "line": 21, + "line": 16, "column": 1 }, "end": { - "line": 21, - "column": 39 + "line": 16, + "column": 26 } }, - "test": { - "type": "BinaryExpression", - "start": 399, - "end": 424, + "callee": { + "type": "Identifier", + "start": 369, + "end": 375, "loc": { "start": { - "line": 21, - "column": 5 + "line": 16, + "column": 1 }, "end": { - "line": 21, - "column": 30 - } + "line": 16, + "column": 7 + }, + "identifierName": "assert" }, - "left": { - "type": "MemberExpression", - "start": 399, - "end": 414, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 376, + "end": 393, "loc": { "start": { - "line": 21, - "column": 5 + "line": 16, + "column": 8 }, "end": { - "line": 21, - "column": 20 + "line": 16, + "column": 25 } }, - "object": { - "type": "MemberExpression", - "start": 399, - "end": 407, + "left": { + "type": "Identifier", + "start": 376, + "end": 377, "loc": { "start": { - "line": 21, - "column": 5 + "line": 16, + "column": 8 }, "end": { - "line": 21, - "column": 13 - } - }, - "object": { - "type": "Identifier", - "start": 399, - "end": 400, - "loc": { - "start": { - "line": 21, - "column": 5 - }, - "end": { - "line": 21, - "column": 6 - }, - "identifierName": "n" + "line": 16, + "column": 9 }, - "name": "n", - "leadingComments": null + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 389, + "end": 393, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 397, + "end": 422, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 397, + "end": 421, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 397, + "end": 403, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 404, + "end": 420, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 404, + "end": 412, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 404, + "end": 405, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" }, "property": { "type": "Identifier", - "start": 401, - "end": 407, + "start": 406, + "end": 412, "loc": { "start": { - "line": 21, - "column": 7 + "line": 17, + "column": 10 }, "end": { - "line": 21, - "column": 13 + "line": 17, + "column": 16 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, - "computed": false, - "leadingComments": null + "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 408, - "end": 414, + "start": 417, + "end": 420, "loc": { "start": { - "line": 21, - "column": 14 + "line": 17, + "column": 21 }, "end": { - "line": 21, - "column": 20 + "line": 17, + "column": 24 }, - "identifierName": "_color" + "identifierName": "RED" }, - "name": "_color" + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 424, + "end": 456, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 424, + "end": 455, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 424, + "end": 430, + "loc": { + "start": { + "line": 18, + "column": 1 }, - "computed": false, - "leadingComments": null + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 419, - "end": 424, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 431, + "end": 454, "loc": { "start": { - "line": 21, - "column": 25 + "line": 18, + "column": 8 }, "end": { - "line": 21, - "column": 30 + "line": 18, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 431, + "end": 444, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 21 + } }, - "identifierName": "BLACK" + "object": { + "type": "MemberExpression", + "start": 431, + "end": 437, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 431, + "end": 432, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 433, + "end": 437, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 438, + "end": 444, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 449, + "end": 454, + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 458, + "end": 491, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 458, + "end": 490, + "loc": { + "start": { + "line": 19, + "column": 1 }, - "leadingComments": null + "end": { + "line": 19, + "column": 33 + } }, - "consequent": { - "type": "ReturnStatement", - "start": 426, - "end": 433, + "callee": { + "type": "Identifier", + "start": 458, + "end": 464, "loc": { "start": { - "line": 21, - "column": 32 + "line": 19, + "column": 1 }, "end": { - "line": 21, - "column": 39 - } + "line": 19, + "column": 7 + }, + "identifierName": "assert" }, - "argument": null + "name": "assert" }, - "alternate": null, - "leadingComments": [ + "arguments": [ { - "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 249, - "end": 393, + "type": "BinaryExpression", + "start": 465, + "end": 489, "loc": { "start": { - "line": 12, - "column": 1 + "line": 19, + "column": 8 }, "end": { - "line": 20, - "column": 4 + "line": 19, + "column": 32 } + }, + "left": { + "type": "MemberExpression", + "start": 465, + "end": 479, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 465, + "end": 472, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 465, + "end": 466, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 467, + "end": 472, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 473, + "end": 479, + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 484, + "end": 489, + "loc": { + "start": { + "line": 19, + "column": 27 + }, + "end": { + "line": 19, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 493, + "end": 519, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 27 + } }, - { - "type": "ExpressionStatement", - "start": 436, - "end": 452, + "expression": { + "type": "CallExpression", + "start": 493, + "end": 518, "loc": { "start": { - "line": 23, + "line": 20, "column": 1 }, "end": { - "line": 23, - "column": 17 + "line": 20, + "column": 26 } }, - "expression": { - "type": "CallExpression", - "start": 436, - "end": 451, + "callee": { + "type": "Identifier", + "start": 493, + "end": 499, "loc": { "start": { - "line": 23, + "line": 20, "column": 1 }, "end": { - "line": 23, - "column": 16 - } + "line": 20, + "column": 7 + }, + "identifierName": "assert" }, - "callee": { - "type": "Identifier", - "start": 436, - "end": 448, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 500, + "end": 517, "loc": { "start": { - "line": 23, - "column": 1 + "line": 20, + "column": 8 }, "end": { - "line": 23, - "column": 13 - }, - "identifierName": "insert_case3" + "line": 20, + "column": 25 + } }, - "name": "insert_case3" - }, - "arguments": [ - { - "type": "Identifier", - "start": 449, - "end": 450, + "left": { + "type": "MemberExpression", + "start": 500, + "end": 508, "loc": { "start": { - "line": 23, - "column": 14 + "line": 20, + "column": 8 }, "end": { - "line": 23, - "column": 15 - }, - "identifierName": "n" + "line": 20, + "column": 16 + } }, - "name": "n" + "object": { + "type": "Identifier", + "start": 500, + "end": 501, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 502, + "end": 508, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 513, + "end": 517, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + } + } } - ] + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 522, + "end": 666, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 30, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 668, + "end": 706, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 39 + } + }, + "test": { + "type": "BinaryExpression", + "start": 672, + "end": 697, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 30 + } + }, + "left": { + "type": "MemberExpression", + "start": 672, + "end": 687, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 20 + } + }, + "object": { + "type": "MemberExpression", + "start": 672, + "end": 680, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 672, + "end": 673, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 674, + "end": 680, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 681, + "end": 687, + "loc": { + "start": { + "line": 31, + "column": 14 + }, + "end": { + "line": 31, + "column": 20 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 692, + "end": 697, + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 30 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "consequent": { + "type": "ReturnStatement", + "start": 699, + "end": 706, + "loc": { + "start": { + "line": 31, + "column": 32 + }, + "end": { + "line": 31, + "column": 39 + } + }, + "argument": null + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 522, + "end": 666, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 30, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 709, + "end": 725, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 17 } + }, + "expression": { + "type": "CallExpression", + "start": 709, + "end": 724, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 709, + "end": 721, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 13 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3" + }, + "arguments": [ + { + "type": "Identifier", + "start": 722, + "end": 723, + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + } + ] } - ], - "directives": [] - } - }, - "leadingComments": null + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 730, + "end": 758, + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 745, + "end": 757, + "loc": { + "start": { + "line": 36, + "column": 15 + }, + "end": { + "line": 36, + "column": 27 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 730, + "end": 758, + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 338, + "end": 728, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 34, + "column": 2 } - ], - "kind": "const", - "leadingComments": [ + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 210, + "type": "VariableDeclarator", + "start": 344, + "end": 727, "loc": { "start": { - "line": 4, - "column": 0 + "line": 15, + "column": 6 }, "end": { - "line": 10, - "column": 3 + "line": 34, + "column": 1 } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 210, - "loc": { - "start": { - "line": 4, - "column": 0 }, - "end": { - "line": 10, - "column": 3 - } - } - } - ] + "id": { + "type": "Identifier", + "start": 344, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 18 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 359, + "end": 727, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 34, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 344, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 18 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 360, + "end": 361, + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 366, + "end": 727, + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 34, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 369, + "end": 395, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 369, + "end": 394, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 369, + "end": 375, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 376, + "end": 393, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 376, + "end": 377, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 389, + "end": 393, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 397, + "end": 422, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 397, + "end": 421, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 397, + "end": 403, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 404, + "end": 420, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 404, + "end": 412, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 404, + "end": 405, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 406, + "end": 412, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 417, + "end": 420, + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 424, + "end": 456, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 424, + "end": 455, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 424, + "end": 430, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 431, + "end": 454, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 431, + "end": 444, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 431, + "end": 437, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 431, + "end": 432, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 433, + "end": 437, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 438, + "end": 444, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 449, + "end": 454, + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 458, + "end": 491, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 458, + "end": 490, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 458, + "end": 464, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 465, + "end": 489, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 465, + "end": 479, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 465, + "end": 472, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 465, + "end": 466, + "loc": { + "start": { + "line": 19, + "column": 8 + }, + "end": { + "line": 19, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 467, + "end": 472, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 473, + "end": 479, + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 484, + "end": 489, + "loc": { + "start": { + "line": 19, + "column": 27 + }, + "end": { + "line": 19, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 493, + "end": 519, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 493, + "end": 518, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 493, + "end": 499, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 500, + "end": 517, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 500, + "end": 508, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 500, + "end": 501, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 502, + "end": 508, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 513, + "end": 517, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + } + } + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 522, + "end": 666, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 30, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 668, + "end": 706, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 39 + } + }, + "test": { + "type": "BinaryExpression", + "start": 672, + "end": 697, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 30 + } + }, + "left": { + "type": "MemberExpression", + "start": 672, + "end": 687, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 20 + } + }, + "object": { + "type": "MemberExpression", + "start": 672, + "end": 680, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 672, + "end": 673, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 674, + "end": 680, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 681, + "end": 687, + "loc": { + "start": { + "line": 31, + "column": 14 + }, + "end": { + "line": 31, + "column": 20 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 692, + "end": 697, + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 30 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "consequent": { + "type": "ReturnStatement", + "start": 699, + "end": 706, + "loc": { + "start": { + "line": 31, + "column": 32 + }, + "end": { + "line": 31, + "column": 39 + } + }, + "argument": null + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 522, + "end": 666, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 30, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 709, + "end": 725, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 709, + "end": 724, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 709, + "end": 721, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 13 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3" + }, + "arguments": [ + { + "type": "Identifier", + "start": 722, + "end": 723, + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 337, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 337, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 522, + "end": 666, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 30, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case3", + "start": 147, + "end": 159, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 160, + "end": 164, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case3.js", + "start": 165, + "end": 184, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 184, + "end": 185, + "loc": { + "start": { + "line": 5, + "column": 44 + }, + "end": { + "line": 5, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 337, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 338, + "end": 343, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case2", + "start": 344, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 357, + "end": 358, + "loc": { + "start": { + "line": 15, + "column": 19 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 359, + "end": 360, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 360, + "end": 361, + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 361, + "end": 362, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 363, + "end": 365, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 366, + "end": 367, + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 369, + "end": 375, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 375, + "end": 376, + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 376, + "end": 377, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 378, + "end": 388, + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 389, + "end": 393, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 393, + "end": 394, + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 394, + "end": 395, + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 397, + "end": 403, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 403, + "end": 404, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 404, + "end": 405, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 405, + "end": 406, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 406, + "end": 412, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 413, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 417, + "end": 420, + "loc": { + "start": { + "line": 17, + "column": 21 + }, + "end": { + "line": 17, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 420, + "end": 421, + "loc": { + "start": { + "line": 17, + "column": 24 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 421, + "end": 422, + "loc": { + "start": { + "line": 17, + "column": 25 + }, + "end": { + "line": 17, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 424, + "end": 430, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 210, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 430, + "end": 431, "loc": { "start": { - "line": 4, - "column": 0 + "line": 18, + "column": 7 }, "end": { - "line": 10, - "column": 3 + "line": 18, + "column": 8 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 249, - "end": 393, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 431, + "end": 432, "loc": { "start": { - "line": 12, - "column": 1 + "line": 18, + "column": 8 }, "end": { - "line": 20, - "column": 4 + "line": 18, + "column": 9 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -685,24 +4018,23 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "start": 432, + "end": 433, "loc": { "start": { - "line": 1, - "column": 0 + "line": 18, + "column": 9 }, "end": { - "line": 1, - "column": 6 + "line": 18, + "column": 10 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -711,16 +4043,43 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "value": "left", + "start": 433, + "end": 437, "loc": { "start": { - "line": 1, - "column": 7 + "line": 18, + "column": 10 }, "end": { - "line": 1, - "column": 8 + "line": 18, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 437, + "end": 438, + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 15 } } }, @@ -736,42 +4095,44 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "_color", + "start": 438, + "end": 444, "loc": { "start": { - "line": 1, - "column": 8 + "line": 18, + "column": 15 }, "end": { - "line": 1, - "column": 13 + "line": 18, + "column": 21 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 13, - "end": 14, + "value": "===", + "start": 445, + "end": 448, "loc": { "start": { - "line": 1, - "column": 13 + "line": 18, + "column": 22 }, "end": { - "line": 1, - "column": 14 + "line": 18, + "column": 25 } } }, @@ -787,44 +4148,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 15, - "end": 19, + "value": "BLACK", + "start": 449, + "end": 454, "loc": { "start": { - "line": 1, - "column": 15 + "line": 18, + "column": 26 }, "end": { - "line": 1, - "column": 19 + "line": 18, + "column": 31 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/BLACK.js", - "start": 20, - "end": 39, + "start": 454, + "end": 455, "loc": { "start": { - "line": 1, - "column": 20 + "line": 18, + "column": 31 }, "end": { - "line": 1, - "column": 39 + "line": 18, + "column": 32 } } }, @@ -841,23 +4200,22 @@ "binop": null, "updateContext": null }, - "start": 39, - "end": 40, + "start": 455, + "end": 456, "loc": { "start": { - "line": 1, - "column": 39 + "line": 18, + "column": 32 }, "end": { - "line": 1, - "column": 40 + "line": 18, + "column": 33 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -865,26 +4223,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 41, - "end": 47, + "value": "assert", + "start": 458, + "end": 464, "loc": { "start": { - "line": 2, - "column": 0 + "line": 19, + "column": 1 }, "end": { - "line": 2, - "column": 6 + "line": 19, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -894,15 +4251,15 @@ "postfix": false, "binop": null }, - "start": 48, - "end": 49, + "start": 464, + "end": 465, "loc": { "start": { - "line": 2, + "line": 19, "column": 7 }, "end": { - "line": 2, + "line": 19, "column": 8 } } @@ -919,23 +4276,75 @@ "postfix": false, "binop": null }, - "value": "insert_case3", - "start": 49, - "end": 61, + "value": "n", + "start": 465, + "end": 466, "loc": { "start": { - "line": 2, + "line": 19, "column": 8 }, "end": { - "line": 2, - "column": 20 + "line": 19, + "column": 9 } } }, { "type": { - "label": "}", + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 466, + "end": 467, + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 467, + "end": 472, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + { + "type": { + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -943,18 +4352,72 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 472, + "end": 473, + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null }, - "start": 61, - "end": 62, + "value": "_color", + "start": 473, + "end": 479, + "loc": { + "start": { + "line": 19, + "column": 16 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 480, + "end": 483, "loc": { "start": { - "line": 2, - "column": 20 + "line": 19, + "column": 23 }, "end": { - "line": 2, - "column": 21 + "line": 19, + "column": 26 } } }, @@ -970,44 +4433,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 63, - "end": 67, + "value": "BLACK", + "start": 484, + "end": 489, "loc": { "start": { - "line": 2, - "column": 22 + "line": 19, + "column": 27 }, "end": { - "line": 2, - "column": 26 + "line": 19, + "column": 32 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./insert_case3.js", - "start": 68, - "end": 87, + "start": 489, + "end": 490, "loc": { "start": { - "line": 2, - "column": 27 + "line": 19, + "column": 32 }, "end": { - "line": 2, - "column": 46 + "line": 19, + "column": 33 } } }, @@ -1024,88 +4485,67 @@ "binop": null, "updateContext": null }, - "start": 87, - "end": 88, - "loc": { - "start": { - "line": 2, - "column": 46 - }, - "end": { - "line": 2, - "column": 47 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 90, - "end": 210, + "start": 490, + "end": 491, "loc": { "start": { - "line": 4, - "column": 0 + "line": 19, + "column": 33 }, "end": { - "line": 10, - "column": 3 + "line": 19, + "column": 34 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 211, - "end": 217, + "value": "assert", + "start": 493, + "end": 499, "loc": { "start": { - "line": 11, - "column": 0 + "line": 20, + "column": 1 }, "end": { - "line": 11, - "column": 6 + "line": 20, + "column": 7 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 218, - "end": 223, + "start": 499, + "end": 500, "loc": { "start": { - "line": 11, + "line": 20, "column": 7 }, "end": { - "line": 11, - "column": 12 + "line": 20, + "column": 8 } } }, @@ -1121,51 +4561,50 @@ "postfix": false, "binop": null }, - "value": "insert_case2", - "start": 224, - "end": 236, + "value": "n", + "start": 500, + "end": 501, "loc": { "start": { - "line": 11, - "column": 13 + "line": 20, + "column": 8 }, "end": { - "line": 11, - "column": 25 + "line": 20, + "column": 9 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 237, - "end": 238, + "start": 501, + "end": 502, "loc": { "start": { - "line": 11, - "column": 26 + "line": 20, + "column": 9 }, "end": { - "line": 11, - "column": 27 + "line": 20, + "column": 10 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1174,133 +4613,138 @@ "postfix": false, "binop": null }, - "start": 239, - "end": 240, + "value": "parent", + "start": 502, + "end": 508, "loc": { "start": { - "line": 11, - "column": 28 + "line": 20, + "column": 10 }, "end": { - "line": 11, - "column": 29 + "line": 20, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "n", - "start": 240, - "end": 241, + "value": "!==", + "start": 509, + "end": 512, "loc": { "start": { - "line": 11, - "column": 29 + "line": 20, + "column": 17 }, "end": { - "line": 11, - "column": 30 + "line": 20, + "column": 20 } } }, { "type": { - "label": ")", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 241, - "end": 242, + "value": "null", + "start": 513, + "end": 517, "loc": { "start": { - "line": 11, - "column": 30 + "line": 20, + "column": 21 }, "end": { - "line": 11, - "column": 31 + "line": 20, + "column": 25 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 243, - "end": 245, + "start": 517, + "end": 518, "loc": { "start": { - "line": 11, - "column": 32 + "line": 20, + "column": 25 }, "end": { - "line": 11, - "column": 34 + "line": 20, + "column": 26 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 246, - "end": 247, + "start": 518, + "end": 519, "loc": { "start": { - "line": 11, - "column": 35 + "line": 20, + "column": 26 }, "end": { - "line": 11, - "column": 36 + "line": 20, + "column": 27 } } }, { "type": "CommentBlock", "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 249, - "end": 393, + "start": 522, + "end": 666, "loc": { "start": { - "line": 12, + "line": 22, "column": 1 }, "end": { - "line": 20, + "line": 30, "column": 4 } } @@ -1320,15 +4764,15 @@ "updateContext": null }, "value": "if", - "start": 395, - "end": 397, + "start": 668, + "end": 670, "loc": { "start": { - "line": 21, + "line": 31, "column": 1 }, "end": { - "line": 21, + "line": 31, "column": 3 } } @@ -1345,15 +4789,15 @@ "postfix": false, "binop": null }, - "start": 398, - "end": 399, + "start": 671, + "end": 672, "loc": { "start": { - "line": 21, + "line": 31, "column": 4 }, "end": { - "line": 21, + "line": 31, "column": 5 } } @@ -1371,15 +4815,15 @@ "binop": null }, "value": "n", - "start": 399, - "end": 400, + "start": 672, + "end": 673, "loc": { "start": { - "line": 21, + "line": 31, "column": 5 }, "end": { - "line": 21, + "line": 31, "column": 6 } } @@ -1397,15 +4841,15 @@ "binop": null, "updateContext": null }, - "start": 400, - "end": 401, + "start": 673, + "end": 674, "loc": { "start": { - "line": 21, + "line": 31, "column": 6 }, "end": { - "line": 21, + "line": 31, "column": 7 } } @@ -1423,15 +4867,15 @@ "binop": null }, "value": "parent", - "start": 401, - "end": 407, + "start": 674, + "end": 680, "loc": { "start": { - "line": 21, + "line": 31, "column": 7 }, "end": { - "line": 21, + "line": 31, "column": 13 } } @@ -1449,15 +4893,15 @@ "binop": null, "updateContext": null }, - "start": 407, - "end": 408, + "start": 680, + "end": 681, "loc": { "start": { - "line": 21, + "line": 31, "column": 13 }, "end": { - "line": 21, + "line": 31, "column": 14 } } @@ -1475,15 +4919,15 @@ "binop": null }, "value": "_color", - "start": 408, - "end": 414, + "start": 681, + "end": 687, "loc": { "start": { - "line": 21, + "line": 31, "column": 14 }, "end": { - "line": 21, + "line": 31, "column": 20 } } @@ -1502,15 +4946,15 @@ "updateContext": null }, "value": "===", - "start": 415, - "end": 418, + "start": 688, + "end": 691, "loc": { "start": { - "line": 21, + "line": 31, "column": 21 }, "end": { - "line": 21, + "line": 31, "column": 24 } } @@ -1528,15 +4972,15 @@ "binop": null }, "value": "BLACK", - "start": 419, - "end": 424, + "start": 692, + "end": 697, "loc": { "start": { - "line": 21, + "line": 31, "column": 25 }, "end": { - "line": 21, + "line": 31, "column": 30 } } @@ -1553,15 +4997,15 @@ "postfix": false, "binop": null }, - "start": 424, - "end": 425, + "start": 697, + "end": 698, "loc": { "start": { - "line": 21, + "line": 31, "column": 30 }, "end": { - "line": 21, + "line": 31, "column": 31 } } @@ -1581,15 +5025,15 @@ "updateContext": null }, "value": "return", - "start": 426, - "end": 432, + "start": 699, + "end": 705, "loc": { "start": { - "line": 21, + "line": 31, "column": 32 }, "end": { - "line": 21, + "line": 31, "column": 38 } } @@ -1607,15 +5051,15 @@ "binop": null, "updateContext": null }, - "start": 432, - "end": 433, + "start": 705, + "end": 706, "loc": { "start": { - "line": 21, + "line": 31, "column": 38 }, "end": { - "line": 21, + "line": 31, "column": 39 } } @@ -1633,15 +5077,15 @@ "binop": null }, "value": "insert_case3", - "start": 436, - "end": 448, + "start": 709, + "end": 721, "loc": { "start": { - "line": 23, + "line": 33, "column": 1 }, "end": { - "line": 23, + "line": 33, "column": 13 } } @@ -1658,15 +5102,15 @@ "postfix": false, "binop": null }, - "start": 448, - "end": 449, + "start": 721, + "end": 722, "loc": { "start": { - "line": 23, + "line": 33, "column": 13 }, "end": { - "line": 23, + "line": 33, "column": 14 } } @@ -1684,15 +5128,15 @@ "binop": null }, "value": "n", - "start": 449, - "end": 450, + "start": 722, + "end": 723, "loc": { "start": { - "line": 23, + "line": 33, "column": 14 }, "end": { - "line": 23, + "line": 33, "column": 15 } } @@ -1709,15 +5153,15 @@ "postfix": false, "binop": null }, - "start": 450, - "end": 451, + "start": 723, + "end": 724, "loc": { "start": { - "line": 23, + "line": 33, "column": 15 }, "end": { - "line": 23, + "line": 33, "column": 16 } } @@ -1735,15 +5179,15 @@ "binop": null, "updateContext": null }, - "start": 451, - "end": 452, + "start": 724, + "end": 725, "loc": { "start": { - "line": 23, + "line": 33, "column": 16 }, "end": { - "line": 23, + "line": 33, "column": 17 } } @@ -1760,15 +5204,15 @@ "postfix": false, "binop": null }, - "start": 453, - "end": 454, + "start": 726, + "end": 727, "loc": { "start": { - "line": 24, + "line": 34, "column": 0 }, "end": { - "line": 24, + "line": 34, "column": 1 } } @@ -1786,19 +5230,127 @@ "binop": null, "updateContext": null }, - "start": 454, - "end": 455, + "start": 727, + "end": 728, "loc": { "start": { - "line": 24, + "line": 34, "column": 1 }, "end": { - "line": 24, + "line": 34, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 730, + "end": 736, + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 737, + "end": 744, + "loc": { + "start": { + "line": 36, + "column": 7 + }, + "end": { + "line": 36, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case2", + "start": 745, + "end": 757, + "loc": { + "start": { + "line": 36, + "column": 15 + }, + "end": { + "line": 36, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 757, + "end": 758, + "loc": { + "start": { + "line": 36, + "column": 27 + }, + "end": { + "line": 36, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -1812,15 +5364,15 @@ "binop": null, "updateContext": null }, - "start": 456, - "end": 456, + "start": 759, + "end": 759, "loc": { "start": { - "line": 25, + "line": 37, "column": 0 }, "end": { - "line": 25, + "line": 37, "column": 0 } } diff --git a/ast/source/insertion/insert_case3.js.json b/ast/source/insertion/insert_case3.js.json index 06c0878..4aee9eb 100644 --- a/ast/source/insertion/insert_case3.js.json +++ b/ast/source/insertion/insert_case3.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1081, + "end": 1433, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 39, + "line": 52, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1081, + "end": 1433, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 39, + "line": 52, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 45, + "end": 28, "loc": { "start": { "line": 1, @@ -39,102 +39,243 @@ }, "end": { "line": 1, - "column": 45 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 40, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 11 }, - "identifierName": "BLACK" + "identifierName": "Node" }, - "name": "BLACK" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 } }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 38 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 15, - "end": 18, + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 12 } }, - "imported": { + "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 73, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 12 }, - "identifierName": "RED" + "identifierName": "BLACK" }, - "name": "RED" + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 105, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } }, "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 112, + "end": 115, "loc": { "start": { - "line": 1, - "column": 15 + "line": 4, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 4, + "column": 10 }, "identifierName": "RED" }, @@ -144,132 +285,135 @@ ], "source": { "type": "StringLiteral", - "start": 25, - "end": 44, + "start": 121, + "end": 138, "loc": { "start": { - "line": 1, - "column": 25 + "line": 4, + "column": 16 }, "end": { - "line": 1, - "column": 44 + "line": 4, + "column": 33 } }, "extra": { - "rawValue": "../color/index.js", - "raw": "'../color/index.js'" + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" }, - "value": "../color/index.js" + "value": "../color/RED.js" } }, { "type": "ImportDeclaration", - "start": 46, - "end": 100, + "start": 140, + "end": 179, "loc": { "start": { - "line": 2, + "line": 5, "column": 0 }, "end": { - "line": 2, - "column": 54 + "line": 5, + "column": 39 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 54, - "end": 59, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 152, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 13 + "line": 5, + "column": 12 } }, - "imported": { - "type": "Identifier", - "start": 54, - "end": 59, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "uncle" - }, - "name": "uncle" - }, "local": { "type": "Identifier", - "start": 54, - "end": 59, + "start": 147, + "end": 152, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 13 + "line": 5, + "column": 12 }, "identifierName": "uncle" }, "name": "uncle" } + } + ], + "source": { + "type": "StringLiteral", + "start": 158, + "end": 178, + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "extra": { + "rawValue": "../family/uncle.js", + "raw": "'../family/uncle.js'" + }, + "value": "../family/uncle.js" + } + }, + { + "type": "ImportDeclaration", + "start": 180, + "end": 231, + "loc": { + "start": { + "line": 6, + "column": 0 }, + "end": { + "line": 6, + "column": 51 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 61, - "end": 72, + "type": "ImportDefaultSpecifier", + "start": 187, + "end": 198, "loc": { "start": { - "line": 2, - "column": 15 + "line": 6, + "column": 7 }, "end": { - "line": 2, - "column": 26 + "line": 6, + "column": 18 } }, - "imported": { - "type": "Identifier", - "start": 61, - "end": 72, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 26 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" - }, "local": { "type": "Identifier", - "start": 61, - "end": 72, + "start": 187, + "end": 198, "loc": { "start": { - "line": 2, - "column": 15 + "line": 6, + "column": 7 }, "end": { - "line": 2, - "column": 26 + "line": 6, + "column": 18 }, "identifierName": "grandparent" }, @@ -279,83 +423,66 @@ ], "source": { "type": "StringLiteral", - "start": 79, - "end": 99, + "start": 204, + "end": 230, "loc": { "start": { - "line": 2, - "column": 33 + "line": 6, + "column": 24 }, "end": { - "line": 2, - "column": 53 + "line": 6, + "column": 50 } }, "extra": { - "rawValue": "../family/index.js", - "raw": "'../family/index.js'" + "rawValue": "../family/grandparent.js", + "raw": "'../family/grandparent.js'" }, - "value": "../family/index.js" + "value": "../family/grandparent.js" } }, { "type": "ImportDeclaration", - "start": 101, - "end": 148, + "start": 232, + "end": 277, "loc": { "start": { - "line": 3, + "line": 7, "column": 0 }, "end": { - "line": 3, - "column": 47 + "line": 7, + "column": 45 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 109, - "end": 121, + "type": "ImportDefaultSpecifier", + "start": 239, + "end": 251, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 7, + "column": 19 } }, - "imported": { - "type": "Identifier", - "start": 109, - "end": 121, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 20 - }, - "identifierName": "insert_case1" - }, - "name": "insert_case1" - }, "local": { "type": "Identifier", - "start": 109, - "end": 121, + "start": 239, + "end": 251, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 7, + "column": 19 }, "identifierName": "insert_case1" }, @@ -365,16 +492,16 @@ ], "source": { "type": "StringLiteral", - "start": 128, - "end": 147, + "start": 257, + "end": 276, "loc": { "start": { - "line": 3, - "column": 27 + "line": 7, + "column": 25 }, "end": { - "line": 3, - "column": 46 + "line": 7, + "column": 44 } }, "extra": { @@ -386,62 +513,45 @@ }, { "type": "ImportDeclaration", - "start": 149, - "end": 196, + "start": 278, + "end": 323, "loc": { "start": { - "line": 4, + "line": 8, "column": 0 }, "end": { - "line": 4, - "column": 47 + "line": 8, + "column": 45 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 157, - "end": 169, + "type": "ImportDefaultSpecifier", + "start": 285, + "end": 297, "loc": { "start": { - "line": 4, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 4, - "column": 20 + "line": 8, + "column": 19 } }, - "imported": { - "type": "Identifier", - "start": 157, - "end": 169, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 20 - }, - "identifierName": "insert_case4" - }, - "name": "insert_case4" - }, "local": { "type": "Identifier", - "start": 157, - "end": 169, + "start": 285, + "end": 297, "loc": { "start": { - "line": 4, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 4, - "column": 20 + "line": 8, + "column": 19 }, "identifierName": "insert_case4" }, @@ -451,16 +561,16 @@ ], "source": { "type": "StringLiteral", - "start": 176, - "end": 195, + "start": 303, + "end": 322, "loc": { "start": { - "line": 4, - "column": 27 + "line": 8, + "column": 25 }, "end": { - "line": 4, - "column": 46 + "line": 8, + "column": 44 } }, "extra": { @@ -472,16 +582,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 198, - "end": 344, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "start": 325, + "end": 501, "loc": { "start": { - "line": 6, + "line": 10, "column": 0 }, "end": { - "line": 13, + "line": 18, "column": 3 } } @@ -489,392 +599,306 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 345, - "end": 1080, + "type": "Identifier", + "start": 502, + "end": 1402, "loc": { "start": { - "line": 14, + "line": 19, "column": 0 }, "end": { - "line": 38, + "line": 49, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 352, - "end": 1080, - "loc": { - "start": { - "line": 14, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 508, + "end": 1401, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 49, + "column": 1 + } }, - "end": { - "line": 38, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 358, - "end": 1079, + "id": { + "type": "Identifier", + "start": 508, + "end": 520, "loc": { "start": { - "line": 14, - "column": 13 + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 523, + "end": 1401, + "loc": { + "start": { + "line": 19, + "column": 21 }, "end": { - "line": 38, + "line": 49, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 358, - "end": 370, - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 25 + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 524, + "end": 525, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + }, + "identifierName": "n" }, - "identifierName": "insert_case3" - }, - "name": "insert_case3", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 373, - "end": 1079, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 530, + "end": 1401, "loc": { "start": { - "line": 14, + "line": 19, "column": 28 }, "end": { - "line": 38, + "line": 49, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 358, - "end": 370, - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 25 - }, - "identifierName": "insert_case3" - }, - "name": "insert_case3", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 374, - "end": 375, + "type": "ExpressionStatement", + "start": 533, + "end": 559, "loc": { "start": { - "line": 14, - "column": 29 + "line": 20, + "column": 1 }, "end": { - "line": 14, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 380, - "end": 1079, - "loc": { - "start": { - "line": 14, - "column": 35 + "line": 20, + "column": 27 + } }, - "end": { - "line": 38, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 383, - "end": 402, + "expression": { + "type": "CallExpression", + "start": 533, + "end": 558, "loc": { "start": { - "line": 15, + "line": 20, "column": 1 }, "end": { - "line": 15, - "column": 20 + "line": 20, + "column": 26 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 533, + "end": 539, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 389, - "end": 401, + "type": "BinaryExpression", + "start": 540, + "end": 557, "loc": { "start": { - "line": 15, - "column": 7 + "line": 20, + "column": 8 }, "end": { - "line": 15, - "column": 19 + "line": 20, + "column": 25 } }, - "id": { + "left": { "type": "Identifier", - "start": 389, - "end": 390, + "start": 540, + "end": 541, "loc": { "start": { - "line": 15, - "column": 7 + "line": 20, + "column": 8 }, "end": { - "line": 15, - "column": 8 + "line": 20, + "column": 9 }, - "identifierName": "u" + "identifierName": "n" }, - "name": "u" + "name": "n" }, - "init": { - "type": "CallExpression", - "start": 393, - "end": 401, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 553, + "end": 557, "loc": { "start": { - "line": 15, - "column": 11 + "line": 20, + "column": 21 }, "end": { - "line": 15, - "column": 19 - } - }, - "callee": { - "type": "Identifier", - "start": 393, - "end": 398, - "loc": { - "start": { - "line": 15, - "column": 11 - }, - "end": { - "line": 15, - "column": 16 - }, - "identifierName": "uncle" + "line": 20, + "column": 25 }, - "name": "uncle" - }, - "arguments": [ - { - "type": "Identifier", - "start": 399, - "end": 400, - "loc": { - "start": { - "line": 15, - "column": 17 - }, - "end": { - "line": 15, - "column": 18 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 405, - "end": 900, - "loc": { - "start": { - "line": 17, - "column": 1 + "identifierName": "Node" }, - "end": { - "line": 29, - "column": 4 - } + "name": "Node" } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 561, + "end": 586, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 26 + } }, - { - "type": "IfStatement", - "start": 903, - "end": 1077, + "expression": { + "type": "CallExpression", + "start": 561, + "end": 585, "loc": { "start": { - "line": 31, + "line": 21, "column": 1 }, "end": { - "line": 37, - "column": 24 + "line": 21, + "column": 25 } }, - "test": { - "type": "LogicalExpression", - "start": 907, - "end": 937, + "callee": { + "type": "Identifier", + "start": 561, + "end": 567, "loc": { "start": { - "line": 31, - "column": 5 + "line": 21, + "column": 1 }, "end": { - "line": 31, - "column": 35 - } - }, - "left": { - "type": "BinaryExpression", - "start": 907, - "end": 917, - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 31, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 907, - "end": 908, - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 31, - "column": 6 - }, - "identifierName": "u" - }, - "name": "u", - "leadingComments": null - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 913, - "end": 917, - "loc": { - "start": { - "line": 31, - "column": 11 - }, - "end": { - "line": 31, - "column": 15 - } - } + "line": 21, + "column": 7 }, - "leadingComments": null + "identifierName": "assert" }, - "operator": "&&", - "right": { + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 921, - "end": 937, + "start": 568, + "end": 584, "loc": { "start": { - "line": 31, - "column": 19 + "line": 21, + "column": 8 }, "end": { - "line": 31, - "column": 35 + "line": 21, + "column": 24 } }, "left": { "type": "MemberExpression", - "start": 921, - "end": 929, + "start": 568, + "end": 576, "loc": { "start": { - "line": 31, - "column": 19 + "line": 21, + "column": 8 }, "end": { - "line": 31, - "column": 27 + "line": 21, + "column": 16 } }, "object": { "type": "Identifier", - "start": 921, - "end": 922, + "start": 568, + "end": 569, "loc": { "start": { - "line": 31, - "column": 19 + "line": 21, + "column": 8 }, "end": { - "line": 31, - "column": 20 + "line": 21, + "column": 9 }, - "identifierName": "u" + "identifierName": "n" }, - "name": "u" + "name": "n" }, "property": { "type": "Identifier", - "start": 923, - "end": 929, + "start": 570, + "end": 576, "loc": { "start": { - "line": 31, - "column": 21 + "line": 21, + "column": 10 }, "end": { - "line": 31, - "column": 27 + "line": 21, + "column": 16 }, "identifierName": "_color" }, @@ -885,594 +909,740 @@ "operator": "===", "right": { "type": "Identifier", - "start": 934, - "end": 937, + "start": 581, + "end": 584, "loc": { "start": { - "line": 31, - "column": 32 + "line": 21, + "column": 21 }, "end": { - "line": 31, - "column": 35 + "line": 21, + "column": 24 }, "identifierName": "RED" }, "name": "RED" } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 588, + "end": 620, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 588, + "end": 619, + "loc": { + "start": { + "line": 22, + "column": 1 }, - "leadingComments": null + "end": { + "line": 22, + "column": 32 + } }, - "consequent": { - "type": "BlockStatement", - "start": 939, - "end": 1055, + "callee": { + "type": "Identifier", + "start": 588, + "end": 594, "loc": { "start": { - "line": 31, - "column": 37 + "line": 22, + "column": 1 }, "end": { - "line": 37, - "column": 2 - } + "line": 22, + "column": 7 + }, + "identifierName": "assert" }, - "body": [ - { - "type": "ExpressionStatement", - "start": 943, - "end": 967, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 595, + "end": 618, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 595, + "end": 608, "loc": { "start": { - "line": 32, - "column": 2 + "line": 22, + "column": 8 }, "end": { - "line": 32, - "column": 26 + "line": 22, + "column": 21 } }, - "expression": { - "type": "AssignmentExpression", - "start": 943, - "end": 966, + "object": { + "type": "MemberExpression", + "start": 595, + "end": 601, "loc": { "start": { - "line": 32, - "column": 2 + "line": 22, + "column": 8 }, "end": { - "line": 32, - "column": 25 + "line": 22, + "column": 14 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 943, - "end": 958, + "object": { + "type": "Identifier", + "start": 595, + "end": 596, "loc": { "start": { - "line": 32, - "column": 2 + "line": 22, + "column": 8 }, "end": { - "line": 32, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 943, - "end": 951, - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 943, - "end": 944, - "loc": { - "start": { - "line": 32, - "column": 2 - }, - "end": { - "line": 32, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 945, - "end": 951, - "loc": { - "start": { - "line": 32, - "column": 4 - }, - "end": { - "line": 32, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 952, - "end": 958, - "loc": { - "start": { - "line": 32, - "column": 11 - }, - "end": { - "line": 32, - "column": 17 - }, - "identifierName": "_color" + "line": 22, + "column": 9 }, - "name": "_color" + "identifierName": "n" }, - "computed": false + "name": "n" }, - "right": { + "property": { "type": "Identifier", - "start": 961, - "end": 966, + "start": 597, + "end": 601, "loc": { "start": { - "line": 32, - "column": 20 + "line": 22, + "column": 10 }, "end": { - "line": 32, - "column": 25 + "line": 22, + "column": 14 }, - "identifierName": "BLACK" + "identifierName": "left" }, - "name": "BLACK" - } + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 602, + "end": 608, + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 613, + "end": 618, + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 622, + "end": 655, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 622, + "end": 654, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 622, + "end": 628, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 629, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 32 } }, - { - "type": "ExpressionStatement", - "start": 970, - "end": 987, + "left": { + "type": "MemberExpression", + "start": 629, + "end": 643, "loc": { "start": { - "line": 33, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 33, - "column": 19 + "line": 23, + "column": 22 } }, - "expression": { - "type": "AssignmentExpression", - "start": 970, - "end": 986, + "object": { + "type": "MemberExpression", + "start": 629, + "end": 636, "loc": { "start": { - "line": 33, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 33, - "column": 18 + "line": 23, + "column": 15 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 970, - "end": 978, + "object": { + "type": "Identifier", + "start": 629, + "end": 630, "loc": { "start": { - "line": 33, - "column": 2 + "line": 23, + "column": 8 }, "end": { - "line": 33, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 970, - "end": 971, - "loc": { - "start": { - "line": 33, - "column": 2 - }, - "end": { - "line": 33, - "column": 3 - }, - "identifierName": "u" - }, - "name": "u" - }, - "property": { - "type": "Identifier", - "start": 972, - "end": 978, - "loc": { - "start": { - "line": 33, - "column": 4 - }, - "end": { - "line": 33, - "column": 10 - }, - "identifierName": "_color" + "line": 23, + "column": 9 }, - "name": "_color" + "identifierName": "n" }, - "computed": false + "name": "n" }, - "right": { + "property": { "type": "Identifier", - "start": 981, - "end": 986, + "start": 631, + "end": 636, "loc": { "start": { - "line": 33, - "column": 13 + "line": 23, + "column": 10 }, "end": { - "line": 33, - "column": 18 + "line": 23, + "column": 15 }, - "identifierName": "BLACK" + "identifierName": "right" }, - "name": "BLACK" - } + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 637, + "end": 643, + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 648, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 657, + "end": 683, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 657, + "end": 682, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 657, + "end": 663, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 664, + "end": 681, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 25 } }, - { - "type": "VariableDeclaration", - "start": 990, - "end": 1015, + "left": { + "type": "MemberExpression", + "start": 664, + "end": 672, "loc": { "start": { - "line": 34, - "column": 2 + "line": 24, + "column": 8 }, "end": { - "line": 34, - "column": 27 + "line": 24, + "column": 16 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 996, - "end": 1014, - "loc": { - "start": { - "line": 34, - "column": 8 - }, - "end": { - "line": 34, - "column": 26 - } + "object": { + "type": "Identifier", + "start": 664, + "end": 665, + "loc": { + "start": { + "line": 24, + "column": 8 }, - "id": { - "type": "Identifier", - "start": 996, - "end": 997, - "loc": { - "start": { - "line": 34, - "column": 8 - }, - "end": { - "line": 34, - "column": 9 - }, - "identifierName": "g" - }, - "name": "g" + "end": { + "line": 24, + "column": 9 }, - "init": { - "type": "CallExpression", - "start": 1000, - "end": 1014, - "loc": { - "start": { - "line": 34, - "column": 12 - }, - "end": { - "line": 34, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 1000, - "end": 1011, - "loc": { - "start": { - "line": 34, - "column": 12 - }, - "end": { - "line": 34, - "column": 23 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" - }, - "arguments": [ - { - "type": "Identifier", - "start": 1012, - "end": 1013, - "loc": { - "start": { - "line": 34, - "column": 24 - }, - "end": { - "line": 34, - "column": 25 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 666, + "end": 672, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 677, + "end": 681, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 } - ], - "kind": "const" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 685, + "end": 717, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 685, + "end": 716, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 685, + "end": 691, + "loc": { + "start": { + "line": 25, + "column": 1 }, - { - "type": "ExpressionStatement", - "start": 1018, - "end": 1033, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 692, + "end": 715, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 692, + "end": 707, "loc": { "start": { - "line": 35, - "column": 2 + "line": 25, + "column": 8 }, "end": { - "line": 35, - "column": 17 + "line": 25, + "column": 23 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1018, - "end": 1032, + "object": { + "type": "MemberExpression", + "start": 692, + "end": 700, "loc": { "start": { - "line": 35, - "column": 2 + "line": 25, + "column": 8 }, "end": { - "line": 35, + "line": 25, "column": 16 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1018, - "end": 1026, + "object": { + "type": "Identifier", + "start": 692, + "end": 693, "loc": { "start": { - "line": 35, - "column": 2 + "line": 25, + "column": 8 }, "end": { - "line": 35, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1018, - "end": 1019, - "loc": { - "start": { - "line": 35, - "column": 2 - }, - "end": { - "line": 35, - "column": 3 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1020, - "end": 1026, - "loc": { - "start": { - "line": 35, - "column": 4 - }, - "end": { - "line": 35, - "column": 10 - }, - "identifierName": "_color" + "line": 25, + "column": 9 }, - "name": "_color" + "identifierName": "n" }, - "computed": false + "name": "n" }, - "right": { + "property": { "type": "Identifier", - "start": 1029, - "end": 1032, + "start": 694, + "end": 700, "loc": { "start": { - "line": 35, - "column": 13 + "line": 25, + "column": 10 }, "end": { - "line": 35, + "line": 25, "column": 16 }, - "identifierName": "RED" + "identifierName": "parent" }, - "name": "RED" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1036, - "end": 1052, - "loc": { - "start": { - "line": 36, - "column": 2 + "name": "parent" }, - "end": { - "line": 36, - "column": 18 - } + "computed": false }, - "expression": { - "type": "CallExpression", - "start": 1036, - "end": 1051, + "property": { + "type": "Identifier", + "start": 701, + "end": 707, "loc": { "start": { - "line": 36, - "column": 2 + "line": 25, + "column": 17 }, "end": { - "line": 36, - "column": 17 - } - }, - "callee": { - "type": "Identifier", - "start": 1036, - "end": 1048, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 14 - }, - "identifierName": "insert_case1" + "line": 25, + "column": 23 }, - "name": "insert_case1" + "identifierName": "_color" }, - "arguments": [ - { - "type": "Identifier", - "start": 1049, - "end": 1050, - "loc": { - "start": { - "line": 36, - "column": 15 - }, - "end": { - "line": 36, - "column": 16 - }, - "identifierName": "g" - }, - "name": "g" - } - ] - } + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 712, + "end": 715, + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" } - ], - "directives": [] + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 719, + "end": 738, + "loc": { + "start": { + "line": 26, + "column": 1 }, - "alternate": { - "type": "ExpressionStatement", - "start": 1061, - "end": 1077, + "end": { + "line": 26, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 725, + "end": 737, "loc": { "start": { - "line": 37, - "column": 8 + "line": 26, + "column": 7 }, "end": { - "line": 37, - "column": 24 + "line": 26, + "column": 19 } }, - "expression": { - "type": "CallExpression", - "start": 1061, - "end": 1076, + "id": { + "type": "Identifier", + "start": 725, + "end": 726, "loc": { "start": { - "line": 37, + "line": 26, + "column": 7 + }, + "end": { + "line": 26, "column": 8 }, + "identifierName": "u" + }, + "name": "u" + }, + "init": { + "type": "CallExpression", + "start": 729, + "end": 737, + "loc": { + "start": { + "line": 26, + "column": 11 + }, "end": { - "line": 37, - "column": 23 + "line": 26, + "column": 19 } }, "callee": { "type": "Identifier", - "start": 1061, - "end": 1073, + "start": 729, + "end": 734, "loc": { "start": { - "line": 37, - "column": 8 + "line": 26, + "column": 11 }, "end": { - "line": 37, - "column": 20 + "line": 26, + "column": 16 }, - "identifierName": "insert_case4" + "identifierName": "uncle" }, - "name": "insert_case4" + "name": "uncle" }, "arguments": [ { "type": "Identifier", - "start": 1074, - "end": 1075, + "start": 735, + "end": 736, "loc": { "start": { - "line": 37, - "column": 21 + "line": 26, + "column": 17 }, "end": { - "line": 37, - "column": 22 + "line": 26, + "column": 18 }, "identifierName": "n" }, @@ -1480,115 +1650,4347 @@ } ] } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 741, + "end": 1236, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1239, + "end": 1399, + "loc": { + "start": { + "line": 42, + "column": 1 }, - "leadingComments": [ + "end": { + "line": 48, + "column": 24 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1243, + "end": 1259, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 21 + } + }, + "left": { + "type": "MemberExpression", + "start": 1243, + "end": 1251, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 1243, + "end": 1244, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 6 + }, + "identifierName": "u" + }, + "name": "u", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1245, + "end": 1251, + "loc": { + "start": { + "line": 42, + "column": 7 + }, + "end": { + "line": 42, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1256, + "end": 1259, + "loc": { + "start": { + "line": 42, + "column": 18 + }, + "end": { + "line": 42, + "column": 21 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1261, + "end": 1377, + "loc": { + "start": { + "line": 42, + "column": 23 + }, + "end": { + "line": 48, + "column": 2 + } + }, + "body": [ { - "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 405, - "end": 900, + "type": "ExpressionStatement", + "start": 1265, + "end": 1289, "loc": { "start": { - "line": 17, - "column": 1 + "line": 43, + "column": 2 }, "end": { - "line": 29, - "column": 4 + "line": 43, + "column": 26 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1265, + "end": 1288, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 25 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1265, + "end": 1280, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1265, + "end": 1273, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1265, + "end": 1266, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1267, + "end": 1273, + "loc": { + "start": { + "line": 43, + "column": 4 + }, + "end": { + "line": 43, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1274, + "end": 1280, + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 43, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1283, + "end": 1288, + "loc": { + "start": { + "line": 43, + "column": 20 + }, + "end": { + "line": 43, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } } - } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 198, - "end": 344, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 13, - "column": 3 - } - } - } - ], - "trailingComments": [] + }, + { + "type": "ExpressionStatement", + "start": 1292, + "end": 1309, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1292, + "end": 1308, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1292, + "end": 1300, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1292, + "end": 1293, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + }, + "identifierName": "u" + }, + "name": "u" + }, + "property": { + "type": "Identifier", + "start": 1294, + "end": 1300, + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1303, + "end": 1308, + "loc": { + "start": { + "line": 44, + "column": 13 + }, + "end": { + "line": 44, + "column": 18 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "VariableDeclaration", + "start": 1312, + "end": 1337, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 1318, + "end": 1336, + "loc": { + "start": { + "line": 45, + "column": 8 + }, + "end": { + "line": 45, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 1318, + "end": 1319, + "loc": { + "start": { + "line": 45, + "column": 8 + }, + "end": { + "line": 45, + "column": 9 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 1322, + "end": 1336, + "loc": { + "start": { + "line": 45, + "column": 12 + }, + "end": { + "line": 45, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 1322, + "end": 1333, + "loc": { + "start": { + "line": 45, + "column": 12 + }, + "end": { + "line": 45, + "column": 23 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1334, + "end": 1335, + "loc": { + "start": { + "line": 45, + "column": 24 + }, + "end": { + "line": 45, + "column": 25 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 1340, + "end": 1355, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1340, + "end": 1354, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1340, + "end": 1348, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1340, + "end": 1341, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 3 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1342, + "end": 1348, + "loc": { + "start": { + "line": 46, + "column": 4 + }, + "end": { + "line": 46, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1351, + "end": 1354, + "loc": { + "start": { + "line": 46, + "column": 13 + }, + "end": { + "line": 46, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1358, + "end": 1374, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1358, + "end": 1373, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1358, + "end": 1370, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 14 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1371, + "end": 1372, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1383, + "end": 1399, + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 48, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1383, + "end": 1398, + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 48, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1383, + "end": 1395, + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 48, + "column": 20 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1396, + "end": 1397, + "loc": { + "start": { + "line": 48, + "column": 21 + }, + "end": { + "line": 48, + "column": 22 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 741, + "end": 1236, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1404, + "end": 1432, + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 1419, + "end": 1431, + "loc": { + "start": { + "line": 51, + "column": 15 + }, + "end": { + "line": 51, + "column": 27 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1404, + "end": 1432, + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 502, + "end": 1402, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 49, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 508, + "end": 1401, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 49, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 508, + "end": 520, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 523, + "end": 1401, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 49, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 508, + "end": 520, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 524, + "end": 525, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 530, + "end": 1401, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 49, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 533, + "end": 559, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 533, + "end": 558, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 533, + "end": 539, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 540, + "end": 557, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 540, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 561, + "end": 586, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 561, + "end": 585, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 561, + "end": 567, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 568, + "end": 584, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 568, + "end": 576, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 568, + "end": 569, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 570, + "end": 576, + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 581, + "end": 584, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 588, + "end": 620, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 588, + "end": 619, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 588, + "end": 594, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 595, + "end": 618, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 595, + "end": 608, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 595, + "end": 601, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 595, + "end": 596, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 597, + "end": 601, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 602, + "end": 608, + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 613, + "end": 618, + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 622, + "end": 655, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 622, + "end": 654, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 622, + "end": 628, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 629, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 629, + "end": 643, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 629, + "end": 636, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 629, + "end": 630, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 631, + "end": 636, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 637, + "end": 643, + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 648, + "end": 653, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 657, + "end": 683, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 657, + "end": 682, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 657, + "end": 663, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 664, + "end": 681, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 664, + "end": 672, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 664, + "end": 665, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 666, + "end": 672, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 677, + "end": 681, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 685, + "end": 717, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 685, + "end": 716, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 685, + "end": 691, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 692, + "end": 715, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 692, + "end": 707, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 692, + "end": 700, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 692, + "end": 693, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 694, + "end": 700, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 701, + "end": 707, + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 712, + "end": 715, + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 719, + "end": 738, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 725, + "end": 737, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 725, + "end": 726, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + }, + "identifierName": "u" + }, + "name": "u" + }, + "init": { + "type": "CallExpression", + "start": 729, + "end": 737, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 729, + "end": 734, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "uncle" + }, + "name": "uncle" + }, + "arguments": [ + { + "type": "Identifier", + "start": 735, + "end": 736, + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 18 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 741, + "end": 1236, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1239, + "end": 1399, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 48, + "column": 24 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1243, + "end": 1259, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 21 + } + }, + "left": { + "type": "MemberExpression", + "start": 1243, + "end": 1251, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 1243, + "end": 1244, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 6 + }, + "identifierName": "u" + }, + "name": "u", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1245, + "end": 1251, + "loc": { + "start": { + "line": 42, + "column": 7 + }, + "end": { + "line": 42, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1256, + "end": 1259, + "loc": { + "start": { + "line": 42, + "column": 18 + }, + "end": { + "line": 42, + "column": 21 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1261, + "end": 1377, + "loc": { + "start": { + "line": 42, + "column": 23 + }, + "end": { + "line": 48, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1265, + "end": 1289, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 26 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1265, + "end": 1288, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 25 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1265, + "end": 1280, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1265, + "end": 1273, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1265, + "end": 1266, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1267, + "end": 1273, + "loc": { + "start": { + "line": 43, + "column": 4 + }, + "end": { + "line": 43, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1274, + "end": 1280, + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 43, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1283, + "end": 1288, + "loc": { + "start": { + "line": 43, + "column": 20 + }, + "end": { + "line": 43, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1292, + "end": 1309, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1292, + "end": 1308, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1292, + "end": 1300, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1292, + "end": 1293, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + }, + "identifierName": "u" + }, + "name": "u" + }, + "property": { + "type": "Identifier", + "start": 1294, + "end": 1300, + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1303, + "end": 1308, + "loc": { + "start": { + "line": 44, + "column": 13 + }, + "end": { + "line": 44, + "column": 18 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "VariableDeclaration", + "start": 1312, + "end": 1337, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 1318, + "end": 1336, + "loc": { + "start": { + "line": 45, + "column": 8 + }, + "end": { + "line": 45, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 1318, + "end": 1319, + "loc": { + "start": { + "line": 45, + "column": 8 + }, + "end": { + "line": 45, + "column": 9 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 1322, + "end": 1336, + "loc": { + "start": { + "line": 45, + "column": 12 + }, + "end": { + "line": 45, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 1322, + "end": 1333, + "loc": { + "start": { + "line": 45, + "column": 12 + }, + "end": { + "line": 45, + "column": 23 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1334, + "end": 1335, + "loc": { + "start": { + "line": 45, + "column": 24 + }, + "end": { + "line": 45, + "column": 25 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 1340, + "end": 1355, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1340, + "end": 1354, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1340, + "end": 1348, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1340, + "end": 1341, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 3 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1342, + "end": 1348, + "loc": { + "start": { + "line": 46, + "column": 4 + }, + "end": { + "line": 46, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1351, + "end": 1354, + "loc": { + "start": { + "line": 46, + "column": 13 + }, + "end": { + "line": 46, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1358, + "end": 1374, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1358, + "end": 1373, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1358, + "end": 1370, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 14 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1371, + "end": 1372, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1383, + "end": 1399, + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 48, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1383, + "end": 1398, + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 48, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1383, + "end": 1395, + "loc": { + "start": { + "line": 48, + "column": 8 + }, + "end": { + "line": 48, + "column": 20 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1396, + "end": 1397, + "loc": { + "start": { + "line": 48, + "column": 21 + }, + "end": { + "line": 48, + "column": 22 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 741, + "end": 1236, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "start": 325, + "end": 501, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "start": 325, + "end": 501, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 741, + "end": 1236, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "uncle", + "start": 147, + "end": 152, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 153, + "end": 157, + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/uncle.js", + "start": 158, + "end": 178, + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 178, + "end": 179, + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 39 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 180, + "end": 186, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 187, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 199, + "end": 203, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/grandparent.js", + "start": 204, + "end": 230, + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 230, + "end": 231, + "loc": { + "start": { + "line": 6, + "column": 50 + }, + "end": { + "line": 6, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 232, + "end": 238, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case1", + "start": 239, + "end": 251, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 252, + "end": 256, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case1.js", + "start": 257, + "end": 276, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 276, + "end": 277, + "loc": { + "start": { + "line": 7, + "column": 44 + }, + "end": { + "line": 7, + "column": 45 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 278, + "end": 284, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case4", + "start": 285, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 298, + "end": 302, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case4.js", + "start": 303, + "end": 322, + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "start": 325, + "end": 501, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 502, + "end": 507, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case3", + "start": 508, + "end": 520, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 521, + "end": 522, + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 523, + "end": 524, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 524, + "end": 525, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 525, + "end": 526, + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 527, + "end": 529, + "loc": { + "start": { + "line": 19, + "column": 25 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 530, + "end": 531, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 533, + "end": 539, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 539, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 540, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 542, + "end": 552, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 557, + "end": 558, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 558, + "end": 559, + "loc": { + "start": { + "line": 20, + "column": 26 + }, + "end": { + "line": 20, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 561, + "end": 567, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 567, + "end": 568, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 568, + "end": 569, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 569, + "end": 570, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 570, + "end": 576, + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 577, + "end": 580, + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 581, + "end": 584, + "loc": { + "start": { + "line": 21, + "column": 21 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 198, - "end": 344, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 13, - "column": 3 - } - } - } - ] + "end": { + "line": 21, + "column": 24 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 198, - "end": 344, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 584, + "end": 585, "loc": { "start": { - "line": 6, - "column": 0 + "line": 21, + "column": 24 }, "end": { - "line": 13, - "column": 3 + "line": 21, + "column": 25 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 405, - "end": 900, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 585, + "end": 586, "loc": { "start": { - "line": 17, - "column": 1 + "line": 21, + "column": 25 }, "end": { - "line": 29, - "column": 4 + "line": 21, + "column": 26 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1596,26 +5998,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "assert", + "start": 588, + "end": 594, "loc": { "start": { - "line": 1, - "column": 0 + "line": 22, + "column": 1 }, "end": { - "line": 1, - "column": 6 + "line": 22, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1625,15 +6026,15 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "start": 594, + "end": 595, "loc": { "start": { - "line": 1, + "line": 22, "column": 7 }, "end": { - "line": 1, + "line": 22, "column": 8 } } @@ -1650,24 +6051,24 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "n", + "start": 595, + "end": 596, "loc": { "start": { - "line": 1, + "line": 22, "column": 8 }, "end": { - "line": 1, - "column": 13 + "line": 22, + "column": 9 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1677,16 +6078,16 @@ "binop": null, "updateContext": null }, - "start": 13, - "end": 14, + "start": 596, + "end": 597, "loc": { "start": { - "line": 1, - "column": 13 + "line": 22, + "column": 9 }, "end": { - "line": 1, - "column": 14 + "line": 22, + "column": 10 } } }, @@ -1702,23 +6103,23 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 15, - "end": 18, + "value": "left", + "start": 597, + "end": 601, "loc": { "start": { - "line": 1, - "column": 15 + "line": 22, + "column": 10 }, "end": { - "line": 1, - "column": 18 + "line": 22, + "column": 14 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1726,18 +6127,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 18, - "end": 19, + "start": 601, + "end": 602, "loc": { "start": { - "line": 1, - "column": 18 + "line": 22, + "column": 14 }, "end": { - "line": 1, - "column": 19 + "line": 22, + "column": 15 } } }, @@ -1753,123 +6155,121 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 20, - "end": 24, + "value": "_color", + "start": 602, + "end": 608, "loc": { "start": { - "line": 1, - "column": 20 + "line": 22, + "column": 15 }, "end": { - "line": 1, - "column": 24 + "line": 22, + "column": 21 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "../color/index.js", - "start": 25, - "end": 44, + "value": "===", + "start": 609, + "end": 612, "loc": { "start": { - "line": 1, - "column": 25 + "line": 22, + "column": 22 }, "end": { - "line": 1, - "column": 44 + "line": 22, + "column": 25 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 44, - "end": 45, + "value": "BLACK", + "start": 613, + "end": 618, "loc": { "start": { - "line": 1, - "column": 44 + "line": 22, + "column": 26 }, "end": { - "line": 1, - "column": 45 + "line": 22, + "column": 31 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 46, - "end": 52, + "start": 618, + "end": 619, "loc": { "start": { - "line": 2, - "column": 0 + "line": 22, + "column": 31 }, "end": { - "line": 2, - "column": 6 + "line": 22, + "column": 32 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 53, - "end": 54, + "start": 619, + "end": 620, "loc": { "start": { - "line": 2, - "column": 7 + "line": 22, + "column": 32 }, "end": { - "line": 2, - "column": 8 + "line": 22, + "column": 33 } } }, @@ -1885,43 +6285,42 @@ "postfix": false, "binop": null }, - "value": "uncle", - "start": 54, - "end": 59, + "value": "assert", + "start": 622, + "end": 628, "loc": { "start": { - "line": 2, - "column": 8 + "line": 23, + "column": 1 }, "end": { - "line": 2, - "column": 13 + "line": 23, + "column": 7 } } }, { "type": { - "label": ",", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 59, - "end": 60, + "start": 628, + "end": 629, "loc": { "start": { - "line": 2, - "column": 13 + "line": 23, + "column": 7 }, "end": { - "line": 2, - "column": 14 + "line": 23, + "column": 8 } } }, @@ -1937,23 +6336,23 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 61, - "end": 72, + "value": "n", + "start": 629, + "end": 630, "loc": { "start": { - "line": 2, - "column": 15 + "line": 23, + "column": 8 }, "end": { - "line": 2, - "column": 26 + "line": 23, + "column": 9 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1961,18 +6360,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 72, - "end": 73, + "start": 630, + "end": 631, "loc": { "start": { - "line": 2, - "column": 26 + "line": 23, + "column": 9 }, "end": { - "line": 2, - "column": 27 + "line": 23, + "column": 10 } } }, @@ -1980,31 +6380,57 @@ "type": { "label": "name", "beforeExpr": false, - "startsExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 631, + "end": 636, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 15 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 74, - "end": 78, + "start": 636, + "end": 637, "loc": { "start": { - "line": 2, - "column": 28 + "line": 23, + "column": 15 }, "end": { - "line": 2, - "column": 32 + "line": 23, + "column": 16 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2012,26 +6438,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/index.js", - "start": 79, - "end": 99, + "value": "_color", + "start": 637, + "end": 643, "loc": { "start": { - "line": 2, - "column": 33 + "line": 23, + "column": 16 }, "end": { - "line": 2, - "column": 53 + "line": 23, + "column": 22 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2039,26 +6464,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 99, - "end": 100, + "value": "===", + "start": 644, + "end": 647, "loc": { "start": { - "line": 2, - "column": 53 + "line": 23, + "column": 23 }, "end": { - "line": 2, - "column": 54 + "line": 23, + "column": 26 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2066,28 +6491,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 101, - "end": 107, + "value": "BLACK", + "start": 648, + "end": 653, "loc": { "start": { - "line": 3, - "column": 0 + "line": 23, + "column": 27 }, "end": { - "line": 3, - "column": 6 + "line": 23, + "column": 32 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2095,50 +6519,50 @@ "postfix": false, "binop": null }, - "start": 108, - "end": 109, + "start": 653, + "end": 654, "loc": { "start": { - "line": 3, - "column": 7 + "line": 23, + "column": 32 }, "end": { - "line": 3, - "column": 8 + "line": 23, + "column": 33 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "insert_case1", - "start": 109, - "end": 121, + "start": 654, + "end": 655, "loc": { "start": { - "line": 3, - "column": 8 + "line": 23, + "column": 33 }, "end": { - "line": 3, - "column": 20 + "line": 23, + "column": 34 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2146,23 +6570,24 @@ "postfix": false, "binop": null }, - "start": 121, - "end": 122, + "value": "assert", + "start": 657, + "end": 663, "loc": { "start": { - "line": 3, - "column": 20 + "line": 24, + "column": 1 }, "end": { - "line": 3, - "column": 21 + "line": 24, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2171,23 +6596,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 123, - "end": 127, + "start": 663, + "end": 664, "loc": { "start": { - "line": 3, - "column": 22 + "line": 24, + "column": 7 }, "end": { - "line": 3, - "column": 26 + "line": 24, + "column": 8 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2195,27 +6619,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./insert_case1.js", - "start": 128, - "end": 147, + "value": "n", + "start": 664, + "end": 665, "loc": { "start": { - "line": 3, - "column": 27 + "line": 24, + "column": 8 }, "end": { - "line": 3, - "column": 46 + "line": 24, + "column": 9 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2225,23 +6648,22 @@ "binop": null, "updateContext": null }, - "start": 147, - "end": 148, + "start": 665, + "end": 666, "loc": { "start": { - "line": 3, - "column": 46 + "line": 24, + "column": 9 }, "end": { - "line": 3, - "column": 47 + "line": 24, + "column": 10 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2249,51 +6671,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 149, - "end": 155, + "value": "parent", + "start": 666, + "end": 672, "loc": { "start": { - "line": 4, - "column": 0 + "line": 24, + "column": 10 }, "end": { - "line": 4, - "column": 6 + "line": 24, + "column": 16 } } }, { "type": { - "label": "{", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 156, - "end": 157, + "value": "!==", + "start": 673, + "end": 676, "loc": { "start": { - "line": 4, - "column": 7 + "line": 24, + "column": 17 }, "end": { - "line": 4, - "column": 8 + "line": 24, + "column": 20 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2301,25 +6725,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "insert_case4", - "start": 157, - "end": 169, + "value": "null", + "start": 677, + "end": 681, "loc": { "start": { - "line": 4, - "column": 8 + "line": 24, + "column": 21 }, "end": { - "line": 4, - "column": 20 + "line": 24, + "column": 25 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2329,48 +6754,48 @@ "postfix": false, "binop": null }, - "start": 169, - "end": 170, + "start": 681, + "end": 682, "loc": { "start": { - "line": 4, - "column": 20 + "line": 24, + "column": 25 }, "end": { - "line": 4, - "column": 21 + "line": 24, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 171, - "end": 175, + "start": 682, + "end": 683, "loc": { "start": { - "line": 4, - "column": 22 + "line": 24, + "column": 26 }, "end": { - "line": 4, - "column": 26 + "line": 24, + "column": 27 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2378,97 +6803,76 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./insert_case4.js", - "start": 176, - "end": 195, + "value": "assert", + "start": 685, + "end": 691, "loc": { "start": { - "line": 4, - "column": 27 + "line": 25, + "column": 1 }, "end": { - "line": 4, - "column": 46 + "line": 25, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 195, - "end": 196, - "loc": { - "start": { - "line": 4, - "column": 46 - }, - "end": { - "line": 4, - "column": 47 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 198, - "end": 344, + "start": 691, + "end": 692, "loc": { "start": { - "line": 6, - "column": 0 + "line": 25, + "column": 7 }, "end": { - "line": 13, - "column": 3 + "line": 25, + "column": 8 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 345, - "end": 351, + "value": "n", + "start": 692, + "end": 693, "loc": { "start": { - "line": 14, - "column": 0 + "line": 25, + "column": 8 }, "end": { - "line": 14, - "column": 6 + "line": 25, + "column": 9 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2479,17 +6883,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 352, - "end": 357, + "start": 693, + "end": 694, "loc": { "start": { - "line": 14, - "column": 7 + "line": 25, + "column": 9 }, "end": { - "line": 14, - "column": 12 + "line": 25, + "column": 10 } } }, @@ -2505,51 +6908,50 @@ "postfix": false, "binop": null }, - "value": "insert_case3", - "start": 358, - "end": 370, + "value": "parent", + "start": 694, + "end": 700, "loc": { "start": { - "line": 14, - "column": 13 + "line": 25, + "column": 10 }, "end": { - "line": 14, - "column": 25 + "line": 25, + "column": 16 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 371, - "end": 372, + "start": 700, + "end": 701, "loc": { "start": { - "line": 14, - "column": 26 + "line": 25, + "column": 16 }, "end": { - "line": 14, - "column": 27 + "line": 25, + "column": 17 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2558,50 +6960,52 @@ "postfix": false, "binop": null }, - "start": 373, - "end": 374, + "value": "_color", + "start": 701, + "end": 707, "loc": { "start": { - "line": 14, - "column": 28 + "line": 25, + "column": 17 }, "end": { - "line": 14, - "column": 29 + "line": 25, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "n", - "start": 374, - "end": 375, + "value": "===", + "start": 708, + "end": 711, "loc": { "start": { - "line": 14, - "column": 29 + "line": 25, + "column": 24 }, "end": { - "line": 14, - "column": 30 + "line": 25, + "column": 27 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2609,67 +7013,68 @@ "postfix": false, "binop": null }, - "start": 375, - "end": 376, + "value": "RED", + "start": 712, + "end": 715, "loc": { "start": { - "line": 14, - "column": 30 + "line": 25, + "column": 28 }, "end": { - "line": 14, + "line": 25, "column": 31 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 377, - "end": 379, + "start": 715, + "end": 716, "loc": { "start": { - "line": 14, - "column": 32 + "line": 25, + "column": 31 }, "end": { - "line": 14, - "column": 34 + "line": 25, + "column": 32 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 380, - "end": 381, + "start": 716, + "end": 717, "loc": { "start": { - "line": 14, - "column": 35 + "line": 25, + "column": 32 }, "end": { - "line": 14, - "column": 36 + "line": 25, + "column": 33 } } }, @@ -2688,15 +7093,15 @@ "updateContext": null }, "value": "const", - "start": 383, - "end": 388, + "start": 719, + "end": 724, "loc": { "start": { - "line": 15, + "line": 26, "column": 1 }, "end": { - "line": 15, + "line": 26, "column": 6 } } @@ -2714,15 +7119,15 @@ "binop": null }, "value": "u", - "start": 389, - "end": 390, + "start": 725, + "end": 726, "loc": { "start": { - "line": 15, + "line": 26, "column": 7 }, "end": { - "line": 15, + "line": 26, "column": 8 } } @@ -2741,15 +7146,15 @@ "updateContext": null }, "value": "=", - "start": 391, - "end": 392, + "start": 727, + "end": 728, "loc": { "start": { - "line": 15, + "line": 26, "column": 9 }, "end": { - "line": 15, + "line": 26, "column": 10 } } @@ -2767,15 +7172,15 @@ "binop": null }, "value": "uncle", - "start": 393, - "end": 398, + "start": 729, + "end": 734, "loc": { "start": { - "line": 15, + "line": 26, "column": 11 }, "end": { - "line": 15, + "line": 26, "column": 16 } } @@ -2792,15 +7197,15 @@ "postfix": false, "binop": null }, - "start": 398, - "end": 399, + "start": 734, + "end": 735, "loc": { "start": { - "line": 15, + "line": 26, "column": 16 }, "end": { - "line": 15, + "line": 26, "column": 17 } } @@ -2818,15 +7223,15 @@ "binop": null }, "value": "n", - "start": 399, - "end": 400, + "start": 735, + "end": 736, "loc": { "start": { - "line": 15, + "line": 26, "column": 17 }, "end": { - "line": 15, + "line": 26, "column": 18 } } @@ -2843,15 +7248,15 @@ "postfix": false, "binop": null }, - "start": 400, - "end": 401, + "start": 736, + "end": 737, "loc": { "start": { - "line": 15, + "line": 26, "column": 18 }, "end": { - "line": 15, + "line": 26, "column": 19 } } @@ -2869,15 +7274,15 @@ "binop": null, "updateContext": null }, - "start": 401, - "end": 402, + "start": 737, + "end": 738, "loc": { "start": { - "line": 15, + "line": 26, "column": 19 }, "end": { - "line": 15, + "line": 26, "column": 20 } } @@ -2885,15 +7290,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 405, - "end": 900, + "start": 741, + "end": 1236, "loc": { "start": { - "line": 17, + "line": 28, "column": 1 }, "end": { - "line": 29, + "line": 40, "column": 4 } } @@ -2913,15 +7318,15 @@ "updateContext": null }, "value": "if", - "start": 903, - "end": 905, + "start": 1239, + "end": 1241, "loc": { "start": { - "line": 31, + "line": 42, "column": 1 }, "end": { - "line": 31, + "line": 42, "column": 3 } } @@ -2938,15 +7343,15 @@ "postfix": false, "binop": null }, - "start": 906, - "end": 907, + "start": 1242, + "end": 1243, "loc": { "start": { - "line": 31, + "line": 42, "column": 4 }, "end": { - "line": 31, + "line": 42, "column": 5 } } @@ -2964,127 +7369,19 @@ "binop": null }, "value": "u", - "start": 907, - "end": 908, + "start": 1243, + "end": 1244, "loc": { "start": { - "line": 31, + "line": 42, "column": 5 }, "end": { - "line": 31, + "line": 42, "column": 6 } } }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "!==", - "start": 909, - "end": 912, - "loc": { - "start": { - "line": 31, - "column": 7 - }, - "end": { - "line": 31, - "column": 10 - } - } - }, - { - "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "null", - "start": 913, - "end": 917, - "loc": { - "start": { - "line": 31, - "column": 11 - }, - "end": { - "line": 31, - "column": 15 - } - } - }, - { - "type": { - "label": "&&", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 2, - "updateContext": null - }, - "value": "&&", - "start": 918, - "end": 920, - "loc": { - "start": { - "line": 31, - "column": 16 - }, - "end": { - "line": 31, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "u", - "start": 921, - "end": 922, - "loc": { - "start": { - "line": 31, - "column": 19 - }, - "end": { - "line": 31, - "column": 20 - } - } - }, { "type": { "label": ".", @@ -3098,16 +7395,16 @@ "binop": null, "updateContext": null }, - "start": 922, - "end": 923, + "start": 1244, + "end": 1245, "loc": { "start": { - "line": 31, - "column": 20 + "line": 42, + "column": 6 }, "end": { - "line": 31, - "column": 21 + "line": 42, + "column": 7 } } }, @@ -3124,16 +7421,16 @@ "binop": null }, "value": "_color", - "start": 923, - "end": 929, + "start": 1245, + "end": 1251, "loc": { "start": { - "line": 31, - "column": 21 + "line": 42, + "column": 7 }, "end": { - "line": 31, - "column": 27 + "line": 42, + "column": 13 } } }, @@ -3151,16 +7448,16 @@ "updateContext": null }, "value": "===", - "start": 930, - "end": 933, + "start": 1252, + "end": 1255, "loc": { "start": { - "line": 31, - "column": 28 + "line": 42, + "column": 14 }, "end": { - "line": 31, - "column": 31 + "line": 42, + "column": 17 } } }, @@ -3177,16 +7474,16 @@ "binop": null }, "value": "RED", - "start": 934, - "end": 937, + "start": 1256, + "end": 1259, "loc": { "start": { - "line": 31, - "column": 32 + "line": 42, + "column": 18 }, "end": { - "line": 31, - "column": 35 + "line": 42, + "column": 21 } } }, @@ -3202,16 +7499,16 @@ "postfix": false, "binop": null }, - "start": 937, - "end": 938, + "start": 1259, + "end": 1260, "loc": { "start": { - "line": 31, - "column": 35 + "line": 42, + "column": 21 }, "end": { - "line": 31, - "column": 36 + "line": 42, + "column": 22 } } }, @@ -3227,16 +7524,16 @@ "postfix": false, "binop": null }, - "start": 939, - "end": 940, + "start": 1261, + "end": 1262, "loc": { "start": { - "line": 31, - "column": 37 + "line": 42, + "column": 23 }, "end": { - "line": 31, - "column": 38 + "line": 42, + "column": 24 } } }, @@ -3253,15 +7550,15 @@ "binop": null }, "value": "n", - "start": 943, - "end": 944, + "start": 1265, + "end": 1266, "loc": { "start": { - "line": 32, + "line": 43, "column": 2 }, "end": { - "line": 32, + "line": 43, "column": 3 } } @@ -3279,15 +7576,15 @@ "binop": null, "updateContext": null }, - "start": 944, - "end": 945, + "start": 1266, + "end": 1267, "loc": { "start": { - "line": 32, + "line": 43, "column": 3 }, "end": { - "line": 32, + "line": 43, "column": 4 } } @@ -3305,15 +7602,15 @@ "binop": null }, "value": "parent", - "start": 945, - "end": 951, + "start": 1267, + "end": 1273, "loc": { "start": { - "line": 32, + "line": 43, "column": 4 }, "end": { - "line": 32, + "line": 43, "column": 10 } } @@ -3331,15 +7628,15 @@ "binop": null, "updateContext": null }, - "start": 951, - "end": 952, + "start": 1273, + "end": 1274, "loc": { "start": { - "line": 32, + "line": 43, "column": 10 }, "end": { - "line": 32, + "line": 43, "column": 11 } } @@ -3357,15 +7654,15 @@ "binop": null }, "value": "_color", - "start": 952, - "end": 958, + "start": 1274, + "end": 1280, "loc": { "start": { - "line": 32, + "line": 43, "column": 11 }, "end": { - "line": 32, + "line": 43, "column": 17 } } @@ -3384,15 +7681,15 @@ "updateContext": null }, "value": "=", - "start": 959, - "end": 960, + "start": 1281, + "end": 1282, "loc": { "start": { - "line": 32, + "line": 43, "column": 18 }, "end": { - "line": 32, + "line": 43, "column": 19 } } @@ -3410,15 +7707,15 @@ "binop": null }, "value": "BLACK", - "start": 961, - "end": 966, + "start": 1283, + "end": 1288, "loc": { "start": { - "line": 32, + "line": 43, "column": 20 }, "end": { - "line": 32, + "line": 43, "column": 25 } } @@ -3436,15 +7733,15 @@ "binop": null, "updateContext": null }, - "start": 966, - "end": 967, + "start": 1288, + "end": 1289, "loc": { "start": { - "line": 32, + "line": 43, "column": 25 }, "end": { - "line": 32, + "line": 43, "column": 26 } } @@ -3462,15 +7759,15 @@ "binop": null }, "value": "u", - "start": 970, - "end": 971, + "start": 1292, + "end": 1293, "loc": { "start": { - "line": 33, + "line": 44, "column": 2 }, "end": { - "line": 33, + "line": 44, "column": 3 } } @@ -3488,15 +7785,15 @@ "binop": null, "updateContext": null }, - "start": 971, - "end": 972, + "start": 1293, + "end": 1294, "loc": { "start": { - "line": 33, + "line": 44, "column": 3 }, "end": { - "line": 33, + "line": 44, "column": 4 } } @@ -3514,15 +7811,15 @@ "binop": null }, "value": "_color", - "start": 972, - "end": 978, + "start": 1294, + "end": 1300, "loc": { "start": { - "line": 33, + "line": 44, "column": 4 }, "end": { - "line": 33, + "line": 44, "column": 10 } } @@ -3541,15 +7838,15 @@ "updateContext": null }, "value": "=", - "start": 979, - "end": 980, + "start": 1301, + "end": 1302, "loc": { "start": { - "line": 33, + "line": 44, "column": 11 }, "end": { - "line": 33, + "line": 44, "column": 12 } } @@ -3567,15 +7864,15 @@ "binop": null }, "value": "BLACK", - "start": 981, - "end": 986, + "start": 1303, + "end": 1308, "loc": { "start": { - "line": 33, + "line": 44, "column": 13 }, "end": { - "line": 33, + "line": 44, "column": 18 } } @@ -3593,15 +7890,15 @@ "binop": null, "updateContext": null }, - "start": 986, - "end": 987, + "start": 1308, + "end": 1309, "loc": { "start": { - "line": 33, + "line": 44, "column": 18 }, "end": { - "line": 33, + "line": 44, "column": 19 } } @@ -3621,15 +7918,15 @@ "updateContext": null }, "value": "const", - "start": 990, - "end": 995, + "start": 1312, + "end": 1317, "loc": { "start": { - "line": 34, + "line": 45, "column": 2 }, "end": { - "line": 34, + "line": 45, "column": 7 } } @@ -3647,15 +7944,15 @@ "binop": null }, "value": "g", - "start": 996, - "end": 997, + "start": 1318, + "end": 1319, "loc": { "start": { - "line": 34, + "line": 45, "column": 8 }, "end": { - "line": 34, + "line": 45, "column": 9 } } @@ -3674,15 +7971,15 @@ "updateContext": null }, "value": "=", - "start": 998, - "end": 999, + "start": 1320, + "end": 1321, "loc": { "start": { - "line": 34, + "line": 45, "column": 10 }, "end": { - "line": 34, + "line": 45, "column": 11 } } @@ -3700,15 +7997,15 @@ "binop": null }, "value": "grandparent", - "start": 1000, - "end": 1011, + "start": 1322, + "end": 1333, "loc": { "start": { - "line": 34, + "line": 45, "column": 12 }, "end": { - "line": 34, + "line": 45, "column": 23 } } @@ -3725,15 +8022,15 @@ "postfix": false, "binop": null }, - "start": 1011, - "end": 1012, + "start": 1333, + "end": 1334, "loc": { "start": { - "line": 34, + "line": 45, "column": 23 }, "end": { - "line": 34, + "line": 45, "column": 24 } } @@ -3751,15 +8048,15 @@ "binop": null }, "value": "n", - "start": 1012, - "end": 1013, + "start": 1334, + "end": 1335, "loc": { "start": { - "line": 34, + "line": 45, "column": 24 }, "end": { - "line": 34, + "line": 45, "column": 25 } } @@ -3776,15 +8073,15 @@ "postfix": false, "binop": null }, - "start": 1013, - "end": 1014, + "start": 1335, + "end": 1336, "loc": { "start": { - "line": 34, + "line": 45, "column": 25 }, "end": { - "line": 34, + "line": 45, "column": 26 } } @@ -3802,15 +8099,15 @@ "binop": null, "updateContext": null }, - "start": 1014, - "end": 1015, + "start": 1336, + "end": 1337, "loc": { "start": { - "line": 34, + "line": 45, "column": 26 }, "end": { - "line": 34, + "line": 45, "column": 27 } } @@ -3828,15 +8125,15 @@ "binop": null }, "value": "g", - "start": 1018, - "end": 1019, + "start": 1340, + "end": 1341, "loc": { "start": { - "line": 35, + "line": 46, "column": 2 }, "end": { - "line": 35, + "line": 46, "column": 3 } } @@ -3854,15 +8151,15 @@ "binop": null, "updateContext": null }, - "start": 1019, - "end": 1020, + "start": 1341, + "end": 1342, "loc": { "start": { - "line": 35, + "line": 46, "column": 3 }, "end": { - "line": 35, + "line": 46, "column": 4 } } @@ -3880,15 +8177,15 @@ "binop": null }, "value": "_color", - "start": 1020, - "end": 1026, + "start": 1342, + "end": 1348, "loc": { "start": { - "line": 35, + "line": 46, "column": 4 }, "end": { - "line": 35, + "line": 46, "column": 10 } } @@ -3907,15 +8204,15 @@ "updateContext": null }, "value": "=", - "start": 1027, - "end": 1028, + "start": 1349, + "end": 1350, "loc": { "start": { - "line": 35, + "line": 46, "column": 11 }, "end": { - "line": 35, + "line": 46, "column": 12 } } @@ -3933,15 +8230,15 @@ "binop": null }, "value": "RED", - "start": 1029, - "end": 1032, + "start": 1351, + "end": 1354, "loc": { "start": { - "line": 35, + "line": 46, "column": 13 }, "end": { - "line": 35, + "line": 46, "column": 16 } } @@ -3959,15 +8256,15 @@ "binop": null, "updateContext": null }, - "start": 1032, - "end": 1033, + "start": 1354, + "end": 1355, "loc": { "start": { - "line": 35, + "line": 46, "column": 16 }, "end": { - "line": 35, + "line": 46, "column": 17 } } @@ -3985,15 +8282,15 @@ "binop": null }, "value": "insert_case1", - "start": 1036, - "end": 1048, + "start": 1358, + "end": 1370, "loc": { "start": { - "line": 36, + "line": 47, "column": 2 }, "end": { - "line": 36, + "line": 47, "column": 14 } } @@ -4010,15 +8307,15 @@ "postfix": false, "binop": null }, - "start": 1048, - "end": 1049, + "start": 1370, + "end": 1371, "loc": { "start": { - "line": 36, + "line": 47, "column": 14 }, "end": { - "line": 36, + "line": 47, "column": 15 } } @@ -4036,15 +8333,15 @@ "binop": null }, "value": "g", - "start": 1049, - "end": 1050, + "start": 1371, + "end": 1372, "loc": { "start": { - "line": 36, + "line": 47, "column": 15 }, "end": { - "line": 36, + "line": 47, "column": 16 } } @@ -4061,15 +8358,15 @@ "postfix": false, "binop": null }, - "start": 1050, - "end": 1051, + "start": 1372, + "end": 1373, "loc": { "start": { - "line": 36, + "line": 47, "column": 16 }, "end": { - "line": 36, + "line": 47, "column": 17 } } @@ -4087,15 +8384,15 @@ "binop": null, "updateContext": null }, - "start": 1051, - "end": 1052, + "start": 1373, + "end": 1374, "loc": { "start": { - "line": 36, + "line": 47, "column": 17 }, "end": { - "line": 36, + "line": 47, "column": 18 } } @@ -4112,15 +8409,15 @@ "postfix": false, "binop": null }, - "start": 1054, - "end": 1055, + "start": 1376, + "end": 1377, "loc": { "start": { - "line": 37, + "line": 48, "column": 1 }, "end": { - "line": 37, + "line": 48, "column": 2 } } @@ -4140,15 +8437,15 @@ "updateContext": null }, "value": "else", - "start": 1056, - "end": 1060, + "start": 1378, + "end": 1382, "loc": { "start": { - "line": 37, + "line": 48, "column": 3 }, "end": { - "line": 37, + "line": 48, "column": 7 } } @@ -4166,15 +8463,15 @@ "binop": null }, "value": "insert_case4", - "start": 1061, - "end": 1073, + "start": 1383, + "end": 1395, "loc": { "start": { - "line": 37, + "line": 48, "column": 8 }, "end": { - "line": 37, + "line": 48, "column": 20 } } @@ -4191,15 +8488,15 @@ "postfix": false, "binop": null }, - "start": 1073, - "end": 1074, + "start": 1395, + "end": 1396, "loc": { "start": { - "line": 37, + "line": 48, "column": 20 }, "end": { - "line": 37, + "line": 48, "column": 21 } } @@ -4217,15 +8514,15 @@ "binop": null }, "value": "n", - "start": 1074, - "end": 1075, + "start": 1396, + "end": 1397, "loc": { "start": { - "line": 37, + "line": 48, "column": 21 }, "end": { - "line": 37, + "line": 48, "column": 22 } } @@ -4242,15 +8539,15 @@ "postfix": false, "binop": null }, - "start": 1075, - "end": 1076, + "start": 1397, + "end": 1398, "loc": { "start": { - "line": 37, + "line": 48, "column": 22 }, "end": { - "line": 37, + "line": 48, "column": 23 } } @@ -4268,15 +8565,15 @@ "binop": null, "updateContext": null }, - "start": 1076, - "end": 1077, + "start": 1398, + "end": 1399, "loc": { "start": { - "line": 37, + "line": 48, "column": 23 }, "end": { - "line": 37, + "line": 48, "column": 24 } } @@ -4293,15 +8590,15 @@ "postfix": false, "binop": null }, - "start": 1078, - "end": 1079, + "start": 1400, + "end": 1401, "loc": { "start": { - "line": 38, + "line": 49, "column": 0 }, "end": { - "line": 38, + "line": 49, "column": 1 } } @@ -4319,19 +8616,127 @@ "binop": null, "updateContext": null }, - "start": 1079, - "end": 1080, + "start": 1401, + "end": 1402, "loc": { "start": { - "line": 38, + "line": 49, "column": 1 }, "end": { - "line": 38, + "line": 49, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1404, + "end": 1410, + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1411, + "end": 1418, + "loc": { + "start": { + "line": 51, + "column": 7 + }, + "end": { + "line": 51, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case3", + "start": 1419, + "end": 1431, + "loc": { + "start": { + "line": 51, + "column": 15 + }, + "end": { + "line": 51, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1431, + "end": 1432, + "loc": { + "start": { + "line": 51, + "column": 27 + }, + "end": { + "line": 51, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -4345,15 +8750,15 @@ "binop": null, "updateContext": null }, - "start": 1081, - "end": 1081, + "start": 1433, + "end": 1433, "loc": { "start": { - "line": 39, + "line": 52, "column": 0 }, "end": { - "line": 39, + "line": 52, "column": 0 } } diff --git a/ast/source/insertion/insert_case4.js.json b/ast/source/insertion/insert_case4.js.json index e704dcf..c1faf79 100644 --- a/ast/source/insertion/insert_case4.js.json +++ b/ast/source/insertion/insert_case4.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 2240, + "end": 2659, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 79, + "line": 93, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 2240, + "end": 2659, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 79, + "line": 93, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 61, + "end": 28, "loc": { "start": { "line": 1, @@ -39,274 +39,519 @@ }, "end": { "line": 1, - "column": 61 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, - "end": 19, + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 19 + "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, - "end": 19, + "start": 7, + "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 19 + "column": 13 }, - "identifierName": "rotate_left" + "identifierName": "assert" }, - "name": "rotate_left" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 19, + "start": 36, + "end": 40, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 19 + "line": 2, + "column": 11 }, - "identifierName": "rotate_left" + "identifierName": "Node" }, - "name": "rotate_left" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 } }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 38 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 21, - "end": 33, + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 78, "loc": { "start": { - "line": 1, - "column": 21 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 33 + "line": 3, + "column": 12 } }, - "imported": { + "local": { "type": "Identifier", - "start": 21, - "end": 33, + "start": 73, + "end": 78, "loc": { "start": { - "line": 1, - "column": 21 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 33 + "line": 3, + "column": 12 }, - "identifierName": "rotate_right" + "identifierName": "BLACK" }, - "name": "rotate_right" + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 105, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } }, "local": { "type": "Identifier", - "start": 21, - "end": 33, + "start": 112, + "end": 115, "loc": { "start": { - "line": 1, - "column": 21 + "line": 4, + "column": 7 }, "end": { - "line": 1, - "column": 33 + "line": 4, + "column": 10 }, - "identifierName": "rotate_right" + "identifierName": "RED" }, - "name": "rotate_right" + "name": "RED" } } ], "source": { "type": "StringLiteral", - "start": 40, - "end": 60, + "start": 121, + "end": 138, "loc": { "start": { - "line": 1, - "column": 40 + "line": 4, + "column": 16 }, "end": { - "line": 1, - "column": 60 + "line": 4, + "column": 33 } }, "extra": { - "rawValue": "../rotate/index.js", - "raw": "'../rotate/index.js'" + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" }, - "value": "../rotate/index.js" + "value": "../color/RED.js" } }, { "type": "ImportDeclaration", - "start": 62, - "end": 115, + "start": 140, + "end": 191, "loc": { "start": { - "line": 2, + "line": 5, "column": 0 }, "end": { - "line": 2, - "column": 53 + "line": 5, + "column": 51 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 70, - "end": 81, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 158, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 19 + "line": 5, + "column": 18 } }, - "imported": { + "local": { "type": "Identifier", - "start": 70, - "end": 81, + "start": 147, + "end": 158, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 19 + "line": 5, + "column": 18 }, - "identifierName": "grandparent" + "identifierName": "rotate_left" }, - "name": "grandparent" + "name": "rotate_left" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 164, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + }, + "extra": { + "rawValue": "../rotate/rotate_left.js", + "raw": "'../rotate/rotate_left.js'" + }, + "value": "../rotate/rotate_left.js" + } + }, + { + "type": "ImportDeclaration", + "start": 192, + "end": 245, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 53 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 199, + "end": 211, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 19 + } }, "local": { "type": "Identifier", - "start": 70, - "end": 81, + "start": 199, + "end": 211, "loc": { "start": { - "line": 2, - "column": 8 + "line": 6, + "column": 7 }, "end": { - "line": 2, + "line": 6, "column": 19 }, - "identifierName": "grandparent" + "identifierName": "rotate_right" }, - "name": "grandparent" + "name": "rotate_right" } } ], "source": { "type": "StringLiteral", - "start": 88, - "end": 114, + "start": 217, + "end": 244, "loc": { "start": { - "line": 2, - "column": 26 + "line": 6, + "column": 25 }, "end": { - "line": 2, + "line": 6, "column": 52 } }, "extra": { - "rawValue": "../family/grandparent.js", - "raw": "'../family/grandparent.js'" + "rawValue": "../rotate/rotate_right.js", + "raw": "'../rotate/rotate_right.js'" }, - "value": "../family/grandparent.js" + "value": "../rotate/rotate_right.js" } }, { "type": "ImportDeclaration", - "start": 116, - "end": 163, + "start": 246, + "end": 297, "loc": { "start": { - "line": 3, + "line": 7, "column": 0 }, "end": { - "line": 3, - "column": 47 + "line": 7, + "column": 51 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 124, - "end": 136, + "type": "ImportDefaultSpecifier", + "start": 253, + "end": 264, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 7, + "column": 18 } }, - "imported": { + "local": { "type": "Identifier", - "start": 124, - "end": 136, + "start": 253, + "end": 264, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 7, + "column": 18 }, - "identifierName": "insert_case5" + "identifierName": "grandparent" }, - "name": "insert_case5" + "name": "grandparent" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 270, + "end": 296, + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 50 + } + }, + "extra": { + "rawValue": "../family/grandparent.js", + "raw": "'../family/grandparent.js'" + }, + "value": "../family/grandparent.js" + } + }, + { + "type": "ImportDeclaration", + "start": 298, + "end": 343, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 305, + "end": 317, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } }, "local": { "type": "Identifier", - "start": 124, - "end": 136, + "start": 305, + "end": 317, "loc": { "start": { - "line": 3, - "column": 8 + "line": 8, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 8, + "column": 19 }, "identifierName": "insert_case5" }, @@ -316,16 +561,16 @@ ], "source": { "type": "StringLiteral", - "start": 143, - "end": 162, + "start": 323, + "end": 342, "loc": { "start": { - "line": 3, - "column": 27 + "line": 8, + "column": 25 }, "end": { - "line": 3, - "column": 46 + "line": 8, + "column": 44 } }, "extra": { @@ -337,16 +582,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 165, - "end": 425, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", + "start": 345, + "end": 635, "loc": { "start": { - "line": 5, + "line": 10, "column": 0 }, "end": { - "line": 15, + "line": 21, "column": 3 } } @@ -354,357 +599,435 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 426, - "end": 2239, + "type": "Identifier", + "start": 636, + "end": 2628, "loc": { "start": { - "line": 16, + "line": 22, "column": 0 }, "end": { - "line": 78, + "line": 90, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 433, - "end": 2239, - "loc": { - "start": { - "line": 16, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 642, + "end": 2627, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 90, + "column": 1 + } }, - "end": { - "line": 78, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 439, - "end": 2238, + "id": { + "type": "Identifier", + "start": 642, + "end": 654, "loc": { "start": { - "line": 16, - "column": 13 + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 657, + "end": 2627, + "loc": { + "start": { + "line": 22, + "column": 21 }, "end": { - "line": 78, + "line": 90, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 439, - "end": 451, - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 16, - "column": 25 + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 658, + "end": 659, + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 23 + }, + "identifierName": "n" }, - "identifierName": "insert_case4" - }, - "name": "insert_case4", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 454, - "end": 2238, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 664, + "end": 2627, "loc": { "start": { - "line": 16, + "line": 22, "column": 28 }, "end": { - "line": 78, + "line": 90, "column": 1 } }, - "id": { - "type": "Identifier", - "start": 439, - "end": 451, - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 16, - "column": 25 - }, - "identifierName": "insert_case4" - }, - "name": "insert_case4", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 455, - "end": 456, + "type": "ExpressionStatement", + "start": 667, + "end": 693, "loc": { "start": { - "line": 16, - "column": 29 + "line": 23, + "column": 1 }, "end": { - "line": 16, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 461, - "end": 2238, - "loc": { - "start": { - "line": 16, - "column": 35 + "line": 23, + "column": 27 + } }, - "end": { - "line": 78, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 464, - "end": 489, + "expression": { + "type": "CallExpression", + "start": 667, + "end": 692, "loc": { "start": { - "line": 17, + "line": 23, "column": 1 }, "end": { - "line": 17, + "line": 23, "column": 26 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 667, + "end": 673, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 470, - "end": 488, + "type": "BinaryExpression", + "start": 674, + "end": 691, "loc": { "start": { - "line": 17, - "column": 7 + "line": 23, + "column": 8 }, "end": { - "line": 17, + "line": 23, "column": 25 } }, - "id": { + "left": { "type": "Identifier", - "start": 470, - "end": 471, + "start": 674, + "end": 675, "loc": { "start": { - "line": 17, - "column": 7 + "line": 23, + "column": 8 }, "end": { - "line": 17, - "column": 8 + "line": 23, + "column": 9 }, - "identifierName": "g" + "identifierName": "n" }, - "name": "g" + "name": "n" }, - "init": { - "type": "CallExpression", - "start": 474, - "end": 488, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 687, + "end": 691, "loc": { "start": { - "line": 17, - "column": 11 + "line": 23, + "column": 21 }, "end": { - "line": 17, + "line": 23, "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 695, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 695, + "end": 719, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 695, + "end": 701, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 702, + "end": 718, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 702, + "end": 710, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 } }, - "callee": { + "object": { "type": "Identifier", - "start": 474, - "end": 485, + "start": 702, + "end": 703, "loc": { "start": { - "line": 17, - "column": 11 + "line": 24, + "column": 8 }, "end": { - "line": 17, - "column": 22 + "line": 24, + "column": 9 }, - "identifierName": "grandparent" + "identifierName": "n" }, - "name": "grandparent" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 486, - "end": 487, - "loc": { - "start": { - "line": 17, - "column": 23 - }, - "end": { - "line": 17, - "column": 24 - }, - "identifierName": "n" + "property": { + "type": "Identifier", + "start": 704, + "end": 710, + "loc": { + "start": { + "line": 24, + "column": 10 }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 492, - "end": 954, - "loc": { - "start": { - "line": 19, - "column": 1 + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "end": { - "line": 31, - "column": 4 - } + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 715, + "end": 718, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 722, + "end": 754, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 33 + } }, - { - "type": "IfStatement", - "start": 957, - "end": 2217, + "expression": { + "type": "CallExpression", + "start": 722, + "end": 753, "loc": { "start": { - "line": 33, + "line": 25, "column": 1 }, "end": { - "line": 75, - "column": 2 + "line": 25, + "column": 32 } }, - "test": { - "type": "LogicalExpression", - "start": 961, - "end": 1004, + "callee": { + "type": "Identifier", + "start": 722, + "end": 728, "loc": { "start": { - "line": 33, - "column": 5 + "line": 25, + "column": 1 }, "end": { - "line": 33, - "column": 48 - } + "line": 25, + "column": 7 + }, + "identifierName": "assert" }, - "left": { + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 961, - "end": 981, + "start": 729, + "end": 752, "loc": { "start": { - "line": 33, - "column": 5 + "line": 25, + "column": 8 }, "end": { - "line": 33, - "column": 25 + "line": 25, + "column": 31 } }, "left": { - "type": "Identifier", - "start": 961, - "end": 962, - "loc": { - "start": { - "line": 33, - "column": 5 - }, - "end": { - "line": 33, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "operator": "===", - "right": { "type": "MemberExpression", - "start": 967, - "end": 981, + "start": 729, + "end": 742, "loc": { "start": { - "line": 33, - "column": 11 + "line": 25, + "column": 8 }, "end": { - "line": 33, - "column": 25 + "line": 25, + "column": 21 } }, "object": { "type": "MemberExpression", - "start": 967, - "end": 975, + "start": 729, + "end": 735, "loc": { "start": { - "line": 33, - "column": 11 + "line": 25, + "column": 8 }, "end": { - "line": 33, - "column": 19 + "line": 25, + "column": 14 } }, "object": { "type": "Identifier", - "start": 967, - "end": 968, + "start": 729, + "end": 730, "loc": { "start": { - "line": 33, - "column": 11 + "line": 25, + "column": 8 }, "end": { - "line": 33, - "column": 12 + "line": 25, + "column": 9 }, "identifierName": "n" }, @@ -712,1003 +1035,5805 @@ }, "property": { "type": "Identifier", - "start": 969, - "end": 975, + "start": 731, + "end": 735, "loc": { "start": { - "line": 33, - "column": 13 + "line": 25, + "column": 10 }, "end": { - "line": 33, - "column": 19 + "line": 25, + "column": 14 }, - "identifierName": "parent" + "identifierName": "left" }, - "name": "parent" + "name": "left" }, "computed": false }, "property": { "type": "Identifier", - "start": 976, - "end": 981, + "start": 736, + "end": 742, "loc": { "start": { - "line": 33, - "column": 20 + "line": 25, + "column": 15 }, "end": { - "line": 33, - "column": 25 + "line": 25, + "column": 21 }, - "identifierName": "right" + "identifierName": "_color" }, - "name": "right" + "name": "_color" }, "computed": false }, - "leadingComments": null - }, - "operator": "&&", - "right": { + "operator": "===", + "right": { + "type": "Identifier", + "start": 747, + "end": 752, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 756, + "end": 789, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 756, + "end": 788, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 756, + "end": 762, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 985, - "end": 1004, + "start": 763, + "end": 787, "loc": { "start": { - "line": 33, - "column": 29 + "line": 26, + "column": 8 }, "end": { - "line": 33, - "column": 48 + "line": 26, + "column": 32 } }, "left": { "type": "MemberExpression", - "start": 985, - "end": 993, + "start": 763, + "end": 777, "loc": { "start": { - "line": 33, - "column": 29 + "line": 26, + "column": 8 }, "end": { - "line": 33, - "column": 37 + "line": 26, + "column": 22 } }, "object": { - "type": "Identifier", - "start": 985, - "end": 986, + "type": "MemberExpression", + "start": 763, + "end": 770, "loc": { "start": { - "line": 33, - "column": 29 + "line": 26, + "column": 8 }, "end": { - "line": 33, - "column": 30 + "line": 26, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 763, + "end": 764, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 765, + "end": 770, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 987, - "end": 993, + "start": 771, + "end": 777, "loc": { "start": { - "line": 33, - "column": 31 + "line": 26, + "column": 16 }, "end": { - "line": 33, - "column": 37 + "line": 26, + "column": 22 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false }, "operator": "===", "right": { + "type": "Identifier", + "start": 782, + "end": 787, + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 791, + "end": 817, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 791, + "end": 816, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 791, + "end": 797, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 798, + "end": 815, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "left": { "type": "MemberExpression", - "start": 998, - "end": 1004, + "start": 798, + "end": 806, "loc": { "start": { - "line": 33, - "column": 42 + "line": 27, + "column": 8 }, "end": { - "line": 33, - "column": 48 + "line": 27, + "column": 16 } }, "object": { "type": "Identifier", - "start": 998, - "end": 999, + "start": 798, + "end": 799, "loc": { "start": { - "line": 33, - "column": 42 + "line": 27, + "column": 8 }, "end": { - "line": 33, - "column": 43 + "line": 27, + "column": 9 }, - "identifierName": "g" + "identifierName": "n" }, - "name": "g" + "name": "n" }, "property": { "type": "Identifier", - "start": 1000, - "end": 1004, + "start": 800, + "end": 806, "loc": { "start": { - "line": 33, - "column": 44 + "line": 27, + "column": 10 }, "end": { - "line": 33, - "column": 48 + "line": 27, + "column": 16 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 811, + "end": 815, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + } + } } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 819, + "end": 851, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 819, + "end": 850, + "loc": { + "start": { + "line": 28, + "column": 1 }, - "leadingComments": null + "end": { + "line": 28, + "column": 32 + } }, - "consequent": { - "type": "BlockStatement", - "start": 1006, - "end": 1376, + "callee": { + "type": "Identifier", + "start": 819, + "end": 825, "loc": { "start": { - "line": 33, - "column": 50 + "line": 28, + "column": 1 }, "end": { - "line": 48, - "column": 2 - } + "line": 28, + "column": 7 + }, + "identifierName": "assert" }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1010, - "end": 1032, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 826, + "end": 849, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 826, + "end": 841, "loc": { "start": { - "line": 34, - "column": 2 + "line": 28, + "column": 8 }, "end": { - "line": 34, - "column": 24 + "line": 28, + "column": 23 } }, - "expression": { - "type": "CallExpression", - "start": 1010, - "end": 1031, + "object": { + "type": "MemberExpression", + "start": 826, + "end": 834, "loc": { "start": { - "line": 34, - "column": 2 + "line": 28, + "column": 8 }, "end": { - "line": 34, - "column": 23 + "line": 28, + "column": 16 } }, - "callee": { + "object": { "type": "Identifier", - "start": 1010, - "end": 1021, + "start": 826, + "end": 827, "loc": { "start": { - "line": 34, - "column": 2 + "line": 28, + "column": 8 }, "end": { - "line": 34, - "column": 13 + "line": 28, + "column": 9 }, - "identifierName": "rotate_left" + "identifierName": "n" }, - "name": "rotate_left" + "name": "n" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1022, - "end": 1030, - "loc": { - "start": { - "line": 34, - "column": 14 - }, - "end": { - "line": 34, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 1022, - "end": 1023, - "loc": { - "start": { - "line": 34, - "column": 14 - }, - "end": { - "line": 34, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1024, - "end": 1030, - "loc": { - "start": { - "line": 34, - "column": 16 - }, - "end": { - "line": 34, - "column": 22 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1036, - "end": 1292, + "property": { + "type": "Identifier", + "start": 828, + "end": 834, "loc": { "start": { - "line": 36, - "column": 2 + "line": 28, + "column": 10 }, "end": { - "line": 45, - "column": 5 - } - } - }, - { - "type": "CommentLine", - "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1296, - "end": 1373, - "loc": { - "start": { - "line": 47, - "column": 2 + "line": 28, + "column": 16 }, - "end": { - "line": 47, - "column": 79 - } - } - } - ] + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 835, + "end": 841, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 846, + "end": 849, + "loc": { + "start": { + "line": 28, + "column": 28 + }, + "end": { + "line": 28, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" } - ], - "directives": [] + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 853, + "end": 878, + "loc": { + "start": { + "line": 29, + "column": 1 }, - "alternate": { - "type": "IfStatement", - "start": 1382, - "end": 2217, + "end": { + "line": 29, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 859, + "end": 877, "loc": { "start": { - "line": 48, - "column": 8 + "line": 29, + "column": 7 }, "end": { - "line": 75, - "column": 2 + "line": 29, + "column": 25 } }, - "test": { - "type": "LogicalExpression", - "start": 1386, - "end": 1429, + "id": { + "type": "Identifier", + "start": 859, + "end": 860, "loc": { "start": { - "line": 48, - "column": 12 + "line": 29, + "column": 7 }, "end": { - "line": 48, - "column": 55 + "line": 29, + "column": 8 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 863, + "end": 877, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 25 } }, - "left": { - "type": "BinaryExpression", - "start": 1386, - "end": 1405, + "callee": { + "type": "Identifier", + "start": 863, + "end": 874, "loc": { "start": { - "line": 48, - "column": 12 + "line": 29, + "column": 11 }, "end": { - "line": 48, - "column": 31 - } + "line": 29, + "column": 22 + }, + "identifierName": "grandparent" }, - "left": { + "name": "grandparent" + }, + "arguments": [ + { "type": "Identifier", - "start": 1386, - "end": 1387, + "start": 875, + "end": 876, "loc": { "start": { - "line": 48, - "column": 12 + "line": 29, + "column": 23 }, "end": { - "line": 48, - "column": 13 + "line": 29, + "column": 24 }, "identifierName": "n" }, "name": "n" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 881, + "end": 1343, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 43, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1346, + "end": 2606, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 87, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1350, + "end": 1393, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 48 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1350, + "end": 1370, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 1350, + "end": 1351, + "loc": { + "start": { + "line": 45, + "column": 5 }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1392, - "end": 1405, - "loc": { - "start": { - "line": 48, - "column": 18 - }, - "end": { - "line": 48, - "column": 31 - } - }, - "object": { - "type": "MemberExpression", - "start": 1392, - "end": 1400, - "loc": { - "start": { - "line": 48, - "column": 18 - }, - "end": { - "line": 48, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 1392, - "end": 1393, - "loc": { - "start": { - "line": 48, - "column": 18 - }, - "end": { - "line": 48, - "column": 19 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1394, - "end": 1400, - "loc": { - "start": { - "line": 48, - "column": 20 - }, - "end": { - "line": 48, - "column": 26 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1401, - "end": 1405, - "loc": { - "start": { - "line": 48, - "column": 27 - }, - "end": { - "line": 48, - "column": 31 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false + "end": { + "line": 45, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1356, + "end": 1370, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 25 } }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1409, - "end": 1429, + "object": { + "type": "MemberExpression", + "start": 1356, + "end": 1364, "loc": { "start": { - "line": 48, - "column": 35 + "line": 45, + "column": 11 }, "end": { - "line": 48, - "column": 55 + "line": 45, + "column": 19 } }, - "left": { - "type": "MemberExpression", - "start": 1409, - "end": 1417, + "object": { + "type": "Identifier", + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 48, - "column": 35 + "line": 45, + "column": 11 }, "end": { - "line": 48, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 1409, - "end": 1410, - "loc": { - "start": { - "line": 48, - "column": 35 - }, - "end": { - "line": 48, - "column": 36 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1411, - "end": 1417, - "loc": { - "start": { - "line": 48, - "column": 37 - }, - "end": { - "line": 48, - "column": 43 - }, - "identifierName": "parent" + "line": 45, + "column": 12 }, - "name": "parent" + "identifierName": "n" }, - "computed": false + "name": "n" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1422, - "end": 1429, + "property": { + "type": "Identifier", + "start": 1358, + "end": 1364, "loc": { "start": { - "line": 48, - "column": 48 + "line": 45, + "column": 13 }, "end": { - "line": 48, - "column": 55 - } - }, - "object": { - "type": "Identifier", - "start": 1422, - "end": 1423, - "loc": { - "start": { - "line": 48, - "column": 48 - }, - "end": { - "line": 48, - "column": 49 - }, - "identifierName": "g" + "line": 45, + "column": 19 }, - "name": "g" + "identifierName": "parent" }, - "property": { - "type": "Identifier", - "start": 1424, - "end": 1429, - "loc": { - "start": { - "line": 48, - "column": 50 - }, - "end": { - "line": 48, - "column": 55 - }, - "identifierName": "right" - }, - "name": "right" + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1365, + "end": 1370, + "loc": { + "start": { + "line": 45, + "column": 20 }, - "computed": false - } + "end": { + "line": 45, + "column": 25 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1374, + "end": 1393, + "loc": { + "start": { + "line": 45, + "column": 29 + }, + "end": { + "line": 45, + "column": 48 } }, - "consequent": { - "type": "BlockStatement", - "start": 1431, - "end": 2217, + "left": { + "type": "MemberExpression", + "start": 1374, + "end": 1382, "loc": { "start": { - "line": 48, - "column": 57 + "line": 45, + "column": 29 + }, + "end": { + "line": 45, + "column": 37 + } + }, + "object": { + "type": "Identifier", + "start": 1374, + "end": 1375, + "loc": { + "start": { + "line": 45, + "column": 29 + }, + "end": { + "line": 45, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1376, + "end": 1382, + "loc": { + "start": { + "line": 45, + "column": 31 + }, + "end": { + "line": 45, + "column": 37 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1387, + "end": 1393, + "loc": { + "start": { + "line": 45, + "column": 42 }, "end": { - "line": 75, + "line": 45, + "column": 48 + } + }, + "object": { + "type": "Identifier", + "start": 1387, + "end": 1388, + "loc": { + "start": { + "line": 45, + "column": 42 + }, + "end": { + "line": 45, + "column": 43 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1389, + "end": 1393, + "loc": { + "start": { + "line": 45, + "column": 44 + }, + "end": { + "line": 45, + "column": 48 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1395, + "end": 1765, + "loc": { + "start": { + "line": 45, + "column": 50 + }, + "end": { + "line": 60, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1399, + "end": 1421, + "loc": { + "start": { + "line": 46, "column": 2 + }, + "end": { + "line": 46, + "column": 24 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1939, - "end": 1962, + "expression": { + "type": "CallExpression", + "start": 1399, + "end": 1420, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1399, + "end": 1410, "loc": { "start": { - "line": 62, + "line": 46, "column": 2 }, "end": { - "line": 62, - "column": 25 - } + "line": 46, + "column": 13 + }, + "identifierName": "rotate_left" }, - "expression": { - "type": "CallExpression", - "start": 1939, - "end": 1961, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1411, + "end": 1419, "loc": { "start": { - "line": 62, - "column": 2 + "line": 46, + "column": 14 }, "end": { - "line": 62, - "column": 24 + "line": 46, + "column": 22 } }, - "callee": { + "object": { "type": "Identifier", - "start": 1939, - "end": 1951, + "start": 1411, + "end": 1412, "loc": { "start": { - "line": 62, - "column": 2 + "line": 46, + "column": 14 }, "end": { - "line": 62, - "column": 14 + "line": 46, + "column": 15 }, - "identifierName": "rotate_right" + "identifierName": "n" }, - "name": "rotate_right", - "leadingComments": null + "name": "n" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1952, - "end": 1960, - "loc": { - "start": { - "line": 62, - "column": 15 - }, - "end": { - "line": 62, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1952, - "end": 1953, - "loc": { - "start": { - "line": 62, - "column": 15 - }, - "end": { - "line": 62, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1954, - "end": 1960, - "loc": { - "start": { - "line": 62, - "column": 17 - }, - "end": { - "line": 62, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1435, - "end": 1936, + "property": { + "type": "Identifier", + "start": 1413, + "end": 1419, "loc": { "start": { - "line": 49, - "column": 2 + "line": 46, + "column": 16 }, "end": { - "line": 61, - "column": 5 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 1966, - "end": 2194, - "loc": { - "start": { - "line": 64, - "column": 2 + "line": 46, + "column": 22 }, - "end": { - "line": 72, - "column": 5 - } - } + "identifierName": "parent" + }, + "name": "parent" }, - { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2198, - "end": 2214, - "loc": { - "start": { - "line": 74, - "column": 2 - }, - "end": { - "line": 74, - "column": 18 - } - } - } - ] - } - ], - "directives": [] - }, - "alternate": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 492, - "end": 954, - "loc": { - "start": { - "line": 19, - "column": 1 + "computed": false + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1425, + "end": 1681, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 57, + "column": 5 + } + } }, - "end": { - "line": 31, - "column": 4 + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1685, + "end": 1762, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 79 + } + } } - } + ] } - ] + ], + "directives": [] }, - { - "type": "ExpressionStatement", - "start": 2220, - "end": 2236, + "alternate": { + "type": "IfStatement", + "start": 1771, + "end": 2606, "loc": { "start": { - "line": 77, - "column": 1 + "line": 60, + "column": 8 }, "end": { - "line": 77, - "column": 17 + "line": 87, + "column": 2 } }, - "expression": { - "type": "CallExpression", - "start": 2220, - "end": 2235, + "test": { + "type": "LogicalExpression", + "start": 1775, + "end": 1818, "loc": { "start": { - "line": 77, - "column": 1 + "line": 60, + "column": 12 }, "end": { - "line": 77, - "column": 16 + "line": 60, + "column": 55 } }, - "callee": { - "type": "Identifier", - "start": 2220, - "end": 2232, + "left": { + "type": "BinaryExpression", + "start": 1775, + "end": 1794, "loc": { "start": { - "line": 77, - "column": 1 + "line": 60, + "column": 12 }, "end": { - "line": 77, - "column": 13 - }, - "identifierName": "insert_case5" + "line": 60, + "column": 31 + } }, - "name": "insert_case5" - }, - "arguments": [ - { + "left": { "type": "Identifier", - "start": 2233, - "end": 2234, + "start": 1775, + "end": 1776, "loc": { "start": { - "line": 77, - "column": 14 + "line": 60, + "column": 12 }, "end": { - "line": 77, - "column": 15 + "line": 60, + "column": 13 }, "identifierName": "n" }, "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1781, + "end": 1794, + "loc": { + "start": { + "line": 60, + "column": 18 + }, + "end": { + "line": 60, + "column": 31 + } + }, + "object": { + "type": "MemberExpression", + "start": 1781, + "end": 1789, + "loc": { + "start": { + "line": 60, + "column": 18 + }, + "end": { + "line": 60, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 1781, + "end": 1782, + "loc": { + "start": { + "line": 60, + "column": 18 + }, + "end": { + "line": 60, + "column": 19 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1783, + "end": 1789, + "loc": { + "start": { + "line": 60, + "column": 20 + }, + "end": { + "line": 60, + "column": 26 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1790, + "end": 1794, + "loc": { + "start": { + "line": 60, + "column": 27 + }, + "end": { + "line": 60, + "column": 31 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false } - ] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 165, - "end": 425, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 15, - "column": 3 - } - } - } - ], - "trailingComments": [] + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1798, + "end": 1818, + "loc": { + "start": { + "line": 60, + "column": 35 + }, + "end": { + "line": 60, + "column": 55 + } + }, + "left": { + "type": "MemberExpression", + "start": 1798, + "end": 1806, + "loc": { + "start": { + "line": 60, + "column": 35 + }, + "end": { + "line": 60, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 1798, + "end": 1799, + "loc": { + "start": { + "line": 60, + "column": 35 + }, + "end": { + "line": 60, + "column": 36 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1800, + "end": 1806, + "loc": { + "start": { + "line": 60, + "column": 37 + }, + "end": { + "line": 60, + "column": 43 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1811, + "end": 1818, + "loc": { + "start": { + "line": 60, + "column": 48 + }, + "end": { + "line": 60, + "column": 55 + } + }, + "object": { + "type": "Identifier", + "start": 1811, + "end": 1812, + "loc": { + "start": { + "line": 60, + "column": 48 + }, + "end": { + "line": 60, + "column": 49 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1813, + "end": 1818, + "loc": { + "start": { + "line": 60, + "column": 50 + }, + "end": { + "line": 60, + "column": 55 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1820, + "end": 2606, + "loc": { + "start": { + "line": 60, + "column": 57 + }, + "end": { + "line": 87, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2328, + "end": 2351, + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 2328, + "end": 2350, + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 2328, + "end": 2340, + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 14 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right", + "leadingComments": null + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 2341, + "end": 2349, + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 2341, + "end": 2342, + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 2343, + "end": 2349, + "loc": { + "start": { + "line": 74, + "column": 17 + }, + "end": { + "line": 74, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1824, + "end": 2325, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 73, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2355, + "end": 2583, + "loc": { + "start": { + "line": 76, + "column": 2 + }, + "end": { + "line": 84, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2587, + "end": 2603, + "loc": { + "start": { + "line": 86, + "column": 2 + }, + "end": { + "line": 86, + "column": 18 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 881, + "end": 1343, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 43, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 2609, + "end": 2625, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2609, + "end": 2624, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2609, + "end": 2621, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 13 + }, + "identifierName": "insert_case5" + }, + "name": "insert_case5" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2622, + "end": 2623, + "loc": { + "start": { + "line": 89, + "column": 14 + }, + "end": { + "line": 89, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 2630, + "end": 2658, + "loc": { + "start": { + "line": 92, + "column": 0 + }, + "end": { + "line": 92, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 2645, + "end": 2657, + "loc": { + "start": { + "line": 92, + "column": 15 + }, + "end": { + "line": 92, + "column": 27 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 2630, + "end": 2658, + "loc": { + "start": { + "line": 92, + "column": 0 + }, + "end": { + "line": 92, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 636, + "end": 2628, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 90, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 642, + "end": 2627, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 90, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 642, + "end": 654, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 657, + "end": 2627, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 90, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 642, + "end": 654, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 658, + "end": 659, + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 664, + "end": 2627, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 90, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 667, + "end": 693, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 667, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 667, + "end": 673, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 674, + "end": 691, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 674, + "end": 675, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 687, + "end": 691, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 695, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 695, + "end": 719, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 695, + "end": 701, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 702, + "end": 718, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 702, + "end": 710, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 702, + "end": 703, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 704, + "end": 710, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 715, + "end": 718, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 722, + "end": 754, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 722, + "end": 753, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 722, + "end": 728, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 729, + "end": 752, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 729, + "end": 742, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 729, + "end": 735, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 729, + "end": 730, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 736, + "end": 742, + "loc": { + "start": { + "line": 25, + "column": 15 + }, + "end": { + "line": 25, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 747, + "end": 752, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 756, + "end": 789, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 756, + "end": 788, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 756, + "end": 762, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 763, + "end": 787, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 763, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 763, + "end": 770, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 763, + "end": 764, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 765, + "end": 770, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 771, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 16 + }, + "end": { + "line": 26, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 782, + "end": 787, + "loc": { + "start": { + "line": 26, + "column": 27 + }, + "end": { + "line": 26, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 791, + "end": 817, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 791, + "end": 816, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 791, + "end": 797, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 798, + "end": 815, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 798, + "end": 806, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 798, + "end": 799, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 800, + "end": 806, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 811, + "end": 815, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 819, + "end": 851, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 819, + "end": 850, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 819, + "end": 825, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 826, + "end": 849, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 826, + "end": 841, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 826, + "end": 834, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 826, + "end": 827, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 828, + "end": 834, + "loc": { + "start": { + "line": 28, + "column": 10 + }, + "end": { + "line": 28, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 835, + "end": 841, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 846, + "end": 849, + "loc": { + "start": { + "line": 28, + "column": 28 + }, + "end": { + "line": 28, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 853, + "end": 878, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 859, + "end": 877, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 859, + "end": 860, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 8 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 863, + "end": 877, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 863, + "end": 874, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 22 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 875, + "end": 876, + "loc": { + "start": { + "line": 29, + "column": 23 + }, + "end": { + "line": 29, + "column": 24 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 881, + "end": 1343, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 43, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1346, + "end": 2606, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 87, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1350, + "end": 1393, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 48 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1350, + "end": 1370, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 1350, + "end": 1351, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1356, + "end": 1370, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "object": { + "type": "MemberExpression", + "start": 1356, + "end": 1364, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 1356, + "end": 1357, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1358, + "end": 1364, + "loc": { + "start": { + "line": 45, + "column": 13 + }, + "end": { + "line": 45, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1365, + "end": 1370, + "loc": { + "start": { + "line": 45, + "column": 20 + }, + "end": { + "line": 45, + "column": 25 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1374, + "end": 1393, + "loc": { + "start": { + "line": 45, + "column": 29 + }, + "end": { + "line": 45, + "column": 48 + } + }, + "left": { + "type": "MemberExpression", + "start": 1374, + "end": 1382, + "loc": { + "start": { + "line": 45, + "column": 29 + }, + "end": { + "line": 45, + "column": 37 + } + }, + "object": { + "type": "Identifier", + "start": 1374, + "end": 1375, + "loc": { + "start": { + "line": 45, + "column": 29 + }, + "end": { + "line": 45, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1376, + "end": 1382, + "loc": { + "start": { + "line": 45, + "column": 31 + }, + "end": { + "line": 45, + "column": 37 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1387, + "end": 1393, + "loc": { + "start": { + "line": 45, + "column": 42 + }, + "end": { + "line": 45, + "column": 48 + } + }, + "object": { + "type": "Identifier", + "start": 1387, + "end": 1388, + "loc": { + "start": { + "line": 45, + "column": 42 + }, + "end": { + "line": 45, + "column": 43 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1389, + "end": 1393, + "loc": { + "start": { + "line": 45, + "column": 44 + }, + "end": { + "line": 45, + "column": 48 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1395, + "end": 1765, + "loc": { + "start": { + "line": 45, + "column": 50 + }, + "end": { + "line": 60, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1399, + "end": 1421, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1399, + "end": 1420, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1399, + "end": 1410, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 13 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1411, + "end": 1419, + "loc": { + "start": { + "line": 46, + "column": 14 + }, + "end": { + "line": 46, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 1411, + "end": 1412, + "loc": { + "start": { + "line": 46, + "column": 14 + }, + "end": { + "line": 46, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1413, + "end": 1419, + "loc": { + "start": { + "line": 46, + "column": 16 + }, + "end": { + "line": 46, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1425, + "end": 1681, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 57, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1685, + "end": 1762, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 79 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": { + "type": "IfStatement", + "start": 1771, + "end": 2606, + "loc": { + "start": { + "line": 60, + "column": 8 + }, + "end": { + "line": 87, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1775, + "end": 1818, + "loc": { + "start": { + "line": 60, + "column": 12 + }, + "end": { + "line": 60, + "column": 55 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1775, + "end": 1794, + "loc": { + "start": { + "line": 60, + "column": 12 + }, + "end": { + "line": 60, + "column": 31 + } + }, + "left": { + "type": "Identifier", + "start": 1775, + "end": 1776, + "loc": { + "start": { + "line": 60, + "column": 12 + }, + "end": { + "line": 60, + "column": 13 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1781, + "end": 1794, + "loc": { + "start": { + "line": 60, + "column": 18 + }, + "end": { + "line": 60, + "column": 31 + } + }, + "object": { + "type": "MemberExpression", + "start": 1781, + "end": 1789, + "loc": { + "start": { + "line": 60, + "column": 18 + }, + "end": { + "line": 60, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 1781, + "end": 1782, + "loc": { + "start": { + "line": 60, + "column": 18 + }, + "end": { + "line": 60, + "column": 19 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1783, + "end": 1789, + "loc": { + "start": { + "line": 60, + "column": 20 + }, + "end": { + "line": 60, + "column": 26 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1790, + "end": 1794, + "loc": { + "start": { + "line": 60, + "column": 27 + }, + "end": { + "line": 60, + "column": 31 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1798, + "end": 1818, + "loc": { + "start": { + "line": 60, + "column": 35 + }, + "end": { + "line": 60, + "column": 55 + } + }, + "left": { + "type": "MemberExpression", + "start": 1798, + "end": 1806, + "loc": { + "start": { + "line": 60, + "column": 35 + }, + "end": { + "line": 60, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 1798, + "end": 1799, + "loc": { + "start": { + "line": 60, + "column": 35 + }, + "end": { + "line": 60, + "column": 36 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1800, + "end": 1806, + "loc": { + "start": { + "line": 60, + "column": 37 + }, + "end": { + "line": 60, + "column": 43 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1811, + "end": 1818, + "loc": { + "start": { + "line": 60, + "column": 48 + }, + "end": { + "line": 60, + "column": 55 + } + }, + "object": { + "type": "Identifier", + "start": 1811, + "end": 1812, + "loc": { + "start": { + "line": 60, + "column": 48 + }, + "end": { + "line": 60, + "column": 49 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1813, + "end": 1818, + "loc": { + "start": { + "line": 60, + "column": 50 + }, + "end": { + "line": 60, + "column": 55 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1820, + "end": 2606, + "loc": { + "start": { + "line": 60, + "column": 57 + }, + "end": { + "line": 87, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2328, + "end": 2351, + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 25 + } + }, + "expression": { + "type": "CallExpression", + "start": 2328, + "end": 2350, + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 2328, + "end": 2340, + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 14 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right", + "leadingComments": null + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 2341, + "end": 2349, + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 2341, + "end": 2342, + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 2343, + "end": 2349, + "loc": { + "start": { + "line": 74, + "column": 17 + }, + "end": { + "line": 74, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1824, + "end": 2325, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 73, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2355, + "end": 2583, + "loc": { + "start": { + "line": 76, + "column": 2 + }, + "end": { + "line": 84, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2587, + "end": 2603, + "loc": { + "start": { + "line": 86, + "column": 2 + }, + "end": { + "line": 86, + "column": 18 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 881, + "end": 1343, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 43, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 2609, + "end": 2625, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2609, + "end": 2624, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2609, + "end": 2621, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 13 + }, + "identifierName": "insert_case5" + }, + "name": "insert_case5" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2622, + "end": 2623, + "loc": { + "start": { + "line": 89, + "column": 14 + }, + "end": { + "line": 89, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", + "start": 345, + "end": 635, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", + "start": 345, + "end": 635, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 881, + "end": 1343, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 43, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1425, + "end": 1681, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 57, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1685, + "end": 1762, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 79 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1824, + "end": 2325, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 73, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2355, + "end": 2583, + "loc": { + "start": { + "line": 76, + "column": 2 + }, + "end": { + "line": 84, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2587, + "end": 2603, + "loc": { + "start": { + "line": 86, + "column": 2 + }, + "end": { + "line": 86, + "column": 18 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 147, + "end": 158, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 159, + "end": 163, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_left.js", + "start": 164, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 190, + "end": 191, + "loc": { + "start": { + "line": 5, + "column": 50 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 192, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 199, + "end": 211, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 212, + "end": 216, + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_right.js", + "start": 217, + "end": 244, + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 52 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 244, + "end": 245, + "loc": { + "start": { + "line": 6, + "column": 52 + }, + "end": { + "line": 6, + "column": 53 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 246, + "end": 252, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 253, + "end": 264, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 265, + "end": 269, + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/grandparent.js", + "start": 270, + "end": 296, + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 296, + "end": 297, + "loc": { + "start": { + "line": 7, + "column": 50 + }, + "end": { + "line": 7, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 298, + "end": 304, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case5", + "start": 305, + "end": 317, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 318, + "end": 322, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case5.js", + "start": 323, + "end": 342, + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 342, + "end": 343, + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", + "start": 345, + "end": 635, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 636, + "end": 641, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case4", + "start": 642, + "end": 654, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 655, + "end": 656, + "loc": { + "start": { + "line": 22, + "column": 19 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 657, + "end": 658, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 658, + "end": 659, + "loc": { + "start": { + "line": 22, + "column": 22 + }, + "end": { + "line": 22, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 659, + "end": 660, + "loc": { + "start": { + "line": 22, + "column": 23 + }, + "end": { + "line": 22, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 661, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 664, + "end": 665, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 22, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 667, + "end": 673, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 673, + "end": 674, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 674, + "end": 675, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 676, + "end": 686, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 687, + "end": 691, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 691, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 25 + }, + "end": { + "line": 23, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 692, + "end": 693, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 695, + "end": 701, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 701, + "end": 702, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 702, + "end": 703, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 703, + "end": 704, + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 704, + "end": 710, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 711, + "end": 714, + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 715, + "end": 718, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 718, + "end": 719, + "loc": { + "start": { + "line": 24, + "column": 24 + }, + "end": { + "line": 24, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 719, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 722, + "end": 728, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 728, + "end": 729, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 729, + "end": 730, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 730, + "end": 731, + "loc": { + "start": { + "line": 25, + "column": 9 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 165, - "end": 425, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 15, - "column": 3 - } - } - } - ] + "end": { + "line": 25, + "column": 10 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 165, - "end": 425, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 731, + "end": 735, "loc": { "start": { - "line": 5, - "column": 0 + "line": 25, + "column": 10 }, "end": { - "line": 15, - "column": 3 + "line": 25, + "column": 14 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 492, - "end": 954, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 735, + "end": 736, "loc": { "start": { - "line": 19, - "column": 1 + "line": 25, + "column": 14 }, "end": { - "line": 31, - "column": 4 + "line": 25, + "column": 15 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1036, - "end": 1292, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 736, + "end": 742, "loc": { "start": { - "line": 36, - "column": 2 + "line": 25, + "column": 15 }, "end": { - "line": 45, - "column": 5 + "line": 25, + "column": 21 } } }, { - "type": "CommentLine", - "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1296, - "end": 1373, + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 743, + "end": 746, "loc": { "start": { - "line": 47, - "column": 2 + "line": 25, + "column": 22 }, "end": { - "line": 47, - "column": 79 + "line": 25, + "column": 25 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1435, - "end": 1936, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 747, + "end": 752, "loc": { "start": { - "line": 49, - "column": 2 + "line": 25, + "column": 26 }, "end": { - "line": 61, - "column": 5 + "line": 25, + "column": 31 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 1966, - "end": 2194, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 752, + "end": 753, "loc": { "start": { - "line": 64, - "column": 2 + "line": 25, + "column": 31 }, "end": { - "line": 72, - "column": 5 + "line": 25, + "column": 32 } } }, { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2198, - "end": 2214, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 753, + "end": 754, "loc": { "start": { - "line": 74, - "column": 2 + "line": 25, + "column": 32 }, "end": { - "line": 74, - "column": 18 + "line": 25, + "column": 33 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1716,26 +6841,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "assert", + "start": 756, + "end": 762, "loc": { "start": { - "line": 1, - "column": 0 + "line": 26, + "column": 1 }, "end": { - "line": 1, - "column": 6 + "line": 26, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1745,15 +6869,15 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "start": 762, + "end": 763, "loc": { "start": { - "line": 1, + "line": 26, "column": 7 }, "end": { - "line": 1, + "line": 26, "column": 8 } } @@ -1770,24 +6894,24 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 8, - "end": 19, + "value": "n", + "start": 763, + "end": 764, "loc": { "start": { - "line": 1, + "line": 26, "column": 8 }, "end": { - "line": 1, - "column": 19 + "line": 26, + "column": 9 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1797,16 +6921,16 @@ "binop": null, "updateContext": null }, - "start": 19, - "end": 20, + "start": 764, + "end": 765, "loc": { "start": { - "line": 1, - "column": 19 + "line": 26, + "column": 9 }, "end": { - "line": 1, - "column": 20 + "line": 26, + "column": 10 } } }, @@ -1822,42 +6946,96 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 21, - "end": 33, + "value": "right", + "start": 765, + "end": 770, "loc": { "start": { - "line": 1, - "column": 21 + "line": 26, + "column": 10 }, "end": { - "line": 1, - "column": 33 + "line": 26, + "column": 15 } } }, { "type": { - "label": "}", + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 770, + "end": 771, + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 16 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 771, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 16 + }, + "end": { + "line": 26, + "column": 22 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 33, - "end": 34, + "value": "===", + "start": 778, + "end": 781, "loc": { "start": { - "line": 1, - "column": 33 + "line": 26, + "column": 23 }, "end": { - "line": 1, - "column": 34 + "line": 26, + "column": 26 } } }, @@ -1873,44 +7051,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 35, - "end": 39, + "value": "BLACK", + "start": 782, + "end": 787, "loc": { "start": { - "line": 1, - "column": 35 + "line": 26, + "column": 27 }, "end": { - "line": 1, - "column": 39 + "line": 26, + "column": 32 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../rotate/index.js", - "start": 40, - "end": 60, + "start": 787, + "end": 788, "loc": { "start": { - "line": 1, - "column": 40 + "line": 26, + "column": 32 }, "end": { - "line": 1, - "column": 60 + "line": 26, + "column": 33 } } }, @@ -1927,23 +7103,22 @@ "binop": null, "updateContext": null }, - "start": 60, - "end": 61, + "start": 788, + "end": 789, "loc": { "start": { - "line": 1, - "column": 60 + "line": 26, + "column": 33 }, "end": { - "line": 1, - "column": 61 + "line": 26, + "column": 34 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1951,26 +7126,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 62, - "end": 68, + "value": "assert", + "start": 791, + "end": 797, "loc": { "start": { - "line": 2, - "column": 0 + "line": 27, + "column": 1 }, "end": { - "line": 2, - "column": 6 + "line": 27, + "column": 7 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1980,15 +7154,15 @@ "postfix": false, "binop": null }, - "start": 69, - "end": 70, + "start": 797, + "end": 798, "loc": { "start": { - "line": 2, + "line": 27, "column": 7 }, "end": { - "line": 2, + "line": 27, "column": 8 } } @@ -2005,23 +7179,23 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 70, - "end": 81, + "value": "n", + "start": 798, + "end": 799, "loc": { "start": { - "line": 2, + "line": 27, "column": 8 }, "end": { - "line": 2, - "column": 19 + "line": 27, + "column": 9 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2029,18 +7203,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 81, - "end": 82, + "start": 799, + "end": 800, "loc": { "start": { - "line": 2, - "column": 19 + "line": 27, + "column": 9 }, "end": { - "line": 2, - "column": 20 + "line": 27, + "column": 10 } } }, @@ -2056,52 +7231,53 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 83, - "end": 87, + "value": "parent", + "start": 800, + "end": 806, "loc": { "start": { - "line": 2, - "column": 21 + "line": 27, + "column": 10 }, "end": { - "line": 2, - "column": 25 + "line": 27, + "column": 16 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "../family/grandparent.js", - "start": 88, - "end": 114, + "value": "!==", + "start": 807, + "end": 810, "loc": { "start": { - "line": 2, - "column": 26 + "line": 27, + "column": 17 }, "end": { - "line": 2, - "column": 52 + "line": 27, + "column": 20 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2110,69 +7286,68 @@ "binop": null, "updateContext": null }, - "start": 114, - "end": 115, + "value": "null", + "start": 811, + "end": 815, "loc": { "start": { - "line": 2, - "column": 52 + "line": 27, + "column": 21 }, "end": { - "line": 2, - "column": 53 + "line": 27, + "column": 25 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 116, - "end": 122, + "start": 815, + "end": 816, "loc": { "start": { - "line": 3, - "column": 0 + "line": 27, + "column": 25 }, "end": { - "line": 3, - "column": 6 + "line": 27, + "column": 26 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 123, - "end": 124, + "start": 816, + "end": 817, "loc": { "start": { - "line": 3, - "column": 7 + "line": 27, + "column": 26 }, "end": { - "line": 3, - "column": 8 + "line": 27, + "column": 27 } } }, @@ -2188,25 +7363,25 @@ "postfix": false, "binop": null }, - "value": "insert_case5", - "start": 124, - "end": 136, + "value": "assert", + "start": 819, + "end": 825, "loc": { "start": { - "line": 3, - "column": 8 + "line": 28, + "column": 1 }, "end": { - "line": 3, - "column": 20 + "line": 28, + "column": 7 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2214,16 +7389,16 @@ "postfix": false, "binop": null }, - "start": 136, - "end": 137, + "start": 825, + "end": 826, "loc": { "start": { - "line": 3, - "column": 20 + "line": 28, + "column": 7 }, "end": { - "line": 3, - "column": 21 + "line": 28, + "column": 8 } } }, @@ -2239,51 +7414,24 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 138, - "end": 142, + "value": "n", + "start": 826, + "end": 827, "loc": { "start": { - "line": 3, - "column": 22 + "line": 28, + "column": 8 }, "end": { - "line": 3, - "column": 26 + "line": 28, + "column": 9 } } }, { "type": { - "label": "string", + "label": ".", "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./insert_case5.js", - "start": 143, - "end": 162, - "loc": { - "start": { - "line": 3, - "column": 27 - }, - "end": { - "line": 3, - "column": 46 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2293,67 +7441,48 @@ "binop": null, "updateContext": null }, - "start": 162, - "end": 163, - "loc": { - "start": { - "line": 3, - "column": 46 - }, - "end": { - "line": 3, - "column": 47 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 165, - "end": 425, + "start": 827, + "end": 828, "loc": { "start": { - "line": 5, - "column": 0 + "line": 28, + "column": 9 }, "end": { - "line": 15, - "column": 3 + "line": 28, + "column": 10 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 426, - "end": 432, + "value": "parent", + "start": 828, + "end": 834, "loc": { "start": { - "line": 16, - "column": 0 + "line": 28, + "column": 10 }, "end": { - "line": 16, - "column": 6 + "line": 28, + "column": 16 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2364,17 +7493,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 433, - "end": 438, + "start": 834, + "end": 835, "loc": { "start": { - "line": 16, - "column": 7 + "line": 28, + "column": 16 }, "end": { - "line": 16, - "column": 12 + "line": 28, + "column": 17 } } }, @@ -2390,69 +7518,44 @@ "postfix": false, "binop": null }, - "value": "insert_case4", - "start": 439, - "end": 451, + "value": "_color", + "start": 835, + "end": 841, "loc": { "start": { - "line": 16, - "column": 13 + "line": 28, + "column": 17 }, "end": { - "line": 16, - "column": 25 + "line": 28, + "column": 23 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 452, - "end": 453, - "loc": { - "start": { - "line": 16, - "column": 26 - }, - "end": { - "line": 16, - "column": 27 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 454, - "end": 455, + "value": "===", + "start": 842, + "end": 845, "loc": { "start": { - "line": 16, - "column": 28 + "line": 28, + "column": 24 }, "end": { - "line": 16, - "column": 29 + "line": 28, + "column": 27 } } }, @@ -2468,17 +7571,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 455, - "end": 456, + "value": "RED", + "start": 846, + "end": 849, "loc": { "start": { - "line": 16, - "column": 29 + "line": 28, + "column": 28 }, "end": { - "line": 16, - "column": 30 + "line": 28, + "column": 31 } } }, @@ -2494,22 +7597,22 @@ "postfix": false, "binop": null }, - "start": 456, - "end": 457, + "start": 849, + "end": 850, "loc": { "start": { - "line": 16, - "column": 30 + "line": 28, + "column": 31 }, "end": { - "line": 16, - "column": 31 + "line": 28, + "column": 32 } } }, { "type": { - "label": "=>", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2520,41 +7623,16 @@ "binop": null, "updateContext": null }, - "start": 458, - "end": 460, + "start": 850, + "end": 851, "loc": { "start": { - "line": 16, + "line": 28, "column": 32 }, "end": { - "line": 16, - "column": 34 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 461, - "end": 462, - "loc": { - "start": { - "line": 16, - "column": 35 - }, - "end": { - "line": 16, - "column": 36 + "line": 28, + "column": 33 } } }, @@ -2573,15 +7651,15 @@ "updateContext": null }, "value": "const", - "start": 464, - "end": 469, + "start": 853, + "end": 858, "loc": { "start": { - "line": 17, + "line": 29, "column": 1 }, "end": { - "line": 17, + "line": 29, "column": 6 } } @@ -2599,15 +7677,15 @@ "binop": null }, "value": "g", - "start": 470, - "end": 471, + "start": 859, + "end": 860, "loc": { "start": { - "line": 17, + "line": 29, "column": 7 }, "end": { - "line": 17, + "line": 29, "column": 8 } } @@ -2626,15 +7704,15 @@ "updateContext": null }, "value": "=", - "start": 472, - "end": 473, + "start": 861, + "end": 862, "loc": { "start": { - "line": 17, + "line": 29, "column": 9 }, "end": { - "line": 17, + "line": 29, "column": 10 } } @@ -2652,15 +7730,15 @@ "binop": null }, "value": "grandparent", - "start": 474, - "end": 485, + "start": 863, + "end": 874, "loc": { "start": { - "line": 17, + "line": 29, "column": 11 }, "end": { - "line": 17, + "line": 29, "column": 22 } } @@ -2677,15 +7755,15 @@ "postfix": false, "binop": null }, - "start": 485, - "end": 486, + "start": 874, + "end": 875, "loc": { "start": { - "line": 17, + "line": 29, "column": 22 }, "end": { - "line": 17, + "line": 29, "column": 23 } } @@ -2703,15 +7781,15 @@ "binop": null }, "value": "n", - "start": 486, - "end": 487, + "start": 875, + "end": 876, "loc": { "start": { - "line": 17, + "line": 29, "column": 23 }, "end": { - "line": 17, + "line": 29, "column": 24 } } @@ -2728,15 +7806,15 @@ "postfix": false, "binop": null }, - "start": 487, - "end": 488, + "start": 876, + "end": 877, "loc": { "start": { - "line": 17, + "line": 29, "column": 24 }, "end": { - "line": 17, + "line": 29, "column": 25 } } @@ -2754,15 +7832,15 @@ "binop": null, "updateContext": null }, - "start": 488, - "end": 489, + "start": 877, + "end": 878, "loc": { "start": { - "line": 17, + "line": 29, "column": 25 }, "end": { - "line": 17, + "line": 29, "column": 26 } } @@ -2770,15 +7848,15 @@ { "type": "CommentBlock", "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 492, - "end": 954, + "start": 881, + "end": 1343, "loc": { "start": { - "line": 19, + "line": 31, "column": 1 }, "end": { - "line": 31, + "line": 43, "column": 4 } } @@ -2798,15 +7876,15 @@ "updateContext": null }, "value": "if", - "start": 957, - "end": 959, + "start": 1346, + "end": 1348, "loc": { "start": { - "line": 33, + "line": 45, "column": 1 }, "end": { - "line": 33, + "line": 45, "column": 3 } } @@ -2823,15 +7901,15 @@ "postfix": false, "binop": null }, - "start": 960, - "end": 961, + "start": 1349, + "end": 1350, "loc": { "start": { - "line": 33, + "line": 45, "column": 4 }, "end": { - "line": 33, + "line": 45, "column": 5 } } @@ -2849,15 +7927,15 @@ "binop": null }, "value": "n", - "start": 961, - "end": 962, + "start": 1350, + "end": 1351, "loc": { "start": { - "line": 33, + "line": 45, "column": 5 }, "end": { - "line": 33, + "line": 45, "column": 6 } } @@ -2876,15 +7954,15 @@ "updateContext": null }, "value": "===", - "start": 963, - "end": 966, + "start": 1352, + "end": 1355, "loc": { "start": { - "line": 33, + "line": 45, "column": 7 }, "end": { - "line": 33, + "line": 45, "column": 10 } } @@ -2902,15 +7980,15 @@ "binop": null }, "value": "n", - "start": 967, - "end": 968, + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 33, + "line": 45, "column": 11 }, "end": { - "line": 33, + "line": 45, "column": 12 } } @@ -2928,15 +8006,15 @@ "binop": null, "updateContext": null }, - "start": 968, - "end": 969, + "start": 1357, + "end": 1358, "loc": { "start": { - "line": 33, + "line": 45, "column": 12 }, "end": { - "line": 33, + "line": 45, "column": 13 } } @@ -2954,15 +8032,15 @@ "binop": null }, "value": "parent", - "start": 969, - "end": 975, + "start": 1358, + "end": 1364, "loc": { "start": { - "line": 33, + "line": 45, "column": 13 }, "end": { - "line": 33, + "line": 45, "column": 19 } } @@ -2980,15 +8058,15 @@ "binop": null, "updateContext": null }, - "start": 975, - "end": 976, + "start": 1364, + "end": 1365, "loc": { "start": { - "line": 33, + "line": 45, "column": 19 }, "end": { - "line": 33, + "line": 45, "column": 20 } } @@ -3006,15 +8084,15 @@ "binop": null }, "value": "right", - "start": 976, - "end": 981, + "start": 1365, + "end": 1370, "loc": { "start": { - "line": 33, + "line": 45, "column": 20 }, "end": { - "line": 33, + "line": 45, "column": 25 } } @@ -3033,15 +8111,15 @@ "updateContext": null }, "value": "&&", - "start": 982, - "end": 984, + "start": 1371, + "end": 1373, "loc": { "start": { - "line": 33, + "line": 45, "column": 26 }, "end": { - "line": 33, + "line": 45, "column": 28 } } @@ -3059,15 +8137,15 @@ "binop": null }, "value": "n", - "start": 985, - "end": 986, + "start": 1374, + "end": 1375, "loc": { "start": { - "line": 33, + "line": 45, "column": 29 }, "end": { - "line": 33, + "line": 45, "column": 30 } } @@ -3085,15 +8163,15 @@ "binop": null, "updateContext": null }, - "start": 986, - "end": 987, + "start": 1375, + "end": 1376, "loc": { "start": { - "line": 33, + "line": 45, "column": 30 }, "end": { - "line": 33, + "line": 45, "column": 31 } } @@ -3111,15 +8189,15 @@ "binop": null }, "value": "parent", - "start": 987, - "end": 993, + "start": 1376, + "end": 1382, "loc": { "start": { - "line": 33, + "line": 45, "column": 31 }, "end": { - "line": 33, + "line": 45, "column": 37 } } @@ -3138,15 +8216,15 @@ "updateContext": null }, "value": "===", - "start": 994, - "end": 997, + "start": 1383, + "end": 1386, "loc": { "start": { - "line": 33, + "line": 45, "column": 38 }, "end": { - "line": 33, + "line": 45, "column": 41 } } @@ -3164,15 +8242,15 @@ "binop": null }, "value": "g", - "start": 998, - "end": 999, + "start": 1387, + "end": 1388, "loc": { "start": { - "line": 33, + "line": 45, "column": 42 }, "end": { - "line": 33, + "line": 45, "column": 43 } } @@ -3190,15 +8268,15 @@ "binop": null, "updateContext": null }, - "start": 999, - "end": 1000, + "start": 1388, + "end": 1389, "loc": { "start": { - "line": 33, + "line": 45, "column": 43 }, "end": { - "line": 33, + "line": 45, "column": 44 } } @@ -3216,15 +8294,15 @@ "binop": null }, "value": "left", - "start": 1000, - "end": 1004, + "start": 1389, + "end": 1393, "loc": { "start": { - "line": 33, + "line": 45, "column": 44 }, "end": { - "line": 33, + "line": 45, "column": 48 } } @@ -3241,15 +8319,15 @@ "postfix": false, "binop": null }, - "start": 1004, - "end": 1005, + "start": 1393, + "end": 1394, "loc": { "start": { - "line": 33, + "line": 45, "column": 48 }, "end": { - "line": 33, + "line": 45, "column": 49 } } @@ -3266,15 +8344,15 @@ "postfix": false, "binop": null }, - "start": 1006, - "end": 1007, + "start": 1395, + "end": 1396, "loc": { "start": { - "line": 33, + "line": 45, "column": 50 }, "end": { - "line": 33, + "line": 45, "column": 51 } } @@ -3292,15 +8370,15 @@ "binop": null }, "value": "rotate_left", - "start": 1010, - "end": 1021, + "start": 1399, + "end": 1410, "loc": { "start": { - "line": 34, + "line": 46, "column": 2 }, "end": { - "line": 34, + "line": 46, "column": 13 } } @@ -3317,15 +8395,15 @@ "postfix": false, "binop": null }, - "start": 1021, - "end": 1022, + "start": 1410, + "end": 1411, "loc": { "start": { - "line": 34, + "line": 46, "column": 13 }, "end": { - "line": 34, + "line": 46, "column": 14 } } @@ -3343,15 +8421,15 @@ "binop": null }, "value": "n", - "start": 1022, - "end": 1023, + "start": 1411, + "end": 1412, "loc": { "start": { - "line": 34, + "line": 46, "column": 14 }, "end": { - "line": 34, + "line": 46, "column": 15 } } @@ -3369,15 +8447,15 @@ "binop": null, "updateContext": null }, - "start": 1023, - "end": 1024, + "start": 1412, + "end": 1413, "loc": { "start": { - "line": 34, + "line": 46, "column": 15 }, "end": { - "line": 34, + "line": 46, "column": 16 } } @@ -3395,15 +8473,15 @@ "binop": null }, "value": "parent", - "start": 1024, - "end": 1030, + "start": 1413, + "end": 1419, "loc": { "start": { - "line": 34, + "line": 46, "column": 16 }, "end": { - "line": 34, + "line": 46, "column": 22 } } @@ -3420,15 +8498,15 @@ "postfix": false, "binop": null }, - "start": 1030, - "end": 1031, + "start": 1419, + "end": 1420, "loc": { "start": { - "line": 34, + "line": 46, "column": 22 }, "end": { - "line": 34, + "line": 46, "column": 23 } } @@ -3446,15 +8524,15 @@ "binop": null, "updateContext": null }, - "start": 1031, - "end": 1032, + "start": 1420, + "end": 1421, "loc": { "start": { - "line": 34, + "line": 46, "column": 23 }, "end": { - "line": 34, + "line": 46, "column": 24 } } @@ -3462,15 +8540,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1036, - "end": 1292, + "start": 1425, + "end": 1681, "loc": { "start": { - "line": 36, + "line": 48, "column": 2 }, "end": { - "line": 45, + "line": 57, "column": 5 } } @@ -3478,15 +8556,15 @@ { "type": "CommentLine", "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1296, - "end": 1373, + "start": 1685, + "end": 1762, "loc": { "start": { - "line": 47, + "line": 59, "column": 2 }, "end": { - "line": 47, + "line": 59, "column": 79 } } @@ -3503,15 +8581,15 @@ "postfix": false, "binop": null }, - "start": 1375, - "end": 1376, + "start": 1764, + "end": 1765, "loc": { "start": { - "line": 48, + "line": 60, "column": 1 }, "end": { - "line": 48, + "line": 60, "column": 2 } } @@ -3531,15 +8609,15 @@ "updateContext": null }, "value": "else", - "start": 1377, - "end": 1381, + "start": 1766, + "end": 1770, "loc": { "start": { - "line": 48, + "line": 60, "column": 3 }, "end": { - "line": 48, + "line": 60, "column": 7 } } @@ -3559,15 +8637,15 @@ "updateContext": null }, "value": "if", - "start": 1382, - "end": 1384, + "start": 1771, + "end": 1773, "loc": { "start": { - "line": 48, + "line": 60, "column": 8 }, "end": { - "line": 48, + "line": 60, "column": 10 } } @@ -3584,15 +8662,15 @@ "postfix": false, "binop": null }, - "start": 1385, - "end": 1386, + "start": 1774, + "end": 1775, "loc": { "start": { - "line": 48, + "line": 60, "column": 11 }, "end": { - "line": 48, + "line": 60, "column": 12 } } @@ -3610,15 +8688,15 @@ "binop": null }, "value": "n", - "start": 1386, - "end": 1387, + "start": 1775, + "end": 1776, "loc": { "start": { - "line": 48, + "line": 60, "column": 12 }, "end": { - "line": 48, + "line": 60, "column": 13 } } @@ -3637,15 +8715,15 @@ "updateContext": null }, "value": "===", - "start": 1388, - "end": 1391, + "start": 1777, + "end": 1780, "loc": { "start": { - "line": 48, + "line": 60, "column": 14 }, "end": { - "line": 48, + "line": 60, "column": 17 } } @@ -3663,15 +8741,15 @@ "binop": null }, "value": "n", - "start": 1392, - "end": 1393, + "start": 1781, + "end": 1782, "loc": { "start": { - "line": 48, + "line": 60, "column": 18 }, "end": { - "line": 48, + "line": 60, "column": 19 } } @@ -3689,15 +8767,15 @@ "binop": null, "updateContext": null }, - "start": 1393, - "end": 1394, + "start": 1782, + "end": 1783, "loc": { "start": { - "line": 48, + "line": 60, "column": 19 }, "end": { - "line": 48, + "line": 60, "column": 20 } } @@ -3715,15 +8793,15 @@ "binop": null }, "value": "parent", - "start": 1394, - "end": 1400, + "start": 1783, + "end": 1789, "loc": { "start": { - "line": 48, + "line": 60, "column": 20 }, "end": { - "line": 48, + "line": 60, "column": 26 } } @@ -3741,15 +8819,15 @@ "binop": null, "updateContext": null }, - "start": 1400, - "end": 1401, + "start": 1789, + "end": 1790, "loc": { "start": { - "line": 48, + "line": 60, "column": 26 }, "end": { - "line": 48, + "line": 60, "column": 27 } } @@ -3767,15 +8845,15 @@ "binop": null }, "value": "left", - "start": 1401, - "end": 1405, + "start": 1790, + "end": 1794, "loc": { "start": { - "line": 48, + "line": 60, "column": 27 }, "end": { - "line": 48, + "line": 60, "column": 31 } } @@ -3794,15 +8872,15 @@ "updateContext": null }, "value": "&&", - "start": 1406, - "end": 1408, + "start": 1795, + "end": 1797, "loc": { "start": { - "line": 48, + "line": 60, "column": 32 }, "end": { - "line": 48, + "line": 60, "column": 34 } } @@ -3820,15 +8898,15 @@ "binop": null }, "value": "n", - "start": 1409, - "end": 1410, + "start": 1798, + "end": 1799, "loc": { "start": { - "line": 48, + "line": 60, "column": 35 }, "end": { - "line": 48, + "line": 60, "column": 36 } } @@ -3846,15 +8924,15 @@ "binop": null, "updateContext": null }, - "start": 1410, - "end": 1411, + "start": 1799, + "end": 1800, "loc": { "start": { - "line": 48, + "line": 60, "column": 36 }, "end": { - "line": 48, + "line": 60, "column": 37 } } @@ -3872,15 +8950,15 @@ "binop": null }, "value": "parent", - "start": 1411, - "end": 1417, + "start": 1800, + "end": 1806, "loc": { "start": { - "line": 48, + "line": 60, "column": 37 }, "end": { - "line": 48, + "line": 60, "column": 43 } } @@ -3899,15 +8977,15 @@ "updateContext": null }, "value": "===", - "start": 1418, - "end": 1421, + "start": 1807, + "end": 1810, "loc": { "start": { - "line": 48, + "line": 60, "column": 44 }, "end": { - "line": 48, + "line": 60, "column": 47 } } @@ -3925,15 +9003,15 @@ "binop": null }, "value": "g", - "start": 1422, - "end": 1423, + "start": 1811, + "end": 1812, "loc": { "start": { - "line": 48, + "line": 60, "column": 48 }, "end": { - "line": 48, + "line": 60, "column": 49 } } @@ -3951,15 +9029,15 @@ "binop": null, "updateContext": null }, - "start": 1423, - "end": 1424, + "start": 1812, + "end": 1813, "loc": { "start": { - "line": 48, + "line": 60, "column": 49 }, "end": { - "line": 48, + "line": 60, "column": 50 } } @@ -3977,15 +9055,15 @@ "binop": null }, "value": "right", - "start": 1424, - "end": 1429, + "start": 1813, + "end": 1818, "loc": { "start": { - "line": 48, + "line": 60, "column": 50 }, "end": { - "line": 48, + "line": 60, "column": 55 } } @@ -4002,15 +9080,15 @@ "postfix": false, "binop": null }, - "start": 1429, - "end": 1430, + "start": 1818, + "end": 1819, "loc": { "start": { - "line": 48, + "line": 60, "column": 55 }, "end": { - "line": 48, + "line": 60, "column": 56 } } @@ -4027,15 +9105,15 @@ "postfix": false, "binop": null }, - "start": 1431, - "end": 1432, + "start": 1820, + "end": 1821, "loc": { "start": { - "line": 48, + "line": 60, "column": 57 }, "end": { - "line": 48, + "line": 60, "column": 58 } } @@ -4043,15 +9121,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1435, - "end": 1936, + "start": 1824, + "end": 2325, "loc": { "start": { - "line": 49, + "line": 61, "column": 2 }, "end": { - "line": 61, + "line": 73, "column": 5 } } @@ -4069,15 +9147,15 @@ "binop": null }, "value": "rotate_right", - "start": 1939, - "end": 1951, + "start": 2328, + "end": 2340, "loc": { "start": { - "line": 62, + "line": 74, "column": 2 }, "end": { - "line": 62, + "line": 74, "column": 14 } } @@ -4094,15 +9172,15 @@ "postfix": false, "binop": null }, - "start": 1951, - "end": 1952, + "start": 2340, + "end": 2341, "loc": { "start": { - "line": 62, + "line": 74, "column": 14 }, "end": { - "line": 62, + "line": 74, "column": 15 } } @@ -4120,15 +9198,15 @@ "binop": null }, "value": "n", - "start": 1952, - "end": 1953, + "start": 2341, + "end": 2342, "loc": { "start": { - "line": 62, + "line": 74, "column": 15 }, "end": { - "line": 62, + "line": 74, "column": 16 } } @@ -4146,15 +9224,15 @@ "binop": null, "updateContext": null }, - "start": 1953, - "end": 1954, + "start": 2342, + "end": 2343, "loc": { "start": { - "line": 62, + "line": 74, "column": 16 }, "end": { - "line": 62, + "line": 74, "column": 17 } } @@ -4172,15 +9250,15 @@ "binop": null }, "value": "parent", - "start": 1954, - "end": 1960, + "start": 2343, + "end": 2349, "loc": { "start": { - "line": 62, + "line": 74, "column": 17 }, "end": { - "line": 62, + "line": 74, "column": 23 } } @@ -4197,15 +9275,15 @@ "postfix": false, "binop": null }, - "start": 1960, - "end": 1961, + "start": 2349, + "end": 2350, "loc": { "start": { - "line": 62, + "line": 74, "column": 23 }, "end": { - "line": 62, + "line": 74, "column": 24 } } @@ -4223,15 +9301,15 @@ "binop": null, "updateContext": null }, - "start": 1961, - "end": 1962, + "start": 2350, + "end": 2351, "loc": { "start": { - "line": 62, + "line": 74, "column": 24 }, "end": { - "line": 62, + "line": 74, "column": 25 } } @@ -4239,15 +9317,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 1966, - "end": 2194, + "start": 2355, + "end": 2583, "loc": { "start": { - "line": 64, + "line": 76, "column": 2 }, "end": { - "line": 72, + "line": 84, "column": 5 } } @@ -4255,15 +9333,15 @@ { "type": "CommentLine", "value": " n = n.right ;", - "start": 2198, - "end": 2214, + "start": 2587, + "end": 2603, "loc": { "start": { - "line": 74, + "line": 86, "column": 2 }, "end": { - "line": 74, + "line": 86, "column": 18 } } @@ -4280,15 +9358,15 @@ "postfix": false, "binop": null }, - "start": 2216, - "end": 2217, + "start": 2605, + "end": 2606, "loc": { "start": { - "line": 75, + "line": 87, "column": 1 }, "end": { - "line": 75, + "line": 87, "column": 2 } } @@ -4306,15 +9384,15 @@ "binop": null }, "value": "insert_case5", - "start": 2220, - "end": 2232, + "start": 2609, + "end": 2621, "loc": { "start": { - "line": 77, + "line": 89, "column": 1 }, "end": { - "line": 77, + "line": 89, "column": 13 } } @@ -4331,15 +9409,15 @@ "postfix": false, "binop": null }, - "start": 2232, - "end": 2233, + "start": 2621, + "end": 2622, "loc": { "start": { - "line": 77, + "line": 89, "column": 13 }, "end": { - "line": 77, + "line": 89, "column": 14 } } @@ -4357,15 +9435,15 @@ "binop": null }, "value": "n", - "start": 2233, - "end": 2234, + "start": 2622, + "end": 2623, "loc": { "start": { - "line": 77, + "line": 89, "column": 14 }, "end": { - "line": 77, + "line": 89, "column": 15 } } @@ -4382,15 +9460,15 @@ "postfix": false, "binop": null }, - "start": 2234, - "end": 2235, + "start": 2623, + "end": 2624, "loc": { "start": { - "line": 77, + "line": 89, "column": 15 }, "end": { - "line": 77, + "line": 89, "column": 16 } } @@ -4408,15 +9486,15 @@ "binop": null, "updateContext": null }, - "start": 2235, - "end": 2236, + "start": 2624, + "end": 2625, "loc": { "start": { - "line": 77, + "line": 89, "column": 16 }, "end": { - "line": 77, + "line": 89, "column": 17 } } @@ -4433,15 +9511,15 @@ "postfix": false, "binop": null }, - "start": 2237, - "end": 2238, + "start": 2626, + "end": 2627, "loc": { "start": { - "line": 78, + "line": 90, "column": 0 }, "end": { - "line": 78, + "line": 90, "column": 1 } } @@ -4459,19 +9537,127 @@ "binop": null, "updateContext": null }, - "start": 2238, - "end": 2239, + "start": 2627, + "end": 2628, "loc": { "start": { - "line": 78, + "line": 90, "column": 1 }, "end": { - "line": 78, + "line": 90, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 2630, + "end": 2636, + "loc": { + "start": { + "line": 92, + "column": 0 + }, + "end": { + "line": 92, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 2637, + "end": 2644, + "loc": { + "start": { + "line": 92, + "column": 7 + }, + "end": { + "line": 92, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case4", + "start": 2645, + "end": 2657, + "loc": { + "start": { + "line": 92, + "column": 15 + }, + "end": { + "line": 92, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2657, + "end": 2658, + "loc": { + "start": { + "line": 92, + "column": 27 + }, + "end": { + "line": 92, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -4485,15 +9671,15 @@ "binop": null, "updateContext": null }, - "start": 2240, - "end": 2240, + "start": 2659, + "end": 2659, "loc": { "start": { - "line": 79, + "line": 93, "column": 0 }, "end": { - "line": 79, + "line": 93, "column": 0 } } diff --git a/ast/source/insertion/insert_case5.js.json b/ast/source/insertion/insert_case5.js.json index 159a7aa..7ab7ea0 100644 --- a/ast/source/insertion/insert_case5.js.json +++ b/ast/source/insertion/insert_case5.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1450, + "end": 2063, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 48, + "line": 71, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1450, + "end": 2063, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 48, + "line": 71, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 45, + "end": 28, "loc": { "start": { "line": 1, @@ -39,102 +39,243 @@ }, "end": { "line": 1, - "column": 45 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 40, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 11 }, - "identifierName": "BLACK" + "identifierName": "Node" }, - "name": "BLACK" + "name": "Node" } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 0 }, + "end": { + "line": 3, + "column": 38 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 15, - "end": 18, + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 12 } }, - "imported": { + "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 73, + "end": 78, "loc": { "start": { - "line": 1, - "column": 15 + "line": 3, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 3, + "column": 12 }, - "identifierName": "RED" + "identifierName": "BLACK" }, - "name": "RED" + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 105, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } }, "local": { "type": "Identifier", - "start": 15, - "end": 18, + "start": 112, + "end": 115, "loc": { "start": { - "line": 1, - "column": 15 + "line": 4, + "column": 7 }, "end": { - "line": 1, - "column": 18 + "line": 4, + "column": 10 }, "identifierName": "RED" }, @@ -144,132 +285,135 @@ ], "source": { "type": "StringLiteral", - "start": 25, - "end": 44, + "start": 121, + "end": 138, "loc": { "start": { - "line": 1, - "column": 25 + "line": 4, + "column": 16 }, "end": { - "line": 1, - "column": 44 + "line": 4, + "column": 33 } }, "extra": { - "rawValue": "../color/index.js", - "raw": "'../color/index.js'" + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" }, - "value": "../color/index.js" + "value": "../color/RED.js" } }, { "type": "ImportDeclaration", - "start": 46, - "end": 107, + "start": 140, + "end": 191, "loc": { "start": { - "line": 2, + "line": 5, "column": 0 }, "end": { - "line": 2, - "column": 61 + "line": 5, + "column": 51 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 54, - "end": 65, + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 158, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 19 + "line": 5, + "column": 18 } }, - "imported": { - "type": "Identifier", - "start": 54, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 19 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, "local": { "type": "Identifier", - "start": 54, - "end": 65, + "start": 147, + "end": 158, "loc": { "start": { - "line": 2, - "column": 8 + "line": 5, + "column": 7 }, "end": { - "line": 2, - "column": 19 + "line": 5, + "column": 18 }, "identifierName": "rotate_left" }, "name": "rotate_left" } + } + ], + "source": { + "type": "StringLiteral", + "start": 164, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + }, + "extra": { + "rawValue": "../rotate/rotate_left.js", + "raw": "'../rotate/rotate_left.js'" + }, + "value": "../rotate/rotate_left.js" + } + }, + { + "type": "ImportDeclaration", + "start": 192, + "end": 245, + "loc": { + "start": { + "line": 6, + "column": 0 }, + "end": { + "line": 6, + "column": 53 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 67, - "end": 79, + "type": "ImportDefaultSpecifier", + "start": 199, + "end": 211, "loc": { "start": { - "line": 2, - "column": 21 + "line": 6, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 6, + "column": 19 } }, - "imported": { - "type": "Identifier", - "start": 67, - "end": 79, - "loc": { - "start": { - "line": 2, - "column": 21 - }, - "end": { - "line": 2, - "column": 33 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - }, "local": { "type": "Identifier", - "start": 67, - "end": 79, + "start": 199, + "end": 211, "loc": { "start": { - "line": 2, - "column": 21 + "line": 6, + "column": 7 }, "end": { - "line": 2, - "column": 33 + "line": 6, + "column": 19 }, "identifierName": "rotate_right" }, @@ -279,83 +423,66 @@ ], "source": { "type": "StringLiteral", - "start": 86, - "end": 106, + "start": 217, + "end": 244, "loc": { "start": { - "line": 2, - "column": 40 + "line": 6, + "column": 25 }, "end": { - "line": 2, - "column": 60 + "line": 6, + "column": 52 } }, "extra": { - "rawValue": "../rotate/index.js", - "raw": "'../rotate/index.js'" + "rawValue": "../rotate/rotate_right.js", + "raw": "'../rotate/rotate_right.js'" }, - "value": "../rotate/index.js" + "value": "../rotate/rotate_right.js" } }, { "type": "ImportDeclaration", - "start": 108, - "end": 161, + "start": 246, + "end": 297, "loc": { "start": { - "line": 3, + "line": 7, "column": 0 }, "end": { - "line": 3, - "column": 53 + "line": 7, + "column": 51 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 116, - "end": 127, + "type": "ImportDefaultSpecifier", + "start": 253, + "end": 264, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 19 + "line": 7, + "column": 18 } }, - "imported": { - "type": "Identifier", - "start": 116, - "end": 127, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 19 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" - }, "local": { "type": "Identifier", - "start": 116, - "end": 127, + "start": 253, + "end": 264, "loc": { "start": { - "line": 3, - "column": 8 + "line": 7, + "column": 7 }, "end": { - "line": 3, - "column": 19 + "line": 7, + "column": 18 }, "identifierName": "grandparent" }, @@ -365,16 +492,16 @@ ], "source": { "type": "StringLiteral", - "start": 134, - "end": 160, + "start": 270, + "end": 296, "loc": { "start": { - "line": 3, - "column": 26 + "line": 7, + "column": 24 }, "end": { - "line": 3, - "column": 52 + "line": 7, + "column": 50 } }, "extra": { @@ -386,16 +513,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 163, - "end": 412, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "start": 299, + "end": 578, "loc": { "start": { - "line": 5, + "line": 9, "column": 0 }, "end": { - "line": 14, + "line": 19, "column": 3 } } @@ -403,967 +530,8914 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 413, - "end": 1449, + "type": "Identifier", + "start": 579, + "end": 2032, "loc": { "start": { - "line": 15, + "line": 20, "column": 0 }, "end": { - "line": 47, + "line": 68, "column": 2 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 420, - "end": 1449, - "loc": { - "start": { - "line": 15, - "column": 7 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 585, + "end": 2031, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 68, + "column": 1 + } }, - "end": { - "line": 47, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 426, - "end": 1448, + "id": { + "type": "Identifier", + "start": 585, + "end": 597, "loc": { "start": { - "line": 15, - "column": 13 + "line": 20, + "column": 6 }, "end": { - "line": 47, - "column": 1 - } + "line": 20, + "column": 18 + }, + "identifierName": "insert_case5" }, - "id": { - "type": "Identifier", - "start": 426, - "end": 438, - "loc": { - "start": { - "line": 15, - "column": 13 - }, - "end": { - "line": 15, - "column": 25 - }, - "identifierName": "insert_case5" + "name": "insert_case5", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 600, + "end": 2031, + "loc": { + "start": { + "line": 20, + "column": 21 }, - "name": "insert_case5", - "leadingComments": null + "end": { + "line": 68, + "column": 1 + } }, - "init": { - "type": "ArrowFunctionExpression", - "start": 441, - "end": 1448, - "loc": { - "start": { - "line": 15, - "column": 28 - }, - "end": { - "line": 47, - "column": 1 - } - }, - "id": { + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 426, - "end": 438, + "start": 601, + "end": 602, "loc": { "start": { - "line": 15, - "column": 13 + "line": 20, + "column": 22 }, "end": { - "line": 15, - "column": 25 + "line": 20, + "column": 23 }, - "identifierName": "insert_case5" + "identifierName": "n" }, - "name": "insert_case5", - "leadingComments": null + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 607, + "end": 2031, + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 68, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 442, - "end": 443, + "type": "ExpressionStatement", + "start": 610, + "end": 636, "loc": { "start": { - "line": 15, - "column": 29 + "line": 21, + "column": 1 }, "end": { - "line": 15, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 448, - "end": 1448, - "loc": { - "start": { - "line": 15, - "column": 35 + "line": 21, + "column": 27 + } }, - "end": { - "line": 47, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 451, - "end": 476, + "expression": { + "type": "CallExpression", + "start": 610, + "end": 635, "loc": { "start": { - "line": 16, + "line": 21, "column": 1 }, "end": { - "line": 16, + "line": 21, "column": 26 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 610, + "end": 616, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 457, - "end": 475, + "type": "BinaryExpression", + "start": 617, + "end": 634, "loc": { "start": { - "line": 16, - "column": 7 + "line": 21, + "column": 8 }, "end": { - "line": 16, + "line": 21, "column": 25 } }, - "id": { + "left": { "type": "Identifier", - "start": 457, - "end": 458, + "start": 617, + "end": 618, "loc": { "start": { - "line": 16, - "column": 7 + "line": 21, + "column": 8 }, "end": { - "line": 16, - "column": 8 + "line": 21, + "column": 9 }, - "identifierName": "g" + "identifierName": "n" }, - "name": "g" + "name": "n" }, - "init": { - "type": "CallExpression", - "start": 461, - "end": 475, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 630, + "end": 634, "loc": { "start": { - "line": 16, - "column": 11 + "line": 21, + "column": 21 }, "end": { - "line": 16, + "line": 21, "column": 25 - } - }, - "callee": { - "type": "Identifier", - "start": 461, - "end": 472, - "loc": { - "start": { - "line": 16, - "column": 11 - }, - "end": { - "line": 16, - "column": 22 - }, - "identifierName": "grandparent" }, - "name": "grandparent" - }, - "arguments": [ - { - "type": "Identifier", - "start": 473, - "end": 474, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 24 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 479, - "end": 527, - "loc": { - "start": { - "line": 18, - "column": 1 + "identifierName": "Node" }, - "end": { - "line": 18, - "column": 49 - } + "name": "Node" } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 638, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 26 + } }, - { - "type": "ExpressionStatement", - "start": 529, - "end": 553, + "expression": { + "type": "CallExpression", + "start": 638, + "end": 662, "loc": { "start": { - "line": 19, + "line": 22, "column": 1 }, "end": { - "line": 19, + "line": 22, "column": 25 } }, - "expression": { - "type": "AssignmentExpression", - "start": 529, - "end": 552, + "callee": { + "type": "Identifier", + "start": 638, + "end": 644, "loc": { "start": { - "line": 19, + "line": 22, "column": 1 }, "end": { - "line": 19, - "column": 24 - } + "line": 22, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 529, - "end": 544, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 645, + "end": 661, "loc": { "start": { - "line": 19, - "column": 1 + "line": 22, + "column": 8 }, "end": { - "line": 19, - "column": 16 + "line": 22, + "column": 24 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 529, - "end": 537, + "start": 645, + "end": 653, "loc": { "start": { - "line": 19, - "column": 1 + "line": 22, + "column": 8 }, "end": { - "line": 19, - "column": 9 + "line": 22, + "column": 16 } }, "object": { "type": "Identifier", - "start": 529, - "end": 530, + "start": 645, + "end": 646, "loc": { "start": { - "line": 19, - "column": 1 + "line": 22, + "column": 8 }, "end": { - "line": 19, - "column": 2 + "line": 22, + "column": 9 }, "identifierName": "n" }, - "name": "n", - "leadingComments": null + "name": "n" }, "property": { "type": "Identifier", - "start": 531, - "end": 537, + "start": 647, + "end": 653, "loc": { "start": { - "line": 19, - "column": 3 + "line": 22, + "column": 10 }, "end": { - "line": 19, - "column": 9 + "line": 22, + "column": 16 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, - "computed": false, - "leadingComments": null + "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 538, - "end": 544, + "start": 658, + "end": 661, "loc": { "start": { - "line": 19, - "column": 10 + "line": 22, + "column": 21 }, "end": { - "line": 19, - "column": 16 + "line": 22, + "column": 24 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 547, - "end": 552, - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 479, - "end": 527, - "loc": { - "start": { - "line": 18, - "column": 1 + "identifierName": "RED" }, - "end": { - "line": 18, - "column": 49 - } + "name": "RED" } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 665, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 33 + } }, - { - "type": "ExpressionStatement", - "start": 555, - "end": 570, + "expression": { + "type": "CallExpression", + "start": 665, + "end": 696, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, - "column": 16 + "line": 23, + "column": 32 } }, - "expression": { - "type": "AssignmentExpression", - "start": 555, - "end": 569, + "callee": { + "type": "Identifier", + "start": 665, + "end": 671, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, - "column": 15 - } + "line": 23, + "column": 7 + }, + "identifierName": "assert" }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 555, - "end": 563, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 672, + "end": 695, "loc": { "start": { - "line": 20, - "column": 1 + "line": 23, + "column": 8 }, "end": { - "line": 20, - "column": 9 + "line": 23, + "column": 31 } }, - "object": { - "type": "Identifier", - "start": 555, - "end": 556, + "left": { + "type": "MemberExpression", + "start": 672, + "end": 685, "loc": { "start": { - "line": 20, - "column": 1 + "line": 23, + "column": 8 }, "end": { - "line": 20, - "column": 2 - }, - "identifierName": "g" + "line": 23, + "column": 21 + } }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 557, - "end": 563, - "loc": { - "start": { - "line": 20, - "column": 3 - }, - "end": { - "line": 20, - "column": 9 + "object": { + "type": "MemberExpression", + "start": 672, + "end": 678, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 14 + } }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 566, - "end": 569, - "loc": { - "start": { - "line": 20, - "column": 12 + "object": { + "type": "Identifier", + "start": 672, + "end": 673, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 674, + "end": 678, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "end": { - "line": 20, - "column": 15 + "property": { + "type": "Identifier", + "start": 679, + "end": 685, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "RED" + "computed": false }, - "name": "RED" - } - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t ", - "start": 573, - "end": 988, - "loc": { - "start": { - "line": 22, - "column": 1 + "operator": "===", + "right": { + "type": "Identifier", + "start": 690, + "end": 695, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 31 + }, + "identifierName": "BLACK" }, - "end": { - "line": 33, - "column": 4 - } + "name": "BLACK" } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 699, + "end": 732, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 34 + } }, - { - "type": "IfStatement", - "start": 990, - "end": 1446, + "expression": { + "type": "CallExpression", + "start": 699, + "end": 731, "loc": { "start": { - "line": 34, + "line": 24, "column": 1 }, "end": { - "line": 46, - "column": 25 + "line": 24, + "column": 33 } }, - "test": { - "type": "BinaryExpression", - "start": 994, - "end": 1013, + "callee": { + "type": "Identifier", + "start": 699, + "end": 705, "loc": { "start": { - "line": 34, - "column": 5 + "line": 24, + "column": 1 }, "end": { - "line": 34, - "column": 24 - } - }, - "left": { - "type": "Identifier", - "start": 994, - "end": 995, - "loc": { - "start": { - "line": 34, - "column": 5 - }, - "end": { - "line": 34, - "column": 6 - }, - "identifierName": "n" + "line": 24, + "column": 7 }, - "name": "n", - "leadingComments": null + "identifierName": "assert" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1000, - "end": 1013, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 706, + "end": 730, "loc": { "start": { - "line": 34, - "column": 11 + "line": 24, + "column": 8 }, "end": { - "line": 34, - "column": 24 + "line": 24, + "column": 32 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 1000, - "end": 1008, + "start": 706, + "end": 720, "loc": { "start": { - "line": 34, - "column": 11 + "line": 24, + "column": 8 }, "end": { - "line": 34, - "column": 19 + "line": 24, + "column": 22 } }, "object": { - "type": "Identifier", - "start": 1000, - "end": 1001, + "type": "MemberExpression", + "start": 706, + "end": 713, "loc": { "start": { - "line": 34, - "column": 11 + "line": 24, + "column": 8 }, "end": { - "line": 34, - "column": 12 + "line": 24, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 706, + "end": 707, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 708, + "end": 713, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 1002, - "end": 1008, + "start": 714, + "end": 720, "loc": { "start": { - "line": 34, - "column": 13 + "line": 24, + "column": 16 }, "end": { - "line": 34, - "column": 19 + "line": 24, + "column": 22 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 1009, - "end": 1013, + "start": 725, + "end": 730, "loc": { "start": { - "line": 34, - "column": 20 + "line": 24, + "column": 27 }, "end": { - "line": 34, - "column": 24 + "line": 24, + "column": 32 }, - "identifierName": "left" + "identifierName": "BLACK" }, - "name": "left" - }, - "computed": false + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 734, + "end": 760, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 734, + "end": 759, + "loc": { + "start": { + "line": 25, + "column": 1 }, - "leadingComments": null + "end": { + "line": 25, + "column": 26 + } }, - "consequent": { - "type": "ExpressionStatement", - "start": 1015, - "end": 1031, + "callee": { + "type": "Identifier", + "start": 734, + "end": 740, "loc": { "start": { - "line": 34, - "column": 26 + "line": 25, + "column": 1 }, "end": { - "line": 34, - "column": 42 - } + "line": 25, + "column": 7 + }, + "identifierName": "assert" }, - "expression": { - "type": "CallExpression", - "start": 1015, - "end": 1030, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 741, + "end": 758, "loc": { "start": { - "line": 34, - "column": 26 + "line": 25, + "column": 8 }, "end": { - "line": 34, - "column": 41 + "line": 25, + "column": 25 } }, - "callee": { - "type": "Identifier", - "start": 1015, - "end": 1027, + "left": { + "type": "MemberExpression", + "start": 741, + "end": 749, "loc": { "start": { - "line": 34, - "column": 26 + "line": 25, + "column": 8 }, "end": { - "line": 34, - "column": 38 + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 741, + "end": 742, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "rotate_right" + "name": "n" }, - "name": "rotate_right" - }, - "arguments": [ - { + "property": { "type": "Identifier", - "start": 1028, - "end": 1029, + "start": 743, + "end": 749, "loc": { "start": { - "line": 34, - "column": 39 + "line": 25, + "column": 10 }, "end": { - "line": 34, - "column": 40 + "line": 25, + "column": 16 }, - "identifierName": "g" + "identifierName": "parent" }, - "name": "g" - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t ", - "start": 1033, - "end": 1425, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 754, + "end": 758, "loc": { "start": { - "line": 35, - "column": 1 + "line": 25, + "column": 21 }, "end": { - "line": 46, - "column": 4 + "line": 25, + "column": 25 } } } - ] + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 762, + "end": 794, + "loc": { + "start": { + "line": 26, + "column": 1 }, - "alternate": { - "type": "ExpressionStatement", - "start": 1431, - "end": 1446, + "end": { + "line": 26, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 762, + "end": 793, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 762, + "end": 768, "loc": { "start": { - "line": 46, - "column": 10 + "line": 26, + "column": 1 }, "end": { - "line": 46, - "column": 25 - } + "line": 26, + "column": 7 + }, + "identifierName": "assert" }, - "expression": { - "type": "CallExpression", - "start": 1431, - "end": 1445, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 769, + "end": 792, "loc": { "start": { - "line": 46, - "column": 10 + "line": 26, + "column": 8 }, "end": { - "line": 46, - "column": 24 + "line": 26, + "column": 31 } }, - "callee": { - "type": "Identifier", - "start": 1431, - "end": 1442, + "left": { + "type": "MemberExpression", + "start": 769, + "end": 784, "loc": { "start": { - "line": 46, - "column": 10 + "line": 26, + "column": 8 }, "end": { - "line": 46, - "column": 21 - }, - "identifierName": "rotate_left" + "line": 26, + "column": 23 + } }, - "name": "rotate_left", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1443, - "end": 1444, + "object": { + "type": "MemberExpression", + "start": 769, + "end": 777, "loc": { "start": { - "line": 46, - "column": 22 + "line": 26, + "column": 8 }, "end": { - "line": 46, - "column": 23 + "line": 26, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 769, + "end": 770, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "g" + "name": "n" }, - "name": "g" - } - ], - "leadingComments": null + "property": { + "type": "Identifier", + "start": 771, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 778, + "end": 784, + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 789, + "end": 792, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 796, + "end": 821, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 802, + "end": 820, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 25 + } }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t ", - "start": 1033, - "end": 1425, + "id": { + "type": "Identifier", + "start": 802, + "end": 803, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 806, + "end": 820, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 806, + "end": 817, "loc": { "start": { - "line": 35, - "column": 1 + "line": 27, + "column": 11 }, "end": { - "line": 46, - "column": 4 - } + "line": 27, + "column": 22 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 818, + "end": 819, + "loc": { + "start": { + "line": 27, + "column": 23 + }, + "end": { + "line": 27, + "column": 24 + }, + "identifierName": "n" + }, + "name": "n" } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 824, + "end": 872, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 } - ] + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 874, + "end": 898, + "loc": { + "start": { + "line": 30, + "column": 1 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t ", - "start": 573, - "end": 988, + "end": { + "line": 30, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 874, + "end": 897, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 874, + "end": 889, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 874, + "end": 882, "loc": { "start": { - "line": 22, + "line": 30, "column": 1 }, "end": { - "line": 33, - "column": 4 + "line": 30, + "column": 9 } + }, + "object": { + "type": "Identifier", + "start": 874, + "end": 875, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 876, + "end": 882, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 883, + "end": 889, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 892, + "end": 897, + "loc": { + "start": { + "line": 30, + "column": 19 + }, + "end": { + "line": 30, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 824, + "end": 872, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 } } - ] + } + ] + }, + { + "type": "ExpressionStatement", + "start": 900, + "end": 915, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 900, + "end": 914, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 900, + "end": 908, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 900, + "end": 901, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 902, + "end": 908, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 911, + "end": 914, + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 15 + }, + "identifierName": "RED" + }, + "name": "RED" + } } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 163, - "end": 412, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 14, - "column": 3 - } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 163, - "end": 412, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 14, - "column": 3 + }, + { + "type": "IfStatement", + "start": 918, + "end": 2029, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 67, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 922, + "end": 941, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 922, + "end": 923, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 928, + "end": 941, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "object": { + "type": "MemberExpression", + "start": 928, + "end": 936, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 928, + "end": 929, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 930, + "end": 936, + "loc": { + "start": { + "line": 33, + "column": 13 + }, + "end": { + "line": 33, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 937, + "end": 941, + "loc": { + "start": { + "line": 33, + "column": 20 + }, + "end": { + "line": 33, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "BlockStatement", + "start": 943, + "end": 1494, + "loc": { + "start": { + "line": 33, + "column": 26 + }, + "end": { + "line": 50, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1376, + "end": 1407, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 1376, + "end": 1406, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 1376, + "end": 1382, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1383, + "end": 1405, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 1383, + "end": 1389, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1383, + "end": 1384, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1385, + "end": 1389, + "loc": { + "start": { + "line": 46, + "column": 11 + }, + "end": { + "line": 46, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1401, + "end": 1405, + "loc": { + "start": { + "line": 46, + "column": 27 + }, + "end": { + "line": 46, + "column": 31 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 947, + "end": 1373, + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 45, + "column": 5 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1410, + "end": 1436, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 1410, + "end": 1435, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 1410, + "end": 1416, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1417, + "end": 1434, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 26 + } + }, + "left": { + "type": "Identifier", + "start": 1417, + "end": 1418, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1423, + "end": 1434, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 26 + } + }, + "object": { + "type": "MemberExpression", + "start": 1423, + "end": 1429, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 1423, + "end": 1424, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1425, + "end": 1429, + "loc": { + "start": { + "line": 47, + "column": 17 + }, + "end": { + "line": 47, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1430, + "end": 1434, + "loc": { + "start": { + "line": 47, + "column": 22 + }, + "end": { + "line": 47, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1439, + "end": 1472, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 35 + } + }, + "expression": { + "type": "CallExpression", + "start": 1439, + "end": 1471, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 34 + } + }, + "callee": { + "type": "Identifier", + "start": 1439, + "end": 1445, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1446, + "end": 1470, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 33 + } + }, + "left": { + "type": "MemberExpression", + "start": 1446, + "end": 1460, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 1446, + "end": 1453, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1446, + "end": 1447, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1448, + "end": 1453, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1454, + "end": 1460, + "loc": { + "start": { + "line": 48, + "column": 17 + }, + "end": { + "line": 48, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1465, + "end": 1470, + "loc": { + "start": { + "line": 48, + "column": 28 + }, + "end": { + "line": 48, + "column": 33 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1475, + "end": 1491, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1475, + "end": 1490, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1475, + "end": 1487, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 14 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1488, + "end": 1489, + "loc": { + "start": { + "line": 49, + "column": 15 + }, + "end": { + "line": 49, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 1500, + "end": 2029, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 67, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1910, + "end": 1942, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 1910, + "end": 1941, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 1910, + "end": 1916, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1917, + "end": 1940, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 1917, + "end": 1924, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1917, + "end": 1918, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1919, + "end": 1924, + "loc": { + "start": { + "line": 63, + "column": 11 + }, + "end": { + "line": 63, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1936, + "end": 1940, + "loc": { + "start": { + "line": 63, + "column": 28 + }, + "end": { + "line": 63, + "column": 32 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 1504, + "end": 1907, + "loc": { + "start": { + "line": 51, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1945, + "end": 1973, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 1945, + "end": 1972, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 1945, + "end": 1951, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1952, + "end": 1971, + "loc": { + "start": { + "line": 64, + "column": 9 + }, + "end": { + "line": 64, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 1952, + "end": 1953, + "loc": { + "start": { + "line": 64, + "column": 9 + }, + "end": { + "line": 64, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1958, + "end": 1971, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 28 + } + }, + "object": { + "type": "MemberExpression", + "start": 1958, + "end": 1965, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 1958, + "end": 1959, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1960, + "end": 1965, + "loc": { + "start": { + "line": 64, + "column": 17 + }, + "end": { + "line": 64, + "column": 22 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1966, + "end": 1971, + "loc": { + "start": { + "line": 64, + "column": 23 + }, + "end": { + "line": 64, + "column": 28 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1976, + "end": 2008, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 1976, + "end": 2007, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 1976, + "end": 1982, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1983, + "end": 2006, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 1983, + "end": 1996, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 1983, + "end": 1989, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1983, + "end": 1984, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1985, + "end": 1989, + "loc": { + "start": { + "line": 65, + "column": 11 + }, + "end": { + "line": 65, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1990, + "end": 1996, + "loc": { + "start": { + "line": 65, + "column": 16 + }, + "end": { + "line": 65, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 2001, + "end": 2006, + "loc": { + "start": { + "line": 65, + "column": 27 + }, + "end": { + "line": 65, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 2011, + "end": 2026, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2011, + "end": 2025, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2011, + "end": 2022, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 13 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2023, + "end": 2024, + "loc": { + "start": { + "line": 66, + "column": 14 + }, + "end": { + "line": 66, + "column": 15 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 2034, + "end": 2062, + "loc": { + "start": { + "line": 70, + "column": 0 + }, + "end": { + "line": 70, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 2049, + "end": 2061, + "loc": { + "start": { + "line": 70, + "column": 15 + }, + "end": { + "line": 70, + "column": 27 + }, + "identifierName": "insert_case5" + }, + "name": "insert_case5" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 2034, + "end": 2062, + "loc": { + "start": { + "line": 70, + "column": 0 + }, + "end": { + "line": 70, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 579, + "end": 2032, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 68, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 585, + "end": 2031, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 68, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 585, + "end": 597, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 18 + }, + "identifierName": "insert_case5" + }, + "name": "insert_case5", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 600, + "end": 2031, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 68, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 585, + "end": 597, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 18 + }, + "identifierName": "insert_case5" + }, + "name": "insert_case5", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 601, + "end": 602, + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 607, + "end": 2031, + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 68, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 610, + "end": 636, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 610, + "end": 635, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 610, + "end": 616, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 617, + "end": 634, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 617, + "end": 618, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 630, + "end": 634, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 638, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 638, + "end": 662, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 638, + "end": 644, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 645, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 645, + "end": 653, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 645, + "end": 646, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 647, + "end": 653, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 658, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 665, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 665, + "end": 696, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 665, + "end": 671, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 672, + "end": 695, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 672, + "end": 685, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 672, + "end": 678, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 672, + "end": 673, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 674, + "end": 678, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 679, + "end": 685, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 690, + "end": 695, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 699, + "end": 732, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 699, + "end": 731, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 699, + "end": 705, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 706, + "end": 730, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 706, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 706, + "end": 713, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 706, + "end": 707, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 708, + "end": 713, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 714, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 725, + "end": 730, + "loc": { + "start": { + "line": 24, + "column": 27 + }, + "end": { + "line": 24, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 734, + "end": 760, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 734, + "end": 759, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 734, + "end": 740, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 741, + "end": 758, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 741, + "end": 749, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 741, + "end": 742, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 743, + "end": 749, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 754, + "end": 758, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 762, + "end": 794, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 762, + "end": 793, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 762, + "end": 768, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 769, + "end": 792, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 769, + "end": 784, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 769, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 769, + "end": 770, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 771, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 778, + "end": 784, + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 789, + "end": 792, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 796, + "end": 821, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 802, + "end": 820, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "id": { + "type": "Identifier", + "start": 802, + "end": 803, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 806, + "end": 820, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 806, + "end": 817, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 22 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 818, + "end": 819, + "loc": { + "start": { + "line": 27, + "column": 23 + }, + "end": { + "line": 27, + "column": 24 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 824, + "end": 872, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 874, + "end": 898, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 874, + "end": 897, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 874, + "end": 889, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 874, + "end": 882, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 874, + "end": 875, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 876, + "end": 882, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 883, + "end": 889, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 892, + "end": 897, + "loc": { + "start": { + "line": 30, + "column": 19 + }, + "end": { + "line": 30, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 824, + "end": 872, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 900, + "end": 915, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 900, + "end": 914, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 900, + "end": 908, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 900, + "end": 901, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 902, + "end": 908, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 911, + "end": 914, + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 15 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "IfStatement", + "start": 918, + "end": 2029, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 67, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 922, + "end": 941, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 922, + "end": 923, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 928, + "end": 941, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "object": { + "type": "MemberExpression", + "start": 928, + "end": 936, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 928, + "end": 929, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 930, + "end": 936, + "loc": { + "start": { + "line": 33, + "column": 13 + }, + "end": { + "line": 33, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 937, + "end": 941, + "loc": { + "start": { + "line": 33, + "column": 20 + }, + "end": { + "line": 33, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "BlockStatement", + "start": 943, + "end": 1494, + "loc": { + "start": { + "line": 33, + "column": 26 + }, + "end": { + "line": 50, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1376, + "end": 1407, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 1376, + "end": 1406, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 1376, + "end": 1382, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1383, + "end": 1405, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 1383, + "end": 1389, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1383, + "end": 1384, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1385, + "end": 1389, + "loc": { + "start": { + "line": 46, + "column": 11 + }, + "end": { + "line": 46, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1401, + "end": 1405, + "loc": { + "start": { + "line": 46, + "column": 27 + }, + "end": { + "line": 46, + "column": 31 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 947, + "end": 1373, + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 45, + "column": 5 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1410, + "end": 1436, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 1410, + "end": 1435, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 1410, + "end": 1416, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1417, + "end": 1434, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 26 + } + }, + "left": { + "type": "Identifier", + "start": 1417, + "end": 1418, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1423, + "end": 1434, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 26 + } + }, + "object": { + "type": "MemberExpression", + "start": 1423, + "end": 1429, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 1423, + "end": 1424, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1425, + "end": 1429, + "loc": { + "start": { + "line": 47, + "column": 17 + }, + "end": { + "line": 47, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1430, + "end": 1434, + "loc": { + "start": { + "line": 47, + "column": 22 + }, + "end": { + "line": 47, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1439, + "end": 1472, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 35 + } + }, + "expression": { + "type": "CallExpression", + "start": 1439, + "end": 1471, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 34 + } + }, + "callee": { + "type": "Identifier", + "start": 1439, + "end": 1445, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1446, + "end": 1470, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 33 + } + }, + "left": { + "type": "MemberExpression", + "start": 1446, + "end": 1460, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 1446, + "end": 1453, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1446, + "end": 1447, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1448, + "end": 1453, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1454, + "end": 1460, + "loc": { + "start": { + "line": 48, + "column": 17 + }, + "end": { + "line": 48, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1465, + "end": 1470, + "loc": { + "start": { + "line": 48, + "column": 28 + }, + "end": { + "line": 48, + "column": 33 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1475, + "end": 1491, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1475, + "end": 1490, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1475, + "end": 1487, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 14 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1488, + "end": 1489, + "loc": { + "start": { + "line": 49, + "column": 15 + }, + "end": { + "line": 49, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 1500, + "end": 2029, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 67, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1910, + "end": 1942, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 1910, + "end": 1941, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 1910, + "end": 1916, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1917, + "end": 1940, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 1917, + "end": 1924, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1917, + "end": 1918, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1919, + "end": 1924, + "loc": { + "start": { + "line": 63, + "column": 11 + }, + "end": { + "line": 63, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1936, + "end": 1940, + "loc": { + "start": { + "line": 63, + "column": 28 + }, + "end": { + "line": 63, + "column": 32 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 1504, + "end": 1907, + "loc": { + "start": { + "line": 51, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1945, + "end": 1973, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 1945, + "end": 1972, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 1945, + "end": 1951, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1952, + "end": 1971, + "loc": { + "start": { + "line": 64, + "column": 9 + }, + "end": { + "line": 64, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 1952, + "end": 1953, + "loc": { + "start": { + "line": 64, + "column": 9 + }, + "end": { + "line": 64, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1958, + "end": 1971, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 28 + } + }, + "object": { + "type": "MemberExpression", + "start": 1958, + "end": 1965, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 1958, + "end": 1959, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1960, + "end": 1965, + "loc": { + "start": { + "line": 64, + "column": 17 + }, + "end": { + "line": 64, + "column": 22 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1966, + "end": 1971, + "loc": { + "start": { + "line": 64, + "column": 23 + }, + "end": { + "line": 64, + "column": 28 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1976, + "end": 2008, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 1976, + "end": 2007, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 1976, + "end": 1982, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1983, + "end": 2006, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 1983, + "end": 1996, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 1983, + "end": 1989, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1983, + "end": 1984, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1985, + "end": 1989, + "loc": { + "start": { + "line": 65, + "column": 11 + }, + "end": { + "line": 65, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1990, + "end": 1996, + "loc": { + "start": { + "line": 65, + "column": 16 + }, + "end": { + "line": 65, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 2001, + "end": 2006, + "loc": { + "start": { + "line": 65, + "column": 27 + }, + "end": { + "line": 65, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 2011, + "end": 2026, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2011, + "end": 2025, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2011, + "end": 2022, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 13 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2023, + "end": 2024, + "loc": { + "start": { + "line": 66, + "column": 14 + }, + "end": { + "line": 66, + "column": 15 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "start": 299, + "end": 578, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } } } - } - ] + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "start": 299, + "end": 578, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 824, + "end": 872, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 947, + "end": 1373, + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 45, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 1504, + "end": 1907, + "loc": { + "start": { + "line": 51, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 147, + "end": 158, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 159, + "end": 163, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_left.js", + "start": 164, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 190, + "end": 191, + "loc": { + "start": { + "line": 5, + "column": 50 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 192, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 199, + "end": 211, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 212, + "end": 216, + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_right.js", + "start": 217, + "end": 244, + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 52 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 244, + "end": 245, + "loc": { + "start": { + "line": 6, + "column": 52 + }, + "end": { + "line": 6, + "column": 53 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 246, + "end": 252, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 253, + "end": 264, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 265, + "end": 269, + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/grandparent.js", + "start": 270, + "end": 296, + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 296, + "end": 297, + "loc": { + "start": { + "line": 7, + "column": 50 + }, + "end": { + "line": 7, + "column": 51 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "start": 299, + "end": 578, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 579, + "end": 584, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case5", + "start": 585, + "end": 597, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 598, + "end": 599, + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 600, + "end": 601, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 601, + "end": 602, + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 602, + "end": 603, + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 604, + "end": 606, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 607, + "end": 608, + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 20, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 610, + "end": 616, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 616, + "end": 617, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 617, + "end": 618, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 619, + "end": 629, + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 630, + "end": 634, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 634, + "end": 635, + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 635, + "end": 636, + "loc": { + "start": { + "line": 21, + "column": 26 + }, + "end": { + "line": 21, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 638, + "end": 644, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 644, + "end": 645, + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 645, + "end": 646, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 646, + "end": 647, + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 22, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 647, + "end": 653, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 654, + "end": 657, + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 658, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 661, + "end": 662, + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 662, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 665, + "end": 671, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 671, + "end": 672, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 672, + "end": 673, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 673, + "end": 674, + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 674, + "end": 678, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 678, + "end": 679, + "loc": { + "start": { + "line": 23, + "column": 14 + }, + "end": { + "line": 23, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 679, + "end": 685, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 21 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 686, + "end": 689, + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 23, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 690, + "end": 695, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 31 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 695, + "end": 696, + "loc": { + "start": { + "line": 23, + "column": 31 + }, + "end": { + "line": 23, + "column": 32 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 696, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 32 + }, + "end": { + "line": 23, + "column": 33 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 699, + "end": 705, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 705, + "end": 706, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 706, + "end": 707, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 707, + "end": 708, + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 708, + "end": 713, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 713, + "end": 714, + "loc": { + "start": { + "line": 24, + "column": 15 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 714, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 22 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 721, + "end": 724, + "loc": { + "start": { + "line": 24, + "column": 23 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 725, + "end": 730, + "loc": { + "start": { + "line": 24, + "column": 27 + }, + "end": { + "line": 24, + "column": 32 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 730, + "end": 731, + "loc": { + "start": { + "line": 24, + "column": 32 + }, + "end": { + "line": 24, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 731, + "end": 732, + "loc": { + "start": { + "line": 24, + "column": 33 + }, + "end": { + "line": 24, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 734, + "end": 740, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 740, + "end": 741, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 741, + "end": 742, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 742, + "end": 743, + "loc": { + "start": { + "line": 25, + "column": 9 + }, + "end": { + "line": 25, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 743, + "end": 749, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 750, + "end": 753, + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 20 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 754, + "end": 758, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 758, + "end": 759, + "loc": { + "start": { + "line": 25, + "column": 25 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 762, + "end": 768, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 768, + "end": 769, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 769, + "end": 770, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 770, + "end": 771, + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 771, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 16 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 777, + "end": 778, + "loc": { + "start": { + "line": 26, + "column": 16 + }, + "end": { + "line": 26, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 778, + "end": 784, + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 23 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 785, + "end": 788, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 789, + "end": 792, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 31 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 792, + "end": 793, + "loc": { + "start": { + "line": 26, + "column": 31 + }, + "end": { + "line": 26, + "column": 32 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 793, + "end": 794, + "loc": { + "start": { + "line": 26, + "column": 32 + }, + "end": { + "line": 26, + "column": 33 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 796, + "end": 801, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "g", + "start": 802, + "end": 803, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 804, + "end": 805, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 806, + "end": 817, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 22 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 817, + "end": 818, + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 818, + "end": 819, + "loc": { + "start": { + "line": 27, + "column": 23 + }, + "end": { + "line": 27, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 819, + "end": 820, + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 820, + "end": 821, + "loc": { + "start": { + "line": 27, + "column": 25 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 824, + "end": 872, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 874, + "end": 875, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 875, + "end": 876, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 876, + "end": 882, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 882, + "end": 883, + "loc": { + "start": { + "line": 30, + "column": 9 + }, + "end": { + "line": 30, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 883, + "end": 889, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 16 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 890, + "end": 891, + "loc": { + "start": { + "line": 30, + "column": 17 + }, + "end": { + "line": 30, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 892, + "end": 897, + "loc": { + "start": { + "line": 30, + "column": 19 + }, + "end": { + "line": 30, + "column": 24 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 897, + "end": 898, + "loc": { + "start": { + "line": 30, + "column": 24 + }, + "end": { + "line": 30, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "g", + "start": 900, + "end": 901, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 901, + "end": 902, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 902, + "end": 908, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 9 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 909, + "end": 910, + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 11 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 163, - "end": 412, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 911, + "end": 914, + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 15 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 914, + "end": 915, + "loc": { + "start": { + "line": 31, + "column": 15 + }, + "end": { + "line": 31, + "column": 16 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 918, + "end": 920, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 921, + "end": 922, + "loc": { + "start": { + "line": 33, + "column": 4 + }, + "end": { + "line": 33, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 922, + "end": 923, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 6 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 924, + "end": 927, + "loc": { + "start": { + "line": 33, + "column": 7 + }, + "end": { + "line": 33, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 928, + "end": 929, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 929, + "end": 930, + "loc": { + "start": { + "line": 33, + "column": 12 + }, + "end": { + "line": 33, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 930, + "end": 936, + "loc": { + "start": { + "line": 33, + "column": 13 + }, + "end": { + "line": 33, + "column": 19 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 936, + "end": 937, + "loc": { + "start": { + "line": 33, + "column": 19 + }, + "end": { + "line": 33, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 937, + "end": 941, "loc": { "start": { - "line": 5, - "column": 0 + "line": 33, + "column": 20 }, "end": { - "line": 14, - "column": 3 + "line": 33, + "column": 24 } } }, { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 479, - "end": 527, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 941, + "end": 942, "loc": { "start": { - "line": 18, - "column": 1 + "line": 33, + "column": 24 }, "end": { - "line": 18, - "column": 49 + "line": 33, + "column": 25 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t ", - "start": 573, - "end": 988, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 943, + "end": 944, "loc": { "start": { - "line": 22, - "column": 1 + "line": 33, + "column": 26 }, "end": { "line": 33, - "column": 4 + "column": 27 } } }, { "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t ", - "start": 1033, - "end": 1425, + "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 947, + "end": 1373, "loc": { "start": { - "line": 35, - "column": 1 + "line": 34, + "column": 2 }, "end": { - "line": 46, - "column": 4 + "line": 45, + "column": 5 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1371,26 +9445,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "assert", + "start": 1376, + "end": 1382, "loc": { "start": { - "line": 1, - "column": 0 + "line": 46, + "column": 2 }, "end": { - "line": 1, - "column": 6 + "line": 46, + "column": 8 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1400,16 +9473,16 @@ "postfix": false, "binop": null }, - "start": 7, - "end": 8, + "start": 1382, + "end": 1383, "loc": { "start": { - "line": 1, - "column": 7 + "line": 46, + "column": 8 }, "end": { - "line": 1, - "column": 8 + "line": 46, + "column": 9 } } }, @@ -1425,24 +9498,24 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "g", + "start": 1383, + "end": 1384, "loc": { "start": { - "line": 1, - "column": 8 + "line": 46, + "column": 9 }, "end": { - "line": 1, - "column": 13 + "line": 46, + "column": 10 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1452,16 +9525,16 @@ "binop": null, "updateContext": null }, - "start": 13, - "end": 14, + "start": 1384, + "end": 1385, "loc": { "start": { - "line": 1, - "column": 13 + "line": 46, + "column": 10 }, "end": { - "line": 1, - "column": 14 + "line": 46, + "column": 11 } } }, @@ -1477,42 +9550,45 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 15, - "end": 18, + "value": "left", + "start": 1385, + "end": 1389, "loc": { "start": { - "line": 1, - "column": 15 + "line": 46, + "column": 11 }, "end": { - "line": 1, - "column": 18 + "line": 46, + "column": 15 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 18, - "end": 19, + "value": "instanceof", + "start": 1390, + "end": 1400, "loc": { "start": { - "line": 1, - "column": 18 + "line": 46, + "column": 16 }, "end": { - "line": 1, - "column": 19 + "line": 46, + "column": 26 } } }, @@ -1528,44 +9604,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 20, - "end": 24, + "value": "Node", + "start": 1401, + "end": 1405, "loc": { "start": { - "line": 1, - "column": 20 + "line": 46, + "column": 27 }, "end": { - "line": 1, - "column": 24 + "line": 46, + "column": 31 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/index.js", - "start": 25, - "end": 44, + "start": 1405, + "end": 1406, "loc": { "start": { - "line": 1, - "column": 25 + "line": 46, + "column": 31 }, "end": { - "line": 1, - "column": 44 + "line": 46, + "column": 32 } } }, @@ -1582,23 +9656,22 @@ "binop": null, "updateContext": null }, - "start": 44, - "end": 45, + "start": 1406, + "end": 1407, "loc": { "start": { - "line": 1, - "column": 44 + "line": 46, + "column": 32 }, "end": { - "line": 1, - "column": 45 + "line": 46, + "column": 33 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1606,26 +9679,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 46, - "end": 52, + "value": "assert", + "start": 1410, + "end": 1416, "loc": { "start": { - "line": 2, - "column": 0 + "line": 47, + "column": 2 }, "end": { - "line": 2, - "column": 6 + "line": 47, + "column": 8 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1635,16 +9707,16 @@ "postfix": false, "binop": null }, - "start": 53, - "end": 54, + "start": 1416, + "end": 1417, "loc": { "start": { - "line": 2, - "column": 7 + "line": 47, + "column": 8 }, "end": { - "line": 2, - "column": 8 + "line": 47, + "column": 9 } } }, @@ -1660,23 +9732,23 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 54, - "end": 65, + "value": "n", + "start": 1417, + "end": 1418, "loc": { "start": { - "line": 2, - "column": 8 + "line": 47, + "column": 9 }, "end": { - "line": 2, - "column": 19 + "line": 47, + "column": 10 } } }, { "type": { - "label": ",", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1684,19 +9756,72 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 1419, + "end": 1422, + "loc": { + "start": { + "line": 47, + "column": 11 + }, + "end": { + "line": 47, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "g", + "start": 1423, + "end": 1424, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "start": 65, - "end": 66, + "start": 1424, + "end": 1425, "loc": { "start": { - "line": 2, - "column": 19 + "line": 47, + "column": 16 }, "end": { - "line": 2, - "column": 20 + "line": 47, + "column": 17 } } }, @@ -1712,23 +9837,23 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 67, - "end": 79, + "value": "left", + "start": 1425, + "end": 1429, "loc": { "start": { - "line": 2, - "column": 21 + "line": 47, + "column": 17 }, "end": { - "line": 2, - "column": 33 + "line": 47, + "column": 21 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1736,18 +9861,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 79, - "end": 80, + "start": 1429, + "end": 1430, "loc": { "start": { - "line": 2, - "column": 33 + "line": 47, + "column": 21 }, "end": { - "line": 2, - "column": 34 + "line": 47, + "column": 22 } } }, @@ -1763,44 +9889,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 81, - "end": 85, + "value": "left", + "start": 1430, + "end": 1434, "loc": { "start": { - "line": 2, - "column": 35 + "line": 47, + "column": 22 }, "end": { - "line": 2, - "column": 39 + "line": 47, + "column": 26 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../rotate/index.js", - "start": 86, - "end": 106, + "start": 1434, + "end": 1435, "loc": { "start": { - "line": 2, - "column": 40 + "line": 47, + "column": 26 }, "end": { - "line": 2, - "column": 60 + "line": 47, + "column": 27 } } }, @@ -1817,23 +9941,22 @@ "binop": null, "updateContext": null }, - "start": 106, - "end": 107, + "start": 1435, + "end": 1436, "loc": { "start": { - "line": 2, - "column": 60 + "line": 47, + "column": 27 }, "end": { - "line": 2, - "column": 61 + "line": 47, + "column": 28 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1841,26 +9964,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 108, - "end": 114, + "value": "assert", + "start": 1439, + "end": 1445, "loc": { "start": { - "line": 3, - "column": 0 + "line": 48, + "column": 2 }, "end": { - "line": 3, - "column": 6 + "line": 48, + "column": 8 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -1870,16 +9992,16 @@ "postfix": false, "binop": null }, - "start": 115, - "end": 116, + "start": 1445, + "end": 1446, "loc": { "start": { - "line": 3, - "column": 7 + "line": 48, + "column": 8 }, "end": { - "line": 3, - "column": 8 + "line": 48, + "column": 9 } } }, @@ -1895,23 +10017,23 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 116, - "end": 127, + "value": "g", + "start": 1446, + "end": 1447, "loc": { "start": { - "line": 3, - "column": 8 + "line": 48, + "column": 9 }, "end": { - "line": 3, - "column": 19 + "line": 48, + "column": 10 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1919,18 +10041,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 127, - "end": 128, + "start": 1447, + "end": 1448, "loc": { "start": { - "line": 3, - "column": 19 + "line": 48, + "column": 10 }, "end": { - "line": 3, - "column": 20 + "line": 48, + "column": 11 } } }, @@ -1946,25 +10069,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 129, - "end": 133, + "value": "right", + "start": 1448, + "end": 1453, "loc": { "start": { - "line": 3, - "column": 21 + "line": 48, + "column": 11 }, "end": { - "line": 3, - "column": 25 + "line": 48, + "column": 16 } } }, { "type": { - "label": "string", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1973,94 +10096,101 @@ "binop": null, "updateContext": null }, - "value": "../family/grandparent.js", - "start": 134, - "end": 160, + "start": 1453, + "end": 1454, "loc": { "start": { - "line": 3, - "column": 26 + "line": 48, + "column": 16 }, "end": { - "line": 3, - "column": 52 + "line": 48, + "column": 17 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 160, - "end": 161, + "value": "_color", + "start": 1454, + "end": 1460, "loc": { "start": { - "line": 3, - "column": 52 + "line": 48, + "column": 17 }, "end": { - "line": 3, - "column": 53 + "line": 48, + "column": 23 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 163, - "end": 412, + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 1461, + "end": 1464, "loc": { "start": { - "line": 5, - "column": 0 + "line": 48, + "column": 24 }, "end": { - "line": 14, - "column": 3 + "line": 48, + "column": 27 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 413, - "end": 419, + "value": "BLACK", + "start": 1465, + "end": 1470, "loc": { "start": { - "line": 15, - "column": 0 + "line": 48, + "column": 28 }, "end": { - "line": 15, - "column": 6 + "line": 48, + "column": 33 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2068,73 +10198,70 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 420, - "end": 425, + "start": 1470, + "end": 1471, "loc": { "start": { - "line": 15, - "column": 7 + "line": 48, + "column": 33 }, "end": { - "line": 15, - "column": 12 + "line": 48, + "column": 34 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "insert_case5", - "start": 426, - "end": 438, + "start": 1471, + "end": 1472, "loc": { "start": { - "line": 15, - "column": 13 + "line": 48, + "column": 34 }, "end": { - "line": 15, - "column": 25 + "line": 48, + "column": 35 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 439, - "end": 440, + "value": "rotate_right", + "start": 1475, + "end": 1487, "loc": { "start": { - "line": 15, - "column": 26 + "line": 49, + "column": 2 }, "end": { - "line": 15, - "column": 27 + "line": 49, + "column": 14 } } }, @@ -2150,16 +10277,16 @@ "postfix": false, "binop": null }, - "start": 441, - "end": 442, + "start": 1487, + "end": 1488, "loc": { "start": { - "line": 15, - "column": 28 + "line": 49, + "column": 14 }, "end": { - "line": 15, - "column": 29 + "line": 49, + "column": 15 } } }, @@ -2175,17 +10302,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 442, - "end": 443, + "value": "g", + "start": 1488, + "end": 1489, "loc": { "start": { - "line": 15, - "column": 29 + "line": 49, + "column": 15 }, "end": { - "line": 15, - "column": 30 + "line": 49, + "column": 16 } } }, @@ -2201,22 +10328,22 @@ "postfix": false, "binop": null }, - "start": 443, - "end": 444, + "start": 1489, + "end": 1490, "loc": { "start": { - "line": 15, - "column": 30 + "line": 49, + "column": 16 }, "end": { - "line": 15, - "column": 31 + "line": 49, + "column": 17 } } }, { "type": { - "label": "=>", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2227,24 +10354,24 @@ "binop": null, "updateContext": null }, - "start": 445, - "end": 447, + "start": 1490, + "end": 1491, "loc": { "start": { - "line": 15, - "column": 32 + "line": 49, + "column": 17 }, "end": { - "line": 15, - "column": 34 + "line": 49, + "column": 18 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2252,24 +10379,24 @@ "postfix": false, "binop": null }, - "start": 448, - "end": 449, + "start": 1493, + "end": 1494, "loc": { "start": { - "line": 15, - "column": 35 + "line": 50, + "column": 1 }, "end": { - "line": 15, - "column": 36 + "line": 50, + "column": 2 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": "else", + "keyword": "else", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2279,24 +10406,24 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 451, - "end": 456, + "value": "else", + "start": 1495, + "end": 1499, "loc": { "start": { - "line": 16, - "column": 1 + "line": 50, + "column": 3 }, "end": { - "line": 16, - "column": 6 + "line": 50, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2305,44 +10432,32 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 457, - "end": 458, + "start": 1500, + "end": 1501, "loc": { "start": { - "line": 16, - "column": 7 + "line": 50, + "column": 8 }, "end": { - "line": 16, - "column": 8 + "line": 50, + "column": 9 } } }, { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 459, - "end": 460, + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 1504, + "end": 1907, "loc": { "start": { - "line": 16, - "column": 9 + "line": 51, + "column": 2 }, "end": { - "line": 16, - "column": 10 + "line": 62, + "column": 5 } } }, @@ -2358,17 +10473,17 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 461, - "end": 472, + "value": "assert", + "start": 1910, + "end": 1916, "loc": { "start": { - "line": 16, - "column": 11 + "line": 63, + "column": 2 }, "end": { - "line": 16, - "column": 22 + "line": 63, + "column": 8 } } }, @@ -2384,16 +10499,16 @@ "postfix": false, "binop": null }, - "start": 472, - "end": 473, + "start": 1916, + "end": 1917, "loc": { "start": { - "line": 16, - "column": 22 + "line": 63, + "column": 8 }, "end": { - "line": 16, - "column": 23 + "line": 63, + "column": 9 } } }, @@ -2409,23 +10524,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 473, - "end": 474, + "value": "g", + "start": 1917, + "end": 1918, "loc": { "start": { - "line": 16, - "column": 23 + "line": 63, + "column": 9 }, "end": { - "line": 16, - "column": 24 + "line": 63, + "column": 10 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2433,120 +10548,107 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 474, - "end": 475, + "start": 1918, + "end": 1919, "loc": { "start": { - "line": 16, - "column": 24 + "line": 63, + "column": 10 }, "end": { - "line": 16, - "column": 25 + "line": 63, + "column": 11 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 475, - "end": 476, - "loc": { - "start": { - "line": 16, - "column": 25 - }, - "end": { - "line": 16, - "column": 26 - } - } - }, - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 479, - "end": 527, + "value": "right", + "start": 1919, + "end": 1924, "loc": { "start": { - "line": 18, - "column": 1 + "line": 63, + "column": 11 }, "end": { - "line": 18, - "column": 49 + "line": 63, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "value": "n", - "start": 529, - "end": 530, + "value": "instanceof", + "start": 1925, + "end": 1935, "loc": { "start": { - "line": 19, - "column": 1 + "line": 63, + "column": 17 }, "end": { - "line": 19, - "column": 2 + "line": 63, + "column": 27 } } }, { "type": { - "label": ".", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 530, - "end": 531, + "value": "Node", + "start": 1936, + "end": 1940, "loc": { "start": { - "line": 19, - "column": 2 + "line": 63, + "column": 28 }, "end": { - "line": 19, - "column": 3 + "line": 63, + "column": 32 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2554,24 +10656,23 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 531, - "end": 537, + "start": 1940, + "end": 1941, "loc": { "start": { - "line": 19, - "column": 3 + "line": 63, + "column": 32 }, "end": { - "line": 19, - "column": 9 + "line": 63, + "column": 33 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2581,16 +10682,16 @@ "binop": null, "updateContext": null }, - "start": 537, - "end": 538, + "start": 1941, + "end": 1942, "loc": { "start": { - "line": 19, - "column": 9 + "line": 63, + "column": 33 }, "end": { - "line": 19, - "column": 10 + "line": 63, + "column": 34 } } }, @@ -2606,44 +10707,42 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 538, - "end": 544, + "value": "assert", + "start": 1945, + "end": 1951, "loc": { "start": { - "line": 19, - "column": 10 + "line": 64, + "column": 2 }, "end": { - "line": 19, - "column": 16 + "line": 64, + "column": 8 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 545, - "end": 546, + "start": 1951, + "end": 1952, "loc": { "start": { - "line": 19, - "column": 17 + "line": 64, + "column": 8 }, "end": { - "line": 19, - "column": 18 + "line": 64, + "column": 9 } } }, @@ -2659,23 +10758,23 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 547, - "end": 552, + "value": "n", + "start": 1952, + "end": 1953, "loc": { "start": { - "line": 19, - "column": 19 + "line": 64, + "column": 9 }, "end": { - "line": 19, - "column": 24 + "line": 64, + "column": 10 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2683,19 +10782,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 552, - "end": 553, + "value": "===", + "start": 1954, + "end": 1957, "loc": { "start": { - "line": 19, - "column": 24 + "line": 64, + "column": 11 }, "end": { - "line": 19, - "column": 25 + "line": 64, + "column": 14 } } }, @@ -2712,16 +10812,16 @@ "binop": null }, "value": "g", - "start": 555, - "end": 556, + "start": 1958, + "end": 1959, "loc": { "start": { - "line": 20, - "column": 1 + "line": 64, + "column": 15 }, "end": { - "line": 20, - "column": 2 + "line": 64, + "column": 16 } } }, @@ -2738,16 +10838,16 @@ "binop": null, "updateContext": null }, - "start": 556, - "end": 557, + "start": 1959, + "end": 1960, "loc": { "start": { - "line": 20, - "column": 2 + "line": 64, + "column": 16 }, "end": { - "line": 20, - "column": 3 + "line": 64, + "column": 17 } } }, @@ -2763,44 +10863,43 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 557, - "end": 563, + "value": "right", + "start": 1960, + "end": 1965, "loc": { "start": { - "line": 20, - "column": 3 + "line": 64, + "column": 17 }, "end": { - "line": 20, - "column": 9 + "line": 64, + "column": 22 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 564, - "end": 565, + "start": 1965, + "end": 1966, "loc": { "start": { - "line": 20, - "column": 10 + "line": 64, + "column": 22 }, "end": { - "line": 20, - "column": 11 + "line": 64, + "column": 23 } } }, @@ -2816,87 +10915,94 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 566, - "end": 569, + "value": "right", + "start": 1966, + "end": 1971, "loc": { "start": { - "line": 20, - "column": 12 + "line": 64, + "column": 23 }, "end": { - "line": 20, - "column": 15 + "line": 64, + "column": 28 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 569, - "end": 570, + "start": 1971, + "end": 1972, "loc": { "start": { - "line": 20, - "column": 15 + "line": 64, + "column": 28 }, "end": { - "line": 20, - "column": 16 + "line": 64, + "column": 29 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t ", - "start": 573, - "end": 988, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1972, + "end": 1973, "loc": { "start": { - "line": 22, - "column": 1 + "line": 64, + "column": 29 }, "end": { - "line": 33, - "column": 4 + "line": 64, + "column": 30 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 990, - "end": 992, + "value": "assert", + "start": 1976, + "end": 1982, "loc": { "start": { - "line": 34, - "column": 1 + "line": 65, + "column": 2 }, "end": { - "line": 34, - "column": 3 + "line": 65, + "column": 8 } } }, @@ -2912,16 +11018,16 @@ "postfix": false, "binop": null }, - "start": 993, - "end": 994, + "start": 1982, + "end": 1983, "loc": { "start": { - "line": 34, - "column": 4 + "line": 65, + "column": 8 }, "end": { - "line": 34, - "column": 5 + "line": 65, + "column": 9 } } }, @@ -2937,44 +11043,43 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 994, - "end": 995, + "value": "g", + "start": 1983, + "end": 1984, "loc": { "start": { - "line": 34, - "column": 5 + "line": 65, + "column": 9 }, "end": { - "line": 34, - "column": 6 + "line": 65, + "column": 10 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 996, - "end": 999, + "start": 1984, + "end": 1985, "loc": { "start": { - "line": 34, - "column": 7 + "line": 65, + "column": 10 }, "end": { - "line": 34, - "column": 10 + "line": 65, + "column": 11 } } }, @@ -2990,17 +11095,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1000, - "end": 1001, + "value": "left", + "start": 1985, + "end": 1989, "loc": { "start": { - "line": 34, + "line": 65, "column": 11 }, "end": { - "line": 34, - "column": 12 + "line": 65, + "column": 15 } } }, @@ -3017,16 +11122,16 @@ "binop": null, "updateContext": null }, - "start": 1001, - "end": 1002, + "start": 1989, + "end": 1990, "loc": { "start": { - "line": 34, - "column": 12 + "line": 65, + "column": 15 }, "end": { - "line": 34, - "column": 13 + "line": 65, + "column": 16 } } }, @@ -3042,43 +11147,44 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1002, - "end": 1008, + "value": "_color", + "start": 1990, + "end": 1996, "loc": { "start": { - "line": 34, - "column": 13 + "line": 65, + "column": 16 }, "end": { - "line": 34, - "column": 19 + "line": 65, + "column": 22 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1008, - "end": 1009, + "value": "===", + "start": 1997, + "end": 2000, "loc": { "start": { - "line": 34, - "column": 19 + "line": 65, + "column": 23 }, "end": { - "line": 34, - "column": 20 + "line": 65, + "column": 26 } } }, @@ -3094,17 +11200,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1009, - "end": 1013, + "value": "BLACK", + "start": 2001, + "end": 2006, "loc": { "start": { - "line": 34, - "column": 20 + "line": 65, + "column": 27 }, "end": { - "line": 34, - "column": 24 + "line": 65, + "column": 32 } } }, @@ -3120,49 +11226,49 @@ "postfix": false, "binop": null }, - "start": 1013, - "end": 1014, + "start": 2006, + "end": 2007, "loc": { "start": { - "line": 34, - "column": 24 + "line": 65, + "column": 32 }, "end": { - "line": 34, - "column": 25 + "line": 65, + "column": 33 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "rotate_right", - "start": 1015, - "end": 1027, + "start": 2007, + "end": 2008, "loc": { "start": { - "line": 34, - "column": 26 + "line": 65, + "column": 33 }, "end": { - "line": 34, - "column": 38 + "line": 65, + "column": 34 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3171,23 +11277,24 @@ "postfix": false, "binop": null }, - "start": 1027, - "end": 1028, + "value": "rotate_left", + "start": 2011, + "end": 2022, "loc": { "start": { - "line": 34, - "column": 38 + "line": 66, + "column": 2 }, "end": { - "line": 34, - "column": 39 + "line": 66, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3196,25 +11303,24 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 1028, - "end": 1029, + "start": 2022, + "end": 2023, "loc": { "start": { - "line": 34, - "column": 39 + "line": 66, + "column": 13 }, "end": { - "line": 34, - "column": 40 + "line": 66, + "column": 14 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3222,65 +11328,48 @@ "postfix": false, "binop": null }, - "start": 1029, - "end": 1030, + "value": "g", + "start": 2023, + "end": 2024, "loc": { "start": { - "line": 34, - "column": 40 + "line": 66, + "column": 14 }, "end": { - "line": 34, - "column": 41 + "line": 66, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1030, - "end": 1031, + "start": 2024, + "end": 2025, "loc": { "start": { - "line": 34, - "column": 41 - }, - "end": { - "line": 34, - "column": 42 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t ", - "start": 1033, - "end": 1425, - "loc": { - "start": { - "line": 35, - "column": 1 + "line": 66, + "column": 15 }, "end": { - "line": 46, - "column": 4 + "line": 66, + "column": 16 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3291,25 +11380,24 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1426, - "end": 1430, + "start": 2025, + "end": 2026, "loc": { "start": { - "line": 46, - "column": 5 + "line": 66, + "column": 16 }, "end": { - "line": 46, - "column": 9 + "line": 66, + "column": 17 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3317,25 +11405,24 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 1431, - "end": 1442, + "start": 2028, + "end": 2029, "loc": { "start": { - "line": 46, - "column": 10 + "line": 67, + "column": 1 }, "end": { - "line": 46, - "column": 21 + "line": 67, + "column": 2 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3343,48 +11430,49 @@ "postfix": false, "binop": null }, - "start": 1442, - "end": 1443, + "start": 2030, + "end": 2031, "loc": { "start": { - "line": 46, - "column": 21 + "line": 68, + "column": 0 }, "end": { - "line": 46, - "column": 22 + "line": 68, + "column": 1 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "g", - "start": 1443, - "end": 1444, + "start": 2031, + "end": 2032, "loc": { "start": { - "line": 46, - "column": 22 + "line": 68, + "column": 1 }, "end": { - "line": 46, - "column": 23 + "line": 68, + "column": 2 } } }, { "type": { - "label": ")", + "label": "export", + "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3392,24 +11480,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1444, - "end": 1445, + "value": "export", + "start": 2034, + "end": 2040, "loc": { "start": { - "line": 46, - "column": 23 + "line": 70, + "column": 0 }, "end": { - "line": 46, - "column": 24 + "line": 70, + "column": 6 } } }, { "type": { - "label": ";", + "label": "default", + "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3420,24 +11511,25 @@ "binop": null, "updateContext": null }, - "start": 1445, - "end": 1446, + "value": "default", + "start": 2041, + "end": 2048, "loc": { "start": { - "line": 46, - "column": 24 + "line": 70, + "column": 7 }, "end": { - "line": 46, - "column": 25 + "line": 70, + "column": 14 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3445,16 +11537,17 @@ "postfix": false, "binop": null }, - "start": 1447, - "end": 1448, + "value": "insert_case5", + "start": 2049, + "end": 2061, "loc": { "start": { - "line": 47, - "column": 0 + "line": 70, + "column": 15 }, "end": { - "line": 47, - "column": 1 + "line": 70, + "column": 27 } } }, @@ -3471,16 +11564,16 @@ "binop": null, "updateContext": null }, - "start": 1448, - "end": 1449, + "start": 2061, + "end": 2062, "loc": { "start": { - "line": 47, - "column": 1 + "line": 70, + "column": 27 }, "end": { - "line": 47, - "column": 2 + "line": 70, + "column": 28 } } }, @@ -3497,15 +11590,15 @@ "binop": null, "updateContext": null }, - "start": 1450, - "end": 1450, + "start": 2063, + "end": 2063, "loc": { "start": { - "line": 48, + "line": 71, "column": 0 }, "end": { - "line": 48, + "line": 71, "column": 0 } } diff --git a/ast/source/rotate/index.js.json b/ast/source/rotate/index.js.json deleted file mode 100644 index 2851073..0000000 --- a/ast/source/rotate/index.js.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 69, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 33 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - }, - "extra": { - "rawValue": "./rotate_left.js", - "raw": "'./rotate_left.js'" - }, - "value": "./rotate_left.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 34, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 34 - } - }, - "source": { - "type": "StringLiteral", - "start": 48, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 33 - } - }, - "extra": { - "rawValue": "./rotate_right.js", - "raw": "'./rotate_right.js'" - }, - "value": "./rotate_right.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./rotate_left.js", - "start": 14, - "end": 32, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 32 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 32, - "end": 33, - "loc": { - "start": { - "line": 1, - "column": 32 - }, - "end": { - "line": 1, - "column": 33 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 34, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 41, - "end": 42, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 43, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./rotate_right.js", - "start": 48, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 67, - "end": 68, - "loc": { - "start": { - "line": 2, - "column": 33 - }, - "end": { - "line": 2, - "column": 34 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 69, - "end": 69, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/rotate/rotate_left.js.json b/ast/source/rotate/rotate_left.js.json index 4908de3..643ff58 100644 --- a/ast/source/rotate/rotate_left.js.json +++ b/ast/source/rotate/rotate_left.js.json @@ -1,1295 +1,1169 @@ { "type": "File", "start": 0, - "end": 632, + "end": 777, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 35, + "line": 42, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 632, + "end": 777, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 35, + "line": 42, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 332, - "end": 631, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 16, + "line": 1, "column": 0 }, "end": { - "line": 34, - "column": 2 + "line": 1, + "column": 28 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 339, - "end": 631, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, "loc": { "start": { - "line": 16, - "column": 7 + "line": 1, + "column": 19 }, "end": { - "line": 34, - "column": 2 + "line": 1, + "column": 27 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 345, - "end": 630, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, "loc": { "start": { - "line": 16, - "column": 13 + "line": 2, + "column": 7 }, "end": { - "line": 34, - "column": 1 - } + "line": 2, + "column": 11 + }, + "identifierName": "Node" }, - "id": { - "type": "Identifier", - "start": 345, - "end": 356, - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 16, - "column": 24 - }, - "identifierName": "rotate_left" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "start": 67, + "end": 397, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 399, + "end": 747, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 39, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 405, + "end": 746, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 39, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 405, + "end": 416, + "loc": { + "start": { + "line": 19, + "column": 6 }, - "name": "rotate_left", - "leadingComments": null + "end": { + "line": 19, + "column": 17 + }, + "identifierName": "rotate_left" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 359, - "end": 630, - "loc": { - "start": { - "line": 16, - "column": 27 - }, - "end": { - "line": 34, - "column": 1 - } + "name": "rotate_left", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 419, + "end": 746, + "loc": { + "start": { + "line": 19, + "column": 20 }, - "id": { + "end": { + "line": 39, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 345, - "end": 356, + "start": 420, + "end": 421, "loc": { "start": { - "line": 16, - "column": 13 + "line": 19, + "column": 21 }, "end": { - "line": 16, - "column": 24 + "line": 19, + "column": 22 }, - "identifierName": "rotate_left" + "identifierName": "A" }, - "name": "rotate_left", - "leadingComments": null + "name": "A" + } + ], + "body": { + "type": "BlockStatement", + "start": 426, + "end": 746, + "loc": { + "start": { + "line": 19, + "column": 27 + }, + "end": { + "line": 39, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 360, - "end": 361, + "type": "ExpressionStatement", + "start": 429, + "end": 455, "loc": { "start": { - "line": 16, - "column": 28 + "line": 20, + "column": 1 }, "end": { - "line": 16, - "column": 29 - }, - "identifierName": "A" - }, - "name": "A" - } - ], - "body": { - "type": "BlockStatement", - "start": 366, - "end": 630, - "loc": { - "start": { - "line": 16, - "column": 34 + "line": 20, + "column": 27 + } }, - "end": { - "line": 34, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 369, - "end": 387, + "expression": { + "type": "CallExpression", + "start": 429, + "end": 454, "loc": { "start": { - "line": 17, + "line": 20, "column": 1 }, "end": { - "line": 17, - "column": 19 + "line": 20, + "column": 26 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 429, + "end": 435, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 375, - "end": 386, + "type": "BinaryExpression", + "start": 436, + "end": 453, "loc": { "start": { - "line": 17, - "column": 7 + "line": 20, + "column": 8 }, "end": { - "line": 17, - "column": 18 + "line": 20, + "column": 25 } }, - "id": { + "left": { "type": "Identifier", - "start": 375, - "end": 376, + "start": 436, + "end": 437, "loc": { "start": { - "line": 17, - "column": 7 + "line": 20, + "column": 8 }, "end": { - "line": 17, - "column": 8 + "line": 20, + "column": 9 }, - "identifierName": "B" + "identifierName": "A" }, - "name": "B" + "name": "A" }, - "init": { - "type": "MemberExpression", - "start": 379, - "end": 386, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 449, + "end": 453, "loc": { "start": { - "line": 17, - "column": 11 + "line": 20, + "column": 21 }, "end": { - "line": 17, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 379, - "end": 380, - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 12 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 381, - "end": 386, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 18 - }, - "identifierName": "right" + "line": 20, + "column": 25 }, - "name": "right" + "identifierName": "Node" }, - "computed": false + "name": "Node" } } - ], - "kind": "const" + ] + } + }, + { + "type": "VariableDeclaration", + "start": 457, + "end": 475, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 19 + } }, - { - "type": "VariableDeclaration", - "start": 389, - "end": 406, - "loc": { - "start": { - "line": 18, - "column": 1 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 463, + "end": 474, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 18 + } }, - "end": { - "line": 18, - "column": 18 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 395, - "end": 405, + "id": { + "type": "Identifier", + "start": 463, + "end": 464, "loc": { "start": { - "line": 18, + "line": 21, "column": 7 }, "end": { - "line": 18, - "column": 17 - } + "line": 21, + "column": 8 + }, + "identifierName": "B" }, - "id": { - "type": "Identifier", - "start": 395, - "end": 396, - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 8 - }, - "identifierName": "a" + "name": "B" + }, + "init": { + "type": "MemberExpression", + "start": 467, + "end": 474, + "loc": { + "start": { + "line": 21, + "column": 11 }, - "name": "a" + "end": { + "line": 21, + "column": 18 + } }, - "init": { - "type": "MemberExpression", - "start": 399, - "end": 405, + "object": { + "type": "Identifier", + "start": 467, + "end": 468, "loc": { "start": { - "line": 18, + "line": 21, "column": 11 }, "end": { - "line": 18, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 399, - "end": 400, - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 12 - }, - "identifierName": "A" + "line": 21, + "column": 12 }, - "name": "A" + "identifierName": "A" }, - "property": { - "type": "Identifier", - "start": 401, - "end": 405, - "loc": { - "start": { - "line": 18, - "column": 13 - }, - "end": { - "line": 18, - "column": 17 - }, - "identifierName": "left" + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 469, + "end": 474, + "loc": { + "start": { + "line": 21, + "column": 13 }, - "name": "left" + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "right" }, - "computed": false - } + "name": "right" + }, + "computed": false } - ], - "kind": "const" + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 477, + "end": 503, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 27 + } }, - { - "type": "VariableDeclaration", - "start": 408, - "end": 425, + "expression": { + "type": "CallExpression", + "start": 477, + "end": 502, "loc": { "start": { - "line": 19, + "line": 22, "column": 1 }, "end": { - "line": 19, - "column": 18 + "line": 22, + "column": 26 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 477, + "end": 483, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 414, - "end": 424, + "type": "BinaryExpression", + "start": 484, + "end": 501, "loc": { "start": { - "line": 19, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 19, - "column": 17 + "line": 22, + "column": 25 } }, - "id": { + "left": { "type": "Identifier", - "start": 414, - "end": 415, + "start": 484, + "end": 485, "loc": { "start": { - "line": 19, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 19, - "column": 8 + "line": 22, + "column": 9 }, - "identifierName": "b" + "identifierName": "B" }, - "name": "b" + "name": "B" }, - "init": { - "type": "MemberExpression", - "start": 418, - "end": 424, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 497, + "end": 501, "loc": { "start": { - "line": 19, - "column": 11 + "line": 22, + "column": 21 }, "end": { - "line": 19, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 418, - "end": 419, - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 19, - "column": 12 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 420, - "end": 424, - "loc": { - "start": { - "line": 19, - "column": 13 - }, - "end": { - "line": 19, - "column": 17 - }, - "identifierName": "left" + "line": 22, + "column": 25 }, - "name": "left" + "identifierName": "Node" }, - "computed": false + "name": "Node" } } - ], - "kind": "const" + ] + } + }, + { + "type": "VariableDeclaration", + "start": 505, + "end": 522, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 18 + } }, - { - "type": "VariableDeclaration", - "start": 427, - "end": 445, - "loc": { - "start": { - "line": 20, - "column": 1 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 511, + "end": 521, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 17 + } }, - "end": { - "line": 20, - "column": 19 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 433, - "end": 444, + "id": { + "type": "Identifier", + "start": 511, + "end": 512, "loc": { "start": { - "line": 20, + "line": 23, "column": 7 }, "end": { - "line": 20, - "column": 18 + "line": 23, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "MemberExpression", + "start": 515, + "end": 521, + "loc": { + "start": { + "line": 23, + "column": 11 + }, + "end": { + "line": 23, + "column": 17 } }, - "id": { + "object": { "type": "Identifier", - "start": 433, - "end": 434, + "start": 515, + "end": 516, "loc": { "start": { - "line": 20, - "column": 7 + "line": 23, + "column": 11 }, "end": { - "line": 20, - "column": 8 + "line": 23, + "column": 12 }, - "identifierName": "c" + "identifierName": "A" }, - "name": "c" + "name": "A" }, - "init": { - "type": "MemberExpression", - "start": 437, - "end": 444, + "property": { + "type": "Identifier", + "start": 517, + "end": 521, "loc": { "start": { - "line": 20, - "column": 11 + "line": 23, + "column": 13 }, "end": { - "line": 20, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 437, - "end": 438, - "loc": { - "start": { - "line": 20, - "column": 11 - }, - "end": { - "line": 20, - "column": 12 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 439, - "end": 444, - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 20, - "column": 18 - }, - "identifierName": "right" + "line": 23, + "column": 17 }, - "name": "right" + "identifierName": "left" }, - "computed": false - } + "name": "left" + }, + "computed": false } - ], - "kind": "const" + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 524, + "end": 541, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 18 + } }, - { - "type": "ExpressionStatement", - "start": 448, - "end": 480, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 33 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 448, - "end": 479, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 530, + "end": 540, "loc": { "start": { - "line": 22, - "column": 1 + "line": 24, + "column": 7 }, "end": { - "line": 22, - "column": 32 + "line": 24, + "column": 17 } }, - "operator": "=", - "left": { - "type": "ArrayPattern", - "start": 448, - "end": 462, + "id": { + "type": "Identifier", + "start": 530, + "end": 531, "loc": { "start": { - "line": 22, - "column": 1 + "line": 24, + "column": 7 }, "end": { - "line": 22, - "column": 15 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 449, - "end": 454, - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 449, - "end": 450, - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 451, - "end": 454, - "loc": { - "start": { - "line": 22, - "column": 4 - }, - "end": { - "line": 22, - "column": 7 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false + "line": 24, + "column": 8 }, - { - "type": "MemberExpression", - "start": 456, - "end": 461, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 456, - "end": 457, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 10 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 458, - "end": 461, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 14 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - } - ] + "identifierName": "b" + }, + "name": "b" }, - "right": { - "type": "ArrayExpression", - "start": 465, - "end": 479, + "init": { + "type": "MemberExpression", + "start": 534, + "end": 540, "loc": { "start": { - "line": 22, - "column": 18 + "line": 24, + "column": 11 }, "end": { - "line": 22, - "column": 32 + "line": 24, + "column": 17 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 466, - "end": 471, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 24 - } - }, - "object": { - "type": "Identifier", - "start": 466, - "end": 467, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 20 - }, - "identifierName": "B" - }, - "name": "B" + "object": { + "type": "Identifier", + "start": 534, + "end": 535, + "loc": { + "start": { + "line": 24, + "column": 11 }, - "property": { - "type": "Identifier", - "start": 468, - "end": 471, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 24 - }, - "identifierName": "key" - }, - "name": "key" + "end": { + "line": 24, + "column": 12 }, - "computed": false + "identifierName": "B" }, - { - "type": "MemberExpression", - "start": 473, - "end": 478, - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 31 - } - }, - "object": { - "type": "Identifier", - "start": 473, - "end": 474, - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 27 - }, - "identifierName": "A" - }, - "name": "A" + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 536, + "end": 540, + "loc": { + "start": { + "line": 24, + "column": 13 }, - "property": { - "type": "Identifier", - "start": 475, - "end": 478, - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 22, - "column": 31 - }, - "identifierName": "key" - }, - "name": "key" + "end": { + "line": 24, + "column": 17 }, - "computed": false - } - ] + "identifierName": "left" + }, + "name": "left" + }, + "computed": false } } - }, - { - "type": "ExpressionStatement", - "start": 482, - "end": 526, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 45 - } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 543, + "end": 561, + "loc": { + "start": { + "line": 25, + "column": 1 }, - "expression": { - "type": "AssignmentExpression", - "start": 482, - "end": 525, + "end": { + "line": 25, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 549, + "end": 560, "loc": { "start": { - "line": 23, - "column": 1 + "line": 25, + "column": 7 }, "end": { - "line": 23, - "column": 44 + "line": 25, + "column": 18 } }, - "operator": "=", - "left": { - "type": "ArrayPattern", - "start": 482, - "end": 502, + "id": { + "type": "Identifier", + "start": 549, + "end": 550, "loc": { "start": { - "line": 23, - "column": 1 + "line": 25, + "column": 7 }, "end": { - "line": 23, - "column": 21 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 483, - "end": 491, - "loc": { - "start": { - "line": 23, - "column": 2 - }, - "end": { - "line": 23, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 483, - "end": 484, - "loc": { - "start": { - "line": 23, - "column": 2 - }, - "end": { - "line": 23, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 485, - "end": 491, - "loc": { - "start": { - "line": 23, - "column": 4 - }, - "end": { - "line": 23, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 493, - "end": 501, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 493, - "end": 494, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 13 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 495, - "end": 501, - "loc": { - "start": { - "line": 23, - "column": 14 - }, - "end": { - "line": 23, - "column": 20 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] - }, - "right": { - "type": "ArrayExpression", - "start": 505, - "end": 525, - "loc": { - "start": { - "line": 23, - "column": 24 - }, - "end": { - "line": 23, - "column": 44 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 506, - "end": 514, - "loc": { - "start": { - "line": 23, - "column": 25 - }, - "end": { - "line": 23, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 506, - "end": 507, - "loc": { - "start": { - "line": 23, - "column": 25 - }, - "end": { - "line": 23, - "column": 26 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 508, - "end": 514, - "loc": { - "start": { - "line": 23, - "column": 27 - }, - "end": { - "line": 23, - "column": 33 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 25, + "column": 8 }, - { - "type": "MemberExpression", - "start": 516, - "end": 524, - "loc": { - "start": { - "line": 23, - "column": 35 - }, - "end": { - "line": 23, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 516, - "end": 517, - "loc": { - "start": { - "line": 23, - "column": 35 - }, - "end": { - "line": 23, - "column": 36 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 518, - "end": 524, - "loc": { - "start": { - "line": 23, - "column": 37 - }, - "end": { - "line": 23, - "column": 43 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] - } - } - }, - { - "type": "ExpressionStatement", - "start": 529, - "end": 540, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 12 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 529, - "end": 539, - "loc": { - "start": { - "line": 25, - "column": 1 + "identifierName": "c" }, - "end": { - "line": 25, - "column": 11 - } + "name": "c" }, - "operator": "=", - "left": { + "init": { "type": "MemberExpression", - "start": 529, - "end": 535, + "start": 553, + "end": 560, "loc": { "start": { "line": 25, - "column": 1 + "column": 11 }, "end": { "line": 25, - "column": 7 + "column": 18 } }, "object": { "type": "Identifier", - "start": 529, - "end": 530, + "start": 553, + "end": 554, "loc": { "start": { "line": 25, - "column": 1 + "column": 11 }, "end": { "line": 25, - "column": 2 + "column": 12 }, - "identifierName": "A" + "identifierName": "B" }, - "name": "A" + "name": "B" }, "property": { "type": "Identifier", - "start": 531, - "end": 535, + "start": 555, + "end": 560, "loc": { "start": { "line": 25, - "column": 3 + "column": 13 }, "end": { "line": 25, - "column": 7 + "column": 18 }, - "identifierName": "left" + "identifierName": "right" }, - "name": "left" + "name": "right" }, "computed": false - }, - "right": { - "type": "Identifier", - "start": 538, - "end": 539, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 11 - }, - "identifierName": "B" - }, - "name": "B" } } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 564, + "end": 596, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 33 + } }, - { - "type": "ExpressionStatement", - "start": 542, - "end": 554, + "expression": { + "type": "AssignmentExpression", + "start": 564, + "end": 595, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, - "column": 13 + "line": 27, + "column": 32 } }, - "expression": { - "type": "AssignmentExpression", - "start": 542, - "end": 553, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 564, + "end": 578, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, - "column": 12 + "line": 27, + "column": 15 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 542, - "end": 549, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 542, - "end": 543, + "elements": [ + { + "type": "MemberExpression", + "start": 565, + "end": 570, "loc": { "start": { - "line": 26, - "column": 1 + "line": 27, + "column": 2 }, "end": { - "line": 26, - "column": 2 + "line": 27, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 565, + "end": 566, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 3 + }, + "identifierName": "A" }, - "identifierName": "A" + "name": "A" }, - "name": "A" + "property": { + "type": "Identifier", + "start": 567, + "end": 570, + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false }, - "property": { - "type": "Identifier", - "start": 544, - "end": 549, + { + "type": "MemberExpression", + "start": 572, + "end": 577, "loc": { "start": { - "line": 26, - "column": 3 + "line": 27, + "column": 9 }, "end": { - "line": 26, - "column": 8 + "line": 27, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 572, + "end": 573, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + }, + "identifierName": "B" }, - "identifierName": "right" + "name": "B" }, - "name": "right" + "property": { + "type": "Identifier", + "start": 574, + "end": 577, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 14 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 581, + "end": 595, + "loc": { + "start": { + "line": 27, + "column": 18 }, - "computed": false + "end": { + "line": 27, + "column": 32 + } }, - "right": { - "type": "Identifier", - "start": 552, - "end": 553, - "loc": { - "start": { - "line": 26, - "column": 11 + "elements": [ + { + "type": "MemberExpression", + "start": 582, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 24 + } }, - "end": { - "line": 26, - "column": 12 + "object": { + "type": "Identifier", + "start": 582, + "end": 583, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "B" + }, + "name": "B" }, - "identifierName": "c" + "property": { + "type": "Identifier", + "start": 584, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 24 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false }, - "name": "c" - } + { + "type": "MemberExpression", + "start": 589, + "end": 594, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "object": { + "type": "Identifier", + "start": 589, + "end": 590, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 591, + "end": 594, + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 31 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 598, + "end": 642, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 45 } }, - { - "type": "ExpressionStatement", - "start": 557, - "end": 568, + "expression": { + "type": "AssignmentExpression", + "start": 598, + "end": 641, "loc": { "start": { "line": 28, @@ -1297,13 +1171,14 @@ }, "end": { "line": 28, - "column": 12 + "column": 44 } }, - "expression": { - "type": "AssignmentExpression", - "start": 557, - "end": 567, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 598, + "end": 618, "loc": { "start": { "line": 28, @@ -1311,181 +1186,347 @@ }, "end": { "line": 28, - "column": 11 + "column": 21 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 557, - "end": 563, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 557, - "end": 558, + "elements": [ + { + "type": "MemberExpression", + "start": 599, + "end": 607, "loc": { "start": { "line": 28, - "column": 1 + "column": 2 }, "end": { "line": 28, - "column": 2 + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 599, + "end": 600, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + }, + "identifierName": "A" }, - "identifierName": "B" + "name": "A" }, - "name": "B" + "property": { + "type": "Identifier", + "start": 601, + "end": 607, + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "property": { - "type": "Identifier", - "start": 559, - "end": 563, + { + "type": "MemberExpression", + "start": 609, + "end": 617, "loc": { "start": { "line": 28, - "column": 3 + "column": 12 }, "end": { "line": 28, - "column": 7 + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 28, + "column": 13 + }, + "identifierName": "B" }, - "identifierName": "left" + "name": "B" }, - "name": "left" + "property": { + "type": "Identifier", + "start": 611, + "end": 617, + "loc": { + "start": { + "line": 28, + "column": 14 + }, + "end": { + "line": 28, + "column": 20 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 621, + "end": 641, + "loc": { + "start": { + "line": 28, + "column": 24 }, - "computed": false + "end": { + "line": 28, + "column": 44 + } }, - "right": { - "type": "Identifier", - "start": 566, - "end": 567, - "loc": { - "start": { - "line": 28, - "column": 10 + "elements": [ + { + "type": "MemberExpression", + "start": 622, + "end": 630, + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 33 + } }, - "end": { - "line": 28, - "column": 11 + "object": { + "type": "Identifier", + "start": 622, + "end": 623, + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 26 + }, + "identifierName": "B" + }, + "name": "B" }, - "identifierName": "a" + "property": { + "type": "Identifier", + "start": 624, + "end": 630, + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 33 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "name": "a" - } + { + "type": "MemberExpression", + "start": 632, + "end": 640, + "loc": { + "start": { + "line": 28, + "column": 35 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 632, + "end": 633, + "loc": { + "start": { + "line": 28, + "column": 35 + }, + "end": { + "line": 28, + "column": 36 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 634, + "end": 640, + "loc": { + "start": { + "line": 28, + "column": 37 + }, + "end": { + "line": 28, + "column": 43 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 645, + "end": 656, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 12 } }, - { - "type": "ExpressionStatement", - "start": 570, - "end": 582, + "expression": { + "type": "AssignmentExpression", + "start": 645, + "end": 655, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, - "column": 13 + "line": 30, + "column": 11 } }, - "expression": { - "type": "AssignmentExpression", - "start": 570, - "end": 581, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 645, + "end": 651, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, - "column": 12 + "line": 30, + "column": 7 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 570, - "end": 577, + "object": { + "type": "Identifier", + "start": 645, + "end": 646, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 570, - "end": 571, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 2 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 572, - "end": 577, - "loc": { - "start": { - "line": 29, - "column": 3 - }, - "end": { - "line": 29, - "column": 8 - }, - "identifierName": "right" + "line": 30, + "column": 2 }, - "name": "right" + "identifierName": "A" }, - "computed": false + "name": "A" }, - "right": { + "property": { "type": "Identifier", - "start": 580, - "end": 581, + "start": 647, + "end": 651, "loc": { "start": { - "line": 29, - "column": 11 + "line": 30, + "column": 3 }, "end": { - "line": 29, - "column": 12 + "line": 30, + "column": 7 }, - "identifierName": "b" + "identifierName": "left" }, - "name": "b" - } + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 654, + "end": 655, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 11 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 658, + "end": 670, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 } }, - { - "type": "ExpressionStatement", - "start": 585, - "end": 598, + "expression": { + "type": "AssignmentExpression", + "start": 658, + "end": 669, "loc": { "start": { "line": 31, @@ -1493,13 +1534,14 @@ }, "end": { "line": 31, - "column": 14 + "column": 12 } }, - "expression": { - "type": "AssignmentExpression", - "start": 585, - "end": 597, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 658, + "end": 665, "loc": { "start": { "line": 31, @@ -1507,14 +1549,13 @@ }, "end": { "line": 31, - "column": 13 + "column": 8 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 585, - "end": 593, + "object": { + "type": "Identifier", + "start": 658, + "end": 659, "loc": { "start": { "line": 31, @@ -1522,406 +1563,3208 @@ }, "end": { "line": 31, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 585, - "end": 586, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 2 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 587, - "end": 593, - "loc": { - "start": { - "line": 31, - "column": 3 - }, - "end": { - "line": 31, - "column": 9 - }, - "identifierName": "parent" + "column": 2 }, - "name": "parent" + "identifierName": "A" }, - "computed": false + "name": "A" }, - "right": { + "property": { "type": "Identifier", - "start": 596, - "end": 597, + "start": 660, + "end": 665, "loc": { "start": { "line": 31, - "column": 12 + "column": 3 }, "end": { "line": 31, - "column": 13 + "column": 8 }, - "identifierName": "B" + "identifierName": "right" }, - "name": "B" - } + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 668, + "end": 669, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + } + } + }, + { + "type": "ExpressionStatement", + "start": 673, + "end": 684, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 12 } }, - { - "type": "ExpressionStatement", - "start": 600, - "end": 613, + "expression": { + "type": "AssignmentExpression", + "start": 673, + "end": 683, "loc": { "start": { - "line": 32, + "line": 33, "column": 1 }, "end": { - "line": 32, - "column": 14 + "line": 33, + "column": 11 } }, - "expression": { - "type": "AssignmentExpression", - "start": 600, - "end": 612, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 673, + "end": 679, "loc": { "start": { - "line": 32, + "line": 33, "column": 1 }, "end": { - "line": 32, - "column": 13 + "line": 33, + "column": 7 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 600, - "end": 608, + "object": { + "type": "Identifier", + "start": 673, + "end": 674, "loc": { "start": { - "line": 32, + "line": 33, "column": 1 }, "end": { - "line": 32, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 600, - "end": 601, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 2 - }, - "identifierName": "b" + "line": 33, + "column": 2 }, - "name": "b" + "identifierName": "B" }, - "property": { - "type": "Identifier", - "start": 602, - "end": 608, - "loc": { - "start": { - "line": 32, - "column": 3 - }, - "end": { - "line": 32, - "column": 9 - }, - "identifierName": "parent" + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 675, + "end": 679, + "loc": { + "start": { + "line": 33, + "column": 3 }, - "name": "parent" + "end": { + "line": 33, + "column": 7 + }, + "identifierName": "left" }, - "computed": false + "name": "left" }, - "right": { + "computed": false + }, + "right": { + "type": "Identifier", + "start": 682, + "end": 683, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + } + }, + { + "type": "ExpressionStatement", + "start": 686, + "end": 698, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 686, + "end": 697, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 686, + "end": 693, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 8 + } + }, + "object": { "type": "Identifier", - "start": 611, - "end": 612, + "start": 686, + "end": 687, "loc": { "start": { - "line": 32, - "column": 12 + "line": 34, + "column": 1 }, "end": { - "line": 32, - "column": 13 + "line": 34, + "column": 2 }, "identifierName": "B" }, "name": "B" - } + }, + "property": { + "type": "Identifier", + "start": 688, + "end": 693, + "loc": { + "start": { + "line": 34, + "column": 3 + }, + "end": { + "line": 34, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 696, + "end": 697, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + } + } + }, + { + "type": "ExpressionStatement", + "start": 701, + "end": 714, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 14 } }, - { - "type": "ExpressionStatement", - "start": 615, - "end": 628, + "expression": { + "type": "AssignmentExpression", + "start": 701, + "end": 713, "loc": { "start": { - "line": 33, + "line": 36, "column": 1 }, "end": { - "line": 33, - "column": 14 + "line": 36, + "column": 13 } }, - "expression": { - "type": "AssignmentExpression", - "start": 615, - "end": 627, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 701, + "end": 709, "loc": { "start": { - "line": 33, + "line": 36, "column": 1 }, "end": { - "line": 33, - "column": 13 + "line": 36, + "column": 9 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 615, - "end": 623, + "object": { + "type": "Identifier", + "start": 701, + "end": 702, "loc": { "start": { - "line": 33, + "line": 36, "column": 1 }, "end": { - "line": 33, - "column": 9 - } + "line": 36, + "column": 2 + }, + "identifierName": "a" }, - "object": { - "type": "Identifier", - "start": 615, - "end": 616, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 2 - }, - "identifierName": "c" + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 703, + "end": 709, + "loc": { + "start": { + "line": 36, + "column": 3 }, - "name": "c" + "end": { + "line": 36, + "column": 9 + }, + "identifierName": "parent" }, - "property": { - "type": "Identifier", - "start": 617, - "end": 623, - "loc": { - "start": { - "line": 33, - "column": 3 - }, - "end": { - "line": 33, - "column": 9 - }, - "identifierName": "parent" + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 712, + "end": 713, + "loc": { + "start": { + "line": 36, + "column": 12 + }, + "end": { + "line": 36, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 716, + "end": 729, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 716, + "end": 728, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 716, + "end": 724, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 716, + "end": 717, + "loc": { + "start": { + "line": 37, + "column": 1 }, - "name": "parent" + "end": { + "line": 37, + "column": 2 + }, + "identifierName": "b" }, - "computed": false + "name": "b" }, - "right": { + "property": { "type": "Identifier", - "start": 626, - "end": 627, + "start": 718, + "end": 724, "loc": { "start": { - "line": 33, - "column": 12 + "line": 37, + "column": 3 }, "end": { - "line": 33, - "column": 13 + "line": 37, + "column": 9 }, - "identifierName": "A" + "identifierName": "parent" }, - "name": "A" + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 727, + "end": 728, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 731, + "end": 744, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 731, + "end": 743, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 13 } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 731, + "end": 739, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 731, + "end": 732, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 2 + }, + "identifierName": "c" + }, + "name": "c" + }, + "property": { + "type": "Identifier", + "start": 733, + "end": 739, + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 742, + "end": 743, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" } } - ], - "directives": [] - } - }, - "leadingComments": null + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 749, + "end": 776, + "loc": { + "start": { + "line": 41, + "column": 0 + }, + "end": { + "line": 41, + "column": 27 + } + }, + "declaration": { + "type": "Identifier", + "start": 764, + "end": 775, + "loc": { + "start": { + "line": 41, + "column": 15 + }, + "end": { + "line": 41, + "column": 26 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 749, + "end": 776, + "loc": { + "start": { + "line": 41, + "column": 0 + }, + "end": { + "line": 41, + "column": 27 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 399, + "end": 747, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 39, + "column": 2 } - ], - "kind": "const", - "leadingComments": [ + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", - "start": 0, - "end": 330, + "type": "VariableDeclarator", + "start": 405, + "end": 746, "loc": { "start": { - "line": 1, - "column": 0 + "line": 19, + "column": 6 }, "end": { - "line": 14, - "column": 3 + "line": 39, + "column": 1 } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", - "start": 0, - "end": 330, - "loc": { - "start": { - "line": 1, - "column": 0 }, - "end": { - "line": 14, - "column": 3 - } - } - } - ] - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", - "start": 0, - "end": 330, + "id": { + "type": "Identifier", + "start": 405, + "end": 416, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 17 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 419, + "end": 746, + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 39, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 405, + "end": 416, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 17 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 420, + "end": 421, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + }, + "identifierName": "A" + }, + "name": "A" + } + ], + "body": { + "type": "BlockStatement", + "start": 426, + "end": 746, + "loc": { + "start": { + "line": 19, + "column": 27 + }, + "end": { + "line": 39, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 429, + "end": 455, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 429, + "end": 454, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 429, + "end": 435, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 436, + "end": 453, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 436, + "end": 437, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 449, + "end": 453, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 457, + "end": 475, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 463, + "end": 474, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 463, + "end": 464, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "MemberExpression", + "start": 467, + "end": 474, + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 467, + "end": 468, + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 469, + "end": 474, + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 477, + "end": 503, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 477, + "end": 502, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 477, + "end": 483, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 484, + "end": 501, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 484, + "end": 485, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 497, + "end": 501, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 505, + "end": 522, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 511, + "end": 521, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 511, + "end": 512, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "MemberExpression", + "start": 515, + "end": 521, + "loc": { + "start": { + "line": 23, + "column": 11 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 515, + "end": 516, + "loc": { + "start": { + "line": 23, + "column": 11 + }, + "end": { + "line": 23, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 517, + "end": 521, + "loc": { + "start": { + "line": 23, + "column": 13 + }, + "end": { + "line": 23, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 524, + "end": 541, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 530, + "end": 540, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 530, + "end": 531, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + }, + "identifierName": "b" + }, + "name": "b" + }, + "init": { + "type": "MemberExpression", + "start": 534, + "end": 540, + "loc": { + "start": { + "line": 24, + "column": 11 + }, + "end": { + "line": 24, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 534, + "end": 535, + "loc": { + "start": { + "line": 24, + "column": 11 + }, + "end": { + "line": 24, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 536, + "end": 540, + "loc": { + "start": { + "line": 24, + "column": 13 + }, + "end": { + "line": 24, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 543, + "end": 561, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 549, + "end": 560, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 549, + "end": 550, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + }, + "identifierName": "c" + }, + "name": "c" + }, + "init": { + "type": "MemberExpression", + "start": 553, + "end": 560, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 553, + "end": 554, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 555, + "end": 560, + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 564, + "end": 596, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 33 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 564, + "end": 595, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 32 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 564, + "end": 578, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 15 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 565, + "end": 570, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 565, + "end": 566, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 567, + "end": 570, + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 572, + "end": 577, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 572, + "end": 573, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 574, + "end": 577, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 14 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 581, + "end": 595, + "loc": { + "start": { + "line": 27, + "column": 18 + }, + "end": { + "line": 27, + "column": 32 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 582, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 24 + } + }, + "object": { + "type": "Identifier", + "start": 582, + "end": 583, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 584, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 24 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 589, + "end": 594, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "object": { + "type": "Identifier", + "start": 589, + "end": 590, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 591, + "end": 594, + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 31 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 598, + "end": 642, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 45 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 598, + "end": 641, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 44 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 598, + "end": 618, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 21 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 599, + "end": 607, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 599, + "end": 600, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 601, + "end": 607, + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 609, + "end": 617, + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 28, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 28, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 611, + "end": 617, + "loc": { + "start": { + "line": 28, + "column": 14 + }, + "end": { + "line": 28, + "column": 20 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 621, + "end": 641, + "loc": { + "start": { + "line": 28, + "column": 24 + }, + "end": { + "line": 28, + "column": 44 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 622, + "end": 630, + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 622, + "end": 623, + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 26 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 624, + "end": 630, + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 33 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 632, + "end": 640, + "loc": { + "start": { + "line": 28, + "column": 35 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 632, + "end": 633, + "loc": { + "start": { + "line": 28, + "column": 35 + }, + "end": { + "line": 28, + "column": 36 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 634, + "end": 640, + "loc": { + "start": { + "line": 28, + "column": 37 + }, + "end": { + "line": 28, + "column": 43 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 645, + "end": 656, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 645, + "end": 655, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 645, + "end": 651, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 645, + "end": 646, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 647, + "end": 651, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 654, + "end": 655, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 11 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 658, + "end": 670, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 658, + "end": 669, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 658, + "end": 665, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 658, + "end": 659, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 660, + "end": 665, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 668, + "end": 669, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + } + } + }, + { + "type": "ExpressionStatement", + "start": 673, + "end": 684, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 673, + "end": 683, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 673, + "end": 679, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 673, + "end": 674, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 675, + "end": 679, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 682, + "end": 683, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + } + }, + { + "type": "ExpressionStatement", + "start": 686, + "end": 698, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 686, + "end": 697, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 686, + "end": 693, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 686, + "end": 687, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 688, + "end": 693, + "loc": { + "start": { + "line": 34, + "column": 3 + }, + "end": { + "line": 34, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 696, + "end": 697, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + }, + "identifierName": "b" + }, + "name": "b" + } + } + }, + { + "type": "ExpressionStatement", + "start": 701, + "end": 714, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 701, + "end": 713, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 701, + "end": 709, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 701, + "end": 702, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 703, + "end": 709, + "loc": { + "start": { + "line": 36, + "column": 3 + }, + "end": { + "line": 36, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 712, + "end": 713, + "loc": { + "start": { + "line": 36, + "column": 12 + }, + "end": { + "line": 36, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 716, + "end": 729, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 716, + "end": 728, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 716, + "end": 724, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 716, + "end": 717, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 2 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "Identifier", + "start": 718, + "end": 724, + "loc": { + "start": { + "line": 37, + "column": 3 + }, + "end": { + "line": 37, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 727, + "end": 728, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 731, + "end": 744, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 731, + "end": 743, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 731, + "end": 739, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 731, + "end": 732, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 2 + }, + "identifierName": "c" + }, + "name": "c" + }, + "property": { + "type": "Identifier", + "start": 733, + "end": 739, + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 742, + "end": 743, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "start": 67, + "end": 397, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "start": 67, + "end": 397, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "start": 67, + "end": 397, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 399, + "end": 404, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 405, + "end": 416, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 417, + "end": 418, + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 419, + "end": 420, + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 420, + "end": 421, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 421, + "end": 422, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 423, + "end": 425, + "loc": { + "start": { + "line": 19, + "column": 24 + }, + "end": { + "line": 19, + "column": 26 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 426, + "end": 427, + "loc": { + "start": { + "line": 19, + "column": 27 + }, + "end": { + "line": 19, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 429, + "end": 435, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 435, + "end": 436, "loc": { "start": { - "line": 1, - "column": 0 + "line": 20, + "column": 7 }, "end": { - "line": 14, - "column": 3 + "line": 20, + "column": 8 } } - } - ], - "tokens": [ + }, { - "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", - "start": 0, - "end": 330, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 436, + "end": 437, "loc": { "start": { - "line": 1, - "column": 0 + "line": 20, + "column": 8 }, "end": { - "line": 14, - "column": 3 + "line": 20, + "column": 9 } } }, { "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "export", - "start": 332, - "end": 338, + "value": "instanceof", + "start": 438, + "end": 448, "loc": { "start": { - "line": 16, - "column": 0 + "line": 20, + "column": 10 }, "end": { - "line": 16, - "column": 6 + "line": 20, + "column": 20 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 339, - "end": 344, + "value": "Node", + "start": 449, + "end": 453, "loc": { "start": { - "line": 16, - "column": 7 + "line": 20, + "column": 21 }, "end": { - "line": 16, - "column": 12 + "line": 20, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1929,69 +4772,70 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 345, - "end": 356, + "start": 453, + "end": 454, "loc": { "start": { - "line": 16, - "column": 13 + "line": 20, + "column": 25 }, "end": { - "line": 16, - "column": 24 + "line": 20, + "column": 26 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 357, - "end": 358, + "start": 454, + "end": 455, "loc": { "start": { - "line": 16, - "column": 25 + "line": 20, + "column": 26 }, "end": { - "line": 16, - "column": 26 + "line": 20, + "column": 27 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 359, - "end": 360, + "value": "const", + "start": 457, + "end": 462, "loc": { "start": { - "line": 16, - "column": 27 + "line": 21, + "column": 1 }, "end": { - "line": 16, - "column": 28 + "line": 21, + "column": 6 } } }, @@ -2007,49 +4851,77 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 360, - "end": 361, + "value": "B", + "start": 463, + "end": 464, "loc": { "start": { - "line": 16, - "column": 28 + "line": 21, + "column": 7 }, "end": { - "line": 16, - "column": 29 + "line": 21, + "column": 8 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 465, + "end": 466, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null }, - "start": 361, - "end": 362, + "value": "A", + "start": 467, + "end": 468, "loc": { "start": { - "line": 16, - "column": 29 + "line": 21, + "column": 11 }, "end": { - "line": 16, - "column": 30 + "line": 21, + "column": 12 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2059,23 +4931,23 @@ "binop": null, "updateContext": null }, - "start": 363, - "end": 365, + "start": 468, + "end": 469, "loc": { "start": { - "line": 16, - "column": 31 + "line": 21, + "column": 12 }, "end": { - "line": 16, - "column": 33 + "line": 21, + "column": 13 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2084,24 +4956,24 @@ "postfix": false, "binop": null }, - "start": 366, - "end": 367, + "value": "right", + "start": 469, + "end": 474, "loc": { "start": { - "line": 16, - "column": 34 + "line": 21, + "column": 13 }, "end": { - "line": 16, - "column": 35 + "line": 21, + "column": 18 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2111,17 +4983,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 369, - "end": 374, + "start": 474, + "end": 475, "loc": { "start": { - "line": 17, - "column": 1 + "line": 21, + "column": 18 }, "end": { - "line": 17, - "column": 6 + "line": 21, + "column": 19 } } }, @@ -2137,44 +5008,42 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 375, - "end": 376, + "value": "assert", + "start": 477, + "end": 483, "loc": { "start": { - "line": 17, - "column": 7 + "line": 22, + "column": 1 }, "end": { - "line": 17, - "column": 8 + "line": 22, + "column": 7 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 377, - "end": 378, + "start": 483, + "end": 484, "loc": { "start": { - "line": 17, - "column": 9 + "line": 22, + "column": 7 }, "end": { - "line": 17, - "column": 10 + "line": 22, + "column": 8 } } }, @@ -2190,51 +5059,79 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 379, - "end": 380, + "value": "B", + "start": 484, + "end": 485, "loc": { "start": { - "line": 17, - "column": 11 + "line": 22, + "column": 8 }, "end": { - "line": 17, - "column": 12 + "line": 22, + "column": 9 } } }, { "type": { - "label": ".", + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 486, + "end": 496, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 380, - "end": 381, + "value": "Node", + "start": 497, + "end": 501, "loc": { "start": { - "line": 17, - "column": 12 + "line": 22, + "column": 21 }, "end": { - "line": 17, - "column": 13 + "line": 22, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2242,17 +5139,16 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 381, - "end": 386, + "start": 501, + "end": 502, "loc": { "start": { - "line": 17, - "column": 13 + "line": 22, + "column": 25 }, "end": { - "line": 17, - "column": 18 + "line": 22, + "column": 26 } } }, @@ -2269,16 +5165,16 @@ "binop": null, "updateContext": null }, - "start": 386, - "end": 387, + "start": 502, + "end": 503, "loc": { "start": { - "line": 17, - "column": 18 + "line": 22, + "column": 26 }, "end": { - "line": 17, - "column": 19 + "line": 22, + "column": 27 } } }, @@ -2297,15 +5193,15 @@ "updateContext": null }, "value": "const", - "start": 389, - "end": 394, + "start": 505, + "end": 510, "loc": { "start": { - "line": 18, + "line": 23, "column": 1 }, "end": { - "line": 18, + "line": 23, "column": 6 } } @@ -2323,15 +5219,15 @@ "binop": null }, "value": "a", - "start": 395, - "end": 396, + "start": 511, + "end": 512, "loc": { "start": { - "line": 18, + "line": 23, "column": 7 }, "end": { - "line": 18, + "line": 23, "column": 8 } } @@ -2350,15 +5246,15 @@ "updateContext": null }, "value": "=", - "start": 397, - "end": 398, + "start": 513, + "end": 514, "loc": { "start": { - "line": 18, + "line": 23, "column": 9 }, "end": { - "line": 18, + "line": 23, "column": 10 } } @@ -2376,15 +5272,15 @@ "binop": null }, "value": "A", - "start": 399, - "end": 400, + "start": 515, + "end": 516, "loc": { "start": { - "line": 18, + "line": 23, "column": 11 }, "end": { - "line": 18, + "line": 23, "column": 12 } } @@ -2402,15 +5298,15 @@ "binop": null, "updateContext": null }, - "start": 400, - "end": 401, + "start": 516, + "end": 517, "loc": { "start": { - "line": 18, + "line": 23, "column": 12 }, "end": { - "line": 18, + "line": 23, "column": 13 } } @@ -2428,15 +5324,15 @@ "binop": null }, "value": "left", - "start": 401, - "end": 405, + "start": 517, + "end": 521, "loc": { "start": { - "line": 18, + "line": 23, "column": 13 }, "end": { - "line": 18, + "line": 23, "column": 17 } } @@ -2454,15 +5350,15 @@ "binop": null, "updateContext": null }, - "start": 405, - "end": 406, + "start": 521, + "end": 522, "loc": { "start": { - "line": 18, + "line": 23, "column": 17 }, "end": { - "line": 18, + "line": 23, "column": 18 } } @@ -2482,15 +5378,15 @@ "updateContext": null }, "value": "const", - "start": 408, - "end": 413, + "start": 524, + "end": 529, "loc": { "start": { - "line": 19, + "line": 24, "column": 1 }, "end": { - "line": 19, + "line": 24, "column": 6 } } @@ -2508,15 +5404,15 @@ "binop": null }, "value": "b", - "start": 414, - "end": 415, + "start": 530, + "end": 531, "loc": { "start": { - "line": 19, + "line": 24, "column": 7 }, "end": { - "line": 19, + "line": 24, "column": 8 } } @@ -2535,15 +5431,15 @@ "updateContext": null }, "value": "=", - "start": 416, - "end": 417, + "start": 532, + "end": 533, "loc": { "start": { - "line": 19, + "line": 24, "column": 9 }, "end": { - "line": 19, + "line": 24, "column": 10 } } @@ -2561,15 +5457,15 @@ "binop": null }, "value": "B", - "start": 418, - "end": 419, + "start": 534, + "end": 535, "loc": { "start": { - "line": 19, + "line": 24, "column": 11 }, "end": { - "line": 19, + "line": 24, "column": 12 } } @@ -2587,15 +5483,15 @@ "binop": null, "updateContext": null }, - "start": 419, - "end": 420, + "start": 535, + "end": 536, "loc": { "start": { - "line": 19, + "line": 24, "column": 12 }, "end": { - "line": 19, + "line": 24, "column": 13 } } @@ -2613,15 +5509,15 @@ "binop": null }, "value": "left", - "start": 420, - "end": 424, + "start": 536, + "end": 540, "loc": { "start": { - "line": 19, + "line": 24, "column": 13 }, "end": { - "line": 19, + "line": 24, "column": 17 } } @@ -2639,15 +5535,15 @@ "binop": null, "updateContext": null }, - "start": 424, - "end": 425, + "start": 540, + "end": 541, "loc": { "start": { - "line": 19, + "line": 24, "column": 17 }, "end": { - "line": 19, + "line": 24, "column": 18 } } @@ -2667,15 +5563,15 @@ "updateContext": null }, "value": "const", - "start": 427, - "end": 432, + "start": 543, + "end": 548, "loc": { "start": { - "line": 20, + "line": 25, "column": 1 }, "end": { - "line": 20, + "line": 25, "column": 6 } } @@ -2693,15 +5589,15 @@ "binop": null }, "value": "c", - "start": 433, - "end": 434, + "start": 549, + "end": 550, "loc": { "start": { - "line": 20, + "line": 25, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 8 } } @@ -2720,15 +5616,15 @@ "updateContext": null }, "value": "=", - "start": 435, - "end": 436, + "start": 551, + "end": 552, "loc": { "start": { - "line": 20, + "line": 25, "column": 9 }, "end": { - "line": 20, + "line": 25, "column": 10 } } @@ -2746,15 +5642,15 @@ "binop": null }, "value": "B", - "start": 437, - "end": 438, + "start": 553, + "end": 554, "loc": { "start": { - "line": 20, + "line": 25, "column": 11 }, "end": { - "line": 20, + "line": 25, "column": 12 } } @@ -2772,15 +5668,15 @@ "binop": null, "updateContext": null }, - "start": 438, - "end": 439, + "start": 554, + "end": 555, "loc": { "start": { - "line": 20, + "line": 25, "column": 12 }, "end": { - "line": 20, + "line": 25, "column": 13 } } @@ -2798,15 +5694,15 @@ "binop": null }, "value": "right", - "start": 439, - "end": 444, + "start": 555, + "end": 560, "loc": { "start": { - "line": 20, + "line": 25, "column": 13 }, "end": { - "line": 20, + "line": 25, "column": 18 } } @@ -2824,15 +5720,15 @@ "binop": null, "updateContext": null }, - "start": 444, - "end": 445, + "start": 560, + "end": 561, "loc": { "start": { - "line": 20, + "line": 25, "column": 18 }, "end": { - "line": 20, + "line": 25, "column": 19 } } @@ -2850,15 +5746,15 @@ "binop": null, "updateContext": null }, - "start": 448, - "end": 449, + "start": 564, + "end": 565, "loc": { "start": { - "line": 22, + "line": 27, "column": 1 }, "end": { - "line": 22, + "line": 27, "column": 2 } } @@ -2876,15 +5772,15 @@ "binop": null }, "value": "A", - "start": 449, - "end": 450, + "start": 565, + "end": 566, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, + "line": 27, "column": 3 } } @@ -2902,15 +5798,15 @@ "binop": null, "updateContext": null }, - "start": 450, - "end": 451, + "start": 566, + "end": 567, "loc": { "start": { - "line": 22, + "line": 27, "column": 3 }, "end": { - "line": 22, + "line": 27, "column": 4 } } @@ -2928,15 +5824,15 @@ "binop": null }, "value": "key", - "start": 451, - "end": 454, + "start": 567, + "end": 570, "loc": { "start": { - "line": 22, + "line": 27, "column": 4 }, "end": { - "line": 22, + "line": 27, "column": 7 } } @@ -2954,15 +5850,15 @@ "binop": null, "updateContext": null }, - "start": 454, - "end": 455, + "start": 570, + "end": 571, "loc": { "start": { - "line": 22, + "line": 27, "column": 7 }, "end": { - "line": 22, + "line": 27, "column": 8 } } @@ -2980,15 +5876,15 @@ "binop": null }, "value": "B", - "start": 456, - "end": 457, + "start": 572, + "end": 573, "loc": { "start": { - "line": 22, + "line": 27, "column": 9 }, "end": { - "line": 22, + "line": 27, "column": 10 } } @@ -3006,15 +5902,15 @@ "binop": null, "updateContext": null }, - "start": 457, - "end": 458, + "start": 573, + "end": 574, "loc": { "start": { - "line": 22, + "line": 27, "column": 10 }, "end": { - "line": 22, + "line": 27, "column": 11 } } @@ -3032,15 +5928,15 @@ "binop": null }, "value": "key", - "start": 458, - "end": 461, + "start": 574, + "end": 577, "loc": { "start": { - "line": 22, + "line": 27, "column": 11 }, "end": { - "line": 22, + "line": 27, "column": 14 } } @@ -3058,15 +5954,15 @@ "binop": null, "updateContext": null }, - "start": 461, - "end": 462, + "start": 577, + "end": 578, "loc": { "start": { - "line": 22, + "line": 27, "column": 14 }, "end": { - "line": 22, + "line": 27, "column": 15 } } @@ -3085,15 +5981,15 @@ "updateContext": null }, "value": "=", - "start": 463, - "end": 464, + "start": 579, + "end": 580, "loc": { "start": { - "line": 22, + "line": 27, "column": 16 }, "end": { - "line": 22, + "line": 27, "column": 17 } } @@ -3111,15 +6007,15 @@ "binop": null, "updateContext": null }, - "start": 465, - "end": 466, + "start": 581, + "end": 582, "loc": { "start": { - "line": 22, + "line": 27, "column": 18 }, "end": { - "line": 22, + "line": 27, "column": 19 } } @@ -3137,15 +6033,15 @@ "binop": null }, "value": "B", - "start": 466, - "end": 467, + "start": 582, + "end": 583, "loc": { "start": { - "line": 22, + "line": 27, "column": 19 }, "end": { - "line": 22, + "line": 27, "column": 20 } } @@ -3163,15 +6059,15 @@ "binop": null, "updateContext": null }, - "start": 467, - "end": 468, + "start": 583, + "end": 584, "loc": { "start": { - "line": 22, + "line": 27, "column": 20 }, "end": { - "line": 22, + "line": 27, "column": 21 } } @@ -3189,15 +6085,15 @@ "binop": null }, "value": "key", - "start": 468, - "end": 471, + "start": 584, + "end": 587, "loc": { "start": { - "line": 22, + "line": 27, "column": 21 }, "end": { - "line": 22, + "line": 27, "column": 24 } } @@ -3215,15 +6111,15 @@ "binop": null, "updateContext": null }, - "start": 471, - "end": 472, + "start": 587, + "end": 588, "loc": { "start": { - "line": 22, + "line": 27, "column": 24 }, "end": { - "line": 22, + "line": 27, "column": 25 } } @@ -3241,15 +6137,15 @@ "binop": null }, "value": "A", - "start": 473, - "end": 474, + "start": 589, + "end": 590, "loc": { "start": { - "line": 22, + "line": 27, "column": 26 }, "end": { - "line": 22, + "line": 27, "column": 27 } } @@ -3267,15 +6163,15 @@ "binop": null, "updateContext": null }, - "start": 474, - "end": 475, + "start": 590, + "end": 591, "loc": { "start": { - "line": 22, + "line": 27, "column": 27 }, "end": { - "line": 22, + "line": 27, "column": 28 } } @@ -3293,15 +6189,15 @@ "binop": null }, "value": "key", - "start": 475, - "end": 478, + "start": 591, + "end": 594, "loc": { "start": { - "line": 22, + "line": 27, "column": 28 }, "end": { - "line": 22, + "line": 27, "column": 31 } } @@ -3319,15 +6215,15 @@ "binop": null, "updateContext": null }, - "start": 478, - "end": 479, + "start": 594, + "end": 595, "loc": { "start": { - "line": 22, + "line": 27, "column": 31 }, "end": { - "line": 22, + "line": 27, "column": 32 } } @@ -3345,15 +6241,15 @@ "binop": null, "updateContext": null }, - "start": 479, - "end": 480, + "start": 595, + "end": 596, "loc": { "start": { - "line": 22, + "line": 27, "column": 32 }, "end": { - "line": 22, + "line": 27, "column": 33 } } @@ -3371,15 +6267,15 @@ "binop": null, "updateContext": null }, - "start": 482, - "end": 483, + "start": 598, + "end": 599, "loc": { "start": { - "line": 23, + "line": 28, "column": 1 }, "end": { - "line": 23, + "line": 28, "column": 2 } } @@ -3397,15 +6293,15 @@ "binop": null }, "value": "A", - "start": 483, - "end": 484, + "start": 599, + "end": 600, "loc": { "start": { - "line": 23, + "line": 28, "column": 2 }, "end": { - "line": 23, + "line": 28, "column": 3 } } @@ -3423,15 +6319,15 @@ "binop": null, "updateContext": null }, - "start": 484, - "end": 485, + "start": 600, + "end": 601, "loc": { "start": { - "line": 23, + "line": 28, "column": 3 }, "end": { - "line": 23, + "line": 28, "column": 4 } } @@ -3449,15 +6345,15 @@ "binop": null }, "value": "_color", - "start": 485, - "end": 491, + "start": 601, + "end": 607, "loc": { "start": { - "line": 23, + "line": 28, "column": 4 }, "end": { - "line": 23, + "line": 28, "column": 10 } } @@ -3475,15 +6371,15 @@ "binop": null, "updateContext": null }, - "start": 491, - "end": 492, + "start": 607, + "end": 608, "loc": { "start": { - "line": 23, + "line": 28, "column": 10 }, "end": { - "line": 23, + "line": 28, "column": 11 } } @@ -3501,15 +6397,15 @@ "binop": null }, "value": "B", - "start": 493, - "end": 494, + "start": 609, + "end": 610, "loc": { "start": { - "line": 23, + "line": 28, "column": 12 }, "end": { - "line": 23, + "line": 28, "column": 13 } } @@ -3527,15 +6423,15 @@ "binop": null, "updateContext": null }, - "start": 494, - "end": 495, + "start": 610, + "end": 611, "loc": { "start": { - "line": 23, + "line": 28, "column": 13 }, "end": { - "line": 23, + "line": 28, "column": 14 } } @@ -3553,15 +6449,15 @@ "binop": null }, "value": "_color", - "start": 495, - "end": 501, + "start": 611, + "end": 617, "loc": { "start": { - "line": 23, + "line": 28, "column": 14 }, "end": { - "line": 23, + "line": 28, "column": 20 } } @@ -3579,15 +6475,15 @@ "binop": null, "updateContext": null }, - "start": 501, - "end": 502, + "start": 617, + "end": 618, "loc": { "start": { - "line": 23, + "line": 28, "column": 20 }, "end": { - "line": 23, + "line": 28, "column": 21 } } @@ -3606,15 +6502,15 @@ "updateContext": null }, "value": "=", - "start": 503, - "end": 504, + "start": 619, + "end": 620, "loc": { "start": { - "line": 23, + "line": 28, "column": 22 }, "end": { - "line": 23, + "line": 28, "column": 23 } } @@ -3632,15 +6528,15 @@ "binop": null, "updateContext": null }, - "start": 505, - "end": 506, + "start": 621, + "end": 622, "loc": { "start": { - "line": 23, + "line": 28, "column": 24 }, "end": { - "line": 23, + "line": 28, "column": 25 } } @@ -3658,15 +6554,15 @@ "binop": null }, "value": "B", - "start": 506, - "end": 507, + "start": 622, + "end": 623, "loc": { "start": { - "line": 23, + "line": 28, "column": 25 }, "end": { - "line": 23, + "line": 28, "column": 26 } } @@ -3684,15 +6580,15 @@ "binop": null, "updateContext": null }, - "start": 507, - "end": 508, + "start": 623, + "end": 624, "loc": { "start": { - "line": 23, + "line": 28, "column": 26 }, "end": { - "line": 23, + "line": 28, "column": 27 } } @@ -3710,15 +6606,15 @@ "binop": null }, "value": "_color", - "start": 508, - "end": 514, + "start": 624, + "end": 630, "loc": { "start": { - "line": 23, + "line": 28, "column": 27 }, "end": { - "line": 23, + "line": 28, "column": 33 } } @@ -3736,15 +6632,15 @@ "binop": null, "updateContext": null }, - "start": 514, - "end": 515, + "start": 630, + "end": 631, "loc": { "start": { - "line": 23, + "line": 28, "column": 33 }, "end": { - "line": 23, + "line": 28, "column": 34 } } @@ -3762,15 +6658,15 @@ "binop": null }, "value": "A", - "start": 516, - "end": 517, + "start": 632, + "end": 633, "loc": { "start": { - "line": 23, + "line": 28, "column": 35 }, "end": { - "line": 23, + "line": 28, "column": 36 } } @@ -3788,15 +6684,15 @@ "binop": null, "updateContext": null }, - "start": 517, - "end": 518, + "start": 633, + "end": 634, "loc": { "start": { - "line": 23, + "line": 28, "column": 36 }, "end": { - "line": 23, + "line": 28, "column": 37 } } @@ -3814,15 +6710,15 @@ "binop": null }, "value": "_color", - "start": 518, - "end": 524, + "start": 634, + "end": 640, "loc": { "start": { - "line": 23, + "line": 28, "column": 37 }, "end": { - "line": 23, + "line": 28, "column": 43 } } @@ -3840,15 +6736,15 @@ "binop": null, "updateContext": null }, - "start": 524, - "end": 525, + "start": 640, + "end": 641, "loc": { "start": { - "line": 23, + "line": 28, "column": 43 }, "end": { - "line": 23, + "line": 28, "column": 44 } } @@ -3866,15 +6762,15 @@ "binop": null, "updateContext": null }, - "start": 525, - "end": 526, + "start": 641, + "end": 642, "loc": { "start": { - "line": 23, + "line": 28, "column": 44 }, "end": { - "line": 23, + "line": 28, "column": 45 } } @@ -3892,15 +6788,15 @@ "binop": null }, "value": "A", - "start": 529, - "end": 530, + "start": 645, + "end": 646, "loc": { "start": { - "line": 25, + "line": 30, "column": 1 }, "end": { - "line": 25, + "line": 30, "column": 2 } } @@ -3918,15 +6814,15 @@ "binop": null, "updateContext": null }, - "start": 530, - "end": 531, + "start": 646, + "end": 647, "loc": { "start": { - "line": 25, + "line": 30, "column": 2 }, "end": { - "line": 25, + "line": 30, "column": 3 } } @@ -3944,15 +6840,15 @@ "binop": null }, "value": "left", - "start": 531, - "end": 535, + "start": 647, + "end": 651, "loc": { "start": { - "line": 25, + "line": 30, "column": 3 }, "end": { - "line": 25, + "line": 30, "column": 7 } } @@ -3971,15 +6867,15 @@ "updateContext": null }, "value": "=", - "start": 536, - "end": 537, + "start": 652, + "end": 653, "loc": { "start": { - "line": 25, + "line": 30, "column": 8 }, "end": { - "line": 25, + "line": 30, "column": 9 } } @@ -3997,15 +6893,15 @@ "binop": null }, "value": "B", - "start": 538, - "end": 539, + "start": 654, + "end": 655, "loc": { "start": { - "line": 25, + "line": 30, "column": 10 }, "end": { - "line": 25, + "line": 30, "column": 11 } } @@ -4023,15 +6919,15 @@ "binop": null, "updateContext": null }, - "start": 539, - "end": 540, + "start": 655, + "end": 656, "loc": { "start": { - "line": 25, + "line": 30, "column": 11 }, "end": { - "line": 25, + "line": 30, "column": 12 } } @@ -4049,15 +6945,15 @@ "binop": null }, "value": "A", - "start": 542, - "end": 543, + "start": 658, + "end": 659, "loc": { "start": { - "line": 26, + "line": 31, "column": 1 }, "end": { - "line": 26, + "line": 31, "column": 2 } } @@ -4075,15 +6971,15 @@ "binop": null, "updateContext": null }, - "start": 543, - "end": 544, + "start": 659, + "end": 660, "loc": { "start": { - "line": 26, + "line": 31, "column": 2 }, "end": { - "line": 26, + "line": 31, "column": 3 } } @@ -4101,15 +6997,15 @@ "binop": null }, "value": "right", - "start": 544, - "end": 549, + "start": 660, + "end": 665, "loc": { "start": { - "line": 26, + "line": 31, "column": 3 }, "end": { - "line": 26, + "line": 31, "column": 8 } } @@ -4128,15 +7024,15 @@ "updateContext": null }, "value": "=", - "start": 550, - "end": 551, + "start": 666, + "end": 667, "loc": { "start": { - "line": 26, + "line": 31, "column": 9 }, "end": { - "line": 26, + "line": 31, "column": 10 } } @@ -4154,15 +7050,15 @@ "binop": null }, "value": "c", - "start": 552, - "end": 553, + "start": 668, + "end": 669, "loc": { "start": { - "line": 26, + "line": 31, "column": 11 }, "end": { - "line": 26, + "line": 31, "column": 12 } } @@ -4180,15 +7076,15 @@ "binop": null, "updateContext": null }, - "start": 553, - "end": 554, + "start": 669, + "end": 670, "loc": { "start": { - "line": 26, + "line": 31, "column": 12 }, "end": { - "line": 26, + "line": 31, "column": 13 } } @@ -4206,15 +7102,15 @@ "binop": null }, "value": "B", - "start": 557, - "end": 558, + "start": 673, + "end": 674, "loc": { "start": { - "line": 28, + "line": 33, "column": 1 }, "end": { - "line": 28, + "line": 33, "column": 2 } } @@ -4232,15 +7128,15 @@ "binop": null, "updateContext": null }, - "start": 558, - "end": 559, + "start": 674, + "end": 675, "loc": { "start": { - "line": 28, + "line": 33, "column": 2 }, "end": { - "line": 28, + "line": 33, "column": 3 } } @@ -4258,15 +7154,15 @@ "binop": null }, "value": "left", - "start": 559, - "end": 563, + "start": 675, + "end": 679, "loc": { "start": { - "line": 28, + "line": 33, "column": 3 }, "end": { - "line": 28, + "line": 33, "column": 7 } } @@ -4285,15 +7181,15 @@ "updateContext": null }, "value": "=", - "start": 564, - "end": 565, + "start": 680, + "end": 681, "loc": { "start": { - "line": 28, + "line": 33, "column": 8 }, "end": { - "line": 28, + "line": 33, "column": 9 } } @@ -4311,15 +7207,15 @@ "binop": null }, "value": "a", - "start": 566, - "end": 567, + "start": 682, + "end": 683, "loc": { "start": { - "line": 28, + "line": 33, "column": 10 }, "end": { - "line": 28, + "line": 33, "column": 11 } } @@ -4337,15 +7233,15 @@ "binop": null, "updateContext": null }, - "start": 567, - "end": 568, + "start": 683, + "end": 684, "loc": { "start": { - "line": 28, + "line": 33, "column": 11 }, "end": { - "line": 28, + "line": 33, "column": 12 } } @@ -4363,15 +7259,15 @@ "binop": null }, "value": "B", - "start": 570, - "end": 571, + "start": 686, + "end": 687, "loc": { "start": { - "line": 29, + "line": 34, "column": 1 }, "end": { - "line": 29, + "line": 34, "column": 2 } } @@ -4389,15 +7285,15 @@ "binop": null, "updateContext": null }, - "start": 571, - "end": 572, + "start": 687, + "end": 688, "loc": { "start": { - "line": 29, + "line": 34, "column": 2 }, "end": { - "line": 29, + "line": 34, "column": 3 } } @@ -4415,15 +7311,15 @@ "binop": null }, "value": "right", - "start": 572, - "end": 577, + "start": 688, + "end": 693, "loc": { "start": { - "line": 29, + "line": 34, "column": 3 }, "end": { - "line": 29, + "line": 34, "column": 8 } } @@ -4442,15 +7338,15 @@ "updateContext": null }, "value": "=", - "start": 578, - "end": 579, + "start": 694, + "end": 695, "loc": { "start": { - "line": 29, + "line": 34, "column": 9 }, "end": { - "line": 29, + "line": 34, "column": 10 } } @@ -4468,15 +7364,15 @@ "binop": null }, "value": "b", - "start": 580, - "end": 581, + "start": 696, + "end": 697, "loc": { "start": { - "line": 29, + "line": 34, "column": 11 }, "end": { - "line": 29, + "line": 34, "column": 12 } } @@ -4494,15 +7390,15 @@ "binop": null, "updateContext": null }, - "start": 581, - "end": 582, + "start": 697, + "end": 698, "loc": { "start": { - "line": 29, + "line": 34, "column": 12 }, "end": { - "line": 29, + "line": 34, "column": 13 } } @@ -4520,15 +7416,15 @@ "binop": null }, "value": "a", - "start": 585, - "end": 586, + "start": 701, + "end": 702, "loc": { "start": { - "line": 31, + "line": 36, "column": 1 }, "end": { - "line": 31, + "line": 36, "column": 2 } } @@ -4546,15 +7442,15 @@ "binop": null, "updateContext": null }, - "start": 586, - "end": 587, + "start": 702, + "end": 703, "loc": { "start": { - "line": 31, + "line": 36, "column": 2 }, "end": { - "line": 31, + "line": 36, "column": 3 } } @@ -4572,15 +7468,15 @@ "binop": null }, "value": "parent", - "start": 587, - "end": 593, + "start": 703, + "end": 709, "loc": { "start": { - "line": 31, + "line": 36, "column": 3 }, "end": { - "line": 31, + "line": 36, "column": 9 } } @@ -4599,15 +7495,15 @@ "updateContext": null }, "value": "=", - "start": 594, - "end": 595, + "start": 710, + "end": 711, "loc": { "start": { - "line": 31, + "line": 36, "column": 10 }, "end": { - "line": 31, + "line": 36, "column": 11 } } @@ -4625,15 +7521,15 @@ "binop": null }, "value": "B", - "start": 596, - "end": 597, + "start": 712, + "end": 713, "loc": { "start": { - "line": 31, + "line": 36, "column": 12 }, "end": { - "line": 31, + "line": 36, "column": 13 } } @@ -4651,15 +7547,15 @@ "binop": null, "updateContext": null }, - "start": 597, - "end": 598, + "start": 713, + "end": 714, "loc": { "start": { - "line": 31, + "line": 36, "column": 13 }, "end": { - "line": 31, + "line": 36, "column": 14 } } @@ -4677,15 +7573,15 @@ "binop": null }, "value": "b", - "start": 600, - "end": 601, + "start": 716, + "end": 717, "loc": { "start": { - "line": 32, + "line": 37, "column": 1 }, "end": { - "line": 32, + "line": 37, "column": 2 } } @@ -4703,15 +7599,15 @@ "binop": null, "updateContext": null }, - "start": 601, - "end": 602, + "start": 717, + "end": 718, "loc": { "start": { - "line": 32, + "line": 37, "column": 2 }, "end": { - "line": 32, + "line": 37, "column": 3 } } @@ -4729,15 +7625,15 @@ "binop": null }, "value": "parent", - "start": 602, - "end": 608, + "start": 718, + "end": 724, "loc": { "start": { - "line": 32, + "line": 37, "column": 3 }, "end": { - "line": 32, + "line": 37, "column": 9 } } @@ -4756,15 +7652,15 @@ "updateContext": null }, "value": "=", - "start": 609, - "end": 610, + "start": 725, + "end": 726, "loc": { "start": { - "line": 32, + "line": 37, "column": 10 }, "end": { - "line": 32, + "line": 37, "column": 11 } } @@ -4782,15 +7678,15 @@ "binop": null }, "value": "B", - "start": 611, - "end": 612, + "start": 727, + "end": 728, "loc": { "start": { - "line": 32, + "line": 37, "column": 12 }, "end": { - "line": 32, + "line": 37, "column": 13 } } @@ -4808,15 +7704,15 @@ "binop": null, "updateContext": null }, - "start": 612, - "end": 613, + "start": 728, + "end": 729, "loc": { "start": { - "line": 32, + "line": 37, "column": 13 }, "end": { - "line": 32, + "line": 37, "column": 14 } } @@ -4834,15 +7730,15 @@ "binop": null }, "value": "c", - "start": 615, - "end": 616, + "start": 731, + "end": 732, "loc": { "start": { - "line": 33, + "line": 38, "column": 1 }, "end": { - "line": 33, + "line": 38, "column": 2 } } @@ -4860,15 +7756,15 @@ "binop": null, "updateContext": null }, - "start": 616, - "end": 617, + "start": 732, + "end": 733, "loc": { "start": { - "line": 33, + "line": 38, "column": 2 }, "end": { - "line": 33, + "line": 38, "column": 3 } } @@ -4886,15 +7782,15 @@ "binop": null }, "value": "parent", - "start": 617, - "end": 623, + "start": 733, + "end": 739, "loc": { "start": { - "line": 33, + "line": 38, "column": 3 }, "end": { - "line": 33, + "line": 38, "column": 9 } } @@ -4913,15 +7809,15 @@ "updateContext": null }, "value": "=", - "start": 624, - "end": 625, + "start": 740, + "end": 741, "loc": { "start": { - "line": 33, + "line": 38, "column": 10 }, "end": { - "line": 33, + "line": 38, "column": 11 } } @@ -4939,15 +7835,15 @@ "binop": null }, "value": "A", - "start": 626, - "end": 627, + "start": 742, + "end": 743, "loc": { "start": { - "line": 33, + "line": 38, "column": 12 }, "end": { - "line": 33, + "line": 38, "column": 13 } } @@ -4965,15 +7861,15 @@ "binop": null, "updateContext": null }, - "start": 627, - "end": 628, + "start": 743, + "end": 744, "loc": { "start": { - "line": 33, + "line": 38, "column": 13 }, "end": { - "line": 33, + "line": 38, "column": 14 } } @@ -4990,15 +7886,15 @@ "postfix": false, "binop": null }, - "start": 629, - "end": 630, + "start": 745, + "end": 746, "loc": { "start": { - "line": 34, + "line": 39, "column": 0 }, "end": { - "line": 34, + "line": 39, "column": 1 } } @@ -5016,19 +7912,127 @@ "binop": null, "updateContext": null }, - "start": 630, - "end": 631, + "start": 746, + "end": 747, "loc": { "start": { - "line": 34, + "line": 39, "column": 1 }, "end": { - "line": 34, + "line": 39, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 749, + "end": 755, + "loc": { + "start": { + "line": 41, + "column": 0 + }, + "end": { + "line": 41, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 756, + "end": 763, + "loc": { + "start": { + "line": 41, + "column": 7 + }, + "end": { + "line": 41, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 764, + "end": 775, + "loc": { + "start": { + "line": 41, + "column": 15 + }, + "end": { + "line": 41, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 775, + "end": 776, + "loc": { + "start": { + "line": 41, + "column": 26 + }, + "end": { + "line": 41, + "column": 27 + } + } + }, { "type": { "label": "eof", @@ -5042,15 +8046,15 @@ "binop": null, "updateContext": null }, - "start": 632, - "end": 632, + "start": 777, + "end": 777, "loc": { "start": { - "line": 35, + "line": 42, "column": 0 }, "end": { - "line": 35, + "line": 42, "column": 0 } } diff --git a/ast/source/rotate/rotate_right.js.json b/ast/source/rotate/rotate_right.js.json index 8ae5be4..fca0294 100644 --- a/ast/source/rotate/rotate_right.js.json +++ b/ast/source/rotate/rotate_right.js.json @@ -1,1150 +1,858 @@ { "type": "File", "start": 0, - "end": 642, + "end": 788, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 35, + "line": 42, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 642, + "end": 788, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 35, + "line": 42, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 341, - "end": 641, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 16, + "line": 1, "column": 0 }, "end": { - "line": 34, - "column": 2 + "line": 1, + "column": 28 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 348, - "end": 641, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, "loc": { "start": { - "line": 16, - "column": 7 + "line": 1, + "column": 19 }, "end": { - "line": 34, - "column": 2 + "line": 1, + "column": 27 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 354, - "end": 640, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, "loc": { "start": { - "line": 16, - "column": 13 + "line": 2, + "column": 7 }, "end": { - "line": 34, - "column": 1 - } + "line": 2, + "column": 11 + }, + "identifierName": "Node" }, - "id": { - "type": "Identifier", - "start": 354, - "end": 366, - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 16, - "column": 25 - }, - "identifierName": "rotate_right" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 406, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 408, + "end": 757, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 39, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 414, + "end": 756, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 39, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 414, + "end": 426, + "loc": { + "start": { + "line": 19, + "column": 6 }, - "name": "rotate_right", - "leadingComments": null + "end": { + "line": 19, + "column": 18 + }, + "identifierName": "rotate_right" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 369, - "end": 640, - "loc": { - "start": { - "line": 16, - "column": 28 - }, - "end": { - "line": 34, - "column": 1 - } + "name": "rotate_right", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 429, + "end": 756, + "loc": { + "start": { + "line": 19, + "column": 21 }, - "id": { + "end": { + "line": 39, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 354, - "end": 366, + "start": 430, + "end": 431, "loc": { "start": { - "line": 16, - "column": 13 + "line": 19, + "column": 22 }, "end": { - "line": 16, - "column": 25 + "line": 19, + "column": 23 }, - "identifierName": "rotate_right" + "identifierName": "B" }, - "name": "rotate_right", - "leadingComments": null + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 436, + "end": 756, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 39, + "column": 1 + } }, - "generator": false, - "expression": false, - "async": false, - "params": [ + "body": [ { - "type": "Identifier", - "start": 370, - "end": 371, + "type": "ExpressionStatement", + "start": 439, + "end": 465, "loc": { "start": { - "line": 16, - "column": 29 + "line": 20, + "column": 1 }, "end": { - "line": 16, - "column": 30 - }, - "identifierName": "B" - }, - "name": "B" - } - ], - "body": { - "type": "BlockStatement", - "start": 376, - "end": 640, - "loc": { - "start": { - "line": 16, - "column": 35 + "line": 20, + "column": 27 + } }, - "end": { - "line": 34, - "column": 1 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 379, - "end": 396, + "expression": { + "type": "CallExpression", + "start": 439, + "end": 464, "loc": { "start": { - "line": 17, + "line": 20, "column": 1 }, "end": { - "line": 17, - "column": 18 + "line": 20, + "column": 26 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 439, + "end": 445, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 385, - "end": 395, + "type": "BinaryExpression", + "start": 446, + "end": 463, "loc": { "start": { - "line": 17, - "column": 7 + "line": 20, + "column": 8 }, "end": { - "line": 17, - "column": 17 + "line": 20, + "column": 25 } }, - "id": { + "left": { "type": "Identifier", - "start": 385, - "end": 386, + "start": 446, + "end": 447, "loc": { "start": { - "line": 17, - "column": 7 + "line": 20, + "column": 8 }, "end": { - "line": 17, - "column": 8 + "line": 20, + "column": 9 }, - "identifierName": "A" + "identifierName": "B" }, - "name": "A" + "name": "B" }, - "init": { - "type": "MemberExpression", - "start": 389, - "end": 395, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 459, + "end": 463, "loc": { "start": { - "line": 17, - "column": 11 + "line": 20, + "column": 21 }, "end": { - "line": 17, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 389, - "end": 390, - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 12 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 391, - "end": 395, - "loc": { - "start": { - "line": 17, - "column": 13 - }, - "end": { - "line": 17, - "column": 17 - }, - "identifierName": "left" + "line": 20, + "column": 25 }, - "name": "left" + "identifierName": "Node" }, - "computed": false + "name": "Node" } } - ], - "kind": "const" + ] + } + }, + { + "type": "VariableDeclaration", + "start": 467, + "end": 484, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 18 + } }, - { - "type": "VariableDeclaration", - "start": 398, - "end": 415, - "loc": { - "start": { - "line": 18, - "column": 1 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 473, + "end": 483, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 17 + } }, - "end": { - "line": 18, - "column": 18 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 404, - "end": 414, + "id": { + "type": "Identifier", + "start": 473, + "end": 474, "loc": { "start": { - "line": 18, + "line": 21, "column": 7 }, "end": { - "line": 18, - "column": 17 - } + "line": 21, + "column": 8 + }, + "identifierName": "A" }, - "id": { - "type": "Identifier", - "start": 404, - "end": 405, - "loc": { - "start": { - "line": 18, - "column": 7 + "name": "A" + }, + "init": { + "type": "MemberExpression", + "start": 477, + "end": 483, + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 477, + "end": 478, + "loc": { + "start": { + "line": 21, + "column": 11 }, "end": { - "line": 18, - "column": 8 + "line": 21, + "column": 12 }, - "identifierName": "a" + "identifierName": "B" }, - "name": "a" + "name": "B" }, - "init": { - "type": "MemberExpression", - "start": 408, - "end": 414, + "property": { + "type": "Identifier", + "start": 479, + "end": 483, "loc": { "start": { - "line": 18, - "column": 11 + "line": 21, + "column": 13 }, "end": { - "line": 18, + "line": 21, "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 408, - "end": 409, - "loc": { - "start": { - "line": 18, - "column": 11 - }, - "end": { - "line": 18, - "column": 12 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 410, - "end": 414, - "loc": { - "start": { - "line": 18, - "column": 13 - }, - "end": { - "line": 18, - "column": 17 - }, - "identifierName": "left" }, - "name": "left" + "identifierName": "left" }, - "computed": false - } + "name": "left" + }, + "computed": false } - ], - "kind": "const" + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 486, + "end": 512, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 27 + } }, - { - "type": "VariableDeclaration", - "start": 417, - "end": 435, + "expression": { + "type": "CallExpression", + "start": 486, + "end": 511, "loc": { "start": { - "line": 19, + "line": 22, "column": 1 }, "end": { - "line": 19, - "column": 19 + "line": 22, + "column": 26 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 486, + "end": 492, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 423, - "end": 434, + "type": "BinaryExpression", + "start": 493, + "end": 510, "loc": { "start": { - "line": 19, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 19, - "column": 18 + "line": 22, + "column": 25 } }, - "id": { + "left": { "type": "Identifier", - "start": 423, - "end": 424, + "start": 493, + "end": 494, "loc": { "start": { - "line": 19, - "column": 7 + "line": 22, + "column": 8 }, "end": { - "line": 19, - "column": 8 + "line": 22, + "column": 9 }, - "identifierName": "b" + "identifierName": "A" }, - "name": "b" + "name": "A" }, - "init": { - "type": "MemberExpression", - "start": 427, - "end": 434, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 506, + "end": 510, "loc": { "start": { - "line": 19, - "column": 11 + "line": 22, + "column": 21 }, "end": { - "line": 19, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 427, - "end": 428, - "loc": { - "start": { - "line": 19, - "column": 11 - }, - "end": { - "line": 19, - "column": 12 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 429, - "end": 434, - "loc": { - "start": { - "line": 19, - "column": 13 - }, - "end": { - "line": 19, - "column": 18 - }, - "identifierName": "right" + "line": 22, + "column": 25 }, - "name": "right" + "identifierName": "Node" }, - "computed": false + "name": "Node" } } - ], - "kind": "const" + ] + } + }, + { + "type": "VariableDeclaration", + "start": 514, + "end": 531, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 18 + } }, - { - "type": "VariableDeclaration", - "start": 437, - "end": 455, - "loc": { - "start": { - "line": 20, - "column": 1 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 520, + "end": 530, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 17 + } }, - "end": { - "line": 20, - "column": 19 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 443, - "end": 454, + "id": { + "type": "Identifier", + "start": 520, + "end": 521, "loc": { "start": { - "line": 20, + "line": 23, "column": 7 }, "end": { - "line": 20, - "column": 18 + "line": 23, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "MemberExpression", + "start": 524, + "end": 530, + "loc": { + "start": { + "line": 23, + "column": 11 + }, + "end": { + "line": 23, + "column": 17 } }, - "id": { + "object": { "type": "Identifier", - "start": 443, - "end": 444, + "start": 524, + "end": 525, "loc": { "start": { - "line": 20, - "column": 7 + "line": 23, + "column": 11 }, "end": { - "line": 20, - "column": 8 + "line": 23, + "column": 12 }, - "identifierName": "c" + "identifierName": "A" }, - "name": "c" + "name": "A" }, - "init": { - "type": "MemberExpression", - "start": 447, - "end": 454, + "property": { + "type": "Identifier", + "start": 526, + "end": 530, "loc": { "start": { - "line": 20, - "column": 11 + "line": 23, + "column": 13 }, "end": { - "line": 20, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 447, - "end": 448, - "loc": { - "start": { - "line": 20, - "column": 11 - }, - "end": { - "line": 20, - "column": 12 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 449, - "end": 454, - "loc": { - "start": { - "line": 20, - "column": 13 - }, - "end": { - "line": 20, - "column": 18 - }, - "identifierName": "right" + "line": 23, + "column": 17 }, - "name": "right" + "identifierName": "left" }, - "computed": false - } + "name": "left" + }, + "computed": false } - ], - "kind": "const" + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 533, + "end": 551, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 19 + } }, - { - "type": "ExpressionStatement", - "start": 458, - "end": 490, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 33 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 458, - "end": 489, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 539, + "end": 550, "loc": { "start": { - "line": 22, - "column": 1 + "line": 24, + "column": 7 }, "end": { - "line": 22, - "column": 32 + "line": 24, + "column": 18 } }, - "operator": "=", - "left": { - "type": "ArrayPattern", - "start": 458, - "end": 472, + "id": { + "type": "Identifier", + "start": 539, + "end": 540, "loc": { "start": { - "line": 22, - "column": 1 + "line": 24, + "column": 7 }, "end": { - "line": 22, - "column": 15 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 459, - "end": 464, - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 459, - "end": 460, - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 22, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 461, - "end": 464, - "loc": { - "start": { - "line": 22, - "column": 4 - }, - "end": { - "line": 22, - "column": 7 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false + "line": 24, + "column": 8 }, - { - "type": "MemberExpression", - "start": 466, - "end": 471, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 466, - "end": 467, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 10 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 468, - "end": 471, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 14 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - } - ] + "identifierName": "b" + }, + "name": "b" }, - "right": { - "type": "ArrayExpression", - "start": 475, - "end": 489, + "init": { + "type": "MemberExpression", + "start": 543, + "end": 550, "loc": { "start": { - "line": 22, - "column": 18 + "line": 24, + "column": 11 }, "end": { - "line": 22, - "column": 32 + "line": 24, + "column": 18 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 476, - "end": 481, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 24 - } - }, - "object": { - "type": "Identifier", - "start": 476, - "end": 477, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 20 - }, - "identifierName": "B" - }, - "name": "B" + "object": { + "type": "Identifier", + "start": 543, + "end": 544, + "loc": { + "start": { + "line": 24, + "column": 11 }, - "property": { - "type": "Identifier", - "start": 478, - "end": 481, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 24 - }, - "identifierName": "key" - }, - "name": "key" + "end": { + "line": 24, + "column": 12 }, - "computed": false + "identifierName": "A" }, - { - "type": "MemberExpression", - "start": 483, - "end": 488, - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 31 - } - }, - "object": { - "type": "Identifier", - "start": 483, - "end": 484, - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 27 - }, - "identifierName": "A" - }, - "name": "A" + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 545, + "end": 550, + "loc": { + "start": { + "line": 24, + "column": 13 }, - "property": { - "type": "Identifier", - "start": 485, - "end": 488, - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 22, - "column": 31 - }, - "identifierName": "key" - }, - "name": "key" + "end": { + "line": 24, + "column": 18 }, - "computed": false - } - ] + "identifierName": "right" + }, + "name": "right" + }, + "computed": false } } - }, - { - "type": "ExpressionStatement", - "start": 492, - "end": 536, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 45 - } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 553, + "end": 571, + "loc": { + "start": { + "line": 25, + "column": 1 }, - "expression": { - "type": "AssignmentExpression", - "start": 492, - "end": 535, + "end": { + "line": 25, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 559, + "end": 570, "loc": { "start": { - "line": 23, - "column": 1 + "line": 25, + "column": 7 }, "end": { - "line": 23, - "column": 44 + "line": 25, + "column": 18 } }, - "operator": "=", - "left": { - "type": "ArrayPattern", - "start": 492, - "end": 512, + "id": { + "type": "Identifier", + "start": 559, + "end": 560, "loc": { "start": { - "line": 23, - "column": 1 + "line": 25, + "column": 7 }, "end": { - "line": 23, - "column": 21 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 493, - "end": 501, - "loc": { - "start": { - "line": 23, - "column": 2 - }, - "end": { - "line": 23, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 493, - "end": 494, - "loc": { - "start": { - "line": 23, - "column": 2 - }, - "end": { - "line": 23, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 495, - "end": 501, - "loc": { - "start": { - "line": 23, - "column": 4 - }, - "end": { - "line": 23, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 503, - "end": 511, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 503, - "end": 504, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 13 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 505, - "end": 511, - "loc": { - "start": { - "line": 23, - "column": 14 - }, - "end": { - "line": 23, - "column": 20 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] - }, - "right": { - "type": "ArrayExpression", - "start": 515, - "end": 535, - "loc": { - "start": { - "line": 23, - "column": 24 - }, - "end": { - "line": 23, - "column": 44 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 516, - "end": 524, - "loc": { - "start": { - "line": 23, - "column": 25 - }, - "end": { - "line": 23, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 516, - "end": 517, - "loc": { - "start": { - "line": 23, - "column": 25 - }, - "end": { - "line": 23, - "column": 26 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 518, - "end": 524, - "loc": { - "start": { - "line": 23, - "column": 27 - }, - "end": { - "line": 23, - "column": 33 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 25, + "column": 8 }, - { - "type": "MemberExpression", - "start": 526, - "end": 534, - "loc": { - "start": { - "line": 23, - "column": 35 - }, - "end": { - "line": 23, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 526, - "end": 527, - "loc": { - "start": { - "line": 23, - "column": 35 - }, - "end": { - "line": 23, - "column": 36 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 528, - "end": 534, - "loc": { - "start": { - "line": 23, - "column": 37 - }, - "end": { - "line": 23, - "column": 43 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] - } - } - }, - { - "type": "ExpressionStatement", - "start": 539, - "end": 550, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 12 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 539, - "end": 549, - "loc": { - "start": { - "line": 25, - "column": 1 + "identifierName": "c" }, - "end": { - "line": 25, - "column": 11 - } + "name": "c" }, - "operator": "=", - "left": { + "init": { "type": "MemberExpression", - "start": 539, - "end": 545, + "start": 563, + "end": 570, "loc": { "start": { "line": 25, - "column": 1 + "column": 11 }, "end": { "line": 25, - "column": 7 + "column": 18 } }, "object": { "type": "Identifier", - "start": 539, - "end": 540, + "start": 563, + "end": 564, "loc": { "start": { "line": 25, - "column": 1 + "column": 11 }, "end": { "line": 25, - "column": 2 + "column": 12 }, "identifierName": "B" }, @@ -1152,768 +860,3877 @@ }, "property": { "type": "Identifier", - "start": 541, - "end": 545, + "start": 565, + "end": 570, "loc": { "start": { "line": 25, - "column": 3 + "column": 13 }, "end": { "line": 25, - "column": 7 + "column": 18 }, - "identifierName": "left" + "identifierName": "right" }, - "name": "left" + "name": "right" }, "computed": false - }, - "right": { - "type": "Identifier", - "start": 548, - "end": 549, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 11 - }, - "identifierName": "a" - }, - "name": "a" } } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 574, + "end": 606, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 33 + } }, - { - "type": "ExpressionStatement", - "start": 552, - "end": 564, + "expression": { + "type": "AssignmentExpression", + "start": 574, + "end": 605, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, - "column": 13 + "line": 27, + "column": 32 } }, - "expression": { - "type": "AssignmentExpression", - "start": 552, - "end": 563, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 574, + "end": 588, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, - "column": 12 + "line": 27, + "column": 15 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 552, - "end": 559, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 552, - "end": 553, + "elements": [ + { + "type": "MemberExpression", + "start": 575, + "end": 580, "loc": { "start": { - "line": 26, - "column": 1 + "line": 27, + "column": 2 }, "end": { - "line": 26, - "column": 2 + "line": 27, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 575, + "end": 576, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 3 + }, + "identifierName": "A" }, - "identifierName": "B" + "name": "A" }, - "name": "B" + "property": { + "type": "Identifier", + "start": 577, + "end": 580, + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false }, - "property": { - "type": "Identifier", - "start": 554, - "end": 559, + { + "type": "MemberExpression", + "start": 582, + "end": 587, "loc": { "start": { - "line": 26, - "column": 3 + "line": 27, + "column": 9 }, "end": { - "line": 26, - "column": 8 - }, - "identifierName": "right" + "line": 27, + "column": 14 + } }, - "name": "right" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 562, - "end": 563, - "loc": { - "start": { - "line": 26, - "column": 11 + "object": { + "type": "Identifier", + "start": 582, + "end": 583, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + }, + "identifierName": "B" + }, + "name": "B" }, - "end": { - "line": 26, - "column": 12 + "property": { + "type": "Identifier", + "start": 584, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 14 + }, + "identifierName": "key" + }, + "name": "key" }, - "identifierName": "A" - }, - "name": "A" - } - } - }, - { - "type": "ExpressionStatement", - "start": 567, - "end": 578, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 12 - } + "computed": false + } + ] }, - "expression": { - "type": "AssignmentExpression", - "start": 567, - "end": 577, + "right": { + "type": "ArrayExpression", + "start": 591, + "end": 605, "loc": { "start": { - "line": 28, - "column": 1 + "line": 27, + "column": 18 }, "end": { - "line": 28, - "column": 11 + "line": 27, + "column": 32 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 567, - "end": 573, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 567, - "end": 568, + "elements": [ + { + "type": "MemberExpression", + "start": 592, + "end": 597, "loc": { "start": { - "line": 28, - "column": 1 + "line": 27, + "column": 19 }, "end": { - "line": 28, - "column": 2 + "line": 27, + "column": 24 + } + }, + "object": { + "type": "Identifier", + "start": 592, + "end": 593, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "B" }, - "identifierName": "A" + "name": "B" }, - "name": "A" + "property": { + "type": "Identifier", + "start": 594, + "end": 597, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 24 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false }, - "property": { - "type": "Identifier", - "start": 569, - "end": 573, + { + "type": "MemberExpression", + "start": 599, + "end": 604, "loc": { "start": { - "line": 28, - "column": 3 + "line": 27, + "column": 26 }, "end": { - "line": 28, - "column": 7 - }, - "identifierName": "left" + "line": 27, + "column": 31 + } }, - "name": "left" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 576, - "end": 577, - "loc": { - "start": { - "line": 28, - "column": 10 + "object": { + "type": "Identifier", + "start": 599, + "end": 600, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + }, + "identifierName": "A" + }, + "name": "A" }, - "end": { - "line": 28, - "column": 11 + "property": { + "type": "Identifier", + "start": 601, + "end": 604, + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 31 + }, + "identifierName": "key" + }, + "name": "key" }, - "identifierName": "b" - }, - "name": "b" - } + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 608, + "end": 652, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 45 } }, - { - "type": "ExpressionStatement", - "start": 580, - "end": 592, + "expression": { + "type": "AssignmentExpression", + "start": 608, + "end": 651, "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 29, - "column": 13 + "line": 28, + "column": 44 } }, - "expression": { - "type": "AssignmentExpression", - "start": 580, - "end": 591, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 608, + "end": 628, "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 29, - "column": 12 + "line": 28, + "column": 21 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 580, - "end": 587, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 580, - "end": 581, + "elements": [ + { + "type": "MemberExpression", + "start": 609, + "end": 617, "loc": { "start": { - "line": 29, - "column": 1 + "line": 28, + "column": 2 }, "end": { - "line": 29, - "column": 2 + "line": 28, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + }, + "identifierName": "A" }, - "identifierName": "A" + "name": "A" }, - "name": "A" + "property": { + "type": "Identifier", + "start": 611, + "end": 617, + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "property": { - "type": "Identifier", - "start": 582, - "end": 587, + { + "type": "MemberExpression", + "start": 619, + "end": 627, "loc": { "start": { - "line": 29, - "column": 3 + "line": 28, + "column": 12 }, "end": { - "line": 29, - "column": 8 - }, - "identifierName": "right" + "line": 28, + "column": 20 + } }, - "name": "right" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 590, - "end": 591, - "loc": { - "start": { - "line": 29, - "column": 11 + "object": { + "type": "Identifier", + "start": 619, + "end": 620, + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 28, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" }, - "end": { - "line": 29, - "column": 12 + "property": { + "type": "Identifier", + "start": 621, + "end": 627, + "loc": { + "start": { + "line": 28, + "column": 14 + }, + "end": { + "line": 28, + "column": 20 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "c" - }, - "name": "c" - } - } - }, - { - "type": "ExpressionStatement", - "start": 595, - "end": 608, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 14 - } + "computed": false + } + ] }, - "expression": { - "type": "AssignmentExpression", - "start": 595, - "end": 607, + "right": { + "type": "ArrayExpression", + "start": 631, + "end": 651, "loc": { "start": { - "line": 31, - "column": 1 + "line": 28, + "column": 24 }, "end": { - "line": 31, - "column": 13 + "line": 28, + "column": 44 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 595, - "end": 603, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 595, - "end": 596, + "elements": [ + { + "type": "MemberExpression", + "start": 632, + "end": 640, "loc": { "start": { - "line": 31, - "column": 1 + "line": 28, + "column": 25 }, "end": { - "line": 31, - "column": 2 + "line": 28, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 632, + "end": 633, + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 26 + }, + "identifierName": "B" }, - "identifierName": "a" + "name": "B" }, - "name": "a" + "property": { + "type": "Identifier", + "start": 634, + "end": 640, + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 33 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "property": { - "type": "Identifier", - "start": 597, - "end": 603, + { + "type": "MemberExpression", + "start": 642, + "end": 650, "loc": { "start": { - "line": 31, - "column": 3 + "line": 28, + "column": 35 }, "end": { - "line": 31, - "column": 9 - }, - "identifierName": "parent" + "line": 28, + "column": 43 + } }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 606, - "end": 607, - "loc": { - "start": { - "line": 31, - "column": 12 + "object": { + "type": "Identifier", + "start": 642, + "end": 643, + "loc": { + "start": { + "line": 28, + "column": 35 + }, + "end": { + "line": 28, + "column": 36 + }, + "identifierName": "A" + }, + "name": "A" }, - "end": { - "line": 31, - "column": 13 + "property": { + "type": "Identifier", + "start": 644, + "end": 650, + "loc": { + "start": { + "line": 28, + "column": 37 + }, + "end": { + "line": 28, + "column": 43 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "B" - }, - "name": "B" - } + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 655, + "end": 666, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 12 } }, - { - "type": "ExpressionStatement", - "start": 610, - "end": 623, + "expression": { + "type": "AssignmentExpression", + "start": 655, + "end": 665, "loc": { "start": { - "line": 32, + "line": 30, "column": 1 }, "end": { - "line": 32, - "column": 14 + "line": 30, + "column": 11 } }, - "expression": { - "type": "AssignmentExpression", - "start": 610, - "end": 622, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 655, + "end": 661, "loc": { "start": { - "line": 32, + "line": 30, "column": 1 }, "end": { - "line": 32, - "column": 13 + "line": 30, + "column": 7 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 610, - "end": 618, + "object": { + "type": "Identifier", + "start": 655, + "end": 656, "loc": { "start": { - "line": 32, + "line": 30, "column": 1 }, "end": { - "line": 32, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 610, - "end": 611, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 2 - }, - "identifierName": "b" - }, - "name": "b" - }, - "property": { - "type": "Identifier", - "start": 612, - "end": 618, - "loc": { - "start": { - "line": 32, - "column": 3 - }, - "end": { - "line": 32, - "column": 9 - }, - "identifierName": "parent" + "line": 30, + "column": 2 }, - "name": "parent" + "identifierName": "B" }, - "computed": false + "name": "B" }, - "right": { + "property": { "type": "Identifier", - "start": 621, - "end": 622, + "start": 657, + "end": 661, "loc": { "start": { - "line": 32, - "column": 12 + "line": 30, + "column": 3 }, "end": { - "line": 32, - "column": 13 + "line": 30, + "column": 7 }, - "identifierName": "A" + "identifierName": "left" }, - "name": "A" - } - } - }, - { - "type": "ExpressionStatement", - "start": 625, - "end": 638, - "loc": { - "start": { - "line": 33, - "column": 1 + "name": "left" }, - "end": { - "line": 33, - "column": 14 - } + "computed": false }, - "expression": { - "type": "AssignmentExpression", - "start": 625, - "end": 637, + "right": { + "type": "Identifier", + "start": 664, + "end": 665, "loc": { "start": { - "line": 33, - "column": 1 + "line": 30, + "column": 10 }, "end": { - "line": 33, - "column": 13 + "line": 30, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + } + }, + { + "type": "ExpressionStatement", + "start": 668, + "end": 680, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 668, + "end": 679, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 668, + "end": 675, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 8 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 625, - "end": 633, + "object": { + "type": "Identifier", + "start": 668, + "end": 669, "loc": { "start": { - "line": 33, + "line": 31, "column": 1 }, "end": { - "line": 33, - "column": 9 - } + "line": 31, + "column": 2 + }, + "identifierName": "B" }, - "object": { - "type": "Identifier", - "start": 625, - "end": 626, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 2 - }, - "identifierName": "c" + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 670, + "end": 675, + "loc": { + "start": { + "line": 31, + "column": 3 }, - "name": "c" + "end": { + "line": 31, + "column": 8 + }, + "identifierName": "right" }, - "property": { - "type": "Identifier", - "start": 627, - "end": 633, - "loc": { - "start": { - "line": 33, - "column": 3 - }, - "end": { - "line": 33, - "column": 9 - }, - "identifierName": "parent" + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 678, + "end": 679, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ExpressionStatement", + "start": 683, + "end": 694, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 683, + "end": 693, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 683, + "end": 689, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 683, + "end": 684, + "loc": { + "start": { + "line": 33, + "column": 1 }, - "name": "parent" + "end": { + "line": 33, + "column": 2 + }, + "identifierName": "A" }, - "computed": false + "name": "A" }, - "right": { + "property": { "type": "Identifier", - "start": 636, - "end": 637, + "start": 685, + "end": 689, "loc": { "start": { "line": 33, - "column": 12 + "column": 3 }, "end": { "line": 33, - "column": 13 + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 692, + "end": 693, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 11 + }, + "identifierName": "b" + }, + "name": "b" + } + } + }, + { + "type": "ExpressionStatement", + "start": 696, + "end": 708, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 696, + "end": 707, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 696, + "end": 703, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 696, + "end": 697, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 2 }, "identifierName": "A" }, "name": "A" + }, + "property": { + "type": "Identifier", + "start": 698, + "end": 703, + "loc": { + "start": { + "line": 34, + "column": 3 + }, + "end": { + "line": 34, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 706, + "end": 707, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + } + } + }, + { + "type": "ExpressionStatement", + "start": 711, + "end": 724, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 711, + "end": 723, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 13 } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 711, + "end": 719, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 711, + "end": 712, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 713, + "end": 719, + "loc": { + "start": { + "line": 36, + "column": 3 + }, + "end": { + "line": 36, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 722, + "end": 723, + "loc": { + "start": { + "line": 36, + "column": 12 + }, + "end": { + "line": 36, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" } } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ + }, + { + "type": "ExpressionStatement", + "start": 726, + "end": 739, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 726, + "end": 738, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 726, + "end": 734, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 726, + "end": 727, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 2 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "Identifier", + "start": 728, + "end": 734, + "loc": { + "start": { + "line": 37, + "column": 3 + }, + "end": { + "line": 37, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 737, + "end": 738, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ExpressionStatement", + "start": 741, + "end": 754, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 741, + "end": 753, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 741, + "end": 749, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 741, + "end": 742, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 2 + }, + "identifierName": "c" + }, + "name": "c" + }, + "property": { + "type": "Identifier", + "start": 743, + "end": 749, + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 752, + "end": 753, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 759, + "end": 787, + "loc": { + "start": { + "line": 41, + "column": 0 + }, + "end": { + "line": 41, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 774, + "end": 786, + "loc": { + "start": { + "line": 41, + "column": 15 + }, + "end": { + "line": 41, + "column": 27 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 759, + "end": 787, + "loc": { + "start": { + "line": 41, + "column": 0 + }, + "end": { + "line": 41, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 408, + "end": 757, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 39, + "column": 2 + } + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 0, - "end": 339, + "type": "VariableDeclarator", + "start": 414, + "end": 756, "loc": { "start": { - "line": 1, - "column": 0 + "line": 19, + "column": 6 }, "end": { - "line": 14, - "column": 3 + "line": 39, + "column": 1 } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 0, - "end": 339, - "loc": { - "start": { - "line": 1, - "column": 0 }, - "end": { - "line": 14, - "column": 3 - } - } - } - ] - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 0, - "end": 339, + "id": { + "type": "Identifier", + "start": 414, + "end": 426, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 429, + "end": 756, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 39, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 414, + "end": 426, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 430, + "end": 431, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + }, + "identifierName": "B" + }, + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 436, + "end": 756, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 39, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 439, + "end": 465, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 439, + "end": 464, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 439, + "end": 445, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 446, + "end": 463, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 446, + "end": 447, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 459, + "end": 463, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 467, + "end": 484, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 473, + "end": 483, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 473, + "end": 474, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + }, + "identifierName": "A" + }, + "name": "A" + }, + "init": { + "type": "MemberExpression", + "start": 477, + "end": 483, + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 477, + "end": 478, + "loc": { + "start": { + "line": 21, + "column": 11 + }, + "end": { + "line": 21, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 479, + "end": 483, + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 486, + "end": 512, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 486, + "end": 511, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 486, + "end": 492, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 493, + "end": 510, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 493, + "end": 494, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 506, + "end": 510, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 514, + "end": 531, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 520, + "end": 530, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 520, + "end": 521, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "MemberExpression", + "start": 524, + "end": 530, + "loc": { + "start": { + "line": 23, + "column": 11 + }, + "end": { + "line": 23, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 524, + "end": 525, + "loc": { + "start": { + "line": 23, + "column": 11 + }, + "end": { + "line": 23, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 526, + "end": 530, + "loc": { + "start": { + "line": 23, + "column": 13 + }, + "end": { + "line": 23, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 533, + "end": 551, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 539, + "end": 550, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 539, + "end": 540, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + }, + "identifierName": "b" + }, + "name": "b" + }, + "init": { + "type": "MemberExpression", + "start": 543, + "end": 550, + "loc": { + "start": { + "line": 24, + "column": 11 + }, + "end": { + "line": 24, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 543, + "end": 544, + "loc": { + "start": { + "line": 24, + "column": 11 + }, + "end": { + "line": 24, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 545, + "end": 550, + "loc": { + "start": { + "line": 24, + "column": 13 + }, + "end": { + "line": 24, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 553, + "end": 571, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 559, + "end": 570, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 559, + "end": 560, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + }, + "identifierName": "c" + }, + "name": "c" + }, + "init": { + "type": "MemberExpression", + "start": 563, + "end": 570, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 563, + "end": 564, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 565, + "end": 570, + "loc": { + "start": { + "line": 25, + "column": 13 + }, + "end": { + "line": 25, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 574, + "end": 606, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 33 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 574, + "end": 605, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 32 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 574, + "end": 588, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 15 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 575, + "end": 580, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 575, + "end": 576, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 577, + "end": 580, + "loc": { + "start": { + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 582, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 582, + "end": 583, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 584, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 14 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 591, + "end": 605, + "loc": { + "start": { + "line": 27, + "column": 18 + }, + "end": { + "line": 27, + "column": 32 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 592, + "end": 597, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 24 + } + }, + "object": { + "type": "Identifier", + "start": 592, + "end": 593, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 594, + "end": 597, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 24 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 599, + "end": 604, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "object": { + "type": "Identifier", + "start": 599, + "end": 600, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 601, + "end": 604, + "loc": { + "start": { + "line": 27, + "column": 28 + }, + "end": { + "line": 27, + "column": 31 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 608, + "end": 652, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 45 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 608, + "end": 651, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 44 + } + }, + "operator": "=", + "left": { + "type": "ArrayPattern", + "start": 608, + "end": 628, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 21 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 609, + "end": 617, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 611, + "end": 617, + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 619, + "end": 627, + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 28, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 619, + "end": 620, + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 28, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 621, + "end": 627, + "loc": { + "start": { + "line": 28, + "column": 14 + }, + "end": { + "line": 28, + "column": 20 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + ] + }, + "right": { + "type": "ArrayExpression", + "start": 631, + "end": 651, + "loc": { + "start": { + "line": 28, + "column": 24 + }, + "end": { + "line": 28, + "column": 44 + } + }, + "elements": [ + { + "type": "MemberExpression", + "start": 632, + "end": 640, + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 632, + "end": 633, + "loc": { + "start": { + "line": 28, + "column": 25 + }, + "end": { + "line": 28, + "column": 26 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 634, + "end": 640, + "loc": { + "start": { + "line": 28, + "column": 27 + }, + "end": { + "line": 28, + "column": 33 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 642, + "end": 650, + "loc": { + "start": { + "line": 28, + "column": 35 + }, + "end": { + "line": 28, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 642, + "end": 643, + "loc": { + "start": { + "line": 28, + "column": 35 + }, + "end": { + "line": 28, + "column": 36 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 644, + "end": 650, + "loc": { + "start": { + "line": 28, + "column": 37 + }, + "end": { + "line": 28, + "column": 43 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 655, + "end": 666, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 655, + "end": 665, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 655, + "end": 661, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 655, + "end": 656, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 657, + "end": 661, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 664, + "end": 665, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + } + }, + { + "type": "ExpressionStatement", + "start": 668, + "end": 680, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 668, + "end": 679, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 668, + "end": 675, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 668, + "end": 669, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 670, + "end": 675, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 678, + "end": 679, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ExpressionStatement", + "start": 683, + "end": 694, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 683, + "end": 693, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 683, + "end": 689, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 683, + "end": 684, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 685, + "end": 689, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 692, + "end": 693, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 11 + }, + "identifierName": "b" + }, + "name": "b" + } + } + }, + { + "type": "ExpressionStatement", + "start": 696, + "end": 708, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 696, + "end": 707, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 696, + "end": 703, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 696, + "end": 697, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 698, + "end": 703, + "loc": { + "start": { + "line": 34, + "column": 3 + }, + "end": { + "line": 34, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 706, + "end": 707, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + } + } + }, + { + "type": "ExpressionStatement", + "start": 711, + "end": 724, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 711, + "end": 723, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 711, + "end": 719, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 711, + "end": 712, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 2 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 713, + "end": 719, + "loc": { + "start": { + "line": 36, + "column": 3 + }, + "end": { + "line": 36, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 722, + "end": 723, + "loc": { + "start": { + "line": 36, + "column": 12 + }, + "end": { + "line": 36, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 726, + "end": 739, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 726, + "end": 738, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 726, + "end": 734, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 726, + "end": 727, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 2 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "Identifier", + "start": 728, + "end": 734, + "loc": { + "start": { + "line": 37, + "column": 3 + }, + "end": { + "line": 37, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 737, + "end": 738, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ExpressionStatement", + "start": 741, + "end": 754, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 741, + "end": 753, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 741, + "end": 749, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 741, + "end": 742, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 2 + }, + "identifierName": "c" + }, + "name": "c" + }, + "property": { + "type": "Identifier", + "start": 743, + "end": 749, + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 752, + "end": 753, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 406, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 406, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 406, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 408, + "end": 413, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 414, + "end": 426, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 429, + "end": 430, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 430, + "end": 431, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 431, + "end": 432, + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 433, + "end": 435, + "loc": { + "start": { + "line": 19, + "column": 25 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 436, + "end": 437, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 439, + "end": 445, "loc": { "start": { - "line": 1, - "column": 0 + "line": 20, + "column": 1 }, "end": { - "line": 14, - "column": 3 + "line": 20, + "column": 7 } } - } - ], - "tokens": [ + }, { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 0, - "end": 339, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 445, + "end": 446, "loc": { "start": { - "line": 1, - "column": 0 + "line": 20, + "column": 7 }, "end": { - "line": 14, - "column": 3 + "line": 20, + "column": 8 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 341, - "end": 347, + "value": "B", + "start": 446, + "end": 447, "loc": { "start": { - "line": 16, - "column": 0 + "line": 20, + "column": 8 }, "end": { - "line": 16, - "column": 6 + "line": 20, + "column": 9 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "const", - "start": 348, - "end": 353, + "value": "instanceof", + "start": 448, + "end": 458, "loc": { "start": { - "line": 16, - "column": 7 + "line": 20, + "column": 10 }, "end": { - "line": 16, - "column": 12 + "line": 20, + "column": 20 } } }, @@ -1929,69 +4746,96 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 354, - "end": 366, + "value": "Node", + "start": 459, + "end": 463, "loc": { "start": { - "line": 16, - "column": 13 + "line": 20, + "column": 21 }, "end": { - "line": 16, + "line": 20, "column": 25 } } }, { "type": { - "label": "=", + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 463, + "end": 464, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 26 + } + } + }, + { + "type": { + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 367, - "end": 368, + "start": 464, + "end": 465, "loc": { "start": { - "line": 16, + "line": 20, "column": 26 }, "end": { - "line": 16, + "line": 20, "column": 27 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 369, - "end": 370, + "value": "const", + "start": 467, + "end": 472, "loc": { "start": { - "line": 16, - "column": 28 + "line": 21, + "column": 1 }, "end": { - "line": 16, - "column": 29 + "line": 21, + "column": 6 } } }, @@ -2007,25 +4851,52 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 370, - "end": 371, + "value": "A", + "start": 473, + "end": 474, "loc": { "start": { - "line": 16, - "column": 29 + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 475, + "end": 476, + "loc": { + "start": { + "line": 21, + "column": 9 }, "end": { - "line": 16, - "column": 30 + "line": 21, + "column": 10 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2033,23 +4904,24 @@ "postfix": false, "binop": null }, - "start": 371, - "end": 372, + "value": "B", + "start": 477, + "end": 478, "loc": { "start": { - "line": 16, - "column": 30 + "line": 21, + "column": 11 }, "end": { - "line": 16, - "column": 31 + "line": 21, + "column": 12 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2059,23 +4931,23 @@ "binop": null, "updateContext": null }, - "start": 373, - "end": 375, + "start": 478, + "end": 479, "loc": { "start": { - "line": 16, - "column": 32 + "line": 21, + "column": 12 }, "end": { - "line": 16, - "column": 34 + "line": 21, + "column": 13 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2084,24 +4956,24 @@ "postfix": false, "binop": null }, - "start": 376, - "end": 377, + "value": "left", + "start": 479, + "end": 483, "loc": { "start": { - "line": 16, - "column": 35 + "line": 21, + "column": 13 }, "end": { - "line": 16, - "column": 36 + "line": 21, + "column": 17 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2111,17 +4983,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 379, - "end": 384, + "start": 483, + "end": 484, "loc": { "start": { - "line": 17, - "column": 1 + "line": 21, + "column": 17 }, "end": { - "line": 17, - "column": 6 + "line": 21, + "column": 18 } } }, @@ -2137,44 +5008,42 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 385, - "end": 386, + "value": "assert", + "start": 486, + "end": 492, "loc": { "start": { - "line": 17, - "column": 7 + "line": 22, + "column": 1 }, "end": { - "line": 17, - "column": 8 + "line": 22, + "column": 7 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 387, - "end": 388, + "start": 492, + "end": 493, "loc": { "start": { - "line": 17, - "column": 9 + "line": 22, + "column": 7 }, "end": { - "line": 17, - "column": 10 + "line": 22, + "column": 8 } } }, @@ -2190,51 +5059,79 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 389, - "end": 390, + "value": "A", + "start": 493, + "end": 494, "loc": { "start": { - "line": 17, - "column": 11 + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 495, + "end": 505, + "loc": { + "start": { + "line": 22, + "column": 10 }, "end": { - "line": 17, - "column": 12 + "line": 22, + "column": 20 } } }, { "type": { - "label": ".", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 390, - "end": 391, + "value": "Node", + "start": 506, + "end": 510, "loc": { "start": { - "line": 17, - "column": 12 + "line": 22, + "column": 21 }, "end": { - "line": 17, - "column": 13 + "line": 22, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2242,17 +5139,16 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 391, - "end": 395, + "start": 510, + "end": 511, "loc": { "start": { - "line": 17, - "column": 13 + "line": 22, + "column": 25 }, "end": { - "line": 17, - "column": 17 + "line": 22, + "column": 26 } } }, @@ -2269,16 +5165,16 @@ "binop": null, "updateContext": null }, - "start": 395, - "end": 396, + "start": 511, + "end": 512, "loc": { "start": { - "line": 17, - "column": 17 + "line": 22, + "column": 26 }, "end": { - "line": 17, - "column": 18 + "line": 22, + "column": 27 } } }, @@ -2297,15 +5193,15 @@ "updateContext": null }, "value": "const", - "start": 398, - "end": 403, + "start": 514, + "end": 519, "loc": { "start": { - "line": 18, + "line": 23, "column": 1 }, "end": { - "line": 18, + "line": 23, "column": 6 } } @@ -2323,15 +5219,15 @@ "binop": null }, "value": "a", - "start": 404, - "end": 405, + "start": 520, + "end": 521, "loc": { "start": { - "line": 18, + "line": 23, "column": 7 }, "end": { - "line": 18, + "line": 23, "column": 8 } } @@ -2350,15 +5246,15 @@ "updateContext": null }, "value": "=", - "start": 406, - "end": 407, + "start": 522, + "end": 523, "loc": { "start": { - "line": 18, + "line": 23, "column": 9 }, "end": { - "line": 18, + "line": 23, "column": 10 } } @@ -2376,15 +5272,15 @@ "binop": null }, "value": "A", - "start": 408, - "end": 409, + "start": 524, + "end": 525, "loc": { "start": { - "line": 18, + "line": 23, "column": 11 }, "end": { - "line": 18, + "line": 23, "column": 12 } } @@ -2402,15 +5298,15 @@ "binop": null, "updateContext": null }, - "start": 409, - "end": 410, + "start": 525, + "end": 526, "loc": { "start": { - "line": 18, + "line": 23, "column": 12 }, "end": { - "line": 18, + "line": 23, "column": 13 } } @@ -2428,15 +5324,15 @@ "binop": null }, "value": "left", - "start": 410, - "end": 414, + "start": 526, + "end": 530, "loc": { "start": { - "line": 18, + "line": 23, "column": 13 }, "end": { - "line": 18, + "line": 23, "column": 17 } } @@ -2454,15 +5350,15 @@ "binop": null, "updateContext": null }, - "start": 414, - "end": 415, + "start": 530, + "end": 531, "loc": { "start": { - "line": 18, + "line": 23, "column": 17 }, "end": { - "line": 18, + "line": 23, "column": 18 } } @@ -2482,15 +5378,15 @@ "updateContext": null }, "value": "const", - "start": 417, - "end": 422, + "start": 533, + "end": 538, "loc": { "start": { - "line": 19, + "line": 24, "column": 1 }, "end": { - "line": 19, + "line": 24, "column": 6 } } @@ -2508,15 +5404,15 @@ "binop": null }, "value": "b", - "start": 423, - "end": 424, + "start": 539, + "end": 540, "loc": { "start": { - "line": 19, + "line": 24, "column": 7 }, "end": { - "line": 19, + "line": 24, "column": 8 } } @@ -2535,15 +5431,15 @@ "updateContext": null }, "value": "=", - "start": 425, - "end": 426, + "start": 541, + "end": 542, "loc": { "start": { - "line": 19, + "line": 24, "column": 9 }, "end": { - "line": 19, + "line": 24, "column": 10 } } @@ -2561,15 +5457,15 @@ "binop": null }, "value": "A", - "start": 427, - "end": 428, + "start": 543, + "end": 544, "loc": { "start": { - "line": 19, + "line": 24, "column": 11 }, "end": { - "line": 19, + "line": 24, "column": 12 } } @@ -2587,15 +5483,15 @@ "binop": null, "updateContext": null }, - "start": 428, - "end": 429, + "start": 544, + "end": 545, "loc": { "start": { - "line": 19, + "line": 24, "column": 12 }, "end": { - "line": 19, + "line": 24, "column": 13 } } @@ -2613,15 +5509,15 @@ "binop": null }, "value": "right", - "start": 429, - "end": 434, + "start": 545, + "end": 550, "loc": { "start": { - "line": 19, + "line": 24, "column": 13 }, "end": { - "line": 19, + "line": 24, "column": 18 } } @@ -2639,15 +5535,15 @@ "binop": null, "updateContext": null }, - "start": 434, - "end": 435, + "start": 550, + "end": 551, "loc": { "start": { - "line": 19, + "line": 24, "column": 18 }, "end": { - "line": 19, + "line": 24, "column": 19 } } @@ -2667,15 +5563,15 @@ "updateContext": null }, "value": "const", - "start": 437, - "end": 442, + "start": 553, + "end": 558, "loc": { "start": { - "line": 20, + "line": 25, "column": 1 }, "end": { - "line": 20, + "line": 25, "column": 6 } } @@ -2693,15 +5589,15 @@ "binop": null }, "value": "c", - "start": 443, - "end": 444, + "start": 559, + "end": 560, "loc": { "start": { - "line": 20, + "line": 25, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 8 } } @@ -2720,15 +5616,15 @@ "updateContext": null }, "value": "=", - "start": 445, - "end": 446, + "start": 561, + "end": 562, "loc": { "start": { - "line": 20, + "line": 25, "column": 9 }, "end": { - "line": 20, + "line": 25, "column": 10 } } @@ -2746,15 +5642,15 @@ "binop": null }, "value": "B", - "start": 447, - "end": 448, + "start": 563, + "end": 564, "loc": { "start": { - "line": 20, + "line": 25, "column": 11 }, "end": { - "line": 20, + "line": 25, "column": 12 } } @@ -2772,15 +5668,15 @@ "binop": null, "updateContext": null }, - "start": 448, - "end": 449, + "start": 564, + "end": 565, "loc": { "start": { - "line": 20, + "line": 25, "column": 12 }, "end": { - "line": 20, + "line": 25, "column": 13 } } @@ -2798,15 +5694,15 @@ "binop": null }, "value": "right", - "start": 449, - "end": 454, + "start": 565, + "end": 570, "loc": { "start": { - "line": 20, + "line": 25, "column": 13 }, "end": { - "line": 20, + "line": 25, "column": 18 } } @@ -2824,15 +5720,15 @@ "binop": null, "updateContext": null }, - "start": 454, - "end": 455, + "start": 570, + "end": 571, "loc": { "start": { - "line": 20, + "line": 25, "column": 18 }, "end": { - "line": 20, + "line": 25, "column": 19 } } @@ -2850,15 +5746,15 @@ "binop": null, "updateContext": null }, - "start": 458, - "end": 459, + "start": 574, + "end": 575, "loc": { "start": { - "line": 22, + "line": 27, "column": 1 }, "end": { - "line": 22, + "line": 27, "column": 2 } } @@ -2876,15 +5772,15 @@ "binop": null }, "value": "A", - "start": 459, - "end": 460, + "start": 575, + "end": 576, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, + "line": 27, "column": 3 } } @@ -2902,15 +5798,15 @@ "binop": null, "updateContext": null }, - "start": 460, - "end": 461, + "start": 576, + "end": 577, "loc": { "start": { - "line": 22, + "line": 27, "column": 3 }, "end": { - "line": 22, + "line": 27, "column": 4 } } @@ -2928,15 +5824,15 @@ "binop": null }, "value": "key", - "start": 461, - "end": 464, + "start": 577, + "end": 580, "loc": { "start": { - "line": 22, + "line": 27, "column": 4 }, "end": { - "line": 22, + "line": 27, "column": 7 } } @@ -2954,15 +5850,15 @@ "binop": null, "updateContext": null }, - "start": 464, - "end": 465, + "start": 580, + "end": 581, "loc": { "start": { - "line": 22, + "line": 27, "column": 7 }, "end": { - "line": 22, + "line": 27, "column": 8 } } @@ -2980,15 +5876,15 @@ "binop": null }, "value": "B", - "start": 466, - "end": 467, + "start": 582, + "end": 583, "loc": { "start": { - "line": 22, + "line": 27, "column": 9 }, "end": { - "line": 22, + "line": 27, "column": 10 } } @@ -3006,15 +5902,15 @@ "binop": null, "updateContext": null }, - "start": 467, - "end": 468, + "start": 583, + "end": 584, "loc": { "start": { - "line": 22, + "line": 27, "column": 10 }, "end": { - "line": 22, + "line": 27, "column": 11 } } @@ -3032,15 +5928,15 @@ "binop": null }, "value": "key", - "start": 468, - "end": 471, + "start": 584, + "end": 587, "loc": { "start": { - "line": 22, + "line": 27, "column": 11 }, "end": { - "line": 22, + "line": 27, "column": 14 } } @@ -3058,15 +5954,15 @@ "binop": null, "updateContext": null }, - "start": 471, - "end": 472, + "start": 587, + "end": 588, "loc": { "start": { - "line": 22, + "line": 27, "column": 14 }, "end": { - "line": 22, + "line": 27, "column": 15 } } @@ -3085,15 +5981,15 @@ "updateContext": null }, "value": "=", - "start": 473, - "end": 474, + "start": 589, + "end": 590, "loc": { "start": { - "line": 22, + "line": 27, "column": 16 }, "end": { - "line": 22, + "line": 27, "column": 17 } } @@ -3111,15 +6007,15 @@ "binop": null, "updateContext": null }, - "start": 475, - "end": 476, + "start": 591, + "end": 592, "loc": { "start": { - "line": 22, + "line": 27, "column": 18 }, "end": { - "line": 22, + "line": 27, "column": 19 } } @@ -3137,15 +6033,15 @@ "binop": null }, "value": "B", - "start": 476, - "end": 477, + "start": 592, + "end": 593, "loc": { "start": { - "line": 22, + "line": 27, "column": 19 }, "end": { - "line": 22, + "line": 27, "column": 20 } } @@ -3163,15 +6059,15 @@ "binop": null, "updateContext": null }, - "start": 477, - "end": 478, + "start": 593, + "end": 594, "loc": { "start": { - "line": 22, + "line": 27, "column": 20 }, "end": { - "line": 22, + "line": 27, "column": 21 } } @@ -3189,15 +6085,15 @@ "binop": null }, "value": "key", - "start": 478, - "end": 481, + "start": 594, + "end": 597, "loc": { "start": { - "line": 22, + "line": 27, "column": 21 }, "end": { - "line": 22, + "line": 27, "column": 24 } } @@ -3215,15 +6111,15 @@ "binop": null, "updateContext": null }, - "start": 481, - "end": 482, + "start": 597, + "end": 598, "loc": { "start": { - "line": 22, + "line": 27, "column": 24 }, "end": { - "line": 22, + "line": 27, "column": 25 } } @@ -3241,15 +6137,15 @@ "binop": null }, "value": "A", - "start": 483, - "end": 484, + "start": 599, + "end": 600, "loc": { "start": { - "line": 22, + "line": 27, "column": 26 }, "end": { - "line": 22, + "line": 27, "column": 27 } } @@ -3267,15 +6163,15 @@ "binop": null, "updateContext": null }, - "start": 484, - "end": 485, + "start": 600, + "end": 601, "loc": { "start": { - "line": 22, + "line": 27, "column": 27 }, "end": { - "line": 22, + "line": 27, "column": 28 } } @@ -3293,15 +6189,15 @@ "binop": null }, "value": "key", - "start": 485, - "end": 488, + "start": 601, + "end": 604, "loc": { "start": { - "line": 22, + "line": 27, "column": 28 }, "end": { - "line": 22, + "line": 27, "column": 31 } } @@ -3319,15 +6215,15 @@ "binop": null, "updateContext": null }, - "start": 488, - "end": 489, + "start": 604, + "end": 605, "loc": { "start": { - "line": 22, + "line": 27, "column": 31 }, "end": { - "line": 22, + "line": 27, "column": 32 } } @@ -3345,15 +6241,15 @@ "binop": null, "updateContext": null }, - "start": 489, - "end": 490, + "start": 605, + "end": 606, "loc": { "start": { - "line": 22, + "line": 27, "column": 32 }, "end": { - "line": 22, + "line": 27, "column": 33 } } @@ -3371,15 +6267,15 @@ "binop": null, "updateContext": null }, - "start": 492, - "end": 493, + "start": 608, + "end": 609, "loc": { "start": { - "line": 23, + "line": 28, "column": 1 }, "end": { - "line": 23, + "line": 28, "column": 2 } } @@ -3397,15 +6293,15 @@ "binop": null }, "value": "A", - "start": 493, - "end": 494, + "start": 609, + "end": 610, "loc": { "start": { - "line": 23, + "line": 28, "column": 2 }, "end": { - "line": 23, + "line": 28, "column": 3 } } @@ -3423,15 +6319,15 @@ "binop": null, "updateContext": null }, - "start": 494, - "end": 495, + "start": 610, + "end": 611, "loc": { "start": { - "line": 23, + "line": 28, "column": 3 }, "end": { - "line": 23, + "line": 28, "column": 4 } } @@ -3449,15 +6345,15 @@ "binop": null }, "value": "_color", - "start": 495, - "end": 501, + "start": 611, + "end": 617, "loc": { "start": { - "line": 23, + "line": 28, "column": 4 }, "end": { - "line": 23, + "line": 28, "column": 10 } } @@ -3475,15 +6371,15 @@ "binop": null, "updateContext": null }, - "start": 501, - "end": 502, + "start": 617, + "end": 618, "loc": { "start": { - "line": 23, + "line": 28, "column": 10 }, "end": { - "line": 23, + "line": 28, "column": 11 } } @@ -3501,15 +6397,15 @@ "binop": null }, "value": "B", - "start": 503, - "end": 504, + "start": 619, + "end": 620, "loc": { "start": { - "line": 23, + "line": 28, "column": 12 }, "end": { - "line": 23, + "line": 28, "column": 13 } } @@ -3527,15 +6423,15 @@ "binop": null, "updateContext": null }, - "start": 504, - "end": 505, + "start": 620, + "end": 621, "loc": { "start": { - "line": 23, + "line": 28, "column": 13 }, "end": { - "line": 23, + "line": 28, "column": 14 } } @@ -3553,15 +6449,15 @@ "binop": null }, "value": "_color", - "start": 505, - "end": 511, + "start": 621, + "end": 627, "loc": { "start": { - "line": 23, + "line": 28, "column": 14 }, "end": { - "line": 23, + "line": 28, "column": 20 } } @@ -3579,15 +6475,15 @@ "binop": null, "updateContext": null }, - "start": 511, - "end": 512, + "start": 627, + "end": 628, "loc": { "start": { - "line": 23, + "line": 28, "column": 20 }, "end": { - "line": 23, + "line": 28, "column": 21 } } @@ -3606,15 +6502,15 @@ "updateContext": null }, "value": "=", - "start": 513, - "end": 514, + "start": 629, + "end": 630, "loc": { "start": { - "line": 23, + "line": 28, "column": 22 }, "end": { - "line": 23, + "line": 28, "column": 23 } } @@ -3632,15 +6528,15 @@ "binop": null, "updateContext": null }, - "start": 515, - "end": 516, + "start": 631, + "end": 632, "loc": { "start": { - "line": 23, + "line": 28, "column": 24 }, "end": { - "line": 23, + "line": 28, "column": 25 } } @@ -3658,15 +6554,15 @@ "binop": null }, "value": "B", - "start": 516, - "end": 517, + "start": 632, + "end": 633, "loc": { "start": { - "line": 23, + "line": 28, "column": 25 }, "end": { - "line": 23, + "line": 28, "column": 26 } } @@ -3684,15 +6580,15 @@ "binop": null, "updateContext": null }, - "start": 517, - "end": 518, + "start": 633, + "end": 634, "loc": { "start": { - "line": 23, + "line": 28, "column": 26 }, "end": { - "line": 23, + "line": 28, "column": 27 } } @@ -3710,15 +6606,15 @@ "binop": null }, "value": "_color", - "start": 518, - "end": 524, + "start": 634, + "end": 640, "loc": { "start": { - "line": 23, + "line": 28, "column": 27 }, "end": { - "line": 23, + "line": 28, "column": 33 } } @@ -3736,15 +6632,15 @@ "binop": null, "updateContext": null }, - "start": 524, - "end": 525, + "start": 640, + "end": 641, "loc": { "start": { - "line": 23, + "line": 28, "column": 33 }, "end": { - "line": 23, + "line": 28, "column": 34 } } @@ -3762,15 +6658,15 @@ "binop": null }, "value": "A", - "start": 526, - "end": 527, + "start": 642, + "end": 643, "loc": { "start": { - "line": 23, + "line": 28, "column": 35 }, "end": { - "line": 23, + "line": 28, "column": 36 } } @@ -3788,15 +6684,15 @@ "binop": null, "updateContext": null }, - "start": 527, - "end": 528, + "start": 643, + "end": 644, "loc": { "start": { - "line": 23, + "line": 28, "column": 36 }, "end": { - "line": 23, + "line": 28, "column": 37 } } @@ -3814,15 +6710,15 @@ "binop": null }, "value": "_color", - "start": 528, - "end": 534, + "start": 644, + "end": 650, "loc": { "start": { - "line": 23, + "line": 28, "column": 37 }, "end": { - "line": 23, + "line": 28, "column": 43 } } @@ -3840,15 +6736,15 @@ "binop": null, "updateContext": null }, - "start": 534, - "end": 535, + "start": 650, + "end": 651, "loc": { "start": { - "line": 23, + "line": 28, "column": 43 }, "end": { - "line": 23, + "line": 28, "column": 44 } } @@ -3866,15 +6762,15 @@ "binop": null, "updateContext": null }, - "start": 535, - "end": 536, + "start": 651, + "end": 652, "loc": { "start": { - "line": 23, + "line": 28, "column": 44 }, "end": { - "line": 23, + "line": 28, "column": 45 } } @@ -3892,15 +6788,15 @@ "binop": null }, "value": "B", - "start": 539, - "end": 540, + "start": 655, + "end": 656, "loc": { "start": { - "line": 25, + "line": 30, "column": 1 }, "end": { - "line": 25, + "line": 30, "column": 2 } } @@ -3918,15 +6814,15 @@ "binop": null, "updateContext": null }, - "start": 540, - "end": 541, + "start": 656, + "end": 657, "loc": { "start": { - "line": 25, + "line": 30, "column": 2 }, "end": { - "line": 25, + "line": 30, "column": 3 } } @@ -3944,15 +6840,15 @@ "binop": null }, "value": "left", - "start": 541, - "end": 545, + "start": 657, + "end": 661, "loc": { "start": { - "line": 25, + "line": 30, "column": 3 }, "end": { - "line": 25, + "line": 30, "column": 7 } } @@ -3971,15 +6867,15 @@ "updateContext": null }, "value": "=", - "start": 546, - "end": 547, + "start": 662, + "end": 663, "loc": { "start": { - "line": 25, + "line": 30, "column": 8 }, "end": { - "line": 25, + "line": 30, "column": 9 } } @@ -3997,15 +6893,15 @@ "binop": null }, "value": "a", - "start": 548, - "end": 549, + "start": 664, + "end": 665, "loc": { "start": { - "line": 25, + "line": 30, "column": 10 }, "end": { - "line": 25, + "line": 30, "column": 11 } } @@ -4023,15 +6919,15 @@ "binop": null, "updateContext": null }, - "start": 549, - "end": 550, + "start": 665, + "end": 666, "loc": { "start": { - "line": 25, + "line": 30, "column": 11 }, "end": { - "line": 25, + "line": 30, "column": 12 } } @@ -4049,15 +6945,15 @@ "binop": null }, "value": "B", - "start": 552, - "end": 553, + "start": 668, + "end": 669, "loc": { "start": { - "line": 26, + "line": 31, "column": 1 }, "end": { - "line": 26, + "line": 31, "column": 2 } } @@ -4075,15 +6971,15 @@ "binop": null, "updateContext": null }, - "start": 553, - "end": 554, + "start": 669, + "end": 670, "loc": { "start": { - "line": 26, + "line": 31, "column": 2 }, "end": { - "line": 26, + "line": 31, "column": 3 } } @@ -4101,15 +6997,15 @@ "binop": null }, "value": "right", - "start": 554, - "end": 559, + "start": 670, + "end": 675, "loc": { "start": { - "line": 26, + "line": 31, "column": 3 }, "end": { - "line": 26, + "line": 31, "column": 8 } } @@ -4128,15 +7024,15 @@ "updateContext": null }, "value": "=", - "start": 560, - "end": 561, + "start": 676, + "end": 677, "loc": { "start": { - "line": 26, + "line": 31, "column": 9 }, "end": { - "line": 26, + "line": 31, "column": 10 } } @@ -4154,15 +7050,15 @@ "binop": null }, "value": "A", - "start": 562, - "end": 563, + "start": 678, + "end": 679, "loc": { "start": { - "line": 26, + "line": 31, "column": 11 }, "end": { - "line": 26, + "line": 31, "column": 12 } } @@ -4180,15 +7076,15 @@ "binop": null, "updateContext": null }, - "start": 563, - "end": 564, + "start": 679, + "end": 680, "loc": { "start": { - "line": 26, + "line": 31, "column": 12 }, "end": { - "line": 26, + "line": 31, "column": 13 } } @@ -4206,15 +7102,15 @@ "binop": null }, "value": "A", - "start": 567, - "end": 568, + "start": 683, + "end": 684, "loc": { "start": { - "line": 28, + "line": 33, "column": 1 }, "end": { - "line": 28, + "line": 33, "column": 2 } } @@ -4232,15 +7128,15 @@ "binop": null, "updateContext": null }, - "start": 568, - "end": 569, + "start": 684, + "end": 685, "loc": { "start": { - "line": 28, + "line": 33, "column": 2 }, "end": { - "line": 28, + "line": 33, "column": 3 } } @@ -4258,15 +7154,15 @@ "binop": null }, "value": "left", - "start": 569, - "end": 573, + "start": 685, + "end": 689, "loc": { "start": { - "line": 28, + "line": 33, "column": 3 }, "end": { - "line": 28, + "line": 33, "column": 7 } } @@ -4285,15 +7181,15 @@ "updateContext": null }, "value": "=", - "start": 574, - "end": 575, + "start": 690, + "end": 691, "loc": { "start": { - "line": 28, + "line": 33, "column": 8 }, "end": { - "line": 28, + "line": 33, "column": 9 } } @@ -4311,15 +7207,15 @@ "binop": null }, "value": "b", - "start": 576, - "end": 577, + "start": 692, + "end": 693, "loc": { "start": { - "line": 28, + "line": 33, "column": 10 }, "end": { - "line": 28, + "line": 33, "column": 11 } } @@ -4337,15 +7233,15 @@ "binop": null, "updateContext": null }, - "start": 577, - "end": 578, + "start": 693, + "end": 694, "loc": { "start": { - "line": 28, + "line": 33, "column": 11 }, "end": { - "line": 28, + "line": 33, "column": 12 } } @@ -4363,15 +7259,15 @@ "binop": null }, "value": "A", - "start": 580, - "end": 581, + "start": 696, + "end": 697, "loc": { "start": { - "line": 29, + "line": 34, "column": 1 }, "end": { - "line": 29, + "line": 34, "column": 2 } } @@ -4389,15 +7285,15 @@ "binop": null, "updateContext": null }, - "start": 581, - "end": 582, + "start": 697, + "end": 698, "loc": { "start": { - "line": 29, + "line": 34, "column": 2 }, "end": { - "line": 29, + "line": 34, "column": 3 } } @@ -4415,15 +7311,15 @@ "binop": null }, "value": "right", - "start": 582, - "end": 587, + "start": 698, + "end": 703, "loc": { "start": { - "line": 29, + "line": 34, "column": 3 }, "end": { - "line": 29, + "line": 34, "column": 8 } } @@ -4442,15 +7338,15 @@ "updateContext": null }, "value": "=", - "start": 588, - "end": 589, + "start": 704, + "end": 705, "loc": { "start": { - "line": 29, + "line": 34, "column": 9 }, "end": { - "line": 29, + "line": 34, "column": 10 } } @@ -4468,15 +7364,15 @@ "binop": null }, "value": "c", - "start": 590, - "end": 591, + "start": 706, + "end": 707, "loc": { "start": { - "line": 29, + "line": 34, "column": 11 }, "end": { - "line": 29, + "line": 34, "column": 12 } } @@ -4494,15 +7390,15 @@ "binop": null, "updateContext": null }, - "start": 591, - "end": 592, + "start": 707, + "end": 708, "loc": { "start": { - "line": 29, + "line": 34, "column": 12 }, "end": { - "line": 29, + "line": 34, "column": 13 } } @@ -4520,15 +7416,15 @@ "binop": null }, "value": "a", - "start": 595, - "end": 596, + "start": 711, + "end": 712, "loc": { "start": { - "line": 31, + "line": 36, "column": 1 }, "end": { - "line": 31, + "line": 36, "column": 2 } } @@ -4546,15 +7442,15 @@ "binop": null, "updateContext": null }, - "start": 596, - "end": 597, + "start": 712, + "end": 713, "loc": { "start": { - "line": 31, + "line": 36, "column": 2 }, "end": { - "line": 31, + "line": 36, "column": 3 } } @@ -4572,15 +7468,15 @@ "binop": null }, "value": "parent", - "start": 597, - "end": 603, + "start": 713, + "end": 719, "loc": { "start": { - "line": 31, + "line": 36, "column": 3 }, "end": { - "line": 31, + "line": 36, "column": 9 } } @@ -4599,15 +7495,15 @@ "updateContext": null }, "value": "=", - "start": 604, - "end": 605, + "start": 720, + "end": 721, "loc": { "start": { - "line": 31, + "line": 36, "column": 10 }, "end": { - "line": 31, + "line": 36, "column": 11 } } @@ -4625,15 +7521,15 @@ "binop": null }, "value": "B", - "start": 606, - "end": 607, + "start": 722, + "end": 723, "loc": { "start": { - "line": 31, + "line": 36, "column": 12 }, "end": { - "line": 31, + "line": 36, "column": 13 } } @@ -4651,15 +7547,15 @@ "binop": null, "updateContext": null }, - "start": 607, - "end": 608, + "start": 723, + "end": 724, "loc": { "start": { - "line": 31, + "line": 36, "column": 13 }, "end": { - "line": 31, + "line": 36, "column": 14 } } @@ -4677,15 +7573,15 @@ "binop": null }, "value": "b", - "start": 610, - "end": 611, + "start": 726, + "end": 727, "loc": { "start": { - "line": 32, + "line": 37, "column": 1 }, "end": { - "line": 32, + "line": 37, "column": 2 } } @@ -4703,15 +7599,15 @@ "binop": null, "updateContext": null }, - "start": 611, - "end": 612, + "start": 727, + "end": 728, "loc": { "start": { - "line": 32, + "line": 37, "column": 2 }, "end": { - "line": 32, + "line": 37, "column": 3 } } @@ -4729,15 +7625,15 @@ "binop": null }, "value": "parent", - "start": 612, - "end": 618, + "start": 728, + "end": 734, "loc": { "start": { - "line": 32, + "line": 37, "column": 3 }, "end": { - "line": 32, + "line": 37, "column": 9 } } @@ -4756,15 +7652,15 @@ "updateContext": null }, "value": "=", - "start": 619, - "end": 620, + "start": 735, + "end": 736, "loc": { "start": { - "line": 32, + "line": 37, "column": 10 }, "end": { - "line": 32, + "line": 37, "column": 11 } } @@ -4782,15 +7678,15 @@ "binop": null }, "value": "A", - "start": 621, - "end": 622, + "start": 737, + "end": 738, "loc": { "start": { - "line": 32, + "line": 37, "column": 12 }, "end": { - "line": 32, + "line": 37, "column": 13 } } @@ -4808,15 +7704,15 @@ "binop": null, "updateContext": null }, - "start": 622, - "end": 623, + "start": 738, + "end": 739, "loc": { "start": { - "line": 32, + "line": 37, "column": 13 }, "end": { - "line": 32, + "line": 37, "column": 14 } } @@ -4834,15 +7730,15 @@ "binop": null }, "value": "c", - "start": 625, - "end": 626, + "start": 741, + "end": 742, "loc": { "start": { - "line": 33, + "line": 38, "column": 1 }, "end": { - "line": 33, + "line": 38, "column": 2 } } @@ -4860,15 +7756,15 @@ "binop": null, "updateContext": null }, - "start": 626, - "end": 627, + "start": 742, + "end": 743, "loc": { "start": { - "line": 33, + "line": 38, "column": 2 }, "end": { - "line": 33, + "line": 38, "column": 3 } } @@ -4886,15 +7782,15 @@ "binop": null }, "value": "parent", - "start": 627, - "end": 633, + "start": 743, + "end": 749, "loc": { "start": { - "line": 33, + "line": 38, "column": 3 }, "end": { - "line": 33, + "line": 38, "column": 9 } } @@ -4913,15 +7809,15 @@ "updateContext": null }, "value": "=", - "start": 634, - "end": 635, + "start": 750, + "end": 751, "loc": { "start": { - "line": 33, + "line": 38, "column": 10 }, "end": { - "line": 33, + "line": 38, "column": 11 } } @@ -4939,15 +7835,15 @@ "binop": null }, "value": "A", - "start": 636, - "end": 637, + "start": 752, + "end": 753, "loc": { "start": { - "line": 33, + "line": 38, "column": 12 }, "end": { - "line": 33, + "line": 38, "column": 13 } } @@ -4965,15 +7861,15 @@ "binop": null, "updateContext": null }, - "start": 637, - "end": 638, + "start": 753, + "end": 754, "loc": { "start": { - "line": 33, + "line": 38, "column": 13 }, "end": { - "line": 33, + "line": 38, "column": 14 } } @@ -4990,15 +7886,15 @@ "postfix": false, "binop": null }, - "start": 639, - "end": 640, + "start": 755, + "end": 756, "loc": { "start": { - "line": 34, + "line": 39, "column": 0 }, "end": { - "line": 34, + "line": 39, "column": 1 } } @@ -5016,19 +7912,127 @@ "binop": null, "updateContext": null }, - "start": 640, - "end": 641, + "start": 756, + "end": 757, "loc": { "start": { - "line": 34, + "line": 39, "column": 1 }, "end": { - "line": 34, + "line": 39, "column": 2 } } }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 759, + "end": 765, + "loc": { + "start": { + "line": 41, + "column": 0 + }, + "end": { + "line": 41, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 766, + "end": 773, + "loc": { + "start": { + "line": 41, + "column": 7 + }, + "end": { + "line": 41, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 774, + "end": 786, + "loc": { + "start": { + "line": 41, + "column": 15 + }, + "end": { + "line": 41, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 786, + "end": 787, + "loc": { + "start": { + "line": 41, + "column": 27 + }, + "end": { + "line": 41, + "column": 28 + } + } + }, { "type": { "label": "eof", @@ -5042,15 +8046,15 @@ "binop": null, "updateContext": null }, - "start": 642, - "end": 642, + "start": 788, + "end": 788, "loc": { "start": { - "line": 35, + "line": 42, "column": 0 }, "end": { - "line": 35, + "line": 42, "column": 0 } } diff --git a/ast/source/search/index.js.json b/ast/source/search/index.js.json deleted file mode 100644 index 0b64a41..0000000 --- a/ast/source/search/index.js.json +++ /dev/null @@ -1,232 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "extra": { - "rawValue": "./search.js", - "raw": "'./search.js'" - }, - "value": "./search.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./search.js", - "start": 14, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 29, - "end": 29, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/search/search.js.json b/ast/source/search/search.js.json index 4874a31..ef3731f 100644 --- a/ast/source/search/search.js.json +++ b/ast/source/search/search.js.json @@ -1,618 +1,840 @@ { "type": "File", "start": 0, - "end": 479, + "end": 652, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 33, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 479, + "end": 652, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 33, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 249, - "end": 478, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 9, + "line": 1, "column": 0 }, "end": { - "line": 23, - "column": 2 + "line": 1, + "column": 28 } }, - "specifiers": [], - "source": null, - "declaration": { - "type": "VariableDeclaration", - "start": 256, - "end": 478, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, "loc": { "start": { - "line": 9, - "column": 7 + "line": 1, + "column": 19 }, "end": { - "line": 23, - "column": 2 + "line": 1, + "column": 27 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 262, - "end": 477, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, "loc": { "start": { - "line": 9, - "column": 13 + "line": 2, + "column": 7 }, "end": { - "line": 23, - "column": 1 - } + "line": 2, + "column": 11 + }, + "identifierName": "Node" }, - "id": { - "type": "Identifier", - "start": 262, - "end": 268, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 19 - }, - "identifierName": "search" + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", + "start": 67, + "end": 315, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 316, + "end": 627, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 30, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 322, + "end": 626, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 30, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 322, + "end": 328, + "loc": { + "start": { + "line": 12, + "column": 6 }, - "name": "search", - "leadingComments": null + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "search" }, - "init": { - "type": "ArrowFunctionExpression", - "start": 271, - "end": 477, - "loc": { - "start": { - "line": 9, - "column": 22 - }, - "end": { - "line": 23, - "column": 1 - } + "name": "search", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 331, + "end": 626, + "loc": { + "start": { + "line": 12, + "column": 15 }, - "id": { + "end": { + "line": 30, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { "type": "Identifier", - "start": 262, - "end": 268, + "start": 332, + "end": 339, "loc": { "start": { - "line": 9, - "column": 13 + "line": 12, + "column": 16 }, "end": { - "line": 9, - "column": 19 + "line": 12, + "column": 23 }, - "identifierName": "search" + "identifierName": "compare" }, - "name": "search", - "leadingComments": null + "name": "compare" }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 272, - "end": 279, - "loc": { - "start": { - "line": 9, - "column": 23 - }, - "end": { - "line": 9, - "column": 30 - }, - "identifierName": "compare" + { + "type": "Identifier", + "start": 341, + "end": 345, + "loc": { + "start": { + "line": 12, + "column": 25 }, - "name": "compare" + "end": { + "line": 12, + "column": 29 + }, + "identifierName": "root" }, - { - "type": "Identifier", - "start": 281, - "end": 285, - "loc": { - "start": { - "line": 9, - "column": 32 - }, - "end": { - "line": 9, - "column": 36 - }, - "identifierName": "root" + "name": "root" + }, + { + "type": "Identifier", + "start": 347, + "end": 350, + "loc": { + "start": { + "line": 12, + "column": 31 }, - "name": "root" + "end": { + "line": 12, + "column": 34 + }, + "identifierName": "key" + }, + "name": "key" + } + ], + "body": { + "type": "BlockStatement", + "start": 355, + "end": 626, + "loc": { + "start": { + "line": 12, + "column": 39 }, + "end": { + "line": 30, + "column": 1 + } + }, + "body": [ { - "type": "Identifier", - "start": 287, - "end": 290, + "type": "ExpressionStatement", + "start": 358, + "end": 387, "loc": { "start": { - "line": 9, - "column": 38 + "line": 13, + "column": 1 }, "end": { - "line": 9, - "column": 41 - }, - "identifierName": "key" - }, - "name": "key" - } - ], - "body": { - "type": "BlockStatement", - "start": 295, - "end": 477, - "loc": { - "start": { - "line": 9, - "column": 46 + "line": 13, + "column": 30 + } }, - "end": { - "line": 23, - "column": 1 - } - }, - "body": [ - { - "type": "WhileStatement", - "start": 298, - "end": 475, + "expression": { + "type": "CallExpression", + "start": 358, + "end": 386, "loc": { "start": { - "line": 10, + "line": 13, "column": 1 }, "end": { - "line": 22, - "column": 2 + "line": 13, + "column": 29 } }, - "test": { - "type": "BooleanLiteral", - "start": 305, - "end": 309, + "callee": { + "type": "Identifier", + "start": 358, + "end": 364, "loc": { "start": { - "line": 10, - "column": 8 + "line": 13, + "column": 1 }, "end": { - "line": 10, - "column": 12 - } + "line": 13, + "column": 7 + }, + "identifierName": "assert" }, - "value": true + "name": "assert" }, - "body": { - "type": "BlockStatement", - "start": 311, - "end": 475, - "loc": { - "start": { - "line": 10, - "column": 14 + "arguments": [ + { + "type": "BinaryExpression", + "start": 365, + "end": 385, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 28 + } }, - "end": { - "line": 22, - "column": 2 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 315, - "end": 348, + "left": { + "type": "Identifier", + "start": 365, + "end": 369, "loc": { "start": { - "line": 11, - "column": 2 + "line": 13, + "column": 8 }, "end": { - "line": 11, - "column": 35 - } + "line": 13, + "column": 12 + }, + "identifierName": "root" }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 321, - "end": 347, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 34 - } - }, - "id": { - "type": "Identifier", - "start": 321, - "end": 322, - "loc": { - "start": { - "line": 11, - "column": 8 - }, - "end": { - "line": 11, - "column": 9 - }, - "identifierName": "d" - }, - "name": "d" - }, - "init": { - "type": "CallExpression", - "start": 325, - "end": 347, - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 34 - } - }, - "callee": { - "type": "Identifier", - "start": 325, - "end": 332, - "loc": { - "start": { - "line": 11, - "column": 12 - }, - "end": { - "line": 11, - "column": 19 - }, - "identifierName": "compare" - }, - "name": "compare" - }, - "arguments": [ - { - "type": "Identifier", - "start": 333, - "end": 336, - "loc": { - "start": { - "line": 11, - "column": 20 - }, - "end": { - "line": 11, - "column": 23 - }, - "identifierName": "key" - }, - "name": "key" - }, - { - "type": "MemberExpression", - "start": 338, - "end": 346, - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 338, - "end": 342, - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 29 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 343, - "end": 346, - "loc": { - "start": { - "line": 11, - "column": 30 - }, - "end": { - "line": 11, - "column": 33 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - } - ] - } - } - ], - "kind": "const" + "name": "root" }, - { - "type": "IfStatement", - "start": 352, - "end": 386, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 381, + "end": 385, "loc": { "start": { "line": 13, - "column": 2 + "column": 24 }, "end": { - "line": 15, - "column": 3 - } + "line": 13, + "column": 28 + }, + "identifierName": "Node" }, - "test": { - "type": "BinaryExpression", - "start": 356, - "end": 363, + "name": "Node" + } + } + ] + } + }, + { + "type": "WhileStatement", + "start": 389, + "end": 624, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 396, + "end": 400, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 12 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 402, + "end": 624, + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 29, + "column": 2 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 406, + "end": 439, + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 35 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 412, + "end": 438, "loc": { "start": { - "line": 13, - "column": 6 + "line": 15, + "column": 8 }, "end": { - "line": 13, - "column": 13 + "line": 15, + "column": 34 } }, - "left": { + "id": { "type": "Identifier", - "start": 356, - "end": 357, + "start": 412, + "end": 413, "loc": { "start": { - "line": 13, - "column": 6 + "line": 15, + "column": 8 }, "end": { - "line": 13, - "column": 7 + "line": 15, + "column": 9 }, "identifierName": "d" }, "name": "d" }, - "operator": "===", - "right": { - "type": "NumericLiteral", - "start": 362, - "end": 363, + "init": { + "type": "CallExpression", + "start": 416, + "end": 438, "loc": { "start": { - "line": 13, + "line": 15, "column": 12 }, "end": { - "line": 13, - "column": 13 + "line": 15, + "column": 34 } }, - "extra": { - "rawValue": 0, - "raw": "0" - }, - "value": 0 - } - }, - "consequent": { - "type": "BlockStatement", - "start": 365, - "end": 386, - "loc": { - "start": { - "line": 13, - "column": 15 - }, - "end": { - "line": 15, - "column": 3 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 370, - "end": 382, + "callee": { + "type": "Identifier", + "start": 416, + "end": 423, "loc": { "start": { - "line": 14, - "column": 3 + "line": 15, + "column": 12 }, "end": { - "line": 14, - "column": 15 - } + "line": 15, + "column": 19 + }, + "identifierName": "compare" }, - "argument": { + "name": "compare" + }, + "arguments": [ + { "type": "Identifier", - "start": 377, - "end": 381, + "start": 424, + "end": 427, "loc": { "start": { - "line": 14, - "column": 10 + "line": 15, + "column": 20 }, "end": { - "line": 14, - "column": 14 + "line": 15, + "column": 23 }, - "identifierName": "root" + "identifierName": "key" }, - "name": "root" + "name": "key" + }, + { + "type": "MemberExpression", + "start": 429, + "end": 437, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 429, + "end": 433, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 29 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 434, + "end": 437, + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 33 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false } - } - ], - "directives": [] + ] + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 443, + "end": 477, + "loc": { + "start": { + "line": 17, + "column": 2 }, - "alternate": null + "end": { + "line": 19, + "column": 3 + } }, - { - "type": "ExpressionStatement", - "start": 390, - "end": 428, + "test": { + "type": "BinaryExpression", + "start": 447, + "end": 454, "loc": { "start": { "line": 17, - "column": 2 + "column": 6 }, "end": { "line": 17, - "column": 40 + "column": 13 } }, - "expression": { - "type": "AssignmentExpression", - "start": 390, - "end": 427, + "left": { + "type": "Identifier", + "start": 447, + "end": 448, "loc": { "start": { "line": 17, - "column": 2 + "column": 6 }, "end": { "line": 17, - "column": 39 - } + "column": 7 + }, + "identifierName": "d" }, - "operator": "=", - "left": { - "type": "Identifier", - "start": 390, - "end": 394, - "loc": { - "start": { - "line": 17, - "column": 2 - }, - "end": { - "line": 17, - "column": 6 - }, - "identifierName": "root" + "name": "d" + }, + "operator": "===", + "right": { + "type": "NumericLiteral", + "start": 453, + "end": 454, + "loc": { + "start": { + "line": 17, + "column": 12 }, - "name": "root" + "end": { + "line": 17, + "column": 13 + } }, - "right": { - "type": "ConditionalExpression", - "start": 397, - "end": 427, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "consequent": { + "type": "BlockStatement", + "start": 456, + "end": 477, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 19, + "column": 3 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 461, + "end": 473, "loc": { "start": { - "line": 17, - "column": 9 + "line": 18, + "column": 3 }, "end": { - "line": 17, - "column": 39 + "line": 18, + "column": 15 } }, - "test": { - "type": "BinaryExpression", - "start": 397, - "end": 402, + "argument": { + "type": "Identifier", + "start": 468, + "end": 472, "loc": { "start": { - "line": 17, - "column": 9 + "line": 18, + "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 14 - } - }, - "left": { - "type": "Identifier", - "start": 397, - "end": 398, - "loc": { - "start": { - "line": 17, - "column": 9 - }, - "end": { - "line": 17, - "column": 10 - }, - "identifierName": "d" }, - "name": "d" + "identifierName": "root" }, - "operator": "<", + "name": "root" + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "VariableDeclaration", + "start": 481, + "end": 526, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 487, + "end": 525, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 487, + "end": 492, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 13 + }, + "identifierName": "child" + }, + "name": "child" + }, + "init": { + "type": "ConditionalExpression", + "start": 495, + "end": 525, + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 46 + } + }, + "test": { + "type": "BinaryExpression", + "start": 495, + "end": 500, + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 495, + "end": 496, + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 17 + }, + "identifierName": "d" + }, + "name": "d" + }, + "operator": "<", "right": { "type": "NumericLiteral", - "start": 401, - "end": 402, + "start": 499, + "end": 500, "loc": { "start": { - "line": 17, - "column": 13 + "line": 21, + "column": 20 }, "end": { - "line": 17, - "column": 14 + "line": 21, + "column": 21 } }, "extra": { @@ -624,30 +846,30 @@ }, "consequent": { "type": "MemberExpression", - "start": 405, - "end": 414, + "start": 503, + "end": 512, "loc": { "start": { - "line": 17, - "column": 17 + "line": 21, + "column": 24 }, "end": { - "line": 17, - "column": 26 + "line": 21, + "column": 33 } }, "object": { "type": "Identifier", - "start": 405, - "end": 409, + "start": 503, + "end": 507, "loc": { "start": { - "line": 17, - "column": 17 + "line": 21, + "column": 24 }, "end": { - "line": 17, - "column": 21 + "line": 21, + "column": 28 }, "identifierName": "root" }, @@ -655,16 +877,16 @@ }, "property": { "type": "Identifier", - "start": 410, - "end": 414, + "start": 508, + "end": 512, "loc": { "start": { - "line": 17, - "column": 22 + "line": 21, + "column": 29 }, "end": { - "line": 17, - "column": 26 + "line": 21, + "column": 33 }, "identifierName": "left" }, @@ -674,30 +896,30 @@ }, "alternate": { "type": "MemberExpression", - "start": 417, - "end": 427, + "start": 515, + "end": 525, "loc": { "start": { - "line": 17, - "column": 29 + "line": 21, + "column": 36 }, "end": { - "line": 17, - "column": 39 + "line": 21, + "column": 46 } }, "object": { "type": "Identifier", - "start": 417, - "end": 421, + "start": 515, + "end": 519, "loc": { "start": { - "line": 17, - "column": 29 + "line": 21, + "column": 36 }, "end": { - "line": 17, - "column": 33 + "line": 21, + "column": 40 }, "identifierName": "root" }, @@ -705,16 +927,16 @@ }, "property": { "type": "Identifier", - "start": 422, - "end": 427, + "start": 520, + "end": 525, "loc": { "start": { - "line": 17, - "column": 34 + "line": 21, + "column": 41 }, "end": { - "line": 17, - "column": 39 + "line": 21, + "column": 46 }, "identifierName": "right" }, @@ -724,230 +946,2359 @@ } } } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 530, + "end": 571, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 25, + "column": 3 + } }, - { - "type": "IfStatement", - "start": 432, - "end": 472, + "test": { + "type": "CallExpression", + "start": 534, + "end": 548, "loc": { "start": { - "line": 19, - "column": 2 + "line": 23, + "column": 6 }, "end": { - "line": 21, - "column": 3 + "line": 23, + "column": 20 } }, - "test": { - "type": "CallExpression", - "start": 436, - "end": 449, + "callee": { + "type": "MemberExpression", + "start": 534, + "end": 546, "loc": { "start": { - "line": 19, + "line": 23, "column": 6 }, "end": { - "line": 19, - "column": 19 + "line": 23, + "column": 18 } }, - "callee": { - "type": "MemberExpression", - "start": 436, - "end": 447, + "object": { + "type": "Identifier", + "start": 534, + "end": 539, "loc": { "start": { - "line": 19, + "line": 23, "column": 6 }, "end": { - "line": 19, - "column": 17 + "line": 23, + "column": 11 + }, + "identifierName": "child" + }, + "name": "child" + }, + "property": { + "type": "Identifier", + "start": 540, + "end": 546, + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 18 + }, + "identifierName": "isLeaf" + }, + "name": "isLeaf" + }, + "computed": false + }, + "arguments": [] + }, + "consequent": { + "type": "BlockStatement", + "start": 550, + "end": 571, + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 555, + "end": 567, + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 15 } }, - "object": { + "argument": { + "type": "NullLiteral", + "start": 562, + "end": 566, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 14 + } + } + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 575, + "end": 605, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 575, + "end": 604, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 575, + "end": 581, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 582, + "end": 603, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "left": { "type": "Identifier", - "start": 436, - "end": 440, + "start": 582, + "end": 587, "loc": { "start": { - "line": 19, - "column": 6 + "line": 27, + "column": 9 }, "end": { - "line": 19, - "column": 10 + "line": 27, + "column": 14 }, - "identifierName": "root" + "identifierName": "child" }, - "name": "root" + "name": "child" }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 441, - "end": 447, + "start": 599, + "end": 603, "loc": { "start": { - "line": 19, - "column": 11 + "line": 27, + "column": 26 }, "end": { - "line": 19, - "column": 17 + "line": 27, + "column": 30 }, - "identifierName": "isLeaf" + "identifierName": "Node" }, - "name": "isLeaf" - }, - "computed": false + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 608, + "end": 621, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 608, + "end": 620, + "loc": { + "start": { + "line": 28, + "column": 2 }, - "arguments": [] + "end": { + "line": 28, + "column": 14 + } }, - "consequent": { - "type": "BlockStatement", - "start": 451, - "end": 472, + "operator": "=", + "left": { + "type": "Identifier", + "start": 608, + "end": 612, "loc": { "start": { - "line": 19, - "column": 21 + "line": 28, + "column": 2 }, "end": { - "line": 21, - "column": 3 - } + "line": 28, + "column": 6 + }, + "identifierName": "root" }, - "body": [ - { - "type": "ReturnStatement", - "start": 456, - "end": 468, - "loc": { - "start": { - "line": 20, - "column": 3 - }, - "end": { - "line": 20, - "column": 15 - } - }, - "argument": { - "type": "NullLiteral", - "start": 463, - "end": 467, - "loc": { - "start": { - "line": 20, - "column": 10 - }, - "end": { - "line": 20, - "column": 14 - } - } - } - } - ], - "directives": [] + "name": "root" }, - "alternate": null + "right": { + "type": "Identifier", + "start": 615, + "end": 620, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 14 + }, + "identifierName": "child" + }, + "name": "child" + } } - ], - "directives": [] - } + } + ], + "directives": [] } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n ", - "start": 0, - "end": 248, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 3 - } + } + ], + "directives": [] } - } - ], - "trailingComments": [] + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 629, + "end": 651, + "loc": { + "start": { + "line": 32, + "column": 0 + }, + "end": { + "line": 32, + "column": 22 + } }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n ", - "start": 0, - "end": 248, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 8, - "column": 3 - } - } + "declaration": { + "type": "Identifier", + "start": 644, + "end": 650, + "loc": { + "start": { + "line": 32, + "column": 15 + }, + "end": { + "line": 32, + "column": 21 + }, + "identifierName": "search" + }, + "name": "search" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 629, + "end": 651, + "loc": { + "start": { + "line": 32, + "column": 0 + }, + "end": { + "line": 32, + "column": 22 } - ] + }, + "declaration": { + "type": "VariableDeclaration", + "start": 316, + "end": 627, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 30, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 322, + "end": 626, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 30, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 322, + "end": 328, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "search" + }, + "name": "search", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 331, + "end": 626, + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 30, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 322, + "end": 328, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 12 + }, + "identifierName": "search" + }, + "name": "search", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 332, + "end": 339, + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 23 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "Identifier", + "start": 341, + "end": 345, + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 29 + }, + "identifierName": "root" + }, + "name": "root" + }, + { + "type": "Identifier", + "start": 347, + "end": 350, + "loc": { + "start": { + "line": 12, + "column": 31 + }, + "end": { + "line": 12, + "column": 34 + }, + "identifierName": "key" + }, + "name": "key" + } + ], + "body": { + "type": "BlockStatement", + "start": 355, + "end": 626, + "loc": { + "start": { + "line": 12, + "column": 39 + }, + "end": { + "line": 30, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 358, + "end": 387, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 358, + "end": 386, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 358, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 365, + "end": 385, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 365, + "end": 369, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 12 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 381, + "end": 385, + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 28 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "WhileStatement", + "start": 389, + "end": 624, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 + } + }, + "test": { + "type": "BooleanLiteral", + "start": 396, + "end": 400, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 12 + } + }, + "value": true + }, + "body": { + "type": "BlockStatement", + "start": 402, + "end": 624, + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 29, + "column": 2 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 406, + "end": 439, + "loc": { + "start": { + "line": 15, + "column": 2 + }, + "end": { + "line": 15, + "column": 35 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 412, + "end": 438, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 34 + } + }, + "id": { + "type": "Identifier", + "start": 412, + "end": 413, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "d" + }, + "name": "d" + }, + "init": { + "type": "CallExpression", + "start": 416, + "end": 438, + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 34 + } + }, + "callee": { + "type": "Identifier", + "start": 416, + "end": 423, + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 19 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + "arguments": [ + { + "type": "Identifier", + "start": 424, + "end": 427, + "loc": { + "start": { + "line": 15, + "column": 20 + }, + "end": { + "line": 15, + "column": 23 + }, + "identifierName": "key" + }, + "name": "key" + }, + { + "type": "MemberExpression", + "start": 429, + "end": 437, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 429, + "end": 433, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 29 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 434, + "end": 437, + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 33 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 443, + "end": 477, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 19, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 447, + "end": 454, + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 13 + } + }, + "left": { + "type": "Identifier", + "start": 447, + "end": 448, + "loc": { + "start": { + "line": 17, + "column": 6 + }, + "end": { + "line": 17, + "column": 7 + }, + "identifierName": "d" + }, + "name": "d" + }, + "operator": "===", + "right": { + "type": "NumericLiteral", + "start": 453, + "end": 454, + "loc": { + "start": { + "line": 17, + "column": 12 + }, + "end": { + "line": 17, + "column": 13 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "consequent": { + "type": "BlockStatement", + "start": 456, + "end": 477, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 19, + "column": 3 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 461, + "end": 473, + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 15 + } + }, + "argument": { + "type": "Identifier", + "start": 468, + "end": 472, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "VariableDeclaration", + "start": 481, + "end": 526, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 47 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 487, + "end": 525, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 46 + } + }, + "id": { + "type": "Identifier", + "start": 487, + "end": 492, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 13 + }, + "identifierName": "child" + }, + "name": "child" + }, + "init": { + "type": "ConditionalExpression", + "start": 495, + "end": 525, + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 46 + } + }, + "test": { + "type": "BinaryExpression", + "start": 495, + "end": 500, + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 495, + "end": 496, + "loc": { + "start": { + "line": 21, + "column": 16 + }, + "end": { + "line": 21, + "column": 17 + }, + "identifierName": "d" + }, + "name": "d" + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 499, + "end": 500, + "loc": { + "start": { + "line": 21, + "column": 20 + }, + "end": { + "line": 21, + "column": 21 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "consequent": { + "type": "MemberExpression", + "start": 503, + "end": 512, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 503, + "end": 507, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 28 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 508, + "end": 512, + "loc": { + "start": { + "line": 21, + "column": 29 + }, + "end": { + "line": 21, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "alternate": { + "type": "MemberExpression", + "start": 515, + "end": 525, + "loc": { + "start": { + "line": 21, + "column": 36 + }, + "end": { + "line": 21, + "column": 46 + } + }, + "object": { + "type": "Identifier", + "start": 515, + "end": 519, + "loc": { + "start": { + "line": 21, + "column": 36 + }, + "end": { + "line": 21, + "column": 40 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 520, + "end": 525, + "loc": { + "start": { + "line": 21, + "column": 41 + }, + "end": { + "line": 21, + "column": 46 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 530, + "end": 571, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "test": { + "type": "CallExpression", + "start": 534, + "end": 548, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 20 + } + }, + "callee": { + "type": "MemberExpression", + "start": 534, + "end": 546, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 534, + "end": 539, + "loc": { + "start": { + "line": 23, + "column": 6 + }, + "end": { + "line": 23, + "column": 11 + }, + "identifierName": "child" + }, + "name": "child" + }, + "property": { + "type": "Identifier", + "start": 540, + "end": 546, + "loc": { + "start": { + "line": 23, + "column": 12 + }, + "end": { + "line": 23, + "column": 18 + }, + "identifierName": "isLeaf" + }, + "name": "isLeaf" + }, + "computed": false + }, + "arguments": [] + }, + "consequent": { + "type": "BlockStatement", + "start": 550, + "end": 571, + "loc": { + "start": { + "line": 23, + "column": 22 + }, + "end": { + "line": 25, + "column": 3 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 555, + "end": 567, + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 15 + } + }, + "argument": { + "type": "NullLiteral", + "start": 562, + "end": 566, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 14 + } + } + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 575, + "end": 605, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 575, + "end": 604, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 575, + "end": 581, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 582, + "end": 603, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 582, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 14 + }, + "identifierName": "child" + }, + "name": "child" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 599, + "end": 603, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 30 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 608, + "end": 621, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 15 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 608, + "end": 620, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 14 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 608, + "end": 612, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 6 + }, + "identifierName": "root" + }, + "name": "root" + }, + "right": { + "type": "Identifier", + "start": 615, + "end": 620, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 14 + }, + "identifierName": "child" + }, + "name": "child" + } + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", + "start": 67, + "end": 315, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", + "start": 67, + "end": 315, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", + "start": 67, + "end": 315, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 316, + "end": 321, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "search", + "start": 322, + "end": 328, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 12 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 329, + "end": 330, + "loc": { + "start": { + "line": 12, + "column": 13 + }, + "end": { + "line": 12, + "column": 14 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 331, + "end": 332, + "loc": { + "start": { + "line": 12, + "column": 15 + }, + "end": { + "line": 12, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 332, + "end": 339, + "loc": { + "start": { + "line": 12, + "column": 16 + }, + "end": { + "line": 12, + "column": 23 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 339, + "end": 340, + "loc": { + "start": { + "line": 12, + "column": 23 + }, + "end": { + "line": 12, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 341, + "end": 345, + "loc": { + "start": { + "line": 12, + "column": 25 + }, + "end": { + "line": 12, + "column": 29 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 345, + "end": 346, + "loc": { + "start": { + "line": 12, + "column": 29 + }, + "end": { + "line": 12, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 347, + "end": 350, + "loc": { + "start": { + "line": 12, + "column": 31 + }, + "end": { + "line": 12, + "column": 34 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 350, + "end": 351, + "loc": { + "start": { + "line": 12, + "column": 34 + }, + "end": { + "line": 12, + "column": 35 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 352, + "end": 354, + "loc": { + "start": { + "line": 12, + "column": 36 + }, + "end": { + "line": 12, + "column": 38 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 355, + "end": 356, + "loc": { + "start": { + "line": 12, + "column": 39 + }, + "end": { + "line": 12, + "column": 40 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 358, + "end": 364, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 364, + "end": 365, + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 365, + "end": 369, + "loc": { + "start": { + "line": 13, + "column": 8 + }, + "end": { + "line": 13, + "column": 12 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 370, + "end": 380, + "loc": { + "start": { + "line": 13, + "column": 13 + }, + "end": { + "line": 13, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 381, + "end": 385, + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 28 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 385, + "end": 386, + "loc": { + "start": { + "line": 13, + "column": 28 + }, + "end": { + "line": 13, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 386, + "end": 387, + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 13, + "column": 30 + } + } + }, + { + "type": { + "label": "while", + "keyword": "while", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": true, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "while", + "start": 389, + "end": 394, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 6 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n ", - "start": 0, - "end": 248, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 395, + "end": 396, "loc": { "start": { - "line": 1, - "column": 0 + "line": 14, + "column": 7 }, "end": { - "line": 8, - "column": 3 + "line": 14, + "column": 8 } } - } - ], - "tokens": [ + }, { - "type": "CommentBlock", - "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n ", - "start": 0, - "end": 248, + "type": { + "label": "true", + "keyword": "true", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "true", + "start": 396, + "end": 400, "loc": { "start": { - "line": 1, - "column": 0 + "line": 14, + "column": 8 }, "end": { - "line": 8, - "column": 3 + "line": 14, + "column": 12 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -955,20 +3306,43 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 249, - "end": 255, + "start": 400, + "end": 401, "loc": { "start": { - "line": 9, - "column": 0 + "line": 14, + "column": 12 }, "end": { - "line": 9, - "column": 6 + "line": 14, + "column": 13 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 402, + "end": 403, + "loc": { + "start": { + "line": 14, + "column": 14 + }, + "end": { + "line": 14, + "column": 15 } } }, @@ -987,16 +3361,16 @@ "updateContext": null }, "value": "const", - "start": 256, - "end": 261, + "start": 406, + "end": 411, "loc": { "start": { - "line": 9, - "column": 7 + "line": 15, + "column": 2 }, "end": { - "line": 9, - "column": 12 + "line": 15, + "column": 7 } } }, @@ -1012,17 +3386,17 @@ "postfix": false, "binop": null }, - "value": "search", - "start": 262, - "end": 268, + "value": "d", + "start": 412, + "end": 413, "loc": { "start": { - "line": 9, - "column": 13 + "line": 15, + "column": 8 }, "end": { - "line": 9, - "column": 19 + "line": 15, + "column": 9 } } }, @@ -1040,16 +3414,42 @@ "updateContext": null }, "value": "=", - "start": 269, - "end": 270, + "start": 414, + "end": 415, "loc": { "start": { - "line": 9, - "column": 20 + "line": 15, + "column": 10 }, "end": { - "line": 9, - "column": 21 + "line": 15, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 416, + "end": 423, + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 19 } } }, @@ -1065,16 +3465,16 @@ "postfix": false, "binop": null }, - "start": 271, - "end": 272, + "start": 423, + "end": 424, "loc": { "start": { - "line": 9, - "column": 22 + "line": 15, + "column": 19 }, "end": { - "line": 9, - "column": 23 + "line": 15, + "column": 20 } } }, @@ -1090,17 +3490,17 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 272, - "end": 279, + "value": "key", + "start": 424, + "end": 427, "loc": { "start": { - "line": 9, - "column": 23 + "line": 15, + "column": 20 }, "end": { - "line": 9, - "column": 30 + "line": 15, + "column": 23 } } }, @@ -1117,16 +3517,16 @@ "binop": null, "updateContext": null }, - "start": 279, - "end": 280, + "start": 427, + "end": 428, "loc": { "start": { - "line": 9, - "column": 30 + "line": 15, + "column": 23 }, "end": { - "line": 9, - "column": 31 + "line": 15, + "column": 24 } } }, @@ -1143,23 +3543,23 @@ "binop": null }, "value": "root", - "start": 281, - "end": 285, + "start": 429, + "end": 433, "loc": { "start": { - "line": 9, - "column": 32 + "line": 15, + "column": 25 }, "end": { - "line": 9, - "column": 36 + "line": 15, + "column": 29 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1169,16 +3569,16 @@ "binop": null, "updateContext": null }, - "start": 285, - "end": 286, + "start": 433, + "end": 434, "loc": { "start": { - "line": 9, - "column": 36 + "line": 15, + "column": 29 }, "end": { - "line": 9, - "column": 37 + "line": 15, + "column": 30 } } }, @@ -1195,16 +3595,16 @@ "binop": null }, "value": "key", - "start": 287, - "end": 290, + "start": 434, + "end": 437, "loc": { "start": { - "line": 9, - "column": 38 + "line": 15, + "column": 30 }, "end": { - "line": 9, - "column": 41 + "line": 15, + "column": 33 } } }, @@ -1220,22 +3620,22 @@ "postfix": false, "binop": null }, - "start": 290, - "end": 291, + "start": 437, + "end": 438, "loc": { "start": { - "line": 9, - "column": 41 + "line": 15, + "column": 33 }, "end": { - "line": 9, - "column": 42 + "line": 15, + "column": 34 } } }, { "type": { - "label": "=>", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1246,69 +3646,44 @@ "binop": null, "updateContext": null }, - "start": 292, - "end": 294, - "loc": { - "start": { - "line": 9, - "column": 43 - }, - "end": { - "line": 9, - "column": 45 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 295, - "end": 296, + "start": 438, + "end": 439, "loc": { "start": { - "line": 9, - "column": 46 + "line": 15, + "column": 34 }, "end": { - "line": 9, - "column": 47 + "line": 15, + "column": 35 } } }, { "type": { - "label": "while", - "keyword": "while", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, - "isLoop": true, + "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "while", - "start": 298, - "end": 303, + "value": "if", + "start": 443, + "end": 445, "loc": { "start": { - "line": 10, - "column": 1 + "line": 17, + "column": 2 }, "end": { - "line": 10, - "column": 6 + "line": 17, + "column": 4 } } }, @@ -1324,23 +3699,22 @@ "postfix": false, "binop": null }, - "start": 304, - "end": 305, + "start": 446, + "end": 447, "loc": { "start": { - "line": 10, - "column": 7 + "line": 17, + "column": 5 }, "end": { - "line": 10, - "column": 8 + "line": 17, + "column": 6 } } }, { "type": { - "label": "true", - "keyword": "true", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1348,77 +3722,79 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "true", - "start": 305, - "end": 309, + "value": "d", + "start": 447, + "end": 448, "loc": { "start": { - "line": 10, - "column": 8 + "line": 17, + "column": 6 }, "end": { - "line": 10, - "column": 12 + "line": 17, + "column": 7 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 309, - "end": 310, + "value": "===", + "start": 449, + "end": 452, "loc": { "start": { - "line": 10, - "column": 12 + "line": 17, + "column": 8 }, "end": { - "line": 10, - "column": 13 + "line": 17, + "column": 11 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "num", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 311, - "end": 312, + "value": 0, + "start": 453, + "end": 454, "loc": { "start": { - "line": 10, - "column": 14 + "line": 17, + "column": 12 }, "end": { - "line": 10, - "column": 15 + "line": 17, + "column": 13 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -1426,27 +3802,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 315, - "end": 320, + "start": 454, + "end": 455, "loc": { "start": { - "line": 11, - "column": 2 + "line": 17, + "column": 13 }, "end": { - "line": 11, - "column": 7 + "line": 17, + "column": 14 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1455,44 +3829,44 @@ "postfix": false, "binop": null }, - "value": "d", - "start": 321, - "end": 322, + "start": 456, + "end": 457, "loc": { "start": { - "line": 11, - "column": 8 + "line": 17, + "column": 15 }, "end": { - "line": 11, - "column": 9 + "line": 17, + "column": 16 } } }, { "type": { - "label": "=", + "label": "return", + "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 323, - "end": 324, + "value": "return", + "start": 461, + "end": 467, "loc": { "start": { - "line": 11, - "column": 10 + "line": 18, + "column": 3 }, "end": { - "line": 11, - "column": 11 + "line": 18, + "column": 9 } } }, @@ -1508,50 +3882,51 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 325, - "end": 332, + "value": "root", + "start": 468, + "end": 472, "loc": { "start": { - "line": 11, - "column": 12 + "line": 18, + "column": 10 }, "end": { - "line": 11, - "column": 19 + "line": 18, + "column": 14 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 332, - "end": 333, + "start": 472, + "end": 473, "loc": { "start": { - "line": 11, - "column": 19 + "line": 18, + "column": 14 }, "end": { - "line": 11, - "column": 20 + "line": 18, + "column": 15 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1559,24 +3934,24 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 333, - "end": 336, + "start": 476, + "end": 477, "loc": { "start": { - "line": 11, - "column": 20 + "line": 19, + "column": 2 }, "end": { - "line": 11, - "column": 23 + "line": 19, + "column": 3 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1586,16 +3961,17 @@ "binop": null, "updateContext": null }, - "start": 336, - "end": 337, + "value": "const", + "start": 481, + "end": 486, "loc": { "start": { - "line": 11, - "column": 23 + "line": 21, + "column": 2 }, "end": { - "line": 11, - "column": 24 + "line": 21, + "column": 7 } } }, @@ -1611,43 +3987,44 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 338, - "end": 342, + "value": "child", + "start": 487, + "end": 492, "loc": { "start": { - "line": 11, - "column": 25 + "line": 21, + "column": 8 }, "end": { - "line": 11, - "column": 29 + "line": 21, + "column": 13 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 342, - "end": 343, + "value": "=", + "start": 493, + "end": 494, "loc": { "start": { - "line": 11, - "column": 29 + "line": 21, + "column": 14 }, "end": { - "line": 11, - "column": 30 + "line": 21, + "column": 15 } } }, @@ -1663,48 +4040,23 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 343, - "end": 346, - "loc": { - "start": { - "line": 11, - "column": 30 - }, - "end": { - "line": 11, - "column": 33 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 346, - "end": 347, + "value": "d", + "start": 495, + "end": 496, "loc": { "start": { - "line": 11, - "column": 33 + "line": 21, + "column": 16 }, "end": { - "line": 11, - "column": 34 + "line": 21, + "column": 17 } } }, { "type": { - "label": ";", + "label": "", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1712,28 +4064,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 347, - "end": 348, + "value": "<", + "start": 497, + "end": 498, "loc": { "start": { - "line": 11, - "column": 34 + "line": 21, + "column": 18 }, "end": { - "line": 11, - "column": 35 + "line": 21, + "column": 19 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "num", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1742,42 +4094,43 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 352, - "end": 354, + "value": 0, + "start": 499, + "end": 500, "loc": { "start": { - "line": 13, - "column": 2 + "line": 21, + "column": 20 }, "end": { - "line": 13, - "column": 4 + "line": 21, + "column": 21 } } }, { "type": { - "label": "(", + "label": "?", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 355, - "end": 356, + "start": 501, + "end": 502, "loc": { "start": { - "line": 13, - "column": 5 + "line": 21, + "column": 22 }, "end": { - "line": 13, - "column": 6 + "line": 21, + "column": 23 } } }, @@ -1793,50 +4146,49 @@ "postfix": false, "binop": null }, - "value": "d", - "start": 356, - "end": 357, + "value": "root", + "start": 503, + "end": 507, "loc": { "start": { - "line": 13, - "column": 6 + "line": 21, + "column": 24 }, "end": { - "line": 13, - "column": 7 + "line": 21, + "column": 28 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 358, - "end": 361, + "start": 507, + "end": 508, "loc": { - "start": { - "line": 13, - "column": 8 + "start": { + "line": 21, + "column": 28 }, "end": { - "line": 13, - "column": 11 + "line": 21, + "column": 29 } } }, { "type": { - "label": "num", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1844,52 +4196,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": 0, - "start": 362, - "end": 363, + "value": "left", + "start": 508, + "end": 512, "loc": { "start": { - "line": 13, - "column": 12 + "line": 21, + "column": 29 }, "end": { - "line": 13, - "column": 13 + "line": 21, + "column": 33 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ":", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 363, - "end": 364, + "start": 513, + "end": 514, "loc": { "start": { - "line": 13, - "column": 13 + "line": 21, + "column": 34 }, "end": { - "line": 13, - "column": 14 + "line": 21, + "column": 35 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -1898,24 +4250,24 @@ "postfix": false, "binop": null }, - "start": 365, - "end": 366, + "value": "root", + "start": 515, + "end": 519, "loc": { "start": { - "line": 13, - "column": 15 + "line": 21, + "column": 36 }, "end": { - "line": 13, - "column": 16 + "line": 21, + "column": 40 } } }, { "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -1925,17 +4277,16 @@ "binop": null, "updateContext": null }, - "value": "return", - "start": 370, - "end": 376, + "start": 519, + "end": 520, "loc": { "start": { - "line": 14, - "column": 3 + "line": 21, + "column": 40 }, "end": { - "line": 14, - "column": 9 + "line": 21, + "column": 41 } } }, @@ -1951,17 +4302,17 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 377, - "end": 381, + "value": "right", + "start": 520, + "end": 525, "loc": { "start": { - "line": 14, - "column": 10 + "line": 21, + "column": 41 }, "end": { - "line": 14, - "column": 14 + "line": 21, + "column": 46 } } }, @@ -1978,22 +4329,23 @@ "binop": null, "updateContext": null }, - "start": 381, - "end": 382, + "start": 525, + "end": 526, "loc": { "start": { - "line": 14, - "column": 14 + "line": 21, + "column": 46 }, "end": { - "line": 14, - "column": 15 + "line": 21, + "column": 47 } } }, { "type": { - "label": "}", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2001,25 +4353,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 385, - "end": 386, + "value": "if", + "start": 530, + "end": 532, "loc": { "start": { - "line": 15, + "line": 23, "column": 2 }, "end": { - "line": 15, - "column": 3 + "line": 23, + "column": 4 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2028,47 +4382,19 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 390, - "end": 394, + "start": 533, + "end": 534, "loc": { "start": { - "line": 17, - "column": 2 + "line": 23, + "column": 5 }, "end": { - "line": 17, + "line": 23, "column": 6 } } }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 395, - "end": 396, - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 8 - } - } - }, { "type": { "label": "name", @@ -2081,50 +4407,49 @@ "postfix": false, "binop": null }, - "value": "d", - "start": 397, - "end": 398, + "value": "child", + "start": 534, + "end": 539, "loc": { "start": { - "line": 17, - "column": 9 + "line": 23, + "column": 6 }, "end": { - "line": 17, - "column": 10 + "line": 23, + "column": 11 } } }, { "type": { - "label": "", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "<", - "start": 399, - "end": 400, + "start": 539, + "end": 540, "loc": { "start": { - "line": 17, + "line": 23, "column": 11 }, "end": { - "line": 17, + "line": 23, "column": 12 } } }, { "type": { - "label": "num", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2132,54 +4457,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": 0, - "start": 401, - "end": 402, + "value": "isLeaf", + "start": 540, + "end": 546, "loc": { "start": { - "line": 17, - "column": 13 + "line": 23, + "column": 12 }, "end": { - "line": 17, - "column": 14 + "line": 23, + "column": 18 } } }, { "type": { - "label": "?", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 403, - "end": 404, + "start": 546, + "end": 547, "loc": { "start": { - "line": 17, - "column": 15 + "line": 23, + "column": 18 }, "end": { - "line": 17, - "column": 16 + "line": 23, + "column": 19 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2187,23 +4510,22 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 405, - "end": 409, + "start": 547, + "end": 548, "loc": { "start": { - "line": 17, - "column": 17 + "line": 23, + "column": 19 }, "end": { - "line": 17, - "column": 21 + "line": 23, + "column": 20 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2211,26 +4533,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 409, - "end": 410, + "start": 548, + "end": 549, "loc": { "start": { - "line": 17, - "column": 21 + "line": 23, + "column": 20 }, "end": { - "line": 17, - "column": 22 + "line": 23, + "column": 21 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2239,23 +4560,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 410, - "end": 414, + "start": 550, + "end": 551, "loc": { "start": { - "line": 17, + "line": 23, "column": 22 }, "end": { - "line": 17, - "column": 26 + "line": 23, + "column": 23 } } }, { "type": { - "label": ":", + "label": "return", + "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2266,48 +4587,77 @@ "binop": null, "updateContext": null }, - "start": 415, - "end": 416, + "value": "return", + "start": 555, + "end": 561, + "loc": { + "start": { + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 562, + "end": 566, "loc": { "start": { - "line": 17, - "column": 27 + "line": 24, + "column": 10 }, "end": { - "line": 17, - "column": 28 + "line": 24, + "column": 14 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "root", - "start": 417, - "end": 421, + "start": 566, + "end": 567, "loc": { "start": { - "line": 17, - "column": 29 + "line": 24, + "column": 14 }, "end": { - "line": 17, - "column": 33 + "line": 24, + "column": 15 } } }, { "type": { - "label": ".", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2315,19 +4665,18 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 421, - "end": 422, + "start": 570, + "end": 571, "loc": { "start": { - "line": 17, - "column": 33 + "line": 25, + "column": 2 }, "end": { - "line": 17, - "column": 34 + "line": 25, + "column": 3 } } }, @@ -2343,96 +4692,96 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 422, - "end": 427, + "value": "assert", + "start": 575, + "end": 581, "loc": { "start": { - "line": 17, - "column": 34 + "line": 27, + "column": 2 }, "end": { - "line": 17, - "column": 39 + "line": 27, + "column": 8 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 427, - "end": 428, + "start": 581, + "end": 582, "loc": { "start": { - "line": 17, - "column": 39 + "line": 27, + "column": 8 }, "end": { - "line": 17, - "column": 40 + "line": 27, + "column": 9 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 432, - "end": 434, + "value": "child", + "start": 582, + "end": 587, "loc": { "start": { - "line": 19, - "column": 2 + "line": 27, + "column": 9 }, "end": { - "line": 19, - "column": 4 + "line": 27, + "column": 14 } } }, { "type": { - "label": "(", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 435, - "end": 436, + "value": "instanceof", + "start": 588, + "end": 598, "loc": { "start": { - "line": 19, - "column": 5 + "line": 27, + "column": 15 }, "end": { - "line": 19, - "column": 6 + "line": 27, + "column": 25 } } }, @@ -2448,23 +4797,23 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 436, - "end": 440, + "value": "Node", + "start": 599, + "end": 603, "loc": { "start": { - "line": 19, - "column": 6 + "line": 27, + "column": 26 }, "end": { - "line": 19, - "column": 10 + "line": 27, + "column": 30 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2472,52 +4821,51 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 440, - "end": 441, + "start": 603, + "end": 604, "loc": { "start": { - "line": 19, - "column": 10 + "line": 27, + "column": 30 }, "end": { - "line": 19, - "column": 11 + "line": 27, + "column": 31 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "isLeaf", - "start": 441, - "end": 447, + "start": 604, + "end": 605, "loc": { "start": { - "line": 19, - "column": 11 + "line": 27, + "column": 31 }, "end": { - "line": 19, - "column": 17 + "line": 27, + "column": 32 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2526,49 +4874,52 @@ "postfix": false, "binop": null }, - "start": 447, - "end": 448, + "value": "root", + "start": 608, + "end": 612, "loc": { "start": { - "line": 19, - "column": 17 + "line": 28, + "column": 2 }, "end": { - "line": 19, - "column": 18 + "line": 28, + "column": 6 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 448, - "end": 449, + "value": "=", + "start": 613, + "end": 614, "loc": { "start": { - "line": 19, - "column": 18 + "line": 28, + "column": 7 }, "end": { - "line": 19, - "column": 19 + "line": 28, + "column": 8 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2576,97 +4927,93 @@ "postfix": false, "binop": null }, - "start": 449, - "end": 450, + "value": "child", + "start": 615, + "end": 620, "loc": { "start": { - "line": 19, - "column": 19 + "line": 28, + "column": 9 }, "end": { - "line": 19, - "column": 20 + "line": 28, + "column": 14 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 451, - "end": 452, + "start": 620, + "end": 621, "loc": { "start": { - "line": 19, - "column": 21 + "line": 28, + "column": 14 }, "end": { - "line": 19, - "column": 22 + "line": 28, + "column": 15 } } }, { "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "return", - "start": 456, - "end": 462, + "start": 623, + "end": 624, "loc": { "start": { - "line": 20, - "column": 3 + "line": 29, + "column": 1 }, "end": { - "line": 20, - "column": 9 + "line": 29, + "column": 2 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 463, - "end": 467, + "start": 625, + "end": 626, "loc": { "start": { - "line": 20, - "column": 10 + "line": 30, + "column": 0 }, "end": { - "line": 20, - "column": 14 + "line": 30, + "column": 1 } } }, @@ -2683,22 +5030,23 @@ "binop": null, "updateContext": null }, - "start": 467, - "end": 468, + "start": 626, + "end": 627, "loc": { "start": { - "line": 20, - "column": 14 + "line": 30, + "column": 1 }, "end": { - "line": 20, - "column": 15 + "line": 30, + "column": 2 } } }, { "type": { - "label": "}", + "label": "export", + "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2706,51 +5054,56 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 471, - "end": 472, + "value": "export", + "start": 629, + "end": 635, "loc": { "start": { - "line": 21, - "column": 2 + "line": 32, + "column": 0 }, "end": { - "line": 21, - "column": 3 + "line": 32, + "column": 6 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "default", + "keyword": "default", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 474, - "end": 475, + "value": "default", + "start": 636, + "end": 643, "loc": { "start": { - "line": 22, - "column": 1 + "line": 32, + "column": 7 }, "end": { - "line": 22, - "column": 2 + "line": 32, + "column": 14 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2758,16 +5111,17 @@ "postfix": false, "binop": null }, - "start": 476, - "end": 477, + "value": "search", + "start": 644, + "end": 650, "loc": { "start": { - "line": 23, - "column": 0 + "line": 32, + "column": 15 }, "end": { - "line": 23, - "column": 1 + "line": 32, + "column": 21 } } }, @@ -2784,16 +5138,16 @@ "binop": null, "updateContext": null }, - "start": 477, - "end": 478, + "start": 650, + "end": 651, "loc": { "start": { - "line": 23, - "column": 1 + "line": 32, + "column": 21 }, "end": { - "line": 23, - "column": 2 + "line": 32, + "column": 22 } } }, @@ -2810,15 +5164,15 @@ "binop": null, "updateContext": null }, - "start": 479, - "end": 479, + "start": 652, + "end": 652, "loc": { "start": { - "line": 24, + "line": 33, "column": 0 }, "end": { - "line": 24, + "line": 33, "column": 0 } } diff --git a/ast/source/traversal/index.js.json b/ast/source/traversal/index.js.json deleted file mode 100644 index 1eee90c..0000000 --- a/ast/source/traversal/index.js.json +++ /dev/null @@ -1,401 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 76, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 76, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ExportAllDeclaration", - "start": 0, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 38 - } - }, - "source": { - "type": "StringLiteral", - "start": 14, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 37 - } - }, - "extra": { - "rawValue": "./inordertraversal.js", - "raw": "'./inordertraversal.js'" - }, - "value": "./inordertraversal.js" - } - }, - { - "type": "ExportAllDeclaration", - "start": 39, - "end": 75, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 36 - } - }, - "source": { - "type": "StringLiteral", - "start": 53, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "extra": { - "rawValue": "./rangetraversal.js", - "raw": "'./rangetraversal.js'" - }, - "value": "./rangetraversal.js" - } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 9, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 9 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./inordertraversal.js", - "start": 14, - "end": 37, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 37 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 37, - "end": 38, - "loc": { - "start": { - "line": 1, - "column": 37 - }, - "end": { - "line": 1, - "column": 38 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 39, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 10, - "updateContext": null - }, - "value": "*", - "start": 46, - "end": 47, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 48, - "end": 52, - "loc": { - "start": { - "line": 2, - "column": 9 - }, - "end": { - "line": 2, - "column": 13 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./rangetraversal.js", - "start": 53, - "end": 74, - "loc": { - "start": { - "line": 2, - "column": 14 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 74, - "end": 75, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 76, - "end": 76, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/traversal/inordertraversal.js.json b/ast/source/traversal/inordertraversal.js.json index fb01bc5..48df69d 100644 --- a/ast/source/traversal/inordertraversal.js.json +++ b/ast/source/traversal/inordertraversal.js.json @@ -1,75 +1,229 @@ { "type": "File", "start": 0, - "end": 687, + "end": 876, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 25, + "line": 31, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 687, + "end": 876, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 25, + "line": 31, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 140, - "end": 686, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 7, + "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 214, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ] + }, + { + "type": "ExportDefaultDeclaration", + "start": 215, + "end": 875, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 30, "column": 1 } }, - "specifiers": [], - "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 147, - "end": 686, + "start": 230, + "end": 875, "loc": { "start": { - "line": 7, - "column": 7 + "line": 10, + "column": 15 }, "end": { - "line": 24, + "line": 30, "column": 1 } }, "id": { "type": "Identifier", - "start": 157, - "end": 173, + "start": 240, + "end": 256, "loc": { "start": { - "line": 7, - "column": 17 + "line": 10, + "column": 25 }, "end": { - "line": 7, - "column": 33 + "line": 10, + "column": 41 }, "identifierName": "inordertraversal" }, @@ -82,16 +236,16 @@ "params": [ { "type": "Identifier", - "start": 174, - "end": 178, + "start": 257, + "end": 261, "loc": { "start": { - "line": 7, - "column": 34 + "line": 10, + "column": 42 }, "end": { - "line": 7, - "column": 38 + "line": 10, + "column": 46 }, "identifierName": "node" }, @@ -100,44 +254,143 @@ ], "body": { "type": "BlockStatement", - "start": 180, - "end": 686, + "start": 263, + "end": 875, "loc": { "start": { - "line": 7, - "column": 40 + "line": 10, + "column": 48 }, "end": { - "line": 24, + "line": 30, "column": 1 } }, "body": [ + { + "type": "ExpressionStatement", + "start": 266, + "end": 295, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 266, + "end": 294, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 266, + "end": 272, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 273, + "end": 293, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 273, + "end": 277, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 289, + "end": 293, + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 28 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, { "type": "IfStatement", - "start": 183, - "end": 408, + "start": 297, + "end": 559, "loc": { "start": { - "line": 8, + "line": 12, "column": 1 }, "end": { - "line": 13, + "line": 18, "column": 2 } }, "test": { "type": "UnaryExpression", - "start": 187, - "end": 206, + "start": 301, + "end": 320, "loc": { "start": { - "line": 8, + "line": 12, "column": 5 }, "end": { - "line": 8, + "line": 12, "column": 24 } }, @@ -145,57 +398,57 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 188, - "end": 206, + "start": 302, + "end": 320, "loc": { "start": { - "line": 8, + "line": 12, "column": 6 }, "end": { - "line": 8, + "line": 12, "column": 24 } }, "callee": { "type": "MemberExpression", - "start": 188, - "end": 204, + "start": 302, + "end": 318, "loc": { "start": { - "line": 8, + "line": 12, "column": 6 }, "end": { - "line": 8, + "line": 12, "column": 22 } }, "object": { "type": "MemberExpression", - "start": 188, - "end": 197, + "start": 302, + "end": 311, "loc": { "start": { - "line": 8, + "line": 12, "column": 6 }, "end": { - "line": 8, + "line": 12, "column": 15 } }, "object": { "type": "Identifier", - "start": 188, - "end": 192, + "start": 302, + "end": 306, "loc": { "start": { - "line": 8, + "line": 12, "column": 6 }, "end": { - "line": 8, + "line": 12, "column": 10 }, "identifierName": "node" @@ -204,15 +457,15 @@ }, "property": { "type": "Identifier", - "start": 193, - "end": 197, + "start": 307, + "end": 311, "loc": { "start": { - "line": 8, + "line": 12, "column": 11 }, "end": { - "line": 8, + "line": 12, "column": 15 }, "identifierName": "left" @@ -223,15 +476,15 @@ }, "property": { "type": "Identifier", - "start": 198, - "end": 204, + "start": 312, + "end": 318, "loc": { "start": { - "line": 8, + "line": 12, "column": 16 }, "end": { - "line": 8, + "line": 12, "column": 22 }, "identifierName": "isLeaf" @@ -248,107 +501,106 @@ }, "consequent": { "type": "BlockStatement", - "start": 208, - "end": 408, + "start": 322, + "end": 559, "loc": { "start": { - "line": 8, + "line": 12, "column": 26 }, "end": { - "line": 13, + "line": 18, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 370, - "end": 405, + "start": 484, + "end": 518, "loc": { "start": { - "line": 12, + "line": 16, "column": 2 }, "end": { - "line": 12, - "column": 37 + "line": 16, + "column": 36 } }, "expression": { - "type": "YieldExpression", - "start": 370, - "end": 404, + "type": "CallExpression", + "start": 484, + "end": 517, "loc": { "start": { - "line": 12, + "line": 16, "column": 2 }, "end": { - "line": 12, - "column": 36 + "line": 16, + "column": 35 } }, - "delegate": true, - "argument": { - "type": "CallExpression", - "start": 377, - "end": 404, + "callee": { + "type": "Identifier", + "start": 484, + "end": 490, "loc": { "start": { - "line": 12, - "column": 9 + "line": 16, + "column": 2 }, "end": { - "line": 12, - "column": 36 - } + "line": 16, + "column": 8 + }, + "identifierName": "assert" }, - "callee": { - "type": "Identifier", - "start": 377, - "end": 393, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 491, + "end": 516, "loc": { "start": { - "line": 12, + "line": 16, "column": 9 }, "end": { - "line": 12, - "column": 25 - }, - "identifierName": "inordertraversal" + "line": 16, + "column": 34 + } }, - "name": "inordertraversal", - "leadingComments": null - }, - "arguments": [ - { + "left": { "type": "MemberExpression", - "start": 394, - "end": 403, + "start": 491, + "end": 500, "loc": { "start": { - "line": 12, - "column": 26 + "line": 16, + "column": 9 }, "end": { - "line": 12, - "column": 35 + "line": 16, + "column": 18 } }, "object": { "type": "Identifier", - "start": 394, - "end": 398, + "start": 491, + "end": 495, "loc": { "start": { - "line": 12, - "column": 26 + "line": 16, + "column": 9 }, "end": { - "line": 12, - "column": 30 + "line": 16, + "column": 13 }, "identifierName": "node" }, @@ -356,41 +608,58 @@ }, "property": { "type": "Identifier", - "start": 399, - "end": 403, + "start": 496, + "end": 500, "loc": { "start": { - "line": 12, - "column": 31 + "line": 16, + "column": 14 }, "end": { - "line": 12, - "column": 35 + "line": 16, + "column": 18 }, "identifierName": "left" }, "name": "left" }, "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 512, + "end": 516, + "loc": { + "start": { + "line": 16, + "column": 30 + }, + "end": { + "line": 16, + "column": 34 + }, + "identifierName": "Node" + }, + "name": "Node" } - ], - "leadingComments": null - }, + } + ], "leadingComments": null }, "leadingComments": [ { "type": "CommentLine", "value": " Yield the nodes on the left recursively. Those nodes are all smaller", - "start": 212, - "end": 283, + "start": 326, + "end": 397, "loc": { "start": { - "line": 9, + "line": 13, "column": 2 }, "end": { - "line": 9, + "line": 13, "column": 73 } } @@ -398,15 +667,15 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 286, - "end": 350, + "start": 400, + "end": 464, "loc": { "start": { - "line": 10, + "line": 14, "column": 2 }, "end": { - "line": 10, + "line": 14, "column": 66 } } @@ -414,117 +683,232 @@ { "type": "CommentLine", "value": " properties.", - "start": 353, - "end": 367, + "start": 467, + "end": 481, "loc": { "start": { - "line": 11, + "line": 15, "column": 2 }, "end": { - "line": 11, + "line": 15, "column": 16 } } } ] - } - ], - "directives": [], - "trailingComments": null - }, - "alternate": null, - "trailingComments": [ - { - "type": "CommentLine", - "value": " Yield the current node.", - "start": 411, - "end": 437, - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 27 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 439, - "end": 454, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 16 - } - }, - "expression": { - "type": "YieldExpression", - "start": 439, - "end": 453, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 15 - } - }, - "delegate": false, - "argument": { - "type": "MemberExpression", - "start": 445, - "end": 453, - "loc": { - "start": { - "line": 16, - "column": 7 - }, - "end": { - "line": 16, - "column": 15 - } }, - "object": { - "type": "Identifier", - "start": 445, - "end": 449, + { + "type": "ExpressionStatement", + "start": 521, + "end": 556, "loc": { "start": { - "line": 16, - "column": 7 + "line": 17, + "column": 2 }, "end": { - "line": 16, - "column": 11 - }, - "identifierName": "node" - }, + "line": 17, + "column": 37 + } + }, + "expression": { + "type": "YieldExpression", + "start": 521, + "end": 555, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 36 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 528, + "end": 555, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 528, + "end": 544, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 25 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 545, + "end": 554, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 545, + "end": 549, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 30 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 550, + "end": 554, + "loc": { + "start": { + "line": 17, + "column": 31 + }, + "end": { + "line": 17, + "column": 35 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + ] + } + } + } + ], + "directives": [], + "trailingComments": null + }, + "alternate": null, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Yield the current node.", + "start": 562, + "end": 588, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 27 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 590, + "end": 605, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "expression": { + "type": "YieldExpression", + "start": 590, + "end": 604, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 15 + } + }, + "delegate": false, + "argument": { + "type": "MemberExpression", + "start": 596, + "end": 604, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 596, + "end": 600, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 11 + }, + "identifierName": "node" + }, "name": "node", "leadingComments": null }, "property": { "type": "Identifier", - "start": 450, - "end": 453, + "start": 601, + "end": 604, "loc": { "start": { - "line": 16, + "line": 21, "column": 12 }, "end": { - "line": 16, + "line": 21, "column": 15 }, "identifierName": "key" @@ -540,15 +924,15 @@ { "type": "CommentLine", "value": " Yield the current node.", - "start": 411, - "end": 437, + "start": 562, + "end": 588, "loc": { "start": { - "line": 15, + "line": 20, "column": 1 }, "end": { - "line": 15, + "line": 20, "column": 27 } } @@ -557,29 +941,29 @@ }, { "type": "IfStatement", - "start": 457, - "end": 684, + "start": 608, + "end": 873, "loc": { "start": { - "line": 18, + "line": 23, "column": 1 }, "end": { - "line": 23, + "line": 29, "column": 2 } }, "test": { "type": "UnaryExpression", - "start": 461, - "end": 481, + "start": 612, + "end": 632, "loc": { "start": { - "line": 18, + "line": 23, "column": 5 }, "end": { - "line": 18, + "line": 23, "column": 25 } }, @@ -587,57 +971,57 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 462, - "end": 481, + "start": 613, + "end": 632, "loc": { "start": { - "line": 18, + "line": 23, "column": 6 }, "end": { - "line": 18, + "line": 23, "column": 25 } }, "callee": { "type": "MemberExpression", - "start": 462, - "end": 479, + "start": 613, + "end": 630, "loc": { "start": { - "line": 18, + "line": 23, "column": 6 }, "end": { - "line": 18, + "line": 23, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 462, - "end": 472, + "start": 613, + "end": 623, "loc": { "start": { - "line": 18, + "line": 23, "column": 6 }, "end": { - "line": 18, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 462, - "end": 466, + "start": 613, + "end": 617, "loc": { "start": { - "line": 18, + "line": 23, "column": 6 }, "end": { - "line": 18, + "line": 23, "column": 10 }, "identifierName": "node" @@ -646,15 +1030,15 @@ }, "property": { "type": "Identifier", - "start": 467, - "end": 472, + "start": 618, + "end": 623, "loc": { "start": { - "line": 18, + "line": 23, "column": 11 }, "end": { - "line": 18, + "line": 23, "column": 16 }, "identifierName": "right" @@ -665,15 +1049,15 @@ }, "property": { "type": "Identifier", - "start": 473, - "end": 479, + "start": 624, + "end": 630, "loc": { "start": { - "line": 18, + "line": 23, "column": 17 }, "end": { - "line": 18, + "line": 23, "column": 23 }, "identifierName": "isLeaf" @@ -690,107 +1074,106 @@ }, "consequent": { "type": "BlockStatement", - "start": 483, - "end": 684, + "start": 634, + "end": 873, "loc": { "start": { - "line": 18, + "line": 23, "column": 27 }, "end": { - "line": 23, + "line": 29, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 645, - "end": 681, + "start": 796, + "end": 831, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, - "column": 38 + "line": 27, + "column": 37 } }, "expression": { - "type": "YieldExpression", - "start": 645, - "end": 680, + "type": "CallExpression", + "start": 796, + "end": 830, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, - "column": 37 + "line": 27, + "column": 36 } }, - "delegate": true, - "argument": { - "type": "CallExpression", - "start": 652, - "end": 680, + "callee": { + "type": "Identifier", + "start": 796, + "end": 802, "loc": { "start": { - "line": 22, - "column": 9 + "line": 27, + "column": 2 }, "end": { - "line": 22, - "column": 37 - } + "line": 27, + "column": 8 + }, + "identifierName": "assert" }, - "callee": { - "type": "Identifier", - "start": 652, - "end": 668, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 803, + "end": 829, "loc": { "start": { - "line": 22, + "line": 27, "column": 9 }, "end": { - "line": 22, - "column": 25 - }, - "identifierName": "inordertraversal" + "line": 27, + "column": 35 + } }, - "name": "inordertraversal", - "leadingComments": null - }, - "arguments": [ - { + "left": { "type": "MemberExpression", - "start": 669, - "end": 679, + "start": 803, + "end": 813, "loc": { "start": { - "line": 22, - "column": 26 + "line": 27, + "column": 9 }, "end": { - "line": 22, - "column": 36 + "line": 27, + "column": 19 } }, "object": { "type": "Identifier", - "start": 669, - "end": 673, + "start": 803, + "end": 807, "loc": { "start": { - "line": 22, - "column": 26 + "line": 27, + "column": 9 }, "end": { - "line": 22, - "column": 30 + "line": 27, + "column": 13 }, "identifierName": "node" }, @@ -798,41 +1181,58 @@ }, "property": { "type": "Identifier", - "start": 674, - "end": 679, + "start": 808, + "end": 813, "loc": { "start": { - "line": 22, - "column": 31 + "line": 27, + "column": 14 }, "end": { - "line": 22, - "column": 36 + "line": 27, + "column": 19 }, "identifierName": "right" }, "name": "right" }, "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 825, + "end": 829, + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 35 + }, + "identifierName": "Node" + }, + "name": "Node" } - ], - "leadingComments": null - }, + } + ], "leadingComments": null }, "leadingComments": [ { "type": "CommentLine", "value": " Yield the nodes on the right recursively. Those nodes are all larger", - "start": 487, - "end": 558, + "start": 638, + "end": 709, "loc": { "start": { - "line": 19, + "line": 24, "column": 2 }, "end": { - "line": 19, + "line": 24, "column": 73 } } @@ -840,15 +1240,15 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 561, - "end": 625, + "start": 712, + "end": 776, "loc": { "start": { - "line": 20, + "line": 25, "column": 2 }, "end": { - "line": 20, + "line": 25, "column": 66 } } @@ -856,100 +1256,215 @@ { "type": "CommentLine", "value": " properties.", - "start": 628, - "end": 642, + "start": 779, + "end": 793, "loc": { "start": { - "line": 21, + "line": 26, "column": 2 }, "end": { - "line": 21, + "line": 26, "column": 16 } } } ] - } - ], - "directives": [] - }, - "alternate": null - } - ], - "directives": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n ", - "start": 0, - "end": 139, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } - } - ], - "trailingComments": [] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n ", - "start": 0, - "end": 139, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } - } - ] - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n ", - "start": 0, - "end": 139, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 6, - "column": 3 - } - } - }, - { - "type": "CommentLine", - "value": " Yield the nodes on the left recursively. Those nodes are all smaller", - "start": 212, - "end": 283, - "loc": { - "start": { + }, + { + "type": "ExpressionStatement", + "start": 834, + "end": 870, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 38 + } + }, + "expression": { + "type": "YieldExpression", + "start": 834, + "end": 869, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 37 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 841, + "end": 869, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 37 + } + }, + "callee": { + "type": "Identifier", + "start": 841, + "end": 857, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 25 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 858, + "end": 868, + "loc": { + "start": { + "line": 28, + "column": 26 + }, + "end": { + "line": 28, + "column": 36 + } + }, + "object": { + "type": "Identifier", + "start": 858, + "end": 862, + "loc": { + "start": { + "line": 28, + "column": 26 + }, + "end": { + "line": 28, + "column": 30 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 863, + "end": 868, + "loc": { + "start": { + "line": 28, + "column": 31 + }, + "end": { + "line": 28, + "column": 36 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + ] + } + } + } + ], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 214, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ], + "trailingComments": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 214, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 214, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { "line": 9, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " Yield the nodes on the left recursively. Those nodes are all smaller", + "start": 326, + "end": 397, + "loc": { + "start": { + "line": 13, "column": 2 }, "end": { - "line": 9, + "line": 13, "column": 73 } } @@ -957,15 +1472,15 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 286, - "end": 350, + "start": 400, + "end": 464, "loc": { "start": { - "line": 10, + "line": 14, "column": 2 }, "end": { - "line": 10, + "line": 14, "column": 66 } } @@ -973,15 +1488,15 @@ { "type": "CommentLine", "value": " properties.", - "start": 353, - "end": 367, + "start": 467, + "end": 481, "loc": { "start": { - "line": 11, + "line": 15, "column": 2 }, "end": { - "line": 11, + "line": 15, "column": 16 } } @@ -989,15 +1504,15 @@ { "type": "CommentLine", "value": " Yield the current node.", - "start": 411, - "end": 437, + "start": 562, + "end": 588, "loc": { "start": { - "line": 15, + "line": 20, "column": 1 }, "end": { - "line": 15, + "line": 20, "column": 27 } } @@ -1005,15 +1520,15 @@ { "type": "CommentLine", "value": " Yield the nodes on the right recursively. Those nodes are all larger", - "start": 487, - "end": 558, + "start": 638, + "end": 709, "loc": { "start": { - "line": 19, + "line": 24, "column": 2 }, "end": { - "line": 19, + "line": 24, "column": 73 } } @@ -1021,15 +1536,15 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 561, - "end": 625, + "start": 712, + "end": 776, "loc": { "start": { - "line": 20, + "line": 25, "column": 2 }, "end": { - "line": 20, + "line": 25, "column": 66 } } @@ -1037,15 +1552,15 @@ { "type": "CommentLine", "value": " properties.", - "start": 628, - "end": 642, + "start": 779, + "end": 793, "loc": { "start": { - "line": 21, + "line": 26, "column": 2 }, "end": { - "line": 21, + "line": 26, "column": 16 } } @@ -1053,53 +1568,62 @@ ], "tokens": [ { - "type": "CommentBlock", - "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n ", + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", "start": 0, - "end": 139, + "end": 6, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 6, - "column": 3 + "line": 1, + "column": 6 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 140, - "end": 146, + "value": "assert", + "start": 7, + "end": 13, "loc": { "start": { - "line": 7, - "column": 0 + "line": 1, + "column": 7 }, "end": { - "line": 7, - "column": 6 + "line": 1, + "column": 13 } } }, { "type": { - "label": "function", - "keyword": "function", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1109,23 +1633,50 @@ "postfix": false, "binop": null }, - "value": "function", - "start": 147, - "end": 155, + "value": "from", + "start": 14, + "end": 18, "loc": { "start": { - "line": 7, - "column": 7 + "line": 1, + "column": 14 }, "end": { - "line": 7, - "column": 15 + "line": 1, + "column": 18 } } }, { "type": { - "label": "*", + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1133,19 +1684,770 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, + "binop": null, "updateContext": null }, - "value": "*", - "start": 155, - "end": 156, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 214, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 215, + "end": 221, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 222, + "end": 229, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, + { + "type": { + "label": "function", + "keyword": "function", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "function", + "start": 230, + "end": 238, + "loc": { + "start": { + "line": 10, + "column": 15 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 238, + "end": 239, + "loc": { + "start": { + "line": 10, + "column": 23 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "inordertraversal", + "start": 240, + "end": 256, + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 41 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 256, + "end": 257, + "loc": { + "start": { + "line": 10, + "column": 41 + }, + "end": { + "line": 10, + "column": 42 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 257, + "end": 261, + "loc": { + "start": { + "line": 10, + "column": 42 + }, + "end": { + "line": 10, + "column": 46 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 261, + "end": 262, + "loc": { + "start": { + "line": 10, + "column": 46 + }, + "end": { + "line": 10, + "column": 47 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 263, + "end": 264, + "loc": { + "start": { + "line": 10, + "column": 48 + }, + "end": { + "line": 10, + "column": 49 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 266, + "end": 272, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 272, + "end": 273, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 273, + "end": 277, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 278, + "end": 288, + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 289, + "end": 293, + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 293, + "end": 294, + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 294, + "end": 295, + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 30 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 297, + "end": 299, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 300, + "end": 301, + "loc": { + "start": { + "line": 12, + "column": 4 + }, + "end": { + "line": 12, + "column": 5 + } + } + }, + { + "type": { + "label": "prefix", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": true, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "!", + "start": 301, + "end": 302, + "loc": { + "start": { + "line": 12, + "column": 5 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 302, + "end": 306, + "loc": { + "start": { + "line": 12, + "column": 6 + }, + "end": { + "line": 12, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 306, + "end": 307, + "loc": { + "start": { + "line": 12, + "column": 10 + }, + "end": { + "line": 12, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 307, + "end": 311, + "loc": { + "start": { + "line": 12, + "column": 11 + }, + "end": { + "line": 12, + "column": 15 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 311, + "end": 312, "loc": { "start": { - "line": 7, + "line": 12, "column": 15 }, "end": { - "line": 7, + "line": 12, "column": 16 } } @@ -1162,17 +2464,17 @@ "postfix": false, "binop": null }, - "value": "inordertraversal", - "start": 157, - "end": 173, + "value": "isLeaf", + "start": 312, + "end": 318, "loc": { "start": { - "line": 7, - "column": 17 + "line": 12, + "column": 16 }, "end": { - "line": 7, - "column": 33 + "line": 12, + "column": 22 } } }, @@ -1188,24 +2490,24 @@ "postfix": false, "binop": null }, - "start": 173, - "end": 174, + "start": 318, + "end": 319, "loc": { "start": { - "line": 7, - "column": 33 + "line": 12, + "column": 22 }, "end": { - "line": 7, - "column": 34 + "line": 12, + "column": 23 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1213,17 +2515,16 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 174, - "end": 178, + "start": 319, + "end": 320, "loc": { "start": { - "line": 7, - "column": 34 + "line": 12, + "column": 23 }, "end": { - "line": 7, - "column": 38 + "line": 12, + "column": 24 } } }, @@ -1239,16 +2540,16 @@ "postfix": false, "binop": null }, - "start": 178, - "end": 179, + "start": 320, + "end": 321, "loc": { "start": { - "line": 7, - "column": 38 + "line": 12, + "column": 24 }, "end": { - "line": 7, - "column": 39 + "line": 12, + "column": 25 } } }, @@ -1264,96 +2565,64 @@ "postfix": false, "binop": null }, - "start": 180, - "end": 181, + "start": 322, + "end": 323, "loc": { "start": { - "line": 7, - "column": 40 + "line": 12, + "column": 26 }, "end": { - "line": 7, - "column": 41 + "line": 12, + "column": 27 } } }, { - "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "if", - "start": 183, - "end": 185, + "type": "CommentLine", + "value": " Yield the nodes on the left recursively. Those nodes are all smaller", + "start": 326, + "end": 397, "loc": { "start": { - "line": 8, - "column": 1 + "line": 13, + "column": 2 }, "end": { - "line": 8, - "column": 3 + "line": 13, + "column": 73 } } }, { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 186, - "end": 187, + "type": "CommentLine", + "value": " than (or equal to) the current node by the binary search tree", + "start": 400, + "end": 464, "loc": { "start": { - "line": 8, - "column": 4 + "line": 14, + "column": 2 }, "end": { - "line": 8, - "column": 5 + "line": 14, + "column": 66 } } }, { - "type": { - "label": "prefix", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "!", - "start": 187, - "end": 188, + "type": "CommentLine", + "value": " properties.", + "start": 467, + "end": 481, "loc": { "start": { - "line": 8, - "column": 5 + "line": 15, + "column": 2 }, "end": { - "line": 8, - "column": 6 + "line": 15, + "column": 16 } } }, @@ -1369,43 +2638,42 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 188, - "end": 192, + "value": "assert", + "start": 484, + "end": 490, "loc": { "start": { - "line": 8, - "column": 6 + "line": 16, + "column": 2 }, "end": { - "line": 8, - "column": 10 + "line": 16, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 192, - "end": 193, + "start": 490, + "end": 491, "loc": { "start": { - "line": 8, - "column": 10 + "line": 16, + "column": 8 }, "end": { - "line": 8, - "column": 11 + "line": 16, + "column": 9 } } }, @@ -1421,17 +2689,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 193, - "end": 197, + "value": "node", + "start": 491, + "end": 495, "loc": { "start": { - "line": 8, - "column": 11 + "line": 16, + "column": 9 }, "end": { - "line": 8, - "column": 15 + "line": 16, + "column": 13 } } }, @@ -1448,16 +2716,16 @@ "binop": null, "updateContext": null }, - "start": 197, - "end": 198, + "start": 495, + "end": 496, "loc": { "start": { - "line": 8, - "column": 15 + "line": 16, + "column": 13 }, "end": { - "line": 8, - "column": 16 + "line": 16, + "column": 14 } } }, @@ -1473,50 +2741,53 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 198, - "end": 204, + "value": "left", + "start": 496, + "end": 500, "loc": { "start": { - "line": 8, - "column": 16 + "line": 16, + "column": 14 }, "end": { - "line": 8, - "column": 22 + "line": 16, + "column": 18 } } }, { "type": { - "label": "(", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 204, - "end": 205, + "value": "instanceof", + "start": 501, + "end": 511, "loc": { "start": { - "line": 8, - "column": 22 + "line": 16, + "column": 19 }, "end": { - "line": 8, - "column": 23 + "line": 16, + "column": 29 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1524,16 +2795,17 @@ "postfix": false, "binop": null }, - "start": 205, - "end": 206, + "value": "Node", + "start": 512, + "end": 516, "loc": { "start": { - "line": 8, - "column": 23 + "line": 16, + "column": 30 }, "end": { - "line": 8, - "column": 24 + "line": 16, + "column": 34 } } }, @@ -1549,89 +2821,42 @@ "postfix": false, "binop": null }, - "start": 206, - "end": 207, + "start": 516, + "end": 517, "loc": { "start": { - "line": 8, - "column": 24 + "line": 16, + "column": 34 }, "end": { - "line": 8, - "column": 25 + "line": 16, + "column": 35 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 208, - "end": 209, - "loc": { - "start": { - "line": 8, - "column": 26 - }, - "end": { - "line": 8, - "column": 27 - } - } - }, - { - "type": "CommentLine", - "value": " Yield the nodes on the left recursively. Those nodes are all smaller", - "start": 212, - "end": 283, - "loc": { - "start": { - "line": 9, - "column": 2 - }, - "end": { - "line": 9, - "column": 73 - } - } - }, - { - "type": "CommentLine", - "value": " than (or equal to) the current node by the binary search tree", - "start": 286, - "end": 350, - "loc": { - "start": { - "line": 10, - "column": 2 - }, - "end": { - "line": 10, - "column": 66 - } - } - }, - { - "type": "CommentLine", - "value": " properties.", - "start": 353, - "end": 367, + "start": 517, + "end": 518, "loc": { "start": { - "line": 11, - "column": 2 + "line": 16, + "column": 35 }, "end": { - "line": 11, - "column": 16 + "line": 16, + "column": 36 } } }, @@ -1650,15 +2875,15 @@ "updateContext": null }, "value": "yield", - "start": 370, - "end": 375, + "start": 521, + "end": 526, "loc": { "start": { - "line": 12, + "line": 17, "column": 2 }, "end": { - "line": 12, + "line": 17, "column": 7 } } @@ -1677,15 +2902,15 @@ "updateContext": null }, "value": "*", - "start": 375, - "end": 376, + "start": 526, + "end": 527, "loc": { "start": { - "line": 12, + "line": 17, "column": 7 }, "end": { - "line": 12, + "line": 17, "column": 8 } } @@ -1703,15 +2928,15 @@ "binop": null }, "value": "inordertraversal", - "start": 377, - "end": 393, + "start": 528, + "end": 544, "loc": { "start": { - "line": 12, + "line": 17, "column": 9 }, "end": { - "line": 12, + "line": 17, "column": 25 } } @@ -1728,15 +2953,15 @@ "postfix": false, "binop": null }, - "start": 393, - "end": 394, + "start": 544, + "end": 545, "loc": { "start": { - "line": 12, + "line": 17, "column": 25 }, "end": { - "line": 12, + "line": 17, "column": 26 } } @@ -1754,15 +2979,15 @@ "binop": null }, "value": "node", - "start": 394, - "end": 398, + "start": 545, + "end": 549, "loc": { "start": { - "line": 12, + "line": 17, "column": 26 }, "end": { - "line": 12, + "line": 17, "column": 30 } } @@ -1780,15 +3005,15 @@ "binop": null, "updateContext": null }, - "start": 398, - "end": 399, + "start": 549, + "end": 550, "loc": { "start": { - "line": 12, + "line": 17, "column": 30 }, "end": { - "line": 12, + "line": 17, "column": 31 } } @@ -1806,15 +3031,15 @@ "binop": null }, "value": "left", - "start": 399, - "end": 403, + "start": 550, + "end": 554, "loc": { "start": { - "line": 12, + "line": 17, "column": 31 }, "end": { - "line": 12, + "line": 17, "column": 35 } } @@ -1831,15 +3056,15 @@ "postfix": false, "binop": null }, - "start": 403, - "end": 404, + "start": 554, + "end": 555, "loc": { "start": { - "line": 12, + "line": 17, "column": 35 }, "end": { - "line": 12, + "line": 17, "column": 36 } } @@ -1857,15 +3082,15 @@ "binop": null, "updateContext": null }, - "start": 404, - "end": 405, + "start": 555, + "end": 556, "loc": { "start": { - "line": 12, + "line": 17, "column": 36 }, "end": { - "line": 12, + "line": 17, "column": 37 } } @@ -1882,15 +3107,15 @@ "postfix": false, "binop": null }, - "start": 407, - "end": 408, + "start": 558, + "end": 559, "loc": { "start": { - "line": 13, + "line": 18, "column": 1 }, "end": { - "line": 13, + "line": 18, "column": 2 } } @@ -1898,15 +3123,15 @@ { "type": "CommentLine", "value": " Yield the current node.", - "start": 411, - "end": 437, + "start": 562, + "end": 588, "loc": { "start": { - "line": 15, + "line": 20, "column": 1 }, "end": { - "line": 15, + "line": 20, "column": 27 } } @@ -1926,15 +3151,15 @@ "updateContext": null }, "value": "yield", - "start": 439, - "end": 444, + "start": 590, + "end": 595, "loc": { "start": { - "line": 16, + "line": 21, "column": 1 }, "end": { - "line": 16, + "line": 21, "column": 6 } } @@ -1952,15 +3177,15 @@ "binop": null }, "value": "node", - "start": 445, - "end": 449, + "start": 596, + "end": 600, "loc": { "start": { - "line": 16, + "line": 21, "column": 7 }, "end": { - "line": 16, + "line": 21, "column": 11 } } @@ -1978,15 +3203,15 @@ "binop": null, "updateContext": null }, - "start": 449, - "end": 450, + "start": 600, + "end": 601, "loc": { "start": { - "line": 16, + "line": 21, "column": 11 }, "end": { - "line": 16, + "line": 21, "column": 12 } } @@ -2004,15 +3229,15 @@ "binop": null }, "value": "key", - "start": 450, - "end": 453, + "start": 601, + "end": 604, "loc": { "start": { - "line": 16, + "line": 21, "column": 12 }, "end": { - "line": 16, + "line": 21, "column": 15 } } @@ -2030,15 +3255,15 @@ "binop": null, "updateContext": null }, - "start": 453, - "end": 454, + "start": 604, + "end": 605, "loc": { "start": { - "line": 16, + "line": 21, "column": 15 }, "end": { - "line": 16, + "line": 21, "column": 16 } } @@ -2058,15 +3283,15 @@ "updateContext": null }, "value": "if", - "start": 457, - "end": 459, + "start": 608, + "end": 610, "loc": { "start": { - "line": 18, + "line": 23, "column": 1 }, "end": { - "line": 18, + "line": 23, "column": 3 } } @@ -2083,15 +3308,15 @@ "postfix": false, "binop": null }, - "start": 460, - "end": 461, + "start": 611, + "end": 612, "loc": { "start": { - "line": 18, + "line": 23, "column": 4 }, "end": { - "line": 18, + "line": 23, "column": 5 } } @@ -2110,15 +3335,15 @@ "updateContext": null }, "value": "!", - "start": 461, - "end": 462, + "start": 612, + "end": 613, "loc": { "start": { - "line": 18, + "line": 23, "column": 5 }, "end": { - "line": 18, + "line": 23, "column": 6 } } @@ -2136,15 +3361,15 @@ "binop": null }, "value": "node", - "start": 462, - "end": 466, + "start": 613, + "end": 617, "loc": { "start": { - "line": 18, + "line": 23, "column": 6 }, "end": { - "line": 18, + "line": 23, "column": 10 } } @@ -2162,15 +3387,15 @@ "binop": null, "updateContext": null }, - "start": 466, - "end": 467, + "start": 617, + "end": 618, "loc": { "start": { - "line": 18, + "line": 23, "column": 10 }, "end": { - "line": 18, + "line": 23, "column": 11 } } @@ -2188,15 +3413,15 @@ "binop": null }, "value": "right", - "start": 467, - "end": 472, + "start": 618, + "end": 623, "loc": { "start": { - "line": 18, + "line": 23, "column": 11 }, "end": { - "line": 18, + "line": 23, "column": 16 } } @@ -2214,15 +3439,15 @@ "binop": null, "updateContext": null }, - "start": 472, - "end": 473, + "start": 623, + "end": 624, "loc": { "start": { - "line": 18, + "line": 23, "column": 16 }, "end": { - "line": 18, + "line": 23, "column": 17 } } @@ -2240,15 +3465,15 @@ "binop": null }, "value": "isLeaf", - "start": 473, - "end": 479, + "start": 624, + "end": 630, "loc": { "start": { - "line": 18, + "line": 23, "column": 17 }, "end": { - "line": 18, + "line": 23, "column": 23 } } @@ -2265,15 +3490,15 @@ "postfix": false, "binop": null }, - "start": 479, - "end": 480, + "start": 630, + "end": 631, "loc": { "start": { - "line": 18, + "line": 23, "column": 23 }, "end": { - "line": 18, + "line": 23, "column": 24 } } @@ -2290,15 +3515,15 @@ "postfix": false, "binop": null }, - "start": 480, - "end": 481, + "start": 631, + "end": 632, "loc": { "start": { - "line": 18, + "line": 23, "column": 24 }, "end": { - "line": 18, + "line": 23, "column": 25 } } @@ -2315,15 +3540,15 @@ "postfix": false, "binop": null }, - "start": 481, - "end": 482, + "start": 632, + "end": 633, "loc": { "start": { - "line": 18, + "line": 23, "column": 25 }, "end": { - "line": 18, + "line": 23, "column": 26 } } @@ -2340,15 +3565,15 @@ "postfix": false, "binop": null }, - "start": 483, - "end": 484, + "start": 634, + "end": 635, "loc": { "start": { - "line": 18, + "line": 23, "column": 27 }, "end": { - "line": 18, + "line": 23, "column": 28 } } @@ -2356,15 +3581,15 @@ { "type": "CommentLine", "value": " Yield the nodes on the right recursively. Those nodes are all larger", - "start": 487, - "end": 558, + "start": 638, + "end": 709, "loc": { "start": { - "line": 19, + "line": 24, "column": 2 }, "end": { - "line": 19, + "line": 24, "column": 73 } } @@ -2372,15 +3597,15 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 561, - "end": 625, + "start": 712, + "end": 776, "loc": { "start": { - "line": 20, + "line": 25, "column": 2 }, "end": { - "line": 20, + "line": 25, "column": 66 } } @@ -2388,19 +3613,253 @@ { "type": "CommentLine", "value": " properties.", - "start": 628, - "end": 642, + "start": 779, + "end": 793, "loc": { "start": { - "line": 21, + "line": 26, "column": 2 }, "end": { - "line": 21, + "line": 26, "column": 16 } } }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 796, + "end": 802, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 802, + "end": 803, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 803, + "end": 807, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 13 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 807, + "end": 808, + "loc": { + "start": { + "line": 27, + "column": 13 + }, + "end": { + "line": 27, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 808, + "end": 813, + "loc": { + "start": { + "line": 27, + "column": 14 + }, + "end": { + "line": 27, + "column": 19 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 814, + "end": 824, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 825, + "end": 829, + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 35 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 829, + "end": 830, + "loc": { + "start": { + "line": 27, + "column": 35 + }, + "end": { + "line": 27, + "column": 36 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 830, + "end": 831, + "loc": { + "start": { + "line": 27, + "column": 36 + }, + "end": { + "line": 27, + "column": 37 + } + } + }, { "type": { "label": "yield", @@ -2416,15 +3875,15 @@ "updateContext": null }, "value": "yield", - "start": 645, - "end": 650, + "start": 834, + "end": 839, "loc": { "start": { - "line": 22, + "line": 28, "column": 2 }, "end": { - "line": 22, + "line": 28, "column": 7 } } @@ -2443,15 +3902,15 @@ "updateContext": null }, "value": "*", - "start": 650, - "end": 651, + "start": 839, + "end": 840, "loc": { "start": { - "line": 22, + "line": 28, "column": 7 }, "end": { - "line": 22, + "line": 28, "column": 8 } } @@ -2469,15 +3928,15 @@ "binop": null }, "value": "inordertraversal", - "start": 652, - "end": 668, + "start": 841, + "end": 857, "loc": { "start": { - "line": 22, + "line": 28, "column": 9 }, "end": { - "line": 22, + "line": 28, "column": 25 } } @@ -2494,15 +3953,15 @@ "postfix": false, "binop": null }, - "start": 668, - "end": 669, + "start": 857, + "end": 858, "loc": { "start": { - "line": 22, + "line": 28, "column": 25 }, "end": { - "line": 22, + "line": 28, "column": 26 } } @@ -2520,15 +3979,15 @@ "binop": null }, "value": "node", - "start": 669, - "end": 673, + "start": 858, + "end": 862, "loc": { "start": { - "line": 22, + "line": 28, "column": 26 }, "end": { - "line": 22, + "line": 28, "column": 30 } } @@ -2546,15 +4005,15 @@ "binop": null, "updateContext": null }, - "start": 673, - "end": 674, + "start": 862, + "end": 863, "loc": { "start": { - "line": 22, + "line": 28, "column": 30 }, "end": { - "line": 22, + "line": 28, "column": 31 } } @@ -2572,15 +4031,15 @@ "binop": null }, "value": "right", - "start": 674, - "end": 679, + "start": 863, + "end": 868, "loc": { "start": { - "line": 22, + "line": 28, "column": 31 }, "end": { - "line": 22, + "line": 28, "column": 36 } } @@ -2597,15 +4056,15 @@ "postfix": false, "binop": null }, - "start": 679, - "end": 680, + "start": 868, + "end": 869, "loc": { "start": { - "line": 22, + "line": 28, "column": 36 }, "end": { - "line": 22, + "line": 28, "column": 37 } } @@ -2623,15 +4082,15 @@ "binop": null, "updateContext": null }, - "start": 680, - "end": 681, + "start": 869, + "end": 870, "loc": { "start": { - "line": 22, + "line": 28, "column": 37 }, "end": { - "line": 22, + "line": 28, "column": 38 } } @@ -2648,15 +4107,15 @@ "postfix": false, "binop": null }, - "start": 683, - "end": 684, + "start": 872, + "end": 873, "loc": { "start": { - "line": 23, + "line": 29, "column": 1 }, "end": { - "line": 23, + "line": 29, "column": 2 } } @@ -2673,15 +4132,15 @@ "postfix": false, "binop": null }, - "start": 685, - "end": 686, + "start": 874, + "end": 875, "loc": { "start": { - "line": 24, + "line": 30, "column": 0 }, "end": { - "line": 24, + "line": 30, "column": 1 } } @@ -2699,15 +4158,15 @@ "binop": null, "updateContext": null }, - "start": 687, - "end": 687, + "start": 876, + "end": 876, "loc": { "start": { - "line": 25, + "line": 31, "column": 0 }, "end": { - "line": 25, + "line": 31, "column": 0 } } diff --git a/ast/source/traversal/rangetraversal.js.json b/ast/source/traversal/rangetraversal.js.json index 21c4732..0a4696a 100644 --- a/ast/source/traversal/rangetraversal.js.json +++ b/ast/source/traversal/rangetraversal.js.json @@ -1,75 +1,229 @@ { "type": "File", "start": 0, - "end": 1177, + "end": 1463, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 32, + "line": 44, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1177, + "end": 1463, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 32, + "line": 44, "column": 0 } }, "sourceType": "module", "body": [ { - "type": "ExportNamedDeclaration", - "start": 378, - "end": 1176, + "type": "ImportDeclaration", + "start": 0, + "end": 28, "loc": { "start": { - "line": 11, + "line": 1, "column": 0 }, "end": { - "line": 31, + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 476, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] + }, + { + "type": "ExportDefaultDeclaration", + "start": 477, + "end": 1462, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 43, "column": 1 } }, - "specifiers": [], - "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 385, - "end": 1176, + "start": 492, + "end": 1462, "loc": { "start": { - "line": 11, - "column": 7 + "line": 14, + "column": 15 }, "end": { - "line": 31, + "line": 43, "column": 1 } }, "id": { "type": "Identifier", - "start": 395, - "end": 409, + "start": 502, + "end": 516, "loc": { "start": { - "line": 11, - "column": 17 + "line": 14, + "column": 25 }, "end": { - "line": 11, - "column": 31 + "line": 14, + "column": 39 }, "identifierName": "rangetraversal" }, @@ -82,16 +236,16 @@ "params": [ { "type": "Identifier", - "start": 410, - "end": 417, + "start": 517, + "end": 524, "loc": { "start": { - "line": 11, - "column": 32 + "line": 14, + "column": 40 }, "end": { - "line": 11, - "column": 39 + "line": 14, + "column": 47 }, "identifierName": "compare" }, @@ -99,16 +253,16 @@ }, { "type": "Identifier", - "start": 419, - "end": 423, + "start": 526, + "end": 530, "loc": { "start": { - "line": 11, - "column": 41 + "line": 14, + "column": 49 }, "end": { - "line": 11, - "column": 45 + "line": 14, + "column": 53 }, "identifierName": "root" }, @@ -116,16 +270,16 @@ }, { "type": "Identifier", - "start": 425, - "end": 429, + "start": 532, + "end": 536, "loc": { "start": { - "line": 11, - "column": 47 + "line": 14, + "column": 55 }, "end": { - "line": 11, - "column": 51 + "line": 14, + "column": 59 }, "identifierName": "left" }, @@ -133,16 +287,16 @@ }, { "type": "Identifier", - "start": 431, - "end": 436, + "start": 538, + "end": 543, "loc": { "start": { - "line": 11, - "column": 53 + "line": 14, + "column": 61 }, "end": { - "line": 11, - "column": 58 + "line": 14, + "column": 66 }, "identifierName": "right" }, @@ -151,72 +305,72 @@ ], "body": { "type": "BlockStatement", - "start": 438, - "end": 1176, + "start": 545, + "end": 1462, "loc": { "start": { - "line": 11, - "column": 60 + "line": 14, + "column": 68 }, "end": { - "line": 31, + "line": 43, "column": 1 } }, "body": [ { "type": "IfStatement", - "start": 441, - "end": 1174, + "start": 548, + "end": 1460, "loc": { "start": { - "line": 12, + "line": 15, "column": 1 }, "end": { - "line": 30, + "line": 42, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 445, - "end": 472, + "start": 552, + "end": 579, "loc": { "start": { - "line": 12, + "line": 15, "column": 5 }, "end": { - "line": 12, + "line": 15, "column": 32 } }, "left": { "type": "CallExpression", - "start": 445, - "end": 468, + "start": 552, + "end": 575, "loc": { "start": { - "line": 12, + "line": 15, "column": 5 }, "end": { - "line": 12, + "line": 15, "column": 28 } }, "callee": { "type": "Identifier", - "start": 445, - "end": 452, + "start": 552, + "end": 559, "loc": { "start": { - "line": 12, + "line": 15, "column": 5 }, "end": { - "line": 12, + "line": 15, "column": 12 }, "identifierName": "compare" @@ -226,29 +380,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 453, - "end": 461, + "start": 560, + "end": 568, "loc": { "start": { - "line": 12, + "line": 15, "column": 13 }, "end": { - "line": 12, + "line": 15, "column": 21 } }, "object": { "type": "Identifier", - "start": 453, - "end": 457, + "start": 560, + "end": 564, "loc": { "start": { - "line": 12, + "line": 15, "column": 13 }, "end": { - "line": 12, + "line": 15, "column": 17 }, "identifierName": "root" @@ -257,15 +411,15 @@ }, "property": { "type": "Identifier", - "start": 458, - "end": 461, + "start": 565, + "end": 568, "loc": { "start": { - "line": 12, + "line": 15, "column": 18 }, "end": { - "line": 12, + "line": 15, "column": 21 }, "identifierName": "key" @@ -276,15 +430,15 @@ }, { "type": "Identifier", - "start": 463, - "end": 467, + "start": 570, + "end": 574, "loc": { "start": { - "line": 12, + "line": 15, "column": 23 }, "end": { - "line": 12, + "line": 15, "column": 27 }, "identifierName": "left" @@ -296,15 +450,15 @@ "operator": "<", "right": { "type": "NumericLiteral", - "start": 471, - "end": 472, + "start": 578, + "end": 579, "loc": { "start": { - "line": 12, + "line": 15, "column": 31 }, "end": { - "line": 12, + "line": 15, "column": 32 } }, @@ -317,44 +471,44 @@ }, "consequent": { "type": "BlockStatement", - "start": 474, - "end": 662, + "start": 581, + "end": 814, "loc": { "start": { - "line": 12, + "line": 15, "column": 34 }, "end": { - "line": 17, + "line": 22, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 574, - "end": 659, + "start": 681, + "end": 811, "loc": { "start": { - "line": 15, + "line": 18, "column": 2 }, "end": { - "line": 16, - "column": 59 + "line": 21, + "column": 3 } }, "test": { "type": "UnaryExpression", - "start": 578, - "end": 598, + "start": 685, + "end": 705, "loc": { "start": { - "line": 15, + "line": 18, "column": 6 }, "end": { - "line": 15, + "line": 18, "column": 26 } }, @@ -362,57 +516,57 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 579, - "end": 598, + "start": 686, + "end": 705, "loc": { "start": { - "line": 15, + "line": 18, "column": 7 }, "end": { - "line": 15, + "line": 18, "column": 26 } }, "callee": { "type": "MemberExpression", - "start": 579, - "end": 596, + "start": 686, + "end": 703, "loc": { "start": { - "line": 15, + "line": 18, "column": 7 }, "end": { - "line": 15, + "line": 18, "column": 24 } }, "object": { "type": "MemberExpression", - "start": 579, - "end": 589, + "start": 686, + "end": 696, "loc": { "start": { - "line": 15, + "line": 18, "column": 7 }, "end": { - "line": 15, + "line": 18, "column": 17 } }, "object": { "type": "Identifier", - "start": 579, - "end": 583, + "start": 686, + "end": 690, "loc": { "start": { - "line": 15, + "line": 18, "column": 7 }, "end": { - "line": 15, + "line": 18, "column": 11 }, "identifierName": "root" @@ -422,15 +576,15 @@ }, "property": { "type": "Identifier", - "start": 584, - "end": 589, + "start": 691, + "end": 696, "loc": { "start": { - "line": 15, + "line": 18, "column": 12 }, "end": { - "line": 15, + "line": 18, "column": 17 }, "identifierName": "right" @@ -442,15 +596,15 @@ }, "property": { "type": "Identifier", - "start": 590, - "end": 596, + "start": 697, + "end": 703, "loc": { "start": { - "line": 15, + "line": 18, "column": 18 }, "end": { - "line": 15, + "line": 18, "column": 24 }, "identifierName": "isLeaf" @@ -469,185 +623,335 @@ "leadingComments": null }, "consequent": { - "type": "ExpressionStatement", - "start": 603, - "end": 659, + "type": "BlockStatement", + "start": 707, + "end": 811, "loc": { "start": { - "line": 16, - "column": 3 + "line": 18, + "column": 28 }, "end": { - "line": 16, - "column": 59 + "line": 21, + "column": 3 } }, - "expression": { - "type": "YieldExpression", - "start": 603, - "end": 658, - "loc": { - "start": { - "line": 16, - "column": 3 - }, - "end": { - "line": 16, - "column": 58 - } - }, - "delegate": true, - "argument": { - "type": "CallExpression", - "start": 610, - "end": 658, + "body": [ + { + "type": "ExpressionStatement", + "start": 712, + "end": 747, "loc": { "start": { - "line": 16, - "column": 10 + "line": 19, + "column": 3 }, "end": { - "line": 16, - "column": 58 + "line": 19, + "column": 38 } }, - "callee": { - "type": "Identifier", - "start": 610, - "end": 624, + "expression": { + "type": "CallExpression", + "start": 712, + "end": 746, "loc": { "start": { - "line": 16, - "column": 10 + "line": 19, + "column": 3 }, "end": { - "line": 16, - "column": 24 - }, - "identifierName": "rangetraversal" + "line": 19, + "column": 37 + } }, - "name": "rangetraversal" - }, - "arguments": [ - { + "callee": { "type": "Identifier", - "start": 625, - "end": 632, + "start": 712, + "end": 718, "loc": { "start": { - "line": 16, - "column": 25 + "line": 19, + "column": 3 }, "end": { - "line": 16, - "column": 32 + "line": 19, + "column": 9 }, - "identifierName": "compare" + "identifierName": "assert" }, - "name": "compare" + "name": "assert" }, - { - "type": "MemberExpression", - "start": 634, - "end": 644, - "loc": { - "start": { - "line": 16, - "column": 34 - }, - "end": { - "line": 16, - "column": 44 - } - }, - "object": { - "type": "Identifier", - "start": 634, - "end": 638, + "arguments": [ + { + "type": "BinaryExpression", + "start": 719, + "end": 745, "loc": { "start": { - "line": 16, - "column": 34 + "line": 19, + "column": 10 }, "end": { - "line": 16, - "column": 38 - }, - "identifierName": "root" + "line": 19, + "column": 36 + } }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 639, - "end": 644, - "loc": { - "start": { - "line": 16, - "column": 39 + "left": { + "type": "MemberExpression", + "start": 719, + "end": 729, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 20 + } }, - "end": { - "line": 16, - "column": 44 + "object": { + "type": "Identifier", + "start": 719, + "end": 723, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" }, - "identifierName": "right" + "property": { + "type": "Identifier", + "start": 724, + "end": 729, + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "name": "right" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 741, + "end": 745, + "loc": { + "start": { + "line": 19, + "column": 32 + }, + "end": { + "line": 19, + "column": 36 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 751, + "end": 807, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 59 + } + }, + "expression": { + "type": "YieldExpression", + "start": 751, + "end": 806, + "loc": { + "start": { + "line": 20, + "column": 3 }, - "computed": false + "end": { + "line": 20, + "column": 58 + } }, - { - "type": "Identifier", - "start": 646, - "end": 650, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 758, + "end": 806, "loc": { "start": { - "line": 16, - "column": 46 + "line": 20, + "column": 10 }, "end": { - "line": 16, - "column": 50 + "line": 20, + "column": 58 + } + }, + "callee": { + "type": "Identifier", + "start": 758, + "end": 772, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 24 + }, + "identifierName": "rangetraversal" }, - "identifierName": "left" + "name": "rangetraversal" }, - "name": "left" - }, - { - "type": "Identifier", - "start": 652, - "end": 657, - "loc": { - "start": { - "line": 16, - "column": 52 + "arguments": [ + { + "type": "Identifier", + "start": 773, + "end": 780, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 32 + }, + "identifierName": "compare" + }, + "name": "compare" }, - "end": { - "line": 16, - "column": 57 + { + "type": "MemberExpression", + "start": 782, + "end": 792, + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 20, + "column": 44 + } + }, + "object": { + "type": "Identifier", + "start": 782, + "end": 786, + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 20, + "column": 38 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 787, + "end": 792, + "loc": { + "start": { + "line": 20, + "column": 39 + }, + "end": { + "line": 20, + "column": 44 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "identifierName": "right" - }, - "name": "right" + { + "type": "Identifier", + "start": 794, + "end": 798, + "loc": { + "start": { + "line": 20, + "column": 46 + }, + "end": { + "line": 20, + "column": 50 + }, + "identifierName": "left" + }, + "name": "left" + }, + { + "type": "Identifier", + "start": 800, + "end": 805, + "loc": { + "start": { + "line": 20, + "column": 52 + }, + "end": { + "line": 20, + "column": 57 + }, + "identifierName": "right" + }, + "name": "right" + } + ] } - ] + } } - } + ], + "directives": [] }, "alternate": null, "leadingComments": [ { "type": "CommentLine", "value": " If the root lies to the left of the interval, we can discard the", - "start": 478, - "end": 545, + "start": 585, + "end": 652, "loc": { "start": { - "line": 13, + "line": 16, "column": 2 }, "end": { - "line": 13, + "line": 16, "column": 69 } } @@ -655,15 +959,15 @@ { "type": "CommentLine", "value": " entire left subtree.", - "start": 548, - "end": 571, + "start": 655, + "end": 678, "loc": { "start": { - "line": 14, + "line": 17, "column": 2 }, "end": { - "line": 14, + "line": 17, "column": 25 } } @@ -675,57 +979,57 @@ }, "alternate": { "type": "IfStatement", - "start": 668, - "end": 1174, + "start": 820, + "end": 1460, "loc": { "start": { - "line": 17, + "line": 22, "column": 8 }, "end": { - "line": 30, + "line": 42, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 672, - "end": 701, + "start": 824, + "end": 853, "loc": { "start": { - "line": 17, + "line": 22, "column": 12 }, "end": { - "line": 17, + "line": 22, "column": 41 } }, "left": { "type": "CallExpression", - "start": 672, - "end": 696, + "start": 824, + "end": 848, "loc": { "start": { - "line": 17, + "line": 22, "column": 12 }, "end": { - "line": 17, + "line": 22, "column": 36 } }, "callee": { "type": "Identifier", - "start": 672, - "end": 679, + "start": 824, + "end": 831, "loc": { "start": { - "line": 17, + "line": 22, "column": 12 }, "end": { - "line": 17, + "line": 22, "column": 19 }, "identifierName": "compare" @@ -735,29 +1039,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 680, - "end": 688, + "start": 832, + "end": 840, "loc": { "start": { - "line": 17, + "line": 22, "column": 20 }, "end": { - "line": 17, + "line": 22, "column": 28 } }, "object": { "type": "Identifier", - "start": 680, - "end": 684, + "start": 832, + "end": 836, "loc": { "start": { - "line": 17, + "line": 22, "column": 20 }, "end": { - "line": 17, + "line": 22, "column": 24 }, "identifierName": "root" @@ -766,15 +1070,15 @@ }, "property": { "type": "Identifier", - "start": 685, - "end": 688, + "start": 837, + "end": 840, "loc": { "start": { - "line": 17, + "line": 22, "column": 25 }, "end": { - "line": 17, + "line": 22, "column": 28 }, "identifierName": "key" @@ -785,15 +1089,15 @@ }, { "type": "Identifier", - "start": 690, - "end": 695, + "start": 842, + "end": 847, "loc": { "start": { - "line": 17, + "line": 22, "column": 30 }, "end": { - "line": 17, + "line": 22, "column": 35 }, "identifierName": "right" @@ -805,15 +1109,15 @@ "operator": ">=", "right": { "type": "NumericLiteral", - "start": 700, - "end": 701, + "start": 852, + "end": 853, "loc": { "start": { - "line": 17, + "line": 22, "column": 40 }, "end": { - "line": 17, + "line": 22, "column": 41 } }, @@ -826,44 +1130,44 @@ }, "consequent": { "type": "BlockStatement", - "start": 703, - "end": 891, + "start": 855, + "end": 1087, "loc": { "start": { - "line": 17, + "line": 22, "column": 43 }, "end": { - "line": 22, + "line": 29, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 805, - "end": 888, + "start": 957, + "end": 1084, "loc": { "start": { - "line": 20, + "line": 25, "column": 2 }, "end": { - "line": 21, - "column": 58 + "line": 28, + "column": 3 } }, "test": { "type": "UnaryExpression", - "start": 809, - "end": 828, + "start": 961, + "end": 980, "loc": { "start": { - "line": 20, + "line": 25, "column": 6 }, "end": { - "line": 20, + "line": 25, "column": 25 } }, @@ -871,57 +1175,57 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 810, - "end": 828, + "start": 962, + "end": 980, "loc": { "start": { - "line": 20, + "line": 25, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 25 } }, "callee": { "type": "MemberExpression", - "start": 810, - "end": 826, + "start": 962, + "end": 978, "loc": { "start": { - "line": 20, + "line": 25, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 810, - "end": 819, + "start": 962, + "end": 971, "loc": { "start": { - "line": 20, + "line": 25, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 16 } }, "object": { "type": "Identifier", - "start": 810, - "end": 814, + "start": 962, + "end": 966, "loc": { "start": { - "line": 20, + "line": 25, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 11 }, "identifierName": "root" @@ -931,15 +1235,15 @@ }, "property": { "type": "Identifier", - "start": 815, - "end": 819, + "start": 967, + "end": 971, "loc": { "start": { - "line": 20, + "line": 25, "column": 12 }, "end": { - "line": 20, + "line": 25, "column": 16 }, "identifierName": "left" @@ -951,15 +1255,15 @@ }, "property": { "type": "Identifier", - "start": 820, - "end": 826, + "start": 972, + "end": 978, "loc": { "start": { - "line": 20, + "line": 25, "column": 17 }, "end": { - "line": 20, + "line": 25, "column": 23 }, "identifierName": "isLeaf" @@ -978,185 +1282,335 @@ "leadingComments": null }, "consequent": { - "type": "ExpressionStatement", - "start": 833, - "end": 888, + "type": "BlockStatement", + "start": 982, + "end": 1084, "loc": { "start": { - "line": 21, - "column": 3 + "line": 25, + "column": 27 }, "end": { - "line": 21, - "column": 58 + "line": 28, + "column": 3 } }, - "expression": { - "type": "YieldExpression", - "start": 833, - "end": 887, - "loc": { - "start": { - "line": 21, - "column": 3 - }, - "end": { - "line": 21, - "column": 57 - } - }, - "delegate": true, - "argument": { - "type": "CallExpression", - "start": 840, - "end": 887, + "body": [ + { + "type": "ExpressionStatement", + "start": 987, + "end": 1021, "loc": { "start": { - "line": 21, - "column": 10 + "line": 26, + "column": 3 }, "end": { - "line": 21, - "column": 57 + "line": 26, + "column": 37 } }, - "callee": { - "type": "Identifier", - "start": 840, - "end": 854, + "expression": { + "type": "CallExpression", + "start": 987, + "end": 1020, "loc": { "start": { - "line": 21, - "column": 10 + "line": 26, + "column": 3 }, "end": { - "line": 21, - "column": 24 - }, - "identifierName": "rangetraversal" + "line": 26, + "column": 36 + } }, - "name": "rangetraversal" - }, - "arguments": [ - { + "callee": { "type": "Identifier", - "start": 855, - "end": 862, + "start": 987, + "end": 993, "loc": { "start": { - "line": 21, - "column": 25 + "line": 26, + "column": 3 }, "end": { - "line": 21, - "column": 32 + "line": 26, + "column": 9 }, - "identifierName": "compare" + "identifierName": "assert" }, - "name": "compare" + "name": "assert" }, - { - "type": "MemberExpression", - "start": 864, - "end": 873, - "loc": { - "start": { - "line": 21, - "column": 34 - }, - "end": { - "line": 21, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 864, - "end": 868, + "arguments": [ + { + "type": "BinaryExpression", + "start": 994, + "end": 1019, "loc": { "start": { - "line": 21, - "column": 34 + "line": 26, + "column": 10 }, "end": { - "line": 21, - "column": 38 - }, - "identifierName": "root" + "line": 26, + "column": 35 + } }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 869, - "end": 873, - "loc": { - "start": { - "line": 21, - "column": 39 + "left": { + "type": "MemberExpression", + "start": 994, + "end": 1003, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 19 + } }, - "end": { - "line": 21, - "column": 43 + "object": { + "type": "Identifier", + "start": 994, + "end": 998, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" }, - "identifierName": "left" + "property": { + "type": "Identifier", + "start": 999, + "end": 1003, + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 19 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "name": "left" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1015, + "end": 1019, + "loc": { + "start": { + "line": 26, + "column": 31 + }, + "end": { + "line": 26, + "column": 35 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1025, + "end": 1080, + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 58 + } + }, + "expression": { + "type": "YieldExpression", + "start": 1025, + "end": 1079, + "loc": { + "start": { + "line": 27, + "column": 3 }, - "computed": false + "end": { + "line": 27, + "column": 57 + } }, - { - "type": "Identifier", - "start": 875, - "end": 879, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 1032, + "end": 1079, "loc": { "start": { - "line": 21, - "column": 45 + "line": 27, + "column": 10 }, "end": { - "line": 21, - "column": 49 + "line": 27, + "column": 57 + } + }, + "callee": { + "type": "Identifier", + "start": 1032, + "end": 1046, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 24 + }, + "identifierName": "rangetraversal" }, - "identifierName": "left" + "name": "rangetraversal" }, - "name": "left" - }, - { - "type": "Identifier", - "start": 881, - "end": 886, - "loc": { - "start": { - "line": 21, - "column": 51 + "arguments": [ + { + "type": "Identifier", + "start": 1047, + "end": 1054, + "loc": { + "start": { + "line": 27, + "column": 25 + }, + "end": { + "line": 27, + "column": 32 + }, + "identifierName": "compare" + }, + "name": "compare" }, - "end": { - "line": 21, - "column": 56 + { + "type": "MemberExpression", + "start": 1056, + "end": 1065, + "loc": { + "start": { + "line": 27, + "column": 34 + }, + "end": { + "line": 27, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 1056, + "end": 1060, + "loc": { + "start": { + "line": 27, + "column": 34 + }, + "end": { + "line": 27, + "column": 38 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1061, + "end": 1065, + "loc": { + "start": { + "line": 27, + "column": 39 + }, + "end": { + "line": 27, + "column": 43 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "identifierName": "right" - }, - "name": "right" + { + "type": "Identifier", + "start": 1067, + "end": 1071, + "loc": { + "start": { + "line": 27, + "column": 45 + }, + "end": { + "line": 27, + "column": 49 + }, + "identifierName": "left" + }, + "name": "left" + }, + { + "type": "Identifier", + "start": 1073, + "end": 1078, + "loc": { + "start": { + "line": 27, + "column": 51 + }, + "end": { + "line": 27, + "column": 56 + }, + "identifierName": "right" + }, + "name": "right" + } + ] } - ] + } } - } + ], + "directives": [] }, "alternate": null, "leadingComments": [ { "type": "CommentLine", "value": " If the root lies to the right of the interval, we can discard the", - "start": 707, - "end": 775, + "start": 859, + "end": 927, "loc": { "start": { - "line": 18, + "line": 23, "column": 2 }, "end": { - "line": 18, + "line": 23, "column": 70 } } @@ -1164,15 +1618,15 @@ { "type": "CommentLine", "value": " entire right subtree.", - "start": 778, - "end": 802, + "start": 930, + "end": 954, "loc": { "start": { - "line": 19, + "line": 24, "column": 2 }, "end": { - "line": 19, + "line": 24, "column": 26 } } @@ -1184,44 +1638,44 @@ }, "alternate": { "type": "BlockStatement", - "start": 897, - "end": 1174, + "start": 1093, + "end": 1460, "loc": { "start": { - "line": 22, + "line": 29, "column": 8 }, "end": { - "line": 30, + "line": 42, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 982, - "end": 1065, + "start": 1178, + "end": 1305, "loc": { "start": { - "line": 25, + "line": 32, "column": 2 }, "end": { - "line": 26, - "column": 58 + "line": 35, + "column": 3 } }, "test": { "type": "UnaryExpression", - "start": 986, - "end": 1005, + "start": 1182, + "end": 1201, "loc": { "start": { - "line": 25, + "line": 32, "column": 6 }, "end": { - "line": 25, + "line": 32, "column": 25 } }, @@ -1229,57 +1683,57 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 987, - "end": 1005, + "start": 1183, + "end": 1201, "loc": { "start": { - "line": 25, + "line": 32, "column": 7 }, "end": { - "line": 25, + "line": 32, "column": 25 } }, "callee": { "type": "MemberExpression", - "start": 987, - "end": 1003, + "start": 1183, + "end": 1199, "loc": { "start": { - "line": 25, + "line": 32, "column": 7 }, "end": { - "line": 25, + "line": 32, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 987, - "end": 996, + "start": 1183, + "end": 1192, "loc": { "start": { - "line": 25, + "line": 32, "column": 7 }, "end": { - "line": 25, + "line": 32, "column": 16 } }, "object": { "type": "Identifier", - "start": 987, - "end": 991, + "start": 1183, + "end": 1187, "loc": { "start": { - "line": 25, + "line": 32, "column": 7 }, "end": { - "line": 25, + "line": 32, "column": 11 }, "identifierName": "root" @@ -1289,15 +1743,15 @@ }, "property": { "type": "Identifier", - "start": 992, - "end": 996, + "start": 1188, + "end": 1192, "loc": { "start": { - "line": 25, + "line": 32, "column": 12 }, "end": { - "line": 25, + "line": 32, "column": 16 }, "identifierName": "left" @@ -1309,15 +1763,15 @@ }, "property": { "type": "Identifier", - "start": 997, - "end": 1003, + "start": 1193, + "end": 1199, "loc": { "start": { - "line": 25, + "line": 32, "column": 17 }, "end": { - "line": 25, + "line": 32, "column": 23 }, "identifierName": "isLeaf" @@ -1336,185 +1790,335 @@ "leadingComments": null }, "consequent": { - "type": "ExpressionStatement", - "start": 1010, - "end": 1065, + "type": "BlockStatement", + "start": 1203, + "end": 1305, "loc": { "start": { - "line": 26, - "column": 3 + "line": 32, + "column": 27 }, "end": { - "line": 26, - "column": 58 + "line": 35, + "column": 3 } }, - "expression": { - "type": "YieldExpression", - "start": 1010, - "end": 1064, - "loc": { - "start": { - "line": 26, - "column": 3 - }, - "end": { - "line": 26, - "column": 57 - } - }, - "delegate": true, - "argument": { - "type": "CallExpression", - "start": 1017, - "end": 1064, + "body": [ + { + "type": "ExpressionStatement", + "start": 1208, + "end": 1242, "loc": { "start": { - "line": 26, - "column": 10 + "line": 33, + "column": 3 }, "end": { - "line": 26, - "column": 57 + "line": 33, + "column": 37 } }, - "callee": { - "type": "Identifier", - "start": 1017, - "end": 1031, + "expression": { + "type": "CallExpression", + "start": 1208, + "end": 1241, "loc": { "start": { - "line": 26, - "column": 10 + "line": 33, + "column": 3 }, "end": { - "line": 26, - "column": 24 - }, - "identifierName": "rangetraversal" + "line": 33, + "column": 36 + } }, - "name": "rangetraversal" - }, - "arguments": [ - { + "callee": { "type": "Identifier", - "start": 1032, - "end": 1039, + "start": 1208, + "end": 1214, "loc": { "start": { - "line": 26, - "column": 25 + "line": 33, + "column": 3 }, "end": { - "line": 26, - "column": 32 + "line": 33, + "column": 9 }, - "identifierName": "compare" + "identifierName": "assert" }, - "name": "compare" + "name": "assert" }, - { - "type": "MemberExpression", - "start": 1041, - "end": 1050, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1215, + "end": 1240, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 35 + } + }, + "left": { + "type": "MemberExpression", + "start": 1215, + "end": 1224, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 1215, + "end": 1219, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1220, + "end": 1224, + "loc": { + "start": { + "line": 33, + "column": 15 + }, + "end": { + "line": 33, + "column": 19 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1236, + "end": 1240, + "loc": { + "start": { + "line": 33, + "column": 31 + }, + "end": { + "line": 33, + "column": 35 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1246, + "end": 1301, + "loc": { + "start": { + "line": 34, + "column": 3 + }, + "end": { + "line": 34, + "column": 58 + } + }, + "expression": { + "type": "YieldExpression", + "start": 1246, + "end": 1300, + "loc": { + "start": { + "line": 34, + "column": 3 + }, + "end": { + "line": 34, + "column": 57 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 1253, + "end": 1300, "loc": { "start": { - "line": 26, - "column": 34 + "line": 34, + "column": 10 }, "end": { - "line": 26, - "column": 43 + "line": 34, + "column": 57 } }, - "object": { + "callee": { "type": "Identifier", - "start": 1041, - "end": 1045, + "start": 1253, + "end": 1267, "loc": { "start": { - "line": 26, - "column": 34 + "line": 34, + "column": 10 }, "end": { - "line": 26, - "column": 38 + "line": 34, + "column": 24 }, - "identifierName": "root" + "identifierName": "rangetraversal" }, - "name": "root" + "name": "rangetraversal" }, - "property": { - "type": "Identifier", - "start": 1046, - "end": 1050, - "loc": { - "start": { - "line": 26, - "column": 39 - }, - "end": { - "line": 26, - "column": 43 + "arguments": [ + { + "type": "Identifier", + "start": 1268, + "end": 1275, + "loc": { + "start": { + "line": 34, + "column": 25 + }, + "end": { + "line": 34, + "column": 32 + }, + "identifierName": "compare" }, - "identifierName": "left" + "name": "compare" }, - "name": "left" - }, - "computed": false - }, - { - "type": "Identifier", - "start": 1052, - "end": 1056, - "loc": { - "start": { - "line": 26, - "column": 45 + { + "type": "MemberExpression", + "start": 1277, + "end": 1286, + "loc": { + "start": { + "line": 34, + "column": 34 + }, + "end": { + "line": 34, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 1277, + "end": 1281, + "loc": { + "start": { + "line": 34, + "column": 34 + }, + "end": { + "line": 34, + "column": 38 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1282, + "end": 1286, + "loc": { + "start": { + "line": 34, + "column": 39 + }, + "end": { + "line": 34, + "column": 43 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "end": { - "line": 26, - "column": 49 + { + "type": "Identifier", + "start": 1288, + "end": 1292, + "loc": { + "start": { + "line": 34, + "column": 45 + }, + "end": { + "line": 34, + "column": 49 + }, + "identifierName": "left" + }, + "name": "left" }, - "identifierName": "left" - }, - "name": "left" - }, - { - "type": "Identifier", - "start": 1058, - "end": 1063, - "loc": { - "start": { - "line": 26, - "column": 51 - }, - "end": { - "line": 26, - "column": 56 - }, - "identifierName": "right" - }, - "name": "right" + { + "type": "Identifier", + "start": 1294, + "end": 1299, + "loc": { + "start": { + "line": 34, + "column": 51 + }, + "end": { + "line": 34, + "column": 56 + }, + "identifierName": "right" + }, + "name": "right" + } + ] } - ] + } } - } + ], + "directives": [] }, "alternate": null, "leadingComments": [ { "type": "CommentLine", "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 901, - "end": 965, + "start": 1097, + "end": 1161, "loc": { "start": { - "line": 23, + "line": 30, "column": 2 }, "end": { - "line": 23, + "line": 30, "column": 66 } } @@ -1522,15 +2126,15 @@ { "type": "CommentLine", "value": " between.", - "start": 968, - "end": 979, + "start": 1164, + "end": 1175, "loc": { "start": { - "line": 24, + "line": 31, "column": 2 }, "end": { - "line": 24, + "line": 31, "column": 13 } } @@ -1539,58 +2143,58 @@ }, { "type": "ExpressionStatement", - "start": 1068, - "end": 1083, + "start": 1309, + "end": 1324, "loc": { "start": { - "line": 27, + "line": 37, "column": 2 }, "end": { - "line": 27, + "line": 37, "column": 17 } }, "expression": { "type": "YieldExpression", - "start": 1068, - "end": 1082, + "start": 1309, + "end": 1323, "loc": { "start": { - "line": 27, + "line": 37, "column": 2 }, "end": { - "line": 27, + "line": 37, "column": 16 } }, "delegate": false, "argument": { "type": "MemberExpression", - "start": 1074, - "end": 1082, + "start": 1315, + "end": 1323, "loc": { "start": { - "line": 27, + "line": 37, "column": 8 }, "end": { - "line": 27, + "line": 37, "column": 16 } }, "object": { "type": "Identifier", - "start": 1074, - "end": 1078, + "start": 1315, + "end": 1319, "loc": { "start": { - "line": 27, + "line": 37, "column": 8 }, "end": { - "line": 27, + "line": 37, "column": 12 }, "identifierName": "root" @@ -1599,15 +2203,15 @@ }, "property": { "type": "Identifier", - "start": 1079, - "end": 1082, + "start": 1320, + "end": 1323, "loc": { "start": { - "line": 27, + "line": 37, "column": 13 }, "end": { - "line": 27, + "line": 37, "column": 16 }, "identifierName": "key" @@ -1620,29 +2224,29 @@ }, { "type": "IfStatement", - "start": 1086, - "end": 1171, + "start": 1327, + "end": 1457, "loc": { "start": { - "line": 28, + "line": 38, "column": 2 }, "end": { - "line": 29, - "column": 59 + "line": 41, + "column": 3 } }, "test": { "type": "UnaryExpression", - "start": 1090, - "end": 1110, + "start": 1331, + "end": 1351, "loc": { "start": { - "line": 28, + "line": 38, "column": 6 }, "end": { - "line": 28, + "line": 38, "column": 26 } }, @@ -1650,57 +2254,57 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 1091, - "end": 1110, + "start": 1332, + "end": 1351, "loc": { "start": { - "line": 28, + "line": 38, "column": 7 }, "end": { - "line": 28, + "line": 38, "column": 26 } }, "callee": { "type": "MemberExpression", - "start": 1091, - "end": 1108, + "start": 1332, + "end": 1349, "loc": { "start": { - "line": 28, + "line": 38, "column": 7 }, "end": { - "line": 28, + "line": 38, "column": 24 } }, "object": { "type": "MemberExpression", - "start": 1091, - "end": 1101, + "start": 1332, + "end": 1342, "loc": { "start": { - "line": 28, + "line": 38, "column": 7 }, "end": { - "line": 28, + "line": 38, "column": 17 } }, "object": { "type": "Identifier", - "start": 1091, - "end": 1095, + "start": 1332, + "end": 1336, "loc": { "start": { - "line": 28, + "line": 38, "column": 7 }, "end": { - "line": 28, + "line": 38, "column": 11 }, "identifierName": "root" @@ -1709,15 +2313,15 @@ }, "property": { "type": "Identifier", - "start": 1096, - "end": 1101, + "start": 1337, + "end": 1342, "loc": { "start": { - "line": 28, + "line": 38, "column": 12 }, "end": { - "line": 28, + "line": 38, "column": 17 }, "identifierName": "right" @@ -1728,15 +2332,15 @@ }, "property": { "type": "Identifier", - "start": 1102, - "end": 1108, + "start": 1343, + "end": 1349, "loc": { "start": { - "line": 28, + "line": 38, "column": 18 }, "end": { - "line": 28, + "line": 38, "column": 24 }, "identifierName": "isLeaf" @@ -1752,170 +2356,320 @@ } }, "consequent": { - "type": "ExpressionStatement", - "start": 1115, - "end": 1171, + "type": "BlockStatement", + "start": 1353, + "end": 1457, "loc": { "start": { - "line": 29, - "column": 3 + "line": 38, + "column": 28 }, "end": { - "line": 29, - "column": 59 + "line": 41, + "column": 3 } }, - "expression": { - "type": "YieldExpression", - "start": 1115, - "end": 1170, - "loc": { - "start": { - "line": 29, - "column": 3 - }, - "end": { - "line": 29, - "column": 58 - } - }, - "delegate": true, - "argument": { - "type": "CallExpression", - "start": 1122, - "end": 1170, + "body": [ + { + "type": "ExpressionStatement", + "start": 1358, + "end": 1393, "loc": { "start": { - "line": 29, - "column": 10 + "line": 39, + "column": 3 }, "end": { - "line": 29, - "column": 58 + "line": 39, + "column": 38 } }, - "callee": { - "type": "Identifier", - "start": 1122, - "end": 1136, + "expression": { + "type": "CallExpression", + "start": 1358, + "end": 1392, "loc": { "start": { - "line": 29, - "column": 10 + "line": 39, + "column": 3 }, "end": { - "line": 29, - "column": 24 - }, - "identifierName": "rangetraversal" + "line": 39, + "column": 37 + } }, - "name": "rangetraversal" - }, - "arguments": [ - { + "callee": { "type": "Identifier", - "start": 1137, - "end": 1144, + "start": 1358, + "end": 1364, "loc": { "start": { - "line": 29, - "column": 25 + "line": 39, + "column": 3 }, "end": { - "line": 29, - "column": 32 + "line": 39, + "column": 9 }, - "identifierName": "compare" + "identifierName": "assert" }, - "name": "compare" + "name": "assert" }, - { - "type": "MemberExpression", - "start": 1146, - "end": 1156, - "loc": { - "start": { - "line": 29, - "column": 34 - }, - "end": { - "line": 29, - "column": 44 - } - }, - "object": { - "type": "Identifier", - "start": 1146, - "end": 1150, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1365, + "end": 1391, "loc": { "start": { - "line": 29, - "column": 34 + "line": 39, + "column": 10 }, "end": { - "line": 29, - "column": 38 - }, - "identifierName": "root" + "line": 39, + "column": 36 + } }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 1151, - "end": 1156, - "loc": { - "start": { - "line": 29, - "column": 39 + "left": { + "type": "MemberExpression", + "start": 1365, + "end": 1375, + "loc": { + "start": { + "line": 39, + "column": 10 + }, + "end": { + "line": 39, + "column": 20 + } }, - "end": { - "line": 29, - "column": 44 + "object": { + "type": "Identifier", + "start": 1365, + "end": 1369, + "loc": { + "start": { + "line": 39, + "column": 10 + }, + "end": { + "line": 39, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" }, - "identifierName": "right" + "property": { + "type": "Identifier", + "start": 1370, + "end": 1375, + "loc": { + "start": { + "line": 39, + "column": 15 + }, + "end": { + "line": 39, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "name": "right" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1387, + "end": 1391, + "loc": { + "start": { + "line": 39, + "column": 32 + }, + "end": { + "line": 39, + "column": 36 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1397, + "end": 1453, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 59 + } + }, + "expression": { + "type": "YieldExpression", + "start": 1397, + "end": 1452, + "loc": { + "start": { + "line": 40, + "column": 3 }, - "computed": false + "end": { + "line": 40, + "column": 58 + } }, - { - "type": "Identifier", - "start": 1158, - "end": 1162, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 1404, + "end": 1452, "loc": { "start": { - "line": 29, - "column": 46 + "line": 40, + "column": 10 }, "end": { - "line": 29, - "column": 50 + "line": 40, + "column": 58 + } + }, + "callee": { + "type": "Identifier", + "start": 1404, + "end": 1418, + "loc": { + "start": { + "line": 40, + "column": 10 + }, + "end": { + "line": 40, + "column": 24 + }, + "identifierName": "rangetraversal" }, - "identifierName": "left" + "name": "rangetraversal" }, - "name": "left" - }, - { - "type": "Identifier", - "start": 1164, - "end": 1169, - "loc": { - "start": { - "line": 29, - "column": 52 + "arguments": [ + { + "type": "Identifier", + "start": 1419, + "end": 1426, + "loc": { + "start": { + "line": 40, + "column": 25 + }, + "end": { + "line": 40, + "column": 32 + }, + "identifierName": "compare" + }, + "name": "compare" }, - "end": { - "line": 29, - "column": 57 + { + "type": "MemberExpression", + "start": 1428, + "end": 1438, + "loc": { + "start": { + "line": 40, + "column": 34 + }, + "end": { + "line": 40, + "column": 44 + } + }, + "object": { + "type": "Identifier", + "start": 1428, + "end": 1432, + "loc": { + "start": { + "line": 40, + "column": 34 + }, + "end": { + "line": 40, + "column": 38 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1433, + "end": 1438, + "loc": { + "start": { + "line": 40, + "column": 39 + }, + "end": { + "line": 40, + "column": 44 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "identifierName": "right" - }, - "name": "right" + { + "type": "Identifier", + "start": 1440, + "end": 1444, + "loc": { + "start": { + "line": 40, + "column": 46 + }, + "end": { + "line": 40, + "column": 50 + }, + "identifierName": "left" + }, + "name": "left" + }, + { + "type": "Identifier", + "start": 1446, + "end": 1451, + "loc": { + "start": { + "line": 40, + "column": 52 + }, + "end": { + "line": 40, + "column": 57 + }, + "identifierName": "right" + }, + "name": "right" + } + ] } - ] + } } - } + ], + "directives": [] }, "alternate": null } @@ -1930,16 +2684,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n ", - "start": 0, - "end": 377, + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 476, "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 13, "column": 3 } } @@ -1950,16 +2704,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n ", - "start": 0, - "end": 377, + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 476, "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 13, "column": 3 } } @@ -1972,16 +2726,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n ", - "start": 0, - "end": 377, + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 476, "loc": { "start": { - "line": 1, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 13, "column": 3 } } @@ -1989,15 +2743,15 @@ { "type": "CommentLine", "value": " If the root lies to the left of the interval, we can discard the", - "start": 478, - "end": 545, + "start": 585, + "end": 652, "loc": { "start": { - "line": 13, + "line": 16, "column": 2 }, "end": { - "line": 13, + "line": 16, "column": 69 } } @@ -2005,15 +2759,15 @@ { "type": "CommentLine", "value": " entire left subtree.", - "start": 548, - "end": 571, + "start": 655, + "end": 678, "loc": { "start": { - "line": 14, + "line": 17, "column": 2 }, "end": { - "line": 14, + "line": 17, "column": 25 } } @@ -2021,15 +2775,15 @@ { "type": "CommentLine", "value": " If the root lies to the right of the interval, we can discard the", - "start": 707, - "end": 775, + "start": 859, + "end": 927, "loc": { "start": { - "line": 18, + "line": 23, "column": 2 }, "end": { - "line": 18, + "line": 23, "column": 70 } } @@ -2037,15 +2791,15 @@ { "type": "CommentLine", "value": " entire right subtree.", - "start": 778, - "end": 802, + "start": 930, + "end": 954, "loc": { "start": { - "line": 19, + "line": 24, "column": 2 }, "end": { - "line": 19, + "line": 24, "column": 26 } } @@ -2053,15 +2807,15 @@ { "type": "CommentLine", "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 901, - "end": 965, + "start": 1097, + "end": 1161, "loc": { "start": { - "line": 23, + "line": 30, "column": 2 }, "end": { - "line": 23, + "line": 30, "column": 66 } } @@ -2069,43 +2823,27 @@ { "type": "CommentLine", "value": " between.", - "start": 968, - "end": 979, + "start": 1164, + "end": 1175, "loc": { "start": { - "line": 24, + "line": 31, "column": 2 }, "end": { - "line": 24, + "line": 31, "column": 13 } } } ], "tokens": [ - { - "type": "CommentBlock", - "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n ", - "start": 0, - "end": 377, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - }, { "type": { - "label": "export", - "keyword": "export", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2114,24 +2852,23 @@ "binop": null, "updateContext": null }, - "value": "export", - "start": 378, - "end": 384, + "value": "import", + "start": 0, + "end": 6, "loc": { "start": { - "line": 11, + "line": 1, "column": 0 }, "end": { - "line": 11, + "line": 1, "column": 6 } } }, { "type": { - "label": "function", - "keyword": "function", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2141,50 +2878,49 @@ "postfix": false, "binop": null }, - "value": "function", - "start": 385, - "end": 393, + "value": "assert", + "start": 7, + "end": 13, "loc": { "start": { - "line": 11, + "line": 1, "column": 7 }, "end": { - "line": 11, - "column": 15 + "line": 1, + "column": 13 } } }, { "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 393, - "end": 394, + "value": "from", + "start": 14, + "end": 18, "loc": { "start": { - "line": 11, - "column": 15 + "line": 1, + "column": 14 }, "end": { - "line": 11, - "column": 16 + "line": 1, + "column": 18 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2192,50 +2928,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "rangetraversal", - "start": 395, - "end": 409, + "value": "assert", + "start": 19, + "end": 27, "loc": { "start": { - "line": 11, - "column": 17 + "line": 1, + "column": 19 }, "end": { - "line": 11, - "column": 31 + "line": 1, + "column": 27 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 409, - "end": 410, + "start": 27, + "end": 28, "loc": { "start": { - "line": 11, - "column": 31 + "line": 1, + "column": 27 }, "end": { - "line": 11, - "column": 32 + "line": 1, + "column": 28 } } }, { "type": { - "label": "name", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2243,45 +2982,46 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "compare", - "start": 410, - "end": 417, + "value": "import", + "start": 29, + "end": 35, "loc": { "start": { - "line": 11, - "column": 32 + "line": 2, + "column": 0 }, "end": { - "line": 11, - "column": 39 + "line": 2, + "column": 6 } } }, { "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 417, - "end": 418, + "value": "Node", + "start": 36, + "end": 40, "loc": { "start": { - "line": 11, - "column": 39 + "line": 2, + "column": 7 }, "end": { - "line": 11, - "column": 40 + "line": 2, + "column": 11 } } }, @@ -2297,25 +3037,25 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 419, - "end": 423, + "value": "from", + "start": 41, + "end": 45, "loc": { "start": { - "line": 11, - "column": 41 + "line": 2, + "column": 12 }, "end": { - "line": 11, - "column": 45 + "line": 2, + "column": 16 } } }, { "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, + "label": "string", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2324,48 +3064,23 @@ "binop": null, "updateContext": null }, - "start": 423, - "end": 424, + "value": "../types/Node.js", + "start": 46, + "end": 64, "loc": { "start": { - "line": 11, - "column": 45 + "line": 2, + "column": 17 }, "end": { - "line": 11, - "column": 46 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 425, - "end": 429, - "loc": { - "start": { - "line": 11, - "column": 47 - }, - "end": { - "line": 11, - "column": 51 + "line": 2, + "column": 35 } } }, { "type": { - "label": ",", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2376,48 +3091,39 @@ "binop": null, "updateContext": null }, - "start": 429, - "end": 430, + "start": 64, + "end": 65, "loc": { "start": { - "line": 11, - "column": 51 + "line": 2, + "column": 35 }, "end": { - "line": 11, - "column": 52 + "line": 2, + "column": 36 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 431, - "end": 436, + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 67, + "end": 476, "loc": { "start": { - "line": 11, - "column": 53 + "line": 4, + "column": 0 }, "end": { - "line": 11, - "column": 58 + "line": 13, + "column": 3 } } }, { "type": { - "label": ")", + "label": "export", + "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2425,96 +3131,102 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 436, - "end": 437, + "value": "export", + "start": 477, + "end": 483, "loc": { "start": { - "line": 11, - "column": 58 + "line": 14, + "column": 0 }, "end": { - "line": 11, - "column": 59 + "line": 14, + "column": 6 } } }, { "type": { - "label": "{", + "label": "default", + "keyword": "default", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 438, - "end": 439, + "value": "default", + "start": 484, + "end": 491, "loc": { "start": { - "line": 11, - "column": 60 + "line": 14, + "column": 7 }, "end": { - "line": 11, - "column": 61 + "line": 14, + "column": 14 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "function", + "keyword": "function", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 441, - "end": 443, + "value": "function", + "start": 492, + "end": 500, "loc": { "start": { - "line": 12, - "column": 1 + "line": 14, + "column": 15 }, "end": { - "line": 12, - "column": 3 + "line": 14, + "column": 23 } } }, { "type": { - "label": "(", + "label": "*", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 10, + "updateContext": null }, - "start": 444, - "end": 445, + "value": "*", + "start": 500, + "end": 501, "loc": { "start": { - "line": 12, - "column": 4 + "line": 14, + "column": 23 }, "end": { - "line": 12, - "column": 5 + "line": 14, + "column": 24 } } }, @@ -2530,17 +3242,17 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 445, - "end": 452, + "value": "rangetraversal", + "start": 502, + "end": 516, "loc": { "start": { - "line": 12, - "column": 5 + "line": 14, + "column": 25 }, "end": { - "line": 12, - "column": 12 + "line": 14, + "column": 39 } } }, @@ -2556,16 +3268,16 @@ "postfix": false, "binop": null }, - "start": 452, - "end": 453, + "start": 516, + "end": 517, "loc": { "start": { - "line": 12, - "column": 12 + "line": 14, + "column": 39 }, "end": { - "line": 12, - "column": 13 + "line": 14, + "column": 40 } } }, @@ -2581,24 +3293,24 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 453, - "end": 457, + "value": "compare", + "start": 517, + "end": 524, "loc": { "start": { - "line": 12, - "column": 13 + "line": 14, + "column": 40 }, "end": { - "line": 12, - "column": 17 + "line": 14, + "column": 47 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ",", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2608,16 +3320,16 @@ "binop": null, "updateContext": null }, - "start": 457, - "end": 458, + "start": 524, + "end": 525, "loc": { "start": { - "line": 12, - "column": 17 + "line": 14, + "column": 47 }, "end": { - "line": 12, - "column": 18 + "line": 14, + "column": 48 } } }, @@ -2633,17 +3345,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 458, - "end": 461, + "value": "root", + "start": 526, + "end": 530, "loc": { "start": { - "line": 12, - "column": 18 + "line": 14, + "column": 49 }, "end": { - "line": 12, - "column": 21 + "line": 14, + "column": 53 } } }, @@ -2660,16 +3372,16 @@ "binop": null, "updateContext": null }, - "start": 461, - "end": 462, + "start": 530, + "end": 531, "loc": { "start": { - "line": 12, - "column": 21 + "line": 14, + "column": 53 }, "end": { - "line": 12, - "column": 22 + "line": 14, + "column": 54 } } }, @@ -2686,47 +3398,22 @@ "binop": null }, "value": "left", - "start": 463, - "end": 467, - "loc": { - "start": { - "line": 12, - "column": 23 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 467, - "end": 468, + "start": 532, + "end": 536, "loc": { "start": { - "line": 12, - "column": 27 + "line": 14, + "column": 55 }, "end": { - "line": 12, - "column": 28 + "line": 14, + "column": 59 } } }, { "type": { - "label": "", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2734,26 +3421,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "<", - "start": 469, - "end": 470, + "start": 536, + "end": 537, "loc": { "start": { - "line": 12, - "column": 29 + "line": 14, + "column": 59 }, "end": { - "line": 12, - "column": 30 + "line": 14, + "column": 60 } } }, { "type": { - "label": "num", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2761,20 +3447,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": 0, - "start": 471, - "end": 472, + "value": "right", + "start": 538, + "end": 543, "loc": { "start": { - "line": 12, - "column": 31 + "line": 14, + "column": 61 }, "end": { - "line": 12, - "column": 32 + "line": 14, + "column": 66 } } }, @@ -2790,16 +3475,16 @@ "postfix": false, "binop": null }, - "start": 472, - "end": 473, + "start": 543, + "end": 544, "loc": { "start": { - "line": 12, - "column": 32 + "line": 14, + "column": 66 }, "end": { - "line": 12, - "column": 33 + "line": 14, + "column": 67 } } }, @@ -2815,48 +3500,16 @@ "postfix": false, "binop": null }, - "start": 474, - "end": 475, - "loc": { - "start": { - "line": 12, - "column": 34 - }, - "end": { - "line": 12, - "column": 35 - } - } - }, - { - "type": "CommentLine", - "value": " If the root lies to the left of the interval, we can discard the", - "start": 478, - "end": 545, - "loc": { - "start": { - "line": 13, - "column": 2 - }, - "end": { - "line": 13, - "column": 69 - } - } - }, - { - "type": "CommentLine", - "value": " entire left subtree.", - "start": 548, - "end": 571, + "start": 545, + "end": 546, "loc": { "start": { "line": 14, - "column": 2 + "column": 68 }, "end": { "line": 14, - "column": 25 + "column": 69 } } }, @@ -2875,16 +3528,16 @@ "updateContext": null }, "value": "if", - "start": 574, - "end": 576, + "start": 548, + "end": 550, "loc": { "start": { "line": 15, - "column": 2 + "column": 1 }, "end": { "line": 15, - "column": 4 + "column": 3 } } }, @@ -2900,50 +3553,49 @@ "postfix": false, "binop": null }, - "start": 577, - "end": 578, + "start": 551, + "end": 552, "loc": { "start": { "line": 15, - "column": 5 + "column": 4 }, "end": { "line": 15, - "column": 6 + "column": 5 } } }, { "type": { - "label": "prefix", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": true, + "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "!", - "start": 578, - "end": 579, + "value": "compare", + "start": 552, + "end": 559, "loc": { "start": { "line": 15, - "column": 6 + "column": 5 }, "end": { "line": 15, - "column": 7 + "column": 12 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2952,43 +3604,16 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 579, - "end": 583, - "loc": { - "start": { - "line": 15, - "column": 7 - }, - "end": { - "line": 15, - "column": 11 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 583, - "end": 584, + "start": 559, + "end": 560, "loc": { "start": { "line": 15, - "column": 11 + "column": 12 }, "end": { "line": 15, - "column": 12 + "column": 13 } } }, @@ -3004,13 +3629,13 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 584, - "end": 589, + "value": "root", + "start": 560, + "end": 564, "loc": { "start": { "line": 15, - "column": 12 + "column": 13 }, "end": { "line": 15, @@ -3031,8 +3656,8 @@ "binop": null, "updateContext": null }, - "start": 589, - "end": 590, + "start": 564, + "end": 565, "loc": { "start": { "line": 15, @@ -3056,9 +3681,9 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 590, - "end": 596, + "value": "key", + "start": 565, + "end": 568, "loc": { "start": { "line": 15, @@ -3066,40 +3691,41 @@ }, "end": { "line": 15, - "column": 24 + "column": 21 } } }, { "type": { - "label": "(", + "label": ",", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 596, - "end": 597, + "start": 568, + "end": 569, "loc": { "start": { "line": 15, - "column": 24 + "column": 21 }, "end": { "line": 15, - "column": 25 + "column": 22 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3107,16 +3733,17 @@ "postfix": false, "binop": null }, - "start": 597, - "end": 598, + "value": "left", + "start": 570, + "end": 574, "loc": { "start": { "line": 15, - "column": 25 + "column": 23 }, "end": { "line": 15, - "column": 26 + "column": 27 } } }, @@ -3132,79 +3759,78 @@ "postfix": false, "binop": null }, - "start": 598, - "end": 599, + "start": 574, + "end": 575, "loc": { "start": { "line": 15, - "column": 26 + "column": 27 }, "end": { "line": 15, - "column": 27 + "column": 28 } } }, { "type": { - "label": "yield", - "keyword": "yield", + "label": "", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "yield", - "start": 603, - "end": 608, + "value": "<", + "start": 576, + "end": 577, "loc": { "start": { - "line": 16, - "column": 3 + "line": 15, + "column": 29 }, "end": { - "line": 16, - "column": 8 + "line": 15, + "column": 30 } } }, { "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, + "label": "num", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, + "binop": null, "updateContext": null }, - "value": "*", - "start": 608, - "end": 609, + "value": 0, + "start": 578, + "end": 579, "loc": { "start": { - "line": 16, - "column": 8 + "line": 15, + "column": 31 }, "end": { - "line": 16, - "column": 9 + "line": 15, + "column": 32 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3212,23 +3838,22 @@ "postfix": false, "binop": null }, - "value": "rangetraversal", - "start": 610, - "end": 624, + "start": 579, + "end": 580, "loc": { "start": { - "line": 16, - "column": 10 + "line": 15, + "column": 32 }, "end": { - "line": 16, - "column": 24 + "line": 15, + "column": 33 } } }, { "type": { - "label": "(", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -3238,49 +3863,56 @@ "postfix": false, "binop": null }, - "start": 624, - "end": 625, + "start": 581, + "end": 582, "loc": { "start": { - "line": 16, - "column": 24 + "line": 15, + "column": 34 }, "end": { - "line": 16, - "column": 25 + "line": 15, + "column": 35 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "compare", - "start": 625, - "end": 632, + "type": "CommentLine", + "value": " If the root lies to the left of the interval, we can discard the", + "start": 585, + "end": 652, "loc": { "start": { "line": 16, - "column": 25 + "column": 2 }, "end": { "line": 16, - "column": 32 + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " entire left subtree.", + "start": 655, + "end": 678, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 25 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": "if", + "keyword": "if", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3290,23 +3922,24 @@ "binop": null, "updateContext": null }, - "start": 632, - "end": 633, + "value": "if", + "start": 681, + "end": 683, "loc": { "start": { - "line": 16, - "column": 32 + "line": 18, + "column": 2 }, "end": { - "line": 16, - "column": 33 + "line": 18, + "column": 4 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3315,43 +3948,43 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 634, - "end": 638, + "start": 684, + "end": 685, "loc": { "start": { - "line": 16, - "column": 34 + "line": 18, + "column": 5 }, "end": { - "line": 16, - "column": 38 + "line": 18, + "column": 6 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "prefix", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": false, + "prefix": true, "postfix": false, "binop": null, "updateContext": null }, - "start": 638, - "end": 639, + "value": "!", + "start": 685, + "end": 686, "loc": { "start": { - "line": 16, - "column": 38 + "line": 18, + "column": 6 }, "end": { - "line": 16, - "column": 39 + "line": 18, + "column": 7 } } }, @@ -3367,24 +4000,24 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 639, - "end": 644, + "value": "root", + "start": 686, + "end": 690, "loc": { "start": { - "line": 16, - "column": 39 + "line": 18, + "column": 7 }, "end": { - "line": 16, - "column": 44 + "line": 18, + "column": 11 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3394,16 +4027,16 @@ "binop": null, "updateContext": null }, - "start": 644, - "end": 645, + "start": 690, + "end": 691, "loc": { "start": { - "line": 16, - "column": 44 + "line": 18, + "column": 11 }, "end": { - "line": 16, - "column": 45 + "line": 18, + "column": 12 } } }, @@ -3419,24 +4052,24 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 646, - "end": 650, + "value": "right", + "start": 691, + "end": 696, "loc": { "start": { - "line": 16, - "column": 46 + "line": 18, + "column": 12 }, "end": { - "line": 16, - "column": 50 + "line": 18, + "column": 17 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3446,16 +4079,16 @@ "binop": null, "updateContext": null }, - "start": 650, - "end": 651, + "start": 696, + "end": 697, "loc": { "start": { - "line": 16, - "column": 50 + "line": 18, + "column": 17 }, "end": { - "line": 16, - "column": 51 + "line": 18, + "column": 18 } } }, @@ -3471,25 +4104,25 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 652, - "end": 657, + "value": "isLeaf", + "start": 697, + "end": 703, "loc": { "start": { - "line": 16, - "column": 52 + "line": 18, + "column": 18 }, "end": { - "line": 16, - "column": 57 + "line": 18, + "column": 24 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3497,48 +4130,47 @@ "postfix": false, "binop": null }, - "start": 657, - "end": 658, + "start": 703, + "end": 704, "loc": { "start": { - "line": 16, - "column": 57 + "line": 18, + "column": 24 }, "end": { - "line": 16, - "column": 58 + "line": 18, + "column": 25 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 658, - "end": 659, + "start": 704, + "end": 705, "loc": { "start": { - "line": 16, - "column": 58 + "line": 18, + "column": 25 }, "end": { - "line": 16, - "column": 59 + "line": 18, + "column": 26 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3548,72 +4180,67 @@ "postfix": false, "binop": null }, - "start": 661, - "end": 662, + "start": 705, + "end": 706, "loc": { "start": { - "line": 17, - "column": 1 + "line": 18, + "column": 26 }, "end": { - "line": 17, - "column": 2 + "line": 18, + "column": 27 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "else", - "start": 663, - "end": 667, + "start": 707, + "end": 708, "loc": { "start": { - "line": 17, - "column": 3 + "line": 18, + "column": 28 }, "end": { - "line": 17, - "column": 7 + "line": 18, + "column": 29 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 668, - "end": 670, + "value": "assert", + "start": 712, + "end": 718, "loc": { "start": { - "line": 17, - "column": 8 + "line": 19, + "column": 3 }, "end": { - "line": 17, - "column": 10 + "line": 19, + "column": 9 } } }, @@ -3629,16 +4256,16 @@ "postfix": false, "binop": null }, - "start": 671, - "end": 672, + "start": 718, + "end": 719, "loc": { "start": { - "line": 17, - "column": 11 + "line": 19, + "column": 9 }, "end": { - "line": 17, - "column": 12 + "line": 19, + "column": 10 } } }, @@ -3654,42 +4281,43 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 672, - "end": 679, + "value": "root", + "start": 719, + "end": 723, "loc": { "start": { - "line": 17, - "column": 12 + "line": 19, + "column": 10 }, "end": { - "line": 17, - "column": 19 + "line": 19, + "column": 14 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 679, - "end": 680, + "start": 723, + "end": 724, "loc": { "start": { - "line": 17, - "column": 19 + "line": 19, + "column": 14 }, "end": { - "line": 17, - "column": 20 + "line": 19, + "column": 15 } } }, @@ -3705,43 +4333,45 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 680, - "end": 684, + "value": "right", + "start": 724, + "end": 729, "loc": { "start": { - "line": 17, - "column": 20 + "line": 19, + "column": 15 }, "end": { - "line": 17, - "column": 24 + "line": 19, + "column": 20 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 684, - "end": 685, + "value": "instanceof", + "start": 730, + "end": 740, "loc": { "start": { - "line": 17, - "column": 24 + "line": 19, + "column": 21 }, "end": { - "line": 17, - "column": 25 + "line": 19, + "column": 31 } } }, @@ -3757,100 +4387,102 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 685, - "end": 688, + "value": "Node", + "start": 741, + "end": 745, "loc": { "start": { - "line": 17, - "column": 25 + "line": 19, + "column": 32 }, "end": { - "line": 17, - "column": 28 + "line": 19, + "column": 36 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 688, - "end": 689, + "start": 745, + "end": 746, "loc": { "start": { - "line": 17, - "column": 28 + "line": 19, + "column": 36 }, "end": { - "line": 17, - "column": 29 + "line": 19, + "column": 37 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "right", - "start": 690, - "end": 695, + "start": 746, + "end": 747, "loc": { "start": { - "line": 17, - "column": 30 + "line": 19, + "column": 37 }, "end": { - "line": 17, - "column": 35 + "line": 19, + "column": 38 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 695, - "end": 696, + "value": "yield", + "start": 751, + "end": 756, "loc": { "start": { - "line": 17, - "column": 35 + "line": 20, + "column": 3 }, "end": { - "line": 17, - "column": 36 + "line": 20, + "column": 8 } } }, { "type": { - "label": "", + "label": "*", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3858,26 +4490,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": 10, "updateContext": null }, - "value": ">=", - "start": 697, - "end": 699, + "value": "*", + "start": 756, + "end": 757, "loc": { "start": { - "line": 17, - "column": 37 + "line": 20, + "column": 8 }, "end": { - "line": 17, - "column": 39 + "line": 20, + "column": 9 } } }, { "type": { - "label": "num", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3885,28 +4517,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": 0, - "start": 700, - "end": 701, + "value": "rangetraversal", + "start": 758, + "end": 772, "loc": { "start": { - "line": 17, - "column": 40 + "line": 20, + "column": 10 }, "end": { - "line": 17, - "column": 41 + "line": 20, + "column": 24 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3914,23 +4545,23 @@ "postfix": false, "binop": null }, - "start": 701, - "end": 702, + "start": 772, + "end": 773, "loc": { "start": { - "line": 17, - "column": 41 + "line": 20, + "column": 24 }, "end": { - "line": 17, - "column": 42 + "line": 20, + "column": 25 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3939,55 +4570,75 @@ "postfix": false, "binop": null }, - "start": 703, - "end": 704, + "value": "compare", + "start": 773, + "end": 780, "loc": { "start": { - "line": 17, - "column": 43 + "line": 20, + "column": 25 }, "end": { - "line": 17, - "column": 44 + "line": 20, + "column": 32 } } }, { - "type": "CommentLine", - "value": " If the root lies to the right of the interval, we can discard the", - "start": 707, - "end": 775, + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 780, + "end": 781, "loc": { "start": { - "line": 18, - "column": 2 + "line": 20, + "column": 32 }, "end": { - "line": 18, - "column": 70 + "line": 20, + "column": 33 } } }, { - "type": "CommentLine", - "value": " entire right subtree.", - "start": 778, - "end": 802, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 782, + "end": 786, "loc": { "start": { - "line": 19, - "column": 2 + "line": 20, + "column": 34 }, "end": { - "line": 19, - "column": 26 + "line": 20, + "column": 38 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3998,24 +4649,23 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 805, - "end": 807, + "start": 786, + "end": 787, "loc": { "start": { "line": 20, - "column": 2 + "column": 38 }, "end": { "line": 20, - "column": 4 + "column": 39 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4024,43 +4674,43 @@ "postfix": false, "binop": null }, - "start": 808, - "end": 809, + "value": "right", + "start": 787, + "end": 792, "loc": { "start": { "line": 20, - "column": 5 + "column": 39 }, "end": { "line": 20, - "column": 6 + "column": 44 } } }, { "type": { - "label": "prefix", + "label": ",", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": true, + "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "!", - "start": 809, - "end": 810, + "start": 792, + "end": 793, "loc": { "start": { "line": 20, - "column": 6 + "column": 44 }, "end": { "line": 20, - "column": 7 + "column": 45 } } }, @@ -4076,24 +4726,24 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 810, - "end": 814, + "value": "left", + "start": 794, + "end": 798, "loc": { "start": { "line": 20, - "column": 7 + "column": 46 }, "end": { "line": 20, - "column": 11 + "column": 50 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ",", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4103,16 +4753,16 @@ "binop": null, "updateContext": null }, - "start": 814, - "end": 815, + "start": 798, + "end": 799, "loc": { "start": { "line": 20, - "column": 11 + "column": 50 }, "end": { "line": 20, - "column": 12 + "column": 51 } } }, @@ -4128,23 +4778,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 815, - "end": 819, + "value": "right", + "start": 800, + "end": 805, "loc": { "start": { "line": 20, - "column": 12 + "column": 52 }, "end": { "line": 20, - "column": 16 + "column": 57 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -4152,53 +4802,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 819, - "end": 820, + "start": 805, + "end": 806, "loc": { "start": { "line": 20, - "column": 16 + "column": 57 }, "end": { "line": 20, - "column": 17 + "column": 58 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "isLeaf", - "start": 820, - "end": 826, + "start": 806, + "end": 807, "loc": { "start": { "line": 20, - "column": 17 + "column": 58 }, "end": { "line": 20, - "column": 23 + "column": 59 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4206,22 +4855,22 @@ "postfix": false, "binop": null }, - "start": 826, - "end": 827, + "start": 810, + "end": 811, "loc": { "start": { - "line": 20, - "column": 23 + "line": 21, + "column": 2 }, "end": { - "line": 20, - "column": 24 + "line": 21, + "column": 3 } } }, { "type": { - "label": ")", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -4231,50 +4880,53 @@ "postfix": false, "binop": null }, - "start": 827, - "end": 828, + "start": 813, + "end": 814, "loc": { "start": { - "line": 20, - "column": 24 + "line": 22, + "column": 1 }, "end": { - "line": 20, - "column": 25 + "line": 22, + "column": 2 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "else", + "keyword": "else", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 828, - "end": 829, + "value": "else", + "start": 815, + "end": 819, "loc": { "start": { - "line": 20, - "column": 25 + "line": 22, + "column": 3 }, "end": { - "line": 20, - "column": 26 + "line": 22, + "column": 7 } } }, { "type": { - "label": "yield", - "keyword": "yield", - "beforeExpr": true, - "startsExpr": true, + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4283,51 +4935,1671 @@ "binop": null, "updateContext": null }, - "value": "yield", - "start": 833, - "end": 838, + "value": "if", + "start": 820, + "end": 822, "loc": { "start": { - "line": 21, - "column": 3 + "line": 22, + "column": 8 }, "end": { - "line": 21, - "column": 8 + "line": 22, + "column": 10 } } }, { "type": { - "label": "*", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 838, - "end": 839, + "start": 823, + "end": 824, "loc": { "start": { - "line": 21, - "column": 8 + "line": 22, + "column": 11 }, "end": { - "line": 21, - "column": 9 + "line": 22, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 824, + "end": 831, + "loc": { + "start": { + "line": 22, + "column": 12 + }, + "end": { + "line": 22, + "column": 19 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 831, + "end": 832, + "loc": { + "start": { + "line": 22, + "column": 19 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 832, + "end": 836, + "loc": { + "start": { + "line": 22, + "column": 20 + }, + "end": { + "line": 22, + "column": 24 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 836, + "end": 837, + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 837, + "end": 840, + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 22, + "column": 28 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 840, + "end": 841, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 22, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 842, + "end": 847, + "loc": { + "start": { + "line": 22, + "column": 30 + }, + "end": { + "line": 22, + "column": 35 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 847, + "end": 848, + "loc": { + "start": { + "line": 22, + "column": 35 + }, + "end": { + "line": 22, + "column": 36 + } + } + }, + { + "type": { + "label": "", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": ">=", + "start": 849, + "end": 851, + "loc": { + "start": { + "line": 22, + "column": 37 + }, + "end": { + "line": 22, + "column": 39 + } + } + }, + { + "type": { + "label": "num", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": 0, + "start": 852, + "end": 853, + "loc": { + "start": { + "line": 22, + "column": 40 + }, + "end": { + "line": 22, + "column": 41 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 853, + "end": 854, + "loc": { + "start": { + "line": 22, + "column": 41 + }, + "end": { + "line": 22, + "column": 42 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 855, + "end": 856, + "loc": { + "start": { + "line": 22, + "column": 43 + }, + "end": { + "line": 22, + "column": 44 + } + } + }, + { + "type": "CommentLine", + "value": " If the root lies to the right of the interval, we can discard the", + "start": 859, + "end": 927, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 70 + } + } + }, + { + "type": "CommentLine", + "value": " entire right subtree.", + "start": 930, + "end": 954, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 957, + "end": 959, + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 960, + "end": 961, + "loc": { + "start": { + "line": 25, + "column": 5 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + { + "type": { + "label": "prefix", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": true, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "!", + "start": 961, + "end": 962, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 962, + "end": 966, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 11 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 966, + "end": 967, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 967, + "end": 971, + "loc": { + "start": { + "line": 25, + "column": 12 + }, + "end": { + "line": 25, + "column": 16 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 971, + "end": 972, + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "isLeaf", + "start": 972, + "end": 978, + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 23 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 978, + "end": 979, + "loc": { + "start": { + "line": 25, + "column": 23 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 979, + "end": 980, + "loc": { + "start": { + "line": 25, + "column": 24 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 980, + "end": 981, + "loc": { + "start": { + "line": 25, + "column": 25 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 982, + "end": 983, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 987, + "end": 993, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 993, + "end": 994, + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 994, + "end": 998, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 998, + "end": 999, + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 999, + "end": 1003, + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 19 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 1004, + "end": 1014, + "loc": { + "start": { + "line": 26, + "column": 20 + }, + "end": { + "line": 26, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 1015, + "end": 1019, + "loc": { + "start": { + "line": 26, + "column": 31 + }, + "end": { + "line": 26, + "column": 35 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1019, + "end": 1020, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 36 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1020, + "end": 1021, + "loc": { + "start": { + "line": 26, + "column": 36 + }, + "end": { + "line": 26, + "column": 37 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 1025, + "end": 1030, + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 1030, + "end": 1031, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rangetraversal", + "start": 1032, + "end": 1046, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 24 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1046, + "end": 1047, + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 1047, + "end": 1054, + "loc": { + "start": { + "line": 27, + "column": 25 + }, + "end": { + "line": 27, + "column": 32 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1054, + "end": 1055, + "loc": { + "start": { + "line": 27, + "column": 32 + }, + "end": { + "line": 27, + "column": 33 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1056, + "end": 1060, + "loc": { + "start": { + "line": 27, + "column": 34 + }, + "end": { + "line": 27, + "column": 38 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1060, + "end": 1061, + "loc": { + "start": { + "line": 27, + "column": 38 + }, + "end": { + "line": 27, + "column": 39 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1061, + "end": 1065, + "loc": { + "start": { + "line": 27, + "column": 39 + }, + "end": { + "line": 27, + "column": 43 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1065, + "end": 1066, + "loc": { + "start": { + "line": 27, + "column": 43 + }, + "end": { + "line": 27, + "column": 44 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1067, + "end": 1071, + "loc": { + "start": { + "line": 27, + "column": 45 + }, + "end": { + "line": 27, + "column": 49 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1071, + "end": 1072, + "loc": { + "start": { + "line": 27, + "column": 49 + }, + "end": { + "line": 27, + "column": 50 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1073, + "end": 1078, + "loc": { + "start": { + "line": 27, + "column": 51 + }, + "end": { + "line": 27, + "column": 56 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1078, + "end": 1079, + "loc": { + "start": { + "line": 27, + "column": 56 + }, + "end": { + "line": 27, + "column": 57 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1079, + "end": 1080, + "loc": { + "start": { + "line": 27, + "column": 57 + }, + "end": { + "line": 27, + "column": 58 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1083, + "end": 1084, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1086, + "end": 1087, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 1088, + "end": 1092, + "loc": { + "start": { + "line": 29, + "column": 3 + }, + "end": { + "line": 29, + "column": 7 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1093, + "end": 1094, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 9 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise just recurse on both subtrees and yield the root in", + "start": 1097, + "end": 1161, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 66 + } + } + }, + { + "type": "CommentLine", + "value": " between.", + "start": 1164, + "end": 1175, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 13 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1178, + "end": 1180, + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1181, + "end": 1182, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 6 + } + } + }, + { + "type": { + "label": "prefix", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": true, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "!", + "start": 1182, + "end": 1183, + "loc": { + "start": { + "line": 32, + "column": 6 + }, + "end": { + "line": 32, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1183, + "end": 1187, + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 11 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1187, + "end": 1188, + "loc": { + "start": { + "line": 32, + "column": 11 + }, + "end": { + "line": 32, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1188, + "end": 1192, + "loc": { + "start": { + "line": 32, + "column": 12 + }, + "end": { + "line": 32, + "column": 16 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1192, + "end": 1193, + "loc": { + "start": { + "line": 32, + "column": 16 + }, + "end": { + "line": 32, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "isLeaf", + "start": 1193, + "end": 1199, + "loc": { + "start": { + "line": 32, + "column": 17 + }, + "end": { + "line": 32, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4336,25 +6608,24 @@ "postfix": false, "binop": null }, - "value": "rangetraversal", - "start": 840, - "end": 854, + "start": 1199, + "end": 1200, "loc": { "start": { - "line": 21, - "column": 10 + "line": 32, + "column": 23 }, "end": { - "line": 21, + "line": 32, "column": 24 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4362,24 +6633,24 @@ "postfix": false, "binop": null }, - "start": 854, - "end": 855, + "start": 1200, + "end": 1201, "loc": { "start": { - "line": 21, + "line": 32, "column": 24 }, "end": { - "line": 21, + "line": 32, "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4387,43 +6658,41 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 855, - "end": 862, + "start": 1201, + "end": 1202, "loc": { "start": { - "line": 21, + "line": 32, "column": 25 }, "end": { - "line": 21, - "column": 32 + "line": 32, + "column": 26 } } }, { "type": { - "label": ",", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 862, - "end": 863, + "start": 1203, + "end": 1204, "loc": { "start": { - "line": 21, - "column": 32 + "line": 32, + "column": 27 }, "end": { - "line": 21, - "column": 33 + "line": 32, + "column": 28 } } }, @@ -4439,43 +6708,42 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 864, - "end": 868, + "value": "assert", + "start": 1208, + "end": 1214, "loc": { "start": { - "line": 21, - "column": 34 + "line": 33, + "column": 3 }, "end": { - "line": 21, - "column": 38 + "line": 33, + "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 868, - "end": 869, + "start": 1214, + "end": 1215, "loc": { "start": { - "line": 21, - "column": 38 + "line": 33, + "column": 9 }, "end": { - "line": 21, - "column": 39 + "line": 33, + "column": 10 } } }, @@ -4491,24 +6759,24 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 869, - "end": 873, + "value": "root", + "start": 1215, + "end": 1219, "loc": { "start": { - "line": 21, - "column": 39 + "line": 33, + "column": 10 }, "end": { - "line": 21, - "column": 43 + "line": 33, + "column": 14 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4518,16 +6786,16 @@ "binop": null, "updateContext": null }, - "start": 873, - "end": 874, + "start": 1219, + "end": 1220, "loc": { "start": { - "line": 21, - "column": 43 + "line": 33, + "column": 14 }, "end": { - "line": 21, - "column": 44 + "line": 33, + "column": 15 } } }, @@ -4544,22 +6812,23 @@ "binop": null }, "value": "left", - "start": 875, - "end": 879, + "start": 1220, + "end": 1224, "loc": { "start": { - "line": 21, - "column": 45 + "line": 33, + "column": 15 }, "end": { - "line": 21, - "column": 49 + "line": 33, + "column": 19 } } }, { "type": { - "label": ",", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4567,19 +6836,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 879, - "end": 880, + "value": "instanceof", + "start": 1225, + "end": 1235, "loc": { "start": { - "line": 21, - "column": 49 + "line": 33, + "column": 20 }, "end": { - "line": 21, - "column": 50 + "line": 33, + "column": 30 } } }, @@ -4595,17 +6865,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 881, - "end": 886, + "value": "Node", + "start": 1236, + "end": 1240, "loc": { "start": { - "line": 21, - "column": 51 + "line": 33, + "column": 31 }, "end": { - "line": 21, - "column": 56 + "line": 33, + "column": 35 } } }, @@ -4621,16 +6891,16 @@ "postfix": false, "binop": null }, - "start": 886, - "end": 887, + "start": 1240, + "end": 1241, "loc": { "start": { - "line": 21, - "column": 56 + "line": 33, + "column": 35 }, "end": { - "line": 21, - "column": 57 + "line": 33, + "column": 36 } } }, @@ -4647,50 +6917,25 @@ "binop": null, "updateContext": null }, - "start": 887, - "end": 888, - "loc": { - "start": { - "line": 21, - "column": 57 - }, - "end": { - "line": 21, - "column": 58 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 890, - "end": 891, + "start": 1241, + "end": 1242, "loc": { "start": { - "line": 22, - "column": 1 + "line": 33, + "column": 36 }, "end": { - "line": 22, - "column": 2 + "line": 33, + "column": 37 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": "yield", + "keyword": "yield", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4699,102 +6944,70 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 892, - "end": 896, + "value": "yield", + "start": 1246, + "end": 1251, "loc": { "start": { - "line": 22, + "line": 34, "column": 3 }, "end": { - "line": 22, - "column": 7 + "line": 34, + "column": 8 } } }, { "type": { - "label": "{", + "label": "*", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 10, + "updateContext": null }, - "start": 897, - "end": 898, + "value": "*", + "start": 1251, + "end": 1252, "loc": { "start": { - "line": 22, + "line": 34, "column": 8 }, "end": { - "line": 22, + "line": 34, "column": 9 } } }, - { - "type": "CommentLine", - "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 901, - "end": 965, - "loc": { - "start": { - "line": 23, - "column": 2 - }, - "end": { - "line": 23, - "column": 66 - } - } - }, - { - "type": "CommentLine", - "value": " between.", - "start": 968, - "end": 979, - "loc": { - "start": { - "line": 24, - "column": 2 - }, - "end": { - "line": 24, - "column": 13 - } - } - }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 982, - "end": 984, + "value": "rangetraversal", + "start": 1253, + "end": 1267, "loc": { "start": { - "line": 25, - "column": 2 + "line": 34, + "column": 10 }, "end": { - "line": 25, - "column": 4 + "line": 34, + "column": 24 } } }, @@ -4810,43 +7023,16 @@ "postfix": false, "binop": null }, - "start": 985, - "end": 986, - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 25, - "column": 6 - } - } - }, - { - "type": { - "label": "prefix", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "!", - "start": 986, - "end": 987, + "start": 1267, + "end": 1268, "loc": { "start": { - "line": 25, - "column": 6 + "line": 34, + "column": 24 }, "end": { - "line": 25, - "column": 7 + "line": 34, + "column": 25 } } }, @@ -4862,24 +7048,24 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 987, - "end": 991, + "value": "compare", + "start": 1268, + "end": 1275, "loc": { "start": { - "line": 25, - "column": 7 + "line": 34, + "column": 25 }, "end": { - "line": 25, - "column": 11 + "line": 34, + "column": 32 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ",", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4889,16 +7075,16 @@ "binop": null, "updateContext": null }, - "start": 991, - "end": 992, + "start": 1275, + "end": 1276, "loc": { "start": { - "line": 25, - "column": 11 + "line": 34, + "column": 32 }, "end": { - "line": 25, - "column": 12 + "line": 34, + "column": 33 } } }, @@ -4914,17 +7100,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 992, - "end": 996, + "value": "root", + "start": 1277, + "end": 1281, "loc": { "start": { - "line": 25, - "column": 12 + "line": 34, + "column": 34 }, "end": { - "line": 25, - "column": 16 + "line": 34, + "column": 38 } } }, @@ -4941,16 +7127,16 @@ "binop": null, "updateContext": null }, - "start": 996, - "end": 997, + "start": 1281, + "end": 1282, "loc": { "start": { - "line": 25, - "column": 16 + "line": 34, + "column": 38 }, "end": { - "line": 25, - "column": 17 + "line": 34, + "column": 39 } } }, @@ -4966,75 +7152,51 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 997, - "end": 1003, + "value": "left", + "start": 1282, + "end": 1286, "loc": { "start": { - "line": 25, - "column": 17 + "line": 34, + "column": 39 }, "end": { - "line": 25, - "column": 23 + "line": 34, + "column": 43 } } }, { "type": { - "label": "(", + "label": ",", "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1003, - "end": 1004, - "loc": { - "start": { - "line": 25, - "column": 23 - }, - "end": { - "line": 25, - "column": 24 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1004, - "end": 1005, + "start": 1286, + "end": 1287, "loc": { "start": { - "line": 25, - "column": 24 + "line": 34, + "column": 43 }, "end": { - "line": 25, - "column": 25 + "line": 34, + "column": 44 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5042,25 +7204,25 @@ "postfix": false, "binop": null }, - "start": 1005, - "end": 1006, + "value": "left", + "start": 1288, + "end": 1292, "loc": { "start": { - "line": 25, - "column": 25 + "line": 34, + "column": 45 }, "end": { - "line": 25, - "column": 26 + "line": 34, + "column": 49 } } }, { "type": { - "label": "yield", - "keyword": "yield", + "label": ",", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5069,52 +7231,50 @@ "binop": null, "updateContext": null }, - "value": "yield", - "start": 1010, - "end": 1015, + "start": 1292, + "end": 1293, "loc": { "start": { - "line": 26, - "column": 3 + "line": 34, + "column": 49 }, "end": { - "line": 26, - "column": 8 + "line": 34, + "column": 50 } } }, { "type": { - "label": "*", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 10, - "updateContext": null + "binop": null }, - "value": "*", - "start": 1015, - "end": 1016, + "value": "right", + "start": 1294, + "end": 1299, "loc": { "start": { - "line": 26, - "column": 8 + "line": 34, + "column": 51 }, "end": { - "line": 26, - "column": 9 + "line": 34, + "column": 56 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5122,50 +7282,50 @@ "postfix": false, "binop": null }, - "value": "rangetraversal", - "start": 1017, - "end": 1031, + "start": 1299, + "end": 1300, "loc": { "start": { - "line": 26, - "column": 10 + "line": 34, + "column": 56 }, "end": { - "line": 26, - "column": 24 + "line": 34, + "column": 57 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1031, - "end": 1032, + "start": 1300, + "end": 1301, "loc": { "start": { - "line": 26, - "column": 24 + "line": 34, + "column": 57 }, "end": { - "line": 26, - "column": 25 + "line": 34, + "column": 58 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5173,25 +7333,25 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 1032, - "end": 1039, + "start": 1304, + "end": 1305, "loc": { "start": { - "line": 26, - "column": 25 + "line": 35, + "column": 2 }, "end": { - "line": 26, - "column": 32 + "line": 35, + "column": 3 } } }, { "type": { - "label": ",", + "label": "yield", + "keyword": "yield", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5200,16 +7360,17 @@ "binop": null, "updateContext": null }, - "start": 1039, - "end": 1040, + "value": "yield", + "start": 1309, + "end": 1314, "loc": { "start": { - "line": 26, - "column": 32 + "line": 37, + "column": 2 }, "end": { - "line": 26, - "column": 33 + "line": 37, + "column": 7 } } }, @@ -5226,16 +7387,16 @@ "binop": null }, "value": "root", - "start": 1041, - "end": 1045, + "start": 1315, + "end": 1319, "loc": { "start": { - "line": 26, - "column": 34 + "line": 37, + "column": 8 }, "end": { - "line": 26, - "column": 38 + "line": 37, + "column": 12 } } }, @@ -5252,16 +7413,16 @@ "binop": null, "updateContext": null }, - "start": 1045, - "end": 1046, + "start": 1319, + "end": 1320, "loc": { "start": { - "line": 26, - "column": 38 + "line": 37, + "column": 12 }, "end": { - "line": 26, - "column": 39 + "line": 37, + "column": 13 } } }, @@ -5277,23 +7438,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1046, - "end": 1050, + "value": "key", + "start": 1320, + "end": 1323, "loc": { "start": { - "line": 26, - "column": 39 + "line": 37, + "column": 13 }, "end": { - "line": 26, - "column": 43 + "line": 37, + "column": 16 } } }, { "type": { - "label": ",", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5304,49 +7465,24 @@ "binop": null, "updateContext": null }, - "start": 1050, - "end": 1051, + "start": 1323, + "end": 1324, "loc": { "start": { - "line": 26, - "column": 43 + "line": 37, + "column": 16 }, "end": { - "line": 26, - "column": 44 + "line": 37, + "column": 17 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1052, - "end": 1056, - "loc": { - "start": { - "line": 26, - "column": 45 - }, - "end": { - "line": 26, - "column": 49 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5356,23 +7492,24 @@ "binop": null, "updateContext": null }, - "start": 1056, - "end": 1057, + "value": "if", + "start": 1327, + "end": 1329, "loc": { "start": { - "line": 26, - "column": 49 + "line": 38, + "column": 2 }, "end": { - "line": 26, - "column": 50 + "line": 38, + "column": 4 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5381,77 +7518,77 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1058, - "end": 1063, + "start": 1330, + "end": 1331, "loc": { "start": { - "line": 26, - "column": 51 + "line": 38, + "column": 5 }, "end": { - "line": 26, - "column": 56 + "line": 38, + "column": 6 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "prefix", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": false, + "prefix": true, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1063, - "end": 1064, + "value": "!", + "start": 1331, + "end": 1332, "loc": { "start": { - "line": 26, - "column": 56 + "line": 38, + "column": 6 }, "end": { - "line": 26, - "column": 57 + "line": 38, + "column": 7 } } }, { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1064, - "end": 1065, + "value": "root", + "start": 1332, + "end": 1336, "loc": { "start": { - "line": 26, - "column": 57 + "line": 38, + "column": 7 }, "end": { - "line": 26, - "column": 58 + "line": 38, + "column": 11 } } }, { "type": { - "label": "yield", - "keyword": "yield", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5460,17 +7597,16 @@ "binop": null, "updateContext": null }, - "value": "yield", - "start": 1068, - "end": 1073, + "start": 1336, + "end": 1337, "loc": { "start": { - "line": 27, - "column": 2 + "line": 38, + "column": 11 }, "end": { - "line": 27, - "column": 7 + "line": 38, + "column": 12 } } }, @@ -5486,17 +7622,17 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 1074, - "end": 1078, + "value": "right", + "start": 1337, + "end": 1342, "loc": { "start": { - "line": 27, - "column": 8 + "line": 38, + "column": 12 }, "end": { - "line": 27, - "column": 12 + "line": 38, + "column": 17 } } }, @@ -5513,16 +7649,16 @@ "binop": null, "updateContext": null }, - "start": 1078, - "end": 1079, + "start": 1342, + "end": 1343, "loc": { "start": { - "line": 27, - "column": 12 + "line": 38, + "column": 17 }, "end": { - "line": 27, - "column": 13 + "line": 38, + "column": 18 } } }, @@ -5538,50 +7674,48 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 1079, - "end": 1082, + "value": "isLeaf", + "start": 1343, + "end": 1349, "loc": { "start": { - "line": 27, - "column": 13 + "line": 38, + "column": 18 }, "end": { - "line": 27, - "column": 16 + "line": 38, + "column": 24 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1082, - "end": 1083, + "start": 1349, + "end": 1350, "loc": { "start": { - "line": 27, - "column": 16 + "line": 38, + "column": 24 }, "end": { - "line": 27, - "column": 17 + "line": 38, + "column": 25 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -5589,28 +7723,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1086, - "end": 1088, + "start": 1350, + "end": 1351, "loc": { "start": { - "line": 28, - "column": 2 + "line": 38, + "column": 25 }, "end": { - "line": 28, - "column": 4 + "line": 38, + "column": 26 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5618,43 +7750,41 @@ "postfix": false, "binop": null }, - "start": 1089, - "end": 1090, + "start": 1351, + "end": 1352, "loc": { "start": { - "line": 28, - "column": 5 + "line": 38, + "column": 26 }, "end": { - "line": 28, - "column": 6 + "line": 38, + "column": 27 } } }, { "type": { - "label": "prefix", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": true, + "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "!", - "start": 1090, - "end": 1091, + "start": 1353, + "end": 1354, "loc": { "start": { - "line": 28, - "column": 6 + "line": 38, + "column": 28 }, "end": { - "line": 28, - "column": 7 + "line": 38, + "column": 29 } } }, @@ -5670,43 +7800,42 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 1091, - "end": 1095, + "value": "assert", + "start": 1358, + "end": 1364, "loc": { "start": { - "line": 28, - "column": 7 + "line": 39, + "column": 3 }, "end": { - "line": 28, - "column": 11 + "line": 39, + "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1095, - "end": 1096, + "start": 1364, + "end": 1365, "loc": { "start": { - "line": 28, - "column": 11 + "line": 39, + "column": 9 }, "end": { - "line": 28, - "column": 12 + "line": 39, + "column": 10 } } }, @@ -5722,17 +7851,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1096, - "end": 1101, + "value": "root", + "start": 1365, + "end": 1369, "loc": { "start": { - "line": 28, - "column": 12 + "line": 39, + "column": 10 }, "end": { - "line": 28, - "column": 17 + "line": 39, + "column": 14 } } }, @@ -5749,16 +7878,16 @@ "binop": null, "updateContext": null }, - "start": 1101, - "end": 1102, + "start": 1369, + "end": 1370, "loc": { "start": { - "line": 28, - "column": 17 + "line": 39, + "column": 14 }, "end": { - "line": 28, - "column": 18 + "line": 39, + "column": 15 } } }, @@ -5774,24 +7903,52 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 1102, - "end": 1108, + "value": "right", + "start": 1370, + "end": 1375, "loc": { "start": { - "line": 28, - "column": 18 + "line": 39, + "column": 15 }, "end": { - "line": 28, - "column": 24 + "line": 39, + "column": 20 } } }, { "type": { - "label": "(", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 1376, + "end": 1386, + "loc": { + "start": { + "line": 39, + "column": 21 + }, + "end": { + "line": 39, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5800,16 +7957,17 @@ "postfix": false, "binop": null }, - "start": 1108, - "end": 1109, + "value": "Node", + "start": 1387, + "end": 1391, "loc": { "start": { - "line": 28, - "column": 24 + "line": 39, + "column": 32 }, "end": { - "line": 28, - "column": 25 + "line": 39, + "column": 36 } } }, @@ -5825,41 +7983,42 @@ "postfix": false, "binop": null }, - "start": 1109, - "end": 1110, + "start": 1391, + "end": 1392, "loc": { "start": { - "line": 28, - "column": 25 + "line": 39, + "column": 36 }, "end": { - "line": 28, - "column": 26 + "line": 39, + "column": 37 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1110, - "end": 1111, + "start": 1392, + "end": 1393, "loc": { "start": { - "line": 28, - "column": 26 + "line": 39, + "column": 37 }, "end": { - "line": 28, - "column": 27 + "line": 39, + "column": 38 } } }, @@ -5878,15 +8037,15 @@ "updateContext": null }, "value": "yield", - "start": 1115, - "end": 1120, + "start": 1397, + "end": 1402, "loc": { "start": { - "line": 29, + "line": 40, "column": 3 }, "end": { - "line": 29, + "line": 40, "column": 8 } } @@ -5905,15 +8064,15 @@ "updateContext": null }, "value": "*", - "start": 1120, - "end": 1121, + "start": 1402, + "end": 1403, "loc": { "start": { - "line": 29, + "line": 40, "column": 8 }, "end": { - "line": 29, + "line": 40, "column": 9 } } @@ -5931,15 +8090,15 @@ "binop": null }, "value": "rangetraversal", - "start": 1122, - "end": 1136, + "start": 1404, + "end": 1418, "loc": { "start": { - "line": 29, + "line": 40, "column": 10 }, "end": { - "line": 29, + "line": 40, "column": 24 } } @@ -5956,15 +8115,15 @@ "postfix": false, "binop": null }, - "start": 1136, - "end": 1137, + "start": 1418, + "end": 1419, "loc": { "start": { - "line": 29, + "line": 40, "column": 24 }, "end": { - "line": 29, + "line": 40, "column": 25 } } @@ -5982,15 +8141,15 @@ "binop": null }, "value": "compare", - "start": 1137, - "end": 1144, + "start": 1419, + "end": 1426, "loc": { "start": { - "line": 29, + "line": 40, "column": 25 }, "end": { - "line": 29, + "line": 40, "column": 32 } } @@ -6008,15 +8167,15 @@ "binop": null, "updateContext": null }, - "start": 1144, - "end": 1145, + "start": 1426, + "end": 1427, "loc": { "start": { - "line": 29, + "line": 40, "column": 32 }, "end": { - "line": 29, + "line": 40, "column": 33 } } @@ -6034,15 +8193,15 @@ "binop": null }, "value": "root", - "start": 1146, - "end": 1150, + "start": 1428, + "end": 1432, "loc": { "start": { - "line": 29, + "line": 40, "column": 34 }, "end": { - "line": 29, + "line": 40, "column": 38 } } @@ -6060,15 +8219,15 @@ "binop": null, "updateContext": null }, - "start": 1150, - "end": 1151, + "start": 1432, + "end": 1433, "loc": { "start": { - "line": 29, + "line": 40, "column": 38 }, "end": { - "line": 29, + "line": 40, "column": 39 } } @@ -6086,15 +8245,15 @@ "binop": null }, "value": "right", - "start": 1151, - "end": 1156, + "start": 1433, + "end": 1438, "loc": { "start": { - "line": 29, + "line": 40, "column": 39 }, "end": { - "line": 29, + "line": 40, "column": 44 } } @@ -6112,15 +8271,15 @@ "binop": null, "updateContext": null }, - "start": 1156, - "end": 1157, + "start": 1438, + "end": 1439, "loc": { "start": { - "line": 29, + "line": 40, "column": 44 }, "end": { - "line": 29, + "line": 40, "column": 45 } } @@ -6138,15 +8297,15 @@ "binop": null }, "value": "left", - "start": 1158, - "end": 1162, + "start": 1440, + "end": 1444, "loc": { "start": { - "line": 29, + "line": 40, "column": 46 }, "end": { - "line": 29, + "line": 40, "column": 50 } } @@ -6164,15 +8323,15 @@ "binop": null, "updateContext": null }, - "start": 1162, - "end": 1163, + "start": 1444, + "end": 1445, "loc": { "start": { - "line": 29, + "line": 40, "column": 50 }, "end": { - "line": 29, + "line": 40, "column": 51 } } @@ -6190,15 +8349,15 @@ "binop": null }, "value": "right", - "start": 1164, - "end": 1169, + "start": 1446, + "end": 1451, "loc": { "start": { - "line": 29, + "line": 40, "column": 52 }, "end": { - "line": 29, + "line": 40, "column": 57 } } @@ -6215,15 +8374,15 @@ "postfix": false, "binop": null }, - "start": 1169, - "end": 1170, + "start": 1451, + "end": 1452, "loc": { "start": { - "line": 29, + "line": 40, "column": 57 }, "end": { - "line": 29, + "line": 40, "column": 58 } } @@ -6241,15 +8400,15 @@ "binop": null, "updateContext": null }, - "start": 1170, - "end": 1171, + "start": 1452, + "end": 1453, "loc": { "start": { - "line": 29, + "line": 40, "column": 58 }, "end": { - "line": 29, + "line": 40, "column": 59 } } @@ -6266,15 +8425,40 @@ "postfix": false, "binop": null }, - "start": 1173, - "end": 1174, + "start": 1456, + "end": 1457, "loc": { "start": { - "line": 30, + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 3 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1459, + "end": 1460, + "loc": { + "start": { + "line": 42, "column": 1 }, "end": { - "line": 30, + "line": 42, "column": 2 } } @@ -6291,15 +8475,15 @@ "postfix": false, "binop": null }, - "start": 1175, - "end": 1176, + "start": 1461, + "end": 1462, "loc": { "start": { - "line": 31, + "line": 43, "column": 0 }, "end": { - "line": 31, + "line": 43, "column": 1 } } @@ -6317,15 +8501,15 @@ "binop": null, "updateContext": null }, - "start": 1177, - "end": 1177, + "start": 1463, + "end": 1463, "loc": { "start": { - "line": 32, + "line": 44, "column": 0 }, "end": { - "line": 32, + "line": 44, "column": 0 } } diff --git a/ast/source/adt/Leaf.js.json b/ast/source/types/Leaf.js.json similarity index 57% rename from ast/source/adt/Leaf.js.json rename to ast/source/types/Leaf.js.json index 2df2f8d..845740b 100644 --- a/ast/source/adt/Leaf.js.json +++ b/ast/source/types/Leaf.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 446, + "end": 609, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 28, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 446, + "end": 609, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 28, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 40, + "end": 28, "loc": { "start": { "line": 1, @@ -39,53 +39,105 @@ }, "end": { "line": 1, - "column": 40 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, + "type": "ImportDefaultSpecifier", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 } }, - "imported": { + "local": { "type": "Identifier", - "start": 8, + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, "column": 13 }, - "identifierName": "BLACK" + "identifierName": "assert" }, - "name": "BLACK" + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } }, "local": { "type": "Identifier", - "start": 8, - "end": 13, + "start": 36, + "end": 41, "loc": { "start": { - "line": 1, - "column": 8 + "line": 2, + "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 2, + "column": 12 }, "identifierName": "BLACK" }, @@ -95,16 +147,16 @@ ], "source": { "type": "StringLiteral", - "start": 20, - "end": 39, + "start": 47, + "end": 66, "loc": { "start": { - "line": 1, - "column": 20 + "line": 2, + "column": 18 }, "end": { - "line": 1, - "column": 39 + "line": 2, + "column": 37 } }, "extra": { @@ -112,20 +164,89 @@ "raw": "'../color/BLACK.js'" }, "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 68, + "end": 97, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 85, + "end": 96, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 28 + } + }, + "extra": { + "rawValue": "./Node.js", + "raw": "'./Node.js'" + }, + "value": "./Node.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", - "start": 42, - "end": 164, + "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", + "start": 99, + "end": 196, "loc": { "start": { - "line": 3, + "line": 5, "column": 0 }, "end": { - "line": 9, + "line": 10, "column": 3 } } @@ -133,47 +254,45 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 165, - "end": 242, + "type": "ExportDefaultDeclaration", + "start": 197, + "end": 405, "loc": { "start": { - "line": 10, + "line": 11, "column": 0 }, "end": { - "line": 13, + "line": 17, "column": 1 } }, - "specifiers": [], - "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 172, - "end": 242, + "start": 212, + "end": 405, "loc": { "start": { - "line": 10, - "column": 7 + "line": 11, + "column": 15 }, "end": { - "line": 13, + "line": 17, "column": 1 } }, "id": { "type": "Identifier", - "start": 181, - "end": 185, + "start": 221, + "end": 225, "loc": { "start": { - "line": 10, - "column": 16 + "line": 11, + "column": 24 }, "end": { - "line": 10, - "column": 20 + "line": 11, + "column": 28 }, "identifierName": "Leaf" }, @@ -186,16 +305,16 @@ "params": [ { "type": "Identifier", - "start": 186, - "end": 192, + "start": 226, + "end": 232, "loc": { "start": { - "line": 10, - "column": 21 + "line": 11, + "column": 29 }, "end": { - "line": 10, - "column": 27 + "line": 11, + "column": 35 }, "identifierName": "parent" }, @@ -204,210 +323,387 @@ ], "body": { "type": "BlockStatement", - "start": 194, - "end": 242, + "start": 234, + "end": 405, "loc": { "start": { - "line": 10, - "column": 29 + "line": 11, + "column": 37 }, "end": { - "line": 13, + "line": 17, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 197, - "end": 217, + "start": 237, + "end": 268, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 237, + "end": 267, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 237, + "end": 243, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 12, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 244, + "end": 266, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 244, + "end": 250, + "loc": { + "start": { + "line": 12, + "column": 8 + }, + "end": { + "line": 12, + "column": 14 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 262, + "end": 266, + "loc": { + "start": { + "line": 12, + "column": 26 + }, + "end": { + "line": 12, + "column": 30 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "* @constant {number} The color of the node. ", + "start": 270, + "end": 318, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 49 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 320, + "end": 340, "loc": { "start": { - "line": 11, + "line": 14, "column": 1 }, "end": { - "line": 11, + "line": 14, "column": 21 } }, "expression": { "type": "AssignmentExpression", - "start": 197, - "end": 216, + "start": 320, + "end": 339, "loc": { "start": { - "line": 11, + "line": 14, "column": 1 }, "end": { - "line": 11, + "line": 14, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 197, - "end": 208, + "start": 320, + "end": 331, "loc": { "start": { - "line": 11, + "line": 14, "column": 1 }, "end": { - "line": 11, + "line": 14, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 197, - "end": 201, + "start": 320, + "end": 324, "loc": { "start": { - "line": 11, + "line": 14, "column": 1 }, "end": { - "line": 11, + "line": 14, "column": 5 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 202, - "end": 208, + "start": 325, + "end": 331, "loc": { "start": { - "line": 11, + "line": 14, "column": 6 }, "end": { - "line": 11, + "line": 14, "column": 12 }, "identifierName": "_color" }, "name": "_color" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "Identifier", - "start": 211, - "end": 216, + "start": 334, + "end": 339, "loc": { "start": { - "line": 11, + "line": 14, "column": 15 }, "end": { - "line": 11, + "line": 14, "column": 20 }, "identifierName": "BLACK" }, "name": "BLACK" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @constant {number} The color of the node. ", + "start": 270, + "end": 318, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 49 + } + } } - } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node} The parent node. ", + "start": 342, + "end": 380, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 39 + } + } + } + ] }, { "type": "ExpressionStatement", - "start": 219, - "end": 240, + "start": 382, + "end": 403, "loc": { "start": { - "line": 12, + "line": 16, "column": 1 }, "end": { - "line": 12, + "line": 16, "column": 22 } }, "expression": { "type": "AssignmentExpression", - "start": 219, - "end": 239, + "start": 382, + "end": 402, "loc": { "start": { - "line": 12, + "line": 16, "column": 1 }, "end": { - "line": 12, + "line": 16, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 219, - "end": 230, + "start": 382, + "end": 393, "loc": { "start": { - "line": 12, + "line": 16, "column": 1 }, "end": { - "line": 12, + "line": 16, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 219, - "end": 223, + "start": 382, + "end": 386, "loc": { "start": { - "line": 12, + "line": 16, "column": 1 }, "end": { - "line": 12, + "line": 16, "column": 5 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 224, - "end": 230, + "start": 387, + "end": 393, "loc": { "start": { - "line": 12, + "line": 16, "column": 6 }, "end": { - "line": 12, + "line": 16, "column": 12 }, "identifierName": "parent" }, "name": "parent" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "Identifier", - "start": 233, - "end": 239, + "start": 396, + "end": 402, "loc": { "start": { - "line": 12, + "line": 16, "column": 15 }, "end": { - "line": 12, + "line": 16, "column": 21 }, "identifierName": "parent" }, "name": "parent" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node} The parent node. ", + "start": 342, + "end": 380, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 39 + } + } } - } + ] } ], "directives": [], @@ -416,16 +712,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", - "start": 42, - "end": 164, + "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", + "start": 99, + "end": 196, "loc": { "start": { - "line": 3, + "line": 5, "column": 0 }, "end": { - "line": 9, + "line": 10, "column": 3 } } @@ -435,15 +731,15 @@ { "type": "CommentBlock", "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 244, - "end": 390, + "start": 407, + "end": 553, "loc": { "start": { - "line": 15, + "line": 19, "column": 0 }, "end": { - "line": 20, + "line": 24, "column": 3 } } @@ -453,16 +749,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", - "start": 42, - "end": 164, + "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", + "start": 99, + "end": 196, "loc": { "start": { - "line": 3, + "line": 5, "column": 0 }, "end": { - "line": 9, + "line": 10, "column": 3 } } @@ -472,15 +768,15 @@ { "type": "CommentBlock", "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 244, - "end": 390, + "start": 407, + "end": 553, "loc": { "start": { - "line": 15, + "line": 19, "column": 0 }, "end": { - "line": 20, + "line": 24, "column": 3 } } @@ -489,72 +785,72 @@ }, { "type": "ExpressionStatement", - "start": 391, - "end": 445, + "start": 554, + "end": 608, "loc": { "start": { - "line": 21, + "line": 25, "column": 0 }, "end": { - "line": 23, + "line": 27, "column": 2 } }, "expression": { "type": "AssignmentExpression", - "start": 391, - "end": 444, + "start": 554, + "end": 607, "loc": { "start": { - "line": 21, + "line": 25, "column": 0 }, "end": { - "line": 23, + "line": 27, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 391, - "end": 412, + "start": 554, + "end": 575, "loc": { "start": { - "line": 21, + "line": 25, "column": 0 }, "end": { - "line": 21, + "line": 25, "column": 21 } }, "object": { "type": "MemberExpression", - "start": 391, - "end": 405, + "start": 554, + "end": 568, "loc": { "start": { - "line": 21, + "line": 25, "column": 0 }, "end": { - "line": 21, + "line": 25, "column": 14 } }, "object": { "type": "Identifier", - "start": 391, - "end": 395, + "start": 554, + "end": 558, "loc": { "start": { - "line": 21, + "line": 25, "column": 0 }, "end": { - "line": 21, + "line": 25, "column": 4 }, "identifierName": "Leaf" @@ -564,15 +860,15 @@ }, "property": { "type": "Identifier", - "start": 396, - "end": 405, + "start": 559, + "end": 568, "loc": { "start": { - "line": 21, + "line": 25, "column": 5 }, "end": { - "line": 21, + "line": 25, "column": 14 }, "identifierName": "prototype" @@ -584,15 +880,15 @@ }, "property": { "type": "Identifier", - "start": 406, - "end": 412, + "start": 569, + "end": 575, "loc": { "start": { - "line": 21, + "line": 25, "column": 15 }, "end": { - "line": 21, + "line": 25, "column": 21 }, "identifierName": "isLeaf" @@ -604,29 +900,29 @@ }, "right": { "type": "FunctionExpression", - "start": 415, - "end": 444, + "start": 578, + "end": 607, "loc": { "start": { - "line": 21, + "line": 25, "column": 24 }, "end": { - "line": 23, + "line": 27, "column": 1 } }, "id": { "type": "Identifier", - "start": 406, - "end": 412, + "start": 569, + "end": 575, "loc": { "start": { - "line": 21, + "line": 25, "column": 15 }, "end": { - "line": 21, + "line": 25, "column": 21 }, "identifierName": "isLeaf" @@ -639,44 +935,44 @@ "params": [], "body": { "type": "BlockStatement", - "start": 427, - "end": 444, + "start": 590, + "end": 607, "loc": { "start": { - "line": 21, + "line": 25, "column": 36 }, "end": { - "line": 23, + "line": 27, "column": 1 } }, "body": [ { "type": "ReturnStatement", - "start": 430, - "end": 442, + "start": 593, + "end": 605, "loc": { "start": { - "line": 22, + "line": 26, "column": 1 }, "end": { - "line": 22, + "line": 26, "column": 13 } }, "argument": { "type": "BooleanLiteral", - "start": 437, - "end": 441, + "start": 600, + "end": 604, "loc": { "start": { - "line": 22, + "line": 26, "column": 8 }, "end": { - "line": 22, + "line": 26, "column": 12 } }, @@ -693,15 +989,15 @@ { "type": "CommentBlock", "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 244, - "end": 390, + "start": 407, + "end": 553, "loc": { "start": { - "line": 15, + "line": 19, "column": 0 }, "end": { - "line": 20, + "line": 24, "column": 3 } } @@ -714,32 +1010,64 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", - "start": 42, - "end": 164, + "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", + "start": 99, + "end": 196, "loc": { "start": { - "line": 3, + "line": 5, "column": 0 }, "end": { - "line": 9, + "line": 10, "column": 3 } } }, { "type": "CommentBlock", - "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 244, - "end": 390, + "value": "* @constant {number} The color of the node. ", + "start": 270, + "end": 318, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 49 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Node} The parent node. ", + "start": 342, + "end": 380, "loc": { "start": { "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 39 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", + "start": 407, + "end": 553, + "loc": { + "start": { + "line": 19, "column": 0 }, "end": { - "line": 20, + "line": 24, "column": 3 } } @@ -760,48 +1088,467 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 80, + "end": 84, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./Node.js", + "start": 85, + "end": 96, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 96, + "end": 97, + "loc": { + "start": { + "line": 3, + "column": 28 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", + "start": 99, + "end": 196, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 10, + "column": 3 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 197, + "end": 203, "loc": { "start": { - "line": 1, + "line": 11, "column": 0 }, "end": { - "line": 1, + "line": 11, "column": 6 } } }, { "type": { - "label": "{", + "label": "default", + "keyword": "default", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 7, - "end": 8, + "value": "default", + "start": 204, + "end": 211, "loc": { "start": { - "line": 1, + "line": 11, "column": 7 }, "end": { - "line": 1, - "column": 8 + "line": 11, + "column": 14 } } }, { "type": { - "label": "name", + "label": "function", + "keyword": "function", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -811,25 +1558,25 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 8, - "end": 13, + "value": "function", + "start": 212, + "end": 220, "loc": { "start": { - "line": 1, - "column": 8 + "line": 11, + "column": 15 }, "end": { - "line": 1, - "column": 13 + "line": 11, + "column": 23 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -837,23 +1584,24 @@ "postfix": false, "binop": null }, - "start": 13, - "end": 14, + "value": "Leaf", + "start": 221, + "end": 225, "loc": { "start": { - "line": 1, - "column": 13 + "line": 11, + "column": 24 }, "end": { - "line": 1, - "column": 14 + "line": 11, + "column": 28 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -862,23 +1610,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 15, - "end": 19, + "start": 225, + "end": 226, "loc": { "start": { - "line": 1, - "column": 15 + "line": 11, + "column": 28 }, "end": { - "line": 1, - "column": 19 + "line": 11, + "column": 29 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -886,98 +1633,102 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/BLACK.js", - "start": 20, - "end": 39, + "value": "parent", + "start": 226, + "end": 232, "loc": { "start": { - "line": 1, - "column": 20 + "line": 11, + "column": 29 }, "end": { - "line": 1, - "column": 39 + "line": 11, + "column": 35 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 39, - "end": 40, + "start": 232, + "end": 233, "loc": { "start": { - "line": 1, - "column": 39 + "line": 11, + "column": 35 }, "end": { - "line": 1, - "column": 40 + "line": 11, + "column": 36 } } }, { - "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n ", - "start": 42, - "end": 164, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 234, + "end": 235, "loc": { "start": { - "line": 3, - "column": 0 + "line": 11, + "column": 37 }, "end": { - "line": 9, - "column": 3 + "line": 11, + "column": 38 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 165, - "end": 171, + "value": "assert", + "start": 237, + "end": 243, "loc": { "start": { - "line": 10, - "column": 0 + "line": 12, + "column": 1 }, "end": { - "line": 10, - "column": 6 + "line": 12, + "column": 7 } } }, { "type": { - "label": "function", - "keyword": "function", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -986,17 +1737,16 @@ "postfix": false, "binop": null }, - "value": "function", - "start": 172, - "end": 180, + "start": 243, + "end": 244, "loc": { "start": { - "line": 10, + "line": 12, "column": 7 }, "end": { - "line": 10, - "column": 15 + "line": 12, + "column": 8 } } }, @@ -1012,42 +1762,45 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 181, - "end": 185, + "value": "parent", + "start": 244, + "end": 250, "loc": { "start": { - "line": 10, - "column": 16 + "line": 12, + "column": 8 }, "end": { - "line": 10, - "column": 20 + "line": 12, + "column": 14 } } }, { "type": { - "label": "(", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 185, - "end": 186, + "value": "instanceof", + "start": 251, + "end": 261, "loc": { "start": { - "line": 10, - "column": 20 + "line": 12, + "column": 15 }, "end": { - "line": 10, - "column": 21 + "line": 12, + "column": 25 } } }, @@ -1063,17 +1816,17 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 186, - "end": 192, + "value": "Node", + "start": 262, + "end": 266, "loc": { "start": { - "line": 10, - "column": 21 + "line": 12, + "column": 26 }, "end": { - "line": 10, - "column": 27 + "line": 12, + "column": 30 } } }, @@ -1089,41 +1842,58 @@ "postfix": false, "binop": null }, - "start": 192, - "end": 193, + "start": 266, + "end": 267, "loc": { "start": { - "line": 10, - "column": 27 + "line": 12, + "column": 30 }, "end": { - "line": 10, - "column": 28 + "line": 12, + "column": 31 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 194, - "end": 195, + "start": 267, + "end": 268, "loc": { "start": { - "line": 10, - "column": 29 + "line": 12, + "column": 31 }, "end": { - "line": 10, - "column": 30 + "line": 12, + "column": 32 + } + } + }, + { + "type": "CommentBlock", + "value": "* @constant {number} The color of the node. ", + "start": 270, + "end": 318, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 49 } } }, @@ -1142,15 +1912,15 @@ "updateContext": null }, "value": "this", - "start": 197, - "end": 201, + "start": 320, + "end": 324, "loc": { "start": { - "line": 11, + "line": 14, "column": 1 }, "end": { - "line": 11, + "line": 14, "column": 5 } } @@ -1168,15 +1938,15 @@ "binop": null, "updateContext": null }, - "start": 201, - "end": 202, + "start": 324, + "end": 325, "loc": { "start": { - "line": 11, + "line": 14, "column": 5 }, "end": { - "line": 11, + "line": 14, "column": 6 } } @@ -1194,15 +1964,15 @@ "binop": null }, "value": "_color", - "start": 202, - "end": 208, + "start": 325, + "end": 331, "loc": { "start": { - "line": 11, + "line": 14, "column": 6 }, "end": { - "line": 11, + "line": 14, "column": 12 } } @@ -1221,15 +1991,15 @@ "updateContext": null }, "value": "=", - "start": 209, - "end": 210, + "start": 332, + "end": 333, "loc": { "start": { - "line": 11, + "line": 14, "column": 13 }, "end": { - "line": 11, + "line": 14, "column": 14 } } @@ -1247,15 +2017,15 @@ "binop": null }, "value": "BLACK", - "start": 211, - "end": 216, + "start": 334, + "end": 339, "loc": { "start": { - "line": 11, + "line": 14, "column": 15 }, "end": { - "line": 11, + "line": 14, "column": 20 } } @@ -1273,19 +2043,35 @@ "binop": null, "updateContext": null }, - "start": 216, - "end": 217, + "start": 339, + "end": 340, "loc": { "start": { - "line": 11, + "line": 14, "column": 20 }, "end": { - "line": 11, + "line": 14, "column": 21 } } }, + { + "type": "CommentBlock", + "value": "* @member {Node} The parent node. ", + "start": 342, + "end": 380, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 39 + } + } + }, { "type": { "label": "this", @@ -1301,15 +2087,15 @@ "updateContext": null }, "value": "this", - "start": 219, - "end": 223, + "start": 382, + "end": 386, "loc": { "start": { - "line": 12, + "line": 16, "column": 1 }, "end": { - "line": 12, + "line": 16, "column": 5 } } @@ -1327,15 +2113,15 @@ "binop": null, "updateContext": null }, - "start": 223, - "end": 224, + "start": 386, + "end": 387, "loc": { "start": { - "line": 12, + "line": 16, "column": 5 }, "end": { - "line": 12, + "line": 16, "column": 6 } } @@ -1353,15 +2139,15 @@ "binop": null }, "value": "parent", - "start": 224, - "end": 230, + "start": 387, + "end": 393, "loc": { "start": { - "line": 12, + "line": 16, "column": 6 }, "end": { - "line": 12, + "line": 16, "column": 12 } } @@ -1380,15 +2166,15 @@ "updateContext": null }, "value": "=", - "start": 231, - "end": 232, + "start": 394, + "end": 395, "loc": { "start": { - "line": 12, + "line": 16, "column": 13 }, "end": { - "line": 12, + "line": 16, "column": 14 } } @@ -1406,15 +2192,15 @@ "binop": null }, "value": "parent", - "start": 233, - "end": 239, + "start": 396, + "end": 402, "loc": { "start": { - "line": 12, + "line": 16, "column": 15 }, "end": { - "line": 12, + "line": 16, "column": 21 } } @@ -1432,15 +2218,15 @@ "binop": null, "updateContext": null }, - "start": 239, - "end": 240, + "start": 402, + "end": 403, "loc": { "start": { - "line": 12, + "line": 16, "column": 21 }, "end": { - "line": 12, + "line": 16, "column": 22 } } @@ -1457,15 +2243,15 @@ "postfix": false, "binop": null }, - "start": 241, - "end": 242, + "start": 404, + "end": 405, "loc": { "start": { - "line": 13, + "line": 17, "column": 0 }, "end": { - "line": 13, + "line": 17, "column": 1 } } @@ -1473,15 +2259,15 @@ { "type": "CommentBlock", "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 244, - "end": 390, + "start": 407, + "end": 553, "loc": { "start": { - "line": 15, + "line": 19, "column": 0 }, "end": { - "line": 20, + "line": 24, "column": 3 } } @@ -1499,15 +2285,15 @@ "binop": null }, "value": "Leaf", - "start": 391, - "end": 395, + "start": 554, + "end": 558, "loc": { "start": { - "line": 21, + "line": 25, "column": 0 }, "end": { - "line": 21, + "line": 25, "column": 4 } } @@ -1525,15 +2311,15 @@ "binop": null, "updateContext": null }, - "start": 395, - "end": 396, + "start": 558, + "end": 559, "loc": { "start": { - "line": 21, + "line": 25, "column": 4 }, "end": { - "line": 21, + "line": 25, "column": 5 } } @@ -1551,15 +2337,15 @@ "binop": null }, "value": "prototype", - "start": 396, - "end": 405, + "start": 559, + "end": 568, "loc": { "start": { - "line": 21, + "line": 25, "column": 5 }, "end": { - "line": 21, + "line": 25, "column": 14 } } @@ -1577,15 +2363,15 @@ "binop": null, "updateContext": null }, - "start": 405, - "end": 406, + "start": 568, + "end": 569, "loc": { "start": { - "line": 21, + "line": 25, "column": 14 }, "end": { - "line": 21, + "line": 25, "column": 15 } } @@ -1603,15 +2389,15 @@ "binop": null }, "value": "isLeaf", - "start": 406, - "end": 412, + "start": 569, + "end": 575, "loc": { "start": { - "line": 21, + "line": 25, "column": 15 }, "end": { - "line": 21, + "line": 25, "column": 21 } } @@ -1630,15 +2416,15 @@ "updateContext": null }, "value": "=", - "start": 413, - "end": 414, + "start": 576, + "end": 577, "loc": { "start": { - "line": 21, + "line": 25, "column": 22 }, "end": { - "line": 21, + "line": 25, "column": 23 } } @@ -1657,15 +2443,15 @@ "binop": null }, "value": "function", - "start": 415, - "end": 423, + "start": 578, + "end": 586, "loc": { "start": { - "line": 21, + "line": 25, "column": 24 }, "end": { - "line": 21, + "line": 25, "column": 32 } } @@ -1682,15 +2468,15 @@ "postfix": false, "binop": null }, - "start": 424, - "end": 425, + "start": 587, + "end": 588, "loc": { "start": { - "line": 21, + "line": 25, "column": 33 }, "end": { - "line": 21, + "line": 25, "column": 34 } } @@ -1707,15 +2493,15 @@ "postfix": false, "binop": null }, - "start": 425, - "end": 426, + "start": 588, + "end": 589, "loc": { "start": { - "line": 21, + "line": 25, "column": 34 }, "end": { - "line": 21, + "line": 25, "column": 35 } } @@ -1732,15 +2518,15 @@ "postfix": false, "binop": null }, - "start": 427, - "end": 428, + "start": 590, + "end": 591, "loc": { "start": { - "line": 21, + "line": 25, "column": 36 }, "end": { - "line": 21, + "line": 25, "column": 37 } } @@ -1760,15 +2546,15 @@ "updateContext": null }, "value": "return", - "start": 430, - "end": 436, + "start": 593, + "end": 599, "loc": { "start": { - "line": 22, + "line": 26, "column": 1 }, "end": { - "line": 22, + "line": 26, "column": 7 } } @@ -1788,15 +2574,15 @@ "updateContext": null }, "value": "true", - "start": 437, - "end": 441, + "start": 600, + "end": 604, "loc": { "start": { - "line": 22, + "line": 26, "column": 8 }, "end": { - "line": 22, + "line": 26, "column": 12 } } @@ -1814,15 +2600,15 @@ "binop": null, "updateContext": null }, - "start": 441, - "end": 442, + "start": 604, + "end": 605, "loc": { "start": { - "line": 22, + "line": 26, "column": 12 }, "end": { - "line": 22, + "line": 26, "column": 13 } } @@ -1839,15 +2625,15 @@ "postfix": false, "binop": null }, - "start": 443, - "end": 444, + "start": 606, + "end": 607, "loc": { "start": { - "line": 23, + "line": 27, "column": 0 }, "end": { - "line": 23, + "line": 27, "column": 1 } } @@ -1865,15 +2651,15 @@ "binop": null, "updateContext": null }, - "start": 444, - "end": 445, + "start": 607, + "end": 608, "loc": { "start": { - "line": 23, + "line": 27, "column": 1 }, "end": { - "line": 23, + "line": 27, "column": 2 } } @@ -1891,15 +2677,15 @@ "binop": null, "updateContext": null }, - "start": 446, - "end": 446, + "start": 609, + "end": 609, "loc": { "start": { - "line": 24, + "line": 28, "column": 0 }, "end": { - "line": 24, + "line": 28, "column": 0 } } diff --git a/ast/source/adt/Node.js.json b/ast/source/types/Node.js.json similarity index 73% rename from ast/source/adt/Node.js.json rename to ast/source/types/Node.js.json index 63d5e74..b70b327 100644 --- a/ast/source/adt/Node.js.json +++ b/ast/source/types/Node.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 585, + "end": 790, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 28, + "line": 32, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 585, + "end": 790, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 28, + "line": 32, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 31, + "end": 29, "loc": { "start": { "line": 1, @@ -39,53 +39,36 @@ }, "end": { "line": 1, - "column": 31 + "column": 29 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, - "end": 12, + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 11, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 12 + "column": 11 } }, - "imported": { - "type": "Identifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - }, "local": { "type": "Identifier", - "start": 8, - "end": 12, + "start": 7, + "end": 11, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 12 + "column": 11 }, "identifierName": "Leaf" }, @@ -95,16 +78,16 @@ ], "source": { "type": "StringLiteral", - "start": 19, - "end": 30, + "start": 17, + "end": 28, "loc": { "start": { "line": 1, - "column": 19 + "column": 17 }, "end": { "line": 1, - "column": 30 + "column": 28 } }, "extra": { @@ -116,16 +99,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", - "start": 33, - "end": 223, + "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", + "start": 31, + "end": 196, "loc": { "start": { "line": 3, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -133,47 +116,45 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 224, - "end": 379, + "type": "ExportDefaultDeclaration", + "start": 197, + "end": 584, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { - "line": 17, + "line": 21, "column": 1 } }, - "specifiers": [], - "source": null, "declaration": { "type": "FunctionDeclaration", - "start": 231, - "end": 379, + "start": 212, + "end": 584, "loc": { "start": { - "line": 11, - "column": 7 + "line": 10, + "column": 15 }, "end": { - "line": 17, + "line": 21, "column": 1 } }, "id": { "type": "Identifier", - "start": 240, - "end": 244, + "start": 221, + "end": 225, "loc": { "start": { - "line": 11, - "column": 16 + "line": 10, + "column": 24 }, "end": { - "line": 11, - "column": 20 + "line": 10, + "column": 28 }, "identifierName": "Node" }, @@ -186,16 +167,16 @@ "params": [ { "type": "Identifier", - "start": 245, - "end": 250, + "start": 226, + "end": 231, "loc": { "start": { - "line": 11, - "column": 21 + "line": 10, + "column": 29 }, "end": { - "line": 11, - "column": 26 + "line": 10, + "column": 34 }, "identifierName": "color" }, @@ -203,16 +184,16 @@ }, { "type": "Identifier", - "start": 252, - "end": 255, + "start": 233, + "end": 236, "loc": { "start": { - "line": 11, - "column": 28 + "line": 10, + "column": 36 }, "end": { - "line": 11, - "column": 31 + "line": 10, + "column": 39 }, "identifierName": "key" }, @@ -221,23 +202,23 @@ ], "body": { "type": "BlockStatement", - "start": 257, - "end": 379, + "start": 238, + "end": 584, "loc": { "start": { - "line": 11, - "column": 33 + "line": 10, + "column": 41 }, "end": { - "line": 17, + "line": 21, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 260, - "end": 280, + "start": 289, + "end": 309, "loc": { "start": { "line": 12, @@ -250,8 +231,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 260, - "end": 279, + "start": 289, + "end": 308, "loc": { "start": { "line": 12, @@ -265,8 +246,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 260, - "end": 271, + "start": 289, + "end": 300, "loc": { "start": { "line": 12, @@ -279,8 +260,8 @@ }, "object": { "type": "ThisExpression", - "start": 260, - "end": 264, + "start": 289, + "end": 293, "loc": { "start": { "line": 12, @@ -290,12 +271,13 @@ "line": 12, "column": 5 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 265, - "end": 271, + "start": 294, + "end": 300, "loc": { "start": { "line": 12, @@ -309,12 +291,13 @@ }, "name": "_color" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "Identifier", - "start": 274, - "end": 279, + "start": 303, + "end": 308, "loc": { "start": { "line": 12, @@ -327,111 +310,150 @@ "identifierName": "color" }, "name": "color" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @member {number} The color of the node. ", + "start": 241, + "end": 287, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 47 + } + } } - } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node|Leaf} The left child ", + "start": 311, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 42 + } + } + } + ] }, { "type": "ExpressionStatement", - "start": 282, - "end": 309, + "start": 354, + "end": 381, "loc": { "start": { - "line": 13, + "line": 14, "column": 1 }, "end": { - "line": 13, + "line": 14, "column": 28 } }, "expression": { "type": "AssignmentExpression", - "start": 282, - "end": 308, + "start": 354, + "end": 380, "loc": { "start": { - "line": 13, + "line": 14, "column": 1 }, "end": { - "line": 13, + "line": 14, "column": 27 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 282, - "end": 291, + "start": 354, + "end": 363, "loc": { "start": { - "line": 13, + "line": 14, "column": 1 }, "end": { - "line": 13, + "line": 14, "column": 10 } }, "object": { "type": "ThisExpression", - "start": 282, - "end": 286, + "start": 354, + "end": 358, "loc": { "start": { - "line": 13, + "line": 14, "column": 1 }, "end": { - "line": 13, + "line": 14, "column": 5 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 287, - "end": 291, + "start": 359, + "end": 363, "loc": { "start": { - "line": 13, + "line": 14, "column": 6 }, "end": { - "line": 13, + "line": 14, "column": 10 }, "identifierName": "left" }, "name": "left" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "NewExpression", - "start": 294, - "end": 308, + "start": 366, + "end": 380, "loc": { "start": { - "line": 13, + "line": 14, "column": 13 }, "end": { - "line": 13, + "line": 14, "column": 27 } }, "callee": { "type": "Identifier", - "start": 298, - "end": 302, + "start": 370, + "end": 374, "loc": { "start": { - "line": 13, + "line": 14, "column": 17 }, "end": { - "line": 13, + "line": 14, "column": 21 }, "identifierName": "Leaf" @@ -441,125 +463,164 @@ "arguments": [ { "type": "ThisExpression", - "start": 303, - "end": 307, + "start": 375, + "end": 379, "loc": { "start": { - "line": 13, + "line": 14, "column": 22 }, "end": { - "line": 13, + "line": 14, "column": 26 } } } ] + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node|Leaf} The left child ", + "start": 311, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 42 + } + } } - } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node|Leaf} The right child ", + "start": 383, + "end": 425, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 43 + } + } + } + ] }, { "type": "ExpressionStatement", - "start": 311, - "end": 339, + "start": 427, + "end": 455, "loc": { "start": { - "line": 14, + "line": 16, "column": 1 }, "end": { - "line": 14, + "line": 16, "column": 29 } }, "expression": { "type": "AssignmentExpression", - "start": 311, - "end": 338, + "start": 427, + "end": 454, "loc": { "start": { - "line": 14, + "line": 16, "column": 1 }, "end": { - "line": 14, + "line": 16, "column": 28 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 311, - "end": 321, + "start": 427, + "end": 437, "loc": { "start": { - "line": 14, + "line": 16, "column": 1 }, "end": { - "line": 14, + "line": 16, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 311, - "end": 315, + "start": 427, + "end": 431, "loc": { "start": { - "line": 14, + "line": 16, "column": 1 }, "end": { - "line": 14, + "line": 16, "column": 5 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 316, - "end": 321, + "start": 432, + "end": 437, "loc": { "start": { - "line": 14, + "line": 16, "column": 6 }, "end": { - "line": 14, + "line": 16, "column": 11 }, "identifierName": "right" }, "name": "right" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "NewExpression", - "start": 324, - "end": 338, + "start": 440, + "end": 454, "loc": { "start": { - "line": 14, + "line": 16, "column": 14 }, "end": { - "line": 14, + "line": 16, "column": 28 } }, "callee": { "type": "Identifier", - "start": 328, - "end": 332, + "start": 444, + "end": 448, "loc": { "start": { - "line": 14, + "line": 16, "column": 18 }, "end": { - "line": 14, + "line": 16, "column": 22 }, "identifierName": "Leaf" @@ -569,212 +630,309 @@ "arguments": [ { "type": "ThisExpression", - "start": 333, - "end": 337, + "start": 449, + "end": 453, "loc": { "start": { - "line": 14, + "line": 16, "column": 23 }, "end": { - "line": 14, + "line": 16, "column": 27 } } } ] + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node|Leaf} The right child ", + "start": 383, + "end": 425, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 43 + } + } } - } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node} The parent node. ", + "start": 457, + "end": 495, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 39 + } + } + } + ] }, { "type": "ExpressionStatement", - "start": 341, - "end": 360, + "start": 497, + "end": 516, "loc": { "start": { - "line": 15, + "line": 18, "column": 1 }, "end": { - "line": 15, + "line": 18, "column": 20 } }, "expression": { "type": "AssignmentExpression", - "start": 341, - "end": 359, + "start": 497, + "end": 515, "loc": { "start": { - "line": 15, + "line": 18, "column": 1 }, "end": { - "line": 15, + "line": 18, "column": 19 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 341, - "end": 352, + "start": 497, + "end": 508, "loc": { "start": { - "line": 15, + "line": 18, "column": 1 }, "end": { - "line": 15, + "line": 18, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 341, - "end": 345, + "start": 497, + "end": 501, "loc": { "start": { - "line": 15, + "line": 18, "column": 1 }, "end": { - "line": 15, + "line": 18, "column": 5 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 346, - "end": 352, + "start": 502, + "end": 508, "loc": { "start": { - "line": 15, + "line": 18, "column": 6 }, "end": { - "line": 15, + "line": 18, "column": 12 }, "identifierName": "parent" }, "name": "parent" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "NullLiteral", - "start": 355, - "end": 359, + "start": 511, + "end": 515, "loc": { "start": { - "line": 15, + "line": 18, "column": 15 }, "end": { - "line": 15, + "line": 18, "column": 19 } } + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node} The parent node. ", + "start": 457, + "end": 495, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 39 + } + } } - } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "* @member {any} The key held by this node. ", + "start": 518, + "end": 565, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 48 + } + } + } + ] }, { "type": "ExpressionStatement", - "start": 362, - "end": 377, + "start": 567, + "end": 582, "loc": { "start": { - "line": 16, + "line": 20, "column": 1 }, "end": { - "line": 16, + "line": 20, "column": 16 } }, "expression": { "type": "AssignmentExpression", - "start": 362, - "end": 376, + "start": 567, + "end": 581, "loc": { "start": { - "line": 16, + "line": 20, "column": 1 }, "end": { - "line": 16, + "line": 20, "column": 15 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 362, - "end": 370, + "start": 567, + "end": 575, "loc": { "start": { - "line": 16, + "line": 20, "column": 1 }, "end": { - "line": 16, + "line": 20, "column": 9 } }, "object": { "type": "ThisExpression", - "start": 362, - "end": 366, + "start": 567, + "end": 571, "loc": { "start": { - "line": 16, + "line": 20, "column": 1 }, "end": { - "line": 16, + "line": 20, "column": 5 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 367, - "end": 370, + "start": 572, + "end": 575, "loc": { "start": { - "line": 16, + "line": 20, "column": 6 }, "end": { - "line": 16, + "line": 20, "column": 9 }, "identifierName": "key" }, "name": "key" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "Identifier", - "start": 373, - "end": 376, + "start": 578, + "end": 581, "loc": { "start": { - "line": 16, + "line": 20, "column": 12 }, "end": { - "line": 16, + "line": 20, "column": 15 }, "identifierName": "key" }, "name": "key" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @member {any} The key held by this node. ", + "start": 518, + "end": 565, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 48 + } + } } - } + ] } ], "directives": [], @@ -783,16 +941,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", - "start": 33, - "end": 223, + "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", + "start": 31, + "end": 196, "loc": { "start": { "line": 3, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -802,15 +960,15 @@ { "type": "CommentBlock", "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 381, - "end": 528, + "start": 586, + "end": 733, "loc": { "start": { - "line": 19, + "line": 23, "column": 0 }, "end": { - "line": 24, + "line": 28, "column": 3 } } @@ -820,16 +978,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", - "start": 33, - "end": 223, + "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", + "start": 31, + "end": 196, "loc": { "start": { "line": 3, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -839,15 +997,15 @@ { "type": "CommentBlock", "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 381, - "end": 528, + "start": 586, + "end": 733, "loc": { "start": { - "line": 19, + "line": 23, "column": 0 }, "end": { - "line": 24, + "line": 28, "column": 3 } } @@ -856,72 +1014,72 @@ }, { "type": "ExpressionStatement", - "start": 529, - "end": 584, + "start": 734, + "end": 789, "loc": { "start": { - "line": 25, + "line": 29, "column": 0 }, "end": { - "line": 27, + "line": 31, "column": 2 } }, "expression": { "type": "AssignmentExpression", - "start": 529, - "end": 583, + "start": 734, + "end": 788, "loc": { "start": { - "line": 25, + "line": 29, "column": 0 }, "end": { - "line": 27, + "line": 31, "column": 1 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 529, - "end": 550, + "start": 734, + "end": 755, "loc": { "start": { - "line": 25, + "line": 29, "column": 0 }, "end": { - "line": 25, + "line": 29, "column": 21 } }, "object": { "type": "MemberExpression", - "start": 529, - "end": 543, + "start": 734, + "end": 748, "loc": { "start": { - "line": 25, + "line": 29, "column": 0 }, "end": { - "line": 25, + "line": 29, "column": 14 } }, "object": { "type": "Identifier", - "start": 529, - "end": 533, + "start": 734, + "end": 738, "loc": { "start": { - "line": 25, + "line": 29, "column": 0 }, "end": { - "line": 25, + "line": 29, "column": 4 }, "identifierName": "Node" @@ -931,15 +1089,15 @@ }, "property": { "type": "Identifier", - "start": 534, - "end": 543, + "start": 739, + "end": 748, "loc": { "start": { - "line": 25, + "line": 29, "column": 5 }, "end": { - "line": 25, + "line": 29, "column": 14 }, "identifierName": "prototype" @@ -951,15 +1109,15 @@ }, "property": { "type": "Identifier", - "start": 544, - "end": 550, + "start": 749, + "end": 755, "loc": { "start": { - "line": 25, + "line": 29, "column": 15 }, "end": { - "line": 25, + "line": 29, "column": 21 }, "identifierName": "isLeaf" @@ -971,29 +1129,29 @@ }, "right": { "type": "FunctionExpression", - "start": 553, - "end": 583, + "start": 758, + "end": 788, "loc": { "start": { - "line": 25, + "line": 29, "column": 24 }, "end": { - "line": 27, + "line": 31, "column": 1 } }, "id": { "type": "Identifier", - "start": 544, - "end": 550, + "start": 749, + "end": 755, "loc": { "start": { - "line": 25, + "line": 29, "column": 15 }, "end": { - "line": 25, + "line": 29, "column": 21 }, "identifierName": "isLeaf" @@ -1006,44 +1164,44 @@ "params": [], "body": { "type": "BlockStatement", - "start": 565, - "end": 583, + "start": 770, + "end": 788, "loc": { "start": { - "line": 25, + "line": 29, "column": 36 }, "end": { - "line": 27, + "line": 31, "column": 1 } }, "body": [ { "type": "ReturnStatement", - "start": 568, - "end": 581, + "start": 773, + "end": 786, "loc": { "start": { - "line": 26, + "line": 30, "column": 1 }, "end": { - "line": 26, + "line": 30, "column": 14 } }, "argument": { "type": "BooleanLiteral", - "start": 575, - "end": 580, + "start": 780, + "end": 785, "loc": { "start": { - "line": 26, + "line": 30, "column": 8 }, "end": { - "line": 26, + "line": 30, "column": 13 } }, @@ -1060,15 +1218,15 @@ { "type": "CommentBlock", "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 381, - "end": 528, + "start": 586, + "end": 733, "loc": { "start": { - "line": 19, + "line": 23, "column": 0 }, "end": { - "line": 24, + "line": 28, "column": 3 } } @@ -1081,32 +1239,112 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", - "start": 33, - "end": 223, + "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", + "start": 31, + "end": 196, "loc": { "start": { "line": 3, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } }, { "type": "CommentBlock", - "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 381, - "end": 528, + "value": "* @member {number} The color of the node. ", + "start": 241, + "end": 287, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 47 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Node|Leaf} The left child ", + "start": 311, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 42 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Node|Leaf} The right child ", + "start": 383, + "end": 425, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 43 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Node} The parent node. ", + "start": 457, + "end": 495, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 39 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {any} The key held by this node. ", + "start": 518, + "end": 565, "loc": { "start": { "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 48 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", + "start": 586, + "end": 733, + "loc": { + "start": { + "line": 23, "column": 0 }, "end": { - "line": 24, + "line": 28, "column": 3 } } @@ -1141,31 +1379,6 @@ } } }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 8 - } - } - }, { "type": { "label": "name", @@ -1179,41 +1392,16 @@ "binop": null }, "value": "Leaf", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 12, - "end": 13, + "start": 7, + "end": 11, "loc": { "start": { "line": 1, - "column": 12 + "column": 7 }, "end": { "line": 1, - "column": 13 + "column": 11 } } }, @@ -1230,16 +1418,16 @@ "binop": null }, "value": "from", - "start": 14, - "end": 18, + "start": 12, + "end": 16, "loc": { "start": { "line": 1, - "column": 14 + "column": 12 }, "end": { "line": 1, - "column": 18 + "column": 16 } } }, @@ -1257,16 +1445,16 @@ "updateContext": null }, "value": "./Leaf.js", - "start": 19, - "end": 30, + "start": 17, + "end": 28, "loc": { "start": { "line": 1, - "column": 19 + "column": 17 }, "end": { "line": 1, - "column": 30 + "column": 28 } } }, @@ -1283,31 +1471,31 @@ "binop": null, "updateContext": null }, - "start": 30, - "end": 31, + "start": 28, + "end": 29, "loc": { "start": { "line": 1, - "column": 30 + "column": 28 }, "end": { "line": 1, - "column": 31 + "column": 29 } } }, { "type": "CommentBlock", - "value": "*\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n ", - "start": 33, - "end": 223, + "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", + "start": 31, + "end": 196, "loc": { "start": { "line": 3, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -1327,19 +1515,47 @@ "updateContext": null }, "value": "export", - "start": 224, - "end": 230, + "start": 197, + "end": 203, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { - "line": 11, + "line": 10, "column": 6 } } }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 204, + "end": 211, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 14 + } + } + }, { "type": { "label": "function", @@ -1354,16 +1570,16 @@ "binop": null }, "value": "function", - "start": 231, - "end": 239, + "start": 212, + "end": 220, "loc": { "start": { - "line": 11, - "column": 7 + "line": 10, + "column": 15 }, "end": { - "line": 11, - "column": 15 + "line": 10, + "column": 23 } } }, @@ -1380,16 +1596,16 @@ "binop": null }, "value": "Node", - "start": 240, - "end": 244, + "start": 221, + "end": 225, "loc": { "start": { - "line": 11, - "column": 16 + "line": 10, + "column": 24 }, "end": { - "line": 11, - "column": 20 + "line": 10, + "column": 28 } } }, @@ -1405,16 +1621,16 @@ "postfix": false, "binop": null }, - "start": 244, - "end": 245, + "start": 225, + "end": 226, "loc": { "start": { - "line": 11, - "column": 20 + "line": 10, + "column": 28 }, "end": { - "line": 11, - "column": 21 + "line": 10, + "column": 29 } } }, @@ -1431,16 +1647,16 @@ "binop": null }, "value": "color", - "start": 245, - "end": 250, + "start": 226, + "end": 231, "loc": { "start": { - "line": 11, - "column": 21 + "line": 10, + "column": 29 }, "end": { - "line": 11, - "column": 26 + "line": 10, + "column": 34 } } }, @@ -1457,16 +1673,16 @@ "binop": null, "updateContext": null }, - "start": 250, - "end": 251, + "start": 231, + "end": 232, "loc": { "start": { - "line": 11, - "column": 26 + "line": 10, + "column": 34 }, "end": { - "line": 11, - "column": 27 + "line": 10, + "column": 35 } } }, @@ -1483,16 +1699,16 @@ "binop": null }, "value": "key", - "start": 252, - "end": 255, + "start": 233, + "end": 236, "loc": { "start": { - "line": 11, - "column": 28 + "line": 10, + "column": 36 }, "end": { - "line": 11, - "column": 31 + "line": 10, + "column": 39 } } }, @@ -1508,16 +1724,16 @@ "postfix": false, "binop": null }, - "start": 255, - "end": 256, + "start": 236, + "end": 237, "loc": { "start": { - "line": 11, - "column": 31 + "line": 10, + "column": 39 }, "end": { - "line": 11, - "column": 32 + "line": 10, + "column": 40 } } }, @@ -1533,16 +1749,32 @@ "postfix": false, "binop": null }, - "start": 257, - "end": 258, + "start": 238, + "end": 239, + "loc": { + "start": { + "line": 10, + "column": 41 + }, + "end": { + "line": 10, + "column": 42 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {number} The color of the node. ", + "start": 241, + "end": 287, "loc": { "start": { "line": 11, - "column": 33 + "column": 1 }, "end": { "line": 11, - "column": 34 + "column": 47 } } }, @@ -1561,8 +1793,8 @@ "updateContext": null }, "value": "this", - "start": 260, - "end": 264, + "start": 289, + "end": 293, "loc": { "start": { "line": 12, @@ -1587,8 +1819,8 @@ "binop": null, "updateContext": null }, - "start": 264, - "end": 265, + "start": 293, + "end": 294, "loc": { "start": { "line": 12, @@ -1613,8 +1845,8 @@ "binop": null }, "value": "_color", - "start": 265, - "end": 271, + "start": 294, + "end": 300, "loc": { "start": { "line": 12, @@ -1640,8 +1872,8 @@ "updateContext": null }, "value": "=", - "start": 272, - "end": 273, + "start": 301, + "end": 302, "loc": { "start": { "line": 12, @@ -1666,8 +1898,8 @@ "binop": null }, "value": "color", - "start": 274, - "end": 279, + "start": 303, + "end": 308, "loc": { "start": { "line": 12, @@ -1692,8 +1924,8 @@ "binop": null, "updateContext": null }, - "start": 279, - "end": 280, + "start": 308, + "end": 309, "loc": { "start": { "line": 12, @@ -1705,6 +1937,22 @@ } } }, + { + "type": "CommentBlock", + "value": "* @member {Node|Leaf} The left child ", + "start": 311, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 42 + } + } + }, { "type": { "label": "this", @@ -1720,15 +1968,15 @@ "updateContext": null }, "value": "this", - "start": 282, - "end": 286, + "start": 354, + "end": 358, "loc": { "start": { - "line": 13, + "line": 14, "column": 1 }, "end": { - "line": 13, + "line": 14, "column": 5 } } @@ -1746,15 +1994,15 @@ "binop": null, "updateContext": null }, - "start": 286, - "end": 287, + "start": 358, + "end": 359, "loc": { "start": { - "line": 13, + "line": 14, "column": 5 }, "end": { - "line": 13, + "line": 14, "column": 6 } } @@ -1772,15 +2020,15 @@ "binop": null }, "value": "left", - "start": 287, - "end": 291, + "start": 359, + "end": 363, "loc": { "start": { - "line": 13, + "line": 14, "column": 6 }, "end": { - "line": 13, + "line": 14, "column": 10 } } @@ -1799,15 +2047,15 @@ "updateContext": null }, "value": "=", - "start": 292, - "end": 293, + "start": 364, + "end": 365, "loc": { "start": { - "line": 13, + "line": 14, "column": 11 }, "end": { - "line": 13, + "line": 14, "column": 12 } } @@ -1827,15 +2075,15 @@ "updateContext": null }, "value": "new", - "start": 294, - "end": 297, + "start": 366, + "end": 369, "loc": { "start": { - "line": 13, + "line": 14, "column": 13 }, "end": { - "line": 13, + "line": 14, "column": 16 } } @@ -1853,15 +2101,15 @@ "binop": null }, "value": "Leaf", - "start": 298, - "end": 302, + "start": 370, + "end": 374, "loc": { "start": { - "line": 13, + "line": 14, "column": 17 }, "end": { - "line": 13, + "line": 14, "column": 21 } } @@ -1878,15 +2126,15 @@ "postfix": false, "binop": null }, - "start": 302, - "end": 303, + "start": 374, + "end": 375, "loc": { "start": { - "line": 13, + "line": 14, "column": 21 }, "end": { - "line": 13, + "line": 14, "column": 22 } } @@ -1906,15 +2154,15 @@ "updateContext": null }, "value": "this", - "start": 303, - "end": 307, + "start": 375, + "end": 379, "loc": { "start": { - "line": 13, + "line": 14, "column": 22 }, "end": { - "line": 13, + "line": 14, "column": 26 } } @@ -1931,15 +2179,15 @@ "postfix": false, "binop": null }, - "start": 307, - "end": 308, + "start": 379, + "end": 380, "loc": { "start": { - "line": 13, + "line": 14, "column": 26 }, "end": { - "line": 13, + "line": 14, "column": 27 } } @@ -1957,19 +2205,35 @@ "binop": null, "updateContext": null }, - "start": 308, - "end": 309, + "start": 380, + "end": 381, "loc": { "start": { - "line": 13, + "line": 14, "column": 27 }, "end": { - "line": 13, + "line": 14, "column": 28 } } }, + { + "type": "CommentBlock", + "value": "* @member {Node|Leaf} The right child ", + "start": 383, + "end": 425, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 43 + } + } + }, { "type": { "label": "this", @@ -1985,15 +2249,15 @@ "updateContext": null }, "value": "this", - "start": 311, - "end": 315, + "start": 427, + "end": 431, "loc": { "start": { - "line": 14, + "line": 16, "column": 1 }, "end": { - "line": 14, + "line": 16, "column": 5 } } @@ -2011,15 +2275,15 @@ "binop": null, "updateContext": null }, - "start": 315, - "end": 316, + "start": 431, + "end": 432, "loc": { "start": { - "line": 14, + "line": 16, "column": 5 }, "end": { - "line": 14, + "line": 16, "column": 6 } } @@ -2037,15 +2301,15 @@ "binop": null }, "value": "right", - "start": 316, - "end": 321, + "start": 432, + "end": 437, "loc": { "start": { - "line": 14, + "line": 16, "column": 6 }, "end": { - "line": 14, + "line": 16, "column": 11 } } @@ -2064,15 +2328,15 @@ "updateContext": null }, "value": "=", - "start": 322, - "end": 323, + "start": 438, + "end": 439, "loc": { "start": { - "line": 14, + "line": 16, "column": 12 }, "end": { - "line": 14, + "line": 16, "column": 13 } } @@ -2092,15 +2356,15 @@ "updateContext": null }, "value": "new", - "start": 324, - "end": 327, + "start": 440, + "end": 443, "loc": { "start": { - "line": 14, + "line": 16, "column": 14 }, "end": { - "line": 14, + "line": 16, "column": 17 } } @@ -2118,15 +2382,15 @@ "binop": null }, "value": "Leaf", - "start": 328, - "end": 332, + "start": 444, + "end": 448, "loc": { "start": { - "line": 14, + "line": 16, "column": 18 }, "end": { - "line": 14, + "line": 16, "column": 22 } } @@ -2143,15 +2407,15 @@ "postfix": false, "binop": null }, - "start": 332, - "end": 333, + "start": 448, + "end": 449, "loc": { "start": { - "line": 14, + "line": 16, "column": 22 }, "end": { - "line": 14, + "line": 16, "column": 23 } } @@ -2171,15 +2435,15 @@ "updateContext": null }, "value": "this", - "start": 333, - "end": 337, + "start": 449, + "end": 453, "loc": { "start": { - "line": 14, + "line": 16, "column": 23 }, "end": { - "line": 14, + "line": 16, "column": 27 } } @@ -2196,15 +2460,15 @@ "postfix": false, "binop": null }, - "start": 337, - "end": 338, + "start": 453, + "end": 454, "loc": { "start": { - "line": 14, + "line": 16, "column": 27 }, "end": { - "line": 14, + "line": 16, "column": 28 } } @@ -2222,19 +2486,35 @@ "binop": null, "updateContext": null }, - "start": 338, - "end": 339, + "start": 454, + "end": 455, "loc": { "start": { - "line": 14, + "line": 16, "column": 28 }, "end": { - "line": 14, + "line": 16, "column": 29 } } }, + { + "type": "CommentBlock", + "value": "* @member {Node} The parent node. ", + "start": 457, + "end": 495, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 39 + } + } + }, { "type": { "label": "this", @@ -2250,15 +2530,15 @@ "updateContext": null }, "value": "this", - "start": 341, - "end": 345, + "start": 497, + "end": 501, "loc": { "start": { - "line": 15, + "line": 18, "column": 1 }, "end": { - "line": 15, + "line": 18, "column": 5 } } @@ -2276,15 +2556,15 @@ "binop": null, "updateContext": null }, - "start": 345, - "end": 346, + "start": 501, + "end": 502, "loc": { "start": { - "line": 15, + "line": 18, "column": 5 }, "end": { - "line": 15, + "line": 18, "column": 6 } } @@ -2302,15 +2582,15 @@ "binop": null }, "value": "parent", - "start": 346, - "end": 352, + "start": 502, + "end": 508, "loc": { "start": { - "line": 15, + "line": 18, "column": 6 }, "end": { - "line": 15, + "line": 18, "column": 12 } } @@ -2329,15 +2609,15 @@ "updateContext": null }, "value": "=", - "start": 353, - "end": 354, + "start": 509, + "end": 510, "loc": { "start": { - "line": 15, + "line": 18, "column": 13 }, "end": { - "line": 15, + "line": 18, "column": 14 } } @@ -2357,15 +2637,15 @@ "updateContext": null }, "value": "null", - "start": 355, - "end": 359, + "start": 511, + "end": 515, "loc": { "start": { - "line": 15, + "line": 18, "column": 15 }, "end": { - "line": 15, + "line": 18, "column": 19 } } @@ -2383,19 +2663,35 @@ "binop": null, "updateContext": null }, - "start": 359, - "end": 360, + "start": 515, + "end": 516, "loc": { "start": { - "line": 15, + "line": 18, "column": 19 }, "end": { - "line": 15, + "line": 18, "column": 20 } } }, + { + "type": "CommentBlock", + "value": "* @member {any} The key held by this node. ", + "start": 518, + "end": 565, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 48 + } + } + }, { "type": { "label": "this", @@ -2411,15 +2707,15 @@ "updateContext": null }, "value": "this", - "start": 362, - "end": 366, + "start": 567, + "end": 571, "loc": { "start": { - "line": 16, + "line": 20, "column": 1 }, "end": { - "line": 16, + "line": 20, "column": 5 } } @@ -2437,15 +2733,15 @@ "binop": null, "updateContext": null }, - "start": 366, - "end": 367, + "start": 571, + "end": 572, "loc": { "start": { - "line": 16, + "line": 20, "column": 5 }, "end": { - "line": 16, + "line": 20, "column": 6 } } @@ -2463,15 +2759,15 @@ "binop": null }, "value": "key", - "start": 367, - "end": 370, + "start": 572, + "end": 575, "loc": { "start": { - "line": 16, + "line": 20, "column": 6 }, "end": { - "line": 16, + "line": 20, "column": 9 } } @@ -2490,15 +2786,15 @@ "updateContext": null }, "value": "=", - "start": 371, - "end": 372, + "start": 576, + "end": 577, "loc": { "start": { - "line": 16, + "line": 20, "column": 10 }, "end": { - "line": 16, + "line": 20, "column": 11 } } @@ -2516,15 +2812,15 @@ "binop": null }, "value": "key", - "start": 373, - "end": 376, + "start": 578, + "end": 581, "loc": { "start": { - "line": 16, + "line": 20, "column": 12 }, "end": { - "line": 16, + "line": 20, "column": 15 } } @@ -2542,15 +2838,15 @@ "binop": null, "updateContext": null }, - "start": 376, - "end": 377, + "start": 581, + "end": 582, "loc": { "start": { - "line": 16, + "line": 20, "column": 15 }, "end": { - "line": 16, + "line": 20, "column": 16 } } @@ -2567,15 +2863,15 @@ "postfix": false, "binop": null }, - "start": 378, - "end": 379, + "start": 583, + "end": 584, "loc": { "start": { - "line": 17, + "line": 21, "column": 0 }, "end": { - "line": 17, + "line": 21, "column": 1 } } @@ -2583,15 +2879,15 @@ { "type": "CommentBlock", "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 381, - "end": 528, + "start": 586, + "end": 733, "loc": { "start": { - "line": 19, + "line": 23, "column": 0 }, "end": { - "line": 24, + "line": 28, "column": 3 } } @@ -2609,15 +2905,15 @@ "binop": null }, "value": "Node", - "start": 529, - "end": 533, + "start": 734, + "end": 738, "loc": { "start": { - "line": 25, + "line": 29, "column": 0 }, "end": { - "line": 25, + "line": 29, "column": 4 } } @@ -2635,15 +2931,15 @@ "binop": null, "updateContext": null }, - "start": 533, - "end": 534, + "start": 738, + "end": 739, "loc": { "start": { - "line": 25, + "line": 29, "column": 4 }, "end": { - "line": 25, + "line": 29, "column": 5 } } @@ -2661,15 +2957,15 @@ "binop": null }, "value": "prototype", - "start": 534, - "end": 543, + "start": 739, + "end": 748, "loc": { "start": { - "line": 25, + "line": 29, "column": 5 }, "end": { - "line": 25, + "line": 29, "column": 14 } } @@ -2687,15 +2983,15 @@ "binop": null, "updateContext": null }, - "start": 543, - "end": 544, + "start": 748, + "end": 749, "loc": { "start": { - "line": 25, + "line": 29, "column": 14 }, "end": { - "line": 25, + "line": 29, "column": 15 } } @@ -2713,15 +3009,15 @@ "binop": null }, "value": "isLeaf", - "start": 544, - "end": 550, + "start": 749, + "end": 755, "loc": { "start": { - "line": 25, + "line": 29, "column": 15 }, "end": { - "line": 25, + "line": 29, "column": 21 } } @@ -2740,15 +3036,15 @@ "updateContext": null }, "value": "=", - "start": 551, - "end": 552, + "start": 756, + "end": 757, "loc": { "start": { - "line": 25, + "line": 29, "column": 22 }, "end": { - "line": 25, + "line": 29, "column": 23 } } @@ -2767,15 +3063,15 @@ "binop": null }, "value": "function", - "start": 553, - "end": 561, + "start": 758, + "end": 766, "loc": { "start": { - "line": 25, + "line": 29, "column": 24 }, "end": { - "line": 25, + "line": 29, "column": 32 } } @@ -2792,15 +3088,15 @@ "postfix": false, "binop": null }, - "start": 562, - "end": 563, + "start": 767, + "end": 768, "loc": { "start": { - "line": 25, + "line": 29, "column": 33 }, "end": { - "line": 25, + "line": 29, "column": 34 } } @@ -2817,15 +3113,15 @@ "postfix": false, "binop": null }, - "start": 563, - "end": 564, + "start": 768, + "end": 769, "loc": { "start": { - "line": 25, + "line": 29, "column": 34 }, "end": { - "line": 25, + "line": 29, "column": 35 } } @@ -2842,15 +3138,15 @@ "postfix": false, "binop": null }, - "start": 565, - "end": 566, + "start": 770, + "end": 771, "loc": { "start": { - "line": 25, + "line": 29, "column": 36 }, "end": { - "line": 25, + "line": 29, "column": 37 } } @@ -2870,15 +3166,15 @@ "updateContext": null }, "value": "return", - "start": 568, - "end": 574, + "start": 773, + "end": 779, "loc": { "start": { - "line": 26, + "line": 30, "column": 1 }, "end": { - "line": 26, + "line": 30, "column": 7 } } @@ -2898,15 +3194,15 @@ "updateContext": null }, "value": "false", - "start": 575, - "end": 580, + "start": 780, + "end": 785, "loc": { "start": { - "line": 26, + "line": 30, "column": 8 }, "end": { - "line": 26, + "line": 30, "column": 13 } } @@ -2924,15 +3220,15 @@ "binop": null, "updateContext": null }, - "start": 580, - "end": 581, + "start": 785, + "end": 786, "loc": { "start": { - "line": 26, + "line": 30, "column": 13 }, "end": { - "line": 26, + "line": 30, "column": 14 } } @@ -2949,15 +3245,15 @@ "postfix": false, "binop": null }, - "start": 582, - "end": 583, + "start": 787, + "end": 788, "loc": { "start": { - "line": 27, + "line": 31, "column": 0 }, "end": { - "line": 27, + "line": 31, "column": 1 } } @@ -2975,15 +3271,15 @@ "binop": null, "updateContext": null }, - "start": 583, - "end": 584, + "start": 788, + "end": 789, "loc": { "start": { - "line": 27, + "line": 31, "column": 1 }, "end": { - "line": 27, + "line": 31, "column": 2 } } @@ -3001,15 +3297,15 @@ "binop": null, "updateContext": null }, - "start": 585, - "end": 585, + "start": 790, + "end": 790, "loc": { "start": { - "line": 28, + "line": 32, "column": 0 }, "end": { - "line": 28, + "line": 32, "column": 0 } } diff --git a/ast/source/adt/RedBlackTree.js.json b/ast/source/types/RedBlackTree.js.json similarity index 76% rename from ast/source/adt/RedBlackTree.js.json rename to ast/source/types/RedBlackTree.js.json index 2c2fe25..716727b 100644 --- a/ast/source/adt/RedBlackTree.js.json +++ b/ast/source/types/RedBlackTree.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 4447, + "end": 4957, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 177, + "line": 193, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 4447, + "end": 4957, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 177, + "line": 193, "column": 0 } }, @@ -31,7 +31,7 @@ { "type": "ImportDeclaration", "start": 0, - "end": 31, + "end": 28, "loc": { "start": { "line": 1, @@ -39,64 +39,47 @@ }, "end": { "line": 1, - "column": 31 + "column": 28 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 8, - "end": 12, + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 12 + "column": 13 } }, - "imported": { - "type": "Identifier", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - }, - "identifierName": "Node" - }, - "name": "Node" - }, "local": { "type": "Identifier", - "start": 8, - "end": 12, + "start": 7, + "end": 13, "loc": { "start": { "line": 1, - "column": 8 + "column": 7 }, "end": { "line": 1, - "column": 12 + "column": 13 }, - "identifierName": "Node" + "identifierName": "assert" }, - "name": "Node" + "name": "assert" } } ], "source": { "type": "StringLiteral", "start": 19, - "end": 30, + "end": 27, "loc": { "start": { "line": 1, @@ -104,20 +87,20 @@ }, "end": { "line": 1, - "column": 30 + "column": 27 } }, "extra": { - "rawValue": "./Node.js", - "raw": "'./Node.js'" + "rawValue": "assert", + "raw": "'assert'" }, - "value": "./Node.js" + "value": "assert" } }, { "type": "ImportDeclaration", - "start": 32, - "end": 77, + "start": 29, + "end": 58, "loc": { "start": { "line": 2, @@ -125,134 +108,68 @@ }, "end": { "line": 2, - "column": 45 + "column": 29 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 40, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - } - }, - "imported": { - "type": "Identifier", - "start": 40, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "local": { - "type": "Identifier", - "start": 40, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 8 - }, - "end": { - "line": 2, - "column": 13 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - { - "type": "ImportSpecifier", - "start": 47, - "end": 50, + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, "loc": { "start": { "line": 2, - "column": 15 + "column": 7 }, "end": { "line": 2, - "column": 18 + "column": 11 } }, - "imported": { - "type": "Identifier", - "start": 47, - "end": 50, - "loc": { - "start": { - "line": 2, - "column": 15 - }, - "end": { - "line": 2, - "column": 18 - }, - "identifierName": "RED" - }, - "name": "RED" - }, "local": { "type": "Identifier", - "start": 47, - "end": 50, + "start": 36, + "end": 40, "loc": { "start": { "line": 2, - "column": 15 + "column": 7 }, "end": { "line": 2, - "column": 18 + "column": 11 }, - "identifierName": "RED" + "identifierName": "Node" }, - "name": "RED" + "name": "Node" } } ], "source": { "type": "StringLiteral", - "start": 57, - "end": 76, + "start": 46, + "end": 57, "loc": { "start": { "line": 2, - "column": 25 + "column": 17 }, "end": { "line": 2, - "column": 44 + "column": 28 } }, "extra": { - "rawValue": "../color/index.js", - "raw": "'../color/index.js'" + "rawValue": "./Node.js", + "raw": "'./Node.js'" }, - "value": "../color/index.js" + "value": "./Node.js" } }, { "type": "ImportDeclaration", - "start": 78, - "end": 131, + "start": 59, + "end": 97, "loc": { "start": { "line": 3, @@ -260,85 +177,68 @@ }, "end": { "line": 3, - "column": 53 + "column": 38 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 86, - "end": 97, + "type": "ImportDefaultSpecifier", + "start": 66, + "end": 71, "loc": { "start": { "line": 3, - "column": 8 + "column": 7 }, "end": { "line": 3, - "column": 19 + "column": 12 } }, - "imported": { - "type": "Identifier", - "start": 86, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 8 - }, - "end": { - "line": 3, - "column": 19 - }, - "identifierName": "predecessor" - }, - "name": "predecessor" - }, "local": { "type": "Identifier", - "start": 86, - "end": 97, + "start": 66, + "end": 71, "loc": { "start": { "line": 3, - "column": 8 + "column": 7 }, "end": { "line": 3, - "column": 19 + "column": 12 }, - "identifierName": "predecessor" + "identifierName": "BLACK" }, - "name": "predecessor" + "name": "BLACK" } } ], "source": { "type": "StringLiteral", - "start": 104, - "end": 130, + "start": 77, + "end": 96, "loc": { "start": { "line": 3, - "column": 26 + "column": 18 }, "end": { "line": 3, - "column": 52 + "column": 37 } }, "extra": { - "rawValue": "../family/predecessor.js", - "raw": "'../family/predecessor.js'" + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" }, - "value": "../family/predecessor.js" + "value": "../color/BLACK.js" } }, { "type": "ImportDeclaration", - "start": 132, - "end": 191, + "start": 98, + "end": 132, "loc": { "start": { "line": 4, @@ -346,134 +246,68 @@ }, "end": { "line": 4, - "column": 59 + "column": 34 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 14 - } - }, - "imported": { - "type": "Identifier", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 14 - }, - "identifierName": "insert" - }, - "name": "insert" - }, - "local": { - "type": "Identifier", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 4, - "column": 8 - }, - "end": { - "line": 4, - "column": 14 - }, - "identifierName": "insert" - }, - "name": "insert" - } - }, - { - "type": "ImportSpecifier", - "start": 148, - "end": 160, + "type": "ImportDefaultSpecifier", + "start": 105, + "end": 108, "loc": { "start": { "line": 4, - "column": 16 + "column": 7 }, "end": { "line": 4, - "column": 28 + "column": 10 } }, - "imported": { - "type": "Identifier", - "start": 148, - "end": 160, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 28 - }, - "identifierName": "insert_case2" - }, - "name": "insert_case2" - }, "local": { "type": "Identifier", - "start": 148, - "end": 160, + "start": 105, + "end": 108, "loc": { "start": { "line": 4, - "column": 16 + "column": 7 }, "end": { "line": 4, - "column": 28 + "column": 10 }, - "identifierName": "insert_case2" + "identifierName": "RED" }, - "name": "insert_case2" + "name": "RED" } } ], "source": { "type": "StringLiteral", - "start": 167, - "end": 190, + "start": 114, + "end": 131, "loc": { "start": { "line": 4, - "column": 35 + "column": 16 }, "end": { "line": 4, - "column": 58 + "column": 33 } }, "extra": { - "rawValue": "../insertion/index.js", - "raw": "'../insertion/index.js'" + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" }, - "value": "../insertion/index.js" + "value": "../color/RED.js" } }, { "type": "ImportDeclaration", - "start": 192, - "end": 246, + "start": 133, + "end": 184, "loc": { "start": { "line": 5, @@ -481,85 +315,68 @@ }, "end": { "line": 5, - "column": 54 + "column": 51 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 200, - "end": 216, + "type": "ImportDefaultSpecifier", + "start": 140, + "end": 151, "loc": { "start": { "line": 5, - "column": 8 + "column": 7 }, "end": { "line": 5, - "column": 24 + "column": 18 } }, - "imported": { - "type": "Identifier", - "start": 200, - "end": 216, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 24 - }, - "identifierName": "delete_one_child" - }, - "name": "delete_one_child" - }, "local": { "type": "Identifier", - "start": 200, - "end": 216, + "start": 140, + "end": 151, "loc": { "start": { "line": 5, - "column": 8 + "column": 7 }, "end": { "line": 5, - "column": 24 + "column": 18 }, - "identifierName": "delete_one_child" + "identifierName": "predecessor" }, - "name": "delete_one_child" + "name": "predecessor" } } ], "source": { "type": "StringLiteral", - "start": 223, - "end": 245, + "start": 157, + "end": 183, "loc": { "start": { "line": 5, - "column": 31 + "column": 24 }, "end": { "line": 5, - "column": 53 + "column": 50 } }, "extra": { - "rawValue": "../deletion/index.js", - "raw": "'../deletion/index.js'" + "rawValue": "../family/predecessor.js", + "raw": "'../family/predecessor.js'" }, - "value": "../deletion/index.js" + "value": "../family/predecessor.js" } }, { "type": "ImportDeclaration", - "start": 247, - "end": 289, + "start": 185, + "end": 229, "loc": { "start": { "line": 6, @@ -567,85 +384,68 @@ }, "end": { "line": 6, - "column": 42 + "column": 44 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 255, - "end": 261, + "type": "ImportDefaultSpecifier", + "start": 192, + "end": 198, "loc": { "start": { "line": 6, - "column": 8 + "column": 7 }, "end": { "line": 6, - "column": 14 + "column": 13 } }, - "imported": { - "type": "Identifier", - "start": 255, - "end": 261, - "loc": { - "start": { - "line": 6, - "column": 8 - }, - "end": { - "line": 6, - "column": 14 - }, - "identifierName": "search" - }, - "name": "search" - }, "local": { "type": "Identifier", - "start": 255, - "end": 261, + "start": 192, + "end": 198, "loc": { "start": { "line": 6, - "column": 8 + "column": 7 }, "end": { "line": 6, - "column": 14 + "column": 13 }, - "identifierName": "search" + "identifierName": "insert" }, - "name": "search" + "name": "insert" } } ], "source": { "type": "StringLiteral", - "start": 268, - "end": 288, + "start": 204, + "end": 228, "loc": { "start": { "line": 6, - "column": 21 + "column": 19 }, "end": { "line": 6, - "column": 41 + "column": 43 } }, "extra": { - "rawValue": "../search/index.js", - "raw": "'../search/index.js'" + "rawValue": "../insertion/insert.js", + "raw": "'../insertion/insert.js'" }, - "value": "../search/index.js" + "value": "../insertion/insert.js" } }, { "type": "ImportDeclaration", - "start": 290, - "end": 361, + "start": 230, + "end": 286, "loc": { "start": { "line": 7, @@ -653,102 +453,312 @@ }, "end": { "line": 7, - "column": 71 + "column": 56 } }, "specifiers": [ { - "type": "ImportSpecifier", - "start": 298, - "end": 314, + "type": "ImportDefaultSpecifier", + "start": 237, + "end": 249, "loc": { "start": { "line": 7, - "column": 8 + "column": 7 }, "end": { "line": 7, - "column": 24 + "column": 19 } }, - "imported": { - "type": "Identifier", - "start": 298, - "end": 314, - "loc": { - "start": { - "line": 7, - "column": 8 - }, - "end": { - "line": 7, - "column": 24 - }, - "identifierName": "inordertraversal" - }, - "name": "inordertraversal" - }, "local": { "type": "Identifier", - "start": 298, - "end": 314, + "start": 237, + "end": 249, "loc": { "start": { "line": 7, - "column": 8 + "column": 7 }, "end": { "line": 7, - "column": 24 + "column": 19 }, - "identifierName": "inordertraversal" + "identifierName": "insert_case2" }, - "name": "inordertraversal" + "name": "insert_case2" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 255, + "end": 285, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 55 } }, + "extra": { + "rawValue": "../insertion/insert_case2.js", + "raw": "'../insertion/insert_case2.js'" + }, + "value": "../insertion/insert_case2.js" + } + }, + { + "type": "ImportDeclaration", + "start": 287, + "end": 350, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 63 + } + }, + "specifiers": [ { - "type": "ImportSpecifier", - "start": 316, - "end": 330, + "type": "ImportDefaultSpecifier", + "start": 294, + "end": 310, "loc": { "start": { - "line": 7, - "column": 26 + "line": 8, + "column": 7 }, "end": { - "line": 7, - "column": 40 + "line": 8, + "column": 23 } }, - "imported": { + "local": { "type": "Identifier", - "start": 316, - "end": 330, + "start": 294, + "end": 310, "loc": { "start": { - "line": 7, - "column": 26 + "line": 8, + "column": 7 }, "end": { - "line": 7, - "column": 40 + "line": 8, + "column": 23 }, - "identifierName": "rangetraversal" + "identifierName": "delete_one_child" }, - "name": "rangetraversal" - }, + "name": "delete_one_child" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 316, + "end": 349, + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 62 + } + }, + "extra": { + "rawValue": "../deletion/delete_one_child.js", + "raw": "'../deletion/delete_one_child.js'" + }, + "value": "../deletion/delete_one_child.js" + } + }, + { + "type": "ImportDeclaration", + "start": 351, + "end": 392, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 41 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 358, + "end": 364, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 13 + } + }, "local": { "type": "Identifier", - "start": 316, - "end": 330, + "start": 358, + "end": 364, "loc": { "start": { - "line": 7, - "column": 26 + "line": 9, + "column": 7 }, "end": { - "line": 7, - "column": 40 + "line": 9, + "column": 13 + }, + "identifierName": "search" + }, + "name": "search" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 370, + "end": 391, + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 40 + } + }, + "extra": { + "rawValue": "../search/search.js", + "raw": "'../search/search.js'" + }, + "value": "../search/search.js" + } + }, + { + "type": "ImportDeclaration", + "start": 393, + "end": 457, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 64 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 400, + "end": 416, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 400, + "end": 416, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 23 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 422, + "end": 456, + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 63 + } + }, + "extra": { + "rawValue": "../traversal/inordertraversal.js", + "raw": "'../traversal/inordertraversal.js'" + }, + "value": "../traversal/inordertraversal.js" + } + }, + { + "type": "ImportDeclaration", + "start": 458, + "end": 518, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 60 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 465, + "end": 479, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 21 + } + }, + "local": { + "type": "Identifier", + "start": 465, + "end": 479, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 21 }, "identifierName": "rangetraversal" }, @@ -758,37 +768,37 @@ ], "source": { "type": "StringLiteral", - "start": 337, - "end": 360, + "start": 485, + "end": 517, "loc": { "start": { - "line": 7, - "column": 47 + "line": 11, + "column": 27 }, "end": { - "line": 7, - "column": 70 + "line": 11, + "column": 59 } }, "extra": { - "rawValue": "../traversal/index.js", - "raw": "'../traversal/index.js'" + "rawValue": "../traversal/rangetraversal.js", + "raw": "'../traversal/rangetraversal.js'" }, - "value": "../traversal/index.js" + "value": "../traversal/rangetraversal.js" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 363, - "end": 412, + "start": 520, + "end": 569, "loc": { "start": { - "line": 9, + "line": 13, "column": 0 }, "end": { - "line": 12, + "line": 16, "column": 3 } } @@ -796,47 +806,45 @@ ] }, { - "type": "ExportNamedDeclaration", - "start": 413, - "end": 4446, + "type": "ExportDefaultDeclaration", + "start": 570, + "end": 4956, "loc": { "start": { - "line": 13, + "line": 17, "column": 0 }, "end": { - "line": 176, + "line": 192, "column": 1 } }, - "specifiers": [], - "source": null, "declaration": { "type": "ClassDeclaration", - "start": 420, - "end": 4446, + "start": 585, + "end": 4956, "loc": { "start": { - "line": 13, - "column": 7 + "line": 17, + "column": 15 }, "end": { - "line": 176, + "line": 192, "column": 1 } }, "id": { "type": "Identifier", - "start": 426, - "end": 438, + "start": 591, + "end": 603, "loc": { "start": { - "line": 13, - "column": 13 + "line": 17, + "column": 21 }, "end": { - "line": 13, - "column": 25 + "line": 17, + "column": 33 }, "identifierName": "RedBlackTree" }, @@ -846,30 +854,30 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 439, - "end": 4446, + "start": 604, + "end": 4956, "loc": { "start": { - "line": 13, - "column": 26 + "line": 17, + "column": 34 }, "end": { - "line": 176, + "line": 192, "column": 1 } }, "body": [ { "type": "ClassMethod", - "start": 598, - "end": 669, + "start": 735, + "end": 919, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 23, + "line": 28, "column": 2 } }, @@ -877,15 +885,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 598, - "end": 609, + "start": 735, + "end": 746, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, + "line": 23, "column": 12 }, "identifierName": "constructor" @@ -901,15 +909,15 @@ "params": [ { "type": "Identifier", - "start": 610, - "end": 617, + "start": 747, + "end": 754, "loc": { "start": { - "line": 20, + "line": 23, "column": 13 }, "end": { - "line": 20, + "line": 23, "column": 20 }, "identifierName": "compare" @@ -919,208 +927,268 @@ ], "body": { "type": "BlockStatement", - "start": 619, - "end": 669, + "start": 756, + "end": 919, "loc": { "start": { - "line": 20, + "line": 23, "column": 22 }, "end": { - "line": 23, + "line": 28, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 623, - "end": 646, + "start": 827, + "end": 850, "loc": { "start": { - "line": 21, + "line": 25, "column": 2 }, "end": { - "line": 21, + "line": 25, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 623, - "end": 645, + "start": 827, + "end": 849, "loc": { "start": { - "line": 21, + "line": 25, "column": 2 }, "end": { - "line": 21, + "line": 25, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 623, - "end": 635, + "start": 827, + "end": 839, "loc": { "start": { - "line": 21, + "line": 25, "column": 2 }, "end": { - "line": 21, + "line": 25, "column": 14 } }, "object": { "type": "ThisExpression", - "start": 623, - "end": 627, + "start": 827, + "end": 831, "loc": { "start": { - "line": 21, + "line": 25, "column": 2 }, "end": { - "line": 21, + "line": 25, "column": 6 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 628, - "end": 635, + "start": 832, + "end": 839, "loc": { "start": { - "line": 21, + "line": 25, "column": 7 }, "end": { - "line": 21, + "line": 25, "column": 14 }, "identifierName": "compare" }, "name": "compare" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "Identifier", - "start": 638, - "end": 645, + "start": 842, + "end": 849, "loc": { "start": { - "line": 21, + "line": 25, "column": 17 }, "end": { - "line": 21, + "line": 25, "column": 24 }, "identifierName": "compare" }, "name": "compare" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Function} The comparison function for node keys. ", + "start": 760, + "end": 824, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 66 + } + } } - } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node} The root of the tree. ", + "start": 853, + "end": 896, + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 45 + } + } + } + ] }, { "type": "ExpressionStatement", - "start": 649, - "end": 666, + "start": 899, + "end": 916, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, + "line": 27, "column": 19 } }, "expression": { "type": "AssignmentExpression", - "start": 649, - "end": 665, + "start": 899, + "end": 915, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, + "line": 27, "column": 18 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 649, - "end": 658, + "start": 899, + "end": 908, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, + "line": 27, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 649, - "end": 653, + "start": 899, + "end": 903, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, + "line": 27, "column": 6 } - } + }, + "leadingComments": null }, "property": { "type": "Identifier", - "start": 654, - "end": 658, + "start": 904, + "end": 908, "loc": { "start": { - "line": 22, + "line": 27, "column": 7 }, "end": { - "line": 22, + "line": 27, "column": 11 }, "identifierName": "root" }, "name": "root" }, - "computed": false + "computed": false, + "leadingComments": null }, "right": { "type": "NullLiteral", - "start": 661, - "end": 665, + "start": 911, + "end": 915, "loc": { "start": { - "line": 22, + "line": 27, "column": 14 }, "end": { - "line": 22, + "line": 27, "column": 18 } } + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Node} The root of the tree. ", + "start": 853, + "end": 896, + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 45 + } + } } - } + ] } ], "directives": [], @@ -1129,16 +1197,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t ", - "start": 442, - "end": 596, + "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", + "start": 607, + "end": 733, "loc": { "start": { - "line": 14, + "line": 18, "column": 1 }, "end": { - "line": 19, + "line": 22, "column": 4 } } @@ -1148,15 +1216,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 672, - "end": 776, + "start": 922, + "end": 1026, "loc": { "start": { - "line": 25, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 34, "column": 4 } } @@ -1165,15 +1233,15 @@ }, { "type": "ClassMethod", - "start": 778, - "end": 821, + "start": 1028, + "end": 1071, "loc": { "start": { - "line": 30, + "line": 35, "column": 1 }, "end": { - "line": 32, + "line": 37, "column": 2 } }, @@ -1181,15 +1249,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 778, - "end": 785, + "start": 1028, + "end": 1035, "loc": { "start": { - "line": 30, + "line": 35, "column": 1 }, "end": { - "line": 30, + "line": 35, "column": 8 }, "identifierName": "isEmpty" @@ -1205,87 +1273,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 788, - "end": 821, + "start": 1038, + "end": 1071, "loc": { "start": { - "line": 30, + "line": 35, "column": 11 }, "end": { - "line": 32, + "line": 37, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 792, - "end": 818, + "start": 1042, + "end": 1068, "loc": { "start": { - "line": 31, + "line": 36, "column": 2 }, "end": { - "line": 31, + "line": 36, "column": 28 } }, "argument": { "type": "BinaryExpression", - "start": 799, - "end": 817, + "start": 1049, + "end": 1067, "loc": { "start": { - "line": 31, + "line": 36, "column": 9 }, "end": { - "line": 31, + "line": 36, "column": 27 } }, "left": { "type": "MemberExpression", - "start": 799, - "end": 808, + "start": 1049, + "end": 1058, "loc": { "start": { - "line": 31, + "line": 36, "column": 9 }, "end": { - "line": 31, + "line": 36, "column": 18 } }, "object": { "type": "ThisExpression", - "start": 799, - "end": 803, + "start": 1049, + "end": 1053, "loc": { "start": { - "line": 31, + "line": 36, "column": 9 }, "end": { - "line": 31, + "line": 36, "column": 13 } } }, "property": { "type": "Identifier", - "start": 804, - "end": 808, + "start": 1054, + "end": 1058, "loc": { "start": { - "line": 31, + "line": 36, "column": 14 }, "end": { - "line": 31, + "line": 36, "column": 18 }, "identifierName": "root" @@ -1297,15 +1365,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 813, - "end": 817, + "start": 1063, + "end": 1067, "loc": { "start": { - "line": 31, + "line": 36, "column": 23 }, "end": { - "line": 31, + "line": 36, "column": 27 } } @@ -1320,15 +1388,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 672, - "end": 776, + "start": 922, + "end": 1026, "loc": { "start": { - "line": 25, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 34, "column": 4 } } @@ -1337,16 +1405,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t ", - "start": 824, - "end": 903, + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", + "start": 1074, + "end": 1153, "loc": { "start": { - "line": 34, + "line": 39, "column": 1 }, "end": { - "line": 38, + "line": 43, "column": 4 } } @@ -1355,15 +1423,15 @@ }, { "type": "ClassMethod", - "start": 905, - "end": 1099, + "start": 1155, + "end": 1349, "loc": { "start": { - "line": 39, + "line": 44, "column": 1 }, "end": { - "line": 47, + "line": 52, "column": 2 } }, @@ -1371,15 +1439,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 905, - "end": 908, + "start": 1155, + "end": 1158, "loc": { "start": { - "line": 39, + "line": 44, "column": 1 }, "end": { - "line": 39, + "line": 44, "column": 4 }, "identifierName": "add" @@ -1395,15 +1463,15 @@ "params": [ { "type": "Identifier", - "start": 909, - "end": 912, + "start": 1159, + "end": 1162, "loc": { "start": { - "line": 39, + "line": 44, "column": 5 }, "end": { - "line": 39, + "line": 44, "column": 8 }, "identifierName": "key" @@ -1413,87 +1481,87 @@ ], "body": { "type": "BlockStatement", - "start": 914, - "end": 1099, + "start": 1164, + "end": 1349, "loc": { "start": { - "line": 39, + "line": 44, "column": 10 }, "end": { - "line": 47, + "line": 52, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 918, - "end": 1096, + "start": 1168, + "end": 1346, "loc": { "start": { - "line": 40, + "line": 45, "column": 2 }, "end": { - "line": 46, + "line": 51, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 922, - "end": 940, + "start": 1172, + "end": 1190, "loc": { "start": { - "line": 40, + "line": 45, "column": 6 }, "end": { - "line": 40, + "line": 45, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 922, - "end": 931, + "start": 1172, + "end": 1181, "loc": { "start": { - "line": 40, + "line": 45, "column": 6 }, "end": { - "line": 40, + "line": 45, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 922, - "end": 926, + "start": 1172, + "end": 1176, "loc": { "start": { - "line": 40, + "line": 45, "column": 6 }, "end": { - "line": 40, + "line": 45, "column": 10 } } }, "property": { "type": "Identifier", - "start": 927, - "end": 931, + "start": 1177, + "end": 1181, "loc": { "start": { - "line": 40, + "line": 45, "column": 11 }, "end": { - "line": 40, + "line": 45, "column": 15 }, "identifierName": "root" @@ -1505,15 +1573,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 936, - "end": 940, + "start": 1186, + "end": 1190, "loc": { "start": { - "line": 40, + "line": 45, "column": 20 }, "end": { - "line": 40, + "line": 45, "column": 24 } } @@ -1521,88 +1589,88 @@ }, "consequent": { "type": "BlockStatement", - "start": 942, - "end": 984, + "start": 1192, + "end": 1234, "loc": { "start": { - "line": 40, + "line": 45, "column": 26 }, "end": { - "line": 42, + "line": 47, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 947, - "end": 980, + "start": 1197, + "end": 1230, "loc": { "start": { - "line": 41, + "line": 46, "column": 3 }, "end": { - "line": 41, + "line": 46, "column": 36 } }, "expression": { "type": "AssignmentExpression", - "start": 947, - "end": 979, + "start": 1197, + "end": 1229, "loc": { "start": { - "line": 41, + "line": 46, "column": 3 }, "end": { - "line": 41, + "line": 46, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 947, - "end": 956, + "start": 1197, + "end": 1206, "loc": { "start": { - "line": 41, + "line": 46, "column": 3 }, "end": { - "line": 41, + "line": 46, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 947, - "end": 951, + "start": 1197, + "end": 1201, "loc": { "start": { - "line": 41, + "line": 46, "column": 3 }, "end": { - "line": 41, + "line": 46, "column": 7 } } }, "property": { "type": "Identifier", - "start": 952, - "end": 956, + "start": 1202, + "end": 1206, "loc": { "start": { - "line": 41, + "line": 46, "column": 8 }, "end": { - "line": 41, + "line": 46, "column": 12 }, "identifierName": "root" @@ -1613,29 +1681,29 @@ }, "right": { "type": "NewExpression", - "start": 959, - "end": 979, + "start": 1209, + "end": 1229, "loc": { "start": { - "line": 41, + "line": 46, "column": 15 }, "end": { - "line": 41, + "line": 46, "column": 35 } }, "callee": { "type": "Identifier", - "start": 963, - "end": 967, + "start": 1213, + "end": 1217, "loc": { "start": { - "line": 41, + "line": 46, "column": 19 }, "end": { - "line": 41, + "line": 46, "column": 23 }, "identifierName": "Node" @@ -1645,15 +1713,15 @@ "arguments": [ { "type": "Identifier", - "start": 968, - "end": 973, + "start": 1218, + "end": 1223, "loc": { "start": { - "line": 41, + "line": 46, "column": 24 }, "end": { - "line": 41, + "line": 46, "column": 29 }, "identifierName": "BLACK" @@ -1662,15 +1730,15 @@ }, { "type": "Identifier", - "start": 975, - "end": 978, + "start": 1225, + "end": 1228, "loc": { "start": { - "line": 41, + "line": 46, "column": 31 }, "end": { - "line": 41, + "line": 46, "column": 34 }, "identifierName": "key" @@ -1686,59 +1754,59 @@ }, "alternate": { "type": "BlockStatement", - "start": 990, - "end": 1096, + "start": 1240, + "end": 1346, "loc": { "start": { - "line": 42, + "line": 47, "column": 9 }, "end": { - "line": 46, + "line": 51, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 995, - "end": 1027, + "start": 1245, + "end": 1277, "loc": { "start": { - "line": 43, + "line": 48, "column": 3 }, "end": { - "line": 43, + "line": 48, "column": 35 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 1001, - "end": 1026, + "start": 1251, + "end": 1276, "loc": { "start": { - "line": 43, + "line": 48, "column": 9 }, "end": { - "line": 43, + "line": 48, "column": 34 } }, "id": { "type": "Identifier", - "start": 1001, - "end": 1005, + "start": 1251, + "end": 1255, "loc": { "start": { - "line": 43, + "line": 48, "column": 9 }, "end": { - "line": 43, + "line": 48, "column": 13 }, "identifierName": "node" @@ -1747,29 +1815,29 @@ }, "init": { "type": "NewExpression", - "start": 1008, - "end": 1026, + "start": 1258, + "end": 1276, "loc": { "start": { - "line": 43, + "line": 48, "column": 16 }, "end": { - "line": 43, + "line": 48, "column": 34 } }, "callee": { "type": "Identifier", - "start": 1012, - "end": 1016, + "start": 1262, + "end": 1266, "loc": { "start": { - "line": 43, + "line": 48, "column": 20 }, "end": { - "line": 43, + "line": 48, "column": 24 }, "identifierName": "Node" @@ -1779,15 +1847,15 @@ "arguments": [ { "type": "Identifier", - "start": 1017, - "end": 1020, + "start": 1267, + "end": 1270, "loc": { "start": { - "line": 43, + "line": 48, "column": 25 }, "end": { - "line": 43, + "line": 48, "column": 28 }, "identifierName": "RED" @@ -1796,15 +1864,15 @@ }, { "type": "Identifier", - "start": 1022, - "end": 1025, + "start": 1272, + "end": 1275, "loc": { "start": { - "line": 43, + "line": 48, "column": 30 }, "end": { - "line": 43, + "line": 48, "column": 33 }, "identifierName": "key" @@ -1819,43 +1887,43 @@ }, { "type": "ExpressionStatement", - "start": 1031, - "end": 1069, + "start": 1281, + "end": 1319, "loc": { "start": { - "line": 44, + "line": 49, "column": 3 }, "end": { - "line": 44, + "line": 49, "column": 41 } }, "expression": { "type": "CallExpression", - "start": 1031, - "end": 1068, + "start": 1281, + "end": 1318, "loc": { "start": { - "line": 44, + "line": 49, "column": 3 }, "end": { - "line": 44, + "line": 49, "column": 40 } }, "callee": { "type": "Identifier", - "start": 1031, - "end": 1037, + "start": 1281, + "end": 1287, "loc": { "start": { - "line": 44, + "line": 49, "column": 3 }, "end": { - "line": 44, + "line": 49, "column": 9 }, "identifierName": "insert" @@ -1865,44 +1933,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 1038, - "end": 1050, + "start": 1288, + "end": 1300, "loc": { "start": { - "line": 44, + "line": 49, "column": 10 }, "end": { - "line": 44, + "line": 49, "column": 22 } }, "object": { "type": "ThisExpression", - "start": 1038, - "end": 1042, + "start": 1288, + "end": 1292, "loc": { "start": { - "line": 44, + "line": 49, "column": 10 }, "end": { - "line": 44, + "line": 49, "column": 14 } } }, "property": { "type": "Identifier", - "start": 1043, - "end": 1050, + "start": 1293, + "end": 1300, "loc": { "start": { - "line": 44, + "line": 49, "column": 15 }, "end": { - "line": 44, + "line": 49, "column": 22 }, "identifierName": "compare" @@ -1913,44 +1981,44 @@ }, { "type": "MemberExpression", - "start": 1052, - "end": 1061, + "start": 1302, + "end": 1311, "loc": { "start": { - "line": 44, + "line": 49, "column": 24 }, "end": { - "line": 44, + "line": 49, "column": 33 } }, "object": { "type": "ThisExpression", - "start": 1052, - "end": 1056, + "start": 1302, + "end": 1306, "loc": { "start": { - "line": 44, + "line": 49, "column": 24 }, "end": { - "line": 44, + "line": 49, "column": 28 } } }, "property": { "type": "Identifier", - "start": 1057, - "end": 1061, + "start": 1307, + "end": 1311, "loc": { "start": { - "line": 44, + "line": 49, "column": 29 }, "end": { - "line": 44, + "line": 49, "column": 33 }, "identifierName": "root" @@ -1961,15 +2029,15 @@ }, { "type": "Identifier", - "start": 1063, - "end": 1067, + "start": 1313, + "end": 1317, "loc": { "start": { - "line": 44, + "line": 49, "column": 35 }, "end": { - "line": 44, + "line": 49, "column": 39 }, "identifierName": "node" @@ -1981,43 +2049,43 @@ }, { "type": "ExpressionStatement", - "start": 1073, - "end": 1092, + "start": 1323, + "end": 1342, "loc": { "start": { - "line": 45, + "line": 50, "column": 3 }, "end": { - "line": 45, + "line": 50, "column": 22 } }, "expression": { "type": "CallExpression", - "start": 1073, - "end": 1091, + "start": 1323, + "end": 1341, "loc": { "start": { - "line": 45, + "line": 50, "column": 3 }, "end": { - "line": 45, + "line": 50, "column": 21 } }, "callee": { "type": "Identifier", - "start": 1073, - "end": 1085, + "start": 1323, + "end": 1335, "loc": { "start": { - "line": 45, + "line": 50, "column": 3 }, "end": { - "line": 45, + "line": 50, "column": 15 }, "identifierName": "insert_case2" @@ -2027,15 +2095,15 @@ "arguments": [ { "type": "Identifier", - "start": 1086, - "end": 1090, + "start": 1336, + "end": 1340, "loc": { "start": { - "line": 45, + "line": 50, "column": 16 }, "end": { - "line": 45, + "line": 50, "column": 20 }, "identifierName": "node" @@ -2056,16 +2124,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t ", - "start": 824, - "end": 903, + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", + "start": 1074, + "end": 1153, "loc": { "start": { - "line": 34, + "line": 39, "column": 1 }, "end": { - "line": 38, + "line": 43, "column": 4 } } @@ -2074,16 +2142,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1102, - "end": 1328, + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", + "start": 1352, + "end": 1578, "loc": { "start": { - "line": 49, + "line": 54, "column": 1 }, "end": { - "line": 56, + "line": 61, "column": 4 } } @@ -2092,15 +2160,15 @@ }, { "type": "ClassMethod", - "start": 1330, - "end": 1433, + "start": 1580, + "end": 1683, "loc": { "start": { - "line": 57, + "line": 62, "column": 1 }, "end": { - "line": 60, + "line": 65, "column": 2 } }, @@ -2108,15 +2176,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1330, - "end": 1337, + "start": 1580, + "end": 1587, "loc": { "start": { - "line": 57, + "line": 62, "column": 1 }, "end": { - "line": 57, + "line": 62, "column": 8 }, "identifierName": "_search" @@ -2132,15 +2200,15 @@ "params": [ { "type": "Identifier", - "start": 1338, - "end": 1341, + "start": 1588, + "end": 1591, "loc": { "start": { - "line": 57, + "line": 62, "column": 9 }, "end": { - "line": 57, + "line": 62, "column": 12 }, "identifierName": "key" @@ -2150,87 +2218,87 @@ ], "body": { "type": "BlockStatement", - "start": 1343, - "end": 1433, + "start": 1593, + "end": 1683, "loc": { "start": { - "line": 57, + "line": 62, "column": 14 }, "end": { - "line": 60, + "line": 65, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 1347, - "end": 1383, + "start": 1597, + "end": 1633, "loc": { "start": { - "line": 58, + "line": 63, "column": 2 }, "end": { - "line": 58, + "line": 63, "column": 38 } }, "test": { "type": "BinaryExpression", - "start": 1351, - "end": 1369, + "start": 1601, + "end": 1619, "loc": { "start": { - "line": 58, + "line": 63, "column": 6 }, "end": { - "line": 58, + "line": 63, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 1351, - "end": 1360, + "start": 1601, + "end": 1610, "loc": { "start": { - "line": 58, + "line": 63, "column": 6 }, "end": { - "line": 58, + "line": 63, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 1351, - "end": 1355, + "start": 1601, + "end": 1605, "loc": { "start": { - "line": 58, + "line": 63, "column": 6 }, "end": { - "line": 58, + "line": 63, "column": 10 } } }, "property": { "type": "Identifier", - "start": 1356, - "end": 1360, + "start": 1606, + "end": 1610, "loc": { "start": { - "line": 58, + "line": 63, "column": 11 }, "end": { - "line": 58, + "line": 63, "column": 15 }, "identifierName": "root" @@ -2242,15 +2310,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1365, - "end": 1369, + "start": 1615, + "end": 1619, "loc": { "start": { - "line": 58, + "line": 63, "column": 20 }, "end": { - "line": 58, + "line": 63, "column": 24 } } @@ -2258,29 +2326,29 @@ }, "consequent": { "type": "ReturnStatement", - "start": 1371, - "end": 1383, + "start": 1621, + "end": 1633, "loc": { "start": { - "line": 58, + "line": 63, "column": 26 }, "end": { - "line": 58, + "line": 63, "column": 38 } }, "argument": { "type": "NullLiteral", - "start": 1378, - "end": 1382, + "start": 1628, + "end": 1632, "loc": { "start": { - "line": 58, + "line": 63, "column": 33 }, "end": { - "line": 58, + "line": 63, "column": 37 } } @@ -2290,43 +2358,43 @@ }, { "type": "ReturnStatement", - "start": 1386, - "end": 1430, + "start": 1636, + "end": 1680, "loc": { "start": { - "line": 59, + "line": 64, "column": 2 }, "end": { - "line": 59, + "line": 64, "column": 46 } }, "argument": { "type": "CallExpression", - "start": 1393, - "end": 1429, + "start": 1643, + "end": 1679, "loc": { "start": { - "line": 59, + "line": 64, "column": 9 }, "end": { - "line": 59, + "line": 64, "column": 45 } }, "callee": { "type": "Identifier", - "start": 1393, - "end": 1399, + "start": 1643, + "end": 1649, "loc": { "start": { - "line": 59, + "line": 64, "column": 9 }, "end": { - "line": 59, + "line": 64, "column": 15 }, "identifierName": "search" @@ -2336,44 +2404,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 1400, - "end": 1412, + "start": 1650, + "end": 1662, "loc": { "start": { - "line": 59, + "line": 64, "column": 16 }, "end": { - "line": 59, + "line": 64, "column": 28 } }, "object": { "type": "ThisExpression", - "start": 1400, - "end": 1404, + "start": 1650, + "end": 1654, "loc": { "start": { - "line": 59, + "line": 64, "column": 16 }, "end": { - "line": 59, + "line": 64, "column": 20 } } }, "property": { "type": "Identifier", - "start": 1405, - "end": 1412, + "start": 1655, + "end": 1662, "loc": { "start": { - "line": 59, + "line": 64, "column": 21 }, "end": { - "line": 59, + "line": 64, "column": 28 }, "identifierName": "compare" @@ -2384,44 +2452,44 @@ }, { "type": "MemberExpression", - "start": 1414, - "end": 1423, + "start": 1664, + "end": 1673, "loc": { "start": { - "line": 59, + "line": 64, "column": 30 }, "end": { - "line": 59, + "line": 64, "column": 39 } }, "object": { "type": "ThisExpression", - "start": 1414, - "end": 1418, + "start": 1664, + "end": 1668, "loc": { "start": { - "line": 59, + "line": 64, "column": 30 }, "end": { - "line": 59, + "line": 64, "column": 34 } } }, "property": { "type": "Identifier", - "start": 1419, - "end": 1423, + "start": 1669, + "end": 1673, "loc": { "start": { - "line": 59, + "line": 64, "column": 35 }, "end": { - "line": 59, + "line": 64, "column": 39 }, "identifierName": "root" @@ -2432,15 +2500,15 @@ }, { "type": "Identifier", - "start": 1425, - "end": 1428, + "start": 1675, + "end": 1678, "loc": { "start": { - "line": 59, + "line": 64, "column": 41 }, "end": { - "line": 59, + "line": 64, "column": 44 }, "identifierName": "key" @@ -2457,16 +2525,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1102, - "end": 1328, + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", + "start": 1352, + "end": 1578, "loc": { "start": { - "line": 49, + "line": 54, "column": 1 }, "end": { - "line": 56, + "line": 61, "column": 4 } } @@ -2475,16 +2543,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t ", - "start": 1436, - "end": 1698, + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", + "start": 1686, + "end": 1948, "loc": { "start": { - "line": 62, + "line": 67, "column": 1 }, "end": { - "line": 69, + "line": 74, "column": 4 } } @@ -2493,15 +2561,15 @@ }, { "type": "ClassMethod", - "start": 1700, - "end": 1789, + "start": 1950, + "end": 2039, "loc": { "start": { - "line": 70, + "line": 75, "column": 1 }, "end": { - "line": 73, + "line": 78, "column": 2 } }, @@ -2509,15 +2577,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1700, - "end": 1703, + "start": 1950, + "end": 1953, "loc": { "start": { - "line": 70, + "line": 75, "column": 1 }, "end": { - "line": 70, + "line": 75, "column": 4 }, "identifierName": "get" @@ -2533,15 +2601,15 @@ "params": [ { "type": "Identifier", - "start": 1704, - "end": 1707, + "start": 1954, + "end": 1957, "loc": { "start": { - "line": 70, + "line": 75, "column": 5 }, "end": { - "line": 70, + "line": 75, "column": 8 }, "identifierName": "key" @@ -2551,59 +2619,59 @@ ], "body": { "type": "BlockStatement", - "start": 1709, - "end": 1789, + "start": 1959, + "end": 2039, "loc": { "start": { - "line": 70, + "line": 75, "column": 10 }, "end": { - "line": 73, + "line": 78, "column": 2 } }, "body": [ { "type": "VariableDeclaration", - "start": 1713, - "end": 1744, + "start": 1963, + "end": 1994, "loc": { "start": { - "line": 71, + "line": 76, "column": 2 }, "end": { - "line": 71, + "line": 76, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 1719, - "end": 1743, + "start": 1969, + "end": 1993, "loc": { "start": { - "line": 71, + "line": 76, "column": 8 }, "end": { - "line": 71, + "line": 76, "column": 32 } }, "id": { "type": "Identifier", - "start": 1719, - "end": 1723, + "start": 1969, + "end": 1973, "loc": { "start": { - "line": 71, + "line": 76, "column": 8 }, "end": { - "line": 71, + "line": 76, "column": 12 }, "identifierName": "node" @@ -2612,58 +2680,58 @@ }, "init": { "type": "CallExpression", - "start": 1726, - "end": 1743, + "start": 1976, + "end": 1993, "loc": { "start": { - "line": 71, + "line": 76, "column": 15 }, "end": { - "line": 71, + "line": 76, "column": 32 } }, "callee": { "type": "MemberExpression", - "start": 1726, - "end": 1738, + "start": 1976, + "end": 1988, "loc": { "start": { - "line": 71, + "line": 76, "column": 15 }, "end": { - "line": 71, + "line": 76, "column": 27 } }, "object": { "type": "ThisExpression", - "start": 1726, - "end": 1730, + "start": 1976, + "end": 1980, "loc": { "start": { - "line": 71, + "line": 76, "column": 15 }, "end": { - "line": 71, + "line": 76, "column": 19 } } }, "property": { "type": "Identifier", - "start": 1731, - "end": 1738, + "start": 1981, + "end": 1988, "loc": { "start": { - "line": 71, + "line": 76, "column": 20 }, "end": { - "line": 71, + "line": 76, "column": 27 }, "identifierName": "_search" @@ -2675,15 +2743,15 @@ "arguments": [ { "type": "Identifier", - "start": 1739, - "end": 1742, + "start": 1989, + "end": 1992, "loc": { "start": { - "line": 71, + "line": 76, "column": 28 }, "end": { - "line": 71, + "line": 76, "column": 31 }, "identifierName": "key" @@ -2698,57 +2766,57 @@ }, { "type": "ReturnStatement", - "start": 1747, - "end": 1786, + "start": 1997, + "end": 2036, "loc": { "start": { - "line": 72, + "line": 77, "column": 2 }, "end": { - "line": 72, + "line": 77, "column": 41 } }, "argument": { "type": "ConditionalExpression", - "start": 1754, - "end": 1785, + "start": 2004, + "end": 2035, "loc": { "start": { - "line": 72, + "line": 77, "column": 9 }, "end": { - "line": 72, + "line": 77, "column": 40 } }, "test": { "type": "BinaryExpression", - "start": 1754, - "end": 1767, + "start": 2004, + "end": 2017, "loc": { "start": { - "line": 72, + "line": 77, "column": 9 }, "end": { - "line": 72, + "line": 77, "column": 22 } }, "left": { "type": "Identifier", - "start": 1754, - "end": 1758, + "start": 2004, + "end": 2008, "loc": { "start": { - "line": 72, + "line": 77, "column": 9 }, "end": { - "line": 72, + "line": 77, "column": 13 }, "identifierName": "node" @@ -2758,15 +2826,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1763, - "end": 1767, + "start": 2013, + "end": 2017, "loc": { "start": { - "line": 72, + "line": 77, "column": 18 }, "end": { - "line": 72, + "line": 77, "column": 22 } } @@ -2774,44 +2842,44 @@ }, "consequent": { "type": "NullLiteral", - "start": 1770, - "end": 1774, + "start": 2020, + "end": 2024, "loc": { "start": { - "line": 72, + "line": 77, "column": 25 }, "end": { - "line": 72, + "line": 77, "column": 29 } } }, "alternate": { "type": "MemberExpression", - "start": 1777, - "end": 1785, + "start": 2027, + "end": 2035, "loc": { "start": { - "line": 72, + "line": 77, "column": 32 }, "end": { - "line": 72, + "line": 77, "column": 40 } }, "object": { "type": "Identifier", - "start": 1777, - "end": 1781, + "start": 2027, + "end": 2031, "loc": { "start": { - "line": 72, + "line": 77, "column": 32 }, "end": { - "line": 72, + "line": 77, "column": 36 }, "identifierName": "node" @@ -2820,15 +2888,15 @@ }, "property": { "type": "Identifier", - "start": 1782, - "end": 1785, + "start": 2032, + "end": 2035, "loc": { "start": { - "line": 72, + "line": 77, "column": 37 }, "end": { - "line": 72, + "line": 77, "column": 40 }, "identifierName": "key" @@ -2846,16 +2914,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t ", - "start": 1436, - "end": 1698, + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", + "start": 1686, + "end": 1948, "loc": { "start": { - "line": 62, + "line": 67, "column": 1 }, "end": { - "line": 69, + "line": 74, "column": 4 } } @@ -2864,16 +2932,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t ", - "start": 1792, - "end": 1947, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t ", + "start": 2042, + "end": 2197, "loc": { "start": { - "line": 75, + "line": 80, "column": 1 }, "end": { - "line": 81, + "line": 86, "column": 4 } } @@ -2882,15 +2950,15 @@ }, { "type": "ClassMethod", - "start": 1949, - "end": 1999, + "start": 2199, + "end": 2249, "loc": { "start": { - "line": 82, + "line": 87, "column": 1 }, "end": { - "line": 84, + "line": 89, "column": 2 } }, @@ -2898,15 +2966,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1949, - "end": 1952, + "start": 2199, + "end": 2202, "loc": { "start": { - "line": 82, + "line": 87, "column": 1 }, "end": { - "line": 82, + "line": 87, "column": 4 }, "identifierName": "has" @@ -2922,15 +2990,15 @@ "params": [ { "type": "Identifier", - "start": 1953, - "end": 1956, + "start": 2203, + "end": 2206, "loc": { "start": { - "line": 82, + "line": 87, "column": 5 }, "end": { - "line": 82, + "line": 87, "column": 8 }, "identifierName": "key" @@ -2940,101 +3008,101 @@ ], "body": { "type": "BlockStatement", - "start": 1958, - "end": 1999, + "start": 2208, + "end": 2249, "loc": { "start": { - "line": 82, + "line": 87, "column": 10 }, "end": { - "line": 84, + "line": 89, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 1962, - "end": 1996, + "start": 2212, + "end": 2246, "loc": { "start": { - "line": 83, + "line": 88, "column": 2 }, "end": { - "line": 83, + "line": 88, "column": 36 } }, "argument": { "type": "BinaryExpression", - "start": 1969, - "end": 1995, + "start": 2219, + "end": 2245, "loc": { "start": { - "line": 83, + "line": 88, "column": 9 }, "end": { - "line": 83, + "line": 88, "column": 35 } }, "left": { "type": "CallExpression", - "start": 1969, - "end": 1986, + "start": 2219, + "end": 2236, "loc": { "start": { - "line": 83, + "line": 88, "column": 9 }, "end": { - "line": 83, + "line": 88, "column": 26 } }, "callee": { "type": "MemberExpression", - "start": 1969, - "end": 1981, + "start": 2219, + "end": 2231, "loc": { "start": { - "line": 83, + "line": 88, "column": 9 }, "end": { - "line": 83, + "line": 88, "column": 21 } }, "object": { "type": "ThisExpression", - "start": 1969, - "end": 1973, + "start": 2219, + "end": 2223, "loc": { "start": { - "line": 83, + "line": 88, "column": 9 }, "end": { - "line": 83, + "line": 88, "column": 13 } } }, "property": { "type": "Identifier", - "start": 1974, - "end": 1981, + "start": 2224, + "end": 2231, "loc": { "start": { - "line": 83, + "line": 88, "column": 14 }, "end": { - "line": 83, + "line": 88, "column": 21 }, "identifierName": "_search" @@ -3046,15 +3114,15 @@ "arguments": [ { "type": "Identifier", - "start": 1982, - "end": 1985, + "start": 2232, + "end": 2235, "loc": { "start": { - "line": 83, + "line": 88, "column": 22 }, "end": { - "line": 83, + "line": 88, "column": 25 }, "identifierName": "key" @@ -3066,15 +3134,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 1991, - "end": 1995, + "start": 2241, + "end": 2245, "loc": { "start": { - "line": 83, + "line": 88, "column": 31 }, "end": { - "line": 83, + "line": 88, "column": 35 } } @@ -3088,16 +3156,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t ", - "start": 1792, - "end": 1947, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t ", + "start": 2042, + "end": 2197, "loc": { "start": { - "line": 75, + "line": 80, "column": 1 }, "end": { - "line": 81, + "line": 86, "column": 4 } } @@ -3107,15 +3175,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2002, - "end": 2107, + "start": 2252, + "end": 2357, "loc": { "start": { - "line": 86, + "line": 91, "column": 1 }, "end": { - "line": 90, + "line": 95, "column": 4 } } @@ -3124,15 +3192,15 @@ }, { "type": "ClassMethod", - "start": 2109, - "end": 2895, + "start": 2359, + "end": 3178, "loc": { "start": { - "line": 91, + "line": 96, "column": 1 }, "end": { - "line": 115, + "line": 121, "column": 2 } }, @@ -3140,15 +3208,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 2109, - "end": 2116, + "start": 2359, + "end": 2366, "loc": { "start": { - "line": 91, + "line": 96, "column": 1 }, "end": { - "line": 91, + "line": 96, "column": 8 }, "identifierName": "_delete" @@ -3164,15 +3232,15 @@ "params": [ { "type": "Identifier", - "start": 2117, - "end": 2121, + "start": 2367, + "end": 2371, "loc": { "start": { - "line": 91, + "line": 96, "column": 9 }, "end": { - "line": 91, + "line": 96, "column": 13 }, "identifierName": "node" @@ -3182,44 +3250,44 @@ ], "body": { "type": "BlockStatement", - "start": 2123, - "end": 2895, + "start": 2373, + "end": 3178, "loc": { "start": { - "line": 91, + "line": 96, "column": 15 }, "end": { - "line": 115, + "line": 121, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 2127, - "end": 2892, + "start": 2377, + "end": 3175, "loc": { "start": { - "line": 92, + "line": 97, "column": 2 }, "end": { - "line": 114, + "line": 120, "column": 3 } }, "test": { "type": "UnaryExpression", - "start": 2131, - "end": 2150, + "start": 2381, + "end": 2400, "loc": { "start": { - "line": 92, + "line": 97, "column": 6 }, "end": { - "line": 92, + "line": 97, "column": 25 } }, @@ -3227,57 +3295,57 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 2132, - "end": 2150, + "start": 2382, + "end": 2400, "loc": { "start": { - "line": 92, + "line": 97, "column": 7 }, "end": { - "line": 92, + "line": 97, "column": 25 } }, "callee": { "type": "MemberExpression", - "start": 2132, - "end": 2148, + "start": 2382, + "end": 2398, "loc": { "start": { - "line": 92, + "line": 97, "column": 7 }, "end": { - "line": 92, + "line": 97, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 2132, - "end": 2141, + "start": 2382, + "end": 2391, "loc": { "start": { - "line": 92, + "line": 97, "column": 7 }, "end": { - "line": 92, + "line": 97, "column": 16 } }, "object": { "type": "Identifier", - "start": 2132, - "end": 2136, + "start": 2382, + "end": 2386, "loc": { "start": { - "line": 92, + "line": 97, "column": 7 }, "end": { - "line": 92, + "line": 97, "column": 11 }, "identifierName": "node" @@ -3286,15 +3354,15 @@ }, "property": { "type": "Identifier", - "start": 2137, - "end": 2141, + "start": 2387, + "end": 2391, "loc": { "start": { - "line": 92, + "line": 97, "column": 12 }, "end": { - "line": 92, + "line": 97, "column": 16 }, "identifierName": "left" @@ -3305,15 +3373,15 @@ }, "property": { "type": "Identifier", - "start": 2142, - "end": 2148, + "start": 2392, + "end": 2398, "loc": { "start": { - "line": 92, + "line": 97, "column": 17 }, "end": { - "line": 92, + "line": 97, "column": 23 }, "identifierName": "isLeaf" @@ -3330,59 +3398,59 @@ }, "consequent": { "type": "BlockStatement", - "start": 2152, - "end": 2425, + "start": 2402, + "end": 2675, "loc": { "start": { - "line": 92, + "line": 97, "column": 27 }, "end": { - "line": 100, + "line": 105, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 2205, - "end": 2236, + "start": 2455, + "end": 2486, "loc": { "start": { - "line": 94, + "line": 99, "column": 3 }, "end": { - "line": 94, + "line": 99, "column": 34 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 2211, - "end": 2235, + "start": 2461, + "end": 2485, "loc": { "start": { - "line": 94, + "line": 99, "column": 9 }, "end": { - "line": 94, + "line": 99, "column": 33 } }, "id": { "type": "Identifier", - "start": 2211, - "end": 2215, + "start": 2461, + "end": 2465, "loc": { "start": { - "line": 94, + "line": 99, "column": 9 }, "end": { - "line": 94, + "line": 99, "column": 13 }, "identifierName": "pred" @@ -3392,29 +3460,29 @@ }, "init": { "type": "CallExpression", - "start": 2218, - "end": 2235, + "start": 2468, + "end": 2485, "loc": { "start": { - "line": 94, + "line": 99, "column": 16 }, "end": { - "line": 94, + "line": 99, "column": 33 } }, "callee": { "type": "Identifier", - "start": 2218, - "end": 2229, + "start": 2468, + "end": 2479, "loc": { "start": { - "line": 94, + "line": 99, "column": 16 }, "end": { - "line": 94, + "line": 99, "column": 27 }, "identifierName": "predecessor" @@ -3424,15 +3492,15 @@ "arguments": [ { "type": "Identifier", - "start": 2230, - "end": 2234, + "start": 2480, + "end": 2484, "loc": { "start": { - "line": 94, + "line": 99, "column": 28 }, "end": { - "line": 94, + "line": 99, "column": 32 }, "identifierName": "node" @@ -3449,15 +3517,15 @@ { "type": "CommentLine", "value": " Replace node's key with predecessor's key", - "start": 2157, - "end": 2201, + "start": 2407, + "end": 2451, "loc": { "start": { - "line": 93, + "line": 98, "column": 3 }, "end": { - "line": 93, + "line": 98, "column": 47 } } @@ -3466,58 +3534,58 @@ }, { "type": "ExpressionStatement", - "start": 2240, - "end": 2260, + "start": 2490, + "end": 2510, "loc": { "start": { - "line": 95, + "line": 100, "column": 3 }, "end": { - "line": 95, + "line": 100, "column": 23 } }, "expression": { "type": "AssignmentExpression", - "start": 2240, - "end": 2259, + "start": 2490, + "end": 2509, "loc": { "start": { - "line": 95, + "line": 100, "column": 3 }, "end": { - "line": 95, + "line": 100, "column": 22 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 2240, - "end": 2248, + "start": 2490, + "end": 2498, "loc": { "start": { - "line": 95, + "line": 100, "column": 3 }, "end": { - "line": 95, + "line": 100, "column": 11 } }, "object": { "type": "Identifier", - "start": 2240, - "end": 2244, + "start": 2490, + "end": 2494, "loc": { "start": { - "line": 95, + "line": 100, "column": 3 }, "end": { - "line": 95, + "line": 100, "column": 7 }, "identifierName": "node" @@ -3526,15 +3594,15 @@ }, "property": { "type": "Identifier", - "start": 2245, - "end": 2248, + "start": 2495, + "end": 2498, "loc": { "start": { - "line": 95, + "line": 100, "column": 8 }, "end": { - "line": 95, + "line": 100, "column": 11 }, "identifierName": "key" @@ -3545,29 +3613,29 @@ }, "right": { "type": "MemberExpression", - "start": 2251, - "end": 2259, + "start": 2501, + "end": 2509, "loc": { "start": { - "line": 95, + "line": 100, "column": 14 }, "end": { - "line": 95, + "line": 100, "column": 22 } }, "object": { "type": "Identifier", - "start": 2251, - "end": 2255, + "start": 2501, + "end": 2505, "loc": { "start": { - "line": 95, + "line": 100, "column": 14 }, "end": { - "line": 95, + "line": 100, "column": 18 }, "identifierName": "pred" @@ -3576,15 +3644,15 @@ }, "property": { "type": "Identifier", - "start": 2256, - "end": 2259, + "start": 2506, + "end": 2509, "loc": { "start": { - "line": 95, + "line": 100, "column": 19 }, "end": { - "line": 95, + "line": 100, "column": 22 }, "identifierName": "key" @@ -3598,15 +3666,15 @@ { "type": "CommentLine", "value": " Delete predecessor node", - "start": 2264, - "end": 2290, + "start": 2514, + "end": 2540, "loc": { "start": { - "line": 96, + "line": 101, "column": 3 }, "end": { - "line": 96, + "line": 101, "column": 29 } } @@ -3614,15 +3682,15 @@ { "type": "CommentLine", "value": " note: this node can only have one non-leaf child", - "start": 2294, - "end": 2345, + "start": 2544, + "end": 2595, "loc": { "start": { - "line": 97, + "line": 102, "column": 3 }, "end": { - "line": 97, + "line": 102, "column": 54 } } @@ -3630,15 +3698,15 @@ { "type": "CommentLine", "value": " because the tree is a red-black tree", - "start": 2349, - "end": 2394, + "start": 2599, + "end": 2644, "loc": { "start": { - "line": 98, + "line": 103, "column": 3 }, "end": { - "line": 98, + "line": 103, "column": 48 } } @@ -3647,43 +3715,43 @@ }, { "type": "ExpressionStatement", - "start": 2398, - "end": 2421, + "start": 2648, + "end": 2671, "loc": { "start": { - "line": 99, + "line": 104, "column": 3 }, "end": { - "line": 99, + "line": 104, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 2398, - "end": 2420, + "start": 2648, + "end": 2670, "loc": { "start": { - "line": 99, + "line": 104, "column": 3 }, "end": { - "line": 99, + "line": 104, "column": 25 } }, "callee": { "type": "Identifier", - "start": 2398, - "end": 2414, + "start": 2648, + "end": 2664, "loc": { "start": { - "line": 99, + "line": 104, "column": 3 }, "end": { - "line": 99, + "line": 104, "column": 19 }, "identifierName": "delete_one_child" @@ -3694,15 +3762,15 @@ "arguments": [ { "type": "Identifier", - "start": 2415, - "end": 2419, + "start": 2665, + "end": 2669, "loc": { "start": { - "line": 99, + "line": 104, "column": 20 }, "end": { - "line": 99, + "line": 104, "column": 24 }, "identifierName": "pred" @@ -3716,15 +3784,15 @@ { "type": "CommentLine", "value": " Delete predecessor node", - "start": 2264, - "end": 2290, + "start": 2514, + "end": 2540, "loc": { "start": { - "line": 96, + "line": 101, "column": 3 }, "end": { - "line": 96, + "line": 101, "column": 29 } } @@ -3732,15 +3800,15 @@ { "type": "CommentLine", "value": " note: this node can only have one non-leaf child", - "start": 2294, - "end": 2345, + "start": 2544, + "end": 2595, "loc": { "start": { - "line": 97, + "line": 102, "column": 3 }, "end": { - "line": 97, + "line": 102, "column": 54 } } @@ -3748,15 +3816,15 @@ { "type": "CommentLine", "value": " because the tree is a red-black tree", - "start": 2349, - "end": 2394, + "start": 2599, + "end": 2644, "loc": { "start": { - "line": 98, + "line": 103, "column": 3 }, "end": { - "line": 98, + "line": 103, "column": 48 } } @@ -3768,29 +3836,29 @@ }, "alternate": { "type": "IfStatement", - "start": 2431, - "end": 2892, + "start": 2681, + "end": 3175, "loc": { "start": { - "line": 100, + "line": 105, "column": 9 }, "end": { - "line": 114, + "line": 120, "column": 3 } }, "test": { "type": "UnaryExpression", - "start": 2435, - "end": 2455, + "start": 2685, + "end": 2705, "loc": { "start": { - "line": 100, + "line": 105, "column": 13 }, "end": { - "line": 100, + "line": 105, "column": 33 } }, @@ -3798,57 +3866,57 @@ "prefix": true, "argument": { "type": "CallExpression", - "start": 2436, - "end": 2455, + "start": 2686, + "end": 2705, "loc": { "start": { - "line": 100, + "line": 105, "column": 14 }, "end": { - "line": 100, + "line": 105, "column": 33 } }, "callee": { "type": "MemberExpression", - "start": 2436, - "end": 2453, + "start": 2686, + "end": 2703, "loc": { "start": { - "line": 100, + "line": 105, "column": 14 }, "end": { - "line": 100, + "line": 105, "column": 31 } }, "object": { "type": "MemberExpression", - "start": 2436, - "end": 2446, + "start": 2686, + "end": 2696, "loc": { "start": { - "line": 100, + "line": 105, "column": 14 }, "end": { - "line": 100, + "line": 105, "column": 24 } }, "object": { "type": "Identifier", - "start": 2436, - "end": 2440, + "start": 2686, + "end": 2690, "loc": { "start": { - "line": 100, + "line": 105, "column": 14 }, "end": { - "line": 100, + "line": 105, "column": 18 }, "identifierName": "node" @@ -3857,15 +3925,15 @@ }, "property": { "type": "Identifier", - "start": 2441, - "end": 2446, + "start": 2691, + "end": 2696, "loc": { "start": { - "line": 100, + "line": 105, "column": 19 }, "end": { - "line": 100, + "line": 105, "column": 24 }, "identifierName": "right" @@ -3876,15 +3944,15 @@ }, "property": { "type": "Identifier", - "start": 2447, - "end": 2453, + "start": 2697, + "end": 2703, "loc": { "start": { - "line": 100, + "line": 105, "column": 25 }, "end": { - "line": 100, + "line": 105, "column": 31 }, "identifierName": "isLeaf" @@ -3901,59 +3969,59 @@ }, "consequent": { "type": "BlockStatement", - "start": 2457, - "end": 2798, + "start": 2707, + "end": 3081, "loc": { "start": { - "line": 100, + "line": 105, "column": 35 }, "end": { - "line": 110, + "line": 116, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 2587, - "end": 2611, + "start": 2837, + "end": 2861, "loc": { "start": { - "line": 104, + "line": 109, "column": 3 }, "end": { - "line": 104, + "line": 109, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 2593, - "end": 2610, + "start": 2843, + "end": 2860, "loc": { "start": { - "line": 104, + "line": 109, "column": 9 }, "end": { - "line": 104, + "line": 109, "column": 26 } }, "id": { "type": "Identifier", - "start": 2593, - "end": 2597, + "start": 2843, + "end": 2847, "loc": { "start": { - "line": 104, + "line": 109, "column": 9 }, "end": { - "line": 104, + "line": 109, "column": 13 }, "identifierName": "succ" @@ -3963,29 +4031,29 @@ }, "init": { "type": "MemberExpression", - "start": 2600, - "end": 2610, + "start": 2850, + "end": 2860, "loc": { "start": { - "line": 104, + "line": 109, "column": 16 }, "end": { - "line": 104, + "line": 109, "column": 26 } }, "object": { "type": "Identifier", - "start": 2600, - "end": 2604, + "start": 2850, + "end": 2854, "loc": { "start": { - "line": 104, + "line": 109, "column": 16 }, "end": { - "line": 104, + "line": 109, "column": 20 }, "identifierName": "node" @@ -3994,15 +4062,15 @@ }, "property": { "type": "Identifier", - "start": 2605, - "end": 2610, + "start": 2855, + "end": 2860, "loc": { "start": { - "line": 104, + "line": 109, "column": 21 }, "end": { - "line": 104, + "line": 109, "column": 26 }, "identifierName": "right" @@ -4019,15 +4087,15 @@ { "type": "CommentLine", "value": " Replace node's key with successor's key", - "start": 2462, - "end": 2504, + "start": 2712, + "end": 2754, "loc": { "start": { - "line": 101, + "line": 106, "column": 3 }, "end": { - "line": 101, + "line": 106, "column": 45 } } @@ -4035,15 +4103,15 @@ { "type": "CommentLine", "value": " If there is no left child, then there can only be one right", - "start": 2508, - "end": 2570, + "start": 2758, + "end": 2820, "loc": { "start": { - "line": 102, + "line": 107, "column": 3 }, "end": { - "line": 102, + "line": 107, "column": 65 } } @@ -4051,15 +4119,15 @@ { "type": "CommentLine", "value": " child.", - "start": 2574, - "end": 2583, + "start": 2824, + "end": 2833, "loc": { "start": { - "line": 103, + "line": 108, "column": 3 }, "end": { - "line": 103, + "line": 108, "column": 12 } } @@ -4068,58 +4136,157 @@ }, { "type": "ExpressionStatement", - "start": 2615, - "end": 2635, + "start": 2865, + "end": 2894, "loc": { "start": { - "line": 105, + "line": 110, "column": 3 }, "end": { - "line": 105, + "line": 110, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 2865, + "end": 2893, + "loc": { + "start": { + "line": 110, + "column": 3 + }, + "end": { + "line": 110, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 2865, + "end": 2871, + "loc": { + "start": { + "line": 110, + "column": 3 + }, + "end": { + "line": 110, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 2872, + "end": 2892, + "loc": { + "start": { + "line": 110, + "column": 10 + }, + "end": { + "line": 110, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 2872, + "end": 2876, + "loc": { + "start": { + "line": 110, + "column": 10 + }, + "end": { + "line": 110, + "column": 14 + }, + "identifierName": "succ" + }, + "name": "succ" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 2888, + "end": 2892, + "loc": { + "start": { + "line": 110, + "column": 26 + }, + "end": { + "line": 110, + "column": 30 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 2898, + "end": 2918, + "loc": { + "start": { + "line": 111, + "column": 3 + }, + "end": { + "line": 111, "column": 23 } }, "expression": { "type": "AssignmentExpression", - "start": 2615, - "end": 2634, + "start": 2898, + "end": 2917, "loc": { "start": { - "line": 105, + "line": 111, "column": 3 }, "end": { - "line": 105, + "line": 111, "column": 22 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 2615, - "end": 2623, + "start": 2898, + "end": 2906, "loc": { "start": { - "line": 105, + "line": 111, "column": 3 }, "end": { - "line": 105, + "line": 111, "column": 11 } }, "object": { "type": "Identifier", - "start": 2615, - "end": 2619, + "start": 2898, + "end": 2902, "loc": { "start": { - "line": 105, + "line": 111, "column": 3 }, "end": { - "line": 105, + "line": 111, "column": 7 }, "identifierName": "node" @@ -4128,15 +4295,15 @@ }, "property": { "type": "Identifier", - "start": 2620, - "end": 2623, + "start": 2903, + "end": 2906, "loc": { "start": { - "line": 105, + "line": 111, "column": 8 }, "end": { - "line": 105, + "line": 111, "column": 11 }, "identifierName": "key" @@ -4147,29 +4314,29 @@ }, "right": { "type": "MemberExpression", - "start": 2626, - "end": 2634, + "start": 2909, + "end": 2917, "loc": { "start": { - "line": 105, + "line": 111, "column": 14 }, "end": { - "line": 105, + "line": 111, "column": 22 } }, "object": { "type": "Identifier", - "start": 2626, - "end": 2630, + "start": 2909, + "end": 2913, "loc": { "start": { - "line": 105, + "line": 111, "column": 14 }, "end": { - "line": 105, + "line": 111, "column": 18 }, "identifierName": "succ" @@ -4178,15 +4345,15 @@ }, "property": { "type": "Identifier", - "start": 2631, - "end": 2634, + "start": 2914, + "end": 2917, "loc": { "start": { - "line": 105, + "line": 111, "column": 19 }, "end": { - "line": 105, + "line": 111, "column": 22 }, "identifierName": "key" @@ -4200,15 +4367,15 @@ { "type": "CommentLine", "value": " Delete successor node", - "start": 2639, - "end": 2663, + "start": 2922, + "end": 2946, "loc": { "start": { - "line": 106, + "line": 112, "column": 3 }, "end": { - "line": 106, + "line": 112, "column": 27 } } @@ -4216,15 +4383,15 @@ { "type": "CommentLine", "value": " note: this node can only have one non-leaf child", - "start": 2667, - "end": 2718, + "start": 2950, + "end": 3001, "loc": { "start": { - "line": 107, + "line": 113, "column": 3 }, "end": { - "line": 107, + "line": 113, "column": 54 } } @@ -4232,15 +4399,15 @@ { "type": "CommentLine", "value": " because the tree is a red-black tree", - "start": 2722, - "end": 2767, + "start": 3005, + "end": 3050, "loc": { "start": { - "line": 108, + "line": 114, "column": 3 }, "end": { - "line": 108, + "line": 114, "column": 48 } } @@ -4249,43 +4416,43 @@ }, { "type": "ExpressionStatement", - "start": 2771, - "end": 2794, + "start": 3054, + "end": 3077, "loc": { "start": { - "line": 109, + "line": 115, "column": 3 }, "end": { - "line": 109, + "line": 115, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 2771, - "end": 2793, + "start": 3054, + "end": 3076, "loc": { "start": { - "line": 109, + "line": 115, "column": 3 }, "end": { - "line": 109, + "line": 115, "column": 25 } }, "callee": { "type": "Identifier", - "start": 2771, - "end": 2787, + "start": 3054, + "end": 3070, "loc": { "start": { - "line": 109, + "line": 115, "column": 3 }, "end": { - "line": 109, + "line": 115, "column": 19 }, "identifierName": "delete_one_child" @@ -4296,15 +4463,15 @@ "arguments": [ { "type": "Identifier", - "start": 2788, - "end": 2792, + "start": 3071, + "end": 3075, "loc": { "start": { - "line": 109, + "line": 115, "column": 20 }, "end": { - "line": 109, + "line": 115, "column": 24 }, "identifierName": "succ" @@ -4318,15 +4485,15 @@ { "type": "CommentLine", "value": " Delete successor node", - "start": 2639, - "end": 2663, + "start": 2922, + "end": 2946, "loc": { "start": { - "line": 106, + "line": 112, "column": 3 }, "end": { - "line": 106, + "line": 112, "column": 27 } } @@ -4334,15 +4501,15 @@ { "type": "CommentLine", "value": " note: this node can only have one non-leaf child", - "start": 2667, - "end": 2718, + "start": 2950, + "end": 3001, "loc": { "start": { - "line": 107, + "line": 113, "column": 3 }, "end": { - "line": 107, + "line": 113, "column": 54 } } @@ -4350,15 +4517,15 @@ { "type": "CommentLine", "value": " because the tree is a red-black tree", - "start": 2722, - "end": 2767, + "start": 3005, + "end": 3050, "loc": { "start": { - "line": 108, + "line": 114, "column": 3 }, "end": { - "line": 108, + "line": 114, "column": 48 } } @@ -4370,43 +4537,43 @@ }, "alternate": { "type": "IfStatement", - "start": 2804, - "end": 2892, + "start": 3087, + "end": 3175, "loc": { "start": { - "line": 110, + "line": 116, "column": 9 }, "end": { - "line": 114, + "line": 120, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 2808, - "end": 2826, + "start": 3091, + "end": 3109, "loc": { "start": { - "line": 110, + "line": 116, "column": 13 }, "end": { - "line": 110, + "line": 116, "column": 31 } }, "left": { "type": "Identifier", - "start": 2808, - "end": 2812, + "start": 3091, + "end": 3095, "loc": { "start": { - "line": 110, + "line": 116, "column": 13 }, "end": { - "line": 110, + "line": 116, "column": 17 }, "identifierName": "node" @@ -4416,44 +4583,44 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 2817, - "end": 2826, + "start": 3100, + "end": 3109, "loc": { "start": { - "line": 110, + "line": 116, "column": 22 }, "end": { - "line": 110, + "line": 116, "column": 31 } }, "object": { "type": "ThisExpression", - "start": 2817, - "end": 2821, + "start": 3100, + "end": 3104, "loc": { "start": { - "line": 110, + "line": 116, "column": 22 }, "end": { - "line": 110, + "line": 116, "column": 26 } } }, "property": { "type": "Identifier", - "start": 2822, - "end": 2826, + "start": 3105, + "end": 3109, "loc": { "start": { - "line": 110, + "line": 116, "column": 27 }, "end": { - "line": 110, + "line": 116, "column": 31 }, "identifierName": "root" @@ -4465,88 +4632,88 @@ }, "consequent": { "type": "BlockStatement", - "start": 2828, - "end": 2854, + "start": 3111, + "end": 3137, "loc": { "start": { - "line": 110, + "line": 116, "column": 33 }, "end": { - "line": 112, + "line": 118, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 2833, - "end": 2850, + "start": 3116, + "end": 3133, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 20 } }, "expression": { "type": "AssignmentExpression", - "start": 2833, - "end": 2849, + "start": 3116, + "end": 3132, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 19 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 2833, - "end": 2842, + "start": 3116, + "end": 3125, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 2833, - "end": 2837, + "start": 3116, + "end": 3120, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 7 } } }, "property": { "type": "Identifier", - "start": 2838, - "end": 2842, + "start": 3121, + "end": 3125, "loc": { "start": { - "line": 111, + "line": 117, "column": 8 }, "end": { - "line": 111, + "line": 117, "column": 12 }, "identifierName": "root" @@ -4557,15 +4724,15 @@ }, "right": { "type": "NullLiteral", - "start": 2845, - "end": 2849, + "start": 3128, + "end": 3132, "loc": { "start": { - "line": 111, + "line": 117, "column": 15 }, "end": { - "line": 111, + "line": 117, "column": 19 } } @@ -4577,58 +4744,58 @@ }, "alternate": { "type": "BlockStatement", - "start": 2860, - "end": 2892, + "start": 3143, + "end": 3175, "loc": { "start": { - "line": 112, + "line": 118, "column": 9 }, "end": { - "line": 114, + "line": 120, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 2865, - "end": 2888, + "start": 3148, + "end": 3171, "loc": { "start": { - "line": 113, + "line": 119, "column": 3 }, "end": { - "line": 113, + "line": 119, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 2865, - "end": 2887, + "start": 3148, + "end": 3170, "loc": { "start": { - "line": 113, + "line": 119, "column": 3 }, "end": { - "line": 113, + "line": 119, "column": 25 } }, "callee": { "type": "Identifier", - "start": 2865, - "end": 2881, + "start": 3148, + "end": 3164, "loc": { "start": { - "line": 113, + "line": 119, "column": 3 }, "end": { - "line": 113, + "line": 119, "column": 19 }, "identifierName": "delete_one_child" @@ -4638,15 +4805,15 @@ "arguments": [ { "type": "Identifier", - "start": 2882, - "end": 2886, + "start": 3165, + "end": 3169, "loc": { "start": { - "line": 113, + "line": 119, "column": 20 }, "end": { - "line": 113, + "line": 119, "column": 24 }, "identifierName": "node" @@ -4670,15 +4837,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2002, - "end": 2107, + "start": 2252, + "end": 2357, "loc": { "start": { - "line": 86, + "line": 91, "column": 1 }, "end": { - "line": 90, + "line": 95, "column": 4 } } @@ -4687,16 +4854,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 2898, - "end": 3310, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 3181, + "end": 3593, "loc": { "start": { - "line": 117, + "line": 123, "column": 1 }, "end": { - "line": 125, + "line": 131, "column": 4 } } @@ -4705,15 +4872,15 @@ }, { "type": "ClassMethod", - "start": 3312, - "end": 3435, + "start": 3595, + "end": 3718, "loc": { "start": { - "line": 126, + "line": 132, "column": 1 }, "end": { - "line": 132, + "line": 138, "column": 2 } }, @@ -4721,15 +4888,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 3312, - "end": 3318, + "start": 3595, + "end": 3601, "loc": { "start": { - "line": 126, + "line": 132, "column": 1 }, "end": { - "line": 126, + "line": 132, "column": 7 }, "identifierName": "remove" @@ -4745,15 +4912,15 @@ "params": [ { "type": "Identifier", - "start": 3319, - "end": 3322, + "start": 3602, + "end": 3605, "loc": { "start": { - "line": 126, + "line": 132, "column": 8 }, "end": { - "line": 126, + "line": 132, "column": 11 }, "identifierName": "key" @@ -4763,59 +4930,59 @@ ], "body": { "type": "BlockStatement", - "start": 3324, - "end": 3435, + "start": 3607, + "end": 3718, "loc": { "start": { - "line": 126, + "line": 132, "column": 13 }, "end": { - "line": 132, + "line": 138, "column": 2 } }, "body": [ { "type": "VariableDeclaration", - "start": 3328, - "end": 3359, + "start": 3611, + "end": 3642, "loc": { "start": { - "line": 127, + "line": 133, "column": 2 }, "end": { - "line": 127, + "line": 133, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 3334, - "end": 3358, + "start": 3617, + "end": 3641, "loc": { "start": { - "line": 127, + "line": 133, "column": 8 }, "end": { - "line": 127, + "line": 133, "column": 32 } }, "id": { "type": "Identifier", - "start": 3334, - "end": 3338, + "start": 3617, + "end": 3621, "loc": { "start": { - "line": 127, + "line": 133, "column": 8 }, "end": { - "line": 127, + "line": 133, "column": 12 }, "identifierName": "node" @@ -4824,58 +4991,58 @@ }, "init": { "type": "CallExpression", - "start": 3341, - "end": 3358, + "start": 3624, + "end": 3641, "loc": { "start": { - "line": 127, + "line": 133, "column": 15 }, "end": { - "line": 127, + "line": 133, "column": 32 } }, "callee": { "type": "MemberExpression", - "start": 3341, - "end": 3353, + "start": 3624, + "end": 3636, "loc": { "start": { - "line": 127, + "line": 133, "column": 15 }, "end": { - "line": 127, + "line": 133, "column": 27 } }, "object": { "type": "ThisExpression", - "start": 3341, - "end": 3345, + "start": 3624, + "end": 3628, "loc": { "start": { - "line": 127, + "line": 133, "column": 15 }, "end": { - "line": 127, + "line": 133, "column": 19 } } }, "property": { "type": "Identifier", - "start": 3346, - "end": 3353, + "start": 3629, + "end": 3636, "loc": { "start": { - "line": 127, + "line": 133, "column": 20 }, "end": { - "line": 127, + "line": 133, "column": 27 }, "identifierName": "_search" @@ -4887,15 +5054,15 @@ "arguments": [ { "type": "Identifier", - "start": 3354, - "end": 3357, + "start": 3637, + "end": 3640, "loc": { "start": { - "line": 127, + "line": 133, "column": 28 }, "end": { - "line": 127, + "line": 133, "column": 31 }, "identifierName": "key" @@ -4910,43 +5077,43 @@ }, { "type": "IfStatement", - "start": 3362, - "end": 3394, + "start": 3645, + "end": 3677, "loc": { "start": { - "line": 128, + "line": 134, "column": 2 }, "end": { - "line": 128, + "line": 134, "column": 34 } }, "test": { "type": "BinaryExpression", - "start": 3366, - "end": 3379, + "start": 3649, + "end": 3662, "loc": { "start": { - "line": 128, + "line": 134, "column": 6 }, "end": { - "line": 128, + "line": 134, "column": 19 } }, "left": { "type": "Identifier", - "start": 3366, - "end": 3370, + "start": 3649, + "end": 3653, "loc": { "start": { - "line": 128, + "line": 134, "column": 6 }, "end": { - "line": 128, + "line": 134, "column": 10 }, "identifierName": "node" @@ -4956,15 +5123,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 3375, - "end": 3379, + "start": 3658, + "end": 3662, "loc": { "start": { - "line": 128, + "line": 134, "column": 15 }, "end": { - "line": 128, + "line": 134, "column": 19 } } @@ -4972,29 +5139,29 @@ }, "consequent": { "type": "ReturnStatement", - "start": 3381, - "end": 3394, + "start": 3664, + "end": 3677, "loc": { "start": { - "line": 128, + "line": 134, "column": 21 }, "end": { - "line": 128, + "line": 134, "column": 34 } }, "argument": { "type": "BooleanLiteral", - "start": 3388, - "end": 3393, + "start": 3671, + "end": 3676, "loc": { "start": { - "line": 128, + "line": 134, "column": 28 }, "end": { - "line": 128, + "line": 134, "column": 33 } }, @@ -5005,72 +5172,72 @@ }, { "type": "ExpressionStatement", - "start": 3398, - "end": 3417, + "start": 3681, + "end": 3700, "loc": { "start": { - "line": 130, + "line": 136, "column": 2 }, "end": { - "line": 130, + "line": 136, "column": 21 } }, "expression": { "type": "CallExpression", - "start": 3398, - "end": 3416, + "start": 3681, + "end": 3699, "loc": { "start": { - "line": 130, + "line": 136, "column": 2 }, "end": { - "line": 130, + "line": 136, "column": 20 } }, "callee": { "type": "MemberExpression", - "start": 3398, - "end": 3410, + "start": 3681, + "end": 3693, "loc": { "start": { - "line": 130, + "line": 136, "column": 2 }, "end": { - "line": 130, + "line": 136, "column": 14 } }, "object": { "type": "ThisExpression", - "start": 3398, - "end": 3402, + "start": 3681, + "end": 3685, "loc": { "start": { - "line": 130, + "line": 136, "column": 2 }, "end": { - "line": 130, + "line": 136, "column": 6 } } }, "property": { "type": "Identifier", - "start": 3403, - "end": 3410, + "start": 3686, + "end": 3693, "loc": { "start": { - "line": 130, + "line": 136, "column": 7 }, "end": { - "line": 130, + "line": 136, "column": 14 }, "identifierName": "_delete" @@ -5082,15 +5249,15 @@ "arguments": [ { "type": "Identifier", - "start": 3411, - "end": 3415, + "start": 3694, + "end": 3698, "loc": { "start": { - "line": 130, + "line": 136, "column": 15 }, "end": { - "line": 130, + "line": 136, "column": 19 }, "identifierName": "node" @@ -5102,29 +5269,29 @@ }, { "type": "ReturnStatement", - "start": 3420, - "end": 3432, + "start": 3703, + "end": 3715, "loc": { "start": { - "line": 131, + "line": 137, "column": 2 }, "end": { - "line": 131, + "line": 137, "column": 14 } }, "argument": { "type": "BooleanLiteral", - "start": 3427, - "end": 3431, + "start": 3710, + "end": 3714, "loc": { "start": { - "line": 131, + "line": 137, "column": 9 }, "end": { - "line": 131, + "line": 137, "column": 13 } }, @@ -5138,16 +5305,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 2898, - "end": 3310, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 3181, + "end": 3593, "loc": { "start": { - "line": 117, + "line": 123, "column": 1 }, "end": { - "line": 125, + "line": 131, "column": 4 } } @@ -5156,16 +5323,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t ", - "start": 3438, - "end": 3687, + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", + "start": 3721, + "end": 3978, "loc": { "start": { - "line": 134, + "line": 140, "column": 1 }, "end": { - "line": 140, + "line": 146, "column": 4 } } @@ -5174,15 +5341,15 @@ }, { "type": "ClassMethod", - "start": 3689, - "end": 3803, + "start": 3980, + "end": 4094, "loc": { "start": { - "line": 141, + "line": 147, "column": 1 }, "end": { - "line": 144, + "line": 150, "column": 2 } }, @@ -5191,15 +5358,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 3690, - "end": 3695, + "start": 3981, + "end": 3986, "loc": { "start": { - "line": 141, + "line": 147, "column": 2 }, "end": { - "line": 141, + "line": 147, "column": 7 }, "identifierName": "range" @@ -5214,15 +5381,15 @@ "params": [ { "type": "Identifier", - "start": 3696, - "end": 3700, + "start": 3987, + "end": 3991, "loc": { "start": { - "line": 141, + "line": 147, "column": 8 }, "end": { - "line": 141, + "line": 147, "column": 12 }, "identifierName": "left" @@ -5231,15 +5398,15 @@ }, { "type": "Identifier", - "start": 3702, - "end": 3707, + "start": 3993, + "end": 3998, "loc": { "start": { - "line": 141, + "line": 147, "column": 14 }, "end": { - "line": 141, + "line": 147, "column": 19 }, "identifierName": "right" @@ -5249,87 +5416,87 @@ ], "body": { "type": "BlockStatement", - "start": 3709, - "end": 3803, + "start": 4000, + "end": 4094, "loc": { "start": { - "line": 141, + "line": 147, "column": 21 }, "end": { - "line": 144, + "line": 150, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 3713, - "end": 3800, + "start": 4004, + "end": 4091, "loc": { "start": { - "line": 142, + "line": 148, "column": 2 }, "end": { - "line": 143, + "line": 149, "column": 63 } }, "test": { "type": "BinaryExpression", - "start": 3717, - "end": 3735, + "start": 4008, + "end": 4026, "loc": { "start": { - "line": 142, + "line": 148, "column": 6 }, "end": { - "line": 142, + "line": 148, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 3717, - "end": 3726, + "start": 4008, + "end": 4017, "loc": { "start": { - "line": 142, + "line": 148, "column": 6 }, "end": { - "line": 142, + "line": 148, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 3717, - "end": 3721, + "start": 4008, + "end": 4012, "loc": { "start": { - "line": 142, + "line": 148, "column": 6 }, "end": { - "line": 142, + "line": 148, "column": 10 } } }, "property": { "type": "Identifier", - "start": 3722, - "end": 3726, + "start": 4013, + "end": 4017, "loc": { "start": { - "line": 142, + "line": 148, "column": 11 }, "end": { - "line": 142, + "line": 148, "column": 15 }, "identifierName": "root" @@ -5341,15 +5508,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 3731, - "end": 3735, + "start": 4022, + "end": 4026, "loc": { "start": { - "line": 142, + "line": 148, "column": 20 }, "end": { - "line": 142, + "line": 148, "column": 24 } } @@ -5357,58 +5524,58 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 3740, - "end": 3800, + "start": 4031, + "end": 4091, "loc": { "start": { - "line": 143, + "line": 149, "column": 3 }, "end": { - "line": 143, + "line": 149, "column": 63 } }, "expression": { "type": "YieldExpression", - "start": 3740, - "end": 3799, + "start": 4031, + "end": 4090, "loc": { "start": { - "line": 143, + "line": 149, "column": 3 }, "end": { - "line": 143, + "line": 149, "column": 62 } }, "delegate": true, "argument": { "type": "CallExpression", - "start": 3747, - "end": 3799, + "start": 4038, + "end": 4090, "loc": { "start": { - "line": 143, + "line": 149, "column": 10 }, "end": { - "line": 143, + "line": 149, "column": 62 } }, "callee": { "type": "Identifier", - "start": 3747, - "end": 3761, + "start": 4038, + "end": 4052, "loc": { "start": { - "line": 143, + "line": 149, "column": 10 }, "end": { - "line": 143, + "line": 149, "column": 24 }, "identifierName": "rangetraversal" @@ -5418,44 +5585,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 3762, - "end": 3774, + "start": 4053, + "end": 4065, "loc": { "start": { - "line": 143, + "line": 149, "column": 25 }, "end": { - "line": 143, + "line": 149, "column": 37 } }, "object": { "type": "ThisExpression", - "start": 3762, - "end": 3766, + "start": 4053, + "end": 4057, "loc": { "start": { - "line": 143, + "line": 149, "column": 25 }, "end": { - "line": 143, + "line": 149, "column": 29 } } }, "property": { "type": "Identifier", - "start": 3767, - "end": 3774, + "start": 4058, + "end": 4065, "loc": { "start": { - "line": 143, + "line": 149, "column": 30 }, "end": { - "line": 143, + "line": 149, "column": 37 }, "identifierName": "compare" @@ -5466,44 +5633,44 @@ }, { "type": "MemberExpression", - "start": 3776, - "end": 3785, + "start": 4067, + "end": 4076, "loc": { "start": { - "line": 143, + "line": 149, "column": 39 }, "end": { - "line": 143, + "line": 149, "column": 48 } }, "object": { "type": "ThisExpression", - "start": 3776, - "end": 3780, + "start": 4067, + "end": 4071, "loc": { "start": { - "line": 143, + "line": 149, "column": 39 }, "end": { - "line": 143, + "line": 149, "column": 43 } } }, "property": { "type": "Identifier", - "start": 3781, - "end": 3785, + "start": 4072, + "end": 4076, "loc": { "start": { - "line": 143, + "line": 149, "column": 44 }, "end": { - "line": 143, + "line": 149, "column": 48 }, "identifierName": "root" @@ -5514,15 +5681,15 @@ }, { "type": "Identifier", - "start": 3787, - "end": 3791, + "start": 4078, + "end": 4082, "loc": { "start": { - "line": 143, + "line": 149, "column": 50 }, "end": { - "line": 143, + "line": 149, "column": 54 }, "identifierName": "left" @@ -5531,15 +5698,15 @@ }, { "type": "Identifier", - "start": 3793, - "end": 3798, + "start": 4084, + "end": 4089, "loc": { "start": { - "line": 143, + "line": 149, "column": 56 }, "end": { - "line": 143, + "line": 149, "column": 61 }, "identifierName": "right" @@ -5559,16 +5726,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t ", - "start": 3438, - "end": 3687, + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", + "start": 3721, + "end": 3978, "loc": { "start": { - "line": 134, + "line": 140, "column": 1 }, "end": { - "line": 140, + "line": 146, "column": 4 } } @@ -5577,16 +5744,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t ", - "start": 3806, - "end": 3902, + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", + "start": 4097, + "end": 4201, "loc": { "start": { - "line": 146, + "line": 152, "column": 1 }, "end": { - "line": 150, + "line": 156, "column": 4 } } @@ -5595,15 +5762,15 @@ }, { "type": "ClassMethod", - "start": 3904, - "end": 3979, + "start": 4203, + "end": 4278, "loc": { "start": { - "line": 151, + "line": 157, "column": 1 }, "end": { - "line": 153, + "line": 159, "column": 2 } }, @@ -5612,15 +5779,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 3905, - "end": 3910, + "start": 4204, + "end": 4209, "loc": { "start": { - "line": 151, + "line": 157, "column": 2 }, "end": { - "line": 151, + "line": 157, "column": 7 }, "identifierName": "items" @@ -5635,87 +5802,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 3913, - "end": 3979, + "start": 4212, + "end": 4278, "loc": { "start": { - "line": 151, + "line": 157, "column": 10 }, "end": { - "line": 153, + "line": 159, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 3917, - "end": 3976, + "start": 4216, + "end": 4275, "loc": { "start": { - "line": 152, + "line": 158, "column": 2 }, "end": { - "line": 152, + "line": 158, "column": 61 } }, "test": { "type": "BinaryExpression", - "start": 3921, - "end": 3939, + "start": 4220, + "end": 4238, "loc": { "start": { - "line": 152, + "line": 158, "column": 6 }, "end": { - "line": 152, + "line": 158, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 3921, - "end": 3930, + "start": 4220, + "end": 4229, "loc": { "start": { - "line": 152, + "line": 158, "column": 6 }, "end": { - "line": 152, + "line": 158, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 3921, - "end": 3925, + "start": 4220, + "end": 4224, "loc": { "start": { - "line": 152, + "line": 158, "column": 6 }, "end": { - "line": 152, + "line": 158, "column": 10 } } }, "property": { "type": "Identifier", - "start": 3926, - "end": 3930, + "start": 4225, + "end": 4229, "loc": { "start": { - "line": 152, + "line": 158, "column": 11 }, "end": { - "line": 152, + "line": 158, "column": 15 }, "identifierName": "root" @@ -5727,15 +5894,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 3935, - "end": 3939, + "start": 4234, + "end": 4238, "loc": { "start": { - "line": 152, + "line": 158, "column": 20 }, "end": { - "line": 152, + "line": 158, "column": 24 } } @@ -5743,58 +5910,58 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 3941, - "end": 3976, + "start": 4240, + "end": 4275, "loc": { "start": { - "line": 152, + "line": 158, "column": 26 }, "end": { - "line": 152, + "line": 158, "column": 61 } }, "expression": { "type": "YieldExpression", - "start": 3941, - "end": 3975, + "start": 4240, + "end": 4274, "loc": { "start": { - "line": 152, + "line": 158, "column": 26 }, "end": { - "line": 152, + "line": 158, "column": 60 } }, "delegate": true, "argument": { "type": "CallExpression", - "start": 3948, - "end": 3975, + "start": 4247, + "end": 4274, "loc": { "start": { - "line": 152, + "line": 158, "column": 33 }, "end": { - "line": 152, + "line": 158, "column": 60 } }, "callee": { "type": "Identifier", - "start": 3948, - "end": 3964, + "start": 4247, + "end": 4263, "loc": { "start": { - "line": 152, + "line": 158, "column": 33 }, "end": { - "line": 152, + "line": 158, "column": 49 }, "identifierName": "inordertraversal" @@ -5804,44 +5971,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 3965, - "end": 3974, + "start": 4264, + "end": 4273, "loc": { "start": { - "line": 152, + "line": 158, "column": 50 }, "end": { - "line": 152, + "line": 158, "column": 59 } }, "object": { "type": "ThisExpression", - "start": 3965, - "end": 3969, + "start": 4264, + "end": 4268, "loc": { "start": { - "line": 152, + "line": 158, "column": 50 }, "end": { - "line": 152, + "line": 158, "column": 54 } } }, "property": { "type": "Identifier", - "start": 3970, - "end": 3974, + "start": 4269, + "end": 4273, "loc": { "start": { - "line": 152, + "line": 158, "column": 55 }, "end": { - "line": 152, + "line": 158, "column": 59 }, "identifierName": "root" @@ -5863,16 +6030,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t ", - "start": 3806, - "end": 3902, + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", + "start": 4097, + "end": 4201, "loc": { "start": { - "line": 146, + "line": 152, "column": 1 }, "end": { - "line": 150, + "line": 156, "column": 4 } } @@ -5882,15 +6049,15 @@ { "type": "CommentBlock", "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 3982, - "end": 4030, + "start": 4281, + "end": 4329, "loc": { "start": { - "line": 155, + "line": 161, "column": 1 }, "end": { - "line": 157, + "line": 163, "column": 4 } } @@ -5899,15 +6066,15 @@ }, { "type": "ClassMethod", - "start": 4032, - "end": 4079, + "start": 4331, + "end": 4378, "loc": { "start": { - "line": 158, + "line": 164, "column": 1 }, "end": { - "line": 160, + "line": 166, "column": 2 } }, @@ -5915,29 +6082,29 @@ "computed": true, "key": { "type": "MemberExpression", - "start": 4033, - "end": 4048, + "start": 4332, + "end": 4347, "loc": { "start": { - "line": 158, + "line": 164, "column": 2 }, "end": { - "line": 158, + "line": 164, "column": 17 } }, "object": { "type": "Identifier", - "start": 4033, - "end": 4039, + "start": 4332, + "end": 4338, "loc": { "start": { - "line": 158, + "line": 164, "column": 2 }, "end": { - "line": 158, + "line": 164, "column": 8 }, "identifierName": "Symbol" @@ -5947,15 +6114,15 @@ }, "property": { "type": "Identifier", - "start": 4040, - "end": 4048, + "start": 4339, + "end": 4347, "loc": { "start": { - "line": 158, + "line": 164, "column": 9 }, "end": { - "line": 158, + "line": 164, "column": 17 }, "identifierName": "iterator" @@ -5973,87 +6140,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 4052, - "end": 4079, + "start": 4351, + "end": 4378, "loc": { "start": { - "line": 158, + "line": 164, "column": 21 }, "end": { - "line": 160, + "line": 166, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 4056, - "end": 4076, + "start": 4355, + "end": 4375, "loc": { "start": { - "line": 159, + "line": 165, "column": 2 }, "end": { - "line": 159, + "line": 165, "column": 22 } }, "argument": { "type": "CallExpression", - "start": 4063, - "end": 4075, + "start": 4362, + "end": 4374, "loc": { "start": { - "line": 159, + "line": 165, "column": 9 }, "end": { - "line": 159, + "line": 165, "column": 21 } }, "callee": { "type": "MemberExpression", - "start": 4063, - "end": 4073, + "start": 4362, + "end": 4372, "loc": { "start": { - "line": 159, + "line": 165, "column": 9 }, "end": { - "line": 159, + "line": 165, "column": 19 } }, "object": { "type": "ThisExpression", - "start": 4063, - "end": 4067, + "start": 4362, + "end": 4366, "loc": { "start": { - "line": 159, + "line": 165, "column": 9 }, "end": { - "line": 159, + "line": 165, "column": 13 } } }, "property": { "type": "Identifier", - "start": 4068, - "end": 4073, + "start": 4367, + "end": 4372, "loc": { "start": { - "line": 159, + "line": 165, "column": 14 }, "end": { - "line": 159, + "line": 165, "column": 19 }, "identifierName": "items" @@ -6073,15 +6240,15 @@ { "type": "CommentBlock", "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 3982, - "end": 4030, + "start": 4281, + "end": 4329, "loc": { "start": { - "line": 155, + "line": 161, "column": 1 }, "end": { - "line": 157, + "line": 163, "column": 4 } } @@ -6090,16 +6257,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4082, - "end": 4295, + "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", + "start": 4381, + "end": 4525, "loc": { "start": { - "line": 162, + "line": 168, "column": 1 }, "end": { - "line": 168, + "line": 173, "column": 4 } } @@ -6108,15 +6275,15 @@ }, { "type": "ClassMethod", - "start": 4297, - "end": 4444, + "start": 4527, + "end": 4589, "loc": { "start": { - "line": 169, + "line": 174, "column": 1 }, "end": { - "line": 175, + "line": 176, "column": 2 } }, @@ -6124,20 +6291,20 @@ "computed": false, "key": { "type": "Identifier", - "start": 4304, - "end": 4308, + "start": 4534, + "end": 4539, "loc": { "start": { - "line": 169, + "line": 174, "column": 8 }, "end": { - "line": 169, - "column": 12 + "line": 174, + "column": 13 }, - "identifierName": "from" + "identifierName": "empty" }, - "name": "from" + "name": "empty" }, "kind": "method", "id": null, @@ -6147,125 +6314,304 @@ "params": [ { "type": "Identifier", - "start": 4309, - "end": 4316, + "start": 4540, + "end": 4547, "loc": { "start": { - "line": 169, - "column": 13 + "line": 174, + "column": 14 }, "end": { - "line": 169, - "column": 20 + "line": 174, + "column": 21 }, "identifierName": "compare" }, "name": "compare" - }, - { - "type": "Identifier", - "start": 4318, - "end": 4326, - "loc": { - "start": { - "line": 169, - "column": 22 - }, - "end": { - "line": 169, - "column": 30 - }, - "identifierName": "iterable" - }, - "name": "iterable" } ], "body": { "type": "BlockStatement", - "start": 4328, - "end": 4444, + "start": 4549, + "end": 4589, "loc": { "start": { - "line": 169, - "column": 32 + "line": 174, + "column": 23 }, "end": { - "line": 175, + "line": 176, "column": 2 } }, "body": [ { - "type": "VariableDeclaration", - "start": 4332, - "end": 4371, + "type": "ReturnStatement", + "start": 4553, + "end": 4586, "loc": { "start": { - "line": 170, + "line": 175, "column": 2 }, "end": { - "line": 170, - "column": 41 + "line": 175, + "column": 35 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 4338, - "end": 4370, + "argument": { + "type": "NewExpression", + "start": 4560, + "end": 4585, + "loc": { + "start": { + "line": 175, + "column": 9 + }, + "end": { + "line": 175, + "column": 34 + } + }, + "callee": { + "type": "Identifier", + "start": 4564, + "end": 4576, "loc": { "start": { - "line": 170, - "column": 8 + "line": 175, + "column": 13 }, "end": { - "line": 170, - "column": 40 - } + "line": 175, + "column": 25 + }, + "identifierName": "RedBlackTree" }, - "id": { + "name": "RedBlackTree" + }, + "arguments": [ + { "type": "Identifier", - "start": 4338, - "end": 4342, + "start": 4577, + "end": 4584, "loc": { "start": { - "line": 170, - "column": 8 + "line": 175, + "column": 26 }, "end": { - "line": 170, - "column": 12 + "line": 175, + "column": 33 }, - "identifierName": "tree" + "identifierName": "compare" }, - "name": "tree" - }, - "init": { - "type": "NewExpression", - "start": 4345, - "end": 4370, - "loc": { - "start": { - "line": 170, - "column": 15 - }, - "end": { - "line": 170, - "column": 40 - } + "name": "compare" + } + ] + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", + "start": 4381, + "end": 4525, + "loc": { + "start": { + "line": 168, + "column": 1 + }, + "end": { + "line": 173, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "start": 4592, + "end": 4805, + "loc": { + "start": { + "line": 178, + "column": 1 + }, + "end": { + "line": 184, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 4807, + "end": 4954, + "loc": { + "start": { + "line": 185, + "column": 1 + }, + "end": { + "line": 191, + "column": 2 + } + }, + "static": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 4814, + "end": 4818, + "loc": { + "start": { + "line": 185, + "column": 8 + }, + "end": { + "line": 185, + "column": 12 + }, + "identifierName": "from" + }, + "name": "from" + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 4819, + "end": 4826, + "loc": { + "start": { + "line": 185, + "column": 13 + }, + "end": { + "line": 185, + "column": 20 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "Identifier", + "start": 4828, + "end": 4836, + "loc": { + "start": { + "line": 185, + "column": 22 + }, + "end": { + "line": 185, + "column": 30 + }, + "identifierName": "iterable" + }, + "name": "iterable" + } + ], + "body": { + "type": "BlockStatement", + "start": 4838, + "end": 4954, + "loc": { + "start": { + "line": 185, + "column": 32 + }, + "end": { + "line": 191, + "column": 2 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 4842, + "end": 4881, + "loc": { + "start": { + "line": 186, + "column": 2 + }, + "end": { + "line": 186, + "column": 41 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4848, + "end": 4880, + "loc": { + "start": { + "line": 186, + "column": 8 + }, + "end": { + "line": 186, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 4848, + "end": 4852, + "loc": { + "start": { + "line": 186, + "column": 8 + }, + "end": { + "line": 186, + "column": 12 + }, + "identifierName": "tree" + }, + "name": "tree" + }, + "init": { + "type": "NewExpression", + "start": 4855, + "end": 4880, + "loc": { + "start": { + "line": 186, + "column": 15 + }, + "end": { + "line": 186, + "column": 40 + } }, "callee": { "type": "Identifier", - "start": 4349, - "end": 4361, + "start": 4859, + "end": 4871, "loc": { "start": { - "line": 170, + "line": 186, "column": 19 }, "end": { - "line": 170, + "line": 186, "column": 31 }, "identifierName": "RedBlackTree" @@ -6275,15 +6621,15 @@ "arguments": [ { "type": "Identifier", - "start": 4362, - "end": 4369, + "start": 4872, + "end": 4879, "loc": { "start": { - "line": 170, + "line": 186, "column": 32 }, "end": { - "line": 170, + "line": 186, "column": 39 }, "identifierName": "compare" @@ -6298,58 +6644,58 @@ }, { "type": "ForOfStatement", - "start": 4375, - "end": 4425, + "start": 4885, + "end": 4935, "loc": { "start": { - "line": 172, + "line": 188, "column": 2 }, "end": { - "line": 172, + "line": 188, "column": 52 } }, "left": { "type": "VariableDeclaration", - "start": 4380, - "end": 4393, + "start": 4890, + "end": 4903, "loc": { "start": { - "line": 172, + "line": 188, "column": 7 }, "end": { - "line": 172, + "line": 188, "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 4386, - "end": 4393, + "start": 4896, + "end": 4903, "loc": { "start": { - "line": 172, + "line": 188, "column": 13 }, "end": { - "line": 172, + "line": 188, "column": 20 } }, "id": { "type": "Identifier", - "start": 4386, - "end": 4393, + "start": 4896, + "end": 4903, "loc": { "start": { - "line": 172, + "line": 188, "column": 13 }, "end": { - "line": 172, + "line": 188, "column": 20 }, "identifierName": "element" @@ -6363,15 +6709,15 @@ }, "right": { "type": "Identifier", - "start": 4397, - "end": 4405, + "start": 4907, + "end": 4915, "loc": { "start": { - "line": 172, + "line": 188, "column": 24 }, "end": { - "line": 172, + "line": 188, "column": 32 }, "identifierName": "iterable" @@ -6380,57 +6726,57 @@ }, "body": { "type": "ExpressionStatement", - "start": 4407, - "end": 4425, + "start": 4917, + "end": 4935, "loc": { "start": { - "line": 172, + "line": 188, "column": 34 }, "end": { - "line": 172, + "line": 188, "column": 52 } }, "expression": { "type": "CallExpression", - "start": 4407, - "end": 4424, + "start": 4917, + "end": 4934, "loc": { "start": { - "line": 172, + "line": 188, "column": 34 }, "end": { - "line": 172, + "line": 188, "column": 51 } }, "callee": { "type": "MemberExpression", - "start": 4407, - "end": 4415, + "start": 4917, + "end": 4925, "loc": { "start": { - "line": 172, + "line": 188, "column": 34 }, "end": { - "line": 172, + "line": 188, "column": 42 } }, "object": { "type": "Identifier", - "start": 4407, - "end": 4411, + "start": 4917, + "end": 4921, "loc": { "start": { - "line": 172, + "line": 188, "column": 34 }, "end": { - "line": 172, + "line": 188, "column": 38 }, "identifierName": "tree" @@ -6439,15 +6785,15 @@ }, "property": { "type": "Identifier", - "start": 4412, - "end": 4415, + "start": 4922, + "end": 4925, "loc": { "start": { - "line": 172, + "line": 188, "column": 39 }, "end": { - "line": 172, + "line": 188, "column": 42 }, "identifierName": "add" @@ -6459,15 +6805,15 @@ "arguments": [ { "type": "Identifier", - "start": 4416, - "end": 4423, + "start": 4926, + "end": 4933, "loc": { "start": { - "line": 172, + "line": 188, "column": 43 }, "end": { - "line": 172, + "line": 188, "column": 50 }, "identifierName": "element" @@ -6480,29 +6826,29 @@ }, { "type": "ReturnStatement", - "start": 4429, - "end": 4441, + "start": 4939, + "end": 4951, "loc": { "start": { - "line": 174, + "line": 190, "column": 2 }, "end": { - "line": 174, + "line": 190, "column": 14 } }, "argument": { "type": "Identifier", - "start": 4436, - "end": 4440, + "start": 4946, + "end": 4950, "loc": { "start": { - "line": 174, + "line": 190, "column": 9 }, "end": { - "line": 174, + "line": 190, "column": 13 }, "identifierName": "tree" @@ -6516,16 +6862,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4082, - "end": 4295, + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "start": 4592, + "end": 4805, "loc": { "start": { - "line": 162, + "line": 178, "column": 1 }, "end": { - "line": 168, + "line": 184, "column": 4 } } @@ -6538,15 +6884,15 @@ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 363, - "end": 412, + "start": 520, + "end": 569, "loc": { "start": { - "line": 9, + "line": 13, "column": 0 }, "end": { - "line": 12, + "line": 16, "column": 3 } } @@ -6558,15 +6904,15 @@ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 363, - "end": 412, + "start": 520, + "end": 569, "loc": { "start": { - "line": 9, + "line": 13, "column": 0 }, "end": { - "line": 12, + "line": 16, "column": 3 } } @@ -6580,111 +6926,143 @@ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 363, - "end": 412, + "start": 520, + "end": 569, "loc": { "start": { - "line": 9, + "line": 13, "column": 0 }, "end": { - "line": 12, + "line": 16, "column": 3 } } }, { "type": "CommentBlock", - "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t ", - "start": 442, - "end": 596, + "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", + "start": 607, + "end": 733, "loc": { "start": { - "line": 14, + "line": 18, "column": 1 }, "end": { - "line": 19, + "line": 22, "column": 4 } } }, + { + "type": "CommentBlock", + "value": "* @member {Function} The comparison function for node keys. ", + "start": 760, + "end": 824, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 66 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Node} The root of the tree. ", + "start": 853, + "end": 896, + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 45 + } + } + }, { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 672, - "end": 776, + "start": 922, + "end": 1026, "loc": { "start": { - "line": 25, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 34, "column": 4 } } }, { "type": "CommentBlock", - "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t ", - "start": 824, - "end": 903, + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", + "start": 1074, + "end": 1153, "loc": { "start": { - "line": 34, + "line": 39, "column": 1 }, "end": { - "line": 38, + "line": 43, "column": 4 } } }, { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1102, - "end": 1328, + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", + "start": 1352, + "end": 1578, "loc": { "start": { - "line": 49, + "line": 54, "column": 1 }, "end": { - "line": 56, + "line": 61, "column": 4 } } }, { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t ", - "start": 1436, - "end": 1698, + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", + "start": 1686, + "end": 1948, "loc": { "start": { - "line": 62, + "line": 67, "column": 1 }, "end": { - "line": 69, + "line": 74, "column": 4 } } }, { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t ", - "start": 1792, - "end": 1947, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t ", + "start": 2042, + "end": 2197, "loc": { "start": { - "line": 75, + "line": 80, "column": 1 }, "end": { - "line": 81, + "line": 86, "column": 4 } } @@ -6692,15 +7070,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2002, - "end": 2107, + "start": 2252, + "end": 2357, "loc": { "start": { - "line": 86, + "line": 91, "column": 1 }, "end": { - "line": 90, + "line": 95, "column": 4 } } @@ -6708,15 +7086,15 @@ { "type": "CommentLine", "value": " Replace node's key with predecessor's key", - "start": 2157, - "end": 2201, + "start": 2407, + "end": 2451, "loc": { "start": { - "line": 93, + "line": 98, "column": 3 }, "end": { - "line": 93, + "line": 98, "column": 47 } } @@ -6724,15 +7102,15 @@ { "type": "CommentLine", "value": " Delete predecessor node", - "start": 2264, - "end": 2290, + "start": 2514, + "end": 2540, "loc": { "start": { - "line": 96, + "line": 101, "column": 3 }, "end": { - "line": 96, + "line": 101, "column": 29 } } @@ -6740,15 +7118,15 @@ { "type": "CommentLine", "value": " note: this node can only have one non-leaf child", - "start": 2294, - "end": 2345, + "start": 2544, + "end": 2595, "loc": { "start": { - "line": 97, + "line": 102, "column": 3 }, "end": { - "line": 97, + "line": 102, "column": 54 } } @@ -6756,15 +7134,15 @@ { "type": "CommentLine", "value": " because the tree is a red-black tree", - "start": 2349, - "end": 2394, + "start": 2599, + "end": 2644, "loc": { "start": { - "line": 98, + "line": 103, "column": 3 }, "end": { - "line": 98, + "line": 103, "column": 48 } } @@ -6772,15 +7150,15 @@ { "type": "CommentLine", "value": " Replace node's key with successor's key", - "start": 2462, - "end": 2504, + "start": 2712, + "end": 2754, "loc": { "start": { - "line": 101, + "line": 106, "column": 3 }, "end": { - "line": 101, + "line": 106, "column": 45 } } @@ -6788,15 +7166,15 @@ { "type": "CommentLine", "value": " If there is no left child, then there can only be one right", - "start": 2508, - "end": 2570, + "start": 2758, + "end": 2820, "loc": { "start": { - "line": 102, + "line": 107, "column": 3 }, "end": { - "line": 102, + "line": 107, "column": 65 } } @@ -6804,15 +7182,15 @@ { "type": "CommentLine", "value": " child.", - "start": 2574, - "end": 2583, + "start": 2824, + "end": 2833, "loc": { "start": { - "line": 103, + "line": 108, "column": 3 }, "end": { - "line": 103, + "line": 108, "column": 12 } } @@ -6820,15 +7198,15 @@ { "type": "CommentLine", "value": " Delete successor node", - "start": 2639, - "end": 2663, + "start": 2922, + "end": 2946, "loc": { "start": { - "line": 106, + "line": 112, "column": 3 }, "end": { - "line": 106, + "line": 112, "column": 27 } } @@ -6836,15 +7214,15 @@ { "type": "CommentLine", "value": " note: this node can only have one non-leaf child", - "start": 2667, - "end": 2718, + "start": 2950, + "end": 3001, "loc": { "start": { - "line": 107, + "line": 113, "column": 3 }, "end": { - "line": 107, + "line": 113, "column": 54 } } @@ -6852,63 +7230,63 @@ { "type": "CommentLine", "value": " because the tree is a red-black tree", - "start": 2722, - "end": 2767, + "start": 3005, + "end": 3050, "loc": { "start": { - "line": 108, + "line": 114, "column": 3 }, "end": { - "line": 108, + "line": 114, "column": 48 } } }, { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 2898, - "end": 3310, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 3181, + "end": 3593, "loc": { "start": { - "line": 117, + "line": 123, "column": 1 }, "end": { - "line": 125, + "line": 131, "column": 4 } } }, { "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t ", - "start": 3438, - "end": 3687, + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", + "start": 3721, + "end": 3978, "loc": { "start": { - "line": 134, + "line": 140, "column": 1 }, "end": { - "line": 140, + "line": 146, "column": 4 } } }, { "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t ", - "start": 3806, - "end": 3902, + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", + "start": 4097, + "end": 4201, "loc": { "start": { - "line": 146, + "line": 152, "column": 1 }, "end": { - "line": 150, + "line": 156, "column": 4 } } @@ -6916,87 +7294,78 @@ { "type": "CommentBlock", "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 3982, - "end": 4030, + "start": 4281, + "end": 4329, "loc": { "start": { - "line": 155, + "line": 161, "column": 1 }, "end": { - "line": 157, + "line": 163, "column": 4 } } }, { "type": "CommentBlock", - "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4082, - "end": 4295, + "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", + "start": 4381, + "end": 4525, "loc": { "start": { - "line": 162, + "line": 168, "column": 1 }, "end": { - "line": 168, + "line": 173, "column": 4 } } - } - ], - "tokens": [ + }, { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, + "type": "CommentBlock", + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "start": 4592, + "end": 4805, "loc": { "start": { - "line": 1, - "column": 0 + "line": 178, + "column": 1 }, "end": { - "line": 1, - "column": 6 + "line": 184, + "column": 4 } } - }, + } + ], + "tokens": [ { "type": { - "label": "{", - "beforeExpr": true, + "label": "import", + "keyword": "import", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 7, - "end": 8, + "value": "import", + "start": 0, + "end": 6, "loc": { "start": { "line": 1, - "column": 7 + "column": 0 }, "end": { "line": 1, - "column": 8 + "column": 6 } } }, @@ -7012,38 +7381,13 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 8, - "end": 12, - "loc": { - "start": { - "line": 1, - "column": 8 - }, - "end": { - "line": 1, - "column": 12 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 12, + "value": "assert", + "start": 7, "end": 13, "loc": { "start": { "line": 1, - "column": 12 + "column": 7 }, "end": { "line": 1, @@ -7090,9 +7434,9 @@ "binop": null, "updateContext": null }, - "value": "./Node.js", + "value": "assert", "start": 19, - "end": 30, + "end": 27, "loc": { "start": { "line": 1, @@ -7100,7 +7444,7 @@ }, "end": { "line": 1, - "column": 30 + "column": 27 } } }, @@ -7117,16 +7461,16 @@ "binop": null, "updateContext": null }, - "start": 30, - "end": 31, + "start": 27, + "end": 28, "loc": { "start": { "line": 1, - "column": 30 + "column": 27 }, "end": { "line": 1, - "column": 31 + "column": 28 } } }, @@ -7145,8 +7489,8 @@ "updateContext": null }, "value": "import", - "start": 32, - "end": 38, + "start": 29, + "end": 35, "loc": { "start": { "line": 2, @@ -7160,8 +7504,8 @@ }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7170,7 +7514,8 @@ "postfix": false, "binop": null }, - "start": 39, + "value": "Node", + "start": 36, "end": 40, "loc": { "start": { @@ -7179,7 +7524,7 @@ }, "end": { "line": 2, - "column": 8 + "column": 11 } } }, @@ -7195,25 +7540,25 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 40, + "value": "from", + "start": 41, "end": 45, "loc": { "start": { "line": 2, - "column": 8 + "column": 12 }, "end": { "line": 2, - "column": 13 + "column": 16 } } }, { "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, + "label": "string", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7222,67 +7567,71 @@ "binop": null, "updateContext": null }, - "start": 45, - "end": 46, + "value": "./Node.js", + "start": 46, + "end": 57, "loc": { "start": { "line": 2, - "column": 13 + "column": 17 }, "end": { "line": 2, - "column": 14 + "column": 28 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 47, - "end": 50, + "start": 57, + "end": 58, "loc": { "start": { "line": 2, - "column": 15 + "column": 28 }, "end": { "line": 2, - "column": 18 + "column": 29 } } }, { "type": { - "label": "}", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 50, - "end": 51, + "value": "import", + "start": 59, + "end": 65, "loc": { "start": { - "line": 2, - "column": 18 + "line": 3, + "column": 0 }, "end": { - "line": 2, - "column": 19 + "line": 3, + "column": 6 } } }, @@ -7298,23 +7647,23 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 52, - "end": 56, + "value": "BLACK", + "start": 66, + "end": 71, "loc": { "start": { - "line": 2, - "column": 20 + "line": 3, + "column": 7 }, "end": { - "line": 2, - "column": 24 + "line": 3, + "column": 12 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7322,53 +7671,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/index.js", - "start": 57, + "value": "from", + "start": 72, "end": 76, "loc": { "start": { - "line": 2, - "column": 25 - }, - "end": { - "line": 2, - "column": 44 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 76, - "end": 77, - "loc": { - "start": { - "line": 2, - "column": 44 + "line": 3, + "column": 13 }, "end": { - "line": 2, - "column": 45 + "line": 3, + "column": 17 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7379,48 +7700,50 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 78, - "end": 84, + "value": "../color/BLACK.js", + "start": 77, + "end": 96, "loc": { "start": { "line": 3, - "column": 0 + "column": 18 }, "end": { "line": 3, - "column": 6 + "column": 37 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 85, - "end": 86, + "start": 96, + "end": 97, "loc": { "start": { "line": 3, - "column": 7 + "column": 37 }, "end": { "line": 3, - "column": 8 + "column": 38 } } }, { "type": { - "label": "name", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7428,27 +7751,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "predecessor", - "start": 86, - "end": 97, + "value": "import", + "start": 98, + "end": 104, "loc": { "start": { - "line": 3, - "column": 8 + "line": 4, + "column": 0 }, "end": { - "line": 3, - "column": 19 + "line": 4, + "column": 6 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7456,16 +7780,17 @@ "postfix": false, "binop": null }, - "start": 97, - "end": 98, + "value": "RED", + "start": 105, + "end": 108, "loc": { "start": { - "line": 3, - "column": 19 + "line": 4, + "column": 7 }, "end": { - "line": 3, - "column": 20 + "line": 4, + "column": 10 } } }, @@ -7482,16 +7807,16 @@ "binop": null }, "value": "from", - "start": 99, - "end": 103, + "start": 109, + "end": 113, "loc": { "start": { - "line": 3, - "column": 21 + "line": 4, + "column": 11 }, "end": { - "line": 3, - "column": 25 + "line": 4, + "column": 15 } } }, @@ -7508,17 +7833,17 @@ "binop": null, "updateContext": null }, - "value": "../family/predecessor.js", - "start": 104, - "end": 130, + "value": "../color/RED.js", + "start": 114, + "end": 131, "loc": { "start": { - "line": 3, - "column": 26 + "line": 4, + "column": 16 }, "end": { - "line": 3, - "column": 52 + "line": 4, + "column": 33 } } }, @@ -7535,16 +7860,16 @@ "binop": null, "updateContext": null }, - "start": 130, - "end": 131, + "start": 131, + "end": 132, "loc": { "start": { - "line": 3, - "column": 52 + "line": 4, + "column": 33 }, "end": { - "line": 3, - "column": 53 + "line": 4, + "column": 34 } } }, @@ -7563,23 +7888,23 @@ "updateContext": null }, "value": "import", - "start": 132, - "end": 138, + "start": 133, + "end": 139, "loc": { "start": { - "line": 4, + "line": 5, "column": 0 }, "end": { - "line": 4, + "line": 5, "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7588,16 +7913,17 @@ "postfix": false, "binop": null }, - "start": 139, - "end": 140, + "value": "predecessor", + "start": 140, + "end": 151, "loc": { "start": { - "line": 4, + "line": 5, "column": 7 }, "end": { - "line": 4, - "column": 8 + "line": 5, + "column": 18 } } }, @@ -7613,23 +7939,50 @@ "postfix": false, "binop": null }, - "value": "insert", - "start": 140, - "end": 146, + "value": "from", + "start": 152, + "end": 156, "loc": { "start": { - "line": 4, - "column": 8 + "line": 5, + "column": 19 }, "end": { - "line": 4, - "column": 14 + "line": 5, + "column": 23 } } }, { "type": { - "label": ",", + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/predecessor.js", + "start": 157, + "end": 183, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": { + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7640,22 +7993,23 @@ "binop": null, "updateContext": null }, - "start": 146, - "end": 147, + "start": 183, + "end": 184, "loc": { "start": { - "line": 4, - "column": 14 + "line": 5, + "column": 50 }, "end": { - "line": 4, - "column": 15 + "line": 5, + "column": 51 } } }, { "type": { - "label": "name", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7663,27 +8017,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "insert_case2", - "start": 148, - "end": 160, + "value": "import", + "start": 185, + "end": 191, "loc": { "start": { - "line": 4, - "column": 16 + "line": 6, + "column": 0 }, "end": { - "line": 4, - "column": 28 + "line": 6, + "column": 6 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7691,16 +8046,17 @@ "postfix": false, "binop": null }, - "start": 160, - "end": 161, + "value": "insert", + "start": 192, + "end": 198, "loc": { "start": { - "line": 4, - "column": 28 + "line": 6, + "column": 7 }, "end": { - "line": 4, - "column": 29 + "line": 6, + "column": 13 } } }, @@ -7717,16 +8073,16 @@ "binop": null }, "value": "from", - "start": 162, - "end": 166, + "start": 199, + "end": 203, "loc": { "start": { - "line": 4, - "column": 30 + "line": 6, + "column": 14 }, "end": { - "line": 4, - "column": 34 + "line": 6, + "column": 18 } } }, @@ -7743,17 +8099,17 @@ "binop": null, "updateContext": null }, - "value": "../insertion/index.js", - "start": 167, - "end": 190, + "value": "../insertion/insert.js", + "start": 204, + "end": 228, "loc": { "start": { - "line": 4, - "column": 35 + "line": 6, + "column": 19 }, "end": { - "line": 4, - "column": 58 + "line": 6, + "column": 43 } } }, @@ -7770,16 +8126,16 @@ "binop": null, "updateContext": null }, - "start": 190, - "end": 191, + "start": 228, + "end": 229, "loc": { "start": { - "line": 4, - "column": 58 + "line": 6, + "column": 43 }, "end": { - "line": 4, - "column": 59 + "line": 6, + "column": 44 } } }, @@ -7798,44 +8154,19 @@ "updateContext": null }, "value": "import", - "start": 192, - "end": 198, + "start": 230, + "end": 236, "loc": { "start": { - "line": 5, + "line": 7, "column": 0 }, "end": { - "line": 5, + "line": 7, "column": 6 } } }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 199, - "end": 200, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 8 - } - } - }, { "type": { "label": "name", @@ -7848,42 +8179,17 @@ "postfix": false, "binop": null }, - "value": "delete_one_child", - "start": 200, - "end": 216, - "loc": { - "start": { - "line": 5, - "column": 8 - }, - "end": { - "line": 5, - "column": 24 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 216, - "end": 217, + "value": "insert_case2", + "start": 237, + "end": 249, "loc": { "start": { - "line": 5, - "column": 24 + "line": 7, + "column": 7 }, "end": { - "line": 5, - "column": 25 + "line": 7, + "column": 19 } } }, @@ -7900,16 +8206,16 @@ "binop": null }, "value": "from", - "start": 218, - "end": 222, + "start": 250, + "end": 254, "loc": { "start": { - "line": 5, - "column": 26 + "line": 7, + "column": 20 }, "end": { - "line": 5, - "column": 30 + "line": 7, + "column": 24 } } }, @@ -7926,17 +8232,17 @@ "binop": null, "updateContext": null }, - "value": "../deletion/index.js", - "start": 223, - "end": 245, + "value": "../insertion/insert_case2.js", + "start": 255, + "end": 285, "loc": { "start": { - "line": 5, - "column": 31 + "line": 7, + "column": 25 }, "end": { - "line": 5, - "column": 53 + "line": 7, + "column": 55 } } }, @@ -7953,16 +8259,16 @@ "binop": null, "updateContext": null }, - "start": 245, - "end": 246, + "start": 285, + "end": 286, "loc": { "start": { - "line": 5, - "column": 53 + "line": 7, + "column": 55 }, "end": { - "line": 5, - "column": 54 + "line": 7, + "column": 56 } } }, @@ -7981,23 +8287,23 @@ "updateContext": null }, "value": "import", - "start": 247, - "end": 253, + "start": 287, + "end": 293, "loc": { "start": { - "line": 6, + "line": 8, "column": 0 }, "end": { - "line": 6, + "line": 8, "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -8006,16 +8312,17 @@ "postfix": false, "binop": null }, - "start": 254, - "end": 255, + "value": "delete_one_child", + "start": 294, + "end": 310, "loc": { "start": { - "line": 6, + "line": 8, "column": 7 }, "end": { - "line": 6, - "column": 8 + "line": 8, + "column": 23 } } }, @@ -8031,74 +8338,77 @@ "postfix": false, "binop": null }, - "value": "search", - "start": 255, - "end": 261, + "value": "from", + "start": 311, + "end": 315, "loc": { "start": { - "line": 6, - "column": 8 + "line": 8, + "column": 24 }, "end": { - "line": 6, - "column": 14 + "line": 8, + "column": 28 } } }, { "type": { - "label": "}", + "label": "string", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 261, - "end": 262, + "value": "../deletion/delete_one_child.js", + "start": 316, + "end": 349, "loc": { "start": { - "line": 6, - "column": 14 + "line": 8, + "column": 29 }, "end": { - "line": 6, - "column": 15 + "line": 8, + "column": 62 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 263, - "end": 267, + "start": 349, + "end": 350, "loc": { "start": { - "line": 6, - "column": 16 + "line": 8, + "column": 62 }, "end": { - "line": 6, - "column": 20 + "line": 8, + "column": 63 } } }, { "type": { - "label": "string", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8109,17 +8419,96 @@ "binop": null, "updateContext": null }, - "value": "../search/index.js", - "start": 268, - "end": 288, + "value": "import", + "start": 351, + "end": 357, "loc": { "start": { - "line": 6, - "column": 21 + "line": 9, + "column": 0 }, "end": { - "line": 6, - "column": 41 + "line": 9, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "search", + "start": 358, + "end": 364, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 365, + "end": 369, + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../search/search.js", + "start": 370, + "end": 391, + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 40 } } }, @@ -8136,16 +8525,16 @@ "binop": null, "updateContext": null }, - "start": 288, - "end": 289, + "start": 391, + "end": 392, "loc": { "start": { - "line": 6, - "column": 41 + "line": 9, + "column": 40 }, "end": { - "line": 6, - "column": 42 + "line": 9, + "column": 41 } } }, @@ -8164,23 +8553,23 @@ "updateContext": null }, "value": "import", - "start": 290, - "end": 296, + "start": 393, + "end": 399, "loc": { "start": { - "line": 7, + "line": 10, "column": 0 }, "end": { - "line": 7, + "line": 10, "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -8189,16 +8578,17 @@ "postfix": false, "binop": null }, - "start": 297, - "end": 298, + "value": "inordertraversal", + "start": 400, + "end": 416, "loc": { "start": { - "line": 7, + "line": 10, "column": 7 }, "end": { - "line": 7, - "column": 8 + "line": 10, + "column": 23 } } }, @@ -8214,23 +8604,50 @@ "postfix": false, "binop": null }, - "value": "inordertraversal", - "start": 298, - "end": 314, + "value": "from", + "start": 417, + "end": 421, "loc": { "start": { - "line": 7, - "column": 8 + "line": 10, + "column": 24 }, "end": { - "line": 7, - "column": 24 + "line": 10, + "column": 28 } } }, { "type": { - "label": ",", + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../traversal/inordertraversal.js", + "start": 422, + "end": 456, + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 63 + } + } + }, + { + "type": { + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8241,22 +8658,23 @@ "binop": null, "updateContext": null }, - "start": 314, - "end": 315, + "start": 456, + "end": 457, "loc": { "start": { - "line": 7, - "column": 24 + "line": 10, + "column": 63 }, "end": { - "line": 7, - "column": 25 + "line": 10, + "column": 64 } } }, { "type": { - "label": "name", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8264,27 +8682,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "rangetraversal", - "start": 316, - "end": 330, + "value": "import", + "start": 458, + "end": 464, "loc": { "start": { - "line": 7, - "column": 26 + "line": 11, + "column": 0 }, "end": { - "line": 7, - "column": 40 + "line": 11, + "column": 6 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8292,16 +8711,17 @@ "postfix": false, "binop": null }, - "start": 330, - "end": 331, + "value": "rangetraversal", + "start": 465, + "end": 479, "loc": { "start": { - "line": 7, - "column": 40 + "line": 11, + "column": 7 }, "end": { - "line": 7, - "column": 41 + "line": 11, + "column": 21 } } }, @@ -8318,16 +8738,16 @@ "binop": null }, "value": "from", - "start": 332, - "end": 336, + "start": 480, + "end": 484, "loc": { "start": { - "line": 7, - "column": 42 + "line": 11, + "column": 22 }, "end": { - "line": 7, - "column": 46 + "line": 11, + "column": 26 } } }, @@ -8344,17 +8764,17 @@ "binop": null, "updateContext": null }, - "value": "../traversal/index.js", - "start": 337, - "end": 360, + "value": "../traversal/rangetraversal.js", + "start": 485, + "end": 517, "loc": { "start": { - "line": 7, - "column": 47 + "line": 11, + "column": 27 }, "end": { - "line": 7, - "column": 70 + "line": 11, + "column": 59 } } }, @@ -8371,31 +8791,31 @@ "binop": null, "updateContext": null }, - "start": 360, - "end": 361, + "start": 517, + "end": 518, "loc": { "start": { - "line": 7, - "column": 70 + "line": 11, + "column": 59 }, "end": { - "line": 7, - "column": 71 + "line": 11, + "column": 60 } } }, { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 363, - "end": 412, + "start": 520, + "end": 569, "loc": { "start": { - "line": 9, + "line": 13, "column": 0 }, "end": { - "line": 12, + "line": 16, "column": 3 } } @@ -8415,19 +8835,47 @@ "updateContext": null }, "value": "export", - "start": 413, - "end": 419, + "start": 570, + "end": 576, "loc": { "start": { - "line": 13, + "line": 17, "column": 0 }, "end": { - "line": 13, + "line": 17, "column": 6 } } }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 577, + "end": 584, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, { "type": { "label": "class", @@ -8443,16 +8891,16 @@ "updateContext": null }, "value": "class", - "start": 420, - "end": 425, + "start": 585, + "end": 590, "loc": { "start": { - "line": 13, - "column": 7 + "line": 17, + "column": 15 }, "end": { - "line": 13, - "column": 12 + "line": 17, + "column": 20 } } }, @@ -8469,16 +8917,16 @@ "binop": null }, "value": "RedBlackTree", - "start": 426, - "end": 438, + "start": 591, + "end": 603, "loc": { "start": { - "line": 13, - "column": 13 + "line": 17, + "column": 21 }, "end": { - "line": 13, - "column": 25 + "line": 17, + "column": 33 } } }, @@ -8494,31 +8942,31 @@ "postfix": false, "binop": null }, - "start": 439, - "end": 440, + "start": 604, + "end": 605, "loc": { "start": { - "line": 13, - "column": 26 + "line": 17, + "column": 34 }, "end": { - "line": 13, - "column": 27 + "line": 17, + "column": 35 } } }, { "type": "CommentBlock", - "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t ", - "start": 442, - "end": 596, + "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", + "start": 607, + "end": 733, "loc": { "start": { - "line": 14, + "line": 18, "column": 1 }, "end": { - "line": 19, + "line": 22, "column": 4 } } @@ -8536,15 +8984,15 @@ "binop": null }, "value": "constructor", - "start": 598, - "end": 609, + "start": 735, + "end": 746, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, + "line": 23, "column": 12 } } @@ -8561,15 +9009,15 @@ "postfix": false, "binop": null }, - "start": 609, - "end": 610, + "start": 746, + "end": 747, "loc": { "start": { - "line": 20, + "line": 23, "column": 12 }, "end": { - "line": 20, + "line": 23, "column": 13 } } @@ -8587,15 +9035,15 @@ "binop": null }, "value": "compare", - "start": 610, - "end": 617, + "start": 747, + "end": 754, "loc": { "start": { - "line": 20, + "line": 23, "column": 13 }, "end": { - "line": 20, + "line": 23, "column": 20 } } @@ -8612,15 +9060,15 @@ "postfix": false, "binop": null }, - "start": 617, - "end": 618, + "start": 754, + "end": 755, "loc": { "start": { - "line": 20, + "line": 23, "column": 20 }, "end": { - "line": 20, + "line": 23, "column": 21 } } @@ -8637,19 +9085,35 @@ "postfix": false, "binop": null }, - "start": 619, - "end": 620, + "start": 756, + "end": 757, "loc": { "start": { - "line": 20, + "line": 23, "column": 22 }, "end": { - "line": 20, + "line": 23, "column": 23 } } }, + { + "type": "CommentBlock", + "value": "* @member {Function} The comparison function for node keys. ", + "start": 760, + "end": 824, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 66 + } + } + }, { "type": { "label": "this", @@ -8665,15 +9129,15 @@ "updateContext": null }, "value": "this", - "start": 623, - "end": 627, + "start": 827, + "end": 831, "loc": { "start": { - "line": 21, + "line": 25, "column": 2 }, "end": { - "line": 21, + "line": 25, "column": 6 } } @@ -8691,15 +9155,15 @@ "binop": null, "updateContext": null }, - "start": 627, - "end": 628, + "start": 831, + "end": 832, "loc": { "start": { - "line": 21, + "line": 25, "column": 6 }, "end": { - "line": 21, + "line": 25, "column": 7 } } @@ -8717,15 +9181,15 @@ "binop": null }, "value": "compare", - "start": 628, - "end": 635, + "start": 832, + "end": 839, "loc": { "start": { - "line": 21, + "line": 25, "column": 7 }, "end": { - "line": 21, + "line": 25, "column": 14 } } @@ -8744,15 +9208,15 @@ "updateContext": null }, "value": "=", - "start": 636, - "end": 637, + "start": 840, + "end": 841, "loc": { "start": { - "line": 21, + "line": 25, "column": 15 }, "end": { - "line": 21, + "line": 25, "column": 16 } } @@ -8770,15 +9234,15 @@ "binop": null }, "value": "compare", - "start": 638, - "end": 645, + "start": 842, + "end": 849, "loc": { "start": { - "line": 21, + "line": 25, "column": 17 }, "end": { - "line": 21, + "line": 25, "column": 24 } } @@ -8796,22 +9260,38 @@ "binop": null, "updateContext": null }, - "start": 645, - "end": 646, + "start": 849, + "end": 850, "loc": { "start": { - "line": 21, + "line": 25, "column": 24 }, "end": { - "line": 21, + "line": 25, "column": 25 } } }, { - "type": { - "label": "this", + "type": "CommentBlock", + "value": "* @member {Node} The root of the tree. ", + "start": 853, + "end": 896, + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 45 + } + } + }, + { + "type": { + "label": "this", "keyword": "this", "beforeExpr": false, "startsExpr": true, @@ -8824,15 +9304,15 @@ "updateContext": null }, "value": "this", - "start": 649, - "end": 653, + "start": 899, + "end": 903, "loc": { "start": { - "line": 22, + "line": 27, "column": 2 }, "end": { - "line": 22, + "line": 27, "column": 6 } } @@ -8850,15 +9330,15 @@ "binop": null, "updateContext": null }, - "start": 653, - "end": 654, + "start": 903, + "end": 904, "loc": { "start": { - "line": 22, + "line": 27, "column": 6 }, "end": { - "line": 22, + "line": 27, "column": 7 } } @@ -8876,15 +9356,15 @@ "binop": null }, "value": "root", - "start": 654, - "end": 658, + "start": 904, + "end": 908, "loc": { "start": { - "line": 22, + "line": 27, "column": 7 }, "end": { - "line": 22, + "line": 27, "column": 11 } } @@ -8903,15 +9383,15 @@ "updateContext": null }, "value": "=", - "start": 659, - "end": 660, + "start": 909, + "end": 910, "loc": { "start": { - "line": 22, + "line": 27, "column": 12 }, "end": { - "line": 22, + "line": 27, "column": 13 } } @@ -8931,15 +9411,15 @@ "updateContext": null }, "value": "null", - "start": 661, - "end": 665, + "start": 911, + "end": 915, "loc": { "start": { - "line": 22, + "line": 27, "column": 14 }, "end": { - "line": 22, + "line": 27, "column": 18 } } @@ -8957,15 +9437,15 @@ "binop": null, "updateContext": null }, - "start": 665, - "end": 666, + "start": 915, + "end": 916, "loc": { "start": { - "line": 22, + "line": 27, "column": 18 }, "end": { - "line": 22, + "line": 27, "column": 19 } } @@ -8982,15 +9462,15 @@ "postfix": false, "binop": null }, - "start": 668, - "end": 669, + "start": 918, + "end": 919, "loc": { "start": { - "line": 23, + "line": 28, "column": 1 }, "end": { - "line": 23, + "line": 28, "column": 2 } } @@ -8998,15 +9478,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 672, - "end": 776, + "start": 922, + "end": 1026, "loc": { "start": { - "line": 25, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 34, "column": 4 } } @@ -9024,15 +9504,15 @@ "binop": null }, "value": "isEmpty", - "start": 778, - "end": 785, + "start": 1028, + "end": 1035, "loc": { "start": { - "line": 30, + "line": 35, "column": 1 }, "end": { - "line": 30, + "line": 35, "column": 8 } } @@ -9049,15 +9529,15 @@ "postfix": false, "binop": null }, - "start": 785, - "end": 786, + "start": 1035, + "end": 1036, "loc": { "start": { - "line": 30, + "line": 35, "column": 8 }, "end": { - "line": 30, + "line": 35, "column": 9 } } @@ -9074,15 +9554,15 @@ "postfix": false, "binop": null }, - "start": 786, - "end": 787, + "start": 1036, + "end": 1037, "loc": { "start": { - "line": 30, + "line": 35, "column": 9 }, "end": { - "line": 30, + "line": 35, "column": 10 } } @@ -9099,15 +9579,15 @@ "postfix": false, "binop": null }, - "start": 788, - "end": 789, + "start": 1038, + "end": 1039, "loc": { "start": { - "line": 30, + "line": 35, "column": 11 }, "end": { - "line": 30, + "line": 35, "column": 12 } } @@ -9127,15 +9607,15 @@ "updateContext": null }, "value": "return", - "start": 792, - "end": 798, + "start": 1042, + "end": 1048, "loc": { "start": { - "line": 31, + "line": 36, "column": 2 }, "end": { - "line": 31, + "line": 36, "column": 8 } } @@ -9155,15 +9635,15 @@ "updateContext": null }, "value": "this", - "start": 799, - "end": 803, + "start": 1049, + "end": 1053, "loc": { "start": { - "line": 31, + "line": 36, "column": 9 }, "end": { - "line": 31, + "line": 36, "column": 13 } } @@ -9181,15 +9661,15 @@ "binop": null, "updateContext": null }, - "start": 803, - "end": 804, + "start": 1053, + "end": 1054, "loc": { "start": { - "line": 31, + "line": 36, "column": 13 }, "end": { - "line": 31, + "line": 36, "column": 14 } } @@ -9207,15 +9687,15 @@ "binop": null }, "value": "root", - "start": 804, - "end": 808, + "start": 1054, + "end": 1058, "loc": { "start": { - "line": 31, + "line": 36, "column": 14 }, "end": { - "line": 31, + "line": 36, "column": 18 } } @@ -9234,15 +9714,15 @@ "updateContext": null }, "value": "===", - "start": 809, - "end": 812, + "start": 1059, + "end": 1062, "loc": { "start": { - "line": 31, + "line": 36, "column": 19 }, "end": { - "line": 31, + "line": 36, "column": 22 } } @@ -9262,15 +9742,15 @@ "updateContext": null }, "value": "null", - "start": 813, - "end": 817, + "start": 1063, + "end": 1067, "loc": { "start": { - "line": 31, + "line": 36, "column": 23 }, "end": { - "line": 31, + "line": 36, "column": 27 } } @@ -9288,15 +9768,15 @@ "binop": null, "updateContext": null }, - "start": 817, - "end": 818, + "start": 1067, + "end": 1068, "loc": { "start": { - "line": 31, + "line": 36, "column": 27 }, "end": { - "line": 31, + "line": 36, "column": 28 } } @@ -9313,31 +9793,31 @@ "postfix": false, "binop": null }, - "start": 820, - "end": 821, + "start": 1070, + "end": 1071, "loc": { "start": { - "line": 32, + "line": 37, "column": 1 }, "end": { - "line": 32, + "line": 37, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t ", - "start": 824, - "end": 903, + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", + "start": 1074, + "end": 1153, "loc": { "start": { - "line": 34, + "line": 39, "column": 1 }, "end": { - "line": 38, + "line": 43, "column": 4 } } @@ -9355,15 +9835,15 @@ "binop": null }, "value": "add", - "start": 905, - "end": 908, + "start": 1155, + "end": 1158, "loc": { "start": { - "line": 39, + "line": 44, "column": 1 }, "end": { - "line": 39, + "line": 44, "column": 4 } } @@ -9380,15 +9860,15 @@ "postfix": false, "binop": null }, - "start": 908, - "end": 909, + "start": 1158, + "end": 1159, "loc": { "start": { - "line": 39, + "line": 44, "column": 4 }, "end": { - "line": 39, + "line": 44, "column": 5 } } @@ -9406,15 +9886,15 @@ "binop": null }, "value": "key", - "start": 909, - "end": 912, + "start": 1159, + "end": 1162, "loc": { "start": { - "line": 39, + "line": 44, "column": 5 }, "end": { - "line": 39, + "line": 44, "column": 8 } } @@ -9431,15 +9911,15 @@ "postfix": false, "binop": null }, - "start": 912, - "end": 913, + "start": 1162, + "end": 1163, "loc": { "start": { - "line": 39, + "line": 44, "column": 8 }, "end": { - "line": 39, + "line": 44, "column": 9 } } @@ -9456,15 +9936,15 @@ "postfix": false, "binop": null }, - "start": 914, - "end": 915, + "start": 1164, + "end": 1165, "loc": { "start": { - "line": 39, + "line": 44, "column": 10 }, "end": { - "line": 39, + "line": 44, "column": 11 } } @@ -9484,15 +9964,15 @@ "updateContext": null }, "value": "if", - "start": 918, - "end": 920, + "start": 1168, + "end": 1170, "loc": { "start": { - "line": 40, + "line": 45, "column": 2 }, "end": { - "line": 40, + "line": 45, "column": 4 } } @@ -9509,15 +9989,15 @@ "postfix": false, "binop": null }, - "start": 921, - "end": 922, + "start": 1171, + "end": 1172, "loc": { "start": { - "line": 40, + "line": 45, "column": 5 }, "end": { - "line": 40, + "line": 45, "column": 6 } } @@ -9537,15 +10017,15 @@ "updateContext": null }, "value": "this", - "start": 922, - "end": 926, + "start": 1172, + "end": 1176, "loc": { "start": { - "line": 40, + "line": 45, "column": 6 }, "end": { - "line": 40, + "line": 45, "column": 10 } } @@ -9563,15 +10043,15 @@ "binop": null, "updateContext": null }, - "start": 926, - "end": 927, + "start": 1176, + "end": 1177, "loc": { "start": { - "line": 40, + "line": 45, "column": 10 }, "end": { - "line": 40, + "line": 45, "column": 11 } } @@ -9589,15 +10069,15 @@ "binop": null }, "value": "root", - "start": 927, - "end": 931, + "start": 1177, + "end": 1181, "loc": { "start": { - "line": 40, + "line": 45, "column": 11 }, "end": { - "line": 40, + "line": 45, "column": 15 } } @@ -9616,15 +10096,15 @@ "updateContext": null }, "value": "===", - "start": 932, - "end": 935, + "start": 1182, + "end": 1185, "loc": { "start": { - "line": 40, + "line": 45, "column": 16 }, "end": { - "line": 40, + "line": 45, "column": 19 } } @@ -9644,15 +10124,15 @@ "updateContext": null }, "value": "null", - "start": 936, - "end": 940, + "start": 1186, + "end": 1190, "loc": { "start": { - "line": 40, + "line": 45, "column": 20 }, "end": { - "line": 40, + "line": 45, "column": 24 } } @@ -9669,15 +10149,15 @@ "postfix": false, "binop": null }, - "start": 940, - "end": 941, + "start": 1190, + "end": 1191, "loc": { "start": { - "line": 40, + "line": 45, "column": 24 }, "end": { - "line": 40, + "line": 45, "column": 25 } } @@ -9694,15 +10174,15 @@ "postfix": false, "binop": null }, - "start": 942, - "end": 943, + "start": 1192, + "end": 1193, "loc": { "start": { - "line": 40, + "line": 45, "column": 26 }, "end": { - "line": 40, + "line": 45, "column": 27 } } @@ -9722,15 +10202,15 @@ "updateContext": null }, "value": "this", - "start": 947, - "end": 951, + "start": 1197, + "end": 1201, "loc": { "start": { - "line": 41, + "line": 46, "column": 3 }, "end": { - "line": 41, + "line": 46, "column": 7 } } @@ -9748,15 +10228,15 @@ "binop": null, "updateContext": null }, - "start": 951, - "end": 952, + "start": 1201, + "end": 1202, "loc": { "start": { - "line": 41, + "line": 46, "column": 7 }, "end": { - "line": 41, + "line": 46, "column": 8 } } @@ -9774,15 +10254,15 @@ "binop": null }, "value": "root", - "start": 952, - "end": 956, + "start": 1202, + "end": 1206, "loc": { "start": { - "line": 41, + "line": 46, "column": 8 }, "end": { - "line": 41, + "line": 46, "column": 12 } } @@ -9801,15 +10281,15 @@ "updateContext": null }, "value": "=", - "start": 957, - "end": 958, + "start": 1207, + "end": 1208, "loc": { "start": { - "line": 41, + "line": 46, "column": 13 }, "end": { - "line": 41, + "line": 46, "column": 14 } } @@ -9829,15 +10309,15 @@ "updateContext": null }, "value": "new", - "start": 959, - "end": 962, + "start": 1209, + "end": 1212, "loc": { "start": { - "line": 41, + "line": 46, "column": 15 }, "end": { - "line": 41, + "line": 46, "column": 18 } } @@ -9855,15 +10335,15 @@ "binop": null }, "value": "Node", - "start": 963, - "end": 967, + "start": 1213, + "end": 1217, "loc": { "start": { - "line": 41, + "line": 46, "column": 19 }, "end": { - "line": 41, + "line": 46, "column": 23 } } @@ -9880,15 +10360,15 @@ "postfix": false, "binop": null }, - "start": 967, - "end": 968, + "start": 1217, + "end": 1218, "loc": { "start": { - "line": 41, + "line": 46, "column": 23 }, "end": { - "line": 41, + "line": 46, "column": 24 } } @@ -9906,15 +10386,15 @@ "binop": null }, "value": "BLACK", - "start": 968, - "end": 973, + "start": 1218, + "end": 1223, "loc": { "start": { - "line": 41, + "line": 46, "column": 24 }, "end": { - "line": 41, + "line": 46, "column": 29 } } @@ -9932,15 +10412,15 @@ "binop": null, "updateContext": null }, - "start": 973, - "end": 974, + "start": 1223, + "end": 1224, "loc": { "start": { - "line": 41, + "line": 46, "column": 29 }, "end": { - "line": 41, + "line": 46, "column": 30 } } @@ -9958,15 +10438,15 @@ "binop": null }, "value": "key", - "start": 975, - "end": 978, + "start": 1225, + "end": 1228, "loc": { "start": { - "line": 41, + "line": 46, "column": 31 }, "end": { - "line": 41, + "line": 46, "column": 34 } } @@ -9983,15 +10463,15 @@ "postfix": false, "binop": null }, - "start": 978, - "end": 979, + "start": 1228, + "end": 1229, "loc": { "start": { - "line": 41, + "line": 46, "column": 34 }, "end": { - "line": 41, + "line": 46, "column": 35 } } @@ -10009,15 +10489,15 @@ "binop": null, "updateContext": null }, - "start": 979, - "end": 980, + "start": 1229, + "end": 1230, "loc": { "start": { - "line": 41, + "line": 46, "column": 35 }, "end": { - "line": 41, + "line": 46, "column": 36 } } @@ -10034,15 +10514,15 @@ "postfix": false, "binop": null }, - "start": 983, - "end": 984, + "start": 1233, + "end": 1234, "loc": { "start": { - "line": 42, + "line": 47, "column": 2 }, "end": { - "line": 42, + "line": 47, "column": 3 } } @@ -10062,15 +10542,15 @@ "updateContext": null }, "value": "else", - "start": 985, - "end": 989, + "start": 1235, + "end": 1239, "loc": { "start": { - "line": 42, + "line": 47, "column": 4 }, "end": { - "line": 42, + "line": 47, "column": 8 } } @@ -10087,15 +10567,15 @@ "postfix": false, "binop": null }, - "start": 990, - "end": 991, + "start": 1240, + "end": 1241, "loc": { "start": { - "line": 42, + "line": 47, "column": 9 }, "end": { - "line": 42, + "line": 47, "column": 10 } } @@ -10115,15 +10595,15 @@ "updateContext": null }, "value": "const", - "start": 995, - "end": 1000, + "start": 1245, + "end": 1250, "loc": { "start": { - "line": 43, + "line": 48, "column": 3 }, "end": { - "line": 43, + "line": 48, "column": 8 } } @@ -10141,15 +10621,15 @@ "binop": null }, "value": "node", - "start": 1001, - "end": 1005, + "start": 1251, + "end": 1255, "loc": { "start": { - "line": 43, + "line": 48, "column": 9 }, "end": { - "line": 43, + "line": 48, "column": 13 } } @@ -10168,15 +10648,15 @@ "updateContext": null }, "value": "=", - "start": 1006, - "end": 1007, + "start": 1256, + "end": 1257, "loc": { "start": { - "line": 43, + "line": 48, "column": 14 }, "end": { - "line": 43, + "line": 48, "column": 15 } } @@ -10196,15 +10676,15 @@ "updateContext": null }, "value": "new", - "start": 1008, - "end": 1011, + "start": 1258, + "end": 1261, "loc": { "start": { - "line": 43, + "line": 48, "column": 16 }, "end": { - "line": 43, + "line": 48, "column": 19 } } @@ -10222,15 +10702,15 @@ "binop": null }, "value": "Node", - "start": 1012, - "end": 1016, + "start": 1262, + "end": 1266, "loc": { "start": { - "line": 43, + "line": 48, "column": 20 }, "end": { - "line": 43, + "line": 48, "column": 24 } } @@ -10247,15 +10727,15 @@ "postfix": false, "binop": null }, - "start": 1016, - "end": 1017, + "start": 1266, + "end": 1267, "loc": { "start": { - "line": 43, + "line": 48, "column": 24 }, "end": { - "line": 43, + "line": 48, "column": 25 } } @@ -10273,15 +10753,15 @@ "binop": null }, "value": "RED", - "start": 1017, - "end": 1020, + "start": 1267, + "end": 1270, "loc": { "start": { - "line": 43, + "line": 48, "column": 25 }, "end": { - "line": 43, + "line": 48, "column": 28 } } @@ -10299,15 +10779,15 @@ "binop": null, "updateContext": null }, - "start": 1020, - "end": 1021, + "start": 1270, + "end": 1271, "loc": { "start": { - "line": 43, + "line": 48, "column": 28 }, "end": { - "line": 43, + "line": 48, "column": 29 } } @@ -10325,15 +10805,15 @@ "binop": null }, "value": "key", - "start": 1022, - "end": 1025, + "start": 1272, + "end": 1275, "loc": { "start": { - "line": 43, + "line": 48, "column": 30 }, "end": { - "line": 43, + "line": 48, "column": 33 } } @@ -10350,15 +10830,15 @@ "postfix": false, "binop": null }, - "start": 1025, - "end": 1026, + "start": 1275, + "end": 1276, "loc": { "start": { - "line": 43, + "line": 48, "column": 33 }, "end": { - "line": 43, + "line": 48, "column": 34 } } @@ -10376,15 +10856,15 @@ "binop": null, "updateContext": null }, - "start": 1026, - "end": 1027, + "start": 1276, + "end": 1277, "loc": { "start": { - "line": 43, + "line": 48, "column": 34 }, "end": { - "line": 43, + "line": 48, "column": 35 } } @@ -10402,15 +10882,15 @@ "binop": null }, "value": "insert", - "start": 1031, - "end": 1037, + "start": 1281, + "end": 1287, "loc": { "start": { - "line": 44, + "line": 49, "column": 3 }, "end": { - "line": 44, + "line": 49, "column": 9 } } @@ -10427,15 +10907,15 @@ "postfix": false, "binop": null }, - "start": 1037, - "end": 1038, + "start": 1287, + "end": 1288, "loc": { "start": { - "line": 44, + "line": 49, "column": 9 }, "end": { - "line": 44, + "line": 49, "column": 10 } } @@ -10455,15 +10935,15 @@ "updateContext": null }, "value": "this", - "start": 1038, - "end": 1042, + "start": 1288, + "end": 1292, "loc": { "start": { - "line": 44, + "line": 49, "column": 10 }, "end": { - "line": 44, + "line": 49, "column": 14 } } @@ -10481,15 +10961,15 @@ "binop": null, "updateContext": null }, - "start": 1042, - "end": 1043, + "start": 1292, + "end": 1293, "loc": { "start": { - "line": 44, + "line": 49, "column": 14 }, "end": { - "line": 44, + "line": 49, "column": 15 } } @@ -10507,15 +10987,15 @@ "binop": null }, "value": "compare", - "start": 1043, - "end": 1050, + "start": 1293, + "end": 1300, "loc": { "start": { - "line": 44, + "line": 49, "column": 15 }, "end": { - "line": 44, + "line": 49, "column": 22 } } @@ -10533,15 +11013,15 @@ "binop": null, "updateContext": null }, - "start": 1050, - "end": 1051, + "start": 1300, + "end": 1301, "loc": { "start": { - "line": 44, + "line": 49, "column": 22 }, "end": { - "line": 44, + "line": 49, "column": 23 } } @@ -10561,15 +11041,15 @@ "updateContext": null }, "value": "this", - "start": 1052, - "end": 1056, + "start": 1302, + "end": 1306, "loc": { "start": { - "line": 44, + "line": 49, "column": 24 }, "end": { - "line": 44, + "line": 49, "column": 28 } } @@ -10587,15 +11067,15 @@ "binop": null, "updateContext": null }, - "start": 1056, - "end": 1057, + "start": 1306, + "end": 1307, "loc": { "start": { - "line": 44, + "line": 49, "column": 28 }, "end": { - "line": 44, + "line": 49, "column": 29 } } @@ -10613,15 +11093,15 @@ "binop": null }, "value": "root", - "start": 1057, - "end": 1061, + "start": 1307, + "end": 1311, "loc": { "start": { - "line": 44, + "line": 49, "column": 29 }, "end": { - "line": 44, + "line": 49, "column": 33 } } @@ -10639,15 +11119,15 @@ "binop": null, "updateContext": null }, - "start": 1061, - "end": 1062, + "start": 1311, + "end": 1312, "loc": { "start": { - "line": 44, + "line": 49, "column": 33 }, "end": { - "line": 44, + "line": 49, "column": 34 } } @@ -10665,15 +11145,15 @@ "binop": null }, "value": "node", - "start": 1063, - "end": 1067, + "start": 1313, + "end": 1317, "loc": { "start": { - "line": 44, + "line": 49, "column": 35 }, "end": { - "line": 44, + "line": 49, "column": 39 } } @@ -10690,15 +11170,15 @@ "postfix": false, "binop": null }, - "start": 1067, - "end": 1068, + "start": 1317, + "end": 1318, "loc": { "start": { - "line": 44, + "line": 49, "column": 39 }, "end": { - "line": 44, + "line": 49, "column": 40 } } @@ -10716,15 +11196,15 @@ "binop": null, "updateContext": null }, - "start": 1068, - "end": 1069, + "start": 1318, + "end": 1319, "loc": { "start": { - "line": 44, + "line": 49, "column": 40 }, "end": { - "line": 44, + "line": 49, "column": 41 } } @@ -10742,15 +11222,15 @@ "binop": null }, "value": "insert_case2", - "start": 1073, - "end": 1085, + "start": 1323, + "end": 1335, "loc": { "start": { - "line": 45, + "line": 50, "column": 3 }, "end": { - "line": 45, + "line": 50, "column": 15 } } @@ -10767,15 +11247,15 @@ "postfix": false, "binop": null }, - "start": 1085, - "end": 1086, + "start": 1335, + "end": 1336, "loc": { "start": { - "line": 45, + "line": 50, "column": 15 }, "end": { - "line": 45, + "line": 50, "column": 16 } } @@ -10793,15 +11273,15 @@ "binop": null }, "value": "node", - "start": 1086, - "end": 1090, + "start": 1336, + "end": 1340, "loc": { "start": { - "line": 45, + "line": 50, "column": 16 }, "end": { - "line": 45, + "line": 50, "column": 20 } } @@ -10818,15 +11298,15 @@ "postfix": false, "binop": null }, - "start": 1090, - "end": 1091, + "start": 1340, + "end": 1341, "loc": { "start": { - "line": 45, + "line": 50, "column": 20 }, "end": { - "line": 45, + "line": 50, "column": 21 } } @@ -10844,15 +11324,15 @@ "binop": null, "updateContext": null }, - "start": 1091, - "end": 1092, + "start": 1341, + "end": 1342, "loc": { "start": { - "line": 45, + "line": 50, "column": 21 }, "end": { - "line": 45, + "line": 50, "column": 22 } } @@ -10869,15 +11349,15 @@ "postfix": false, "binop": null }, - "start": 1095, - "end": 1096, + "start": 1345, + "end": 1346, "loc": { "start": { - "line": 46, + "line": 51, "column": 2 }, "end": { - "line": 46, + "line": 51, "column": 3 } } @@ -10894,31 +11374,31 @@ "postfix": false, "binop": null }, - "start": 1098, - "end": 1099, + "start": 1348, + "end": 1349, "loc": { "start": { - "line": 47, + "line": 52, "column": 1 }, "end": { - "line": 47, + "line": 52, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1102, - "end": 1328, + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", + "start": 1352, + "end": 1578, "loc": { "start": { - "line": 49, + "line": 54, "column": 1 }, "end": { - "line": 56, + "line": 61, "column": 4 } } @@ -10936,15 +11416,15 @@ "binop": null }, "value": "_search", - "start": 1330, - "end": 1337, + "start": 1580, + "end": 1587, "loc": { "start": { - "line": 57, + "line": 62, "column": 1 }, "end": { - "line": 57, + "line": 62, "column": 8 } } @@ -10961,15 +11441,15 @@ "postfix": false, "binop": null }, - "start": 1337, - "end": 1338, + "start": 1587, + "end": 1588, "loc": { "start": { - "line": 57, + "line": 62, "column": 8 }, "end": { - "line": 57, + "line": 62, "column": 9 } } @@ -10987,15 +11467,15 @@ "binop": null }, "value": "key", - "start": 1338, - "end": 1341, + "start": 1588, + "end": 1591, "loc": { "start": { - "line": 57, + "line": 62, "column": 9 }, "end": { - "line": 57, + "line": 62, "column": 12 } } @@ -11012,15 +11492,15 @@ "postfix": false, "binop": null }, - "start": 1341, - "end": 1342, + "start": 1591, + "end": 1592, "loc": { "start": { - "line": 57, + "line": 62, "column": 12 }, "end": { - "line": 57, + "line": 62, "column": 13 } } @@ -11037,15 +11517,15 @@ "postfix": false, "binop": null }, - "start": 1343, - "end": 1344, + "start": 1593, + "end": 1594, "loc": { "start": { - "line": 57, + "line": 62, "column": 14 }, "end": { - "line": 57, + "line": 62, "column": 15 } } @@ -11065,15 +11545,15 @@ "updateContext": null }, "value": "if", - "start": 1347, - "end": 1349, + "start": 1597, + "end": 1599, "loc": { "start": { - "line": 58, + "line": 63, "column": 2 }, "end": { - "line": 58, + "line": 63, "column": 4 } } @@ -11090,15 +11570,15 @@ "postfix": false, "binop": null }, - "start": 1350, - "end": 1351, + "start": 1600, + "end": 1601, "loc": { "start": { - "line": 58, + "line": 63, "column": 5 }, "end": { - "line": 58, + "line": 63, "column": 6 } } @@ -11118,15 +11598,15 @@ "updateContext": null }, "value": "this", - "start": 1351, - "end": 1355, + "start": 1601, + "end": 1605, "loc": { "start": { - "line": 58, + "line": 63, "column": 6 }, "end": { - "line": 58, + "line": 63, "column": 10 } } @@ -11144,15 +11624,15 @@ "binop": null, "updateContext": null }, - "start": 1355, - "end": 1356, + "start": 1605, + "end": 1606, "loc": { "start": { - "line": 58, + "line": 63, "column": 10 }, "end": { - "line": 58, + "line": 63, "column": 11 } } @@ -11170,15 +11650,15 @@ "binop": null }, "value": "root", - "start": 1356, - "end": 1360, + "start": 1606, + "end": 1610, "loc": { "start": { - "line": 58, + "line": 63, "column": 11 }, "end": { - "line": 58, + "line": 63, "column": 15 } } @@ -11197,15 +11677,15 @@ "updateContext": null }, "value": "===", - "start": 1361, - "end": 1364, + "start": 1611, + "end": 1614, "loc": { "start": { - "line": 58, + "line": 63, "column": 16 }, "end": { - "line": 58, + "line": 63, "column": 19 } } @@ -11225,15 +11705,15 @@ "updateContext": null }, "value": "null", - "start": 1365, - "end": 1369, + "start": 1615, + "end": 1619, "loc": { "start": { - "line": 58, + "line": 63, "column": 20 }, "end": { - "line": 58, + "line": 63, "column": 24 } } @@ -11250,15 +11730,15 @@ "postfix": false, "binop": null }, - "start": 1369, - "end": 1370, + "start": 1619, + "end": 1620, "loc": { "start": { - "line": 58, + "line": 63, "column": 24 }, "end": { - "line": 58, + "line": 63, "column": 25 } } @@ -11278,15 +11758,15 @@ "updateContext": null }, "value": "return", - "start": 1371, - "end": 1377, + "start": 1621, + "end": 1627, "loc": { "start": { - "line": 58, + "line": 63, "column": 26 }, "end": { - "line": 58, + "line": 63, "column": 32 } } @@ -11306,15 +11786,15 @@ "updateContext": null }, "value": "null", - "start": 1378, - "end": 1382, + "start": 1628, + "end": 1632, "loc": { "start": { - "line": 58, + "line": 63, "column": 33 }, "end": { - "line": 58, + "line": 63, "column": 37 } } @@ -11332,15 +11812,15 @@ "binop": null, "updateContext": null }, - "start": 1382, - "end": 1383, + "start": 1632, + "end": 1633, "loc": { "start": { - "line": 58, + "line": 63, "column": 37 }, "end": { - "line": 58, + "line": 63, "column": 38 } } @@ -11360,15 +11840,15 @@ "updateContext": null }, "value": "return", - "start": 1386, - "end": 1392, + "start": 1636, + "end": 1642, "loc": { "start": { - "line": 59, + "line": 64, "column": 2 }, "end": { - "line": 59, + "line": 64, "column": 8 } } @@ -11386,15 +11866,15 @@ "binop": null }, "value": "search", - "start": 1393, - "end": 1399, + "start": 1643, + "end": 1649, "loc": { "start": { - "line": 59, + "line": 64, "column": 9 }, "end": { - "line": 59, + "line": 64, "column": 15 } } @@ -11411,15 +11891,15 @@ "postfix": false, "binop": null }, - "start": 1399, - "end": 1400, + "start": 1649, + "end": 1650, "loc": { "start": { - "line": 59, + "line": 64, "column": 15 }, "end": { - "line": 59, + "line": 64, "column": 16 } } @@ -11439,15 +11919,15 @@ "updateContext": null }, "value": "this", - "start": 1400, - "end": 1404, + "start": 1650, + "end": 1654, "loc": { "start": { - "line": 59, + "line": 64, "column": 16 }, "end": { - "line": 59, + "line": 64, "column": 20 } } @@ -11465,15 +11945,15 @@ "binop": null, "updateContext": null }, - "start": 1404, - "end": 1405, + "start": 1654, + "end": 1655, "loc": { "start": { - "line": 59, + "line": 64, "column": 20 }, "end": { - "line": 59, + "line": 64, "column": 21 } } @@ -11491,15 +11971,15 @@ "binop": null }, "value": "compare", - "start": 1405, - "end": 1412, + "start": 1655, + "end": 1662, "loc": { "start": { - "line": 59, + "line": 64, "column": 21 }, "end": { - "line": 59, + "line": 64, "column": 28 } } @@ -11517,15 +11997,15 @@ "binop": null, "updateContext": null }, - "start": 1412, - "end": 1413, + "start": 1662, + "end": 1663, "loc": { "start": { - "line": 59, + "line": 64, "column": 28 }, "end": { - "line": 59, + "line": 64, "column": 29 } } @@ -11545,15 +12025,15 @@ "updateContext": null }, "value": "this", - "start": 1414, - "end": 1418, + "start": 1664, + "end": 1668, "loc": { "start": { - "line": 59, + "line": 64, "column": 30 }, "end": { - "line": 59, + "line": 64, "column": 34 } } @@ -11571,15 +12051,15 @@ "binop": null, "updateContext": null }, - "start": 1418, - "end": 1419, + "start": 1668, + "end": 1669, "loc": { "start": { - "line": 59, + "line": 64, "column": 34 }, "end": { - "line": 59, + "line": 64, "column": 35 } } @@ -11597,15 +12077,15 @@ "binop": null }, "value": "root", - "start": 1419, - "end": 1423, + "start": 1669, + "end": 1673, "loc": { "start": { - "line": 59, + "line": 64, "column": 35 }, "end": { - "line": 59, + "line": 64, "column": 39 } } @@ -11623,15 +12103,15 @@ "binop": null, "updateContext": null }, - "start": 1423, - "end": 1424, + "start": 1673, + "end": 1674, "loc": { "start": { - "line": 59, + "line": 64, "column": 39 }, "end": { - "line": 59, + "line": 64, "column": 40 } } @@ -11649,15 +12129,15 @@ "binop": null }, "value": "key", - "start": 1425, - "end": 1428, + "start": 1675, + "end": 1678, "loc": { "start": { - "line": 59, + "line": 64, "column": 41 }, "end": { - "line": 59, + "line": 64, "column": 44 } } @@ -11674,15 +12154,15 @@ "postfix": false, "binop": null }, - "start": 1428, - "end": 1429, + "start": 1678, + "end": 1679, "loc": { "start": { - "line": 59, + "line": 64, "column": 44 }, "end": { - "line": 59, + "line": 64, "column": 45 } } @@ -11700,15 +12180,15 @@ "binop": null, "updateContext": null }, - "start": 1429, - "end": 1430, + "start": 1679, + "end": 1680, "loc": { "start": { - "line": 59, + "line": 64, "column": 45 }, "end": { - "line": 59, + "line": 64, "column": 46 } } @@ -11725,31 +12205,31 @@ "postfix": false, "binop": null }, - "start": 1432, - "end": 1433, + "start": 1682, + "end": 1683, "loc": { "start": { - "line": 60, + "line": 65, "column": 1 }, "end": { - "line": 60, + "line": 65, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t ", - "start": 1436, - "end": 1698, + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", + "start": 1686, + "end": 1948, "loc": { "start": { - "line": 62, + "line": 67, "column": 1 }, "end": { - "line": 69, + "line": 74, "column": 4 } } @@ -11767,15 +12247,15 @@ "binop": null }, "value": "get", - "start": 1700, - "end": 1703, + "start": 1950, + "end": 1953, "loc": { "start": { - "line": 70, + "line": 75, "column": 1 }, "end": { - "line": 70, + "line": 75, "column": 4 } } @@ -11792,15 +12272,15 @@ "postfix": false, "binop": null }, - "start": 1703, - "end": 1704, + "start": 1953, + "end": 1954, "loc": { "start": { - "line": 70, + "line": 75, "column": 4 }, "end": { - "line": 70, + "line": 75, "column": 5 } } @@ -11818,15 +12298,15 @@ "binop": null }, "value": "key", - "start": 1704, - "end": 1707, + "start": 1954, + "end": 1957, "loc": { "start": { - "line": 70, + "line": 75, "column": 5 }, "end": { - "line": 70, + "line": 75, "column": 8 } } @@ -11843,15 +12323,15 @@ "postfix": false, "binop": null }, - "start": 1707, - "end": 1708, + "start": 1957, + "end": 1958, "loc": { "start": { - "line": 70, + "line": 75, "column": 8 }, "end": { - "line": 70, + "line": 75, "column": 9 } } @@ -11868,15 +12348,15 @@ "postfix": false, "binop": null }, - "start": 1709, - "end": 1710, + "start": 1959, + "end": 1960, "loc": { "start": { - "line": 70, + "line": 75, "column": 10 }, "end": { - "line": 70, + "line": 75, "column": 11 } } @@ -11896,15 +12376,15 @@ "updateContext": null }, "value": "const", - "start": 1713, - "end": 1718, + "start": 1963, + "end": 1968, "loc": { "start": { - "line": 71, + "line": 76, "column": 2 }, "end": { - "line": 71, + "line": 76, "column": 7 } } @@ -11922,15 +12402,15 @@ "binop": null }, "value": "node", - "start": 1719, - "end": 1723, + "start": 1969, + "end": 1973, "loc": { "start": { - "line": 71, + "line": 76, "column": 8 }, "end": { - "line": 71, + "line": 76, "column": 12 } } @@ -11949,15 +12429,15 @@ "updateContext": null }, "value": "=", - "start": 1724, - "end": 1725, + "start": 1974, + "end": 1975, "loc": { "start": { - "line": 71, + "line": 76, "column": 13 }, "end": { - "line": 71, + "line": 76, "column": 14 } } @@ -11977,15 +12457,15 @@ "updateContext": null }, "value": "this", - "start": 1726, - "end": 1730, + "start": 1976, + "end": 1980, "loc": { "start": { - "line": 71, + "line": 76, "column": 15 }, "end": { - "line": 71, + "line": 76, "column": 19 } } @@ -12003,15 +12483,15 @@ "binop": null, "updateContext": null }, - "start": 1730, - "end": 1731, + "start": 1980, + "end": 1981, "loc": { "start": { - "line": 71, + "line": 76, "column": 19 }, "end": { - "line": 71, + "line": 76, "column": 20 } } @@ -12029,15 +12509,15 @@ "binop": null }, "value": "_search", - "start": 1731, - "end": 1738, + "start": 1981, + "end": 1988, "loc": { "start": { - "line": 71, + "line": 76, "column": 20 }, "end": { - "line": 71, + "line": 76, "column": 27 } } @@ -12054,15 +12534,15 @@ "postfix": false, "binop": null }, - "start": 1738, - "end": 1739, + "start": 1988, + "end": 1989, "loc": { "start": { - "line": 71, + "line": 76, "column": 27 }, "end": { - "line": 71, + "line": 76, "column": 28 } } @@ -12080,15 +12560,15 @@ "binop": null }, "value": "key", - "start": 1739, - "end": 1742, + "start": 1989, + "end": 1992, "loc": { "start": { - "line": 71, + "line": 76, "column": 28 }, "end": { - "line": 71, + "line": 76, "column": 31 } } @@ -12105,15 +12585,15 @@ "postfix": false, "binop": null }, - "start": 1742, - "end": 1743, + "start": 1992, + "end": 1993, "loc": { "start": { - "line": 71, + "line": 76, "column": 31 }, "end": { - "line": 71, + "line": 76, "column": 32 } } @@ -12131,15 +12611,15 @@ "binop": null, "updateContext": null }, - "start": 1743, - "end": 1744, + "start": 1993, + "end": 1994, "loc": { "start": { - "line": 71, + "line": 76, "column": 32 }, "end": { - "line": 71, + "line": 76, "column": 33 } } @@ -12159,15 +12639,15 @@ "updateContext": null }, "value": "return", - "start": 1747, - "end": 1753, + "start": 1997, + "end": 2003, "loc": { "start": { - "line": 72, + "line": 77, "column": 2 }, "end": { - "line": 72, + "line": 77, "column": 8 } } @@ -12185,15 +12665,15 @@ "binop": null }, "value": "node", - "start": 1754, - "end": 1758, + "start": 2004, + "end": 2008, "loc": { "start": { - "line": 72, + "line": 77, "column": 9 }, "end": { - "line": 72, + "line": 77, "column": 13 } } @@ -12212,15 +12692,15 @@ "updateContext": null }, "value": "===", - "start": 1759, - "end": 1762, + "start": 2009, + "end": 2012, "loc": { "start": { - "line": 72, + "line": 77, "column": 14 }, "end": { - "line": 72, + "line": 77, "column": 17 } } @@ -12240,15 +12720,15 @@ "updateContext": null }, "value": "null", - "start": 1763, - "end": 1767, + "start": 2013, + "end": 2017, "loc": { "start": { - "line": 72, + "line": 77, "column": 18 }, "end": { - "line": 72, + "line": 77, "column": 22 } } @@ -12266,15 +12746,15 @@ "binop": null, "updateContext": null }, - "start": 1768, - "end": 1769, + "start": 2018, + "end": 2019, "loc": { "start": { - "line": 72, + "line": 77, "column": 23 }, "end": { - "line": 72, + "line": 77, "column": 24 } } @@ -12294,15 +12774,15 @@ "updateContext": null }, "value": "null", - "start": 1770, - "end": 1774, + "start": 2020, + "end": 2024, "loc": { "start": { - "line": 72, + "line": 77, "column": 25 }, "end": { - "line": 72, + "line": 77, "column": 29 } } @@ -12320,15 +12800,15 @@ "binop": null, "updateContext": null }, - "start": 1775, - "end": 1776, + "start": 2025, + "end": 2026, "loc": { "start": { - "line": 72, + "line": 77, "column": 30 }, "end": { - "line": 72, + "line": 77, "column": 31 } } @@ -12346,15 +12826,15 @@ "binop": null }, "value": "node", - "start": 1777, - "end": 1781, + "start": 2027, + "end": 2031, "loc": { "start": { - "line": 72, + "line": 77, "column": 32 }, "end": { - "line": 72, + "line": 77, "column": 36 } } @@ -12372,15 +12852,15 @@ "binop": null, "updateContext": null }, - "start": 1781, - "end": 1782, + "start": 2031, + "end": 2032, "loc": { "start": { - "line": 72, + "line": 77, "column": 36 }, "end": { - "line": 72, + "line": 77, "column": 37 } } @@ -12398,15 +12878,15 @@ "binop": null }, "value": "key", - "start": 1782, - "end": 1785, + "start": 2032, + "end": 2035, "loc": { "start": { - "line": 72, + "line": 77, "column": 37 }, "end": { - "line": 72, + "line": 77, "column": 40 } } @@ -12424,15 +12904,15 @@ "binop": null, "updateContext": null }, - "start": 1785, - "end": 1786, + "start": 2035, + "end": 2036, "loc": { "start": { - "line": 72, + "line": 77, "column": 40 }, "end": { - "line": 72, + "line": 77, "column": 41 } } @@ -12449,31 +12929,31 @@ "postfix": false, "binop": null }, - "start": 1788, - "end": 1789, + "start": 2038, + "end": 2039, "loc": { "start": { - "line": 73, + "line": 78, "column": 1 }, "end": { - "line": 73, + "line": 78, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t ", - "start": 1792, - "end": 1947, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t ", + "start": 2042, + "end": 2197, "loc": { "start": { - "line": 75, + "line": 80, "column": 1 }, "end": { - "line": 81, + "line": 86, "column": 4 } } @@ -12491,15 +12971,15 @@ "binop": null }, "value": "has", - "start": 1949, - "end": 1952, + "start": 2199, + "end": 2202, "loc": { "start": { - "line": 82, + "line": 87, "column": 1 }, "end": { - "line": 82, + "line": 87, "column": 4 } } @@ -12516,15 +12996,15 @@ "postfix": false, "binop": null }, - "start": 1952, - "end": 1953, + "start": 2202, + "end": 2203, "loc": { "start": { - "line": 82, + "line": 87, "column": 4 }, "end": { - "line": 82, + "line": 87, "column": 5 } } @@ -12542,15 +13022,15 @@ "binop": null }, "value": "key", - "start": 1953, - "end": 1956, + "start": 2203, + "end": 2206, "loc": { "start": { - "line": 82, + "line": 87, "column": 5 }, "end": { - "line": 82, + "line": 87, "column": 8 } } @@ -12567,15 +13047,15 @@ "postfix": false, "binop": null }, - "start": 1956, - "end": 1957, + "start": 2206, + "end": 2207, "loc": { "start": { - "line": 82, + "line": 87, "column": 8 }, "end": { - "line": 82, + "line": 87, "column": 9 } } @@ -12592,15 +13072,15 @@ "postfix": false, "binop": null }, - "start": 1958, - "end": 1959, + "start": 2208, + "end": 2209, "loc": { "start": { - "line": 82, + "line": 87, "column": 10 }, "end": { - "line": 82, + "line": 87, "column": 11 } } @@ -12620,15 +13100,15 @@ "updateContext": null }, "value": "return", - "start": 1962, - "end": 1968, + "start": 2212, + "end": 2218, "loc": { "start": { - "line": 83, + "line": 88, "column": 2 }, "end": { - "line": 83, + "line": 88, "column": 8 } } @@ -12648,15 +13128,15 @@ "updateContext": null }, "value": "this", - "start": 1969, - "end": 1973, + "start": 2219, + "end": 2223, "loc": { "start": { - "line": 83, + "line": 88, "column": 9 }, "end": { - "line": 83, + "line": 88, "column": 13 } } @@ -12674,15 +13154,15 @@ "binop": null, "updateContext": null }, - "start": 1973, - "end": 1974, + "start": 2223, + "end": 2224, "loc": { "start": { - "line": 83, + "line": 88, "column": 13 }, "end": { - "line": 83, + "line": 88, "column": 14 } } @@ -12700,15 +13180,15 @@ "binop": null }, "value": "_search", - "start": 1974, - "end": 1981, + "start": 2224, + "end": 2231, "loc": { "start": { - "line": 83, + "line": 88, "column": 14 }, "end": { - "line": 83, + "line": 88, "column": 21 } } @@ -12725,15 +13205,15 @@ "postfix": false, "binop": null }, - "start": 1981, - "end": 1982, + "start": 2231, + "end": 2232, "loc": { "start": { - "line": 83, + "line": 88, "column": 21 }, "end": { - "line": 83, + "line": 88, "column": 22 } } @@ -12751,15 +13231,15 @@ "binop": null }, "value": "key", - "start": 1982, - "end": 1985, + "start": 2232, + "end": 2235, "loc": { "start": { - "line": 83, + "line": 88, "column": 22 }, "end": { - "line": 83, + "line": 88, "column": 25 } } @@ -12776,15 +13256,15 @@ "postfix": false, "binop": null }, - "start": 1985, - "end": 1986, + "start": 2235, + "end": 2236, "loc": { "start": { - "line": 83, + "line": 88, "column": 25 }, "end": { - "line": 83, + "line": 88, "column": 26 } } @@ -12803,15 +13283,15 @@ "updateContext": null }, "value": "!==", - "start": 1987, - "end": 1990, + "start": 2237, + "end": 2240, "loc": { "start": { - "line": 83, + "line": 88, "column": 27 }, "end": { - "line": 83, + "line": 88, "column": 30 } } @@ -12831,15 +13311,15 @@ "updateContext": null }, "value": "null", - "start": 1991, - "end": 1995, + "start": 2241, + "end": 2245, "loc": { "start": { - "line": 83, + "line": 88, "column": 31 }, "end": { - "line": 83, + "line": 88, "column": 35 } } @@ -12857,15 +13337,15 @@ "binop": null, "updateContext": null }, - "start": 1995, - "end": 1996, + "start": 2245, + "end": 2246, "loc": { "start": { - "line": 83, + "line": 88, "column": 35 }, "end": { - "line": 83, + "line": 88, "column": 36 } } @@ -12882,15 +13362,15 @@ "postfix": false, "binop": null }, - "start": 1998, - "end": 1999, + "start": 2248, + "end": 2249, "loc": { "start": { - "line": 84, + "line": 89, "column": 1 }, "end": { - "line": 84, + "line": 89, "column": 2 } } @@ -12898,15 +13378,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2002, - "end": 2107, + "start": 2252, + "end": 2357, "loc": { "start": { - "line": 86, + "line": 91, "column": 1 }, "end": { - "line": 90, + "line": 95, "column": 4 } } @@ -12924,15 +13404,15 @@ "binop": null }, "value": "_delete", - "start": 2109, - "end": 2116, + "start": 2359, + "end": 2366, "loc": { "start": { - "line": 91, + "line": 96, "column": 1 }, "end": { - "line": 91, + "line": 96, "column": 8 } } @@ -12949,15 +13429,15 @@ "postfix": false, "binop": null }, - "start": 2116, - "end": 2117, + "start": 2366, + "end": 2367, "loc": { "start": { - "line": 91, + "line": 96, "column": 8 }, "end": { - "line": 91, + "line": 96, "column": 9 } } @@ -12975,15 +13455,15 @@ "binop": null }, "value": "node", - "start": 2117, - "end": 2121, + "start": 2367, + "end": 2371, "loc": { "start": { - "line": 91, + "line": 96, "column": 9 }, "end": { - "line": 91, + "line": 96, "column": 13 } } @@ -13000,15 +13480,15 @@ "postfix": false, "binop": null }, - "start": 2121, - "end": 2122, + "start": 2371, + "end": 2372, "loc": { "start": { - "line": 91, + "line": 96, "column": 13 }, "end": { - "line": 91, + "line": 96, "column": 14 } } @@ -13025,15 +13505,15 @@ "postfix": false, "binop": null }, - "start": 2123, - "end": 2124, + "start": 2373, + "end": 2374, "loc": { "start": { - "line": 91, + "line": 96, "column": 15 }, "end": { - "line": 91, + "line": 96, "column": 16 } } @@ -13053,15 +13533,15 @@ "updateContext": null }, "value": "if", - "start": 2127, - "end": 2129, + "start": 2377, + "end": 2379, "loc": { "start": { - "line": 92, + "line": 97, "column": 2 }, "end": { - "line": 92, + "line": 97, "column": 4 } } @@ -13078,15 +13558,15 @@ "postfix": false, "binop": null }, - "start": 2130, - "end": 2131, + "start": 2380, + "end": 2381, "loc": { "start": { - "line": 92, + "line": 97, "column": 5 }, "end": { - "line": 92, + "line": 97, "column": 6 } } @@ -13105,15 +13585,15 @@ "updateContext": null }, "value": "!", - "start": 2131, - "end": 2132, + "start": 2381, + "end": 2382, "loc": { "start": { - "line": 92, + "line": 97, "column": 6 }, "end": { - "line": 92, + "line": 97, "column": 7 } } @@ -13131,15 +13611,15 @@ "binop": null }, "value": "node", - "start": 2132, - "end": 2136, + "start": 2382, + "end": 2386, "loc": { "start": { - "line": 92, + "line": 97, "column": 7 }, "end": { - "line": 92, + "line": 97, "column": 11 } } @@ -13157,15 +13637,15 @@ "binop": null, "updateContext": null }, - "start": 2136, - "end": 2137, + "start": 2386, + "end": 2387, "loc": { "start": { - "line": 92, + "line": 97, "column": 11 }, "end": { - "line": 92, + "line": 97, "column": 12 } } @@ -13183,15 +13663,15 @@ "binop": null }, "value": "left", - "start": 2137, - "end": 2141, + "start": 2387, + "end": 2391, "loc": { "start": { - "line": 92, + "line": 97, "column": 12 }, "end": { - "line": 92, + "line": 97, "column": 16 } } @@ -13209,15 +13689,15 @@ "binop": null, "updateContext": null }, - "start": 2141, - "end": 2142, + "start": 2391, + "end": 2392, "loc": { "start": { - "line": 92, + "line": 97, "column": 16 }, "end": { - "line": 92, + "line": 97, "column": 17 } } @@ -13235,15 +13715,15 @@ "binop": null }, "value": "isLeaf", - "start": 2142, - "end": 2148, + "start": 2392, + "end": 2398, "loc": { "start": { - "line": 92, + "line": 97, "column": 17 }, "end": { - "line": 92, + "line": 97, "column": 23 } } @@ -13260,15 +13740,15 @@ "postfix": false, "binop": null }, - "start": 2148, - "end": 2149, + "start": 2398, + "end": 2399, "loc": { "start": { - "line": 92, + "line": 97, "column": 23 }, "end": { - "line": 92, + "line": 97, "column": 24 } } @@ -13285,15 +13765,15 @@ "postfix": false, "binop": null }, - "start": 2149, - "end": 2150, + "start": 2399, + "end": 2400, "loc": { "start": { - "line": 92, + "line": 97, "column": 24 }, "end": { - "line": 92, + "line": 97, "column": 25 } } @@ -13310,15 +13790,15 @@ "postfix": false, "binop": null }, - "start": 2150, - "end": 2151, + "start": 2400, + "end": 2401, "loc": { "start": { - "line": 92, + "line": 97, "column": 25 }, "end": { - "line": 92, + "line": 97, "column": 26 } } @@ -13335,15 +13815,15 @@ "postfix": false, "binop": null }, - "start": 2152, - "end": 2153, + "start": 2402, + "end": 2403, "loc": { "start": { - "line": 92, + "line": 97, "column": 27 }, "end": { - "line": 92, + "line": 97, "column": 28 } } @@ -13351,15 +13831,15 @@ { "type": "CommentLine", "value": " Replace node's key with predecessor's key", - "start": 2157, - "end": 2201, + "start": 2407, + "end": 2451, "loc": { "start": { - "line": 93, + "line": 98, "column": 3 }, "end": { - "line": 93, + "line": 98, "column": 47 } } @@ -13379,15 +13859,15 @@ "updateContext": null }, "value": "const", - "start": 2205, - "end": 2210, + "start": 2455, + "end": 2460, "loc": { "start": { - "line": 94, + "line": 99, "column": 3 }, "end": { - "line": 94, + "line": 99, "column": 8 } } @@ -13405,15 +13885,15 @@ "binop": null }, "value": "pred", - "start": 2211, - "end": 2215, + "start": 2461, + "end": 2465, "loc": { "start": { - "line": 94, + "line": 99, "column": 9 }, "end": { - "line": 94, + "line": 99, "column": 13 } } @@ -13432,15 +13912,15 @@ "updateContext": null }, "value": "=", - "start": 2216, - "end": 2217, + "start": 2466, + "end": 2467, "loc": { "start": { - "line": 94, + "line": 99, "column": 14 }, "end": { - "line": 94, + "line": 99, "column": 15 } } @@ -13458,15 +13938,15 @@ "binop": null }, "value": "predecessor", - "start": 2218, - "end": 2229, + "start": 2468, + "end": 2479, "loc": { "start": { - "line": 94, + "line": 99, "column": 16 }, "end": { - "line": 94, + "line": 99, "column": 27 } } @@ -13483,15 +13963,15 @@ "postfix": false, "binop": null }, - "start": 2229, - "end": 2230, + "start": 2479, + "end": 2480, "loc": { "start": { - "line": 94, + "line": 99, "column": 27 }, "end": { - "line": 94, + "line": 99, "column": 28 } } @@ -13509,15 +13989,15 @@ "binop": null }, "value": "node", - "start": 2230, - "end": 2234, + "start": 2480, + "end": 2484, "loc": { "start": { - "line": 94, + "line": 99, "column": 28 }, "end": { - "line": 94, + "line": 99, "column": 32 } } @@ -13534,15 +14014,15 @@ "postfix": false, "binop": null }, - "start": 2234, - "end": 2235, + "start": 2484, + "end": 2485, "loc": { "start": { - "line": 94, + "line": 99, "column": 32 }, "end": { - "line": 94, + "line": 99, "column": 33 } } @@ -13560,15 +14040,15 @@ "binop": null, "updateContext": null }, - "start": 2235, - "end": 2236, + "start": 2485, + "end": 2486, "loc": { "start": { - "line": 94, + "line": 99, "column": 33 }, "end": { - "line": 94, + "line": 99, "column": 34 } } @@ -13586,15 +14066,15 @@ "binop": null }, "value": "node", - "start": 2240, - "end": 2244, + "start": 2490, + "end": 2494, "loc": { "start": { - "line": 95, + "line": 100, "column": 3 }, "end": { - "line": 95, + "line": 100, "column": 7 } } @@ -13612,15 +14092,15 @@ "binop": null, "updateContext": null }, - "start": 2244, - "end": 2245, + "start": 2494, + "end": 2495, "loc": { "start": { - "line": 95, + "line": 100, "column": 7 }, "end": { - "line": 95, + "line": 100, "column": 8 } } @@ -13638,15 +14118,15 @@ "binop": null }, "value": "key", - "start": 2245, - "end": 2248, + "start": 2495, + "end": 2498, "loc": { "start": { - "line": 95, + "line": 100, "column": 8 }, "end": { - "line": 95, + "line": 100, "column": 11 } } @@ -13665,15 +14145,15 @@ "updateContext": null }, "value": "=", - "start": 2249, - "end": 2250, + "start": 2499, + "end": 2500, "loc": { "start": { - "line": 95, + "line": 100, "column": 12 }, "end": { - "line": 95, + "line": 100, "column": 13 } } @@ -13691,15 +14171,15 @@ "binop": null }, "value": "pred", - "start": 2251, - "end": 2255, + "start": 2501, + "end": 2505, "loc": { "start": { - "line": 95, + "line": 100, "column": 14 }, "end": { - "line": 95, + "line": 100, "column": 18 } } @@ -13717,15 +14197,15 @@ "binop": null, "updateContext": null }, - "start": 2255, - "end": 2256, + "start": 2505, + "end": 2506, "loc": { "start": { - "line": 95, + "line": 100, "column": 18 }, "end": { - "line": 95, + "line": 100, "column": 19 } } @@ -13743,15 +14223,15 @@ "binop": null }, "value": "key", - "start": 2256, - "end": 2259, + "start": 2506, + "end": 2509, "loc": { "start": { - "line": 95, + "line": 100, "column": 19 }, "end": { - "line": 95, + "line": 100, "column": 22 } } @@ -13769,15 +14249,15 @@ "binop": null, "updateContext": null }, - "start": 2259, - "end": 2260, + "start": 2509, + "end": 2510, "loc": { "start": { - "line": 95, + "line": 100, "column": 22 }, "end": { - "line": 95, + "line": 100, "column": 23 } } @@ -13785,15 +14265,15 @@ { "type": "CommentLine", "value": " Delete predecessor node", - "start": 2264, - "end": 2290, + "start": 2514, + "end": 2540, "loc": { "start": { - "line": 96, + "line": 101, "column": 3 }, "end": { - "line": 96, + "line": 101, "column": 29 } } @@ -13801,15 +14281,15 @@ { "type": "CommentLine", "value": " note: this node can only have one non-leaf child", - "start": 2294, - "end": 2345, + "start": 2544, + "end": 2595, "loc": { "start": { - "line": 97, + "line": 102, "column": 3 }, "end": { - "line": 97, + "line": 102, "column": 54 } } @@ -13817,15 +14297,15 @@ { "type": "CommentLine", "value": " because the tree is a red-black tree", - "start": 2349, - "end": 2394, + "start": 2599, + "end": 2644, "loc": { "start": { - "line": 98, + "line": 103, "column": 3 }, "end": { - "line": 98, + "line": 103, "column": 48 } } @@ -13843,15 +14323,15 @@ "binop": null }, "value": "delete_one_child", - "start": 2398, - "end": 2414, + "start": 2648, + "end": 2664, "loc": { "start": { - "line": 99, + "line": 104, "column": 3 }, "end": { - "line": 99, + "line": 104, "column": 19 } } @@ -13868,15 +14348,15 @@ "postfix": false, "binop": null }, - "start": 2414, - "end": 2415, + "start": 2664, + "end": 2665, "loc": { "start": { - "line": 99, + "line": 104, "column": 19 }, "end": { - "line": 99, + "line": 104, "column": 20 } } @@ -13894,15 +14374,15 @@ "binop": null }, "value": "pred", - "start": 2415, - "end": 2419, + "start": 2665, + "end": 2669, "loc": { "start": { - "line": 99, + "line": 104, "column": 20 }, "end": { - "line": 99, + "line": 104, "column": 24 } } @@ -13919,15 +14399,15 @@ "postfix": false, "binop": null }, - "start": 2419, - "end": 2420, + "start": 2669, + "end": 2670, "loc": { "start": { - "line": 99, + "line": 104, "column": 24 }, "end": { - "line": 99, + "line": 104, "column": 25 } } @@ -13945,15 +14425,15 @@ "binop": null, "updateContext": null }, - "start": 2420, - "end": 2421, + "start": 2670, + "end": 2671, "loc": { "start": { - "line": 99, + "line": 104, "column": 25 }, "end": { - "line": 99, + "line": 104, "column": 26 } } @@ -13970,15 +14450,15 @@ "postfix": false, "binop": null }, - "start": 2424, - "end": 2425, + "start": 2674, + "end": 2675, "loc": { "start": { - "line": 100, + "line": 105, "column": 2 }, "end": { - "line": 100, + "line": 105, "column": 3 } } @@ -13998,15 +14478,15 @@ "updateContext": null }, "value": "else", - "start": 2426, - "end": 2430, + "start": 2676, + "end": 2680, "loc": { "start": { - "line": 100, + "line": 105, "column": 4 }, "end": { - "line": 100, + "line": 105, "column": 8 } } @@ -14026,15 +14506,15 @@ "updateContext": null }, "value": "if", - "start": 2431, - "end": 2433, + "start": 2681, + "end": 2683, "loc": { "start": { - "line": 100, + "line": 105, "column": 9 }, "end": { - "line": 100, + "line": 105, "column": 11 } } @@ -14051,15 +14531,15 @@ "postfix": false, "binop": null }, - "start": 2434, - "end": 2435, + "start": 2684, + "end": 2685, "loc": { "start": { - "line": 100, + "line": 105, "column": 12 }, "end": { - "line": 100, + "line": 105, "column": 13 } } @@ -14078,15 +14558,15 @@ "updateContext": null }, "value": "!", - "start": 2435, - "end": 2436, + "start": 2685, + "end": 2686, "loc": { "start": { - "line": 100, + "line": 105, "column": 13 }, "end": { - "line": 100, + "line": 105, "column": 14 } } @@ -14104,15 +14584,15 @@ "binop": null }, "value": "node", - "start": 2436, - "end": 2440, + "start": 2686, + "end": 2690, "loc": { "start": { - "line": 100, + "line": 105, "column": 14 }, "end": { - "line": 100, + "line": 105, "column": 18 } } @@ -14130,15 +14610,15 @@ "binop": null, "updateContext": null }, - "start": 2440, - "end": 2441, + "start": 2690, + "end": 2691, "loc": { "start": { - "line": 100, + "line": 105, "column": 18 }, "end": { - "line": 100, + "line": 105, "column": 19 } } @@ -14156,15 +14636,15 @@ "binop": null }, "value": "right", - "start": 2441, - "end": 2446, + "start": 2691, + "end": 2696, "loc": { "start": { - "line": 100, + "line": 105, "column": 19 }, "end": { - "line": 100, + "line": 105, "column": 24 } } @@ -14182,15 +14662,15 @@ "binop": null, "updateContext": null }, - "start": 2446, - "end": 2447, + "start": 2696, + "end": 2697, "loc": { "start": { - "line": 100, + "line": 105, "column": 24 }, "end": { - "line": 100, + "line": 105, "column": 25 } } @@ -14208,15 +14688,15 @@ "binop": null }, "value": "isLeaf", - "start": 2447, - "end": 2453, + "start": 2697, + "end": 2703, "loc": { "start": { - "line": 100, + "line": 105, "column": 25 }, "end": { - "line": 100, + "line": 105, "column": 31 } } @@ -14233,15 +14713,15 @@ "postfix": false, "binop": null }, - "start": 2453, - "end": 2454, + "start": 2703, + "end": 2704, "loc": { "start": { - "line": 100, + "line": 105, "column": 31 }, "end": { - "line": 100, + "line": 105, "column": 32 } } @@ -14258,15 +14738,15 @@ "postfix": false, "binop": null }, - "start": 2454, - "end": 2455, + "start": 2704, + "end": 2705, "loc": { "start": { - "line": 100, + "line": 105, "column": 32 }, "end": { - "line": 100, + "line": 105, "column": 33 } } @@ -14283,15 +14763,15 @@ "postfix": false, "binop": null }, - "start": 2455, - "end": 2456, + "start": 2705, + "end": 2706, "loc": { "start": { - "line": 100, + "line": 105, "column": 33 }, "end": { - "line": 100, + "line": 105, "column": 34 } } @@ -14308,15 +14788,15 @@ "postfix": false, "binop": null }, - "start": 2457, - "end": 2458, + "start": 2707, + "end": 2708, "loc": { "start": { - "line": 100, + "line": 105, "column": 35 }, "end": { - "line": 100, + "line": 105, "column": 36 } } @@ -14324,15 +14804,15 @@ { "type": "CommentLine", "value": " Replace node's key with successor's key", - "start": 2462, - "end": 2504, + "start": 2712, + "end": 2754, "loc": { "start": { - "line": 101, + "line": 106, "column": 3 }, "end": { - "line": 101, + "line": 106, "column": 45 } } @@ -14340,15 +14820,15 @@ { "type": "CommentLine", "value": " If there is no left child, then there can only be one right", - "start": 2508, - "end": 2570, + "start": 2758, + "end": 2820, "loc": { "start": { - "line": 102, + "line": 107, "column": 3 }, "end": { - "line": 102, + "line": 107, "column": 65 } } @@ -14356,15 +14836,15 @@ { "type": "CommentLine", "value": " child.", - "start": 2574, - "end": 2583, + "start": 2824, + "end": 2833, "loc": { "start": { - "line": 103, + "line": 108, "column": 3 }, "end": { - "line": 103, + "line": 108, "column": 12 } } @@ -14384,15 +14864,15 @@ "updateContext": null }, "value": "const", - "start": 2587, - "end": 2592, + "start": 2837, + "end": 2842, "loc": { "start": { - "line": 104, + "line": 109, "column": 3 }, "end": { - "line": 104, + "line": 109, "column": 8 } } @@ -14410,15 +14890,15 @@ "binop": null }, "value": "succ", - "start": 2593, - "end": 2597, + "start": 2843, + "end": 2847, "loc": { "start": { - "line": 104, + "line": 109, "column": 9 }, "end": { - "line": 104, + "line": 109, "column": 13 } } @@ -14437,15 +14917,15 @@ "updateContext": null }, "value": "=", - "start": 2598, - "end": 2599, + "start": 2848, + "end": 2849, "loc": { "start": { - "line": 104, + "line": 109, "column": 14 }, "end": { - "line": 104, + "line": 109, "column": 15 } } @@ -14463,15 +14943,15 @@ "binop": null }, "value": "node", - "start": 2600, - "end": 2604, + "start": 2850, + "end": 2854, "loc": { "start": { - "line": 104, + "line": 109, "column": 16 }, "end": { - "line": 104, + "line": 109, "column": 20 } } @@ -14489,15 +14969,15 @@ "binop": null, "updateContext": null }, - "start": 2604, - "end": 2605, + "start": 2854, + "end": 2855, "loc": { "start": { - "line": 104, + "line": 109, "column": 20 }, "end": { - "line": 104, + "line": 109, "column": 21 } } @@ -14515,15 +14995,15 @@ "binop": null }, "value": "right", - "start": 2605, - "end": 2610, + "start": 2855, + "end": 2860, "loc": { "start": { - "line": 104, + "line": 109, "column": 21 }, "end": { - "line": 104, + "line": 109, "column": 26 } } @@ -14541,19 +15021,201 @@ "binop": null, "updateContext": null }, - "start": 2610, - "end": 2611, + "start": 2860, + "end": 2861, "loc": { "start": { - "line": 104, + "line": 109, "column": 26 }, "end": { - "line": 104, + "line": 109, "column": 27 } } }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 2865, + "end": 2871, + "loc": { + "start": { + "line": 110, + "column": 3 + }, + "end": { + "line": 110, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2871, + "end": 2872, + "loc": { + "start": { + "line": 110, + "column": 9 + }, + "end": { + "line": 110, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "succ", + "start": 2872, + "end": 2876, + "loc": { + "start": { + "line": 110, + "column": 10 + }, + "end": { + "line": 110, + "column": 14 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 2877, + "end": 2887, + "loc": { + "start": { + "line": 110, + "column": 15 + }, + "end": { + "line": 110, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 2888, + "end": 2892, + "loc": { + "start": { + "line": 110, + "column": 26 + }, + "end": { + "line": 110, + "column": 30 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2892, + "end": 2893, + "loc": { + "start": { + "line": 110, + "column": 30 + }, + "end": { + "line": 110, + "column": 31 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2893, + "end": 2894, + "loc": { + "start": { + "line": 110, + "column": 31 + }, + "end": { + "line": 110, + "column": 32 + } + } + }, { "type": { "label": "name", @@ -14567,15 +15229,15 @@ "binop": null }, "value": "node", - "start": 2615, - "end": 2619, + "start": 2898, + "end": 2902, "loc": { "start": { - "line": 105, + "line": 111, "column": 3 }, "end": { - "line": 105, + "line": 111, "column": 7 } } @@ -14593,15 +15255,15 @@ "binop": null, "updateContext": null }, - "start": 2619, - "end": 2620, + "start": 2902, + "end": 2903, "loc": { "start": { - "line": 105, + "line": 111, "column": 7 }, "end": { - "line": 105, + "line": 111, "column": 8 } } @@ -14619,15 +15281,15 @@ "binop": null }, "value": "key", - "start": 2620, - "end": 2623, + "start": 2903, + "end": 2906, "loc": { "start": { - "line": 105, + "line": 111, "column": 8 }, "end": { - "line": 105, + "line": 111, "column": 11 } } @@ -14646,15 +15308,15 @@ "updateContext": null }, "value": "=", - "start": 2624, - "end": 2625, + "start": 2907, + "end": 2908, "loc": { "start": { - "line": 105, + "line": 111, "column": 12 }, "end": { - "line": 105, + "line": 111, "column": 13 } } @@ -14672,15 +15334,15 @@ "binop": null }, "value": "succ", - "start": 2626, - "end": 2630, + "start": 2909, + "end": 2913, "loc": { "start": { - "line": 105, + "line": 111, "column": 14 }, "end": { - "line": 105, + "line": 111, "column": 18 } } @@ -14698,15 +15360,15 @@ "binop": null, "updateContext": null }, - "start": 2630, - "end": 2631, + "start": 2913, + "end": 2914, "loc": { "start": { - "line": 105, + "line": 111, "column": 18 }, "end": { - "line": 105, + "line": 111, "column": 19 } } @@ -14724,15 +15386,15 @@ "binop": null }, "value": "key", - "start": 2631, - "end": 2634, + "start": 2914, + "end": 2917, "loc": { "start": { - "line": 105, + "line": 111, "column": 19 }, "end": { - "line": 105, + "line": 111, "column": 22 } } @@ -14750,15 +15412,15 @@ "binop": null, "updateContext": null }, - "start": 2634, - "end": 2635, + "start": 2917, + "end": 2918, "loc": { "start": { - "line": 105, + "line": 111, "column": 22 }, "end": { - "line": 105, + "line": 111, "column": 23 } } @@ -14766,15 +15428,15 @@ { "type": "CommentLine", "value": " Delete successor node", - "start": 2639, - "end": 2663, + "start": 2922, + "end": 2946, "loc": { "start": { - "line": 106, + "line": 112, "column": 3 }, "end": { - "line": 106, + "line": 112, "column": 27 } } @@ -14782,15 +15444,15 @@ { "type": "CommentLine", "value": " note: this node can only have one non-leaf child", - "start": 2667, - "end": 2718, + "start": 2950, + "end": 3001, "loc": { "start": { - "line": 107, + "line": 113, "column": 3 }, "end": { - "line": 107, + "line": 113, "column": 54 } } @@ -14798,15 +15460,15 @@ { "type": "CommentLine", "value": " because the tree is a red-black tree", - "start": 2722, - "end": 2767, + "start": 3005, + "end": 3050, "loc": { "start": { - "line": 108, + "line": 114, "column": 3 }, "end": { - "line": 108, + "line": 114, "column": 48 } } @@ -14824,15 +15486,15 @@ "binop": null }, "value": "delete_one_child", - "start": 2771, - "end": 2787, + "start": 3054, + "end": 3070, "loc": { "start": { - "line": 109, + "line": 115, "column": 3 }, "end": { - "line": 109, + "line": 115, "column": 19 } } @@ -14849,15 +15511,15 @@ "postfix": false, "binop": null }, - "start": 2787, - "end": 2788, + "start": 3070, + "end": 3071, "loc": { "start": { - "line": 109, + "line": 115, "column": 19 }, "end": { - "line": 109, + "line": 115, "column": 20 } } @@ -14875,15 +15537,15 @@ "binop": null }, "value": "succ", - "start": 2788, - "end": 2792, + "start": 3071, + "end": 3075, "loc": { "start": { - "line": 109, + "line": 115, "column": 20 }, "end": { - "line": 109, + "line": 115, "column": 24 } } @@ -14900,15 +15562,15 @@ "postfix": false, "binop": null }, - "start": 2792, - "end": 2793, + "start": 3075, + "end": 3076, "loc": { "start": { - "line": 109, + "line": 115, "column": 24 }, "end": { - "line": 109, + "line": 115, "column": 25 } } @@ -14926,15 +15588,15 @@ "binop": null, "updateContext": null }, - "start": 2793, - "end": 2794, + "start": 3076, + "end": 3077, "loc": { "start": { - "line": 109, + "line": 115, "column": 25 }, "end": { - "line": 109, + "line": 115, "column": 26 } } @@ -14951,15 +15613,15 @@ "postfix": false, "binop": null }, - "start": 2797, - "end": 2798, + "start": 3080, + "end": 3081, "loc": { "start": { - "line": 110, + "line": 116, "column": 2 }, "end": { - "line": 110, + "line": 116, "column": 3 } } @@ -14979,15 +15641,15 @@ "updateContext": null }, "value": "else", - "start": 2799, - "end": 2803, + "start": 3082, + "end": 3086, "loc": { "start": { - "line": 110, + "line": 116, "column": 4 }, "end": { - "line": 110, + "line": 116, "column": 8 } } @@ -15007,15 +15669,15 @@ "updateContext": null }, "value": "if", - "start": 2804, - "end": 2806, + "start": 3087, + "end": 3089, "loc": { "start": { - "line": 110, + "line": 116, "column": 9 }, "end": { - "line": 110, + "line": 116, "column": 11 } } @@ -15032,15 +15694,15 @@ "postfix": false, "binop": null }, - "start": 2807, - "end": 2808, + "start": 3090, + "end": 3091, "loc": { "start": { - "line": 110, + "line": 116, "column": 12 }, "end": { - "line": 110, + "line": 116, "column": 13 } } @@ -15058,15 +15720,15 @@ "binop": null }, "value": "node", - "start": 2808, - "end": 2812, + "start": 3091, + "end": 3095, "loc": { "start": { - "line": 110, + "line": 116, "column": 13 }, "end": { - "line": 110, + "line": 116, "column": 17 } } @@ -15085,15 +15747,15 @@ "updateContext": null }, "value": "===", - "start": 2813, - "end": 2816, + "start": 3096, + "end": 3099, "loc": { "start": { - "line": 110, + "line": 116, "column": 18 }, "end": { - "line": 110, + "line": 116, "column": 21 } } @@ -15113,15 +15775,15 @@ "updateContext": null }, "value": "this", - "start": 2817, - "end": 2821, + "start": 3100, + "end": 3104, "loc": { "start": { - "line": 110, + "line": 116, "column": 22 }, "end": { - "line": 110, + "line": 116, "column": 26 } } @@ -15139,15 +15801,15 @@ "binop": null, "updateContext": null }, - "start": 2821, - "end": 2822, + "start": 3104, + "end": 3105, "loc": { "start": { - "line": 110, + "line": 116, "column": 26 }, "end": { - "line": 110, + "line": 116, "column": 27 } } @@ -15165,15 +15827,15 @@ "binop": null }, "value": "root", - "start": 2822, - "end": 2826, + "start": 3105, + "end": 3109, "loc": { "start": { - "line": 110, + "line": 116, "column": 27 }, "end": { - "line": 110, + "line": 116, "column": 31 } } @@ -15190,15 +15852,15 @@ "postfix": false, "binop": null }, - "start": 2826, - "end": 2827, + "start": 3109, + "end": 3110, "loc": { "start": { - "line": 110, + "line": 116, "column": 31 }, "end": { - "line": 110, + "line": 116, "column": 32 } } @@ -15215,15 +15877,15 @@ "postfix": false, "binop": null }, - "start": 2828, - "end": 2829, + "start": 3111, + "end": 3112, "loc": { "start": { - "line": 110, + "line": 116, "column": 33 }, "end": { - "line": 110, + "line": 116, "column": 34 } } @@ -15243,15 +15905,15 @@ "updateContext": null }, "value": "this", - "start": 2833, - "end": 2837, + "start": 3116, + "end": 3120, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 7 } } @@ -15269,15 +15931,15 @@ "binop": null, "updateContext": null }, - "start": 2837, - "end": 2838, + "start": 3120, + "end": 3121, "loc": { "start": { - "line": 111, + "line": 117, "column": 7 }, "end": { - "line": 111, + "line": 117, "column": 8 } } @@ -15295,15 +15957,15 @@ "binop": null }, "value": "root", - "start": 2838, - "end": 2842, + "start": 3121, + "end": 3125, "loc": { "start": { - "line": 111, + "line": 117, "column": 8 }, "end": { - "line": 111, + "line": 117, "column": 12 } } @@ -15322,15 +15984,15 @@ "updateContext": null }, "value": "=", - "start": 2843, - "end": 2844, + "start": 3126, + "end": 3127, "loc": { "start": { - "line": 111, + "line": 117, "column": 13 }, "end": { - "line": 111, + "line": 117, "column": 14 } } @@ -15350,15 +16012,15 @@ "updateContext": null }, "value": "null", - "start": 2845, - "end": 2849, + "start": 3128, + "end": 3132, "loc": { "start": { - "line": 111, + "line": 117, "column": 15 }, "end": { - "line": 111, + "line": 117, "column": 19 } } @@ -15376,15 +16038,15 @@ "binop": null, "updateContext": null }, - "start": 2849, - "end": 2850, + "start": 3132, + "end": 3133, "loc": { "start": { - "line": 111, + "line": 117, "column": 19 }, "end": { - "line": 111, + "line": 117, "column": 20 } } @@ -15401,15 +16063,15 @@ "postfix": false, "binop": null }, - "start": 2853, - "end": 2854, + "start": 3136, + "end": 3137, "loc": { "start": { - "line": 112, + "line": 118, "column": 2 }, "end": { - "line": 112, + "line": 118, "column": 3 } } @@ -15429,15 +16091,15 @@ "updateContext": null }, "value": "else", - "start": 2855, - "end": 2859, + "start": 3138, + "end": 3142, "loc": { "start": { - "line": 112, + "line": 118, "column": 4 }, "end": { - "line": 112, + "line": 118, "column": 8 } } @@ -15454,15 +16116,15 @@ "postfix": false, "binop": null }, - "start": 2860, - "end": 2861, + "start": 3143, + "end": 3144, "loc": { "start": { - "line": 112, + "line": 118, "column": 9 }, "end": { - "line": 112, + "line": 118, "column": 10 } } @@ -15480,15 +16142,15 @@ "binop": null }, "value": "delete_one_child", - "start": 2865, - "end": 2881, + "start": 3148, + "end": 3164, "loc": { "start": { - "line": 113, + "line": 119, "column": 3 }, "end": { - "line": 113, + "line": 119, "column": 19 } } @@ -15505,15 +16167,15 @@ "postfix": false, "binop": null }, - "start": 2881, - "end": 2882, + "start": 3164, + "end": 3165, "loc": { "start": { - "line": 113, + "line": 119, "column": 19 }, "end": { - "line": 113, + "line": 119, "column": 20 } } @@ -15531,15 +16193,15 @@ "binop": null }, "value": "node", - "start": 2882, - "end": 2886, + "start": 3165, + "end": 3169, "loc": { "start": { - "line": 113, + "line": 119, "column": 20 }, "end": { - "line": 113, + "line": 119, "column": 24 } } @@ -15556,15 +16218,15 @@ "postfix": false, "binop": null }, - "start": 2886, - "end": 2887, + "start": 3169, + "end": 3170, "loc": { "start": { - "line": 113, + "line": 119, "column": 24 }, "end": { - "line": 113, + "line": 119, "column": 25 } } @@ -15582,15 +16244,15 @@ "binop": null, "updateContext": null }, - "start": 2887, - "end": 2888, + "start": 3170, + "end": 3171, "loc": { "start": { - "line": 113, + "line": 119, "column": 25 }, "end": { - "line": 113, + "line": 119, "column": 26 } } @@ -15607,15 +16269,15 @@ "postfix": false, "binop": null }, - "start": 2891, - "end": 2892, + "start": 3174, + "end": 3175, "loc": { "start": { - "line": 114, + "line": 120, "column": 2 }, "end": { - "line": 114, + "line": 120, "column": 3 } } @@ -15632,31 +16294,31 @@ "postfix": false, "binop": null }, - "start": 2894, - "end": 2895, + "start": 3177, + "end": 3178, "loc": { "start": { - "line": 115, + "line": 121, "column": 1 }, "end": { - "line": 115, + "line": 121, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 2898, - "end": 3310, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 3181, + "end": 3593, "loc": { "start": { - "line": 117, + "line": 123, "column": 1 }, "end": { - "line": 125, + "line": 131, "column": 4 } } @@ -15674,15 +16336,15 @@ "binop": null }, "value": "remove", - "start": 3312, - "end": 3318, + "start": 3595, + "end": 3601, "loc": { "start": { - "line": 126, + "line": 132, "column": 1 }, "end": { - "line": 126, + "line": 132, "column": 7 } } @@ -15699,15 +16361,15 @@ "postfix": false, "binop": null }, - "start": 3318, - "end": 3319, + "start": 3601, + "end": 3602, "loc": { "start": { - "line": 126, + "line": 132, "column": 7 }, "end": { - "line": 126, + "line": 132, "column": 8 } } @@ -15725,15 +16387,15 @@ "binop": null }, "value": "key", - "start": 3319, - "end": 3322, + "start": 3602, + "end": 3605, "loc": { "start": { - "line": 126, + "line": 132, "column": 8 }, "end": { - "line": 126, + "line": 132, "column": 11 } } @@ -15750,15 +16412,15 @@ "postfix": false, "binop": null }, - "start": 3322, - "end": 3323, + "start": 3605, + "end": 3606, "loc": { "start": { - "line": 126, + "line": 132, "column": 11 }, "end": { - "line": 126, + "line": 132, "column": 12 } } @@ -15775,15 +16437,15 @@ "postfix": false, "binop": null }, - "start": 3324, - "end": 3325, + "start": 3607, + "end": 3608, "loc": { "start": { - "line": 126, + "line": 132, "column": 13 }, "end": { - "line": 126, + "line": 132, "column": 14 } } @@ -15803,15 +16465,15 @@ "updateContext": null }, "value": "const", - "start": 3328, - "end": 3333, + "start": 3611, + "end": 3616, "loc": { "start": { - "line": 127, + "line": 133, "column": 2 }, "end": { - "line": 127, + "line": 133, "column": 7 } } @@ -15829,15 +16491,15 @@ "binop": null }, "value": "node", - "start": 3334, - "end": 3338, + "start": 3617, + "end": 3621, "loc": { "start": { - "line": 127, + "line": 133, "column": 8 }, "end": { - "line": 127, + "line": 133, "column": 12 } } @@ -15856,15 +16518,15 @@ "updateContext": null }, "value": "=", - "start": 3339, - "end": 3340, + "start": 3622, + "end": 3623, "loc": { "start": { - "line": 127, + "line": 133, "column": 13 }, "end": { - "line": 127, + "line": 133, "column": 14 } } @@ -15884,15 +16546,15 @@ "updateContext": null }, "value": "this", - "start": 3341, - "end": 3345, + "start": 3624, + "end": 3628, "loc": { "start": { - "line": 127, + "line": 133, "column": 15 }, "end": { - "line": 127, + "line": 133, "column": 19 } } @@ -15910,15 +16572,15 @@ "binop": null, "updateContext": null }, - "start": 3345, - "end": 3346, + "start": 3628, + "end": 3629, "loc": { "start": { - "line": 127, + "line": 133, "column": 19 }, "end": { - "line": 127, + "line": 133, "column": 20 } } @@ -15936,15 +16598,15 @@ "binop": null }, "value": "_search", - "start": 3346, - "end": 3353, + "start": 3629, + "end": 3636, "loc": { "start": { - "line": 127, + "line": 133, "column": 20 }, "end": { - "line": 127, + "line": 133, "column": 27 } } @@ -15961,15 +16623,15 @@ "postfix": false, "binop": null }, - "start": 3353, - "end": 3354, + "start": 3636, + "end": 3637, "loc": { "start": { - "line": 127, + "line": 133, "column": 27 }, "end": { - "line": 127, + "line": 133, "column": 28 } } @@ -15987,15 +16649,15 @@ "binop": null }, "value": "key", - "start": 3354, - "end": 3357, + "start": 3637, + "end": 3640, "loc": { "start": { - "line": 127, + "line": 133, "column": 28 }, "end": { - "line": 127, + "line": 133, "column": 31 } } @@ -16012,15 +16674,15 @@ "postfix": false, "binop": null }, - "start": 3357, - "end": 3358, + "start": 3640, + "end": 3641, "loc": { "start": { - "line": 127, + "line": 133, "column": 31 }, "end": { - "line": 127, + "line": 133, "column": 32 } } @@ -16038,15 +16700,15 @@ "binop": null, "updateContext": null }, - "start": 3358, - "end": 3359, + "start": 3641, + "end": 3642, "loc": { "start": { - "line": 127, + "line": 133, "column": 32 }, "end": { - "line": 127, + "line": 133, "column": 33 } } @@ -16066,15 +16728,15 @@ "updateContext": null }, "value": "if", - "start": 3362, - "end": 3364, + "start": 3645, + "end": 3647, "loc": { "start": { - "line": 128, + "line": 134, "column": 2 }, "end": { - "line": 128, + "line": 134, "column": 4 } } @@ -16091,15 +16753,15 @@ "postfix": false, "binop": null }, - "start": 3365, - "end": 3366, + "start": 3648, + "end": 3649, "loc": { "start": { - "line": 128, + "line": 134, "column": 5 }, "end": { - "line": 128, + "line": 134, "column": 6 } } @@ -16117,15 +16779,15 @@ "binop": null }, "value": "node", - "start": 3366, - "end": 3370, + "start": 3649, + "end": 3653, "loc": { "start": { - "line": 128, + "line": 134, "column": 6 }, "end": { - "line": 128, + "line": 134, "column": 10 } } @@ -16144,15 +16806,15 @@ "updateContext": null }, "value": "===", - "start": 3371, - "end": 3374, + "start": 3654, + "end": 3657, "loc": { "start": { - "line": 128, + "line": 134, "column": 11 }, "end": { - "line": 128, + "line": 134, "column": 14 } } @@ -16172,15 +16834,15 @@ "updateContext": null }, "value": "null", - "start": 3375, - "end": 3379, + "start": 3658, + "end": 3662, "loc": { "start": { - "line": 128, + "line": 134, "column": 15 }, "end": { - "line": 128, + "line": 134, "column": 19 } } @@ -16197,15 +16859,15 @@ "postfix": false, "binop": null }, - "start": 3379, - "end": 3380, + "start": 3662, + "end": 3663, "loc": { "start": { - "line": 128, + "line": 134, "column": 19 }, "end": { - "line": 128, + "line": 134, "column": 20 } } @@ -16225,15 +16887,15 @@ "updateContext": null }, "value": "return", - "start": 3381, - "end": 3387, + "start": 3664, + "end": 3670, "loc": { "start": { - "line": 128, + "line": 134, "column": 21 }, "end": { - "line": 128, + "line": 134, "column": 27 } } @@ -16253,15 +16915,15 @@ "updateContext": null }, "value": "false", - "start": 3388, - "end": 3393, + "start": 3671, + "end": 3676, "loc": { "start": { - "line": 128, + "line": 134, "column": 28 }, "end": { - "line": 128, + "line": 134, "column": 33 } } @@ -16279,15 +16941,15 @@ "binop": null, "updateContext": null }, - "start": 3393, - "end": 3394, + "start": 3676, + "end": 3677, "loc": { "start": { - "line": 128, + "line": 134, "column": 33 }, "end": { - "line": 128, + "line": 134, "column": 34 } } @@ -16307,15 +16969,15 @@ "updateContext": null }, "value": "this", - "start": 3398, - "end": 3402, + "start": 3681, + "end": 3685, "loc": { "start": { - "line": 130, + "line": 136, "column": 2 }, "end": { - "line": 130, + "line": 136, "column": 6 } } @@ -16333,15 +16995,15 @@ "binop": null, "updateContext": null }, - "start": 3402, - "end": 3403, + "start": 3685, + "end": 3686, "loc": { "start": { - "line": 130, + "line": 136, "column": 6 }, "end": { - "line": 130, + "line": 136, "column": 7 } } @@ -16359,15 +17021,15 @@ "binop": null }, "value": "_delete", - "start": 3403, - "end": 3410, + "start": 3686, + "end": 3693, "loc": { "start": { - "line": 130, + "line": 136, "column": 7 }, "end": { - "line": 130, + "line": 136, "column": 14 } } @@ -16384,15 +17046,15 @@ "postfix": false, "binop": null }, - "start": 3410, - "end": 3411, + "start": 3693, + "end": 3694, "loc": { "start": { - "line": 130, + "line": 136, "column": 14 }, "end": { - "line": 130, + "line": 136, "column": 15 } } @@ -16410,15 +17072,15 @@ "binop": null }, "value": "node", - "start": 3411, - "end": 3415, + "start": 3694, + "end": 3698, "loc": { "start": { - "line": 130, + "line": 136, "column": 15 }, "end": { - "line": 130, + "line": 136, "column": 19 } } @@ -16435,15 +17097,15 @@ "postfix": false, "binop": null }, - "start": 3415, - "end": 3416, + "start": 3698, + "end": 3699, "loc": { "start": { - "line": 130, + "line": 136, "column": 19 }, "end": { - "line": 130, + "line": 136, "column": 20 } } @@ -16461,15 +17123,15 @@ "binop": null, "updateContext": null }, - "start": 3416, - "end": 3417, + "start": 3699, + "end": 3700, "loc": { "start": { - "line": 130, + "line": 136, "column": 20 }, "end": { - "line": 130, + "line": 136, "column": 21 } } @@ -16489,15 +17151,15 @@ "updateContext": null }, "value": "return", - "start": 3420, - "end": 3426, + "start": 3703, + "end": 3709, "loc": { "start": { - "line": 131, + "line": 137, "column": 2 }, "end": { - "line": 131, + "line": 137, "column": 8 } } @@ -16517,15 +17179,15 @@ "updateContext": null }, "value": "true", - "start": 3427, - "end": 3431, + "start": 3710, + "end": 3714, "loc": { "start": { - "line": 131, + "line": 137, "column": 9 }, "end": { - "line": 131, + "line": 137, "column": 13 } } @@ -16543,15 +17205,15 @@ "binop": null, "updateContext": null }, - "start": 3431, - "end": 3432, + "start": 3714, + "end": 3715, "loc": { "start": { - "line": 131, + "line": 137, "column": 13 }, "end": { - "line": 131, + "line": 137, "column": 14 } } @@ -16568,31 +17230,31 @@ "postfix": false, "binop": null }, - "start": 3434, - "end": 3435, + "start": 3717, + "end": 3718, "loc": { "start": { - "line": 132, + "line": 138, "column": 1 }, "end": { - "line": 132, + "line": 138, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t ", - "start": 3438, - "end": 3687, + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", + "start": 3721, + "end": 3978, "loc": { "start": { - "line": 134, + "line": 140, "column": 1 }, "end": { - "line": 140, + "line": 146, "column": 4 } } @@ -16611,15 +17273,15 @@ "updateContext": null }, "value": "*", - "start": 3689, - "end": 3690, + "start": 3980, + "end": 3981, "loc": { "start": { - "line": 141, + "line": 147, "column": 1 }, "end": { - "line": 141, + "line": 147, "column": 2 } } @@ -16637,15 +17299,15 @@ "binop": null }, "value": "range", - "start": 3690, - "end": 3695, + "start": 3981, + "end": 3986, "loc": { "start": { - "line": 141, + "line": 147, "column": 2 }, "end": { - "line": 141, + "line": 147, "column": 7 } } @@ -16662,15 +17324,15 @@ "postfix": false, "binop": null }, - "start": 3695, - "end": 3696, + "start": 3986, + "end": 3987, "loc": { "start": { - "line": 141, + "line": 147, "column": 7 }, "end": { - "line": 141, + "line": 147, "column": 8 } } @@ -16688,15 +17350,15 @@ "binop": null }, "value": "left", - "start": 3696, - "end": 3700, + "start": 3987, + "end": 3991, "loc": { "start": { - "line": 141, + "line": 147, "column": 8 }, "end": { - "line": 141, + "line": 147, "column": 12 } } @@ -16714,15 +17376,15 @@ "binop": null, "updateContext": null }, - "start": 3700, - "end": 3701, + "start": 3991, + "end": 3992, "loc": { "start": { - "line": 141, + "line": 147, "column": 12 }, "end": { - "line": 141, + "line": 147, "column": 13 } } @@ -16740,15 +17402,15 @@ "binop": null }, "value": "right", - "start": 3702, - "end": 3707, + "start": 3993, + "end": 3998, "loc": { "start": { - "line": 141, + "line": 147, "column": 14 }, "end": { - "line": 141, + "line": 147, "column": 19 } } @@ -16765,15 +17427,15 @@ "postfix": false, "binop": null }, - "start": 3707, - "end": 3708, + "start": 3998, + "end": 3999, "loc": { "start": { - "line": 141, + "line": 147, "column": 19 }, "end": { - "line": 141, + "line": 147, "column": 20 } } @@ -16790,15 +17452,15 @@ "postfix": false, "binop": null }, - "start": 3709, - "end": 3710, + "start": 4000, + "end": 4001, "loc": { "start": { - "line": 141, + "line": 147, "column": 21 }, "end": { - "line": 141, + "line": 147, "column": 22 } } @@ -16818,15 +17480,15 @@ "updateContext": null }, "value": "if", - "start": 3713, - "end": 3715, + "start": 4004, + "end": 4006, "loc": { "start": { - "line": 142, + "line": 148, "column": 2 }, "end": { - "line": 142, + "line": 148, "column": 4 } } @@ -16843,15 +17505,15 @@ "postfix": false, "binop": null }, - "start": 3716, - "end": 3717, + "start": 4007, + "end": 4008, "loc": { "start": { - "line": 142, + "line": 148, "column": 5 }, "end": { - "line": 142, + "line": 148, "column": 6 } } @@ -16871,15 +17533,15 @@ "updateContext": null }, "value": "this", - "start": 3717, - "end": 3721, + "start": 4008, + "end": 4012, "loc": { "start": { - "line": 142, + "line": 148, "column": 6 }, "end": { - "line": 142, + "line": 148, "column": 10 } } @@ -16897,15 +17559,15 @@ "binop": null, "updateContext": null }, - "start": 3721, - "end": 3722, + "start": 4012, + "end": 4013, "loc": { "start": { - "line": 142, + "line": 148, "column": 10 }, "end": { - "line": 142, + "line": 148, "column": 11 } } @@ -16923,15 +17585,15 @@ "binop": null }, "value": "root", - "start": 3722, - "end": 3726, + "start": 4013, + "end": 4017, "loc": { "start": { - "line": 142, + "line": 148, "column": 11 }, "end": { - "line": 142, + "line": 148, "column": 15 } } @@ -16950,15 +17612,15 @@ "updateContext": null }, "value": "!==", - "start": 3727, - "end": 3730, + "start": 4018, + "end": 4021, "loc": { "start": { - "line": 142, + "line": 148, "column": 16 }, "end": { - "line": 142, + "line": 148, "column": 19 } } @@ -16978,15 +17640,15 @@ "updateContext": null }, "value": "null", - "start": 3731, - "end": 3735, + "start": 4022, + "end": 4026, "loc": { "start": { - "line": 142, + "line": 148, "column": 20 }, "end": { - "line": 142, + "line": 148, "column": 24 } } @@ -17003,15 +17665,15 @@ "postfix": false, "binop": null }, - "start": 3735, - "end": 3736, + "start": 4026, + "end": 4027, "loc": { "start": { - "line": 142, + "line": 148, "column": 24 }, "end": { - "line": 142, + "line": 148, "column": 25 } } @@ -17031,15 +17693,15 @@ "updateContext": null }, "value": "yield", - "start": 3740, - "end": 3745, + "start": 4031, + "end": 4036, "loc": { "start": { - "line": 143, + "line": 149, "column": 3 }, "end": { - "line": 143, + "line": 149, "column": 8 } } @@ -17058,15 +17720,15 @@ "updateContext": null }, "value": "*", - "start": 3745, - "end": 3746, + "start": 4036, + "end": 4037, "loc": { "start": { - "line": 143, + "line": 149, "column": 8 }, "end": { - "line": 143, + "line": 149, "column": 9 } } @@ -17084,15 +17746,15 @@ "binop": null }, "value": "rangetraversal", - "start": 3747, - "end": 3761, + "start": 4038, + "end": 4052, "loc": { "start": { - "line": 143, + "line": 149, "column": 10 }, "end": { - "line": 143, + "line": 149, "column": 24 } } @@ -17109,15 +17771,15 @@ "postfix": false, "binop": null }, - "start": 3761, - "end": 3762, + "start": 4052, + "end": 4053, "loc": { "start": { - "line": 143, + "line": 149, "column": 24 }, "end": { - "line": 143, + "line": 149, "column": 25 } } @@ -17137,15 +17799,15 @@ "updateContext": null }, "value": "this", - "start": 3762, - "end": 3766, + "start": 4053, + "end": 4057, "loc": { "start": { - "line": 143, + "line": 149, "column": 25 }, "end": { - "line": 143, + "line": 149, "column": 29 } } @@ -17163,15 +17825,15 @@ "binop": null, "updateContext": null }, - "start": 3766, - "end": 3767, + "start": 4057, + "end": 4058, "loc": { "start": { - "line": 143, + "line": 149, "column": 29 }, "end": { - "line": 143, + "line": 149, "column": 30 } } @@ -17189,15 +17851,15 @@ "binop": null }, "value": "compare", - "start": 3767, - "end": 3774, + "start": 4058, + "end": 4065, "loc": { "start": { - "line": 143, + "line": 149, "column": 30 }, "end": { - "line": 143, + "line": 149, "column": 37 } } @@ -17215,15 +17877,15 @@ "binop": null, "updateContext": null }, - "start": 3774, - "end": 3775, + "start": 4065, + "end": 4066, "loc": { "start": { - "line": 143, + "line": 149, "column": 37 }, "end": { - "line": 143, + "line": 149, "column": 38 } } @@ -17243,15 +17905,15 @@ "updateContext": null }, "value": "this", - "start": 3776, - "end": 3780, + "start": 4067, + "end": 4071, "loc": { "start": { - "line": 143, + "line": 149, "column": 39 }, "end": { - "line": 143, + "line": 149, "column": 43 } } @@ -17269,15 +17931,15 @@ "binop": null, "updateContext": null }, - "start": 3780, - "end": 3781, + "start": 4071, + "end": 4072, "loc": { "start": { - "line": 143, + "line": 149, "column": 43 }, "end": { - "line": 143, + "line": 149, "column": 44 } } @@ -17295,15 +17957,15 @@ "binop": null }, "value": "root", - "start": 3781, - "end": 3785, + "start": 4072, + "end": 4076, "loc": { "start": { - "line": 143, + "line": 149, "column": 44 }, "end": { - "line": 143, + "line": 149, "column": 48 } } @@ -17321,15 +17983,15 @@ "binop": null, "updateContext": null }, - "start": 3785, - "end": 3786, + "start": 4076, + "end": 4077, "loc": { "start": { - "line": 143, + "line": 149, "column": 48 }, "end": { - "line": 143, + "line": 149, "column": 49 } } @@ -17347,15 +18009,15 @@ "binop": null }, "value": "left", - "start": 3787, - "end": 3791, + "start": 4078, + "end": 4082, "loc": { "start": { - "line": 143, + "line": 149, "column": 50 }, "end": { - "line": 143, + "line": 149, "column": 54 } } @@ -17373,15 +18035,15 @@ "binop": null, "updateContext": null }, - "start": 3791, - "end": 3792, + "start": 4082, + "end": 4083, "loc": { "start": { - "line": 143, + "line": 149, "column": 54 }, "end": { - "line": 143, + "line": 149, "column": 55 } } @@ -17399,15 +18061,15 @@ "binop": null }, "value": "right", - "start": 3793, - "end": 3798, + "start": 4084, + "end": 4089, "loc": { "start": { - "line": 143, + "line": 149, "column": 56 }, "end": { - "line": 143, + "line": 149, "column": 61 } } @@ -17424,15 +18086,15 @@ "postfix": false, "binop": null }, - "start": 3798, - "end": 3799, + "start": 4089, + "end": 4090, "loc": { "start": { - "line": 143, + "line": 149, "column": 61 }, "end": { - "line": 143, + "line": 149, "column": 62 } } @@ -17450,15 +18112,15 @@ "binop": null, "updateContext": null }, - "start": 3799, - "end": 3800, + "start": 4090, + "end": 4091, "loc": { "start": { - "line": 143, + "line": 149, "column": 62 }, "end": { - "line": 143, + "line": 149, "column": 63 } } @@ -17475,31 +18137,31 @@ "postfix": false, "binop": null }, - "start": 3802, - "end": 3803, + "start": 4093, + "end": 4094, "loc": { "start": { - "line": 144, + "line": 150, "column": 1 }, "end": { - "line": 144, + "line": 150, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t ", - "start": 3806, - "end": 3902, + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", + "start": 4097, + "end": 4201, "loc": { "start": { - "line": 146, + "line": 152, "column": 1 }, "end": { - "line": 150, + "line": 156, "column": 4 } } @@ -17518,15 +18180,15 @@ "updateContext": null }, "value": "*", - "start": 3904, - "end": 3905, + "start": 4203, + "end": 4204, "loc": { "start": { - "line": 151, + "line": 157, "column": 1 }, "end": { - "line": 151, + "line": 157, "column": 2 } } @@ -17544,15 +18206,15 @@ "binop": null }, "value": "items", - "start": 3905, - "end": 3910, + "start": 4204, + "end": 4209, "loc": { "start": { - "line": 151, + "line": 157, "column": 2 }, "end": { - "line": 151, + "line": 157, "column": 7 } } @@ -17569,15 +18231,15 @@ "postfix": false, "binop": null }, - "start": 3910, - "end": 3911, + "start": 4209, + "end": 4210, "loc": { "start": { - "line": 151, + "line": 157, "column": 7 }, "end": { - "line": 151, + "line": 157, "column": 8 } } @@ -17594,15 +18256,15 @@ "postfix": false, "binop": null }, - "start": 3911, - "end": 3912, + "start": 4210, + "end": 4211, "loc": { "start": { - "line": 151, + "line": 157, "column": 8 }, "end": { - "line": 151, + "line": 157, "column": 9 } } @@ -17619,15 +18281,15 @@ "postfix": false, "binop": null }, - "start": 3913, - "end": 3914, + "start": 4212, + "end": 4213, "loc": { "start": { - "line": 151, + "line": 157, "column": 10 }, "end": { - "line": 151, + "line": 157, "column": 11 } } @@ -17647,15 +18309,15 @@ "updateContext": null }, "value": "if", - "start": 3917, - "end": 3919, + "start": 4216, + "end": 4218, "loc": { "start": { - "line": 152, + "line": 158, "column": 2 }, "end": { - "line": 152, + "line": 158, "column": 4 } } @@ -17672,15 +18334,15 @@ "postfix": false, "binop": null }, - "start": 3920, - "end": 3921, + "start": 4219, + "end": 4220, "loc": { "start": { - "line": 152, + "line": 158, "column": 5 }, "end": { - "line": 152, + "line": 158, "column": 6 } } @@ -17700,15 +18362,15 @@ "updateContext": null }, "value": "this", - "start": 3921, - "end": 3925, + "start": 4220, + "end": 4224, "loc": { "start": { - "line": 152, + "line": 158, "column": 6 }, "end": { - "line": 152, + "line": 158, "column": 10 } } @@ -17726,15 +18388,15 @@ "binop": null, "updateContext": null }, - "start": 3925, - "end": 3926, + "start": 4224, + "end": 4225, "loc": { "start": { - "line": 152, + "line": 158, "column": 10 }, "end": { - "line": 152, + "line": 158, "column": 11 } } @@ -17752,15 +18414,15 @@ "binop": null }, "value": "root", - "start": 3926, - "end": 3930, + "start": 4225, + "end": 4229, "loc": { "start": { - "line": 152, + "line": 158, "column": 11 }, "end": { - "line": 152, + "line": 158, "column": 15 } } @@ -17779,15 +18441,15 @@ "updateContext": null }, "value": "!==", - "start": 3931, - "end": 3934, + "start": 4230, + "end": 4233, "loc": { "start": { - "line": 152, + "line": 158, "column": 16 }, "end": { - "line": 152, + "line": 158, "column": 19 } } @@ -17807,15 +18469,15 @@ "updateContext": null }, "value": "null", - "start": 3935, - "end": 3939, + "start": 4234, + "end": 4238, "loc": { "start": { - "line": 152, + "line": 158, "column": 20 }, "end": { - "line": 152, + "line": 158, "column": 24 } } @@ -17832,15 +18494,15 @@ "postfix": false, "binop": null }, - "start": 3939, - "end": 3940, + "start": 4238, + "end": 4239, "loc": { "start": { - "line": 152, + "line": 158, "column": 24 }, "end": { - "line": 152, + "line": 158, "column": 25 } } @@ -17860,15 +18522,15 @@ "updateContext": null }, "value": "yield", - "start": 3941, - "end": 3946, + "start": 4240, + "end": 4245, "loc": { "start": { - "line": 152, + "line": 158, "column": 26 }, "end": { - "line": 152, + "line": 158, "column": 31 } } @@ -17887,15 +18549,15 @@ "updateContext": null }, "value": "*", - "start": 3946, - "end": 3947, + "start": 4245, + "end": 4246, "loc": { "start": { - "line": 152, + "line": 158, "column": 31 }, "end": { - "line": 152, + "line": 158, "column": 32 } } @@ -17913,15 +18575,15 @@ "binop": null }, "value": "inordertraversal", - "start": 3948, - "end": 3964, + "start": 4247, + "end": 4263, "loc": { "start": { - "line": 152, + "line": 158, "column": 33 }, "end": { - "line": 152, + "line": 158, "column": 49 } } @@ -17938,15 +18600,15 @@ "postfix": false, "binop": null }, - "start": 3964, - "end": 3965, + "start": 4263, + "end": 4264, "loc": { "start": { - "line": 152, + "line": 158, "column": 49 }, "end": { - "line": 152, + "line": 158, "column": 50 } } @@ -17966,49 +18628,480 @@ "updateContext": null }, "value": "this", - "start": 3965, - "end": 3969, + "start": 4264, + "end": 4268, "loc": { "start": { - "line": 152, + "line": 158, "column": 50 }, "end": { - "line": 152, - "column": 54 + "line": 158, + "column": 54 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 4268, + "end": 4269, + "loc": { + "start": { + "line": 158, + "column": 54 + }, + "end": { + "line": 158, + "column": 55 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 4269, + "end": 4273, + "loc": { + "start": { + "line": 158, + "column": 55 + }, + "end": { + "line": 158, + "column": 59 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 4273, + "end": 4274, + "loc": { + "start": { + "line": 158, + "column": 59 + }, + "end": { + "line": 158, + "column": 60 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 4274, + "end": 4275, + "loc": { + "start": { + "line": 158, + "column": 60 + }, + "end": { + "line": 158, + "column": 61 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 4277, + "end": 4278, + "loc": { + "start": { + "line": 159, + "column": 1 + }, + "end": { + "line": 159, + "column": 2 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", + "start": 4281, + "end": 4329, + "loc": { + "start": { + "line": 161, + "column": 1 + }, + "end": { + "line": 163, + "column": 4 + } + } + }, + { + "type": { + "label": "[", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 4331, + "end": 4332, + "loc": { + "start": { + "line": 164, + "column": 1 + }, + "end": { + "line": 164, + "column": 2 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Symbol", + "start": 4332, + "end": 4338, + "loc": { + "start": { + "line": 164, + "column": 2 + }, + "end": { + "line": 164, + "column": 8 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 4338, + "end": 4339, + "loc": { + "start": { + "line": 164, + "column": 8 + }, + "end": { + "line": 164, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "iterator", + "start": 4339, + "end": 4347, + "loc": { + "start": { + "line": 164, + "column": 9 + }, + "end": { + "line": 164, + "column": 17 + } + } + }, + { + "type": { + "label": "]", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 4347, + "end": 4348, + "loc": { + "start": { + "line": 164, + "column": 17 + }, + "end": { + "line": 164, + "column": 18 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 4348, + "end": 4349, + "loc": { + "start": { + "line": 164, + "column": 18 + }, + "end": { + "line": 164, + "column": 19 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 4349, + "end": 4350, + "loc": { + "start": { + "line": 164, + "column": 19 + }, + "end": { + "line": 164, + "column": 20 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 4351, + "end": 4352, + "loc": { + "start": { + "line": 164, + "column": 21 + }, + "end": { + "line": 164, + "column": 22 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 4355, + "end": 4361, + "loc": { + "start": { + "line": 165, + "column": 2 + }, + "end": { + "line": 165, + "column": 8 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 4362, + "end": 4366, + "loc": { + "start": { + "line": 165, + "column": 9 + }, + "end": { + "line": 165, + "column": 13 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 4366, + "end": 4367, + "loc": { + "start": { + "line": 165, + "column": 13 + }, + "end": { + "line": 165, + "column": 14 } } }, { "type": { - "label": ".", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 3969, - "end": 3970, + "value": "items", + "start": 4367, + "end": 4372, "loc": { "start": { - "line": 152, - "column": 54 + "line": 165, + "column": 14 }, "end": { - "line": 152, - "column": 55 + "line": 165, + "column": 19 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -18017,17 +19110,16 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 3970, - "end": 3974, + "start": 4372, + "end": 4373, "loc": { "start": { - "line": 152, - "column": 55 + "line": 165, + "column": 19 }, "end": { - "line": 152, - "column": 59 + "line": 165, + "column": 20 } } }, @@ -18043,16 +19135,16 @@ "postfix": false, "binop": null }, - "start": 3974, - "end": 3975, + "start": 4373, + "end": 4374, "loc": { "start": { - "line": 152, - "column": 59 + "line": 165, + "column": 20 }, "end": { - "line": 152, - "column": 60 + "line": 165, + "column": 21 } } }, @@ -18069,16 +19161,16 @@ "binop": null, "updateContext": null }, - "start": 3975, - "end": 3976, + "start": 4374, + "end": 4375, "loc": { "start": { - "line": 152, - "column": 60 + "line": 165, + "column": 21 }, "end": { - "line": 152, - "column": 61 + "line": 165, + "column": 22 } } }, @@ -18094,58 +19186,58 @@ "postfix": false, "binop": null }, - "start": 3978, - "end": 3979, + "start": 4377, + "end": 4378, "loc": { "start": { - "line": 153, + "line": 166, "column": 1 }, "end": { - "line": 153, + "line": 166, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 3982, - "end": 4030, + "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", + "start": 4381, + "end": 4525, "loc": { "start": { - "line": 155, + "line": 168, "column": 1 }, "end": { - "line": 157, + "line": 173, "column": 4 } } }, { "type": { - "label": "[", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 4032, - "end": 4033, + "value": "static", + "start": 4527, + "end": 4533, "loc": { "start": { - "line": 158, + "line": 174, "column": 1 }, "end": { - "line": 158, - "column": 2 + "line": 174, + "column": 7 } } }, @@ -18161,50 +19253,24 @@ "postfix": false, "binop": null }, - "value": "Symbol", - "start": 4033, - "end": 4039, - "loc": { - "start": { - "line": 158, - "column": 2 - }, - "end": { - "line": 158, - "column": 8 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 4039, - "end": 4040, + "value": "empty", + "start": 4534, + "end": 4539, "loc": { "start": { - "line": 158, + "line": 174, "column": 8 }, "end": { - "line": 158, - "column": 9 + "line": 174, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -18213,50 +19279,23 @@ "postfix": false, "binop": null }, - "value": "iterator", - "start": 4040, - "end": 4048, + "start": 4539, + "end": 4540, "loc": { "start": { - "line": 158, - "column": 9 + "line": 174, + "column": 13 }, "end": { - "line": 158, - "column": 17 + "line": 174, + "column": 14 } } }, { "type": { - "label": "]", + "label": "name", "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 4048, - "end": 4049, - "loc": { - "start": { - "line": 158, - "column": 17 - }, - "end": { - "line": 158, - "column": 18 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -18265,16 +19304,17 @@ "postfix": false, "binop": null }, - "start": 4049, - "end": 4050, + "value": "compare", + "start": 4540, + "end": 4547, "loc": { "start": { - "line": 158, - "column": 18 + "line": 174, + "column": 14 }, "end": { - "line": 158, - "column": 19 + "line": 174, + "column": 21 } } }, @@ -18290,16 +19330,16 @@ "postfix": false, "binop": null }, - "start": 4050, - "end": 4051, + "start": 4547, + "end": 4548, "loc": { "start": { - "line": 158, - "column": 19 + "line": 174, + "column": 21 }, "end": { - "line": 158, - "column": 20 + "line": 174, + "column": 22 } } }, @@ -18315,16 +19355,16 @@ "postfix": false, "binop": null }, - "start": 4052, - "end": 4053, + "start": 4549, + "end": 4550, "loc": { "start": { - "line": 158, - "column": 21 + "line": 174, + "column": 23 }, "end": { - "line": 158, - "column": 22 + "line": 174, + "column": 24 } } }, @@ -18343,24 +19383,24 @@ "updateContext": null }, "value": "return", - "start": 4056, - "end": 4062, + "start": 4553, + "end": 4559, "loc": { "start": { - "line": 159, + "line": 175, "column": 2 }, "end": { - "line": 159, + "line": 175, "column": 8 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, + "label": "new", + "keyword": "new", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -18370,50 +19410,50 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 4063, - "end": 4067, + "value": "new", + "start": 4560, + "end": 4563, "loc": { "start": { - "line": 159, + "line": 175, "column": 9 }, "end": { - "line": 159, - "column": 13 + "line": 175, + "column": 12 } } }, { "type": { - "label": ".", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 4067, - "end": 4068, + "value": "RedBlackTree", + "start": 4564, + "end": 4576, "loc": { "start": { - "line": 159, + "line": 175, "column": 13 }, "end": { - "line": 159, - "column": 14 + "line": 175, + "column": 25 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -18422,24 +19462,23 @@ "postfix": false, "binop": null }, - "value": "items", - "start": 4068, - "end": 4073, + "start": 4576, + "end": 4577, "loc": { "start": { - "line": 159, - "column": 14 + "line": 175, + "column": 25 }, "end": { - "line": 159, - "column": 19 + "line": 175, + "column": 26 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -18448,16 +19487,17 @@ "postfix": false, "binop": null }, - "start": 4073, - "end": 4074, + "value": "compare", + "start": 4577, + "end": 4584, "loc": { "start": { - "line": 159, - "column": 19 + "line": 175, + "column": 26 }, "end": { - "line": 159, - "column": 20 + "line": 175, + "column": 33 } } }, @@ -18473,16 +19513,16 @@ "postfix": false, "binop": null }, - "start": 4074, - "end": 4075, + "start": 4584, + "end": 4585, "loc": { "start": { - "line": 159, - "column": 20 + "line": 175, + "column": 33 }, "end": { - "line": 159, - "column": 21 + "line": 175, + "column": 34 } } }, @@ -18499,16 +19539,16 @@ "binop": null, "updateContext": null }, - "start": 4075, - "end": 4076, + "start": 4585, + "end": 4586, "loc": { "start": { - "line": 159, - "column": 21 + "line": 175, + "column": 34 }, "end": { - "line": 159, - "column": 22 + "line": 175, + "column": 35 } } }, @@ -18524,31 +19564,31 @@ "postfix": false, "binop": null }, - "start": 4078, - "end": 4079, + "start": 4588, + "end": 4589, "loc": { "start": { - "line": 160, + "line": 176, "column": 1 }, "end": { - "line": 160, + "line": 176, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4082, - "end": 4295, + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "start": 4592, + "end": 4805, "loc": { "start": { - "line": 162, + "line": 178, "column": 1 }, "end": { - "line": 168, + "line": 184, "column": 4 } } @@ -18566,15 +19606,15 @@ "binop": null }, "value": "static", - "start": 4297, - "end": 4303, + "start": 4807, + "end": 4813, "loc": { "start": { - "line": 169, + "line": 185, "column": 1 }, "end": { - "line": 169, + "line": 185, "column": 7 } } @@ -18592,15 +19632,15 @@ "binop": null }, "value": "from", - "start": 4304, - "end": 4308, + "start": 4814, + "end": 4818, "loc": { "start": { - "line": 169, + "line": 185, "column": 8 }, "end": { - "line": 169, + "line": 185, "column": 12 } } @@ -18617,15 +19657,15 @@ "postfix": false, "binop": null }, - "start": 4308, - "end": 4309, + "start": 4818, + "end": 4819, "loc": { "start": { - "line": 169, + "line": 185, "column": 12 }, "end": { - "line": 169, + "line": 185, "column": 13 } } @@ -18643,15 +19683,15 @@ "binop": null }, "value": "compare", - "start": 4309, - "end": 4316, + "start": 4819, + "end": 4826, "loc": { "start": { - "line": 169, + "line": 185, "column": 13 }, "end": { - "line": 169, + "line": 185, "column": 20 } } @@ -18669,15 +19709,15 @@ "binop": null, "updateContext": null }, - "start": 4316, - "end": 4317, + "start": 4826, + "end": 4827, "loc": { "start": { - "line": 169, + "line": 185, "column": 20 }, "end": { - "line": 169, + "line": 185, "column": 21 } } @@ -18695,15 +19735,15 @@ "binop": null }, "value": "iterable", - "start": 4318, - "end": 4326, + "start": 4828, + "end": 4836, "loc": { "start": { - "line": 169, + "line": 185, "column": 22 }, "end": { - "line": 169, + "line": 185, "column": 30 } } @@ -18720,15 +19760,15 @@ "postfix": false, "binop": null }, - "start": 4326, - "end": 4327, + "start": 4836, + "end": 4837, "loc": { "start": { - "line": 169, + "line": 185, "column": 30 }, "end": { - "line": 169, + "line": 185, "column": 31 } } @@ -18745,15 +19785,15 @@ "postfix": false, "binop": null }, - "start": 4328, - "end": 4329, + "start": 4838, + "end": 4839, "loc": { "start": { - "line": 169, + "line": 185, "column": 32 }, "end": { - "line": 169, + "line": 185, "column": 33 } } @@ -18773,15 +19813,15 @@ "updateContext": null }, "value": "const", - "start": 4332, - "end": 4337, + "start": 4842, + "end": 4847, "loc": { "start": { - "line": 170, + "line": 186, "column": 2 }, "end": { - "line": 170, + "line": 186, "column": 7 } } @@ -18799,15 +19839,15 @@ "binop": null }, "value": "tree", - "start": 4338, - "end": 4342, + "start": 4848, + "end": 4852, "loc": { "start": { - "line": 170, + "line": 186, "column": 8 }, "end": { - "line": 170, + "line": 186, "column": 12 } } @@ -18826,15 +19866,15 @@ "updateContext": null }, "value": "=", - "start": 4343, - "end": 4344, + "start": 4853, + "end": 4854, "loc": { "start": { - "line": 170, + "line": 186, "column": 13 }, "end": { - "line": 170, + "line": 186, "column": 14 } } @@ -18854,15 +19894,15 @@ "updateContext": null }, "value": "new", - "start": 4345, - "end": 4348, + "start": 4855, + "end": 4858, "loc": { "start": { - "line": 170, + "line": 186, "column": 15 }, "end": { - "line": 170, + "line": 186, "column": 18 } } @@ -18880,15 +19920,15 @@ "binop": null }, "value": "RedBlackTree", - "start": 4349, - "end": 4361, + "start": 4859, + "end": 4871, "loc": { "start": { - "line": 170, + "line": 186, "column": 19 }, "end": { - "line": 170, + "line": 186, "column": 31 } } @@ -18905,15 +19945,15 @@ "postfix": false, "binop": null }, - "start": 4361, - "end": 4362, + "start": 4871, + "end": 4872, "loc": { "start": { - "line": 170, + "line": 186, "column": 31 }, "end": { - "line": 170, + "line": 186, "column": 32 } } @@ -18931,15 +19971,15 @@ "binop": null }, "value": "compare", - "start": 4362, - "end": 4369, + "start": 4872, + "end": 4879, "loc": { "start": { - "line": 170, + "line": 186, "column": 32 }, "end": { - "line": 170, + "line": 186, "column": 39 } } @@ -18956,15 +19996,15 @@ "postfix": false, "binop": null }, - "start": 4369, - "end": 4370, + "start": 4879, + "end": 4880, "loc": { "start": { - "line": 170, + "line": 186, "column": 39 }, "end": { - "line": 170, + "line": 186, "column": 40 } } @@ -18982,15 +20022,15 @@ "binop": null, "updateContext": null }, - "start": 4370, - "end": 4371, + "start": 4880, + "end": 4881, "loc": { "start": { - "line": 170, + "line": 186, "column": 40 }, "end": { - "line": 170, + "line": 186, "column": 41 } } @@ -19010,15 +20050,15 @@ "updateContext": null }, "value": "for", - "start": 4375, - "end": 4378, + "start": 4885, + "end": 4888, "loc": { "start": { - "line": 172, + "line": 188, "column": 2 }, "end": { - "line": 172, + "line": 188, "column": 5 } } @@ -19035,15 +20075,15 @@ "postfix": false, "binop": null }, - "start": 4379, - "end": 4380, + "start": 4889, + "end": 4890, "loc": { "start": { - "line": 172, + "line": 188, "column": 6 }, "end": { - "line": 172, + "line": 188, "column": 7 } } @@ -19063,15 +20103,15 @@ "updateContext": null }, "value": "const", - "start": 4380, - "end": 4385, + "start": 4890, + "end": 4895, "loc": { "start": { - "line": 172, + "line": 188, "column": 7 }, "end": { - "line": 172, + "line": 188, "column": 12 } } @@ -19089,15 +20129,15 @@ "binop": null }, "value": "element", - "start": 4386, - "end": 4393, + "start": 4896, + "end": 4903, "loc": { "start": { - "line": 172, + "line": 188, "column": 13 }, "end": { - "line": 172, + "line": 188, "column": 20 } } @@ -19115,15 +20155,15 @@ "binop": null }, "value": "of", - "start": 4394, - "end": 4396, + "start": 4904, + "end": 4906, "loc": { "start": { - "line": 172, + "line": 188, "column": 21 }, "end": { - "line": 172, + "line": 188, "column": 23 } } @@ -19141,15 +20181,15 @@ "binop": null }, "value": "iterable", - "start": 4397, - "end": 4405, + "start": 4907, + "end": 4915, "loc": { "start": { - "line": 172, + "line": 188, "column": 24 }, "end": { - "line": 172, + "line": 188, "column": 32 } } @@ -19166,15 +20206,15 @@ "postfix": false, "binop": null }, - "start": 4405, - "end": 4406, + "start": 4915, + "end": 4916, "loc": { "start": { - "line": 172, + "line": 188, "column": 32 }, "end": { - "line": 172, + "line": 188, "column": 33 } } @@ -19192,15 +20232,15 @@ "binop": null }, "value": "tree", - "start": 4407, - "end": 4411, + "start": 4917, + "end": 4921, "loc": { "start": { - "line": 172, + "line": 188, "column": 34 }, "end": { - "line": 172, + "line": 188, "column": 38 } } @@ -19218,15 +20258,15 @@ "binop": null, "updateContext": null }, - "start": 4411, - "end": 4412, + "start": 4921, + "end": 4922, "loc": { "start": { - "line": 172, + "line": 188, "column": 38 }, "end": { - "line": 172, + "line": 188, "column": 39 } } @@ -19244,15 +20284,15 @@ "binop": null }, "value": "add", - "start": 4412, - "end": 4415, + "start": 4922, + "end": 4925, "loc": { "start": { - "line": 172, + "line": 188, "column": 39 }, "end": { - "line": 172, + "line": 188, "column": 42 } } @@ -19269,15 +20309,15 @@ "postfix": false, "binop": null }, - "start": 4415, - "end": 4416, + "start": 4925, + "end": 4926, "loc": { "start": { - "line": 172, + "line": 188, "column": 42 }, "end": { - "line": 172, + "line": 188, "column": 43 } } @@ -19295,15 +20335,15 @@ "binop": null }, "value": "element", - "start": 4416, - "end": 4423, + "start": 4926, + "end": 4933, "loc": { "start": { - "line": 172, + "line": 188, "column": 43 }, "end": { - "line": 172, + "line": 188, "column": 50 } } @@ -19320,15 +20360,15 @@ "postfix": false, "binop": null }, - "start": 4423, - "end": 4424, + "start": 4933, + "end": 4934, "loc": { "start": { - "line": 172, + "line": 188, "column": 50 }, "end": { - "line": 172, + "line": 188, "column": 51 } } @@ -19346,15 +20386,15 @@ "binop": null, "updateContext": null }, - "start": 4424, - "end": 4425, + "start": 4934, + "end": 4935, "loc": { "start": { - "line": 172, + "line": 188, "column": 51 }, "end": { - "line": 172, + "line": 188, "column": 52 } } @@ -19374,15 +20414,15 @@ "updateContext": null }, "value": "return", - "start": 4429, - "end": 4435, + "start": 4939, + "end": 4945, "loc": { "start": { - "line": 174, + "line": 190, "column": 2 }, "end": { - "line": 174, + "line": 190, "column": 8 } } @@ -19400,15 +20440,15 @@ "binop": null }, "value": "tree", - "start": 4436, - "end": 4440, + "start": 4946, + "end": 4950, "loc": { "start": { - "line": 174, + "line": 190, "column": 9 }, "end": { - "line": 174, + "line": 190, "column": 13 } } @@ -19426,15 +20466,15 @@ "binop": null, "updateContext": null }, - "start": 4440, - "end": 4441, + "start": 4950, + "end": 4951, "loc": { "start": { - "line": 174, + "line": 190, "column": 13 }, "end": { - "line": 174, + "line": 190, "column": 14 } } @@ -19451,15 +20491,15 @@ "postfix": false, "binop": null }, - "start": 4443, - "end": 4444, + "start": 4953, + "end": 4954, "loc": { "start": { - "line": 175, + "line": 191, "column": 1 }, "end": { - "line": 175, + "line": 191, "column": 2 } } @@ -19476,15 +20516,15 @@ "postfix": false, "binop": null }, - "start": 4445, - "end": 4446, + "start": 4955, + "end": 4956, "loc": { "start": { - "line": 176, + "line": 192, "column": 0 }, "end": { - "line": 176, + "line": 192, "column": 1 } } @@ -19502,15 +20542,15 @@ "binop": null, "updateContext": null }, - "start": 4447, - "end": 4447, + "start": 4957, + "end": 4957, "loc": { "start": { - "line": 177, + "line": 193, "column": 0 }, "end": { - "line": 177, + "line": 193, "column": 0 } } diff --git a/badge.svg b/badge.svg index ab7df2b..1117afa 100644 --- a/badge.svg +++ b/badge.svg @@ -11,7 +11,7 @@ document document - 95% - 95% + 100% + 100% diff --git a/class/src/adt/RedBlackTree.js~RedBlackTree.html b/class/src/types/RedBlackTree.js~RedBlackTree.html similarity index 75% rename from class/src/adt/RedBlackTree.js~RedBlackTree.html rename to class/src/types/RedBlackTree.js~RedBlackTree.html index 8f6f203..91001bf 100644 --- a/class/src/adt/RedBlackTree.js~RedBlackTree.html +++ b/class/src/types/RedBlackTree.js~RedBlackTree.html @@ -29,9 +29,8 @@
    - + public class - | source + | source
    @@ -121,7 +123,36 @@

    RedBlackTree

    - from(compare: Function, iterable: Iterbale): RedBlackTree + empty(compare: Function): RedBlackTree +

    +
    +
    + + +

    Constructs an empty red-black tree.

    +
    +
    + + + + + + + + + public + static + + + + + +
    +

    + + + + from(compare: Function, iterable: Iterable): RedBlackTree

    @@ -157,7 +188,7 @@

    RedBlackTree

    - constructor(compare: Function): RedBlackTree + constructor(compare: Function)

    @@ -193,7 +224,7 @@

    RedBlackTree

    - compare: * + compare: *

    @@ -221,7 +252,7 @@

    RedBlackTree

    - root: * + root: *

    @@ -256,13 +287,13 @@

    RedBlackTree

    - [Symbol.iterator](): * + [Symbol.iterator](): *

    - @@ -285,7 +316,7 @@

    RedBlackTree

    - add(key: Key) + add(key: any)

    @@ -314,7 +345,7 @@

    RedBlackTree

    - get(key: Key): Key + get(key: any): any

    @@ -343,7 +374,7 @@

    RedBlackTree

    - has(key: Key): Boolean + has(key: any): Boolean

    @@ -373,7 +404,7 @@

    RedBlackTree

    - isEmpty(): boolean + isEmpty(): boolean

    @@ -402,7 +433,7 @@

    RedBlackTree

    * - items(): Iterator + items(): IterableIterator

    @@ -431,7 +462,7 @@

    RedBlackTree

    * - range(left: Key, right: Key): Iterator + range(left: any, right: any): IterableIterator

    @@ -461,15 +492,15 @@

    RedBlackTree

    - remove(key: Key): Boolean + remove(key: any): Boolean

    Search for the first node of the tree whose key equals the input key -(with RedBlackTree#_search), then delete that node -(with RedBlackTree#_delete).

    +(with RedBlackTree#_search), then delete that node +(with RedBlackTree#_delete).

    @@ -498,7 +529,7 @@

    RedBlackTree

    - _delete(node: Node) + _delete(node: Node)

    @@ -527,7 +558,7 @@

    RedBlackTree

    - _search(key: Key): Node + _search(key: any): Node

    @@ -551,6 +582,79 @@

    RedBlackTree

    Static Public Methods

    +
    +

    + public + static + + + + + empty(compare: Function): RedBlackTree + + + + source + +

    + + + + +

    Constructs an empty red-black tree.

    +
    + + + +
    +

    Params:

    + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    compareFunction

    The comparison function to use.

    +
    +
    +
    + +
    +

    Return:

    + + + + + + + +
    RedBlackTree
    +
    +
    +
    + + + + + + + + + + + + + + + +

    public @@ -559,11 +663,11 @@

    - from(compare: Function, iterable: Iterbale): RedBlackTree + from(compare: Function, iterable: Iterable): RedBlackTree - source + source

    @@ -592,7 +696,7 @@

    Params:

    iterable - Iterbale + Iterable

    The input iterable.

    @@ -607,7 +711,7 @@

    Return:

    - + @@ -642,11 +746,11 @@

    - constructor(compare: Function): RedBlackTree + constructor(compare: Function) - source + source

    @@ -678,19 +782,7 @@

    Params:

    -
    -

    Return:

    -
    RedBlackTreeRedBlackTree
    - - - - - - -
    RedBlackTree
    -
    -
    -
    + @@ -722,7 +814,7 @@

    - source + source

    @@ -765,7 +857,7 @@

    - source + source

    @@ -811,14 +903,14 @@

    - source + source

    -

    Same as RedBlackTree#items.

    + @@ -863,11 +955,11 @@

    - add(key: Key) + add(key: any) - source + source

    @@ -889,7 +981,7 @@

    Params:

    key - Key + any

    The key to add.

    @@ -924,11 +1016,11 @@

    - get(key: Key): Key + get(key: any): any - source + source

    @@ -936,7 +1028,7 @@

    Search for the input key in the tree. Returns the first node key found -in this way (with RedBlackTree#_search. If no such key exists +in this way (with RedBlackTree#_search. If no such key exists in the tree, returns null.

    @@ -952,7 +1044,7 @@

    Params:

    key - Key + any

    The input key.

    @@ -967,7 +1059,7 @@

    Return:

    - + @@ -999,11 +1091,11 @@

    - has(key: Key): Boolean + has(key: any): Boolean - source + source

    @@ -1026,7 +1118,7 @@

    Params:

    - + @@ -1077,7 +1169,7 @@

    - source + source

    @@ -1130,11 +1222,11 @@

    * - items(): Iterator + items(): IterableIterator - source + source

    @@ -1154,7 +1246,7 @@

    Return:

    Keyany
    keyKeyany

    The input key.

    - + @@ -1186,11 +1278,11 @@

    * - range(left: Key, right: Key): Iterator + range(left: any, right: any): IterableIterator - source + source

    @@ -1213,14 +1305,14 @@

    Params:

    - + - + @@ -1235,7 +1327,7 @@

    Return:

    IteratorIterableIterator
    leftKeyany

    The left bound of the interval.

    rightKeyany

    The right bound of the interval.

    - + @@ -1267,11 +1359,11 @@

    - remove(key: Key): Boolean + remove(key: any): Boolean - source + source

    @@ -1279,8 +1371,8 @@

    Search for the first node of the tree whose key equals the input key -(with RedBlackTree#_search), then delete that node -(with RedBlackTree#_delete). If such a node is found and deleted +(with RedBlackTree#_search), then delete that node +(with RedBlackTree#_delete). If such a node is found and deleted then return true. Return false otherwise.

    @@ -1296,7 +1388,7 @@

    Params:

    - + @@ -1350,7 +1442,7 @@

    - source + source

    @@ -1407,11 +1499,11 @@ @@ -1435,7 +1527,7 @@

    Params:

    - + diff --git a/coverage.json b/coverage.json index bea8d9e..1ee82e5 100644 --- a/coverage.json +++ b/coverage.json @@ -1,26 +1,18 @@ { - "coverage": "95.55%", - "expectCount": 45, - "actualCount": 43, + "coverage": "100%", + "expectCount": 48, + "actualCount": 48, "files": { - "src/adt/Leaf.js": { - "expectCount": 2, - "actualCount": 2, + "src/api/empty.js": { + "expectCount": 1, + "actualCount": 1, "undocumentLines": [] }, - "src/adt/Node.js": { - "expectCount": 2, - "actualCount": 2, + "src/api/from.js": { + "expectCount": 1, + "actualCount": 1, "undocumentLines": [] }, - "src/adt/RedBlackTree.js": { - "expectCount": 15, - "actualCount": 13, - "undocumentLines": [ - 21, - 22 - ] - }, "src/color/BLACK.js": { "expectCount": 1, "actualCount": 1, @@ -31,7 +23,7 @@ "actualCount": 1, "undocumentLines": [] }, - "src/debug/debug.js": { + "src/debug/_debug.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] @@ -150,6 +142,21 @@ "expectCount": 1, "actualCount": 1, "undocumentLines": [] + }, + "src/types/Leaf.js": { + "expectCount": 2, + "actualCount": 2, + "undocumentLines": [] + }, + "src/types/Node.js": { + "expectCount": 2, + "actualCount": 2, + "undocumentLines": [] + }, + "src/types/RedBlackTree.js": { + "expectCount": 16, + "actualCount": 16, + "undocumentLines": [] } } } \ No newline at end of file diff --git a/file/src/adt/index.js.html b/file/src/api/empty.js.html similarity index 89% rename from file/src/adt/index.js.html rename to file/src/api/empty.js.html index c988d5c..9866297 100644 --- a/file/src/adt/index.js.html +++ b/file/src/api/empty.js.html @@ -3,7 +3,7 @@ - src/adt/index.js | @aureooms/js-red-black-tree + src/api/empty.js | @aureooms/js-red-black-tree @@ -29,9 +29,8 @@ -

    src/adt/index.js

    -
    export * from './Leaf.js';
    -export * from './Node.js';
    -export * from './RedBlackTree.js';
    +

    src/api/empty.js

    +
    import RedBlackTree from '../types/RedBlackTree.js';
    +
    +/**
    + * Same as {@link RedBlackTree.empty}.
    + * @function empty
    + */
    +const empty = RedBlackTree.empty;
    +export default empty;
     
    diff --git a/file/src/debug/index.js.html b/file/src/api/from.js.html similarity index 89% rename from file/src/debug/index.js.html rename to file/src/api/from.js.html index 887081a..73c4dbe 100644 --- a/file/src/debug/index.js.html +++ b/file/src/api/from.js.html @@ -3,7 +3,7 @@ - src/debug/index.js | @aureooms/js-red-black-tree + src/api/from.js | @aureooms/js-red-black-tree @@ -29,9 +29,8 @@ -

    src/debug/index.js

    -
    export * from './debug.js';
    +

    src/api/from.js

    +
    import RedBlackTree from '../types/RedBlackTree.js';
    +
    +/**
    + * Same as {@link RedBlackTree.from}.
    + * @function from
    + */
    +const from = RedBlackTree.from;
    +export default from;
     
    diff --git a/file/src/color/BLACK.js.html b/file/src/color/BLACK.js.html index 50a86fe..c225c1d 100644 --- a/file/src/color/BLACK.js.html +++ b/file/src/color/BLACK.js.html @@ -29,9 +29,8 @@ @@ -66,7 +68,8 @@
    /**
      * Constant for black.
      */
    -export const BLACK = 0;
    +const BLACK = 0;
    +export default BLACK;
     
    diff --git a/file/src/color/RED.js.html b/file/src/color/RED.js.html index 362bd05..4be9f0e 100644 --- a/file/src/color/RED.js.html +++ b/file/src/color/RED.js.html @@ -29,9 +29,8 @@ @@ -66,7 +68,8 @@
    /**
      * Constant for red.
      */
    -export const RED = 1;
    +const RED = 1;
    +export default RED;
     
    diff --git a/file/src/color/index.js.html b/file/src/color/index.js.html deleted file mode 100644 index 4154703..0000000 --- a/file/src/color/index.js.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - src/color/index.js | @aureooms/js-red-black-tree - - - - - - - -
    - Home - Manual - Reference - Source - - -
    - - - -

    src/color/index.js

    -
    export * from './BLACK.js';
    -export * from './RED.js';
    -
    - -
    - - - - - - - - - - - - diff --git a/file/src/debug/debug.js.html b/file/src/debug/_debug.js.html similarity index 87% rename from file/src/debug/debug.js.html rename to file/src/debug/_debug.js.html index a1d1939..1021384 100644 --- a/file/src/debug/debug.js.html +++ b/file/src/debug/_debug.js.html @@ -3,7 +3,7 @@ - src/debug/debug.js | @aureooms/js-red-black-tree + src/debug/_debug.js | @aureooms/js-red-black-tree @@ -29,9 +29,8 @@ -

    src/debug/debug.js

    -
    import {BLACK} from '../color/BLACK.js';
    +

    src/debug/_debug.js

    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +import BLACK from '../color/BLACK.js';
     
     /**
      * Builds a debug function from color handlers.
    @@ -71,16 +76,22 @@
      * @param {Object} colors The colors to use.
      * @returns {Function} The debug function.
      */
    -export const _debug = ({red, black}) => {
    +const _debug = ({red, black}) => {
     	/**
     	 * Recursively constructs a prettyprint string for the red-black tree rooted at
     	 * <code>root</code>.
     	 *
    -	 * @param {Node} root - The root of the tree.
    +	 * @param {Node|Leaf} root - The root of the tree.
     	 * @returns {string}
     	 */
     	const debug = (root) => {
    -		if (root.isLeaf()) return black('L');
    +		assert(root instanceof Node || root instanceof Leaf);
    +		if (root.isLeaf()) {
    +			assert(root instanceof Leaf);
    +			return black('L');
    +		}
    +
    +		assert(root instanceof Node);
     
     		const repr = root._color === BLACK ? black(root.key) : red(root.key);
     
    @@ -89,6 +100,8 @@
     
     	return debug;
     };
    +
    +export default _debug;
     
    diff --git a/file/src/deletion/delete_case1.js.html b/file/src/deletion/delete_case1.js.html index a082fd0..b023d88 100644 --- a/file/src/deletion/delete_case1.js.html +++ b/file/src/deletion/delete_case1.js.html @@ -29,9 +29,8 @@

    src/deletion/delete_case1.js

    -
    import {delete_case2} from './delete_case2.js';
    +
    import assert from 'assert';
    +import BLACK from '../color/BLACK.js';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +import delete_case2 from './delete_case2.js';
     
     /**
      * Preconditions:
    @@ -71,13 +77,18 @@
      *   - all root-leaf paths going through n have a black height of b - 1
      *   - all other root-leaf paths have a black height of b
      *
    - * @param {Node} n - The input node.
    + * @param {Node|Leaf} n - The input node.
      */
    -export const delete_case1 = (n) => {
    -	// If n is the root, there is nothing to do: all paths go through n, and n
    -	// is black.
    +const delete_case1 = (n) => {
    +	assert(n instanceof Node || n instanceof Leaf);
    +	assert(n._color === BLACK);
    +	// If n is the root, there is nothing to do:
    +	//   - all paths go through n, and
    +	//   - n is black.
     	if (n.parent !== null) delete_case2(n);
     };
    +
    +export default delete_case1;
     
    diff --git a/file/src/deletion/delete_case2.js.html b/file/src/deletion/delete_case2.js.html index 4ce123a..0d6554c 100644 --- a/file/src/deletion/delete_case2.js.html +++ b/file/src/deletion/delete_case2.js.html @@ -29,9 +29,8 @@

    src/deletion/delete_case2.js

    -
    import {BLACK, RED} from '../color/index.js';
    -import {rotate_left, rotate_right} from '../rotate/index.js';
    -import {sibling} from '../family/sibling.js';
    +
    import assert from 'assert';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +import rotate_left from '../rotate/rotate_left.js';
    +import rotate_right from '../rotate/rotate_right.js';
    +import sibling from '../family/sibling.js';
     
    -import {delete_case3} from './delete_case3.js';
    -import {delete_case4} from './delete_case4.js';
    +import delete_case3 from './delete_case3.js';
    +import delete_case4 from './delete_case4.js';
     
     /**
      * Preconditions:
    @@ -77,9 +84,13 @@
      *   - all other root-leaf paths have a black height of b
      *   - n is not the root
      *
    - * @param {Node} n - The input node.
    + * @param {Node|Leaf} n - The input node.
      */
    -export const delete_case2 = (n) => {
    +const delete_case2 = (n) => {
    +	assert(n instanceof Node || n instanceof Leaf);
    +	assert(n._color === BLACK);
    +	assert(n.parent !== null);
    +
     	const s = sibling(n);
     
     	/**
    @@ -104,6 +115,8 @@
     	// Otherwise, go to case 3.
     	else delete_case3(n);
     };
    +
    +export default delete_case2;
     
    diff --git a/file/src/deletion/delete_case3.js.html b/file/src/deletion/delete_case3.js.html index 8f6ce6e..9b63320 100644 --- a/file/src/deletion/delete_case3.js.html +++ b/file/src/deletion/delete_case3.js.html @@ -29,9 +29,8 @@

    src/deletion/delete_case3.js

    -
    import {BLACK, RED} from '../color/index.js';
    -import {sibling} from '../family/sibling.js';
    +
    import assert from 'assert';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +import sibling from '../family/sibling.js';
     
    -import {delete_case1} from './delete_case1.js';
    -import {delete_case4} from './delete_case4.js';
    +import delete_case1 from './delete_case1.js';
    +import delete_case4 from './delete_case4.js';
     
     /**
      * Preconditions:
    @@ -77,10 +83,15 @@
      *   - n is not the root
      *   - n's sibling is black
      *
    - * @param {Node} n - The input node.
    + * @param {Node|Leaf} n - The input node.
      */
    -export const delete_case3 = (n) => {
    +const delete_case3 = (n) => {
    +	assert(n instanceof Node || n instanceof Leaf);
    +	assert(n._color === BLACK);
    +	assert(n.parent !== null);
     	const s = sibling(n);
    +	assert(s instanceof Node);
    +	assert(s._color === BLACK);
     
     	/**
     	 * If n's parent is black and n's sibling's children are black, then
    @@ -107,6 +118,8 @@
     	// Otherwise, go to case 4.
     	else delete_case4(n);
     };
    +
    +export default delete_case3;
     
    diff --git a/file/src/deletion/delete_case4.js.html b/file/src/deletion/delete_case4.js.html index 21b6de6..8a81a82 100644 --- a/file/src/deletion/delete_case4.js.html +++ b/file/src/deletion/delete_case4.js.html @@ -29,9 +29,8 @@

    src/deletion/delete_case4.js

    -
    import {BLACK, RED} from '../color/index.js';
    -import {sibling} from '../family/sibling.js';
    +
    import assert from 'assert';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +import sibling from '../family/sibling.js';
     
    -import {delete_case5} from './delete_case5.js';
    +import delete_case5 from './delete_case5.js';
     
     /**
      * Preconditions:
    @@ -77,10 +83,18 @@
      *   - n's sibling is black
      *   - n's parent and n's sibling's children cannot all be black
      *
    - * @param {Node} n - The input node.
    + * @param {Node|Leaf} n - The input node.
      */
    -export const delete_case4 = (n) => {
    +const delete_case4 = (n) => {
    +	assert(n instanceof Node || n instanceof Leaf);
    +	assert(n._color === BLACK);
    +	assert(n.parent !== null);
     	const s = sibling(n);
    +	assert(s instanceof Node);
    +	assert(s._color === BLACK);
    +	assert(
    +		n.parent._color === RED || s.left._color === RED || s.right._color === RED,
    +	);
     
     	/**
     	 * If n's parent is red and n's sibling's children are black, then swap n's
    @@ -109,6 +123,8 @@
     	// Otherwise, go to case 5.
     	else delete_case5(n);
     };
    +
    +export default delete_case4;
     
    diff --git a/file/src/deletion/delete_case5.js.html b/file/src/deletion/delete_case5.js.html index f17d5ea..5b8a6fb 100644 --- a/file/src/deletion/delete_case5.js.html +++ b/file/src/deletion/delete_case5.js.html @@ -29,9 +29,8 @@

    src/deletion/delete_case5.js

    -
    import {BLACK, RED} from '../color/index.js';
    -import {rotate_left, rotate_right} from '../rotate/index.js';
    -import {sibling} from '../family/sibling.js';
    +
    import assert from 'assert';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +import rotate_left from '../rotate/rotate_left.js';
    +import rotate_right from '../rotate/rotate_right.js';
    +import sibling from '../family/sibling.js';
     
    -import {delete_case6} from './delete_case6.js';
    +import delete_case6 from './delete_case6.js';
     
     /**
      * Preconditions:
    @@ -78,10 +85,16 @@
      *   - n's sibling is black
      *   - at least one of n's sibling's children is red
      *
    - * @param {Node} n - The input node.
    + * @param {Node|Leaf} n - The input node.
      */
    -export const delete_case5 = (n) => {
    +const delete_case5 = (n) => {
    +	assert(n instanceof Node || n instanceof Leaf);
    +	assert(n._color === BLACK);
    +	assert(n.parent !== null);
     	const s = sibling(n);
    +	assert(s instanceof Node);
    +	assert(s._color === BLACK);
    +	assert(s.left._color === RED || s.right._color === RED);
     
     	// The following statements just force the red n's sibling child to be on
     	// the left of the left of the parent, or right of the right, so case 6
    @@ -121,6 +134,8 @@
     
     	delete_case6(n);
     };
    +
    +export default delete_case5;
     
    diff --git a/file/src/deletion/delete_case6.js.html b/file/src/deletion/delete_case6.js.html index ff99ae3..3a3c12a 100644 --- a/file/src/deletion/delete_case6.js.html +++ b/file/src/deletion/delete_case6.js.html @@ -29,9 +29,8 @@

    src/deletion/delete_case6.js

    -
    import {BLACK} from '../color/BLACK.js';
    -import {rotate_left, rotate_right} from '../rotate/index.js';
    -import {sibling} from '../family/sibling.js';
    +
    import assert from 'assert';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +import rotate_left from '../rotate/rotate_left.js';
    +import rotate_right from '../rotate/rotate_right.js';
    +import sibling from '../family/sibling.js';
     
     /**
      * Preconditions:
    @@ -77,10 +84,15 @@
      *   - if n is a left child, the right child of n's sibling is red
      *   - if n is a right child, the left child of n's sibling is red
      *
    - * @param {Node} n - The input node.
    + * @param {Node|Leaf} n - The input node.
      */
    -export const delete_case6 = (n) => {
    +const delete_case6 = (n) => {
    +	assert(n instanceof Node || n instanceof Leaf);
    +	assert(n._color === BLACK);
    +	assert(n.parent !== null);
     	const s = sibling(n);
    +	assert(s instanceof Node);
    +	assert(s._color === BLACK);
     
     	/**
     	 * Increment the black height of all root-leaf paths going through n by
    @@ -104,16 +116,20 @@
     	n.parent._color = BLACK;
     
     	if (n === n.parent.left) {
    +		assert(s.right._color === RED);
     		s.right._color = BLACK;
     		rotate_left(n.parent);
     	}
     
     	// Symmetric case
     	else {
    +		assert(s.left._color === RED);
     		s.left._color = BLACK;
     		rotate_right(n.parent);
     	}
     };
    +
    +export default delete_case6;
     
    diff --git a/file/src/deletion/delete_one_child.js.html b/file/src/deletion/delete_one_child.js.html index 06b9c80..5207615 100644 --- a/file/src/deletion/delete_one_child.js.html +++ b/file/src/deletion/delete_one_child.js.html @@ -29,9 +29,8 @@

    src/deletion/delete_one_child.js

    -
    import {BLACK, RED} from '../color/index.js';
    +
    import assert from 'assert';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
     
    -import {replace_node} from './replace_node.js';
    -import {delete_case1} from './delete_case1.js';
    +import replace_node from './replace_node.js';
    +import delete_case1 from './delete_case1.js';
     
     /**
      * Delete a node <code>n</code> that has at most a single non-leaf child.
    @@ -74,16 +80,18 @@
      * Precondition:
      *   - n has at most one non-leaf child.
      *   - if n has a non-leaf child, then it is its left child.
    + *   - hence, n's right child is a leaf
      *
      * @param {Node} n - The node to delete.
      */
    -export const delete_one_child = (n) => {
    -	// Precondition: n has at most one non-leaf child.
    -	// assert( n.right.isLeaf() || n.left.isLeaf());
    +const delete_one_child = (n) => {
    +	assert(n instanceof Node);
    +	// Precondition: n's right child is a leaf.
    +	// The right child of n is always a LEAF because either n is a subtree
    +	// predecessor or it is the only child of its parent by the red-black tree
    +	// properties
    +	assert(n.right instanceof Leaf);
     
    -	// const child = n.right.isLeaf() ? n.left : n.right;
    -	// n.right is always a LEAF because either n is a subtree predecessor or it
    -	// is the only child of its parent by the red-black tree properties
     	const child = n.left;
     
     	// Replace n with its left child
    @@ -97,14 +105,17 @@
     		// replace n with it.
     		if (child._color === RED) child._color = BLACK;
     		// Otherwise, there are more things to fix.
    -		else delete_case1(child);
    +		else {
    +			delete_case1(child);
    +		}
    +	} else {
    +		//    If n is red then its child can only be black. Replacing n with its
    +		//    child suffices. This is a NO-OP.
    +		assert(child._color === BLACK);
     	}
    -
    -	// Else {
    -	//    If n is red then its child can only be black. Replacing n with its
    -	//    child suffices.
    -	// }
     };
    +
    +export default delete_one_child;
     
    diff --git a/file/src/deletion/index.js.html b/file/src/deletion/index.js.html deleted file mode 100644 index 572d367..0000000 --- a/file/src/deletion/index.js.html +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - src/deletion/index.js | @aureooms/js-red-black-tree - - - - - - - -
    - Home - Manual - Reference - Source - - -
    - - - -

    src/deletion/index.js

    -
    export * from './delete_case1.js';
    -export * from './delete_case2.js';
    -export * from './delete_case3.js';
    -export * from './delete_case4.js';
    -export * from './delete_case5.js';
    -export * from './delete_case6.js';
    -export * from './delete_one_child.js';
    -export * from './replace_node.js';
    -
    - -
    - - - - - - - - - - - - diff --git a/file/src/deletion/replace_node.js.html b/file/src/deletion/replace_node.js.html index c9f2402..f239aa9 100644 --- a/file/src/deletion/replace_node.js.html +++ b/file/src/deletion/replace_node.js.html @@ -29,9 +29,8 @@

    src/deletion/replace_node.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +
    +/**
      * Replaces node <code>A</code> by node <code>B</code>.
      *
      * @param {Node} A - The node to replace.
    - * @param {Node} B - The replacement node.
    + * @param {Node|Leaf} B - The replacement node.
      */
    -export const replace_node = (A, B) => {
    -	// Assert( A.parent !== null ) ;
    -	// we never apply delete_one_child on the root so we are safe
    +const replace_node = (A, B) => {
    +	assert(A instanceof Node);
    +	assert(B instanceof Node || B instanceof Leaf);
    +	// We never apply delete_one_child on the root
    +	assert(A.parent !== null);
     
     	if (A === A.parent.left) A.parent.left = B;
     	else A.parent.right = B;
     
     	B.parent = A.parent;
     };
    +
    +export default replace_node;
     
    diff --git a/file/src/family/grandparent.js.html b/file/src/family/grandparent.js.html index 2ba4928..f0df1c8 100644 --- a/file/src/family/grandparent.js.html +++ b/file/src/family/grandparent.js.html @@ -29,9 +29,8 @@

    src/family/grandparent.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
      * Computes the grandparent (parent of parent) of the input node.
      *
      * @param {Node} node - The input node.
      * @returns {Node}
      */
    -export const grandparent = (node) => {
    -	// Assert((node !== null) && (node.parent !== null));
    +const grandparent = (node) => {
    +	assert(node instanceof Node);
     	// We only call this function when node HAS a grandparent
    +	assert(node.parent !== null);
    +	assert(node.parent.parent !== null);
     	return node.parent.parent;
     };
    +
    +export default grandparent;
     
    diff --git a/file/src/family/index.js.html b/file/src/family/index.js.html deleted file mode 100644 index fcdb596..0000000 --- a/file/src/family/index.js.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - src/family/index.js | @aureooms/js-red-black-tree - - - - - - - -
    - Home - Manual - Reference - Source - - -
    - - - -

    src/family/index.js

    -
    export * from './grandparent.js';
    -export * from './predecessor.js';
    -export * from './sibling.js';
    -export * from './uncle.js';
    -
    - -
    - - - - - - - - - - - - diff --git a/file/src/family/predecessor.js.html b/file/src/family/predecessor.js.html index 088b0bc..c475006 100644 --- a/file/src/family/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -29,9 +29,8 @@

    src/family/predecessor.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
      * Computes the predecessor of the input node, in the subtree rooted at the
      * input node, when this predecessor is guaranteed to exist.
      *
      * @param {Node} node - The input node.
      * @returns {Node}
      */
    -export const predecessor = (node) => {
    -	// Assert( !node.left.isLeaf() ) ;
    +const predecessor = (node) => {
    +	assert(node.left instanceof Node);
     	let pred = node.left;
     
    -	while (!pred.right.isLeaf()) pred = pred.right;
    +	while (!pred.right.isLeaf()) {
    +		assert(pred.right instanceof Node);
    +		pred = pred.right;
    +	}
     
     	return pred;
     };
    +
    +export default predecessor;
     
    diff --git a/file/src/family/sibling.js.html b/file/src/family/sibling.js.html index 0c33ca9..895c948 100644 --- a/file/src/family/sibling.js.html +++ b/file/src/family/sibling.js.html @@ -29,9 +29,8 @@

    src/family/sibling.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +
    +/**
      * Computes the sibling of the input node.
      *
    - * @param {Node} node - The input node.
    - * @returns {Node}
    + * @param {Node|Leaf} node - The input node.
    + * @returns {Node|Leaf}
      */
    -export const sibling = (node) => {
    -	// Assert((node !== null) && (node.parent !== null));
    -	// We only use this function when node HAS a sibling so this case can never
    -	// happen.
    +const sibling = (node) => {
    +	assert(node instanceof Node || node instanceof Leaf);
    +	// We only use this function when node HAS a sibling.
    +	assert(node.parent !== null);
     
     	return node === node.parent.left ? node.parent.right : node.parent.left;
     };
    +
    +export default sibling;
     
    diff --git a/file/src/family/uncle.js.html b/file/src/family/uncle.js.html index 01c7322..3948a71 100644 --- a/file/src/family/uncle.js.html +++ b/file/src/family/uncle.js.html @@ -29,9 +29,8 @@

    src/family/uncle.js

    -
    import {grandparent} from './grandparent.js';
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import Leaf from '../types/Leaf.js';
    +import grandparent from './grandparent.js';
     
     /**
      * Computes the uncle of the input node when the grandparent is guaranteed to
      * exist.
      *
      * @param {Node} node - The input node.
    - * @returns {Node}
    + * @returns {Node|Leaf}
      */
    -export const uncle = (node) => {
    +const uncle = (node) => {
    +	assert(node instanceof Node);
     	const g = grandparent(node);
    -	// Assert( g !== null ) ;
    -	// this can never happen
    -	if (node.parent === g.left) return g.right.isLeaf() ? null : g.right;
    -	return g.left.isLeaf() ? null : g.left;
    +	assert(g !== null);
    +	const u = node.parent === g.left ? g.right : g.left;
    +	assert(u instanceof Node || u instanceof Leaf);
    +	return u;
     };
    +
    +export default uncle;
     
    diff --git a/file/src/index.js.html b/file/src/index.js.html index b97737a..36833ed 100644 --- a/file/src/index.js.html +++ b/file/src/index.js.html @@ -29,9 +29,8 @@

    src/index.js

    -
    export * from './adt/index.js';
    -export * from './color/index.js';
    -export * from './debug/index.js';
    -export * from './deletion/index.js';
    -export * from './family/index.js';
    -export * from './insertion/index.js';
    -export * from './rotate/index.js';
    -export * from './search/index.js';
    -export * from './traversal/index.js';
    +
    export {default as empty} from './api/empty.js';
    +export {default as from} from './api/from.js';
    +export {default as BLACK} from './color/BLACK.js';
    +export {default as RED} from './color/RED.js';
    +export {default as _debug} from './debug/_debug.js';
    +export {default as delete_case1} from './deletion/delete_case1.js';
    +export {default as delete_case2} from './deletion/delete_case2.js';
    +export {default as delete_case3} from './deletion/delete_case3.js';
    +export {default as delete_case4} from './deletion/delete_case4.js';
    +export {default as delete_case5} from './deletion/delete_case5.js';
    +export {default as delete_case6} from './deletion/delete_case6.js';
    +export {default as delete_one_child} from './deletion/delete_one_child.js';
    +export {default as replace_node} from './deletion/replace_node.js';
    +export {default as grandparent} from './family/grandparent.js';
    +export {default as predecessor} from './family/predecessor.js';
    +export {default as sibling} from './family/sibling.js';
    +export {default as uncle} from './family/uncle.js';
    +export {default as insert} from './insertion/insert.js';
    +export {default as insert_case1} from './insertion/insert_case1.js';
    +export {default as insert_case2} from './insertion/insert_case2.js';
    +export {default as insert_case3} from './insertion/insert_case3.js';
    +export {default as insert_case4} from './insertion/insert_case4.js';
    +export {default as insert_case5} from './insertion/insert_case5.js';
    +export {default as rotate_left} from './rotate/rotate_left.js';
    +export {default as rotate_right} from './rotate/rotate_right.js';
    +export {default as search} from './search/search.js';
    +export {default as inordertraversal} from './traversal/inordertraversal.js';
    +export {default as rangetraversal} from './traversal/rangetraversal.js';
    +export {default as Leaf} from './types/Leaf.js';
    +export {default as Node} from './types/Node.js';
    +export {default as RedBlackTree} from './types/RedBlackTree.js';
     
    diff --git a/file/src/insertion/index.js.html b/file/src/insertion/index.js.html deleted file mode 100644 index cf80632..0000000 --- a/file/src/insertion/index.js.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - src/insertion/index.js | @aureooms/js-red-black-tree - - - - - - - -
    - Home - Manual - Reference - Source - - -
    - - - -

    src/insertion/index.js

    -
    export * from './insert.js';
    -export * from './insert_case1.js';
    -export * from './insert_case2.js';
    -export * from './insert_case3.js';
    -export * from './insert_case4.js';
    -export * from './insert_case5.js';
    -
    - -
    - - - - - - - - - - - - diff --git a/file/src/insertion/insert.js.html b/file/src/insertion/insert.js.html index 799c011..f79ca35 100644 --- a/file/src/insertion/insert.js.html +++ b/file/src/insertion/insert.js.html @@ -29,9 +29,8 @@

    src/insertion/insert.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
      * Walks the tree rooted at <code>A</code> down the only path that satisfies
      * the following property: if at a node <code>C</code> we make a left (resp.
      * right), then <code>B < C</code> (resp. <code>B >= C</code>). Once we hit the
    @@ -74,12 +79,12 @@
      * properties in case they have been violated by this insertion. This is fixed
      * by {@link insert_case1}.
      *
    - * @param compare - The comparison function to use.
    + * @param {Function} compare - The comparison function to use.
      * @param {Node} A - The root of the tree.
      * @param {Node} B - The node to insert.
      * @returns {Node} B - The node that has been inserted.
      */
    -export const insert = (compare, A, B) => {
    +const insert = (compare, A, B) => {
     	while (true) {
     		if (compare(B.key, A.key) < 0) {
     			const node = A.left;
    @@ -89,6 +94,7 @@
     				break;
     			}
     
    +			assert(node instanceof Node);
     			A = node;
     		} else {
     			const node = A.right;
    @@ -98,6 +104,7 @@
     				break;
     			}
     
    +			assert(node instanceof Node);
     			A = node;
     		}
     	}
    @@ -106,6 +113,8 @@
     
     	return B;
     };
    +
    +export default insert;
     
    diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html index 35ac274..3f6e7a5 100644 --- a/file/src/insertion/insert_case1.js.html +++ b/file/src/insertion/insert_case1.js.html @@ -29,9 +29,8 @@

    src/insertion/insert_case1.js

    -
    import {BLACK} from '../color/BLACK.js';
    -import {insert_case2} from './insert_case2.js';
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import insert_case2 from './insert_case2.js';
     
     /**
      * Preconditions:
      *   - n is red.
    + *   - n's children are BLACK
      *
      * @param {Node} n - The input node.
      */
    -export const insert_case1 = (n) => {
    +const insert_case1 = (n) => {
    +	assert(n instanceof Node);
    +	assert(n._color === RED);
    +	assert(n.left._color === BLACK);
    +	assert(n.right._color === BLACK);
     	/**
     	 * If n is the root of the tree, paint it black and we are done.
     	 *
    @@ -83,6 +93,8 @@
     	if (n.parent === null) n._color = BLACK;
     	else insert_case2(n);
     };
    +
    +export default insert_case1;
     
    diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index 63d77df..85c86b7 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -29,9 +29,8 @@

    src/insertion/insert_case2.js

    -
    import {BLACK} from '../color/BLACK.js';
    -import {insert_case3} from './insert_case3.js';
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import insert_case3 from './insert_case3.js';
     
     /**
      * Preconditions:
      *   - n is red.
    + *   - n's children are BLACK
      *   - n is not the root of the tree.
      *
      * @param {Node} n - The input node.
      */
    -export const insert_case2 = (n) => {
    +const insert_case2 = (n) => {
    +	assert(n instanceof Node);
    +	assert(n._color === RED);
    +	assert(n.left._color === BLACK);
    +	assert(n.right._color === BLACK);
    +	assert(n.parent !== null);
    +
     	/**
     	 * If the parent of n is black then we have nothing to do.
     	 *
    @@ -87,6 +99,8 @@
     
     	insert_case3(n);
     };
    +
    +export default insert_case2;
     
    diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index bf72548..b465a49 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -29,9 +29,8 @@

    src/insertion/insert_case3.js

    -
    import {BLACK, RED} from '../color/index.js';
    -import {uncle, grandparent} from '../family/index.js';
    -import {insert_case1} from './insert_case1.js';
    -import {insert_case4} from './insert_case4.js';
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import uncle from '../family/uncle.js';
    +import grandparent from '../family/grandparent.js';
    +import insert_case1 from './insert_case1.js';
    +import insert_case4 from './insert_case4.js';
     
     /**
      * Preconditions:
      *   - n is red.
    + *   - n's children are BLACK
      *   - n is not the root of the tree.
      *   - n's parent is red.
      *
      * @param {Node} n - The input node.
      */
    -export const insert_case3 = (n) => {
    +const insert_case3 = (n) => {
    +	assert(n instanceof Node);
    +	assert(n._color === RED);
    +	assert(n.left._color === BLACK);
    +	assert(n.right._color === BLACK);
    +	assert(n.parent !== null);
    +	assert(n.parent._color === RED);
     	const u = uncle(n);
     
     	/**
    @@ -93,7 +106,7 @@
     	 *     -   -                 -   -
     	 */
     
    -	if (u !== null && u._color === RED) {
    +	if (u._color === RED) {
     		n.parent._color = BLACK;
     		u._color = BLACK;
     		const g = grandparent(n);
    @@ -101,6 +114,8 @@
     		insert_case1(g);
     	} else insert_case4(n);
     };
    +
    +export default insert_case3;
     
    diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index 185ed12..e724df1 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -29,9 +29,8 @@

    src/insertion/insert_case4.js

    -
    import {rotate_left, rotate_right} from '../rotate/index.js';
    -import {grandparent} from '../family/grandparent.js';
    -import {insert_case5} from './insert_case5.js';
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import rotate_left from '../rotate/rotate_left.js';
    +import rotate_right from '../rotate/rotate_right.js';
    +import grandparent from '../family/grandparent.js';
    +import insert_case5 from './insert_case5.js';
     
     /**
      * Preconditions:
      *   - n is red.
    + *   - n's children are BLACK
      *   - n is not the root of the tree.
      *   - n's parent is red.
      *   - n's uncle is black.
    @@ -78,7 +86,13 @@
      *
      * @param {Node} n - The input node.
      */
    -export const insert_case4 = (n) => {
    +const insert_case4 = (n) => {
    +	assert(n instanceof Node);
    +	assert(n._color === RED);
    +	assert(n.left._color === BLACK);
    +	assert(n.right._color === BLACK);
    +	assert(n.parent !== null);
    +	assert(n.parent._color === RED);
     	const g = grandparent(n);
     
     	/**
    @@ -141,6 +155,8 @@
     
     	insert_case5(n);
     };
    +
    +export default insert_case4;
     
    diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case5.js.html index c604c3d..a73c39a 100644 --- a/file/src/insertion/insert_case5.js.html +++ b/file/src/insertion/insert_case5.js.html @@ -29,9 +29,8 @@

    src/insertion/insert_case5.js

    -
    import {BLACK, RED} from '../color/index.js';
    -import {rotate_left, rotate_right} from '../rotate/index.js';
    -import {grandparent} from '../family/grandparent.js';
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import rotate_left from '../rotate/rotate_left.js';
    +import rotate_right from '../rotate/rotate_right.js';
    +import grandparent from '../family/grandparent.js';
     
     /**
      * Preconditions:
      *   - n is red.
    + *   - n's children are BLACK
      *   - n is not the root of the tree.
      *   - n's parent is red.
      *   - n's uncle is black.
    @@ -77,39 +84,57 @@
      *
      * @param {Node} n - The input node.
      */
    -export const insert_case5 = (n) => {
    +const insert_case5 = (n) => {
    +	assert(n instanceof Node);
    +	assert(n._color === RED);
    +	assert(n.left._color === BLACK);
    +	assert(n.right._color === BLACK);
    +	assert(n.parent !== null);
    +	assert(n.parent._color === RED);
     	const g = grandparent(n);
     
     	// Repaint n's parent black, n's grandparent red
     	n.parent._color = BLACK;
     	g._color = RED;
     
    -	/**
    -	 * If the path from g to n makes a left-left, {@link rotate_right} at g.
    -	 * We are done.
    -	 *
    -	 *             R                     B
    -	 *           /   \                 /   \
    -	 *         B       B            >R       R
    -	 *        / \     / \   -->     / \     / \
    -	 *      >R   =   -   -         =   =   =   B
    -	 *      / \                               / \
    -	 *     =   =                             -   -
    -	 */
    -	if (n === n.parent.left) rotate_right(g);
    -	/**
    -	 * If the path from g to n makes a right-right, {@link rotate_left} at g.
    -	 * We are done.
    -	 *
    -	 *             R                     B
    -	 *           /   \                 /   \
    -	 *         B       B             R      >R
    -	 *        / \     / \   -->     / \     / \
    -	 *       -   -   =  >R         B   =   =   =
    -	 *                  / \       / \
    -	 *                 =   =     -   -
    -	 */ else rotate_left(g);
    +	if (n === n.parent.left) {
    +		/**
    +		 * If the path from g to n makes a left-left, {@link rotate_right} at g.
    +		 * We are done.
    +		 *
    +		 *             R                     B
    +		 *           /   \                 /   \
    +		 *         B       B            >R       R
    +		 *        / \     / \   -->     / \     / \
    +		 *      >R   =   -   -         =   =   =   B
    +		 *      / \                               / \
    +		 *     =   =                             -   -
    +		 */
    +		assert(g.left instanceof Node);
    +		assert(n === g.left.left);
    +		assert(g.right._color === BLACK);
    +		rotate_right(g);
    +	} else {
    +		/**
    +		 * If the path from g to n makes a right-right, {@link rotate_left} at g.
    +		 * We are done.
    +		 *
    +		 *             R                     B
    +		 *           /   \                 /   \
    +		 *         B       B             R      >R
    +		 *        / \     / \   -->     / \     / \
    +		 *       -   -   =  >R         B   =   =   =
    +		 *                  / \       / \
    +		 *                 =   =     -   -
    +		 */
    +		assert(g.right instanceof Node);
    +		assert(n === g.right.right);
    +		assert(g.left._color === BLACK);
    +		rotate_left(g);
    +	}
     };
    +
    +export default insert_case5;
     
    diff --git a/file/src/rotate/index.js.html b/file/src/rotate/index.js.html deleted file mode 100644 index 70d8aee..0000000 --- a/file/src/rotate/index.js.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - src/rotate/index.js | @aureooms/js-red-black-tree - - - - - - - -
    - Home - Manual - Reference - Source - - -
    - - - -

    src/rotate/index.js

    -
    export * from './rotate_left.js';
    -export * from './rotate_right.js';
    -
    - -
    - - - - - - - - - - - - diff --git a/file/src/rotate/rotate_left.js.html b/file/src/rotate/rotate_left.js.html index 182aa8a..a31777a 100644 --- a/file/src/rotate/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -29,9 +29,8 @@

    src/rotate/rotate_left.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
      * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)
      * /!\ This swaps the references to A and B.
      *
    @@ -78,8 +83,10 @@
      *
      */
     
    -export const rotate_left = (A) => {
    +const rotate_left = (A) => {
    +	assert(A instanceof Node);
     	const B = A.right;
    +	assert(B instanceof Node);
     	const a = A.left;
     	const b = B.left;
     	const c = B.right;
    @@ -97,6 +104,8 @@
     	b.parent = B;
     	c.parent = A;
     };
    +
    +export default rotate_left;
     
    diff --git a/file/src/rotate/rotate_right.js.html b/file/src/rotate/rotate_right.js.html index 3e03a2f..cad90f8 100644 --- a/file/src/rotate/rotate_right.js.html +++ b/file/src/rotate/rotate_right.js.html @@ -29,9 +29,8 @@

    src/rotate/rotate_right.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
      * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)
      * /!\ This swaps the references to A and B.
      *
    @@ -78,8 +83,10 @@
      *
      */
     
    -export const rotate_right = (B) => {
    +const rotate_right = (B) => {
    +	assert(B instanceof Node);
     	const A = B.left;
    +	assert(A instanceof Node);
     	const a = A.left;
     	const b = A.right;
     	const c = B.right;
    @@ -97,6 +104,8 @@
     	b.parent = A;
     	c.parent = A;
     };
    +
    +export default rotate_right;
     
    diff --git a/file/src/search/index.js.html b/file/src/search/index.js.html deleted file mode 100644 index 9e9ffe9..0000000 --- a/file/src/search/index.js.html +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - src/search/index.js | @aureooms/js-red-black-tree - - - - - - - -
    - Home - Manual - Reference - Source - - -
    - - - -

    src/search/index.js

    -
    export * from './search.js';
    -
    - -
    - - - - - - - - - - - - diff --git a/file/src/search/search.js.html b/file/src/search/search.js.html index e5cfea3..8204eeb 100644 --- a/file/src/search/search.js.html +++ b/file/src/search/search.js.html @@ -29,9 +29,8 @@

    src/search/search.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
      * Search for the first node whose key equals <code>key</code>.
      *
      * @param {Function} compare - The comparison function.
      * @param {Node} root - The root of the tree to scan.
    - * @param {Key} key - The key to search for.
    + * @param {any} key - The key to search for.
      * @returns {Node}
      */
    -export const search = (compare, root, key) => {
    +const search = (compare, root, key) => {
    +	assert(root instanceof Node);
     	while (true) {
     		const d = compare(key, root.key);
     
    @@ -79,13 +85,18 @@
     			return root;
     		}
     
    -		root = d < 0 ? root.left : root.right;
    +		const child = d < 0 ? root.left : root.right;
     
    -		if (root.isLeaf()) {
    +		if (child.isLeaf()) {
     			return null;
     		}
    +
    +		assert(child instanceof Node);
    +		root = child;
     	}
     };
    +
    +export default search;
     
    diff --git a/file/src/traversal/index.js.html b/file/src/traversal/index.js.html deleted file mode 100644 index 14923dc..0000000 --- a/file/src/traversal/index.js.html +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - src/traversal/index.js | @aureooms/js-red-black-tree - - - - - - - -
    - Home - Manual - Reference - Source - - -
    - - - -

    src/traversal/index.js

    -
    export * from './inordertraversal.js';
    -export * from './rangetraversal.js';
    -
    - -
    - - - - - - - - - - - - diff --git a/file/src/traversal/inordertraversal.js.html b/file/src/traversal/inordertraversal.js.html index a9e6013..1014801 100644 --- a/file/src/traversal/inordertraversal.js.html +++ b/file/src/traversal/inordertraversal.js.html @@ -29,9 +29,8 @@

    src/traversal/inordertraversal.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
      * Traverses the tree rooted at <code>node</code> in order.
      *
      * @param {Node} node - The root of the tree.
    - * @returns {Iterator}
    + * @returns {IterableIterator}
      */
    -export function* inordertraversal(node) {
    +export default function* inordertraversal(node) {
    +	assert(node instanceof Node);
     	if (!node.left.isLeaf()) {
     		// Yield the nodes on the left recursively. Those nodes are all smaller
     		// than (or equal to) the current node by the binary search tree
     		// properties.
    +		assert(node.left instanceof Node);
     		yield* inordertraversal(node.left);
     	}
     
    @@ -84,6 +91,7 @@
     		// Yield the nodes on the right recursively. Those nodes are all larger
     		// than (or equal to) the current node by the binary search tree
     		// properties.
    +		assert(node.right instanceof Node);
     		yield* inordertraversal(node.right);
     	}
     }
    diff --git a/file/src/traversal/rangetraversal.js.html b/file/src/traversal/rangetraversal.js.html
    index c65d357..740d703 100644
    --- a/file/src/traversal/rangetraversal.js.html
    +++ b/file/src/traversal/rangetraversal.js.html
    @@ -29,9 +29,8 @@
     
     
     

    src/traversal/rangetraversal.js

    -
    /**
    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
      * Yields all the keys in the tree rooted at <code>root</code> that lie in the
      * interval <code>[left, right[</code>, in order.
      *
      * @param {Function} compare - The comparison function.
      * @param {Node} root - The root of the tree.
    - * @param {Key} left - The lower bound of the interval.
    - * @param {Key} right - The upper bound of the interval.
    - * @returns {Iterator}
    + * @param {any} left - The inclusive lower bound of the interval.
    + * @param {any} right - The non-inclusive upper bound of the interval.
    + * @returns {IterableIterator}
      */
    -export function* rangetraversal(compare, root, left, right) {
    +export default function* rangetraversal(compare, root, left, right) {
     	if (compare(root.key, left) < 0) {
     		// If the root lies to the left of the interval, we can discard the
     		// entire left subtree.
    -		if (!root.right.isLeaf())
    +		if (!root.right.isLeaf()) {
    +			assert(root.right instanceof Node);
     			yield* rangetraversal(compare, root.right, left, right);
    +		}
     	} else if (compare(root.key, right) >= 0) {
     		// If the root lies to the right of the interval, we can discard the
     		// entire right subtree.
    -		if (!root.left.isLeaf())
    +		if (!root.left.isLeaf()) {
    +			assert(root.left instanceof Node);
     			yield* rangetraversal(compare, root.left, left, right);
    +		}
     	} else {
     		// Otherwise just recurse on both subtrees and yield the root in
     		// between.
    -		if (!root.left.isLeaf())
    +		if (!root.left.isLeaf()) {
    +			assert(root.left instanceof Node);
     			yield* rangetraversal(compare, root.left, left, right);
    +		}
    +
     		yield root.key;
    -		if (!root.right.isLeaf())
    +		if (!root.right.isLeaf()) {
    +			assert(root.right instanceof Node);
     			yield* rangetraversal(compare, root.right, left, right);
    +		}
     	}
     }
     
    diff --git a/file/src/adt/Leaf.js.html b/file/src/types/Leaf.js.html similarity index 88% rename from file/src/adt/Leaf.js.html rename to file/src/types/Leaf.js.html index bb743a0..a0501c8 100644 --- a/file/src/adt/Leaf.js.html +++ b/file/src/types/Leaf.js.html @@ -3,7 +3,7 @@ - src/adt/Leaf.js | @aureooms/js-red-black-tree + src/types/Leaf.js | @aureooms/js-red-black-tree @@ -29,9 +29,8 @@ -

    src/adt/Leaf.js

    -
    import {BLACK} from '../color/BLACK.js';
    +

    src/types/Leaf.js

    +
    import assert from 'assert';
    +import BLACK from '../color/BLACK.js';
    +import Node from './Node.js';
     
     /**
      * A black leaf node.
      *
    - * @constructor
    + * @class
      * @param {Node} parent - The parent node in the tree.
    - * @returns {Leaf}
      */
    -export function Leaf(parent) {
    +export default function Leaf(parent) {
    +	assert(parent instanceof Node);
    +	/** @constant {number} The color of the node. */
     	this._color = BLACK;
    +	/** @member {Node} The parent node. */
     	this.parent = parent;
     }
     
    diff --git a/file/src/adt/Node.js.html b/file/src/types/Node.js.html
    similarity index 87%
    rename from file/src/adt/Node.js.html
    rename to file/src/types/Node.js.html
    index b3c67ca..fc7b394 100644
    --- a/file/src/adt/Node.js.html
    +++ b/file/src/types/Node.js.html
    @@ -3,7 +3,7 @@
     
       
       
    -  src/adt/Node.js | @aureooms/js-red-black-tree
    +  src/types/Node.js | @aureooms/js-red-black-tree
       
       
       
    @@ -29,9 +29,8 @@
     
     
    -

    src/adt/Node.js

    -
    import {Leaf} from './Leaf.js';
    +

    src/types/Node.js

    +
    import Leaf from './Leaf.js';
     
     /**
      * An internal node. This node can be red or black.
      *
    - * @constructor
    - * @param {Number} color - The color of the node.
    - * @param {Key} key - The key of the node.
    - * @returns {Node}
    + * @class
    + * @param {number} color - The color of the node.
    + * @param {any} key - The key of the node.
      */
    -export function Node(color, key) {
    +export default function Node(color, key) {
    +	/** @member {number} The color of the node. */
     	this._color = color;
    +	/** @member {Node|Leaf} The left child */
     	this.left = new Leaf(this);
    +	/** @member {Node|Leaf} The right child */
     	this.right = new Leaf(this);
    +	/** @member {Node} The parent node. */
     	this.parent = null;
    +	/** @member {any} The key held by this node. */
     	this.key = key;
     }
     
    diff --git a/file/src/adt/RedBlackTree.js.html b/file/src/types/RedBlackTree.js.html
    similarity index 84%
    rename from file/src/adt/RedBlackTree.js.html
    rename to file/src/types/RedBlackTree.js.html
    index c00cf7f..776d75a 100644
    --- a/file/src/adt/RedBlackTree.js.html
    +++ b/file/src/types/RedBlackTree.js.html
    @@ -3,7 +3,7 @@
     
       
       
    -  src/adt/RedBlackTree.js | @aureooms/js-red-black-tree
    +  src/types/RedBlackTree.js | @aureooms/js-red-black-tree
       
       
       
    @@ -29,9 +29,8 @@
     
     
    -

    src/adt/RedBlackTree.js

    -
    import {Node} from './Node.js';
    -import {BLACK, RED} from '../color/index.js';
    -import {predecessor} from '../family/predecessor.js';
    -import {insert, insert_case2} from '../insertion/index.js';
    -import {delete_one_child} from '../deletion/index.js';
    -import {search} from '../search/index.js';
    -import {inordertraversal, rangetraversal} from '../traversal/index.js';
    +

    src/types/RedBlackTree.js

    +
    import assert from 'assert';
    +import Node from './Node.js';
    +import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
    +import predecessor from '../family/predecessor.js';
    +import insert from '../insertion/insert.js';
    +import insert_case2 from '../insertion/insert_case2.js';
    +import delete_one_child from '../deletion/delete_one_child.js';
    +import search from '../search/search.js';
    +import inordertraversal from '../traversal/inordertraversal.js';
    +import rangetraversal from '../traversal/rangetraversal.js';
     
     /**
      * A RedBlackTree with key-only nodes.
      *
      */
    -export class RedBlackTree {
    +export default class RedBlackTree {
     	/**
     	 * Constructs a new empty red-black tree.
     	 *
     	 * @param {Function} compare - The comparison function for node keys.
    -	 * @returns {RedBlackTree}
     	 */
     	constructor(compare) {
    +		/** @member {Function} The comparison function for node keys. */
     		this.compare = compare;
    +		/** @member {Node} The root of the tree. */
     		this.root = null;
     	}
     
    @@ -99,7 +106,7 @@
     	/**
     	 * Adds a key to the tree.
     	 *
    -	 * @param {Key} key - The key to add.
    +	 * @param {any} key - The key to add.
     	 */
     	add(key) {
     		if (this.root === null) {
    @@ -116,7 +123,7 @@
     	 * Returns the first node whose key equals the input key.
     	 * If no such node exists, returns <code>null</code>.
     	 *
    -	 * @param {Key} key - The input key.
    +	 * @param {any} key - The input key.
     	 * @returns {Node}
     	 */
     	_search(key) {
    @@ -129,8 +136,8 @@
     	 * in this way (with {@link RedBlackTree#_search}. If no such key exists
     	 * in the tree, returns <code>null</code>.
     	 *
    -	 * @param {Key} key - The input key.
    -	 * @returns {Key}
    +	 * @param {any} key - The input key.
    +	 * @returns {any}
     	 */
     	get(key) {
     		const node = this._search(key);
    @@ -141,7 +148,7 @@
     	 * Returns <code>true</code> if and only if the tree contains the input
     	 * key.
     	 *
    -	 * @param {Key} key - The input key.
    +	 * @param {any} key - The input key.
     	 * @returns {Boolean}
     	 */
     	has(key) {
    @@ -167,6 +174,7 @@
     			// If there is no left child, then there can only be one right
     			// child.
     			const succ = node.right;
    +			assert(succ instanceof Node);
     			node.key = succ.key;
     			// Delete successor node
     			// note: this node can only have one non-leaf child
    @@ -185,7 +193,7 @@
     	 * (with {@link RedBlackTree#_delete}). If such a node is found and deleted
     	 * then return <code>true</code>. Return <code>false</code> otherwise.
     	 *
    -	 * @param {Key} key - The input key.
    +	 * @param {any} key - The input key.
     	 * @returns {Boolean} - Whether the key existed in the tree before removal.
     	 */
     	remove(key) {
    @@ -199,9 +207,9 @@
     	/**
     	 * Returns an in order iterator over the keys of the tree that lie in the
     	 * interval [left, right[.
    -	 * @param {Key} left - The left bound of the interval.
    -	 * @param {Key} right - The right bound of the interval.
    -	 * @returns {Iterator}
    +	 * @param {any} left - The left bound of the interval.
    +	 * @param {any} right - The right bound of the interval.
    +	 * @returns {IterableIterator}
     	 */
     	*range(left, right) {
     		if (this.root !== null)
    @@ -211,7 +219,7 @@
     	/**
     	 * Returns an in order iterator over the keys of the tree.
     	 *
    -	 * @returns {Iterator}
    +	 * @returns {IterableIterator}
     	 */
     	*items() {
     		if (this.root !== null) yield* inordertraversal(this.root);
    @@ -224,11 +232,21 @@
     		return this.items();
     	}
     
    +	/**
    +	 * Constructs an empty red-black tree.
    +	 *
    +	 * @param {Function} compare - The comparison function to use.
    +	 * @returns {RedBlackTree}
    +	 */
    +	static empty(compare) {
    +		return new RedBlackTree(compare);
    +	}
    +
     	/**
     	 * Constructs a red-black tree from an input iterable.
     	 *
     	 * @param {Function} compare - The comparison function to use.
    -	 * @param {Iterbale} iterable - The input iterable.
    +	 * @param {Iterable} iterable - The input iterable.
     	 * @returns {RedBlackTree}
     	 */
     	static from(compare, iterable) {
    diff --git a/function/index.html b/function/index.html
    index 0b44d2f..6acd50e 100644
    --- a/function/index.html
    +++ b/function/index.html
    @@ -29,9 +29,8 @@
     
    @@ -81,7 +83,7 @@
               
               
               
    -          Leaf(parent: Node): Leaf
    +          Leaf(parent: Node)
             

    @@ -110,7 +112,7 @@ - Node(color: Number, key: Key): Node + Node(color: number, key: any)

    @@ -139,7 +141,7 @@ - delete_case1(n: Node) + delete_case1(n: Node | Leaf)

    @@ -173,7 +175,7 @@ - delete_case2(n: Node) + delete_case2(n: Node | Leaf)

    @@ -208,7 +210,7 @@ - delete_case3(n: Node) + delete_case3(n: Node | Leaf)

    @@ -244,7 +246,7 @@ - delete_case4(n: Node) + delete_case4(n: Node | Leaf)

    @@ -281,7 +283,7 @@ - delete_case5(n: Node) + delete_case5(n: Node | Leaf)

    @@ -318,7 +320,7 @@ - delete_case6(n: Node) + delete_case6(n: Node | Leaf)

    @@ -414,7 +416,7 @@ * - inordertraversal(node: Node): Iterator + inordertraversal(node: Node): IterableIterator

    @@ -443,7 +445,7 @@ - insert(compare: *, A: Node, B: Node): Node + insert(compare: Function, A: Node, B: Node): Node

    @@ -663,7 +665,7 @@ * - rangetraversal(compare: Function, root: Node, left: Key, right: Key): Iterator + rangetraversal(compare: Function, root: Node, left: any, right: any): IterableIterator

    @@ -693,7 +695,7 @@ - replace_node(A: Node, B: Node) + replace_node(A: Node, B: Node | Leaf)

    @@ -780,7 +782,7 @@ - search(compare: Function, root: Node, key: Key): Node + search(compare: Function, root: Node, key: any): Node

    @@ -809,7 +811,7 @@ - sibling(node: Node): Node + sibling(node: Node | Leaf): Node | Leaf

    @@ -838,7 +840,7 @@ - uncle(node: Node): Node + uncle(node: Node): Node | Leaf

    @@ -902,15 +904,15 @@

    - Leaf(parent: Node): Leaf + Leaf(parent: Node) - source + source

    - +

    A black leaf node.

    @@ -938,19 +940,7 @@

    Params:

    -
    -

    Return:

    -
    IteratorIterableIterator
    keyKeyany

    The input key.

    keyKeyany

    The input key.

    - - - - - - -
    Leaf
    -
    -
    -
    + @@ -975,15 +965,15 @@

    - Node(color: Number, key: Key): Node + Node(color: number, key: any) - source + source

    - +

    An internal node. This node can be red or black.

    @@ -1001,14 +991,14 @@

    Params:

    color - Number + number

    The color of the node.

    key - Key + any

    The key of the node.

    @@ -1018,19 +1008,7 @@

    Params:

    -
    -

    Return:

    - - - - - - - -
    Node
    -
    -
    -
    + @@ -1055,15 +1033,15 @@

    - delete_case1(n: Node) + delete_case1(n: Node | Leaf) - source + source

    - +

    Preconditions:

    @@ -1086,7 +1064,7 @@

    Params:

    n - Node + Node | Leaf

    The input node.

    @@ -1121,15 +1099,15 @@

    - delete_case2(n: Node) + delete_case2(n: Node | Leaf) - source + source

    - +

    Preconditions:

    @@ -1153,7 +1131,7 @@

    Params:

    n - Node + Node | Leaf

    The input node.

    @@ -1188,15 +1166,15 @@

    - delete_case3(n: Node) + delete_case3(n: Node | Leaf) - source + source

    - +

    Preconditions:

    @@ -1221,7 +1199,7 @@

    Params:

    n - Node + Node | Leaf

    The input node.

    @@ -1256,15 +1234,15 @@

    - delete_case4(n: Node) + delete_case4(n: Node | Leaf) - source + source

    - +

    Preconditions:

    @@ -1290,7 +1268,7 @@

    Params:

    n - Node + Node | Leaf

    The input node.

    @@ -1325,15 +1303,15 @@

    - delete_case5(n: Node) + delete_case5(n: Node | Leaf) - source + source

    - +

    Preconditions:

    @@ -1359,7 +1337,7 @@

    Params:

    n - Node + Node | Leaf

    The input node.

    @@ -1394,15 +1372,15 @@

    - delete_case6(n: Node) + delete_case6(n: Node | Leaf) - source + source

    - +

    Preconditions:

    @@ -1429,7 +1407,7 @@

    Params:

    n - Node + Node | Leaf

    The input node.

    @@ -1468,11 +1446,11 @@

    - source + source

    - +

    Delete a node n that has at most a single non-leaf child.

    @@ -1480,6 +1458,7 @@

    • n has at most one non-leaf child.
    • if n has a non-leaf child, then it is its left child.
    • +
    • hence, n's right child is a leaf

    @@ -1534,11 +1513,11 @@

    - source + source

    - +

    Computes the grandparent (parent of parent) of the input node.

    @@ -1603,15 +1582,15 @@

    * - inordertraversal(node: Node): Iterator + inordertraversal(node: Node): IterableIterator - source + source

    - +

    Traverses the tree rooted at node in order.

    @@ -1644,7 +1623,7 @@

    Return:

    - + @@ -1676,15 +1655,15 @@

    - insert(compare: *, A: Node, B: Node): Node + insert(compare: Function, A: Node, B: Node): Node - source + source

    - +

    Walks the tree rooted at A down the only path that satisfies @@ -1710,7 +1689,7 @@

    Params:

    - + @@ -1776,16 +1755,17 @@

    - source + source

    - +

    Preconditions:

    • n is red.
    • +
    • n's children are BLACK
    @@ -1840,16 +1820,17 @@

    - source + source

    - +

    Preconditions:

    • n is red.
    • +
    • n's children are BLACK
    • n is not the root of the tree.
    @@ -1905,16 +1886,17 @@

    - source + source

    - +

    Preconditions:

    • n is red.
    • +
    • n's children are BLACK
    • n is not the root of the tree.
    • n's parent is red.
    @@ -1971,16 +1953,17 @@

    - source + source

    - +

    Preconditions:

    - + - - + - @@ -2240,7 +2224,7 @@

    Return:

    IteratorIterableIterator
    compare*Function

    The comparison function to use.

    leftKeyany

    The lower bound of the interval.

    +

    The inclusive lower bound of the interval.

    rightKeyany

    The upper bound of the interval.

    +

    The non-inclusive upper bound of the interval.

    - + @@ -2272,15 +2256,15 @@

    - replace_node(A: Node, B: Node) + replace_node(A: Node, B: Node | Leaf) - source + source

    - +

    Replaces node A by node B.

    @@ -2305,7 +2289,7 @@

    Params:

    - + @@ -2344,11 +2328,11 @@

    - source + source

    - +

    Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation) @@ -2411,11 +2395,11 @@

    - source + source

    - +

    Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation) @@ -2474,15 +2458,15 @@

    - +

    Search for the first node whose key equals key.

    @@ -2514,7 +2498,7 @@

    Params:

    - + @@ -2561,15 +2545,15 @@

    - sibling(node: Node): Node + sibling(node: Node | Leaf): Node | Leaf - source + source

    - +

    Computes the sibling of the input node.

    @@ -2587,7 +2571,7 @@

    Params:

    - + @@ -2602,7 +2586,7 @@

    Return:

    IteratorIterableIterator
    BNodeNode | Leaf

    The replacement node.

    keyKeyany

    The key to search for.

    nodeNodeNode | Leaf

    The input node.

    - + @@ -2634,15 +2618,15 @@

    - uncle(node: Node): Node + uncle(node: Node): Node | Leaf - source + source

    - +

    Computes the uncle of the input node when the grandparent is guaranteed to @@ -2676,7 +2660,7 @@

    Return:

    NodeNode | Leaf
    - + @@ -2714,11 +2698,11 @@

    - source + source

    - +

    Builds a debug function from color handlers.

    diff --git a/identifiers.html b/identifiers.html index e73aab8..ba01726 100644 --- a/identifiers.html +++ b/identifiers.html @@ -29,9 +29,8 @@ @@ -68,7 +70,7 @@
    -

    adt

    +

    api

    NodeNode | Leaf
    @@ -84,45 +86,16 @@

    adt

    - - - - - @@ -142,16 +115,16 @@

    adt

    @@ -291,7 +264,7 @@

    deletion

    F - delete_case1(n: Node) + delete_case1(n: Node | Leaf)

    @@ -325,7 +298,7 @@

    deletion

    F - delete_case2(n: Node) + delete_case2(n: Node | Leaf)

    @@ -360,7 +333,7 @@

    deletion

    F - delete_case3(n: Node) + delete_case3(n: Node | Leaf)

    @@ -396,7 +369,7 @@

    deletion

    F - delete_case4(n: Node) + delete_case4(n: Node | Leaf)

    @@ -433,7 +406,7 @@

    deletion

    F - delete_case5(n: Node) + delete_case5(n: Node | Leaf)

    @@ -470,7 +443,7 @@

    deletion

    F - delete_case6(n: Node) + delete_case6(n: Node | Leaf)

    @@ -537,7 +510,7 @@

    deletion

    F - replace_node(A: Node, B: Node) + replace_node(A: Node, B: Node | Leaf)

    @@ -635,7 +608,7 @@

    family

    F - sibling(node: Node): Node + sibling(node: Node | Leaf): Node | Leaf

    @@ -664,7 +637,7 @@

    family

    F - uncle(node: Node): Node + uncle(node: Node): Node | Leaf

    @@ -704,7 +677,7 @@

    insertion

    F - insert(compare: *, A: Node, B: Node): Node + insert(compare: Function, A: Node, B: Node): Node

    @@ -972,7 +945,7 @@ F - search(compare: Function, root: Node, key: Key): Node + search(compare: Function, root: Node, key: any): Node

    @@ -1011,7 +984,7 @@

    traversal

    F * - inordertraversal(node: Node): Iterator + inordertraversal(node: Node): IterableIterator

    @@ -1040,7 +1013,7 @@

    traversal

    F * - rangetraversal(compare: Function, root: Node, left: Key, right: Key): Iterator + rangetraversal(compare: Function, root: Node, left: any, right: any): IterableIterator

    @@ -1054,6 +1027,103 @@

    traversal

    + + +
    summary

    - C - - - RedBlackTree -

    -
    -
    - - -

    A RedBlackTree with key-only nodes.

    -
    -
    -
    - - -
    - public - - - - - -
    -

    - F + V - Leaf(parent: Node): Leaf + empty: *

    -

    A black leaf node.

    +

    - F + V - Node(color: Number, key: Key): Node + from: *

    -

    An internal node.

    +
    +
    +
    +
    +
    +

    types

    +
    + + + + + + + + + + + + + + + + + @@ -1064,7 +1134,7 @@

    traversal

    Directories
    -
    +
    @@ -1072,7 +1142,8 @@

    traversal

    -
    + +
    diff --git a/index.html b/index.html index dca9bfd..967f8af 100644 --- a/index.html +++ b/index.html @@ -29,9 +29,8 @@ -

    :christmas_tree: @aureooms/js-red-black-tree

    -
    let tree = RedBlackTree.from( increasing , range( 100000 ) ) ;
    +

    :christmas_tree: @aureooms/js-red-black-tree

    + +

    + +

    +
    import {from} from '@aureooms/js-red-black-tree';
    +import {increasing} from '@aureooms/js-compare';
    +import {range} from '@aureooms/js-itertools';
    +let tree = from( increasing , range( 100000 ) ) ;
     

    Red-black tree library for JavaScript. See documentation. diff --git a/index.json b/index.json index a5c5d17..bc64ee5 100644 --- a/index.json +++ b/index.json @@ -566,844 +566,794 @@ { "__docId__": 48, "kind": "file", - "name": "src/adt/Leaf.js", - "content": "import {BLACK} from '../color/BLACK.js';\n\n/**\n * A black leaf node.\n *\n * @constructor\n * @param {Node} parent - The parent node in the tree.\n * @returns {Leaf}\n */\nexport function Leaf(parent) {\n\tthis._color = BLACK;\n\tthis.parent = parent;\n}\n\n/**\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n */\nLeaf.prototype.isLeaf = function () {\n\treturn true;\n};\n", + "name": "src/api/empty.js", + "content": "import RedBlackTree from '../types/RedBlackTree.js';\n\n/**\n * Same as {@link RedBlackTree.empty}.\n * @function empty\n */\nconst empty = RedBlackTree.empty;\nexport default empty;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/adt/Leaf.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/api/empty.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 49, - "kind": "function", - "name": "Leaf", - "memberof": "src/adt/Leaf.js", - "generator": false, - "async": false, + "kind": "variable", + "name": "empty", + "memberof": "src/api/empty.js", "static": true, - "longname": "src/adt/Leaf.js~Leaf", + "longname": "src/api/empty.js~empty", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/adt/Leaf.js", - "importStyle": "{Leaf}", - "description": "A black leaf node.", - "lineNumber": 10, + "importPath": "@aureooms/js-red-black-tree/src/api/empty.js", + "importStyle": "empty", + "description": "Same as {@link RedBlackTree.empty}.", + "lineNumber": 7, "unknown": [ { - "tagName": "@constructor", - "tagValue": "" - }, - { - "tagName": "@returns", - "tagValue": "{Leaf}" + "tagName": "@function", + "tagValue": "empty" } ], - "params": [ - { - "nullable": null, - "types": [ - "Node" - ], - "spread": false, - "optional": false, - "name": "parent", - "description": "The parent node in the tree." - } - ], - "return": { - "nullable": null, + "type": { "types": [ - "Leaf" - ], - "spread": false, - "description": "" + "*" + ] } }, { "__docId__": 50, - "kind": "function", - "name": "isLeaf", - "memberof": "src/adt/Leaf.js", - "generator": false, - "async": false, - "static": true, - "longname": "src/adt/Leaf.js~isLeaf", - "access": "public", - "export": false, - "importPath": "@aureooms/js-red-black-tree/src/adt/Leaf.js", - "importStyle": null, - "description": "Returns true if the Leaf object is a leaf. This\nalways returns true.", - "lineNumber": 21, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Boolean}" - } - ], - "return": { - "nullable": null, - "types": [ - "Boolean" - ], - "spread": false, - "description": "" - }, - "params": [], - "ignore": true - }, - { - "__docId__": 51, "kind": "file", - "name": "src/adt/Node.js", - "content": "import {Leaf} from './Leaf.js';\n\n/**\n * An internal node. This node can be red or black.\n *\n * @constructor\n * @param {Number} color - The color of the node.\n * @param {Key} key - The key of the node.\n * @returns {Node}\n */\nexport function Node(color, key) {\n\tthis._color = color;\n\tthis.left = new Leaf(this);\n\tthis.right = new Leaf(this);\n\tthis.parent = null;\n\tthis.key = key;\n}\n\n/**\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n */\nNode.prototype.isLeaf = function () {\n\treturn false;\n};\n", + "name": "src/api/from.js", + "content": "import RedBlackTree from '../types/RedBlackTree.js';\n\n/**\n * Same as {@link RedBlackTree.from}.\n * @function from\n */\nconst from = RedBlackTree.from;\nexport default from;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/adt/Node.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/api/from.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 52, - "kind": "function", - "name": "Node", - "memberof": "src/adt/Node.js", - "generator": false, - "async": false, + "__docId__": 51, + "kind": "variable", + "name": "from", + "memberof": "src/api/from.js", "static": true, - "longname": "src/adt/Node.js~Node", + "longname": "src/api/from.js~from", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/adt/Node.js", - "importStyle": "{Node}", - "description": "An internal node. This node can be red or black.", - "lineNumber": 11, + "importPath": "@aureooms/js-red-black-tree/src/api/from.js", + "importStyle": "from", + "description": "Same as {@link RedBlackTree.from}.", + "lineNumber": 7, "unknown": [ { - "tagName": "@constructor", - "tagValue": "" - }, - { - "tagName": "@returns", - "tagValue": "{Node}" - } - ], - "params": [ - { - "nullable": null, - "types": [ - "Number" - ], - "spread": false, - "optional": false, - "name": "color", - "description": "The color of the node." - }, - { - "nullable": null, - "types": [ - "Key" - ], - "spread": false, - "optional": false, - "name": "key", - "description": "The key of the node." + "tagName": "@function", + "tagValue": "from" } ], - "return": { - "nullable": null, + "type": { "types": [ - "Node" - ], - "spread": false, - "description": "" + "*" + ] } }, + { + "__docId__": 52, + "kind": "file", + "name": "src/color/BLACK.js", + "content": "/**\n * Constant for black.\n */\nconst BLACK = 0;\nexport default BLACK;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/color/BLACK.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, { "__docId__": 53, - "kind": "function", - "name": "isLeaf", - "memberof": "src/adt/Node.js", - "generator": false, - "async": false, + "kind": "variable", + "name": "BLACK", + "memberof": "src/color/BLACK.js", "static": true, - "longname": "src/adt/Node.js~isLeaf", + "longname": "src/color/BLACK.js~BLACK", "access": "public", - "export": false, - "importPath": "@aureooms/js-red-black-tree/src/adt/Node.js", - "importStyle": null, - "description": "Returns true if the Node object is a leaf. This\nalways returns false.", - "lineNumber": 25, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Boolean}" - } - ], - "return": { - "nullable": null, + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/color/BLACK.js", + "importStyle": "BLACK", + "description": "Constant for black.", + "lineNumber": 4, + "type": { "types": [ - "Boolean" - ], - "spread": false, - "description": "" - }, - "params": [], - "ignore": true + "number" + ] + } }, { "__docId__": 54, "kind": "file", - "name": "src/adt/RedBlackTree.js", - "content": "import {Node} from './Node.js';\nimport {BLACK, RED} from '../color/index.js';\nimport {predecessor} from '../family/predecessor.js';\nimport {insert, insert_case2} from '../insertion/index.js';\nimport {delete_one_child} from '../deletion/index.js';\nimport {search} from '../search/index.js';\nimport {inordertraversal, rangetraversal} from '../traversal/index.js';\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport class RedBlackTree {\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t * @returns {RedBlackTree}\n\t */\n\tconstructor(compare) {\n\t\tthis.compare = compare;\n\t\tthis.root = null;\n\t}\n\n\t/**\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t */\n\tisEmpty() {\n\t\treturn this.root === null;\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {Key} key - The key to add.\n\t */\n\tadd(key) {\n\t\tif (this.root === null) {\n\t\t\tthis.root = new Node(BLACK, key);\n\t\t} else {\n\t\t\tconst node = new Node(RED, key);\n\t\t\tinsert(this.compare, this.root, node);\n\t\t\tinsert_case2(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search(key) {\n\t\tif (this.root === null) return null;\n\t\treturn search(this.compare, this.root, key);\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Key}\n\t */\n\tget(key) {\n\t\tconst node = this._search(key);\n\t\treturn node === null ? null : node.key;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean}\n\t */\n\thas(key) {\n\t\treturn this._search(key) !== null;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\t_delete(node) {\n\t\tif (!node.left.isLeaf()) {\n\t\t\t// Replace node's key with predecessor's key\n\t\t\tconst pred = predecessor(node);\n\t\t\tnode.key = pred.key;\n\t\t\t// Delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(pred);\n\t\t} else if (!node.right.isLeaf()) {\n\t\t\t// Replace node's key with successor's key\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right;\n\t\t\tnode.key = succ.key;\n\t\t\t// Delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(succ);\n\t\t} else if (node === this.root) {\n\t\t\tthis.root = null;\n\t\t} else {\n\t\t\tdelete_one_child(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {Key} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove(key) {\n\t\tconst node = this._search(key);\n\t\tif (node === null) return false;\n\n\t\tthis._delete(node);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {Key} left - The left bound of the interval.\n\t * @param {Key} right - The right bound of the interval.\n\t * @returns {Iterator}\n\t */\n\t*range(left, right) {\n\t\tif (this.root !== null)\n\t\t\tyield* rangetraversal(this.compare, this.root, left, right);\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {Iterator}\n\t */\n\t*items() {\n\t\tif (this.root !== null) yield* inordertraversal(this.root);\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator]() {\n\t\treturn this.items();\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterbale} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from(compare, iterable) {\n\t\tconst tree = new RedBlackTree(compare);\n\n\t\tfor (const element of iterable) tree.add(element);\n\n\t\treturn tree;\n\t}\n}\n", + "name": "src/color/RED.js", + "content": "/**\n * Constant for red.\n */\nconst RED = 1;\nexport default RED;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/adt/RedBlackTree.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/color/RED.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 55, - "kind": "class", - "name": "RedBlackTree", - "memberof": "src/adt/RedBlackTree.js", + "kind": "variable", + "name": "RED", + "memberof": "src/color/RED.js", "static": true, - "longname": "src/adt/RedBlackTree.js~RedBlackTree", + "longname": "src/color/RED.js~RED", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/adt/RedBlackTree.js", - "importStyle": "{RedBlackTree}", - "description": "A RedBlackTree with key-only nodes.", - "lineNumber": 13, - "interface": false + "importPath": "@aureooms/js-red-black-tree/src/color/RED.js", + "importStyle": "RED", + "description": "Constant for red.", + "lineNumber": 4, + "type": { + "types": [ + "number" + ] + } }, { "__docId__": 56, - "kind": "constructor", - "name": "constructor", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "kind": "file", + "name": "src/debug/_debug.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport BLACK from '../color/BLACK.js';\n\n/**\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n */\nconst _debug = ({red, black}) => {\n\t/**\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t */\n\tconst debug = (root) => {\n\t\tassert(root instanceof Node || root instanceof Leaf);\n\t\tif (root.isLeaf()) {\n\t\t\tassert(root instanceof Leaf);\n\t\t\treturn black('L');\n\t\t}\n\n\t\tassert(root instanceof Node);\n\n\t\tconst repr = root._color === BLACK ? black(root.key) : red(root.key);\n\n\t\treturn `(${debug(root.left)}, ${repr}, ${debug(root.right)})`;\n\t};\n\n\treturn debug;\n};\n\nexport default _debug;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/debug/_debug.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 57, + "kind": "function", + "name": "_debug", + "memberof": "src/debug/_debug.js", "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#constructor", - "access": "public", - "description": "Constructs a new empty red-black tree.", - "lineNumber": 20, + "static": true, + "longname": "src/debug/_debug.js~_debug", + "access": "private", + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/debug/_debug.js", + "importStyle": "_debug", + "description": "Builds a debug function from color handlers.", + "lineNumber": 12, "unknown": [ { "tagName": "@returns", - "tagValue": "{RedBlackTree}" + "tagValue": "{Function} The debug function." } ], "params": [ { "nullable": null, "types": [ - "Function" + "Object" ], "spread": false, "optional": false, - "name": "compare", - "description": "The comparison function for node keys." + "name": "colors", + "description": "The colors to use." } ], "return": { "nullable": null, "types": [ - "RedBlackTree" + "Function" ], "spread": false, - "description": "" - } - }, - { - "__docId__": 57, - "kind": "member", - "name": "compare", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#compare", - "access": "public", - "description": null, - "lineNumber": 21, - "undocument": true, - "type": { - "types": [ - "*" - ] + "description": "The debug function." } }, { "__docId__": 58, - "kind": "member", - "name": "root", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#root", + "kind": "file", + "name": "src/deletion/delete_case1.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport delete_case2 from './delete_case2.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case1 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\t// If n is the root, there is nothing to do:\n\t// - all paths go through n, and\n\t// - n is black.\n\tif (n.parent !== null) delete_case2(n);\n};\n\nexport default delete_case1;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case1.js", "access": "public", "description": null, - "lineNumber": 22, - "undocument": true, - "type": { - "types": [ - "*" - ] - } + "lineNumber": 1 }, { "__docId__": 59, - "kind": "method", - "name": "isEmpty", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "kind": "function", + "name": "delete_case1", + "memberof": "src/deletion/delete_case1.js", "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#isEmpty", + "static": true, + "longname": "src/deletion/delete_case1.js~delete_case1", "access": "public", - "description": "Tells whether the tree is empty.", - "lineNumber": 30, - "unknown": [ + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case1.js", + "importStyle": "delete_case1", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b", + "lineNumber": 15, + "params": [ { - "tagName": "@returns", - "tagValue": "{boolean} true if empty, false otherwise." + "nullable": null, + "types": [ + "Node", + "Leaf" + ], + "spread": false, + "optional": false, + "name": "n", + "description": "The input node." } ], - "return": { - "nullable": null, - "types": [ - "boolean" - ], - "spread": false, - "description": "true if empty, false otherwise." - }, - "params": [] + "return": null }, { "__docId__": 60, - "kind": "method", - "name": "add", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "kind": "file", + "name": "src/deletion/delete_case2.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case3 from './delete_case3.js';\nimport delete_case4 from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case2 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t */\n\tif (s._color === RED) {\n\t\tn.parent._color = RED;\n\t\ts._color = BLACK;\n\t\tif (n === n.parent.left) rotate_left(n.parent);\n\t\telse rotate_right(n.parent);\n\t\tdelete_case4(n);\n\t}\n\n\t// Otherwise, go to case 3.\n\telse delete_case3(n);\n};\n\nexport default delete_case2;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case2.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 61, + "kind": "function", + "name": "delete_case2", + "memberof": "src/deletion/delete_case2.js", "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#add", + "static": true, + "longname": "src/deletion/delete_case2.js~delete_case2", "access": "public", - "description": "Adds a key to the tree.", - "lineNumber": 39, + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case2.js", + "importStyle": "delete_case2", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root", + "lineNumber": 22, "params": [ { "nullable": null, "types": [ - "Key" + "Node", + "Leaf" ], "spread": false, "optional": false, - "name": "key", - "description": "The key to add." + "name": "n", + "description": "The input node." } ], "return": null }, { "__docId__": 62, - "kind": "method", - "name": "_search", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "kind": "file", + "name": "src/deletion/delete_case3.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case1 from './delete_case1.js';\nimport delete_case4 from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case3 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\tn.parent._color === BLACK &&\n\t\ts.left._color === BLACK &&\n\t\ts.right._color === BLACK\n\t) {\n\t\ts._color = RED;\n\t\tdelete_case1(n.parent);\n\t}\n\n\t// Otherwise, go to case 4.\n\telse delete_case4(n);\n};\n\nexport default delete_case3;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case3.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 63, + "kind": "function", + "name": "delete_case3", + "memberof": "src/deletion/delete_case3.js", "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#_search", - "access": "private", - "description": "Search for the input key in the tree.\nReturns the first node whose key equals the input key.\nIf no such node exists, returns null.", - "lineNumber": 57, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Node}" - } - ], + "static": true, + "longname": "src/deletion/delete_case3.js~delete_case3", + "access": "public", + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case3.js", + "importStyle": "delete_case3", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black", + "lineNumber": 21, "params": [ { "nullable": null, "types": [ - "Key" + "Node", + "Leaf" ], "spread": false, "optional": false, - "name": "key", - "description": "The input key." + "name": "n", + "description": "The input node." } ], - "return": { - "nullable": null, - "types": [ - "Node" - ], - "spread": false, - "description": "" - } + "return": null }, { - "__docId__": 63, - "kind": "method", - "name": "get", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "__docId__": 64, + "kind": "file", + "name": "src/deletion/delete_case4.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case5 from './delete_case5.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case4 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\tassert(\n\t\tn.parent._color === RED || s.left._color === RED || s.right._color === RED,\n\t);\n\n\t/**\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\t// The parent color test is always true when coming from case 2\n\t\tn.parent._color === RED &&\n\t\ts.left._color === BLACK &&\n\t\ts.right._color === BLACK\n\t) {\n\t\ts._color = RED;\n\t\tn.parent._color = BLACK;\n\t}\n\n\t// Otherwise, go to case 5.\n\telse delete_case5(n);\n};\n\nexport default delete_case4;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case4.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 65, + "kind": "function", + "name": "delete_case4", + "memberof": "src/deletion/delete_case4.js", "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#get", + "static": true, + "longname": "src/deletion/delete_case4.js~delete_case4", "access": "public", - "description": "Search for the input key in the tree. Returns the first node key found\nin this way (with {@link RedBlackTree#_search}. If no such key exists\nin the tree, returns null.", - "lineNumber": 70, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Key}" - } - ], + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case4.js", + "importStyle": "delete_case4", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - n's parent and n's sibling's children cannot all be black", + "lineNumber": 21, "params": [ { "nullable": null, "types": [ - "Key" + "Node", + "Leaf" ], "spread": false, "optional": false, - "name": "key", - "description": "The input key." + "name": "n", + "description": "The input node." } ], - "return": { - "nullable": null, - "types": [ - "Key" - ], - "spread": false, - "description": "" - } + "return": null }, { - "__docId__": 64, - "kind": "method", - "name": "has", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "__docId__": 66, + "kind": "file", + "name": "src/deletion/delete_case5.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case6 from './delete_case6.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case5 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\tassert(s.left._color === RED || s.right._color === RED);\n\n\t// The following statements just force the red n's sibling child to be on\n\t// the left of the left of the parent, or right of the right, so case 6\n\t// will rotate correctly.\n\n\t/**\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t */\n\tif (n === n.parent.left && s.right._color === BLACK) {\n\t\ts._color = RED;\n\t\ts.left._color = BLACK;\n\t\trotate_right(s);\n\t} else if (n === n.parent.right && s.left._color === BLACK) {\n\t\t/**\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t */\n\t\ts._color = RED;\n\t\ts.right._color = BLACK;\n\t\trotate_left(s);\n\t}\n\n\tdelete_case6(n);\n};\n\nexport default delete_case5;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case5.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 67, + "kind": "function", + "name": "delete_case5", + "memberof": "src/deletion/delete_case5.js", "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#has", + "static": true, + "longname": "src/deletion/delete_case5.js~delete_case5", "access": "public", - "description": "Returns true if and only if the tree contains the input\nkey.", - "lineNumber": 82, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Boolean}" - } - ], + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case5.js", + "importStyle": "delete_case5", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - at least one of n's sibling's children is red", + "lineNumber": 23, "params": [ { "nullable": null, "types": [ - "Key" + "Node", + "Leaf" ], "spread": false, "optional": false, - "name": "key", - "description": "The input key." + "name": "n", + "description": "The input node." } ], - "return": { - "nullable": null, - "types": [ - "Boolean" - ], - "spread": false, - "description": "" - } + "return": null + }, + { + "__docId__": 68, + "kind": "file", + "name": "src/deletion/delete_case6.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case6 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n\ts._color = n.parent._color;\n\tn.parent._color = BLACK;\n\n\tif (n === n.parent.left) {\n\t\tassert(s.right._color === RED);\n\t\ts.right._color = BLACK;\n\t\trotate_left(n.parent);\n\t}\n\n\t// Symmetric case\n\telse {\n\t\tassert(s.left._color === RED);\n\t\ts.left._color = BLACK;\n\t\trotate_right(n.parent);\n\t}\n};\n\nexport default delete_case6;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case6.js", + "access": "public", + "description": null, + "lineNumber": 1 }, { - "__docId__": 65, - "kind": "method", - "name": "_delete", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "__docId__": 69, + "kind": "function", + "name": "delete_case6", + "memberof": "src/deletion/delete_case6.js", "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#_delete", - "access": "private", - "description": "Deletes the input node from the tree.", - "lineNumber": 91, + "static": true, + "longname": "src/deletion/delete_case6.js~delete_case6", + "access": "public", + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case6.js", + "importStyle": "delete_case6", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - if n is a left child, the right child of n's sibling is red\n - if n is a right child, the left child of n's sibling is red", + "lineNumber": 22, "params": [ { "nullable": null, "types": [ - "Node" + "Node", + "Leaf" ], "spread": false, "optional": false, - "name": "node", - "description": "The input node to delete." + "name": "n", + "description": "The input node." } ], "return": null }, { - "__docId__": 67, - "kind": "method", - "name": "remove", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "__docId__": 70, + "kind": "file", + "name": "src/deletion/delete_one_child.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\n\nimport replace_node from './replace_node.js';\nimport delete_case1 from './delete_case1.js';\n\n/**\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n */\nconst delete_one_child = (n) => {\n\tassert(n instanceof Node);\n\t// Precondition: n's right child is a leaf.\n\t// The right child of n is always a LEAF because either n is a subtree\n\t// predecessor or it is the only child of its parent by the red-black tree\n\t// properties\n\tassert(n.right instanceof Leaf);\n\n\tconst child = n.left;\n\n\t// Replace n with its left child\n\treplace_node(n, child);\n\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1.\n\tif (n._color === BLACK) {\n\t\t// We can easily fix this when its left child is an\n\t\t// internal red node: change the color of the left child to black and\n\t\t// replace n with it.\n\t\tif (child._color === RED) child._color = BLACK;\n\t\t// Otherwise, there are more things to fix.\n\t\telse {\n\t\t\tdelete_case1(child);\n\t\t}\n\t} else {\n\t\t// If n is red then its child can only be black. Replacing n with its\n\t\t// child suffices. This is a NO-OP.\n\t\tassert(child._color === BLACK);\n\t}\n};\n\nexport default delete_one_child;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_one_child.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 71, + "kind": "function", + "name": "delete_one_child", + "memberof": "src/deletion/delete_one_child.js", "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#remove", + "static": true, + "longname": "src/deletion/delete_one_child.js~delete_one_child", "access": "public", - "description": "Search for the first node of the tree whose key equals the input key\n(with {@link RedBlackTree#_search}), then delete that node\n(with {@link RedBlackTree#_delete}). If such a node is found and deleted\nthen return true. Return false otherwise.", - "lineNumber": 126, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Boolean} - Whether the key existed in the tree before removal." - } - ], + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_one_child.js", + "importStyle": "delete_one_child", + "description": "Delete a node n that has at most a single non-leaf child.\n\nPrecondition:\n - n has at most one non-leaf child.\n - if n has a non-leaf child, then it is its left child.\n - hence, n's right child is a leaf", + "lineNumber": 20, "params": [ { "nullable": null, "types": [ - "Key" + "Node" ], "spread": false, "optional": false, - "name": "key", - "description": "The input key." + "name": "n", + "description": "The node to delete." } ], - "return": { - "nullable": null, - "types": [ - "Boolean" - ], - "spread": false, - "description": "Whether the key existed in the tree before removal." - } + "return": null }, { - "__docId__": 68, - "kind": "method", - "name": "range", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", - "generator": true, + "__docId__": 72, + "kind": "file", + "name": "src/deletion/replace_node.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\n\n/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n */\nconst replace_node = (A, B) => {\n\tassert(A instanceof Node);\n\tassert(B instanceof Node || B instanceof Leaf);\n\t// We never apply delete_one_child on the root\n\tassert(A.parent !== null);\n\n\tif (A === A.parent.left) A.parent.left = B;\n\telse A.parent.right = B;\n\n\tB.parent = A.parent;\n};\n\nexport default replace_node;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/replace_node.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 73, + "kind": "function", + "name": "replace_node", + "memberof": "src/deletion/replace_node.js", + "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#range", + "static": true, + "longname": "src/deletion/replace_node.js~replace_node", "access": "public", - "description": "Returns an in order iterator over the keys of the tree that lie in the\ninterval [left, right[.", - "lineNumber": 141, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Iterator}" - } - ], + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/deletion/replace_node.js", + "importStyle": "replace_node", + "description": "Replaces node A by node B.", + "lineNumber": 11, "params": [ { "nullable": null, "types": [ - "Key" + "Node" ], "spread": false, "optional": false, - "name": "left", - "description": "The left bound of the interval." + "name": "A", + "description": "The node to replace." }, { "nullable": null, "types": [ - "Key" + "Node", + "Leaf" ], "spread": false, "optional": false, - "name": "right", - "description": "The right bound of the interval." + "name": "B", + "description": "The replacement node." } ], - "return": { - "nullable": null, - "types": [ - "Iterator" - ], - "spread": false, - "description": "" - } + "return": null }, { - "__docId__": 69, - "kind": "method", - "name": "items", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", - "generator": true, + "__docId__": 74, + "kind": "file", + "name": "src/family/grandparent.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nconst grandparent = (node) => {\n\tassert(node instanceof Node);\n\t// We only call this function when node HAS a grandparent\n\tassert(node.parent !== null);\n\tassert(node.parent.parent !== null);\n\treturn node.parent.parent;\n};\n\nexport default grandparent;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/grandparent.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 75, + "kind": "function", + "name": "grandparent", + "memberof": "src/family/grandparent.js", + "generator": false, "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#items", + "static": true, + "longname": "src/family/grandparent.js~grandparent", "access": "public", - "description": "Returns an in order iterator over the keys of the tree.", - "lineNumber": 151, + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/family/grandparent.js", + "importStyle": "grandparent", + "description": "Computes the grandparent (parent of parent) of the input node.", + "lineNumber": 10, "unknown": [ { "tagName": "@returns", - "tagValue": "{Iterator}" + "tagValue": "{Node}" + } + ], + "params": [ + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "node", + "description": "The input node." } ], "return": { "nullable": null, "types": [ - "Iterator" + "Node" ], "spread": false, "description": "" - }, - "params": [] + } }, { - "__docId__": 70, - "kind": "method", - "name": "[Symbol.iterator]", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", - "generator": false, - "async": false, - "static": false, - "longname": "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", + "__docId__": 76, + "kind": "file", + "name": "src/family/predecessor.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nconst predecessor = (node) => {\n\tassert(node.left instanceof Node);\n\tlet pred = node.left;\n\n\twhile (!pred.right.isLeaf()) {\n\t\tassert(pred.right instanceof Node);\n\t\tpred = pred.right;\n\t}\n\n\treturn pred;\n};\n\nexport default predecessor;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/predecessor.js", "access": "public", - "description": "Same as {@link RedBlackTree#items}.", - "lineNumber": 158, - "params": [], - "return": { - "types": [ - "*" - ] - } + "description": null, + "lineNumber": 1 }, { - "__docId__": 71, - "kind": "method", - "name": "from", - "memberof": "src/adt/RedBlackTree.js~RedBlackTree", + "__docId__": 77, + "kind": "function", + "name": "predecessor", + "memberof": "src/family/predecessor.js", "generator": false, "async": false, "static": true, - "longname": "src/adt/RedBlackTree.js~RedBlackTree.from", + "longname": "src/family/predecessor.js~predecessor", "access": "public", - "description": "Constructs a red-black tree from an input iterable.", - "lineNumber": 169, + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/family/predecessor.js", + "importStyle": "predecessor", + "description": "Computes the predecessor of the input node, in the subtree rooted at the\ninput node, when this predecessor is guaranteed to exist.", + "lineNumber": 11, "unknown": [ { "tagName": "@returns", - "tagValue": "{RedBlackTree}" + "tagValue": "{Node}" } ], "params": [ { "nullable": null, "types": [ - "Function" - ], - "spread": false, - "optional": false, - "name": "compare", - "description": "The comparison function to use." - }, - { - "nullable": null, - "types": [ - "Iterbale" + "Node" ], "spread": false, "optional": false, - "name": "iterable", - "description": "The input iterable." + "name": "node", + "description": "The input node." } ], "return": { "nullable": null, "types": [ - "RedBlackTree" + "Node" ], "spread": false, "description": "" } }, { - "__docId__": 72, - "kind": "file", - "name": "src/adt/index.js", - "content": "export * from './Leaf.js';\nexport * from './Node.js';\nexport * from './RedBlackTree.js';\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/adt/index.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 73, - "kind": "file", - "name": "src/color/BLACK.js", - "content": "/**\n * Constant for black.\n */\nexport const BLACK = 0;\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/color/BLACK.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 74, - "kind": "variable", - "name": "BLACK", - "memberof": "src/color/BLACK.js", - "static": true, - "longname": "src/color/BLACK.js~BLACK", - "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/color/BLACK.js", - "importStyle": "{BLACK}", - "description": "Constant for black.", - "lineNumber": 4, - "type": { - "types": [ - "number" - ] - } - }, - { - "__docId__": 75, + "__docId__": 78, "kind": "file", - "name": "src/color/RED.js", - "content": "/**\n * Constant for red.\n */\nexport const RED = 1;\n", + "name": "src/family/sibling.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\n\n/**\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n */\nconst sibling = (node) => {\n\tassert(node instanceof Node || node instanceof Leaf);\n\t// We only use this function when node HAS a sibling.\n\tassert(node.parent !== null);\n\n\treturn node === node.parent.left ? node.parent.right : node.parent.left;\n};\n\nexport default sibling;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/color/RED.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/sibling.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 76, - "kind": "variable", - "name": "RED", - "memberof": "src/color/RED.js", + "__docId__": 79, + "kind": "function", + "name": "sibling", + "memberof": "src/family/sibling.js", + "generator": false, + "async": false, "static": true, - "longname": "src/color/RED.js~RED", + "longname": "src/family/sibling.js~sibling", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/color/RED.js", - "importStyle": "{RED}", - "description": "Constant for red.", - "lineNumber": 4, - "type": { + "importPath": "@aureooms/js-red-black-tree/src/family/sibling.js", + "importStyle": "sibling", + "description": "Computes the sibling of the input node.", + "lineNumber": 11, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node|Leaf}" + } + ], + "params": [ + { + "nullable": null, + "types": [ + "Node", + "Leaf" + ], + "spread": false, + "optional": false, + "name": "node", + "description": "The input node." + } + ], + "return": { + "nullable": null, "types": [ - "number" - ] + "Node", + "Leaf" + ], + "spread": false, + "description": "" } }, { - "__docId__": 77, - "kind": "file", - "name": "src/color/index.js", - "content": "export * from './BLACK.js';\nexport * from './RED.js';\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/color/index.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 78, + "__docId__": 80, "kind": "file", - "name": "src/debug/debug.js", - "content": "import {BLACK} from '../color/BLACK.js';\n\n/**\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n */\nexport const _debug = ({red, black}) => {\n\t/**\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t */\n\tconst debug = (root) => {\n\t\tif (root.isLeaf()) return black('L');\n\n\t\tconst repr = root._color === BLACK ? black(root.key) : red(root.key);\n\n\t\treturn `(${debug(root.left)}, ${repr}, ${debug(root.right)})`;\n\t};\n\n\treturn debug;\n};\n", + "name": "src/family/uncle.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport grandparent from './grandparent.js';\n\n/**\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n */\nconst uncle = (node) => {\n\tassert(node instanceof Node);\n\tconst g = grandparent(node);\n\tassert(g !== null);\n\tconst u = node.parent === g.left ? g.right : g.left;\n\tassert(u instanceof Node || u instanceof Leaf);\n\treturn u;\n};\n\nexport default uncle;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/debug/debug.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/uncle.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 79, + "__docId__": 81, "kind": "function", - "name": "_debug", - "memberof": "src/debug/debug.js", + "name": "uncle", + "memberof": "src/family/uncle.js", "generator": false, "async": false, "static": true, - "longname": "src/debug/debug.js~_debug", - "access": "private", + "longname": "src/family/uncle.js~uncle", + "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/debug/debug.js", - "importStyle": "{_debug}", - "description": "Builds a debug function from color handlers.", - "lineNumber": 9, + "importPath": "@aureooms/js-red-black-tree/src/family/uncle.js", + "importStyle": "uncle", + "description": "Computes the uncle of the input node when the grandparent is guaranteed to\nexist.", + "lineNumber": 13, "unknown": [ { "tagName": "@returns", - "tagValue": "{Function} The debug function." + "tagValue": "{Node|Leaf}" } ], "params": [ { "nullable": null, "types": [ - "Object" + "Node" ], "spread": false, "optional": false, - "name": "colors", - "description": "The colors to use." + "name": "node", + "description": "The input node." } ], "return": { "nullable": null, "types": [ - "Function" + "Node", + "Leaf" ], "spread": false, - "description": "The debug function." + "description": "" } }, { - "__docId__": 80, + "__docId__": 82, "kind": "file", - "name": "src/debug/index.js", - "content": "export * from './debug.js';\n", + "name": "src/index.js", + "content": "export {default as empty} from './api/empty.js';\nexport {default as from} from './api/from.js';\nexport {default as BLACK} from './color/BLACK.js';\nexport {default as RED} from './color/RED.js';\nexport {default as _debug} from './debug/_debug.js';\nexport {default as delete_case1} from './deletion/delete_case1.js';\nexport {default as delete_case2} from './deletion/delete_case2.js';\nexport {default as delete_case3} from './deletion/delete_case3.js';\nexport {default as delete_case4} from './deletion/delete_case4.js';\nexport {default as delete_case5} from './deletion/delete_case5.js';\nexport {default as delete_case6} from './deletion/delete_case6.js';\nexport {default as delete_one_child} from './deletion/delete_one_child.js';\nexport {default as replace_node} from './deletion/replace_node.js';\nexport {default as grandparent} from './family/grandparent.js';\nexport {default as predecessor} from './family/predecessor.js';\nexport {default as sibling} from './family/sibling.js';\nexport {default as uncle} from './family/uncle.js';\nexport {default as insert} from './insertion/insert.js';\nexport {default as insert_case1} from './insertion/insert_case1.js';\nexport {default as insert_case2} from './insertion/insert_case2.js';\nexport {default as insert_case3} from './insertion/insert_case3.js';\nexport {default as insert_case4} from './insertion/insert_case4.js';\nexport {default as insert_case5} from './insertion/insert_case5.js';\nexport {default as rotate_left} from './rotate/rotate_left.js';\nexport {default as rotate_right} from './rotate/rotate_right.js';\nexport {default as search} from './search/search.js';\nexport {default as inordertraversal} from './traversal/inordertraversal.js';\nexport {default as rangetraversal} from './traversal/rangetraversal.js';\nexport {default as Leaf} from './types/Leaf.js';\nexport {default as Node} from './types/Node.js';\nexport {default as RedBlackTree} from './types/RedBlackTree.js';\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/debug/index.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/index.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 81, + "__docId__": 83, "kind": "file", - "name": "src/deletion/delete_case1.js", - "content": "import {delete_case2} from './delete_case2.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case1 = (n) => {\n\t// If n is the root, there is nothing to do: all paths go through n, and n\n\t// is black.\n\tif (n.parent !== null) delete_case2(n);\n};\n", + "name": "src/insertion/insert.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n */\nconst insert = (compare, A, B) => {\n\twhile (true) {\n\t\tif (compare(B.key, A.key) < 0) {\n\t\t\tconst node = A.left;\n\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tassert(node instanceof Node);\n\t\t\tA = node;\n\t\t} else {\n\t\t\tconst node = A.right;\n\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tassert(node instanceof Node);\n\t\t\tA = node;\n\t\t}\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n};\n\nexport default insert;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case1.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 82, + "__docId__": 84, "kind": "function", - "name": "delete_case1", - "memberof": "src/deletion/delete_case1.js", + "name": "insert", + "memberof": "src/insertion/insert.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case1.js~delete_case1", + "longname": "src/insertion/insert.js~insert", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case1.js", - "importStyle": "{delete_case1}", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b", - "lineNumber": 11, + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert.js", + "importStyle": "insert", + "description": "Walks the tree rooted at A down the only path that satisfies\nthe following property: if at a node C we make a left (resp.\nright), then B < C (resp. B >= C). Once we hit the\nend of the path, we can add node B at this position. By the\nproperty of the path, the tree rooted at A is still a binary\nsearch tree.\nFor our red-black tree, all that is left to do is fix the red-black tree\nproperties in case they have been violated by this insertion. This is fixed\nby {@link insert_case1}.", + "lineNumber": 20, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node} B - The node that has been inserted." + } + ], "params": [ + { + "nullable": null, + "types": [ + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function to use." + }, { "nullable": null, "types": [ @@ -1411,38 +1361,55 @@ ], "spread": false, "optional": false, - "name": "n", - "description": "The input node." + "name": "A", + "description": "The root of the tree." + }, + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "B", + "description": "The node to insert." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "B - The node that has been inserted." + } }, { - "__docId__": 83, + "__docId__": 85, "kind": "file", - "name": "src/deletion/delete_case2.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case3} from './delete_case3.js';\nimport {delete_case4} from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case2 = (n) => {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t */\n\tif (s._color === RED) {\n\t\tn.parent._color = RED;\n\t\ts._color = BLACK;\n\t\tif (n === n.parent.left) rotate_left(n.parent);\n\t\telse rotate_right(n.parent);\n\t\tdelete_case4(n);\n\t}\n\n\t// Otherwise, go to case 3.\n\telse delete_case3(n);\n};\n", + "name": "src/insertion/insert_case1.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case2 from './insert_case2.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n */\nconst insert_case1 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent === null) n._color = BLACK;\n\telse insert_case2(n);\n};\n\nexport default insert_case1;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case2.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case1.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 84, + "__docId__": 86, "kind": "function", - "name": "delete_case2", - "memberof": "src/deletion/delete_case2.js", + "name": "insert_case1", + "memberof": "src/insertion/insert_case1.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case2.js~delete_case2", + "longname": "src/insertion/insert_case1.js~insert_case1", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case2.js", - "importStyle": "{delete_case2}", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root", - "lineNumber": 17, + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case1.js", + "importStyle": "insert_case1", + "description": "Preconditions:\n - n is red.\n - n's children are BLACK", + "lineNumber": 14, "params": [ { "nullable": null, @@ -1458,31 +1425,31 @@ "return": null }, { - "__docId__": 85, + "__docId__": 87, "kind": "file", - "name": "src/deletion/delete_case3.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case1} from './delete_case1.js';\nimport {delete_case4} from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case3 = (n) => {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\tn.parent._color === BLACK &&\n\t\ts.left._color === BLACK &&\n\t\ts.right._color === BLACK\n\t) {\n\t\ts._color = RED;\n\t\tdelete_case1(n.parent);\n\t}\n\n\t// Otherwise, go to case 4.\n\telse delete_case4(n);\n};\n", + "name": "src/insertion/insert_case2.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case3 from './insert_case3.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case2 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\tassert(n.parent !== null);\n\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent._color === BLACK) return;\n\n\tinsert_case3(n);\n};\n\nexport default insert_case2;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case3.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case2.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 86, + "__docId__": 88, "kind": "function", - "name": "delete_case3", - "memberof": "src/deletion/delete_case3.js", + "name": "insert_case2", + "memberof": "src/insertion/insert_case2.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case3.js~delete_case3", + "longname": "src/insertion/insert_case2.js~insert_case2", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case3.js", - "importStyle": "{delete_case3}", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black", - "lineNumber": 17, + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case2.js", + "importStyle": "insert_case2", + "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.", + "lineNumber": 15, "params": [ { "nullable": null, @@ -1498,31 +1465,31 @@ "return": null }, { - "__docId__": 87, + "__docId__": 89, "kind": "file", - "name": "src/deletion/delete_case4.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case5} from './delete_case5.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case4 = (n) => {\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\t// The parent color test is always true when coming from case 2\n\t\tn.parent._color === RED &&\n\t\ts.left._color === BLACK &&\n\t\ts.right._color === BLACK\n\t) {\n\t\ts._color = RED;\n\t\tn.parent._color = BLACK;\n\t}\n\n\t// Otherwise, go to case 5.\n\telse delete_case5(n);\n};\n", + "name": "src/insertion/insert_case3.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport uncle from '../family/uncle.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case1 from './insert_case1.js';\nimport insert_case4 from './insert_case4.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case3 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst u = uncle(n);\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\tif (u._color === RED) {\n\t\tn.parent._color = BLACK;\n\t\tu._color = BLACK;\n\t\tconst g = grandparent(n);\n\t\tg._color = RED;\n\t\tinsert_case1(g);\n\t} else insert_case4(n);\n};\n\nexport default insert_case3;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case4.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case3.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 88, + "__docId__": 90, "kind": "function", - "name": "delete_case4", - "memberof": "src/deletion/delete_case4.js", + "name": "insert_case3", + "memberof": "src/insertion/insert_case3.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case4.js~delete_case4", + "longname": "src/insertion/insert_case3.js~insert_case3", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case4.js", - "importStyle": "{delete_case4}", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - n's parent and n's sibling's children cannot all be black", - "lineNumber": 17, + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case3.js", + "importStyle": "insert_case3", + "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.", + "lineNumber": 19, "params": [ { "nullable": null, @@ -1538,31 +1505,31 @@ "return": null }, { - "__docId__": 89, + "__docId__": 91, "kind": "file", - "name": "src/deletion/delete_case5.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\nimport {delete_case6} from './delete_case6.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case5 = (n) => {\n\tconst s = sibling(n);\n\n\t// The following statements just force the red n's sibling child to be on\n\t// the left of the left of the parent, or right of the right, so case 6\n\t// will rotate correctly.\n\n\t/**\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t */\n\tif (n === n.parent.left && s.right._color === BLACK) {\n\t\ts._color = RED;\n\t\ts.left._color = BLACK;\n\t\trotate_right(s);\n\t} else if (n === n.parent.right && s.left._color === BLACK) {\n\t\t/**\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t */\n\t\ts._color = RED;\n\t\ts.right._color = BLACK;\n\t\trotate_left(s);\n\t}\n\n\tdelete_case6(n);\n};\n", + "name": "src/insertion/insert_case4.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case5 from './insert_case5.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case4 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t/**\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\tif (n === n.parent.right && n.parent === g.left) {\n\t\trotate_left(n.parent);\n\n\t\t/**\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\t} else if (n === n.parent.left && n.parent === g.right) {\n\t\t/**\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_right(n.parent);\n\n\t\t/**\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t}\n\n\tinsert_case5(n);\n};\n\nexport default insert_case4;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case5.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case4.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 90, + "__docId__": 92, "kind": "function", - "name": "delete_case5", - "memberof": "src/deletion/delete_case5.js", + "name": "insert_case4", + "memberof": "src/insertion/insert_case4.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case5.js~delete_case5", + "longname": "src/insertion/insert_case4.js~insert_case4", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case5.js", - "importStyle": "{delete_case5}", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - at least one of n's sibling's children is red", - "lineNumber": 18, + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case4.js", + "importStyle": "insert_case4", + "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n\nHere we fix the input subtree to pass the preconditions of {@link insert_case5}.", + "lineNumber": 22, "params": [ { "nullable": null, @@ -1578,31 +1545,31 @@ "return": null }, { - "__docId__": 91, + "__docId__": 93, "kind": "file", - "name": "src/deletion/delete_case6.js", - "content": "import {BLACK} from '../color/BLACK.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {sibling} from '../family/sibling.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n */\nexport const delete_case6 = (n) => {\n\tconst s = sibling(n);\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n\ts._color = n.parent._color;\n\tn.parent._color = BLACK;\n\n\tif (n === n.parent.left) {\n\t\ts.right._color = BLACK;\n\t\trotate_left(n.parent);\n\t}\n\n\t// Symmetric case\n\telse {\n\t\ts.left._color = BLACK;\n\t\trotate_right(n.parent);\n\t}\n};\n", + "name": "src/insertion/insert_case5.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case5 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t// Repaint n's parent black, n's grandparent red\n\tn.parent._color = BLACK;\n\tg._color = RED;\n\n\tif (n === n.parent.left) {\n\t\t/**\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.left instanceof Node);\n\t\tassert(n === g.left.left);\n\t\tassert(g.right._color === BLACK);\n\t\trotate_right(g);\n\t} else {\n\t\t/**\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.right instanceof Node);\n\t\tassert(n === g.right.right);\n\t\tassert(g.left._color === BLACK);\n\t\trotate_left(g);\n\t}\n};\n\nexport default insert_case5;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case6.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case5.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 92, + "__docId__": 94, "kind": "function", - "name": "delete_case6", - "memberof": "src/deletion/delete_case6.js", + "name": "insert_case5", + "memberof": "src/insertion/insert_case5.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case6.js~delete_case6", + "longname": "src/insertion/insert_case5.js~insert_case5", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case6.js", - "importStyle": "{delete_case6}", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - if n is a left child, the right child of n's sibling is red\n - if n is a right child, the left child of n's sibling is red", - "lineNumber": 17, + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case5.js", + "importStyle": "insert_case5", + "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n - the path from n to its grandparent makes a left-left or right-right.", + "lineNumber": 20, "params": [ { "nullable": null, @@ -1618,31 +1585,31 @@ "return": null }, { - "__docId__": 93, + "__docId__": 95, "kind": "file", - "name": "src/deletion/delete_one_child.js", - "content": "import {BLACK, RED} from '../color/index.js';\n\nimport {replace_node} from './replace_node.js';\nimport {delete_case1} from './delete_case1.js';\n\n/**\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n *\n * @param {Node} n - The node to delete.\n */\nexport const delete_one_child = (n) => {\n\t// Precondition: n has at most one non-leaf child.\n\t// assert( n.right.isLeaf() || n.left.isLeaf());\n\n\t// const child = n.right.isLeaf() ? n.left : n.right;\n\t// n.right is always a LEAF because either n is a subtree predecessor or it\n\t// is the only child of its parent by the red-black tree properties\n\tconst child = n.left;\n\n\t// Replace n with its left child\n\treplace_node(n, child);\n\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1.\n\tif (n._color === BLACK) {\n\t\t// We can easily fix this when its left child is an\n\t\t// internal red node: change the color of the left child to black and\n\t\t// replace n with it.\n\t\tif (child._color === RED) child._color = BLACK;\n\t\t// Otherwise, there are more things to fix.\n\t\telse delete_case1(child);\n\t}\n\n\t// Else {\n\t// If n is red then its child can only be black. Replacing n with its\n\t// child suffices.\n\t// }\n};\n", + "name": "src/rotate/rotate_left.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nconst rotate_left = (A) => {\n\tassert(A instanceof Node);\n\tconst B = A.right;\n\tassert(B instanceof Node);\n\tconst a = A.left;\n\tconst b = B.left;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tA.left = B;\n\tA.right = c;\n\n\tB.left = a;\n\tB.right = b;\n\n\ta.parent = B;\n\tb.parent = B;\n\tc.parent = A;\n};\n\nexport default rotate_left;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_one_child.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_left.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 94, + "__docId__": 96, "kind": "function", - "name": "delete_one_child", - "memberof": "src/deletion/delete_one_child.js", + "name": "rotate_left", + "memberof": "src/rotate/rotate_left.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_one_child.js~delete_one_child", + "longname": "src/rotate/rotate_left.js~rotate_left", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_one_child.js", - "importStyle": "{delete_one_child}", - "description": "Delete a node n that has at most a single non-leaf child.\n\nPrecondition:\n - n has at most one non-leaf child.\n - if n has a non-leaf child, then it is its left child.", - "lineNumber": 15, + "importPath": "@aureooms/js-red-black-tree/src/rotate/rotate_left.js", + "importStyle": "rotate_left", + "description": "Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n/!\\ This swaps the references to A and B.\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", + "lineNumber": 19, "params": [ { "nullable": null, @@ -1651,60 +1618,39 @@ ], "spread": false, "optional": false, - "name": "n", - "description": "The node to delete." + "name": "A", + "description": "The root of the tree." } ], "return": null }, { - "__docId__": 95, - "kind": "file", - "name": "src/deletion/index.js", - "content": "export * from './delete_case1.js';\nexport * from './delete_case2.js';\nexport * from './delete_case3.js';\nexport * from './delete_case4.js';\nexport * from './delete_case5.js';\nexport * from './delete_case6.js';\nexport * from './delete_one_child.js';\nexport * from './replace_node.js';\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/index.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 96, + "__docId__": 97, "kind": "file", - "name": "src/deletion/replace_node.js", - "content": "/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n */\nexport const replace_node = (A, B) => {\n\t// Assert( A.parent !== null ) ;\n\t// we never apply delete_one_child on the root so we are safe\n\n\tif (A === A.parent.left) A.parent.left = B;\n\telse A.parent.right = B;\n\n\tB.parent = A.parent;\n};\n", + "name": "src/rotate/rotate_right.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nconst rotate_right = (B) => {\n\tassert(B instanceof Node);\n\tconst A = B.left;\n\tassert(A instanceof Node);\n\tconst a = A.left;\n\tconst b = A.right;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tB.left = a;\n\tB.right = A;\n\n\tA.left = b;\n\tA.right = c;\n\n\ta.parent = B;\n\tb.parent = A;\n\tc.parent = A;\n};\n\nexport default rotate_right;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/replace_node.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_right.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 97, + "__docId__": 98, "kind": "function", - "name": "replace_node", - "memberof": "src/deletion/replace_node.js", + "name": "rotate_right", + "memberof": "src/rotate/rotate_right.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/replace_node.js~replace_node", + "longname": "src/rotate/rotate_right.js~rotate_right", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/replace_node.js", - "importStyle": "{replace_node}", - "description": "Replaces node A by node B.", - "lineNumber": 7, + "importPath": "@aureooms/js-red-black-tree/src/rotate/rotate_right.js", + "importStyle": "rotate_right", + "description": "Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n/!\\ This swaps the references to A and B.\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", + "lineNumber": 19, "params": [ - { - "nullable": null, - "types": [ - "Node" - ], - "spread": false, - "optional": false, - "name": "A", - "description": "The node to replace." - }, { "nullable": null, "types": [ @@ -1713,37 +1659,37 @@ "spread": false, "optional": false, "name": "B", - "description": "The replacement node." + "description": "The root of the tree." } ], "return": null }, { - "__docId__": 98, + "__docId__": 99, "kind": "file", - "name": "src/family/grandparent.js", - "content": "/**\n * Computes the grandparent (parent of parent) of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport const grandparent = (node) => {\n\t// Assert((node !== null) && (node.parent !== null));\n\t// We only call this function when node HAS a grandparent\n\treturn node.parent.parent;\n};\n", + "name": "src/search/search.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n */\nconst search = (compare, root, key) => {\n\tassert(root instanceof Node);\n\twhile (true) {\n\t\tconst d = compare(key, root.key);\n\n\t\tif (d === 0) {\n\t\t\treturn root;\n\t\t}\n\n\t\tconst child = d < 0 ? root.left : root.right;\n\n\t\tif (child.isLeaf()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tassert(child instanceof Node);\n\t\troot = child;\n\t}\n};\n\nexport default search;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/grandparent.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/search/search.js", "access": "public", "description": null, "lineNumber": 1 }, { - "__docId__": 99, + "__docId__": 100, "kind": "function", - "name": "grandparent", - "memberof": "src/family/grandparent.js", + "name": "search", + "memberof": "src/search/search.js", "generator": false, "async": false, "static": true, - "longname": "src/family/grandparent.js~grandparent", + "longname": "src/search/search.js~search", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/family/grandparent.js", - "importStyle": "{grandparent}", - "description": "Computes the grandparent (parent of parent) of the input node.", - "lineNumber": 7, + "importPath": "@aureooms/js-red-black-tree/src/search/search.js", + "importStyle": "search", + "description": "Search for the first node whose key equals key.", + "lineNumber": 12, "unknown": [ { "tagName": "@returns", @@ -1751,6 +1697,16 @@ } ], "params": [ + { + "nullable": null, + "types": [ + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function." + }, { "nullable": null, "types": [ @@ -1758,8 +1714,18 @@ ], "spread": false, "optional": false, - "name": "node", - "description": "The input node." + "name": "root", + "description": "The root of the tree to scan." + }, + { + "nullable": null, + "types": [ + "any" + ], + "spread": false, + "optional": false, + "name": "key", + "description": "The key to search for." } ], "return": { @@ -1771,24 +1737,13 @@ "description": "" } }, - { - "__docId__": 100, - "kind": "file", - "name": "src/family/index.js", - "content": "export * from './grandparent.js';\nexport * from './predecessor.js';\nexport * from './sibling.js';\nexport * from './uncle.js';\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/index.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, { "__docId__": 101, "kind": "file", - "name": "src/family/predecessor.js", - "content": "/**\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport const predecessor = (node) => {\n\t// Assert( !node.left.isLeaf() ) ;\n\tlet pred = node.left;\n\n\twhile (!pred.right.isLeaf()) pred = pred.right;\n\n\treturn pred;\n};\n", + "name": "src/traversal/inordertraversal.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n */\nexport default function* inordertraversal(node) {\n\tassert(node instanceof Node);\n\tif (!node.left.isLeaf()) {\n\t\t// Yield the nodes on the left recursively. Those nodes are all smaller\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tassert(node.left instanceof Node);\n\t\tyield* inordertraversal(node.left);\n\t}\n\n\t// Yield the current node.\n\tyield node.key;\n\n\tif (!node.right.isLeaf()) {\n\t\t// Yield the nodes on the right recursively. Those nodes are all larger\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tassert(node.right instanceof Node);\n\t\tyield* inordertraversal(node.right);\n\t}\n}\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/predecessor.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/inordertraversal.js", "access": "public", "description": null, "lineNumber": 1 @@ -1796,22 +1751,22 @@ { "__docId__": 102, "kind": "function", - "name": "predecessor", - "memberof": "src/family/predecessor.js", - "generator": false, + "name": "inordertraversal", + "memberof": "src/traversal/inordertraversal.js", + "generator": true, "async": false, "static": true, - "longname": "src/family/predecessor.js~predecessor", + "longname": "src/traversal/inordertraversal.js~inordertraversal", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/family/predecessor.js", - "importStyle": "{predecessor}", - "description": "Computes the predecessor of the input node, in the subtree rooted at the\ninput node, when this predecessor is guaranteed to exist.", - "lineNumber": 8, + "importPath": "@aureooms/js-red-black-tree/src/traversal/inordertraversal.js", + "importStyle": "inordertraversal", + "description": "Traverses the tree rooted at node in order.", + "lineNumber": 10, "unknown": [ { "tagName": "@returns", - "tagValue": "{Node}" + "tagValue": "{IterableIterator}" } ], "params": [ @@ -1823,13 +1778,13 @@ "spread": false, "optional": false, "name": "node", - "description": "The input node." + "description": "The root of the tree." } ], "return": { "nullable": null, "types": [ - "Node" + "IterableIterator" ], "spread": false, "description": "" @@ -1838,10 +1793,10 @@ { "__docId__": 103, "kind": "file", - "name": "src/family/sibling.js", - "content": "/**\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport const sibling = (node) => {\n\t// Assert((node !== null) && (node.parent !== null));\n\t// We only use this function when node HAS a sibling so this case can never\n\t// happen.\n\n\treturn node === node.parent.left ? node.parent.right : node.parent.left;\n};\n", + "name": "src/traversal/rangetraversal.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n */\nexport default function* rangetraversal(compare, root, left, right) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (!root.right.isLeaf()) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t} else if (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (!root.left.isLeaf()) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\t} else {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif (!root.left.isLeaf()) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\n\t\tyield root.key;\n\t\tif (!root.right.isLeaf()) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t}\n}\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/sibling.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/rangetraversal.js", "access": "public", "description": null, "lineNumber": 1 @@ -1849,25 +1804,35 @@ { "__docId__": 104, "kind": "function", - "name": "sibling", - "memberof": "src/family/sibling.js", - "generator": false, + "name": "rangetraversal", + "memberof": "src/traversal/rangetraversal.js", + "generator": true, "async": false, "static": true, - "longname": "src/family/sibling.js~sibling", + "longname": "src/traversal/rangetraversal.js~rangetraversal", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/family/sibling.js", - "importStyle": "{sibling}", - "description": "Computes the sibling of the input node.", - "lineNumber": 7, + "importPath": "@aureooms/js-red-black-tree/src/traversal/rangetraversal.js", + "importStyle": "rangetraversal", + "description": "Yields all the keys in the tree rooted at root that lie in the\ninterval [left, right[, in order.", + "lineNumber": 14, "unknown": [ { "tagName": "@returns", - "tagValue": "{Node}" + "tagValue": "{IterableIterator}" } ], "params": [ + { + "nullable": null, + "types": [ + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function." + }, { "nullable": null, "types": [ @@ -1875,14 +1840,34 @@ ], "spread": false, "optional": false, - "name": "node", - "description": "The input node." + "name": "root", + "description": "The root of the tree." + }, + { + "nullable": null, + "types": [ + "any" + ], + "spread": false, + "optional": false, + "name": "left", + "description": "The inclusive lower bound of the interval." + }, + { + "nullable": null, + "types": [ + "any" + ], + "spread": false, + "optional": false, + "name": "right", + "description": "The non-inclusive upper bound of the interval." } ], "return": { "nullable": null, "types": [ - "Node" + "IterableIterator" ], "spread": false, "description": "" @@ -1891,10 +1876,10 @@ { "__docId__": 105, "kind": "file", - "name": "src/family/uncle.js", - "content": "import {grandparent} from './grandparent.js';\n\n/**\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nexport const uncle = (node) => {\n\tconst g = grandparent(node);\n\t// Assert( g !== null ) ;\n\t// this can never happen\n\tif (node.parent === g.left) return g.right.isLeaf() ? null : g.right;\n\treturn g.left.isLeaf() ? null : g.left;\n};\n", + "name": "src/types/Leaf.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport Node from './Node.js';\n\n/**\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n */\nexport default function Leaf(parent) {\n\tassert(parent instanceof Node);\n\t/** @constant {number} The color of the node. */\n\tthis._color = BLACK;\n\t/** @member {Node} The parent node. */\n\tthis.parent = parent;\n}\n\n/**\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n */\nLeaf.prototype.isLeaf = function () {\n\treturn true;\n};\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/uncle.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/types/Leaf.js", "access": "public", "description": null, "lineNumber": 1 @@ -1902,22 +1887,22 @@ { "__docId__": 106, "kind": "function", - "name": "uncle", - "memberof": "src/family/uncle.js", + "name": "Leaf", + "memberof": "src/types/Leaf.js", "generator": false, "async": false, "static": true, - "longname": "src/family/uncle.js~uncle", + "longname": "src/types/Leaf.js~Leaf", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/family/uncle.js", - "importStyle": "{uncle}", - "description": "Computes the uncle of the input node when the grandparent is guaranteed to\nexist.", - "lineNumber": 10, + "importPath": "@aureooms/js-red-black-tree/src/types/Leaf.js", + "importStyle": "Leaf", + "description": "A black leaf node.", + "lineNumber": 11, "unknown": [ { - "tagName": "@returns", - "tagValue": "{Node}" + "tagName": "@class", + "tagValue": "" } ], "params": [ @@ -1928,391 +1913,398 @@ ], "spread": false, "optional": false, - "name": "node", - "description": "The input node." + "name": "parent", + "description": "The parent node in the tree." + } + ], + "return": null + }, + { + "__docId__": 107, + "kind": "function", + "name": "isLeaf", + "memberof": "src/types/Leaf.js", + "generator": false, + "async": false, + "static": true, + "longname": "src/types/Leaf.js~isLeaf", + "access": "public", + "export": false, + "importPath": "@aureooms/js-red-black-tree/src/types/Leaf.js", + "importStyle": null, + "description": "Returns true if the Leaf object is a leaf. This\nalways returns true.", + "lineNumber": 25, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Boolean}" } ], "return": { "nullable": null, "types": [ - "Node" + "Boolean" ], "spread": false, "description": "" - } - }, - { - "__docId__": 107, - "kind": "file", - "name": "src/index.js", - "content": "export * from './adt/index.js';\nexport * from './color/index.js';\nexport * from './debug/index.js';\nexport * from './deletion/index.js';\nexport * from './family/index.js';\nexport * from './insertion/index.js';\nexport * from './rotate/index.js';\nexport * from './search/index.js';\nexport * from './traversal/index.js';\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/index.js", - "access": "public", - "description": null, - "lineNumber": 1 + }, + "params": [], + "ignore": true }, { "__docId__": 108, "kind": "file", - "name": "src/insertion/index.js", - "content": "export * from './insert.js';\nexport * from './insert_case1.js';\nexport * from './insert_case2.js';\nexport * from './insert_case3.js';\nexport * from './insert_case4.js';\nexport * from './insert_case5.js';\n", + "name": "src/types/Node.js", + "content": "import Leaf from './Leaf.js';\n\n/**\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n */\nexport default function Node(color, key) {\n\t/** @member {number} The color of the node. */\n\tthis._color = color;\n\t/** @member {Node|Leaf} The left child */\n\tthis.left = new Leaf(this);\n\t/** @member {Node|Leaf} The right child */\n\tthis.right = new Leaf(this);\n\t/** @member {Node} The parent node. */\n\tthis.parent = null;\n\t/** @member {any} The key held by this node. */\n\tthis.key = key;\n}\n\n/**\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n */\nNode.prototype.isLeaf = function () {\n\treturn false;\n};\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/index.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/types/Node.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 109, - "kind": "file", - "name": "src/insertion/insert.js", - "content": "/**\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n */\nexport const insert = (compare, A, B) => {\n\twhile (true) {\n\t\tif (compare(B.key, A.key) < 0) {\n\t\t\tconst node = A.left;\n\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\t\t} else {\n\t\t\tconst node = A.right;\n\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tA = node;\n\t\t}\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 110, "kind": "function", - "name": "insert", - "memberof": "src/insertion/insert.js", + "name": "Node", + "memberof": "src/types/Node.js", "generator": false, "async": false, "static": true, - "longname": "src/insertion/insert.js~insert", + "longname": "src/types/Node.js~Node", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert.js", - "importStyle": "{insert}", - "description": "Walks the tree rooted at A down the only path that satisfies\nthe following property: if at a node C we make a left (resp.\nright), then B < C (resp. B >= C). Once we hit the\nend of the path, we can add node B at this position. By the\nproperty of the path, the tree rooted at A is still a binary\nsearch tree.\nFor our red-black tree, all that is left to do is fix the red-black tree\nproperties in case they have been violated by this insertion. This is fixed\nby {@link insert_case1}.", - "lineNumber": 17, + "importPath": "@aureooms/js-red-black-tree/src/types/Node.js", + "importStyle": "Node", + "description": "An internal node. This node can be red or black.", + "lineNumber": 10, "unknown": [ { - "tagName": "@returns", - "tagValue": "{Node} B - The node that has been inserted." + "tagName": "@class", + "tagValue": "" } ], "params": [ { "nullable": null, "types": [ - "*" - ], - "spread": false, - "optional": false, - "name": "compare", - "description": "The comparison function to use." - }, - { - "nullable": null, - "types": [ - "Node" + "number" ], "spread": false, "optional": false, - "name": "A", - "description": "The root of the tree." + "name": "color", + "description": "The color of the node." }, { "nullable": null, "types": [ - "Node" + "any" ], "spread": false, "optional": false, - "name": "B", - "description": "The node to insert." + "name": "key", + "description": "The key of the node." + } + ], + "return": null + }, + { + "__docId__": 110, + "kind": "function", + "name": "isLeaf", + "memberof": "src/types/Node.js", + "generator": false, + "async": false, + "static": true, + "longname": "src/types/Node.js~isLeaf", + "access": "public", + "export": false, + "importPath": "@aureooms/js-red-black-tree/src/types/Node.js", + "importStyle": null, + "description": "Returns true if the Node object is a leaf. This\nalways returns false.", + "lineNumber": 29, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Boolean}" } ], "return": { "nullable": null, "types": [ - "Node" + "Boolean" ], "spread": false, - "description": "B - The node that has been inserted." - } + "description": "" + }, + "params": [], + "ignore": true }, { "__docId__": 111, "kind": "file", - "name": "src/insertion/insert_case1.js", - "content": "import {BLACK} from '../color/BLACK.js';\nimport {insert_case2} from './insert_case2.js';\n\n/**\n * Preconditions:\n * - n is red.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case1 = (n) => {\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent === null) n._color = BLACK;\n\telse insert_case2(n);\n};\n", + "name": "src/types/RedBlackTree.js", + "content": "import assert from 'assert';\nimport Node from './Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport predecessor from '../family/predecessor.js';\nimport insert from '../insertion/insert.js';\nimport insert_case2 from '../insertion/insert_case2.js';\nimport delete_one_child from '../deletion/delete_one_child.js';\nimport search from '../search/search.js';\nimport inordertraversal from '../traversal/inordertraversal.js';\nimport rangetraversal from '../traversal/rangetraversal.js';\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport default class RedBlackTree {\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t */\n\tconstructor(compare) {\n\t\t/** @member {Function} The comparison function for node keys. */\n\t\tthis.compare = compare;\n\t\t/** @member {Node} The root of the tree. */\n\t\tthis.root = null;\n\t}\n\n\t/**\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t */\n\tisEmpty() {\n\t\treturn this.root === null;\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t */\n\tadd(key) {\n\t\tif (this.root === null) {\n\t\t\tthis.root = new Node(BLACK, key);\n\t\t} else {\n\t\t\tconst node = new Node(RED, key);\n\t\t\tinsert(this.compare, this.root, node);\n\t\t\tinsert_case2(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search(key) {\n\t\tif (this.root === null) return null;\n\t\treturn search(this.compare, this.root, key);\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t */\n\tget(key) {\n\t\tconst node = this._search(key);\n\t\treturn node === null ? null : node.key;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t */\n\thas(key) {\n\t\treturn this._search(key) !== null;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\t_delete(node) {\n\t\tif (!node.left.isLeaf()) {\n\t\t\t// Replace node's key with predecessor's key\n\t\t\tconst pred = predecessor(node);\n\t\t\tnode.key = pred.key;\n\t\t\t// Delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(pred);\n\t\t} else if (!node.right.isLeaf()) {\n\t\t\t// Replace node's key with successor's key\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right;\n\t\t\tassert(succ instanceof Node);\n\t\t\tnode.key = succ.key;\n\t\t\t// Delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(succ);\n\t\t} else if (node === this.root) {\n\t\t\tthis.root = null;\n\t\t} else {\n\t\t\tdelete_one_child(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove(key) {\n\t\tconst node = this._search(key);\n\t\tif (node === null) return false;\n\n\t\tthis._delete(node);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t */\n\t*range(left, right) {\n\t\tif (this.root !== null)\n\t\t\tyield* rangetraversal(this.compare, this.root, left, right);\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t */\n\t*items() {\n\t\tif (this.root !== null) yield* inordertraversal(this.root);\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator]() {\n\t\treturn this.items();\n\t}\n\n\t/**\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic empty(compare) {\n\t\treturn new RedBlackTree(compare);\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from(compare, iterable) {\n\t\tconst tree = new RedBlackTree(compare);\n\n\t\tfor (const element of iterable) tree.add(element);\n\n\t\treturn tree;\n\t}\n}\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case1.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/types/RedBlackTree.js", "access": "public", "description": null, "lineNumber": 1 }, { "__docId__": 112, - "kind": "function", - "name": "insert_case1", - "memberof": "src/insertion/insert_case1.js", - "generator": false, - "async": false, + "kind": "class", + "name": "RedBlackTree", + "memberof": "src/types/RedBlackTree.js", "static": true, - "longname": "src/insertion/insert_case1.js~insert_case1", + "longname": "src/types/RedBlackTree.js~RedBlackTree", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case1.js", - "importStyle": "{insert_case1}", - "description": "Preconditions:\n - n is red.", - "lineNumber": 10, - "params": [ - { - "nullable": null, - "types": [ - "Node" - ], - "spread": false, - "optional": false, - "name": "n", - "description": "The input node." - } - ], - "return": null + "importPath": "@aureooms/js-red-black-tree/src/types/RedBlackTree.js", + "importStyle": "RedBlackTree", + "description": "A RedBlackTree with key-only nodes.", + "lineNumber": 17, + "interface": false }, { "__docId__": 113, - "kind": "file", - "name": "src/insertion/insert_case2.js", - "content": "import {BLACK} from '../color/BLACK.js';\nimport {insert_case3} from './insert_case3.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case2 = (n) => {\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent._color === BLACK) return;\n\n\tinsert_case3(n);\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case2.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 114, - "kind": "function", - "name": "insert_case2", - "memberof": "src/insertion/insert_case2.js", + "kind": "constructor", + "name": "constructor", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", "generator": false, "async": false, - "static": true, - "longname": "src/insertion/insert_case2.js~insert_case2", + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#constructor", "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case2.js", - "importStyle": "{insert_case2}", - "description": "Preconditions:\n - n is red.\n - n is not the root of the tree.", - "lineNumber": 11, + "description": "Constructs a new empty red-black tree.", + "lineNumber": 23, "params": [ { "nullable": null, "types": [ - "Node" + "Function" ], "spread": false, "optional": false, - "name": "n", - "description": "The input node." + "name": "compare", + "description": "The comparison function for node keys." } - ], - "return": null + ] + }, + { + "__docId__": 114, + "kind": "member", + "name": "compare", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#compare", + "access": "public", + "description": null, + "lineNumber": 25, + "type": { + "types": [ + "*" + ] + } }, { "__docId__": 115, - "kind": "file", - "name": "src/insertion/insert_case3.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {uncle, grandparent} from '../family/index.js';\nimport {insert_case1} from './insert_case1.js';\nimport {insert_case4} from './insert_case4.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case3 = (n) => {\n\tconst u = uncle(n);\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\tif (u !== null && u._color === RED) {\n\t\tn.parent._color = BLACK;\n\t\tu._color = BLACK;\n\t\tconst g = grandparent(n);\n\t\tg._color = RED;\n\t\tinsert_case1(g);\n\t} else insert_case4(n);\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case3.js", + "kind": "member", + "name": "root", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#root", "access": "public", "description": null, - "lineNumber": 1 + "lineNumber": 27, + "type": { + "types": [ + "*" + ] + } }, { "__docId__": 116, - "kind": "function", - "name": "insert_case3", - "memberof": "src/insertion/insert_case3.js", + "kind": "method", + "name": "isEmpty", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", "generator": false, "async": false, - "static": true, - "longname": "src/insertion/insert_case3.js~insert_case3", + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#isEmpty", "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case3.js", - "importStyle": "{insert_case3}", - "description": "Preconditions:\n - n is red.\n - n is not the root of the tree.\n - n's parent is red.", - "lineNumber": 14, + "description": "Tells whether the tree is empty.", + "lineNumber": 35, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{boolean} true if empty, false otherwise." + } + ], + "return": { + "nullable": null, + "types": [ + "boolean" + ], + "spread": false, + "description": "true if empty, false otherwise." + }, + "params": [] + }, + { + "__docId__": 117, + "kind": "method", + "name": "add", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", + "generator": false, + "async": false, + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#add", + "access": "public", + "description": "Adds a key to the tree.", + "lineNumber": 44, "params": [ { "nullable": null, "types": [ - "Node" + "any" ], "spread": false, "optional": false, - "name": "n", - "description": "The input node." + "name": "key", + "description": "The key to add." } ], "return": null }, { - "__docId__": 117, - "kind": "file", - "name": "src/insertion/insert_case4.js", - "content": "import {rotate_left, rotate_right} from '../rotate/index.js';\nimport {grandparent} from '../family/grandparent.js';\nimport {insert_case5} from './insert_case5.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case4 = (n) => {\n\tconst g = grandparent(n);\n\n\t/**\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\tif (n === n.parent.right && n.parent === g.left) {\n\t\trotate_left(n.parent);\n\n\t\t/**\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\t} else if (n === n.parent.left && n.parent === g.right) {\n\t\t/**\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_right(n.parent);\n\n\t\t/**\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t}\n\n\tinsert_case5(n);\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case4.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 118, - "kind": "function", - "name": "insert_case4", - "memberof": "src/insertion/insert_case4.js", + "__docId__": 119, + "kind": "method", + "name": "_search", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", "generator": false, "async": false, - "static": true, - "longname": "src/insertion/insert_case4.js~insert_case4", - "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case4.js", - "importStyle": "{insert_case4}", - "description": "Preconditions:\n - n is red.\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n\nHere we fix the input subtree to pass the preconditions of {@link insert_case5}.", - "lineNumber": 16, + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#_search", + "access": "private", + "description": "Search for the input key in the tree.\nReturns the first node whose key equals the input key.\nIf no such node exists, returns null.", + "lineNumber": 62, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Node}" + } + ], "params": [ { "nullable": null, "types": [ - "Node" + "any" ], "spread": false, "optional": false, - "name": "n", - "description": "The input node." + "name": "key", + "description": "The input key." } ], - "return": null - }, - { - "__docId__": 119, - "kind": "file", - "name": "src/insertion/insert_case5.js", - "content": "import {BLACK, RED} from '../color/index.js';\nimport {rotate_left, rotate_right} from '../rotate/index.js';\nimport {grandparent} from '../family/grandparent.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n */\nexport const insert_case5 = (n) => {\n\tconst g = grandparent(n);\n\n\t// Repaint n's parent black, n's grandparent red\n\tn.parent._color = BLACK;\n\tg._color = RED;\n\n\t/**\n\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B >R R\n\t * / \\ / \\ --> / \\ / \\\n\t * >R = - - = = = B\n\t * / \\ / \\\n\t * = = - -\n\t */\n\tif (n === n.parent.left) rotate_right(g);\n\t/**\n\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t * We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * B B R >R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - = >R B = = =\n\t * / \\ / \\\n\t * = = - -\n\t */ else rotate_left(g);\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case5.js", - "access": "public", - "description": null, - "lineNumber": 1 + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "" + } }, { "__docId__": 120, - "kind": "function", - "name": "insert_case5", - "memberof": "src/insertion/insert_case5.js", + "kind": "method", + "name": "get", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", "generator": false, "async": false, - "static": true, - "longname": "src/insertion/insert_case5.js~insert_case5", + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#get", "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case5.js", - "importStyle": "{insert_case5}", - "description": "Preconditions:\n - n is red.\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n - the path from n to its grandparent makes a left-left or right-right.", - "lineNumber": 15, + "description": "Search for the input key in the tree. Returns the first node key found\nin this way (with {@link RedBlackTree#_search}. If no such key exists\nin the tree, returns null.", + "lineNumber": 75, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{any}" + } + ], "params": [ { "nullable": null, "types": [ - "Node" + "any" ], "spread": false, "optional": false, - "name": "n", - "description": "The input node." + "name": "key", + "description": "The input key." } ], - "return": null - }, - { - "__docId__": 121, - "kind": "file", - "name": "src/rotate/index.js", - "content": "export * from './rotate_left.js';\nexport * from './rotate_right.js';\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/index.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 122, - "kind": "file", - "name": "src/rotate/rotate_left.js", - "content": "/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nexport const rotate_left = (A) => {\n\tconst B = A.right;\n\tconst a = A.left;\n\tconst b = B.left;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tA.left = B;\n\tA.right = c;\n\n\tB.left = a;\n\tB.right = b;\n\n\ta.parent = B;\n\tb.parent = B;\n\tc.parent = A;\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_left.js", - "access": "public", - "description": null, - "lineNumber": 1 + "return": { + "nullable": null, + "types": [ + "any" + ], + "spread": false, + "description": "" + } }, { - "__docId__": 123, - "kind": "function", - "name": "rotate_left", - "memberof": "src/rotate/rotate_left.js", + "__docId__": 121, + "kind": "method", + "name": "has", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", "generator": false, "async": false, - "static": true, - "longname": "src/rotate/rotate_left.js~rotate_left", + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#has", "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/rotate/rotate_left.js", - "importStyle": "{rotate_left}", - "description": "Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n/!\\ This swaps the references to A and B.\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", - "lineNumber": 16, + "description": "Returns true if and only if the tree contains the input\nkey.", + "lineNumber": 87, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{Boolean}" + } + ], "params": [ { "nullable": null, "types": [ - "Node" + "any" ], "spread": false, "optional": false, - "name": "A", - "description": "The root of the tree." + "name": "key", + "description": "The input key." } ], - "return": null - }, - { - "__docId__": 124, - "kind": "file", - "name": "src/rotate/rotate_right.js", - "content": "/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nexport const rotate_right = (B) => {\n\tconst A = B.left;\n\tconst a = A.left;\n\tconst b = A.right;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tB.left = a;\n\tB.right = A;\n\n\tA.left = b;\n\tA.right = c;\n\n\ta.parent = B;\n\tb.parent = A;\n\tc.parent = A;\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_right.js", - "access": "public", - "description": null, - "lineNumber": 1 + "return": { + "nullable": null, + "types": [ + "Boolean" + ], + "spread": false, + "description": "" + } }, { - "__docId__": 125, - "kind": "function", - "name": "rotate_right", - "memberof": "src/rotate/rotate_right.js", + "__docId__": 122, + "kind": "method", + "name": "_delete", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", "generator": false, "async": false, - "static": true, - "longname": "src/rotate/rotate_right.js~rotate_right", - "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/rotate/rotate_right.js", - "importStyle": "{rotate_right}", - "description": "Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n/!\\ This swaps the references to A and B.\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", - "lineNumber": 16, + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#_delete", + "access": "private", + "description": "Deletes the input node from the tree.", + "lineNumber": 96, "params": [ { "nullable": null, @@ -2321,190 +2313,202 @@ ], "spread": false, "optional": false, - "name": "B", - "description": "The root of the tree." + "name": "node", + "description": "The input node to delete." } ], "return": null }, { - "__docId__": 126, - "kind": "file", - "name": "src/search/index.js", - "content": "export * from './search.js';\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/search/index.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 127, - "kind": "file", - "name": "src/search/search.js", - "content": "/**\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {Key} key - The key to search for.\n * @returns {Node}\n */\nexport const search = (compare, root, key) => {\n\twhile (true) {\n\t\tconst d = compare(key, root.key);\n\n\t\tif (d === 0) {\n\t\t\treturn root;\n\t\t}\n\n\t\troot = d < 0 ? root.left : root.right;\n\n\t\tif (root.isLeaf()) {\n\t\t\treturn null;\n\t\t}\n\t}\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/search/search.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 128, - "kind": "function", - "name": "search", - "memberof": "src/search/search.js", + "__docId__": 124, + "kind": "method", + "name": "remove", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", "generator": false, "async": false, - "static": true, - "longname": "src/search/search.js~search", + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#remove", "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/search/search.js", - "importStyle": "{search}", - "description": "Search for the first node whose key equals key.", - "lineNumber": 9, + "description": "Search for the first node of the tree whose key equals the input key\n(with {@link RedBlackTree#_search}), then delete that node\n(with {@link RedBlackTree#_delete}). If such a node is found and deleted\nthen return true. Return false otherwise.", + "lineNumber": 132, "unknown": [ { "tagName": "@returns", - "tagValue": "{Node}" + "tagValue": "{Boolean} - Whether the key existed in the tree before removal." } ], "params": [ { "nullable": null, "types": [ - "Function" + "any" ], "spread": false, "optional": false, - "name": "compare", - "description": "The comparison function." - }, + "name": "key", + "description": "The input key." + } + ], + "return": { + "nullable": null, + "types": [ + "Boolean" + ], + "spread": false, + "description": "Whether the key existed in the tree before removal." + } + }, + { + "__docId__": 125, + "kind": "method", + "name": "range", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", + "generator": true, + "async": false, + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#range", + "access": "public", + "description": "Returns an in order iterator over the keys of the tree that lie in the\ninterval [left, right[.", + "lineNumber": 147, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{IterableIterator}" + } + ], + "params": [ { "nullable": null, "types": [ - "Node" + "any" ], "spread": false, "optional": false, - "name": "root", - "description": "The root of the tree to scan." + "name": "left", + "description": "The left bound of the interval." }, { "nullable": null, "types": [ - "Key" + "any" ], "spread": false, "optional": false, - "name": "key", - "description": "The key to search for." + "name": "right", + "description": "The right bound of the interval." } ], "return": { "nullable": null, "types": [ - "Node" + "IterableIterator" ], "spread": false, "description": "" } }, { - "__docId__": 129, - "kind": "file", - "name": "src/traversal/index.js", - "content": "export * from './inordertraversal.js';\nexport * from './rangetraversal.js';\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/index.js", + "__docId__": 126, + "kind": "method", + "name": "items", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", + "generator": true, + "async": false, + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#items", "access": "public", - "description": null, - "lineNumber": 1 + "description": "Returns an in order iterator over the keys of the tree.", + "lineNumber": 157, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{IterableIterator}" + } + ], + "return": { + "nullable": null, + "types": [ + "IterableIterator" + ], + "spread": false, + "description": "" + }, + "params": [] }, { - "__docId__": 130, - "kind": "file", - "name": "src/traversal/inordertraversal.js", - "content": "/**\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {Iterator}\n */\nexport function* inordertraversal(node) {\n\tif (!node.left.isLeaf()) {\n\t\t// Yield the nodes on the left recursively. Those nodes are all smaller\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tyield* inordertraversal(node.left);\n\t}\n\n\t// Yield the current node.\n\tyield node.key;\n\n\tif (!node.right.isLeaf()) {\n\t\t// Yield the nodes on the right recursively. Those nodes are all larger\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tyield* inordertraversal(node.right);\n\t}\n}\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/inordertraversal.js", + "__docId__": 127, + "kind": "method", + "name": "[Symbol.iterator]", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", + "generator": false, + "async": false, + "static": false, + "longname": "src/types/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "access": "public", - "description": null, - "lineNumber": 1 + "description": "Same as {@link RedBlackTree#items}.", + "lineNumber": 164, + "params": [], + "return": { + "types": [ + "*" + ] + } }, { - "__docId__": 131, - "kind": "function", - "name": "inordertraversal", - "memberof": "src/traversal/inordertraversal.js", - "generator": true, + "__docId__": 128, + "kind": "method", + "name": "empty", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", + "generator": false, "async": false, "static": true, - "longname": "src/traversal/inordertraversal.js~inordertraversal", + "longname": "src/types/RedBlackTree.js~RedBlackTree.empty", "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/traversal/inordertraversal.js", - "importStyle": "{inordertraversal}", - "description": "Traverses the tree rooted at node in order.", - "lineNumber": 7, + "description": "Constructs an empty red-black tree.", + "lineNumber": 174, "unknown": [ { "tagName": "@returns", - "tagValue": "{Iterator}" + "tagValue": "{RedBlackTree}" } ], "params": [ { "nullable": null, "types": [ - "Node" + "Function" ], "spread": false, "optional": false, - "name": "node", - "description": "The root of the tree." + "name": "compare", + "description": "The comparison function to use." } ], "return": { "nullable": null, "types": [ - "Iterator" + "RedBlackTree" ], "spread": false, "description": "" } }, { - "__docId__": 132, - "kind": "file", - "name": "src/traversal/rangetraversal.js", - "content": "/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {Key} left - The lower bound of the interval.\n * @param {Key} right - The upper bound of the interval.\n * @returns {Iterator}\n */\nexport function* rangetraversal(compare, root, left, right) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (!root.right.isLeaf())\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t} else if (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (!root.left.isLeaf())\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t} else {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif (!root.left.isLeaf())\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\tyield root.key;\n\t\tif (!root.right.isLeaf())\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t}\n}\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/rangetraversal.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 133, - "kind": "function", - "name": "rangetraversal", - "memberof": "src/traversal/rangetraversal.js", - "generator": true, + "__docId__": 129, + "kind": "method", + "name": "from", + "memberof": "src/types/RedBlackTree.js~RedBlackTree", + "generator": false, "async": false, "static": true, - "longname": "src/traversal/rangetraversal.js~rangetraversal", + "longname": "src/types/RedBlackTree.js~RedBlackTree.from", "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/traversal/rangetraversal.js", - "importStyle": "{rangetraversal}", - "description": "Yields all the keys in the tree rooted at root that lie in the\ninterval [left, right[, in order.", - "lineNumber": 11, + "description": "Constructs a red-black tree from an input iterable.", + "lineNumber": 185, "unknown": [ { "tagName": "@returns", - "tagValue": "{Iterator}" + "tagValue": "{RedBlackTree}" } ], "params": [ @@ -2516,43 +2520,23 @@ "spread": false, "optional": false, "name": "compare", - "description": "The comparison function." - }, - { - "nullable": null, - "types": [ - "Node" - ], - "spread": false, - "optional": false, - "name": "root", - "description": "The root of the tree." - }, - { - "nullable": null, - "types": [ - "Key" - ], - "spread": false, - "optional": false, - "name": "left", - "description": "The lower bound of the interval." + "description": "The comparison function to use." }, { "nullable": null, "types": [ - "Key" + "Iterable" ], "spread": false, "optional": false, - "name": "right", - "description": "The upper bound of the interval." + "name": "iterable", + "description": "The input iterable." } ], "return": { "nullable": null, "types": [ - "Iterator" + "RedBlackTree" ], "spread": false, "description": "" @@ -2560,7 +2544,7 @@ }, { "kind": "index", - "content": ":christmas_tree: [@aureooms/js-red-black-tree](https://aureooms.github.io/js-red-black-tree)\n==\n\n\n\n```js\nlet tree = RedBlackTree.from( increasing , range( 100000 ) ) ;\n```\n\nRed-black tree library for JavaScript.\nSee [documentation](https://aureooms.github.io/js-red-black-tree/index.html).\nParent is [@aureooms/js-bst](https://github.com/aureooms/js-bst).\n\n[![License](https://img.shields.io/github/license/aureooms/js-red-black-tree.svg)](https://raw.githubusercontent.com/aureooms/js-red-black-tree/main/LICENSE)\n[![Version](https://img.shields.io/npm/v/@aureooms/js-red-black-tree.svg)](https://www.npmjs.org/package/@aureooms/js-red-black-tree)\n[![Tests](https://img.shields.io/github/workflow/status/aureooms/js-red-black-tree/ci:test?event=push&label=tests)](https://github.com/aureooms/js-red-black-tree/actions/workflows/ci:test.yml?query=branch:main)\n[![Dependencies](https://img.shields.io/david/aureooms/js-red-black-tree.svg)](https://david-dm.org/aureooms/js-red-black-tree)\n[![Dev dependencies](https://img.shields.io/david/dev/aureooms/js-red-black-tree.svg)](https://david-dm.org/aureooms/js-red-black-tree?type=dev)\n[![GitHub issues](https://img.shields.io/github/issues/aureooms/js-red-black-tree.svg)](https://github.com/aureooms/js-red-black-tree/issues)\n[![Downloads](https://img.shields.io/npm/dm/@aureooms/js-red-black-tree.svg)](https://www.npmjs.org/package/@aureooms/js-red-black-tree)\n\n[![Code issues](https://img.shields.io/codeclimate/issues/aureooms/js-red-black-tree.svg)](https://codeclimate.com/github/aureooms/js-red-black-tree/issues)\n[![Code maintainability](https://img.shields.io/codeclimate/maintainability/aureooms/js-red-black-tree.svg)](https://codeclimate.com/github/aureooms/js-red-black-tree/trends/churn)\n[![Code coverage (cov)](https://img.shields.io/codecov/c/gh/aureooms/js-red-black-tree/main.svg)](https://codecov.io/gh/aureooms/js-red-black-tree)\n[![Code technical debt](https://img.shields.io/codeclimate/tech-debt/aureooms/js-red-black-tree.svg)](https://codeclimate.com/github/aureooms/js-red-black-tree/trends/technical_debt)\n[![Documentation](https://aureooms.github.io/js-red-black-tree/badge.svg)](https://aureooms.github.io/js-red-black-tree/source.html)\n[![Package size](https://img.shields.io/bundlephobia/minzip/@aureooms/js-red-black-tree)](https://bundlephobia.com/result?p=@aureooms/js-red-black-tree)\n", + "content": ":christmas_tree: [@aureooms/js-red-black-tree](https://aureooms.github.io/js-red-black-tree)\n==\n\n

    \n\n

    \n\n```js\nimport {from} from '@aureooms/js-red-black-tree';\nimport {increasing} from '@aureooms/js-compare';\nimport {range} from '@aureooms/js-itertools';\nlet tree = from( increasing , range( 100000 ) ) ;\n```\n\nRed-black tree library for JavaScript.\nSee [documentation](https://aureooms.github.io/js-red-black-tree/index.html).\nParent is [@aureooms/js-bst](https://github.com/aureooms/js-bst).\n\n[![License](https://img.shields.io/github/license/aureooms/js-red-black-tree.svg)](https://raw.githubusercontent.com/aureooms/js-red-black-tree/main/LICENSE)\n[![Version](https://img.shields.io/npm/v/@aureooms/js-red-black-tree.svg)](https://www.npmjs.org/package/@aureooms/js-red-black-tree)\n[![Tests](https://img.shields.io/github/workflow/status/aureooms/js-red-black-tree/ci:test?event=push&label=tests)](https://github.com/aureooms/js-red-black-tree/actions/workflows/ci:test.yml?query=branch:main)\n[![Dependencies](https://img.shields.io/david/aureooms/js-red-black-tree.svg)](https://david-dm.org/aureooms/js-red-black-tree)\n[![Dev dependencies](https://img.shields.io/david/dev/aureooms/js-red-black-tree.svg)](https://david-dm.org/aureooms/js-red-black-tree?type=dev)\n[![GitHub issues](https://img.shields.io/github/issues/aureooms/js-red-black-tree.svg)](https://github.com/aureooms/js-red-black-tree/issues)\n[![Downloads](https://img.shields.io/npm/dm/@aureooms/js-red-black-tree.svg)](https://www.npmjs.org/package/@aureooms/js-red-black-tree)\n\n[![Code issues](https://img.shields.io/codeclimate/issues/aureooms/js-red-black-tree.svg)](https://codeclimate.com/github/aureooms/js-red-black-tree/issues)\n[![Code maintainability](https://img.shields.io/codeclimate/maintainability/aureooms/js-red-black-tree.svg)](https://codeclimate.com/github/aureooms/js-red-black-tree/trends/churn)\n[![Code coverage (cov)](https://img.shields.io/codecov/c/gh/aureooms/js-red-black-tree/main.svg)](https://codecov.io/gh/aureooms/js-red-black-tree)\n[![Code technical debt](https://img.shields.io/codeclimate/tech-debt/aureooms/js-red-black-tree.svg)](https://codeclimate.com/github/aureooms/js-red-black-tree/trends/technical_debt)\n[![Documentation](https://aureooms.github.io/js-red-black-tree/badge.svg)](https://aureooms.github.io/js-red-black-tree/source.html)\n[![Package size](https://img.shields.io/bundlephobia/minzip/@aureooms/js-red-black-tree)](https://bundlephobia.com/result?p=@aureooms/js-red-black-tree)\n", "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/README.md", "name": "./README.md", "static": true, @@ -2568,7 +2552,7 @@ }, { "kind": "packageJSON", - "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"6.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"esmodule\": \"dist/index.modern.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"c8 --all --src src --reporter=lcov npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.13\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.8\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.6.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"5.2.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"test\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"development\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"production\": {\n \"plugins\": [\n \"babel-plugin-unassert\",\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", + "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"7.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"esmodule\": \"dist/index.modern.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"c8 --all --src src --reporter=lcov npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.14\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.14\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.6.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"5.2.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"test\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"development\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"production\": {\n \"plugins\": [\n \"babel-plugin-unassert\",\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/package.json", "name": "package.json", "static": true, @@ -2602,7 +2586,7 @@ "kind": "manual", "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/doc/manual/usage.md", "name": "./doc/manual/usage.md", - "content": "# Usage\nThe code needs a ES2015+ polyfill to work, for example\n[regenerator-runtime/runtime](https://babeljs.io/docs/usage/polyfill).\n```js\nrequire( 'regenerator-runtime/runtime' ) ;\n// or\nimport 'regenerator-runtime/runtime.js' ;\n```\n\nThen\n```js\nconst { RedBlackTree } = require( '@aureooms/js-red-black-tree' ) ;\n// or\nimport { RedBlackTree } from '@aureooms/js-red-black-tree' ;\n```\n", + "content": "# Usage\nThe code needs a ES2015+ polyfill to work, for example\n[regenerator-runtime/runtime](https://babeljs.io/docs/usage/polyfill).\n```js\nrequire( 'regenerator-runtime/runtime' ) ;\n// or\nimport 'regenerator-runtime/runtime.js' ;\n```\n\nThen\n```js\nconst { empty , from } = require( '@aureooms/js-red-black-tree' ) ;\n// or\nimport { empty , from } from '@aureooms/js-red-black-tree' ;\n```\n", "static": true, "access": "public" }, diff --git a/manual/index.html b/manual/index.html index 136fbfe..fdea51e 100644 --- a/manual/index.html +++ b/manual/index.html @@ -86,9 +86,9 @@ regenerator-runtime/runtime.

    require( 'regenerator-runtime/runtime' ) ;
     // or
     import 'regenerator-runtime/runtime.js' ;
    -

    Then

    const { RedBlackTree } = require( '@aureooms/js-red-black-tree' ) ;
    +

    Then

    const { empty , from } = require( '@aureooms/js-red-black-tree' ) ;
     // or
    -import { RedBlackTree } from '@aureooms/js-red-black-tree' ;
    +import { empty , from } from '@aureooms/js-red-black-tree' ;
     
    diff --git a/manual/usage.html b/manual/usage.html index fad3121..e3915ea 100644 --- a/manual/usage.html +++ b/manual/usage.html @@ -64,9 +64,9 @@ import 'regenerator-runtime/runtime.js' ;

    Then

    -
    const { RedBlackTree } = require( '@aureooms/js-red-black-tree' ) ;
    +
    const { empty , from } = require( '@aureooms/js-red-black-tree' ) ;
     // or
    -import { RedBlackTree } from '@aureooms/js-red-black-tree' ;
    +import { empty , from } from '@aureooms/js-red-black-tree' ;
     
    diff --git a/script/search_index.js b/script/search_index.js index 7f7c576..acd5c96 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -6,15 +6,15 @@ window.esdocSearchIndex = [ "variable" ], [ - "@aureooms/js-red-black-tree/src/adt/leaf.js~leaf", + "@aureooms/js-red-black-tree/src/types/leaf.js~leaf", "function/index.html#static-function-Leaf", - "Leaf @aureooms/js-red-black-tree/src/adt/Leaf.js", + "Leaf @aureooms/js-red-black-tree/src/types/Leaf.js", "function" ], [ - "@aureooms/js-red-black-tree/src/adt/node.js~node", + "@aureooms/js-red-black-tree/src/types/node.js~node", "function/index.html#static-function-Node", - "Node @aureooms/js-red-black-tree/src/adt/Node.js", + "Node @aureooms/js-red-black-tree/src/types/Node.js", "function" ], [ @@ -24,15 +24,15 @@ window.esdocSearchIndex = [ "variable" ], [ - "@aureooms/js-red-black-tree/src/adt/redblacktree.js~redblacktree", - "class/src/adt/RedBlackTree.js~RedBlackTree.html", - "RedBlackTree @aureooms/js-red-black-tree/src/adt/RedBlackTree.js", + "@aureooms/js-red-black-tree/src/types/redblacktree.js~redblacktree", + "class/src/types/RedBlackTree.js~RedBlackTree.html", + "RedBlackTree @aureooms/js-red-black-tree/src/types/RedBlackTree.js", "class" ], [ - "@aureooms/js-red-black-tree/src/debug/debug.js~_debug", + "@aureooms/js-red-black-tree/src/debug/_debug.js~_debug", "function/index.html#static-function-_debug", - "_debug @aureooms/js-red-black-tree/src/debug/debug.js", + "_debug @aureooms/js-red-black-tree/src/debug/_debug.js", "function" ], [ @@ -77,6 +77,18 @@ window.esdocSearchIndex = [ "delete_one_child @aureooms/js-red-black-tree/src/deletion/delete_one_child.js", "function" ], + [ + "@aureooms/js-red-black-tree/src/api/empty.js~empty", + "variable/index.html#static-variable-empty", + "empty @aureooms/js-red-black-tree/src/api/empty.js", + "variable" + ], + [ + "@aureooms/js-red-black-tree/src/api/from.js~from", + "variable/index.html#static-variable-from", + "from @aureooms/js-red-black-tree/src/api/from.js", + "variable" + ], [ "@aureooms/js-red-black-tree/src/family/grandparent.js~grandparent", "function/index.html#static-function-grandparent", @@ -456,111 +468,15 @@ window.esdocSearchIndex = [ "external" ], [ - "src/adt/leaf.js", - "file/src/adt/Leaf.js.html", - "src/adt/Leaf.js", - "file" - ], - [ - "src/adt/node.js", - "file/src/adt/Node.js.html", - "src/adt/Node.js", + "src/api/empty.js", + "file/src/api/empty.js.html", + "src/api/empty.js", "file" ], [ - "src/adt/redblacktree.js", - "file/src/adt/RedBlackTree.js.html", - "src/adt/RedBlackTree.js", - "file" - ], - [ - "src/adt/redblacktree.js~redblacktree#[symbol.iterator]", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-[Symbol.iterator]", - "src/adt/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#_delete", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-_delete", - "src/adt/RedBlackTree.js~RedBlackTree#_delete", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#_search", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-_search", - "src/adt/RedBlackTree.js~RedBlackTree#_search", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#add", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-add", - "src/adt/RedBlackTree.js~RedBlackTree#add", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#compare", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-member-compare", - "src/adt/RedBlackTree.js~RedBlackTree#compare", - "member" - ], - [ - "src/adt/redblacktree.js~redblacktree#constructor", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-constructor-constructor", - "src/adt/RedBlackTree.js~RedBlackTree#constructor", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#get", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-get", - "src/adt/RedBlackTree.js~RedBlackTree#get", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#has", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-has", - "src/adt/RedBlackTree.js~RedBlackTree#has", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#isempty", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-isEmpty", - "src/adt/RedBlackTree.js~RedBlackTree#isEmpty", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#items", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-items", - "src/adt/RedBlackTree.js~RedBlackTree#items", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#range", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-range", - "src/adt/RedBlackTree.js~RedBlackTree#range", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#remove", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-method-remove", - "src/adt/RedBlackTree.js~RedBlackTree#remove", - "method" - ], - [ - "src/adt/redblacktree.js~redblacktree#root", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#instance-member-root", - "src/adt/RedBlackTree.js~RedBlackTree#root", - "member" - ], - [ - "src/adt/redblacktree.js~redblacktree.from", - "class/src/adt/RedBlackTree.js~RedBlackTree.html#static-method-from", - "src/adt/RedBlackTree.js~RedBlackTree.from", - "method" - ], - [ - "src/adt/index.js", - "file/src/adt/index.js.html", - "src/adt/index.js", + "src/api/from.js", + "file/src/api/from.js.html", + "src/api/from.js", "file" ], [ @@ -576,21 +492,9 @@ window.esdocSearchIndex = [ "file" ], [ - "src/color/index.js", - "file/src/color/index.js.html", - "src/color/index.js", - "file" - ], - [ - "src/debug/debug.js", - "file/src/debug/debug.js.html", - "src/debug/debug.js", - "file" - ], - [ - "src/debug/index.js", - "file/src/debug/index.js.html", - "src/debug/index.js", + "src/debug/_debug.js", + "file/src/debug/_debug.js.html", + "src/debug/_debug.js", "file" ], [ @@ -635,12 +539,6 @@ window.esdocSearchIndex = [ "src/deletion/delete_one_child.js", "file" ], - [ - "src/deletion/index.js", - "file/src/deletion/index.js.html", - "src/deletion/index.js", - "file" - ], [ "src/deletion/replace_node.js", "file/src/deletion/replace_node.js.html", @@ -653,12 +551,6 @@ window.esdocSearchIndex = [ "src/family/grandparent.js", "file" ], - [ - "src/family/index.js", - "file/src/family/index.js.html", - "src/family/index.js", - "file" - ], [ "src/family/predecessor.js", "file/src/family/predecessor.js.html", @@ -683,12 +575,6 @@ window.esdocSearchIndex = [ "src/index.js", "file" ], - [ - "src/insertion/index.js", - "file/src/insertion/index.js.html", - "src/insertion/index.js", - "file" - ], [ "src/insertion/insert.js", "file/src/insertion/insert.js.html", @@ -725,12 +611,6 @@ window.esdocSearchIndex = [ "src/insertion/insert_case5.js", "file" ], - [ - "src/rotate/index.js", - "file/src/rotate/index.js.html", - "src/rotate/index.js", - "file" - ], [ "src/rotate/rotate_left.js", "file/src/rotate/rotate_left.js.html", @@ -743,24 +623,12 @@ window.esdocSearchIndex = [ "src/rotate/rotate_right.js", "file" ], - [ - "src/search/index.js", - "file/src/search/index.js.html", - "src/search/index.js", - "file" - ], [ "src/search/search.js", "file/src/search/search.js.html", "src/search/search.js", "file" ], - [ - "src/traversal/index.js", - "file/src/traversal/index.js.html", - "src/traversal/index.js", - "file" - ], [ "src/traversal/inordertraversal.js", "file/src/traversal/inordertraversal.js.html", @@ -772,5 +640,113 @@ window.esdocSearchIndex = [ "file/src/traversal/rangetraversal.js.html", "src/traversal/rangetraversal.js", "file" + ], + [ + "src/types/leaf.js", + "file/src/types/Leaf.js.html", + "src/types/Leaf.js", + "file" + ], + [ + "src/types/node.js", + "file/src/types/Node.js.html", + "src/types/Node.js", + "file" + ], + [ + "src/types/redblacktree.js", + "file/src/types/RedBlackTree.js.html", + "src/types/RedBlackTree.js", + "file" + ], + [ + "src/types/redblacktree.js~redblacktree#[symbol.iterator]", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-[Symbol.iterator]", + "src/types/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#_delete", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-_delete", + "src/types/RedBlackTree.js~RedBlackTree#_delete", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#_search", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-_search", + "src/types/RedBlackTree.js~RedBlackTree#_search", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#add", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-add", + "src/types/RedBlackTree.js~RedBlackTree#add", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#compare", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-member-compare", + "src/types/RedBlackTree.js~RedBlackTree#compare", + "member" + ], + [ + "src/types/redblacktree.js~redblacktree#constructor", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-constructor-constructor", + "src/types/RedBlackTree.js~RedBlackTree#constructor", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#get", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-get", + "src/types/RedBlackTree.js~RedBlackTree#get", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#has", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-has", + "src/types/RedBlackTree.js~RedBlackTree#has", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#isempty", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-isEmpty", + "src/types/RedBlackTree.js~RedBlackTree#isEmpty", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#items", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-items", + "src/types/RedBlackTree.js~RedBlackTree#items", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#range", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-range", + "src/types/RedBlackTree.js~RedBlackTree#range", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#remove", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-remove", + "src/types/RedBlackTree.js~RedBlackTree#remove", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree#root", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-member-root", + "src/types/RedBlackTree.js~RedBlackTree#root", + "member" + ], + [ + "src/types/redblacktree.js~redblacktree.empty", + "class/src/types/RedBlackTree.js~RedBlackTree.html#static-method-empty", + "src/types/RedBlackTree.js~RedBlackTree.empty", + "method" + ], + [ + "src/types/redblacktree.js~redblacktree.from", + "class/src/types/RedBlackTree.js~RedBlackTree.html#static-method-from", + "src/types/RedBlackTree.js~RedBlackTree.from", + "method" ] ] \ No newline at end of file diff --git a/source.html b/source.html index 7163c32..ae44f61 100644 --- a/source.html +++ b/source.html @@ -29,9 +29,8 @@ -

    Source 43/45

    +

    Source 48/48

    summary
    + public + + + + + +
    +

    + C + + + RedBlackTree +

    +
    +
    + + +

    A RedBlackTree with key-only nodes.

    +
    +
    +
    + + +
    + public + + + + + +
    +

    + F + + + Leaf(parent: Node) +

    +
    +
    + + +

    A black leaf node.

    +
    +
    +
    + + +
    + public + + + + + +
    +

    + F + + + Node(color: number, key: any) +

    +
    +
    + + +

    An internal node.

    +
    +
    +
    + +
    @@ -78,316 +80,260 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - - - - + + + + + + - - - + + + - - - + + + - - - - - - - - - + - - - - - - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - + + + - - - + + + - - - - - - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - - - - - - - - - + + + - - - + + + - - - - - - - - - - - + + + - - - - - - - - - - - + + + - - - + + + - + + + + + + + + + + + + + + + + + - + + + + + + + + +
    src/adt/Leaf.jsLeaf100 %2/2446 byte232021-03-02 15:05:30 (UTC)
    src/adt/Node.jsNode100 %2/2585 byte272021-03-02 15:05:30 (UTC)
    src/adt/RedBlackTree.jsRedBlackTree86 %13/154447 byte1762021-03-02 15:05:30 (UTC)src/api/empty.jsempty100 %1/1176 byte82021-03-03 09:14:35 (UTC)
    src/adt/index.js--89 byte32021-03-02 15:05:30 (UTC)src/api/from.jsfrom100 %1/1171 byte82021-03-03 09:14:35 (UTC)
    src/color/BLACK.js BLACK 100 %1/155 byte42021-03-02 15:05:30 (UTC)70 byte52021-03-03 09:14:35 (UTC)
    src/color/RED.js RED 100 %1/151 byte42021-03-02 15:05:30 (UTC)64 byte52021-03-03 09:14:35 (UTC)
    src/color/index.js--54 byte22021-03-02 15:05:30 (UTC)
    src/debug/debug.jssrc/debug/_debug.js _debug 100 %1/1647 byte262021-03-02 15:05:30 (UTC)
    src/debug/index.js--28 byte12021-03-02 15:05:30 (UTC)901 byte372021-03-03 09:14:35 (UTC)
    src/deletion/delete_case1.js delete_case1 100 %1/1434 byte152021-03-02 15:05:30 (UTC)692 byte242021-03-03 09:14:35 (UTC)
    src/deletion/delete_case2.js delete_case2 100 %1/11151 byte412021-03-02 15:05:30 (UTC)1455 byte522021-03-03 09:14:35 (UTC)
    src/deletion/delete_case3.js delete_case3 100 %1/11263 byte442021-03-02 15:05:30 (UTC)1579 byte552021-03-03 09:14:35 (UTC)
    src/deletion/delete_case4.js delete_case4 100 %1/11431 byte462021-03-02 15:05:30 (UTC)1840 byte602021-03-03 09:14:35 (UTC)
    src/deletion/delete_case5.js delete_case5 100 %1/11839 byte582021-03-02 15:05:30 (UTC)2259 byte712021-03-03 09:14:35 (UTC)
    src/deletion/delete_case6.js delete_case6 100 %1/11525 byte512021-03-02 15:05:30 (UTC)1961 byte652021-03-03 09:14:35 (UTC)
    src/deletion/delete_one_child.js delete_one_child 100 %1/11340 byte422021-03-02 15:05:30 (UTC)
    src/deletion/index.js--284 byte82021-03-02 15:05:30 (UTC)1555 byte512021-03-03 09:14:35 (UTC)
    src/deletion/replace_node.js replace_node 100 %1/1387 byte152021-03-02 15:05:30 (UTC)575 byte232021-03-03 09:14:35 (UTC)
    src/family/grandparent.js grandparent 100 %1/1320 byte112021-03-02 15:05:30 (UTC)
    src/family/index.js--126 byte42021-03-02 15:05:30 (UTC)454 byte182021-03-03 09:14:35 (UTC)
    src/family/predecessor.js predecessor 100 %1/1373 byte152021-03-02 15:05:30 (UTC)507 byte232021-03-03 09:14:35 (UTC)
    src/family/sibling.js sibling 100 %1/1370 byte132021-03-02 15:05:30 (UTC)499 byte192021-03-03 09:14:35 (UTC)
    src/family/uncle.js uncle 100 %1/1436 byte162021-03-02 15:05:30 (UTC)559 byte222021-03-03 09:14:35 (UTC)
    src/index.js - -318 byte92021-03-02 15:05:30 (UTC)
    src/insertion/index.js--204 byte62021-03-02 15:05:30 (UTC)1934 byte312021-03-03 09:14:35 (UTC)
    src/insertion/insert.js insert 100 %1/11124 byte432021-03-02 15:05:30 (UTC)1285 byte502021-03-03 09:14:35 (UTC)
    src/insertion/insert_case1.js insert_case1 100 %1/1397 byte202021-03-02 15:05:30 (UTC)671 byte302021-03-03 09:14:35 (UTC)
    src/insertion/insert_case2.js insert_case2 100 %1/1456 byte242021-03-02 15:05:30 (UTC)759 byte362021-03-03 09:14:35 (UTC)
    src/insertion/insert_case3.js insert_case3 100 %1/11081 byte382021-03-02 15:05:30 (UTC)1433 byte512021-03-03 09:14:35 (UTC)
    src/insertion/insert_case4.js insert_case4 100 %1/12240 byte782021-03-02 15:05:30 (UTC)2659 byte922021-03-03 09:14:35 (UTC)
    src/insertion/insert_case5.js insert_case5 100 %1/11450 byte472021-03-02 15:05:30 (UTC)
    src/rotate/index.js--69 byte22021-03-02 15:05:30 (UTC)2063 byte702021-03-03 09:14:35 (UTC)
    src/rotate/rotate_left.js rotate_left 100 %1/1632 byte342021-03-02 15:05:30 (UTC)777 byte412021-03-03 09:14:35 (UTC)
    src/rotate/rotate_right.js rotate_right 100 %1/1642 byte342021-03-02 15:05:30 (UTC)
    src/search/index.js--29 byte12021-03-02 15:05:30 (UTC)788 byte412021-03-03 09:14:35 (UTC)
    src/search/search.js search 100 %1/1479 byte232021-03-02 15:05:30 (UTC)
    src/traversal/index.js--76 byte22021-03-02 15:05:30 (UTC)652 byte322021-03-03 09:14:35 (UTC)
    src/traversal/inordertraversal.js inordertraversal 100 %1/1687 byte242021-03-02 15:05:30 (UTC)876 byte302021-03-03 09:14:35 (UTC)
    src/traversal/rangetraversal.js rangetraversal 100 %1/11177 byte1463 byte432021-03-03 09:14:35 (UTC)
    src/types/Leaf.jsLeaf100 %2/2609 byte272021-03-03 09:14:35 (UTC)
    src/types/Node.jsNode100 %2/2790 byte 312021-03-02 15:05:30 (UTC)2021-03-03 09:14:35 (UTC)
    src/types/RedBlackTree.jsRedBlackTree100 %16/164957 byte1922021-03-03 09:14:35 (UTC)
    diff --git a/variable/index.html b/variable/index.html index 2b0c1dc..b5c79e4 100644 --- a/variable/index.html +++ b/variable/index.html @@ -29,9 +29,8 @@ @@ -123,6 +125,64 @@ + + + + + public + + + + + + +
    +

    + + + + empty: * +

    +
    +
    + + + +
    + + + + + + + + + public + + + + + + +
    +

    + + + + from: * +

    +
    +
    + + + +
    + + + + @@ -146,7 +206,7 @@

    - +

    Constant for black.

    @@ -190,7 +250,7 @@

    - +

    Constant for red.

    @@ -217,6 +277,94 @@

    +

    +
    +

    + public + + + + + + empty: * + + + + source + +

    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + +
    +
    +

    + public + + + + + + from: * + + + + source + +

    + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + +
    From d167bc0e3ebac6ff29fa7e69242b91482ebce82d Mon Sep 17 00:00:00 2001 From: aureooms Date: Wed, 31 Mar 2021 16:45:15 +0000 Subject: [PATCH 23/26] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20au?= =?UTF-8?q?reooms/js-red-black-tree@a5c59c519fe834b4429b3600da37f1ca99c57f?= =?UTF-8?q?e9=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ast/source/debug/_debug.js.json | 4180 ++---- ast/source/deletion/delete_case0.js.json | 3438 +++++ ast/source/deletion/delete_case1.js.json | 7634 +++++++--- ast/source/deletion/delete_case2.js.json | 5848 ++++---- ast/source/deletion/delete_case4.js.json | 9647 ------------- ast/source/deletion/delete_case5.js.json | 9431 +++++------- ast/source/deletion/delete_case6.js.json | 10232 ------------- ..._case3.js.json => delete_no_child.js.json} | 7029 +++++---- ast/source/deletion/delete_one_child.js.json | 6401 ++++---- ast/source/deletion/prune.js.json | 3554 +++++ ast/source/deletion/replace_node.js.json | 2265 ++- ast/source/family/predecessor.js.json | 680 +- ast/source/family/sibling.js.json | 1735 +-- ast/source/family/uncle.js.json | 3312 ++--- ast/source/index.js.json | 2182 +-- ast/source/insertion/insert.js.json | 414 +- ast/source/insertion/insert_case0.js.json | 5057 +++++++ ast/source/insertion/insert_case1.js.json | 4546 +++--- ast/source/insertion/insert_case2.js.json | 9137 +++++++++--- ast/source/insertion/insert_case3.js.json | 7823 ++++++---- ast/source/insertion/insert_case4.js.json | 12009 ++++++++++------ ast/source/insertion/insert_case5.js.json | 11607 --------------- ast/source/rotate/rotate_left.js.json | 3665 +++-- ast/source/rotate/rotate_right.js.json | 3951 +++-- ast/source/search/search.js.json | 3214 ++--- ast/source/traversal/inordertraversal.js.json | 984 +- ast/source/traversal/rangetraversal.js.json | 2090 ++- ast/source/types/Leaf.js.json | 2694 ---- ast/source/types/Node.js.json | 2391 +-- ast/source/types/RedBlackTree.js.json | 9161 ++++++------ .../types/RedBlackTree.js~RedBlackTree.html | 57 +- coverage.json | 37 +- file/src/api/empty.js.html | 11 +- file/src/api/from.js.html | 11 +- file/src/color/BLACK.js.html | 11 +- file/src/color/RED.js.html | 11 +- file/src/debug/_debug.js.html | 20 +- .../delete_case0.js.html} | 51 +- file/src/deletion/delete_case1.js.html | 53 +- file/src/deletion/delete_case2.js.html | 53 +- file/src/deletion/delete_case5.js.html | 82 +- file/src/deletion/delete_case6.js.html | 149 - ..._case3.js.html => delete_no_child.js.html} | 84 +- file/src/deletion/delete_one_child.js.html | 56 +- .../{delete_case4.js.html => prune.js.html} | 74 +- file/src/deletion/replace_node.js.html | 18 +- file/src/family/grandparent.js.html | 11 +- file/src/family/predecessor.js.html | 13 +- file/src/family/sibling.js.html | 20 +- file/src/family/uncle.js.html | 18 +- file/src/index.js.html | 18 +- file/src/insertion/insert.js.html | 17 +- ...ert_case5.js.html => insert_case0.js.html} | 79 +- file/src/insertion/insert_case1.js.html | 29 +- file/src/insertion/insert_case2.js.html | 47 +- file/src/insertion/insert_case3.js.html | 92 +- file/src/insertion/insert_case4.js.html | 97 +- file/src/rotate/rotate_left.js.html | 17 +- file/src/rotate/rotate_right.js.html | 17 +- file/src/search/search.js.html | 18 +- file/src/traversal/inordertraversal.js.html | 15 +- file/src/traversal/rangetraversal.js.html | 19 +- file/src/types/Node.js.html | 33 +- file/src/types/RedBlackTree.js.html | 47 +- function/index.html | 467 +- identifiers.html | 97 +- index.html | 11 +- index.json | 482 +- script/search_index.js | 96 +- source.html | 207 +- variable/index.html | 11 +- 71 files changed, 72588 insertions(+), 86479 deletions(-) create mode 100644 ast/source/deletion/delete_case0.js.json delete mode 100644 ast/source/deletion/delete_case4.js.json delete mode 100644 ast/source/deletion/delete_case6.js.json rename ast/source/deletion/{delete_case3.js.json => delete_no_child.js.json} (64%) create mode 100644 ast/source/deletion/prune.js.json create mode 100644 ast/source/insertion/insert_case0.js.json delete mode 100644 ast/source/insertion/insert_case5.js.json delete mode 100644 ast/source/types/Leaf.js.json rename file/src/{types/Leaf.js.html => deletion/delete_case0.js.html} (87%) delete mode 100644 file/src/deletion/delete_case6.js.html rename file/src/deletion/{delete_case3.js.html => delete_no_child.js.html} (80%) rename file/src/deletion/{delete_case4.js.html => prune.js.html} (76%) rename file/src/insertion/{insert_case5.js.html => insert_case0.js.html} (78%) diff --git a/ast/source/debug/_debug.js.json b/ast/source/debug/_debug.js.json index a57a4d8..d89bfaf 100644 --- a/ast/source/debug/_debug.js.json +++ b/ast/source/debug/_debug.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 901, + "end": 761, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 38, + "line": 33, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 901, + "end": 761, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 38, + "line": 33, "column": 0 } }, @@ -169,7 +169,7 @@ { "type": "ImportDeclaration", "start": 66, - "end": 102, + "end": 104, "loc": { "start": { "line": 3, @@ -177,14 +177,14 @@ }, "end": { "line": 3, - "column": 36 + "column": 38 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 73, - "end": 77, + "end": 78, "loc": { "start": { "line": 3, @@ -192,13 +192,13 @@ }, "end": { "line": 3, - "column": 11 + "column": 12 } }, "local": { "type": "Identifier", "start": 73, - "end": 77, + "end": 78, "loc": { "start": { "line": 3, @@ -206,75 +206,6 @@ }, "end": { "line": 3, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 83, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" - } - }, - { - "type": "ImportDeclaration", - "start": 103, - "end": 141, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 38 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 110, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 12 - } - }, - "local": { - "type": "Identifier", - "start": 110, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, "column": 12 }, "identifierName": "BLACK" @@ -285,15 +216,15 @@ ], "source": { "type": "StringLiteral", - "start": 121, - "end": 140, + "start": 84, + "end": 103, "loc": { "start": { - "line": 4, + "line": 3, "column": 18 }, "end": { - "line": 4, + "line": 3, "column": 37 } }, @@ -307,15 +238,15 @@ { "type": "CommentBlock", "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 143, - "end": 289, + "start": 106, + "end": 252, "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 11, + "line": 10, "column": 3 } } @@ -324,44 +255,44 @@ }, { "type": "Identifier", - "start": 290, - "end": 876, + "start": 253, + "end": 736, "loc": { "start": { - "line": 12, + "line": 11, "column": 0 }, "end": { - "line": 35, + "line": 30, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 296, - "end": 875, + "start": 259, + "end": 735, "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 35, + "line": 30, "column": 1 } }, "id": { "type": "Identifier", - "start": 296, - "end": 302, + "start": 259, + "end": 265, "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 12, + "line": 11, "column": 12 }, "identifierName": "_debug" @@ -371,15 +302,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 305, - "end": 875, + "start": 268, + "end": 735, "loc": { "start": { - "line": 12, + "line": 11, "column": 15 }, "end": { - "line": 35, + "line": 30, "column": 1 } }, @@ -390,30 +321,30 @@ "params": [ { "type": "ObjectPattern", - "start": 306, - "end": 318, + "start": 269, + "end": 281, "loc": { "start": { - "line": 12, + "line": 11, "column": 16 }, "end": { - "line": 12, + "line": 11, "column": 28 } }, "properties": [ { "type": "ObjectProperty", - "start": 307, - "end": 310, + "start": 270, + "end": 273, "loc": { "start": { - "line": 12, + "line": 11, "column": 17 }, "end": { - "line": 12, + "line": 11, "column": 20 } }, @@ -422,15 +353,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 307, - "end": 310, + "start": 270, + "end": 273, "loc": { "start": { - "line": 12, + "line": 11, "column": 17 }, "end": { - "line": 12, + "line": 11, "column": 20 }, "identifierName": "red" @@ -439,15 +370,15 @@ }, "value": { "type": "Identifier", - "start": 307, - "end": 310, + "start": 270, + "end": 273, "loc": { "start": { - "line": 12, + "line": 11, "column": 17 }, "end": { - "line": 12, + "line": 11, "column": 20 }, "identifierName": "red" @@ -460,15 +391,15 @@ }, { "type": "ObjectProperty", - "start": 312, - "end": 317, + "start": 275, + "end": 280, "loc": { "start": { - "line": 12, + "line": 11, "column": 22 }, "end": { - "line": 12, + "line": 11, "column": 27 } }, @@ -477,15 +408,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 312, - "end": 317, + "start": 275, + "end": 280, "loc": { "start": { - "line": 12, + "line": 11, "column": 22 }, "end": { - "line": 12, + "line": 11, "column": 27 }, "identifierName": "black" @@ -494,15 +425,15 @@ }, "value": { "type": "Identifier", - "start": 312, - "end": 317, + "start": 275, + "end": 280, "loc": { "start": { - "line": 12, + "line": 11, "column": 22 }, "end": { - "line": 12, + "line": 11, "column": 27 }, "identifierName": "black" @@ -518,59 +449,59 @@ ], "body": { "type": "BlockStatement", - "start": 323, - "end": 875, + "start": 286, + "end": 735, "loc": { "start": { - "line": 12, + "line": 11, "column": 33 }, "end": { - "line": 35, + "line": 30, "column": 1 } }, "body": [ { "type": "VariableDeclaration", - "start": 518, - "end": 857, + "start": 476, + "end": 717, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 32, + "line": 27, "column": 3 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 524, - "end": 856, + "start": 482, + "end": 716, "loc": { "start": { - "line": 20, + "line": 19, "column": 7 }, "end": { - "line": 32, + "line": 27, "column": 2 } }, "id": { "type": "Identifier", - "start": 524, - "end": 529, + "start": 482, + "end": 487, "loc": { "start": { - "line": 20, + "line": 19, "column": 7 }, "end": { - "line": 20, + "line": 19, "column": 12 }, "identifierName": "debug" @@ -580,15 +511,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 532, - "end": 856, + "start": 490, + "end": 716, "loc": { "start": { - "line": 20, + "line": 19, "column": 15 }, "end": { - "line": 32, + "line": 27, "column": 2 } }, @@ -599,15 +530,15 @@ "params": [ { "type": "Identifier", - "start": 533, - "end": 537, + "start": 491, + "end": 495, "loc": { "start": { - "line": 20, + "line": 19, "column": 16 }, "end": { - "line": 20, + "line": 19, "column": 20 }, "identifierName": "root" @@ -617,523 +548,223 @@ ], "body": { "type": "BlockStatement", - "start": 542, - "end": 856, + "start": 500, + "end": 716, "loc": { "start": { - "line": 20, + "line": 19, "column": 25 }, "end": { - "line": 32, + "line": 27, "column": 2 } }, "body": [ { - "type": "ExpressionStatement", - "start": 546, - "end": 599, + "type": "IfStatement", + "start": 504, + "end": 541, "loc": { "start": { - "line": 21, + "line": 20, "column": 2 }, "end": { - "line": 21, - "column": 55 + "line": 20, + "column": 39 } }, - "expression": { - "type": "CallExpression", - "start": 546, - "end": 598, + "test": { + "type": "BinaryExpression", + "start": 508, + "end": 521, "loc": { "start": { - "line": 21, - "column": 2 + "line": 20, + "column": 6 }, "end": { - "line": 21, - "column": 54 + "line": 20, + "column": 19 } }, - "callee": { + "left": { "type": "Identifier", - "start": 546, - "end": 552, + "start": 508, + "end": 512, "loc": { "start": { - "line": 21, - "column": 2 + "line": 20, + "column": 6 }, "end": { - "line": 21, - "column": 8 + "line": 20, + "column": 10 }, - "identifierName": "assert" + "identifierName": "root" }, - "name": "assert" + "name": "root" }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 553, - "end": 597, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 517, + "end": 521, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 19 + } + } + } + }, + "consequent": { + "type": "ReturnStatement", + "start": 523, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 39 + } + }, + "argument": { + "type": "CallExpression", + "start": 530, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 20, + "column": 38 + } + }, + "callee": { + "type": "Identifier", + "start": 530, + "end": 535, "loc": { "start": { - "line": 21, - "column": 9 + "line": 20, + "column": 28 }, "end": { - "line": 21, - "column": 53 - } - }, - "left": { - "type": "BinaryExpression", - "start": 553, - "end": 573, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 29 - } - }, - "left": { - "type": "Identifier", - "start": 553, - "end": 557, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 13 - }, - "identifierName": "root" - }, - "name": "root" + "line": 20, + "column": 33 }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 569, - "end": 573, - "loc": { - "start": { - "line": 21, - "column": 25 - }, - "end": { - "line": 21, - "column": 29 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "identifierName": "black" }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 577, - "end": 597, + "name": "black" + }, + "arguments": [ + { + "type": "StringLiteral", + "start": 536, + "end": 539, "loc": { "start": { - "line": 21, - "column": 33 + "line": 20, + "column": 34 }, "end": { - "line": 21, - "column": 53 + "line": 20, + "column": 37 } }, - "left": { - "type": "Identifier", - "start": 577, - "end": 581, - "loc": { - "start": { - "line": 21, - "column": 33 - }, - "end": { - "line": 21, - "column": 37 - }, - "identifierName": "root" - }, - "name": "root" + "extra": { + "rawValue": "L", + "raw": "'L'" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 593, - "end": 597, - "loc": { - "start": { - "line": 21, - "column": 49 - }, - "end": { - "line": 21, - "column": 53 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "value": "L" } - } - ] - } + ] + } + }, + "alternate": null }, { - "type": "IfStatement", - "start": 602, - "end": 681, + "type": "ExpressionStatement", + "start": 545, + "end": 574, "loc": { "start": { "line": 22, "column": 2 }, "end": { - "line": 25, - "column": 3 + "line": 22, + "column": 31 } }, - "test": { + "expression": { "type": "CallExpression", - "start": 606, - "end": 619, + "start": 545, + "end": 573, "loc": { "start": { "line": 22, - "column": 6 + "column": 2 }, "end": { "line": 22, - "column": 19 + "column": 30 } }, "callee": { - "type": "MemberExpression", - "start": 606, - "end": 617, + "type": "Identifier", + "start": 545, + "end": 551, "loc": { "start": { "line": 22, - "column": 6 + "column": 2 }, "end": { "line": 22, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 606, - "end": 610, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 10 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 611, - "end": 617, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 17 - }, - "identifierName": "isLeaf" + "column": 8 }, - "name": "isLeaf" - }, - "computed": false - }, - "arguments": [] - }, - "consequent": { - "type": "BlockStatement", - "start": 621, - "end": 681, - "loc": { - "start": { - "line": 22, - "column": 21 + "identifierName": "assert" }, - "end": { - "line": 25, - "column": 3 - } + "name": "assert" }, - "body": [ + "arguments": [ { - "type": "ExpressionStatement", - "start": 626, - "end": 655, + "type": "BinaryExpression", + "start": 552, + "end": 572, "loc": { "start": { - "line": 23, - "column": 3 + "line": 22, + "column": 9 }, "end": { - "line": 23, - "column": 32 + "line": 22, + "column": 29 } }, - "expression": { - "type": "CallExpression", - "start": 626, - "end": 654, + "left": { + "type": "Identifier", + "start": 552, + "end": 556, "loc": { "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 626, - "end": 632, - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 633, - "end": 653, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 30 - } - }, - "left": { - "type": "Identifier", - "start": 633, - "end": 637, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - }, - "identifierName": "root" - }, - "name": "root" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 649, - "end": 653, - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 30 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ] - } - }, - { - "type": "ReturnStatement", - "start": 659, - "end": 677, - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 21 - } - }, - "argument": { - "type": "CallExpression", - "start": 666, - "end": 676, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 20 - } - }, - "callee": { - "type": "Identifier", - "start": 666, - "end": 671, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 15 - }, - "identifierName": "black" - }, - "name": "black" - }, - "arguments": [ - { - "type": "StringLiteral", - "start": 672, - "end": 675, - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 19 - } - }, - "extra": { - "rawValue": "L", - "raw": "'L'" - }, - "value": "L" - } - ] - } - } - ], - "directives": [] - }, - "alternate": null - }, - { - "type": "ExpressionStatement", - "start": 685, - "end": 714, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 31 - } - }, - "expression": { - "type": "CallExpression", - "start": 685, - "end": 713, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 30 - } - }, - "callee": { - "type": "Identifier", - "start": 685, - "end": 691, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 692, - "end": 712, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 29 - } - }, - "left": { - "type": "Identifier", - "start": 692, - "end": 696, - "loc": { - "start": { - "line": 27, + "line": 22, "column": 9 }, "end": { - "line": 27, + "line": 22, "column": 13 }, "identifierName": "root" @@ -1143,15 +774,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 708, - "end": 712, + "start": 568, + "end": 572, "loc": { "start": { - "line": 27, + "line": 22, "column": 25 }, "end": { - "line": 27, + "line": 22, "column": 29 }, "identifierName": "Node" @@ -1164,44 +795,44 @@ }, { "type": "VariableDeclaration", - "start": 718, - "end": 787, + "start": 578, + "end": 647, "loc": { "start": { - "line": 29, + "line": 24, "column": 2 }, "end": { - "line": 29, + "line": 24, "column": 71 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 724, - "end": 786, + "start": 584, + "end": 646, "loc": { "start": { - "line": 29, + "line": 24, "column": 8 }, "end": { - "line": 29, + "line": 24, "column": 70 } }, "id": { "type": "Identifier", - "start": 724, - "end": 728, + "start": 584, + "end": 588, "loc": { "start": { - "line": 29, + "line": 24, "column": 8 }, "end": { - "line": 29, + "line": 24, "column": 12 }, "identifierName": "repr" @@ -1210,57 +841,57 @@ }, "init": { "type": "ConditionalExpression", - "start": 731, - "end": 786, + "start": 591, + "end": 646, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 70 } }, "test": { "type": "BinaryExpression", - "start": 731, - "end": 752, + "start": 591, + "end": 612, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 36 } }, "left": { "type": "MemberExpression", - "start": 731, - "end": 742, + "start": 591, + "end": 602, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 26 } }, "object": { "type": "Identifier", - "start": 731, - "end": 735, + "start": 591, + "end": 595, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 19 }, "identifierName": "root" @@ -1269,15 +900,15 @@ }, "property": { "type": "Identifier", - "start": 736, - "end": 742, + "start": 596, + "end": 602, "loc": { "start": { - "line": 29, + "line": 24, "column": 20 }, "end": { - "line": 29, + "line": 24, "column": 26 }, "identifierName": "_color" @@ -1289,15 +920,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 747, - "end": 752, + "start": 607, + "end": 612, "loc": { "start": { - "line": 29, + "line": 24, "column": 31 }, "end": { - "line": 29, + "line": 24, "column": 36 }, "identifierName": "BLACK" @@ -1307,29 +938,29 @@ }, "consequent": { "type": "CallExpression", - "start": 755, - "end": 770, + "start": 615, + "end": 630, "loc": { "start": { - "line": 29, + "line": 24, "column": 39 }, "end": { - "line": 29, + "line": 24, "column": 54 } }, "callee": { "type": "Identifier", - "start": 755, - "end": 760, + "start": 615, + "end": 620, "loc": { "start": { - "line": 29, + "line": 24, "column": 39 }, "end": { - "line": 29, + "line": 24, "column": 44 }, "identifierName": "black" @@ -1339,29 +970,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 761, - "end": 769, + "start": 621, + "end": 629, "loc": { "start": { - "line": 29, + "line": 24, "column": 45 }, "end": { - "line": 29, + "line": 24, "column": 53 } }, "object": { "type": "Identifier", - "start": 761, - "end": 765, + "start": 621, + "end": 625, "loc": { "start": { - "line": 29, + "line": 24, "column": 45 }, "end": { - "line": 29, + "line": 24, "column": 49 }, "identifierName": "root" @@ -1370,15 +1001,15 @@ }, "property": { "type": "Identifier", - "start": 766, - "end": 769, + "start": 626, + "end": 629, "loc": { "start": { - "line": 29, + "line": 24, "column": 50 }, "end": { - "line": 29, + "line": 24, "column": 53 }, "identifierName": "key" @@ -1391,29 +1022,29 @@ }, "alternate": { "type": "CallExpression", - "start": 773, - "end": 786, + "start": 633, + "end": 646, "loc": { "start": { - "line": 29, + "line": 24, "column": 57 }, "end": { - "line": 29, + "line": 24, "column": 70 } }, "callee": { "type": "Identifier", - "start": 773, - "end": 776, + "start": 633, + "end": 636, "loc": { "start": { - "line": 29, + "line": 24, "column": 57 }, "end": { - "line": 29, + "line": 24, "column": 60 }, "identifierName": "red" @@ -1423,29 +1054,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 777, - "end": 785, + "start": 637, + "end": 645, "loc": { "start": { - "line": 29, + "line": 24, "column": 61 }, "end": { - "line": 29, + "line": 24, "column": 69 } }, "object": { "type": "Identifier", - "start": 777, - "end": 781, + "start": 637, + "end": 641, "loc": { "start": { - "line": 29, + "line": 24, "column": 61 }, "end": { - "line": 29, + "line": 24, "column": 65 }, "identifierName": "root" @@ -1454,15 +1085,15 @@ }, "property": { "type": "Identifier", - "start": 782, - "end": 785, + "start": 642, + "end": 645, "loc": { "start": { - "line": 29, + "line": 24, "column": 66 }, "end": { - "line": 29, + "line": 24, "column": 69 }, "identifierName": "key" @@ -1480,58 +1111,58 @@ }, { "type": "ReturnStatement", - "start": 791, - "end": 853, + "start": 651, + "end": 713, "loc": { "start": { - "line": 31, + "line": 26, "column": 2 }, "end": { - "line": 31, + "line": 26, "column": 64 } }, "argument": { "type": "TemplateLiteral", - "start": 798, - "end": 852, + "start": 658, + "end": 712, "loc": { "start": { - "line": 31, + "line": 26, "column": 9 }, "end": { - "line": 31, + "line": 26, "column": 63 } }, "expressions": [ { "type": "CallExpression", - "start": 802, - "end": 818, + "start": 662, + "end": 678, "loc": { "start": { - "line": 31, + "line": 26, "column": 13 }, "end": { - "line": 31, + "line": 26, "column": 29 } }, "callee": { "type": "Identifier", - "start": 802, - "end": 807, + "start": 662, + "end": 667, "loc": { "start": { - "line": 31, + "line": 26, "column": 13 }, "end": { - "line": 31, + "line": 26, "column": 18 }, "identifierName": "debug" @@ -1541,29 +1172,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 808, - "end": 817, + "start": 668, + "end": 677, "loc": { "start": { - "line": 31, + "line": 26, "column": 19 }, "end": { - "line": 31, + "line": 26, "column": 28 } }, "object": { "type": "Identifier", - "start": 808, - "end": 812, + "start": 668, + "end": 672, "loc": { "start": { - "line": 31, + "line": 26, "column": 19 }, "end": { - "line": 31, + "line": 26, "column": 23 }, "identifierName": "root" @@ -1572,15 +1203,15 @@ }, "property": { "type": "Identifier", - "start": 813, - "end": 817, + "start": 673, + "end": 677, "loc": { "start": { - "line": 31, + "line": 26, "column": 24 }, "end": { - "line": 31, + "line": 26, "column": 28 }, "identifierName": "left" @@ -1593,15 +1224,15 @@ }, { "type": "Identifier", - "start": 823, - "end": 827, + "start": 683, + "end": 687, "loc": { "start": { - "line": 31, + "line": 26, "column": 34 }, "end": { - "line": 31, + "line": 26, "column": 38 }, "identifierName": "repr" @@ -1610,29 +1241,29 @@ }, { "type": "CallExpression", - "start": 832, - "end": 849, + "start": 692, + "end": 709, "loc": { "start": { - "line": 31, + "line": 26, "column": 43 }, "end": { - "line": 31, + "line": 26, "column": 60 } }, "callee": { "type": "Identifier", - "start": 832, - "end": 837, + "start": 692, + "end": 697, "loc": { "start": { - "line": 31, + "line": 26, "column": 43 }, "end": { - "line": 31, + "line": 26, "column": 48 }, "identifierName": "debug" @@ -1642,29 +1273,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 838, - "end": 848, + "start": 698, + "end": 708, "loc": { "start": { - "line": 31, + "line": 26, "column": 49 }, "end": { - "line": 31, + "line": 26, "column": 59 } }, "object": { "type": "Identifier", - "start": 838, - "end": 842, + "start": 698, + "end": 702, "loc": { "start": { - "line": 31, + "line": 26, "column": 49 }, "end": { - "line": 31, + "line": 26, "column": 53 }, "identifierName": "root" @@ -1673,15 +1304,15 @@ }, "property": { "type": "Identifier", - "start": 843, - "end": 848, + "start": 703, + "end": 708, "loc": { "start": { - "line": 31, + "line": 26, "column": 54 }, "end": { - "line": 31, + "line": 26, "column": 59 }, "identifierName": "right" @@ -1696,15 +1327,15 @@ "quasis": [ { "type": "TemplateElement", - "start": 799, - "end": 800, + "start": 659, + "end": 660, "loc": { "start": { - "line": 31, + "line": 26, "column": 10 }, "end": { - "line": 31, + "line": 26, "column": 11 } }, @@ -1716,15 +1347,15 @@ }, { "type": "TemplateElement", - "start": 819, - "end": 821, + "start": 679, + "end": 681, "loc": { "start": { - "line": 31, + "line": 26, "column": 30 }, "end": { - "line": 31, + "line": 26, "column": 32 } }, @@ -1736,15 +1367,15 @@ }, { "type": "TemplateElement", - "start": 828, - "end": 830, + "start": 688, + "end": 690, "loc": { "start": { - "line": 31, + "line": 26, "column": 39 }, "end": { - "line": 31, + "line": 26, "column": 41 } }, @@ -1756,15 +1387,15 @@ }, { "type": "TemplateElement", - "start": 850, - "end": 851, + "start": 710, + "end": 711, "loc": { "start": { - "line": 31, + "line": 26, "column": 61 }, "end": { - "line": 31, + "line": 26, "column": 62 } }, @@ -1788,16 +1419,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t ", - "start": 326, - "end": 516, + "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t ", + "start": 289, + "end": 474, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 19, + "line": 18, "column": 4 } } @@ -1806,29 +1437,29 @@ }, { "type": "ReturnStatement", - "start": 860, - "end": 873, + "start": 720, + "end": 733, "loc": { "start": { - "line": 34, + "line": 29, "column": 1 }, "end": { - "line": 34, + "line": 29, "column": 14 } }, "argument": { "type": "Identifier", - "start": 867, - "end": 872, + "start": 727, + "end": 732, "loc": { "start": { - "line": 34, + "line": 29, "column": 8 }, "end": { - "line": 34, + "line": 29, "column": 13 }, "identifierName": "debug" @@ -1850,29 +1481,29 @@ }, { "type": "Identifier", - "start": 878, - "end": 900, + "start": 738, + "end": 760, "loc": { "start": { - "line": 37, + "line": 32, "column": 0 }, "end": { - "line": 37, + "line": 32, "column": 22 } }, "declaration": { "type": "Identifier", - "start": 893, - "end": 899, + "start": 753, + "end": 759, "loc": { "start": { - "line": 37, + "line": 32, "column": 15 }, "end": { - "line": 37, + "line": 32, "column": 21 }, "identifierName": "_debug" @@ -1885,58 +1516,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 878, - "end": 900, + "start": 738, + "end": 760, "loc": { "start": { - "line": 37, + "line": 32, "column": 0 }, "end": { - "line": 37, + "line": 32, "column": 22 } }, "declaration": { "type": "VariableDeclaration", - "start": 290, - "end": 876, + "start": 253, + "end": 736, "loc": { "start": { - "line": 12, + "line": 11, "column": 0 }, "end": { - "line": 35, + "line": 30, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 296, - "end": 875, + "start": 259, + "end": 735, "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 35, + "line": 30, "column": 1 } }, "id": { "type": "Identifier", - "start": 296, - "end": 302, + "start": 259, + "end": 265, "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 12, + "line": 11, "column": 12 }, "identifierName": "_debug" @@ -1946,29 +1577,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 305, - "end": 875, + "start": 268, + "end": 735, "loc": { "start": { - "line": 12, + "line": 11, "column": 15 }, "end": { - "line": 35, + "line": 30, "column": 1 } }, "id": { "type": "Identifier", - "start": 296, - "end": 302, + "start": 259, + "end": 265, "loc": { "start": { - "line": 12, + "line": 11, "column": 6 }, "end": { - "line": 12, + "line": 11, "column": 12 }, "identifierName": "_debug" @@ -1982,30 +1613,30 @@ "params": [ { "type": "ObjectPattern", - "start": 306, - "end": 318, + "start": 269, + "end": 281, "loc": { "start": { - "line": 12, + "line": 11, "column": 16 }, "end": { - "line": 12, + "line": 11, "column": 28 } }, "properties": [ { "type": "ObjectProperty", - "start": 307, - "end": 310, + "start": 270, + "end": 273, "loc": { "start": { - "line": 12, + "line": 11, "column": 17 }, "end": { - "line": 12, + "line": 11, "column": 20 } }, @@ -2014,15 +1645,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 307, - "end": 310, + "start": 270, + "end": 273, "loc": { "start": { - "line": 12, + "line": 11, "column": 17 }, "end": { - "line": 12, + "line": 11, "column": 20 }, "identifierName": "red" @@ -2031,15 +1662,15 @@ }, "value": { "type": "Identifier", - "start": 307, - "end": 310, + "start": 270, + "end": 273, "loc": { "start": { - "line": 12, + "line": 11, "column": 17 }, "end": { - "line": 12, + "line": 11, "column": 20 }, "identifierName": "red" @@ -2052,15 +1683,15 @@ }, { "type": "ObjectProperty", - "start": 312, - "end": 317, + "start": 275, + "end": 280, "loc": { "start": { - "line": 12, + "line": 11, "column": 22 }, "end": { - "line": 12, + "line": 11, "column": 27 } }, @@ -2069,15 +1700,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 312, - "end": 317, + "start": 275, + "end": 280, "loc": { "start": { - "line": 12, + "line": 11, "column": 22 }, "end": { - "line": 12, + "line": 11, "column": 27 }, "identifierName": "black" @@ -2086,15 +1717,15 @@ }, "value": { "type": "Identifier", - "start": 312, - "end": 317, + "start": 275, + "end": 280, "loc": { "start": { - "line": 12, + "line": 11, "column": 22 }, "end": { - "line": 12, + "line": 11, "column": 27 }, "identifierName": "black" @@ -2110,59 +1741,59 @@ ], "body": { "type": "BlockStatement", - "start": 323, - "end": 875, + "start": 286, + "end": 735, "loc": { "start": { - "line": 12, + "line": 11, "column": 33 }, "end": { - "line": 35, + "line": 30, "column": 1 } }, "body": [ { "type": "VariableDeclaration", - "start": 518, - "end": 857, + "start": 476, + "end": 717, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 32, + "line": 27, "column": 3 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 524, - "end": 856, + "start": 482, + "end": 716, "loc": { "start": { - "line": 20, + "line": 19, "column": 7 }, "end": { - "line": 32, + "line": 27, "column": 2 } }, "id": { "type": "Identifier", - "start": 524, - "end": 529, + "start": 482, + "end": 487, "loc": { "start": { - "line": 20, + "line": 19, "column": 7 }, "end": { - "line": 20, + "line": 19, "column": 12 }, "identifierName": "debug" @@ -2172,15 +1803,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 532, - "end": 856, + "start": 490, + "end": 716, "loc": { "start": { - "line": 20, + "line": 19, "column": 15 }, "end": { - "line": 32, + "line": 27, "column": 2 } }, @@ -2191,15 +1822,15 @@ "params": [ { "type": "Identifier", - "start": 533, - "end": 537, + "start": 491, + "end": 495, "loc": { "start": { - "line": 20, + "line": 19, "column": 16 }, "end": { - "line": 20, + "line": 19, "column": 20 }, "identifierName": "root" @@ -2209,491 +1840,191 @@ ], "body": { "type": "BlockStatement", - "start": 542, - "end": 856, + "start": 500, + "end": 716, "loc": { "start": { - "line": 20, + "line": 19, "column": 25 }, "end": { - "line": 32, + "line": 27, "column": 2 } }, "body": [ { - "type": "ExpressionStatement", - "start": 546, - "end": 599, + "type": "IfStatement", + "start": 504, + "end": 541, "loc": { "start": { - "line": 21, + "line": 20, "column": 2 }, "end": { - "line": 21, - "column": 55 + "line": 20, + "column": 39 } }, - "expression": { - "type": "CallExpression", - "start": 546, - "end": 598, + "test": { + "type": "BinaryExpression", + "start": 508, + "end": 521, "loc": { "start": { - "line": 21, - "column": 2 + "line": 20, + "column": 6 }, "end": { - "line": 21, - "column": 54 + "line": 20, + "column": 19 } }, - "callee": { + "left": { "type": "Identifier", - "start": 546, - "end": 552, + "start": 508, + "end": 512, "loc": { "start": { - "line": 21, - "column": 2 + "line": 20, + "column": 6 }, "end": { - "line": 21, - "column": 8 + "line": 20, + "column": 10 }, - "identifierName": "assert" + "identifierName": "root" }, - "name": "assert" + "name": "root" }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 553, - "end": 597, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 517, + "end": 521, + "loc": { + "start": { + "line": 20, + "column": 15 + }, + "end": { + "line": 20, + "column": 19 + } + } + } + }, + "consequent": { + "type": "ReturnStatement", + "start": 523, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 39 + } + }, + "argument": { + "type": "CallExpression", + "start": 530, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 20, + "column": 38 + } + }, + "callee": { + "type": "Identifier", + "start": 530, + "end": 535, "loc": { "start": { - "line": 21, - "column": 9 + "line": 20, + "column": 28 }, "end": { - "line": 21, - "column": 53 - } - }, - "left": { - "type": "BinaryExpression", - "start": 553, - "end": 573, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 29 - } - }, - "left": { - "type": "Identifier", - "start": 553, - "end": 557, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 13 - }, - "identifierName": "root" - }, - "name": "root" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 569, - "end": 573, - "loc": { - "start": { - "line": 21, - "column": 25 - }, - "end": { - "line": 21, - "column": 29 - }, - "identifierName": "Node" - }, - "name": "Node" - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 577, - "end": 597, - "loc": { - "start": { - "line": 21, - "column": 33 - }, - "end": { - "line": 21, - "column": 53 - } - }, - "left": { - "type": "Identifier", - "start": 577, - "end": 581, - "loc": { - "start": { - "line": 21, - "column": 33 - }, - "end": { - "line": 21, - "column": 37 - }, - "identifierName": "root" - }, - "name": "root" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 593, - "end": 597, - "loc": { - "start": { - "line": 21, - "column": 49 - }, - "end": { - "line": 21, - "column": 53 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - } - ] - } - }, - { - "type": "IfStatement", - "start": 602, - "end": 681, - "loc": { - "start": { - "line": 22, - "column": 2 - }, - "end": { - "line": 25, - "column": 3 - } - }, - "test": { - "type": "CallExpression", - "start": 606, - "end": 619, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 19 - } - }, - "callee": { - "type": "MemberExpression", - "start": 606, - "end": 617, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 606, - "end": 610, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 10 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 611, - "end": 617, - "loc": { - "start": { - "line": 22, - "column": 11 - }, - "end": { - "line": 22, - "column": 17 - }, - "identifierName": "isLeaf" - }, - "name": "isLeaf" - }, - "computed": false - }, - "arguments": [] - }, - "consequent": { - "type": "BlockStatement", - "start": 621, - "end": 681, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 25, - "column": 3 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 626, - "end": 655, - "loc": { - "start": { - "line": 23, - "column": 3 + "line": 20, + "column": 33 }, - "end": { - "line": 23, - "column": 32 - } + "identifierName": "black" }, - "expression": { - "type": "CallExpression", - "start": 626, - "end": 654, - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 626, - "end": 632, - "loc": { - "start": { - "line": 23, - "column": 3 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 633, - "end": 653, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 30 - } - }, - "left": { - "type": "Identifier", - "start": 633, - "end": 637, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - }, - "identifierName": "root" - }, - "name": "root" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 649, - "end": 653, - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 30 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ] - } + "name": "black" }, - { - "type": "ReturnStatement", - "start": 659, - "end": 677, - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 21 - } - }, - "argument": { - "type": "CallExpression", - "start": 666, - "end": 676, + "arguments": [ + { + "type": "StringLiteral", + "start": 536, + "end": 539, "loc": { "start": { - "line": 24, - "column": 10 + "line": 20, + "column": 34 }, "end": { - "line": 24, - "column": 20 + "line": 20, + "column": 37 } }, - "callee": { - "type": "Identifier", - "start": 666, - "end": 671, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 15 - }, - "identifierName": "black" - }, - "name": "black" + "extra": { + "rawValue": "L", + "raw": "'L'" }, - "arguments": [ - { - "type": "StringLiteral", - "start": 672, - "end": 675, - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 19 - } - }, - "extra": { - "rawValue": "L", - "raw": "'L'" - }, - "value": "L" - } - ] + "value": "L" } - } - ], - "directives": [] + ] + } }, "alternate": null }, { "type": "ExpressionStatement", - "start": 685, - "end": 714, + "start": 545, + "end": 574, "loc": { "start": { - "line": 27, + "line": 22, "column": 2 }, "end": { - "line": 27, + "line": 22, "column": 31 } }, "expression": { "type": "CallExpression", - "start": 685, - "end": 713, + "start": 545, + "end": 573, "loc": { "start": { - "line": 27, + "line": 22, "column": 2 }, "end": { - "line": 27, + "line": 22, "column": 30 } }, "callee": { "type": "Identifier", - "start": 685, - "end": 691, + "start": 545, + "end": 551, "loc": { "start": { - "line": 27, + "line": 22, "column": 2 }, "end": { - "line": 27, + "line": 22, "column": 8 }, "identifierName": "assert" @@ -2703,29 +2034,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 692, - "end": 712, + "start": 552, + "end": 572, "loc": { "start": { - "line": 27, + "line": 22, "column": 9 }, "end": { - "line": 27, + "line": 22, "column": 29 } }, "left": { "type": "Identifier", - "start": 692, - "end": 696, + "start": 552, + "end": 556, "loc": { "start": { - "line": 27, + "line": 22, "column": 9 }, "end": { - "line": 27, + "line": 22, "column": 13 }, "identifierName": "root" @@ -2735,15 +2066,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 708, - "end": 712, + "start": 568, + "end": 572, "loc": { "start": { - "line": 27, + "line": 22, "column": 25 }, "end": { - "line": 27, + "line": 22, "column": 29 }, "identifierName": "Node" @@ -2756,44 +2087,44 @@ }, { "type": "VariableDeclaration", - "start": 718, - "end": 787, + "start": 578, + "end": 647, "loc": { "start": { - "line": 29, + "line": 24, "column": 2 }, "end": { - "line": 29, + "line": 24, "column": 71 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 724, - "end": 786, + "start": 584, + "end": 646, "loc": { "start": { - "line": 29, + "line": 24, "column": 8 }, "end": { - "line": 29, + "line": 24, "column": 70 } }, "id": { "type": "Identifier", - "start": 724, - "end": 728, + "start": 584, + "end": 588, "loc": { "start": { - "line": 29, + "line": 24, "column": 8 }, "end": { - "line": 29, + "line": 24, "column": 12 }, "identifierName": "repr" @@ -2802,57 +2133,57 @@ }, "init": { "type": "ConditionalExpression", - "start": 731, - "end": 786, + "start": 591, + "end": 646, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 70 } }, "test": { "type": "BinaryExpression", - "start": 731, - "end": 752, + "start": 591, + "end": 612, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 36 } }, "left": { "type": "MemberExpression", - "start": 731, - "end": 742, + "start": 591, + "end": 602, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 26 } }, "object": { "type": "Identifier", - "start": 731, - "end": 735, + "start": 591, + "end": 595, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 19 }, "identifierName": "root" @@ -2861,15 +2192,15 @@ }, "property": { "type": "Identifier", - "start": 736, - "end": 742, + "start": 596, + "end": 602, "loc": { "start": { - "line": 29, + "line": 24, "column": 20 }, "end": { - "line": 29, + "line": 24, "column": 26 }, "identifierName": "_color" @@ -2881,15 +2212,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 747, - "end": 752, + "start": 607, + "end": 612, "loc": { "start": { - "line": 29, + "line": 24, "column": 31 }, "end": { - "line": 29, + "line": 24, "column": 36 }, "identifierName": "BLACK" @@ -2899,29 +2230,29 @@ }, "consequent": { "type": "CallExpression", - "start": 755, - "end": 770, + "start": 615, + "end": 630, "loc": { "start": { - "line": 29, + "line": 24, "column": 39 }, "end": { - "line": 29, + "line": 24, "column": 54 } }, "callee": { "type": "Identifier", - "start": 755, - "end": 760, + "start": 615, + "end": 620, "loc": { "start": { - "line": 29, + "line": 24, "column": 39 }, "end": { - "line": 29, + "line": 24, "column": 44 }, "identifierName": "black" @@ -2931,29 +2262,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 761, - "end": 769, + "start": 621, + "end": 629, "loc": { "start": { - "line": 29, + "line": 24, "column": 45 }, "end": { - "line": 29, + "line": 24, "column": 53 } }, "object": { "type": "Identifier", - "start": 761, - "end": 765, + "start": 621, + "end": 625, "loc": { "start": { - "line": 29, + "line": 24, "column": 45 }, "end": { - "line": 29, + "line": 24, "column": 49 }, "identifierName": "root" @@ -2962,15 +2293,15 @@ }, "property": { "type": "Identifier", - "start": 766, - "end": 769, + "start": 626, + "end": 629, "loc": { "start": { - "line": 29, + "line": 24, "column": 50 }, "end": { - "line": 29, + "line": 24, "column": 53 }, "identifierName": "key" @@ -2983,29 +2314,29 @@ }, "alternate": { "type": "CallExpression", - "start": 773, - "end": 786, + "start": 633, + "end": 646, "loc": { "start": { - "line": 29, + "line": 24, "column": 57 }, "end": { - "line": 29, + "line": 24, "column": 70 } }, "callee": { "type": "Identifier", - "start": 773, - "end": 776, + "start": 633, + "end": 636, "loc": { "start": { - "line": 29, + "line": 24, "column": 57 }, "end": { - "line": 29, + "line": 24, "column": 60 }, "identifierName": "red" @@ -3015,29 +2346,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 777, - "end": 785, + "start": 637, + "end": 645, "loc": { "start": { - "line": 29, + "line": 24, "column": 61 }, "end": { - "line": 29, + "line": 24, "column": 69 } }, "object": { "type": "Identifier", - "start": 777, - "end": 781, + "start": 637, + "end": 641, "loc": { "start": { - "line": 29, + "line": 24, "column": 61 }, "end": { - "line": 29, + "line": 24, "column": 65 }, "identifierName": "root" @@ -3046,15 +2377,15 @@ }, "property": { "type": "Identifier", - "start": 782, - "end": 785, + "start": 642, + "end": 645, "loc": { "start": { - "line": 29, + "line": 24, "column": 66 }, "end": { - "line": 29, + "line": 24, "column": 69 }, "identifierName": "key" @@ -3072,58 +2403,58 @@ }, { "type": "ReturnStatement", - "start": 791, - "end": 853, + "start": 651, + "end": 713, "loc": { "start": { - "line": 31, + "line": 26, "column": 2 }, "end": { - "line": 31, + "line": 26, "column": 64 } }, "argument": { "type": "TemplateLiteral", - "start": 798, - "end": 852, + "start": 658, + "end": 712, "loc": { "start": { - "line": 31, + "line": 26, "column": 9 }, "end": { - "line": 31, + "line": 26, "column": 63 } }, "expressions": [ { "type": "CallExpression", - "start": 802, - "end": 818, + "start": 662, + "end": 678, "loc": { "start": { - "line": 31, + "line": 26, "column": 13 }, "end": { - "line": 31, + "line": 26, "column": 29 } }, "callee": { "type": "Identifier", - "start": 802, - "end": 807, + "start": 662, + "end": 667, "loc": { "start": { - "line": 31, + "line": 26, "column": 13 }, "end": { - "line": 31, + "line": 26, "column": 18 }, "identifierName": "debug" @@ -3133,29 +2464,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 808, - "end": 817, + "start": 668, + "end": 677, "loc": { "start": { - "line": 31, + "line": 26, "column": 19 }, "end": { - "line": 31, + "line": 26, "column": 28 } }, "object": { "type": "Identifier", - "start": 808, - "end": 812, + "start": 668, + "end": 672, "loc": { "start": { - "line": 31, + "line": 26, "column": 19 }, "end": { - "line": 31, + "line": 26, "column": 23 }, "identifierName": "root" @@ -3164,15 +2495,15 @@ }, "property": { "type": "Identifier", - "start": 813, - "end": 817, + "start": 673, + "end": 677, "loc": { "start": { - "line": 31, + "line": 26, "column": 24 }, "end": { - "line": 31, + "line": 26, "column": 28 }, "identifierName": "left" @@ -3185,15 +2516,15 @@ }, { "type": "Identifier", - "start": 823, - "end": 827, + "start": 683, + "end": 687, "loc": { "start": { - "line": 31, + "line": 26, "column": 34 }, "end": { - "line": 31, + "line": 26, "column": 38 }, "identifierName": "repr" @@ -3202,29 +2533,29 @@ }, { "type": "CallExpression", - "start": 832, - "end": 849, + "start": 692, + "end": 709, "loc": { "start": { - "line": 31, + "line": 26, "column": 43 }, "end": { - "line": 31, + "line": 26, "column": 60 } }, "callee": { "type": "Identifier", - "start": 832, - "end": 837, + "start": 692, + "end": 697, "loc": { "start": { - "line": 31, + "line": 26, "column": 43 }, "end": { - "line": 31, + "line": 26, "column": 48 }, "identifierName": "debug" @@ -3234,29 +2565,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 838, - "end": 848, + "start": 698, + "end": 708, "loc": { "start": { - "line": 31, + "line": 26, "column": 49 }, "end": { - "line": 31, + "line": 26, "column": 59 } }, "object": { "type": "Identifier", - "start": 838, - "end": 842, + "start": 698, + "end": 702, "loc": { "start": { - "line": 31, + "line": 26, "column": 49 }, "end": { - "line": 31, + "line": 26, "column": 53 }, "identifierName": "root" @@ -3265,15 +2596,15 @@ }, "property": { "type": "Identifier", - "start": 843, - "end": 848, + "start": 703, + "end": 708, "loc": { "start": { - "line": 31, + "line": 26, "column": 54 }, "end": { - "line": 31, + "line": 26, "column": 59 }, "identifierName": "right" @@ -3288,15 +2619,15 @@ "quasis": [ { "type": "TemplateElement", - "start": 799, - "end": 800, + "start": 659, + "end": 660, "loc": { "start": { - "line": 31, + "line": 26, "column": 10 }, "end": { - "line": 31, + "line": 26, "column": 11 } }, @@ -3308,15 +2639,15 @@ }, { "type": "TemplateElement", - "start": 819, - "end": 821, + "start": 679, + "end": 681, "loc": { "start": { - "line": 31, + "line": 26, "column": 30 }, "end": { - "line": 31, + "line": 26, "column": 32 } }, @@ -3328,15 +2659,15 @@ }, { "type": "TemplateElement", - "start": 828, - "end": 830, + "start": 688, + "end": 690, "loc": { "start": { - "line": 31, + "line": 26, "column": 39 }, "end": { - "line": 31, + "line": 26, "column": 41 } }, @@ -3348,15 +2679,15 @@ }, { "type": "TemplateElement", - "start": 850, - "end": 851, + "start": 710, + "end": 711, "loc": { "start": { - "line": 31, + "line": 26, "column": 61 }, "end": { - "line": 31, + "line": 26, "column": 62 } }, @@ -3380,16 +2711,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t ", - "start": 326, - "end": 516, + "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t ", + "start": 289, + "end": 474, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 19, + "line": 18, "column": 4 } } @@ -3398,29 +2729,29 @@ }, { "type": "ReturnStatement", - "start": 860, - "end": 873, + "start": 720, + "end": 733, "loc": { "start": { - "line": 34, + "line": 29, "column": 1 }, "end": { - "line": 34, + "line": 29, "column": 14 } }, "argument": { "type": "Identifier", - "start": 867, - "end": 872, + "start": 727, + "end": 732, "loc": { "start": { - "line": 34, + "line": 29, "column": 8 }, "end": { - "line": 34, + "line": 29, "column": 13 }, "identifierName": "debug" @@ -3440,15 +2771,15 @@ { "type": "CommentBlock", "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 143, - "end": 289, + "start": 106, + "end": 252, "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 11, + "line": 10, "column": 3 } } @@ -3464,31 +2795,31 @@ { "type": "CommentBlock", "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 143, - "end": 289, + "start": 106, + "end": 252, "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 11, + "line": 10, "column": 3 } } }, { "type": "CommentBlock", - "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t ", - "start": 326, - "end": 516, + "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t ", + "start": 289, + "end": 474, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 19, + "line": 18, "column": 4 } } @@ -3670,736 +3001,47 @@ }, "value": "Node", "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 46, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 66, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 73, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 78, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Leaf.js", - "start": 83, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 101, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 103, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 110, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 116, - "end": 120, - "loc": { - "start": { - "line": 4, - "column": 13 - }, - "end": { - "line": 4, - "column": 17 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/BLACK.js", - "start": 121, - "end": 140, - "loc": { - "start": { - "line": 4, - "column": 18 - }, - "end": { - "line": 4, - "column": 37 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 140, - "end": 141, - "loc": { - "start": { - "line": 4, - "column": 37 - }, - "end": { - "line": 4, - "column": 38 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", - "start": 143, - "end": 289, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 11, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 290, - "end": 295, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 12, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_debug", - "start": 296, - "end": 302, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 12 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 303, - "end": 304, - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 14 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 305, - "end": 306, - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 16 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 306, - "end": 307, - "loc": { - "start": { - "line": 12, - "column": 16 - }, - "end": { - "line": 12, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "red", - "start": 307, - "end": 310, - "loc": { - "start": { - "line": 12, - "column": 17 - }, - "end": { - "line": 12, - "column": 20 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 310, - "end": 311, - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 21 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "black", - "start": 312, - "end": 317, - "loc": { - "start": { - "line": 12, - "column": 22 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 317, - "end": 318, - "loc": { - "start": { - "line": 12, - "column": 27 - }, - "end": { - "line": 12, - "column": 28 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 318, - "end": 319, - "loc": { - "start": { - "line": 12, - "column": 28 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - { - "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 320, - "end": 322, - "loc": { - "start": { - "line": 12, - "column": 30 - }, - "end": { - "line": 12, - "column": 32 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 323, - "end": 324, - "loc": { - "start": { - "line": 12, - "column": 33 - }, - "end": { - "line": 12, - "column": 34 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t ", - "start": 326, - "end": 516, + "end": 40, "loc": { "start": { - "line": 13, - "column": 1 + "line": 2, + "column": 7 }, "end": { - "line": 19, - "column": 4 + "line": 2, + "column": 11 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 518, - "end": 523, + "value": "from", + "start": 41, + "end": 45, "loc": { "start": { - "line": 20, - "column": 1 + "line": 2, + "column": 12 }, "end": { - "line": 20, - "column": 6 + "line": 2, + "column": 16 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4407,71 +3049,74 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "debug", - "start": 524, - "end": 529, + "value": "../types/Node.js", + "start": 46, + "end": 64, "loc": { "start": { - "line": 20, - "column": 7 + "line": 2, + "column": 17 }, "end": { - "line": 20, - "column": 12 + "line": 2, + "column": 35 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 530, - "end": 531, + "start": 64, + "end": 65, "loc": { "start": { - "line": 20, - "column": 13 + "line": 2, + "column": 35 }, "end": { - "line": 20, - "column": 14 + "line": 2, + "column": 36 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "import", + "keyword": "import", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 532, - "end": 533, + "value": "import", + "start": 66, + "end": 72, "loc": { "start": { - "line": 20, - "column": 15 + "line": 3, + "column": 0 }, "end": { - "line": 20, - "column": 16 + "line": 3, + "column": 6 } } }, @@ -4487,25 +3132,25 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 533, - "end": 537, + "value": "BLACK", + "start": 73, + "end": 78, "loc": { "start": { - "line": 20, - "column": 16 + "line": 3, + "column": 7 }, "end": { - "line": 20, - "column": 20 + "line": 3, + "column": 12 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4513,24 +3158,25 @@ "postfix": false, "binop": null }, - "start": 537, - "end": 538, + "value": "from", + "start": 79, + "end": 83, "loc": { "start": { - "line": 20, - "column": 20 + "line": 3, + "column": 13 }, "end": { - "line": 20, - "column": 21 + "line": 3, + "column": 17 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "string", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4539,92 +3185,87 @@ "binop": null, "updateContext": null }, - "start": 539, - "end": 541, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, "loc": { "start": { - "line": 20, - "column": 22 + "line": 3, + "column": 18 }, "end": { - "line": 20, - "column": 24 + "line": 3, + "column": 37 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 542, - "end": 543, + "start": 103, + "end": 104, "loc": { "start": { - "line": 20, - "column": 25 + "line": 3, + "column": 37 }, "end": { - "line": 20, - "column": 26 + "line": 3, + "column": 38 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 546, - "end": 552, + "type": "CommentBlock", + "value": "*\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n ", + "start": 106, + "end": 252, "loc": { "start": { - "line": 21, - "column": 2 + "line": 5, + "column": 0 }, "end": { - "line": 21, - "column": 8 + "line": 10, + "column": 3 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 552, - "end": 553, + "value": "const", + "start": 253, + "end": 258, "loc": { "start": { - "line": 21, - "column": 8 + "line": 11, + "column": 0 }, "end": { - "line": 21, - "column": 9 + "line": 11, + "column": 5 } } }, @@ -4640,52 +3281,51 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 553, - "end": 557, + "value": "_debug", + "start": 259, + "end": 265, "loc": { "start": { - "line": 21, - "column": 9 + "line": 11, + "column": 6 }, "end": { - "line": 21, - "column": 13 + "line": 11, + "column": 12 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 558, - "end": 568, + "value": "=", + "start": 266, + "end": 267, "loc": { "start": { - "line": 21, - "column": 14 + "line": 11, + "column": 13 }, "end": { - "line": 21, - "column": 24 + "line": 11, + "column": 14 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4694,44 +3334,41 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 569, - "end": 573, + "start": 268, + "end": 269, "loc": { "start": { - "line": 21, - "column": 25 + "line": 11, + "column": 15 }, "end": { - "line": 21, - "column": 29 + "line": 11, + "column": 16 } } }, { "type": { - "label": "||", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 1, - "updateContext": null + "binop": null }, - "value": "||", - "start": 574, - "end": 576, + "start": 269, + "end": 270, "loc": { "start": { - "line": 21, - "column": 30 + "line": 11, + "column": 16 }, "end": { - "line": 21, - "column": 32 + "line": 11, + "column": 17 } } }, @@ -4747,24 +3384,23 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 577, - "end": 581, + "value": "red", + "start": 270, + "end": 273, "loc": { "start": { - "line": 21, - "column": 33 + "line": 11, + "column": 17 }, "end": { - "line": 21, - "column": 37 + "line": 11, + "column": 20 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4772,28 +3408,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 582, - "end": 592, + "start": 273, + "end": 274, + "loc": { + "start": { + "line": 11, + "column": 20 + }, + "end": { + "line": 11, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "black", + "start": 275, + "end": 280, "loc": { "start": { - "line": 21, - "column": 38 + "line": 11, + "column": 22 }, "end": { - "line": 21, - "column": 48 + "line": 11, + "column": 27 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4801,17 +3462,16 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 593, - "end": 597, + "start": 280, + "end": 281, "loc": { "start": { - "line": 21, - "column": 49 + "line": 11, + "column": 27 }, "end": { - "line": 21, - "column": 53 + "line": 11, + "column": 28 } } }, @@ -4827,22 +3487,22 @@ "postfix": false, "binop": null }, - "start": 597, - "end": 598, + "start": 281, + "end": 282, "loc": { "start": { - "line": 21, - "column": 53 + "line": 11, + "column": 28 }, "end": { - "line": 21, - "column": 54 + "line": 11, + "column": 29 } } }, { "type": { - "label": ";", + "label": "=>", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4853,68 +3513,84 @@ "binop": null, "updateContext": null }, - "start": 598, - "end": 599, + "start": 283, + "end": 285, "loc": { "start": { - "line": 21, - "column": 54 + "line": 11, + "column": 30 }, "end": { - "line": 21, - "column": 55 + "line": 11, + "column": 32 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 602, - "end": 604, + "start": 286, + "end": 287, "loc": { "start": { - "line": 22, - "column": 2 + "line": 11, + "column": 33 }, "end": { - "line": 22, + "line": 11, + "column": 34 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t ", + "start": 289, + "end": 474, + "loc": { + "start": { + "line": 12, + "column": 1 + }, + "end": { + "line": 18, "column": 4 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 605, - "end": 606, + "value": "const", + "start": 476, + "end": 481, "loc": { "start": { - "line": 22, - "column": 5 + "line": 19, + "column": 1 }, "end": { - "line": 22, + "line": 19, "column": 6 } } @@ -4931,50 +3607,51 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 606, - "end": 610, + "value": "debug", + "start": 482, + "end": 487, "loc": { "start": { - "line": 22, - "column": 6 + "line": 19, + "column": 7 }, "end": { - "line": 22, - "column": 10 + "line": 19, + "column": 12 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 610, - "end": 611, + "value": "=", + "start": 488, + "end": 489, "loc": { "start": { - "line": 22, - "column": 10 + "line": 19, + "column": 13 }, "end": { - "line": 22, - "column": 11 + "line": 19, + "column": 14 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4983,24 +3660,23 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 611, - "end": 617, + "start": 490, + "end": 491, "loc": { "start": { - "line": 22, - "column": 11 + "line": 19, + "column": 15 }, "end": { - "line": 22, - "column": 17 + "line": 19, + "column": 16 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5009,16 +3685,17 @@ "postfix": false, "binop": null }, - "start": 617, - "end": 618, + "value": "root", + "start": 491, + "end": 495, "loc": { "start": { - "line": 22, - "column": 17 + "line": 19, + "column": 16 }, "end": { - "line": 22, - "column": 18 + "line": 19, + "column": 20 } } }, @@ -5034,41 +3711,42 @@ "postfix": false, "binop": null }, - "start": 618, - "end": 619, + "start": 495, + "end": 496, "loc": { "start": { - "line": 22, - "column": 18 + "line": 19, + "column": 20 }, "end": { - "line": 22, - "column": 19 + "line": 19, + "column": 21 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "=>", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 619, - "end": 620, + "start": 497, + "end": 499, "loc": { "start": { - "line": 22, - "column": 19 + "line": 19, + "column": 22 }, "end": { - "line": 22, - "column": 20 + "line": 19, + "column": 24 } } }, @@ -5084,42 +3762,44 @@ "postfix": false, "binop": null }, - "start": 621, - "end": 622, + "start": 500, + "end": 501, "loc": { "start": { - "line": 22, - "column": 21 + "line": 19, + "column": 25 }, "end": { - "line": 22, - "column": 22 + "line": 19, + "column": 26 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 626, - "end": 632, + "value": "if", + "start": 504, + "end": 506, "loc": { "start": { - "line": 23, - "column": 3 + "line": 20, + "column": 2 }, "end": { - "line": 23, - "column": 9 + "line": 20, + "column": 4 } } }, @@ -5135,16 +3815,16 @@ "postfix": false, "binop": null }, - "start": 632, - "end": 633, + "start": 507, + "end": 508, "loc": { "start": { - "line": 23, - "column": 9 + "line": 20, + "column": 5 }, "end": { - "line": 23, - "column": 10 + "line": 20, + "column": 6 } } }, @@ -5161,23 +3841,22 @@ "binop": null }, "value": "root", - "start": 633, - "end": 637, + "start": 508, + "end": 512, "loc": { "start": { - "line": 23, - "column": 10 + "line": 20, + "column": 6 }, "end": { - "line": 23, - "column": 14 + "line": 20, + "column": 10 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5185,26 +3864,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": 6, "updateContext": null }, - "value": "instanceof", - "start": 638, - "end": 648, + "value": "===", + "start": 513, + "end": 516, "loc": { "start": { - "line": 23, - "column": 15 + "line": 20, + "column": 11 }, "end": { - "line": 23, - "column": 25 + "line": 20, + "column": 14 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5212,19 +3892,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Leaf", - "start": 649, - "end": 653, + "value": "null", + "start": 517, + "end": 521, "loc": { "start": { - "line": 23, - "column": 26 + "line": 20, + "column": 15 }, "end": { - "line": 23, - "column": 30 + "line": 20, + "column": 19 } } }, @@ -5240,42 +3921,16 @@ "postfix": false, "binop": null }, - "start": 653, - "end": 654, - "loc": { - "start": { - "line": 23, - "column": 30 - }, - "end": { - "line": 23, - "column": 31 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 654, - "end": 655, + "start": 521, + "end": 522, "loc": { "start": { - "line": 23, - "column": 31 + "line": 20, + "column": 19 }, "end": { - "line": 23, - "column": 32 + "line": 20, + "column": 20 } } }, @@ -5294,16 +3949,16 @@ "updateContext": null }, "value": "return", - "start": 659, - "end": 665, + "start": 523, + "end": 529, "loc": { "start": { - "line": 24, - "column": 3 + "line": 20, + "column": 21 }, "end": { - "line": 24, - "column": 9 + "line": 20, + "column": 27 } } }, @@ -5320,16 +3975,16 @@ "binop": null }, "value": "black", - "start": 666, - "end": 671, + "start": 530, + "end": 535, "loc": { "start": { - "line": 24, - "column": 10 + "line": 20, + "column": 28 }, "end": { - "line": 24, - "column": 15 + "line": 20, + "column": 33 } } }, @@ -5345,16 +4000,16 @@ "postfix": false, "binop": null }, - "start": 671, - "end": 672, + "start": 535, + "end": 536, "loc": { "start": { - "line": 24, - "column": 15 + "line": 20, + "column": 33 }, "end": { - "line": 24, - "column": 16 + "line": 20, + "column": 34 } } }, @@ -5372,16 +4027,16 @@ "updateContext": null }, "value": "L", - "start": 672, - "end": 675, + "start": 536, + "end": 539, "loc": { "start": { - "line": 24, - "column": 16 + "line": 20, + "column": 34 }, "end": { - "line": 24, - "column": 19 + "line": 20, + "column": 37 } } }, @@ -5397,16 +4052,16 @@ "postfix": false, "binop": null }, - "start": 675, - "end": 676, + "start": 539, + "end": 540, "loc": { "start": { - "line": 24, - "column": 19 + "line": 20, + "column": 37 }, "end": { - "line": 24, - "column": 20 + "line": 20, + "column": 38 } } }, @@ -5423,41 +4078,16 @@ "binop": null, "updateContext": null }, - "start": 676, - "end": 677, - "loc": { - "start": { - "line": 24, - "column": 20 - }, - "end": { - "line": 24, - "column": 21 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 680, - "end": 681, + "start": 540, + "end": 541, "loc": { "start": { - "line": 25, - "column": 2 + "line": 20, + "column": 38 }, "end": { - "line": 25, - "column": 3 + "line": 20, + "column": 39 } } }, @@ -5474,15 +4104,15 @@ "binop": null }, "value": "assert", - "start": 685, - "end": 691, + "start": 545, + "end": 551, "loc": { "start": { - "line": 27, + "line": 22, "column": 2 }, "end": { - "line": 27, + "line": 22, "column": 8 } } @@ -5499,15 +4129,15 @@ "postfix": false, "binop": null }, - "start": 691, - "end": 692, + "start": 551, + "end": 552, "loc": { "start": { - "line": 27, + "line": 22, "column": 8 }, "end": { - "line": 27, + "line": 22, "column": 9 } } @@ -5525,15 +4155,15 @@ "binop": null }, "value": "root", - "start": 692, - "end": 696, + "start": 552, + "end": 556, "loc": { "start": { - "line": 27, + "line": 22, "column": 9 }, "end": { - "line": 27, + "line": 22, "column": 13 } } @@ -5553,15 +4183,15 @@ "updateContext": null }, "value": "instanceof", - "start": 697, - "end": 707, + "start": 557, + "end": 567, "loc": { "start": { - "line": 27, + "line": 22, "column": 14 }, "end": { - "line": 27, + "line": 22, "column": 24 } } @@ -5579,15 +4209,15 @@ "binop": null }, "value": "Node", - "start": 708, - "end": 712, + "start": 568, + "end": 572, "loc": { "start": { - "line": 27, + "line": 22, "column": 25 }, "end": { - "line": 27, + "line": 22, "column": 29 } } @@ -5604,15 +4234,15 @@ "postfix": false, "binop": null }, - "start": 712, - "end": 713, + "start": 572, + "end": 573, "loc": { "start": { - "line": 27, + "line": 22, "column": 29 }, "end": { - "line": 27, + "line": 22, "column": 30 } } @@ -5630,15 +4260,15 @@ "binop": null, "updateContext": null }, - "start": 713, - "end": 714, + "start": 573, + "end": 574, "loc": { "start": { - "line": 27, + "line": 22, "column": 30 }, "end": { - "line": 27, + "line": 22, "column": 31 } } @@ -5658,15 +4288,15 @@ "updateContext": null }, "value": "const", - "start": 718, - "end": 723, + "start": 578, + "end": 583, "loc": { "start": { - "line": 29, + "line": 24, "column": 2 }, "end": { - "line": 29, + "line": 24, "column": 7 } } @@ -5684,15 +4314,15 @@ "binop": null }, "value": "repr", - "start": 724, - "end": 728, + "start": 584, + "end": 588, "loc": { "start": { - "line": 29, + "line": 24, "column": 8 }, "end": { - "line": 29, + "line": 24, "column": 12 } } @@ -5711,15 +4341,15 @@ "updateContext": null }, "value": "=", - "start": 729, - "end": 730, + "start": 589, + "end": 590, "loc": { "start": { - "line": 29, + "line": 24, "column": 13 }, "end": { - "line": 29, + "line": 24, "column": 14 } } @@ -5737,15 +4367,15 @@ "binop": null }, "value": "root", - "start": 731, - "end": 735, + "start": 591, + "end": 595, "loc": { "start": { - "line": 29, + "line": 24, "column": 15 }, "end": { - "line": 29, + "line": 24, "column": 19 } } @@ -5763,15 +4393,15 @@ "binop": null, "updateContext": null }, - "start": 735, - "end": 736, + "start": 595, + "end": 596, "loc": { "start": { - "line": 29, + "line": 24, "column": 19 }, "end": { - "line": 29, + "line": 24, "column": 20 } } @@ -5789,15 +4419,15 @@ "binop": null }, "value": "_color", - "start": 736, - "end": 742, + "start": 596, + "end": 602, "loc": { "start": { - "line": 29, + "line": 24, "column": 20 }, "end": { - "line": 29, + "line": 24, "column": 26 } } @@ -5816,15 +4446,15 @@ "updateContext": null }, "value": "===", - "start": 743, - "end": 746, + "start": 603, + "end": 606, "loc": { "start": { - "line": 29, + "line": 24, "column": 27 }, "end": { - "line": 29, + "line": 24, "column": 30 } } @@ -5842,15 +4472,15 @@ "binop": null }, "value": "BLACK", - "start": 747, - "end": 752, + "start": 607, + "end": 612, "loc": { "start": { - "line": 29, + "line": 24, "column": 31 }, "end": { - "line": 29, + "line": 24, "column": 36 } } @@ -5868,15 +4498,15 @@ "binop": null, "updateContext": null }, - "start": 753, - "end": 754, + "start": 613, + "end": 614, "loc": { "start": { - "line": 29, + "line": 24, "column": 37 }, "end": { - "line": 29, + "line": 24, "column": 38 } } @@ -5894,15 +4524,15 @@ "binop": null }, "value": "black", - "start": 755, - "end": 760, + "start": 615, + "end": 620, "loc": { "start": { - "line": 29, + "line": 24, "column": 39 }, "end": { - "line": 29, + "line": 24, "column": 44 } } @@ -5919,15 +4549,15 @@ "postfix": false, "binop": null }, - "start": 760, - "end": 761, + "start": 620, + "end": 621, "loc": { "start": { - "line": 29, + "line": 24, "column": 44 }, "end": { - "line": 29, + "line": 24, "column": 45 } } @@ -5945,15 +4575,15 @@ "binop": null }, "value": "root", - "start": 761, - "end": 765, + "start": 621, + "end": 625, "loc": { "start": { - "line": 29, + "line": 24, "column": 45 }, "end": { - "line": 29, + "line": 24, "column": 49 } } @@ -5971,15 +4601,15 @@ "binop": null, "updateContext": null }, - "start": 765, - "end": 766, + "start": 625, + "end": 626, "loc": { "start": { - "line": 29, + "line": 24, "column": 49 }, "end": { - "line": 29, + "line": 24, "column": 50 } } @@ -5997,15 +4627,15 @@ "binop": null }, "value": "key", - "start": 766, - "end": 769, + "start": 626, + "end": 629, "loc": { "start": { - "line": 29, + "line": 24, "column": 50 }, "end": { - "line": 29, + "line": 24, "column": 53 } } @@ -6022,15 +4652,15 @@ "postfix": false, "binop": null }, - "start": 769, - "end": 770, + "start": 629, + "end": 630, "loc": { "start": { - "line": 29, + "line": 24, "column": 53 }, "end": { - "line": 29, + "line": 24, "column": 54 } } @@ -6048,15 +4678,15 @@ "binop": null, "updateContext": null }, - "start": 771, - "end": 772, + "start": 631, + "end": 632, "loc": { "start": { - "line": 29, + "line": 24, "column": 55 }, "end": { - "line": 29, + "line": 24, "column": 56 } } @@ -6074,15 +4704,15 @@ "binop": null }, "value": "red", - "start": 773, - "end": 776, + "start": 633, + "end": 636, "loc": { "start": { - "line": 29, + "line": 24, "column": 57 }, "end": { - "line": 29, + "line": 24, "column": 60 } } @@ -6099,15 +4729,15 @@ "postfix": false, "binop": null }, - "start": 776, - "end": 777, + "start": 636, + "end": 637, "loc": { "start": { - "line": 29, + "line": 24, "column": 60 }, "end": { - "line": 29, + "line": 24, "column": 61 } } @@ -6125,15 +4755,15 @@ "binop": null }, "value": "root", - "start": 777, - "end": 781, + "start": 637, + "end": 641, "loc": { "start": { - "line": 29, + "line": 24, "column": 61 }, "end": { - "line": 29, + "line": 24, "column": 65 } } @@ -6151,15 +4781,15 @@ "binop": null, "updateContext": null }, - "start": 781, - "end": 782, + "start": 641, + "end": 642, "loc": { "start": { - "line": 29, + "line": 24, "column": 65 }, "end": { - "line": 29, + "line": 24, "column": 66 } } @@ -6177,15 +4807,15 @@ "binop": null }, "value": "key", - "start": 782, - "end": 785, + "start": 642, + "end": 645, "loc": { "start": { - "line": 29, + "line": 24, "column": 66 }, "end": { - "line": 29, + "line": 24, "column": 69 } } @@ -6202,15 +4832,15 @@ "postfix": false, "binop": null }, - "start": 785, - "end": 786, + "start": 645, + "end": 646, "loc": { "start": { - "line": 29, + "line": 24, "column": 69 }, "end": { - "line": 29, + "line": 24, "column": 70 } } @@ -6228,15 +4858,15 @@ "binop": null, "updateContext": null }, - "start": 786, - "end": 787, + "start": 646, + "end": 647, "loc": { "start": { - "line": 29, + "line": 24, "column": 70 }, "end": { - "line": 29, + "line": 24, "column": 71 } } @@ -6256,15 +4886,15 @@ "updateContext": null }, "value": "return", - "start": 791, - "end": 797, + "start": 651, + "end": 657, "loc": { "start": { - "line": 31, + "line": 26, "column": 2 }, "end": { - "line": 31, + "line": 26, "column": 8 } } @@ -6281,15 +4911,15 @@ "postfix": false, "binop": null }, - "start": 798, - "end": 799, + "start": 658, + "end": 659, "loc": { "start": { - "line": 31, + "line": 26, "column": 9 }, "end": { - "line": 31, + "line": 26, "column": 10 } } @@ -6308,15 +4938,15 @@ "updateContext": null }, "value": "(", - "start": 799, - "end": 800, + "start": 659, + "end": 660, "loc": { "start": { - "line": 31, + "line": 26, "column": 10 }, "end": { - "line": 31, + "line": 26, "column": 11 } } @@ -6333,15 +4963,15 @@ "postfix": false, "binop": null }, - "start": 800, - "end": 802, + "start": 660, + "end": 662, "loc": { "start": { - "line": 31, + "line": 26, "column": 11 }, "end": { - "line": 31, + "line": 26, "column": 13 } } @@ -6359,15 +4989,15 @@ "binop": null }, "value": "debug", - "start": 802, - "end": 807, + "start": 662, + "end": 667, "loc": { "start": { - "line": 31, + "line": 26, "column": 13 }, "end": { - "line": 31, + "line": 26, "column": 18 } } @@ -6384,15 +5014,15 @@ "postfix": false, "binop": null }, - "start": 807, - "end": 808, + "start": 667, + "end": 668, "loc": { "start": { - "line": 31, + "line": 26, "column": 18 }, "end": { - "line": 31, + "line": 26, "column": 19 } } @@ -6410,15 +5040,15 @@ "binop": null }, "value": "root", - "start": 808, - "end": 812, + "start": 668, + "end": 672, "loc": { "start": { - "line": 31, + "line": 26, "column": 19 }, "end": { - "line": 31, + "line": 26, "column": 23 } } @@ -6436,15 +5066,15 @@ "binop": null, "updateContext": null }, - "start": 812, - "end": 813, + "start": 672, + "end": 673, "loc": { "start": { - "line": 31, + "line": 26, "column": 23 }, "end": { - "line": 31, + "line": 26, "column": 24 } } @@ -6462,15 +5092,15 @@ "binop": null }, "value": "left", - "start": 813, - "end": 817, + "start": 673, + "end": 677, "loc": { "start": { - "line": 31, + "line": 26, "column": 24 }, "end": { - "line": 31, + "line": 26, "column": 28 } } @@ -6487,15 +5117,15 @@ "postfix": false, "binop": null }, - "start": 817, - "end": 818, + "start": 677, + "end": 678, "loc": { "start": { - "line": 31, + "line": 26, "column": 28 }, "end": { - "line": 31, + "line": 26, "column": 29 } } @@ -6512,15 +5142,15 @@ "postfix": false, "binop": null }, - "start": 818, - "end": 819, + "start": 678, + "end": 679, "loc": { "start": { - "line": 31, + "line": 26, "column": 29 }, "end": { - "line": 31, + "line": 26, "column": 30 } } @@ -6539,15 +5169,15 @@ "updateContext": null }, "value": ", ", - "start": 819, - "end": 821, + "start": 679, + "end": 681, "loc": { "start": { - "line": 31, + "line": 26, "column": 30 }, "end": { - "line": 31, + "line": 26, "column": 32 } } @@ -6564,15 +5194,15 @@ "postfix": false, "binop": null }, - "start": 821, - "end": 823, + "start": 681, + "end": 683, "loc": { "start": { - "line": 31, + "line": 26, "column": 32 }, "end": { - "line": 31, + "line": 26, "column": 34 } } @@ -6590,15 +5220,15 @@ "binop": null }, "value": "repr", - "start": 823, - "end": 827, + "start": 683, + "end": 687, "loc": { "start": { - "line": 31, + "line": 26, "column": 34 }, "end": { - "line": 31, + "line": 26, "column": 38 } } @@ -6615,15 +5245,15 @@ "postfix": false, "binop": null }, - "start": 827, - "end": 828, + "start": 687, + "end": 688, "loc": { "start": { - "line": 31, + "line": 26, "column": 38 }, "end": { - "line": 31, + "line": 26, "column": 39 } } @@ -6642,15 +5272,15 @@ "updateContext": null }, "value": ", ", - "start": 828, - "end": 830, + "start": 688, + "end": 690, "loc": { "start": { - "line": 31, + "line": 26, "column": 39 }, "end": { - "line": 31, + "line": 26, "column": 41 } } @@ -6667,15 +5297,15 @@ "postfix": false, "binop": null }, - "start": 830, - "end": 832, + "start": 690, + "end": 692, "loc": { "start": { - "line": 31, + "line": 26, "column": 41 }, "end": { - "line": 31, + "line": 26, "column": 43 } } @@ -6693,15 +5323,15 @@ "binop": null }, "value": "debug", - "start": 832, - "end": 837, + "start": 692, + "end": 697, "loc": { "start": { - "line": 31, + "line": 26, "column": 43 }, "end": { - "line": 31, + "line": 26, "column": 48 } } @@ -6718,15 +5348,15 @@ "postfix": false, "binop": null }, - "start": 837, - "end": 838, + "start": 697, + "end": 698, "loc": { "start": { - "line": 31, + "line": 26, "column": 48 }, "end": { - "line": 31, + "line": 26, "column": 49 } } @@ -6744,15 +5374,15 @@ "binop": null }, "value": "root", - "start": 838, - "end": 842, + "start": 698, + "end": 702, "loc": { "start": { - "line": 31, + "line": 26, "column": 49 }, "end": { - "line": 31, + "line": 26, "column": 53 } } @@ -6770,15 +5400,15 @@ "binop": null, "updateContext": null }, - "start": 842, - "end": 843, + "start": 702, + "end": 703, "loc": { "start": { - "line": 31, + "line": 26, "column": 53 }, "end": { - "line": 31, + "line": 26, "column": 54 } } @@ -6796,15 +5426,15 @@ "binop": null }, "value": "right", - "start": 843, - "end": 848, + "start": 703, + "end": 708, "loc": { "start": { - "line": 31, + "line": 26, "column": 54 }, "end": { - "line": 31, + "line": 26, "column": 59 } } @@ -6821,15 +5451,15 @@ "postfix": false, "binop": null }, - "start": 848, - "end": 849, + "start": 708, + "end": 709, "loc": { "start": { - "line": 31, + "line": 26, "column": 59 }, "end": { - "line": 31, + "line": 26, "column": 60 } } @@ -6846,15 +5476,15 @@ "postfix": false, "binop": null }, - "start": 849, - "end": 850, + "start": 709, + "end": 710, "loc": { "start": { - "line": 31, + "line": 26, "column": 60 }, "end": { - "line": 31, + "line": 26, "column": 61 } } @@ -6873,15 +5503,15 @@ "updateContext": null }, "value": ")", - "start": 850, - "end": 851, + "start": 710, + "end": 711, "loc": { "start": { - "line": 31, + "line": 26, "column": 61 }, "end": { - "line": 31, + "line": 26, "column": 62 } } @@ -6898,15 +5528,15 @@ "postfix": false, "binop": null }, - "start": 851, - "end": 852, + "start": 711, + "end": 712, "loc": { "start": { - "line": 31, + "line": 26, "column": 62 }, "end": { - "line": 31, + "line": 26, "column": 63 } } @@ -6924,15 +5554,15 @@ "binop": null, "updateContext": null }, - "start": 852, - "end": 853, + "start": 712, + "end": 713, "loc": { "start": { - "line": 31, + "line": 26, "column": 63 }, "end": { - "line": 31, + "line": 26, "column": 64 } } @@ -6949,15 +5579,15 @@ "postfix": false, "binop": null }, - "start": 855, - "end": 856, + "start": 715, + "end": 716, "loc": { "start": { - "line": 32, + "line": 27, "column": 1 }, "end": { - "line": 32, + "line": 27, "column": 2 } } @@ -6975,15 +5605,15 @@ "binop": null, "updateContext": null }, - "start": 856, - "end": 857, + "start": 716, + "end": 717, "loc": { "start": { - "line": 32, + "line": 27, "column": 2 }, "end": { - "line": 32, + "line": 27, "column": 3 } } @@ -7003,15 +5633,15 @@ "updateContext": null }, "value": "return", - "start": 860, - "end": 866, + "start": 720, + "end": 726, "loc": { "start": { - "line": 34, + "line": 29, "column": 1 }, "end": { - "line": 34, + "line": 29, "column": 7 } } @@ -7029,15 +5659,15 @@ "binop": null }, "value": "debug", - "start": 867, - "end": 872, + "start": 727, + "end": 732, "loc": { "start": { - "line": 34, + "line": 29, "column": 8 }, "end": { - "line": 34, + "line": 29, "column": 13 } } @@ -7055,15 +5685,15 @@ "binop": null, "updateContext": null }, - "start": 872, - "end": 873, + "start": 732, + "end": 733, "loc": { "start": { - "line": 34, + "line": 29, "column": 13 }, "end": { - "line": 34, + "line": 29, "column": 14 } } @@ -7080,15 +5710,15 @@ "postfix": false, "binop": null }, - "start": 874, - "end": 875, + "start": 734, + "end": 735, "loc": { "start": { - "line": 35, + "line": 30, "column": 0 }, "end": { - "line": 35, + "line": 30, "column": 1 } } @@ -7106,15 +5736,15 @@ "binop": null, "updateContext": null }, - "start": 875, - "end": 876, + "start": 735, + "end": 736, "loc": { "start": { - "line": 35, + "line": 30, "column": 1 }, "end": { - "line": 35, + "line": 30, "column": 2 } } @@ -7134,15 +5764,15 @@ "updateContext": null }, "value": "export", - "start": 878, - "end": 884, + "start": 738, + "end": 744, "loc": { "start": { - "line": 37, + "line": 32, "column": 0 }, "end": { - "line": 37, + "line": 32, "column": 6 } } @@ -7162,15 +5792,15 @@ "updateContext": null }, "value": "default", - "start": 885, - "end": 892, + "start": 745, + "end": 752, "loc": { "start": { - "line": 37, + "line": 32, "column": 7 }, "end": { - "line": 37, + "line": 32, "column": 14 } } @@ -7188,15 +5818,15 @@ "binop": null }, "value": "_debug", - "start": 893, - "end": 899, + "start": 753, + "end": 759, "loc": { "start": { - "line": 37, + "line": 32, "column": 15 }, "end": { - "line": 37, + "line": 32, "column": 21 } } @@ -7214,15 +5844,15 @@ "binop": null, "updateContext": null }, - "start": 899, - "end": 900, + "start": 759, + "end": 760, "loc": { "start": { - "line": 37, + "line": 32, "column": 21 }, "end": { - "line": 37, + "line": 32, "column": 22 } } @@ -7240,15 +5870,15 @@ "binop": null, "updateContext": null }, - "start": 901, - "end": 901, + "start": 761, + "end": 761, "loc": { "start": { - "line": 38, + "line": 33, "column": 0 }, "end": { - "line": 38, + "line": 33, "column": 0 } } diff --git a/ast/source/deletion/delete_case0.js.json b/ast/source/deletion/delete_case0.js.json new file mode 100644 index 0000000..d211781 --- /dev/null +++ b/ast/source/deletion/delete_case0.js.json @@ -0,0 +1,3438 @@ +{ + "type": "File", + "start": 0, + "end": 629, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 24, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 629, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 24, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 68, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 85, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 105, + "end": 150, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 112, + "end": 124, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 112, + "end": 124, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 19 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 130, + "end": 149, + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 44 + } + }, + "extra": { + "rawValue": "./delete_case1.js", + "raw": "'./delete_case1.js'" + }, + "value": "./delete_case1.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "start": 152, + "end": 365, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 366, + "end": 598, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 21, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 372, + "end": 597, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 372, + "end": 384, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + }, + "identifierName": "delete_case0" + }, + "name": "delete_case0", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 387, + "end": 597, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 388, + "end": 389, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 394, + "end": 597, + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 397, + "end": 423, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 397, + "end": 422, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 397, + "end": 403, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 404, + "end": 421, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 404, + "end": 405, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 417, + "end": 421, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 425, + "end": 452, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 425, + "end": 451, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 425, + "end": 431, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 432, + "end": 450, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 432, + "end": 440, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 432, + "end": 433, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 434, + "end": 440, + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 445, + "end": 450, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 454, + "end": 498, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 500, + "end": 534, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 536, + "end": 554, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 19 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 556, + "end": 595, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "test": { + "type": "BinaryExpression", + "start": 560, + "end": 577, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 560, + "end": 568, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 560, + "end": 561, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 562, + "end": 568, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 573, + "end": 577, + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 579, + "end": 595, + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "expression": { + "type": "CallExpression", + "start": 579, + "end": 594, + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 39 + } + }, + "callee": { + "type": "Identifier", + "start": 579, + "end": 591, + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 36 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1" + }, + "arguments": [ + { + "type": "Identifier", + "start": 592, + "end": 593, + "loc": { + "start": { + "line": 20, + "column": 37 + }, + "end": { + "line": 20, + "column": 38 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 454, + "end": 498, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 500, + "end": 534, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 536, + "end": 554, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 19 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 600, + "end": 628, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 615, + "end": 627, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 27 + }, + "identifierName": "delete_case0" + }, + "name": "delete_case0" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 600, + "end": 628, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 366, + "end": 598, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 21, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 372, + "end": 597, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 372, + "end": 384, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + }, + "identifierName": "delete_case0" + }, + "name": "delete_case0", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 387, + "end": 597, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 372, + "end": 384, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + }, + "identifierName": "delete_case0" + }, + "name": "delete_case0", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 388, + "end": 389, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 394, + "end": 597, + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 21, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 397, + "end": 423, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 397, + "end": 422, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 397, + "end": 403, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 404, + "end": 421, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 404, + "end": 405, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 417, + "end": 421, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 425, + "end": 452, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 425, + "end": 451, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 425, + "end": 431, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 432, + "end": 450, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 432, + "end": 440, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 432, + "end": 433, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 434, + "end": 440, + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 445, + "end": 450, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 454, + "end": 498, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 500, + "end": 534, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 536, + "end": 554, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 19 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 556, + "end": 595, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "test": { + "type": "BinaryExpression", + "start": 560, + "end": 577, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 560, + "end": 568, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 560, + "end": 561, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 562, + "end": 568, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 573, + "end": 577, + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 579, + "end": 595, + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 40 + } + }, + "expression": { + "type": "CallExpression", + "start": 579, + "end": 594, + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 39 + } + }, + "callee": { + "type": "Identifier", + "start": 579, + "end": 591, + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 36 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1" + }, + "arguments": [ + { + "type": "Identifier", + "start": 592, + "end": 593, + "loc": { + "start": { + "line": 20, + "column": 37 + }, + "end": { + "line": 20, + "column": 38 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 454, + "end": 498, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 500, + "end": 534, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 536, + "end": 554, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 19 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "start": 152, + "end": 365, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "start": 152, + "end": 365, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 454, + "end": 498, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 500, + "end": 534, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 536, + "end": 554, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 19 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 75, + "end": 79, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 80, + "end": 84, + "loc": { + "start": { + "line": 3, + "column": 12 + }, + "end": { + "line": 3, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 85, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 17 + }, + "end": { + "line": 3, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case1", + "start": 112, + "end": 124, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 125, + "end": 129, + "loc": { + "start": { + "line": 4, + "column": 20 + }, + "end": { + "line": 4, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case1.js", + "start": 130, + "end": 149, + "loc": { + "start": { + "line": 4, + "column": 25 + }, + "end": { + "line": 4, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 149, + "end": 150, + "loc": { + "start": { + "line": 4, + "column": 44 + }, + "end": { + "line": 4, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "start": 152, + "end": 365, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 366, + "end": 371, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case0", + "start": 372, + "end": 384, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 385, + "end": 386, + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 387, + "end": 388, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 388, + "end": 389, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 389, + "end": 390, + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 391, + "end": 393, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 394, + "end": 395, + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 397, + "end": 403, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 403, + "end": 404, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 404, + "end": 405, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 406, + "end": 416, + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 417, + "end": 421, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 421, + "end": 422, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 422, + "end": 423, + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 425, + "end": 431, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 431, + "end": 432, + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 432, + "end": 433, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 433, + "end": 434, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 434, + "end": 440, + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 441, + "end": 444, + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 445, + "end": 450, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 26 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 450, + "end": 451, + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 451, + "end": 452, + "loc": { + "start": { + "line": 16, + "column": 27 + }, + "end": { + "line": 16, + "column": 28 + } + } + }, + { + "type": "CommentLine", + "value": " If n is the root, there is nothing to do:", + "start": 454, + "end": 498, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " - all paths go through n, and", + "start": 500, + "end": 534, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " - n is black.", + "start": 536, + "end": 554, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 556, + "end": 558, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 559, + "end": 560, + "loc": { + "start": { + "line": 20, + "column": 4 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 560, + "end": 561, + "loc": { + "start": { + "line": 20, + "column": 5 + }, + "end": { + "line": 20, + "column": 6 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 561, + "end": 562, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 562, + "end": 568, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 13 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 569, + "end": 572, + "loc": { + "start": { + "line": 20, + "column": 14 + }, + "end": { + "line": 20, + "column": 17 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 573, + "end": 577, + "loc": { + "start": { + "line": 20, + "column": 18 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 577, + "end": 578, + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case1", + "start": 579, + "end": 591, + "loc": { + "start": { + "line": 20, + "column": 24 + }, + "end": { + "line": 20, + "column": 36 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 591, + "end": 592, + "loc": { + "start": { + "line": 20, + "column": 36 + }, + "end": { + "line": 20, + "column": 37 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 592, + "end": 593, + "loc": { + "start": { + "line": 20, + "column": 37 + }, + "end": { + "line": 20, + "column": 38 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 593, + "end": 594, + "loc": { + "start": { + "line": 20, + "column": 38 + }, + "end": { + "line": 20, + "column": 39 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 594, + "end": 595, + "loc": { + "start": { + "line": 20, + "column": 39 + }, + "end": { + "line": 20, + "column": 40 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 596, + "end": 597, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 1 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 597, + "end": 598, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 2 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 600, + "end": 606, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 607, + "end": 614, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case0", + "start": 615, + "end": 627, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 627, + "end": 628, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 629, + "end": 629, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/deletion/delete_case1.js.json b/ast/source/deletion/delete_case1.js.json index cfe820c..34925d3 100644 --- a/ast/source/deletion/delete_case1.js.json +++ b/ast/source/deletion/delete_case1.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 692, + "end": 1441, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 25, + "line": 53, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 692, + "end": 1441, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 25, + "line": 53, "column": 0 } }, @@ -169,7 +169,7 @@ { "type": "ImportDeclaration", "start": 68, - "end": 104, + "end": 102, "loc": { "start": { "line": 3, @@ -177,14 +177,14 @@ }, "end": { "line": 3, - "column": 36 + "column": 34 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 75, - "end": 79, + "end": 78, "loc": { "start": { "line": 3, @@ -192,13 +192,13 @@ }, "end": { "line": 3, - "column": 11 + "column": 10 } }, "local": { "type": "Identifier", "start": 75, - "end": 79, + "end": 78, "loc": { "start": { "line": 3, @@ -206,39 +206,39 @@ }, "end": { "line": 3, - "column": 11 + "column": 10 }, - "identifierName": "Node" + "identifierName": "RED" }, - "name": "Node" + "name": "RED" } } ], "source": { "type": "StringLiteral", - "start": 85, - "end": 103, + "start": 84, + "end": 101, "loc": { "start": { "line": 3, - "column": 17 + "column": 16 }, "end": { "line": 3, - "column": 35 + "column": 33 } }, "extra": { - "rawValue": "../types/Node.js", - "raw": "'../types/Node.js'" + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" }, - "value": "../types/Node.js" + "value": "../color/RED.js" } }, { "type": "ImportDeclaration", - "start": 105, - "end": 141, + "start": 103, + "end": 139, "loc": { "start": { "line": 4, @@ -252,8 +252,8 @@ "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 112, - "end": 116, + "start": 110, + "end": 114, "loc": { "start": { "line": 4, @@ -266,8 +266,8 @@ }, "local": { "type": "Identifier", - "start": 112, - "end": 116, + "start": 110, + "end": 114, "loc": { "start": { "line": 4, @@ -277,16 +277,16 @@ "line": 4, "column": 11 }, - "identifierName": "Leaf" + "identifierName": "Node" }, - "name": "Leaf" + "name": "Node" } } ], "source": { "type": "StringLiteral", - "start": 122, - "end": 140, + "start": 120, + "end": 138, "loc": { "start": { "line": 4, @@ -298,16 +298,16 @@ } }, "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" }, - "value": "../types/Leaf.js" + "value": "../types/Node.js" } }, { "type": "ImportDeclaration", - "start": 142, - "end": 187, + "start": 140, + "end": 191, "loc": { "start": { "line": 5, @@ -315,14 +315,14 @@ }, "end": { "line": 5, - "column": 45 + "column": 51 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 149, - "end": 161, + "start": 147, + "end": 158, "loc": { "start": { "line": 5, @@ -330,13 +330,13 @@ }, "end": { "line": 5, - "column": 19 + "column": 18 } }, "local": { "type": "Identifier", - "start": 149, - "end": 161, + "start": 147, + "end": 158, "loc": { "start": { "line": 5, @@ -344,6 +344,213 @@ }, "end": { "line": 5, + "column": 18 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 164, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + }, + "extra": { + "rawValue": "../rotate/rotate_left.js", + "raw": "'../rotate/rotate_left.js'" + }, + "value": "../rotate/rotate_left.js" + } + }, + { + "type": "ImportDeclaration", + "start": 192, + "end": 245, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 53 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 199, + "end": 211, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 199, + "end": 211, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 19 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 217, + "end": 244, + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 52 + } + }, + "extra": { + "rawValue": "../rotate/rotate_right.js", + "raw": "'../rotate/rotate_right.js'" + }, + "value": "../rotate/rotate_right.js" + } + }, + { + "type": "ImportDeclaration", + "start": 246, + "end": 289, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 43 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 253, + "end": 260, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + }, + "local": { + "type": "Identifier", + "start": 253, + "end": 260, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + }, + "identifierName": "sibling" + }, + "name": "sibling" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 266, + "end": 288, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 42 + } + }, + "extra": { + "rawValue": "../family/sibling.js", + "raw": "'../family/sibling.js'" + }, + "value": "../family/sibling.js" + } + }, + { + "type": "ImportDeclaration", + "start": 291, + "end": 336, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 298, + "end": 310, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 298, + "end": 310, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, "column": 19 }, "identifierName": "delete_case2" @@ -354,15 +561,15 @@ ], "source": { "type": "StringLiteral", - "start": 167, - "end": 186, + "start": 316, + "end": 335, "loc": { "start": { - "line": 5, + "line": 9, "column": 25 }, "end": { - "line": 5, + "line": 9, "column": 44 } }, @@ -371,20 +578,89 @@ "raw": "'./delete_case2.js'" }, "value": "./delete_case2.js" + } + }, + { + "type": "ImportDeclaration", + "start": 337, + "end": 382, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 344, + "end": 356, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 344, + "end": 356, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 362, + "end": 381, + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 44 + } + }, + "extra": { + "rawValue": "./delete_case3.js", + "raw": "'./delete_case3.js'" + }, + "value": "./delete_case3.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 189, - "end": 407, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "start": 384, + "end": 622, "loc": { "start": { - "line": 7, + "line": 12, "column": 0 }, "end": { - "line": 14, + "line": 20, "column": 3 } } @@ -393,44 +669,44 @@ }, { "type": "Identifier", - "start": 408, - "end": 661, + "start": 623, + "end": 1410, "loc": { "start": { - "line": 15, + "line": 21, "column": 0 }, "end": { - "line": 22, + "line": 50, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 414, - "end": 660, + "start": 629, + "end": 1409, "loc": { "start": { - "line": 15, + "line": 21, "column": 6 }, "end": { - "line": 22, + "line": 50, "column": 1 } }, "id": { "type": "Identifier", - "start": 414, - "end": 426, + "start": 629, + "end": 641, "loc": { "start": { - "line": 15, + "line": 21, "column": 6 }, "end": { - "line": 15, + "line": 21, "column": 18 }, "identifierName": "delete_case1" @@ -440,15 +716,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 429, - "end": 660, + "start": 644, + "end": 1409, "loc": { "start": { - "line": 15, + "line": 21, "column": 21 }, "end": { - "line": 22, + "line": 50, "column": 1 } }, @@ -459,15 +735,15 @@ "params": [ { "type": "Identifier", - "start": 430, - "end": 431, + "start": 645, + "end": 646, "loc": { "start": { - "line": 15, + "line": 21, "column": 22 }, "end": { - "line": 15, + "line": 21, "column": 23 }, "identifierName": "n" @@ -477,58 +753,58 @@ ], "body": { "type": "BlockStatement", - "start": 436, - "end": 660, + "start": 651, + "end": 1409, "loc": { "start": { - "line": 15, + "line": 21, "column": 28 }, "end": { - "line": 22, + "line": 50, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 439, - "end": 486, + "start": 654, + "end": 680, "loc": { "start": { - "line": 16, + "line": 22, "column": 1 }, "end": { - "line": 16, - "column": 48 + "line": 22, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 439, - "end": 485, + "start": 654, + "end": 679, "loc": { "start": { - "line": 16, + "line": 22, "column": 1 }, "end": { - "line": 16, - "column": 47 + "line": 22, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 439, - "end": 445, + "start": 654, + "end": 660, "loc": { "start": { - "line": 16, + "line": 22, "column": 1 }, "end": { - "line": 16, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -537,119 +813,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 446, - "end": 484, + "type": "BinaryExpression", + "start": 661, + "end": 678, "loc": { "start": { - "line": 16, + "line": 22, "column": 8 }, "end": { - "line": 16, - "column": 46 + "line": 22, + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 446, - "end": 463, + "type": "Identifier", + "start": 661, + "end": 662, "loc": { "start": { - "line": 16, + "line": 22, "column": 8 }, "end": { - "line": 16, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 446, - "end": 447, - "loc": { - "start": { - "line": 16, - "column": 8 - }, - "end": { - "line": 16, - "column": 9 - }, - "identifierName": "n" + "line": 22, + "column": 9 }, - "name": "n" + "identifierName": "n" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 459, - "end": 463, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "n" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 467, - "end": 484, + "type": "Identifier", + "start": 674, + "end": 678, "loc": { "start": { - "line": 16, - "column": 29 + "line": 22, + "column": 21 }, "end": { - "line": 16, - "column": 46 - } + "line": 22, + "column": 25 + }, + "identifierName": "Node" }, - "left": { - "type": "Identifier", - "start": 467, - "end": 468, - "loc": { - "start": { - "line": 16, - "column": 29 - }, - "end": { - "line": 16, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 480, - "end": 484, - "loc": { - "start": { - "line": 16, - "column": 42 - }, - "end": { - "line": 16, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -657,43 +867,43 @@ }, { "type": "ExpressionStatement", - "start": 488, - "end": 515, + "start": 682, + "end": 709, "loc": { "start": { - "line": 17, + "line": 23, "column": 1 }, "end": { - "line": 17, + "line": 23, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 488, - "end": 514, + "start": 682, + "end": 708, "loc": { "start": { - "line": 17, + "line": 23, "column": 1 }, "end": { - "line": 17, + "line": 23, "column": 27 } }, "callee": { "type": "Identifier", - "start": 488, - "end": 494, + "start": 682, + "end": 688, "loc": { "start": { - "line": 17, + "line": 23, "column": 1 }, "end": { - "line": 17, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -703,43 +913,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 495, - "end": 513, + "start": 689, + "end": 707, "loc": { "start": { - "line": 17, + "line": 23, "column": 8 }, "end": { - "line": 17, + "line": 23, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 495, - "end": 503, + "start": 689, + "end": 697, "loc": { "start": { - "line": 17, + "line": 23, "column": 8 }, "end": { - "line": 17, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 495, - "end": 496, + "start": 689, + "end": 690, "loc": { "start": { - "line": 17, + "line": 23, "column": 8 }, "end": { - "line": 17, + "line": 23, "column": 9 }, "identifierName": "n" @@ -748,15 +958,15 @@ }, "property": { "type": "Identifier", - "start": 497, - "end": 503, + "start": 691, + "end": 697, "loc": { "start": { - "line": 17, + "line": 23, "column": 10 }, "end": { - "line": 17, + "line": 23, "column": 16 }, "identifierName": "_color" @@ -768,15 +978,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 508, - "end": 513, + "start": 702, + "end": 707, "loc": { "start": { - "line": 17, + "line": 23, "column": 21 }, "end": { - "line": 17, + "line": 23, "column": 26 }, "identifierName": "BLACK" @@ -785,719 +995,779 @@ } } ] + } + }, + { + "type": "ExpressionStatement", + "start": 711, + "end": 737, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " If n is the root, there is nothing to do:", - "start": 517, - "end": 561, + "expression": { + "type": "CallExpression", + "start": 711, + "end": 736, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 711, + "end": 717, "loc": { "start": { - "line": 18, + "line": 24, "column": 1 }, "end": { - "line": 18, - "column": 45 + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 718, + "end": 735, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 718, + "end": 726, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 718, + "end": 719, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 720, + "end": 726, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } } } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 740, + "end": 761, + "loc": { + "start": { + "line": 26, + "column": 1 }, + "end": { + "line": 26, + "column": 22 + } + }, + "declarations": [ { - "type": "CommentLine", - "value": " - all paths go through n, and", - "start": 563, - "end": 597, + "type": "VariableDeclarator", + "start": 746, + "end": 760, "loc": { "start": { - "line": 19, - "column": 1 + "line": 26, + "column": 7 }, "end": { - "line": 19, - "column": 35 + "line": 26, + "column": 21 } + }, + "id": { + "type": "Identifier", + "start": 746, + "end": 747, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 750, + "end": 760, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 750, + "end": 757, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 758, + "end": 759, + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 763, + "end": 789, + "loc": { + "start": { + "line": 27, + "column": 1 }, - { - "type": "CommentLine", - "value": " - n is black.", - "start": 599, - "end": 617, + "end": { + "line": 27, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 763, + "end": 788, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 763, + "end": 769, "loc": { "start": { - "line": 20, + "line": 27, "column": 1 }, "end": { - "line": 20, - "column": 19 + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 770, + "end": 787, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 770, + "end": 771, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 783, + "end": 787, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" } } - } - ] + ] + } }, { "type": "IfStatement", - "start": 619, - "end": 658, + "start": 792, + "end": 1407, "loc": { "start": { - "line": 21, + "line": 29, "column": 1 }, "end": { - "line": 21, - "column": 40 + "line": 49, + "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 623, - "end": 640, + "start": 796, + "end": 814, "loc": { "start": { - "line": 21, + "line": 29, "column": 5 }, "end": { - "line": 21, - "column": 22 + "line": 29, + "column": 23 } }, "left": { "type": "MemberExpression", - "start": 623, - "end": 631, + "start": 796, + "end": 804, "loc": { "start": { - "line": 21, + "line": 29, "column": 5 }, "end": { - "line": 21, + "line": 29, "column": 13 } }, "object": { "type": "Identifier", - "start": 623, - "end": 624, + "start": 796, + "end": 797, "loc": { "start": { - "line": 21, + "line": 29, "column": 5 }, "end": { - "line": 21, + "line": 29, "column": 6 }, - "identifierName": "n" + "identifierName": "s" }, - "name": "n", - "leadingComments": null + "name": "s" }, "property": { "type": "Identifier", - "start": 625, - "end": 631, + "start": 798, + "end": 804, "loc": { "start": { - "line": 21, + "line": 29, "column": 7 }, "end": { - "line": 21, + "line": 29, "column": 13 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, - "computed": false, - "leadingComments": null + "computed": false }, - "operator": "!==", + "operator": "===", "right": { - "type": "NullLiteral", - "start": 636, - "end": 640, + "type": "Identifier", + "start": 809, + "end": 814, "loc": { "start": { - "line": 21, + "line": 29, "column": 18 }, "end": { - "line": 21, - "column": 22 - } - } - }, - "leadingComments": null + "line": 29, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } }, "consequent": { - "type": "ExpressionStatement", - "start": 642, - "end": 658, + "type": "BlockStatement", + "start": 816, + "end": 883, "loc": { "start": { - "line": 21, - "column": 24 + "line": 29, + "column": 25 }, "end": { - "line": 21, - "column": 40 + "line": 32, + "column": 2 } }, - "expression": { - "type": "CallExpression", - "start": 642, - "end": 657, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 39 - } - }, - "callee": { - "type": "Identifier", - "start": 642, - "end": 654, + "body": [ + { + "type": "ExpressionStatement", + "start": 864, + "end": 880, "loc": { "start": { - "line": 21, - "column": 24 + "line": 31, + "column": 2 }, "end": { - "line": 21, - "column": 36 - }, - "identifierName": "delete_case2" + "line": 31, + "column": 18 + } }, - "name": "delete_case2" - }, - "arguments": [ - { - "type": "Identifier", - "start": 655, - "end": 656, + "expression": { + "type": "CallExpression", + "start": 864, + "end": 879, "loc": { "start": { - "line": 21, - "column": 37 + "line": 31, + "column": 2 }, "end": { - "line": 21, - "column": 38 + "line": 31, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 864, + "end": 876, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 14 + }, + "identifierName": "delete_case2" }, - "identifierName": "n" + "name": "delete_case2", + "leadingComments": null }, - "name": "n" - } - ] - } - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is the root, there is nothing to do:", - "start": 517, - "end": 561, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 45 - } - } - }, - { - "type": "CommentLine", - "value": " - all paths go through n, and", - "start": 563, - "end": 597, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 35 - } - } - }, - { - "type": "CommentLine", - "value": " - n is black.", - "start": 599, - "end": 617, - "loc": { - "start": { - "line": 20, - "column": 1 + "arguments": [ + { + "type": "Identifier", + "start": 877, + "end": 878, + "loc": { + "start": { + "line": 31, + "column": 15 + }, + "end": { + "line": 31, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "leadingComments": null }, - "end": { - "line": 20, - "column": 19 - } + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n's sibling is BLACK, go to case 2.", + "start": 820, + "end": 861, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 43 + } + } + } + ] } - } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [], - "name": "_", - "trailingComments": [] - }, - { - "type": "Identifier", - "start": 663, - "end": 691, - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 28 - } - }, - "declaration": { - "type": "Identifier", - "start": 678, - "end": 690, - "loc": { - "start": { - "line": 24, - "column": 15 - }, - "end": { - "line": 24, - "column": 27 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1" - }, - "name": "_", - "leadingComments": [], - "trailingComments": [] - }, - { - "type": "ExportDefaultDeclaration", - "start": 663, - "end": 691, - "loc": { - "start": { - "line": 24, - "column": 0 - }, - "end": { - "line": 24, - "column": 28 - } - }, - "declaration": { - "type": "VariableDeclaration", - "start": 408, - "end": 661, - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 22, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 414, - "end": 660, - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 22, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 414, - "end": 426, - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 15, - "column": 18 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 429, - "end": 660, - "loc": { - "start": { - "line": 15, - "column": 21 - }, - "end": { - "line": 22, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 414, - "end": 426, - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 15, - "column": 18 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 430, - "end": 431, - "loc": { - "start": { - "line": 15, - "column": 22 - }, - "end": { - "line": 15, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 436, - "end": 660, - "loc": { - "start": { - "line": 15, - "column": 28 + ], + "directives": [] }, - "end": { - "line": 22, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 439, - "end": 486, + "alternate": { + "type": "BlockStatement", + "start": 889, + "end": 1407, "loc": { "start": { - "line": 16, - "column": 1 + "line": 32, + "column": 8 }, "end": { - "line": 16, - "column": 48 + "line": 49, + "column": 2 } }, - "expression": { - "type": "CallExpression", - "start": 439, - "end": 485, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 47 - } - }, - "callee": { - "type": "Identifier", - "start": 439, - "end": 445, + "body": [ + { + "type": "ExpressionStatement", + "start": 1262, + "end": 1284, "loc": { "start": { - "line": 16, - "column": 1 + "line": 44, + "column": 2 }, "end": { - "line": 16, - "column": 7 - }, - "identifierName": "assert" + "line": 44, + "column": 24 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 446, - "end": 484, + "expression": { + "type": "AssignmentExpression", + "start": 1262, + "end": 1283, "loc": { "start": { - "line": 16, - "column": 8 + "line": 44, + "column": 2 }, "end": { - "line": 16, - "column": 46 + "line": 44, + "column": 23 } }, + "operator": "=", "left": { - "type": "BinaryExpression", - "start": 446, - "end": 463, + "type": "MemberExpression", + "start": 1262, + "end": 1277, "loc": { "start": { - "line": 16, - "column": 8 + "line": 44, + "column": 2 }, "end": { - "line": 16, - "column": 25 + "line": 44, + "column": 17 } }, - "left": { - "type": "Identifier", - "start": 446, - "end": 447, + "object": { + "type": "MemberExpression", + "start": 1262, + "end": 1270, "loc": { "start": { - "line": 16, - "column": 8 + "line": 44, + "column": 2 }, "end": { - "line": 16, - "column": 9 + "line": 44, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1262, + "end": 1263, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n", + "leadingComments": null }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1264, + "end": 1270, + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null }, - "operator": "instanceof", - "right": { + "property": { "type": "Identifier", - "start": 459, - "end": 463, + "start": 1271, + "end": 1277, "loc": { "start": { - "line": 16, - "column": 21 + "line": 44, + "column": 11 }, "end": { - "line": 16, - "column": 25 + "line": 44, + "column": 17 }, - "identifierName": "Node" + "identifierName": "_color" }, - "name": "Node" - } + "name": "_color" + }, + "computed": false, + "leadingComments": null }, - "operator": "||", "right": { - "type": "BinaryExpression", - "start": 467, - "end": 484, + "type": "Identifier", + "start": 1280, + "end": 1283, "loc": { "start": { - "line": 16, - "column": 29 + "line": 44, + "column": 20 }, "end": { - "line": 16, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 467, - "end": 468, - "loc": { - "start": { - "line": 16, - "column": 29 - }, - "end": { - "line": 16, - "column": 30 - }, - "identifierName": "n" + "line": 44, + "column": 23 }, - "name": "n" + "identifierName": "RED" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 480, - "end": 484, - "loc": { - "start": { - "line": 16, - "column": 42 - }, - "end": { - "line": 16, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 488, - "end": 515, - "loc": { - "start": { - "line": 17, - "column": 1 - }, - "end": { - "line": 17, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 488, - "end": 514, - "loc": { - "start": { - "line": 17, - "column": 1 + "name": "RED" + }, + "leadingComments": null }, - "end": { - "line": 17, - "column": 27 - } + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t ", + "start": 893, + "end": 1259, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 43, + "column": 5 + } + } + } + ] }, - "callee": { - "type": "Identifier", - "start": 488, - "end": 494, + { + "type": "ExpressionStatement", + "start": 1287, + "end": 1304, "loc": { "start": { - "line": 17, - "column": 1 + "line": 45, + "column": 2 }, "end": { - "line": 17, - "column": 7 - }, - "identifierName": "assert" + "line": 45, + "column": 19 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 495, - "end": 513, + "expression": { + "type": "AssignmentExpression", + "start": 1287, + "end": 1303, "loc": { "start": { - "line": 17, - "column": 8 + "line": 45, + "column": 2 }, "end": { - "line": 17, - "column": 26 + "line": 45, + "column": 18 } }, + "operator": "=", "left": { "type": "MemberExpression", - "start": 495, - "end": 503, + "start": 1287, + "end": 1295, "loc": { "start": { - "line": 17, - "column": 8 + "line": 45, + "column": 2 }, "end": { - "line": 17, - "column": 16 + "line": 45, + "column": 10 } }, "object": { "type": "Identifier", - "start": 495, - "end": 496, + "start": 1287, + "end": 1288, "loc": { "start": { - "line": 17, - "column": 8 + "line": 45, + "column": 2 }, "end": { - "line": 17, - "column": 9 + "line": 45, + "column": 3 }, - "identifierName": "n" + "identifierName": "s" }, - "name": "n" + "name": "s" }, "property": { "type": "Identifier", - "start": 497, - "end": 503, + "start": 1289, + "end": 1295, "loc": { "start": { - "line": 17, - "column": 10 + "line": 45, + "column": 4 }, "end": { - "line": 17, - "column": 16 + "line": 45, + "column": 10 }, "identifierName": "_color" }, @@ -1505,315 +1775,2049 @@ }, "computed": false }, - "operator": "===", "right": { "type": "Identifier", - "start": 508, - "end": 513, + "start": 1298, + "end": 1303, "loc": { "start": { - "line": 17, - "column": 21 + "line": 45, + "column": 13 }, "end": { - "line": 17, - "column": 26 + "line": 45, + "column": 18 }, "identifierName": "BLACK" }, "name": "BLACK" } } - ] - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " If n is the root, there is nothing to do:", - "start": 517, - "end": 561, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 45 - } - } - }, - { - "type": "CommentLine", - "value": " - all paths go through n, and", - "start": 563, - "end": 597, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 35 - } - } }, { - "type": "CommentLine", - "value": " - n is black.", - "start": 599, - "end": 617, + "type": "IfStatement", + "start": 1307, + "end": 1385, "loc": { "start": { - "line": 20, - "column": 1 + "line": 46, + "column": 2 }, "end": { - "line": 20, - "column": 19 + "line": 47, + "column": 30 } - } - } - ] - }, - { - "type": "IfStatement", - "start": 619, - "end": 658, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 40 - } - }, - "test": { - "type": "BinaryExpression", - "start": 623, - "end": 640, - "loc": { - "start": { - "line": 21, - "column": 5 }, - "end": { - "line": 21, - "column": 22 - } - }, - "left": { - "type": "MemberExpression", - "start": 623, - "end": 631, - "loc": { - "start": { - "line": 21, - "column": 5 + "test": { + "type": "BinaryExpression", + "start": 1311, + "end": 1330, + "loc": { + "start": { + "line": 46, + "column": 6 + }, + "end": { + "line": 46, + "column": 25 + } }, - "end": { - "line": 21, - "column": 13 + "left": { + "type": "Identifier", + "start": 1311, + "end": 1312, + "loc": { + "start": { + "line": 46, + "column": 6 + }, + "end": { + "line": 46, + "column": 7 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1317, + "end": 1330, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 25 + } + }, + "object": { + "type": "MemberExpression", + "start": 1317, + "end": 1325, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 1317, + "end": 1318, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 13 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1319, + "end": 1325, + "loc": { + "start": { + "line": 46, + "column": 14 + }, + "end": { + "line": 46, + "column": 20 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1326, + "end": 1330, + "loc": { + "start": { + "line": 46, + "column": 21 + }, + "end": { + "line": 46, + "column": 25 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false } }, - "object": { - "type": "Identifier", - "start": 623, - "end": 624, + "consequent": { + "type": "ExpressionStatement", + "start": 1332, + "end": 1354, "loc": { "start": { - "line": 21, - "column": 5 + "line": 46, + "column": 27 }, "end": { - "line": 21, - "column": 6 - }, - "identifierName": "n" + "line": 46, + "column": 49 + } }, - "name": "n", - "leadingComments": null + "expression": { + "type": "CallExpression", + "start": 1332, + "end": 1353, + "loc": { + "start": { + "line": 46, + "column": 27 + }, + "end": { + "line": 46, + "column": 48 + } + }, + "callee": { + "type": "Identifier", + "start": 1332, + "end": 1343, + "loc": { + "start": { + "line": 46, + "column": 27 + }, + "end": { + "line": 46, + "column": 38 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1344, + "end": 1352, + "loc": { + "start": { + "line": 46, + "column": 39 + }, + "end": { + "line": 46, + "column": 47 + } + }, + "object": { + "type": "Identifier", + "start": 1344, + "end": 1345, + "loc": { + "start": { + "line": 46, + "column": 39 + }, + "end": { + "line": 46, + "column": 40 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1346, + "end": 1352, + "loc": { + "start": { + "line": 46, + "column": 41 + }, + "end": { + "line": 46, + "column": 47 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } }, - "property": { - "type": "Identifier", - "start": 625, - "end": 631, + "alternate": { + "type": "ExpressionStatement", + "start": 1362, + "end": 1385, "loc": { "start": { - "line": 21, + "line": 47, "column": 7 }, "end": { - "line": 21, - "column": 13 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 636, - "end": 640, - "loc": { - "start": { - "line": 21, - "column": 18 + "line": 47, + "column": 30 + } }, - "end": { - "line": 21, - "column": 22 + "expression": { + "type": "CallExpression", + "start": 1362, + "end": 1384, + "loc": { + "start": { + "line": 47, + "column": 7 + }, + "end": { + "line": 47, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 1362, + "end": 1374, + "loc": { + "start": { + "line": 47, + "column": 7 + }, + "end": { + "line": 47, + "column": 19 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1375, + "end": 1383, + "loc": { + "start": { + "line": 47, + "column": 20 + }, + "end": { + "line": 47, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 1375, + "end": 1376, + "loc": { + "start": { + "line": 47, + "column": 20 + }, + "end": { + "line": 47, + "column": 21 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1377, + "end": 1383, + "loc": { + "start": { + "line": 47, + "column": 22 + }, + "end": { + "line": 47, + "column": 28 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] } } }, - "leadingComments": null - }, - "consequent": { - "type": "ExpressionStatement", - "start": 642, - "end": 658, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 40 - } - }, - "expression": { - "type": "CallExpression", - "start": 642, - "end": 657, + { + "type": "ExpressionStatement", + "start": 1388, + "end": 1404, "loc": { "start": { - "line": 21, - "column": 24 + "line": 48, + "column": 2 }, "end": { - "line": 21, - "column": 39 + "line": 48, + "column": 18 } }, - "callee": { - "type": "Identifier", - "start": 642, - "end": 654, + "expression": { + "type": "CallExpression", + "start": 1388, + "end": 1403, "loc": { "start": { - "line": 21, - "column": 24 + "line": 48, + "column": 2 }, "end": { - "line": 21, - "column": 36 - }, - "identifierName": "delete_case2" + "line": 48, + "column": 17 + } }, - "name": "delete_case2" - }, - "arguments": [ - { + "callee": { "type": "Identifier", - "start": 655, - "end": 656, + "start": 1388, + "end": 1400, "loc": { "start": { - "line": 21, - "column": 37 + "line": 48, + "column": 2 }, "end": { - "line": 21, - "column": 38 + "line": 48, + "column": 14 }, - "identifierName": "n" + "identifierName": "delete_case3" }, - "name": "n" - } - ] - } - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is the root, there is nothing to do:", - "start": 517, - "end": 561, - "loc": { - "start": { - "line": 18, - "column": 1 + "name": "delete_case3" }, - "end": { - "line": 18, - "column": 45 - } - } + "arguments": [ + { + "type": "Identifier", + "start": 1401, + "end": 1402, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1412, + "end": 1440, + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 1427, + "end": 1439, + "loc": { + "start": { + "line": 52, + "column": 15 + }, + "end": { + "line": 52, + "column": 27 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1412, + "end": 1440, + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 623, + "end": 1410, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 50, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 629, + "end": 1409, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 629, + "end": 641, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 644, + "end": 1409, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 629, + "end": 641, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 645, + "end": 646, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 651, + "end": 1409, + "loc": { + "start": { + "line": 21, + "column": 28 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 654, + "end": 680, + "loc": { + "start": { + "line": 22, + "column": 1 }, - { - "type": "CommentLine", - "value": " - all paths go through n, and", - "start": 563, - "end": 597, + "end": { + "line": 22, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 654, + "end": 679, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 654, + "end": 660, "loc": { "start": { - "line": 19, + "line": 22, "column": 1 }, "end": { - "line": 19, - "column": 35 + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 661, + "end": 678, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 661, + "end": 662, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 674, + "end": 678, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" } } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 682, + "end": 709, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 682, + "end": 708, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 27 + } }, - { - "type": "CommentLine", - "value": " - n is black.", - "start": 599, - "end": 617, + "callee": { + "type": "Identifier", + "start": 682, + "end": 688, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, - "column": 19 - } - } - } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 689, + "end": 707, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 689, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 689, + "end": 690, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 691, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 702, + "end": 707, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 711, + "end": 737, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 711, + "end": 736, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 711, + "end": 717, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 718, + "end": 735, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 718, + "end": 726, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 718, + "end": 719, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 720, + "end": 726, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 740, + "end": 761, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 746, + "end": 760, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 746, + "end": 747, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + }, + "identifierName": "s" + }, + "name": "s" + }, + "init": { + "type": "CallExpression", + "start": 750, + "end": 760, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 750, + "end": 757, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 758, + "end": 759, + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 763, + "end": 789, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 763, + "end": 788, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 763, + "end": 769, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 770, + "end": 787, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 770, + "end": 771, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 783, + "end": 787, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 792, + "end": 1407, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 49, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 796, + "end": 814, + "loc": { + "start": { + "line": 29, + "column": 5 + }, + "end": { + "line": 29, + "column": 23 + } + }, + "left": { + "type": "MemberExpression", + "start": 796, + "end": 804, + "loc": { + "start": { + "line": 29, + "column": 5 + }, + "end": { + "line": 29, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 796, + "end": 797, + "loc": { + "start": { + "line": 29, + "column": 5 + }, + "end": { + "line": 29, + "column": 6 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 798, + "end": 804, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 809, + "end": 814, + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "consequent": { + "type": "BlockStatement", + "start": 816, + "end": 883, + "loc": { + "start": { + "line": 29, + "column": 25 + }, + "end": { + "line": 32, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 864, + "end": 880, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 864, + "end": 879, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 864, + "end": 876, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 14 + }, + "identifierName": "delete_case2" + }, + "name": "delete_case2", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 877, + "end": 878, + "loc": { + "start": { + "line": 31, + "column": 15 + }, + "end": { + "line": 31, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n's sibling is BLACK, go to case 2.", + "start": 820, + "end": 861, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 43 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 889, + "end": 1407, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 49, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1262, + "end": 1284, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1262, + "end": 1283, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 23 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1262, + "end": 1277, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1262, + "end": 1270, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1262, + "end": 1263, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1264, + "end": 1270, + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1271, + "end": 1277, + "loc": { + "start": { + "line": 44, + "column": 11 + }, + "end": { + "line": 44, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 1280, + "end": 1283, + "loc": { + "start": { + "line": 44, + "column": 20 + }, + "end": { + "line": 44, + "column": 23 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t ", + "start": 893, + "end": 1259, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 43, + "column": 5 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1287, + "end": 1304, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1287, + "end": 1303, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1287, + "end": 1295, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1287, + "end": 1288, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 3 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1289, + "end": 1295, + "loc": { + "start": { + "line": 45, + "column": 4 + }, + "end": { + "line": 45, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1298, + "end": 1303, + "loc": { + "start": { + "line": 45, + "column": 13 + }, + "end": { + "line": 45, + "column": 18 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1307, + "end": 1385, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 47, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1311, + "end": 1330, + "loc": { + "start": { + "line": 46, + "column": 6 + }, + "end": { + "line": 46, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 1311, + "end": 1312, + "loc": { + "start": { + "line": 46, + "column": 6 + }, + "end": { + "line": 46, + "column": 7 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1317, + "end": 1330, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 25 + } + }, + "object": { + "type": "MemberExpression", + "start": 1317, + "end": 1325, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 1317, + "end": 1318, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 13 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1319, + "end": 1325, + "loc": { + "start": { + "line": 46, + "column": 14 + }, + "end": { + "line": 46, + "column": 20 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1326, + "end": 1330, + "loc": { + "start": { + "line": 46, + "column": 21 + }, + "end": { + "line": 46, + "column": 25 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1332, + "end": 1354, + "loc": { + "start": { + "line": 46, + "column": 27 + }, + "end": { + "line": 46, + "column": 49 + } + }, + "expression": { + "type": "CallExpression", + "start": 1332, + "end": 1353, + "loc": { + "start": { + "line": 46, + "column": 27 + }, + "end": { + "line": 46, + "column": 48 + } + }, + "callee": { + "type": "Identifier", + "start": 1332, + "end": 1343, + "loc": { + "start": { + "line": 46, + "column": 27 + }, + "end": { + "line": 46, + "column": 38 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1344, + "end": 1352, + "loc": { + "start": { + "line": 46, + "column": 39 + }, + "end": { + "line": 46, + "column": 47 + } + }, + "object": { + "type": "Identifier", + "start": 1344, + "end": 1345, + "loc": { + "start": { + "line": 46, + "column": 39 + }, + "end": { + "line": 46, + "column": 40 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1346, + "end": 1352, + "loc": { + "start": { + "line": 46, + "column": 41 + }, + "end": { + "line": 46, + "column": 47 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1362, + "end": 1385, + "loc": { + "start": { + "line": 47, + "column": 7 + }, + "end": { + "line": 47, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 1362, + "end": 1384, + "loc": { + "start": { + "line": 47, + "column": 7 + }, + "end": { + "line": 47, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 1362, + "end": 1374, + "loc": { + "start": { + "line": 47, + "column": 7 + }, + "end": { + "line": 47, + "column": 19 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1375, + "end": 1383, + "loc": { + "start": { + "line": 47, + "column": 20 + }, + "end": { + "line": 47, + "column": 28 + } + }, + "object": { + "type": "Identifier", + "start": 1375, + "end": 1376, + "loc": { + "start": { + "line": 47, + "column": 20 + }, + "end": { + "line": 47, + "column": 21 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1377, + "end": 1383, + "loc": { + "start": { + "line": 47, + "column": 22 + }, + "end": { + "line": 47, + "column": 28 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ] + } + } + }, + { + "type": "ExpressionStatement", + "start": 1388, + "end": 1404, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1388, + "end": 1403, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1388, + "end": 1400, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 14 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1401, + "end": 1402, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], "kind": "const", "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 189, - "end": 407, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "start": 384, + "end": 622, "loc": { "start": { - "line": 7, + "line": 12, "column": 0 }, "end": { - "line": 14, + "line": 20, "column": 3 } } @@ -1822,80 +3826,2266 @@ "trailingComments": [] } } - ], - "directives": [] - }, - "comments": [ + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "start": 384, + "end": 622, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " If n's sibling is BLACK, go to case 2.", + "start": 820, + "end": 861, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 43 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t ", + "start": 893, + "end": 1259, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 43, + "column": 5 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 36, + "end": 41, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 42, + "end": 46, + "loc": { + "start": { + "line": 2, + "column": 13 + }, + "end": { + "line": 2, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 66, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 37 + }, + "end": { + "line": 2, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 68, + "end": 74, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 75, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 11 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 84, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 101, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 33 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 103, + "end": 109, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 110, + "end": 114, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 115, + "end": 119, + "loc": { + "start": { + "line": 4, + "column": 12 + }, + "end": { + "line": 4, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 120, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 35 + }, + "end": { + "line": 4, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 147, + "end": 158, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 159, + "end": 163, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_left.js", + "start": 164, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 190, + "end": 191, + "loc": { + "start": { + "line": 5, + "column": 50 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 192, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 199, + "end": 211, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 212, + "end": 216, + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_right.js", + "start": 217, + "end": 244, + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 52 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 244, + "end": 245, + "loc": { + "start": { + "line": 6, + "column": 52 + }, + "end": { + "line": 6, + "column": 53 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 246, + "end": 252, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 253, + "end": 260, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 261, + "end": 265, + "loc": { + "start": { + "line": 7, + "column": 15 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/sibling.js", + "start": 266, + "end": 288, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 42 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 288, + "end": 289, + "loc": { + "start": { + "line": 7, + "column": 42 + }, + "end": { + "line": 7, + "column": 43 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 291, + "end": 297, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case2", + "start": 298, + "end": 310, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 311, + "end": 315, + "loc": { + "start": { + "line": 9, + "column": 20 + }, + "end": { + "line": 9, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case2.js", + "start": 316, + "end": 335, + "loc": { + "start": { + "line": 9, + "column": 25 + }, + "end": { + "line": 9, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 335, + "end": 336, + "loc": { + "start": { + "line": 9, + "column": 44 + }, + "end": { + "line": 9, + "column": 45 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 337, + "end": 343, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case3", + "start": 344, + "end": 356, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 357, + "end": 361, + "loc": { + "start": { + "line": 10, + "column": 20 + }, + "end": { + "line": 10, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./delete_case3.js", + "start": 362, + "end": 381, + "loc": { + "start": { + "line": 10, + "column": 25 + }, + "end": { + "line": 10, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 381, + "end": 382, + "loc": { + "start": { + "line": 10, + "column": 44 + }, + "end": { + "line": 10, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "start": 384, + "end": 622, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 623, + "end": 628, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_case1", + "start": 629, + "end": 641, + "loc": { + "start": { + "line": 21, + "column": 6 + }, + "end": { + "line": 21, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 642, + "end": 643, + "loc": { + "start": { + "line": 21, + "column": 19 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 644, + "end": 645, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 645, + "end": 646, + "loc": { + "start": { + "line": 21, + "column": 22 + }, + "end": { + "line": 21, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 646, + "end": 647, + "loc": { + "start": { + "line": 21, + "column": 23 + }, + "end": { + "line": 21, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 648, + "end": 650, + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 651, + "end": 652, + "loc": { + "start": { + "line": 21, + "column": 28 + }, + "end": { + "line": 21, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 654, + "end": 660, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 660, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 661, + "end": 662, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 663, + "end": 673, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 674, + "end": 678, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 678, + "end": 679, + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 679, + "end": 680, + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 682, + "end": 688, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 688, + "end": 689, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 689, + "end": 690, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 690, + "end": 691, + "loc": { + "start": { + "line": 23, + "column": 9 + }, + "end": { + "line": 23, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 691, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 698, + "end": 701, + "loc": { + "start": { + "line": 23, + "column": 17 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 702, + "end": 707, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 26 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 707, + "end": 708, + "loc": { + "start": { + "line": 23, + "column": 26 + }, + "end": { + "line": 23, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 708, + "end": 709, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 711, + "end": 717, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 717, + "end": 718, + "loc": { + "start": { + "line": 24, + "column": 7 + }, + "end": { + "line": 24, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 718, + "end": 719, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 719, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 9 + }, + "end": { + "line": 24, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 720, + "end": 726, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 727, + "end": 730, + "loc": { + "start": { + "line": 24, + "column": 17 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 735, + "end": 736, + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 189, - "end": 407, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 736, + "end": 737, "loc": { "start": { - "line": 7, - "column": 0 + "line": 24, + "column": 26 }, "end": { - "line": 14, - "column": 3 + "line": 24, + "column": 27 } } }, { - "type": "CommentLine", - "value": " If n is the root, there is nothing to do:", - "start": 517, - "end": 561, + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 740, + "end": 745, "loc": { "start": { - "line": 18, + "line": 26, "column": 1 }, "end": { - "line": 18, - "column": 45 + "line": 26, + "column": 6 } } }, { - "type": "CommentLine", - "value": " - all paths go through n, and", - "start": 563, - "end": 597, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "s", + "start": 746, + "end": 747, "loc": { "start": { - "line": 19, - "column": 1 + "line": 26, + "column": 7 }, "end": { - "line": 19, - "column": 35 + "line": 26, + "column": 8 } } }, { - "type": "CommentLine", - "value": " - n is black.", - "start": 599, - "end": 617, + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 748, + "end": 749, "loc": { "start": { - "line": 20, - "column": 1 + "line": 26, + "column": 9 }, "end": { - "line": 20, + "line": 26, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "sibling", + "start": 750, + "end": 757, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 757, + "end": 758, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, "column": 19 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -1903,20 +6093,70 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "value": "n", + "start": 758, + "end": 759, + "loc": { + "start": { + "line": 26, + "column": 19 + }, + "end": { + "line": 26, + "column": 20 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 26, + "column": 20 + }, + "end": { + "line": 26, + "column": 21 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "start": 760, + "end": 761, "loc": { "start": { - "line": 1, - "column": 0 + "line": 26, + "column": 21 }, "end": { - "line": 1, - "column": 6 + "line": 26, + "column": 22 } } }, @@ -1933,16 +6173,41 @@ "binop": null }, "value": "assert", - "start": 7, - "end": 13, + "start": 763, + "end": 769, "loc": { "start": { - "line": 1, + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 769, + "end": 770, + "loc": { + "start": { + "line": 27, "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 27, + "column": 8 } } }, @@ -1958,44 +6223,96 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 14, - "end": 18, + "value": "s", + "start": 770, + "end": 771, "loc": { "start": { - "line": 1, - "column": 14 + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 772, + "end": 782, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 783, + "end": 787, + "loc": { + "start": { + "line": 27, + "column": 21 }, "end": { - "line": 1, - "column": 18 + "line": 27, + "column": 25 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "assert", - "start": 19, - "end": 27, + "start": 787, + "end": 788, "loc": { "start": { - "line": 1, - "column": 19 + "line": 27, + "column": 25 }, "end": { - "line": 1, - "column": 27 + "line": 27, + "column": 26 } } }, @@ -2012,25 +6329,25 @@ "binop": null, "updateContext": null }, - "start": 27, - "end": 28, + "start": 788, + "end": 789, "loc": { "start": { - "line": 1, - "column": 27 + "line": 27, + "column": 26 }, "end": { - "line": 1, - "column": 28 + "line": 27, + "column": 27 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2039,24 +6356,24 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 29, - "end": 35, + "value": "if", + "start": 792, + "end": 794, "loc": { "start": { - "line": 2, - "column": 0 + "line": 29, + "column": 1 }, "end": { - "line": 2, - "column": 6 + "line": 29, + "column": 3 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2065,17 +6382,16 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 36, - "end": 41, + "start": 795, + "end": 796, "loc": { "start": { - "line": 2, - "column": 7 + "line": 29, + "column": 4 }, "end": { - "line": 2, - "column": 12 + "line": 29, + "column": 5 } } }, @@ -2091,25 +6407,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 42, - "end": 46, + "value": "s", + "start": 796, + "end": 797, "loc": { "start": { - "line": 2, - "column": 13 + "line": 29, + "column": 5 }, "end": { - "line": 2, - "column": 17 + "line": 29, + "column": 6 } } }, { "type": { - "label": "string", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2118,71 +6434,69 @@ "binop": null, "updateContext": null }, - "value": "../color/BLACK.js", - "start": 47, - "end": 66, + "start": 797, + "end": 798, "loc": { "start": { - "line": 2, - "column": 18 + "line": 29, + "column": 6 }, "end": { - "line": 2, - "column": 37 + "line": 29, + "column": 7 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 66, - "end": 67, + "value": "_color", + "start": 798, + "end": 804, "loc": { "start": { - "line": 2, - "column": 37 + "line": 29, + "column": 7 }, "end": { - "line": 2, - "column": 38 + "line": 29, + "column": 13 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "import", - "start": 68, - "end": 74, + "value": "===", + "start": 805, + "end": 808, "loc": { "start": { - "line": 3, - "column": 0 + "line": 29, + "column": 14 }, "end": { - "line": 3, - "column": 6 + "line": 29, + "column": 17 } } }, @@ -2198,25 +6512,25 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 75, - "end": 79, + "value": "BLACK", + "start": 809, + "end": 814, "loc": { "start": { - "line": 3, - "column": 7 + "line": 29, + "column": 18 }, "end": { - "line": 3, - "column": 11 + "line": 29, + "column": 23 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2224,98 +6538,108 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 80, - "end": 84, + "start": 814, + "end": 815, "loc": { "start": { - "line": 3, - "column": 12 + "line": 29, + "column": 23 }, "end": { - "line": 3, - "column": 16 + "line": 29, + "column": 24 } } }, { "type": { - "label": "string", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../types/Node.js", - "start": 85, - "end": 103, + "start": 816, + "end": 817, "loc": { "start": { - "line": 3, - "column": 17 + "line": 29, + "column": 25 }, "end": { - "line": 3, - "column": 35 + "line": 29, + "column": 26 + } + } + }, + { + "type": "CommentLine", + "value": " If n's sibling is BLACK, go to case 2.", + "start": 820, + "end": 861, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 43 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 103, - "end": 104, + "value": "delete_case2", + "start": 864, + "end": 876, "loc": { "start": { - "line": 3, - "column": 35 + "line": 31, + "column": 2 }, "end": { - "line": 3, - "column": 36 + "line": 31, + "column": 14 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 105, - "end": 111, + "start": 876, + "end": 877, "loc": { "start": { - "line": 4, - "column": 0 + "line": 31, + "column": 14 }, "end": { - "line": 4, - "column": 6 + "line": 31, + "column": 15 } } }, @@ -2331,25 +6655,25 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 112, - "end": 116, + "value": "n", + "start": 877, + "end": 878, "loc": { "start": { - "line": 4, - "column": 7 + "line": 31, + "column": 15 }, "end": { - "line": 4, - "column": 11 + "line": 31, + "column": 16 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2357,25 +6681,24 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 117, - "end": 121, + "start": 878, + "end": 879, "loc": { "start": { - "line": 4, - "column": 12 + "line": 31, + "column": 16 }, "end": { - "line": 4, - "column": 16 + "line": 31, + "column": 17 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2384,52 +6707,50 @@ "binop": null, "updateContext": null }, - "value": "../types/Leaf.js", - "start": 122, - "end": 140, + "start": 879, + "end": 880, "loc": { "start": { - "line": 4, + "line": 31, "column": 17 }, "end": { - "line": 4, - "column": 35 + "line": 31, + "column": 18 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 140, - "end": 141, + "start": 882, + "end": 883, "loc": { "start": { - "line": 4, - "column": 35 + "line": 32, + "column": 1 }, "end": { - "line": 4, - "column": 36 + "line": 32, + "column": 2 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2438,24 +6759,24 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 142, - "end": 148, + "value": "else", + "start": 884, + "end": 888, "loc": { "start": { - "line": 5, - "column": 0 + "line": 32, + "column": 3 }, "end": { - "line": 5, - "column": 6 + "line": 32, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2464,17 +6785,32 @@ "postfix": false, "binop": null }, - "value": "delete_case2", - "start": 149, - "end": 161, + "start": 889, + "end": 890, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t ", + "start": 893, + "end": 1259, "loc": { "start": { - "line": 5, - "column": 7 + "line": 33, + "column": 2 }, "end": { - "line": 5, - "column": 19 + "line": 43, + "column": 5 } } }, @@ -2490,25 +6826,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 162, - "end": 166, + "value": "n", + "start": 1262, + "end": 1263, "loc": { "start": { - "line": 5, - "column": 20 + "line": 44, + "column": 2 }, "end": { - "line": 5, - "column": 24 + "line": 44, + "column": 3 } } }, { "type": { - "label": "string", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2517,66 +6853,48 @@ "binop": null, "updateContext": null }, - "value": "./delete_case2.js", - "start": 167, - "end": 186, + "start": 1263, + "end": 1264, "loc": { "start": { - "line": 5, - "column": 25 + "line": 44, + "column": 3 }, "end": { - "line": 5, - "column": 44 + "line": 44, + "column": 4 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 186, - "end": 187, - "loc": { - "start": { - "line": 5, - "column": 44 - }, - "end": { - "line": 5, - "column": 45 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 189, - "end": 407, + "value": "parent", + "start": 1264, + "end": 1270, "loc": { "start": { - "line": 7, - "column": 0 + "line": 44, + "column": 4 }, "end": { - "line": 14, - "column": 3 + "line": 44, + "column": 10 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2587,17 +6905,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 408, - "end": 413, + "start": 1270, + "end": 1271, "loc": { "start": { - "line": 15, - "column": 0 + "line": 44, + "column": 10 }, "end": { - "line": 15, - "column": 5 + "line": 44, + "column": 11 } } }, @@ -2613,17 +6930,17 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 414, - "end": 426, + "value": "_color", + "start": 1271, + "end": 1277, "loc": { "start": { - "line": 15, - "column": 6 + "line": 44, + "column": 11 }, "end": { - "line": 15, - "column": 18 + "line": 44, + "column": 17 } } }, @@ -2641,41 +6958,16 @@ "updateContext": null }, "value": "=", - "start": 427, - "end": 428, - "loc": { - "start": { - "line": 15, - "column": 19 - }, - "end": { - "line": 15, - "column": 20 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 429, - "end": 430, + "start": 1278, + "end": 1279, "loc": { "start": { - "line": 15, - "column": 21 + "line": 44, + "column": 18 }, "end": { - "line": 15, - "column": 22 + "line": 44, + "column": 19 } } }, @@ -2691,93 +6983,95 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 430, - "end": 431, + "value": "RED", + "start": 1280, + "end": 1283, "loc": { "start": { - "line": 15, - "column": 22 + "line": 44, + "column": 20 }, "end": { - "line": 15, + "line": 44, "column": 23 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 431, - "end": 432, + "start": 1283, + "end": 1284, "loc": { "start": { - "line": 15, + "line": 44, "column": 23 }, "end": { - "line": 15, + "line": 44, "column": 24 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 433, - "end": 435, + "value": "s", + "start": 1287, + "end": 1288, "loc": { "start": { - "line": 15, - "column": 25 + "line": 45, + "column": 2 }, "end": { - "line": 15, - "column": 27 + "line": 45, + "column": 3 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 436, - "end": 437, + "start": 1288, + "end": 1289, "loc": { "start": { - "line": 15, - "column": 28 + "line": 45, + "column": 3 }, "end": { - "line": 15, - "column": 29 + "line": 45, + "column": 4 } } }, @@ -2793,42 +7087,44 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 439, - "end": 445, + "value": "_color", + "start": 1289, + "end": 1295, "loc": { "start": { - "line": 16, - "column": 1 + "line": 45, + "column": 4 }, "end": { - "line": 16, - "column": 7 + "line": 45, + "column": 10 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 445, - "end": 446, + "value": "=", + "start": 1296, + "end": 1297, "loc": { "start": { - "line": 16, - "column": 7 + "line": 45, + "column": 11 }, "end": { - "line": 16, - "column": 8 + "line": 45, + "column": 12 } } }, @@ -2844,24 +7140,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 446, - "end": 447, + "value": "BLACK", + "start": 1298, + "end": 1303, "loc": { "start": { - "line": 16, - "column": 8 + "line": 45, + "column": 13 }, "end": { - "line": 16, - "column": 9 + "line": 45, + "column": 18 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2869,73 +7164,72 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 448, - "end": 458, + "start": 1303, + "end": 1304, "loc": { "start": { - "line": 16, - "column": 10 + "line": 45, + "column": 18 }, "end": { - "line": 16, - "column": 20 + "line": 45, + "column": 19 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Node", - "start": 459, - "end": 463, + "value": "if", + "start": 1307, + "end": 1309, "loc": { "start": { - "line": 16, - "column": 21 + "line": 46, + "column": 2 }, "end": { - "line": 16, - "column": 25 + "line": 46, + "column": 4 } } }, { "type": { - "label": "||", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 1, - "updateContext": null + "binop": null }, - "value": "||", - "start": 464, - "end": 466, + "start": 1310, + "end": 1311, "loc": { "start": { - "line": 16, - "column": 26 + "line": 46, + "column": 5 }, "end": { - "line": 16, - "column": 28 + "line": 46, + "column": 6 } } }, @@ -2952,23 +7246,22 @@ "binop": null }, "value": "n", - "start": 467, - "end": 468, + "start": 1311, + "end": 1312, "loc": { "start": { - "line": 16, - "column": 29 + "line": 46, + "column": 6 }, "end": { - "line": 16, - "column": 30 + "line": 46, + "column": 7 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2976,20 +7269,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": 6, "updateContext": null }, - "value": "instanceof", - "start": 469, - "end": 479, + "value": "===", + "start": 1313, + "end": 1316, "loc": { "start": { - "line": 16, - "column": 31 + "line": 46, + "column": 8 }, "end": { - "line": 16, - "column": 41 + "line": 46, + "column": 11 } } }, @@ -3005,23 +7298,23 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 480, - "end": 484, + "value": "n", + "start": 1317, + "end": 1318, "loc": { "start": { - "line": 16, - "column": 42 + "line": 46, + "column": 12 }, "end": { - "line": 16, - "column": 46 + "line": 46, + "column": 13 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3029,25 +7322,52 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1318, + "end": 1319, + "loc": { + "start": { + "line": 46, + "column": 13 + }, + "end": { + "line": 46, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null }, - "start": 484, - "end": 485, + "value": "parent", + "start": 1319, + "end": 1325, "loc": { "start": { - "line": 16, - "column": 46 + "line": 46, + "column": 14 }, "end": { - "line": 16, - "column": 47 + "line": 46, + "column": 20 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3057,16 +7377,16 @@ "binop": null, "updateContext": null }, - "start": 485, - "end": 486, + "start": 1325, + "end": 1326, "loc": { "start": { - "line": 16, - "column": 47 + "line": 46, + "column": 20 }, "end": { - "line": 16, - "column": 48 + "line": 46, + "column": 21 } } }, @@ -3082,25 +7402,25 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 488, - "end": 494, + "value": "left", + "start": 1326, + "end": 1330, "loc": { "start": { - "line": 17, - "column": 1 + "line": 46, + "column": 21 }, "end": { - "line": 17, - "column": 7 + "line": 46, + "column": 25 } } }, { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3108,16 +7428,16 @@ "postfix": false, "binop": null }, - "start": 494, - "end": 495, + "start": 1330, + "end": 1331, "loc": { "start": { - "line": 17, - "column": 7 + "line": 46, + "column": 25 }, "end": { - "line": 17, - "column": 8 + "line": 46, + "column": 26 } } }, @@ -3133,43 +7453,42 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 495, - "end": 496, + "value": "rotate_left", + "start": 1332, + "end": 1343, "loc": { "start": { - "line": 17, - "column": 8 + "line": 46, + "column": 27 }, "end": { - "line": 17, - "column": 9 + "line": 46, + "column": 38 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 496, - "end": 497, + "start": 1343, + "end": 1344, "loc": { "start": { - "line": 17, - "column": 9 + "line": 46, + "column": 38 }, "end": { - "line": 17, - "column": 10 + "line": 46, + "column": 39 } } }, @@ -3185,44 +7504,43 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 497, - "end": 503, + "value": "n", + "start": 1344, + "end": 1345, "loc": { "start": { - "line": 17, - "column": 10 + "line": 46, + "column": 39 }, "end": { - "line": 17, - "column": 16 + "line": 46, + "column": 40 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 504, - "end": 507, + "start": 1345, + "end": 1346, "loc": { "start": { - "line": 17, - "column": 17 + "line": 46, + "column": 40 }, "end": { - "line": 17, - "column": 20 + "line": 46, + "column": 41 } } }, @@ -3238,17 +7556,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 508, - "end": 513, + "value": "parent", + "start": 1346, + "end": 1352, "loc": { "start": { - "line": 17, - "column": 21 + "line": 46, + "column": 41 }, "end": { - "line": 17, - "column": 26 + "line": 46, + "column": 47 } } }, @@ -3264,16 +7582,16 @@ "postfix": false, "binop": null }, - "start": 513, - "end": 514, + "start": 1352, + "end": 1353, "loc": { "start": { - "line": 17, - "column": 26 + "line": 46, + "column": 47 }, "end": { - "line": 17, - "column": 27 + "line": 46, + "column": 48 } } }, @@ -3290,92 +7608,70 @@ "binop": null, "updateContext": null }, - "start": 514, - "end": 515, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 28 - } - } - }, - { - "type": "CommentLine", - "value": " If n is the root, there is nothing to do:", - "start": 517, - "end": 561, + "start": 1353, + "end": 1354, "loc": { "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 45 - } - } - }, - { - "type": "CommentLine", - "value": " - all paths go through n, and", - "start": 563, - "end": 597, - "loc": { - "start": { - "line": 19, - "column": 1 + "line": 46, + "column": 48 }, "end": { - "line": 19, - "column": 35 + "line": 46, + "column": 49 } } }, { - "type": "CommentLine", - "value": " - n is black.", - "start": 599, - "end": 617, + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 1357, + "end": 1361, "loc": { "start": { - "line": 20, - "column": 1 + "line": 47, + "column": 2 }, "end": { - "line": 20, - "column": 19 + "line": 47, + "column": 6 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 619, - "end": 621, + "value": "rotate_right", + "start": 1362, + "end": 1374, "loc": { "start": { - "line": 21, - "column": 1 + "line": 47, + "column": 7 }, "end": { - "line": 21, - "column": 3 + "line": 47, + "column": 19 } } }, @@ -3391,16 +7687,16 @@ "postfix": false, "binop": null }, - "start": 622, - "end": 623, + "start": 1374, + "end": 1375, "loc": { "start": { - "line": 21, - "column": 4 + "line": 47, + "column": 19 }, "end": { - "line": 21, - "column": 5 + "line": 47, + "column": 20 } } }, @@ -3417,16 +7713,16 @@ "binop": null }, "value": "n", - "start": 623, - "end": 624, + "start": 1375, + "end": 1376, "loc": { "start": { - "line": 21, - "column": 5 + "line": 47, + "column": 20 }, "end": { - "line": 21, - "column": 6 + "line": 47, + "column": 21 } } }, @@ -3443,16 +7739,16 @@ "binop": null, "updateContext": null }, - "start": 624, - "end": 625, + "start": 1376, + "end": 1377, "loc": { "start": { - "line": 21, - "column": 6 + "line": 47, + "column": 21 }, "end": { - "line": 21, - "column": 7 + "line": 47, + "column": 22 } } }, @@ -3469,52 +7765,49 @@ "binop": null }, "value": "parent", - "start": 625, - "end": 631, + "start": 1377, + "end": 1383, "loc": { "start": { - "line": 21, - "column": 7 + "line": 47, + "column": 22 }, "end": { - "line": 21, - "column": 13 + "line": 47, + "column": 28 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "!==", - "start": 632, - "end": 635, + "start": 1383, + "end": 1384, "loc": { "start": { - "line": 21, - "column": 14 + "line": 47, + "column": 28 }, "end": { - "line": 21, - "column": 17 + "line": 47, + "column": 29 } } }, { "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3523,25 +7816,24 @@ "binop": null, "updateContext": null }, - "value": "null", - "start": 636, - "end": 640, + "start": 1384, + "end": 1385, "loc": { "start": { - "line": 21, - "column": 18 + "line": 47, + "column": 29 }, "end": { - "line": 21, - "column": 22 + "line": 47, + "column": 30 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3549,23 +7841,24 @@ "postfix": false, "binop": null }, - "start": 640, - "end": 641, + "value": "delete_case3", + "start": 1388, + "end": 1400, "loc": { "start": { - "line": 21, - "column": 22 + "line": 48, + "column": 2 }, "end": { - "line": 21, - "column": 23 + "line": 48, + "column": 14 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3574,24 +7867,23 @@ "postfix": false, "binop": null }, - "value": "delete_case2", - "start": 642, - "end": 654, + "start": 1400, + "end": 1401, "loc": { "start": { - "line": 21, - "column": 24 + "line": 48, + "column": 14 }, "end": { - "line": 21, - "column": 36 + "line": 48, + "column": 15 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3600,24 +7892,25 @@ "postfix": false, "binop": null }, - "start": 654, - "end": 655, + "value": "n", + "start": 1401, + "end": 1402, "loc": { "start": { - "line": 21, - "column": 36 + "line": 48, + "column": 15 }, "end": { - "line": 21, - "column": 37 + "line": 48, + "column": 16 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3625,68 +7918,67 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 655, - "end": 656, + "start": 1402, + "end": 1403, "loc": { "start": { - "line": 21, - "column": 37 + "line": 48, + "column": 16 }, "end": { - "line": 21, - "column": 38 + "line": 48, + "column": 17 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 656, - "end": 657, + "start": 1403, + "end": 1404, "loc": { "start": { - "line": 21, - "column": 38 + "line": 48, + "column": 17 }, "end": { - "line": 21, - "column": 39 + "line": 48, + "column": 18 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 657, - "end": 658, + "start": 1406, + "end": 1407, "loc": { "start": { - "line": 21, - "column": 39 + "line": 49, + "column": 1 }, "end": { - "line": 21, - "column": 40 + "line": 49, + "column": 2 } } }, @@ -3702,15 +7994,15 @@ "postfix": false, "binop": null }, - "start": 659, - "end": 660, + "start": 1408, + "end": 1409, "loc": { "start": { - "line": 22, + "line": 50, "column": 0 }, "end": { - "line": 22, + "line": 50, "column": 1 } } @@ -3728,15 +8020,15 @@ "binop": null, "updateContext": null }, - "start": 660, - "end": 661, + "start": 1409, + "end": 1410, "loc": { "start": { - "line": 22, + "line": 50, "column": 1 }, "end": { - "line": 22, + "line": 50, "column": 2 } } @@ -3756,15 +8048,15 @@ "updateContext": null }, "value": "export", - "start": 663, - "end": 669, + "start": 1412, + "end": 1418, "loc": { "start": { - "line": 24, + "line": 52, "column": 0 }, "end": { - "line": 24, + "line": 52, "column": 6 } } @@ -3784,15 +8076,15 @@ "updateContext": null }, "value": "default", - "start": 670, - "end": 677, + "start": 1419, + "end": 1426, "loc": { "start": { - "line": 24, + "line": 52, "column": 7 }, "end": { - "line": 24, + "line": 52, "column": 14 } } @@ -3810,15 +8102,15 @@ "binop": null }, "value": "delete_case1", - "start": 678, - "end": 690, + "start": 1427, + "end": 1439, "loc": { "start": { - "line": 24, + "line": 52, "column": 15 }, "end": { - "line": 24, + "line": 52, "column": 27 } } @@ -3836,15 +8128,15 @@ "binop": null, "updateContext": null }, - "start": 690, - "end": 691, + "start": 1439, + "end": 1440, "loc": { "start": { - "line": 24, + "line": 52, "column": 27 }, "end": { - "line": 24, + "line": 52, "column": 28 } } @@ -3862,15 +8154,15 @@ "binop": null, "updateContext": null }, - "start": 692, - "end": 692, + "start": 1441, + "end": 1441, "loc": { "start": { - "line": 25, + "line": 53, "column": 0 }, "end": { - "line": 25, + "line": 53, "column": 0 } } diff --git a/ast/source/deletion/delete_case2.js.json b/ast/source/deletion/delete_case2.js.json index 390f9f5..d645e11 100644 --- a/ast/source/deletion/delete_case2.js.json +++ b/ast/source/deletion/delete_case2.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1455, + "end": 1558, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 53, + "line": 55, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1455, + "end": 1558, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 53, + "line": 55, "column": 0 } }, @@ -307,7 +307,7 @@ { "type": "ImportDeclaration", "start": 140, - "end": 176, + "end": 183, "loc": { "start": { "line": 5, @@ -315,14 +315,14 @@ }, "end": { "line": 5, - "column": 36 + "column": 43 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 147, - "end": 151, + "end": 154, "loc": { "start": { "line": 5, @@ -330,13 +330,13 @@ }, "end": { "line": 5, - "column": 11 + "column": 14 } }, "local": { "type": "Identifier", "start": 147, - "end": 151, + "end": 154, "loc": { "start": { "line": 5, @@ -344,108 +344,39 @@ }, "end": { "line": 5, - "column": 11 + "column": 14 }, - "identifierName": "Leaf" + "identifierName": "sibling" }, - "name": "Leaf" + "name": "sibling" } } ], "source": { "type": "StringLiteral", - "start": 157, - "end": 175, + "start": 160, + "end": 182, "loc": { "start": { "line": 5, - "column": 17 + "column": 20 }, "end": { "line": 5, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" - } - }, - { - "type": "ImportDeclaration", - "start": 177, - "end": 228, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 51 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 184, - "end": 195, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "local": { - "type": "Identifier", - "start": 184, - "end": 195, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 18 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 201, - "end": 227, - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 50 + "column": 42 } }, "extra": { - "rawValue": "../rotate/rotate_left.js", - "raw": "'../rotate/rotate_left.js'" + "rawValue": "../family/sibling.js", + "raw": "'../family/sibling.js'" }, - "value": "../rotate/rotate_left.js" + "value": "../family/sibling.js" } }, { "type": "ImportDeclaration", - "start": 229, - "end": 282, + "start": 185, + "end": 230, "loc": { "start": { "line": 7, @@ -453,14 +384,14 @@ }, "end": { "line": 7, - "column": 53 + "column": 45 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 236, - "end": 248, + "start": 192, + "end": 204, "loc": { "start": { "line": 7, @@ -473,8 +404,8 @@ }, "local": { "type": "Identifier", - "start": 236, - "end": 248, + "start": 192, + "end": 204, "loc": { "start": { "line": 7, @@ -484,16 +415,16 @@ "line": 7, "column": 19 }, - "identifierName": "rotate_right" + "identifierName": "delete_case0" }, - "name": "rotate_right" + "name": "delete_case0" } } ], "source": { "type": "StringLiteral", - "start": 254, - "end": 281, + "start": 210, + "end": 229, "loc": { "start": { "line": 7, @@ -501,20 +432,20 @@ }, "end": { "line": 7, - "column": 52 + "column": 44 } }, "extra": { - "rawValue": "../rotate/rotate_right.js", - "raw": "'../rotate/rotate_right.js'" + "rawValue": "./delete_case0.js", + "raw": "'./delete_case0.js'" }, - "value": "../rotate/rotate_right.js" + "value": "./delete_case0.js" } }, { "type": "ImportDeclaration", - "start": 283, - "end": 326, + "start": 231, + "end": 276, "loc": { "start": { "line": 8, @@ -522,14 +453,14 @@ }, "end": { "line": 8, - "column": 43 + "column": 45 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 290, - "end": 297, + "start": 238, + "end": 250, "loc": { "start": { "line": 8, @@ -537,13 +468,13 @@ }, "end": { "line": 8, - "column": 14 + "column": 19 } }, "local": { "type": "Identifier", - "start": 290, - "end": 297, + "start": 238, + "end": 250, "loc": { "start": { "line": 8, @@ -551,75 +482,6 @@ }, "end": { "line": 8, - "column": 14 - }, - "identifierName": "sibling" - }, - "name": "sibling" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 303, - "end": 325, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 42 - } - }, - "extra": { - "rawValue": "../family/sibling.js", - "raw": "'../family/sibling.js'" - }, - "value": "../family/sibling.js" - } - }, - { - "type": "ImportDeclaration", - "start": 328, - "end": 373, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 45 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 335, - "end": 347, - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 335, - "end": 347, - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, "column": 19 }, "identifierName": "delete_case3" @@ -630,15 +492,15 @@ ], "source": { "type": "StringLiteral", - "start": 353, - "end": 372, + "start": 256, + "end": 275, "loc": { "start": { - "line": 10, + "line": 8, "column": 25 }, "end": { - "line": 10, + "line": 8, "column": 44 } }, @@ -647,89 +509,20 @@ "raw": "'./delete_case3.js'" }, "value": "./delete_case3.js" - } - }, - { - "type": "ImportDeclaration", - "start": 374, - "end": 419, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 45 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 381, - "end": 393, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 381, - "end": 393, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 19 - }, - "identifierName": "delete_case4" - }, - "name": "delete_case4" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 399, - "end": 418, - "loc": { - "start": { - "line": 11, - "column": 25 - }, - "end": { - "line": 11, - "column": 44 - } - }, - "extra": { - "rawValue": "./delete_case4.js", - "raw": "'./delete_case4.js'" - }, - "value": "./delete_case4.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 421, - "end": 664, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "start": 278, + "end": 544, "loc": { "start": { - "line": 13, + "line": 10, "column": 0 }, "end": { - "line": 21, + "line": 19, "column": 3 } } @@ -738,44 +531,44 @@ }, { "type": "Identifier", - "start": 665, - "end": 1424, + "start": 545, + "end": 1527, "loc": { "start": { - "line": 22, + "line": 20, "column": 0 }, "end": { - "line": 50, + "line": 52, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 671, - "end": 1423, + "start": 551, + "end": 1526, "loc": { "start": { - "line": 22, + "line": 20, "column": 6 }, "end": { - "line": 50, + "line": 52, "column": 1 } }, "id": { "type": "Identifier", - "start": 671, - "end": 683, + "start": 551, + "end": 563, "loc": { "start": { - "line": 22, + "line": 20, "column": 6 }, "end": { - "line": 22, + "line": 20, "column": 18 }, "identifierName": "delete_case2" @@ -785,15 +578,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 686, - "end": 1423, + "start": 566, + "end": 1526, "loc": { "start": { - "line": 22, + "line": 20, "column": 21 }, "end": { - "line": 50, + "line": 52, "column": 1 } }, @@ -804,15 +597,15 @@ "params": [ { "type": "Identifier", - "start": 687, - "end": 688, + "start": 567, + "end": 568, "loc": { "start": { - "line": 22, + "line": 20, "column": 22 }, "end": { - "line": 22, + "line": 20, "column": 23 }, "identifierName": "n" @@ -822,58 +615,58 @@ ], "body": { "type": "BlockStatement", - "start": 693, - "end": 1423, + "start": 573, + "end": 1526, "loc": { "start": { - "line": 22, + "line": 20, "column": 28 }, "end": { - "line": 50, + "line": 52, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 696, - "end": 743, + "start": 576, + "end": 602, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, - "column": 48 + "line": 21, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 696, - "end": 742, + "start": 576, + "end": 601, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, - "column": 47 + "line": 21, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 696, - "end": 702, + "start": 576, + "end": 582, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -882,119 +675,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 703, - "end": 741, + "type": "BinaryExpression", + "start": 583, + "end": 600, "loc": { "start": { - "line": 23, + "line": 21, "column": 8 }, "end": { - "line": 23, - "column": 46 + "line": 21, + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 703, - "end": 720, + "type": "Identifier", + "start": 583, + "end": 584, "loc": { "start": { - "line": 23, + "line": 21, "column": 8 }, "end": { - "line": 23, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 703, - "end": 704, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "n" + "line": 21, + "column": 9 }, - "name": "n" + "identifierName": "n" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 716, - "end": 720, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "n" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 724, - "end": 741, + "type": "Identifier", + "start": 596, + "end": 600, "loc": { "start": { - "line": 23, - "column": 29 + "line": 21, + "column": 21 }, "end": { - "line": 23, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 724, - "end": 725, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 30 - }, - "identifierName": "n" + "line": 21, + "column": 25 }, - "name": "n" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 737, - "end": 741, - "loc": { - "start": { - "line": 23, - "column": 42 - }, - "end": { - "line": 23, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -1002,43 +729,43 @@ }, { "type": "ExpressionStatement", - "start": 745, - "end": 772, + "start": 604, + "end": 631, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 745, - "end": 771, + "start": 604, + "end": 630, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 27 } }, "callee": { "type": "Identifier", - "start": 745, - "end": 751, + "start": 604, + "end": 610, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -1048,43 +775,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 752, - "end": 770, + "start": 611, + "end": 629, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 752, - "end": 760, + "start": 611, + "end": 619, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 16 } }, "object": { "type": "Identifier", - "start": 752, - "end": 753, + "start": 611, + "end": 612, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 9 }, "identifierName": "n" @@ -1093,15 +820,15 @@ }, "property": { "type": "Identifier", - "start": 754, - "end": 760, + "start": 613, + "end": 619, "loc": { "start": { - "line": 24, + "line": 22, "column": 10 }, "end": { - "line": 24, + "line": 22, "column": 16 }, "identifierName": "_color" @@ -1113,15 +840,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 765, - "end": 770, + "start": 624, + "end": 629, "loc": { "start": { - "line": 24, + "line": 22, "column": 21 }, "end": { - "line": 24, + "line": 22, "column": 26 }, "identifierName": "BLACK" @@ -1134,43 +861,43 @@ }, { "type": "ExpressionStatement", - "start": 774, - "end": 800, + "start": 633, + "end": 659, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 774, - "end": 799, + "start": 633, + "end": 658, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 774, - "end": 780, + "start": 633, + "end": 639, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -1180,43 +907,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 781, - "end": 798, + "start": 640, + "end": 657, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 781, - "end": 789, + "start": 640, + "end": 648, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 781, - "end": 782, + "start": 640, + "end": 641, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 9 }, "identifierName": "n" @@ -1225,15 +952,15 @@ }, "property": { "type": "Identifier", - "start": 783, - "end": 789, + "start": 642, + "end": 648, "loc": { "start": { - "line": 25, + "line": 23, "column": 10 }, "end": { - "line": 25, + "line": 23, "column": 16 }, "identifierName": "parent" @@ -1245,15 +972,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 794, - "end": 798, + "start": 653, + "end": 657, "loc": { "start": { - "line": 25, + "line": 23, "column": 21 }, "end": { - "line": 25, + "line": 23, "column": 25 } } @@ -1264,44 +991,44 @@ }, { "type": "VariableDeclaration", - "start": 803, - "end": 824, + "start": 661, + "end": 682, "loc": { "start": { - "line": 27, + "line": 24, "column": 1 }, "end": { - "line": 27, + "line": 24, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 809, - "end": 823, + "start": 667, + "end": 681, "loc": { "start": { - "line": 27, + "line": 24, "column": 7 }, "end": { - "line": 27, + "line": 24, "column": 21 } }, "id": { "type": "Identifier", - "start": 809, - "end": 810, + "start": 667, + "end": 668, "loc": { "start": { - "line": 27, + "line": 24, "column": 7 }, "end": { - "line": 27, + "line": 24, "column": 8 }, "identifierName": "s" @@ -1310,29 +1037,29 @@ }, "init": { "type": "CallExpression", - "start": 813, - "end": 823, + "start": 671, + "end": 681, "loc": { "start": { - "line": 27, + "line": 24, "column": 11 }, "end": { - "line": 27, + "line": 24, "column": 21 } }, "callee": { "type": "Identifier", - "start": 813, - "end": 820, + "start": 671, + "end": 678, "loc": { "start": { - "line": 27, + "line": 24, "column": 11 }, "end": { - "line": 27, + "line": 24, "column": 18 }, "identifierName": "sibling" @@ -1342,15 +1069,15 @@ "arguments": [ { "type": "Identifier", - "start": 821, - "end": 822, + "start": 679, + "end": 680, "loc": { "start": { - "line": 27, + "line": 24, "column": 19 }, "end": { - "line": 27, + "line": 24, "column": 20 }, "identifierName": "n" @@ -1361,276 +1088,303 @@ } } ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 827, - "end": 1195, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 39, - "column": 4 - } - } - } - ] + "kind": "const" }, { - "type": "IfStatement", - "start": 1197, - "end": 1421, + "type": "ExpressionStatement", + "start": 684, + "end": 710, "loc": { "start": { - "line": 40, + "line": 25, "column": 1 }, "end": { - "line": 49, - "column": 22 + "line": 25, + "column": 27 } }, - "test": { - "type": "BinaryExpression", - "start": 1201, - "end": 1217, + "expression": { + "type": "CallExpression", + "start": 684, + "end": 709, "loc": { "start": { - "line": 40, - "column": 5 + "line": 25, + "column": 1 }, "end": { - "line": 40, - "column": 21 + "line": 25, + "column": 26 } }, - "left": { - "type": "MemberExpression", - "start": 1201, - "end": 1209, + "callee": { + "type": "Identifier", + "start": 684, + "end": 690, "loc": { "start": { - "line": 40, - "column": 5 + "line": 25, + "column": 1 }, "end": { - "line": 40, - "column": 13 - } - }, - "object": { - "type": "Identifier", - "start": 1201, - "end": 1202, - "loc": { - "start": { - "line": 40, - "column": 5 - }, - "end": { - "line": 40, - "column": 6 - }, - "identifierName": "s" + "line": 25, + "column": 7 }, - "name": "s", - "leadingComments": null + "identifierName": "assert" }, - "property": { - "type": "Identifier", - "start": 1203, - "end": 1209, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 691, + "end": 708, "loc": { "start": { - "line": 40, - "column": 7 + "line": 25, + "column": 8 }, "end": { - "line": 40, - "column": 13 + "line": 25, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 691, + "end": 692, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "s" }, - "identifierName": "_color" + "name": "s" }, - "name": "_color" + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 704, + "end": 708, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 712, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 712, + "end": 738, + "loc": { + "start": { + "line": 26, + "column": 1 }, - "computed": false, - "leadingComments": null + "end": { + "line": 26, + "column": 27 + } }, - "operator": "===", - "right": { + "callee": { "type": "Identifier", - "start": 1214, - "end": 1217, + "start": 712, + "end": 718, "loc": { "start": { - "line": 40, - "column": 18 + "line": 26, + "column": 1 }, "end": { - "line": 40, - "column": 21 + "line": 26, + "column": 7 }, - "identifierName": "RED" - }, - "name": "RED" - }, - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 1219, - "end": 1368, - "loc": { - "start": { - "line": 40, - "column": 23 + "identifierName": "assert" }, - "end": { - "line": 46, - "column": 2 - } + "name": "assert" }, - "body": [ + "arguments": [ { - "type": "ExpressionStatement", - "start": 1223, - "end": 1245, + "type": "BinaryExpression", + "start": 719, + "end": 737, "loc": { "start": { - "line": 41, - "column": 2 + "line": 26, + "column": 8 }, "end": { - "line": 41, - "column": 24 + "line": 26, + "column": 26 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1223, - "end": 1244, + "left": { + "type": "MemberExpression", + "start": 719, + "end": 727, "loc": { "start": { - "line": 41, - "column": 2 + "line": 26, + "column": 8 }, "end": { - "line": 41, - "column": 23 + "line": 26, + "column": 16 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1223, - "end": 1238, + "object": { + "type": "Identifier", + "start": 719, + "end": 720, "loc": { "start": { - "line": 41, - "column": 2 + "line": 26, + "column": 8 }, "end": { - "line": 41, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1223, - "end": 1231, - "loc": { - "start": { - "line": 41, - "column": 2 - }, - "end": { - "line": 41, - "column": 10 - } + "line": 26, + "column": 9 }, - "object": { - "type": "Identifier", - "start": 1223, - "end": 1224, - "loc": { - "start": { - "line": 41, - "column": 2 - }, - "end": { - "line": 41, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n" + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 721, + "end": 727, + "loc": { + "start": { + "line": 26, + "column": 10 }, - "property": { - "type": "Identifier", - "start": 1225, - "end": 1231, - "loc": { - "start": { - "line": 41, - "column": 4 - }, - "end": { - "line": 41, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1232, - "end": 1238, - "loc": { - "start": { - "line": 41, - "column": 11 - }, - "end": { - "line": 41, - "column": 17 - }, - "identifierName": "_color" + "end": { + "line": 26, + "column": 16 }, - "name": "_color" + "identifierName": "_color" }, - "computed": false + "name": "_color" }, - "right": { - "type": "Identifier", - "start": 1241, - "end": 1244, - "loc": { - "start": { - "line": 41, - "column": 20 - }, - "end": { - "line": 41, - "column": 23 - }, - "identifierName": "RED" + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 732, + "end": 737, + "loc": { + "start": { + "line": 26, + "column": 21 }, - "name": "RED" - } + "end": { + "line": 26, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 742, + "end": 1283, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1285, + "end": 1524, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 51, + "column": 22 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1292, + "end": 1419, + "loc": { + "start": { + "line": 42, + "column": 2 }, - { - "type": "ExpressionStatement", - "start": 1248, - "end": 1265, + "end": { + "line": 44, + "column": 48 + } + }, + "left": { + "type": "LogicalExpression", + "start": 1292, + "end": 1367, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 43, + "column": 46 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1292, + "end": 1317, "loc": { "start": { "line": 42, @@ -1638,13 +1392,13 @@ }, "end": { "line": 42, - "column": 19 + "column": 27 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1248, - "end": 1264, + "left": { + "type": "MemberExpression", + "start": 1292, + "end": 1307, "loc": { "start": { "line": 42, @@ -1652,14 +1406,13 @@ }, "end": { "line": 42, - "column": 18 + "column": 17 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 1248, - "end": 1256, + "start": 1292, + "end": 1300, "loc": { "start": { "line": 42, @@ -1672,8 +1425,8 @@ }, "object": { "type": "Identifier", - "start": 1248, - "end": 1249, + "start": 1292, + "end": 1293, "loc": { "start": { "line": 42, @@ -1683,14 +1436,15 @@ "line": 42, "column": 3 }, - "identifierName": "s" + "identifierName": "n" }, - "name": "s" + "name": "n", + "leadingComments": null }, "property": { "type": "Identifier", - "start": 1250, - "end": 1256, + "start": 1294, + "end": 1300, "loc": { "start": { "line": 42, @@ -1700,422 +1454,701 @@ "line": 42, "column": 10 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, - "computed": false + "computed": false, + "leadingComments": null }, - "right": { + "property": { "type": "Identifier", - "start": 1259, - "end": 1264, + "start": 1301, + "end": 1307, "loc": { "start": { "line": 42, - "column": 13 + "column": 11 }, "end": { "line": 42, - "column": 18 + "column": 17 }, - "identifierName": "BLACK" + "identifierName": "_color" }, - "name": "BLACK" - } - } + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1312, + "end": 1317, + "loc": { + "start": { + "line": 42, + "column": 22 + }, + "end": { + "line": 42, + "column": 27 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null }, - { - "type": "IfStatement", - "start": 1268, - "end": 1346, + "operator": "&&", + "right": { + "type": "LogicalExpression", + "start": 1324, + "end": 1366, "loc": { "start": { "line": 43, - "column": 2 + "column": 3 }, "end": { - "line": 44, - "column": 30 + "line": 43, + "column": 45 } }, - "test": { + "left": { "type": "BinaryExpression", - "start": 1272, - "end": 1291, + "start": 1324, + "end": 1339, "loc": { "start": { "line": 43, - "column": 6 + "column": 3 }, "end": { "line": 43, - "column": 25 + "column": 18 } }, "left": { - "type": "Identifier", - "start": 1272, - "end": 1273, + "type": "MemberExpression", + "start": 1324, + "end": 1330, "loc": { "start": { "line": 43, - "column": 6 + "column": 3 }, "end": { "line": 43, - "column": 7 + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1324, + "end": 1325, + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 4 + }, + "identifierName": "s" }, - "identifierName": "n" + "name": "s" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1326, + "end": 1330, + "loc": { + "start": { + "line": 43, + "column": 5 + }, + "end": { + "line": 43, + "column": 9 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, "operator": "===", "right": { + "type": "NullLiteral", + "start": 1335, + "end": 1339, + "loc": { + "start": { + "line": 43, + "column": 14 + }, + "end": { + "line": 43, + "column": 18 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 1343, + "end": 1366, + "loc": { + "start": { + "line": 43, + "column": 22 + }, + "end": { + "line": 43, + "column": 45 + } + }, + "left": { "type": "MemberExpression", - "start": 1278, - "end": 1291, + "start": 1343, + "end": 1356, "loc": { "start": { "line": 43, - "column": 12 + "column": 22 }, "end": { "line": 43, - "column": 25 + "column": 35 } }, "object": { "type": "MemberExpression", - "start": 1278, - "end": 1286, + "start": 1343, + "end": 1349, "loc": { "start": { "line": 43, - "column": 12 + "column": 22 }, "end": { "line": 43, - "column": 20 + "column": 28 } }, "object": { "type": "Identifier", - "start": 1278, - "end": 1279, + "start": 1343, + "end": 1344, "loc": { "start": { "line": 43, - "column": 12 + "column": 22 }, "end": { "line": 43, - "column": 13 + "column": 23 }, - "identifierName": "n" + "identifierName": "s" }, - "name": "n" + "name": "s" }, "property": { "type": "Identifier", - "start": 1280, - "end": 1286, + "start": 1345, + "end": 1349, "loc": { "start": { "line": 43, - "column": 14 + "column": 24 }, "end": { "line": 43, - "column": 20 + "column": 28 }, - "identifierName": "parent" + "identifierName": "left" }, - "name": "parent" + "name": "left" }, "computed": false }, "property": { "type": "Identifier", - "start": 1287, - "end": 1291, + "start": 1350, + "end": 1356, "loc": { "start": { "line": 43, - "column": 21 + "column": 29 }, "end": { "line": 43, - "column": 25 + "column": 35 }, - "identifierName": "left" + "identifierName": "_color" }, - "name": "left" + "name": "_color" }, "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1361, + "end": 1366, + "loc": { + "start": { + "line": 43, + "column": 40 + }, + "end": { + "line": 43, + "column": 45 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } }, - "consequent": { - "type": "ExpressionStatement", - "start": 1293, - "end": 1315, + "extra": { + "parenthesized": true, + "parenStart": 1323 + } + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "LogicalExpression", + "start": 1374, + "end": 1418, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 47 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1374, + "end": 1390, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 19 + } + }, + "left": { + "type": "MemberExpression", + "start": 1374, + "end": 1381, "loc": { "start": { - "line": 43, - "column": 27 + "line": 44, + "column": 3 }, "end": { - "line": 43, - "column": 49 + "line": 44, + "column": 10 } }, - "expression": { - "type": "CallExpression", - "start": 1293, - "end": 1314, + "object": { + "type": "Identifier", + "start": 1374, + "end": 1375, "loc": { "start": { - "line": 43, - "column": 27 + "line": 44, + "column": 3 }, "end": { - "line": 43, - "column": 48 + "line": 44, + "column": 4 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1376, + "end": 1381, + "loc": { + "start": { + "line": 44, + "column": 5 + }, + "end": { + "line": 44, + "column": 10 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 1386, + "end": 1390, + "loc": { + "start": { + "line": 44, + "column": 15 + }, + "end": { + "line": 44, + "column": 19 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 1394, + "end": 1418, + "loc": { + "start": { + "line": 44, + "column": 23 + }, + "end": { + "line": 44, + "column": 47 + } + }, + "left": { + "type": "MemberExpression", + "start": 1394, + "end": 1408, + "loc": { + "start": { + "line": 44, + "column": 23 + }, + "end": { + "line": 44, + "column": 37 + } + }, + "object": { + "type": "MemberExpression", + "start": 1394, + "end": 1401, + "loc": { + "start": { + "line": 44, + "column": 23 + }, + "end": { + "line": 44, + "column": 30 } }, - "callee": { + "object": { "type": "Identifier", - "start": 1293, - "end": 1304, + "start": 1394, + "end": 1395, "loc": { "start": { - "line": 43, - "column": 27 + "line": 44, + "column": 23 }, "end": { - "line": 43, - "column": 38 + "line": 44, + "column": 24 }, - "identifierName": "rotate_left" + "identifierName": "s" }, - "name": "rotate_left" + "name": "s" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1305, - "end": 1313, - "loc": { - "start": { - "line": 43, - "column": 39 - }, - "end": { - "line": 43, - "column": 47 - } - }, - "object": { - "type": "Identifier", - "start": 1305, - "end": 1306, - "loc": { - "start": { - "line": 43, - "column": 39 - }, - "end": { - "line": 43, - "column": 40 - }, - "identifierName": "n" - }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1396, + "end": 1401, + "loc": { + "start": { + "line": 44, + "column": 25 }, - "property": { - "type": "Identifier", - "start": 1307, - "end": 1313, - "loc": { - "start": { - "line": 43, - "column": 41 - }, - "end": { - "line": 43, - "column": 47 - }, - "identifierName": "parent" - }, - "name": "parent" + "end": { + "line": 44, + "column": 30 }, - "computed": false - } - ] - } + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1402, + "end": 1408, + "loc": { + "start": { + "line": 44, + "column": 31 + }, + "end": { + "line": 44, + "column": 37 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "alternate": { - "type": "ExpressionStatement", - "start": 1323, - "end": 1346, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1413, + "end": 1418, "loc": { "start": { "line": 44, - "column": 7 + "column": 42 }, "end": { "line": 44, - "column": 30 + "column": 47 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "extra": { + "parenthesized": true, + "parenStart": 1373 + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1423, + "end": 1471, + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 48, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1427, + "end": 1442, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1427, + "end": 1441, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 16 } }, - "expression": { - "type": "CallExpression", - "start": 1323, - "end": 1345, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1427, + "end": 1435, "loc": { "start": { - "line": 44, - "column": 7 + "line": 46, + "column": 2 }, "end": { - "line": 44, - "column": 29 + "line": 46, + "column": 10 } }, - "callee": { + "object": { "type": "Identifier", - "start": 1323, - "end": 1335, + "start": 1427, + "end": 1428, "loc": { "start": { - "line": 44, - "column": 7 + "line": 46, + "column": 2 }, "end": { - "line": 44, - "column": 19 + "line": 46, + "column": 3 }, - "identifierName": "rotate_right" + "identifierName": "s" }, - "name": "rotate_right" + "name": "s" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1336, - "end": 1344, - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 28 - } - }, - "object": { - "type": "Identifier", - "start": 1336, - "end": 1337, - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 21 - }, - "identifierName": "n" - }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1429, + "end": 1435, + "loc": { + "start": { + "line": 46, + "column": 4 }, - "property": { - "type": "Identifier", - "start": 1338, - "end": 1344, - "loc": { - "start": { - "line": 44, - "column": 22 - }, - "end": { - "line": 44, - "column": 28 - }, - "identifierName": "parent" - }, - "name": "parent" + "end": { + "line": 46, + "column": 10 }, - "computed": false - } - ] + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1438, + "end": 1441, + "loc": { + "start": { + "line": 46, + "column": 13 + }, + "end": { + "line": 46, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" } } }, { "type": "ExpressionStatement", - "start": 1349, - "end": 1365, + "start": 1445, + "end": 1468, "loc": { "start": { - "line": 45, + "line": 47, "column": 2 }, "end": { - "line": 45, - "column": 18 + "line": 47, + "column": 25 } }, "expression": { "type": "CallExpression", - "start": 1349, - "end": 1364, + "start": 1445, + "end": 1467, "loc": { "start": { - "line": 45, + "line": 47, "column": 2 }, "end": { - "line": 45, - "column": 17 + "line": 47, + "column": 24 } }, "callee": { "type": "Identifier", - "start": 1349, - "end": 1361, + "start": 1445, + "end": 1457, "loc": { "start": { - "line": 45, + "line": 47, "column": 2 }, "end": { - "line": 45, + "line": 47, "column": 14 }, - "identifierName": "delete_case4" + "identifierName": "delete_case0" }, - "name": "delete_case4" + "name": "delete_case0" }, "arguments": [ { - "type": "Identifier", - "start": 1362, - "end": 1363, + "type": "MemberExpression", + "start": 1458, + "end": 1466, "loc": { "start": { - "line": 45, + "line": 47, "column": 15 }, "end": { - "line": 45, - "column": 16 + "line": 47, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 1458, + "end": 1459, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1460, + "end": 1466, + "loc": { + "start": { + "line": 47, + "column": 17 + }, + "end": { + "line": 47, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } ] } @@ -2126,15 +2159,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1371, - "end": 1398, + "start": 1474, + "end": 1501, "loc": { "start": { - "line": 48, + "line": 50, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 28 } } @@ -2143,43 +2176,43 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 1405, - "end": 1421, + "start": 1508, + "end": 1524, "loc": { "start": { - "line": 49, + "line": 51, "column": 6 }, "end": { - "line": 49, + "line": 51, "column": 22 } }, "expression": { "type": "CallExpression", - "start": 1405, - "end": 1420, + "start": 1508, + "end": 1523, "loc": { "start": { - "line": 49, + "line": 51, "column": 6 }, "end": { - "line": 49, + "line": 51, "column": 21 } }, "callee": { "type": "Identifier", - "start": 1405, - "end": 1417, + "start": 1508, + "end": 1520, "loc": { "start": { - "line": 49, + "line": 51, "column": 6 }, "end": { - "line": 49, + "line": 51, "column": 18 }, "identifierName": "delete_case3" @@ -2190,15 +2223,15 @@ "arguments": [ { "type": "Identifier", - "start": 1418, - "end": 1419, + "start": 1521, + "end": 1522, "loc": { "start": { - "line": 49, + "line": 51, "column": 19 }, "end": { - "line": 49, + "line": 51, "column": 20 }, "identifierName": "n" @@ -2212,15 +2245,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1371, - "end": 1398, + "start": 1474, + "end": 1501, "loc": { "start": { - "line": 48, + "line": 50, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 28 } } @@ -2230,16 +2263,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 827, - "end": 1195, + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 742, + "end": 1283, "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 39, + "line": 40, "column": 4 } } @@ -2260,29 +2293,29 @@ }, { "type": "Identifier", - "start": 1426, - "end": 1454, + "start": 1529, + "end": 1557, "loc": { "start": { - "line": 52, + "line": 54, "column": 0 }, "end": { - "line": 52, + "line": 54, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 1441, - "end": 1453, + "start": 1544, + "end": 1556, "loc": { "start": { - "line": 52, + "line": 54, "column": 15 }, "end": { - "line": 52, + "line": 54, "column": 27 }, "identifierName": "delete_case2" @@ -2295,58 +2328,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1426, - "end": 1454, + "start": 1529, + "end": 1557, "loc": { "start": { - "line": 52, + "line": 54, "column": 0 }, "end": { - "line": 52, + "line": 54, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 665, - "end": 1424, + "start": 545, + "end": 1527, "loc": { "start": { - "line": 22, + "line": 20, "column": 0 }, "end": { - "line": 50, + "line": 52, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 671, - "end": 1423, + "start": 551, + "end": 1526, "loc": { "start": { - "line": 22, + "line": 20, "column": 6 }, "end": { - "line": 50, + "line": 52, "column": 1 } }, "id": { "type": "Identifier", - "start": 671, - "end": 683, + "start": 551, + "end": 563, "loc": { "start": { - "line": 22, + "line": 20, "column": 6 }, "end": { - "line": 22, + "line": 20, "column": 18 }, "identifierName": "delete_case2" @@ -2356,29 +2389,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 686, - "end": 1423, + "start": 566, + "end": 1526, "loc": { "start": { - "line": 22, + "line": 20, "column": 21 }, "end": { - "line": 50, + "line": 52, "column": 1 } }, "id": { "type": "Identifier", - "start": 671, - "end": 683, + "start": 551, + "end": 563, "loc": { "start": { - "line": 22, + "line": 20, "column": 6 }, "end": { - "line": 22, + "line": 20, "column": 18 }, "identifierName": "delete_case2" @@ -2392,15 +2425,15 @@ "params": [ { "type": "Identifier", - "start": 687, - "end": 688, + "start": 567, + "end": 568, "loc": { "start": { - "line": 22, + "line": 20, "column": 22 }, "end": { - "line": 22, + "line": 20, "column": 23 }, "identifierName": "n" @@ -2410,58 +2443,58 @@ ], "body": { "type": "BlockStatement", - "start": 693, - "end": 1423, + "start": 573, + "end": 1526, "loc": { "start": { - "line": 22, + "line": 20, "column": 28 }, "end": { - "line": 50, + "line": 52, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 696, - "end": 743, + "start": 576, + "end": 602, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, - "column": 48 + "line": 21, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 696, - "end": 742, + "start": 576, + "end": 601, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, - "column": 47 + "line": 21, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 696, - "end": 702, + "start": 576, + "end": 582, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -2470,119 +2503,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 703, - "end": 741, + "type": "BinaryExpression", + "start": 583, + "end": 600, "loc": { "start": { - "line": 23, + "line": 21, "column": 8 }, "end": { - "line": 23, - "column": 46 + "line": 21, + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 703, - "end": 720, + "type": "Identifier", + "start": 583, + "end": 584, "loc": { "start": { - "line": 23, + "line": 21, "column": 8 }, "end": { - "line": 23, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 703, - "end": 704, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "n" + "line": 21, + "column": 9 }, - "name": "n" + "identifierName": "n" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 716, - "end": 720, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "n" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 724, - "end": 741, + "type": "Identifier", + "start": 596, + "end": 600, "loc": { "start": { - "line": 23, - "column": 29 + "line": 21, + "column": 21 }, "end": { - "line": 23, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 724, - "end": 725, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 30 - }, - "identifierName": "n" + "line": 21, + "column": 25 }, - "name": "n" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 737, - "end": 741, - "loc": { - "start": { - "line": 23, - "column": 42 - }, - "end": { - "line": 23, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -2590,43 +2557,43 @@ }, { "type": "ExpressionStatement", - "start": 745, - "end": 772, + "start": 604, + "end": 631, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 745, - "end": 771, + "start": 604, + "end": 630, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 27 } }, "callee": { "type": "Identifier", - "start": 745, - "end": 751, + "start": 604, + "end": 610, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -2636,43 +2603,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 752, - "end": 770, + "start": 611, + "end": 629, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 752, - "end": 760, + "start": 611, + "end": 619, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 16 } }, "object": { "type": "Identifier", - "start": 752, - "end": 753, + "start": 611, + "end": 612, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 9 }, "identifierName": "n" @@ -2681,15 +2648,15 @@ }, "property": { "type": "Identifier", - "start": 754, - "end": 760, + "start": 613, + "end": 619, "loc": { "start": { - "line": 24, + "line": 22, "column": 10 }, "end": { - "line": 24, + "line": 22, "column": 16 }, "identifierName": "_color" @@ -2701,15 +2668,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 765, - "end": 770, + "start": 624, + "end": 629, "loc": { "start": { - "line": 24, + "line": 22, "column": 21 }, "end": { - "line": 24, + "line": 22, "column": 26 }, "identifierName": "BLACK" @@ -2722,43 +2689,43 @@ }, { "type": "ExpressionStatement", - "start": 774, - "end": 800, + "start": 633, + "end": 659, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 774, - "end": 799, + "start": 633, + "end": 658, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 774, - "end": 780, + "start": 633, + "end": 639, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -2768,43 +2735,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 781, - "end": 798, + "start": 640, + "end": 657, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 781, - "end": 789, + "start": 640, + "end": 648, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 781, - "end": 782, + "start": 640, + "end": 641, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 9 }, "identifierName": "n" @@ -2813,15 +2780,15 @@ }, "property": { "type": "Identifier", - "start": 783, - "end": 789, + "start": 642, + "end": 648, "loc": { "start": { - "line": 25, + "line": 23, "column": 10 }, "end": { - "line": 25, + "line": 23, "column": 16 }, "identifierName": "parent" @@ -2833,15 +2800,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 794, - "end": 798, + "start": 653, + "end": 657, "loc": { "start": { - "line": 25, + "line": 23, "column": 21 }, "end": { - "line": 25, + "line": 23, "column": 25 } } @@ -2852,44 +2819,44 @@ }, { "type": "VariableDeclaration", - "start": 803, - "end": 824, + "start": 661, + "end": 682, "loc": { "start": { - "line": 27, + "line": 24, "column": 1 }, "end": { - "line": 27, + "line": 24, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 809, - "end": 823, + "start": 667, + "end": 681, "loc": { "start": { - "line": 27, + "line": 24, "column": 7 }, "end": { - "line": 27, + "line": 24, "column": 21 } }, "id": { "type": "Identifier", - "start": 809, - "end": 810, + "start": 667, + "end": 668, "loc": { "start": { - "line": 27, + "line": 24, "column": 7 }, "end": { - "line": 27, + "line": 24, "column": 8 }, "identifierName": "s" @@ -2898,71 +2865,302 @@ }, "init": { "type": "CallExpression", - "start": 813, - "end": 823, + "start": 671, + "end": 681, "loc": { "start": { - "line": 27, + "line": 24, "column": 11 }, "end": { - "line": 27, + "line": 24, "column": 21 } }, "callee": { "type": "Identifier", - "start": 813, - "end": 820, + "start": 671, + "end": 678, "loc": { "start": { - "line": 27, + "line": 24, "column": 11 }, "end": { - "line": 27, + "line": 24, "column": 18 }, - "identifierName": "sibling" + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 679, + "end": 680, + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 684, + "end": 710, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 684, + "end": 709, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 684, + "end": 690, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 691, + "end": 708, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 691, + "end": 692, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 704, + "end": 708, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 712, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 712, + "end": 738, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 712, + "end": 718, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 719, + "end": 737, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 719, + "end": 727, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 719, + "end": 720, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 721, + "end": 727, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 732, + "end": 737, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 26 + }, + "identifierName": "BLACK" }, - "name": "sibling" - }, - "arguments": [ - { - "type": "Identifier", - "start": 821, - "end": 822, - "loc": { - "start": { - "line": 27, - "column": 19 - }, - "end": { - "line": 27, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] + "name": "BLACK" + } } - } - ], - "kind": "const", + ] + }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 827, - "end": 1195, + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 742, + "end": 1283, "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 39, + "line": 40, "column": 4 } } @@ -2971,224 +3169,353 @@ }, { "type": "IfStatement", - "start": 1197, - "end": 1421, + "start": 1285, + "end": 1524, "loc": { "start": { - "line": 40, + "line": 41, "column": 1 }, "end": { - "line": 49, + "line": 51, "column": 22 } }, "test": { - "type": "BinaryExpression", - "start": 1201, - "end": 1217, + "type": "LogicalExpression", + "start": 1292, + "end": 1419, "loc": { "start": { - "line": 40, - "column": 5 + "line": 42, + "column": 2 }, "end": { - "line": 40, - "column": 21 + "line": 44, + "column": 48 } }, "left": { - "type": "MemberExpression", - "start": 1201, - "end": 1209, + "type": "LogicalExpression", + "start": 1292, + "end": 1367, "loc": { "start": { - "line": 40, - "column": 5 + "line": 42, + "column": 2 }, "end": { - "line": 40, - "column": 13 + "line": 43, + "column": 46 } }, - "object": { - "type": "Identifier", - "start": 1201, - "end": 1202, + "left": { + "type": "BinaryExpression", + "start": 1292, + "end": 1317, "loc": { "start": { - "line": 40, - "column": 5 + "line": 42, + "column": 2 }, "end": { - "line": 40, - "column": 6 - }, - "identifierName": "s" + "line": 42, + "column": 27 + } }, - "name": "s", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1203, - "end": 1209, - "loc": { - "start": { - "line": 40, - "column": 7 + "left": { + "type": "MemberExpression", + "start": 1292, + "end": 1307, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 42, + "column": 17 + } }, - "end": { - "line": 40, - "column": 13 + "object": { + "type": "MemberExpression", + "start": 1292, + "end": 1300, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 42, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1292, + "end": 1293, + "loc": { + "start": { + "line": 42, + "column": 2 + }, + "end": { + "line": 42, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1294, + "end": 1300, + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 42, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1214, - "end": 1217, - "loc": { - "start": { - "line": 40, - "column": 18 + "property": { + "type": "Identifier", + "start": 1301, + "end": 1307, + "loc": { + "start": { + "line": 42, + "column": 11 + }, + "end": { + "line": 42, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null }, - "end": { - "line": 40, - "column": 21 + "operator": "===", + "right": { + "type": "Identifier", + "start": 1312, + "end": 1317, + "loc": { + "start": { + "line": 42, + "column": 22 + }, + "end": { + "line": 42, + "column": 27 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" }, - "identifierName": "RED" - }, - "name": "RED" - }, - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 1219, - "end": 1368, - "loc": { - "start": { - "line": 40, - "column": 23 + "leadingComments": null }, - "end": { - "line": 46, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1223, - "end": 1245, + "operator": "&&", + "right": { + "type": "LogicalExpression", + "start": 1324, + "end": 1366, "loc": { "start": { - "line": 41, - "column": 2 + "line": 43, + "column": 3 }, "end": { - "line": 41, - "column": 24 + "line": 43, + "column": 45 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1223, - "end": 1244, + "left": { + "type": "BinaryExpression", + "start": 1324, + "end": 1339, "loc": { "start": { - "line": 41, - "column": 2 + "line": 43, + "column": 3 }, "end": { - "line": 41, - "column": 23 + "line": 43, + "column": 18 } }, - "operator": "=", "left": { "type": "MemberExpression", - "start": 1223, - "end": 1238, + "start": 1324, + "end": 1330, "loc": { "start": { - "line": 41, - "column": 2 + "line": 43, + "column": 3 }, "end": { - "line": 41, - "column": 17 + "line": 43, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1324, + "end": 1325, + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 4 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1326, + "end": 1330, + "loc": { + "start": { + "line": 43, + "column": 5 + }, + "end": { + "line": 43, + "column": 9 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 1335, + "end": 1339, + "loc": { + "start": { + "line": 43, + "column": 14 + }, + "end": { + "line": 43, + "column": 18 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 1343, + "end": 1366, + "loc": { + "start": { + "line": 43, + "column": 22 + }, + "end": { + "line": 43, + "column": 45 + } + }, + "left": { + "type": "MemberExpression", + "start": 1343, + "end": 1356, + "loc": { + "start": { + "line": 43, + "column": 22 + }, + "end": { + "line": 43, + "column": 35 } }, "object": { "type": "MemberExpression", - "start": 1223, - "end": 1231, + "start": 1343, + "end": 1349, "loc": { "start": { - "line": 41, - "column": 2 + "line": 43, + "column": 22 }, "end": { - "line": 41, - "column": 10 + "line": 43, + "column": 28 } }, "object": { "type": "Identifier", - "start": 1223, - "end": 1224, + "start": 1343, + "end": 1344, "loc": { "start": { - "line": 41, - "column": 2 + "line": 43, + "column": 22 }, "end": { - "line": 41, - "column": 3 + "line": 43, + "column": 23 }, - "identifierName": "n" + "identifierName": "s" }, - "name": "n" + "name": "s" }, "property": { "type": "Identifier", - "start": 1225, - "end": 1231, + "start": 1345, + "end": 1349, "loc": { "start": { - "line": 41, - "column": 4 + "line": 43, + "column": 24 }, "end": { - "line": 41, - "column": 10 + "line": 43, + "column": 28 }, - "identifierName": "parent" + "identifierName": "left" }, - "name": "parent" + "name": "left" }, "computed": false }, "property": { "type": "Identifier", - "start": 1232, - "end": 1238, + "start": 1350, + "end": 1356, "loc": { "start": { - "line": 41, - "column": 11 + "line": 43, + "column": 29 }, "end": { - "line": 41, - "column": 17 + "line": 43, + "column": 35 }, "identifierName": "_color" }, @@ -3196,514 +3523,460 @@ }, "computed": false }, + "operator": "===", "right": { "type": "Identifier", - "start": 1241, - "end": 1244, + "start": 1361, + "end": 1366, "loc": { "start": { - "line": 41, - "column": 20 + "line": 43, + "column": 40 }, "end": { - "line": 41, - "column": 23 + "line": 43, + "column": 45 }, - "identifierName": "RED" + "identifierName": "BLACK" }, - "name": "RED" + "name": "BLACK" } + }, + "extra": { + "parenthesized": true, + "parenStart": 1323 } }, - { - "type": "ExpressionStatement", - "start": 1248, - "end": 1265, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "LogicalExpression", + "start": 1374, + "end": 1418, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 47 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1374, + "end": 1390, "loc": { "start": { - "line": 42, - "column": 2 + "line": 44, + "column": 3 }, "end": { - "line": 42, + "line": 44, "column": 19 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1248, - "end": 1264, + "left": { + "type": "MemberExpression", + "start": 1374, + "end": 1381, "loc": { "start": { - "line": 42, - "column": 2 + "line": 44, + "column": 3 }, "end": { - "line": 42, - "column": 18 + "line": 44, + "column": 10 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1248, - "end": 1256, + "object": { + "type": "Identifier", + "start": 1374, + "end": 1375, "loc": { "start": { - "line": 42, - "column": 2 + "line": 44, + "column": 3 }, "end": { - "line": 42, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1248, - "end": 1249, - "loc": { - "start": { - "line": 42, - "column": 2 - }, - "end": { - "line": 42, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1250, - "end": 1256, - "loc": { - "start": { - "line": 42, - "column": 4 - }, - "end": { - "line": 42, - "column": 10 - }, - "identifierName": "_color" + "line": 44, + "column": 4 }, - "name": "_color" + "identifierName": "s" }, - "computed": false + "name": "s" }, - "right": { + "property": { "type": "Identifier", - "start": 1259, - "end": 1264, + "start": 1376, + "end": 1381, "loc": { "start": { - "line": 42, - "column": 13 + "line": 44, + "column": 5 }, "end": { - "line": 42, - "column": 18 + "line": 44, + "column": 10 }, - "identifierName": "BLACK" + "identifierName": "right" }, - "name": "BLACK" + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 1386, + "end": 1390, + "loc": { + "start": { + "line": 44, + "column": 15 + }, + "end": { + "line": 44, + "column": 19 + } } } }, - { - "type": "IfStatement", - "start": 1268, - "end": 1346, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 1394, + "end": 1418, "loc": { "start": { - "line": 43, - "column": 2 + "line": 44, + "column": 23 }, "end": { "line": 44, - "column": 30 + "column": 47 } }, - "test": { - "type": "BinaryExpression", - "start": 1272, - "end": 1291, + "left": { + "type": "MemberExpression", + "start": 1394, + "end": 1408, "loc": { "start": { - "line": 43, - "column": 6 + "line": 44, + "column": 23 }, "end": { - "line": 43, - "column": 25 + "line": 44, + "column": 37 } }, - "left": { - "type": "Identifier", - "start": 1272, - "end": 1273, - "loc": { - "start": { - "line": 43, - "column": 6 - }, - "end": { - "line": 43, - "column": 7 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { + "object": { "type": "MemberExpression", - "start": 1278, - "end": 1291, + "start": 1394, + "end": 1401, "loc": { "start": { - "line": 43, - "column": 12 + "line": 44, + "column": 23 }, "end": { - "line": 43, - "column": 25 + "line": 44, + "column": 30 } }, "object": { - "type": "MemberExpression", - "start": 1278, - "end": 1286, + "type": "Identifier", + "start": 1394, + "end": 1395, "loc": { "start": { - "line": 43, - "column": 12 + "line": 44, + "column": 23 }, "end": { - "line": 43, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 1278, - "end": 1279, - "loc": { - "start": { - "line": 43, - "column": 12 - }, - "end": { - "line": 43, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1280, - "end": 1286, - "loc": { - "start": { - "line": 43, - "column": 14 - }, - "end": { - "line": 43, - "column": 20 - }, - "identifierName": "parent" + "line": 44, + "column": 24 }, - "name": "parent" + "identifierName": "s" }, - "computed": false + "name": "s" }, "property": { "type": "Identifier", - "start": 1287, - "end": 1291, + "start": 1396, + "end": 1401, "loc": { "start": { - "line": 43, - "column": 21 + "line": 44, + "column": 25 }, "end": { - "line": 43, - "column": 25 + "line": 44, + "column": 30 }, - "identifierName": "left" + "identifierName": "right" }, - "name": "left" + "name": "right" }, "computed": false + }, + "property": { + "type": "Identifier", + "start": 1402, + "end": 1408, + "loc": { + "start": { + "line": 44, + "column": 31 + }, + "end": { + "line": 44, + "column": 37 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1413, + "end": 1418, + "loc": { + "start": { + "line": 44, + "column": 42 + }, + "end": { + "line": 44, + "column": 47 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "extra": { + "parenthesized": true, + "parenStart": 1373 + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1423, + "end": 1471, + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 48, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1427, + "end": 1442, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 17 } }, - "consequent": { - "type": "ExpressionStatement", - "start": 1293, - "end": 1315, + "expression": { + "type": "AssignmentExpression", + "start": 1427, + "end": 1441, "loc": { "start": { - "line": 43, - "column": 27 + "line": 46, + "column": 2 }, "end": { - "line": 43, - "column": 49 + "line": 46, + "column": 16 } }, - "expression": { - "type": "CallExpression", - "start": 1293, - "end": 1314, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1427, + "end": 1435, "loc": { "start": { - "line": 43, - "column": 27 + "line": 46, + "column": 2 }, "end": { - "line": 43, - "column": 48 + "line": 46, + "column": 10 } }, - "callee": { + "object": { "type": "Identifier", - "start": 1293, - "end": 1304, + "start": 1427, + "end": 1428, "loc": { "start": { - "line": 43, - "column": 27 + "line": 46, + "column": 2 }, "end": { - "line": 43, - "column": 38 + "line": 46, + "column": 3 }, - "identifierName": "rotate_left" + "identifierName": "s" }, - "name": "rotate_left" + "name": "s" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1305, - "end": 1313, - "loc": { - "start": { - "line": 43, - "column": 39 - }, - "end": { - "line": 43, - "column": 47 - } - }, - "object": { - "type": "Identifier", - "start": 1305, - "end": 1306, - "loc": { - "start": { - "line": 43, - "column": 39 - }, - "end": { - "line": 43, - "column": 40 - }, - "identifierName": "n" - }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1429, + "end": 1435, + "loc": { + "start": { + "line": 46, + "column": 4 }, - "property": { - "type": "Identifier", - "start": 1307, - "end": 1313, - "loc": { - "start": { - "line": 43, - "column": 41 - }, - "end": { - "line": 43, - "column": 47 - }, - "identifierName": "parent" - }, - "name": "parent" + "end": { + "line": 46, + "column": 10 }, - "computed": false - } - ] - } - }, - "alternate": { - "type": "ExpressionStatement", - "start": 1323, - "end": 1346, - "loc": { - "start": { - "line": 44, - "column": 7 + "identifierName": "_color" + }, + "name": "_color" }, - "end": { - "line": 44, - "column": 30 - } + "computed": false }, - "expression": { - "type": "CallExpression", - "start": 1323, - "end": 1345, + "right": { + "type": "Identifier", + "start": 1438, + "end": 1441, "loc": { "start": { - "line": 44, - "column": 7 + "line": 46, + "column": 13 }, "end": { - "line": 44, - "column": 29 - } - }, - "callee": { - "type": "Identifier", - "start": 1323, - "end": 1335, - "loc": { - "start": { - "line": 44, - "column": 7 - }, - "end": { - "line": 44, - "column": 19 - }, - "identifierName": "rotate_right" + "line": 46, + "column": 16 }, - "name": "rotate_right" + "identifierName": "RED" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1336, - "end": 1344, - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 28 - } - }, - "object": { - "type": "Identifier", - "start": 1336, - "end": 1337, - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 21 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1338, - "end": 1344, - "loc": { - "start": { - "line": 44, - "column": 22 - }, - "end": { - "line": 44, - "column": 28 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] + "name": "RED" } } }, { "type": "ExpressionStatement", - "start": 1349, - "end": 1365, + "start": 1445, + "end": 1468, "loc": { "start": { - "line": 45, + "line": 47, "column": 2 }, "end": { - "line": 45, - "column": 18 + "line": 47, + "column": 25 } }, "expression": { "type": "CallExpression", - "start": 1349, - "end": 1364, + "start": 1445, + "end": 1467, "loc": { "start": { - "line": 45, + "line": 47, "column": 2 }, "end": { - "line": 45, - "column": 17 + "line": 47, + "column": 24 } }, "callee": { "type": "Identifier", - "start": 1349, - "end": 1361, + "start": 1445, + "end": 1457, "loc": { "start": { - "line": 45, + "line": 47, "column": 2 }, "end": { - "line": 45, + "line": 47, "column": 14 }, - "identifierName": "delete_case4" + "identifierName": "delete_case0" }, - "name": "delete_case4" + "name": "delete_case0" }, "arguments": [ { - "type": "Identifier", - "start": 1362, - "end": 1363, + "type": "MemberExpression", + "start": 1458, + "end": 1466, "loc": { "start": { - "line": 45, + "line": 47, "column": 15 }, "end": { - "line": 45, - "column": 16 + "line": 47, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 1458, + "end": 1459, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1460, + "end": 1466, + "loc": { + "start": { + "line": 47, + "column": 17 + }, + "end": { + "line": 47, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } ] } @@ -3714,15 +3987,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1371, - "end": 1398, + "start": 1474, + "end": 1501, "loc": { "start": { - "line": 48, + "line": 50, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 28 } } @@ -3731,43 +4004,43 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 1405, - "end": 1421, + "start": 1508, + "end": 1524, "loc": { "start": { - "line": 49, + "line": 51, "column": 6 }, "end": { - "line": 49, + "line": 51, "column": 22 } }, "expression": { "type": "CallExpression", - "start": 1405, - "end": 1420, + "start": 1508, + "end": 1523, "loc": { "start": { - "line": 49, + "line": 51, "column": 6 }, "end": { - "line": 49, + "line": 51, "column": 21 } }, "callee": { "type": "Identifier", - "start": 1405, - "end": 1417, + "start": 1508, + "end": 1520, "loc": { "start": { - "line": 49, + "line": 51, "column": 6 }, "end": { - "line": 49, + "line": 51, "column": 18 }, "identifierName": "delete_case3" @@ -3778,15 +4051,15 @@ "arguments": [ { "type": "Identifier", - "start": 1418, - "end": 1419, + "start": 1521, + "end": 1522, "loc": { "start": { - "line": 49, + "line": 51, "column": 19 }, "end": { - "line": 49, + "line": 51, "column": 20 }, "identifierName": "n" @@ -3800,15 +4073,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1371, - "end": 1398, + "start": 1474, + "end": 1501, "loc": { "start": { - "line": 48, + "line": 50, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 28 } } @@ -3818,16 +4091,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 827, - "end": 1195, + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 742, + "end": 1283, "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 39, + "line": 40, "column": 4 } } @@ -3845,16 +4118,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 421, - "end": 664, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "start": 278, + "end": 544, "loc": { "start": { - "line": 13, + "line": 10, "column": 0 }, "end": { - "line": 21, + "line": 19, "column": 3 } } @@ -3869,32 +4142,32 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 421, - "end": 664, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "start": 278, + "end": 544, "loc": { "start": { - "line": 13, + "line": 10, "column": 0 }, "end": { - "line": 21, + "line": 19, "column": 3 } } }, { "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 827, - "end": 1195, + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 742, + "end": 1283, "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 39, + "line": 40, "column": 4 } } @@ -3902,15 +4175,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1371, - "end": 1398, + "start": 1474, + "end": 1501, "loc": { "start": { - "line": 48, + "line": 50, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 28 } } @@ -4489,9 +4762,9 @@ "postfix": false, "binop": null }, - "value": "Leaf", + "value": "sibling", "start": 147, - "end": 151, + "end": 154, "loc": { "start": { "line": 5, @@ -4499,7 +4772,7 @@ }, "end": { "line": 5, - "column": 11 + "column": 14 } } }, @@ -4516,16 +4789,16 @@ "binop": null }, "value": "from", - "start": 152, - "end": 156, + "start": 155, + "end": 159, "loc": { "start": { "line": 5, - "column": 12 + "column": 15 }, "end": { "line": 5, - "column": 16 + "column": 19 } } }, @@ -4542,17 +4815,17 @@ "binop": null, "updateContext": null }, - "value": "../types/Leaf.js", - "start": 157, - "end": 175, + "value": "../family/sibling.js", + "start": 160, + "end": 182, "loc": { "start": { "line": 5, - "column": 17 + "column": 20 }, "end": { "line": 5, - "column": 35 + "column": 42 } } }, @@ -4569,16 +4842,16 @@ "binop": null, "updateContext": null }, - "start": 175, - "end": 176, + "start": 182, + "end": 183, "loc": { "start": { "line": 5, - "column": 35 + "column": 42 }, "end": { "line": 5, - "column": 36 + "column": 43 } } }, @@ -4597,15 +4870,15 @@ "updateContext": null }, "value": "import", - "start": 177, - "end": 183, + "start": 185, + "end": 191, "loc": { "start": { - "line": 6, + "line": 7, "column": 0 }, "end": { - "line": 6, + "line": 7, "column": 6 } } @@ -4622,17 +4895,17 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 184, - "end": 195, + "value": "delete_case0", + "start": 192, + "end": 204, "loc": { "start": { - "line": 6, + "line": 7, "column": 7 }, "end": { - "line": 6, - "column": 18 + "line": 7, + "column": 19 } } }, @@ -4649,16 +4922,16 @@ "binop": null }, "value": "from", - "start": 196, - "end": 200, + "start": 205, + "end": 209, "loc": { "start": { - "line": 6, - "column": 19 + "line": 7, + "column": 20 }, "end": { - "line": 6, - "column": 23 + "line": 7, + "column": 24 } } }, @@ -4675,17 +4948,17 @@ "binop": null, "updateContext": null }, - "value": "../rotate/rotate_left.js", - "start": 201, - "end": 227, + "value": "./delete_case0.js", + "start": 210, + "end": 229, "loc": { "start": { - "line": 6, - "column": 24 + "line": 7, + "column": 25 }, "end": { - "line": 6, - "column": 50 + "line": 7, + "column": 44 } } }, @@ -4702,16 +4975,16 @@ "binop": null, "updateContext": null }, - "start": 227, - "end": 228, + "start": 229, + "end": 230, "loc": { "start": { - "line": 6, - "column": 50 + "line": 7, + "column": 44 }, "end": { - "line": 6, - "column": 51 + "line": 7, + "column": 45 } } }, @@ -4730,15 +5003,15 @@ "updateContext": null }, "value": "import", - "start": 229, - "end": 235, + "start": 231, + "end": 237, "loc": { "start": { - "line": 7, + "line": 8, "column": 0 }, "end": { - "line": 7, + "line": 8, "column": 6 } } @@ -4755,16 +5028,16 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 236, - "end": 248, + "value": "delete_case3", + "start": 238, + "end": 250, "loc": { "start": { - "line": 7, + "line": 8, "column": 7 }, "end": { - "line": 7, + "line": 8, "column": 19 } } @@ -4782,15 +5055,15 @@ "binop": null }, "value": "from", - "start": 249, - "end": 253, + "start": 251, + "end": 255, "loc": { "start": { - "line": 7, + "line": 8, "column": 20 }, "end": { - "line": 7, + "line": 8, "column": 24 } } @@ -4808,17 +5081,17 @@ "binop": null, "updateContext": null }, - "value": "../rotate/rotate_right.js", - "start": 254, - "end": 281, + "value": "./delete_case3.js", + "start": 256, + "end": 275, "loc": { "start": { - "line": 7, + "line": 8, "column": 25 }, "end": { - "line": 7, - "column": 52 + "line": 8, + "column": 44 } } }, @@ -4835,102 +5108,66 @@ "binop": null, "updateContext": null }, - "start": 281, - "end": 282, - "loc": { - "start": { - "line": 7, - "column": 52 - }, - "end": { - "line": 7, - "column": 53 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 283, - "end": 289, + "start": 275, + "end": 276, "loc": { "start": { "line": 8, - "column": 0 + "column": 44 }, "end": { "line": 8, - "column": 6 + "column": 45 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "sibling", - "start": 290, - "end": 297, + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "start": 278, + "end": 544, "loc": { "start": { - "line": 8, - "column": 7 + "line": 10, + "column": 0 }, "end": { - "line": 8, - "column": 14 + "line": 19, + "column": 3 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 298, - "end": 302, + "value": "const", + "start": 545, + "end": 550, "loc": { "start": { - "line": 8, - "column": 15 + "line": 20, + "column": 0 }, "end": { - "line": 8, - "column": 19 + "line": 20, + "column": 5 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4938,74 +5175,71 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/sibling.js", - "start": 303, - "end": 325, + "value": "delete_case2", + "start": 551, + "end": 563, "loc": { "start": { - "line": 8, - "column": 20 + "line": 20, + "column": 6 }, "end": { - "line": 8, - "column": 42 + "line": 20, + "column": 18 } } }, { "type": { - "label": ";", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 325, - "end": 326, + "value": "=", + "start": 564, + "end": 565, "loc": { "start": { - "line": 8, - "column": 42 + "line": 20, + "column": 19 }, "end": { - "line": 8, - "column": 43 + "line": 20, + "column": 20 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 328, - "end": 334, + "start": 566, + "end": 567, "loc": { "start": { - "line": 10, - "column": 0 + "line": 20, + "column": 21 }, "end": { - "line": 10, - "column": 6 + "line": 20, + "column": 22 } } }, @@ -5021,25 +5255,25 @@ "postfix": false, "binop": null }, - "value": "delete_case3", - "start": 335, - "end": 347, + "value": "n", + "start": 567, + "end": 568, "loc": { "start": { - "line": 10, - "column": 7 + "line": 20, + "column": 22 }, "end": { - "line": 10, - "column": 19 + "line": 20, + "column": 23 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5047,25 +5281,24 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 348, - "end": 352, + "start": 568, + "end": 569, "loc": { "start": { - "line": 10, - "column": 20 + "line": 20, + "column": 23 }, "end": { - "line": 10, + "line": 20, "column": 24 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "=>", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5074,50 +5307,47 @@ "binop": null, "updateContext": null }, - "value": "./delete_case3.js", - "start": 353, - "end": 372, + "start": 570, + "end": 572, "loc": { "start": { - "line": 10, + "line": 20, "column": 25 }, "end": { - "line": 10, - "column": 44 + "line": 20, + "column": 27 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 372, - "end": 373, + "start": 573, + "end": 574, "loc": { "start": { - "line": 10, - "column": 44 + "line": 20, + "column": 28 }, "end": { - "line": 10, - "column": 45 + "line": 20, + "column": 29 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5125,27 +5355,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 374, - "end": 380, + "value": "assert", + "start": 576, + "end": 582, "loc": { "start": { - "line": 11, - "column": 0 + "line": 21, + "column": 1 }, "end": { - "line": 11, - "column": 6 + "line": 21, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5154,17 +5383,16 @@ "postfix": false, "binop": null }, - "value": "delete_case4", - "start": 381, - "end": 393, + "start": 582, + "end": 583, "loc": { "start": { - "line": 11, + "line": 21, "column": 7 }, "end": { - "line": 11, - "column": 19 + "line": 21, + "column": 8 } } }, @@ -5180,94 +5408,103 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 394, - "end": 398, + "value": "n", + "start": 583, + "end": 584, "loc": { "start": { - "line": 11, - "column": 20 + "line": 21, + "column": 8 }, "end": { - "line": 11, - "column": 24 + "line": 21, + "column": 9 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "./delete_case4.js", - "start": 399, - "end": 418, + "value": "instanceof", + "start": 585, + "end": 595, "loc": { "start": { - "line": 11, - "column": 25 + "line": 21, + "column": 10 }, "end": { - "line": 11, - "column": 44 + "line": 21, + "column": 20 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 418, - "end": 419, + "value": "Node", + "start": 596, + "end": 600, "loc": { "start": { - "line": 11, - "column": 44 + "line": 21, + "column": 21 }, "end": { - "line": 11, - "column": 45 + "line": 21, + "column": 25 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 421, - "end": 664, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 600, + "end": 601, "loc": { "start": { - "line": 13, - "column": 0 + "line": 21, + "column": 25 }, "end": { "line": 21, - "column": 3 + "column": 26 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5277,17 +5514,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 665, - "end": 670, + "start": 601, + "end": 602, "loc": { "start": { - "line": 22, - "column": 0 + "line": 21, + "column": 26 }, "end": { - "line": 22, - "column": 5 + "line": 21, + "column": 27 } } }, @@ -5303,51 +5539,49 @@ "postfix": false, "binop": null }, - "value": "delete_case2", - "start": 671, - "end": 683, + "value": "assert", + "start": 604, + "end": 610, "loc": { "start": { "line": 22, - "column": 6 + "column": 1 }, "end": { "line": 22, - "column": 18 + "column": 7 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 684, - "end": 685, + "start": 610, + "end": 611, "loc": { "start": { "line": 22, - "column": 19 + "column": 7 }, "end": { "line": 22, - "column": 20 + "column": 8 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5356,50 +5590,51 @@ "postfix": false, "binop": null }, - "start": 686, - "end": 687, + "value": "n", + "start": 611, + "end": 612, "loc": { "start": { "line": 22, - "column": 21 + "column": 8 }, "end": { "line": 22, - "column": 22 + "column": 9 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 687, - "end": 688, + "start": 612, + "end": 613, "loc": { "start": { "line": 22, - "column": 22 + "column": 9 }, "end": { "line": 22, - "column": 23 + "column": 10 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5407,22 +5642,23 @@ "postfix": false, "binop": null }, - "start": 688, - "end": 689, + "value": "_color", + "start": 613, + "end": 619, "loc": { "start": { "line": 22, - "column": 23 + "column": 10 }, "end": { "line": 22, - "column": 24 + "column": 16 } } }, { "type": { - "label": "=>", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5430,26 +5666,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 690, - "end": 692, + "value": "===", + "start": 620, + "end": 623, "loc": { "start": { "line": 22, - "column": 25 + "column": 17 }, "end": { "line": 22, - "column": 27 + "column": 20 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5458,24 +5695,25 @@ "postfix": false, "binop": null }, - "start": 693, - "end": 694, + "value": "BLACK", + "start": 624, + "end": 629, "loc": { "start": { "line": 22, - "column": 28 + "column": 21 }, "end": { "line": 22, - "column": 29 + "column": 26 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5483,42 +5721,42 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 696, - "end": 702, + "start": 629, + "end": 630, "loc": { "start": { - "line": 23, - "column": 1 + "line": 22, + "column": 26 }, "end": { - "line": 23, - "column": 7 + "line": 22, + "column": 27 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 702, - "end": 703, + "start": 630, + "end": 631, "loc": { "start": { - "line": 23, - "column": 7 + "line": 22, + "column": 27 }, "end": { - "line": 23, - "column": 8 + "line": 22, + "column": 28 } } }, @@ -5534,45 +5772,42 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 703, - "end": 704, + "value": "assert", + "start": 633, + "end": 639, "loc": { "start": { "line": 23, - "column": 8 + "column": 1 }, "end": { "line": 23, - "column": 9 + "column": 7 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, - "updateContext": null + "binop": null }, - "value": "instanceof", - "start": 705, - "end": 715, + "start": 639, + "end": 640, "loc": { "start": { "line": 23, - "column": 10 + "column": 7 }, "end": { "line": 23, - "column": 20 + "column": 8 } } }, @@ -5588,44 +5823,43 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 716, - "end": 720, + "value": "n", + "start": 640, + "end": 641, "loc": { "start": { "line": 23, - "column": 21 + "column": 8 }, "end": { "line": 23, - "column": 25 + "column": 9 } } }, { "type": { - "label": "||", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 1, + "binop": null, "updateContext": null }, - "value": "||", - "start": 721, - "end": 723, + "start": 641, + "end": 642, "loc": { "start": { "line": 23, - "column": 26 + "column": 9 }, "end": { "line": 23, - "column": 28 + "column": 10 } } }, @@ -5641,24 +5875,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 724, - "end": 725, + "value": "parent", + "start": 642, + "end": 648, "loc": { "start": { "line": 23, - "column": 29 + "column": 10 }, "end": { "line": 23, - "column": 30 + "column": 16 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5666,26 +5899,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": 6, "updateContext": null }, - "value": "instanceof", - "start": 726, - "end": 736, + "value": "!==", + "start": 649, + "end": 652, "loc": { "start": { "line": 23, - "column": 31 + "column": 17 }, "end": { "line": 23, - "column": 41 + "column": 20 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5693,19 +5927,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Leaf", - "start": 737, - "end": 741, + "value": "null", + "start": 653, + "end": 657, "loc": { "start": { "line": 23, - "column": 42 + "column": 21 }, "end": { "line": 23, - "column": 46 + "column": 25 } } }, @@ -5721,16 +5956,16 @@ "postfix": false, "binop": null }, - "start": 741, - "end": 742, + "start": 657, + "end": 658, "loc": { "start": { "line": 23, - "column": 46 + "column": 25 }, "end": { "line": 23, - "column": 47 + "column": 26 } } }, @@ -5747,34 +5982,36 @@ "binop": null, "updateContext": null }, - "start": 742, - "end": 743, + "start": 658, + "end": 659, "loc": { "start": { "line": 23, - "column": 47 + "column": 26 }, "end": { "line": 23, - "column": 48 + "column": 27 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 745, - "end": 751, + "value": "const", + "start": 661, + "end": 666, "loc": { "start": { "line": 24, @@ -5782,32 +6019,7 @@ }, "end": { "line": 24, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 751, - "end": 752, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 + "column": 6 } } }, @@ -5823,35 +6035,36 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 752, - "end": 753, + "value": "s", + "start": 667, + "end": 668, "loc": { "start": { "line": 24, - "column": 8 + "column": 7 }, "end": { "line": 24, - "column": 9 + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 753, - "end": 754, + "value": "=", + "start": 669, + "end": 670, "loc": { "start": { "line": 24, @@ -5875,44 +6088,42 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 754, - "end": 760, + "value": "sibling", + "start": 671, + "end": 678, "loc": { "start": { "line": 24, - "column": 10 + "column": 11 }, "end": { "line": 24, - "column": 16 + "column": 18 } } }, { "type": { - "label": "==/!=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 761, - "end": 764, + "start": 678, + "end": 679, "loc": { "start": { "line": 24, - "column": 17 + "column": 18 }, "end": { "line": 24, - "column": 20 + "column": 19 } } }, @@ -5928,17 +6139,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 765, - "end": 770, + "value": "n", + "start": 679, + "end": 680, "loc": { "start": { "line": 24, - "column": 21 + "column": 19 }, "end": { "line": 24, - "column": 26 + "column": 20 } } }, @@ -5954,16 +6165,16 @@ "postfix": false, "binop": null }, - "start": 770, - "end": 771, + "start": 680, + "end": 681, "loc": { "start": { "line": 24, - "column": 26 + "column": 20 }, "end": { "line": 24, - "column": 27 + "column": 21 } } }, @@ -5980,16 +6191,16 @@ "binop": null, "updateContext": null }, - "start": 771, - "end": 772, + "start": 681, + "end": 682, "loc": { "start": { "line": 24, - "column": 27 + "column": 21 }, "end": { "line": 24, - "column": 28 + "column": 22 } } }, @@ -6006,8 +6217,8 @@ "binop": null }, "value": "assert", - "start": 774, - "end": 780, + "start": 684, + "end": 690, "loc": { "start": { "line": 25, @@ -6031,8 +6242,8 @@ "postfix": false, "binop": null }, - "start": 780, - "end": 781, + "start": 690, + "end": 691, "loc": { "start": { "line": 25, @@ -6056,9 +6267,9 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 781, - "end": 782, + "value": "s", + "start": 691, + "end": 692, "loc": { "start": { "line": 25, @@ -6072,27 +6283,29 @@ }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 782, - "end": 783, + "value": "instanceof", + "start": 693, + "end": 703, "loc": { "start": { "line": 25, - "column": 9 + "column": 10 }, "end": { "line": 25, - "column": 10 + "column": 20 } } }, @@ -6108,53 +6321,50 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 783, - "end": 789, + "value": "Node", + "start": 704, + "end": 708, "loc": { "start": { "line": 25, - "column": 10 + "column": 21 }, "end": { "line": 25, - "column": 16 + "column": 25 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "!==", - "start": 790, - "end": 793, + "start": 708, + "end": 709, "loc": { "start": { "line": 25, - "column": 17 + "column": 25 }, "end": { "line": 25, - "column": 20 + "column": 26 } } }, { "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6163,25 +6373,24 @@ "binop": null, "updateContext": null }, - "value": "null", - "start": 794, - "end": 798, + "start": 709, + "end": 710, "loc": { "start": { "line": 25, - "column": 21 + "column": 26 }, "end": { "line": 25, - "column": 25 + "column": 27 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6189,70 +6398,42 @@ "postfix": false, "binop": null }, - "start": 798, - "end": 799, - "loc": { - "start": { - "line": 25, - "column": 25 - }, - "end": { - "line": 25, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 799, - "end": 800, + "value": "assert", + "start": 712, + "end": 718, "loc": { "start": { - "line": 25, - "column": 26 + "line": 26, + "column": 1 }, "end": { - "line": 25, - "column": 27 + "line": 26, + "column": 7 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 803, - "end": 808, + "start": 718, + "end": 719, "loc": { "start": { - "line": 27, - "column": 1 + "line": 26, + "column": 7 }, "end": { - "line": 27, - "column": 6 + "line": 26, + "column": 8 } } }, @@ -6269,42 +6450,41 @@ "binop": null }, "value": "s", - "start": 809, - "end": 810, + "start": 719, + "end": 720, "loc": { "start": { - "line": 27, - "column": 7 + "line": 26, + "column": 8 }, "end": { - "line": 27, - "column": 8 + "line": 26, + "column": 9 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 811, - "end": 812, + "start": 720, + "end": 721, "loc": { "start": { - "line": 27, + "line": 26, "column": 9 }, "end": { - "line": 27, + "line": 26, "column": 10 } } @@ -6321,42 +6501,44 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 813, - "end": 820, + "value": "_color", + "start": 721, + "end": 727, "loc": { "start": { - "line": 27, - "column": 11 + "line": 26, + "column": 10 }, "end": { - "line": 27, - "column": 18 + "line": 26, + "column": 16 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 820, - "end": 821, + "value": "===", + "start": 728, + "end": 731, "loc": { "start": { - "line": 27, - "column": 18 + "line": 26, + "column": 17 }, "end": { - "line": 27, - "column": 19 + "line": 26, + "column": 20 } } }, @@ -6372,17 +6554,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 821, - "end": 822, + "value": "BLACK", + "start": 732, + "end": 737, "loc": { "start": { - "line": 27, - "column": 19 + "line": 26, + "column": 21 }, "end": { - "line": 27, - "column": 20 + "line": 26, + "column": 26 } } }, @@ -6398,16 +6580,16 @@ "postfix": false, "binop": null }, - "start": 822, - "end": 823, + "start": 737, + "end": 738, "loc": { "start": { - "line": 27, - "column": 20 + "line": 26, + "column": 26 }, "end": { - "line": 27, - "column": 21 + "line": 26, + "column": 27 } } }, @@ -6424,31 +6606,31 @@ "binop": null, "updateContext": null }, - "start": 823, - "end": 824, + "start": 738, + "end": 739, "loc": { "start": { - "line": 27, - "column": 21 + "line": 26, + "column": 27 }, "end": { - "line": 27, - "column": 22 + "line": 26, + "column": 28 } } }, { "type": "CommentBlock", - "value": "*\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", - "start": 827, - "end": 1195, + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 742, + "end": 1283, "loc": { "start": { - "line": 29, + "line": 28, "column": 1 }, "end": { - "line": 39, + "line": 40, "column": 4 } } @@ -6468,15 +6650,15 @@ "updateContext": null }, "value": "if", - "start": 1197, - "end": 1199, + "start": 1285, + "end": 1287, "loc": { "start": { - "line": 40, + "line": 41, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 3 } } @@ -6493,15 +6675,15 @@ "postfix": false, "binop": null }, - "start": 1200, - "end": 1201, + "start": 1288, + "end": 1289, "loc": { "start": { - "line": 40, + "line": 41, "column": 4 }, "end": { - "line": 40, + "line": 41, "column": 5 } } @@ -6518,17 +6700,17 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1201, - "end": 1202, + "value": "n", + "start": 1292, + "end": 1293, "loc": { "start": { - "line": 40, - "column": 5 + "line": 42, + "column": 2 }, "end": { - "line": 40, - "column": 6 + "line": 42, + "column": 3 } } }, @@ -6545,16 +6727,68 @@ "binop": null, "updateContext": null }, - "start": 1202, - "end": 1203, + "start": 1293, + "end": 1294, "loc": { "start": { - "line": 40, - "column": 6 + "line": 42, + "column": 3 }, "end": { - "line": 40, - "column": 7 + "line": 42, + "column": 4 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1294, + "end": 1300, + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 42, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1300, + "end": 1301, + "loc": { + "start": { + "line": 42, + "column": 10 + }, + "end": { + "line": 42, + "column": 11 } } }, @@ -6571,16 +6805,16 @@ "binop": null }, "value": "_color", - "start": 1203, - "end": 1209, + "start": 1301, + "end": 1307, "loc": { "start": { - "line": 40, - "column": 7 + "line": 42, + "column": 11 }, "end": { - "line": 40, - "column": 13 + "line": 42, + "column": 17 } } }, @@ -6598,16 +6832,16 @@ "updateContext": null }, "value": "===", - "start": 1210, - "end": 1213, + "start": 1308, + "end": 1311, "loc": { "start": { - "line": 40, - "column": 14 + "line": 42, + "column": 18 }, "end": { - "line": 40, - "column": 17 + "line": 42, + "column": 21 } } }, @@ -6623,48 +6857,50 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 1214, - "end": 1217, + "value": "BLACK", + "start": 1312, + "end": 1317, "loc": { "start": { - "line": 40, - "column": 18 + "line": 42, + "column": 22 }, "end": { - "line": 40, - "column": 21 + "line": 42, + "column": 27 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "&&", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 2, + "updateContext": null }, - "start": 1217, - "end": 1218, + "value": "&&", + "start": 1318, + "end": 1320, "loc": { "start": { - "line": 40, - "column": 21 + "line": 42, + "column": 28 }, "end": { - "line": 40, - "column": 22 + "line": 42, + "column": 30 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -6674,16 +6910,16 @@ "postfix": false, "binop": null }, - "start": 1219, - "end": 1220, + "start": 1323, + "end": 1324, "loc": { "start": { - "line": 40, - "column": 23 + "line": 43, + "column": 2 }, "end": { - "line": 40, - "column": 24 + "line": 43, + "column": 3 } } }, @@ -6699,17 +6935,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1223, - "end": 1224, + "value": "s", + "start": 1324, + "end": 1325, "loc": { "start": { - "line": 41, - "column": 2 + "line": 43, + "column": 3 }, "end": { - "line": 41, - "column": 3 + "line": 43, + "column": 4 } } }, @@ -6726,16 +6962,16 @@ "binop": null, "updateContext": null }, - "start": 1224, - "end": 1225, + "start": 1325, + "end": 1326, "loc": { "start": { - "line": 41, - "column": 3 + "line": 43, + "column": 4 }, "end": { - "line": 41, - "column": 4 + "line": 43, + "column": 5 } } }, @@ -6751,49 +6987,51 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1225, - "end": 1231, + "value": "left", + "start": 1326, + "end": 1330, "loc": { "start": { - "line": 41, - "column": 4 + "line": 43, + "column": 5 }, "end": { - "line": 41, - "column": 10 + "line": 43, + "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1231, - "end": 1232, + "value": "===", + "start": 1331, + "end": 1334, "loc": { "start": { - "line": 41, + "line": 43, "column": 10 }, "end": { - "line": 41, - "column": 11 + "line": 43, + "column": 13 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -6801,46 +7039,47 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_color", - "start": 1232, - "end": 1238, + "value": "null", + "start": 1335, + "end": 1339, "loc": { "start": { - "line": 41, - "column": 11 + "line": 43, + "column": 14 }, "end": { - "line": 41, - "column": 17 + "line": 43, + "column": 18 } } }, { "type": { - "label": "=", + "label": "||", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "value": "=", - "start": 1239, - "end": 1240, + "value": "||", + "start": 1340, + "end": 1342, "loc": { "start": { - "line": 41, - "column": 18 + "line": 43, + "column": 19 }, "end": { - "line": 41, - "column": 19 + "line": 43, + "column": 21 } } }, @@ -6856,24 +7095,24 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 1241, - "end": 1244, + "value": "s", + "start": 1343, + "end": 1344, "loc": { "start": { - "line": 41, - "column": 20 + "line": 43, + "column": 22 }, "end": { - "line": 41, + "line": 43, "column": 23 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6883,15 +7122,15 @@ "binop": null, "updateContext": null }, - "start": 1244, - "end": 1245, + "start": 1344, + "end": 1345, "loc": { "start": { - "line": 41, + "line": 43, "column": 23 }, "end": { - "line": 41, + "line": 43, "column": 24 } } @@ -6908,17 +7147,17 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1248, - "end": 1249, + "value": "left", + "start": 1345, + "end": 1349, "loc": { "start": { - "line": 42, - "column": 2 + "line": 43, + "column": 24 }, "end": { - "line": 42, - "column": 3 + "line": 43, + "column": 28 } } }, @@ -6935,16 +7174,16 @@ "binop": null, "updateContext": null }, - "start": 1249, - "end": 1250, + "start": 1349, + "end": 1350, "loc": { "start": { - "line": 42, - "column": 3 + "line": 43, + "column": 28 }, "end": { - "line": 42, - "column": 4 + "line": 43, + "column": 29 } } }, @@ -6961,43 +7200,43 @@ "binop": null }, "value": "_color", - "start": 1250, - "end": 1256, + "start": 1350, + "end": 1356, "loc": { "start": { - "line": 42, - "column": 4 + "line": 43, + "column": 29 }, "end": { - "line": 42, - "column": 10 + "line": 43, + "column": 35 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 1257, - "end": 1258, + "value": "===", + "start": 1357, + "end": 1360, "loc": { "start": { - "line": 42, - "column": 11 + "line": 43, + "column": 36 }, "end": { - "line": 42, - "column": 12 + "line": 43, + "column": 39 } } }, @@ -7014,70 +7253,68 @@ "binop": null }, "value": "BLACK", - "start": 1259, - "end": 1264, + "start": 1361, + "end": 1366, "loc": { "start": { - "line": 42, - "column": 13 + "line": 43, + "column": 40 }, "end": { - "line": 42, - "column": 18 + "line": 43, + "column": 45 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1264, - "end": 1265, + "start": 1366, + "end": 1367, "loc": { "start": { - "line": 42, - "column": 18 + "line": 43, + "column": 45 }, "end": { - "line": 42, - "column": 19 + "line": 43, + "column": 46 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, + "label": "&&", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 2, "updateContext": null }, - "value": "if", - "start": 1268, - "end": 1270, + "value": "&&", + "start": 1368, + "end": 1370, "loc": { "start": { "line": 43, - "column": 2 + "column": 47 }, "end": { "line": 43, - "column": 4 + "column": 49 } } }, @@ -7093,16 +7330,16 @@ "postfix": false, "binop": null }, - "start": 1271, - "end": 1272, + "start": 1373, + "end": 1374, "loc": { "start": { - "line": 43, - "column": 5 + "line": 44, + "column": 2 }, "end": { - "line": 43, - "column": 6 + "line": 44, + "column": 3 } } }, @@ -7118,44 +7355,43 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1272, - "end": 1273, + "value": "s", + "start": 1374, + "end": 1375, "loc": { "start": { - "line": 43, - "column": 6 + "line": 44, + "column": 3 }, "end": { - "line": 43, - "column": 7 + "line": 44, + "column": 4 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1274, - "end": 1277, + "start": 1375, + "end": 1376, "loc": { "start": { - "line": 43, - "column": 8 + "line": 44, + "column": 4 }, "end": { - "line": 43, - "column": 11 + "line": 44, + "column": 5 } } }, @@ -7171,49 +7407,51 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1278, - "end": 1279, + "value": "right", + "start": 1376, + "end": 1381, "loc": { "start": { - "line": 43, - "column": 12 + "line": 44, + "column": 5 }, "end": { - "line": 43, - "column": 13 + "line": 44, + "column": 10 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1279, - "end": 1280, + "value": "===", + "start": 1382, + "end": 1385, "loc": { "start": { - "line": 43, - "column": 13 + "line": 44, + "column": 11 }, "end": { - "line": 43, + "line": 44, "column": 14 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7221,45 +7459,47 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "parent", - "start": 1280, - "end": 1286, + "value": "null", + "start": 1386, + "end": 1390, "loc": { "start": { - "line": 43, - "column": 14 + "line": 44, + "column": 15 }, "end": { - "line": 43, - "column": 20 + "line": 44, + "column": 19 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "||", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "start": 1286, - "end": 1287, + "value": "||", + "start": 1391, + "end": 1393, "loc": { "start": { - "line": 43, + "line": 44, "column": 20 }, "end": { - "line": 43, - "column": 21 + "line": 44, + "column": 22 } } }, @@ -7275,23 +7515,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1287, - "end": 1291, + "value": "s", + "start": 1394, + "end": 1395, "loc": { "start": { - "line": 43, - "column": 21 + "line": 44, + "column": 23 }, "end": { - "line": 43, - "column": 25 + "line": 44, + "column": 24 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7299,18 +7539,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1291, - "end": 1292, + "start": 1395, + "end": 1396, "loc": { "start": { - "line": 43, - "column": 25 + "line": 44, + "column": 24 }, "end": { - "line": 43, - "column": 26 + "line": 44, + "column": 25 } } }, @@ -7326,42 +7567,43 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 1293, - "end": 1304, + "value": "right", + "start": 1396, + "end": 1401, "loc": { "start": { - "line": 43, - "column": 27 + "line": 44, + "column": 25 }, "end": { - "line": 43, - "column": 38 + "line": 44, + "column": 30 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1304, - "end": 1305, + "start": 1401, + "end": 1402, "loc": { "start": { - "line": 43, - "column": 38 + "line": 44, + "column": 30 }, "end": { - "line": 43, - "column": 39 + "line": 44, + "column": 31 } } }, @@ -7377,42 +7619,43 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1305, - "end": 1306, + "value": "_color", + "start": 1402, + "end": 1408, "loc": { "start": { - "line": 43, - "column": 39 + "line": 44, + "column": 31 }, - "end": { - "line": 43, - "column": 40 + "end": { + "line": 44, + "column": 37 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1306, - "end": 1307, + "value": "===", + "start": 1409, + "end": 1412, "loc": { "start": { - "line": 43, - "column": 40 + "line": 44, + "column": 38 }, "end": { - "line": 43, + "line": 44, "column": 41 } } @@ -7429,16 +7672,16 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1307, - "end": 1313, + "value": "BLACK", + "start": 1413, + "end": 1418, "loc": { "start": { - "line": 43, - "column": 41 + "line": 44, + "column": 42 }, "end": { - "line": 43, + "line": 44, "column": 47 } } @@ -7455,70 +7698,66 @@ "postfix": false, "binop": null }, - "start": 1313, - "end": 1314, + "start": 1418, + "end": 1419, "loc": { "start": { - "line": 43, + "line": 44, "column": 47 }, "end": { - "line": 43, + "line": 44, "column": 48 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1314, - "end": 1315, + "start": 1421, + "end": 1422, "loc": { "start": { - "line": 43, - "column": 48 + "line": 45, + "column": 1 }, "end": { - "line": 43, - "column": 49 + "line": 45, + "column": 2 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "else", - "start": 1318, - "end": 1322, + "start": 1423, + "end": 1424, "loc": { "start": { - "line": 44, - "column": 2 + "line": 45, + "column": 3 }, "end": { - "line": 44, - "column": 6 + "line": 45, + "column": 4 } } }, @@ -7534,42 +7773,43 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 1323, - "end": 1335, + "value": "s", + "start": 1427, + "end": 1428, "loc": { "start": { - "line": 44, - "column": 7 + "line": 46, + "column": 2 }, "end": { - "line": 44, - "column": 19 + "line": 46, + "column": 3 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1335, - "end": 1336, + "start": 1428, + "end": 1429, "loc": { "start": { - "line": 44, - "column": 19 + "line": 46, + "column": 3 }, "end": { - "line": 44, - "column": 20 + "line": 46, + "column": 4 } } }, @@ -7585,43 +7825,44 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1336, - "end": 1337, + "value": "_color", + "start": 1429, + "end": 1435, "loc": { "start": { - "line": 44, - "column": 20 + "line": 46, + "column": 4 }, "end": { - "line": 44, - "column": 21 + "line": 46, + "column": 10 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 1337, - "end": 1338, + "value": "=", + "start": 1436, + "end": 1437, "loc": { "start": { - "line": 44, - "column": 21 + "line": 46, + "column": 11 }, "end": { - "line": 44, - "column": 22 + "line": 46, + "column": 12 } } }, @@ -7637,68 +7878,94 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1338, - "end": 1344, + "value": "RED", + "start": 1438, + "end": 1441, "loc": { "start": { - "line": 44, - "column": 22 + "line": 46, + "column": 13 }, "end": { - "line": 44, - "column": 28 + "line": 46, + "column": 16 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1441, + "end": 1442, + "loc": { + "start": { + "line": 46, + "column": 16 + }, + "end": { + "line": 46, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null }, - "start": 1344, - "end": 1345, + "value": "delete_case0", + "start": 1445, + "end": 1457, "loc": { "start": { - "line": 44, - "column": 28 + "line": 47, + "column": 2 }, "end": { - "line": 44, - "column": 29 + "line": 47, + "column": 14 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1345, - "end": 1346, + "start": 1457, + "end": 1458, "loc": { "start": { - "line": 44, - "column": 29 + "line": 47, + "column": 14 }, "end": { - "line": 44, - "column": 30 + "line": 47, + "column": 15 } } }, @@ -7714,42 +7981,43 @@ "postfix": false, "binop": null }, - "value": "delete_case4", - "start": 1349, - "end": 1361, + "value": "n", + "start": 1458, + "end": 1459, "loc": { "start": { - "line": 45, - "column": 2 + "line": 47, + "column": 15 }, "end": { - "line": 45, - "column": 14 + "line": 47, + "column": 16 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1361, - "end": 1362, + "start": 1459, + "end": 1460, "loc": { "start": { - "line": 45, - "column": 14 + "line": 47, + "column": 16 }, "end": { - "line": 45, - "column": 15 + "line": 47, + "column": 17 } } }, @@ -7765,17 +8033,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1362, - "end": 1363, + "value": "parent", + "start": 1460, + "end": 1466, "loc": { "start": { - "line": 45, - "column": 15 + "line": 47, + "column": 17 }, "end": { - "line": 45, - "column": 16 + "line": 47, + "column": 23 } } }, @@ -7791,16 +8059,16 @@ "postfix": false, "binop": null }, - "start": 1363, - "end": 1364, + "start": 1466, + "end": 1467, "loc": { "start": { - "line": 45, - "column": 16 + "line": 47, + "column": 23 }, "end": { - "line": 45, - "column": 17 + "line": 47, + "column": 24 } } }, @@ -7817,16 +8085,16 @@ "binop": null, "updateContext": null }, - "start": 1364, - "end": 1365, + "start": 1467, + "end": 1468, "loc": { "start": { - "line": 45, - "column": 17 + "line": 47, + "column": 24 }, "end": { - "line": 45, - "column": 18 + "line": 47, + "column": 25 } } }, @@ -7842,15 +8110,15 @@ "postfix": false, "binop": null }, - "start": 1367, - "end": 1368, + "start": 1470, + "end": 1471, "loc": { "start": { - "line": 46, + "line": 48, "column": 1 }, "end": { - "line": 46, + "line": 48, "column": 2 } } @@ -7858,15 +8126,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1371, - "end": 1398, + "start": 1474, + "end": 1501, "loc": { "start": { - "line": 48, + "line": 50, "column": 1 }, "end": { - "line": 48, + "line": 50, "column": 28 } } @@ -7886,15 +8154,15 @@ "updateContext": null }, "value": "else", - "start": 1400, - "end": 1404, + "start": 1503, + "end": 1507, "loc": { "start": { - "line": 49, + "line": 51, "column": 1 }, "end": { - "line": 49, + "line": 51, "column": 5 } } @@ -7912,15 +8180,15 @@ "binop": null }, "value": "delete_case3", - "start": 1405, - "end": 1417, + "start": 1508, + "end": 1520, "loc": { "start": { - "line": 49, + "line": 51, "column": 6 }, "end": { - "line": 49, + "line": 51, "column": 18 } } @@ -7937,15 +8205,15 @@ "postfix": false, "binop": null }, - "start": 1417, - "end": 1418, + "start": 1520, + "end": 1521, "loc": { "start": { - "line": 49, + "line": 51, "column": 18 }, "end": { - "line": 49, + "line": 51, "column": 19 } } @@ -7963,15 +8231,15 @@ "binop": null }, "value": "n", - "start": 1418, - "end": 1419, + "start": 1521, + "end": 1522, "loc": { "start": { - "line": 49, + "line": 51, "column": 19 }, "end": { - "line": 49, + "line": 51, "column": 20 } } @@ -7988,15 +8256,15 @@ "postfix": false, "binop": null }, - "start": 1419, - "end": 1420, + "start": 1522, + "end": 1523, "loc": { "start": { - "line": 49, + "line": 51, "column": 20 }, "end": { - "line": 49, + "line": 51, "column": 21 } } @@ -8014,15 +8282,15 @@ "binop": null, "updateContext": null }, - "start": 1420, - "end": 1421, + "start": 1523, + "end": 1524, "loc": { "start": { - "line": 49, + "line": 51, "column": 21 }, "end": { - "line": 49, + "line": 51, "column": 22 } } @@ -8039,15 +8307,15 @@ "postfix": false, "binop": null }, - "start": 1422, - "end": 1423, + "start": 1525, + "end": 1526, "loc": { "start": { - "line": 50, + "line": 52, "column": 0 }, "end": { - "line": 50, + "line": 52, "column": 1 } } @@ -8065,15 +8333,15 @@ "binop": null, "updateContext": null }, - "start": 1423, - "end": 1424, + "start": 1526, + "end": 1527, "loc": { "start": { - "line": 50, + "line": 52, "column": 1 }, "end": { - "line": 50, + "line": 52, "column": 2 } } @@ -8093,15 +8361,15 @@ "updateContext": null }, "value": "export", - "start": 1426, - "end": 1432, + "start": 1529, + "end": 1535, "loc": { "start": { - "line": 52, + "line": 54, "column": 0 }, "end": { - "line": 52, + "line": 54, "column": 6 } } @@ -8121,15 +8389,15 @@ "updateContext": null }, "value": "default", - "start": 1433, - "end": 1440, + "start": 1536, + "end": 1543, "loc": { "start": { - "line": 52, + "line": 54, "column": 7 }, "end": { - "line": 52, + "line": 54, "column": 14 } } @@ -8147,15 +8415,15 @@ "binop": null }, "value": "delete_case2", - "start": 1441, - "end": 1453, + "start": 1544, + "end": 1556, "loc": { "start": { - "line": 52, + "line": 54, "column": 15 }, "end": { - "line": 52, + "line": 54, "column": 27 } } @@ -8173,15 +8441,15 @@ "binop": null, "updateContext": null }, - "start": 1453, - "end": 1454, + "start": 1556, + "end": 1557, "loc": { "start": { - "line": 52, + "line": 54, "column": 27 }, "end": { - "line": 52, + "line": 54, "column": 28 } } @@ -8199,15 +8467,15 @@ "binop": null, "updateContext": null }, - "start": 1455, - "end": 1455, + "start": 1558, + "end": 1558, "loc": { "start": { - "line": 53, + "line": 55, "column": 0 }, "end": { - "line": 53, + "line": 55, "column": 0 } } diff --git a/ast/source/deletion/delete_case4.js.json b/ast/source/deletion/delete_case4.js.json deleted file mode 100644 index 373e269..0000000 --- a/ast/source/deletion/delete_case4.js.json +++ /dev/null @@ -1,9647 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 1840, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 61, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 1840, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 61, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ImportDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "local": { - "type": "Identifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "assert" - }, - "name": "assert" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "extra": { - "rawValue": "assert", - "raw": "'assert'" - }, - "value": "assert" - } - }, - { - "type": "ImportDeclaration", - "start": 29, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "local": { - "type": "Identifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 47, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - }, - "extra": { - "rawValue": "../color/BLACK.js", - "raw": "'../color/BLACK.js'" - }, - "value": "../color/BLACK.js" - } - }, - { - "type": "ImportDeclaration", - "start": 68, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 34 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "local": { - "type": "Identifier", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 84, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "extra": { - "rawValue": "../color/RED.js", - "raw": "'../color/RED.js'" - }, - "value": "../color/RED.js" - } - }, - { - "type": "ImportDeclaration", - "start": 103, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 110, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 110, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 120, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Node.js", - "raw": "'../types/Node.js'" - }, - "value": "../types/Node.js" - } - }, - { - "type": "ImportDeclaration", - "start": 140, - "end": 176, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" - } - }, - { - "type": "ImportDeclaration", - "start": 177, - "end": 220, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 43 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 184, - "end": 191, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 14 - } - }, - "local": { - "type": "Identifier", - "start": 184, - "end": 191, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 14 - }, - "identifierName": "sibling" - }, - "name": "sibling" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 197, - "end": 219, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 42 - } - }, - "extra": { - "rawValue": "../family/sibling.js", - "raw": "'../family/sibling.js'" - }, - "value": "../family/sibling.js" - } - }, - { - "type": "ImportDeclaration", - "start": 222, - "end": 267, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 45 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 229, - "end": 241, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 229, - "end": 241, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - }, - "identifierName": "delete_case5" - }, - "name": "delete_case5" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 247, - "end": 266, - "loc": { - "start": { - "line": 8, - "column": 25 - }, - "end": { - "line": 8, - "column": 44 - } - }, - "extra": { - "rawValue": "./delete_case5.js", - "raw": "'./delete_case5.js'" - }, - "value": "./delete_case5.js" - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 269, - "end": 605, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 20, - "column": 3 - } - } - } - ] - }, - { - "type": "Identifier", - "start": 606, - "end": 1809, - "loc": { - "start": { - "line": 21, - "column": 0 - }, - "end": { - "line": 58, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 612, - "end": 1808, - "loc": { - "start": { - "line": 21, - "column": 6 - }, - "end": { - "line": 58, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 612, - "end": 624, - "loc": { - "start": { - "line": 21, - "column": 6 - }, - "end": { - "line": 21, - "column": 18 - }, - "identifierName": "delete_case4" - }, - "name": "delete_case4", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 627, - "end": 1808, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 58, - "column": 1 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 628, - "end": 629, - "loc": { - "start": { - "line": 21, - "column": 22 - }, - "end": { - "line": 21, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 634, - "end": 1808, - "loc": { - "start": { - "line": 21, - "column": 28 - }, - "end": { - "line": 58, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 637, - "end": 684, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 48 - } - }, - "expression": { - "type": "CallExpression", - "start": 637, - "end": 683, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 47 - } - }, - "callee": { - "type": "Identifier", - "start": 637, - "end": 643, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 644, - "end": 682, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 46 - } - }, - "left": { - "type": "BinaryExpression", - "start": 644, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 644, - "end": 645, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 657, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 665, - "end": 682, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 665, - "end": 666, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 678, - "end": 682, - "loc": { - "start": { - "line": 22, - "column": 42 - }, - "end": { - "line": 22, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 686, - "end": 713, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 686, - "end": 712, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 686, - "end": 692, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 693, - "end": 711, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 693, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 693, - "end": 694, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 695, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 706, - "end": 711, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 715, - "end": 741, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 715, - "end": 740, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 715, - "end": 721, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 722, - "end": 739, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 722, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 722, - "end": 723, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 724, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 16 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 735, - "end": 739, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 25 - } - } - } - } - ] - } - }, - { - "type": "VariableDeclaration", - "start": 743, - "end": 764, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 22 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 749, - "end": 763, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "start": 749, - "end": 750, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 8 - }, - "identifierName": "s" - }, - "name": "s" - }, - "init": { - "type": "CallExpression", - "start": 753, - "end": 763, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 753, - "end": 760, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 18 - }, - "identifierName": "sibling" - }, - "name": "sibling" - }, - "arguments": [ - { - "type": "Identifier", - "start": 761, - "end": 762, - "loc": { - "start": { - "line": 25, - "column": 19 - }, - "end": { - "line": 25, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 766, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 766, - "end": 791, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 766, - "end": 772, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 773, - "end": 790, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 773, - "end": 774, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 786, - "end": 790, - "loc": { - "start": { - "line": 26, - "column": 21 - }, - "end": { - "line": 26, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 794, - "end": 821, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 794, - "end": 820, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 794, - "end": 800, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 801, - "end": 819, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 801, - "end": 809, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 801, - "end": 802, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 803, - "end": 809, - "loc": { - "start": { - "line": 27, - "column": 10 - }, - "end": { - "line": 27, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 814, - "end": 819, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 823, - "end": 912, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 30, - "column": 3 - } - }, - "expression": { - "type": "CallExpression", - "start": 823, - "end": 911, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 30, - "column": 2 - } - }, - "callee": { - "type": "Identifier", - "start": 823, - "end": 829, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 833, - "end": 907, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 76 - } - }, - "left": { - "type": "LogicalExpression", - "start": 833, - "end": 881, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 50 - } - }, - "left": { - "type": "BinaryExpression", - "start": 833, - "end": 856, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 833, - "end": 848, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 833, - "end": 841, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 833, - "end": 834, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 835, - "end": 841, - "loc": { - "start": { - "line": 29, - "column": 4 - }, - "end": { - "line": 29, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 842, - "end": 848, - "loc": { - "start": { - "line": 29, - "column": 11 - }, - "end": { - "line": 29, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 853, - "end": 856, - "loc": { - "start": { - "line": 29, - "column": 22 - }, - "end": { - "line": 29, - "column": 25 - }, - "identifierName": "RED" - }, - "name": "RED" - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 860, - "end": 881, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 50 - } - }, - "left": { - "type": "MemberExpression", - "start": 860, - "end": 873, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 42 - } - }, - "object": { - "type": "MemberExpression", - "start": 860, - "end": 866, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 35 - } - }, - "object": { - "type": "Identifier", - "start": 860, - "end": 861, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 30 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 862, - "end": 866, - "loc": { - "start": { - "line": 29, - "column": 31 - }, - "end": { - "line": 29, - "column": 35 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 867, - "end": 873, - "loc": { - "start": { - "line": 29, - "column": 36 - }, - "end": { - "line": 29, - "column": 42 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 878, - "end": 881, - "loc": { - "start": { - "line": 29, - "column": 47 - }, - "end": { - "line": 29, - "column": 50 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 885, - "end": 907, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 76 - } - }, - "left": { - "type": "MemberExpression", - "start": 885, - "end": 899, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 68 - } - }, - "object": { - "type": "MemberExpression", - "start": 885, - "end": 892, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 61 - } - }, - "object": { - "type": "Identifier", - "start": 885, - "end": 886, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 55 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 887, - "end": 892, - "loc": { - "start": { - "line": 29, - "column": 56 - }, - "end": { - "line": 29, - "column": 61 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 893, - "end": 899, - "loc": { - "start": { - "line": 29, - "column": 62 - }, - "end": { - "line": 29, - "column": 68 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 904, - "end": 907, - "loc": { - "start": { - "line": 29, - "column": 73 - }, - "end": { - "line": 29, - "column": 76 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 915, - "end": 1543, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 45, - "column": 4 - } - } - } - ] - }, - { - "type": "IfStatement", - "start": 1545, - "end": 1806, - "loc": { - "start": { - "line": 46, - "column": 1 - }, - "end": { - "line": 57, - "column": 22 - } - }, - "test": { - "type": "LogicalExpression", - "start": 1618, - "end": 1700, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 50, - "column": 26 - } - }, - "left": { - "type": "LogicalExpression", - "start": 1618, - "end": 1670, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 49, - "column": 25 - } - }, - "left": { - "type": "BinaryExpression", - "start": 1618, - "end": 1641, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 1618, - "end": 1633, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1618, - "end": 1626, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1618, - "end": 1619, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1620, - "end": 1626, - "loc": { - "start": { - "line": 48, - "column": 4 - }, - "end": { - "line": 48, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1627, - "end": 1633, - "loc": { - "start": { - "line": 48, - "column": 11 - }, - "end": { - "line": 48, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1638, - "end": 1641, - "loc": { - "start": { - "line": 48, - "column": 22 - }, - "end": { - "line": 48, - "column": 25 - }, - "identifierName": "RED" - }, - "name": "RED" - }, - "leadingComments": null - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1647, - "end": 1670, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 1647, - "end": 1660, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 15 - } - }, - "object": { - "type": "MemberExpression", - "start": 1647, - "end": 1653, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1647, - "end": 1648, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1649, - "end": 1653, - "loc": { - "start": { - "line": 49, - "column": 4 - }, - "end": { - "line": 49, - "column": 8 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1654, - "end": 1660, - "loc": { - "start": { - "line": 49, - "column": 9 - }, - "end": { - "line": 49, - "column": 15 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1665, - "end": 1670, - "loc": { - "start": { - "line": 49, - "column": 20 - }, - "end": { - "line": 49, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - "leadingComments": null - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1676, - "end": 1700, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 1676, - "end": 1690, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 1676, - "end": 1683, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1676, - "end": 1677, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1678, - "end": 1683, - "loc": { - "start": { - "line": 50, - "column": 4 - }, - "end": { - "line": 50, - "column": 9 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1684, - "end": 1690, - "loc": { - "start": { - "line": 50, - "column": 10 - }, - "end": { - "line": 50, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1695, - "end": 1700, - "loc": { - "start": { - "line": 50, - "column": 21 - }, - "end": { - "line": 50, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " The parent color test is always true when coming from case 2", - "start": 1552, - "end": 1615, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 65 - } - } - } - ] - }, - "consequent": { - "type": "BlockStatement", - "start": 1704, - "end": 1753, - "loc": { - "start": { - "line": 51, - "column": 3 - }, - "end": { - "line": 54, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1708, - "end": 1723, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 17 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1708, - "end": 1722, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 16 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1708, - "end": 1716, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1708, - "end": 1709, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1710, - "end": 1716, - "loc": { - "start": { - "line": 52, - "column": 4 - }, - "end": { - "line": 52, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1719, - "end": 1722, - "loc": { - "start": { - "line": 52, - "column": 13 - }, - "end": { - "line": 52, - "column": 16 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1726, - "end": 1750, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 26 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1726, - "end": 1749, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 25 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1726, - "end": 1741, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1726, - "end": 1734, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1726, - "end": 1727, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1728, - "end": 1734, - "loc": { - "start": { - "line": 53, - "column": 4 - }, - "end": { - "line": 53, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1735, - "end": 1741, - "loc": { - "start": { - "line": 53, - "column": 11 - }, - "end": { - "line": 53, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1744, - "end": 1749, - "loc": { - "start": { - "line": 53, - "column": 20 - }, - "end": { - "line": 53, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1756, - "end": 1783, - "loc": { - "start": { - "line": 56, - "column": 1 - }, - "end": { - "line": 56, - "column": 28 - } - } - } - ] - }, - "alternate": { - "type": "ExpressionStatement", - "start": 1790, - "end": 1806, - "loc": { - "start": { - "line": 57, - "column": 6 - }, - "end": { - "line": 57, - "column": 22 - } - }, - "expression": { - "type": "CallExpression", - "start": 1790, - "end": 1805, - "loc": { - "start": { - "line": 57, - "column": 6 - }, - "end": { - "line": 57, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 1790, - "end": 1802, - "loc": { - "start": { - "line": 57, - "column": 6 - }, - "end": { - "line": 57, - "column": 18 - }, - "identifierName": "delete_case5" - }, - "name": "delete_case5", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1803, - "end": 1804, - "loc": { - "start": { - "line": 57, - "column": 19 - }, - "end": { - "line": 57, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1756, - "end": 1783, - "loc": { - "start": { - "line": 56, - "column": 1 - }, - "end": { - "line": 56, - "column": 28 - } - } - } - ] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 915, - "end": 1543, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 45, - "column": 4 - } - } - } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [], - "name": "_", - "trailingComments": [] - }, - { - "type": "Identifier", - "start": 1811, - "end": 1839, - "loc": { - "start": { - "line": 60, - "column": 0 - }, - "end": { - "line": 60, - "column": 28 - } - }, - "declaration": { - "type": "Identifier", - "start": 1826, - "end": 1838, - "loc": { - "start": { - "line": 60, - "column": 15 - }, - "end": { - "line": 60, - "column": 27 - }, - "identifierName": "delete_case4" - }, - "name": "delete_case4" - }, - "name": "_", - "leadingComments": [], - "trailingComments": [] - }, - { - "type": "ExportDefaultDeclaration", - "start": 1811, - "end": 1839, - "loc": { - "start": { - "line": 60, - "column": 0 - }, - "end": { - "line": 60, - "column": 28 - } - }, - "declaration": { - "type": "VariableDeclaration", - "start": 606, - "end": 1809, - "loc": { - "start": { - "line": 21, - "column": 0 - }, - "end": { - "line": 58, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 612, - "end": 1808, - "loc": { - "start": { - "line": 21, - "column": 6 - }, - "end": { - "line": 58, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 612, - "end": 624, - "loc": { - "start": { - "line": 21, - "column": 6 - }, - "end": { - "line": 21, - "column": 18 - }, - "identifierName": "delete_case4" - }, - "name": "delete_case4", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 627, - "end": 1808, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 58, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 612, - "end": 624, - "loc": { - "start": { - "line": 21, - "column": 6 - }, - "end": { - "line": 21, - "column": 18 - }, - "identifierName": "delete_case4" - }, - "name": "delete_case4", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 628, - "end": 629, - "loc": { - "start": { - "line": 21, - "column": 22 - }, - "end": { - "line": 21, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 634, - "end": 1808, - "loc": { - "start": { - "line": 21, - "column": 28 - }, - "end": { - "line": 58, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 637, - "end": 684, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 48 - } - }, - "expression": { - "type": "CallExpression", - "start": 637, - "end": 683, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 47 - } - }, - "callee": { - "type": "Identifier", - "start": 637, - "end": 643, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 644, - "end": 682, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 46 - } - }, - "left": { - "type": "BinaryExpression", - "start": 644, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 644, - "end": 645, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 657, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 665, - "end": 682, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 665, - "end": 666, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 678, - "end": 682, - "loc": { - "start": { - "line": 22, - "column": 42 - }, - "end": { - "line": 22, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 686, - "end": 713, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 686, - "end": 712, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 686, - "end": 692, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 693, - "end": 711, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 693, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 693, - "end": 694, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 695, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 706, - "end": 711, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 715, - "end": 741, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 715, - "end": 740, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 715, - "end": 721, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 722, - "end": 739, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 722, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 722, - "end": 723, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 724, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 16 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 735, - "end": 739, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 25 - } - } - } - } - ] - } - }, - { - "type": "VariableDeclaration", - "start": 743, - "end": 764, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 22 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 749, - "end": 763, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "start": 749, - "end": 750, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 8 - }, - "identifierName": "s" - }, - "name": "s" - }, - "init": { - "type": "CallExpression", - "start": 753, - "end": 763, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 753, - "end": 760, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 18 - }, - "identifierName": "sibling" - }, - "name": "sibling" - }, - "arguments": [ - { - "type": "Identifier", - "start": 761, - "end": 762, - "loc": { - "start": { - "line": 25, - "column": 19 - }, - "end": { - "line": 25, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 766, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 766, - "end": 791, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 766, - "end": 772, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 773, - "end": 790, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 773, - "end": 774, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 786, - "end": 790, - "loc": { - "start": { - "line": 26, - "column": 21 - }, - "end": { - "line": 26, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 794, - "end": 821, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 794, - "end": 820, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 794, - "end": 800, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 801, - "end": 819, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 801, - "end": 809, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 801, - "end": 802, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 803, - "end": 809, - "loc": { - "start": { - "line": 27, - "column": 10 - }, - "end": { - "line": 27, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 814, - "end": 819, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 823, - "end": 912, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 30, - "column": 3 - } - }, - "expression": { - "type": "CallExpression", - "start": 823, - "end": 911, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 30, - "column": 2 - } - }, - "callee": { - "type": "Identifier", - "start": 823, - "end": 829, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 833, - "end": 907, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 76 - } - }, - "left": { - "type": "LogicalExpression", - "start": 833, - "end": 881, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 50 - } - }, - "left": { - "type": "BinaryExpression", - "start": 833, - "end": 856, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 833, - "end": 848, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 833, - "end": 841, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 833, - "end": 834, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 835, - "end": 841, - "loc": { - "start": { - "line": 29, - "column": 4 - }, - "end": { - "line": 29, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 842, - "end": 848, - "loc": { - "start": { - "line": 29, - "column": 11 - }, - "end": { - "line": 29, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 853, - "end": 856, - "loc": { - "start": { - "line": 29, - "column": 22 - }, - "end": { - "line": 29, - "column": 25 - }, - "identifierName": "RED" - }, - "name": "RED" - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 860, - "end": 881, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 50 - } - }, - "left": { - "type": "MemberExpression", - "start": 860, - "end": 873, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 42 - } - }, - "object": { - "type": "MemberExpression", - "start": 860, - "end": 866, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 35 - } - }, - "object": { - "type": "Identifier", - "start": 860, - "end": 861, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 30 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 862, - "end": 866, - "loc": { - "start": { - "line": 29, - "column": 31 - }, - "end": { - "line": 29, - "column": 35 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 867, - "end": 873, - "loc": { - "start": { - "line": 29, - "column": 36 - }, - "end": { - "line": 29, - "column": 42 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 878, - "end": 881, - "loc": { - "start": { - "line": 29, - "column": 47 - }, - "end": { - "line": 29, - "column": 50 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 885, - "end": 907, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 76 - } - }, - "left": { - "type": "MemberExpression", - "start": 885, - "end": 899, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 68 - } - }, - "object": { - "type": "MemberExpression", - "start": 885, - "end": 892, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 61 - } - }, - "object": { - "type": "Identifier", - "start": 885, - "end": 886, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 55 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 887, - "end": 892, - "loc": { - "start": { - "line": 29, - "column": 56 - }, - "end": { - "line": 29, - "column": 61 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 893, - "end": 899, - "loc": { - "start": { - "line": 29, - "column": 62 - }, - "end": { - "line": 29, - "column": 68 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 904, - "end": 907, - "loc": { - "start": { - "line": 29, - "column": 73 - }, - "end": { - "line": 29, - "column": 76 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 915, - "end": 1543, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 45, - "column": 4 - } - } - } - ] - }, - { - "type": "IfStatement", - "start": 1545, - "end": 1806, - "loc": { - "start": { - "line": 46, - "column": 1 - }, - "end": { - "line": 57, - "column": 22 - } - }, - "test": { - "type": "LogicalExpression", - "start": 1618, - "end": 1700, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 50, - "column": 26 - } - }, - "left": { - "type": "LogicalExpression", - "start": 1618, - "end": 1670, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 49, - "column": 25 - } - }, - "left": { - "type": "BinaryExpression", - "start": 1618, - "end": 1641, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 1618, - "end": 1633, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1618, - "end": 1626, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1618, - "end": 1619, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1620, - "end": 1626, - "loc": { - "start": { - "line": 48, - "column": 4 - }, - "end": { - "line": 48, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1627, - "end": 1633, - "loc": { - "start": { - "line": 48, - "column": 11 - }, - "end": { - "line": 48, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1638, - "end": 1641, - "loc": { - "start": { - "line": 48, - "column": 22 - }, - "end": { - "line": 48, - "column": 25 - }, - "identifierName": "RED" - }, - "name": "RED" - }, - "leadingComments": null - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1647, - "end": 1670, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 1647, - "end": 1660, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 15 - } - }, - "object": { - "type": "MemberExpression", - "start": 1647, - "end": 1653, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1647, - "end": 1648, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1649, - "end": 1653, - "loc": { - "start": { - "line": 49, - "column": 4 - }, - "end": { - "line": 49, - "column": 8 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1654, - "end": 1660, - "loc": { - "start": { - "line": 49, - "column": 9 - }, - "end": { - "line": 49, - "column": 15 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1665, - "end": 1670, - "loc": { - "start": { - "line": 49, - "column": 20 - }, - "end": { - "line": 49, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - "leadingComments": null - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1676, - "end": 1700, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 1676, - "end": 1690, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 1676, - "end": 1683, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1676, - "end": 1677, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1678, - "end": 1683, - "loc": { - "start": { - "line": 50, - "column": 4 - }, - "end": { - "line": 50, - "column": 9 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1684, - "end": 1690, - "loc": { - "start": { - "line": 50, - "column": 10 - }, - "end": { - "line": 50, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1695, - "end": 1700, - "loc": { - "start": { - "line": 50, - "column": 21 - }, - "end": { - "line": 50, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " The parent color test is always true when coming from case 2", - "start": 1552, - "end": 1615, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 65 - } - } - } - ] - }, - "consequent": { - "type": "BlockStatement", - "start": 1704, - "end": 1753, - "loc": { - "start": { - "line": 51, - "column": 3 - }, - "end": { - "line": 54, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1708, - "end": 1723, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 17 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1708, - "end": 1722, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 16 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1708, - "end": 1716, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1708, - "end": 1709, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1710, - "end": 1716, - "loc": { - "start": { - "line": 52, - "column": 4 - }, - "end": { - "line": 52, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1719, - "end": 1722, - "loc": { - "start": { - "line": 52, - "column": 13 - }, - "end": { - "line": 52, - "column": 16 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1726, - "end": 1750, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 26 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1726, - "end": 1749, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 25 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1726, - "end": 1741, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1726, - "end": 1734, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1726, - "end": 1727, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1728, - "end": 1734, - "loc": { - "start": { - "line": 53, - "column": 4 - }, - "end": { - "line": 53, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1735, - "end": 1741, - "loc": { - "start": { - "line": 53, - "column": 11 - }, - "end": { - "line": 53, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1744, - "end": 1749, - "loc": { - "start": { - "line": 53, - "column": 20 - }, - "end": { - "line": 53, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1756, - "end": 1783, - "loc": { - "start": { - "line": 56, - "column": 1 - }, - "end": { - "line": 56, - "column": 28 - } - } - } - ] - }, - "alternate": { - "type": "ExpressionStatement", - "start": 1790, - "end": 1806, - "loc": { - "start": { - "line": 57, - "column": 6 - }, - "end": { - "line": 57, - "column": 22 - } - }, - "expression": { - "type": "CallExpression", - "start": 1790, - "end": 1805, - "loc": { - "start": { - "line": 57, - "column": 6 - }, - "end": { - "line": 57, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 1790, - "end": 1802, - "loc": { - "start": { - "line": 57, - "column": 6 - }, - "end": { - "line": 57, - "column": 18 - }, - "identifierName": "delete_case5" - }, - "name": "delete_case5", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1803, - "end": 1804, - "loc": { - "start": { - "line": 57, - "column": 19 - }, - "end": { - "line": 57, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1756, - "end": 1783, - "loc": { - "start": { - "line": 56, - "column": 1 - }, - "end": { - "line": 56, - "column": 28 - } - } - } - ] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 915, - "end": 1543, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 45, - "column": 4 - } - } - } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 269, - "end": 605, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 20, - "column": 3 - } - } - } - ], - "trailingComments": [] - } - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 269, - "end": 605, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 20, - "column": 3 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 915, - "end": 1543, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 45, - "column": 4 - } - } - }, - { - "type": "CommentLine", - "value": " The parent color test is always true when coming from case 2", - "start": 1552, - "end": 1615, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 65 - } - } - }, - { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1756, - "end": 1783, - "loc": { - "start": { - "line": 56, - "column": 1 - }, - "end": { - "line": 56, - "column": 28 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 42, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/BLACK.js", - "start": 47, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 68, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 79, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/RED.js", - "start": 84, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 101, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 103, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 110, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 115, - "end": 119, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 120, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 138, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 152, - "end": 156, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Leaf.js", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 175, - "end": 176, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 177, - "end": 183, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "sibling", - "start": 184, - "end": 191, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 192, - "end": 196, - "loc": { - "start": { - "line": 6, - "column": 15 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../family/sibling.js", - "start": 197, - "end": 219, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 42 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 219, - "end": 220, - "loc": { - "start": { - "line": 6, - "column": 42 - }, - "end": { - "line": 6, - "column": 43 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 222, - "end": 228, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case5", - "start": 229, - "end": 241, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 242, - "end": 246, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 24 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_case5.js", - "start": 247, - "end": 266, - "loc": { - "start": { - "line": 8, - "column": 25 - }, - "end": { - "line": 8, - "column": 44 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 266, - "end": 267, - "loc": { - "start": { - "line": 8, - "column": 44 - }, - "end": { - "line": 8, - "column": 45 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 269, - "end": 605, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 20, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 606, - "end": 611, - "loc": { - "start": { - "line": 21, - "column": 0 - }, - "end": { - "line": 21, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case4", - "start": 612, - "end": 624, - "loc": { - "start": { - "line": 21, - "column": 6 - }, - "end": { - "line": 21, - "column": 18 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 625, - "end": 626, - "loc": { - "start": { - "line": 21, - "column": 19 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 627, - "end": 628, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 22 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 628, - "end": 629, - "loc": { - "start": { - "line": 21, - "column": 22 - }, - "end": { - "line": 21, - "column": 23 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 629, - "end": 630, - "loc": { - "start": { - "line": 21, - "column": 23 - }, - "end": { - "line": 21, - "column": 24 - } - } - }, - { - "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 631, - "end": 633, - "loc": { - "start": { - "line": 21, - "column": 25 - }, - "end": { - "line": 21, - "column": 27 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 634, - "end": 635, - "loc": { - "start": { - "line": 21, - "column": 28 - }, - "end": { - "line": 21, - "column": 29 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 637, - "end": 643, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 643, - "end": 644, - "loc": { - "start": { - "line": 22, - "column": 7 - }, - "end": { - "line": 22, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 644, - "end": 645, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 646, - "end": 656, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 657, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - { - "type": { - "label": "||", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 1, - "updateContext": null - }, - "value": "||", - "start": 662, - "end": 664, - "loc": { - "start": { - "line": 22, - "column": 26 - }, - "end": { - "line": 22, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 665, - "end": 666, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 30 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 667, - "end": 677, - "loc": { - "start": { - "line": 22, - "column": 31 - }, - "end": { - "line": 22, - "column": 41 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 678, - "end": 682, - "loc": { - "start": { - "line": 22, - "column": 42 - }, - "end": { - "line": 22, - "column": 46 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 682, - "end": 683, - "loc": { - "start": { - "line": 22, - "column": 46 - }, - "end": { - "line": 22, - "column": 47 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 683, - "end": 684, - "loc": { - "start": { - "line": 22, - "column": 47 - }, - "end": { - "line": 22, - "column": 48 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 686, - "end": 692, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 692, - "end": 693, - "loc": { - "start": { - "line": 23, - "column": 7 - }, - "end": { - "line": 23, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 693, - "end": 694, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 694, - "end": 695, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 695, - "end": 701, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 702, - "end": 705, - "loc": { - "start": { - "line": 23, - "column": 17 - }, - "end": { - "line": 23, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 706, - "end": 711, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 26 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 711, - "end": 712, - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 712, - "end": 713, - "loc": { - "start": { - "line": 23, - "column": 27 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 715, - "end": 721, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 721, - "end": 722, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 722, - "end": 723, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 723, - "end": 724, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 724, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "!==", - "start": 731, - "end": 734, - "loc": { - "start": { - "line": 24, - "column": 17 - }, - "end": { - "line": 24, - "column": 20 - } - } - }, - { - "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "null", - "start": 735, - "end": 739, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 739, - "end": 740, - "loc": { - "start": { - "line": 24, - "column": 25 - }, - "end": { - "line": 24, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 740, - "end": 741, - "loc": { - "start": { - "line": 24, - "column": 26 - }, - "end": { - "line": 24, - "column": 27 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 743, - "end": 748, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 749, - "end": 750, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 751, - "end": 752, - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "sibling", - "start": 753, - "end": 760, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 18 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 760, - "end": 761, - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 761, - "end": 762, - "loc": { - "start": { - "line": 25, - "column": 19 - }, - "end": { - "line": 25, - "column": 20 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 762, - "end": 763, - "loc": { - "start": { - "line": 25, - "column": 20 - }, - "end": { - "line": 25, - "column": 21 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 763, - "end": 764, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 22 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 766, - "end": 772, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 772, - "end": 773, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 773, - "end": 774, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 775, - "end": 785, - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 786, - "end": 790, - "loc": { - "start": { - "line": 26, - "column": 21 - }, - "end": { - "line": 26, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 790, - "end": 791, - "loc": { - "start": { - "line": 26, - "column": 25 - }, - "end": { - "line": 26, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 791, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 794, - "end": 800, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 800, - "end": 801, - "loc": { - "start": { - "line": 27, - "column": 7 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 801, - "end": 802, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 802, - "end": 803, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 803, - "end": 809, - "loc": { - "start": { - "line": 27, - "column": 10 - }, - "end": { - "line": 27, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 810, - "end": 813, - "loc": { - "start": { - "line": 27, - "column": 17 - }, - "end": { - "line": 27, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 814, - "end": 819, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 819, - "end": 820, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 820, - "end": 821, - "loc": { - "start": { - "line": 27, - "column": 27 - }, - "end": { - "line": 27, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 823, - "end": 829, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 829, - "end": 830, - "loc": { - "start": { - "line": 28, - "column": 7 - }, - "end": { - "line": 28, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 833, - "end": 834, - "loc": { - "start": { - "line": 29, - "column": 2 - }, - "end": { - "line": 29, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 834, - "end": 835, - "loc": { - "start": { - "line": 29, - "column": 3 - }, - "end": { - "line": 29, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 835, - "end": 841, - "loc": { - "start": { - "line": 29, - "column": 4 - }, - "end": { - "line": 29, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 841, - "end": 842, - "loc": { - "start": { - "line": 29, - "column": 10 - }, - "end": { - "line": 29, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 842, - "end": 848, - "loc": { - "start": { - "line": 29, - "column": 11 - }, - "end": { - "line": 29, - "column": 17 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 849, - "end": 852, - "loc": { - "start": { - "line": 29, - "column": 18 - }, - "end": { - "line": 29, - "column": 21 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 853, - "end": 856, - "loc": { - "start": { - "line": 29, - "column": 22 - }, - "end": { - "line": 29, - "column": 25 - } - } - }, - { - "type": { - "label": "||", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 1, - "updateContext": null - }, - "value": "||", - "start": 857, - "end": 859, - "loc": { - "start": { - "line": 29, - "column": 26 - }, - "end": { - "line": 29, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 860, - "end": 861, - "loc": { - "start": { - "line": 29, - "column": 29 - }, - "end": { - "line": 29, - "column": 30 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 861, - "end": 862, - "loc": { - "start": { - "line": 29, - "column": 30 - }, - "end": { - "line": 29, - "column": 31 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 862, - "end": 866, - "loc": { - "start": { - "line": 29, - "column": 31 - }, - "end": { - "line": 29, - "column": 35 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 866, - "end": 867, - "loc": { - "start": { - "line": 29, - "column": 35 - }, - "end": { - "line": 29, - "column": 36 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 867, - "end": 873, - "loc": { - "start": { - "line": 29, - "column": 36 - }, - "end": { - "line": 29, - "column": 42 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 874, - "end": 877, - "loc": { - "start": { - "line": 29, - "column": 43 - }, - "end": { - "line": 29, - "column": 46 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 878, - "end": 881, - "loc": { - "start": { - "line": 29, - "column": 47 - }, - "end": { - "line": 29, - "column": 50 - } - } - }, - { - "type": { - "label": "||", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 1, - "updateContext": null - }, - "value": "||", - "start": 882, - "end": 884, - "loc": { - "start": { - "line": 29, - "column": 51 - }, - "end": { - "line": 29, - "column": 53 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 885, - "end": 886, - "loc": { - "start": { - "line": 29, - "column": 54 - }, - "end": { - "line": 29, - "column": 55 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 886, - "end": 887, - "loc": { - "start": { - "line": 29, - "column": 55 - }, - "end": { - "line": 29, - "column": 56 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 887, - "end": 892, - "loc": { - "start": { - "line": 29, - "column": 56 - }, - "end": { - "line": 29, - "column": 61 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 892, - "end": 893, - "loc": { - "start": { - "line": 29, - "column": 61 - }, - "end": { - "line": 29, - "column": 62 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 893, - "end": 899, - "loc": { - "start": { - "line": 29, - "column": 62 - }, - "end": { - "line": 29, - "column": 68 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 900, - "end": 903, - "loc": { - "start": { - "line": 29, - "column": 69 - }, - "end": { - "line": 29, - "column": 72 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 904, - "end": 907, - "loc": { - "start": { - "line": 29, - "column": 73 - }, - "end": { - "line": 29, - "column": 76 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 907, - "end": 908, - "loc": { - "start": { - "line": 29, - "column": 76 - }, - "end": { - "line": 29, - "column": 77 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 910, - "end": 911, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 2 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 911, - "end": 912, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 30, - "column": 3 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 915, - "end": 1543, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 45, - "column": 4 - } - } - }, - { - "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "if", - "start": 1545, - "end": 1547, - "loc": { - "start": { - "line": 46, - "column": 1 - }, - "end": { - "line": 46, - "column": 3 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1548, - "end": 1549, - "loc": { - "start": { - "line": 46, - "column": 4 - }, - "end": { - "line": 46, - "column": 5 - } - } - }, - { - "type": "CommentLine", - "value": " The parent color test is always true when coming from case 2", - "start": 1552, - "end": 1615, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 65 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1618, - "end": 1619, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1619, - "end": 1620, - "loc": { - "start": { - "line": 48, - "column": 3 - }, - "end": { - "line": 48, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 1620, - "end": 1626, - "loc": { - "start": { - "line": 48, - "column": 4 - }, - "end": { - "line": 48, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1626, - "end": 1627, - "loc": { - "start": { - "line": 48, - "column": 10 - }, - "end": { - "line": 48, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1627, - "end": 1633, - "loc": { - "start": { - "line": 48, - "column": 11 - }, - "end": { - "line": 48, - "column": 17 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1634, - "end": 1637, - "loc": { - "start": { - "line": 48, - "column": 18 - }, - "end": { - "line": 48, - "column": 21 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 1638, - "end": 1641, - "loc": { - "start": { - "line": 48, - "column": 22 - }, - "end": { - "line": 48, - "column": 25 - } - } - }, - { - "type": { - "label": "&&", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 2, - "updateContext": null - }, - "value": "&&", - "start": 1642, - "end": 1644, - "loc": { - "start": { - "line": 48, - "column": 26 - }, - "end": { - "line": 48, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 1647, - "end": 1648, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1648, - "end": 1649, - "loc": { - "start": { - "line": 49, - "column": 3 - }, - "end": { - "line": 49, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1649, - "end": 1653, - "loc": { - "start": { - "line": 49, - "column": 4 - }, - "end": { - "line": 49, - "column": 8 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1653, - "end": 1654, - "loc": { - "start": { - "line": 49, - "column": 8 - }, - "end": { - "line": 49, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1654, - "end": 1660, - "loc": { - "start": { - "line": 49, - "column": 9 - }, - "end": { - "line": 49, - "column": 15 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1661, - "end": 1664, - "loc": { - "start": { - "line": 49, - "column": 16 - }, - "end": { - "line": 49, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 1665, - "end": 1670, - "loc": { - "start": { - "line": 49, - "column": 20 - }, - "end": { - "line": 49, - "column": 25 - } - } - }, - { - "type": { - "label": "&&", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 2, - "updateContext": null - }, - "value": "&&", - "start": 1671, - "end": 1673, - "loc": { - "start": { - "line": 49, - "column": 26 - }, - "end": { - "line": 49, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 1676, - "end": 1677, - "loc": { - "start": { - "line": 50, - "column": 2 - }, - "end": { - "line": 50, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1677, - "end": 1678, - "loc": { - "start": { - "line": 50, - "column": 3 - }, - "end": { - "line": 50, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 1678, - "end": 1683, - "loc": { - "start": { - "line": 50, - "column": 4 - }, - "end": { - "line": 50, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1683, - "end": 1684, - "loc": { - "start": { - "line": 50, - "column": 9 - }, - "end": { - "line": 50, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1684, - "end": 1690, - "loc": { - "start": { - "line": 50, - "column": 10 - }, - "end": { - "line": 50, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1691, - "end": 1694, - "loc": { - "start": { - "line": 50, - "column": 17 - }, - "end": { - "line": 50, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 1695, - "end": 1700, - "loc": { - "start": { - "line": 50, - "column": 21 - }, - "end": { - "line": 50, - "column": 26 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1702, - "end": 1703, - "loc": { - "start": { - "line": 51, - "column": 1 - }, - "end": { - "line": 51, - "column": 2 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1704, - "end": 1705, - "loc": { - "start": { - "line": 51, - "column": 3 - }, - "end": { - "line": 51, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 1708, - "end": 1709, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1709, - "end": 1710, - "loc": { - "start": { - "line": 52, - "column": 3 - }, - "end": { - "line": 52, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1710, - "end": 1716, - "loc": { - "start": { - "line": 52, - "column": 4 - }, - "end": { - "line": 52, - "column": 10 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1717, - "end": 1718, - "loc": { - "start": { - "line": 52, - "column": 11 - }, - "end": { - "line": 52, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 1719, - "end": 1722, - "loc": { - "start": { - "line": 52, - "column": 13 - }, - "end": { - "line": 52, - "column": 16 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1722, - "end": 1723, - "loc": { - "start": { - "line": 52, - "column": 16 - }, - "end": { - "line": 52, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1726, - "end": 1727, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1727, - "end": 1728, - "loc": { - "start": { - "line": 53, - "column": 3 - }, - "end": { - "line": 53, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 1728, - "end": 1734, - "loc": { - "start": { - "line": 53, - "column": 4 - }, - "end": { - "line": 53, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1734, - "end": 1735, - "loc": { - "start": { - "line": 53, - "column": 10 - }, - "end": { - "line": 53, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1735, - "end": 1741, - "loc": { - "start": { - "line": 53, - "column": 11 - }, - "end": { - "line": 53, - "column": 17 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1742, - "end": 1743, - "loc": { - "start": { - "line": 53, - "column": 18 - }, - "end": { - "line": 53, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 1744, - "end": 1749, - "loc": { - "start": { - "line": 53, - "column": 20 - }, - "end": { - "line": 53, - "column": 25 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1749, - "end": 1750, - "loc": { - "start": { - "line": 53, - "column": 25 - }, - "end": { - "line": 53, - "column": 26 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1752, - "end": 1753, - "loc": { - "start": { - "line": 54, - "column": 1 - }, - "end": { - "line": 54, - "column": 2 - } - } - }, - { - "type": "CommentLine", - "value": " Otherwise, go to case 5.", - "start": 1756, - "end": 1783, - "loc": { - "start": { - "line": 56, - "column": 1 - }, - "end": { - "line": 56, - "column": 28 - } - } - }, - { - "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "else", - "start": 1785, - "end": 1789, - "loc": { - "start": { - "line": 57, - "column": 1 - }, - "end": { - "line": 57, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case5", - "start": 1790, - "end": 1802, - "loc": { - "start": { - "line": 57, - "column": 6 - }, - "end": { - "line": 57, - "column": 18 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1802, - "end": 1803, - "loc": { - "start": { - "line": 57, - "column": 18 - }, - "end": { - "line": 57, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1803, - "end": 1804, - "loc": { - "start": { - "line": 57, - "column": 19 - }, - "end": { - "line": 57, - "column": 20 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1804, - "end": 1805, - "loc": { - "start": { - "line": 57, - "column": 20 - }, - "end": { - "line": 57, - "column": 21 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1805, - "end": 1806, - "loc": { - "start": { - "line": 57, - "column": 21 - }, - "end": { - "line": 57, - "column": 22 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1807, - "end": 1808, - "loc": { - "start": { - "line": 58, - "column": 0 - }, - "end": { - "line": 58, - "column": 1 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1808, - "end": 1809, - "loc": { - "start": { - "line": 58, - "column": 1 - }, - "end": { - "line": 58, - "column": 2 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 1811, - "end": 1817, - "loc": { - "start": { - "line": 60, - "column": 0 - }, - "end": { - "line": 60, - "column": 6 - } - } - }, - { - "type": { - "label": "default", - "keyword": "default", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "default", - "start": 1818, - "end": 1825, - "loc": { - "start": { - "line": 60, - "column": 7 - }, - "end": { - "line": 60, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case4", - "start": 1826, - "end": 1838, - "loc": { - "start": { - "line": 60, - "column": 15 - }, - "end": { - "line": 60, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1838, - "end": 1839, - "loc": { - "start": { - "line": 60, - "column": 27 - }, - "end": { - "line": 60, - "column": 28 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1840, - "end": 1840, - "loc": { - "start": { - "line": 61, - "column": 0 - }, - "end": { - "line": 61, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/deletion/delete_case5.js.json b/ast/source/deletion/delete_case5.js.json index 68f4687..2e9f926 100644 --- a/ast/source/deletion/delete_case5.js.json +++ b/ast/source/deletion/delete_case5.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 2259, + "end": 1898, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 72, + "line": 65, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 2259, + "end": 1898, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 72, + "line": 65, "column": 0 } }, @@ -307,7 +307,7 @@ { "type": "ImportDeclaration", "start": 140, - "end": 176, + "end": 191, "loc": { "start": { "line": 5, @@ -315,14 +315,14 @@ }, "end": { "line": 5, - "column": 36 + "column": 51 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 147, - "end": 151, + "end": 158, "loc": { "start": { "line": 5, @@ -330,13 +330,13 @@ }, "end": { "line": 5, - "column": 11 + "column": 18 } }, "local": { "type": "Identifier", "start": 147, - "end": 151, + "end": 158, "loc": { "start": { "line": 5, @@ -344,75 +344,6 @@ }, "end": { "line": 5, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" - } - }, - { - "type": "ImportDeclaration", - "start": 177, - "end": 228, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 51 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 184, - "end": 195, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "local": { - "type": "Identifier", - "start": 184, - "end": 195, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, "column": 18 }, "identifierName": "rotate_left" @@ -423,15 +354,15 @@ ], "source": { "type": "StringLiteral", - "start": 201, - "end": 227, + "start": 164, + "end": 190, "loc": { "start": { - "line": 6, + "line": 5, "column": 24 }, "end": { - "line": 6, + "line": 5, "column": 50 } }, @@ -444,44 +375,44 @@ }, { "type": "ImportDeclaration", - "start": 229, - "end": 282, + "start": 192, + "end": 245, "loc": { "start": { - "line": 7, + "line": 6, "column": 0 }, "end": { - "line": 7, + "line": 6, "column": 53 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 236, - "end": 248, + "start": 199, + "end": 211, "loc": { "start": { - "line": 7, + "line": 6, "column": 7 }, "end": { - "line": 7, + "line": 6, "column": 19 } }, "local": { "type": "Identifier", - "start": 236, - "end": 248, + "start": 199, + "end": 211, "loc": { "start": { - "line": 7, + "line": 6, "column": 7 }, "end": { - "line": 7, + "line": 6, "column": 19 }, "identifierName": "rotate_right" @@ -492,15 +423,15 @@ ], "source": { "type": "StringLiteral", - "start": 254, - "end": 281, + "start": 217, + "end": 244, "loc": { "start": { - "line": 7, + "line": 6, "column": 25 }, "end": { - "line": 7, + "line": 6, "column": 52 } }, @@ -513,44 +444,44 @@ }, { "type": "ImportDeclaration", - "start": 283, - "end": 326, + "start": 246, + "end": 289, "loc": { "start": { - "line": 8, + "line": 7, "column": 0 }, "end": { - "line": 8, + "line": 7, "column": 43 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 290, - "end": 297, + "start": 253, + "end": 260, "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 14 } }, "local": { "type": "Identifier", - "start": 290, - "end": 297, + "start": 253, + "end": 260, "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 14 }, "identifierName": "sibling" @@ -561,15 +492,15 @@ ], "source": { "type": "StringLiteral", - "start": 303, - "end": 325, + "start": 266, + "end": 288, "loc": { "start": { - "line": 8, + "line": 7, "column": 20 }, "end": { - "line": 8, + "line": 7, "column": 42 } }, @@ -578,89 +509,20 @@ "raw": "'../family/sibling.js'" }, "value": "../family/sibling.js" - } - }, - { - "type": "ImportDeclaration", - "start": 328, - "end": 373, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 10, - "column": 45 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 335, - "end": 347, - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 335, - "end": 347, - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 19 - }, - "identifierName": "delete_case6" - }, - "name": "delete_case6" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 353, - "end": 372, - "loc": { - "start": { - "line": 10, - "column": 25 - }, - "end": { - "line": 10, - "column": 44 - } - }, - "extra": { - "rawValue": "./delete_case6.js", - "raw": "'./delete_case6.js'" - }, - "value": "./delete_case6.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 375, - "end": 699, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "start": 291, + "end": 691, "loc": { "start": { - "line": 12, + "line": 9, "column": 0 }, "end": { - "line": 22, + "line": 20, "column": 3 } } @@ -669,44 +531,44 @@ }, { "type": "Identifier", - "start": 700, - "end": 2228, + "start": 692, + "end": 1867, "loc": { "start": { - "line": 23, + "line": 21, "column": 0 }, "end": { - "line": 69, + "line": 62, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 706, - "end": 2227, + "start": 698, + "end": 1866, "loc": { "start": { - "line": 23, + "line": 21, "column": 6 }, "end": { - "line": 69, + "line": 62, "column": 1 } }, "id": { "type": "Identifier", - "start": 706, - "end": 718, + "start": 698, + "end": 710, "loc": { "start": { - "line": 23, + "line": 21, "column": 6 }, "end": { - "line": 23, + "line": 21, "column": 18 }, "identifierName": "delete_case5" @@ -716,15 +578,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 721, - "end": 2227, + "start": 713, + "end": 1866, "loc": { "start": { - "line": 23, + "line": 21, "column": 21 }, "end": { - "line": 69, + "line": 62, "column": 1 } }, @@ -735,15 +597,15 @@ "params": [ { "type": "Identifier", - "start": 722, - "end": 723, + "start": 714, + "end": 715, "loc": { "start": { - "line": 23, + "line": 21, "column": 22 }, "end": { - "line": 23, + "line": 21, "column": 23 }, "identifierName": "n" @@ -753,58 +615,58 @@ ], "body": { "type": "BlockStatement", - "start": 728, - "end": 2227, + "start": 720, + "end": 1866, "loc": { "start": { - "line": 23, + "line": 21, "column": 28 }, "end": { - "line": 69, + "line": 62, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 731, - "end": 778, + "start": 723, + "end": 749, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, - "column": 48 + "line": 22, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 731, - "end": 777, + "start": 723, + "end": 748, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, - "column": 47 + "line": 22, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 731, - "end": 737, + "start": 723, + "end": 729, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -813,119 +675,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 738, - "end": 776, + "type": "BinaryExpression", + "start": 730, + "end": 747, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, - "column": 46 + "line": 22, + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 738, - "end": 755, + "type": "Identifier", + "start": 730, + "end": 731, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 738, - "end": 739, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - }, - "identifierName": "n" + "line": 22, + "column": 9 }, - "name": "n" + "identifierName": "n" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 751, - "end": 755, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "n" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 759, - "end": 776, + "type": "Identifier", + "start": 743, + "end": 747, "loc": { "start": { - "line": 24, - "column": 29 + "line": 22, + "column": 21 }, "end": { - "line": 24, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 759, - "end": 760, - "loc": { - "start": { - "line": 24, - "column": 29 - }, - "end": { - "line": 24, - "column": 30 - }, - "identifierName": "n" + "line": 22, + "column": 25 }, - "name": "n" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 772, - "end": 776, - "loc": { - "start": { - "line": 24, - "column": 42 - }, - "end": { - "line": 24, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -933,43 +729,43 @@ }, { "type": "ExpressionStatement", - "start": 780, - "end": 807, + "start": 751, + "end": 778, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 780, - "end": 806, + "start": 751, + "end": 777, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 27 } }, "callee": { "type": "Identifier", - "start": 780, - "end": 786, + "start": 751, + "end": 757, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -979,43 +775,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 787, - "end": 805, + "start": 758, + "end": 776, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 787, - "end": 795, + "start": 758, + "end": 766, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 787, - "end": 788, + "start": 758, + "end": 759, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 9 }, "identifierName": "n" @@ -1024,15 +820,15 @@ }, "property": { "type": "Identifier", - "start": 789, - "end": 795, + "start": 760, + "end": 766, "loc": { "start": { - "line": 25, + "line": 23, "column": 10 }, "end": { - "line": 25, + "line": 23, "column": 16 }, "identifierName": "_color" @@ -1044,15 +840,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 800, - "end": 805, + "start": 771, + "end": 776, "loc": { "start": { - "line": 25, + "line": 23, "column": 21 }, "end": { - "line": 25, + "line": 23, "column": 26 }, "identifierName": "BLACK" @@ -1065,43 +861,43 @@ }, { "type": "ExpressionStatement", - "start": 809, - "end": 835, + "start": 780, + "end": 806, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 809, - "end": 834, + "start": 780, + "end": 805, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 26 } }, "callee": { "type": "Identifier", - "start": 809, - "end": 815, + "start": 780, + "end": 786, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -1111,43 +907,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 816, - "end": 833, + "start": 787, + "end": 804, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 816, - "end": 824, + "start": 787, + "end": 795, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 816, - "end": 817, + "start": 787, + "end": 788, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 9 }, "identifierName": "n" @@ -1156,15 +952,15 @@ }, "property": { "type": "Identifier", - "start": 818, - "end": 824, + "start": 789, + "end": 795, "loc": { "start": { - "line": 26, + "line": 24, "column": 10 }, "end": { - "line": 26, + "line": 24, "column": 16 }, "identifierName": "parent" @@ -1176,15 +972,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 829, - "end": 833, + "start": 800, + "end": 804, "loc": { "start": { - "line": 26, + "line": 24, "column": 21 }, "end": { - "line": 26, + "line": 24, "column": 25 } } @@ -1195,44 +991,44 @@ }, { "type": "VariableDeclaration", - "start": 837, - "end": 858, + "start": 808, + "end": 829, "loc": { "start": { - "line": 27, + "line": 25, "column": 1 }, "end": { - "line": 27, + "line": 25, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 843, - "end": 857, + "start": 814, + "end": 828, "loc": { "start": { - "line": 27, + "line": 25, "column": 7 }, "end": { - "line": 27, + "line": 25, "column": 21 } }, "id": { "type": "Identifier", - "start": 843, - "end": 844, + "start": 814, + "end": 815, "loc": { "start": { - "line": 27, + "line": 25, "column": 7 }, "end": { - "line": 27, + "line": 25, "column": 8 }, "identifierName": "s" @@ -1241,29 +1037,29 @@ }, "init": { "type": "CallExpression", - "start": 847, - "end": 857, + "start": 818, + "end": 828, "loc": { "start": { - "line": 27, + "line": 25, "column": 11 }, "end": { - "line": 27, + "line": 25, "column": 21 } }, "callee": { "type": "Identifier", - "start": 847, - "end": 854, + "start": 818, + "end": 825, "loc": { "start": { - "line": 27, + "line": 25, "column": 11 }, "end": { - "line": 27, + "line": 25, "column": 18 }, "identifierName": "sibling" @@ -1273,15 +1069,15 @@ "arguments": [ { "type": "Identifier", - "start": 855, - "end": 856, + "start": 826, + "end": 827, "loc": { "start": { - "line": 27, + "line": 25, "column": 19 }, "end": { - "line": 27, + "line": 25, "column": 20 }, "identifierName": "n" @@ -1296,43 +1092,43 @@ }, { "type": "ExpressionStatement", - "start": 860, - "end": 886, + "start": 831, + "end": 857, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 860, - "end": 885, + "start": 831, + "end": 856, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 26 } }, "callee": { "type": "Identifier", - "start": 860, - "end": 866, + "start": 831, + "end": 837, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -1342,29 +1138,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 867, - "end": 884, + "start": 838, + "end": 855, "loc": { "start": { - "line": 28, + "line": 26, "column": 8 }, "end": { - "line": 28, + "line": 26, "column": 25 } }, "left": { "type": "Identifier", - "start": 867, - "end": 868, + "start": 838, + "end": 839, "loc": { "start": { - "line": 28, + "line": 26, "column": 8 }, "end": { - "line": 28, + "line": 26, "column": 9 }, "identifierName": "s" @@ -1374,15 +1170,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 880, - "end": 884, + "start": 851, + "end": 855, "loc": { "start": { - "line": 28, + "line": 26, "column": 21 }, "end": { - "line": 28, + "line": 26, "column": 25 }, "identifierName": "Node" @@ -1395,43 +1191,43 @@ }, { "type": "ExpressionStatement", - "start": 888, - "end": 915, + "start": 859, + "end": 886, "loc": { "start": { - "line": 29, + "line": 27, "column": 1 }, "end": { - "line": 29, + "line": 27, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 888, - "end": 914, + "start": 859, + "end": 885, "loc": { "start": { - "line": 29, + "line": 27, "column": 1 }, "end": { - "line": 29, + "line": 27, "column": 27 } }, "callee": { "type": "Identifier", - "start": 888, - "end": 894, + "start": 859, + "end": 865, "loc": { "start": { - "line": 29, + "line": 27, "column": 1 }, "end": { - "line": 29, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -1441,43 +1237,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 895, - "end": 913, + "start": 866, + "end": 884, "loc": { "start": { - "line": 29, + "line": 27, "column": 8 }, "end": { - "line": 29, + "line": 27, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 895, - "end": 903, + "start": 866, + "end": 874, "loc": { "start": { - "line": 29, + "line": 27, "column": 8 }, "end": { - "line": 29, + "line": 27, "column": 16 } }, "object": { "type": "Identifier", - "start": 895, - "end": 896, + "start": 866, + "end": 867, "loc": { "start": { - "line": 29, + "line": 27, "column": 8 }, "end": { - "line": 29, + "line": 27, "column": 9 }, "identifierName": "s" @@ -1486,15 +1282,15 @@ }, "property": { "type": "Identifier", - "start": 897, - "end": 903, + "start": 868, + "end": 874, "loc": { "start": { - "line": 29, + "line": 27, "column": 10 }, "end": { - "line": 29, + "line": 27, "column": 16 }, "identifierName": "_color" @@ -1506,15 +1302,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 908, - "end": 913, + "start": 879, + "end": 884, "loc": { "start": { - "line": 29, + "line": 27, "column": 21 }, "end": { - "line": 29, + "line": 27, "column": 26 }, "identifierName": "BLACK" @@ -1523,365 +1319,205 @@ } } ] - } + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 889, + "end": 1576, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + } + ] }, { "type": "ExpressionStatement", - "start": 917, - "end": 973, + "start": 1579, + "end": 1606, "loc": { "start": { - "line": 30, + "line": 47, "column": 1 }, "end": { - "line": 30, - "column": 57 + "line": 47, + "column": 28 } }, "expression": { - "type": "CallExpression", - "start": 917, - "end": 972, + "type": "AssignmentExpression", + "start": 1579, + "end": 1605, "loc": { "start": { - "line": 30, + "line": 47, "column": 1 }, "end": { - "line": 30, - "column": 56 + "line": 47, + "column": 27 } }, - "callee": { - "type": "Identifier", - "start": 917, - "end": 923, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1579, + "end": 1587, "loc": { "start": { - "line": 30, + "line": 47, "column": 1 }, "end": { - "line": 30, - "column": 7 + "line": 47, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1579, + "end": 1580, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 2 + }, + "identifierName": "s" }, - "identifierName": "assert" + "name": "s", + "leadingComments": null }, - "name": "assert" + "property": { + "type": "Identifier", + "start": 1581, + "end": 1587, + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 924, - "end": 971, + "right": { + "type": "MemberExpression", + "start": 1590, + "end": 1605, + "loc": { + "start": { + "line": 47, + "column": 12 + }, + "end": { + "line": 47, + "column": 27 + } + }, + "object": { + "type": "MemberExpression", + "start": 1590, + "end": 1598, "loc": { "start": { - "line": 30, - "column": 8 + "line": 47, + "column": 12 }, "end": { - "line": 30, - "column": 55 + "line": 47, + "column": 20 } }, - "left": { - "type": "BinaryExpression", - "start": 924, - "end": 945, + "object": { + "type": "Identifier", + "start": 1590, + "end": 1591, "loc": { "start": { - "line": 30, - "column": 8 + "line": 47, + "column": 12 }, "end": { - "line": 30, - "column": 29 - } + "line": 47, + "column": 13 + }, + "identifierName": "n" }, - "left": { - "type": "MemberExpression", - "start": 924, - "end": 937, - "loc": { - "start": { - "line": 30, - "column": 8 - }, - "end": { - "line": 30, - "column": 21 - } + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1592, + "end": 1598, + "loc": { + "start": { + "line": 47, + "column": 14 }, - "object": { - "type": "MemberExpression", - "start": 924, - "end": 930, - "loc": { - "start": { - "line": 30, - "column": 8 - }, - "end": { - "line": 30, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 924, - "end": 925, - "loc": { - "start": { - "line": 30, - "column": 8 - }, - "end": { - "line": 30, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 926, - "end": 930, - "loc": { - "start": { - "line": 30, - "column": 10 - }, - "end": { - "line": 30, - "column": 14 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 931, - "end": 937, - "loc": { - "start": { - "line": 30, - "column": 15 - }, - "end": { - "line": 30, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 47, + "column": 20 }, - "computed": false + "identifierName": "parent" }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 942, - "end": 945, - "loc": { - "start": { - "line": 30, - "column": 26 - }, - "end": { - "line": 30, - "column": 29 - }, - "identifierName": "RED" - }, - "name": "RED" - } + "name": "parent" }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 949, - "end": 971, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 55 - } + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1599, + "end": 1605, + "loc": { + "start": { + "line": 47, + "column": 21 }, - "left": { - "type": "MemberExpression", - "start": 949, - "end": 963, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 47 - } - }, - "object": { - "type": "MemberExpression", - "start": 949, - "end": 956, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 40 - } - }, - "object": { - "type": "Identifier", - "start": 949, - "end": 950, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 34 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 951, - "end": 956, - "loc": { - "start": { - "line": 30, - "column": 35 - }, - "end": { - "line": 30, - "column": 40 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 957, - "end": 963, - "loc": { - "start": { - "line": 30, - "column": 41 - }, - "end": { - "line": 30, - "column": 47 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "end": { + "line": 47, + "column": 27 }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 968, - "end": 971, - "loc": { - "start": { - "line": 30, - "column": 52 - }, - "end": { - "line": 30, - "column": 55 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - } - ] - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 976, - "end": 1049, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 1051, - "end": 1122, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 72 - } - } - }, - { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 1124, - "end": 1149, - "loc": { - "start": { - "line": 34, - "column": 1 + "identifierName": "_color" }, - "end": { - "line": 34, - "column": 26 - } - } + "name": "_color" + }, + "computed": false }, + "leadingComments": null + }, + "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 1152, - "end": 1584, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 889, + "end": 1576, "loc": { "start": { - "line": 36, + "line": 29, "column": 1 }, "end": { - "line": 46, + "line": 45, "column": 4 } } @@ -1889,451 +1525,514 @@ ] }, { - "type": "IfStatement", - "start": 1586, - "end": 2206, + "type": "ExpressionStatement", + "start": 1608, + "end": 1632, "loc": { "start": { - "line": 47, + "line": 48, "column": 1 }, "end": { - "line": 66, - "column": 2 + "line": 48, + "column": 25 } }, - "test": { - "type": "LogicalExpression", - "start": 1590, - "end": 1637, + "expression": { + "type": "AssignmentExpression", + "start": 1608, + "end": 1631, "loc": { "start": { - "line": 47, - "column": 5 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 52 + "line": 48, + "column": 24 } }, + "operator": "=", "left": { - "type": "BinaryExpression", - "start": 1590, - "end": 1609, + "type": "MemberExpression", + "start": 1608, + "end": 1623, "loc": { "start": { - "line": 47, - "column": 5 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 16 } }, - "left": { - "type": "Identifier", - "start": 1590, - "end": 1591, - "loc": { - "start": { - "line": 47, - "column": 5 - }, - "end": { - "line": 47, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "operator": "===", - "right": { + "object": { "type": "MemberExpression", - "start": 1596, - "end": 1609, + "start": 1608, + "end": 1616, "loc": { "start": { - "line": 47, - "column": 11 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 9 } }, "object": { - "type": "MemberExpression", - "start": 1596, - "end": 1604, + "type": "Identifier", + "start": 1608, + "end": 1609, "loc": { "start": { - "line": 47, - "column": 11 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 1596, - "end": 1597, - "loc": { - "start": { - "line": 47, - "column": 11 - }, - "end": { - "line": 47, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1598, - "end": 1604, - "loc": { - "start": { - "line": 47, - "column": 13 - }, - "end": { - "line": 47, - "column": 19 - }, - "identifierName": "parent" + "line": 48, + "column": 2 }, - "name": "parent" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1605, - "end": 1609, + "start": 1610, + "end": 1616, "loc": { "start": { - "line": 47, - "column": 20 + "line": 48, + "column": 3 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 9 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false }, - "leadingComments": null + "property": { + "type": "Identifier", + "start": 1617, + "end": 1623, + "loc": { + "start": { + "line": 48, + "column": 10 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "operator": "&&", "right": { - "type": "BinaryExpression", - "start": 1613, - "end": 1637, + "type": "Identifier", + "start": 1626, + "end": 1631, "loc": { "start": { - "line": 47, - "column": 28 + "line": 48, + "column": 19 }, "end": { - "line": 47, - "column": 52 - } - }, - "left": { + "line": 48, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1635, + "end": 1864, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 61, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1639, + "end": 1658, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 1639, + "end": 1640, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1645, + "end": 1658, + "loc": { + "start": { + "line": 50, + "column": 11 + }, + "end": { + "line": 50, + "column": 24 + } + }, + "object": { "type": "MemberExpression", - "start": 1613, - "end": 1627, + "start": 1645, + "end": 1653, "loc": { "start": { - "line": 47, - "column": 28 + "line": 50, + "column": 11 }, "end": { - "line": 47, - "column": 42 + "line": 50, + "column": 19 } }, "object": { - "type": "MemberExpression", - "start": 1613, - "end": 1620, + "type": "Identifier", + "start": 1645, + "end": 1646, "loc": { "start": { - "line": 47, - "column": 28 + "line": 50, + "column": 11 }, "end": { - "line": 47, - "column": 35 - } - }, - "object": { - "type": "Identifier", - "start": 1613, - "end": 1614, - "loc": { - "start": { - "line": 47, - "column": 28 - }, - "end": { - "line": 47, - "column": 29 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1615, - "end": 1620, - "loc": { - "start": { - "line": 47, - "column": 30 - }, - "end": { - "line": 47, - "column": 35 - }, - "identifierName": "right" + "line": 50, + "column": 12 }, - "name": "right" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1621, - "end": 1627, + "start": 1647, + "end": 1653, "loc": { "start": { - "line": 47, - "column": 36 + "line": 50, + "column": 13 }, "end": { - "line": 47, - "column": 42 + "line": 50, + "column": 19 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false }, - "operator": "===", - "right": { + "property": { "type": "Identifier", - "start": 1632, - "end": 1637, + "start": 1654, + "end": 1658, "loc": { "start": { - "line": 47, - "column": 47 + "line": 50, + "column": 20 }, "end": { - "line": 47, - "column": 52 + "line": 50, + "column": 24 }, - "identifierName": "BLACK" + "identifierName": "left" }, - "name": "BLACK" - } - }, - "leadingComments": null + "name": "left" + }, + "computed": false + } }, "consequent": { "type": "BlockStatement", - "start": 1639, - "end": 1705, + "start": 1660, + "end": 1749, "loc": { "start": { - "line": 47, - "column": 54 + "line": 50, + "column": 26 }, "end": { - "line": 51, + "line": 54, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1643, - "end": 1658, + "start": 1664, + "end": 1695, "loc": { "start": { - "line": 48, + "line": 51, "column": 2 }, "end": { - "line": 48, - "column": 17 + "line": 51, + "column": 33 } }, "expression": { - "type": "AssignmentExpression", - "start": 1643, - "end": 1657, + "type": "CallExpression", + "start": 1664, + "end": 1694, "loc": { "start": { - "line": 48, + "line": 51, "column": 2 }, "end": { - "line": 48, - "column": 16 + "line": 51, + "column": 32 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1643, - "end": 1651, + "callee": { + "type": "Identifier", + "start": 1664, + "end": 1670, "loc": { "start": { - "line": 48, + "line": 51, "column": 2 }, "end": { - "line": 48, - "column": 10 - } + "line": 51, + "column": 8 + }, + "identifierName": "assert" }, - "object": { - "type": "Identifier", - "start": 1643, - "end": 1644, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1671, + "end": 1693, "loc": { "start": { - "line": 48, - "column": 2 + "line": 51, + "column": 9 }, "end": { - "line": 48, - "column": 3 - }, - "identifierName": "s" + "line": 51, + "column": 31 + } }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1645, - "end": 1651, - "loc": { - "start": { - "line": 48, - "column": 4 + "left": { + "type": "MemberExpression", + "start": 1671, + "end": 1685, + "loc": { + "start": { + "line": 51, + "column": 9 + }, + "end": { + "line": 51, + "column": 23 + } }, - "end": { - "line": 48, - "column": 10 + "object": { + "type": "MemberExpression", + "start": 1671, + "end": 1678, + "loc": { + "start": { + "line": 51, + "column": 9 + }, + "end": { + "line": 51, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1671, + "end": 1672, + "loc": { + "start": { + "line": 51, + "column": 9 + }, + "end": { + "line": 51, + "column": 10 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1673, + "end": 1678, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1654, - "end": 1657, - "loc": { - "start": { - "line": 48, - "column": 13 - }, - "end": { - "line": 48, - "column": 16 + "property": { + "type": "Identifier", + "start": 1679, + "end": 1685, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "identifierName": "RED" - }, - "name": "RED" - } + "operator": "===", + "right": { + "type": "Identifier", + "start": 1690, + "end": 1693, + "loc": { + "start": { + "line": 51, + "column": 28 + }, + "end": { + "line": 51, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] } }, { "type": "ExpressionStatement", - "start": 1661, - "end": 1683, + "start": 1698, + "end": 1721, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, - "column": 24 + "line": 52, + "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 1661, - "end": 1682, + "start": 1698, + "end": 1720, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, - "column": 23 + "line": 52, + "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1661, - "end": 1674, + "start": 1698, + "end": 1712, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, - "column": 15 + "line": 52, + "column": 16 } }, "object": { "type": "MemberExpression", - "start": 1661, - "end": 1667, + "start": 1698, + "end": 1705, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, - "column": 8 + "line": 52, + "column": 9 } }, "object": { "type": "Identifier", - "start": 1661, - "end": 1662, + "start": 1698, + "end": 1699, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, + "line": 52, "column": 3 }, "identifierName": "s" @@ -2342,35 +2041,35 @@ }, "property": { "type": "Identifier", - "start": 1663, - "end": 1667, + "start": 1700, + "end": 1705, "loc": { "start": { - "line": 49, + "line": 52, "column": 4 }, "end": { - "line": 49, - "column": 8 + "line": 52, + "column": 9 }, - "identifierName": "left" + "identifierName": "right" }, - "name": "left" + "name": "right" }, "computed": false }, "property": { "type": "Identifier", - "start": 1668, - "end": 1674, + "start": 1706, + "end": 1712, "loc": { "start": { - "line": 49, - "column": 9 + "line": 52, + "column": 10 }, "end": { - "line": 49, - "column": 15 + "line": 52, + "column": 16 }, "identifierName": "_color" }, @@ -2380,16 +2079,16 @@ }, "right": { "type": "Identifier", - "start": 1677, - "end": 1682, + "start": 1715, + "end": 1720, "loc": { "start": { - "line": 49, - "column": 18 + "line": 52, + "column": 19 }, "end": { - "line": 49, - "column": 23 + "line": 52, + "column": 24 }, "identifierName": "BLACK" }, @@ -2399,800 +2098,555 @@ }, { "type": "ExpressionStatement", - "start": 1686, - "end": 1702, + "start": 1724, + "end": 1746, "loc": { "start": { - "line": 50, + "line": 53, "column": 2 }, "end": { - "line": 50, - "column": 18 + "line": 53, + "column": 24 } }, "expression": { "type": "CallExpression", - "start": 1686, - "end": 1701, + "start": 1724, + "end": 1745, "loc": { "start": { - "line": 50, + "line": 53, "column": 2 }, "end": { - "line": 50, - "column": 17 + "line": 53, + "column": 23 } }, "callee": { "type": "Identifier", - "start": 1686, - "end": 1698, + "start": 1724, + "end": 1735, "loc": { "start": { - "line": 50, + "line": 53, "column": 2 }, "end": { - "line": 50, - "column": 14 + "line": 53, + "column": 13 }, - "identifierName": "rotate_right" + "identifierName": "rotate_left" }, - "name": "rotate_right" + "name": "rotate_left" }, "arguments": [ { - "type": "Identifier", - "start": 1699, - "end": 1700, + "type": "MemberExpression", + "start": 1736, + "end": 1744, "loc": { "start": { - "line": 50, - "column": 15 + "line": 53, + "column": 14 }, "end": { - "line": 50, - "column": 16 + "line": 53, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 1736, + "end": 1737, + "loc": { + "start": { + "line": 53, + "column": 14 + }, + "end": { + "line": 53, + "column": 15 + }, + "identifierName": "n" }, - "identifierName": "s" + "name": "n" }, - "name": "s" + "property": { + "type": "Identifier", + "start": 1738, + "end": 1744, + "loc": { + "start": { + "line": 53, + "column": 16 + }, + "end": { + "line": 53, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } ] } } ], - "directives": [] + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1752, + "end": 1769, + "loc": { + "start": { + "line": 56, + "column": 1 + }, + "end": { + "line": 56, + "column": 18 + } + } + } + ] }, "alternate": { - "type": "IfStatement", - "start": 1711, - "end": 2206, + "type": "BlockStatement", + "start": 1776, + "end": 1864, "loc": { "start": { - "line": 51, - "column": 8 + "line": 57, + "column": 6 }, "end": { - "line": 66, + "line": 61, "column": 2 } }, - "test": { - "type": "LogicalExpression", - "start": 1715, - "end": 1762, - "loc": { - "start": { - "line": 51, - "column": 12 - }, - "end": { - "line": 51, - "column": 59 - } - }, - "left": { - "type": "BinaryExpression", - "start": 1715, - "end": 1735, + "body": [ + { + "type": "ExpressionStatement", + "start": 1780, + "end": 1810, "loc": { "start": { - "line": 51, - "column": 12 + "line": 58, + "column": 2 }, "end": { - "line": 51, + "line": 58, "column": 32 } }, - "left": { - "type": "Identifier", - "start": 1715, - "end": 1716, + "expression": { + "type": "CallExpression", + "start": 1780, + "end": 1809, "loc": { "start": { - "line": 51, - "column": 12 + "line": 58, + "column": 2 }, "end": { - "line": 51, - "column": 13 + "line": 58, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 1780, + "end": 1786, + "loc": { + "start": { + "line": 58, + "column": 2 + }, + "end": { + "line": 58, + "column": 8 + }, + "identifierName": "assert" }, - "identifierName": "n" + "name": "assert", + "leadingComments": null }, - "name": "n" + "arguments": [ + { + "type": "BinaryExpression", + "start": 1787, + "end": 1808, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 30 + } + }, + "left": { + "type": "MemberExpression", + "start": 1787, + "end": 1800, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 1787, + "end": 1793, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1787, + "end": 1788, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 10 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1789, + "end": 1793, + "loc": { + "start": { + "line": 58, + "column": 11 + }, + "end": { + "line": 58, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1794, + "end": 1800, + "loc": { + "start": { + "line": 58, + "column": 16 + }, + "end": { + "line": 58, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1805, + "end": 1808, + "loc": { + "start": { + "line": 58, + "column": 27 + }, + "end": { + "line": 58, + "column": 30 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ], + "leadingComments": null }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1721, - "end": 1735, + "leadingComments": null + }, + { + "type": "ExpressionStatement", + "start": 1813, + "end": 1835, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1813, + "end": 1834, "loc": { "start": { - "line": 51, - "column": 18 + "line": 59, + "column": 2 }, "end": { - "line": 51, - "column": 32 + "line": 59, + "column": 23 } }, - "object": { + "operator": "=", + "left": { "type": "MemberExpression", - "start": 1721, - "end": 1729, + "start": 1813, + "end": 1826, "loc": { "start": { - "line": 51, - "column": 18 + "line": 59, + "column": 2 }, "end": { - "line": 51, - "column": 26 + "line": 59, + "column": 15 } }, "object": { - "type": "Identifier", - "start": 1721, - "end": 1722, + "type": "MemberExpression", + "start": 1813, + "end": 1819, "loc": { "start": { - "line": 51, - "column": 18 + "line": 59, + "column": 2 }, "end": { - "line": 51, - "column": 19 + "line": 59, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1813, + "end": 1814, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 3 + }, + "identifierName": "s" }, - "identifierName": "n" + "name": "s" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1815, + "end": 1819, + "loc": { + "start": { + "line": 59, + "column": 4 + }, + "end": { + "line": 59, + "column": 8 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 1723, - "end": 1729, + "start": 1820, + "end": 1826, "loc": { "start": { - "line": 51, - "column": 20 + "line": 59, + "column": 9 }, "end": { - "line": 51, - "column": 26 + "line": 59, + "column": 15 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 1730, - "end": 1735, + "start": 1829, + "end": 1834, "loc": { "start": { - "line": 51, - "column": 27 + "line": 59, + "column": 18 }, "end": { - "line": 51, - "column": 32 + "line": 59, + "column": 23 }, - "identifierName": "right" + "identifierName": "BLACK" }, - "name": "right" - }, - "computed": false + "name": "BLACK" + } } }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1739, - "end": 1762, + { + "type": "ExpressionStatement", + "start": 1838, + "end": 1861, "loc": { "start": { - "line": 51, - "column": 36 + "line": 60, + "column": 2 }, "end": { - "line": 51, - "column": 59 + "line": 60, + "column": 25 } }, - "left": { - "type": "MemberExpression", - "start": 1739, - "end": 1752, + "expression": { + "type": "CallExpression", + "start": 1838, + "end": 1860, "loc": { "start": { - "line": 51, - "column": 36 + "line": 60, + "column": 2 }, "end": { - "line": 51, - "column": 49 + "line": 60, + "column": 24 } }, - "object": { - "type": "MemberExpression", - "start": 1739, - "end": 1745, - "loc": { - "start": { - "line": 51, - "column": 36 - }, - "end": { - "line": 51, - "column": 42 - } - }, - "object": { - "type": "Identifier", - "start": 1739, - "end": 1740, - "loc": { - "start": { - "line": 51, - "column": 36 - }, - "end": { - "line": 51, - "column": 37 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1741, - "end": 1745, - "loc": { - "start": { - "line": 51, - "column": 38 - }, - "end": { - "line": 51, - "column": 42 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { + "callee": { "type": "Identifier", - "start": 1746, - "end": 1752, + "start": 1838, + "end": 1850, "loc": { "start": { - "line": 51, - "column": 43 + "line": 60, + "column": 2 }, "end": { - "line": 51, - "column": 49 + "line": 60, + "column": 14 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1757, - "end": 1762, - "loc": { - "start": { - "line": 51, - "column": 54 - }, - "end": { - "line": 51, - "column": 59 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - "consequent": { - "type": "BlockStatement", - "start": 1764, - "end": 2206, - "loc": { - "start": { - "line": 51, - "column": 61 - }, - "end": { - "line": 66, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 2144, - "end": 2159, - "loc": { - "start": { - "line": 63, - "column": 2 + "identifierName": "rotate_right" }, - "end": { - "line": 63, - "column": 17 - } + "name": "rotate_right" }, - "expression": { - "type": "AssignmentExpression", - "start": 2144, - "end": 2158, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 16 - } - }, - "operator": "=", - "left": { + "arguments": [ + { "type": "MemberExpression", - "start": 2144, - "end": 2152, + "start": 1851, + "end": 1859, "loc": { "start": { - "line": 63, - "column": 2 + "line": 60, + "column": 15 }, "end": { - "line": 63, - "column": 10 + "line": 60, + "column": 23 } }, "object": { "type": "Identifier", - "start": 2144, - "end": 2145, + "start": 1851, + "end": 1852, "loc": { "start": { - "line": 63, - "column": 2 + "line": 60, + "column": 15 }, "end": { - "line": 63, - "column": 3 + "line": 60, + "column": 16 }, - "identifierName": "s" + "identifierName": "n" }, - "name": "s", - "leadingComments": null + "name": "n" }, "property": { "type": "Identifier", - "start": 2146, - "end": 2152, + "start": 1853, + "end": 1859, "loc": { "start": { - "line": 63, - "column": 4 + "line": 60, + "column": 17 }, "end": { - "line": 63, - "column": 10 + "line": 60, + "column": 23 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 2155, - "end": 2158, - "loc": { - "start": { - "line": 63, - "column": 13 - }, - "end": { - "line": 63, - "column": 16 + "identifierName": "parent" }, - "identifierName": "RED" + "name": "parent" }, - "name": "RED" - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", - "start": 1768, - "end": 2141, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 62, - "column": 5 - } - } + "computed": false } ] - }, - { - "type": "ExpressionStatement", - "start": 2162, - "end": 2185, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 25 - } + } + } + ], + "directives": [], + "leadingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1752, + "end": 1769, + "loc": { + "start": { + "line": 56, + "column": 1 }, - "expression": { - "type": "AssignmentExpression", - "start": 2162, - "end": 2184, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 24 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 2162, - "end": 2176, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 2162, - "end": 2169, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 2162, - "end": 2163, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 2164, - "end": 2169, - "loc": { - "start": { - "line": 64, - "column": 4 - }, - "end": { - "line": 64, - "column": 9 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 2170, - "end": 2176, - "loc": { - "start": { - "line": 64, - "column": 10 - }, - "end": { - "line": 64, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 2179, - "end": 2184, - "loc": { - "start": { - "line": 64, - "column": 19 - }, - "end": { - "line": 64, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - { - "type": "ExpressionStatement", - "start": 2188, - "end": 2203, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 2188, - "end": 2202, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 2188, - "end": 2199, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 13 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "Identifier", - "start": 2200, - "end": 2201, - "loc": { - "start": { - "line": 65, - "column": 14 - }, - "end": { - "line": 65, - "column": 15 - }, - "identifierName": "s" - }, - "name": "s" - } - ] + "end": { + "line": 56, + "column": 18 } } - ], - "directives": [] - }, - "alternate": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 976, - "end": 1049, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 1051, - "end": 1122, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 72 - } - } - }, - { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 1124, - "end": 1149, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 26 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 1152, - "end": 1584, - "loc": { - "start": { - "line": 36, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 2209, - "end": 2225, - "loc": { - "start": { - "line": 68, - "column": 1 - }, - "end": { - "line": 68, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 2209, - "end": 2224, - "loc": { - "start": { - "line": 68, - "column": 1 - }, - "end": { - "line": 68, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 2209, - "end": 2221, - "loc": { - "start": { - "line": 68, - "column": 1 - }, - "end": { - "line": 68, - "column": 13 - }, - "identifierName": "delete_case6" - }, - "name": "delete_case6" - }, - "arguments": [ - { - "type": "Identifier", - "start": 2222, - "end": 2223, - "loc": { - "start": { - "line": 68, - "column": 14 - }, - "end": { - "line": 68, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" } ] } @@ -3211,29 +2665,29 @@ }, { "type": "Identifier", - "start": 2230, - "end": 2258, + "start": 1869, + "end": 1897, "loc": { "start": { - "line": 71, + "line": 64, "column": 0 }, "end": { - "line": 71, + "line": 64, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 2245, - "end": 2257, + "start": 1884, + "end": 1896, "loc": { "start": { - "line": 71, + "line": 64, "column": 15 }, "end": { - "line": 71, + "line": 64, "column": 27 }, "identifierName": "delete_case5" @@ -3246,58 +2700,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 2230, - "end": 2258, + "start": 1869, + "end": 1897, "loc": { "start": { - "line": 71, + "line": 64, "column": 0 }, "end": { - "line": 71, + "line": 64, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 700, - "end": 2228, + "start": 692, + "end": 1867, "loc": { "start": { - "line": 23, + "line": 21, "column": 0 }, "end": { - "line": 69, + "line": 62, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 706, - "end": 2227, + "start": 698, + "end": 1866, "loc": { "start": { - "line": 23, + "line": 21, "column": 6 }, "end": { - "line": 69, + "line": 62, "column": 1 } }, "id": { "type": "Identifier", - "start": 706, - "end": 718, + "start": 698, + "end": 710, "loc": { "start": { - "line": 23, + "line": 21, "column": 6 }, "end": { - "line": 23, + "line": 21, "column": 18 }, "identifierName": "delete_case5" @@ -3307,29 +2761,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 721, - "end": 2227, + "start": 713, + "end": 1866, "loc": { "start": { - "line": 23, + "line": 21, "column": 21 }, "end": { - "line": 69, + "line": 62, "column": 1 } }, "id": { "type": "Identifier", - "start": 706, - "end": 718, + "start": 698, + "end": 710, "loc": { "start": { - "line": 23, + "line": 21, "column": 6 }, "end": { - "line": 23, + "line": 21, "column": 18 }, "identifierName": "delete_case5" @@ -3343,15 +2797,15 @@ "params": [ { "type": "Identifier", - "start": 722, - "end": 723, + "start": 714, + "end": 715, "loc": { "start": { - "line": 23, + "line": 21, "column": 22 }, "end": { - "line": 23, + "line": 21, "column": 23 }, "identifierName": "n" @@ -3361,58 +2815,58 @@ ], "body": { "type": "BlockStatement", - "start": 728, - "end": 2227, + "start": 720, + "end": 1866, "loc": { "start": { - "line": 23, + "line": 21, "column": 28 }, "end": { - "line": 69, + "line": 62, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 731, - "end": 778, + "start": 723, + "end": 749, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, - "column": 48 + "line": 22, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 731, - "end": 777, + "start": 723, + "end": 748, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, - "column": 47 + "line": 22, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 731, - "end": 737, + "start": 723, + "end": 729, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -3421,119 +2875,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 738, - "end": 776, + "type": "BinaryExpression", + "start": 730, + "end": 747, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, - "column": 46 + "line": 22, + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 738, - "end": 755, + "type": "Identifier", + "start": 730, + "end": 731, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 738, - "end": 739, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - }, - "identifierName": "n" + "line": 22, + "column": 9 }, - "name": "n" + "identifierName": "n" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 751, - "end": 755, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "n" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 759, - "end": 776, + "type": "Identifier", + "start": 743, + "end": 747, "loc": { "start": { - "line": 24, - "column": 29 + "line": 22, + "column": 21 }, "end": { - "line": 24, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 759, - "end": 760, - "loc": { - "start": { - "line": 24, - "column": 29 - }, - "end": { - "line": 24, - "column": 30 - }, - "identifierName": "n" + "line": 22, + "column": 25 }, - "name": "n" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 772, - "end": 776, - "loc": { - "start": { - "line": 24, - "column": 42 - }, - "end": { - "line": 24, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -3541,43 +2929,43 @@ }, { "type": "ExpressionStatement", - "start": 780, - "end": 807, + "start": 751, + "end": 778, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 780, - "end": 806, + "start": 751, + "end": 777, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 27 } }, "callee": { "type": "Identifier", - "start": 780, - "end": 786, + "start": 751, + "end": 757, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -3587,43 +2975,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 787, - "end": 805, + "start": 758, + "end": 776, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 787, - "end": 795, + "start": 758, + "end": 766, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 787, - "end": 788, + "start": 758, + "end": 759, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 9 }, "identifierName": "n" @@ -3632,15 +3020,15 @@ }, "property": { "type": "Identifier", - "start": 789, - "end": 795, + "start": 760, + "end": 766, "loc": { "start": { - "line": 25, + "line": 23, "column": 10 }, "end": { - "line": 25, + "line": 23, "column": 16 }, "identifierName": "_color" @@ -3652,15 +3040,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 800, - "end": 805, + "start": 771, + "end": 776, "loc": { "start": { - "line": 25, + "line": 23, "column": 21 }, "end": { - "line": 25, + "line": 23, "column": 26 }, "identifierName": "BLACK" @@ -3673,43 +3061,43 @@ }, { "type": "ExpressionStatement", - "start": 809, - "end": 835, + "start": 780, + "end": 806, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 809, - "end": 834, + "start": 780, + "end": 805, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 26 } }, "callee": { "type": "Identifier", - "start": 809, - "end": 815, + "start": 780, + "end": 786, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -3719,43 +3107,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 816, - "end": 833, + "start": 787, + "end": 804, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 816, - "end": 824, + "start": 787, + "end": 795, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 816, - "end": 817, + "start": 787, + "end": 788, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 9 }, "identifierName": "n" @@ -3764,15 +3152,15 @@ }, "property": { "type": "Identifier", - "start": 818, - "end": 824, + "start": 789, + "end": 795, "loc": { "start": { - "line": 26, + "line": 24, "column": 10 }, "end": { - "line": 26, + "line": 24, "column": 16 }, "identifierName": "parent" @@ -3784,15 +3172,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 829, - "end": 833, + "start": 800, + "end": 804, "loc": { "start": { - "line": 26, + "line": 24, "column": 21 }, "end": { - "line": 26, + "line": 24, "column": 25 } } @@ -3803,44 +3191,44 @@ }, { "type": "VariableDeclaration", - "start": 837, - "end": 858, + "start": 808, + "end": 829, "loc": { "start": { - "line": 27, + "line": 25, "column": 1 }, "end": { - "line": 27, + "line": 25, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 843, - "end": 857, + "start": 814, + "end": 828, "loc": { "start": { - "line": 27, + "line": 25, "column": 7 }, "end": { - "line": 27, + "line": 25, "column": 21 } }, "id": { "type": "Identifier", - "start": 843, - "end": 844, + "start": 814, + "end": 815, "loc": { "start": { - "line": 27, + "line": 25, "column": 7 }, "end": { - "line": 27, + "line": 25, "column": 8 }, "identifierName": "s" @@ -3849,29 +3237,29 @@ }, "init": { "type": "CallExpression", - "start": 847, - "end": 857, + "start": 818, + "end": 828, "loc": { "start": { - "line": 27, + "line": 25, "column": 11 }, "end": { - "line": 27, + "line": 25, "column": 21 } }, "callee": { "type": "Identifier", - "start": 847, - "end": 854, + "start": 818, + "end": 825, "loc": { "start": { - "line": 27, + "line": 25, "column": 11 }, "end": { - "line": 27, + "line": 25, "column": 18 }, "identifierName": "sibling" @@ -3881,15 +3269,15 @@ "arguments": [ { "type": "Identifier", - "start": 855, - "end": 856, + "start": 826, + "end": 827, "loc": { "start": { - "line": 27, + "line": 25, "column": 19 }, "end": { - "line": 27, + "line": 25, "column": 20 }, "identifierName": "n" @@ -3904,43 +3292,43 @@ }, { "type": "ExpressionStatement", - "start": 860, - "end": 886, + "start": 831, + "end": 857, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 860, - "end": 885, + "start": 831, + "end": 856, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 26 } }, "callee": { "type": "Identifier", - "start": 860, - "end": 866, + "start": 831, + "end": 837, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -3950,29 +3338,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 867, - "end": 884, + "start": 838, + "end": 855, "loc": { "start": { - "line": 28, + "line": 26, "column": 8 }, "end": { - "line": 28, + "line": 26, "column": 25 } }, "left": { "type": "Identifier", - "start": 867, - "end": 868, + "start": 838, + "end": 839, "loc": { "start": { - "line": 28, + "line": 26, "column": 8 }, "end": { - "line": 28, + "line": 26, "column": 9 }, "identifierName": "s" @@ -3982,15 +3370,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 880, - "end": 884, + "start": 851, + "end": 855, "loc": { "start": { - "line": 28, + "line": 26, "column": 21 }, "end": { - "line": 28, + "line": 26, "column": 25 }, "identifierName": "Node" @@ -4003,43 +3391,43 @@ }, { "type": "ExpressionStatement", - "start": 888, - "end": 915, + "start": 859, + "end": 886, "loc": { "start": { - "line": 29, + "line": 27, "column": 1 }, "end": { - "line": 29, + "line": 27, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 888, - "end": 914, + "start": 859, + "end": 885, "loc": { "start": { - "line": 29, + "line": 27, "column": 1 }, "end": { - "line": 29, + "line": 27, "column": 27 } }, "callee": { "type": "Identifier", - "start": 888, - "end": 894, + "start": 859, + "end": 865, "loc": { "start": { - "line": 29, + "line": 27, "column": 1 }, "end": { - "line": 29, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -4049,43 +3437,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 895, - "end": 913, + "start": 866, + "end": 884, "loc": { "start": { - "line": 29, + "line": 27, "column": 8 }, "end": { - "line": 29, + "line": 27, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 895, - "end": 903, + "start": 866, + "end": 874, "loc": { "start": { - "line": 29, + "line": 27, "column": 8 }, "end": { - "line": 29, + "line": 27, "column": 16 } }, "object": { "type": "Identifier", - "start": 895, - "end": 896, + "start": 866, + "end": 867, "loc": { "start": { - "line": 29, + "line": 27, "column": 8 }, "end": { - "line": 29, + "line": 27, "column": 9 }, "identifierName": "s" @@ -4094,15 +3482,15 @@ }, "property": { "type": "Identifier", - "start": 897, - "end": 903, + "start": 868, + "end": 874, "loc": { "start": { - "line": 29, + "line": 27, "column": 10 }, "end": { - "line": 29, + "line": 27, "column": 16 }, "identifierName": "_color" @@ -4114,15 +3502,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 908, - "end": 913, + "start": 879, + "end": 884, "loc": { "start": { - "line": 29, + "line": 27, "column": 21 }, "end": { - "line": 29, + "line": 27, "column": 26 }, "identifierName": "BLACK" @@ -4131,365 +3519,205 @@ } } ] - } + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 889, + "end": 1576, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + } + ] }, { "type": "ExpressionStatement", - "start": 917, - "end": 973, + "start": 1579, + "end": 1606, "loc": { "start": { - "line": 30, + "line": 47, "column": 1 }, "end": { - "line": 30, - "column": 57 + "line": 47, + "column": 28 } }, "expression": { - "type": "CallExpression", - "start": 917, - "end": 972, + "type": "AssignmentExpression", + "start": 1579, + "end": 1605, "loc": { "start": { - "line": 30, + "line": 47, "column": 1 }, "end": { - "line": 30, - "column": 56 + "line": 47, + "column": 27 } }, - "callee": { - "type": "Identifier", - "start": 917, - "end": 923, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1579, + "end": 1587, "loc": { "start": { - "line": 30, + "line": 47, "column": 1 }, "end": { - "line": 30, - "column": 7 + "line": 47, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1579, + "end": 1580, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 2 + }, + "identifierName": "s" }, - "identifierName": "assert" + "name": "s", + "leadingComments": null }, - "name": "assert" + "property": { + "type": "Identifier", + "start": 1581, + "end": 1587, + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 924, - "end": 971, + "right": { + "type": "MemberExpression", + "start": 1590, + "end": 1605, + "loc": { + "start": { + "line": 47, + "column": 12 + }, + "end": { + "line": 47, + "column": 27 + } + }, + "object": { + "type": "MemberExpression", + "start": 1590, + "end": 1598, "loc": { "start": { - "line": 30, - "column": 8 + "line": 47, + "column": 12 }, "end": { - "line": 30, - "column": 55 + "line": 47, + "column": 20 } }, - "left": { - "type": "BinaryExpression", - "start": 924, - "end": 945, + "object": { + "type": "Identifier", + "start": 1590, + "end": 1591, "loc": { "start": { - "line": 30, - "column": 8 + "line": 47, + "column": 12 }, "end": { - "line": 30, - "column": 29 - } + "line": 47, + "column": 13 + }, + "identifierName": "n" }, - "left": { - "type": "MemberExpression", - "start": 924, - "end": 937, - "loc": { - "start": { - "line": 30, - "column": 8 - }, - "end": { - "line": 30, - "column": 21 - } + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1592, + "end": 1598, + "loc": { + "start": { + "line": 47, + "column": 14 }, - "object": { - "type": "MemberExpression", - "start": 924, - "end": 930, - "loc": { - "start": { - "line": 30, - "column": 8 - }, - "end": { - "line": 30, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 924, - "end": 925, - "loc": { - "start": { - "line": 30, - "column": 8 - }, - "end": { - "line": 30, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 926, - "end": 930, - "loc": { - "start": { - "line": 30, - "column": 10 - }, - "end": { - "line": 30, - "column": 14 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 931, - "end": 937, - "loc": { - "start": { - "line": 30, - "column": 15 - }, - "end": { - "line": 30, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 47, + "column": 20 }, - "computed": false + "identifierName": "parent" }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 942, - "end": 945, - "loc": { - "start": { - "line": 30, - "column": 26 - }, - "end": { - "line": 30, - "column": 29 - }, - "identifierName": "RED" - }, - "name": "RED" - } + "name": "parent" }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 949, - "end": 971, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 55 - } + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1599, + "end": 1605, + "loc": { + "start": { + "line": 47, + "column": 21 }, - "left": { - "type": "MemberExpression", - "start": 949, - "end": 963, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 47 - } - }, - "object": { - "type": "MemberExpression", - "start": 949, - "end": 956, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 40 - } - }, - "object": { - "type": "Identifier", - "start": 949, - "end": 950, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 34 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 951, - "end": 956, - "loc": { - "start": { - "line": 30, - "column": 35 - }, - "end": { - "line": 30, - "column": 40 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 957, - "end": 963, - "loc": { - "start": { - "line": 30, - "column": 41 - }, - "end": { - "line": 30, - "column": 47 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "end": { + "line": 47, + "column": 27 }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 968, - "end": 971, - "loc": { - "start": { - "line": 30, - "column": 52 - }, - "end": { - "line": 30, - "column": 55 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - } - ] - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 976, - "end": 1049, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 1051, - "end": 1122, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 72 - } - } - }, - { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 1124, - "end": 1149, - "loc": { - "start": { - "line": 34, - "column": 1 + "identifierName": "_color" }, - "end": { - "line": 34, - "column": 26 - } - } + "name": "_color" + }, + "computed": false }, + "leadingComments": null + }, + "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 1152, - "end": 1584, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 889, + "end": 1576, "loc": { "start": { - "line": 36, + "line": 29, "column": 1 }, "end": { - "line": 46, + "line": 45, "column": 4 } } @@ -4497,451 +3725,514 @@ ] }, { - "type": "IfStatement", - "start": 1586, - "end": 2206, + "type": "ExpressionStatement", + "start": 1608, + "end": 1632, "loc": { "start": { - "line": 47, + "line": 48, "column": 1 }, "end": { - "line": 66, - "column": 2 + "line": 48, + "column": 25 } }, - "test": { - "type": "LogicalExpression", - "start": 1590, - "end": 1637, + "expression": { + "type": "AssignmentExpression", + "start": 1608, + "end": 1631, "loc": { "start": { - "line": 47, - "column": 5 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 52 + "line": 48, + "column": 24 } }, + "operator": "=", "left": { - "type": "BinaryExpression", - "start": 1590, - "end": 1609, + "type": "MemberExpression", + "start": 1608, + "end": 1623, "loc": { "start": { - "line": 47, - "column": 5 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 16 } }, - "left": { - "type": "Identifier", - "start": 1590, - "end": 1591, - "loc": { - "start": { - "line": 47, - "column": 5 - }, - "end": { - "line": 47, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "operator": "===", - "right": { + "object": { "type": "MemberExpression", - "start": 1596, - "end": 1609, + "start": 1608, + "end": 1616, "loc": { "start": { - "line": 47, - "column": 11 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 9 } }, "object": { - "type": "MemberExpression", - "start": 1596, - "end": 1604, + "type": "Identifier", + "start": 1608, + "end": 1609, "loc": { "start": { - "line": 47, - "column": 11 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 1596, - "end": 1597, - "loc": { - "start": { - "line": 47, - "column": 11 - }, - "end": { - "line": 47, - "column": 12 - }, - "identifierName": "n" + "line": 48, + "column": 2 }, - "name": "n" + "identifierName": "n" }, - "property": { - "type": "Identifier", - "start": 1598, - "end": 1604, - "loc": { - "start": { - "line": 47, - "column": 13 - }, - "end": { - "line": 47, - "column": 19 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1605, - "end": 1609, + "start": 1610, + "end": 1616, "loc": { "start": { - "line": 47, - "column": 20 + "line": 48, + "column": 3 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 9 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false }, - "leadingComments": null + "property": { + "type": "Identifier", + "start": 1617, + "end": 1623, + "loc": { + "start": { + "line": 48, + "column": 10 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "operator": "&&", "right": { - "type": "BinaryExpression", - "start": 1613, - "end": 1637, + "type": "Identifier", + "start": 1626, + "end": 1631, "loc": { "start": { - "line": 47, - "column": 28 + "line": 48, + "column": 19 }, "end": { - "line": 47, - "column": 52 + "line": 48, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1635, + "end": 1864, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 61, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1639, + "end": 1658, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 1639, + "end": 1640, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1645, + "end": 1658, + "loc": { + "start": { + "line": 50, + "column": 11 + }, + "end": { + "line": 50, + "column": 24 } }, - "left": { + "object": { "type": "MemberExpression", - "start": 1613, - "end": 1627, + "start": 1645, + "end": 1653, "loc": { "start": { - "line": 47, - "column": 28 + "line": 50, + "column": 11 }, "end": { - "line": 47, - "column": 42 + "line": 50, + "column": 19 } }, "object": { - "type": "MemberExpression", - "start": 1613, - "end": 1620, + "type": "Identifier", + "start": 1645, + "end": 1646, "loc": { "start": { - "line": 47, - "column": 28 + "line": 50, + "column": 11 }, "end": { - "line": 47, - "column": 35 - } - }, - "object": { - "type": "Identifier", - "start": 1613, - "end": 1614, - "loc": { - "start": { - "line": 47, - "column": 28 - }, - "end": { - "line": 47, - "column": 29 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1615, - "end": 1620, - "loc": { - "start": { - "line": 47, - "column": 30 - }, - "end": { - "line": 47, - "column": 35 - }, - "identifierName": "right" + "line": 50, + "column": 12 }, - "name": "right" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1621, - "end": 1627, + "start": 1647, + "end": 1653, "loc": { "start": { - "line": 47, - "column": 36 + "line": 50, + "column": 13 }, "end": { - "line": 47, - "column": 42 + "line": 50, + "column": 19 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false }, - "operator": "===", - "right": { + "property": { "type": "Identifier", - "start": 1632, - "end": 1637, + "start": 1654, + "end": 1658, "loc": { "start": { - "line": 47, - "column": 47 + "line": 50, + "column": 20 }, "end": { - "line": 47, - "column": 52 + "line": 50, + "column": 24 }, - "identifierName": "BLACK" + "identifierName": "left" }, - "name": "BLACK" - } - }, - "leadingComments": null + "name": "left" + }, + "computed": false + } }, "consequent": { "type": "BlockStatement", - "start": 1639, - "end": 1705, + "start": 1660, + "end": 1749, "loc": { "start": { - "line": 47, - "column": 54 + "line": 50, + "column": 26 }, "end": { - "line": 51, + "line": 54, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1643, - "end": 1658, + "start": 1664, + "end": 1695, "loc": { "start": { - "line": 48, + "line": 51, "column": 2 }, "end": { - "line": 48, - "column": 17 + "line": 51, + "column": 33 } }, "expression": { - "type": "AssignmentExpression", - "start": 1643, - "end": 1657, + "type": "CallExpression", + "start": 1664, + "end": 1694, "loc": { "start": { - "line": 48, + "line": 51, "column": 2 }, "end": { - "line": 48, - "column": 16 + "line": 51, + "column": 32 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1643, - "end": 1651, + "callee": { + "type": "Identifier", + "start": 1664, + "end": 1670, "loc": { "start": { - "line": 48, + "line": 51, "column": 2 }, "end": { - "line": 48, - "column": 10 - } + "line": 51, + "column": 8 + }, + "identifierName": "assert" }, - "object": { - "type": "Identifier", - "start": 1643, - "end": 1644, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1671, + "end": 1693, "loc": { "start": { - "line": 48, - "column": 2 + "line": 51, + "column": 9 }, "end": { - "line": 48, - "column": 3 - }, - "identifierName": "s" + "line": 51, + "column": 31 + } }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1645, - "end": 1651, - "loc": { - "start": { - "line": 48, - "column": 4 + "left": { + "type": "MemberExpression", + "start": 1671, + "end": 1685, + "loc": { + "start": { + "line": 51, + "column": 9 + }, + "end": { + "line": 51, + "column": 23 + } }, - "end": { - "line": 48, - "column": 10 + "object": { + "type": "MemberExpression", + "start": 1671, + "end": 1678, + "loc": { + "start": { + "line": 51, + "column": 9 + }, + "end": { + "line": 51, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1671, + "end": 1672, + "loc": { + "start": { + "line": 51, + "column": 9 + }, + "end": { + "line": 51, + "column": 10 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1673, + "end": 1678, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "identifierName": "_color" + "property": { + "type": "Identifier", + "start": 1679, + "end": 1685, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1654, - "end": 1657, - "loc": { - "start": { - "line": 48, - "column": 13 - }, - "end": { - "line": 48, - "column": 16 - }, - "identifierName": "RED" - }, - "name": "RED" - } + "operator": "===", + "right": { + "type": "Identifier", + "start": 1690, + "end": 1693, + "loc": { + "start": { + "line": 51, + "column": 28 + }, + "end": { + "line": 51, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] } }, { "type": "ExpressionStatement", - "start": 1661, - "end": 1683, + "start": 1698, + "end": 1721, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, - "column": 24 + "line": 52, + "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 1661, - "end": 1682, + "start": 1698, + "end": 1720, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, - "column": 23 + "line": 52, + "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1661, - "end": 1674, + "start": 1698, + "end": 1712, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, - "column": 15 + "line": 52, + "column": 16 } }, "object": { "type": "MemberExpression", - "start": 1661, - "end": 1667, + "start": 1698, + "end": 1705, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, - "column": 8 + "line": 52, + "column": 9 } }, "object": { "type": "Identifier", - "start": 1661, - "end": 1662, + "start": 1698, + "end": 1699, "loc": { "start": { - "line": 49, + "line": 52, "column": 2 }, "end": { - "line": 49, + "line": 52, "column": 3 }, "identifierName": "s" @@ -4950,35 +4241,35 @@ }, "property": { "type": "Identifier", - "start": 1663, - "end": 1667, + "start": 1700, + "end": 1705, "loc": { "start": { - "line": 49, + "line": 52, "column": 4 }, "end": { - "line": 49, - "column": 8 + "line": 52, + "column": 9 }, - "identifierName": "left" + "identifierName": "right" }, - "name": "left" + "name": "right" }, "computed": false }, "property": { "type": "Identifier", - "start": 1668, - "end": 1674, + "start": 1706, + "end": 1712, "loc": { "start": { - "line": 49, - "column": 9 + "line": 52, + "column": 10 }, "end": { - "line": 49, - "column": 15 + "line": 52, + "column": 16 }, "identifierName": "_color" }, @@ -4988,16 +4279,16 @@ }, "right": { "type": "Identifier", - "start": 1677, - "end": 1682, + "start": 1715, + "end": 1720, "loc": { "start": { - "line": 49, - "column": 18 + "line": 52, + "column": 19 }, "end": { - "line": 49, - "column": 23 + "line": 52, + "column": 24 }, "identifierName": "BLACK" }, @@ -5007,800 +4298,555 @@ }, { "type": "ExpressionStatement", - "start": 1686, - "end": 1702, + "start": 1724, + "end": 1746, "loc": { "start": { - "line": 50, + "line": 53, "column": 2 }, "end": { - "line": 50, - "column": 18 + "line": 53, + "column": 24 } }, "expression": { "type": "CallExpression", - "start": 1686, - "end": 1701, + "start": 1724, + "end": 1745, "loc": { "start": { - "line": 50, + "line": 53, "column": 2 }, "end": { - "line": 50, - "column": 17 + "line": 53, + "column": 23 } }, "callee": { "type": "Identifier", - "start": 1686, - "end": 1698, + "start": 1724, + "end": 1735, "loc": { "start": { - "line": 50, + "line": 53, "column": 2 }, "end": { - "line": 50, - "column": 14 + "line": 53, + "column": 13 }, - "identifierName": "rotate_right" + "identifierName": "rotate_left" }, - "name": "rotate_right" + "name": "rotate_left" }, "arguments": [ { - "type": "Identifier", - "start": 1699, - "end": 1700, + "type": "MemberExpression", + "start": 1736, + "end": 1744, "loc": { "start": { - "line": 50, - "column": 15 + "line": 53, + "column": 14 }, "end": { - "line": 50, - "column": 16 + "line": 53, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 1736, + "end": 1737, + "loc": { + "start": { + "line": 53, + "column": 14 + }, + "end": { + "line": 53, + "column": 15 + }, + "identifierName": "n" }, - "identifierName": "s" + "name": "n" }, - "name": "s" + "property": { + "type": "Identifier", + "start": 1738, + "end": 1744, + "loc": { + "start": { + "line": 53, + "column": 16 + }, + "end": { + "line": 53, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } ] } } ], - "directives": [] + "directives": [], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1752, + "end": 1769, + "loc": { + "start": { + "line": 56, + "column": 1 + }, + "end": { + "line": 56, + "column": 18 + } + } + } + ] }, "alternate": { - "type": "IfStatement", - "start": 1711, - "end": 2206, + "type": "BlockStatement", + "start": 1776, + "end": 1864, "loc": { "start": { - "line": 51, - "column": 8 + "line": 57, + "column": 6 }, "end": { - "line": 66, + "line": 61, "column": 2 } }, - "test": { - "type": "LogicalExpression", - "start": 1715, - "end": 1762, - "loc": { - "start": { - "line": 51, - "column": 12 - }, - "end": { - "line": 51, - "column": 59 - } - }, - "left": { - "type": "BinaryExpression", - "start": 1715, - "end": 1735, + "body": [ + { + "type": "ExpressionStatement", + "start": 1780, + "end": 1810, "loc": { "start": { - "line": 51, - "column": 12 + "line": 58, + "column": 2 }, "end": { - "line": 51, + "line": 58, "column": 32 } }, - "left": { - "type": "Identifier", - "start": 1715, - "end": 1716, - "loc": { - "start": { - "line": 51, - "column": 12 - }, - "end": { - "line": 51, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1721, - "end": 1735, + "expression": { + "type": "CallExpression", + "start": 1780, + "end": 1809, "loc": { "start": { - "line": 51, - "column": 18 + "line": 58, + "column": 2 }, "end": { - "line": 51, - "column": 32 + "line": 58, + "column": 31 } }, - "object": { - "type": "MemberExpression", - "start": 1721, - "end": 1729, + "callee": { + "type": "Identifier", + "start": 1780, + "end": 1786, "loc": { "start": { - "line": 51, - "column": 18 + "line": 58, + "column": 2 }, "end": { - "line": 51, - "column": 26 - } + "line": 58, + "column": 8 + }, + "identifierName": "assert" }, - "object": { - "type": "Identifier", - "start": 1721, - "end": 1722, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1787, + "end": 1808, "loc": { "start": { - "line": 51, - "column": 18 + "line": 58, + "column": 9 }, "end": { - "line": 51, - "column": 19 - }, - "identifierName": "n" + "line": 58, + "column": 30 + } }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1723, - "end": 1729, - "loc": { - "start": { - "line": 51, - "column": 20 + "left": { + "type": "MemberExpression", + "start": 1787, + "end": 1800, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 22 + } }, - "end": { - "line": 51, - "column": 26 + "object": { + "type": "MemberExpression", + "start": 1787, + "end": 1793, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1787, + "end": 1788, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 10 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1789, + "end": 1793, + "loc": { + "start": { + "line": 58, + "column": 11 + }, + "end": { + "line": 58, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1730, - "end": 1735, - "loc": { - "start": { - "line": 51, - "column": 27 - }, - "end": { - "line": 51, - "column": 32 + "property": { + "type": "Identifier", + "start": 1794, + "end": 1800, + "loc": { + "start": { + "line": 58, + "column": 16 + }, + "end": { + "line": 58, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } + "operator": "===", + "right": { + "type": "Identifier", + "start": 1805, + "end": 1808, + "loc": { + "start": { + "line": 58, + "column": 27 + }, + "end": { + "line": 58, + "column": 30 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ], + "leadingComments": null + }, + "leadingComments": null }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1739, - "end": 1762, + { + "type": "ExpressionStatement", + "start": 1813, + "end": 1835, "loc": { "start": { - "line": 51, - "column": 36 + "line": 59, + "column": 2 }, "end": { - "line": 51, - "column": 59 + "line": 59, + "column": 24 } }, - "left": { - "type": "MemberExpression", - "start": 1739, - "end": 1752, + "expression": { + "type": "AssignmentExpression", + "start": 1813, + "end": 1834, "loc": { "start": { - "line": 51, - "column": 36 + "line": 59, + "column": 2 }, "end": { - "line": 51, - "column": 49 + "line": 59, + "column": 23 } }, - "object": { + "operator": "=", + "left": { "type": "MemberExpression", - "start": 1739, - "end": 1745, + "start": 1813, + "end": 1826, "loc": { "start": { - "line": 51, - "column": 36 - }, - "end": { - "line": 51, - "column": 42 - } - }, - "object": { - "type": "Identifier", - "start": 1739, - "end": 1740, - "loc": { - "start": { - "line": 51, - "column": 36 - }, - "end": { - "line": 51, - "column": 37 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1741, - "end": 1745, - "loc": { - "start": { - "line": 51, - "column": 38 - }, - "end": { - "line": 51, - "column": 42 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1746, - "end": 1752, - "loc": { - "start": { - "line": 51, - "column": 43 - }, - "end": { - "line": 51, - "column": 49 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1757, - "end": 1762, - "loc": { - "start": { - "line": 51, - "column": 54 - }, - "end": { - "line": 51, - "column": 59 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - "consequent": { - "type": "BlockStatement", - "start": 1764, - "end": 2206, - "loc": { - "start": { - "line": 51, - "column": 61 - }, - "end": { - "line": 66, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 2144, - "end": 2159, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 17 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 2144, - "end": 2158, - "loc": { - "start": { - "line": 63, + "line": 59, "column": 2 }, "end": { - "line": 63, - "column": 16 + "line": 59, + "column": 15 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 2144, - "end": 2152, + "start": 1813, + "end": 1819, "loc": { "start": { - "line": 63, + "line": 59, "column": 2 }, "end": { - "line": 63, - "column": 10 + "line": 59, + "column": 8 } }, "object": { "type": "Identifier", - "start": 2144, - "end": 2145, + "start": 1813, + "end": 1814, "loc": { "start": { - "line": 63, + "line": 59, "column": 2 }, "end": { - "line": 63, + "line": 59, "column": 3 }, "identifierName": "s" }, - "name": "s", - "leadingComments": null + "name": "s" }, "property": { "type": "Identifier", - "start": 2146, - "end": 2152, + "start": 1815, + "end": 1819, "loc": { "start": { - "line": 63, + "line": 59, "column": 4 }, "end": { - "line": 63, - "column": 10 + "line": 59, + "column": 8 }, - "identifierName": "_color" + "identifierName": "left" }, - "name": "_color" + "name": "left" }, - "computed": false, - "leadingComments": null + "computed": false }, - "right": { + "property": { "type": "Identifier", - "start": 2155, - "end": 2158, + "start": 1820, + "end": 1826, "loc": { "start": { - "line": 63, - "column": 13 + "line": 59, + "column": 9 }, "end": { - "line": 63, - "column": 16 + "line": 59, + "column": 15 }, - "identifierName": "RED" + "identifierName": "_color" }, - "name": "RED" + "name": "_color" }, - "leadingComments": null + "computed": false }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", - "start": 1768, - "end": 2141, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 62, - "column": 5 - } - } - } - ] + "right": { + "type": "Identifier", + "start": 1829, + "end": 1834, + "loc": { + "start": { + "line": 59, + "column": 18 + }, + "end": { + "line": 59, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1838, + "end": 1861, + "loc": { + "start": { + "line": 60, + "column": 2 + }, + "end": { + "line": 60, + "column": 25 + } }, - { - "type": "ExpressionStatement", - "start": 2162, - "end": 2185, + "expression": { + "type": "CallExpression", + "start": 1838, + "end": 1860, "loc": { "start": { - "line": 64, + "line": 60, "column": 2 }, "end": { - "line": 64, - "column": 25 + "line": 60, + "column": 24 } }, - "expression": { - "type": "AssignmentExpression", - "start": 2162, - "end": 2184, + "callee": { + "type": "Identifier", + "start": 1838, + "end": 1850, "loc": { "start": { - "line": 64, + "line": 60, "column": 2 }, "end": { - "line": 64, - "column": 24 - } + "line": 60, + "column": 14 + }, + "identifierName": "rotate_right" }, - "operator": "=", - "left": { + "name": "rotate_right" + }, + "arguments": [ + { "type": "MemberExpression", - "start": 2162, - "end": 2176, + "start": 1851, + "end": 1859, "loc": { "start": { - "line": 64, - "column": 2 + "line": 60, + "column": 15 }, "end": { - "line": 64, - "column": 16 + "line": 60, + "column": 23 } }, "object": { - "type": "MemberExpression", - "start": 2162, - "end": 2169, + "type": "Identifier", + "start": 1851, + "end": 1852, "loc": { "start": { - "line": 64, - "column": 2 + "line": 60, + "column": 15 }, "end": { - "line": 64, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 2162, - "end": 2163, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 2164, - "end": 2169, - "loc": { - "start": { - "line": 64, - "column": 4 - }, - "end": { - "line": 64, - "column": 9 - }, - "identifierName": "right" + "line": 60, + "column": 16 }, - "name": "right" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 2170, - "end": 2176, + "start": 1853, + "end": 1859, "loc": { "start": { - "line": 64, - "column": 10 + "line": 60, + "column": 17 }, "end": { - "line": 64, - "column": 16 + "line": 60, + "column": 23 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false - }, - "right": { - "type": "Identifier", - "start": 2179, - "end": 2184, - "loc": { - "start": { - "line": 64, - "column": 19 - }, - "end": { - "line": 64, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - { - "type": "ExpressionStatement", - "start": 2188, - "end": 2203, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 17 } + ] + } + } + ], + "directives": [], + "leadingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1752, + "end": 1769, + "loc": { + "start": { + "line": 56, + "column": 1 }, - "expression": { - "type": "CallExpression", - "start": 2188, - "end": 2202, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 2188, - "end": 2199, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 13 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "Identifier", - "start": 2200, - "end": 2201, - "loc": { - "start": { - "line": 65, - "column": 14 - }, - "end": { - "line": 65, - "column": 15 - }, - "identifierName": "s" - }, - "name": "s" - } - ] + "end": { + "line": 56, + "column": 18 } } - ], - "directives": [] - }, - "alternate": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 976, - "end": 1049, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 1051, - "end": 1122, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 72 - } - } - }, - { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 1124, - "end": 1149, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 26 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 1152, - "end": 1584, - "loc": { - "start": { - "line": 36, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 2209, - "end": 2225, - "loc": { - "start": { - "line": 68, - "column": 1 - }, - "end": { - "line": 68, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 2209, - "end": 2224, - "loc": { - "start": { - "line": 68, - "column": 1 - }, - "end": { - "line": 68, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 2209, - "end": 2221, - "loc": { - "start": { - "line": 68, - "column": 1 - }, - "end": { - "line": 68, - "column": 13 - }, - "identifierName": "delete_case6" - }, - "name": "delete_case6" - }, - "arguments": [ - { - "type": "Identifier", - "start": 2222, - "end": 2223, - "loc": { - "start": { - "line": 68, - "column": 14 - }, - "end": { - "line": 68, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" } ] } @@ -5816,16 +4862,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 375, - "end": 699, + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "start": 291, + "end": 691, "loc": { "start": { - "line": 12, + "line": 9, "column": 0 }, "end": { - "line": 22, + "line": 20, "column": 3 } } @@ -5837,903 +4883,57 @@ ], "directives": [] }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 375, - "end": 699, - "loc": { - "start": { - "line": 12, - "column": 0 - }, - "end": { - "line": 22, - "column": 3 - } - } - }, - { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 976, - "end": 1049, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 1051, - "end": 1122, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 72 - } - } - }, - { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 1124, - "end": 1149, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 26 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 1152, - "end": 1584, - "loc": { - "start": { - "line": 36, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", - "start": 1768, - "end": 2141, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 62, - "column": 5 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 42, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/BLACK.js", - "start": 47, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 68, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 79, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/RED.js", - "start": 84, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 101, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 103, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 110, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 115, - "end": 119, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 120, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 138, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 152, - "end": 156, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Leaf.js", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 175, - "end": 176, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 177, - "end": 183, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_left", - "start": 184, - "end": 195, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 18 - } - } - }, + "comments": [ { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 196, - "end": 200, + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "start": 291, + "end": 691, "loc": { "start": { - "line": 6, - "column": 19 + "line": 9, + "column": 0 }, "end": { - "line": 6, - "column": 23 + "line": 20, + "column": 3 } } }, { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../rotate/rotate_left.js", - "start": 201, - "end": 227, + "type": "CommentBlock", + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 889, + "end": 1576, "loc": { "start": { - "line": 6, - "column": 24 + "line": 29, + "column": 1 }, "end": { - "line": 6, - "column": 50 + "line": 45, + "column": 4 } } }, { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 227, - "end": 228, + "type": "CommentLine", + "value": " Symmetric case", + "start": 1752, + "end": 1769, "loc": { "start": { - "line": 6, - "column": 50 + "line": 56, + "column": 1 }, "end": { - "line": 6, - "column": 51 + "line": 56, + "column": 18 } } - }, + } + ], + "tokens": [ { "type": { "label": "import", @@ -6749,15 +4949,15 @@ "updateContext": null }, "value": "import", - "start": 229, - "end": 235, + "start": 0, + "end": 6, "loc": { "start": { - "line": 7, + "line": 1, "column": 0 }, "end": { - "line": 7, + "line": 1, "column": 6 } } @@ -6774,17 +4974,17 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 236, - "end": 248, + "value": "assert", + "start": 7, + "end": 13, "loc": { "start": { - "line": 7, + "line": 1, "column": 7 }, "end": { - "line": 7, - "column": 19 + "line": 1, + "column": 13 } } }, @@ -6801,16 +5001,16 @@ "binop": null }, "value": "from", - "start": 249, - "end": 253, + "start": 14, + "end": 18, "loc": { "start": { - "line": 7, - "column": 20 + "line": 1, + "column": 14 }, "end": { - "line": 7, - "column": 24 + "line": 1, + "column": 18 } } }, @@ -6827,17 +5027,17 @@ "binop": null, "updateContext": null }, - "value": "../rotate/rotate_right.js", - "start": 254, - "end": 281, + "value": "assert", + "start": 19, + "end": 27, "loc": { "start": { - "line": 7, - "column": 25 + "line": 1, + "column": 19 }, "end": { - "line": 7, - "column": 52 + "line": 1, + "column": 27 } } }, @@ -6854,16 +5054,16 @@ "binop": null, "updateContext": null }, - "start": 281, - "end": 282, + "start": 27, + "end": 28, "loc": { "start": { - "line": 7, - "column": 52 + "line": 1, + "column": 27 }, "end": { - "line": 7, - "column": 53 + "line": 1, + "column": 28 } } }, @@ -6882,15 +5082,15 @@ "updateContext": null }, "value": "import", - "start": 283, - "end": 289, + "start": 29, + "end": 35, "loc": { "start": { - "line": 8, + "line": 2, "column": 0 }, "end": { - "line": 8, + "line": 2, "column": 6 } } @@ -6907,17 +5107,17 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 290, - "end": 297, + "value": "BLACK", + "start": 36, + "end": 41, "loc": { "start": { - "line": 8, + "line": 2, "column": 7 }, "end": { - "line": 8, - "column": 14 + "line": 2, + "column": 12 } } }, @@ -6934,16 +5134,16 @@ "binop": null }, "value": "from", - "start": 298, - "end": 302, + "start": 42, + "end": 46, "loc": { "start": { - "line": 8, - "column": 15 + "line": 2, + "column": 13 }, "end": { - "line": 8, - "column": 19 + "line": 2, + "column": 17 } } }, @@ -6960,17 +5160,17 @@ "binop": null, "updateContext": null }, - "value": "../family/sibling.js", - "start": 303, - "end": 325, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, "loc": { "start": { - "line": 8, - "column": 20 + "line": 2, + "column": 18 }, "end": { - "line": 8, - "column": 42 + "line": 2, + "column": 37 } } }, @@ -6987,16 +5187,16 @@ "binop": null, "updateContext": null }, - "start": 325, - "end": 326, + "start": 66, + "end": 67, "loc": { "start": { - "line": 8, - "column": 42 + "line": 2, + "column": 37 }, "end": { - "line": 8, - "column": 43 + "line": 2, + "column": 38 } } }, @@ -7015,15 +5215,15 @@ "updateContext": null }, "value": "import", - "start": 328, - "end": 334, + "start": 68, + "end": 74, "loc": { "start": { - "line": 10, + "line": 3, "column": 0 }, "end": { - "line": 10, + "line": 3, "column": 6 } } @@ -7040,17 +5240,17 @@ "postfix": false, "binop": null }, - "value": "delete_case6", - "start": 335, - "end": 347, + "value": "RED", + "start": 75, + "end": 78, "loc": { "start": { - "line": 10, + "line": 3, "column": 7 }, "end": { - "line": 10, - "column": 19 + "line": 3, + "column": 10 } } }, @@ -7067,16 +5267,16 @@ "binop": null }, "value": "from", - "start": 348, - "end": 352, + "start": 79, + "end": 83, "loc": { "start": { - "line": 10, - "column": 20 + "line": 3, + "column": 11 }, "end": { - "line": 10, - "column": 24 + "line": 3, + "column": 15 } } }, @@ -7093,17 +5293,17 @@ "binop": null, "updateContext": null }, - "value": "./delete_case6.js", - "start": 353, - "end": 372, + "value": "../color/RED.js", + "start": 84, + "end": 101, "loc": { "start": { - "line": 10, - "column": 25 + "line": 3, + "column": 16 }, "end": { - "line": 10, - "column": 44 + "line": 3, + "column": 33 } } }, @@ -7120,41 +5320,25 @@ "binop": null, "updateContext": null }, - "start": 372, - "end": 373, - "loc": { - "start": { - "line": 10, - "column": 44 - }, - "end": { - "line": 10, - "column": 45 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 375, - "end": 699, + "start": 101, + "end": 102, "loc": { "start": { - "line": 12, - "column": 0 + "line": 3, + "column": 33 }, "end": { - "line": 22, - "column": 3 + "line": 3, + "column": 34 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7163,17 +5347,17 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 700, - "end": 705, + "value": "import", + "start": 103, + "end": 109, "loc": { "start": { - "line": 23, + "line": 4, "column": 0 }, "end": { - "line": 23, - "column": 5 + "line": 4, + "column": 6 } } }, @@ -7189,51 +5373,24 @@ "postfix": false, "binop": null }, - "value": "delete_case5", - "start": 706, - "end": 718, - "loc": { - "start": { - "line": 23, - "column": 6 - }, - "end": { - "line": 23, - "column": 18 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 719, - "end": 720, + "value": "Node", + "start": 110, + "end": 114, "loc": { "start": { - "line": 23, - "column": 19 + "line": 4, + "column": 7 }, "end": { - "line": 23, - "column": 20 + "line": 4, + "column": 11 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7242,22 +5399,23 @@ "postfix": false, "binop": null }, - "start": 721, - "end": 722, + "value": "from", + "start": 115, + "end": 119, "loc": { "start": { - "line": 23, - "column": 21 + "line": 4, + "column": 12 }, "end": { - "line": 23, - "column": 22 + "line": 4, + "column": 16 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7265,52 +5423,55 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 722, - "end": 723, + "value": "../types/Node.js", + "start": 120, + "end": 138, "loc": { "start": { - "line": 23, - "column": 22 + "line": 4, + "column": 17 }, "end": { - "line": 23, - "column": 23 + "line": 4, + "column": 35 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 723, - "end": 724, + "start": 138, + "end": 139, "loc": { "start": { - "line": 23, - "column": 23 + "line": 4, + "column": 35 }, "end": { - "line": 23, - "column": 24 + "line": 4, + "column": 36 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7319,23 +5480,24 @@ "binop": null, "updateContext": null }, - "start": 725, - "end": 727, + "value": "import", + "start": 140, + "end": 146, "loc": { "start": { - "line": 23, - "column": 25 + "line": 5, + "column": 0 }, "end": { - "line": 23, - "column": 27 + "line": 5, + "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7344,16 +5506,17 @@ "postfix": false, "binop": null }, - "start": 728, - "end": 729, + "value": "rotate_left", + "start": 147, + "end": 158, "loc": { "start": { - "line": 23, - "column": 28 + "line": 5, + "column": 7 }, "end": { - "line": 23, - "column": 29 + "line": 5, + "column": 18 } } }, @@ -7369,96 +5532,98 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 731, - "end": 737, + "value": "from", + "start": 159, + "end": 163, "loc": { "start": { - "line": 24, - "column": 1 + "line": 5, + "column": 19 }, "end": { - "line": 24, - "column": 7 + "line": 5, + "column": 23 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "string", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 737, - "end": 738, + "value": "../rotate/rotate_left.js", + "start": 164, + "end": 190, "loc": { "start": { - "line": 24, - "column": 7 + "line": 5, + "column": 24 }, "end": { - "line": 24, - "column": 8 + "line": 5, + "column": 50 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 738, - "end": 739, + "start": 190, + "end": 191, "loc": { "start": { - "line": 24, - "column": 8 + "line": 5, + "column": 50 }, "end": { - "line": 24, - "column": 9 + "line": 5, + "column": 51 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 740, - "end": 750, + "value": "import", + "start": 192, + "end": 198, "loc": { "start": { - "line": 24, - "column": 10 + "line": 6, + "column": 0 }, "end": { - "line": 24, - "column": 20 + "line": 6, + "column": 6 } } }, @@ -7474,50 +5639,49 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 751, - "end": 755, + "value": "rotate_right", + "start": 199, + "end": 211, "loc": { "start": { - "line": 24, - "column": 21 + "line": 6, + "column": 7 }, "end": { - "line": 24, - "column": 25 + "line": 6, + "column": 19 } } }, { "type": { - "label": "||", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 1, - "updateContext": null + "binop": null }, - "value": "||", - "start": 756, - "end": 758, + "value": "from", + "start": 212, + "end": 216, "loc": { "start": { - "line": 24, - "column": 26 + "line": 6, + "column": 20 }, "end": { - "line": 24, - "column": 28 + "line": 6, + "column": 24 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7525,26 +5689,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 759, - "end": 760, + "value": "../rotate/rotate_right.js", + "start": 217, + "end": 244, "loc": { "start": { - "line": 24, - "column": 29 + "line": 6, + "column": 25 }, "end": { - "line": 24, - "column": 30 + "line": 6, + "column": 52 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7552,26 +5716,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 761, - "end": 771, + "start": 244, + "end": 245, "loc": { "start": { - "line": 24, - "column": 31 + "line": 6, + "column": 52 }, "end": { - "line": 24, - "column": 41 + "line": 6, + "column": 53 } } }, { "type": { - "label": "name", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7579,27 +5743,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Leaf", - "start": 772, - "end": 776, + "value": "import", + "start": 246, + "end": 252, "loc": { "start": { - "line": 24, - "column": 42 + "line": 7, + "column": 0 }, "end": { - "line": 24, - "column": 46 + "line": 7, + "column": 6 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7607,48 +5772,49 @@ "postfix": false, "binop": null }, - "start": 776, - "end": 777, + "value": "sibling", + "start": 253, + "end": 260, "loc": { "start": { - "line": 24, - "column": 46 + "line": 7, + "column": 7 }, "end": { - "line": 24, - "column": 47 + "line": 7, + "column": 14 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 777, - "end": 778, + "value": "from", + "start": 261, + "end": 265, "loc": { "start": { - "line": 24, - "column": 47 + "line": 7, + "column": 15 }, "end": { - "line": 24, - "column": 48 + "line": 7, + "column": 19 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7656,76 +5822,69 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 780, - "end": 786, + "value": "../family/sibling.js", + "start": 266, + "end": 288, "loc": { "start": { - "line": 25, - "column": 1 + "line": 7, + "column": 20 }, "end": { - "line": 25, - "column": 7 + "line": 7, + "column": 42 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 786, - "end": 787, + "start": 288, + "end": 289, "loc": { "start": { - "line": 25, - "column": 7 + "line": 7, + "column": 42 }, "end": { - "line": 25, - "column": 8 + "line": 7, + "column": 43 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 787, - "end": 788, + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "start": 291, + "end": 691, "loc": { "start": { - "line": 25, - "column": 8 + "line": 9, + "column": 0 }, "end": { - "line": 25, - "column": 9 + "line": 20, + "column": 3 } } }, { "type": { - "label": ".", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7736,16 +5895,17 @@ "binop": null, "updateContext": null }, - "start": 788, - "end": 789, + "value": "const", + "start": 692, + "end": 697, "loc": { "start": { - "line": 25, - "column": 9 + "line": 21, + "column": 0 }, "end": { - "line": 25, - "column": 10 + "line": 21, + "column": 5 } } }, @@ -7761,51 +5921,51 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 789, - "end": 795, + "value": "delete_case5", + "start": 698, + "end": 710, "loc": { "start": { - "line": 25, - "column": 10 + "line": 21, + "column": 6 }, "end": { - "line": 25, - "column": 16 + "line": 21, + "column": 18 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 796, - "end": 799, + "value": "=", + "start": 711, + "end": 712, "loc": { "start": { - "line": 25, - "column": 17 + "line": 21, + "column": 19 }, "end": { - "line": 25, + "line": 21, "column": 20 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7814,25 +5974,24 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 800, - "end": 805, + "start": 713, + "end": 714, "loc": { "start": { - "line": 25, + "line": 21, "column": 21 }, "end": { - "line": 25, - "column": 26 + "line": 21, + "column": 22 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7840,74 +5999,74 @@ "postfix": false, "binop": null }, - "start": 805, - "end": 806, + "value": "n", + "start": 714, + "end": 715, "loc": { "start": { - "line": 25, - "column": 26 + "line": 21, + "column": 22 }, "end": { - "line": 25, - "column": 27 + "line": 21, + "column": 23 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 806, - "end": 807, + "start": 715, + "end": 716, "loc": { "start": { - "line": 25, - "column": 27 + "line": 21, + "column": 23 }, "end": { - "line": 25, - "column": 28 + "line": 21, + "column": 24 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "=>", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 809, - "end": 815, + "start": 717, + "end": 719, "loc": { "start": { - "line": 26, - "column": 1 + "line": 21, + "column": 25 }, "end": { - "line": 26, - "column": 7 + "line": 21, + "column": 27 } } }, { "type": { - "label": "(", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -7917,16 +6076,16 @@ "postfix": false, "binop": null }, - "start": 815, - "end": 816, + "start": 720, + "end": 721, "loc": { "start": { - "line": 26, - "column": 7 + "line": 21, + "column": 28 }, "end": { - "line": 26, - "column": 8 + "line": 21, + "column": 29 } } }, @@ -7942,43 +6101,42 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 816, - "end": 817, + "value": "assert", + "start": 723, + "end": 729, "loc": { "start": { - "line": 26, - "column": 8 + "line": 22, + "column": 1 }, "end": { - "line": 26, - "column": 9 + "line": 22, + "column": 7 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 817, - "end": 818, + "start": 729, + "end": 730, "loc": { "start": { - "line": 26, - "column": 9 + "line": 22, + "column": 7 }, "end": { - "line": 26, - "column": 10 + "line": 22, + "column": 8 } } }, @@ -7994,23 +6152,24 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 818, - "end": 824, + "value": "n", + "start": 730, + "end": 731, "loc": { "start": { - "line": 26, - "column": 10 + "line": 22, + "column": 8 }, "end": { - "line": 26, - "column": 16 + "line": 22, + "column": 9 } } }, { "type": { - "label": "==/!=", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8018,27 +6177,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": 7, "updateContext": null }, - "value": "!==", - "start": 825, - "end": 828, + "value": "instanceof", + "start": 732, + "end": 742, "loc": { "start": { - "line": 26, - "column": 17 + "line": 22, + "column": 10 }, "end": { - "line": 26, + "line": 22, "column": 20 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8046,19 +6204,18 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 829, - "end": 833, + "value": "Node", + "start": 743, + "end": 747, "loc": { "start": { - "line": 26, + "line": 22, "column": 21 }, "end": { - "line": 26, + "line": 22, "column": 25 } } @@ -8075,15 +6232,15 @@ "postfix": false, "binop": null }, - "start": 833, - "end": 834, + "start": 747, + "end": 748, "loc": { "start": { - "line": 26, + "line": 22, "column": 25 }, "end": { - "line": 26, + "line": 22, "column": 26 } } @@ -8101,44 +6258,67 @@ "binop": null, "updateContext": null }, - "start": 834, - "end": 835, + "start": 748, + "end": 749, "loc": { "start": { - "line": 26, + "line": 22, "column": 26 }, "end": { - "line": 26, + "line": 22, "column": 27 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 837, - "end": 842, + "value": "assert", + "start": 751, + "end": 757, "loc": { "start": { - "line": 27, + "line": 23, "column": 1 }, "end": { - "line": 27, - "column": 6 + "line": 23, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 757, + "end": 758, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 } } }, @@ -8154,43 +6334,42 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 843, - "end": 844, + "value": "n", + "start": 758, + "end": 759, "loc": { "start": { - "line": 27, - "column": 7 + "line": 23, + "column": 8 }, "end": { - "line": 27, - "column": 8 + "line": 23, + "column": 9 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 845, - "end": 846, + "start": 759, + "end": 760, "loc": { "start": { - "line": 27, + "line": 23, "column": 9 }, "end": { - "line": 27, + "line": 23, "column": 10 } } @@ -8207,42 +6386,44 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 847, - "end": 854, + "value": "_color", + "start": 760, + "end": 766, "loc": { "start": { - "line": 27, - "column": 11 + "line": 23, + "column": 10 }, "end": { - "line": 27, - "column": 18 + "line": 23, + "column": 16 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 854, - "end": 855, + "value": "===", + "start": 767, + "end": 770, "loc": { "start": { - "line": 27, - "column": 18 + "line": 23, + "column": 17 }, "end": { - "line": 27, - "column": 19 + "line": 23, + "column": 20 } } }, @@ -8258,17 +6439,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 855, - "end": 856, + "value": "BLACK", + "start": 771, + "end": 776, "loc": { "start": { - "line": 27, - "column": 19 + "line": 23, + "column": 21 }, "end": { - "line": 27, - "column": 20 + "line": 23, + "column": 26 } } }, @@ -8284,16 +6465,16 @@ "postfix": false, "binop": null }, - "start": 856, - "end": 857, + "start": 776, + "end": 777, "loc": { "start": { - "line": 27, - "column": 20 + "line": 23, + "column": 26 }, "end": { - "line": 27, - "column": 21 + "line": 23, + "column": 27 } } }, @@ -8310,16 +6491,16 @@ "binop": null, "updateContext": null }, - "start": 857, - "end": 858, + "start": 777, + "end": 778, "loc": { "start": { - "line": 27, - "column": 21 + "line": 23, + "column": 27 }, "end": { - "line": 27, - "column": 22 + "line": 23, + "column": 28 } } }, @@ -8336,15 +6517,15 @@ "binop": null }, "value": "assert", - "start": 860, - "end": 866, + "start": 780, + "end": 786, "loc": { "start": { - "line": 28, + "line": 24, "column": 1 }, "end": { - "line": 28, + "line": 24, "column": 7 } } @@ -8361,15 +6542,15 @@ "postfix": false, "binop": null }, - "start": 866, - "end": 867, + "start": 786, + "end": 787, "loc": { "start": { - "line": 28, + "line": 24, "column": 7 }, "end": { - "line": 28, + "line": 24, "column": 8 } } @@ -8386,45 +6567,43 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 867, - "end": 868, + "value": "n", + "start": 787, + "end": 788, "loc": { "start": { - "line": 28, + "line": 24, "column": 8 }, "end": { - "line": 28, + "line": 24, "column": 9 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 869, - "end": 879, + "start": 788, + "end": 789, "loc": { "start": { - "line": 28, - "column": 10 + "line": 24, + "column": 9 }, "end": { - "line": 28, - "column": 20 + "line": 24, + "column": 10 } } }, @@ -8440,50 +6619,53 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 880, - "end": 884, + "value": "parent", + "start": 789, + "end": 795, "loc": { "start": { - "line": 28, - "column": 21 + "line": 24, + "column": 10 }, "end": { - "line": 28, - "column": 25 + "line": 24, + "column": 16 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 884, - "end": 885, + "value": "!==", + "start": 796, + "end": 799, "loc": { "start": { - "line": 28, - "column": 25 + "line": 24, + "column": 17 }, "end": { - "line": 28, - "column": 26 + "line": 24, + "column": 20 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8492,24 +6674,25 @@ "binop": null, "updateContext": null }, - "start": 885, - "end": 886, + "value": "null", + "start": 800, + "end": 804, "loc": { "start": { - "line": 28, - "column": 26 + "line": 24, + "column": 21 }, "end": { - "line": 28, - "column": 27 + "line": 24, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8517,42 +6700,70 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 888, - "end": 894, + "start": 804, + "end": 805, "loc": { "start": { - "line": 29, - "column": 1 + "line": 24, + "column": 25 }, "end": { - "line": 29, - "column": 7 + "line": 24, + "column": 26 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 894, - "end": 895, + "start": 805, + "end": 806, "loc": { "start": { - "line": 29, - "column": 7 + "line": 24, + "column": 26 }, "end": { - "line": 29, - "column": 8 + "line": 24, + "column": 27 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 808, + "end": 813, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 6 } } }, @@ -8569,41 +6780,42 @@ "binop": null }, "value": "s", - "start": 895, - "end": 896, + "start": 814, + "end": 815, "loc": { "start": { - "line": 29, - "column": 8 + "line": 25, + "column": 7 }, "end": { - "line": 29, - "column": 9 + "line": 25, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 896, - "end": 897, + "value": "=", + "start": 816, + "end": 817, "loc": { "start": { - "line": 29, + "line": 25, "column": 9 }, "end": { - "line": 29, + "line": 25, "column": 10 } } @@ -8620,44 +6832,42 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 897, - "end": 903, + "value": "sibling", + "start": 818, + "end": 825, "loc": { - "start": { - "line": 29, - "column": 10 + "start": { + "line": 25, + "column": 11 }, "end": { - "line": 29, - "column": 16 + "line": 25, + "column": 18 } } }, { "type": { - "label": "==/!=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 904, - "end": 907, + "start": 825, + "end": 826, "loc": { "start": { - "line": 29, - "column": 17 + "line": 25, + "column": 18 }, "end": { - "line": 29, - "column": 20 + "line": 25, + "column": 19 } } }, @@ -8673,17 +6883,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 908, - "end": 913, + "value": "n", + "start": 826, + "end": 827, "loc": { "start": { - "line": 29, - "column": 21 + "line": 25, + "column": 19 }, "end": { - "line": 29, - "column": 26 + "line": 25, + "column": 20 } } }, @@ -8699,16 +6909,16 @@ "postfix": false, "binop": null }, - "start": 913, - "end": 914, + "start": 827, + "end": 828, "loc": { "start": { - "line": 29, - "column": 26 + "line": 25, + "column": 20 }, "end": { - "line": 29, - "column": 27 + "line": 25, + "column": 21 } } }, @@ -8725,16 +6935,16 @@ "binop": null, "updateContext": null }, - "start": 914, - "end": 915, + "start": 828, + "end": 829, "loc": { "start": { - "line": 29, - "column": 27 + "line": 25, + "column": 21 }, "end": { - "line": 29, - "column": 28 + "line": 25, + "column": 22 } } }, @@ -8751,15 +6961,15 @@ "binop": null }, "value": "assert", - "start": 917, - "end": 923, + "start": 831, + "end": 837, "loc": { "start": { - "line": 30, + "line": 26, "column": 1 }, "end": { - "line": 30, + "line": 26, "column": 7 } } @@ -8776,15 +6986,15 @@ "postfix": false, "binop": null }, - "start": 923, - "end": 924, + "start": 837, + "end": 838, "loc": { "start": { - "line": 30, + "line": 26, "column": 7 }, "end": { - "line": 30, + "line": 26, "column": 8 } } @@ -8802,42 +7012,44 @@ "binop": null }, "value": "s", - "start": 924, - "end": 925, + "start": 838, + "end": 839, "loc": { "start": { - "line": 30, + "line": 26, "column": 8 }, "end": { - "line": 30, + "line": 26, "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 925, - "end": 926, + "value": "instanceof", + "start": 840, + "end": 850, "loc": { "start": { - "line": 30, - "column": 9 + "line": 26, + "column": 10 }, "end": { - "line": 30, - "column": 10 + "line": 26, + "column": 20 } } }, @@ -8853,23 +7065,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 926, - "end": 930, + "value": "Node", + "start": 851, + "end": 855, "loc": { "start": { - "line": 30, - "column": 10 + "line": 26, + "column": 21 }, "end": { - "line": 30, - "column": 14 + "line": 26, + "column": 25 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -8877,51 +7089,24 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 930, - "end": 931, - "loc": { - "start": { - "line": 30, - "column": 14 - }, - "end": { - "line": 30, - "column": 15 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, "binop": null }, - "value": "_color", - "start": 931, - "end": 937, + "start": 855, + "end": 856, "loc": { "start": { - "line": 30, - "column": 15 + "line": 26, + "column": 25 }, "end": { - "line": 30, - "column": 21 + "line": 26, + "column": 26 } } }, { "type": { - "label": "==/!=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8929,20 +7114,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 938, - "end": 941, + "start": 856, + "end": 857, "loc": { "start": { - "line": 30, - "column": 22 + "line": 26, + "column": 26 }, "end": { - "line": 30, - "column": 25 + "line": 26, + "column": 27 } } }, @@ -8958,51 +7142,24 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 942, - "end": 945, + "value": "assert", + "start": 859, + "end": 865, "loc": { "start": { - "line": 30, - "column": 26 + "line": 27, + "column": 1 }, "end": { - "line": 30, - "column": 29 + "line": 27, + "column": 7 } } }, { "type": { - "label": "||", + "label": "(", "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 1, - "updateContext": null - }, - "value": "||", - "start": 946, - "end": 948, - "loc": { - "start": { - "line": 30, - "column": 30 - }, - "end": { - "line": 30, - "column": 32 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -9011,43 +7168,16 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 949, - "end": 950, - "loc": { - "start": { - "line": 30, - "column": 33 - }, - "end": { - "line": 30, - "column": 34 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 950, - "end": 951, + "start": 865, + "end": 866, "loc": { "start": { - "line": 30, - "column": 34 + "line": 27, + "column": 7 }, "end": { - "line": 30, - "column": 35 + "line": 27, + "column": 8 } } }, @@ -9063,17 +7193,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 951, - "end": 956, + "value": "s", + "start": 866, + "end": 867, "loc": { "start": { - "line": 30, - "column": 35 + "line": 27, + "column": 8 }, "end": { - "line": 30, - "column": 40 + "line": 27, + "column": 9 } } }, @@ -9090,16 +7220,16 @@ "binop": null, "updateContext": null }, - "start": 956, - "end": 957, + "start": 867, + "end": 868, "loc": { "start": { - "line": 30, - "column": 40 + "line": 27, + "column": 9 }, "end": { - "line": 30, - "column": 41 + "line": 27, + "column": 10 } } }, @@ -9116,16 +7246,16 @@ "binop": null }, "value": "_color", - "start": 957, - "end": 963, + "start": 868, + "end": 874, "loc": { "start": { - "line": 30, - "column": 41 + "line": 27, + "column": 10 }, "end": { - "line": 30, - "column": 47 + "line": 27, + "column": 16 } } }, @@ -9143,16 +7273,16 @@ "updateContext": null }, "value": "===", - "start": 964, - "end": 967, + "start": 875, + "end": 878, "loc": { "start": { - "line": 30, - "column": 48 + "line": 27, + "column": 17 }, "end": { - "line": 30, - "column": 51 + "line": 27, + "column": 20 } } }, @@ -9168,17 +7298,17 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 968, - "end": 971, + "value": "BLACK", + "start": 879, + "end": 884, "loc": { "start": { - "line": 30, - "column": 52 + "line": 27, + "column": 21 }, "end": { - "line": 30, - "column": 55 + "line": 27, + "column": 26 } } }, @@ -9194,16 +7324,16 @@ "postfix": false, "binop": null }, - "start": 971, - "end": 972, + "start": 884, + "end": 885, "loc": { "start": { - "line": 30, - "column": 55 + "line": 27, + "column": 26 }, "end": { - "line": 30, - "column": 56 + "line": 27, + "column": 27 } } }, @@ -9220,100 +7350,50 @@ "binop": null, "updateContext": null }, - "start": 972, - "end": 973, - "loc": { - "start": { - "line": 30, - "column": 56 - }, - "end": { - "line": 30, - "column": 57 - } - } - }, - { - "type": "CommentLine", - "value": " The following statements just force the red n's sibling child to be on", - "start": 976, - "end": 1049, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 32, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " the left of the left of the parent, or right of the right, so case 6", - "start": 1051, - "end": 1122, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 72 - } - } - }, - { - "type": "CommentLine", - "value": " will rotate correctly.", - "start": 1124, - "end": 1149, + "start": 885, + "end": 886, "loc": { "start": { - "line": 34, - "column": 1 + "line": 27, + "column": 27 }, "end": { - "line": 34, - "column": 26 + "line": 27, + "column": 28 } } }, { "type": "CommentBlock", - "value": "*\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t ", - "start": 1152, - "end": 1584, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 889, + "end": 1576, "loc": { "start": { - "line": 36, + "line": 29, "column": 1 }, "end": { - "line": 46, + "line": 45, "column": 4 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1586, - "end": 1588, + "value": "s", + "start": 1579, + "end": 1580, "loc": { "start": { "line": 47, @@ -9321,32 +7401,33 @@ }, "end": { "line": 47, - "column": 3 + "column": 2 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1589, - "end": 1590, + "start": 1580, + "end": 1581, "loc": { "start": { "line": 47, - "column": 4 + "column": 2 }, "end": { "line": 47, - "column": 5 + "column": 3 } } }, @@ -9362,44 +7443,44 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1590, - "end": 1591, + "value": "_color", + "start": 1581, + "end": 1587, "loc": { "start": { "line": 47, - "column": 5 + "column": 3 }, "end": { "line": 47, - "column": 6 + "column": 9 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1592, - "end": 1595, + "value": "=", + "start": 1588, + "end": 1589, "loc": { "start": { "line": 47, - "column": 7 + "column": 10 }, "end": { "line": 47, - "column": 10 + "column": 11 } } }, @@ -9416,16 +7497,16 @@ "binop": null }, "value": "n", - "start": 1596, - "end": 1597, + "start": 1590, + "end": 1591, "loc": { "start": { "line": 47, - "column": 11 + "column": 12 }, "end": { "line": 47, - "column": 12 + "column": 13 } } }, @@ -9442,16 +7523,16 @@ "binop": null, "updateContext": null }, - "start": 1597, - "end": 1598, + "start": 1591, + "end": 1592, "loc": { "start": { "line": 47, - "column": 12 + "column": 13 }, "end": { "line": 47, - "column": 13 + "column": 14 } } }, @@ -9468,16 +7549,16 @@ "binop": null }, "value": "parent", - "start": 1598, - "end": 1604, + "start": 1592, + "end": 1598, "loc": { "start": { "line": 47, - "column": 13 + "column": 14 }, "end": { "line": 47, - "column": 19 + "column": 20 } } }, @@ -9494,16 +7575,16 @@ "binop": null, "updateContext": null }, - "start": 1604, - "end": 1605, + "start": 1598, + "end": 1599, "loc": { "start": { "line": 47, - "column": 19 + "column": 20 }, "end": { "line": 47, - "column": 20 + "column": 21 } } }, @@ -9519,23 +7600,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1605, - "end": 1609, + "value": "_color", + "start": 1599, + "end": 1605, "loc": { "start": { "line": 47, - "column": 20 + "column": 21 }, "end": { "line": 47, - "column": 24 + "column": 27 } } }, { "type": { - "label": "&&", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -9543,20 +7624,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 2, + "binop": null, "updateContext": null }, - "value": "&&", - "start": 1610, - "end": 1612, + "start": 1605, + "end": 1606, "loc": { "start": { "line": 47, - "column": 25 + "column": 27 }, "end": { "line": 47, - "column": 27 + "column": 28 } } }, @@ -9572,17 +7652,17 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1613, - "end": 1614, + "value": "n", + "start": 1608, + "end": 1609, "loc": { "start": { - "line": 47, - "column": 28 + "line": 48, + "column": 1 }, "end": { - "line": 47, - "column": 29 + "line": 48, + "column": 2 } } }, @@ -9599,16 +7679,16 @@ "binop": null, "updateContext": null }, - "start": 1614, - "end": 1615, + "start": 1609, + "end": 1610, "loc": { "start": { - "line": 47, - "column": 29 + "line": 48, + "column": 2 }, "end": { - "line": 47, - "column": 30 + "line": 48, + "column": 3 } } }, @@ -9624,17 +7704,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1615, - "end": 1620, + "value": "parent", + "start": 1610, + "end": 1616, "loc": { "start": { - "line": 47, - "column": 30 + "line": 48, + "column": 3 }, "end": { - "line": 47, - "column": 35 + "line": 48, + "column": 9 } } }, @@ -9651,16 +7731,16 @@ "binop": null, "updateContext": null }, - "start": 1620, - "end": 1621, + "start": 1616, + "end": 1617, "loc": { "start": { - "line": 47, - "column": 35 + "line": 48, + "column": 9 }, "end": { - "line": 47, - "column": 36 + "line": 48, + "column": 10 } } }, @@ -9677,43 +7757,43 @@ "binop": null }, "value": "_color", - "start": 1621, - "end": 1627, + "start": 1617, + "end": 1623, "loc": { "start": { - "line": 47, - "column": 36 + "line": 48, + "column": 10 }, "end": { - "line": 47, - "column": 42 + "line": 48, + "column": 16 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1628, - "end": 1631, + "value": "=", + "start": 1624, + "end": 1625, "loc": { "start": { - "line": 47, - "column": 43 + "line": 48, + "column": 17 }, "end": { - "line": 47, - "column": 46 + "line": 48, + "column": 18 } } }, @@ -9730,22 +7810,49 @@ "binop": null }, "value": "BLACK", - "start": 1632, - "end": 1637, + "start": 1626, + "end": 1631, "loc": { "start": { - "line": 47, - "column": 47 + "line": 48, + "column": 19 }, "end": { - "line": 47, - "column": 52 + "line": 48, + "column": 24 } } }, { "type": { - "label": ")", + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1631, + "end": 1632, + "loc": { + "start": { + "line": 48, + "column": 24 + }, + "end": { + "line": 48, + "column": 25 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -9753,24 +7860,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1637, - "end": 1638, + "value": "if", + "start": 1635, + "end": 1637, "loc": { "start": { - "line": 47, - "column": 52 + "line": 50, + "column": 1 }, "end": { - "line": 47, - "column": 53 + "line": 50, + "column": 3 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -9780,16 +7889,69 @@ "postfix": false, "binop": null }, - "start": 1639, - "end": 1640, + "start": 1638, + "end": 1639, + "loc": { + "start": { + "line": 50, + "column": 4 + }, + "end": { + "line": 50, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 1639, + "end": 1640, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 6 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 1641, + "end": 1644, "loc": { "start": { - "line": 47, - "column": 54 + "line": 50, + "column": 7 }, "end": { - "line": 47, - "column": 55 + "line": 50, + "column": 10 } } }, @@ -9805,17 +7967,17 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1643, - "end": 1644, + "value": "n", + "start": 1645, + "end": 1646, "loc": { "start": { - "line": 48, - "column": 2 + "line": 50, + "column": 11 }, "end": { - "line": 48, - "column": 3 + "line": 50, + "column": 12 } } }, @@ -9832,16 +7994,16 @@ "binop": null, "updateContext": null }, - "start": 1644, - "end": 1645, + "start": 1646, + "end": 1647, "loc": { "start": { - "line": 48, - "column": 3 + "line": 50, + "column": 12 }, "end": { - "line": 48, - "column": 4 + "line": 50, + "column": 13 } } }, @@ -9857,44 +8019,43 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1645, - "end": 1651, + "value": "parent", + "start": 1647, + "end": 1653, "loc": { "start": { - "line": 48, - "column": 4 + "line": 50, + "column": 13 }, "end": { - "line": 48, - "column": 10 + "line": 50, + "column": 19 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 1652, - "end": 1653, + "start": 1653, + "end": 1654, "loc": { "start": { - "line": 48, - "column": 11 + "line": 50, + "column": 19 }, "end": { - "line": 48, - "column": 12 + "line": 50, + "column": 20 } } }, @@ -9910,51 +8071,25 @@ "postfix": false, "binop": null }, - "value": "RED", + "value": "left", "start": 1654, - "end": 1657, - "loc": { - "start": { - "line": 48, - "column": 13 - }, - "end": { - "line": 48, - "column": 16 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1657, "end": 1658, "loc": { "start": { - "line": 48, - "column": 16 + "line": 50, + "column": 20 }, "end": { - "line": 48, - "column": 17 + "line": 50, + "column": 24 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -9962,43 +8097,41 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1661, - "end": 1662, + "start": 1658, + "end": 1659, "loc": { "start": { - "line": 49, - "column": 2 + "line": 50, + "column": 24 }, "end": { - "line": 49, - "column": 3 + "line": 50, + "column": 25 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1662, - "end": 1663, + "start": 1660, + "end": 1661, "loc": { "start": { - "line": 49, - "column": 3 + "line": 50, + "column": 26 }, "end": { - "line": 49, - "column": 4 + "line": 50, + "column": 27 } } }, @@ -10014,42 +8147,41 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1663, - "end": 1667, + "value": "assert", + "start": 1664, + "end": 1670, "loc": { "start": { - "line": 49, - "column": 4 + "line": 51, + "column": 2 }, "end": { - "line": 49, + "line": 51, "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1667, - "end": 1668, + "start": 1670, + "end": 1671, "loc": { "start": { - "line": 49, + "line": 51, "column": 8 }, "end": { - "line": 49, + "line": 51, "column": 9 } } @@ -10066,44 +8198,43 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1668, - "end": 1674, + "value": "s", + "start": 1671, + "end": 1672, "loc": { "start": { - "line": 49, + "line": 51, "column": 9 }, "end": { - "line": 49, - "column": 15 + "line": 51, + "column": 10 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 1675, - "end": 1676, + "start": 1672, + "end": 1673, "loc": { "start": { - "line": 49, - "column": 16 + "line": 51, + "column": 10 }, "end": { - "line": 49, - "column": 17 + "line": 51, + "column": 11 } } }, @@ -10119,24 +8250,24 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1677, - "end": 1682, + "value": "right", + "start": 1673, + "end": 1678, "loc": { "start": { - "line": 49, - "column": 18 + "line": 51, + "column": 11 }, "end": { - "line": 49, - "column": 23 + "line": 51, + "column": 16 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -10146,16 +8277,16 @@ "binop": null, "updateContext": null }, - "start": 1682, - "end": 1683, + "start": 1678, + "end": 1679, "loc": { "start": { - "line": 49, - "column": 23 + "line": 51, + "column": 16 }, "end": { - "line": 49, - "column": 24 + "line": 51, + "column": 17 } } }, @@ -10171,42 +8302,44 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 1686, - "end": 1698, + "value": "_color", + "start": 1679, + "end": 1685, "loc": { "start": { - "line": 50, - "column": 2 + "line": 51, + "column": 17 }, "end": { - "line": 50, - "column": 14 + "line": 51, + "column": 23 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 1698, - "end": 1699, + "value": "===", + "start": 1686, + "end": 1689, "loc": { "start": { - "line": 50, - "column": 14 + "line": 51, + "column": 24 }, "end": { - "line": 50, - "column": 15 + "line": 51, + "column": 27 } } }, @@ -10222,17 +8355,17 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1699, - "end": 1700, + "value": "RED", + "start": 1690, + "end": 1693, "loc": { "start": { - "line": 50, - "column": 15 + "line": 51, + "column": 28 }, "end": { - "line": 50, - "column": 16 + "line": 51, + "column": 31 } } }, @@ -10248,16 +8381,16 @@ "postfix": false, "binop": null }, - "start": 1700, - "end": 1701, + "start": 1693, + "end": 1694, "loc": { "start": { - "line": 50, - "column": 16 + "line": 51, + "column": 31 }, "end": { - "line": 50, - "column": 17 + "line": 51, + "column": 32 } } }, @@ -10274,24 +8407,24 @@ "binop": null, "updateContext": null }, - "start": 1701, - "end": 1702, + "start": 1694, + "end": 1695, "loc": { "start": { - "line": 50, - "column": 17 + "line": 51, + "column": 32 }, "end": { - "line": 50, - "column": 18 + "line": 51, + "column": 33 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10299,24 +8432,24 @@ "postfix": false, "binop": null }, - "start": 1704, - "end": 1705, + "value": "s", + "start": 1698, + "end": 1699, "loc": { "start": { - "line": 51, - "column": 1 + "line": 52, + "column": 2 }, "end": { - "line": 51, - "column": 2 + "line": 52, + "column": 3 } } }, { "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -10326,70 +8459,68 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1706, - "end": 1710, + "start": 1699, + "end": 1700, "loc": { "start": { - "line": 51, + "line": 52, "column": 3 }, "end": { - "line": 51, - "column": 7 + "line": 52, + "column": 4 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1711, - "end": 1713, + "value": "right", + "start": 1700, + "end": 1705, "loc": { "start": { - "line": 51, - "column": 8 + "line": 52, + "column": 4 }, "end": { - "line": 51, - "column": 10 + "line": 52, + "column": 9 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1714, - "end": 1715, + "start": 1705, + "end": 1706, "loc": { "start": { - "line": 51, - "column": 11 + "line": 52, + "column": 9 }, "end": { - "line": 51, - "column": 12 + "line": 52, + "column": 10 } } }, @@ -10405,44 +8536,44 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1715, - "end": 1716, + "value": "_color", + "start": 1706, + "end": 1712, "loc": { "start": { - "line": 51, - "column": 12 + "line": 52, + "column": 10 }, "end": { - "line": 51, - "column": 13 + "line": 52, + "column": 16 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1717, - "end": 1720, + "value": "=", + "start": 1713, + "end": 1714, "loc": { "start": { - "line": 51, - "column": 14 + "line": 52, + "column": 17 }, "end": { - "line": 51, - "column": 17 + "line": 52, + "column": 18 } } }, @@ -10458,24 +8589,24 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1721, - "end": 1722, + "value": "BLACK", + "start": 1715, + "end": 1720, "loc": { "start": { - "line": 51, - "column": 18 + "line": 52, + "column": 19 }, "end": { - "line": 51, - "column": 19 + "line": 52, + "column": 24 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -10485,16 +8616,16 @@ "binop": null, "updateContext": null }, - "start": 1722, - "end": 1723, + "start": 1720, + "end": 1721, "loc": { "start": { - "line": 51, - "column": 19 + "line": 52, + "column": 24 }, "end": { - "line": 51, - "column": 20 + "line": 52, + "column": 25 } } }, @@ -10510,43 +8641,42 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1723, - "end": 1729, + "value": "rotate_left", + "start": 1724, + "end": 1735, "loc": { "start": { - "line": 51, - "column": 20 + "line": 53, + "column": 2 }, "end": { - "line": 51, - "column": 26 + "line": 53, + "column": 13 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1729, - "end": 1730, + "start": 1735, + "end": 1736, "loc": { "start": { - "line": 51, - "column": 26 + "line": 53, + "column": 13 }, "end": { - "line": 51, - "column": 27 + "line": 53, + "column": 14 } } }, @@ -10562,44 +8692,43 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1730, - "end": 1735, + "value": "n", + "start": 1736, + "end": 1737, "loc": { "start": { - "line": 51, - "column": 27 + "line": 53, + "column": 14 }, "end": { - "line": 51, - "column": 32 + "line": 53, + "column": 15 } } }, { "type": { - "label": "&&", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 2, + "binop": null, "updateContext": null }, - "value": "&&", - "start": 1736, + "start": 1737, "end": 1738, "loc": { "start": { - "line": 51, - "column": 33 + "line": 53, + "column": 15 }, "end": { - "line": 51, - "column": 35 + "line": 53, + "column": 16 } } }, @@ -10615,23 +8744,23 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1739, - "end": 1740, + "value": "parent", + "start": 1738, + "end": 1744, "loc": { "start": { - "line": 51, - "column": 36 + "line": 53, + "column": 16 }, "end": { - "line": 51, - "column": 37 + "line": 53, + "column": 22 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -10639,51 +8768,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1740, - "end": 1741, + "start": 1744, + "end": 1745, "loc": { "start": { - "line": 51, - "column": 37 + "line": 53, + "column": 22 }, "end": { - "line": 51, - "column": 38 + "line": 53, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "left", - "start": 1741, - "end": 1745, + "start": 1745, + "end": 1746, "loc": { "start": { - "line": 51, - "column": 38 + "line": 53, + "column": 23 }, "end": { - "line": 51, - "column": 42 + "line": 53, + "column": 24 } } }, { "type": { - "label": ".", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -10691,72 +8819,87 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1745, - "end": 1746, + "start": 1748, + "end": 1749, "loc": { "start": { - "line": 51, - "column": 42 + "line": 54, + "column": 1 }, "end": { - "line": 51, - "column": 43 + "line": 54, + "column": 2 + } + } + }, + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1752, + "end": 1769, + "loc": { + "start": { + "line": 56, + "column": 1 + }, + "end": { + "line": 56, + "column": 18 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_color", - "start": 1746, - "end": 1752, + "value": "else", + "start": 1771, + "end": 1775, "loc": { "start": { - "line": 51, - "column": 43 + "line": 57, + "column": 1 }, "end": { - "line": 51, - "column": 49 + "line": 57, + "column": 5 } } }, { "type": { - "label": "==/!=", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 1753, - "end": 1756, + "start": 1776, + "end": 1777, "loc": { "start": { - "line": 51, - "column": 50 + "line": 57, + "column": 6 }, "end": { - "line": 51, - "column": 53 + "line": 57, + "column": 7 } } }, @@ -10772,25 +8915,25 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1757, - "end": 1762, + "value": "assert", + "start": 1780, + "end": 1786, "loc": { "start": { - "line": 51, - "column": 54 + "line": 58, + "column": 2 }, "end": { - "line": 51, - "column": 59 + "line": 58, + "column": 8 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10798,23 +8941,23 @@ "postfix": false, "binop": null }, - "start": 1762, - "end": 1763, + "start": 1786, + "end": 1787, "loc": { "start": { - "line": 51, - "column": 59 + "line": 58, + "column": 8 }, "end": { - "line": 51, - "column": 60 + "line": 58, + "column": 9 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -10823,32 +8966,43 @@ "postfix": false, "binop": null }, - "start": 1764, - "end": 1765, + "value": "s", + "start": 1787, + "end": 1788, "loc": { "start": { - "line": 51, - "column": 61 + "line": 58, + "column": 9 }, "end": { - "line": 51, - "column": 62 + "line": 58, + "column": 10 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t ", - "start": 1768, - "end": 2141, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1788, + "end": 1789, "loc": { "start": { - "line": 52, - "column": 2 + "line": 58, + "column": 10 }, "end": { - "line": 62, - "column": 5 + "line": 58, + "column": 11 } } }, @@ -10864,17 +9018,17 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 2144, - "end": 2145, + "value": "left", + "start": 1789, + "end": 1793, "loc": { "start": { - "line": 63, - "column": 2 + "line": 58, + "column": 11 }, "end": { - "line": 63, - "column": 3 + "line": 58, + "column": 15 } } }, @@ -10891,16 +9045,16 @@ "binop": null, "updateContext": null }, - "start": 2145, - "end": 2146, + "start": 1793, + "end": 1794, "loc": { "start": { - "line": 63, - "column": 3 + "line": 58, + "column": 15 }, "end": { - "line": 63, - "column": 4 + "line": 58, + "column": 16 } } }, @@ -10917,43 +9071,43 @@ "binop": null }, "value": "_color", - "start": 2146, - "end": 2152, + "start": 1794, + "end": 1800, "loc": { "start": { - "line": 63, - "column": 4 + "line": 58, + "column": 16 }, "end": { - "line": 63, - "column": 10 + "line": 58, + "column": 22 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 2153, - "end": 2154, + "value": "===", + "start": 1801, + "end": 1804, "loc": { "start": { - "line": 63, - "column": 11 + "line": 58, + "column": 23 }, "end": { - "line": 63, - "column": 12 + "line": 58, + "column": 26 } } }, @@ -10970,16 +9124,41 @@ "binop": null }, "value": "RED", - "start": 2155, - "end": 2158, + "start": 1805, + "end": 1808, "loc": { "start": { - "line": 63, - "column": 13 + "line": 58, + "column": 27 }, "end": { - "line": 63, - "column": 16 + "line": 58, + "column": 30 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1808, + "end": 1809, + "loc": { + "start": { + "line": 58, + "column": 30 + }, + "end": { + "line": 58, + "column": 31 } } }, @@ -10996,16 +9175,16 @@ "binop": null, "updateContext": null }, - "start": 2158, - "end": 2159, + "start": 1809, + "end": 1810, "loc": { "start": { - "line": 63, - "column": 16 + "line": 58, + "column": 31 }, "end": { - "line": 63, - "column": 17 + "line": 58, + "column": 32 } } }, @@ -11022,15 +9201,15 @@ "binop": null }, "value": "s", - "start": 2162, - "end": 2163, + "start": 1813, + "end": 1814, "loc": { "start": { - "line": 64, + "line": 59, "column": 2 }, "end": { - "line": 64, + "line": 59, "column": 3 } } @@ -11048,15 +9227,15 @@ "binop": null, "updateContext": null }, - "start": 2163, - "end": 2164, + "start": 1814, + "end": 1815, "loc": { "start": { - "line": 64, + "line": 59, "column": 3 }, "end": { - "line": 64, + "line": 59, "column": 4 } } @@ -11073,17 +9252,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 2164, - "end": 2169, + "value": "left", + "start": 1815, + "end": 1819, "loc": { "start": { - "line": 64, + "line": 59, "column": 4 }, "end": { - "line": 64, - "column": 9 + "line": 59, + "column": 8 } } }, @@ -11100,16 +9279,16 @@ "binop": null, "updateContext": null }, - "start": 2169, - "end": 2170, + "start": 1819, + "end": 1820, "loc": { "start": { - "line": 64, - "column": 9 + "line": 59, + "column": 8 }, "end": { - "line": 64, - "column": 10 + "line": 59, + "column": 9 } } }, @@ -11126,16 +9305,16 @@ "binop": null }, "value": "_color", - "start": 2170, - "end": 2176, + "start": 1820, + "end": 1826, "loc": { "start": { - "line": 64, - "column": 10 + "line": 59, + "column": 9 }, "end": { - "line": 64, - "column": 16 + "line": 59, + "column": 15 } } }, @@ -11153,16 +9332,16 @@ "updateContext": null }, "value": "=", - "start": 2177, - "end": 2178, + "start": 1827, + "end": 1828, "loc": { "start": { - "line": 64, - "column": 17 + "line": 59, + "column": 16 }, "end": { - "line": 64, - "column": 18 + "line": 59, + "column": 17 } } }, @@ -11179,16 +9358,16 @@ "binop": null }, "value": "BLACK", - "start": 2179, - "end": 2184, + "start": 1829, + "end": 1834, "loc": { "start": { - "line": 64, - "column": 19 + "line": 59, + "column": 18 }, "end": { - "line": 64, - "column": 24 + "line": 59, + "column": 23 } } }, @@ -11205,16 +9384,16 @@ "binop": null, "updateContext": null }, - "start": 2184, - "end": 2185, + "start": 1834, + "end": 1835, "loc": { "start": { - "line": 64, - "column": 24 + "line": 59, + "column": 23 }, "end": { - "line": 64, - "column": 25 + "line": 59, + "column": 24 } } }, @@ -11230,17 +9409,17 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 2188, - "end": 2199, + "value": "rotate_right", + "start": 1838, + "end": 1850, "loc": { "start": { - "line": 65, + "line": 60, "column": 2 }, "end": { - "line": 65, - "column": 13 + "line": 60, + "column": 14 } } }, @@ -11256,50 +9435,24 @@ "postfix": false, "binop": null }, - "start": 2199, - "end": 2200, - "loc": { - "start": { - "line": 65, - "column": 13 - }, - "end": { - "line": 65, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 2200, - "end": 2201, + "start": 1850, + "end": 1851, "loc": { "start": { - "line": 65, + "line": 60, "column": 14 }, "end": { - "line": 65, + "line": 60, "column": 15 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11307,23 +9460,24 @@ "postfix": false, "binop": null }, - "start": 2201, - "end": 2202, + "value": "n", + "start": 1851, + "end": 1852, "loc": { "start": { - "line": 65, + "line": 60, "column": 15 }, "end": { - "line": 65, + "line": 60, "column": 16 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -11333,44 +9487,19 @@ "binop": null, "updateContext": null }, - "start": 2202, - "end": 2203, + "start": 1852, + "end": 1853, "loc": { "start": { - "line": 65, + "line": 60, "column": 16 }, "end": { - "line": 65, + "line": 60, "column": 17 } } }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 2205, - "end": 2206, - "loc": { - "start": { - "line": 66, - "column": 1 - }, - "end": { - "line": 66, - "column": 2 - } - } - }, { "type": { "label": "name", @@ -11383,50 +9512,25 @@ "postfix": false, "binop": null }, - "value": "delete_case6", - "start": 2209, - "end": 2221, - "loc": { - "start": { - "line": 68, - "column": 1 - }, - "end": { - "line": 68, - "column": 13 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 2221, - "end": 2222, + "value": "parent", + "start": 1853, + "end": 1859, "loc": { "start": { - "line": 68, - "column": 13 + "line": 60, + "column": 17 }, "end": { - "line": 68, - "column": 14 + "line": 60, + "column": 23 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11434,68 +9538,67 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 2222, - "end": 2223, + "start": 1859, + "end": 1860, "loc": { "start": { - "line": 68, - "column": 14 + "line": 60, + "column": 23 }, "end": { - "line": 68, - "column": 15 + "line": 60, + "column": 24 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2223, - "end": 2224, + "start": 1860, + "end": 1861, "loc": { "start": { - "line": 68, - "column": 15 + "line": 60, + "column": 24 }, "end": { - "line": 68, - "column": 16 + "line": 60, + "column": 25 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2224, - "end": 2225, + "start": 1863, + "end": 1864, "loc": { "start": { - "line": 68, - "column": 16 + "line": 61, + "column": 1 }, "end": { - "line": 68, - "column": 17 + "line": 61, + "column": 2 } } }, @@ -11511,15 +9614,15 @@ "postfix": false, "binop": null }, - "start": 2226, - "end": 2227, + "start": 1865, + "end": 1866, "loc": { "start": { - "line": 69, + "line": 62, "column": 0 }, "end": { - "line": 69, + "line": 62, "column": 1 } } @@ -11537,15 +9640,15 @@ "binop": null, "updateContext": null }, - "start": 2227, - "end": 2228, + "start": 1866, + "end": 1867, "loc": { "start": { - "line": 69, + "line": 62, "column": 1 }, "end": { - "line": 69, + "line": 62, "column": 2 } } @@ -11565,15 +9668,15 @@ "updateContext": null }, "value": "export", - "start": 2230, - "end": 2236, + "start": 1869, + "end": 1875, "loc": { "start": { - "line": 71, + "line": 64, "column": 0 }, "end": { - "line": 71, + "line": 64, "column": 6 } } @@ -11593,15 +9696,15 @@ "updateContext": null }, "value": "default", - "start": 2237, - "end": 2244, + "start": 1876, + "end": 1883, "loc": { "start": { - "line": 71, + "line": 64, "column": 7 }, "end": { - "line": 71, + "line": 64, "column": 14 } } @@ -11619,15 +9722,15 @@ "binop": null }, "value": "delete_case5", - "start": 2245, - "end": 2257, + "start": 1884, + "end": 1896, "loc": { "start": { - "line": 71, + "line": 64, "column": 15 }, "end": { - "line": 71, + "line": 64, "column": 27 } } @@ -11645,15 +9748,15 @@ "binop": null, "updateContext": null }, - "start": 2257, - "end": 2258, + "start": 1896, + "end": 1897, "loc": { "start": { - "line": 71, + "line": 64, "column": 27 }, "end": { - "line": 71, + "line": 64, "column": 28 } } @@ -11671,15 +9774,15 @@ "binop": null, "updateContext": null }, - "start": 2259, - "end": 2259, + "start": 1898, + "end": 1898, "loc": { "start": { - "line": 72, + "line": 65, "column": 0 }, "end": { - "line": 72, + "line": 65, "column": 0 } } diff --git a/ast/source/deletion/delete_case6.js.json b/ast/source/deletion/delete_case6.js.json deleted file mode 100644 index a4e5b6f..0000000 --- a/ast/source/deletion/delete_case6.js.json +++ /dev/null @@ -1,10232 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 1961, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 66, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 1961, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 66, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ImportDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "local": { - "type": "Identifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "assert" - }, - "name": "assert" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "extra": { - "rawValue": "assert", - "raw": "'assert'" - }, - "value": "assert" - } - }, - { - "type": "ImportDeclaration", - "start": 29, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "local": { - "type": "Identifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 47, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - }, - "extra": { - "rawValue": "../color/BLACK.js", - "raw": "'../color/BLACK.js'" - }, - "value": "../color/BLACK.js" - } - }, - { - "type": "ImportDeclaration", - "start": 68, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 34 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 10 - } - }, - "local": { - "type": "Identifier", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 10 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 84, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 33 - } - }, - "extra": { - "rawValue": "../color/RED.js", - "raw": "'../color/RED.js'" - }, - "value": "../color/RED.js" - } - }, - { - "type": "ImportDeclaration", - "start": 103, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 110, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 110, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 120, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Node.js", - "raw": "'../types/Node.js'" - }, - "value": "../types/Node.js" - } - }, - { - "type": "ImportDeclaration", - "start": 140, - "end": 176, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" - } - }, - { - "type": "ImportDeclaration", - "start": 177, - "end": 228, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 51 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 184, - "end": 195, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 18 - } - }, - "local": { - "type": "Identifier", - "start": 184, - "end": 195, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 18 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 201, - "end": 227, - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 50 - } - }, - "extra": { - "rawValue": "../rotate/rotate_left.js", - "raw": "'../rotate/rotate_left.js'" - }, - "value": "../rotate/rotate_left.js" - } - }, - { - "type": "ImportDeclaration", - "start": 229, - "end": 282, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 53 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 236, - "end": 248, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 236, - "end": 248, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 19 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 254, - "end": 281, - "loc": { - "start": { - "line": 7, - "column": 25 - }, - "end": { - "line": 7, - "column": 52 - } - }, - "extra": { - "rawValue": "../rotate/rotate_right.js", - "raw": "'../rotate/rotate_right.js'" - }, - "value": "../rotate/rotate_right.js" - } - }, - { - "type": "ImportDeclaration", - "start": 283, - "end": 326, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 43 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 290, - "end": 297, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 14 - } - }, - "local": { - "type": "Identifier", - "start": 290, - "end": 297, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 14 - }, - "identifierName": "sibling" - }, - "name": "sibling" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 303, - "end": 325, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 42 - } - }, - "extra": { - "rawValue": "../family/sibling.js", - "raw": "'../family/sibling.js'" - }, - "value": "../family/sibling.js" - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 328, - "end": 733, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 21, - "column": 3 - } - } - } - ] - }, - { - "type": "Identifier", - "start": 734, - "end": 1930, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 63, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 740, - "end": 1929, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 63, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 740, - "end": 752, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 18 - }, - "identifierName": "delete_case6" - }, - "name": "delete_case6", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 755, - "end": 1929, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 63, - "column": 1 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 756, - "end": 757, - "loc": { - "start": { - "line": 22, - "column": 22 - }, - "end": { - "line": 22, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 762, - "end": 1929, - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 63, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 765, - "end": 812, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 48 - } - }, - "expression": { - "type": "CallExpression", - "start": 765, - "end": 811, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 47 - } - }, - "callee": { - "type": "Identifier", - "start": 765, - "end": 771, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 772, - "end": 810, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 46 - } - }, - "left": { - "type": "BinaryExpression", - "start": 772, - "end": 789, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 772, - "end": 773, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 785, - "end": 789, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 793, - "end": 810, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 793, - "end": 794, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 806, - "end": 810, - "loc": { - "start": { - "line": 23, - "column": 42 - }, - "end": { - "line": 23, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 814, - "end": 841, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 814, - "end": 840, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 814, - "end": 820, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 821, - "end": 839, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 821, - "end": 829, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 821, - "end": 822, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 823, - "end": 829, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 834, - "end": 839, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 843, - "end": 869, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 843, - "end": 868, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 843, - "end": 849, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 850, - "end": 867, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 850, - "end": 858, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 850, - "end": 851, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 852, - "end": 858, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 16 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 863, - "end": 867, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 25 - } - } - } - } - ] - } - }, - { - "type": "VariableDeclaration", - "start": 871, - "end": 892, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 22 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 877, - "end": 891, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "start": 877, - "end": 878, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 8 - }, - "identifierName": "s" - }, - "name": "s" - }, - "init": { - "type": "CallExpression", - "start": 881, - "end": 891, - "loc": { - "start": { - "line": 26, - "column": 11 - }, - "end": { - "line": 26, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 881, - "end": 888, - "loc": { - "start": { - "line": 26, - "column": 11 - }, - "end": { - "line": 26, - "column": 18 - }, - "identifierName": "sibling" - }, - "name": "sibling" - }, - "arguments": [ - { - "type": "Identifier", - "start": 889, - "end": 890, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 894, - "end": 920, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 894, - "end": 919, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 894, - "end": 900, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 901, - "end": 918, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 901, - "end": 902, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 914, - "end": 918, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 922, - "end": 949, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 922, - "end": 948, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 922, - "end": 928, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 929, - "end": 947, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 929, - "end": 937, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 929, - "end": 930, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 931, - "end": 937, - "loc": { - "start": { - "line": 28, - "column": 10 - }, - "end": { - "line": 28, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 942, - "end": 947, - "loc": { - "start": { - "line": 28, - "column": 21 - }, - "end": { - "line": 28, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 952, - "end": 1639, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1642, - "end": 1669, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 28 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1642, - "end": 1668, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 27 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1642, - "end": 1650, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1642, - "end": 1643, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 2 - }, - "identifierName": "s" - }, - "name": "s", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1644, - "end": 1650, - "loc": { - "start": { - "line": 48, - "column": 3 - }, - "end": { - "line": 48, - "column": 9 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "MemberExpression", - "start": 1653, - "end": 1668, - "loc": { - "start": { - "line": 48, - "column": 12 - }, - "end": { - "line": 48, - "column": 27 - } - }, - "object": { - "type": "MemberExpression", - "start": 1653, - "end": 1661, - "loc": { - "start": { - "line": 48, - "column": 12 - }, - "end": { - "line": 48, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 1653, - "end": 1654, - "loc": { - "start": { - "line": 48, - "column": 12 - }, - "end": { - "line": 48, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1655, - "end": 1661, - "loc": { - "start": { - "line": 48, - "column": 14 - }, - "end": { - "line": 48, - "column": 20 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1662, - "end": 1668, - "loc": { - "start": { - "line": 48, - "column": 21 - }, - "end": { - "line": 48, - "column": 27 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 952, - "end": 1639, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1671, - "end": 1695, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 25 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1671, - "end": 1694, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 24 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1671, - "end": 1686, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 1671, - "end": 1679, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1671, - "end": 1672, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 2 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1673, - "end": 1679, - "loc": { - "start": { - "line": 49, - "column": 3 - }, - "end": { - "line": 49, - "column": 9 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1680, - "end": 1686, - "loc": { - "start": { - "line": 49, - "column": 10 - }, - "end": { - "line": 49, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1689, - "end": 1694, - "loc": { - "start": { - "line": 49, - "column": 19 - }, - "end": { - "line": 49, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - { - "type": "IfStatement", - "start": 1698, - "end": 1927, - "loc": { - "start": { - "line": 51, - "column": 1 - }, - "end": { - "line": 62, - "column": 2 - } - }, - "test": { - "type": "BinaryExpression", - "start": 1702, - "end": 1721, - "loc": { - "start": { - "line": 51, - "column": 5 - }, - "end": { - "line": 51, - "column": 24 - } - }, - "left": { - "type": "Identifier", - "start": 1702, - "end": 1703, - "loc": { - "start": { - "line": 51, - "column": 5 - }, - "end": { - "line": 51, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1708, - "end": 1721, - "loc": { - "start": { - "line": 51, - "column": 11 - }, - "end": { - "line": 51, - "column": 24 - } - }, - "object": { - "type": "MemberExpression", - "start": 1708, - "end": 1716, - "loc": { - "start": { - "line": 51, - "column": 11 - }, - "end": { - "line": 51, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 1708, - "end": 1709, - "loc": { - "start": { - "line": 51, - "column": 11 - }, - "end": { - "line": 51, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1710, - "end": 1716, - "loc": { - "start": { - "line": 51, - "column": 13 - }, - "end": { - "line": 51, - "column": 19 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1717, - "end": 1721, - "loc": { - "start": { - "line": 51, - "column": 20 - }, - "end": { - "line": 51, - "column": 24 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - }, - "consequent": { - "type": "BlockStatement", - "start": 1723, - "end": 1812, - "loc": { - "start": { - "line": 51, - "column": 26 - }, - "end": { - "line": 55, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1727, - "end": 1758, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 1727, - "end": 1757, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 1727, - "end": 1733, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1734, - "end": 1756, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 1734, - "end": 1748, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 1734, - "end": 1741, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 1734, - "end": 1735, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 10 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1736, - "end": 1741, - "loc": { - "start": { - "line": 52, - "column": 11 - }, - "end": { - "line": 52, - "column": 16 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1742, - "end": 1748, - "loc": { - "start": { - "line": 52, - "column": 17 - }, - "end": { - "line": 52, - "column": 23 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1753, - "end": 1756, - "loc": { - "start": { - "line": 52, - "column": 28 - }, - "end": { - "line": 52, - "column": 31 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 1761, - "end": 1784, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 25 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1761, - "end": 1783, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 24 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1761, - "end": 1775, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 1761, - "end": 1768, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1761, - "end": 1762, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1763, - "end": 1768, - "loc": { - "start": { - "line": 53, - "column": 4 - }, - "end": { - "line": 53, - "column": 9 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1769, - "end": 1775, - "loc": { - "start": { - "line": 53, - "column": 10 - }, - "end": { - "line": 53, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1778, - "end": 1783, - "loc": { - "start": { - "line": 53, - "column": 19 - }, - "end": { - "line": 53, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1787, - "end": 1809, - "loc": { - "start": { - "line": 54, - "column": 2 - }, - "end": { - "line": 54, - "column": 24 - } - }, - "expression": { - "type": "CallExpression", - "start": 1787, - "end": 1808, - "loc": { - "start": { - "line": 54, - "column": 2 - }, - "end": { - "line": 54, - "column": 23 - } - }, - "callee": { - "type": "Identifier", - "start": 1787, - "end": 1798, - "loc": { - "start": { - "line": 54, - "column": 2 - }, - "end": { - "line": 54, - "column": 13 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1799, - "end": 1807, - "loc": { - "start": { - "line": 54, - "column": 14 - }, - "end": { - "line": 54, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 1799, - "end": 1800, - "loc": { - "start": { - "line": 54, - "column": 14 - }, - "end": { - "line": 54, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1801, - "end": 1807, - "loc": { - "start": { - "line": 54, - "column": 16 - }, - "end": { - "line": 54, - "column": 22 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } - } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1815, - "end": 1832, - "loc": { - "start": { - "line": 57, - "column": 1 - }, - "end": { - "line": 57, - "column": 18 - } - } - } - ] - }, - "alternate": { - "type": "BlockStatement", - "start": 1839, - "end": 1927, - "loc": { - "start": { - "line": 58, - "column": 6 - }, - "end": { - "line": 62, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1843, - "end": 1873, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 32 - } - }, - "expression": { - "type": "CallExpression", - "start": 1843, - "end": 1872, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 1843, - "end": 1849, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert", - "leadingComments": null - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1850, - "end": 1871, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 30 - } - }, - "left": { - "type": "MemberExpression", - "start": 1850, - "end": 1863, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 1850, - "end": 1856, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 1850, - "end": 1851, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 10 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1852, - "end": 1856, - "loc": { - "start": { - "line": 59, - "column": 11 - }, - "end": { - "line": 59, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1857, - "end": 1863, - "loc": { - "start": { - "line": 59, - "column": 16 - }, - "end": { - "line": 59, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1868, - "end": 1871, - "loc": { - "start": { - "line": 59, - "column": 27 - }, - "end": { - "line": 59, - "column": 30 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ], - "leadingComments": null - }, - "leadingComments": null - }, - { - "type": "ExpressionStatement", - "start": 1876, - "end": 1898, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 24 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1876, - "end": 1897, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 23 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1876, - "end": 1889, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 15 - } - }, - "object": { - "type": "MemberExpression", - "start": 1876, - "end": 1882, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1876, - "end": 1877, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1878, - "end": 1882, - "loc": { - "start": { - "line": 60, - "column": 4 - }, - "end": { - "line": 60, - "column": 8 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1883, - "end": 1889, - "loc": { - "start": { - "line": 60, - "column": 9 - }, - "end": { - "line": 60, - "column": 15 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1892, - "end": 1897, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 23 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1901, - "end": 1924, - "loc": { - "start": { - "line": 61, - "column": 2 - }, - "end": { - "line": 61, - "column": 25 - } - }, - "expression": { - "type": "CallExpression", - "start": 1901, - "end": 1923, - "loc": { - "start": { - "line": 61, - "column": 2 - }, - "end": { - "line": 61, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 1901, - "end": 1913, - "loc": { - "start": { - "line": 61, - "column": 2 - }, - "end": { - "line": 61, - "column": 14 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1914, - "end": 1922, - "loc": { - "start": { - "line": 61, - "column": 15 - }, - "end": { - "line": 61, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1914, - "end": 1915, - "loc": { - "start": { - "line": 61, - "column": 15 - }, - "end": { - "line": 61, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1916, - "end": 1922, - "loc": { - "start": { - "line": 61, - "column": 17 - }, - "end": { - "line": 61, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } - } - ], - "directives": [], - "leadingComments": [ - { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1815, - "end": 1832, - "loc": { - "start": { - "line": 57, - "column": 1 - }, - "end": { - "line": 57, - "column": 18 - } - } - } - ] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [], - "name": "_", - "trailingComments": [] - }, - { - "type": "Identifier", - "start": 1932, - "end": 1960, - "loc": { - "start": { - "line": 65, - "column": 0 - }, - "end": { - "line": 65, - "column": 28 - } - }, - "declaration": { - "type": "Identifier", - "start": 1947, - "end": 1959, - "loc": { - "start": { - "line": 65, - "column": 15 - }, - "end": { - "line": 65, - "column": 27 - }, - "identifierName": "delete_case6" - }, - "name": "delete_case6" - }, - "name": "_", - "leadingComments": [], - "trailingComments": [] - }, - { - "type": "ExportDefaultDeclaration", - "start": 1932, - "end": 1960, - "loc": { - "start": { - "line": 65, - "column": 0 - }, - "end": { - "line": 65, - "column": 28 - } - }, - "declaration": { - "type": "VariableDeclaration", - "start": 734, - "end": 1930, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 63, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 740, - "end": 1929, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 63, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 740, - "end": 752, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 18 - }, - "identifierName": "delete_case6" - }, - "name": "delete_case6", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 755, - "end": 1929, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 63, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 740, - "end": 752, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 18 - }, - "identifierName": "delete_case6" - }, - "name": "delete_case6", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 756, - "end": 757, - "loc": { - "start": { - "line": 22, - "column": 22 - }, - "end": { - "line": 22, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 762, - "end": 1929, - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 63, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 765, - "end": 812, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 48 - } - }, - "expression": { - "type": "CallExpression", - "start": 765, - "end": 811, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 47 - } - }, - "callee": { - "type": "Identifier", - "start": 765, - "end": 771, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 772, - "end": 810, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 46 - } - }, - "left": { - "type": "BinaryExpression", - "start": 772, - "end": 789, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 772, - "end": 773, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 785, - "end": 789, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 793, - "end": 810, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 793, - "end": 794, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 806, - "end": 810, - "loc": { - "start": { - "line": 23, - "column": 42 - }, - "end": { - "line": 23, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 814, - "end": 841, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 814, - "end": 840, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 814, - "end": 820, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 821, - "end": 839, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 821, - "end": 829, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 821, - "end": 822, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 823, - "end": 829, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 834, - "end": 839, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 843, - "end": 869, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 843, - "end": 868, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 843, - "end": 849, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 850, - "end": 867, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 850, - "end": 858, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 850, - "end": 851, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 852, - "end": 858, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 16 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 863, - "end": 867, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 25 - } - } - } - } - ] - } - }, - { - "type": "VariableDeclaration", - "start": 871, - "end": 892, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 22 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 877, - "end": 891, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "start": 877, - "end": 878, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 8 - }, - "identifierName": "s" - }, - "name": "s" - }, - "init": { - "type": "CallExpression", - "start": 881, - "end": 891, - "loc": { - "start": { - "line": 26, - "column": 11 - }, - "end": { - "line": 26, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 881, - "end": 888, - "loc": { - "start": { - "line": 26, - "column": 11 - }, - "end": { - "line": 26, - "column": 18 - }, - "identifierName": "sibling" - }, - "name": "sibling" - }, - "arguments": [ - { - "type": "Identifier", - "start": 889, - "end": 890, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 894, - "end": 920, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 894, - "end": 919, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 894, - "end": 900, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 901, - "end": 918, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 901, - "end": 902, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 914, - "end": 918, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 922, - "end": 949, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 922, - "end": 948, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 922, - "end": 928, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 929, - "end": 947, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 929, - "end": 937, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 929, - "end": 930, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 931, - "end": 937, - "loc": { - "start": { - "line": 28, - "column": 10 - }, - "end": { - "line": 28, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 942, - "end": 947, - "loc": { - "start": { - "line": 28, - "column": 21 - }, - "end": { - "line": 28, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 952, - "end": 1639, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1642, - "end": 1669, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 28 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1642, - "end": 1668, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 27 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1642, - "end": 1650, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1642, - "end": 1643, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 2 - }, - "identifierName": "s" - }, - "name": "s", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1644, - "end": 1650, - "loc": { - "start": { - "line": 48, - "column": 3 - }, - "end": { - "line": 48, - "column": 9 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "MemberExpression", - "start": 1653, - "end": 1668, - "loc": { - "start": { - "line": 48, - "column": 12 - }, - "end": { - "line": 48, - "column": 27 - } - }, - "object": { - "type": "MemberExpression", - "start": 1653, - "end": 1661, - "loc": { - "start": { - "line": 48, - "column": 12 - }, - "end": { - "line": 48, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 1653, - "end": 1654, - "loc": { - "start": { - "line": 48, - "column": 12 - }, - "end": { - "line": 48, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1655, - "end": 1661, - "loc": { - "start": { - "line": 48, - "column": 14 - }, - "end": { - "line": 48, - "column": 20 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1662, - "end": 1668, - "loc": { - "start": { - "line": 48, - "column": 21 - }, - "end": { - "line": 48, - "column": 27 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 952, - "end": 1639, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1671, - "end": 1695, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 25 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1671, - "end": 1694, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 24 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1671, - "end": 1686, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 1671, - "end": 1679, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1671, - "end": 1672, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 2 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1673, - "end": 1679, - "loc": { - "start": { - "line": 49, - "column": 3 - }, - "end": { - "line": 49, - "column": 9 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1680, - "end": 1686, - "loc": { - "start": { - "line": 49, - "column": 10 - }, - "end": { - "line": 49, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1689, - "end": 1694, - "loc": { - "start": { - "line": 49, - "column": 19 - }, - "end": { - "line": 49, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - { - "type": "IfStatement", - "start": 1698, - "end": 1927, - "loc": { - "start": { - "line": 51, - "column": 1 - }, - "end": { - "line": 62, - "column": 2 - } - }, - "test": { - "type": "BinaryExpression", - "start": 1702, - "end": 1721, - "loc": { - "start": { - "line": 51, - "column": 5 - }, - "end": { - "line": 51, - "column": 24 - } - }, - "left": { - "type": "Identifier", - "start": 1702, - "end": 1703, - "loc": { - "start": { - "line": 51, - "column": 5 - }, - "end": { - "line": 51, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1708, - "end": 1721, - "loc": { - "start": { - "line": 51, - "column": 11 - }, - "end": { - "line": 51, - "column": 24 - } - }, - "object": { - "type": "MemberExpression", - "start": 1708, - "end": 1716, - "loc": { - "start": { - "line": 51, - "column": 11 - }, - "end": { - "line": 51, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 1708, - "end": 1709, - "loc": { - "start": { - "line": 51, - "column": 11 - }, - "end": { - "line": 51, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1710, - "end": 1716, - "loc": { - "start": { - "line": 51, - "column": 13 - }, - "end": { - "line": 51, - "column": 19 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1717, - "end": 1721, - "loc": { - "start": { - "line": 51, - "column": 20 - }, - "end": { - "line": 51, - "column": 24 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - }, - "consequent": { - "type": "BlockStatement", - "start": 1723, - "end": 1812, - "loc": { - "start": { - "line": 51, - "column": 26 - }, - "end": { - "line": 55, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1727, - "end": 1758, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 1727, - "end": 1757, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 1727, - "end": 1733, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1734, - "end": 1756, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 1734, - "end": 1748, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 1734, - "end": 1741, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 1734, - "end": 1735, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 10 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1736, - "end": 1741, - "loc": { - "start": { - "line": 52, - "column": 11 - }, - "end": { - "line": 52, - "column": 16 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1742, - "end": 1748, - "loc": { - "start": { - "line": 52, - "column": 17 - }, - "end": { - "line": 52, - "column": 23 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1753, - "end": 1756, - "loc": { - "start": { - "line": 52, - "column": 28 - }, - "end": { - "line": 52, - "column": 31 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 1761, - "end": 1784, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 25 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1761, - "end": 1783, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 24 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1761, - "end": 1775, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 1761, - "end": 1768, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1761, - "end": 1762, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1763, - "end": 1768, - "loc": { - "start": { - "line": 53, - "column": 4 - }, - "end": { - "line": 53, - "column": 9 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1769, - "end": 1775, - "loc": { - "start": { - "line": 53, - "column": 10 - }, - "end": { - "line": 53, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1778, - "end": 1783, - "loc": { - "start": { - "line": 53, - "column": 19 - }, - "end": { - "line": 53, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1787, - "end": 1809, - "loc": { - "start": { - "line": 54, - "column": 2 - }, - "end": { - "line": 54, - "column": 24 - } - }, - "expression": { - "type": "CallExpression", - "start": 1787, - "end": 1808, - "loc": { - "start": { - "line": 54, - "column": 2 - }, - "end": { - "line": 54, - "column": 23 - } - }, - "callee": { - "type": "Identifier", - "start": 1787, - "end": 1798, - "loc": { - "start": { - "line": 54, - "column": 2 - }, - "end": { - "line": 54, - "column": 13 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1799, - "end": 1807, - "loc": { - "start": { - "line": 54, - "column": 14 - }, - "end": { - "line": 54, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 1799, - "end": 1800, - "loc": { - "start": { - "line": 54, - "column": 14 - }, - "end": { - "line": 54, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1801, - "end": 1807, - "loc": { - "start": { - "line": 54, - "column": 16 - }, - "end": { - "line": 54, - "column": 22 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } - } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1815, - "end": 1832, - "loc": { - "start": { - "line": 57, - "column": 1 - }, - "end": { - "line": 57, - "column": 18 - } - } - } - ] - }, - "alternate": { - "type": "BlockStatement", - "start": 1839, - "end": 1927, - "loc": { - "start": { - "line": 58, - "column": 6 - }, - "end": { - "line": 62, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1843, - "end": 1873, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 32 - } - }, - "expression": { - "type": "CallExpression", - "start": 1843, - "end": 1872, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 1843, - "end": 1849, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert", - "leadingComments": null - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1850, - "end": 1871, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 30 - } - }, - "left": { - "type": "MemberExpression", - "start": 1850, - "end": 1863, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 1850, - "end": 1856, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 1850, - "end": 1851, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 10 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1852, - "end": 1856, - "loc": { - "start": { - "line": 59, - "column": 11 - }, - "end": { - "line": 59, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1857, - "end": 1863, - "loc": { - "start": { - "line": 59, - "column": 16 - }, - "end": { - "line": 59, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1868, - "end": 1871, - "loc": { - "start": { - "line": 59, - "column": 27 - }, - "end": { - "line": 59, - "column": 30 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ], - "leadingComments": null - }, - "leadingComments": null - }, - { - "type": "ExpressionStatement", - "start": 1876, - "end": 1898, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 24 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1876, - "end": 1897, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 23 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1876, - "end": 1889, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 15 - } - }, - "object": { - "type": "MemberExpression", - "start": 1876, - "end": 1882, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1876, - "end": 1877, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1878, - "end": 1882, - "loc": { - "start": { - "line": 60, - "column": 4 - }, - "end": { - "line": 60, - "column": 8 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1883, - "end": 1889, - "loc": { - "start": { - "line": 60, - "column": 9 - }, - "end": { - "line": 60, - "column": 15 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1892, - "end": 1897, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 23 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1901, - "end": 1924, - "loc": { - "start": { - "line": 61, - "column": 2 - }, - "end": { - "line": 61, - "column": 25 - } - }, - "expression": { - "type": "CallExpression", - "start": 1901, - "end": 1923, - "loc": { - "start": { - "line": 61, - "column": 2 - }, - "end": { - "line": 61, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 1901, - "end": 1913, - "loc": { - "start": { - "line": 61, - "column": 2 - }, - "end": { - "line": 61, - "column": 14 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1914, - "end": 1922, - "loc": { - "start": { - "line": 61, - "column": 15 - }, - "end": { - "line": 61, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1914, - "end": 1915, - "loc": { - "start": { - "line": 61, - "column": 15 - }, - "end": { - "line": 61, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1916, - "end": 1922, - "loc": { - "start": { - "line": 61, - "column": 17 - }, - "end": { - "line": 61, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } - } - ], - "directives": [], - "leadingComments": [ - { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1815, - "end": 1832, - "loc": { - "start": { - "line": 57, - "column": 1 - }, - "end": { - "line": 57, - "column": 18 - } - } - } - ] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 328, - "end": 733, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 21, - "column": 3 - } - } - } - ], - "trailingComments": [] - } - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 328, - "end": 733, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 21, - "column": 3 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 952, - "end": 1639, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - }, - { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1815, - "end": 1832, - "loc": { - "start": { - "line": 57, - "column": 1 - }, - "end": { - "line": 57, - "column": 18 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 42, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/BLACK.js", - "start": 47, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 68, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 75, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 79, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 11 - }, - "end": { - "line": 3, - "column": 15 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/RED.js", - "start": 84, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 16 - }, - "end": { - "line": 3, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 101, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 33 - }, - "end": { - "line": 3, - "column": 34 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 103, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 110, - "end": 114, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 115, - "end": 119, - "loc": { - "start": { - "line": 4, - "column": 12 - }, - "end": { - "line": 4, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 120, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 17 - }, - "end": { - "line": 4, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 138, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 35 - }, - "end": { - "line": 4, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 152, - "end": 156, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Leaf.js", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 175, - "end": 176, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 177, - "end": 183, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_left", - "start": 184, - "end": 195, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 196, - "end": 200, - "loc": { - "start": { - "line": 6, - "column": 19 - }, - "end": { - "line": 6, - "column": 23 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../rotate/rotate_left.js", - "start": 201, - "end": 227, - "loc": { - "start": { - "line": 6, - "column": 24 - }, - "end": { - "line": 6, - "column": 50 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 227, - "end": 228, - "loc": { - "start": { - "line": 6, - "column": 50 - }, - "end": { - "line": 6, - "column": 51 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 229, - "end": 235, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_right", - "start": 236, - "end": 248, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 249, - "end": 253, - "loc": { - "start": { - "line": 7, - "column": 20 - }, - "end": { - "line": 7, - "column": 24 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../rotate/rotate_right.js", - "start": 254, - "end": 281, - "loc": { - "start": { - "line": 7, - "column": 25 - }, - "end": { - "line": 7, - "column": 52 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 281, - "end": 282, - "loc": { - "start": { - "line": 7, - "column": 52 - }, - "end": { - "line": 7, - "column": 53 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 283, - "end": 289, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "sibling", - "start": 290, - "end": 297, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 298, - "end": 302, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 19 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../family/sibling.js", - "start": 303, - "end": 325, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 42 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 325, - "end": 326, - "loc": { - "start": { - "line": 8, - "column": 42 - }, - "end": { - "line": 8, - "column": 43 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 328, - "end": 733, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 21, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 734, - "end": 739, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 22, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case6", - "start": 740, - "end": 752, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 18 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 753, - "end": 754, - "loc": { - "start": { - "line": 22, - "column": 19 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 755, - "end": 756, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 22 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 756, - "end": 757, - "loc": { - "start": { - "line": 22, - "column": 22 - }, - "end": { - "line": 22, - "column": 23 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 757, - "end": 758, - "loc": { - "start": { - "line": 22, - "column": 23 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, - { - "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 759, - "end": 761, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 27 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 762, - "end": 763, - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 22, - "column": 29 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 765, - "end": 771, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 771, - "end": 772, - "loc": { - "start": { - "line": 23, - "column": 7 - }, - "end": { - "line": 23, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 772, - "end": 773, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 774, - "end": 784, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 785, - "end": 789, - "loc": { - "start": { - "line": 23, - "column": 21 - }, - "end": { - "line": 23, - "column": 25 - } - } - }, - { - "type": { - "label": "||", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 1, - "updateContext": null - }, - "value": "||", - "start": 790, - "end": 792, - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 793, - "end": 794, - "loc": { - "start": { - "line": 23, - "column": 29 - }, - "end": { - "line": 23, - "column": 30 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 795, - "end": 805, - "loc": { - "start": { - "line": 23, - "column": 31 - }, - "end": { - "line": 23, - "column": 41 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 806, - "end": 810, - "loc": { - "start": { - "line": 23, - "column": 42 - }, - "end": { - "line": 23, - "column": 46 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 810, - "end": 811, - "loc": { - "start": { - "line": 23, - "column": 46 - }, - "end": { - "line": 23, - "column": 47 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 811, - "end": 812, - "loc": { - "start": { - "line": 23, - "column": 47 - }, - "end": { - "line": 23, - "column": 48 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 814, - "end": 820, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 820, - "end": 821, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 821, - "end": 822, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 822, - "end": 823, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 823, - "end": 829, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 830, - "end": 833, - "loc": { - "start": { - "line": 24, - "column": 17 - }, - "end": { - "line": 24, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 834, - "end": 839, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 26 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 839, - "end": 840, - "loc": { - "start": { - "line": 24, - "column": 26 - }, - "end": { - "line": 24, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 840, - "end": 841, - "loc": { - "start": { - "line": 24, - "column": 27 - }, - "end": { - "line": 24, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 843, - "end": 849, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 849, - "end": 850, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 850, - "end": 851, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 851, - "end": 852, - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 852, - "end": 858, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "!==", - "start": 859, - "end": 862, - "loc": { - "start": { - "line": 25, - "column": 17 - }, - "end": { - "line": 25, - "column": 20 - } - } - }, - { - "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "null", - "start": 863, - "end": 867, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 867, - "end": 868, - "loc": { - "start": { - "line": 25, - "column": 25 - }, - "end": { - "line": 25, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 868, - "end": 869, - "loc": { - "start": { - "line": 25, - "column": 26 - }, - "end": { - "line": 25, - "column": 27 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 871, - "end": 876, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 877, - "end": 878, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 879, - "end": 880, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "sibling", - "start": 881, - "end": 888, - "loc": { - "start": { - "line": 26, - "column": 11 - }, - "end": { - "line": 26, - "column": 18 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 888, - "end": 889, - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 889, - "end": 890, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 20 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 890, - "end": 891, - "loc": { - "start": { - "line": 26, - "column": 20 - }, - "end": { - "line": 26, - "column": 21 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 891, - "end": 892, - "loc": { - "start": { - "line": 26, - "column": 21 - }, - "end": { - "line": 26, - "column": 22 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 894, - "end": 900, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 900, - "end": 901, - "loc": { - "start": { - "line": 27, - "column": 7 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 901, - "end": 902, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 903, - "end": 913, - "loc": { - "start": { - "line": 27, - "column": 10 - }, - "end": { - "line": 27, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 914, - "end": 918, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 918, - "end": 919, - "loc": { - "start": { - "line": 27, - "column": 25 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 919, - "end": 920, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 922, - "end": 928, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 28, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 928, - "end": 929, - "loc": { - "start": { - "line": 28, - "column": 7 - }, - "end": { - "line": 28, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 929, - "end": 930, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 930, - "end": 931, - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 931, - "end": 937, - "loc": { - "start": { - "line": 28, - "column": 10 - }, - "end": { - "line": 28, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 938, - "end": 941, - "loc": { - "start": { - "line": 28, - "column": 17 - }, - "end": { - "line": 28, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 942, - "end": 947, - "loc": { - "start": { - "line": 28, - "column": 21 - }, - "end": { - "line": 28, - "column": 26 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 947, - "end": 948, - "loc": { - "start": { - "line": 28, - "column": 26 - }, - "end": { - "line": 28, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 948, - "end": 949, - "loc": { - "start": { - "line": 28, - "column": 27 - }, - "end": { - "line": 28, - "column": 28 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 952, - "end": 1639, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 46, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 1642, - "end": 1643, - "loc": { - "start": { - "line": 48, - "column": 1 - }, - "end": { - "line": 48, - "column": 2 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1643, - "end": 1644, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 3 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1644, - "end": 1650, - "loc": { - "start": { - "line": 48, - "column": 3 - }, - "end": { - "line": 48, - "column": 9 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1651, - "end": 1652, - "loc": { - "start": { - "line": 48, - "column": 10 - }, - "end": { - "line": 48, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1653, - "end": 1654, - "loc": { - "start": { - "line": 48, - "column": 12 - }, - "end": { - "line": 48, - "column": 13 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1654, - "end": 1655, - "loc": { - "start": { - "line": 48, - "column": 13 - }, - "end": { - "line": 48, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 1655, - "end": 1661, - "loc": { - "start": { - "line": 48, - "column": 14 - }, - "end": { - "line": 48, - "column": 20 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1661, - "end": 1662, - "loc": { - "start": { - "line": 48, - "column": 20 - }, - "end": { - "line": 48, - "column": 21 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1662, - "end": 1668, - "loc": { - "start": { - "line": 48, - "column": 21 - }, - "end": { - "line": 48, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1668, - "end": 1669, - "loc": { - "start": { - "line": 48, - "column": 27 - }, - "end": { - "line": 48, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1671, - "end": 1672, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 2 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1672, - "end": 1673, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 3 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 1673, - "end": 1679, - "loc": { - "start": { - "line": 49, - "column": 3 - }, - "end": { - "line": 49, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1679, - "end": 1680, - "loc": { - "start": { - "line": 49, - "column": 9 - }, - "end": { - "line": 49, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1680, - "end": 1686, - "loc": { - "start": { - "line": 49, - "column": 10 - }, - "end": { - "line": 49, - "column": 16 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1687, - "end": 1688, - "loc": { - "start": { - "line": 49, - "column": 17 - }, - "end": { - "line": 49, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 1689, - "end": 1694, - "loc": { - "start": { - "line": 49, - "column": 19 - }, - "end": { - "line": 49, - "column": 24 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1694, - "end": 1695, - "loc": { - "start": { - "line": 49, - "column": 24 - }, - "end": { - "line": 49, - "column": 25 - } - } - }, - { - "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "if", - "start": 1698, - "end": 1700, - "loc": { - "start": { - "line": 51, - "column": 1 - }, - "end": { - "line": 51, - "column": 3 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1701, - "end": 1702, - "loc": { - "start": { - "line": 51, - "column": 4 - }, - "end": { - "line": 51, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1702, - "end": 1703, - "loc": { - "start": { - "line": 51, - "column": 5 - }, - "end": { - "line": 51, - "column": 6 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1704, - "end": 1707, - "loc": { - "start": { - "line": 51, - "column": 7 - }, - "end": { - "line": 51, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1708, - "end": 1709, - "loc": { - "start": { - "line": 51, - "column": 11 - }, - "end": { - "line": 51, - "column": 12 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1709, - "end": 1710, - "loc": { - "start": { - "line": 51, - "column": 12 - }, - "end": { - "line": 51, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 1710, - "end": 1716, - "loc": { - "start": { - "line": 51, - "column": 13 - }, - "end": { - "line": 51, - "column": 19 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1716, - "end": 1717, - "loc": { - "start": { - "line": 51, - "column": 19 - }, - "end": { - "line": 51, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1717, - "end": 1721, - "loc": { - "start": { - "line": 51, - "column": 20 - }, - "end": { - "line": 51, - "column": 24 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1721, - "end": 1722, - "loc": { - "start": { - "line": 51, - "column": 24 - }, - "end": { - "line": 51, - "column": 25 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1723, - "end": 1724, - "loc": { - "start": { - "line": 51, - "column": 26 - }, - "end": { - "line": 51, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 1727, - "end": 1733, - "loc": { - "start": { - "line": 52, - "column": 2 - }, - "end": { - "line": 52, - "column": 8 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1733, - "end": 1734, - "loc": { - "start": { - "line": 52, - "column": 8 - }, - "end": { - "line": 52, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 1734, - "end": 1735, - "loc": { - "start": { - "line": 52, - "column": 9 - }, - "end": { - "line": 52, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1735, - "end": 1736, - "loc": { - "start": { - "line": 52, - "column": 10 - }, - "end": { - "line": 52, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 1736, - "end": 1741, - "loc": { - "start": { - "line": 52, - "column": 11 - }, - "end": { - "line": 52, - "column": 16 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1741, - "end": 1742, - "loc": { - "start": { - "line": 52, - "column": 16 - }, - "end": { - "line": 52, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1742, - "end": 1748, - "loc": { - "start": { - "line": 52, - "column": 17 - }, - "end": { - "line": 52, - "column": 23 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1749, - "end": 1752, - "loc": { - "start": { - "line": 52, - "column": 24 - }, - "end": { - "line": 52, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 1753, - "end": 1756, - "loc": { - "start": { - "line": 52, - "column": 28 - }, - "end": { - "line": 52, - "column": 31 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1756, - "end": 1757, - "loc": { - "start": { - "line": 52, - "column": 31 - }, - "end": { - "line": 52, - "column": 32 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1757, - "end": 1758, - "loc": { - "start": { - "line": 52, - "column": 32 - }, - "end": { - "line": 52, - "column": 33 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 1761, - "end": 1762, - "loc": { - "start": { - "line": 53, - "column": 2 - }, - "end": { - "line": 53, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1762, - "end": 1763, - "loc": { - "start": { - "line": 53, - "column": 3 - }, - "end": { - "line": 53, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 1763, - "end": 1768, - "loc": { - "start": { - "line": 53, - "column": 4 - }, - "end": { - "line": 53, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1768, - "end": 1769, - "loc": { - "start": { - "line": 53, - "column": 9 - }, - "end": { - "line": 53, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1769, - "end": 1775, - "loc": { - "start": { - "line": 53, - "column": 10 - }, - "end": { - "line": 53, - "column": 16 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1776, - "end": 1777, - "loc": { - "start": { - "line": 53, - "column": 17 - }, - "end": { - "line": 53, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 1778, - "end": 1783, - "loc": { - "start": { - "line": 53, - "column": 19 - }, - "end": { - "line": 53, - "column": 24 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1783, - "end": 1784, - "loc": { - "start": { - "line": 53, - "column": 24 - }, - "end": { - "line": 53, - "column": 25 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_left", - "start": 1787, - "end": 1798, - "loc": { - "start": { - "line": 54, - "column": 2 - }, - "end": { - "line": 54, - "column": 13 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1798, - "end": 1799, - "loc": { - "start": { - "line": 54, - "column": 13 - }, - "end": { - "line": 54, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1799, - "end": 1800, - "loc": { - "start": { - "line": 54, - "column": 14 - }, - "end": { - "line": 54, - "column": 15 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1800, - "end": 1801, - "loc": { - "start": { - "line": 54, - "column": 15 - }, - "end": { - "line": 54, - "column": 16 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 1801, - "end": 1807, - "loc": { - "start": { - "line": 54, - "column": 16 - }, - "end": { - "line": 54, - "column": 22 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1807, - "end": 1808, - "loc": { - "start": { - "line": 54, - "column": 22 - }, - "end": { - "line": 54, - "column": 23 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1808, - "end": 1809, - "loc": { - "start": { - "line": 54, - "column": 23 - }, - "end": { - "line": 54, - "column": 24 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1811, - "end": 1812, - "loc": { - "start": { - "line": 55, - "column": 1 - }, - "end": { - "line": 55, - "column": 2 - } - } - }, - { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1815, - "end": 1832, - "loc": { - "start": { - "line": 57, - "column": 1 - }, - "end": { - "line": 57, - "column": 18 - } - } - }, - { - "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "else", - "start": 1834, - "end": 1838, - "loc": { - "start": { - "line": 58, - "column": 1 - }, - "end": { - "line": 58, - "column": 5 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1839, - "end": 1840, - "loc": { - "start": { - "line": 58, - "column": 6 - }, - "end": { - "line": 58, - "column": 7 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 1843, - "end": 1849, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 8 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1849, - "end": 1850, - "loc": { - "start": { - "line": 59, - "column": 8 - }, - "end": { - "line": 59, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 1850, - "end": 1851, - "loc": { - "start": { - "line": 59, - "column": 9 - }, - "end": { - "line": 59, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1851, - "end": 1852, - "loc": { - "start": { - "line": 59, - "column": 10 - }, - "end": { - "line": 59, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1852, - "end": 1856, - "loc": { - "start": { - "line": 59, - "column": 11 - }, - "end": { - "line": 59, - "column": 15 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1856, - "end": 1857, - "loc": { - "start": { - "line": 59, - "column": 15 - }, - "end": { - "line": 59, - "column": 16 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1857, - "end": 1863, - "loc": { - "start": { - "line": 59, - "column": 16 - }, - "end": { - "line": 59, - "column": 22 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1864, - "end": 1867, - "loc": { - "start": { - "line": 59, - "column": 23 - }, - "end": { - "line": 59, - "column": 26 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 1868, - "end": 1871, - "loc": { - "start": { - "line": 59, - "column": 27 - }, - "end": { - "line": 59, - "column": 30 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1871, - "end": 1872, - "loc": { - "start": { - "line": 59, - "column": 30 - }, - "end": { - "line": 59, - "column": 31 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1872, - "end": 1873, - "loc": { - "start": { - "line": 59, - "column": 31 - }, - "end": { - "line": 59, - "column": 32 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "s", - "start": 1876, - "end": 1877, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1877, - "end": 1878, - "loc": { - "start": { - "line": 60, - "column": 3 - }, - "end": { - "line": 60, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1878, - "end": 1882, - "loc": { - "start": { - "line": 60, - "column": 4 - }, - "end": { - "line": 60, - "column": 8 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1882, - "end": 1883, - "loc": { - "start": { - "line": 60, - "column": 8 - }, - "end": { - "line": 60, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1883, - "end": 1889, - "loc": { - "start": { - "line": 60, - "column": 9 - }, - "end": { - "line": 60, - "column": 15 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1890, - "end": 1891, - "loc": { - "start": { - "line": 60, - "column": 16 - }, - "end": { - "line": 60, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 1892, - "end": 1897, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 23 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1897, - "end": 1898, - "loc": { - "start": { - "line": 60, - "column": 23 - }, - "end": { - "line": 60, - "column": 24 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_right", - "start": 1901, - "end": 1913, - "loc": { - "start": { - "line": 61, - "column": 2 - }, - "end": { - "line": 61, - "column": 14 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1913, - "end": 1914, - "loc": { - "start": { - "line": 61, - "column": 14 - }, - "end": { - "line": 61, - "column": 15 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1914, - "end": 1915, - "loc": { - "start": { - "line": 61, - "column": 15 - }, - "end": { - "line": 61, - "column": 16 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1915, - "end": 1916, - "loc": { - "start": { - "line": 61, - "column": 16 - }, - "end": { - "line": 61, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 1916, - "end": 1922, - "loc": { - "start": { - "line": 61, - "column": 17 - }, - "end": { - "line": 61, - "column": 23 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1922, - "end": 1923, - "loc": { - "start": { - "line": 61, - "column": 23 - }, - "end": { - "line": 61, - "column": 24 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1923, - "end": 1924, - "loc": { - "start": { - "line": 61, - "column": 24 - }, - "end": { - "line": 61, - "column": 25 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1926, - "end": 1927, - "loc": { - "start": { - "line": 62, - "column": 1 - }, - "end": { - "line": 62, - "column": 2 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1928, - "end": 1929, - "loc": { - "start": { - "line": 63, - "column": 0 - }, - "end": { - "line": 63, - "column": 1 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1929, - "end": 1930, - "loc": { - "start": { - "line": 63, - "column": 1 - }, - "end": { - "line": 63, - "column": 2 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 1932, - "end": 1938, - "loc": { - "start": { - "line": 65, - "column": 0 - }, - "end": { - "line": 65, - "column": 6 - } - } - }, - { - "type": { - "label": "default", - "keyword": "default", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "default", - "start": 1939, - "end": 1946, - "loc": { - "start": { - "line": 65, - "column": 7 - }, - "end": { - "line": 65, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case6", - "start": 1947, - "end": 1959, - "loc": { - "start": { - "line": 65, - "column": 15 - }, - "end": { - "line": 65, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1959, - "end": 1960, - "loc": { - "start": { - "line": 65, - "column": 27 - }, - "end": { - "line": 65, - "column": 28 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1961, - "end": 1961, - "loc": { - "start": { - "line": 66, - "column": 0 - }, - "end": { - "line": 66, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/deletion/delete_case3.js.json b/ast/source/deletion/delete_no_child.js.json similarity index 64% rename from ast/source/deletion/delete_case3.js.json rename to ast/source/deletion/delete_no_child.js.json index e18b370..f56bf9a 100644 --- a/ast/source/deletion/delete_case3.js.json +++ b/ast/source/deletion/delete_no_child.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1579, + "end": 1153, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 56, + "line": 49, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1579, + "end": 1153, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 56, + "line": 49, "column": 0 } }, @@ -306,77 +306,8 @@ }, { "type": "ImportDeclaration", - "start": 140, - "end": 176, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" - } - }, - { - "type": "ImportDeclaration", - "start": 177, - "end": 220, + "start": 141, + "end": 186, "loc": { "start": { "line": 6, @@ -384,14 +315,14 @@ }, "end": { "line": 6, - "column": 43 + "column": 45 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 184, - "end": 191, + "start": 148, + "end": 160, "loc": { "start": { "line": 6, @@ -399,13 +330,13 @@ }, "end": { "line": 6, - "column": 14 + "column": 19 } }, "local": { "type": "Identifier", - "start": 184, - "end": 191, + "start": 148, + "end": 160, "loc": { "start": { "line": 6, @@ -413,75 +344,75 @@ }, "end": { "line": 6, - "column": 14 + "column": 19 }, - "identifierName": "sibling" + "identifierName": "replace_node" }, - "name": "sibling" + "name": "replace_node" } } ], "source": { "type": "StringLiteral", - "start": 197, - "end": 219, + "start": 166, + "end": 185, "loc": { "start": { "line": 6, - "column": 20 + "column": 25 }, "end": { "line": 6, - "column": 42 + "column": 44 } }, "extra": { - "rawValue": "../family/sibling.js", - "raw": "'../family/sibling.js'" + "rawValue": "./replace_node.js", + "raw": "'./replace_node.js'" }, - "value": "../family/sibling.js" + "value": "./replace_node.js" } }, { "type": "ImportDeclaration", - "start": 222, - "end": 267, + "start": 187, + "end": 232, "loc": { "start": { - "line": 8, + "line": 7, "column": 0 }, "end": { - "line": 8, + "line": 7, "column": 45 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 229, - "end": 241, + "start": 194, + "end": 206, "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 19 } }, "local": { "type": "Identifier", - "start": 229, - "end": 241, + "start": 194, + "end": 206, "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 19 }, "identifierName": "delete_case1" @@ -492,15 +423,15 @@ ], "source": { "type": "StringLiteral", - "start": 247, - "end": 266, + "start": 212, + "end": 231, "loc": { "start": { - "line": 8, + "line": 7, "column": 25 }, "end": { - "line": 8, + "line": 7, "column": 44 } }, @@ -513,8 +444,8 @@ }, { "type": "ImportDeclaration", - "start": 268, - "end": 313, + "start": 234, + "end": 265, "loc": { "start": { "line": 9, @@ -522,14 +453,14 @@ }, "end": { "line": 9, - "column": 45 + "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 275, - "end": 287, + "start": 241, + "end": 246, "loc": { "start": { "line": 9, @@ -537,13 +468,13 @@ }, "end": { "line": 9, - "column": 19 + "column": 12 } }, "local": { "type": "Identifier", - "start": 275, - "end": 287, + "start": 241, + "end": 246, "loc": { "start": { "line": 9, @@ -551,47 +482,47 @@ }, "end": { "line": 9, - "column": 19 + "column": 12 }, - "identifierName": "delete_case4" + "identifierName": "prune" }, - "name": "delete_case4" + "name": "prune" } } ], "source": { "type": "StringLiteral", - "start": 293, - "end": 312, + "start": 252, + "end": 264, "loc": { "start": { "line": 9, - "column": 25 + "column": 18 }, "end": { "line": 9, - "column": 44 + "column": 30 } }, "extra": { - "rawValue": "./delete_case4.js", - "raw": "'./delete_case4.js'" + "rawValue": "./prune.js", + "raw": "'./prune.js'" }, - "value": "./delete_case4.js" + "value": "./prune.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 315, - "end": 586, + "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n ", + "start": 267, + "end": 455, "loc": { "start": { "line": 11, "column": 0 }, "end": { - "line": 20, + "line": 19, "column": 3 } } @@ -600,62 +531,62 @@ }, { "type": "Identifier", - "start": 587, - "end": 1548, + "start": 456, + "end": 1119, "loc": { "start": { - "line": 21, + "line": 20, "column": 0 }, "end": { - "line": 53, + "line": 46, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 593, - "end": 1547, + "start": 462, + "end": 1118, "loc": { "start": { - "line": 21, + "line": 20, "column": 6 }, "end": { - "line": 53, + "line": 46, "column": 1 } }, "id": { "type": "Identifier", - "start": 593, - "end": 605, + "start": 462, + "end": 477, "loc": { "start": { - "line": 21, + "line": 20, "column": 6 }, "end": { - "line": 21, - "column": 18 + "line": 20, + "column": 21 }, - "identifierName": "delete_case3" + "identifierName": "delete_no_child" }, - "name": "delete_case3", + "name": "delete_no_child", "leadingComments": null }, "init": { "type": "ArrowFunctionExpression", - "start": 608, - "end": 1547, + "start": 480, + "end": 1118, "loc": { "start": { - "line": 21, - "column": 21 + "line": 20, + "column": 24 }, "end": { - "line": 53, + "line": 46, "column": 1 } }, @@ -666,16 +597,16 @@ "params": [ { "type": "Identifier", - "start": 609, - "end": 610, + "start": 481, + "end": 482, "loc": { "start": { - "line": 21, - "column": 22 + "line": 20, + "column": 25 }, "end": { - "line": 21, - "column": 23 + "line": 20, + "column": 26 }, "identifierName": "n" }, @@ -684,23 +615,122 @@ ], "body": { "type": "BlockStatement", - "start": 615, - "end": 1547, + "start": 487, + "end": 1118, "loc": { "start": { - "line": 21, - "column": 28 + "line": 20, + "column": 31 }, "end": { - "line": 53, + "line": 46, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 618, - "end": 665, + "start": 490, + "end": 516, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 490, + "end": 515, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 490, + "end": 496, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 497, + "end": 514, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 497, + "end": 498, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 510, + "end": 514, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 518, + "end": 544, "loc": { "start": { "line": 22, @@ -708,13 +738,13 @@ }, "end": { "line": 22, - "column": 48 + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 618, - "end": 664, + "start": 518, + "end": 543, "loc": { "start": { "line": 22, @@ -722,13 +752,13 @@ }, "end": { "line": 22, - "column": 47 + "column": 26 } }, "callee": { "type": "Identifier", - "start": 618, - "end": 624, + "start": 518, + "end": 524, "loc": { "start": { "line": 22, @@ -744,9 +774,9 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 625, - "end": 663, + "type": "BinaryExpression", + "start": 525, + "end": 542, "loc": { "start": { "line": 22, @@ -754,13 +784,13 @@ }, "end": { "line": 22, - "column": 46 + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 625, - "end": 642, + "type": "MemberExpression", + "start": 525, + "end": 533, "loc": { "start": { "line": 22, @@ -768,13 +798,13 @@ }, "end": { "line": 22, - "column": 25 + "column": 16 } }, - "left": { + "object": { "type": "Identifier", - "start": 625, - "end": 626, + "start": 525, + "end": 526, "loc": { "start": { "line": 22, @@ -788,74 +818,39 @@ }, "name": "n" }, - "operator": "instanceof", - "right": { + "property": { "type": "Identifier", - "start": 638, - "end": 642, + "start": 527, + "end": 533, "loc": { "start": { "line": 22, - "column": 21 + "column": 10 }, "end": { "line": 22, - "column": 25 + "column": 16 }, - "identifierName": "Node" + "identifierName": "parent" }, - "name": "Node" - } + "name": "parent" + }, + "computed": false }, - "operator": "||", + "operator": "!==", "right": { - "type": "BinaryExpression", - "start": 646, - "end": 663, + "type": "NullLiteral", + "start": 538, + "end": 542, "loc": { "start": { "line": 22, - "column": 29 + "column": 21 }, "end": { "line": 22, - "column": 46 + "column": 25 } - }, - "left": { - "type": "Identifier", - "start": 646, - "end": 647, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 659, - "end": 663, - "loc": { - "start": { - "line": 22, - "column": 42 - }, - "end": { - "line": 22, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" } } } @@ -864,8 +859,8 @@ }, { "type": "ExpressionStatement", - "start": 667, - "end": 694, + "start": 546, + "end": 570, "loc": { "start": { "line": 23, @@ -873,13 +868,13 @@ }, "end": { "line": 23, - "column": 28 + "column": 25 } }, "expression": { "type": "CallExpression", - "start": 667, - "end": 693, + "start": 546, + "end": 569, "loc": { "start": { "line": 23, @@ -887,13 +882,13 @@ }, "end": { "line": 23, - "column": 27 + "column": 24 } }, "callee": { "type": "Identifier", - "start": 667, - "end": 673, + "start": 546, + "end": 552, "loc": { "start": { "line": 23, @@ -910,8 +905,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 674, - "end": 692, + "start": 553, + "end": 568, "loc": { "start": { "line": 23, @@ -919,13 +914,13 @@ }, "end": { "line": 23, - "column": 26 + "column": 23 } }, "left": { "type": "MemberExpression", - "start": 674, - "end": 682, + "start": 553, + "end": 559, "loc": { "start": { "line": 23, @@ -933,13 +928,13 @@ }, "end": { "line": 23, - "column": 16 + "column": 14 } }, "object": { "type": "Identifier", - "start": 674, - "end": 675, + "start": 553, + "end": 554, "loc": { "start": { "line": 23, @@ -955,8 +950,8 @@ }, "property": { "type": "Identifier", - "start": 676, - "end": 682, + "start": 555, + "end": 559, "loc": { "start": { "line": 23, @@ -964,31 +959,29 @@ }, "end": { "line": 23, - "column": 16 + "column": 14 }, - "identifierName": "_color" + "identifierName": "left" }, - "name": "_color" + "name": "left" }, "computed": false }, "operator": "===", "right": { - "type": "Identifier", - "start": 687, - "end": 692, + "type": "NullLiteral", + "start": 564, + "end": 568, "loc": { "start": { "line": 23, - "column": 21 + "column": 19 }, "end": { "line": 23, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" + "column": 23 + } + } } } ] @@ -996,8 +989,8 @@ }, { "type": "ExpressionStatement", - "start": 696, - "end": 722, + "start": 572, + "end": 597, "loc": { "start": { "line": 24, @@ -1005,13 +998,13 @@ }, "end": { "line": 24, - "column": 27 + "column": 26 } }, "expression": { "type": "CallExpression", - "start": 696, - "end": 721, + "start": 572, + "end": 596, "loc": { "start": { "line": 24, @@ -1019,13 +1012,13 @@ }, "end": { "line": 24, - "column": 26 + "column": 25 } }, "callee": { "type": "Identifier", - "start": 696, - "end": 702, + "start": 572, + "end": 578, "loc": { "start": { "line": 24, @@ -1042,8 +1035,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 703, - "end": 720, + "start": 579, + "end": 595, "loc": { "start": { "line": 24, @@ -1051,13 +1044,13 @@ }, "end": { "line": 24, - "column": 25 + "column": 24 } }, "left": { "type": "MemberExpression", - "start": 703, - "end": 711, + "start": 579, + "end": 586, "loc": { "start": { "line": 24, @@ -1065,13 +1058,13 @@ }, "end": { "line": 24, - "column": 16 + "column": 15 } }, "object": { "type": "Identifier", - "start": 703, - "end": 704, + "start": 579, + "end": 580, "loc": { "start": { "line": 24, @@ -1087,8 +1080,8 @@ }, "property": { "type": "Identifier", - "start": 705, - "end": 711, + "start": 581, + "end": 586, "loc": { "start": { "line": 24, @@ -1096,27 +1089,27 @@ }, "end": { "line": 24, - "column": 16 + "column": 15 }, - "identifierName": "parent" + "identifierName": "right" }, - "name": "parent" + "name": "right" }, "computed": false }, - "operator": "!==", + "operator": "===", "right": { "type": "NullLiteral", - "start": 716, - "end": 720, + "start": 591, + "end": 595, "loc": { "start": { "line": 24, - "column": 21 + "column": 20 }, "end": { "line": 24, - "column": 25 + "column": 24 } } } @@ -1125,1088 +1118,946 @@ } }, { - "type": "VariableDeclaration", - "start": 724, - "end": 745, + "type": "IfStatement", + "start": 600, + "end": 678, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, - "column": 22 + "line": 30, + "column": 2 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 730, - "end": 744, + "test": { + "type": "BinaryExpression", + "start": 604, + "end": 622, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 23 + } + }, + "left": { + "type": "MemberExpression", + "start": 604, + "end": 612, "loc": { "start": { - "line": 25, - "column": 7 + "line": 26, + "column": 5 }, "end": { - "line": 25, - "column": 21 + "line": 26, + "column": 13 } }, - "id": { + "object": { "type": "Identifier", - "start": 730, - "end": 731, + "start": 604, + "end": 605, "loc": { "start": { - "line": 25, - "column": 7 + "line": 26, + "column": 5 }, "end": { - "line": 25, - "column": 8 + "line": 26, + "column": 6 }, - "identifierName": "s" + "identifierName": "n" }, - "name": "s" + "name": "n" }, - "init": { - "type": "CallExpression", - "start": 734, - "end": 744, + "property": { + "type": "Identifier", + "start": 606, + "end": 612, "loc": { "start": { - "line": 25, - "column": 11 + "line": 26, + "column": 7 }, "end": { - "line": 25, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 734, - "end": 741, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 18 - }, - "identifierName": "sibling" + "line": 26, + "column": 13 }, - "name": "sibling" + "identifierName": "_color" }, - "arguments": [ - { - "type": "Identifier", - "start": 742, - "end": 743, - "loc": { - "start": { - "line": 25, - "column": 19 - }, - "end": { - "line": 25, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 747, - "end": 773, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 747, - "end": 772, - "loc": { - "start": { - "line": 26, - "column": 1 + "name": "_color" }, - "end": { - "line": 26, - "column": 26 - } + "computed": false }, - "callee": { + "operator": "!==", + "right": { "type": "Identifier", - "start": 747, - "end": 753, + "start": 617, + "end": 622, "loc": { "start": { "line": 26, - "column": 1 + "column": 18 }, "end": { "line": 26, - "column": 7 + "column": 23 }, - "identifierName": "assert" + "identifierName": "BLACK" }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 754, - "end": 771, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 754, - "end": 755, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 9 - }, - "identifierName": "s" - }, - "name": "s" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 767, - "end": 771, - "loc": { - "start": { - "line": 26, - "column": 21 - }, - "end": { - "line": 26, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 775, - "end": 802, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 28 + "name": "BLACK" } }, - "expression": { - "type": "CallExpression", - "start": 775, - "end": 801, + "consequent": { + "type": "BlockStatement", + "start": 624, + "end": 678, "loc": { "start": { - "line": 27, - "column": 1 + "line": 26, + "column": 25 }, "end": { - "line": 27, - "column": 27 + "line": 30, + "column": 2 } }, - "callee": { - "type": "Identifier", - "start": 775, - "end": 781, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ + "body": [ { - "type": "BinaryExpression", - "start": 782, - "end": 800, + "type": "ExpressionStatement", + "start": 628, + "end": 653, "loc": { "start": { "line": 27, - "column": 8 + "column": 2 }, "end": { "line": 27, - "column": 26 + "column": 27 } }, - "left": { - "type": "MemberExpression", - "start": 782, - "end": 790, + "expression": { + "type": "CallExpression", + "start": 628, + "end": 652, "loc": { "start": { "line": 27, - "column": 8 + "column": 2 }, "end": { "line": 27, - "column": 16 + "column": 26 } }, - "object": { + "callee": { "type": "Identifier", - "start": 782, - "end": 783, + "start": 628, + "end": 634, "loc": { "start": { "line": 27, - "column": 8 + "column": 2 }, "end": { "line": 27, - "column": 9 + "column": 8 }, - "identifierName": "s" + "identifierName": "assert" }, - "name": "s" + "name": "assert" }, - "property": { - "type": "Identifier", - "start": 784, - "end": 790, - "loc": { - "start": { - "line": 27, - "column": 10 + "arguments": [ + { + "type": "BinaryExpression", + "start": 635, + "end": 651, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 25 + } }, - "end": { - "line": 27, - "column": 16 + "left": { + "type": "MemberExpression", + "start": 635, + "end": 643, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 635, + "end": 636, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 637, + "end": 643, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "identifierName": "_color" - }, - "name": "_color" + "operator": "===", + "right": { + "type": "Identifier", + "start": 648, + "end": 651, + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 25 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 656, + "end": 665, + "loc": { + "start": { + "line": 28, + "column": 2 }, - "computed": false + "end": { + "line": 28, + "column": 11 + } }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 795, - "end": 800, + "expression": { + "type": "CallExpression", + "start": 656, + "end": 664, "loc": { "start": { - "line": 27, - "column": 21 + "line": 28, + "column": 2 }, "end": { - "line": 27, - "column": 26 + "line": 28, + "column": 10 + } + }, + "callee": { + "type": "Identifier", + "start": 656, + "end": 661, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "prune" }, - "identifierName": "BLACK" + "name": "prune" }, - "name": "BLACK" - } - } - ] + "arguments": [ + { + "type": "Identifier", + "start": 662, + "end": 663, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + { + "type": "ReturnStatement", + "start": 668, + "end": 675, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 9 + } + }, + "argument": null + } + ], + "directives": [], + "trailingComments": null }, + "alternate": null, "trailingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 805, - "end": 1347, + "type": "CommentLine", + "value": " Mock leaf since there is no left child", + "start": 681, + "end": 722, "loc": { "start": { - "line": 29, + "line": 32, "column": 1 }, "end": { - "line": 41, - "column": 4 + "line": 32, + "column": 42 + } + } + }, + { + "type": "CommentLine", + "value": " We use key = n.key to avoid mixing types, but this property is never", + "start": 724, + "end": 795, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " accessed.", + "start": 797, + "end": 809, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 } } } ] }, { - "type": "IfStatement", - "start": 1349, - "end": 1545, + "type": "VariableDeclaration", + "start": 811, + "end": 847, "loc": { "start": { - "line": 42, + "line": 35, "column": 1 }, "end": { - "line": 52, - "column": 22 + "line": 35, + "column": 37 } }, - "test": { - "type": "LogicalExpression", - "start": 1356, - "end": 1440, - "loc": { - "start": { - "line": 43, - "column": 2 - }, - "end": { - "line": 45, - "column": 26 - } - }, - "left": { - "type": "LogicalExpression", - "start": 1356, - "end": 1410, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 817, + "end": 846, "loc": { "start": { - "line": 43, - "column": 2 + "line": 35, + "column": 7 }, "end": { - "line": 44, - "column": 25 + "line": 35, + "column": 36 } }, - "left": { - "type": "BinaryExpression", - "start": 1356, - "end": 1381, + "id": { + "type": "Identifier", + "start": 817, + "end": 821, "loc": { "start": { - "line": 43, - "column": 2 + "line": 35, + "column": 7 }, "end": { - "line": 43, - "column": 27 + "line": 35, + "column": 11 + }, + "identifierName": "leaf" + }, + "name": "leaf", + "leadingComments": null + }, + "init": { + "type": "NewExpression", + "start": 824, + "end": 846, + "loc": { + "start": { + "line": 35, + "column": 14 + }, + "end": { + "line": 35, + "column": 36 } }, - "left": { - "type": "MemberExpression", - "start": 1356, - "end": 1371, + "callee": { + "type": "Identifier", + "start": 828, + "end": 832, "loc": { "start": { - "line": 43, - "column": 2 + "line": 35, + "column": 18 }, "end": { - "line": 43, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1356, - "end": 1364, - "loc": { - "start": { - "line": 43, - "column": 2 - }, - "end": { - "line": 43, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1356, - "end": 1357, - "loc": { - "start": { - "line": 43, - "column": 2 - }, - "end": { - "line": 43, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1358, - "end": 1364, - "loc": { - "start": { - "line": 43, - "column": 4 - }, - "end": { - "line": 43, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" + "line": 35, + "column": 22 }, - "computed": false, - "leadingComments": null + "identifierName": "Node" }, - "property": { + "name": "Node" + }, + "arguments": [ + { "type": "Identifier", - "start": 1365, - "end": 1371, + "start": 833, + "end": 838, "loc": { "start": { - "line": 43, - "column": 11 + "line": 35, + "column": 23 }, "end": { - "line": 43, - "column": 17 + "line": 35, + "column": 28 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1376, - "end": 1381, - "loc": { - "start": { - "line": 43, - "column": 22 - }, - "end": { - "line": 43, - "column": 27 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1387, - "end": 1410, - "loc": { - "start": { - "line": 44, - "column": 2 - }, - "end": { - "line": 44, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 1387, - "end": 1400, - "loc": { - "start": { - "line": 44, - "column": 2 + "identifierName": "BLACK" }, - "end": { - "line": 44, - "column": 15 - } + "name": "BLACK" }, - "object": { + { "type": "MemberExpression", - "start": 1387, - "end": 1393, + "start": 840, + "end": 845, "loc": { "start": { - "line": 44, - "column": 2 + "line": 35, + "column": 30 }, "end": { - "line": 44, - "column": 8 + "line": 35, + "column": 35 } }, "object": { "type": "Identifier", - "start": 1387, - "end": 1388, + "start": 840, + "end": 841, "loc": { "start": { - "line": 44, - "column": 2 + "line": 35, + "column": 30 }, "end": { - "line": 44, - "column": 3 + "line": 35, + "column": 31 }, - "identifierName": "s" + "identifierName": "n" }, - "name": "s" + "name": "n" }, "property": { "type": "Identifier", - "start": 1389, - "end": 1393, + "start": 842, + "end": 845, "loc": { "start": { - "line": 44, - "column": 4 + "line": 35, + "column": 32 }, "end": { - "line": 44, - "column": 8 + "line": 35, + "column": 35 }, - "identifierName": "left" + "identifierName": "key" }, - "name": "left" + "name": "key" }, "computed": false - }, - "property": { - "type": "Identifier", - "start": 1394, - "end": 1400, - "loc": { - "start": { - "line": 44, - "column": 9 - }, - "end": { - "line": 44, - "column": 15 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1405, - "end": 1410, - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } + } + ] }, "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " Mock leaf since there is no left child", + "start": 681, + "end": 722, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 42 + } + } }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1416, - "end": 1440, + { + "type": "CommentLine", + "value": " We use key = n.key to avoid mixing types, but this property is never", + "start": 724, + "end": 795, "loc": { "start": { - "line": 45, - "column": 2 + "line": 33, + "column": 1 }, "end": { - "line": 45, - "column": 26 + "line": 33, + "column": 72 } - }, - "left": { - "type": "MemberExpression", - "start": 1416, - "end": 1430, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 16 - } + } + }, + { + "type": "CommentLine", + "value": " accessed.", + "start": 797, + "end": 809, + "loc": { + "start": { + "line": 34, + "column": 1 }, - "object": { - "type": "MemberExpression", - "start": 1416, - "end": 1423, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1416, - "end": 1417, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1418, - "end": 1423, - "loc": { - "start": { - "line": 45, - "column": 4 - }, - "end": { - "line": 45, - "column": 9 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1424, - "end": 1430, - "loc": { - "start": { - "line": 45, - "column": 10 - }, - "end": { - "line": 45, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1435, - "end": 1440, - "loc": { - "start": { - "line": 45, - "column": 21 - }, - "end": { - "line": 45, - "column": 26 - }, - "identifierName": "BLACK" + "end": { + "line": 34, + "column": 13 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Replace n with the mocked leaf", + "start": 850, + "end": 883, + "loc": { + "start": { + "line": 37, + "column": 1 }, - "name": "BLACK" + "end": { + "line": 37, + "column": 34 + } } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 885, + "end": 907, + "loc": { + "start": { + "line": 38, + "column": 1 }, - "leadingComments": null + "end": { + "line": 38, + "column": 23 + } }, - "consequent": { - "type": "BlockStatement", - "start": 1444, - "end": 1492, + "expression": { + "type": "CallExpression", + "start": 885, + "end": 906, "loc": { "start": { - "line": 46, - "column": 3 + "line": 38, + "column": 1 }, "end": { - "line": 49, - "column": 2 + "line": 38, + "column": 22 } }, - "body": [ + "callee": { + "type": "Identifier", + "start": 885, + "end": 897, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 13 + }, + "identifierName": "replace_node" + }, + "name": "replace_node", + "leadingComments": null + }, + "arguments": [ { - "type": "ExpressionStatement", - "start": 1448, - "end": 1463, + "type": "Identifier", + "start": 898, + "end": 899, "loc": { "start": { - "line": 47, - "column": 2 + "line": 38, + "column": 14 }, "end": { - "line": 47, - "column": 17 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1448, - "end": 1462, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 16 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1448, - "end": 1456, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1448, - "end": 1449, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1450, - "end": 1456, - "loc": { - "start": { - "line": 47, - "column": 4 - }, - "end": { - "line": 47, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 38, + "column": 15 }, - "right": { - "type": "Identifier", - "start": 1459, - "end": 1462, - "loc": { - "start": { - "line": 47, - "column": 13 - }, - "end": { - "line": 47, - "column": 16 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } + "identifierName": "n" + }, + "name": "n" }, { - "type": "ExpressionStatement", - "start": 1466, - "end": 1489, + "type": "Identifier", + "start": 901, + "end": 905, "loc": { "start": { - "line": 48, - "column": 2 + "line": 38, + "column": 17 }, "end": { - "line": 48, - "column": 25 - } - }, - "expression": { - "type": "CallExpression", - "start": 1466, - "end": 1488, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 1466, - "end": 1478, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 14 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1" + "line": 38, + "column": 21 }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1479, - "end": 1487, - "loc": { - "start": { - "line": 48, - "column": 15 - }, - "end": { - "line": 48, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1479, - "end": 1480, - "loc": { - "start": { - "line": 48, - "column": 15 - }, - "end": { - "line": 48, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1481, - "end": 1487, - "loc": { - "start": { - "line": 48, - "column": 17 - }, - "end": { - "line": 48, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } + "identifierName": "leaf" + }, + "name": "leaf" } ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1495, - "end": 1522, - "loc": { - "start": { - "line": 51, - "column": 1 - }, - "end": { - "line": 51, - "column": 28 - } - } - } - ] + "leadingComments": null }, - "alternate": { - "type": "ExpressionStatement", - "start": 1529, - "end": 1545, - "loc": { - "start": { - "line": 52, - "column": 6 - }, - "end": { - "line": 52, - "column": 22 - } - }, - "expression": { - "type": "CallExpression", - "start": 1529, - "end": 1544, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Replace n with the mocked leaf", + "start": 850, + "end": 883, "loc": { "start": { - "line": 52, - "column": 6 + "line": 37, + "column": 1 }, "end": { - "line": 52, - "column": 21 + "line": 37, + "column": 34 } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 910, + "end": 984, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 986, + "end": 1057, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 72 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1059, + "end": 1078, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 42, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 1059, + "end": 1077, + "loc": { + "start": { + "line": 42, + "column": 1 }, - "callee": { + "end": { + "line": 42, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 1059, + "end": 1071, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 42, + "column": 13 + }, + "identifierName": "delete_case1" + }, + "name": "delete_case1", + "leadingComments": null + }, + "arguments": [ + { "type": "Identifier", - "start": 1529, - "end": 1541, + "start": 1072, + "end": 1076, "loc": { "start": { - "line": 52, - "column": 6 + "line": 42, + "column": 14 }, "end": { - "line": 52, + "line": 42, "column": 18 }, - "identifierName": "delete_case4" + "identifierName": "leaf" }, - "name": "delete_case4", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1542, - "end": 1543, - "loc": { - "start": { - "line": 52, - "column": 19 - }, - "end": { - "line": 52, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" + "name": "leaf" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 910, + "end": 984, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 75 } - ], + } + }, + { + "type": "CommentLine", + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 986, + "end": 1057, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 72 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Delete mocked leaf", + "start": 1081, + "end": 1102, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 22 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1104, + "end": 1116, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 13 + } + }, + "expression": { + "type": "CallExpression", + "start": 1104, + "end": 1115, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 1104, + "end": 1109, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 6 + }, + "identifierName": "prune" + }, + "name": "prune", "leadingComments": null }, - "leadingComments": [ + "arguments": [ { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1495, - "end": 1522, + "type": "Identifier", + "start": 1110, + "end": 1114, "loc": { "start": { - "line": 51, - "column": 1 + "line": 45, + "column": 7 }, "end": { - "line": 51, - "column": 28 - } - } + "line": 45, + "column": 11 + }, + "identifierName": "leaf" + }, + "name": "leaf" } - ] + ], + "leadingComments": null }, "leadingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 805, - "end": 1347, + "type": "CommentLine", + "value": " Delete mocked leaf", + "start": 1081, + "end": 1102, "loc": { "start": { - "line": 29, + "line": 44, "column": 1 }, "end": { - "line": 41, - "column": 4 + "line": 44, + "column": 22 } } } @@ -2226,34 +2077,34 @@ }, { "type": "Identifier", - "start": 1550, - "end": 1578, + "start": 1121, + "end": 1152, "loc": { "start": { - "line": 55, + "line": 48, "column": 0 }, "end": { - "line": 55, - "column": 28 + "line": 48, + "column": 31 } }, "declaration": { "type": "Identifier", - "start": 1565, - "end": 1577, + "start": 1136, + "end": 1151, "loc": { "start": { - "line": 55, + "line": 48, "column": 15 }, "end": { - "line": 55, - "column": 27 + "line": 48, + "column": 30 }, - "identifierName": "delete_case3" + "identifierName": "delete_no_child" }, - "name": "delete_case3" + "name": "delete_no_child" }, "name": "_", "leadingComments": [], @@ -2261,95 +2112,95 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1550, - "end": 1578, + "start": 1121, + "end": 1152, "loc": { "start": { - "line": 55, + "line": 48, "column": 0 }, "end": { - "line": 55, - "column": 28 + "line": 48, + "column": 31 } }, "declaration": { "type": "VariableDeclaration", - "start": 587, - "end": 1548, + "start": 456, + "end": 1119, "loc": { "start": { - "line": 21, + "line": 20, "column": 0 }, "end": { - "line": 53, + "line": 46, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 593, - "end": 1547, + "start": 462, + "end": 1118, "loc": { "start": { - "line": 21, + "line": 20, "column": 6 }, "end": { - "line": 53, + "line": 46, "column": 1 } }, "id": { "type": "Identifier", - "start": 593, - "end": 605, + "start": 462, + "end": 477, "loc": { "start": { - "line": 21, + "line": 20, "column": 6 }, "end": { - "line": 21, - "column": 18 + "line": 20, + "column": 21 }, - "identifierName": "delete_case3" + "identifierName": "delete_no_child" }, - "name": "delete_case3", + "name": "delete_no_child", "leadingComments": null }, "init": { "type": "ArrowFunctionExpression", - "start": 608, - "end": 1547, + "start": 480, + "end": 1118, "loc": { "start": { - "line": 21, - "column": 21 + "line": 20, + "column": 24 }, "end": { - "line": 53, + "line": 46, "column": 1 } }, "id": { "type": "Identifier", - "start": 593, - "end": 605, + "start": 462, + "end": 477, "loc": { "start": { - "line": 21, + "line": 20, "column": 6 }, "end": { - "line": 21, - "column": 18 + "line": 20, + "column": 21 }, - "identifierName": "delete_case3" + "identifierName": "delete_no_child" }, - "name": "delete_case3", + "name": "delete_no_child", "leadingComments": null }, "generator": false, @@ -2358,16 +2209,16 @@ "params": [ { "type": "Identifier", - "start": 609, - "end": 610, + "start": 481, + "end": 482, "loc": { "start": { - "line": 21, - "column": 22 + "line": 20, + "column": 25 }, "end": { - "line": 21, - "column": 23 + "line": 20, + "column": 26 }, "identifierName": "n" }, @@ -2376,58 +2227,58 @@ ], "body": { "type": "BlockStatement", - "start": 615, - "end": 1547, + "start": 487, + "end": 1118, "loc": { "start": { - "line": 21, - "column": 28 + "line": 20, + "column": 31 }, "end": { - "line": 53, + "line": 46, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 618, - "end": 665, + "start": 490, + "end": 516, "loc": { "start": { - "line": 22, + "line": 21, "column": 1 }, "end": { - "line": 22, - "column": 48 + "line": 21, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 618, - "end": 664, + "start": 490, + "end": 515, "loc": { "start": { - "line": 22, + "line": 21, "column": 1 }, "end": { - "line": 22, - "column": 47 + "line": 21, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 618, - "end": 624, + "start": 490, + "end": 496, "loc": { "start": { - "line": 22, + "line": 21, "column": 1 }, "end": { - "line": 22, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -2436,119 +2287,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 625, - "end": 663, + "type": "BinaryExpression", + "start": 497, + "end": 514, "loc": { "start": { - "line": 22, + "line": 21, "column": 8 }, "end": { - "line": 22, - "column": 46 + "line": 21, + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 625, - "end": 642, + "type": "Identifier", + "start": 497, + "end": 498, "loc": { "start": { - "line": 22, + "line": 21, "column": 8 }, "end": { - "line": 22, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 625, - "end": 626, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - }, - "identifierName": "n" + "line": 21, + "column": 9 }, - "name": "n" + "identifierName": "n" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 638, - "end": 642, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "n" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 646, - "end": 663, + "type": "Identifier", + "start": 510, + "end": 514, "loc": { "start": { - "line": 22, - "column": 29 + "line": 21, + "column": 21 }, "end": { - "line": 22, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 646, - "end": 647, - "loc": { - "start": { - "line": 22, - "column": 29 - }, - "end": { - "line": 22, - "column": 30 - }, - "identifierName": "n" + "line": 21, + "column": 25 }, - "name": "n" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 659, - "end": 663, - "loc": { - "start": { - "line": 22, - "column": 42 - }, - "end": { - "line": 22, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -2556,43 +2341,43 @@ }, { "type": "ExpressionStatement", - "start": 667, - "end": 694, + "start": 518, + "end": 544, "loc": { "start": { - "line": 23, + "line": 22, "column": 1 }, "end": { - "line": 23, - "column": 28 + "line": 22, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 667, - "end": 693, + "start": 518, + "end": 543, "loc": { "start": { - "line": 23, + "line": 22, "column": 1 }, "end": { - "line": 23, - "column": 27 + "line": 22, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 667, - "end": 673, + "start": 518, + "end": 524, "loc": { "start": { - "line": 23, + "line": 22, "column": 1 }, "end": { - "line": 23, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -2602,43 +2387,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 674, - "end": 692, + "start": 525, + "end": 542, "loc": { "start": { - "line": 23, + "line": 22, "column": 8 }, "end": { - "line": 23, - "column": 26 + "line": 22, + "column": 25 } }, "left": { "type": "MemberExpression", - "start": 674, - "end": 682, + "start": 525, + "end": 533, "loc": { "start": { - "line": 23, + "line": 22, "column": 8 }, "end": { - "line": 23, + "line": 22, "column": 16 } }, "object": { "type": "Identifier", - "start": 674, - "end": 675, + "start": 525, + "end": 526, "loc": { "start": { - "line": 23, + "line": 22, "column": 8 }, "end": { - "line": 23, + "line": 22, "column": 9 }, "identifierName": "n" @@ -2647,40 +2432,38 @@ }, "property": { "type": "Identifier", - "start": 676, - "end": 682, + "start": 527, + "end": 533, "loc": { "start": { - "line": 23, + "line": 22, "column": 10 }, "end": { - "line": 23, + "line": 22, "column": 16 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false }, - "operator": "===", + "operator": "!==", "right": { - "type": "Identifier", - "start": 687, - "end": 692, + "type": "NullLiteral", + "start": 538, + "end": 542, "loc": { "start": { - "line": 23, + "line": 22, "column": 21 }, "end": { - "line": 23, - "column": 26 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" + "line": 22, + "column": 25 + } + } } } ] @@ -2688,43 +2471,43 @@ }, { "type": "ExpressionStatement", - "start": 696, - "end": 722, + "start": 546, + "end": 570, "loc": { "start": { - "line": 24, + "line": 23, "column": 1 }, "end": { - "line": 24, - "column": 27 + "line": 23, + "column": 25 } }, "expression": { "type": "CallExpression", - "start": 696, - "end": 721, + "start": 546, + "end": 569, "loc": { "start": { - "line": 24, + "line": 23, "column": 1 }, "end": { - "line": 24, - "column": 26 + "line": 23, + "column": 24 } }, "callee": { "type": "Identifier", - "start": 696, - "end": 702, + "start": 546, + "end": 552, "loc": { "start": { - "line": 24, + "line": 23, "column": 1 }, "end": { - "line": 24, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -2734,43 +2517,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 703, - "end": 720, + "start": 553, + "end": 568, "loc": { "start": { - "line": 24, + "line": 23, "column": 8 }, "end": { - "line": 24, - "column": 25 + "line": 23, + "column": 23 } }, "left": { "type": "MemberExpression", - "start": 703, - "end": 711, + "start": 553, + "end": 559, "loc": { "start": { - "line": 24, + "line": 23, "column": 8 }, "end": { - "line": 24, - "column": 16 + "line": 23, + "column": 14 } }, "object": { "type": "Identifier", - "start": 703, - "end": 704, + "start": 553, + "end": 554, "loc": { "start": { - "line": 24, + "line": 23, "column": 8 }, "end": { - "line": 24, + "line": 23, "column": 9 }, "identifierName": "n" @@ -2779,36 +2562,36 @@ }, "property": { "type": "Identifier", - "start": 705, - "end": 711, + "start": 555, + "end": 559, "loc": { "start": { - "line": 24, + "line": 23, "column": 10 }, "end": { - "line": 24, - "column": 16 + "line": 23, + "column": 14 }, - "identifierName": "parent" + "identifierName": "left" }, - "name": "parent" + "name": "left" }, "computed": false }, - "operator": "!==", + "operator": "===", "right": { "type": "NullLiteral", - "start": 716, - "end": 720, + "start": 564, + "end": 568, "loc": { "start": { - "line": 24, - "column": 21 + "line": 23, + "column": 19 }, "end": { - "line": 24, - "column": 25 + "line": 23, + "column": 23 } } } @@ -2816,146 +2599,45 @@ ] } }, - { - "type": "VariableDeclaration", - "start": 724, - "end": 745, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 22 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 730, - "end": 744, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "start": 730, - "end": 731, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 8 - }, - "identifierName": "s" - }, - "name": "s" - }, - "init": { - "type": "CallExpression", - "start": 734, - "end": 744, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 734, - "end": 741, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 18 - }, - "identifierName": "sibling" - }, - "name": "sibling" - }, - "arguments": [ - { - "type": "Identifier", - "start": 742, - "end": 743, - "loc": { - "start": { - "line": 25, - "column": 19 - }, - "end": { - "line": 25, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const" - }, { "type": "ExpressionStatement", - "start": 747, - "end": 773, + "start": 572, + "end": 597, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, - "column": 27 + "line": 24, + "column": 26 } }, "expression": { "type": "CallExpression", - "start": 747, - "end": 772, + "start": 572, + "end": 596, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, - "column": 26 + "line": 24, + "column": 25 } }, "callee": { "type": "Identifier", - "start": 747, - "end": 753, + "start": 572, + "end": 578, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -2965,1427 +2647,1197 @@ "arguments": [ { "type": "BinaryExpression", - "start": 754, - "end": 771, + "start": 579, + "end": 595, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, - "column": 25 + "line": 24, + "column": 24 } }, "left": { - "type": "Identifier", - "start": 754, - "end": 755, + "type": "MemberExpression", + "start": 579, + "end": 586, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, - "column": 9 + "line": 24, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 579, + "end": 580, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "s" + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 581, + "end": 586, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" }, - "name": "s" + "computed": false }, - "operator": "instanceof", + "operator": "===", "right": { - "type": "Identifier", - "start": 767, - "end": 771, + "type": "NullLiteral", + "start": 591, + "end": 595, "loc": { "start": { - "line": 26, - "column": 21 + "line": 24, + "column": 20 }, "end": { - "line": 26, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" + "line": 24, + "column": 24 + } + } } } ] } }, { - "type": "ExpressionStatement", - "start": 775, - "end": 802, + "type": "IfStatement", + "start": 600, + "end": 678, "loc": { "start": { - "line": 27, + "line": 26, "column": 1 }, "end": { - "line": 27, - "column": 28 + "line": 30, + "column": 2 } }, - "expression": { - "type": "CallExpression", - "start": 775, - "end": 801, + "test": { + "type": "BinaryExpression", + "start": 604, + "end": 622, "loc": { "start": { - "line": 27, - "column": 1 + "line": 26, + "column": 5 }, "end": { - "line": 27, - "column": 27 + "line": 26, + "column": 23 } }, - "callee": { - "type": "Identifier", - "start": 775, - "end": 781, + "left": { + "type": "MemberExpression", + "start": 604, + "end": 612, "loc": { "start": { - "line": 27, - "column": 1 + "line": 26, + "column": 5 }, "end": { - "line": 27, - "column": 7 + "line": 26, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 604, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + }, + "identifierName": "n" }, - "identifierName": "assert" + "name": "n" }, - "name": "assert" + "property": { + "type": "Identifier", + "start": 606, + "end": 612, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "arguments": [ + "operator": "!==", + "right": { + "type": "Identifier", + "start": 617, + "end": 622, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "consequent": { + "type": "BlockStatement", + "start": 624, + "end": 678, + "loc": { + "start": { + "line": 26, + "column": 25 + }, + "end": { + "line": 30, + "column": 2 + } + }, + "body": [ { - "type": "BinaryExpression", - "start": 782, - "end": 800, + "type": "ExpressionStatement", + "start": 628, + "end": 653, "loc": { "start": { "line": 27, - "column": 8 + "column": 2 }, "end": { "line": 27, - "column": 26 + "column": 27 } }, - "left": { - "type": "MemberExpression", - "start": 782, - "end": 790, + "expression": { + "type": "CallExpression", + "start": 628, + "end": 652, "loc": { "start": { "line": 27, - "column": 8 + "column": 2 }, "end": { "line": 27, - "column": 16 + "column": 26 } }, - "object": { + "callee": { "type": "Identifier", - "start": 782, - "end": 783, + "start": 628, + "end": 634, "loc": { "start": { "line": 27, - "column": 8 + "column": 2 }, "end": { "line": 27, - "column": 9 + "column": 8 }, - "identifierName": "s" + "identifierName": "assert" }, - "name": "s" + "name": "assert" }, - "property": { - "type": "Identifier", - "start": 784, - "end": 790, - "loc": { - "start": { - "line": 27, - "column": 10 + "arguments": [ + { + "type": "BinaryExpression", + "start": 635, + "end": 651, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 25 + } }, - "end": { - "line": 27, - "column": 16 + "left": { + "type": "MemberExpression", + "start": 635, + "end": 643, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 635, + "end": 636, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 637, + "end": 643, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "identifierName": "_color" - }, - "name": "_color" + "operator": "===", + "right": { + "type": "Identifier", + "start": 648, + "end": 651, + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 25 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 656, + "end": 665, + "loc": { + "start": { + "line": 28, + "column": 2 }, - "computed": false + "end": { + "line": 28, + "column": 11 + } }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 795, - "end": 800, + "expression": { + "type": "CallExpression", + "start": 656, + "end": 664, "loc": { "start": { - "line": 27, - "column": 21 + "line": 28, + "column": 2 }, "end": { - "line": 27, - "column": 26 + "line": 28, + "column": 10 + } + }, + "callee": { + "type": "Identifier", + "start": 656, + "end": 661, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "prune" }, - "identifierName": "BLACK" + "name": "prune" }, - "name": "BLACK" + "arguments": [ + { + "type": "Identifier", + "start": 662, + "end": 663, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + } + ] } + }, + { + "type": "ReturnStatement", + "start": 668, + "end": 675, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 9 + } + }, + "argument": null } - ] + ], + "directives": [], + "trailingComments": null }, + "alternate": null, "trailingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 805, - "end": 1347, + "type": "CommentLine", + "value": " Mock leaf since there is no left child", + "start": 681, + "end": 722, "loc": { "start": { - "line": 29, + "line": 32, "column": 1 }, "end": { - "line": 41, - "column": 4 + "line": 32, + "column": 42 + } + } + }, + { + "type": "CommentLine", + "value": " We use key = n.key to avoid mixing types, but this property is never", + "start": 724, + "end": 795, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " accessed.", + "start": 797, + "end": 809, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 } } } ] }, { - "type": "IfStatement", - "start": 1349, - "end": 1545, + "type": "VariableDeclaration", + "start": 811, + "end": 847, "loc": { "start": { - "line": 42, + "line": 35, "column": 1 }, "end": { - "line": 52, - "column": 22 + "line": 35, + "column": 37 } }, - "test": { - "type": "LogicalExpression", - "start": 1356, - "end": 1440, - "loc": { - "start": { - "line": 43, - "column": 2 - }, - "end": { - "line": 45, - "column": 26 - } - }, - "left": { - "type": "LogicalExpression", - "start": 1356, - "end": 1410, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 817, + "end": 846, "loc": { "start": { - "line": 43, - "column": 2 + "line": 35, + "column": 7 }, "end": { - "line": 44, - "column": 25 + "line": 35, + "column": 36 } }, - "left": { - "type": "BinaryExpression", - "start": 1356, - "end": 1381, + "id": { + "type": "Identifier", + "start": 817, + "end": 821, "loc": { "start": { - "line": 43, - "column": 2 + "line": 35, + "column": 7 }, "end": { - "line": 43, - "column": 27 + "line": 35, + "column": 11 + }, + "identifierName": "leaf" + }, + "name": "leaf", + "leadingComments": null + }, + "init": { + "type": "NewExpression", + "start": 824, + "end": 846, + "loc": { + "start": { + "line": 35, + "column": 14 + }, + "end": { + "line": 35, + "column": 36 } }, - "left": { - "type": "MemberExpression", - "start": 1356, - "end": 1371, + "callee": { + "type": "Identifier", + "start": 828, + "end": 832, "loc": { "start": { - "line": 43, - "column": 2 + "line": 35, + "column": 18 }, "end": { - "line": 43, - "column": 17 - } + "line": 35, + "column": 22 + }, + "identifierName": "Node" }, - "object": { - "type": "MemberExpression", - "start": 1356, - "end": 1364, - "loc": { - "start": { - "line": 43, - "column": 2 - }, - "end": { - "line": 43, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1356, - "end": 1357, - "loc": { - "start": { - "line": 43, - "column": 2 - }, - "end": { - "line": 43, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1358, - "end": 1364, - "loc": { - "start": { - "line": 43, - "column": 4 - }, - "end": { - "line": 43, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { + "name": "Node" + }, + "arguments": [ + { "type": "Identifier", - "start": 1365, - "end": 1371, + "start": 833, + "end": 838, "loc": { "start": { - "line": 43, - "column": 11 + "line": 35, + "column": 23 }, "end": { - "line": 43, - "column": 17 + "line": 35, + "column": 28 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1376, - "end": 1381, - "loc": { - "start": { - "line": 43, - "column": 22 - }, - "end": { - "line": 43, - "column": 27 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1387, - "end": 1410, - "loc": { - "start": { - "line": 44, - "column": 2 - }, - "end": { - "line": 44, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 1387, - "end": 1400, - "loc": { - "start": { - "line": 44, - "column": 2 + "identifierName": "BLACK" }, - "end": { - "line": 44, - "column": 15 - } + "name": "BLACK" }, - "object": { + { "type": "MemberExpression", - "start": 1387, - "end": 1393, + "start": 840, + "end": 845, "loc": { "start": { - "line": 44, - "column": 2 + "line": 35, + "column": 30 }, "end": { - "line": 44, - "column": 8 + "line": 35, + "column": 35 } }, "object": { "type": "Identifier", - "start": 1387, - "end": 1388, + "start": 840, + "end": 841, "loc": { "start": { - "line": 44, - "column": 2 + "line": 35, + "column": 30 }, "end": { - "line": 44, - "column": 3 + "line": 35, + "column": 31 }, - "identifierName": "s" + "identifierName": "n" }, - "name": "s" + "name": "n" }, "property": { "type": "Identifier", - "start": 1389, - "end": 1393, + "start": 842, + "end": 845, "loc": { "start": { - "line": 44, - "column": 4 + "line": 35, + "column": 32 }, "end": { - "line": 44, - "column": 8 + "line": 35, + "column": 35 }, - "identifierName": "left" + "identifierName": "key" }, - "name": "left" + "name": "key" }, "computed": false - }, - "property": { - "type": "Identifier", - "start": 1394, - "end": 1400, - "loc": { - "start": { - "line": 44, - "column": 9 - }, - "end": { - "line": 44, - "column": 15 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1405, - "end": 1410, - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } + } + ] }, "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentLine", + "value": " Mock leaf since there is no left child", + "start": 681, + "end": 722, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 42 + } + } }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1416, - "end": 1440, + { + "type": "CommentLine", + "value": " We use key = n.key to avoid mixing types, but this property is never", + "start": 724, + "end": 795, "loc": { "start": { - "line": 45, - "column": 2 + "line": 33, + "column": 1 }, "end": { - "line": 45, - "column": 26 + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " accessed.", + "start": 797, + "end": 809, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Replace n with the mocked leaf", + "start": 850, + "end": 883, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 34 } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 885, + "end": 907, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 23 + } + }, + "expression": { + "type": "CallExpression", + "start": 885, + "end": 906, + "loc": { + "start": { + "line": 38, + "column": 1 }, - "left": { - "type": "MemberExpression", - "start": 1416, - "end": 1430, + "end": { + "line": 38, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 885, + "end": 897, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 13 + }, + "identifierName": "replace_node" + }, + "name": "replace_node", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 898, + "end": 899, "loc": { "start": { - "line": 45, - "column": 2 + "line": 38, + "column": 14 }, "end": { - "line": 45, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 1416, - "end": 1423, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 1416, - "end": 1417, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1418, - "end": 1423, - "loc": { - "start": { - "line": 45, - "column": 4 - }, - "end": { - "line": 45, - "column": 9 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1424, - "end": 1430, - "loc": { - "start": { - "line": 45, - "column": 10 - }, - "end": { - "line": 45, - "column": 16 - }, - "identifierName": "_color" + "line": 38, + "column": 15 }, - "name": "_color" + "identifierName": "n" }, - "computed": false + "name": "n" }, - "operator": "===", - "right": { + { "type": "Identifier", - "start": 1435, - "end": 1440, + "start": 901, + "end": 905, "loc": { "start": { - "line": 45, - "column": 21 + "line": 38, + "column": 17 }, "end": { - "line": 45, - "column": 26 + "line": 38, + "column": 21 }, - "identifierName": "BLACK" + "identifierName": "leaf" }, - "name": "BLACK" + "name": "leaf" } - }, + ], "leadingComments": null }, - "consequent": { - "type": "BlockStatement", - "start": 1444, - "end": 1492, - "loc": { - "start": { - "line": 46, - "column": 3 - }, - "end": { - "line": 49, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1448, - "end": 1463, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 17 - } + "leadingComments": [ + { + "type": "CommentLine", + "value": " Replace n with the mocked leaf", + "start": 850, + "end": 883, + "loc": { + "start": { + "line": 37, + "column": 1 }, - "expression": { - "type": "AssignmentExpression", - "start": 1448, - "end": 1462, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 16 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1448, - "end": 1456, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1448, - "end": 1449, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1450, - "end": 1456, - "loc": { - "start": { - "line": 47, - "column": 4 - }, - "end": { - "line": 47, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1459, - "end": 1462, - "loc": { - "start": { - "line": 47, - "column": 13 - }, - "end": { - "line": 47, - "column": 16 - }, - "identifierName": "RED" - }, - "name": "RED" - } + "end": { + "line": 37, + "column": 34 } - }, - { - "type": "ExpressionStatement", - "start": 1466, - "end": 1489, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 25 - } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 910, + "end": 984, + "loc": { + "start": { + "line": 40, + "column": 1 }, - "expression": { - "type": "CallExpression", - "start": 1466, - "end": 1488, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 1466, - "end": 1478, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 14 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1479, - "end": 1487, - "loc": { - "start": { - "line": 48, - "column": 15 - }, - "end": { - "line": 48, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1479, - "end": 1480, - "loc": { - "start": { - "line": 48, - "column": 15 - }, - "end": { - "line": 48, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1481, - "end": 1487, - "loc": { - "start": { - "line": 48, - "column": 17 - }, - "end": { - "line": 48, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] + "end": { + "line": 40, + "column": 75 } } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1495, - "end": 1522, - "loc": { - "start": { - "line": 51, - "column": 1 - }, - "end": { - "line": 51, - "column": 28 - } + }, + { + "type": "CommentLine", + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 986, + "end": 1057, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 72 } } - ] + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1059, + "end": 1078, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 42, + "column": 20 + } }, - "alternate": { - "type": "ExpressionStatement", - "start": 1529, - "end": 1545, + "expression": { + "type": "CallExpression", + "start": 1059, + "end": 1077, "loc": { "start": { - "line": 52, - "column": 6 + "line": 42, + "column": 1 }, "end": { - "line": 52, - "column": 22 + "line": 42, + "column": 19 } }, - "expression": { - "type": "CallExpression", - "start": 1529, - "end": 1544, + "callee": { + "type": "Identifier", + "start": 1059, + "end": 1071, "loc": { "start": { - "line": 52, - "column": 6 + "line": 42, + "column": 1 }, "end": { - "line": 52, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 1529, - "end": 1541, - "loc": { - "start": { - "line": 52, - "column": 6 - }, - "end": { - "line": 52, - "column": 18 - }, - "identifierName": "delete_case4" + "line": 42, + "column": 13 }, - "name": "delete_case4", - "leadingComments": null + "identifierName": "delete_case1" }, - "arguments": [ - { - "type": "Identifier", - "start": 1542, - "end": 1543, - "loc": { - "start": { - "line": 52, - "column": 19 - }, - "end": { - "line": 52, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ], + "name": "delete_case1", "leadingComments": null }, - "leadingComments": [ + "arguments": [ { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1495, - "end": 1522, + "type": "Identifier", + "start": 1072, + "end": 1076, "loc": { "start": { - "line": 51, - "column": 1 + "line": 42, + "column": 14 }, "end": { - "line": 51, - "column": 28 - } - } + "line": 42, + "column": 18 + }, + "identifierName": "leaf" + }, + "name": "leaf" } - ] + ], + "leadingComments": null }, "leadingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 805, - "end": 1347, + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 910, + "end": 984, "loc": { "start": { - "line": 29, + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 986, + "end": 1057, + "loc": { + "start": { + "line": 41, "column": 1 }, "end": { "line": 41, - "column": 4 + "column": 72 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Delete mocked leaf", + "start": 1081, + "end": 1102, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 22 } } } ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 315, - "end": 586, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 20, - "column": 3 - } - } - } - ], - "trailingComments": [] - } - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 315, - "end": 586, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 20, - "column": 3 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 805, - "end": 1347, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 41, - "column": 4 - } - } - }, - { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1495, - "end": 1522, - "loc": { - "start": { - "line": 51, - "column": 1 - }, - "end": { - "line": 51, - "column": 28 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 + }, + { + "type": "ExpressionStatement", + "start": 1104, + "end": 1116, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 13 + } + }, + "expression": { + "type": "CallExpression", + "start": 1104, + "end": 1115, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 12 + } + }, + "callee": { + "type": "Identifier", + "start": 1104, + "end": 1109, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 6 + }, + "identifierName": "prune" + }, + "name": "prune", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1110, + "end": 1114, + "loc": { + "start": { + "line": 45, + "column": 7 + }, + "end": { + "line": 45, + "column": 11 + }, + "identifierName": "leaf" + }, + "name": "leaf" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Delete mocked leaf", + "start": 1081, + "end": 1102, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 22 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n ", + "start": 267, + "end": 455, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + } + ], + "trailingComments": [] } } - }, + ], + "directives": [] + }, + "comments": [ { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 42, - "end": 46, + "type": "CommentBlock", + "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n ", + "start": 267, + "end": 455, "loc": { "start": { - "line": 2, - "column": 13 + "line": 11, + "column": 0 }, "end": { - "line": 2, - "column": 17 + "line": 19, + "column": 3 } } }, { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/BLACK.js", - "start": 47, - "end": 66, + "type": "CommentLine", + "value": " Mock leaf since there is no left child", + "start": 681, + "end": 722, "loc": { "start": { - "line": 2, - "column": 18 + "line": 32, + "column": 1 }, "end": { - "line": 2, - "column": 37 + "line": 32, + "column": 42 } } }, { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 66, - "end": 67, + "type": "CommentLine", + "value": " We use key = n.key to avoid mixing types, but this property is never", + "start": 724, + "end": 795, "loc": { "start": { - "line": 2, - "column": 37 + "line": 33, + "column": 1 }, "end": { - "line": 2, - "column": 38 + "line": 33, + "column": 72 } } }, { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 68, - "end": 74, + "type": "CommentLine", + "value": " accessed.", + "start": 797, + "end": 809, "loc": { "start": { - "line": 3, - "column": 0 + "line": 34, + "column": 1 }, "end": { - "line": 3, - "column": 6 + "line": 34, + "column": 13 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 75, - "end": 78, + "type": "CommentLine", + "value": " Replace n with the mocked leaf", + "start": 850, + "end": 883, "loc": { "start": { - "line": 3, - "column": 7 + "line": 37, + "column": 1 }, "end": { - "line": 3, - "column": 10 + "line": 37, + "column": 34 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 79, - "end": 83, + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 910, + "end": 984, "loc": { "start": { - "line": 3, - "column": 11 + "line": 40, + "column": 1 }, "end": { - "line": 3, - "column": 15 + "line": 40, + "column": 75 } } }, { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/RED.js", - "start": 84, - "end": 101, + "type": "CommentLine", + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 986, + "end": 1057, "loc": { "start": { - "line": 3, - "column": 16 + "line": 41, + "column": 1 }, "end": { - "line": 3, - "column": 33 + "line": 41, + "column": 72 } } }, { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 101, - "end": 102, + "type": "CommentLine", + "value": " Delete mocked leaf", + "start": 1081, + "end": 1102, "loc": { "start": { - "line": 3, - "column": 33 + "line": 44, + "column": 1 }, "end": { - "line": 3, - "column": 34 + "line": 44, + "column": 22 } } - }, + } + ], + "tokens": [ { "type": { "label": "import", @@ -4401,15 +3853,15 @@ "updateContext": null }, "value": "import", - "start": 103, - "end": 109, + "start": 0, + "end": 6, "loc": { "start": { - "line": 4, + "line": 1, "column": 0 }, "end": { - "line": 4, + "line": 1, "column": 6 } } @@ -4426,17 +3878,17 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 110, - "end": 114, + "value": "assert", + "start": 7, + "end": 13, "loc": { "start": { - "line": 4, + "line": 1, "column": 7 }, "end": { - "line": 4, - "column": 11 + "line": 1, + "column": 13 } } }, @@ -4453,16 +3905,16 @@ "binop": null }, "value": "from", - "start": 115, - "end": 119, + "start": 14, + "end": 18, "loc": { "start": { - "line": 4, - "column": 12 + "line": 1, + "column": 14 }, "end": { - "line": 4, - "column": 16 + "line": 1, + "column": 18 } } }, @@ -4479,17 +3931,17 @@ "binop": null, "updateContext": null }, - "value": "../types/Node.js", - "start": 120, - "end": 138, + "value": "assert", + "start": 19, + "end": 27, "loc": { - "start": { - "line": 4, - "column": 17 + "start": { + "line": 1, + "column": 19 }, "end": { - "line": 4, - "column": 35 + "line": 1, + "column": 27 } } }, @@ -4506,16 +3958,16 @@ "binop": null, "updateContext": null }, - "start": 138, - "end": 139, + "start": 27, + "end": 28, "loc": { "start": { - "line": 4, - "column": 35 + "line": 1, + "column": 27 }, "end": { - "line": 4, - "column": 36 + "line": 1, + "column": 28 } } }, @@ -4534,15 +3986,15 @@ "updateContext": null }, "value": "import", - "start": 140, - "end": 146, + "start": 29, + "end": 35, "loc": { "start": { - "line": 5, + "line": 2, "column": 0 }, "end": { - "line": 5, + "line": 2, "column": 6 } } @@ -4559,17 +4011,17 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 147, - "end": 151, + "value": "BLACK", + "start": 36, + "end": 41, "loc": { "start": { - "line": 5, + "line": 2, "column": 7 }, "end": { - "line": 5, - "column": 11 + "line": 2, + "column": 12 } } }, @@ -4586,16 +4038,16 @@ "binop": null }, "value": "from", - "start": 152, - "end": 156, + "start": 42, + "end": 46, "loc": { "start": { - "line": 5, - "column": 12 + "line": 2, + "column": 13 }, "end": { - "line": 5, - "column": 16 + "line": 2, + "column": 17 } } }, @@ -4612,17 +4064,17 @@ "binop": null, "updateContext": null }, - "value": "../types/Leaf.js", - "start": 157, - "end": 175, + "value": "../color/BLACK.js", + "start": 47, + "end": 66, "loc": { "start": { - "line": 5, - "column": 17 + "line": 2, + "column": 18 }, "end": { - "line": 5, - "column": 35 + "line": 2, + "column": 37 } } }, @@ -4639,16 +4091,16 @@ "binop": null, "updateContext": null }, - "start": 175, - "end": 176, + "start": 66, + "end": 67, "loc": { "start": { - "line": 5, - "column": 35 + "line": 2, + "column": 37 }, "end": { - "line": 5, - "column": 36 + "line": 2, + "column": 38 } } }, @@ -4667,15 +4119,15 @@ "updateContext": null }, "value": "import", - "start": 177, - "end": 183, + "start": 68, + "end": 74, "loc": { "start": { - "line": 6, + "line": 3, "column": 0 }, "end": { - "line": 6, + "line": 3, "column": 6 } } @@ -4692,17 +4144,17 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 184, - "end": 191, + "value": "RED", + "start": 75, + "end": 78, "loc": { "start": { - "line": 6, + "line": 3, "column": 7 }, "end": { - "line": 6, - "column": 14 + "line": 3, + "column": 10 } } }, @@ -4719,16 +4171,16 @@ "binop": null }, "value": "from", - "start": 192, - "end": 196, + "start": 79, + "end": 83, "loc": { "start": { - "line": 6, - "column": 15 + "line": 3, + "column": 11 }, "end": { - "line": 6, - "column": 19 + "line": 3, + "column": 15 } } }, @@ -4745,17 +4197,17 @@ "binop": null, "updateContext": null }, - "value": "../family/sibling.js", - "start": 197, - "end": 219, + "value": "../color/RED.js", + "start": 84, + "end": 101, "loc": { "start": { - "line": 6, - "column": 20 + "line": 3, + "column": 16 }, "end": { - "line": 6, - "column": 42 + "line": 3, + "column": 33 } } }, @@ -4772,16 +4224,16 @@ "binop": null, "updateContext": null }, - "start": 219, - "end": 220, + "start": 101, + "end": 102, "loc": { "start": { - "line": 6, - "column": 42 + "line": 3, + "column": 33 }, "end": { - "line": 6, - "column": 43 + "line": 3, + "column": 34 } } }, @@ -4800,15 +4252,15 @@ "updateContext": null }, "value": "import", - "start": 222, - "end": 228, + "start": 103, + "end": 109, "loc": { "start": { - "line": 8, + "line": 4, "column": 0 }, "end": { - "line": 8, + "line": 4, "column": 6 } } @@ -4825,17 +4277,17 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 229, - "end": 241, + "value": "Node", + "start": 110, + "end": 114, "loc": { "start": { - "line": 8, + "line": 4, "column": 7 }, "end": { - "line": 8, - "column": 19 + "line": 4, + "column": 11 } } }, @@ -4852,16 +4304,16 @@ "binop": null }, "value": "from", - "start": 242, - "end": 246, + "start": 115, + "end": 119, "loc": { "start": { - "line": 8, - "column": 20 + "line": 4, + "column": 12 }, "end": { - "line": 8, - "column": 24 + "line": 4, + "column": 16 } } }, @@ -4878,17 +4330,17 @@ "binop": null, "updateContext": null }, - "value": "./delete_case1.js", - "start": 247, - "end": 266, + "value": "../types/Node.js", + "start": 120, + "end": 138, "loc": { "start": { - "line": 8, - "column": 25 + "line": 4, + "column": 17 }, "end": { - "line": 8, - "column": 44 + "line": 4, + "column": 35 } } }, @@ -4905,16 +4357,16 @@ "binop": null, "updateContext": null }, - "start": 266, - "end": 267, + "start": 138, + "end": 139, "loc": { "start": { - "line": 8, - "column": 44 + "line": 4, + "column": 35 }, "end": { - "line": 8, - "column": 45 + "line": 4, + "column": 36 } } }, @@ -4933,15 +4385,15 @@ "updateContext": null }, "value": "import", - "start": 268, - "end": 274, + "start": 141, + "end": 147, "loc": { "start": { - "line": 9, + "line": 6, "column": 0 }, "end": { - "line": 9, + "line": 6, "column": 6 } } @@ -4958,16 +4410,16 @@ "postfix": false, "binop": null }, - "value": "delete_case4", - "start": 275, - "end": 287, + "value": "replace_node", + "start": 148, + "end": 160, "loc": { "start": { - "line": 9, + "line": 6, "column": 7 }, "end": { - "line": 9, + "line": 6, "column": 19 } } @@ -4985,15 +4437,15 @@ "binop": null }, "value": "from", - "start": 288, - "end": 292, + "start": 161, + "end": 165, "loc": { "start": { - "line": 9, + "line": 6, "column": 20 }, "end": { - "line": 9, + "line": 6, "column": 24 } } @@ -5011,16 +4463,16 @@ "binop": null, "updateContext": null }, - "value": "./delete_case4.js", - "start": 293, - "end": 312, + "value": "./replace_node.js", + "start": 166, + "end": 185, "loc": { "start": { - "line": 9, + "line": 6, "column": 25 }, "end": { - "line": 9, + "line": 6, "column": 44 } } @@ -5038,41 +4490,25 @@ "binop": null, "updateContext": null }, - "start": 312, - "end": 313, + "start": 185, + "end": 186, "loc": { "start": { - "line": 9, + "line": 6, "column": 44 }, "end": { - "line": 9, + "line": 6, "column": 45 } } }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n ", - "start": 315, - "end": 586, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 20, - "column": 3 - } - } - }, { "type": { - "label": "const", - "keyword": "const", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5081,17 +4517,17 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 587, - "end": 592, + "value": "import", + "start": 187, + "end": 193, "loc": { "start": { - "line": 21, + "line": 7, "column": 0 }, "end": { - "line": 21, - "column": 5 + "line": 7, + "column": 6 } } }, @@ -5107,69 +4543,17 @@ "postfix": false, "binop": null }, - "value": "delete_case3", - "start": 593, - "end": 605, + "value": "delete_case1", + "start": 194, + "end": 206, "loc": { "start": { - "line": 21, - "column": 6 + "line": 7, + "column": 7 }, "end": { - "line": 21, - "column": 18 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 606, - "end": 607, - "loc": { - "start": { - "line": 21, + "line": 7, "column": 19 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 608, - "end": 609, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 22 } } }, @@ -5185,48 +4569,50 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 609, - "end": 610, + "value": "from", + "start": 207, + "end": 211, "loc": { "start": { - "line": 21, - "column": 22 + "line": 7, + "column": 20 }, "end": { - "line": 21, - "column": 23 + "line": 7, + "column": 24 } } }, { "type": { - "label": ")", + "label": "string", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 610, - "end": 611, + "value": "./delete_case1.js", + "start": 212, + "end": 231, "loc": { "start": { - "line": 21, - "column": 23 + "line": 7, + "column": 25 }, "end": { - "line": 21, - "column": 24 + "line": 7, + "column": 44 } } }, { "type": { - "label": "=>", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5237,41 +4623,44 @@ "binop": null, "updateContext": null }, - "start": 612, - "end": 614, + "start": 231, + "end": 232, "loc": { "start": { - "line": 21, - "column": 25 + "line": 7, + "column": 44 }, "end": { - "line": 21, - "column": 27 + "line": 7, + "column": 45 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "import", + "keyword": "import", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 615, - "end": 616, + "value": "import", + "start": 234, + "end": 240, "loc": { "start": { - "line": 21, - "column": 28 + "line": 9, + "column": 0 }, "end": { - "line": 21, - "column": 29 + "line": 9, + "column": 6 } } }, @@ -5287,24 +4676,24 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 618, - "end": 624, + "value": "prune", + "start": 241, + "end": 246, "loc": { "start": { - "line": 22, - "column": 1 + "line": 9, + "column": 7 }, "end": { - "line": 22, - "column": 7 + "line": 9, + "column": 12 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5313,22 +4702,23 @@ "postfix": false, "binop": null }, - "start": 624, - "end": 625, + "value": "from", + "start": 247, + "end": 251, "loc": { "start": { - "line": 22, - "column": 7 + "line": 9, + "column": 13 }, "end": { - "line": 22, - "column": 8 + "line": 9, + "column": 17 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5336,26 +4726,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 625, - "end": 626, + "value": "./prune.js", + "start": 252, + "end": 264, "loc": { "start": { - "line": 22, - "column": 8 + "line": 9, + "column": 18 }, "end": { - "line": 22, - "column": 9 + "line": 9, + "column": 30 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5363,73 +4753,63 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 627, - "end": 637, + "start": 264, + "end": 265, "loc": { "start": { - "line": 22, - "column": 10 + "line": 9, + "column": 30 }, "end": { - "line": 22, - "column": 20 + "line": 9, + "column": 31 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 638, - "end": 642, + "type": "CommentBlock", + "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n ", + "start": 267, + "end": 455, "loc": { "start": { - "line": 22, - "column": 21 + "line": 11, + "column": 0 }, "end": { - "line": 22, - "column": 25 + "line": 19, + "column": 3 } } }, { "type": { - "label": "||", - "beforeExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 1, + "binop": null, "updateContext": null }, - "value": "||", - "start": 643, - "end": 645, + "value": "const", + "start": 456, + "end": 461, "loc": { "start": { - "line": 22, - "column": 26 + "line": 20, + "column": 0 }, "end": { - "line": 22, - "column": 28 + "line": 20, + "column": 5 } } }, @@ -5445,52 +4825,51 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 646, - "end": 647, + "value": "delete_no_child", + "start": 462, + "end": 477, "loc": { "start": { - "line": 22, - "column": 29 + "line": 20, + "column": 6 }, "end": { - "line": 22, - "column": 30 + "line": 20, + "column": 21 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 648, - "end": 658, + "value": "=", + "start": 478, + "end": 479, "loc": { "start": { - "line": 22, - "column": 31 + "line": 20, + "column": 22 }, "end": { - "line": 22, - "column": 41 + "line": 20, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5499,25 +4878,24 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 659, - "end": 663, + "start": 480, + "end": 481, "loc": { "start": { - "line": 22, - "column": 42 + "line": 20, + "column": 24 }, "end": { - "line": 22, - "column": 46 + "line": 20, + "column": 25 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5525,74 +4903,74 @@ "postfix": false, "binop": null }, - "start": 663, - "end": 664, + "value": "n", + "start": 481, + "end": 482, "loc": { "start": { - "line": 22, - "column": 46 + "line": 20, + "column": 25 }, "end": { - "line": 22, - "column": 47 + "line": 20, + "column": 26 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 664, - "end": 665, + "start": 482, + "end": 483, "loc": { "start": { - "line": 22, - "column": 47 + "line": 20, + "column": 26 }, "end": { - "line": 22, - "column": 48 + "line": 20, + "column": 27 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "=>", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 667, - "end": 673, + "start": 484, + "end": 486, "loc": { "start": { - "line": 23, - "column": 1 + "line": 20, + "column": 28 }, "end": { - "line": 23, - "column": 7 + "line": 20, + "column": 30 } } }, { "type": { - "label": "(", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -5602,16 +4980,16 @@ "postfix": false, "binop": null }, - "start": 673, - "end": 674, + "start": 487, + "end": 488, "loc": { "start": { - "line": 23, - "column": 7 + "line": 20, + "column": 31 }, "end": { - "line": 23, - "column": 8 + "line": 20, + "column": 32 } } }, @@ -5627,43 +5005,42 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 674, - "end": 675, + "value": "assert", + "start": 490, + "end": 496, "loc": { "start": { - "line": 23, - "column": 8 + "line": 21, + "column": 1 }, "end": { - "line": 23, - "column": 9 + "line": 21, + "column": 7 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 675, - "end": 676, + "start": 496, + "end": 497, "loc": { "start": { - "line": 23, - "column": 9 + "line": 21, + "column": 7 }, "end": { - "line": 23, - "column": 10 + "line": 21, + "column": 8 } } }, @@ -5679,23 +5056,24 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 676, - "end": 682, + "value": "n", + "start": 497, + "end": 498, "loc": { "start": { - "line": 23, - "column": 10 + "line": 21, + "column": 8 }, - "end": { - "line": 23, - "column": 16 + "end": { + "line": 21, + "column": 9 } } }, { "type": { - "label": "==/!=", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5703,19 +5081,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": 7, "updateContext": null }, - "value": "===", - "start": 683, - "end": 686, + "value": "instanceof", + "start": 499, + "end": 509, "loc": { "start": { - "line": 23, - "column": 17 + "line": 21, + "column": 10 }, "end": { - "line": 23, + "line": 21, "column": 20 } } @@ -5732,17 +5110,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 687, - "end": 692, + "value": "Node", + "start": 510, + "end": 514, "loc": { "start": { - "line": 23, + "line": 21, "column": 21 }, "end": { - "line": 23, - "column": 26 + "line": 21, + "column": 25 } } }, @@ -5758,16 +5136,16 @@ "postfix": false, "binop": null }, - "start": 692, - "end": 693, + "start": 514, + "end": 515, "loc": { "start": { - "line": 23, - "column": 26 + "line": 21, + "column": 25 }, "end": { - "line": 23, - "column": 27 + "line": 21, + "column": 26 } } }, @@ -5784,16 +5162,16 @@ "binop": null, "updateContext": null }, - "start": 693, - "end": 694, + "start": 515, + "end": 516, "loc": { "start": { - "line": 23, - "column": 27 + "line": 21, + "column": 26 }, "end": { - "line": 23, - "column": 28 + "line": 21, + "column": 27 } } }, @@ -5810,15 +5188,15 @@ "binop": null }, "value": "assert", - "start": 696, - "end": 702, + "start": 518, + "end": 524, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 7 } } @@ -5835,15 +5213,15 @@ "postfix": false, "binop": null }, - "start": 702, - "end": 703, + "start": 524, + "end": 525, "loc": { "start": { - "line": 24, + "line": 22, "column": 7 }, "end": { - "line": 24, + "line": 22, "column": 8 } } @@ -5861,15 +5239,15 @@ "binop": null }, "value": "n", - "start": 703, - "end": 704, + "start": 525, + "end": 526, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 9 } } @@ -5887,15 +5265,15 @@ "binop": null, "updateContext": null }, - "start": 704, - "end": 705, + "start": 526, + "end": 527, "loc": { "start": { - "line": 24, + "line": 22, "column": 9 }, "end": { - "line": 24, + "line": 22, "column": 10 } } @@ -5913,15 +5291,15 @@ "binop": null }, "value": "parent", - "start": 705, - "end": 711, + "start": 527, + "end": 533, "loc": { "start": { - "line": 24, + "line": 22, "column": 10 }, "end": { - "line": 24, + "line": 22, "column": 16 } } @@ -5940,15 +5318,15 @@ "updateContext": null }, "value": "!==", - "start": 712, - "end": 715, + "start": 534, + "end": 537, "loc": { "start": { - "line": 24, + "line": 22, "column": 17 }, "end": { - "line": 24, + "line": 22, "column": 20 } } @@ -5968,15 +5346,15 @@ "updateContext": null }, "value": "null", - "start": 716, - "end": 720, + "start": 538, + "end": 542, "loc": { "start": { - "line": 24, + "line": 22, "column": 21 }, "end": { - "line": 24, + "line": 22, "column": 25 } } @@ -5993,15 +5371,15 @@ "postfix": false, "binop": null }, - "start": 720, - "end": 721, + "start": 542, + "end": 543, "loc": { "start": { - "line": 24, + "line": 22, "column": 25 }, "end": { - "line": 24, + "line": 22, "column": 26 } } @@ -6019,51 +5397,49 @@ "binop": null, "updateContext": null }, - "start": 721, - "end": 722, + "start": 543, + "end": 544, "loc": { "start": { - "line": 24, + "line": 22, "column": 26 }, "end": { - "line": 24, + "line": 22, "column": 27 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 724, - "end": 729, + "value": "assert", + "start": 546, + "end": 552, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, - "column": 6 + "line": 23, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6072,43 +5448,67 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 730, - "end": 731, + "start": 552, + "end": 553, "loc": { "start": { - "line": 25, + "line": 23, "column": 7 }, "end": { - "line": 25, + "line": 23, "column": 8 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 553, + "end": 554, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 732, - "end": 733, + "start": 554, + "end": 555, "loc": { "start": { - "line": 25, + "line": 23, "column": 9 }, "end": { - "line": 25, + "line": 23, "column": 10 } } @@ -6125,48 +5525,51 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 734, - "end": 741, + "value": "left", + "start": 555, + "end": 559, "loc": { "start": { - "line": 25, - "column": 11 + "line": 23, + "column": 10 }, "end": { - "line": 25, - "column": 18 + "line": 23, + "column": 14 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 741, - "end": 742, + "value": "===", + "start": 560, + "end": 563, "loc": { "start": { - "line": 25, - "column": 18 + "line": 23, + "column": 15 }, "end": { - "line": 25, - "column": 19 + "line": 23, + "column": 18 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -6174,19 +5577,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 742, - "end": 743, + "value": "null", + "start": 564, + "end": 568, "loc": { "start": { - "line": 25, + "line": 23, "column": 19 }, "end": { - "line": 25, - "column": 20 + "line": 23, + "column": 23 } } }, @@ -6202,16 +5606,16 @@ "postfix": false, "binop": null }, - "start": 743, - "end": 744, + "start": 568, + "end": 569, "loc": { "start": { - "line": 25, - "column": 20 + "line": 23, + "column": 23 }, "end": { - "line": 25, - "column": 21 + "line": 23, + "column": 24 } } }, @@ -6228,16 +5632,16 @@ "binop": null, "updateContext": null }, - "start": 744, - "end": 745, + "start": 569, + "end": 570, "loc": { "start": { - "line": 25, - "column": 21 + "line": 23, + "column": 24 }, "end": { - "line": 25, - "column": 22 + "line": 23, + "column": 25 } } }, @@ -6254,15 +5658,15 @@ "binop": null }, "value": "assert", - "start": 747, - "end": 753, + "start": 572, + "end": 578, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 7 } } @@ -6279,15 +5683,15 @@ "postfix": false, "binop": null }, - "start": 753, - "end": 754, + "start": 578, + "end": 579, "loc": { "start": { - "line": 26, + "line": 24, "column": 7 }, "end": { - "line": 26, + "line": 24, "column": 8 } } @@ -6304,45 +5708,43 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 754, - "end": 755, + "value": "n", + "start": 579, + "end": 580, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 9 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 756, - "end": 766, + "start": 580, + "end": 581, "loc": { "start": { - "line": 26, - "column": 10 + "line": 24, + "column": 9 }, "end": { - "line": 26, - "column": 20 + "line": 24, + "column": 10 } } }, @@ -6356,19 +5758,74 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null + }, + "value": "right", + "start": 581, + "end": 586, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 587, + "end": 590, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null }, - "value": "Node", - "start": 767, - "end": 771, + "value": "null", + "start": 591, + "end": 595, "loc": { "start": { - "line": 26, - "column": 21 + "line": 24, + "column": 20 }, "end": { - "line": 26, - "column": 25 + "line": 24, + "column": 24 } } }, @@ -6384,16 +5841,16 @@ "postfix": false, "binop": null }, - "start": 771, - "end": 772, + "start": 595, + "end": 596, "loc": { "start": { - "line": 26, - "column": 25 + "line": 24, + "column": 24 }, "end": { - "line": 26, - "column": 26 + "line": 24, + "column": 25 } } }, @@ -6410,42 +5867,44 @@ "binop": null, "updateContext": null }, - "start": 772, - "end": 773, + "start": 596, + "end": 597, "loc": { "start": { - "line": 26, - "column": 26 + "line": 24, + "column": 25 }, "end": { - "line": 26, - "column": 27 + "line": 24, + "column": 26 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 775, - "end": 781, + "value": "if", + "start": 600, + "end": 602, "loc": { "start": { - "line": 27, + "line": 26, "column": 1 }, "end": { - "line": 27, - "column": 7 + "line": 26, + "column": 3 } } }, @@ -6461,16 +5920,16 @@ "postfix": false, "binop": null }, - "start": 781, - "end": 782, + "start": 603, + "end": 604, "loc": { "start": { - "line": 27, - "column": 7 + "line": 26, + "column": 4 }, "end": { - "line": 27, - "column": 8 + "line": 26, + "column": 5 } } }, @@ -6486,17 +5945,17 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 782, - "end": 783, + "value": "n", + "start": 604, + "end": 605, "loc": { "start": { - "line": 27, - "column": 8 + "line": 26, + "column": 5 }, "end": { - "line": 27, - "column": 9 + "line": 26, + "column": 6 } } }, @@ -6513,16 +5972,16 @@ "binop": null, "updateContext": null }, - "start": 783, - "end": 784, + "start": 605, + "end": 606, "loc": { "start": { - "line": 27, - "column": 9 + "line": 26, + "column": 6 }, "end": { - "line": 27, - "column": 10 + "line": 26, + "column": 7 } } }, @@ -6539,16 +5998,16 @@ "binop": null }, "value": "_color", - "start": 784, - "end": 790, + "start": 606, + "end": 612, "loc": { "start": { - "line": 27, - "column": 10 + "line": 26, + "column": 7 }, "end": { - "line": 27, - "column": 16 + "line": 26, + "column": 13 } } }, @@ -6565,17 +6024,17 @@ "binop": 6, "updateContext": null }, - "value": "===", - "start": 791, - "end": 794, + "value": "!==", + "start": 613, + "end": 616, "loc": { "start": { - "line": 27, - "column": 17 + "line": 26, + "column": 14 }, "end": { - "line": 27, - "column": 20 + "line": 26, + "column": 17 } } }, @@ -6592,16 +6051,16 @@ "binop": null }, "value": "BLACK", - "start": 795, - "end": 800, + "start": 617, + "end": 622, "loc": { "start": { - "line": 27, - "column": 21 + "line": 26, + "column": 18 }, "end": { - "line": 27, - "column": 26 + "line": 26, + "column": 23 } } }, @@ -6617,86 +6076,67 @@ "postfix": false, "binop": null }, - "start": 800, - "end": 801, + "start": 622, + "end": 623, "loc": { "start": { - "line": 27, - "column": 26 + "line": 26, + "column": 23 }, "end": { - "line": 27, - "column": 27 + "line": 26, + "column": 24 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 801, - "end": 802, - "loc": { - "start": { - "line": 27, - "column": 27 - }, - "end": { - "line": 27, - "column": 28 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 805, - "end": 1347, + "start": 624, + "end": 625, "loc": { "start": { - "line": 29, - "column": 1 + "line": 26, + "column": 25 }, "end": { - "line": 41, - "column": 4 + "line": 26, + "column": 26 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1349, - "end": 1351, + "value": "assert", + "start": 628, + "end": 634, "loc": { "start": { - "line": 42, - "column": 1 + "line": 27, + "column": 2 }, "end": { - "line": 42, - "column": 3 + "line": 27, + "column": 8 } } }, @@ -6712,16 +6152,16 @@ "postfix": false, "binop": null }, - "start": 1352, - "end": 1353, + "start": 634, + "end": 635, "loc": { "start": { - "line": 42, - "column": 4 + "line": 27, + "column": 8 }, "end": { - "line": 42, - "column": 5 + "line": 27, + "column": 9 } } }, @@ -6738,16 +6178,16 @@ "binop": null }, "value": "n", - "start": 1356, - "end": 1357, + "start": 635, + "end": 636, "loc": { "start": { - "line": 43, - "column": 2 + "line": 27, + "column": 9 }, "end": { - "line": 43, - "column": 3 + "line": 27, + "column": 10 } } }, @@ -6764,16 +6204,16 @@ "binop": null, "updateContext": null }, - "start": 1357, - "end": 1358, + "start": 636, + "end": 637, "loc": { "start": { - "line": 43, - "column": 3 + "line": 27, + "column": 10 }, "end": { - "line": 43, - "column": 4 + "line": 27, + "column": 11 } } }, @@ -6789,43 +6229,44 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1358, - "end": 1364, + "value": "_color", + "start": 637, + "end": 643, "loc": { "start": { - "line": 43, - "column": 4 + "line": 27, + "column": 11 }, "end": { - "line": 43, - "column": 10 + "line": 27, + "column": 17 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1364, - "end": 1365, + "value": "===", + "start": 644, + "end": 647, "loc": { "start": { - "line": 43, - "column": 10 + "line": 27, + "column": 18 }, "end": { - "line": 43, - "column": 11 + "line": 27, + "column": 21 } } }, @@ -6841,23 +6282,48 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1365, - "end": 1371, + "value": "RED", + "start": 648, + "end": 651, "loc": { "start": { - "line": 43, - "column": 11 + "line": 27, + "column": 22 }, "end": { - "line": 43, - "column": 17 + "line": 27, + "column": 25 } } }, { "type": { - "label": "==/!=", + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 651, + "end": 652, + "loc": { + "start": { + "line": 27, + "column": 25 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + { + "type": { + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -6865,27 +6331,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null, + "updateContext": null + }, + "start": 652, + "end": 653, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null }, - "value": "===", - "start": 1372, - "end": 1375, + "value": "prune", + "start": 656, + "end": 661, "loc": { "start": { - "line": 43, - "column": 18 + "line": 28, + "column": 2 }, "end": { - "line": 43, - "column": 21 + "line": 28, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6894,52 +6385,50 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1376, - "end": 1381, + "start": 661, + "end": 662, "loc": { "start": { - "line": 43, - "column": 22 + "line": 28, + "column": 7 }, "end": { - "line": 43, - "column": 27 + "line": 28, + "column": 8 } } }, { "type": { - "label": "&&", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 2, - "updateContext": null + "binop": null }, - "value": "&&", - "start": 1382, - "end": 1384, + "value": "n", + "start": 662, + "end": 663, "loc": { "start": { - "line": 43, - "column": 28 + "line": 28, + "column": 8 }, "end": { - "line": 43, - "column": 30 + "line": 28, + "column": 9 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6947,24 +6436,23 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1387, - "end": 1388, + "start": 663, + "end": 664, "loc": { "start": { - "line": 44, - "column": 2 + "line": 28, + "column": 9 }, "end": { - "line": 44, - "column": 3 + "line": 28, + "column": 10 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6974,49 +6462,51 @@ "binop": null, "updateContext": null }, - "start": 1388, - "end": 1389, + "start": 664, + "end": 665, "loc": { "start": { - "line": 44, - "column": 3 + "line": 28, + "column": 10 }, "end": { - "line": 44, - "column": 4 + "line": 28, + "column": 11 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "left", - "start": 1389, - "end": 1393, + "value": "return", + "start": 668, + "end": 674, "loc": { "start": { - "line": 44, - "column": 4 + "line": 29, + "column": 2 }, "end": { - "line": 44, + "line": 29, "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -7026,24 +6516,24 @@ "binop": null, "updateContext": null }, - "start": 1393, - "end": 1394, + "start": 674, + "end": 675, "loc": { "start": { - "line": 44, + "line": 29, "column": 8 }, "end": { - "line": 44, + "line": 29, "column": 9 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7051,44 +6541,92 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1394, - "end": 1400, + "start": 677, + "end": 678, "loc": { "start": { - "line": 44, - "column": 9 + "line": 30, + "column": 1 }, "end": { - "line": 44, - "column": 15 + "line": 30, + "column": 2 + } + } + }, + { + "type": "CommentLine", + "value": " Mock leaf since there is no left child", + "start": 681, + "end": 722, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 42 + } + } + }, + { + "type": "CommentLine", + "value": " We use key = n.key to avoid mixing types, but this property is never", + "start": 724, + "end": 795, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " accessed.", + "start": 797, + "end": 809, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 13 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1401, - "end": 1404, + "value": "const", + "start": 811, + "end": 816, "loc": { "start": { - "line": 44, - "column": 16 + "line": 35, + "column": 1 }, "end": { - "line": 44, - "column": 19 + "line": 35, + "column": 6 } } }, @@ -7104,96 +6642,72 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1405, - "end": 1410, + "value": "leaf", + "start": 817, + "end": 821, "loc": { "start": { - "line": 44, - "column": 20 + "line": 35, + "column": 7 }, "end": { - "line": 44, - "column": 25 + "line": 35, + "column": 11 } } }, { "type": { - "label": "&&", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 2, + "binop": null, "updateContext": null }, - "value": "&&", - "start": 1411, - "end": 1413, + "value": "=", + "start": 822, + "end": 823, "loc": { "start": { - "line": 44, - "column": 26 + "line": 35, + "column": 12 }, "end": { - "line": 44, - "column": 28 + "line": 35, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "new", + "keyword": "new", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "value": "s", - "start": 1416, - "end": 1417, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, "binop": null, "updateContext": null }, - "start": 1417, - "end": 1418, + "value": "new", + "start": 824, + "end": 827, "loc": { "start": { - "line": 45, - "column": 3 + "line": 35, + "column": 14 }, "end": { - "line": 45, - "column": 4 + "line": 35, + "column": 17 } } }, @@ -7209,43 +6723,42 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1418, - "end": 1423, + "value": "Node", + "start": 828, + "end": 832, "loc": { "start": { - "line": 45, - "column": 4 + "line": 35, + "column": 18 }, "end": { - "line": 45, - "column": 9 + "line": 35, + "column": 22 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1423, - "end": 1424, + "start": 832, + "end": 833, "loc": { "start": { - "line": 45, - "column": 9 + "line": 35, + "column": 22 }, "end": { - "line": 45, - "column": 10 + "line": 35, + "column": 23 } } }, @@ -7261,23 +6774,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1424, - "end": 1430, + "value": "BLACK", + "start": 833, + "end": 838, "loc": { "start": { - "line": 45, - "column": 10 + "line": 35, + "column": 23 }, "end": { - "line": 45, - "column": 16 + "line": 35, + "column": 28 } } }, { "type": { - "label": "==/!=", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7285,20 +6798,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1431, - "end": 1434, + "start": 838, + "end": 839, "loc": { "start": { - "line": 45, - "column": 17 + "line": 35, + "column": 28 }, "end": { - "line": 45, - "column": 20 + "line": 35, + "column": 29 } } }, @@ -7314,23 +6826,23 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1435, - "end": 1440, + "value": "n", + "start": 840, + "end": 841, "loc": { "start": { - "line": 45, - "column": 21 + "line": 35, + "column": 30 }, "end": { - "line": 45, - "column": 26 + "line": 35, + "column": 31 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7338,25 +6850,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1442, - "end": 1443, + "start": 841, + "end": 842, "loc": { "start": { - "line": 46, - "column": 1 + "line": 35, + "column": 31 }, "end": { - "line": 46, - "column": 2 + "line": 35, + "column": 32 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7365,24 +6878,25 @@ "postfix": false, "binop": null }, - "start": 1444, - "end": 1445, + "value": "key", + "start": 842, + "end": 845, "loc": { "start": { - "line": 46, - "column": 3 + "line": 35, + "column": 32 }, "end": { - "line": 46, - "column": 4 + "line": 35, + "column": 35 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7390,24 +6904,23 @@ "postfix": false, "binop": null }, - "value": "s", - "start": 1448, - "end": 1449, + "start": 845, + "end": 846, "loc": { "start": { - "line": 47, - "column": 2 + "line": 35, + "column": 35 }, "end": { - "line": 47, - "column": 3 + "line": 35, + "column": 36 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -7417,16 +6930,32 @@ "binop": null, "updateContext": null }, - "start": 1449, - "end": 1450, + "start": 846, + "end": 847, "loc": { "start": { - "line": 47, - "column": 3 + "line": 35, + "column": 36 }, "end": { - "line": 47, - "column": 4 + "line": 35, + "column": 37 + } + } + }, + { + "type": "CommentLine", + "value": " Replace n with the mocked leaf", + "start": 850, + "end": 883, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 34 } } }, @@ -7442,44 +6971,42 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1450, - "end": 1456, + "value": "replace_node", + "start": 885, + "end": 897, "loc": { "start": { - "line": 47, - "column": 4 + "line": 38, + "column": 1 }, "end": { - "line": 47, - "column": 10 + "line": 38, + "column": 13 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 1457, - "end": 1458, + "start": 897, + "end": 898, "loc": { "start": { - "line": 47, - "column": 11 + "line": 38, + "column": 13 }, "end": { - "line": 47, - "column": 12 + "line": 38, + "column": 14 } } }, @@ -7495,23 +7022,23 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 1459, - "end": 1462, + "value": "n", + "start": 898, + "end": 899, "loc": { "start": { - "line": 47, - "column": 13 + "line": 38, + "column": 14 }, "end": { - "line": 47, - "column": 16 + "line": 38, + "column": 15 } } }, { "type": { - "label": ";", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7522,16 +7049,16 @@ "binop": null, "updateContext": null }, - "start": 1462, - "end": 1463, + "start": 899, + "end": 900, "loc": { "start": { - "line": 47, - "column": 16 + "line": 38, + "column": 15 }, "end": { - "line": 47, - "column": 17 + "line": 38, + "column": 16 } } }, @@ -7547,25 +7074,25 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 1466, - "end": 1478, + "value": "leaf", + "start": 901, + "end": 905, "loc": { "start": { - "line": 48, - "column": 2 + "line": 38, + "column": 17 }, "end": { - "line": 48, - "column": 14 + "line": 38, + "column": 21 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7573,68 +7100,74 @@ "postfix": false, "binop": null }, - "start": 1478, - "end": 1479, + "start": 905, + "end": 906, "loc": { "start": { - "line": 48, - "column": 14 + "line": 38, + "column": 21 }, "end": { - "line": 48, - "column": 15 + "line": 38, + "column": 22 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 1479, - "end": 1480, + "start": 906, + "end": 907, "loc": { "start": { - "line": 48, - "column": 15 + "line": 38, + "column": 22 }, "end": { - "line": 48, - "column": 16 + "line": 38, + "column": 23 } } }, { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1480, - "end": 1481, + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 910, + "end": 984, "loc": { "start": { - "line": 48, - "column": 16 + "line": 40, + "column": 1 }, "end": { - "line": 48, - "column": 17 + "line": 40, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 986, + "end": 1057, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 72 } } }, @@ -7650,25 +7183,25 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1481, - "end": 1487, + "value": "delete_case1", + "start": 1059, + "end": 1071, "loc": { "start": { - "line": 48, - "column": 17 + "line": 42, + "column": 1 }, "end": { - "line": 48, - "column": 23 + "line": 42, + "column": 13 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7676,48 +7209,48 @@ "postfix": false, "binop": null }, - "start": 1487, - "end": 1488, + "start": 1071, + "end": 1072, "loc": { "start": { - "line": 48, - "column": 23 + "line": 42, + "column": 13 }, "end": { - "line": 48, - "column": 24 + "line": 42, + "column": 14 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1488, - "end": 1489, + "value": "leaf", + "start": 1072, + "end": 1076, "loc": { "start": { - "line": 48, - "column": 24 + "line": 42, + "column": 14 }, "end": { - "line": 48, - "column": 25 + "line": 42, + "column": 18 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7727,39 +7260,22 @@ "postfix": false, "binop": null }, - "start": 1491, - "end": 1492, - "loc": { - "start": { - "line": 49, - "column": 1 - }, - "end": { - "line": 49, - "column": 2 - } - } - }, - { - "type": "CommentLine", - "value": " Otherwise, go to case 4.", - "start": 1495, - "end": 1522, + "start": 1076, + "end": 1077, "loc": { "start": { - "line": 51, - "column": 1 + "line": 42, + "column": 18 }, "end": { - "line": 51, - "column": 28 + "line": 42, + "column": 19 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7770,17 +7286,32 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1524, - "end": 1528, + "start": 1077, + "end": 1078, + "loc": { + "start": { + "line": 42, + "column": 19 + }, + "end": { + "line": 42, + "column": 20 + } + } + }, + { + "type": "CommentLine", + "value": " Delete mocked leaf", + "start": 1081, + "end": 1102, "loc": { "start": { - "line": 52, + "line": 44, "column": 1 }, "end": { - "line": 52, - "column": 5 + "line": 44, + "column": 22 } } }, @@ -7796,17 +7327,17 @@ "postfix": false, "binop": null }, - "value": "delete_case4", - "start": 1529, - "end": 1541, + "value": "prune", + "start": 1104, + "end": 1109, "loc": { "start": { - "line": 52, - "column": 6 + "line": 45, + "column": 1 }, "end": { - "line": 52, - "column": 18 + "line": 45, + "column": 6 } } }, @@ -7822,16 +7353,16 @@ "postfix": false, "binop": null }, - "start": 1541, - "end": 1542, + "start": 1109, + "end": 1110, "loc": { "start": { - "line": 52, - "column": 18 + "line": 45, + "column": 6 }, "end": { - "line": 52, - "column": 19 + "line": 45, + "column": 7 } } }, @@ -7847,17 +7378,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1542, - "end": 1543, + "value": "leaf", + "start": 1110, + "end": 1114, "loc": { "start": { - "line": 52, - "column": 19 + "line": 45, + "column": 7 }, "end": { - "line": 52, - "column": 20 + "line": 45, + "column": 11 } } }, @@ -7873,16 +7404,16 @@ "postfix": false, "binop": null }, - "start": 1543, - "end": 1544, + "start": 1114, + "end": 1115, "loc": { "start": { - "line": 52, - "column": 20 + "line": 45, + "column": 11 }, "end": { - "line": 52, - "column": 21 + "line": 45, + "column": 12 } } }, @@ -7899,16 +7430,16 @@ "binop": null, "updateContext": null }, - "start": 1544, - "end": 1545, + "start": 1115, + "end": 1116, "loc": { "start": { - "line": 52, - "column": 21 + "line": 45, + "column": 12 }, "end": { - "line": 52, - "column": 22 + "line": 45, + "column": 13 } } }, @@ -7924,15 +7455,15 @@ "postfix": false, "binop": null }, - "start": 1546, - "end": 1547, + "start": 1117, + "end": 1118, "loc": { "start": { - "line": 53, + "line": 46, "column": 0 }, "end": { - "line": 53, + "line": 46, "column": 1 } } @@ -7950,15 +7481,15 @@ "binop": null, "updateContext": null }, - "start": 1547, - "end": 1548, + "start": 1118, + "end": 1119, "loc": { "start": { - "line": 53, + "line": 46, "column": 1 }, "end": { - "line": 53, + "line": 46, "column": 2 } } @@ -7978,15 +7509,15 @@ "updateContext": null }, "value": "export", - "start": 1550, - "end": 1556, + "start": 1121, + "end": 1127, "loc": { "start": { - "line": 55, + "line": 48, "column": 0 }, "end": { - "line": 55, + "line": 48, "column": 6 } } @@ -8006,15 +7537,15 @@ "updateContext": null }, "value": "default", - "start": 1557, - "end": 1564, + "start": 1128, + "end": 1135, "loc": { "start": { - "line": 55, + "line": 48, "column": 7 }, "end": { - "line": 55, + "line": 48, "column": 14 } } @@ -8031,17 +7562,17 @@ "postfix": false, "binop": null }, - "value": "delete_case3", - "start": 1565, - "end": 1577, + "value": "delete_no_child", + "start": 1136, + "end": 1151, "loc": { "start": { - "line": 55, + "line": 48, "column": 15 }, "end": { - "line": 55, - "column": 27 + "line": 48, + "column": 30 } } }, @@ -8058,16 +7589,16 @@ "binop": null, "updateContext": null }, - "start": 1577, - "end": 1578, + "start": 1151, + "end": 1152, "loc": { "start": { - "line": 55, - "column": 27 + "line": 48, + "column": 30 }, "end": { - "line": 55, - "column": 28 + "line": 48, + "column": 31 } } }, @@ -8084,15 +7615,15 @@ "binop": null, "updateContext": null }, - "start": 1579, - "end": 1579, + "start": 1153, + "end": 1153, "loc": { "start": { - "line": 56, + "line": 49, "column": 0 }, "end": { - "line": 56, + "line": 49, "column": 0 } } diff --git a/ast/source/deletion/delete_one_child.js.json b/ast/source/deletion/delete_one_child.js.json index 18a561b..7884b97 100644 --- a/ast/source/deletion/delete_one_child.js.json +++ b/ast/source/deletion/delete_one_child.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1555, + "end": 1126, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 52, + "line": 41, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1555, + "end": 1126, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 52, + "line": 41, "column": 0 } }, @@ -306,113 +306,44 @@ }, { "type": "ImportDeclaration", - "start": 140, - "end": 176, + "start": 141, + "end": 186, "loc": { "start": { - "line": 5, + "line": 6, "column": 0 }, "end": { - "line": 5, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" - } - }, - { - "type": "ImportDeclaration", - "start": 178, - "end": 223, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, + "line": 6, "column": 45 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 185, - "end": 197, + "start": 148, + "end": 160, "loc": { "start": { - "line": 7, + "line": 6, "column": 7 }, "end": { - "line": 7, + "line": 6, "column": 19 } }, "local": { "type": "Identifier", - "start": 185, - "end": 197, + "start": 148, + "end": 160, "loc": { "start": { - "line": 7, + "line": 6, "column": 7 }, "end": { - "line": 7, + "line": 6, "column": 19 }, "identifierName": "replace_node" @@ -423,15 +354,15 @@ ], "source": { "type": "StringLiteral", - "start": 203, - "end": 222, + "start": 166, + "end": 185, "loc": { "start": { - "line": 7, + "line": 6, "column": 25 }, "end": { - "line": 7, + "line": 6, "column": 44 } }, @@ -440,89 +371,20 @@ "raw": "'./replace_node.js'" }, "value": "./replace_node.js" - } - }, - { - "type": "ImportDeclaration", - "start": 224, - "end": 269, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 45 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 231, - "end": 243, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 231, - "end": 243, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 249, - "end": 268, - "loc": { - "start": { - "line": 8, - "column": 25 - }, - "end": { - "line": 8, - "column": 44 - } - }, - "extra": { - "rawValue": "./delete_case1.js", - "raw": "'./delete_case1.js'" - }, - "value": "./delete_case1.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n ", - "start": 271, - "end": 558, + "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", + "start": 188, + "end": 566, "loc": { "start": { - "line": 10, + "line": 8, "column": 0 }, "end": { - "line": 19, + "line": 21, "column": 3 } } @@ -531,44 +393,44 @@ }, { "type": "Identifier", - "start": 559, - "end": 1520, + "start": 567, + "end": 1091, "loc": { "start": { - "line": 20, + "line": 22, "column": 0 }, "end": { - "line": 49, + "line": 38, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 565, - "end": 1519, + "start": 573, + "end": 1090, "loc": { "start": { - "line": 20, + "line": 22, "column": 6 }, "end": { - "line": 49, + "line": 38, "column": 1 } }, "id": { "type": "Identifier", - "start": 565, - "end": 581, + "start": 573, + "end": 589, "loc": { "start": { - "line": 20, + "line": 22, "column": 6 }, "end": { - "line": 20, + "line": 22, "column": 22 }, "identifierName": "delete_one_child" @@ -578,15 +440,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 584, - "end": 1519, + "start": 592, + "end": 1090, "loc": { "start": { - "line": 20, + "line": 22, "column": 25 }, "end": { - "line": 49, + "line": 38, "column": 1 } }, @@ -597,15 +459,15 @@ "params": [ { "type": "Identifier", - "start": 585, - "end": 586, + "start": 593, + "end": 594, "loc": { "start": { - "line": 20, + "line": 22, "column": 26 }, "end": { - "line": 20, + "line": 22, "column": 27 }, "identifierName": "n" @@ -615,58 +477,58 @@ ], "body": { "type": "BlockStatement", - "start": 591, - "end": 1519, + "start": 599, + "end": 1090, "loc": { "start": { - "line": 20, + "line": 22, "column": 32 }, "end": { - "line": 49, + "line": 38, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 594, - "end": 620, + "start": 602, + "end": 628, "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 594, - "end": 619, + "start": 602, + "end": 627, "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 594, - "end": 600, + "start": 602, + "end": 608, "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -676,29 +538,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 601, - "end": 618, + "start": 609, + "end": 626, "loc": { "start": { - "line": 21, + "line": 23, "column": 8 }, "end": { - "line": 21, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 601, - "end": 602, + "start": 609, + "end": 610, "loc": { "start": { - "line": 21, + "line": 23, "column": 8 }, "end": { - "line": 21, + "line": 23, "column": 9 }, "identifierName": "n" @@ -708,15 +570,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 614, - "end": 618, + "start": 622, + "end": 626, "loc": { "start": { - "line": 21, + "line": 23, "column": 21 }, "end": { - "line": 21, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -725,160 +587,93 @@ } } ] - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " Precondition: n's right child is a leaf.", - "start": 622, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 44 - } - } - }, - { - "type": "CommentLine", - "value": " The right child of n is always a LEAF because either n is a subtree", - "start": 667, - "end": 737, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 71 - } - } - }, - { - "type": "CommentLine", - "value": " predecessor or it is the only child of its parent by the red-black tree", - "start": 739, - "end": 813, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " properties", - "start": 815, - "end": 828, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 14 - } - } - } - ] + } }, { "type": "ExpressionStatement", - "start": 830, - "end": 862, + "start": 630, + "end": 657, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, - "column": 33 + "line": 24, + "column": 28 } }, "expression": { "type": "CallExpression", - "start": 830, - "end": 861, + "start": 630, + "end": 656, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, - "column": 32 + "line": 24, + "column": 27 } }, "callee": { "type": "Identifier", - "start": 830, - "end": 836, + "start": 630, + "end": 636, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 7 }, "identifierName": "assert" }, - "name": "assert", - "leadingComments": null + "name": "assert" }, "arguments": [ { "type": "BinaryExpression", - "start": 837, - "end": 860, + "start": 637, + "end": 655, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, - "column": 31 + "line": 24, + "column": 26 } }, "left": { "type": "MemberExpression", - "start": 837, - "end": 844, + "start": 637, + "end": 645, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, - "column": 15 + "line": 24, + "column": 16 } }, "object": { "type": "Identifier", - "start": 837, - "end": 838, + "start": 637, + "end": 638, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 9 }, "identifierName": "n" @@ -887,99 +682,77 @@ }, "property": { "type": "Identifier", - "start": 839, - "end": 844, + "start": 639, + "end": 645, "loc": { "start": { - "line": 26, + "line": 24, "column": 10 }, "end": { - "line": 26, - "column": 15 + "line": 24, + "column": 16 }, - "identifierName": "right" + "identifierName": "_color" }, - "name": "right" + "name": "_color" }, "computed": false }, - "operator": "instanceof", + "operator": "===", "right": { "type": "Identifier", - "start": 856, - "end": 860, + "start": 650, + "end": 655, "loc": { "start": { - "line": 26, - "column": 27 + "line": 24, + "column": 21 }, "end": { - "line": 26, - "column": 31 + "line": 24, + "column": 26 }, - "identifierName": "Leaf" + "identifierName": "BLACK" }, - "name": "Leaf" - } - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Precondition: n's right child is a leaf.", - "start": 622, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 44 - } - } - }, - { - "type": "CommentLine", - "value": " The right child of n is always a LEAF because either n is a subtree", - "start": 667, - "end": 737, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 71 + "name": "BLACK" } } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 659, + "end": 685, + "loc": { + "start": { + "line": 25, + "column": 1 }, - { - "type": "CommentLine", - "value": " predecessor or it is the only child of its parent by the red-black tree", - "start": 739, - "end": 813, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 75 - } + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 659, + "end": 684, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 } }, - { - "type": "CommentLine", - "value": " properties", - "start": 815, - "end": 828, + "callee": { + "type": "Identifier", + "start": 659, + "end": 665, "loc": { "start": { "line": 25, @@ -987,1194 +760,1680 @@ }, "end": { "line": 25, - "column": 14 - } - } - } - ] + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 666, + "end": 683, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 666, + "end": 674, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 666, + "end": 667, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 668, + "end": 674, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 679, + "end": 683, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } + } + } + ] + } }, { - "type": "VariableDeclaration", - "start": 865, - "end": 886, + "type": "ExpressionStatement", + "start": 687, + "end": 718, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, - "column": 22 + "line": 26, + "column": 32 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 871, - "end": 885, + "expression": { + "type": "CallExpression", + "start": 687, + "end": 717, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 687, + "end": 693, "loc": { "start": { - "line": 28, - "column": 7 + "line": 26, + "column": 1 }, "end": { - "line": 28, - "column": 21 - } - }, - "id": { - "type": "Identifier", - "start": 871, - "end": 876, - "loc": { - "start": { - "line": 28, - "column": 7 - }, - "end": { - "line": 28, - "column": 12 - }, - "identifierName": "child" + "line": 26, + "column": 7 }, - "name": "child" + "identifierName": "assert" }, - "init": { - "type": "MemberExpression", - "start": 879, - "end": 885, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 694, + "end": 716, "loc": { "start": { - "line": 28, - "column": 15 + "line": 26, + "column": 8 }, "end": { - "line": 28, - "column": 21 + "line": 26, + "column": 30 } }, - "object": { - "type": "Identifier", - "start": 879, - "end": 880, + "left": { + "type": "MemberExpression", + "start": 694, + "end": 700, "loc": { "start": { - "line": 28, - "column": 15 + "line": 26, + "column": 8 }, "end": { - "line": 28, - "column": 16 + "line": 26, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 694, + "end": 695, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 696, + "end": 700, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 881, - "end": 885, + "start": 712, + "end": 716, "loc": { "start": { - "line": 28, - "column": 17 + "line": 26, + "column": 26 }, "end": { - "line": 28, - "column": 21 + "line": 26, + "column": 30 }, - "identifierName": "left" + "identifierName": "Node" }, - "name": "left" - }, - "computed": false - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentLine", - "value": " Replace n with its left child", - "start": 889, - "end": 921, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 33 + "name": "Node" } } - } - ] + ] + } }, { "type": "ExpressionStatement", - "start": 923, - "end": 946, + "start": 720, + "end": 750, "loc": { "start": { - "line": 31, + "line": 27, "column": 1 }, "end": { - "line": 31, - "column": 24 + "line": 27, + "column": 31 } }, "expression": { "type": "CallExpression", - "start": 923, - "end": 945, + "start": 720, + "end": 749, "loc": { "start": { - "line": 31, + "line": 27, "column": 1 }, "end": { - "line": 31, - "column": 23 + "line": 27, + "column": 30 } }, "callee": { "type": "Identifier", - "start": 923, - "end": 935, + "start": 720, + "end": 726, "loc": { "start": { - "line": 31, + "line": 27, "column": 1 }, "end": { - "line": 31, - "column": 13 + "line": 27, + "column": 7 }, - "identifierName": "replace_node" + "identifierName": "assert" }, - "name": "replace_node", - "leadingComments": null + "name": "assert" }, "arguments": [ { - "type": "Identifier", - "start": 936, - "end": 937, + "type": "BinaryExpression", + "start": 727, + "end": 748, "loc": { "start": { - "line": 31, - "column": 14 + "line": 27, + "column": 8 }, "end": { - "line": 31, - "column": 15 - }, - "identifierName": "n" + "line": 27, + "column": 29 + } }, - "name": "n" - }, - { - "type": "Identifier", - "start": 939, - "end": 944, - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 22 + "left": { + "type": "MemberExpression", + "start": 727, + "end": 740, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 21 + } }, - "identifierName": "child" - }, - "name": "child" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Replace n with its left child", - "start": 889, - "end": 921, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 33 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 949, - "end": 1023, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " through it by 1.", - "start": 1025, - "end": 1044, - "loc": { - "start": { - "line": 34, - "column": 1 + "object": { + "type": "MemberExpression", + "start": 727, + "end": 733, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 727, + "end": 728, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 729, + "end": 733, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 734, + "end": 740, + "loc": { + "start": { + "line": 27, + "column": 15 + }, + "end": { + "line": 27, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "end": { - "line": 34, - "column": 20 + "operator": "===", + "right": { + "type": "Identifier", + "start": 745, + "end": 748, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 29 + }, + "identifierName": "RED" + }, + "name": "RED" } } - } - ] + ] + } }, { - "type": "IfStatement", - "start": 1046, - "end": 1517, + "type": "ExpressionStatement", + "start": 752, + "end": 777, "loc": { "start": { - "line": 35, + "line": 28, "column": 1 }, "end": { - "line": 48, - "column": 2 + "line": 28, + "column": 26 } }, - "test": { - "type": "BinaryExpression", - "start": 1050, - "end": 1068, + "expression": { + "type": "CallExpression", + "start": 752, + "end": 776, "loc": { "start": { - "line": 35, - "column": 5 + "line": 28, + "column": 1 }, "end": { - "line": 35, - "column": 23 + "line": 28, + "column": 25 } }, - "left": { - "type": "MemberExpression", - "start": 1050, - "end": 1058, - "loc": { - "start": { - "line": 35, - "column": 5 - }, - "end": { - "line": 35, - "column": 13 - } - }, - "object": { - "type": "Identifier", - "start": 1050, - "end": 1051, - "loc": { - "start": { - "line": 35, - "column": 5 - }, - "end": { - "line": 35, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1052, - "end": 1058, - "loc": { - "start": { - "line": 35, - "column": 7 - }, - "end": { - "line": 35, - "column": 13 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { + "callee": { "type": "Identifier", - "start": 1063, - "end": 1068, + "start": 752, + "end": 758, "loc": { "start": { - "line": 35, - "column": 18 + "line": 28, + "column": 1 }, "end": { - "line": 35, - "column": 23 + "line": 28, + "column": 7 }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 1070, - "end": 1357, - "loc": { - "start": { - "line": 35, - "column": 25 + "identifierName": "assert" }, - "end": { - "line": 44, - "column": 2 - } + "name": "assert" }, - "body": [ + "arguments": [ { - "type": "IfStatement", - "start": 1224, - "end": 1354, + "type": "BinaryExpression", + "start": 759, + "end": 775, "loc": { "start": { - "line": 39, - "column": 2 + "line": 28, + "column": 8 }, "end": { - "line": 43, - "column": 3 + "line": 28, + "column": 24 } }, - "test": { - "type": "BinaryExpression", - "start": 1228, - "end": 1248, + "left": { + "type": "MemberExpression", + "start": 759, + "end": 766, "loc": { "start": { - "line": 39, - "column": 6 + "line": 28, + "column": 8 }, "end": { - "line": 39, - "column": 26 + "line": 28, + "column": 15 } }, - "left": { - "type": "MemberExpression", - "start": 1228, - "end": 1240, + "object": { + "type": "Identifier", + "start": 759, + "end": 760, "loc": { "start": { - "line": 39, - "column": 6 + "line": 28, + "column": 8 }, "end": { - "line": 39, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 1228, - "end": 1233, - "loc": { - "start": { - "line": 39, - "column": 6 - }, - "end": { - "line": 39, - "column": 11 - }, - "identifierName": "child" - }, - "name": "child", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1234, - "end": 1240, - "loc": { - "start": { - "line": 39, - "column": 12 - }, - "end": { - "line": 39, - "column": 18 - }, - "identifierName": "_color" + "line": 28, + "column": 9 }, - "name": "_color" + "identifierName": "n" }, - "computed": false, - "leadingComments": null + "name": "n" }, - "operator": "===", - "right": { + "property": { "type": "Identifier", - "start": 1245, - "end": 1248, + "start": 761, + "end": 766, "loc": { "start": { - "line": 39, - "column": 23 + "line": 28, + "column": 10 }, "end": { - "line": 39, - "column": 26 + "line": 28, + "column": 15 }, - "identifierName": "RED" + "identifierName": "right" }, - "name": "RED" + "name": "right" }, - "leadingComments": null + "computed": false }, - "consequent": { - "type": "ExpressionStatement", - "start": 1250, - "end": 1271, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 771, + "end": 775, "loc": { "start": { - "line": 39, - "column": 28 + "line": 28, + "column": 20 }, "end": { - "line": 39, - "column": 49 + "line": 28, + "column": 24 } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1250, - "end": 1270, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 48 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1250, - "end": 1262, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 40 - } - }, - "object": { - "type": "Identifier", - "start": 1250, - "end": 1255, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 33 - }, - "identifierName": "child" - }, - "name": "child" + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 780, + "end": 801, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 22 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 786, + "end": 800, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 21 + } + }, + "id": { + "type": "Identifier", + "start": 786, + "end": 791, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 12 + }, + "identifierName": "child" + }, + "name": "child" + }, + "init": { + "type": "MemberExpression", + "start": 794, + "end": 800, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 794, + "end": 795, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 796, + "end": 800, + "loc": { + "start": { + "line": 30, + "column": 17 + }, + "end": { + "line": 30, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 803, + "end": 877, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1.", + "start": 879, + "end": 898, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 20 + } + } + }, + { + "type": "CommentLine", + "value": " We can easily fix this when its only child is an", + "start": 900, + "end": 951, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 52 + } + } + }, + { + "type": "CommentLine", + "value": " internal RED node: change the color of the child to black and", + "start": 953, + "end": 1017, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 65 + } + } + }, + { + "type": "CommentLine", + "value": " replace n with it.", + "start": 1019, + "end": 1040, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 22 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1042, + "end": 1065, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1042, + "end": 1064, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1042, + "end": 1054, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 13 + }, + "identifierName": "replace_node" + }, + "name": "replace_node", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1055, + "end": 1056, + "loc": { + "start": { + "line": 36, + "column": 14 + }, + "end": { + "line": 36, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + }, + { + "type": "Identifier", + "start": 1058, + "end": 1063, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 22 + }, + "identifierName": "child" + }, + "name": "child" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 803, + "end": 877, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " through it by 1.", + "start": 879, + "end": 898, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 20 + } + } + }, + { + "type": "CommentLine", + "value": " We can easily fix this when its only child is an", + "start": 900, + "end": 951, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 52 + } + } + }, + { + "type": "CommentLine", + "value": " internal RED node: change the color of the child to black and", + "start": 953, + "end": 1017, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 65 + } + } + }, + { + "type": "CommentLine", + "value": " replace n with it.", + "start": 1019, + "end": 1040, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 22 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1067, + "end": 1088, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1067, + "end": 1087, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 21 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1067, + "end": 1079, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 1067, + "end": 1072, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 6 + }, + "identifierName": "child" + }, + "name": "child" + }, + "property": { + "type": "Identifier", + "start": 1073, + "end": 1079, + "loc": { + "start": { + "line": 37, + "column": 7 + }, + "end": { + "line": 37, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1082, + "end": 1087, + "loc": { + "start": { + "line": 37, + "column": 16 + }, + "end": { + "line": 37, + "column": 21 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1093, + "end": 1125, + "loc": { + "start": { + "line": 40, + "column": 0 + }, + "end": { + "line": 40, + "column": 32 + } + }, + "declaration": { + "type": "Identifier", + "start": 1108, + "end": 1124, + "loc": { + "start": { + "line": 40, + "column": 15 + }, + "end": { + "line": 40, + "column": 31 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1093, + "end": 1125, + "loc": { + "start": { + "line": 40, + "column": 0 + }, + "end": { + "line": 40, + "column": 32 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 567, + "end": 1091, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 38, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 573, + "end": 1090, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 38, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 573, + "end": 589, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 22 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 592, + "end": 1090, + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 38, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 573, + "end": 589, + "loc": { + "start": { + "line": 22, + "column": 6 + }, + "end": { + "line": 22, + "column": 22 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 593, + "end": 594, + "loc": { + "start": { + "line": 22, + "column": 26 + }, + "end": { + "line": 22, + "column": 27 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 599, + "end": 1090, + "loc": { + "start": { + "line": 22, + "column": 32 + }, + "end": { + "line": 38, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 602, + "end": 628, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 602, + "end": 627, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 602, + "end": 608, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 609, + "end": 626, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 23, + "column": 8 }, - "property": { - "type": "Identifier", - "start": 1256, - "end": 1262, - "loc": { - "start": { - "line": 39, - "column": 34 - }, - "end": { - "line": 39, - "column": 40 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 622, + "end": 626, + "loc": { + "start": { + "line": 23, + "column": 21 + }, + "end": { + "line": 23, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 630, + "end": 657, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 630, + "end": 656, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 630, + "end": 636, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 637, + "end": 655, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "left": { + "type": "MemberExpression", + "start": 637, + "end": 645, + "loc": { + "start": { + "line": 24, + "column": 8 }, - "computed": false + "end": { + "line": 24, + "column": 16 + } }, - "right": { + "object": { "type": "Identifier", - "start": 1265, - "end": 1270, + "start": 637, + "end": 638, "loc": { "start": { - "line": 39, - "column": 43 + "line": 24, + "column": 8 }, "end": { - "line": 39, - "column": 48 + "line": 24, + "column": 9 }, - "identifierName": "BLACK" + "identifierName": "n" }, - "name": "BLACK" - } - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1274, - "end": 1317, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 639, + "end": 645, "loc": { "start": { - "line": 40, - "column": 2 + "line": 24, + "column": 10 }, "end": { - "line": 40, - "column": 45 - } - } - } - ] + "line": 24, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 650, + "end": 655, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 26 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 659, + "end": 685, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 659, + "end": 684, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 659, + "end": 665, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" }, - "alternate": { - "type": "BlockStatement", - "start": 1325, - "end": 1354, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 666, + "end": 683, "loc": { "start": { - "line": 41, - "column": 7 + "line": 25, + "column": 8 }, "end": { - "line": 43, - "column": 3 + "line": 25, + "column": 25 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1330, - "end": 1350, + "left": { + "type": "MemberExpression", + "start": 666, + "end": 674, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 666, + "end": 667, "loc": { "start": { - "line": 42, - "column": 3 + "line": 25, + "column": 8 }, "end": { - "line": 42, - "column": 23 - } - }, - "expression": { - "type": "CallExpression", - "start": 1330, - "end": 1349, - "loc": { - "start": { - "line": 42, - "column": 3 - }, - "end": { - "line": 42, - "column": 22 - } - }, - "callee": { - "type": "Identifier", - "start": 1330, - "end": 1342, - "loc": { - "start": { - "line": 42, - "column": 3 - }, - "end": { - "line": 42, - "column": 15 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1", - "leadingComments": null + "line": 25, + "column": 9 }, - "arguments": [ - { - "type": "Identifier", - "start": 1343, - "end": 1348, - "loc": { - "start": { - "line": 42, - "column": 16 - }, - "end": { - "line": 42, - "column": 21 - }, - "identifierName": "child" - }, - "name": "child" - } - ], - "leadingComments": null + "identifierName": "n" }, - "leadingComments": null - } - ], - "directives": [], - "leadingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1274, - "end": 1317, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 668, + "end": 674, "loc": { "start": { - "line": 40, - "column": 2 + "line": 25, + "column": 10 }, "end": { - "line": 40, - "column": 45 - } - } - } - ] - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " We can easily fix this when its left child is an", - "start": 1074, - "end": 1125, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 53 - } - } - }, - { - "type": "CommentLine", - "value": " internal red node: change the color of the left child to black and", - "start": 1128, - "end": 1197, - "loc": { - "start": { - "line": 37, - "column": 2 + "line": 25, + "column": 16 + }, + "identifierName": "parent" }, - "end": { - "line": 37, - "column": 71 - } - } + "name": "parent" + }, + "computed": false }, - { - "type": "CommentLine", - "value": " replace n with it.", - "start": 1200, - "end": 1221, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 679, + "end": 683, "loc": { "start": { - "line": 38, - "column": 2 + "line": 25, + "column": 21 }, "end": { - "line": 38, - "column": 23 + "line": 25, + "column": 25 } } } - ] - } - ], - "directives": [] + } + ] + } }, - "alternate": { - "type": "BlockStatement", - "start": 1363, - "end": 1517, + { + "type": "ExpressionStatement", + "start": 687, + "end": 718, "loc": { "start": { - "line": 44, - "column": 8 + "line": 26, + "column": 1 }, "end": { - "line": 48, - "column": 2 + "line": 26, + "column": 32 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1483, - "end": 1514, + "expression": { + "type": "CallExpression", + "start": 687, + "end": 717, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 687, + "end": 693, "loc": { "start": { - "line": 47, - "column": 2 + "line": 26, + "column": 1 }, "end": { - "line": 47, - "column": 33 - } + "line": 26, + "column": 7 + }, + "identifierName": "assert" }, - "expression": { - "type": "CallExpression", - "start": 1483, - "end": 1513, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 694, + "end": 716, "loc": { "start": { - "line": 47, - "column": 2 + "line": 26, + "column": 8 }, "end": { - "line": 47, - "column": 32 + "line": 26, + "column": 30 } }, - "callee": { - "type": "Identifier", - "start": 1483, - "end": 1489, + "left": { + "type": "MemberExpression", + "start": 694, + "end": 700, "loc": { "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, + "line": 26, "column": 8 }, - "identifierName": "assert" + "end": { + "line": 26, + "column": 14 + } }, - "name": "assert", - "leadingComments": null - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1490, - "end": 1512, + "object": { + "type": "Identifier", + "start": 694, + "end": 695, "loc": { "start": { - "line": 47, - "column": 9 + "line": 26, + "column": 8 }, "end": { - "line": 47, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 1490, - "end": 1502, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 21 - } - }, - "object": { - "type": "Identifier", - "start": 1490, - "end": 1495, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 14 - }, - "identifierName": "child" - }, - "name": "child" + "line": 26, + "column": 9 }, - "property": { - "type": "Identifier", - "start": 1496, - "end": 1502, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 696, + "end": 700, + "loc": { + "start": { + "line": 26, + "column": 10 }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1507, - "end": 1512, - "loc": { - "start": { - "line": 47, - "column": 26 - }, - "end": { - "line": 47, - "column": 31 - }, - "identifierName": "BLACK" + "end": { + "line": 26, + "column": 14 }, - "name": "BLACK" - } - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is red then its child can only be black. Replacing n with its", - "start": 1367, - "end": 1439, - "loc": { - "start": { - "line": 45, - "column": 2 + "identifierName": "left" }, - "end": { - "line": 45, - "column": 74 - } - } + "name": "left" + }, + "computed": false }, - { - "type": "CommentLine", - "value": " child suffices. This is a NO-OP.", - "start": 1442, - "end": 1480, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 712, + "end": 716, "loc": { "start": { - "line": 46, - "column": 2 + "line": 26, + "column": 26 }, "end": { - "line": 46, - "column": 40 - } - } + "line": 26, + "column": 30 + }, + "identifierName": "Node" + }, + "name": "Node" } - ] - } - ], - "directives": [] - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 949, - "end": 1023, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " through it by 1.", - "start": 1025, - "end": 1044, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 20 } - } + ] } - ] - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [], - "name": "_", - "trailingComments": [] - }, - { - "type": "Identifier", - "start": 1522, - "end": 1554, - "loc": { - "start": { - "line": 51, - "column": 0 - }, - "end": { - "line": 51, - "column": 32 - } - }, - "declaration": { - "type": "Identifier", - "start": 1537, - "end": 1553, - "loc": { - "start": { - "line": 51, - "column": 15 - }, - "end": { - "line": 51, - "column": 31 - }, - "identifierName": "delete_one_child" - }, - "name": "delete_one_child" - }, - "name": "_", - "leadingComments": [], - "trailingComments": [] - }, - { - "type": "ExportDefaultDeclaration", - "start": 1522, - "end": 1554, - "loc": { - "start": { - "line": 51, - "column": 0 - }, - "end": { - "line": 51, - "column": 32 - } - }, - "declaration": { - "type": "VariableDeclaration", - "start": 559, - "end": 1520, - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 49, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 565, - "end": 1519, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 49, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 565, - "end": 581, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 20, - "column": 22 - }, - "identifierName": "delete_one_child" - }, - "name": "delete_one_child", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 584, - "end": 1519, - "loc": { - "start": { - "line": 20, - "column": 25 - }, - "end": { - "line": 49, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 565, - "end": 581, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 20, - "column": 22 - }, - "identifierName": "delete_one_child" - }, - "name": "delete_one_child", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 585, - "end": 586, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 27 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 591, - "end": 1519, - "loc": { - "start": { - "line": 20, - "column": 32 }, - "end": { - "line": 49, - "column": 1 - } - }, - "body": [ { "type": "ExpressionStatement", - "start": 594, - "end": 620, + "start": 720, + "end": 750, "loc": { "start": { - "line": 21, + "line": 27, "column": 1 }, "end": { - "line": 21, - "column": 27 + "line": 27, + "column": 31 } }, "expression": { "type": "CallExpression", - "start": 594, - "end": 619, + "start": 720, + "end": 749, "loc": { "start": { - "line": 21, + "line": 27, "column": 1 }, "end": { - "line": 21, - "column": 26 + "line": 27, + "column": 30 } }, "callee": { "type": "Identifier", - "start": 594, - "end": 600, + "start": 720, + "end": 726, "loc": { "start": { - "line": 21, + "line": 27, "column": 1 }, "end": { - "line": 21, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -2184,209 +2443,208 @@ "arguments": [ { "type": "BinaryExpression", - "start": 601, - "end": 618, + "start": 727, + "end": 748, "loc": { "start": { - "line": 21, + "line": 27, "column": 8 }, "end": { - "line": 21, - "column": 25 + "line": 27, + "column": 29 } }, "left": { - "type": "Identifier", - "start": 601, - "end": 602, + "type": "MemberExpression", + "start": 727, + "end": 740, "loc": { "start": { - "line": 21, + "line": 27, "column": 8 }, "end": { - "line": 21, - "column": 9 + "line": 27, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 727, + "end": 733, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 14 + } }, - "identifierName": "n" + "object": { + "type": "Identifier", + "start": 727, + "end": 728, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 729, + "end": 733, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "name": "n" + "property": { + "type": "Identifier", + "start": 734, + "end": 740, + "loc": { + "start": { + "line": 27, + "column": 15 + }, + "end": { + "line": 27, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "operator": "instanceof", + "operator": "===", "right": { "type": "Identifier", - "start": 614, - "end": 618, + "start": 745, + "end": 748, "loc": { "start": { - "line": 21, - "column": 21 + "line": 27, + "column": 26 }, "end": { - "line": 21, - "column": 25 + "line": 27, + "column": 29 }, - "identifierName": "Node" + "identifierName": "RED" }, - "name": "Node" + "name": "RED" } } ] - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " Precondition: n's right child is a leaf.", - "start": 622, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 44 - } - } - }, - { - "type": "CommentLine", - "value": " The right child of n is always a LEAF because either n is a subtree", - "start": 667, - "end": 737, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 71 - } - } - }, - { - "type": "CommentLine", - "value": " predecessor or it is the only child of its parent by the red-black tree", - "start": 739, - "end": 813, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " properties", - "start": 815, - "end": 828, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 14 - } - } - } - ] + } }, { "type": "ExpressionStatement", - "start": 830, - "end": 862, + "start": 752, + "end": 777, "loc": { "start": { - "line": 26, + "line": 28, "column": 1 }, "end": { - "line": 26, - "column": 33 + "line": 28, + "column": 26 } }, "expression": { "type": "CallExpression", - "start": 830, - "end": 861, + "start": 752, + "end": 776, "loc": { "start": { - "line": 26, + "line": 28, "column": 1 }, "end": { - "line": 26, - "column": 32 + "line": 28, + "column": 25 } }, "callee": { "type": "Identifier", - "start": 830, - "end": 836, + "start": 752, + "end": 758, "loc": { "start": { - "line": 26, + "line": 28, "column": 1 }, "end": { - "line": 26, + "line": 28, "column": 7 }, "identifierName": "assert" }, - "name": "assert", - "leadingComments": null + "name": "assert" }, "arguments": [ { "type": "BinaryExpression", - "start": 837, - "end": 860, + "start": 759, + "end": 775, "loc": { "start": { - "line": 26, + "line": 28, "column": 8 }, "end": { - "line": 26, - "column": 31 + "line": 28, + "column": 24 } }, "left": { "type": "MemberExpression", - "start": 837, - "end": 844, + "start": 759, + "end": 766, "loc": { "start": { - "line": 26, + "line": 28, "column": 8 }, "end": { - "line": 26, + "line": 28, "column": 15 } }, "object": { "type": "Identifier", - "start": 837, - "end": 838, + "start": 759, + "end": 760, "loc": { "start": { - "line": 26, + "line": 28, "column": 8 }, "end": { - "line": 26, + "line": 28, "column": 9 }, "identifierName": "n" @@ -2395,15 +2653,15 @@ }, "property": { "type": "Identifier", - "start": 839, - "end": 844, + "start": 761, + "end": 766, "loc": { "start": { - "line": 26, + "line": 28, "column": 10 }, "end": { - "line": 26, + "line": 28, "column": 15 }, "identifierName": "right" @@ -2412,135 +2670,66 @@ }, "computed": false }, - "operator": "instanceof", + "operator": "===", "right": { - "type": "Identifier", - "start": 856, - "end": 860, + "type": "NullLiteral", + "start": 771, + "end": 775, "loc": { "start": { - "line": 26, - "column": 27 + "line": 28, + "column": 20 }, "end": { - "line": 26, - "column": 31 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Precondition: n's right child is a leaf.", - "start": 622, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 44 - } - } - }, - { - "type": "CommentLine", - "value": " The right child of n is always a LEAF because either n is a subtree", - "start": 667, - "end": 737, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 71 - } - } - }, - { - "type": "CommentLine", - "value": " predecessor or it is the only child of its parent by the red-black tree", - "start": 739, - "end": 813, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " properties", - "start": 815, - "end": 828, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 14 + "line": 28, + "column": 24 + } + } } } - } - ] + ] + } }, { "type": "VariableDeclaration", - "start": 865, - "end": 886, + "start": 780, + "end": 801, "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 871, - "end": 885, + "start": 786, + "end": 800, "loc": { "start": { - "line": 28, + "line": 30, "column": 7 }, "end": { - "line": 28, + "line": 30, "column": 21 } }, "id": { "type": "Identifier", - "start": 871, - "end": 876, + "start": 786, + "end": 791, "loc": { "start": { - "line": 28, + "line": 30, "column": 7 }, "end": { - "line": 28, + "line": 30, "column": 12 }, "identifierName": "child" @@ -2549,29 +2738,29 @@ }, "init": { "type": "MemberExpression", - "start": 879, - "end": 885, + "start": 794, + "end": 800, "loc": { "start": { - "line": 28, + "line": 30, "column": 15 }, "end": { - "line": 28, + "line": 30, "column": 21 } }, "object": { "type": "Identifier", - "start": 879, - "end": 880, + "start": 794, + "end": 795, "loc": { "start": { - "line": 28, + "line": 30, "column": 15 }, "end": { - "line": 28, + "line": 30, "column": 16 }, "identifierName": "n" @@ -2580,15 +2769,15 @@ }, "property": { "type": "Identifier", - "start": 881, - "end": 885, + "start": 796, + "end": 800, "loc": { "start": { - "line": 28, + "line": 30, "column": 17 }, "end": { - "line": 28, + "line": 30, "column": 21 }, "identifierName": "left" @@ -2603,848 +2792,183 @@ "trailingComments": [ { "type": "CommentLine", - "value": " Replace n with its left child", - "start": 889, - "end": 921, + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 803, + "end": 877, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, - "column": 33 + "line": 31, + "column": 75 } } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 923, - "end": 946, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 24 - } - }, - "expression": { - "type": "CallExpression", - "start": 923, - "end": 945, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 23 - } }, - "callee": { - "type": "Identifier", - "start": 923, - "end": 935, + { + "type": "CommentLine", + "value": " through it by 1.", + "start": 879, + "end": 898, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, - "column": 13 - }, - "identifierName": "replace_node" - }, - "name": "replace_node", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 936, - "end": 937, - "loc": { - "start": { - "line": 31, - "column": 14 - }, - "end": { - "line": 31, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" - }, - { - "type": "Identifier", - "start": 939, - "end": 944, - "loc": { - "start": { - "line": 31, - "column": 17 - }, - "end": { - "line": 31, - "column": 22 - }, - "identifierName": "child" - }, - "name": "child" + "line": 32, + "column": 20 + } } - ], - "leadingComments": null - }, - "leadingComments": [ + }, { "type": "CommentLine", - "value": " Replace n with its left child", - "start": 889, - "end": 921, + "value": " We can easily fix this when its only child is an", + "start": 900, + "end": 951, "loc": { "start": { - "line": 30, + "line": 33, "column": 1 }, "end": { - "line": 30, - "column": 33 + "line": 33, + "column": 52 } } - } - ], - "trailingComments": [ + }, { "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 949, - "end": 1023, + "value": " internal RED node: change the color of the child to black and", + "start": 953, + "end": 1017, "loc": { "start": { - "line": 33, + "line": 34, "column": 1 }, "end": { - "line": 33, - "column": 75 + "line": 34, + "column": 65 } } }, { "type": "CommentLine", - "value": " through it by 1.", - "start": 1025, - "end": 1044, + "value": " replace n with it.", + "start": 1019, + "end": 1040, "loc": { "start": { - "line": 34, + "line": 35, "column": 1 }, "end": { - "line": 34, - "column": 20 + "line": 35, + "column": 22 } } } ] }, { - "type": "IfStatement", - "start": 1046, - "end": 1517, + "type": "ExpressionStatement", + "start": 1042, + "end": 1065, "loc": { "start": { - "line": 35, + "line": 36, "column": 1 }, "end": { - "line": 48, - "column": 2 + "line": 36, + "column": 24 } }, - "test": { - "type": "BinaryExpression", - "start": 1050, - "end": 1068, + "expression": { + "type": "CallExpression", + "start": 1042, + "end": 1064, "loc": { "start": { - "line": 35, - "column": 5 + "line": 36, + "column": 1 }, "end": { - "line": 35, + "line": 36, "column": 23 } }, - "left": { - "type": "MemberExpression", - "start": 1050, - "end": 1058, + "callee": { + "type": "Identifier", + "start": 1042, + "end": 1054, "loc": { "start": { - "line": 35, - "column": 5 + "line": 36, + "column": 1 }, "end": { - "line": 35, + "line": 36, "column": 13 - } - }, - "object": { - "type": "Identifier", - "start": 1050, - "end": 1051, - "loc": { - "start": { - "line": 35, - "column": 5 - }, - "end": { - "line": 35, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1052, - "end": 1058, - "loc": { - "start": { - "line": 35, - "column": 7 - }, - "end": { - "line": 35, - "column": 13 - }, - "identifierName": "_color" }, - "name": "_color" + "identifierName": "replace_node" }, - "computed": false, + "name": "replace_node", "leadingComments": null }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1063, - "end": 1068, - "loc": { - "start": { - "line": 35, - "column": 18 - }, - "end": { - "line": 35, - "column": 23 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 1070, - "end": 1357, - "loc": { - "start": { - "line": 35, - "column": 25 - }, - "end": { - "line": 44, - "column": 2 - } - }, - "body": [ - { - "type": "IfStatement", - "start": 1224, - "end": 1354, - "loc": { - "start": { - "line": 39, - "column": 2 - }, - "end": { - "line": 43, - "column": 3 - } - }, - "test": { - "type": "BinaryExpression", - "start": 1228, - "end": 1248, - "loc": { - "start": { - "line": 39, - "column": 6 - }, - "end": { - "line": 39, - "column": 26 - } - }, - "left": { - "type": "MemberExpression", - "start": 1228, - "end": 1240, - "loc": { - "start": { - "line": 39, - "column": 6 - }, - "end": { - "line": 39, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 1228, - "end": 1233, - "loc": { - "start": { - "line": 39, - "column": 6 - }, - "end": { - "line": 39, - "column": 11 - }, - "identifierName": "child" - }, - "name": "child", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1234, - "end": 1240, - "loc": { - "start": { - "line": 39, - "column": 12 - }, - "end": { - "line": 39, - "column": 18 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1245, - "end": 1248, - "loc": { - "start": { - "line": 39, - "column": 23 - }, - "end": { - "line": 39, - "column": 26 - }, - "identifierName": "RED" - }, - "name": "RED" - }, - "leadingComments": null - }, - "consequent": { - "type": "ExpressionStatement", - "start": 1250, - "end": 1271, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 49 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1250, - "end": 1270, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 48 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1250, - "end": 1262, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 40 - } - }, - "object": { - "type": "Identifier", - "start": 1250, - "end": 1255, - "loc": { - "start": { - "line": 39, - "column": 28 - }, - "end": { - "line": 39, - "column": 33 - }, - "identifierName": "child" - }, - "name": "child" - }, - "property": { - "type": "Identifier", - "start": 1256, - "end": 1262, - "loc": { - "start": { - "line": 39, - "column": 34 - }, - "end": { - "line": 39, - "column": 40 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 1265, - "end": 1270, - "loc": { - "start": { - "line": 39, - "column": 43 - }, - "end": { - "line": 39, - "column": 48 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1274, - "end": 1317, - "loc": { - "start": { - "line": 40, - "column": 2 - }, - "end": { - "line": 40, - "column": 45 - } - } - } - ] - }, - "alternate": { - "type": "BlockStatement", - "start": 1325, - "end": 1354, - "loc": { - "start": { - "line": 41, - "column": 7 - }, - "end": { - "line": 43, - "column": 3 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1330, - "end": 1350, - "loc": { - "start": { - "line": 42, - "column": 3 - }, - "end": { - "line": 42, - "column": 23 - } - }, - "expression": { - "type": "CallExpression", - "start": 1330, - "end": 1349, - "loc": { - "start": { - "line": 42, - "column": 3 - }, - "end": { - "line": 42, - "column": 22 - } - }, - "callee": { - "type": "Identifier", - "start": 1330, - "end": 1342, - "loc": { - "start": { - "line": 42, - "column": 3 - }, - "end": { - "line": 42, - "column": 15 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1343, - "end": 1348, - "loc": { - "start": { - "line": 42, - "column": 16 - }, - "end": { - "line": 42, - "column": 21 - }, - "identifierName": "child" - }, - "name": "child" - } - ], - "leadingComments": null - }, - "leadingComments": null - } - ], - "directives": [], - "leadingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1274, - "end": 1317, - "loc": { - "start": { - "line": 40, - "column": 2 - }, - "end": { - "line": 40, - "column": 45 - } - } - } - ] - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " We can easily fix this when its left child is an", - "start": 1074, - "end": 1125, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 53 - } - } - }, - { - "type": "CommentLine", - "value": " internal red node: change the color of the left child to black and", - "start": 1128, - "end": 1197, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 71 - } - } - }, - { - "type": "CommentLine", - "value": " replace n with it.", - "start": 1200, - "end": 1221, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 23 - } - } - } - ] - } - ], - "directives": [] - }, - "alternate": { - "type": "BlockStatement", - "start": 1363, - "end": 1517, - "loc": { - "start": { - "line": 44, - "column": 8 - }, - "end": { - "line": 48, - "column": 2 - } - }, - "body": [ + "arguments": [ { - "type": "ExpressionStatement", - "start": 1483, - "end": 1514, + "type": "Identifier", + "start": 1055, + "end": 1056, "loc": { "start": { - "line": 47, - "column": 2 + "line": 36, + "column": 14 }, "end": { - "line": 47, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 1483, - "end": 1513, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 1483, - "end": 1489, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert", - "leadingComments": null + "line": 36, + "column": 15 }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1490, - "end": 1512, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 1490, - "end": 1502, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 21 - } - }, - "object": { - "type": "Identifier", - "start": 1490, - "end": 1495, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 14 - }, - "identifierName": "child" - }, - "name": "child" - }, - "property": { - "type": "Identifier", - "start": 1496, - "end": 1502, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1507, - "end": 1512, - "loc": { - "start": { - "line": 47, - "column": 26 - }, - "end": { - "line": 47, - "column": 31 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ], - "leadingComments": null + "identifierName": "n" }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is red then its child can only be black. Replacing n with its", - "start": 1367, - "end": 1439, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 74 - } - } + "name": "n" + }, + { + "type": "Identifier", + "start": 1058, + "end": 1063, + "loc": { + "start": { + "line": 36, + "column": 17 }, - { - "type": "CommentLine", - "value": " child suffices. This is a NO-OP.", - "start": 1442, - "end": 1480, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 40 - } - } - } - ] + "end": { + "line": 36, + "column": 22 + }, + "identifierName": "child" + }, + "name": "child" } ], - "directives": [] + "leadingComments": null }, "leadingComments": [ { "type": "CommentLine", "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 949, - "end": 1023, + "start": 803, + "end": 877, "loc": { "start": { - "line": 33, + "line": 31, "column": 1 }, "end": { - "line": 33, + "line": 31, "column": 75 } } @@ -3452,8 +2976,40 @@ { "type": "CommentLine", "value": " through it by 1.", - "start": 1025, - "end": 1044, + "start": 879, + "end": 898, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 20 + } + } + }, + { + "type": "CommentLine", + "value": " We can easily fix this when its only child is an", + "start": 900, + "end": 951, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 52 + } + } + }, + { + "type": "CommentLine", + "value": " internal RED node: change the color of the child to black and", + "start": 953, + "end": 1017, "loc": { "start": { "line": 34, @@ -3461,11 +3017,125 @@ }, "end": { "line": 34, - "column": 20 + "column": 65 + } + } + }, + { + "type": "CommentLine", + "value": " replace n with it.", + "start": 1019, + "end": 1040, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 22 } } } ] + }, + { + "type": "ExpressionStatement", + "start": 1067, + "end": 1088, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1067, + "end": 1087, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 21 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1067, + "end": 1079, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 1067, + "end": 1072, + "loc": { + "start": { + "line": 37, + "column": 1 + }, + "end": { + "line": 37, + "column": 6 + }, + "identifierName": "child" + }, + "name": "child" + }, + "property": { + "type": "Identifier", + "start": 1073, + "end": 1079, + "loc": { + "start": { + "line": 37, + "column": 7 + }, + "end": { + "line": 37, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1082, + "end": 1087, + "loc": { + "start": { + "line": 37, + "column": 16 + }, + "end": { + "line": 37, + "column": 21 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } } ], "directives": [] @@ -3478,16 +3148,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n ", - "start": 271, - "end": 558, + "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", + "start": 188, + "end": 566, "loc": { "start": { - "line": 10, + "line": 8, "column": 0 }, "end": { - "line": 19, + "line": 21, "column": 3 } } @@ -3502,112 +3172,32 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n ", - "start": 271, - "end": 558, + "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", + "start": 188, + "end": 566, "loc": { "start": { - "line": 10, + "line": 8, "column": 0 }, "end": { - "line": 19, + "line": 21, "column": 3 } } }, - { - "type": "CommentLine", - "value": " Precondition: n's right child is a leaf.", - "start": 622, - "end": 665, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 44 - } - } - }, - { - "type": "CommentLine", - "value": " The right child of n is always a LEAF because either n is a subtree", - "start": 667, - "end": 737, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 71 - } - } - }, - { - "type": "CommentLine", - "value": " predecessor or it is the only child of its parent by the red-black tree", - "start": 739, - "end": 813, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " properties", - "start": 815, - "end": 828, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 14 - } - } - }, - { - "type": "CommentLine", - "value": " Replace n with its left child", - "start": 889, - "end": 921, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 33 - } - } - }, { "type": "CommentLine", "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 949, - "end": 1023, + "start": 803, + "end": 877, "loc": { "start": { - "line": 33, + "line": 31, "column": 1 }, "end": { - "line": 33, + "line": 31, "column": 75 } } @@ -3615,112 +3205,64 @@ { "type": "CommentLine", "value": " through it by 1.", - "start": 1025, - "end": 1044, + "start": 879, + "end": 898, "loc": { "start": { - "line": 34, + "line": 32, "column": 1 }, "end": { - "line": 34, + "line": 32, "column": 20 } } }, { "type": "CommentLine", - "value": " We can easily fix this when its left child is an", - "start": 1074, - "end": 1125, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 53 - } - } - }, - { - "type": "CommentLine", - "value": " internal red node: change the color of the left child to black and", - "start": 1128, - "end": 1197, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 71 - } - } - }, - { - "type": "CommentLine", - "value": " replace n with it.", - "start": 1200, - "end": 1221, - "loc": { - "start": { - "line": 38, - "column": 2 - }, - "end": { - "line": 38, - "column": 23 - } - } - }, - { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1274, - "end": 1317, + "value": " We can easily fix this when its only child is an", + "start": 900, + "end": 951, "loc": { "start": { - "line": 40, - "column": 2 + "line": 33, + "column": 1 }, "end": { - "line": 40, - "column": 45 + "line": 33, + "column": 52 } } }, { "type": "CommentLine", - "value": " If n is red then its child can only be black. Replacing n with its", - "start": 1367, - "end": 1439, + "value": " internal RED node: change the color of the child to black and", + "start": 953, + "end": 1017, "loc": { "start": { - "line": 45, - "column": 2 + "line": 34, + "column": 1 }, "end": { - "line": 45, - "column": 74 + "line": 34, + "column": 65 } } }, { "type": "CommentLine", - "value": " child suffices. This is a NO-OP.", - "start": 1442, - "end": 1480, + "value": " replace n with it.", + "start": 1019, + "end": 1040, "loc": { "start": { - "line": 46, - "column": 2 + "line": 35, + "column": 1 }, "end": { - "line": 46, - "column": 40 + "line": 35, + "column": 22 } } } @@ -4273,148 +3815,15 @@ "updateContext": null }, "value": "import", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 147, - "end": 151, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 152, - "end": 156, - "loc": { - "start": { - "line": 5, - "column": 12 - }, - "end": { - "line": 5, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Leaf.js", - "start": 157, - "end": 175, - "loc": { - "start": { - "line": 5, - "column": 17 - }, - "end": { - "line": 5, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 175, - "end": 176, - "loc": { - "start": { - "line": 5, - "column": 35 - }, - "end": { - "line": 5, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 178, - "end": 184, + "start": 141, + "end": 147, "loc": { "start": { - "line": 7, + "line": 6, "column": 0 }, "end": { - "line": 7, + "line": 6, "column": 6 } } @@ -4432,15 +3841,15 @@ "binop": null }, "value": "replace_node", - "start": 185, - "end": 197, + "start": 148, + "end": 160, "loc": { "start": { - "line": 7, + "line": 6, "column": 7 }, "end": { - "line": 7, + "line": 6, "column": 19 } } @@ -4458,15 +3867,15 @@ "binop": null }, "value": "from", - "start": 198, - "end": 202, + "start": 161, + "end": 165, "loc": { "start": { - "line": 7, + "line": 6, "column": 20 }, "end": { - "line": 7, + "line": 6, "column": 24 } } @@ -4485,148 +3894,15 @@ "updateContext": null }, "value": "./replace_node.js", - "start": 203, - "end": 222, - "loc": { - "start": { - "line": 7, - "column": 25 - }, - "end": { - "line": 7, - "column": 44 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 222, - "end": 223, - "loc": { - "start": { - "line": 7, - "column": 44 - }, - "end": { - "line": 7, - "column": 45 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 224, - "end": 230, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case1", - "start": 231, - "end": 243, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 244, - "end": 248, - "loc": { - "start": { - "line": 8, - "column": 20 - }, - "end": { - "line": 8, - "column": 24 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./delete_case1.js", - "start": 249, - "end": 268, + "start": 166, + "end": 185, "loc": { "start": { - "line": 8, + "line": 6, "column": 25 }, "end": { - "line": 8, + "line": 6, "column": 44 } } @@ -4644,31 +3920,31 @@ "binop": null, "updateContext": null }, - "start": 268, - "end": 269, + "start": 185, + "end": 186, "loc": { "start": { - "line": 8, + "line": 6, "column": 44 }, "end": { - "line": 8, + "line": 6, "column": 45 } } }, { "type": "CommentBlock", - "value": "*\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n ", - "start": 271, - "end": 558, + "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", + "start": 188, + "end": 566, "loc": { "start": { - "line": 10, + "line": 8, "column": 0 }, "end": { - "line": 19, + "line": 21, "column": 3 } } @@ -4688,15 +3964,15 @@ "updateContext": null }, "value": "const", - "start": 559, - "end": 564, + "start": 567, + "end": 572, "loc": { "start": { - "line": 20, + "line": 22, "column": 0 }, "end": { - "line": 20, + "line": 22, "column": 5 } } @@ -4714,15 +3990,15 @@ "binop": null }, "value": "delete_one_child", - "start": 565, - "end": 581, + "start": 573, + "end": 589, "loc": { "start": { - "line": 20, + "line": 22, "column": 6 }, "end": { - "line": 20, + "line": 22, "column": 22 } } @@ -4741,15 +4017,15 @@ "updateContext": null }, "value": "=", - "start": 582, - "end": 583, + "start": 590, + "end": 591, "loc": { "start": { - "line": 20, + "line": 22, "column": 23 }, "end": { - "line": 20, + "line": 22, "column": 24 } } @@ -4766,15 +4042,15 @@ "postfix": false, "binop": null }, - "start": 584, - "end": 585, + "start": 592, + "end": 593, "loc": { "start": { - "line": 20, + "line": 22, "column": 25 }, "end": { - "line": 20, + "line": 22, "column": 26 } } @@ -4792,15 +4068,15 @@ "binop": null }, "value": "n", - "start": 585, - "end": 586, + "start": 593, + "end": 594, "loc": { "start": { - "line": 20, + "line": 22, "column": 26 }, "end": { - "line": 20, + "line": 22, "column": 27 } } @@ -4817,15 +4093,15 @@ "postfix": false, "binop": null }, - "start": 586, - "end": 587, + "start": 594, + "end": 595, "loc": { "start": { - "line": 20, + "line": 22, "column": 27 }, "end": { - "line": 20, + "line": 22, "column": 28 } } @@ -4843,15 +4119,15 @@ "binop": null, "updateContext": null }, - "start": 588, - "end": 590, + "start": 596, + "end": 598, "loc": { "start": { - "line": 20, + "line": 22, "column": 29 }, "end": { - "line": 20, + "line": 22, "column": 31 } } @@ -4868,15 +4144,15 @@ "postfix": false, "binop": null }, - "start": 591, - "end": 592, + "start": 599, + "end": 600, "loc": { "start": { - "line": 20, + "line": 22, "column": 32 }, "end": { - "line": 20, + "line": 22, "column": 33 } } @@ -4894,15 +4170,15 @@ "binop": null }, "value": "assert", - "start": 594, - "end": 600, + "start": 602, + "end": 608, "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 7 } } @@ -4919,15 +4195,15 @@ "postfix": false, "binop": null }, - "start": 600, - "end": 601, + "start": 608, + "end": 609, "loc": { "start": { - "line": 21, + "line": 23, "column": 7 }, "end": { - "line": 21, + "line": 23, "column": 8 } } @@ -4945,15 +4221,15 @@ "binop": null }, "value": "n", - "start": 601, - "end": 602, + "start": 609, + "end": 610, "loc": { "start": { - "line": 21, + "line": 23, "column": 8 }, "end": { - "line": 21, + "line": 23, "column": 9 } } @@ -4973,15 +4249,15 @@ "updateContext": null }, "value": "instanceof", - "start": 603, - "end": 613, + "start": 611, + "end": 621, "loc": { "start": { - "line": 21, + "line": 23, "column": 10 }, "end": { - "line": 21, + "line": 23, "column": 20 } } @@ -4999,15 +4275,15 @@ "binop": null }, "value": "Node", - "start": 614, - "end": 618, + "start": 622, + "end": 626, "loc": { "start": { - "line": 21, + "line": 23, "column": 21 }, "end": { - "line": 21, + "line": 23, "column": 25 } } @@ -5024,15 +4300,15 @@ "postfix": false, "binop": null }, - "start": 618, - "end": 619, + "start": 626, + "end": 627, "loc": { "start": { - "line": 21, + "line": 23, "column": 25 }, "end": { - "line": 21, + "line": 23, "column": 26 } } @@ -5050,80 +4326,119 @@ "binop": null, "updateContext": null }, - "start": 619, - "end": 620, + "start": 627, + "end": 628, "loc": { "start": { - "line": 21, + "line": 23, "column": 26 }, "end": { - "line": 21, + "line": 23, "column": 27 } } }, { - "type": "CommentLine", - "value": " Precondition: n's right child is a leaf.", - "start": 622, - "end": 665, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 630, + "end": 636, "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, - "column": 44 + "line": 24, + "column": 7 } } }, { - "type": "CommentLine", - "value": " The right child of n is always a LEAF because either n is a subtree", - "start": 667, - "end": 737, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 636, + "end": 637, "loc": { "start": { - "line": 23, - "column": 1 + "line": 24, + "column": 7 }, "end": { - "line": 23, - "column": 71 + "line": 24, + "column": 8 } } }, { - "type": "CommentLine", - "value": " predecessor or it is the only child of its parent by the red-black tree", - "start": 739, - "end": 813, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 637, + "end": 638, "loc": { "start": { "line": 24, - "column": 1 + "column": 8 }, "end": { "line": 24, - "column": 75 + "column": 9 } } }, { - "type": "CommentLine", - "value": " properties", - "start": 815, - "end": 828, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 638, + "end": 639, "loc": { "start": { - "line": 25, - "column": 1 + "line": 24, + "column": 9 }, "end": { - "line": 25, - "column": 14 + "line": 24, + "column": 10 } } }, @@ -5139,42 +4454,44 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 830, - "end": 836, + "value": "_color", + "start": 639, + "end": 645, "loc": { "start": { - "line": 26, - "column": 1 + "line": 24, + "column": 10 }, "end": { - "line": 26, - "column": 7 + "line": 24, + "column": 16 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 836, - "end": 837, + "value": "===", + "start": 646, + "end": 649, "loc": { "start": { - "line": 26, - "column": 7 + "line": 24, + "column": 17 }, "end": { - "line": 26, - "column": 8 + "line": 24, + "column": 20 } } }, @@ -5190,23 +4507,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 837, - "end": 838, + "value": "BLACK", + "start": 650, + "end": 655, "loc": { "start": { - "line": 26, - "column": 8 + "line": 24, + "column": 21 }, "end": { - "line": 26, - "column": 9 + "line": 24, + "column": 26 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -5214,80 +4531,77 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 838, - "end": 839, + "start": 655, + "end": 656, "loc": { "start": { - "line": 26, - "column": 9 + "line": 24, + "column": 26 }, "end": { - "line": 26, - "column": 10 + "line": 24, + "column": 27 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "right", - "start": 839, - "end": 844, + "start": 656, + "end": 657, "loc": { "start": { - "line": 26, - "column": 10 + "line": 24, + "column": 27 }, "end": { - "line": 26, - "column": 15 + "line": 24, + "column": 28 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, - "updateContext": null + "binop": null }, - "value": "instanceof", - "start": 845, - "end": 855, + "value": "assert", + "start": 659, + "end": 665, "loc": { "start": { - "line": 26, - "column": 16 + "line": 25, + "column": 1 }, "end": { - "line": 26, - "column": 26 + "line": 25, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5296,25 +4610,24 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 856, - "end": 860, + "start": 665, + "end": 666, "loc": { "start": { - "line": 26, - "column": 27 + "line": 25, + "column": 7 }, "end": { - "line": 26, - "column": 31 + "line": 25, + "column": 8 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5322,23 +4635,24 @@ "postfix": false, "binop": null }, - "start": 860, - "end": 861, + "value": "n", + "start": 666, + "end": 667, "loc": { "start": { - "line": 26, - "column": 31 + "line": 25, + "column": 8 }, "end": { - "line": 26, - "column": 32 + "line": 25, + "column": 9 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5348,105 +4662,105 @@ "binop": null, "updateContext": null }, - "start": 861, - "end": 862, + "start": 667, + "end": 668, "loc": { "start": { - "line": 26, - "column": 32 + "line": 25, + "column": 9 }, "end": { - "line": 26, - "column": 33 + "line": 25, + "column": 10 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 865, - "end": 870, + "value": "parent", + "start": 668, + "end": 674, "loc": { "start": { - "line": 28, - "column": 1 + "line": 25, + "column": 10 }, "end": { - "line": 28, - "column": 6 + "line": 25, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "child", - "start": 871, - "end": 876, + "value": "!==", + "start": 675, + "end": 678, "loc": { "start": { - "line": 28, - "column": 7 + "line": 25, + "column": 17 }, "end": { - "line": 28, - "column": 12 + "line": 25, + "column": 20 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 877, - "end": 878, + "value": "null", + "start": 679, + "end": 683, "loc": { "start": { - "line": 28, - "column": 13 + "line": 25, + "column": 21 }, "end": { - "line": 28, - "column": 14 + "line": 25, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5454,24 +4768,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 879, - "end": 880, + "start": 683, + "end": 684, "loc": { "start": { - "line": 28, - "column": 15 + "line": 25, + "column": 25 }, "end": { - "line": 28, - "column": 16 + "line": 25, + "column": 26 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5481,16 +4794,16 @@ "binop": null, "updateContext": null }, - "start": 880, - "end": 881, + "start": 684, + "end": 685, "loc": { "start": { - "line": 28, - "column": 16 + "line": 25, + "column": 26 }, "end": { - "line": 28, - "column": 17 + "line": 25, + "column": 27 } } }, @@ -5506,59 +4819,42 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 881, - "end": 885, + "value": "assert", + "start": 687, + "end": 693, "loc": { "start": { - "line": 28, - "column": 17 + "line": 26, + "column": 1 }, "end": { - "line": 28, - "column": 21 + "line": 26, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 885, - "end": 886, - "loc": { - "start": { - "line": 28, - "column": 21 - }, - "end": { - "line": 28, - "column": 22 - } - } - }, - { - "type": "CommentLine", - "value": " Replace n with its left child", - "start": 889, - "end": 921, + "start": 693, + "end": 694, "loc": { "start": { - "line": 30, - "column": 1 + "line": 26, + "column": 7 }, "end": { - "line": 30, - "column": 33 + "line": 26, + "column": 8 } } }, @@ -5574,42 +4870,43 @@ "postfix": false, "binop": null }, - "value": "replace_node", - "start": 923, - "end": 935, + "value": "n", + "start": 694, + "end": 695, "loc": { "start": { - "line": 31, - "column": 1 + "line": 26, + "column": 8 }, "end": { - "line": 31, - "column": 13 + "line": 26, + "column": 9 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 935, - "end": 936, + "start": 695, + "end": 696, "loc": { "start": { - "line": 31, - "column": 13 + "line": 26, + "column": 9 }, "end": { - "line": 31, - "column": 14 + "line": 26, + "column": 10 } } }, @@ -5625,23 +4922,24 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 936, - "end": 937, + "value": "left", + "start": 696, + "end": 700, "loc": { "start": { - "line": 31, - "column": 14 + "line": 26, + "column": 10 }, "end": { - "line": 31, - "column": 15 + "line": 26, + "column": 14 } } }, { "type": { - "label": ",", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5649,19 +4947,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 937, - "end": 938, + "value": "instanceof", + "start": 701, + "end": 711, "loc": { "start": { - "line": 31, + "line": 26, "column": 15 }, "end": { - "line": 31, - "column": 16 + "line": 26, + "column": 25 } } }, @@ -5677,17 +4976,17 @@ "postfix": false, "binop": null }, - "value": "child", - "start": 939, - "end": 944, + "value": "Node", + "start": 712, + "end": 716, "loc": { "start": { - "line": 31, - "column": 17 + "line": 26, + "column": 26 }, "end": { - "line": 31, - "column": 22 + "line": 26, + "column": 30 } } }, @@ -5703,16 +5002,16 @@ "postfix": false, "binop": null }, - "start": 944, - "end": 945, + "start": 716, + "end": 717, "loc": { "start": { - "line": 31, - "column": 22 + "line": 26, + "column": 30 }, "end": { - "line": 31, - "column": 23 + "line": 26, + "column": 31 } } }, @@ -5729,101 +5028,119 @@ "binop": null, "updateContext": null }, - "start": 945, - "end": 946, + "start": 717, + "end": 718, "loc": { "start": { - "line": 31, - "column": 23 + "line": 26, + "column": 31 }, "end": { - "line": 31, - "column": 24 + "line": 26, + "column": 32 } } }, { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 949, - "end": 1023, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 720, + "end": 726, "loc": { "start": { - "line": 33, + "line": 27, "column": 1 }, "end": { - "line": 33, - "column": 75 + "line": 27, + "column": 7 } } }, { - "type": "CommentLine", - "value": " through it by 1.", - "start": 1025, - "end": 1044, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 726, + "end": 727, "loc": { "start": { - "line": 34, - "column": 1 + "line": 27, + "column": 7 }, "end": { - "line": 34, - "column": 20 + "line": 27, + "column": 8 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1046, - "end": 1048, + "value": "n", + "start": 727, + "end": 728, "loc": { "start": { - "line": 35, - "column": 1 + "line": 27, + "column": 8 }, "end": { - "line": 35, - "column": 3 + "line": 27, + "column": 9 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1049, - "end": 1050, + "start": 728, + "end": 729, "loc": { "start": { - "line": 35, - "column": 4 + "line": 27, + "column": 9 }, "end": { - "line": 35, - "column": 5 + "line": 27, + "column": 10 } } }, @@ -5839,17 +5156,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1050, - "end": 1051, + "value": "left", + "start": 729, + "end": 733, "loc": { "start": { - "line": 35, - "column": 5 + "line": 27, + "column": 10 }, "end": { - "line": 35, - "column": 6 + "line": 27, + "column": 14 } } }, @@ -5866,16 +5183,16 @@ "binop": null, "updateContext": null }, - "start": 1051, - "end": 1052, + "start": 733, + "end": 734, "loc": { "start": { - "line": 35, - "column": 6 + "line": 27, + "column": 14 }, "end": { - "line": 35, - "column": 7 + "line": 27, + "column": 15 } } }, @@ -5892,16 +5209,16 @@ "binop": null }, "value": "_color", - "start": 1052, - "end": 1058, + "start": 734, + "end": 740, "loc": { "start": { - "line": 35, - "column": 7 + "line": 27, + "column": 15 }, "end": { - "line": 35, - "column": 13 + "line": 27, + "column": 21 } } }, @@ -5919,16 +5236,16 @@ "updateContext": null }, "value": "===", - "start": 1059, - "end": 1062, + "start": 741, + "end": 744, "loc": { "start": { - "line": 35, - "column": 14 + "line": 27, + "column": 22 }, "end": { - "line": 35, - "column": 17 + "line": 27, + "column": 25 } } }, @@ -5944,17 +5261,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1063, - "end": 1068, + "value": "RED", + "start": 745, + "end": 748, "loc": { "start": { - "line": 35, - "column": 18 + "line": 27, + "column": 26 }, "end": { - "line": 35, - "column": 23 + "line": 27, + "column": 29 } } }, @@ -5970,117 +5287,68 @@ "postfix": false, "binop": null }, - "start": 1068, - "end": 1069, + "start": 748, + "end": 749, "loc": { "start": { - "line": 35, - "column": 23 + "line": 27, + "column": 29 }, "end": { - "line": 35, - "column": 24 + "line": 27, + "column": 30 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1070, - "end": 1071, - "loc": { - "start": { - "line": 35, - "column": 25 - }, - "end": { - "line": 35, - "column": 26 - } - } - }, - { - "type": "CommentLine", - "value": " We can easily fix this when its left child is an", - "start": 1074, - "end": 1125, - "loc": { - "start": { - "line": 36, - "column": 2 - }, - "end": { - "line": 36, - "column": 53 - } - } - }, - { - "type": "CommentLine", - "value": " internal red node: change the color of the left child to black and", - "start": 1128, - "end": 1197, - "loc": { - "start": { - "line": 37, - "column": 2 - }, - "end": { - "line": 37, - "column": 71 - } - } - }, - { - "type": "CommentLine", - "value": " replace n with it.", - "start": 1200, - "end": 1221, + "start": 749, + "end": 750, "loc": { "start": { - "line": 38, - "column": 2 + "line": 27, + "column": 30 }, "end": { - "line": 38, - "column": 23 + "line": 27, + "column": 31 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1224, - "end": 1226, + "value": "assert", + "start": 752, + "end": 758, "loc": { "start": { - "line": 39, - "column": 2 + "line": 28, + "column": 1 }, "end": { - "line": 39, - "column": 4 + "line": 28, + "column": 7 } } }, @@ -6096,16 +5364,16 @@ "postfix": false, "binop": null }, - "start": 1227, - "end": 1228, + "start": 758, + "end": 759, "loc": { "start": { - "line": 39, - "column": 5 + "line": 28, + "column": 7 }, "end": { - "line": 39, - "column": 6 + "line": 28, + "column": 8 } } }, @@ -6121,17 +5389,17 @@ "postfix": false, "binop": null }, - "value": "child", - "start": 1228, - "end": 1233, + "value": "n", + "start": 759, + "end": 760, "loc": { "start": { - "line": 39, - "column": 6 + "line": 28, + "column": 8 }, "end": { - "line": 39, - "column": 11 + "line": 28, + "column": 9 } } }, @@ -6148,16 +5416,16 @@ "binop": null, "updateContext": null }, - "start": 1233, - "end": 1234, + "start": 760, + "end": 761, "loc": { "start": { - "line": 39, - "column": 11 + "line": 28, + "column": 9 }, "end": { - "line": 39, - "column": 12 + "line": 28, + "column": 10 } } }, @@ -6173,17 +5441,17 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1234, - "end": 1240, + "value": "right", + "start": 761, + "end": 766, "loc": { "start": { - "line": 39, - "column": 12 + "line": 28, + "column": 10 }, "end": { - "line": 39, - "column": 18 + "line": 28, + "column": 15 } } }, @@ -6201,22 +5469,23 @@ "updateContext": null }, "value": "===", - "start": 1241, - "end": 1244, + "start": 767, + "end": 770, "loc": { "start": { - "line": 39, - "column": 19 + "line": 28, + "column": 16 }, "end": { - "line": 39, - "column": 22 + "line": 28, + "column": 19 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -6224,19 +5493,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 1245, - "end": 1248, + "value": "null", + "start": 771, + "end": 775, "loc": { "start": { - "line": 39, - "column": 23 + "line": 28, + "column": 20 }, "end": { - "line": 39, - "column": 26 + "line": 28, + "column": 24 } } }, @@ -6252,48 +5522,49 @@ "postfix": false, "binop": null }, - "start": 1248, - "end": 1249, + "start": 775, + "end": 776, "loc": { "start": { - "line": 39, - "column": 26 + "line": 28, + "column": 24 }, "end": { - "line": 39, - "column": 27 + "line": 28, + "column": 25 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "child", - "start": 1250, - "end": 1255, + "start": 776, + "end": 777, "loc": { "start": { - "line": 39, - "column": 28 + "line": 28, + "column": 25 }, "end": { - "line": 39, - "column": 33 + "line": 28, + "column": 26 } } }, { "type": { - "label": ".", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6304,16 +5575,17 @@ "binop": null, "updateContext": null }, - "start": 1255, - "end": 1256, + "value": "const", + "start": 780, + "end": 785, "loc": { "start": { - "line": 39, - "column": 33 + "line": 30, + "column": 1 }, "end": { - "line": 39, - "column": 34 + "line": 30, + "column": 6 } } }, @@ -6329,17 +5601,17 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1256, - "end": 1262, + "value": "child", + "start": 786, + "end": 791, "loc": { "start": { - "line": 39, - "column": 34 + "line": 30, + "column": 7 }, "end": { - "line": 39, - "column": 40 + "line": 30, + "column": 12 } } }, @@ -6357,16 +5629,16 @@ "updateContext": null }, "value": "=", - "start": 1263, - "end": 1264, + "start": 792, + "end": 793, "loc": { "start": { - "line": 39, - "column": 41 + "line": 30, + "column": 13 }, "end": { - "line": 39, - "column": 42 + "line": 30, + "column": 14 } } }, @@ -6382,24 +5654,24 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1265, - "end": 1270, + "value": "n", + "start": 794, + "end": 795, "loc": { "start": { - "line": 39, - "column": 43 + "line": 30, + "column": 15 }, "end": { - "line": 39, - "column": 48 + "line": 30, + "column": 16 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6409,39 +5681,48 @@ "binop": null, "updateContext": null }, - "start": 1270, - "end": 1271, + "start": 795, + "end": 796, "loc": { "start": { - "line": 39, - "column": 48 + "line": 30, + "column": 16 }, "end": { - "line": 39, - "column": 49 + "line": 30, + "column": 17 } } }, { - "type": "CommentLine", - "value": " Otherwise, there are more things to fix.", - "start": 1274, - "end": 1317, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 796, + "end": 800, "loc": { "start": { - "line": 40, - "column": 2 + "line": 30, + "column": 17 }, "end": { - "line": 40, - "column": 45 + "line": 30, + "column": 21 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -6452,178 +5733,130 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1320, - "end": 1324, + "start": 800, + "end": 801, "loc": { "start": { - "line": 41, - "column": 2 + "line": 30, + "column": 21 }, "end": { - "line": 41, - "column": 6 + "line": 30, + "column": 22 } } }, { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1325, - "end": 1326, + "type": "CommentLine", + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 803, + "end": 877, "loc": { "start": { - "line": 41, - "column": 7 + "line": 31, + "column": 1 }, "end": { - "line": 41, - "column": 8 + "line": 31, + "column": 75 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case1", - "start": 1330, - "end": 1342, + "type": "CommentLine", + "value": " through it by 1.", + "start": 879, + "end": 898, "loc": { "start": { - "line": 42, - "column": 3 + "line": 32, + "column": 1 }, "end": { - "line": 42, - "column": 15 + "line": 32, + "column": 20 } } }, { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1342, - "end": 1343, + "type": "CommentLine", + "value": " We can easily fix this when its only child is an", + "start": 900, + "end": 951, "loc": { "start": { - "line": 42, - "column": 15 + "line": 33, + "column": 1 }, "end": { - "line": 42, - "column": 16 + "line": 33, + "column": 52 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "child", - "start": 1343, - "end": 1348, + "type": "CommentLine", + "value": " internal RED node: change the color of the child to black and", + "start": 953, + "end": 1017, "loc": { "start": { - "line": 42, - "column": 16 + "line": 34, + "column": 1 }, "end": { - "line": 42, - "column": 21 + "line": 34, + "column": 65 } } }, { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1348, - "end": 1349, + "type": "CommentLine", + "value": " replace n with it.", + "start": 1019, + "end": 1040, "loc": { "start": { - "line": 42, - "column": 21 + "line": 35, + "column": 1 }, "end": { - "line": 42, + "line": 35, "column": 22 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1349, - "end": 1350, + "value": "replace_node", + "start": 1042, + "end": 1054, "loc": { "start": { - "line": 42, - "column": 22 + "line": 36, + "column": 1 }, "end": { - "line": 42, - "column": 23 + "line": 36, + "column": 13 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6631,24 +5864,24 @@ "postfix": false, "binop": null }, - "start": 1353, - "end": 1354, + "start": 1054, + "end": 1055, "loc": { "start": { - "line": 43, - "column": 2 + "line": 36, + "column": 13 }, "end": { - "line": 43, - "column": 3 + "line": 36, + "column": 14 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6656,23 +5889,23 @@ "postfix": false, "binop": null }, - "start": 1356, - "end": 1357, + "value": "n", + "start": 1055, + "end": 1056, "loc": { "start": { - "line": 44, - "column": 1 + "line": 36, + "column": 14 }, "end": { - "line": 44, - "column": 2 + "line": 36, + "column": 15 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -6683,24 +5916,23 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1358, - "end": 1362, + "start": 1056, + "end": 1057, "loc": { "start": { - "line": 44, - "column": 3 + "line": 36, + "column": 15 }, "end": { - "line": 44, - "column": 7 + "line": 36, + "column": 16 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6709,56 +5941,25 @@ "postfix": false, "binop": null }, - "start": 1363, - "end": 1364, - "loc": { - "start": { - "line": 44, - "column": 8 - }, - "end": { - "line": 44, - "column": 9 - } - } - }, - { - "type": "CommentLine", - "value": " If n is red then its child can only be black. Replacing n with its", - "start": 1367, - "end": 1439, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 74 - } - } - }, - { - "type": "CommentLine", - "value": " child suffices. This is a NO-OP.", - "start": 1442, - "end": 1480, + "value": "child", + "start": 1058, + "end": 1063, "loc": { "start": { - "line": 46, - "column": 2 + "line": 36, + "column": 17 }, "end": { - "line": 46, - "column": 40 + "line": 36, + "column": 22 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6766,42 +5967,42 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 1483, - "end": 1489, + "start": 1063, + "end": 1064, "loc": { "start": { - "line": 47, - "column": 2 + "line": 36, + "column": 22 }, "end": { - "line": 47, - "column": 8 + "line": 36, + "column": 23 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1489, - "end": 1490, + "start": 1064, + "end": 1065, "loc": { "start": { - "line": 47, - "column": 8 + "line": 36, + "column": 23 }, "end": { - "line": 47, - "column": 9 + "line": 36, + "column": 24 } } }, @@ -6818,16 +6019,16 @@ "binop": null }, "value": "child", - "start": 1490, - "end": 1495, + "start": 1067, + "end": 1072, "loc": { "start": { - "line": 47, - "column": 9 + "line": 37, + "column": 1 }, "end": { - "line": 47, - "column": 14 + "line": 37, + "column": 6 } } }, @@ -6844,16 +6045,16 @@ "binop": null, "updateContext": null }, - "start": 1495, - "end": 1496, + "start": 1072, + "end": 1073, "loc": { "start": { - "line": 47, - "column": 14 + "line": 37, + "column": 6 }, "end": { - "line": 47, - "column": 15 + "line": 37, + "column": 7 } } }, @@ -6870,43 +6071,43 @@ "binop": null }, "value": "_color", - "start": 1496, - "end": 1502, + "start": 1073, + "end": 1079, "loc": { "start": { - "line": 47, - "column": 15 + "line": 37, + "column": 7 }, "end": { - "line": 47, - "column": 21 + "line": 37, + "column": 13 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1503, - "end": 1506, + "value": "=", + "start": 1080, + "end": 1081, "loc": { "start": { - "line": 47, - "column": 22 + "line": 37, + "column": 14 }, "end": { - "line": 47, - "column": 25 + "line": 37, + "column": 15 } } }, @@ -6923,41 +6124,16 @@ "binop": null }, "value": "BLACK", - "start": 1507, - "end": 1512, - "loc": { - "start": { - "line": 47, - "column": 26 - }, - "end": { - "line": 47, - "column": 31 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1512, - "end": 1513, + "start": 1082, + "end": 1087, "loc": { "start": { - "line": 47, - "column": 31 + "line": 37, + "column": 16 }, "end": { - "line": 47, - "column": 32 + "line": 37, + "column": 21 } } }, @@ -6974,41 +6150,16 @@ "binop": null, "updateContext": null }, - "start": 1513, - "end": 1514, - "loc": { - "start": { - "line": 47, - "column": 32 - }, - "end": { - "line": 47, - "column": 33 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1516, - "end": 1517, + "start": 1087, + "end": 1088, "loc": { "start": { - "line": 48, - "column": 1 + "line": 37, + "column": 21 }, "end": { - "line": 48, - "column": 2 + "line": 37, + "column": 22 } } }, @@ -7024,15 +6175,15 @@ "postfix": false, "binop": null }, - "start": 1518, - "end": 1519, + "start": 1089, + "end": 1090, "loc": { "start": { - "line": 49, + "line": 38, "column": 0 }, "end": { - "line": 49, + "line": 38, "column": 1 } } @@ -7050,15 +6201,15 @@ "binop": null, "updateContext": null }, - "start": 1519, - "end": 1520, + "start": 1090, + "end": 1091, "loc": { "start": { - "line": 49, + "line": 38, "column": 1 }, "end": { - "line": 49, + "line": 38, "column": 2 } } @@ -7078,15 +6229,15 @@ "updateContext": null }, "value": "export", - "start": 1522, - "end": 1528, + "start": 1093, + "end": 1099, "loc": { "start": { - "line": 51, + "line": 40, "column": 0 }, "end": { - "line": 51, + "line": 40, "column": 6 } } @@ -7106,15 +6257,15 @@ "updateContext": null }, "value": "default", - "start": 1529, - "end": 1536, + "start": 1100, + "end": 1107, "loc": { "start": { - "line": 51, + "line": 40, "column": 7 }, "end": { - "line": 51, + "line": 40, "column": 14 } } @@ -7132,15 +6283,15 @@ "binop": null }, "value": "delete_one_child", - "start": 1537, - "end": 1553, + "start": 1108, + "end": 1124, "loc": { "start": { - "line": 51, + "line": 40, "column": 15 }, "end": { - "line": 51, + "line": 40, "column": 31 } } @@ -7158,15 +6309,15 @@ "binop": null, "updateContext": null }, - "start": 1553, - "end": 1554, + "start": 1124, + "end": 1125, "loc": { "start": { - "line": 51, + "line": 40, "column": 31 }, "end": { - "line": 51, + "line": 40, "column": 32 } } @@ -7184,15 +6335,15 @@ "binop": null, "updateContext": null }, - "start": 1555, - "end": 1555, + "start": 1126, + "end": 1126, "loc": { "start": { - "line": 52, + "line": 41, "column": 0 }, "end": { - "line": 52, + "line": 41, "column": 0 } } diff --git a/ast/source/deletion/prune.js.json b/ast/source/deletion/prune.js.json new file mode 100644 index 0000000..72b5048 --- /dev/null +++ b/ast/source/deletion/prune.js.json @@ -0,0 +1,3554 @@ +{ + "type": "File", + "start": 0, + "end": 379, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 18, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 379, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 18, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Prune subtree rooted at input node.\n *\n * @param {Node} root - The root of the subtree to prune.\n ", + "start": 67, + "end": 174, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 175, + "end": 355, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 15, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 181, + "end": 354, + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 15, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 181, + "end": 186, + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + }, + "identifierName": "prune" + }, + "name": "prune", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 189, + "end": 354, + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 15, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 190, + "end": 194, + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 19 + }, + "identifierName": "root" + }, + "name": "root" + } + ], + "body": { + "type": "BlockStatement", + "start": 199, + "end": 354, + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 15, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 202, + "end": 231, + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 202, + "end": 230, + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 202, + "end": 208, + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 209, + "end": 229, + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 209, + "end": 213, + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 12 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 225, + "end": 229, + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 28 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 233, + "end": 262, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 233, + "end": 261, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 233, + "end": 239, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 240, + "end": 260, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "left": { + "type": "MemberExpression", + "start": 240, + "end": 251, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 240, + "end": 244, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 245, + "end": 251, + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 256, + "end": 260, + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 28 + } + } + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 265, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 14, + "column": 31 + } + }, + "test": { + "type": "BinaryExpression", + "start": 269, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 269, + "end": 273, + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 9 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 278, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 30 + } + }, + "object": { + "type": "MemberExpression", + "start": 278, + "end": 289, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 278, + "end": 282, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 18 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 283, + "end": 289, + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 290, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 30 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 296, + "end": 320, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 56 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 296, + "end": 319, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 55 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 296, + "end": 312, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 48 + } + }, + "object": { + "type": "MemberExpression", + "start": 296, + "end": 307, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 296, + "end": 300, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 36 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 301, + "end": 307, + "loc": { + "start": { + "line": 13, + "column": 37 + }, + "end": { + "line": 13, + "column": 43 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 308, + "end": 312, + "loc": { + "start": { + "line": 13, + "column": 44 + }, + "end": { + "line": 13, + "column": 48 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 315, + "end": 319, + "loc": { + "start": { + "line": 13, + "column": 51 + }, + "end": { + "line": 13, + "column": 55 + } + } + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 327, + "end": 352, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 31 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 327, + "end": 351, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 327, + "end": 344, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 327, + "end": 338, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 327, + "end": 331, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 332, + "end": 338, + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 17 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 339, + "end": 344, + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 23 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 347, + "end": 351, + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 30 + } + } + } + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 357, + "end": 378, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 21 + } + }, + "declaration": { + "type": "Identifier", + "start": 372, + "end": 377, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 20 + }, + "identifierName": "prune" + }, + "name": "prune" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 357, + "end": 378, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 21 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 175, + "end": 355, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 15, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 181, + "end": 354, + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 15, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 181, + "end": 186, + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + }, + "identifierName": "prune" + }, + "name": "prune", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 189, + "end": 354, + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 15, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 181, + "end": 186, + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + }, + "identifierName": "prune" + }, + "name": "prune", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 190, + "end": 194, + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 19 + }, + "identifierName": "root" + }, + "name": "root" + } + ], + "body": { + "type": "BlockStatement", + "start": 199, + "end": 354, + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 15, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 202, + "end": 231, + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 202, + "end": 230, + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 202, + "end": 208, + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 209, + "end": 229, + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 209, + "end": 213, + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 12 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 225, + "end": 229, + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 28 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 233, + "end": 262, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 233, + "end": 261, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 233, + "end": 239, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 240, + "end": 260, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 28 + } + }, + "left": { + "type": "MemberExpression", + "start": 240, + "end": 251, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 240, + "end": 244, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 245, + "end": 251, + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 256, + "end": 260, + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 28 + } + } + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 265, + "end": 352, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 14, + "column": 31 + } + }, + "test": { + "type": "BinaryExpression", + "start": 269, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 269, + "end": 273, + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 9 + }, + "identifierName": "root" + }, + "name": "root" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 278, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 30 + } + }, + "object": { + "type": "MemberExpression", + "start": 278, + "end": 289, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 278, + "end": 282, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 18 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 283, + "end": 289, + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 290, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 30 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 296, + "end": 320, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 56 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 296, + "end": 319, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 55 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 296, + "end": 312, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 48 + } + }, + "object": { + "type": "MemberExpression", + "start": 296, + "end": 307, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 296, + "end": 300, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 36 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 301, + "end": 307, + "loc": { + "start": { + "line": 13, + "column": 37 + }, + "end": { + "line": 13, + "column": 43 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 308, + "end": 312, + "loc": { + "start": { + "line": 13, + "column": 44 + }, + "end": { + "line": 13, + "column": 48 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 315, + "end": 319, + "loc": { + "start": { + "line": 13, + "column": 51 + }, + "end": { + "line": 13, + "column": 55 + } + } + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 327, + "end": 352, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 31 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 327, + "end": 351, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 327, + "end": 344, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 327, + "end": 338, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 327, + "end": 331, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 332, + "end": 338, + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 17 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 339, + "end": 344, + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 23 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 347, + "end": 351, + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 30 + } + } + } + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Prune subtree rooted at input node.\n *\n * @param {Node} root - The root of the subtree to prune.\n ", + "start": 67, + "end": 174, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Prune subtree rooted at input node.\n *\n * @param {Node} root - The root of the subtree to prune.\n ", + "start": 67, + "end": 174, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 8, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Prune subtree rooted at input node.\n *\n * @param {Node} root - The root of the subtree to prune.\n ", + "start": 67, + "end": 174, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 8, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 175, + "end": 180, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "prune", + "start": 181, + "end": 186, + "loc": { + "start": { + "line": 9, + "column": 6 + }, + "end": { + "line": 9, + "column": 11 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 187, + "end": 188, + "loc": { + "start": { + "line": 9, + "column": 12 + }, + "end": { + "line": 9, + "column": 13 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 189, + "end": 190, + "loc": { + "start": { + "line": 9, + "column": 14 + }, + "end": { + "line": 9, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 190, + "end": 194, + "loc": { + "start": { + "line": 9, + "column": 15 + }, + "end": { + "line": 9, + "column": 19 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 194, + "end": 195, + "loc": { + "start": { + "line": 9, + "column": 19 + }, + "end": { + "line": 9, + "column": 20 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 196, + "end": 198, + "loc": { + "start": { + "line": 9, + "column": 21 + }, + "end": { + "line": 9, + "column": 23 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 199, + "end": 200, + "loc": { + "start": { + "line": 9, + "column": 24 + }, + "end": { + "line": 9, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 202, + "end": 208, + "loc": { + "start": { + "line": 10, + "column": 1 + }, + "end": { + "line": 10, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 208, + "end": 209, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 209, + "end": 213, + "loc": { + "start": { + "line": 10, + "column": 8 + }, + "end": { + "line": 10, + "column": 12 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 214, + "end": 224, + "loc": { + "start": { + "line": 10, + "column": 13 + }, + "end": { + "line": 10, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 225, + "end": 229, + "loc": { + "start": { + "line": 10, + "column": 24 + }, + "end": { + "line": 10, + "column": 28 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 229, + "end": 230, + "loc": { + "start": { + "line": 10, + "column": 28 + }, + "end": { + "line": 10, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 230, + "end": 231, + "loc": { + "start": { + "line": 10, + "column": 29 + }, + "end": { + "line": 10, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 233, + "end": 239, + "loc": { + "start": { + "line": 11, + "column": 1 + }, + "end": { + "line": 11, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 239, + "end": 240, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 240, + "end": 244, + "loc": { + "start": { + "line": 11, + "column": 8 + }, + "end": { + "line": 11, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 244, + "end": 245, + "loc": { + "start": { + "line": 11, + "column": 12 + }, + "end": { + "line": 11, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 245, + "end": 251, + "loc": { + "start": { + "line": 11, + "column": 13 + }, + "end": { + "line": 11, + "column": 19 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 252, + "end": 255, + "loc": { + "start": { + "line": 11, + "column": 20 + }, + "end": { + "line": 11, + "column": 23 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 256, + "end": 260, + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 260, + "end": 261, + "loc": { + "start": { + "line": 11, + "column": 28 + }, + "end": { + "line": 11, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 261, + "end": 262, + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 30 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 265, + "end": 267, + "loc": { + "start": { + "line": 13, + "column": 1 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 268, + "end": 269, + "loc": { + "start": { + "line": 13, + "column": 4 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 269, + "end": 273, + "loc": { + "start": { + "line": 13, + "column": 5 + }, + "end": { + "line": 13, + "column": 9 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 274, + "end": 277, + "loc": { + "start": { + "line": 13, + "column": 10 + }, + "end": { + "line": 13, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 278, + "end": 282, + "loc": { + "start": { + "line": 13, + "column": 14 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 282, + "end": 283, + "loc": { + "start": { + "line": 13, + "column": 18 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 283, + "end": 289, + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 289, + "end": 290, + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 13, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 290, + "end": 294, + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 30 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 294, + "end": 295, + "loc": { + "start": { + "line": 13, + "column": 30 + }, + "end": { + "line": 13, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 296, + "end": 300, + "loc": { + "start": { + "line": 13, + "column": 32 + }, + "end": { + "line": 13, + "column": 36 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 300, + "end": 301, + "loc": { + "start": { + "line": 13, + "column": 36 + }, + "end": { + "line": 13, + "column": 37 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 301, + "end": 307, + "loc": { + "start": { + "line": 13, + "column": 37 + }, + "end": { + "line": 13, + "column": 43 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 307, + "end": 308, + "loc": { + "start": { + "line": 13, + "column": 43 + }, + "end": { + "line": 13, + "column": 44 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 308, + "end": 312, + "loc": { + "start": { + "line": 13, + "column": 44 + }, + "end": { + "line": 13, + "column": 48 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 313, + "end": 314, + "loc": { + "start": { + "line": 13, + "column": 49 + }, + "end": { + "line": 13, + "column": 50 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 315, + "end": 319, + "loc": { + "start": { + "line": 13, + "column": 51 + }, + "end": { + "line": 13, + "column": 55 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 319, + "end": 320, + "loc": { + "start": { + "line": 13, + "column": 55 + }, + "end": { + "line": 13, + "column": 56 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 322, + "end": 326, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 327, + "end": 331, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 331, + "end": 332, + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 332, + "end": 338, + "loc": { + "start": { + "line": 14, + "column": 11 + }, + "end": { + "line": 14, + "column": 17 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 338, + "end": 339, + "loc": { + "start": { + "line": 14, + "column": 17 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 339, + "end": 344, + "loc": { + "start": { + "line": 14, + "column": 18 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 345, + "end": 346, + "loc": { + "start": { + "line": 14, + "column": 24 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 347, + "end": 351, + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 30 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 351, + "end": 352, + "loc": { + "start": { + "line": 14, + "column": 30 + }, + "end": { + "line": 14, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 353, + "end": 354, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 1 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 354, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 2 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 357, + "end": 363, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 364, + "end": 371, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "prune", + "start": 372, + "end": 377, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 20 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 377, + "end": 378, + "loc": { + "start": { + "line": 17, + "column": 20 + }, + "end": { + "line": 17, + "column": 21 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 379, + "end": 379, + "loc": { + "start": { + "line": 18, + "column": 0 + }, + "end": { + "line": 18, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/deletion/replace_node.js.json b/ast/source/deletion/replace_node.js.json index e48a198..e153514 100644 --- a/ast/source/deletion/replace_node.js.json +++ b/ast/source/deletion/replace_node.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 575, + "end": 531, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 23, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 575, + "end": 531, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 23, "column": 0 } }, @@ -164,89 +164,20 @@ "raw": "'../types/Node.js'" }, "value": "../types/Node.js" - } - }, - { - "type": "ImportDeclaration", - "start": 66, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 73, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 73, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 83, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n ", - "start": 104, - "end": 260, + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", + "start": 67, + "end": 218, "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -255,44 +186,44 @@ }, { "type": "Identifier", - "start": 261, - "end": 544, + "start": 219, + "end": 500, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { - "line": 21, + "line": 20, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 267, - "end": 543, + "start": 225, + "end": 499, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 21, + "line": 20, "column": 1 } }, "id": { "type": "Identifier", - "start": 267, - "end": 279, + "start": 225, + "end": 237, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 11, + "line": 10, "column": 18 }, "identifierName": "replace_node" @@ -302,15 +233,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 282, - "end": 543, + "start": 240, + "end": 499, "loc": { "start": { - "line": 11, + "line": 10, "column": 21 }, "end": { - "line": 21, + "line": 20, "column": 1 } }, @@ -321,15 +252,15 @@ "params": [ { "type": "Identifier", - "start": 283, - "end": 284, + "start": 241, + "end": 242, "loc": { "start": { - "line": 11, + "line": 10, "column": 22 }, "end": { - "line": 11, + "line": 10, "column": 23 }, "identifierName": "A" @@ -338,15 +269,15 @@ }, { "type": "Identifier", - "start": 286, - "end": 287, + "start": 244, + "end": 245, "loc": { "start": { - "line": 11, + "line": 10, "column": 25 }, "end": { - "line": 11, + "line": 10, "column": 26 }, "identifierName": "B" @@ -356,58 +287,58 @@ ], "body": { "type": "BlockStatement", - "start": 292, - "end": 543, + "start": 250, + "end": 499, "loc": { "start": { - "line": 11, + "line": 10, "column": 31 }, "end": { - "line": 21, + "line": 20, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 295, - "end": 321, + "start": 253, + "end": 279, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 295, - "end": 320, + "start": 253, + "end": 278, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 26 } }, "callee": { "type": "Identifier", - "start": 295, - "end": 301, + "start": 253, + "end": 259, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 7 }, "identifierName": "assert" @@ -417,29 +348,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 302, - "end": 319, + "start": 260, + "end": 277, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 25 } }, "left": { "type": "Identifier", - "start": 302, - "end": 303, + "start": 260, + "end": 261, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 9 }, "identifierName": "A" @@ -449,15 +380,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 315, - "end": 319, + "start": 273, + "end": 277, "loc": { "start": { - "line": 12, + "line": 11, "column": 21 }, "end": { - "line": 12, + "line": 11, "column": 25 }, "identifierName": "Node" @@ -470,43 +401,43 @@ }, { "type": "ExpressionStatement", - "start": 323, - "end": 370, + "start": 281, + "end": 307, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 48 + "line": 12, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 323, - "end": 369, + "start": 281, + "end": 306, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 47 + "line": 12, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 323, - "end": 329, + "start": 281, + "end": 287, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, + "line": 12, "column": 7 }, "identifierName": "assert" @@ -515,119 +446,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 330, - "end": 368, + "type": "BinaryExpression", + "start": 288, + "end": 305, "loc": { "start": { - "line": 13, + "line": 12, "column": 8 }, "end": { - "line": 13, - "column": 46 + "line": 12, + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 330, - "end": 347, + "type": "Identifier", + "start": 288, + "end": 289, "loc": { "start": { - "line": 13, + "line": 12, "column": 8 }, "end": { - "line": 13, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 330, - "end": 331, - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 9 - }, - "identifierName": "B" + "line": 12, + "column": 9 }, - "name": "B" + "identifierName": "B" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 343, - "end": 347, - "loc": { - "start": { - "line": 13, - "column": 21 - }, - "end": { - "line": 13, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "B" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 351, - "end": 368, + "type": "Identifier", + "start": 301, + "end": 305, "loc": { "start": { - "line": 13, - "column": 29 + "line": 12, + "column": 21 }, "end": { - "line": 13, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 351, - "end": 352, - "loc": { - "start": { - "line": 13, - "column": 29 - }, - "end": { - "line": 13, - "column": 30 - }, - "identifierName": "B" + "line": 12, + "column": 25 }, - "name": "B" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 364, - "end": 368, - "loc": { - "start": { - "line": 13, - "column": 42 - }, - "end": { - "line": 13, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -635,17 +500,17 @@ "trailingComments": [ { "type": "CommentLine", - "value": " We never apply delete_one_child on the root", - "start": 372, - "end": 418, + "value": " We never apply delete_one_child or delete_no_child on the root", + "start": 309, + "end": 374, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, - "column": 47 + "line": 13, + "column": 66 } } } @@ -653,43 +518,43 @@ }, { "type": "ExpressionStatement", - "start": 420, - "end": 446, + "start": 376, + "end": 402, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 420, - "end": 445, + "start": 376, + "end": 401, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 26 } }, "callee": { "type": "Identifier", - "start": 420, - "end": 426, + "start": 376, + "end": 382, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 7 }, "identifierName": "assert" @@ -700,43 +565,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 427, - "end": 444, + "start": 383, + "end": 400, "loc": { "start": { - "line": 15, + "line": 14, "column": 8 }, "end": { - "line": 15, + "line": 14, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 427, - "end": 435, + "start": 383, + "end": 391, "loc": { "start": { - "line": 15, + "line": 14, "column": 8 }, "end": { - "line": 15, + "line": 14, "column": 16 } }, "object": { "type": "Identifier", - "start": 427, - "end": 428, + "start": 383, + "end": 384, "loc": { "start": { - "line": 15, + "line": 14, "column": 8 }, "end": { - "line": 15, + "line": 14, "column": 9 }, "identifierName": "A" @@ -745,15 +610,15 @@ }, "property": { "type": "Identifier", - "start": 429, - "end": 435, + "start": 385, + "end": 391, "loc": { "start": { - "line": 15, + "line": 14, "column": 10 }, "end": { - "line": 15, + "line": 14, "column": 16 }, "identifierName": "parent" @@ -765,15 +630,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 440, - "end": 444, + "start": 396, + "end": 400, "loc": { "start": { - "line": 15, + "line": 14, "column": 21 }, "end": { - "line": 15, + "line": 14, "column": 25 } } @@ -785,17 +650,17 @@ "leadingComments": [ { "type": "CommentLine", - "value": " We never apply delete_one_child on the root", - "start": 372, - "end": 418, + "value": " We never apply delete_one_child or delete_no_child on the root", + "start": 309, + "end": 374, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, - "column": 47 + "line": 13, + "column": 66 } } } @@ -803,43 +668,43 @@ }, { "type": "IfStatement", - "start": 449, - "end": 518, + "start": 405, + "end": 474, "loc": { "start": { - "line": 17, + "line": 16, "column": 1 }, "end": { - "line": 18, + "line": 17, "column": 25 } }, "test": { "type": "BinaryExpression", - "start": 453, - "end": 472, + "start": 409, + "end": 428, "loc": { "start": { - "line": 17, + "line": 16, "column": 5 }, "end": { - "line": 17, + "line": 16, "column": 24 } }, "left": { "type": "Identifier", - "start": 453, - "end": 454, + "start": 409, + "end": 410, "loc": { "start": { - "line": 17, + "line": 16, "column": 5 }, "end": { - "line": 17, + "line": 16, "column": 6 }, "identifierName": "A" @@ -849,43 +714,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 459, - "end": 472, + "start": 415, + "end": 428, "loc": { "start": { - "line": 17, + "line": 16, "column": 11 }, "end": { - "line": 17, + "line": 16, "column": 24 } }, "object": { "type": "MemberExpression", - "start": 459, - "end": 467, + "start": 415, + "end": 423, "loc": { "start": { - "line": 17, + "line": 16, "column": 11 }, "end": { - "line": 17, + "line": 16, "column": 19 } }, "object": { "type": "Identifier", - "start": 459, - "end": 460, + "start": 415, + "end": 416, "loc": { "start": { - "line": 17, + "line": 16, "column": 11 }, "end": { - "line": 17, + "line": 16, "column": 12 }, "identifierName": "A" @@ -894,15 +759,15 @@ }, "property": { "type": "Identifier", - "start": 461, - "end": 467, + "start": 417, + "end": 423, "loc": { "start": { - "line": 17, + "line": 16, "column": 13 }, "end": { - "line": 17, + "line": 16, "column": 19 }, "identifierName": "parent" @@ -913,15 +778,15 @@ }, "property": { "type": "Identifier", - "start": 468, - "end": 472, + "start": 424, + "end": 428, "loc": { "start": { - "line": 17, + "line": 16, "column": 20 }, "end": { - "line": 17, + "line": 16, "column": 24 }, "identifierName": "left" @@ -933,72 +798,72 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 474, - "end": 492, + "start": 430, + "end": 448, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 44 } }, "expression": { "type": "AssignmentExpression", - "start": 474, - "end": 491, + "start": 430, + "end": 447, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 43 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 474, - "end": 487, + "start": 430, + "end": 443, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 39 } }, "object": { "type": "MemberExpression", - "start": 474, - "end": 482, + "start": 430, + "end": 438, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 34 } }, "object": { "type": "Identifier", - "start": 474, - "end": 475, + "start": 430, + "end": 431, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 27 }, "identifierName": "A" @@ -1007,15 +872,15 @@ }, "property": { "type": "Identifier", - "start": 476, - "end": 482, + "start": 432, + "end": 438, "loc": { "start": { - "line": 17, + "line": 16, "column": 28 }, "end": { - "line": 17, + "line": 16, "column": 34 }, "identifierName": "parent" @@ -1026,15 +891,15 @@ }, "property": { "type": "Identifier", - "start": 483, - "end": 487, + "start": 439, + "end": 443, "loc": { "start": { - "line": 17, + "line": 16, "column": 35 }, "end": { - "line": 17, + "line": 16, "column": 39 }, "identifierName": "left" @@ -1045,15 +910,15 @@ }, "right": { "type": "Identifier", - "start": 490, - "end": 491, + "start": 446, + "end": 447, "loc": { "start": { - "line": 17, + "line": 16, "column": 42 }, "end": { - "line": 17, + "line": 16, "column": 43 }, "identifierName": "B" @@ -1064,72 +929,72 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 499, - "end": 518, + "start": 455, + "end": 474, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 499, - "end": 517, + "start": 455, + "end": 473, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 499, - "end": 513, + "start": 455, + "end": 469, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 20 } }, "object": { "type": "MemberExpression", - "start": 499, - "end": 507, + "start": 455, + "end": 463, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 14 } }, "object": { "type": "Identifier", - "start": 499, - "end": 500, + "start": 455, + "end": 456, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 7 }, "identifierName": "A" @@ -1138,15 +1003,15 @@ }, "property": { "type": "Identifier", - "start": 501, - "end": 507, + "start": 457, + "end": 463, "loc": { "start": { - "line": 18, + "line": 17, "column": 8 }, "end": { - "line": 18, + "line": 17, "column": 14 }, "identifierName": "parent" @@ -1157,15 +1022,15 @@ }, "property": { "type": "Identifier", - "start": 508, - "end": 513, + "start": 464, + "end": 469, "loc": { "start": { - "line": 18, + "line": 17, "column": 15 }, "end": { - "line": 18, + "line": 17, "column": 20 }, "identifierName": "right" @@ -1176,15 +1041,15 @@ }, "right": { "type": "Identifier", - "start": 516, - "end": 517, + "start": 472, + "end": 473, "loc": { "start": { - "line": 18, + "line": 17, "column": 23 }, "end": { - "line": 18, + "line": 17, "column": 24 }, "identifierName": "B" @@ -1196,58 +1061,58 @@ }, { "type": "ExpressionStatement", - "start": 521, - "end": 541, + "start": 477, + "end": 497, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 21 } }, "expression": { "type": "AssignmentExpression", - "start": 521, - "end": 540, + "start": 477, + "end": 496, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 521, - "end": 529, + "start": 477, + "end": 485, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 9 } }, "object": { "type": "Identifier", - "start": 521, - "end": 522, + "start": 477, + "end": 478, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 2 }, "identifierName": "B" @@ -1256,15 +1121,15 @@ }, "property": { "type": "Identifier", - "start": 523, - "end": 529, + "start": 479, + "end": 485, "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 9 }, "identifierName": "parent" @@ -1275,29 +1140,29 @@ }, "right": { "type": "MemberExpression", - "start": 532, - "end": 540, + "start": 488, + "end": 496, "loc": { "start": { - "line": 20, + "line": 19, "column": 12 }, "end": { - "line": 20, + "line": 19, "column": 20 } }, "object": { "type": "Identifier", - "start": 532, - "end": 533, + "start": 488, + "end": 489, "loc": { "start": { - "line": 20, + "line": 19, "column": 12 }, "end": { - "line": 20, + "line": 19, "column": 13 }, "identifierName": "A" @@ -1306,15 +1171,15 @@ }, "property": { "type": "Identifier", - "start": 534, - "end": 540, + "start": 490, + "end": 496, "loc": { "start": { - "line": 20, + "line": 19, "column": 14 }, "end": { - "line": 20, + "line": 19, "column": 20 }, "identifierName": "parent" @@ -1339,29 +1204,29 @@ }, { "type": "Identifier", - "start": 546, - "end": 574, + "start": 502, + "end": 530, "loc": { "start": { - "line": 23, + "line": 22, "column": 0 }, "end": { - "line": 23, + "line": 22, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 561, - "end": 573, + "start": 517, + "end": 529, "loc": { "start": { - "line": 23, + "line": 22, "column": 15 }, "end": { - "line": 23, + "line": 22, "column": 27 }, "identifierName": "replace_node" @@ -1374,58 +1239,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 546, - "end": 574, + "start": 502, + "end": 530, "loc": { "start": { - "line": 23, + "line": 22, "column": 0 }, "end": { - "line": 23, + "line": 22, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 261, - "end": 544, + "start": 219, + "end": 500, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { - "line": 21, + "line": 20, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 267, - "end": 543, + "start": 225, + "end": 499, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 21, + "line": 20, "column": 1 } }, "id": { "type": "Identifier", - "start": 267, - "end": 279, + "start": 225, + "end": 237, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 11, + "line": 10, "column": 18 }, "identifierName": "replace_node" @@ -1435,29 +1300,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 282, - "end": 543, + "start": 240, + "end": 499, "loc": { "start": { - "line": 11, + "line": 10, "column": 21 }, "end": { - "line": 21, + "line": 20, "column": 1 } }, "id": { "type": "Identifier", - "start": 267, - "end": 279, + "start": 225, + "end": 237, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 11, + "line": 10, "column": 18 }, "identifierName": "replace_node" @@ -1471,15 +1336,15 @@ "params": [ { "type": "Identifier", - "start": 283, - "end": 284, + "start": 241, + "end": 242, "loc": { "start": { - "line": 11, + "line": 10, "column": 22 }, "end": { - "line": 11, + "line": 10, "column": 23 }, "identifierName": "A" @@ -1488,15 +1353,15 @@ }, { "type": "Identifier", - "start": 286, - "end": 287, + "start": 244, + "end": 245, "loc": { "start": { - "line": 11, + "line": 10, "column": 25 }, "end": { - "line": 11, + "line": 10, "column": 26 }, "identifierName": "B" @@ -1506,58 +1371,58 @@ ], "body": { "type": "BlockStatement", - "start": 292, - "end": 543, + "start": 250, + "end": 499, "loc": { "start": { - "line": 11, + "line": 10, "column": 31 }, "end": { - "line": 21, + "line": 20, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 295, - "end": 321, + "start": 253, + "end": 279, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 295, - "end": 320, + "start": 253, + "end": 278, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 26 } }, "callee": { "type": "Identifier", - "start": 295, - "end": 301, + "start": 253, + "end": 259, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 7 }, "identifierName": "assert" @@ -1567,29 +1432,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 302, - "end": 319, + "start": 260, + "end": 277, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 25 } }, "left": { "type": "Identifier", - "start": 302, - "end": 303, + "start": 260, + "end": 261, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 9 }, "identifierName": "A" @@ -1599,15 +1464,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 315, - "end": 319, + "start": 273, + "end": 277, "loc": { "start": { - "line": 12, + "line": 11, "column": 21 }, "end": { - "line": 12, + "line": 11, "column": 25 }, "identifierName": "Node" @@ -1620,43 +1485,43 @@ }, { "type": "ExpressionStatement", - "start": 323, - "end": 370, + "start": 281, + "end": 307, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 48 + "line": 12, + "column": 27 } }, "expression": { "type": "CallExpression", - "start": 323, - "end": 369, + "start": 281, + "end": 306, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 47 + "line": 12, + "column": 26 } }, "callee": { "type": "Identifier", - "start": 323, - "end": 329, + "start": 281, + "end": 287, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, + "line": 12, "column": 7 }, "identifierName": "assert" @@ -1665,119 +1530,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 330, - "end": 368, + "type": "BinaryExpression", + "start": 288, + "end": 305, "loc": { "start": { - "line": 13, + "line": 12, "column": 8 }, "end": { - "line": 13, - "column": 46 + "line": 12, + "column": 25 } }, "left": { - "type": "BinaryExpression", - "start": 330, - "end": 347, + "type": "Identifier", + "start": 288, + "end": 289, "loc": { "start": { - "line": 13, + "line": 12, "column": 8 }, "end": { - "line": 13, - "column": 25 - } + "line": 12, + "column": 9 + }, + "identifierName": "B" }, - "left": { - "type": "Identifier", - "start": 330, - "end": 331, - "loc": { - "start": { - "line": 13, - "column": 8 - }, - "end": { - "line": 13, - "column": 9 - }, - "identifierName": "B" - }, - "name": "B" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 343, - "end": 347, - "loc": { - "start": { - "line": 13, - "column": 21 - }, - "end": { - "line": 13, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "B" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 351, - "end": 368, + "type": "Identifier", + "start": 301, + "end": 305, "loc": { "start": { - "line": 13, - "column": 29 + "line": 12, + "column": 21 }, "end": { - "line": 13, - "column": 46 - } - }, - "left": { - "type": "Identifier", - "start": 351, - "end": 352, - "loc": { - "start": { - "line": 13, - "column": 29 - }, - "end": { - "line": 13, - "column": 30 - }, - "identifierName": "B" + "line": 12, + "column": 25 }, - "name": "B" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 364, - "end": 368, - "loc": { - "start": { - "line": 13, - "column": 42 - }, - "end": { - "line": 13, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -1785,17 +1584,17 @@ "trailingComments": [ { "type": "CommentLine", - "value": " We never apply delete_one_child on the root", - "start": 372, - "end": 418, + "value": " We never apply delete_one_child or delete_no_child on the root", + "start": 309, + "end": 374, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, - "column": 47 + "line": 13, + "column": 66 } } } @@ -1803,43 +1602,43 @@ }, { "type": "ExpressionStatement", - "start": 420, - "end": 446, + "start": 376, + "end": 402, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 420, - "end": 445, + "start": 376, + "end": 401, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 26 } }, "callee": { "type": "Identifier", - "start": 420, - "end": 426, + "start": 376, + "end": 382, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 7 }, "identifierName": "assert" @@ -1850,43 +1649,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 427, - "end": 444, + "start": 383, + "end": 400, "loc": { "start": { - "line": 15, + "line": 14, "column": 8 }, "end": { - "line": 15, + "line": 14, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 427, - "end": 435, + "start": 383, + "end": 391, "loc": { "start": { - "line": 15, + "line": 14, "column": 8 }, "end": { - "line": 15, + "line": 14, "column": 16 } }, "object": { "type": "Identifier", - "start": 427, - "end": 428, + "start": 383, + "end": 384, "loc": { "start": { - "line": 15, + "line": 14, "column": 8 }, "end": { - "line": 15, + "line": 14, "column": 9 }, "identifierName": "A" @@ -1895,15 +1694,15 @@ }, "property": { "type": "Identifier", - "start": 429, - "end": 435, + "start": 385, + "end": 391, "loc": { "start": { - "line": 15, + "line": 14, "column": 10 }, "end": { - "line": 15, + "line": 14, "column": 16 }, "identifierName": "parent" @@ -1915,15 +1714,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 440, - "end": 444, + "start": 396, + "end": 400, "loc": { "start": { - "line": 15, + "line": 14, "column": 21 }, "end": { - "line": 15, + "line": 14, "column": 25 } } @@ -1935,17 +1734,17 @@ "leadingComments": [ { "type": "CommentLine", - "value": " We never apply delete_one_child on the root", - "start": 372, - "end": 418, + "value": " We never apply delete_one_child or delete_no_child on the root", + "start": 309, + "end": 374, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, - "column": 47 + "line": 13, + "column": 66 } } } @@ -1953,43 +1752,43 @@ }, { "type": "IfStatement", - "start": 449, - "end": 518, + "start": 405, + "end": 474, "loc": { "start": { - "line": 17, + "line": 16, "column": 1 }, "end": { - "line": 18, + "line": 17, "column": 25 } }, "test": { "type": "BinaryExpression", - "start": 453, - "end": 472, + "start": 409, + "end": 428, "loc": { "start": { - "line": 17, + "line": 16, "column": 5 }, "end": { - "line": 17, + "line": 16, "column": 24 } }, "left": { "type": "Identifier", - "start": 453, - "end": 454, + "start": 409, + "end": 410, "loc": { "start": { - "line": 17, + "line": 16, "column": 5 }, "end": { - "line": 17, + "line": 16, "column": 6 }, "identifierName": "A" @@ -1999,43 +1798,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 459, - "end": 472, + "start": 415, + "end": 428, "loc": { "start": { - "line": 17, + "line": 16, "column": 11 }, "end": { - "line": 17, + "line": 16, "column": 24 } }, "object": { "type": "MemberExpression", - "start": 459, - "end": 467, + "start": 415, + "end": 423, "loc": { "start": { - "line": 17, + "line": 16, "column": 11 }, "end": { - "line": 17, + "line": 16, "column": 19 } }, "object": { "type": "Identifier", - "start": 459, - "end": 460, + "start": 415, + "end": 416, "loc": { "start": { - "line": 17, + "line": 16, "column": 11 }, "end": { - "line": 17, + "line": 16, "column": 12 }, "identifierName": "A" @@ -2044,15 +1843,15 @@ }, "property": { "type": "Identifier", - "start": 461, - "end": 467, + "start": 417, + "end": 423, "loc": { "start": { - "line": 17, + "line": 16, "column": 13 }, "end": { - "line": 17, + "line": 16, "column": 19 }, "identifierName": "parent" @@ -2063,15 +1862,15 @@ }, "property": { "type": "Identifier", - "start": 468, - "end": 472, + "start": 424, + "end": 428, "loc": { "start": { - "line": 17, + "line": 16, "column": 20 }, "end": { - "line": 17, + "line": 16, "column": 24 }, "identifierName": "left" @@ -2083,72 +1882,72 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 474, - "end": 492, + "start": 430, + "end": 448, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 44 } }, "expression": { "type": "AssignmentExpression", - "start": 474, - "end": 491, + "start": 430, + "end": 447, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 43 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 474, - "end": 487, + "start": 430, + "end": 443, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 39 } }, "object": { "type": "MemberExpression", - "start": 474, - "end": 482, + "start": 430, + "end": 438, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 34 } }, "object": { "type": "Identifier", - "start": 474, - "end": 475, + "start": 430, + "end": 431, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 27 }, "identifierName": "A" @@ -2157,15 +1956,15 @@ }, "property": { "type": "Identifier", - "start": 476, - "end": 482, + "start": 432, + "end": 438, "loc": { "start": { - "line": 17, + "line": 16, "column": 28 }, "end": { - "line": 17, + "line": 16, "column": 34 }, "identifierName": "parent" @@ -2176,15 +1975,15 @@ }, "property": { "type": "Identifier", - "start": 483, - "end": 487, + "start": 439, + "end": 443, "loc": { "start": { - "line": 17, + "line": 16, "column": 35 }, "end": { - "line": 17, + "line": 16, "column": 39 }, "identifierName": "left" @@ -2195,15 +1994,15 @@ }, "right": { "type": "Identifier", - "start": 490, - "end": 491, + "start": 446, + "end": 447, "loc": { "start": { - "line": 17, + "line": 16, "column": 42 }, "end": { - "line": 17, + "line": 16, "column": 43 }, "identifierName": "B" @@ -2214,72 +2013,72 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 499, - "end": 518, + "start": 455, + "end": 474, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 499, - "end": 517, + "start": 455, + "end": 473, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 499, - "end": 513, + "start": 455, + "end": 469, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 20 } }, "object": { "type": "MemberExpression", - "start": 499, - "end": 507, + "start": 455, + "end": 463, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 14 } }, "object": { "type": "Identifier", - "start": 499, - "end": 500, + "start": 455, + "end": 456, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 7 }, "identifierName": "A" @@ -2288,15 +2087,15 @@ }, "property": { "type": "Identifier", - "start": 501, - "end": 507, + "start": 457, + "end": 463, "loc": { "start": { - "line": 18, + "line": 17, "column": 8 }, "end": { - "line": 18, + "line": 17, "column": 14 }, "identifierName": "parent" @@ -2307,15 +2106,15 @@ }, "property": { "type": "Identifier", - "start": 508, - "end": 513, + "start": 464, + "end": 469, "loc": { "start": { - "line": 18, + "line": 17, "column": 15 }, "end": { - "line": 18, + "line": 17, "column": 20 }, "identifierName": "right" @@ -2326,15 +2125,15 @@ }, "right": { "type": "Identifier", - "start": 516, - "end": 517, + "start": 472, + "end": 473, "loc": { "start": { - "line": 18, + "line": 17, "column": 23 }, "end": { - "line": 18, + "line": 17, "column": 24 }, "identifierName": "B" @@ -2346,58 +2145,58 @@ }, { "type": "ExpressionStatement", - "start": 521, - "end": 541, + "start": 477, + "end": 497, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 21 } }, "expression": { "type": "AssignmentExpression", - "start": 521, - "end": 540, + "start": 477, + "end": 496, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 521, - "end": 529, + "start": 477, + "end": 485, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 9 } }, "object": { "type": "Identifier", - "start": 521, - "end": 522, + "start": 477, + "end": 478, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 2 }, "identifierName": "B" @@ -2406,15 +2205,15 @@ }, "property": { "type": "Identifier", - "start": 523, - "end": 529, + "start": 479, + "end": 485, "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 9 }, "identifierName": "parent" @@ -2425,29 +2224,29 @@ }, "right": { "type": "MemberExpression", - "start": 532, - "end": 540, + "start": 488, + "end": 496, "loc": { "start": { - "line": 20, + "line": 19, "column": 12 }, "end": { - "line": 20, + "line": 19, "column": 20 } }, "object": { "type": "Identifier", - "start": 532, - "end": 533, + "start": 488, + "end": 489, "loc": { "start": { - "line": 20, + "line": 19, "column": 12 }, "end": { - "line": 20, + "line": 19, "column": 13 }, "identifierName": "A" @@ -2456,15 +2255,15 @@ }, "property": { "type": "Identifier", - "start": 534, - "end": 540, + "start": 490, + "end": 496, "loc": { "start": { - "line": 20, + "line": 19, "column": 14 }, "end": { - "line": 20, + "line": 19, "column": 20 }, "identifierName": "parent" @@ -2486,16 +2285,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n ", - "start": 104, - "end": 260, + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", + "start": 67, + "end": 218, "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -2510,33 +2309,33 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n ", - "start": 104, - "end": 260, + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", + "start": 67, + "end": 218, "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } }, { "type": "CommentLine", - "value": " We never apply delete_one_child on the root", - "start": 372, - "end": 418, + "value": " We never apply delete_one_child or delete_no_child on the root", + "start": 309, + "end": 374, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, - "column": 47 + "line": 13, + "column": 66 } } } @@ -2808,151 +2607,18 @@ } } }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 66, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 73, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 78, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Leaf.js", - "start": 83, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 101, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, { "type": "CommentBlock", - "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n ", - "start": 104, - "end": 260, + "value": "*\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n ", + "start": 67, + "end": 218, "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -2972,15 +2638,15 @@ "updateContext": null }, "value": "const", - "start": 261, - "end": 266, + "start": 219, + "end": 224, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { - "line": 11, + "line": 10, "column": 5 } } @@ -2998,15 +2664,15 @@ "binop": null }, "value": "replace_node", - "start": 267, - "end": 279, + "start": 225, + "end": 237, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 11, + "line": 10, "column": 18 } } @@ -3025,15 +2691,15 @@ "updateContext": null }, "value": "=", - "start": 280, - "end": 281, + "start": 238, + "end": 239, "loc": { "start": { - "line": 11, + "line": 10, "column": 19 }, "end": { - "line": 11, + "line": 10, "column": 20 } } @@ -3050,15 +2716,15 @@ "postfix": false, "binop": null }, - "start": 282, - "end": 283, + "start": 240, + "end": 241, "loc": { "start": { - "line": 11, + "line": 10, "column": 21 }, "end": { - "line": 11, + "line": 10, "column": 22 } } @@ -3076,15 +2742,15 @@ "binop": null }, "value": "A", - "start": 283, - "end": 284, + "start": 241, + "end": 242, "loc": { "start": { - "line": 11, + "line": 10, "column": 22 }, "end": { - "line": 11, + "line": 10, "column": 23 } } @@ -3102,15 +2768,15 @@ "binop": null, "updateContext": null }, - "start": 284, - "end": 285, + "start": 242, + "end": 243, "loc": { "start": { - "line": 11, + "line": 10, "column": 23 }, "end": { - "line": 11, + "line": 10, "column": 24 } } @@ -3128,15 +2794,15 @@ "binop": null }, "value": "B", - "start": 286, - "end": 287, + "start": 244, + "end": 245, "loc": { "start": { - "line": 11, + "line": 10, "column": 25 }, "end": { - "line": 11, + "line": 10, "column": 26 } } @@ -3153,15 +2819,15 @@ "postfix": false, "binop": null }, - "start": 287, - "end": 288, + "start": 245, + "end": 246, "loc": { "start": { - "line": 11, + "line": 10, "column": 26 }, "end": { - "line": 11, + "line": 10, "column": 27 } } @@ -3179,15 +2845,15 @@ "binop": null, "updateContext": null }, - "start": 289, - "end": 291, + "start": 247, + "end": 249, "loc": { "start": { - "line": 11, + "line": 10, "column": 28 }, "end": { - "line": 11, + "line": 10, "column": 30 } } @@ -3204,15 +2870,15 @@ "postfix": false, "binop": null }, - "start": 292, - "end": 293, + "start": 250, + "end": 251, "loc": { "start": { - "line": 11, + "line": 10, "column": 31 }, "end": { - "line": 11, + "line": 10, "column": 32 } } @@ -3230,15 +2896,15 @@ "binop": null }, "value": "assert", - "start": 295, - "end": 301, + "start": 253, + "end": 259, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 7 } } @@ -3255,15 +2921,15 @@ "postfix": false, "binop": null }, - "start": 301, - "end": 302, + "start": 259, + "end": 260, "loc": { "start": { - "line": 12, + "line": 11, "column": 7 }, "end": { - "line": 12, + "line": 11, "column": 8 } } @@ -3281,15 +2947,15 @@ "binop": null }, "value": "A", - "start": 302, - "end": 303, + "start": 260, + "end": 261, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 9 } } @@ -3309,126 +2975,23 @@ "updateContext": null }, "value": "instanceof", - "start": 304, - "end": 314, - "loc": { - "start": { - "line": 12, - "column": 10 - }, - "end": { - "line": 12, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 315, - "end": 319, - "loc": { - "start": { - "line": 12, - "column": 21 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 319, - "end": 320, - "loc": { - "start": { - "line": 12, - "column": 25 - }, - "end": { - "line": 12, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 320, - "end": 321, + "start": 262, + "end": 272, "loc": { - "start": { - "line": 12, - "column": 26 - }, - "end": { - "line": 12, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 323, - "end": 329, - "loc": { - "start": { - "line": 13, - "column": 1 + "start": { + "line": 11, + "column": 10 }, "end": { - "line": 13, - "column": 7 + "line": 11, + "column": 20 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3437,24 +3000,25 @@ "postfix": false, "binop": null }, - "start": 329, - "end": 330, + "value": "Node", + "start": 273, + "end": 277, "loc": { "start": { - "line": 13, - "column": 7 + "line": 11, + "column": 21 }, "end": { - "line": 13, - "column": 8 + "line": 11, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3462,24 +3026,22 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 330, - "end": 331, + "start": 277, + "end": 278, "loc": { "start": { - "line": 13, - "column": 8 + "line": 11, + "column": 25 }, "end": { - "line": 13, - "column": 9 + "line": 11, + "column": 26 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3487,20 +3049,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 332, - "end": 342, + "start": 278, + "end": 279, "loc": { "start": { - "line": 13, - "column": 10 + "line": 11, + "column": 26 }, "end": { - "line": 13, - "column": 20 + "line": 11, + "column": 27 } } }, @@ -3516,44 +3077,42 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 343, - "end": 347, + "value": "assert", + "start": 281, + "end": 287, "loc": { "start": { - "line": 13, - "column": 21 + "line": 12, + "column": 1 }, "end": { - "line": 13, - "column": 25 + "line": 12, + "column": 7 } } }, { "type": { - "label": "||", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 1, - "updateContext": null + "binop": null }, - "value": "||", - "start": 348, - "end": 350, + "start": 287, + "end": 288, "loc": { "start": { - "line": 13, - "column": 26 + "line": 12, + "column": 7 }, "end": { - "line": 13, - "column": 28 + "line": 12, + "column": 8 } } }, @@ -3570,16 +3129,16 @@ "binop": null }, "value": "B", - "start": 351, - "end": 352, + "start": 288, + "end": 289, "loc": { "start": { - "line": 13, - "column": 29 + "line": 12, + "column": 8 }, "end": { - "line": 13, - "column": 30 + "line": 12, + "column": 9 } } }, @@ -3598,16 +3157,16 @@ "updateContext": null }, "value": "instanceof", - "start": 353, - "end": 363, + "start": 290, + "end": 300, "loc": { "start": { - "line": 13, - "column": 31 + "line": 12, + "column": 10 }, "end": { - "line": 13, - "column": 41 + "line": 12, + "column": 20 } } }, @@ -3623,17 +3182,17 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 364, - "end": 368, + "value": "Node", + "start": 301, + "end": 305, "loc": { "start": { - "line": 13, - "column": 42 + "line": 12, + "column": 21 }, "end": { - "line": 13, - "column": 46 + "line": 12, + "column": 25 } } }, @@ -3649,16 +3208,16 @@ "postfix": false, "binop": null }, - "start": 368, - "end": 369, + "start": 305, + "end": 306, "loc": { "start": { - "line": 13, - "column": 46 + "line": 12, + "column": 25 }, "end": { - "line": 13, - "column": 47 + "line": 12, + "column": 26 } } }, @@ -3675,32 +3234,32 @@ "binop": null, "updateContext": null }, - "start": 369, - "end": 370, + "start": 306, + "end": 307, "loc": { "start": { - "line": 13, - "column": 47 + "line": 12, + "column": 26 }, "end": { - "line": 13, - "column": 48 + "line": 12, + "column": 27 } } }, { "type": "CommentLine", - "value": " We never apply delete_one_child on the root", - "start": 372, - "end": 418, + "value": " We never apply delete_one_child or delete_no_child on the root", + "start": 309, + "end": 374, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, - "column": 47 + "line": 13, + "column": 66 } } }, @@ -3717,15 +3276,15 @@ "binop": null }, "value": "assert", - "start": 420, - "end": 426, + "start": 376, + "end": 382, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 7 } } @@ -3742,15 +3301,15 @@ "postfix": false, "binop": null }, - "start": 426, - "end": 427, + "start": 382, + "end": 383, "loc": { "start": { - "line": 15, + "line": 14, "column": 7 }, "end": { - "line": 15, + "line": 14, "column": 8 } } @@ -3768,15 +3327,15 @@ "binop": null }, "value": "A", - "start": 427, - "end": 428, + "start": 383, + "end": 384, "loc": { "start": { - "line": 15, + "line": 14, "column": 8 }, "end": { - "line": 15, + "line": 14, "column": 9 } } @@ -3794,15 +3353,15 @@ "binop": null, "updateContext": null }, - "start": 428, - "end": 429, + "start": 384, + "end": 385, "loc": { "start": { - "line": 15, + "line": 14, "column": 9 }, "end": { - "line": 15, + "line": 14, "column": 10 } } @@ -3820,15 +3379,15 @@ "binop": null }, "value": "parent", - "start": 429, - "end": 435, + "start": 385, + "end": 391, "loc": { "start": { - "line": 15, + "line": 14, "column": 10 }, "end": { - "line": 15, + "line": 14, "column": 16 } } @@ -3847,15 +3406,15 @@ "updateContext": null }, "value": "!==", - "start": 436, - "end": 439, + "start": 392, + "end": 395, "loc": { "start": { - "line": 15, + "line": 14, "column": 17 }, "end": { - "line": 15, + "line": 14, "column": 20 } } @@ -3875,15 +3434,15 @@ "updateContext": null }, "value": "null", - "start": 440, - "end": 444, + "start": 396, + "end": 400, "loc": { "start": { - "line": 15, + "line": 14, "column": 21 }, "end": { - "line": 15, + "line": 14, "column": 25 } } @@ -3900,15 +3459,15 @@ "postfix": false, "binop": null }, - "start": 444, - "end": 445, + "start": 400, + "end": 401, "loc": { "start": { - "line": 15, + "line": 14, "column": 25 }, "end": { - "line": 15, + "line": 14, "column": 26 } } @@ -3926,15 +3485,15 @@ "binop": null, "updateContext": null }, - "start": 445, - "end": 446, + "start": 401, + "end": 402, "loc": { "start": { - "line": 15, + "line": 14, "column": 26 }, "end": { - "line": 15, + "line": 14, "column": 27 } } @@ -3954,15 +3513,15 @@ "updateContext": null }, "value": "if", - "start": 449, - "end": 451, + "start": 405, + "end": 407, "loc": { "start": { - "line": 17, + "line": 16, "column": 1 }, "end": { - "line": 17, + "line": 16, "column": 3 } } @@ -3979,15 +3538,15 @@ "postfix": false, "binop": null }, - "start": 452, - "end": 453, + "start": 408, + "end": 409, "loc": { "start": { - "line": 17, + "line": 16, "column": 4 }, "end": { - "line": 17, + "line": 16, "column": 5 } } @@ -4005,15 +3564,15 @@ "binop": null }, "value": "A", - "start": 453, - "end": 454, + "start": 409, + "end": 410, "loc": { "start": { - "line": 17, + "line": 16, "column": 5 }, "end": { - "line": 17, + "line": 16, "column": 6 } } @@ -4032,15 +3591,15 @@ "updateContext": null }, "value": "===", - "start": 455, - "end": 458, + "start": 411, + "end": 414, "loc": { "start": { - "line": 17, + "line": 16, "column": 7 }, "end": { - "line": 17, + "line": 16, "column": 10 } } @@ -4058,15 +3617,15 @@ "binop": null }, "value": "A", - "start": 459, - "end": 460, + "start": 415, + "end": 416, "loc": { "start": { - "line": 17, + "line": 16, "column": 11 }, "end": { - "line": 17, + "line": 16, "column": 12 } } @@ -4084,15 +3643,15 @@ "binop": null, "updateContext": null }, - "start": 460, - "end": 461, + "start": 416, + "end": 417, "loc": { "start": { - "line": 17, + "line": 16, "column": 12 }, "end": { - "line": 17, + "line": 16, "column": 13 } } @@ -4110,15 +3669,15 @@ "binop": null }, "value": "parent", - "start": 461, - "end": 467, + "start": 417, + "end": 423, "loc": { "start": { - "line": 17, + "line": 16, "column": 13 }, "end": { - "line": 17, + "line": 16, "column": 19 } } @@ -4136,15 +3695,15 @@ "binop": null, "updateContext": null }, - "start": 467, - "end": 468, + "start": 423, + "end": 424, "loc": { "start": { - "line": 17, + "line": 16, "column": 19 }, "end": { - "line": 17, + "line": 16, "column": 20 } } @@ -4162,15 +3721,15 @@ "binop": null }, "value": "left", - "start": 468, - "end": 472, + "start": 424, + "end": 428, "loc": { "start": { - "line": 17, + "line": 16, "column": 20 }, "end": { - "line": 17, + "line": 16, "column": 24 } } @@ -4187,15 +3746,15 @@ "postfix": false, "binop": null }, - "start": 472, - "end": 473, + "start": 428, + "end": 429, "loc": { "start": { - "line": 17, + "line": 16, "column": 24 }, "end": { - "line": 17, + "line": 16, "column": 25 } } @@ -4213,15 +3772,15 @@ "binop": null }, "value": "A", - "start": 474, - "end": 475, + "start": 430, + "end": 431, "loc": { "start": { - "line": 17, + "line": 16, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 27 } } @@ -4239,15 +3798,15 @@ "binop": null, "updateContext": null }, - "start": 475, - "end": 476, + "start": 431, + "end": 432, "loc": { "start": { - "line": 17, + "line": 16, "column": 27 }, "end": { - "line": 17, + "line": 16, "column": 28 } } @@ -4265,15 +3824,15 @@ "binop": null }, "value": "parent", - "start": 476, - "end": 482, + "start": 432, + "end": 438, "loc": { "start": { - "line": 17, + "line": 16, "column": 28 }, "end": { - "line": 17, + "line": 16, "column": 34 } } @@ -4291,15 +3850,15 @@ "binop": null, "updateContext": null }, - "start": 482, - "end": 483, + "start": 438, + "end": 439, "loc": { "start": { - "line": 17, + "line": 16, "column": 34 }, "end": { - "line": 17, + "line": 16, "column": 35 } } @@ -4317,15 +3876,15 @@ "binop": null }, "value": "left", - "start": 483, - "end": 487, + "start": 439, + "end": 443, "loc": { "start": { - "line": 17, + "line": 16, "column": 35 }, "end": { - "line": 17, + "line": 16, "column": 39 } } @@ -4344,15 +3903,15 @@ "updateContext": null }, "value": "=", - "start": 488, - "end": 489, + "start": 444, + "end": 445, "loc": { "start": { - "line": 17, + "line": 16, "column": 40 }, "end": { - "line": 17, + "line": 16, "column": 41 } } @@ -4370,15 +3929,15 @@ "binop": null }, "value": "B", - "start": 490, - "end": 491, + "start": 446, + "end": 447, "loc": { "start": { - "line": 17, + "line": 16, "column": 42 }, "end": { - "line": 17, + "line": 16, "column": 43 } } @@ -4396,15 +3955,15 @@ "binop": null, "updateContext": null }, - "start": 491, - "end": 492, + "start": 447, + "end": 448, "loc": { "start": { - "line": 17, + "line": 16, "column": 43 }, "end": { - "line": 17, + "line": 16, "column": 44 } } @@ -4424,15 +3983,15 @@ "updateContext": null }, "value": "else", - "start": 494, - "end": 498, + "start": 450, + "end": 454, "loc": { "start": { - "line": 18, + "line": 17, "column": 1 }, "end": { - "line": 18, + "line": 17, "column": 5 } } @@ -4450,15 +4009,15 @@ "binop": null }, "value": "A", - "start": 499, - "end": 500, + "start": 455, + "end": 456, "loc": { "start": { - "line": 18, + "line": 17, "column": 6 }, "end": { - "line": 18, + "line": 17, "column": 7 } } @@ -4476,15 +4035,15 @@ "binop": null, "updateContext": null }, - "start": 500, - "end": 501, + "start": 456, + "end": 457, "loc": { "start": { - "line": 18, + "line": 17, "column": 7 }, "end": { - "line": 18, + "line": 17, "column": 8 } } @@ -4502,15 +4061,15 @@ "binop": null }, "value": "parent", - "start": 501, - "end": 507, + "start": 457, + "end": 463, "loc": { "start": { - "line": 18, + "line": 17, "column": 8 }, "end": { - "line": 18, + "line": 17, "column": 14 } } @@ -4528,15 +4087,15 @@ "binop": null, "updateContext": null }, - "start": 507, - "end": 508, + "start": 463, + "end": 464, "loc": { "start": { - "line": 18, + "line": 17, "column": 14 }, "end": { - "line": 18, + "line": 17, "column": 15 } } @@ -4554,15 +4113,15 @@ "binop": null }, "value": "right", - "start": 508, - "end": 513, + "start": 464, + "end": 469, "loc": { "start": { - "line": 18, + "line": 17, "column": 15 }, "end": { - "line": 18, + "line": 17, "column": 20 } } @@ -4581,15 +4140,15 @@ "updateContext": null }, "value": "=", - "start": 514, - "end": 515, + "start": 470, + "end": 471, "loc": { "start": { - "line": 18, + "line": 17, "column": 21 }, "end": { - "line": 18, + "line": 17, "column": 22 } } @@ -4607,15 +4166,15 @@ "binop": null }, "value": "B", - "start": 516, - "end": 517, + "start": 472, + "end": 473, "loc": { "start": { - "line": 18, + "line": 17, "column": 23 }, "end": { - "line": 18, + "line": 17, "column": 24 } } @@ -4633,15 +4192,15 @@ "binop": null, "updateContext": null }, - "start": 517, - "end": 518, + "start": 473, + "end": 474, "loc": { "start": { - "line": 18, + "line": 17, "column": 24 }, "end": { - "line": 18, + "line": 17, "column": 25 } } @@ -4659,15 +4218,15 @@ "binop": null }, "value": "B", - "start": 521, - "end": 522, + "start": 477, + "end": 478, "loc": { "start": { - "line": 20, + "line": 19, "column": 1 }, "end": { - "line": 20, + "line": 19, "column": 2 } } @@ -4685,15 +4244,15 @@ "binop": null, "updateContext": null }, - "start": 522, - "end": 523, + "start": 478, + "end": 479, "loc": { "start": { - "line": 20, + "line": 19, "column": 2 }, "end": { - "line": 20, + "line": 19, "column": 3 } } @@ -4711,15 +4270,15 @@ "binop": null }, "value": "parent", - "start": 523, - "end": 529, + "start": 479, + "end": 485, "loc": { "start": { - "line": 20, + "line": 19, "column": 3 }, "end": { - "line": 20, + "line": 19, "column": 9 } } @@ -4738,15 +4297,15 @@ "updateContext": null }, "value": "=", - "start": 530, - "end": 531, + "start": 486, + "end": 487, "loc": { "start": { - "line": 20, + "line": 19, "column": 10 }, "end": { - "line": 20, + "line": 19, "column": 11 } } @@ -4764,15 +4323,15 @@ "binop": null }, "value": "A", - "start": 532, - "end": 533, + "start": 488, + "end": 489, "loc": { "start": { - "line": 20, + "line": 19, "column": 12 }, "end": { - "line": 20, + "line": 19, "column": 13 } } @@ -4790,15 +4349,15 @@ "binop": null, "updateContext": null }, - "start": 533, - "end": 534, + "start": 489, + "end": 490, "loc": { "start": { - "line": 20, + "line": 19, "column": 13 }, "end": { - "line": 20, + "line": 19, "column": 14 } } @@ -4816,15 +4375,15 @@ "binop": null }, "value": "parent", - "start": 534, - "end": 540, + "start": 490, + "end": 496, "loc": { "start": { - "line": 20, + "line": 19, "column": 14 }, "end": { - "line": 20, + "line": 19, "column": 20 } } @@ -4842,15 +4401,15 @@ "binop": null, "updateContext": null }, - "start": 540, - "end": 541, + "start": 496, + "end": 497, "loc": { "start": { - "line": 20, + "line": 19, "column": 20 }, "end": { - "line": 20, + "line": 19, "column": 21 } } @@ -4867,15 +4426,15 @@ "postfix": false, "binop": null }, - "start": 542, - "end": 543, + "start": 498, + "end": 499, "loc": { "start": { - "line": 21, + "line": 20, "column": 0 }, "end": { - "line": 21, + "line": 20, "column": 1 } } @@ -4893,15 +4452,15 @@ "binop": null, "updateContext": null }, - "start": 543, - "end": 544, + "start": 499, + "end": 500, "loc": { "start": { - "line": 21, + "line": 20, "column": 1 }, "end": { - "line": 21, + "line": 20, "column": 2 } } @@ -4921,15 +4480,15 @@ "updateContext": null }, "value": "export", - "start": 546, - "end": 552, + "start": 502, + "end": 508, "loc": { "start": { - "line": 23, + "line": 22, "column": 0 }, "end": { - "line": 23, + "line": 22, "column": 6 } } @@ -4949,15 +4508,15 @@ "updateContext": null }, "value": "default", - "start": 553, - "end": 560, + "start": 509, + "end": 516, "loc": { "start": { - "line": 23, + "line": 22, "column": 7 }, "end": { - "line": 23, + "line": 22, "column": 14 } } @@ -4975,15 +4534,15 @@ "binop": null }, "value": "replace_node", - "start": 561, - "end": 573, + "start": 517, + "end": 529, "loc": { "start": { - "line": 23, + "line": 22, "column": 15 }, "end": { - "line": 23, + "line": 22, "column": 27 } } @@ -5001,15 +4560,15 @@ "binop": null, "updateContext": null }, - "start": 573, - "end": 574, + "start": 529, + "end": 530, "loc": { "start": { - "line": 23, + "line": 22, "column": 27 }, "end": { - "line": 23, + "line": 22, "column": 28 } } @@ -5027,15 +4586,15 @@ "binop": null, "updateContext": null }, - "start": 575, - "end": 575, + "start": 531, + "end": 531, "loc": { "start": { - "line": 24, + "line": 23, "column": 0 }, "end": { - "line": 24, + "line": 23, "column": 0 } } diff --git a/ast/source/family/predecessor.js.json b/ast/source/family/predecessor.js.json index 5125887..4773f64 100644 --- a/ast/source/family/predecessor.js.json +++ b/ast/source/family/predecessor.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 507, + "end": 506, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 507, + "end": 506, "loc": { "start": { "line": 1, @@ -187,7 +187,7 @@ { "type": "Identifier", "start": 274, - "end": 477, + "end": 476, "loc": { "start": { "line": 11, @@ -202,7 +202,7 @@ { "type": "VariableDeclarator", "start": 280, - "end": 476, + "end": 475, "loc": { "start": { "line": 11, @@ -234,7 +234,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 294, - "end": 476, + "end": 475, "loc": { "start": { "line": 11, @@ -271,7 +271,7 @@ "body": { "type": "BlockStatement", "start": 304, - "end": 476, + "end": 475, "loc": { "start": { "line": 11, @@ -518,7 +518,7 @@ { "type": "WhileStatement", "start": 367, - "end": 459, + "end": 458, "loc": { "start": { "line": 15, @@ -530,9 +530,9 @@ } }, "test": { - "type": "UnaryExpression", + "type": "BinaryExpression", "start": 374, - "end": 394, + "end": 393, "loc": { "start": { "line": 15, @@ -540,122 +540,84 @@ }, "end": { "line": 15, - "column": 28 + "column": 27 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 375, - "end": 394, + "left": { + "type": "MemberExpression", + "start": 374, + "end": 384, "loc": { "start": { "line": 15, - "column": 9 + "column": 8 }, "end": { "line": 15, - "column": 28 + "column": 18 } }, - "callee": { - "type": "MemberExpression", - "start": 375, - "end": 392, + "object": { + "type": "Identifier", + "start": 374, + "end": 378, "loc": { "start": { "line": 15, - "column": 9 + "column": 8 }, "end": { "line": 15, - "column": 26 - } - }, - "object": { - "type": "MemberExpression", - "start": 375, - "end": 385, - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 375, - "end": 379, - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 13 - }, - "identifierName": "pred" - }, - "name": "pred" - }, - "property": { - "type": "Identifier", - "start": 380, - "end": 385, - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - }, - "identifierName": "right" - }, - "name": "right" + "column": 12 }, - "computed": false + "identifierName": "pred" }, - "property": { - "type": "Identifier", - "start": 386, - "end": 392, - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 26 - }, - "identifierName": "isLeaf" + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 379, + "end": 384, + "loc": { + "start": { + "line": 15, + "column": 13 }, - "name": "isLeaf" + "end": { + "line": 15, + "column": 18 + }, + "identifierName": "right" }, - "computed": false + "name": "right" }, - "arguments": [] + "computed": false }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 389, + "end": 393, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 27 + } + } } }, "body": { "type": "BlockStatement", - "start": 396, - "end": 459, + "start": 395, + "end": 458, "loc": { "start": { "line": 15, - "column": 30 + "column": 29 }, "end": { "line": 18, @@ -665,8 +627,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 400, - "end": 435, + "start": 399, + "end": 434, "loc": { "start": { "line": 16, @@ -679,8 +641,8 @@ }, "expression": { "type": "CallExpression", - "start": 400, - "end": 434, + "start": 399, + "end": 433, "loc": { "start": { "line": 16, @@ -693,8 +655,8 @@ }, "callee": { "type": "Identifier", - "start": 400, - "end": 406, + "start": 399, + "end": 405, "loc": { "start": { "line": 16, @@ -711,8 +673,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 407, - "end": 433, + "start": 406, + "end": 432, "loc": { "start": { "line": 16, @@ -725,8 +687,8 @@ }, "left": { "type": "MemberExpression", - "start": 407, - "end": 417, + "start": 406, + "end": 416, "loc": { "start": { "line": 16, @@ -739,8 +701,8 @@ }, "object": { "type": "Identifier", - "start": 407, - "end": 411, + "start": 406, + "end": 410, "loc": { "start": { "line": 16, @@ -756,8 +718,8 @@ }, "property": { "type": "Identifier", - "start": 412, - "end": 417, + "start": 411, + "end": 416, "loc": { "start": { "line": 16, @@ -776,8 +738,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 429, - "end": 433, + "start": 428, + "end": 432, "loc": { "start": { "line": 16, @@ -797,8 +759,8 @@ }, { "type": "ExpressionStatement", - "start": 438, - "end": 456, + "start": 437, + "end": 455, "loc": { "start": { "line": 17, @@ -811,8 +773,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 438, - "end": 455, + "start": 437, + "end": 454, "loc": { "start": { "line": 17, @@ -826,8 +788,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 438, - "end": 442, + "start": 437, + "end": 441, "loc": { "start": { "line": 17, @@ -843,8 +805,8 @@ }, "right": { "type": "MemberExpression", - "start": 445, - "end": 455, + "start": 444, + "end": 454, "loc": { "start": { "line": 17, @@ -857,8 +819,8 @@ }, "object": { "type": "Identifier", - "start": 445, - "end": 449, + "start": 444, + "end": 448, "loc": { "start": { "line": 17, @@ -874,8 +836,8 @@ }, "property": { "type": "Identifier", - "start": 450, - "end": 455, + "start": 449, + "end": 454, "loc": { "start": { "line": 17, @@ -899,8 +861,8 @@ }, { "type": "ReturnStatement", - "start": 462, - "end": 474, + "start": 461, + "end": 473, "loc": { "start": { "line": 20, @@ -913,8 +875,8 @@ }, "argument": { "type": "Identifier", - "start": 469, - "end": 473, + "start": 468, + "end": 472, "loc": { "start": { "line": 20, @@ -943,8 +905,8 @@ }, { "type": "Identifier", - "start": 479, - "end": 506, + "start": 478, + "end": 505, "loc": { "start": { "line": 23, @@ -957,8 +919,8 @@ }, "declaration": { "type": "Identifier", - "start": 494, - "end": 505, + "start": 493, + "end": 504, "loc": { "start": { "line": 23, @@ -978,8 +940,8 @@ }, { "type": "ExportDefaultDeclaration", - "start": 479, - "end": 506, + "start": 478, + "end": 505, "loc": { "start": { "line": 23, @@ -993,7 +955,7 @@ "declaration": { "type": "VariableDeclaration", "start": 274, - "end": 477, + "end": 476, "loc": { "start": { "line": 11, @@ -1008,7 +970,7 @@ { "type": "VariableDeclarator", "start": 280, - "end": 476, + "end": 475, "loc": { "start": { "line": 11, @@ -1040,7 +1002,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 294, - "end": 476, + "end": 475, "loc": { "start": { "line": 11, @@ -1094,7 +1056,7 @@ "body": { "type": "BlockStatement", "start": 304, - "end": 476, + "end": 475, "loc": { "start": { "line": 11, @@ -1341,7 +1303,7 @@ { "type": "WhileStatement", "start": 367, - "end": 459, + "end": 458, "loc": { "start": { "line": 15, @@ -1353,9 +1315,9 @@ } }, "test": { - "type": "UnaryExpression", + "type": "BinaryExpression", "start": 374, - "end": 394, + "end": 393, "loc": { "start": { "line": 15, @@ -1363,122 +1325,84 @@ }, "end": { "line": 15, - "column": 28 + "column": 27 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 375, - "end": 394, + "left": { + "type": "MemberExpression", + "start": 374, + "end": 384, "loc": { "start": { "line": 15, - "column": 9 + "column": 8 }, "end": { "line": 15, - "column": 28 + "column": 18 } }, - "callee": { - "type": "MemberExpression", - "start": 375, - "end": 392, + "object": { + "type": "Identifier", + "start": 374, + "end": 378, "loc": { "start": { "line": 15, - "column": 9 + "column": 8 }, "end": { "line": 15, - "column": 26 - } - }, - "object": { - "type": "MemberExpression", - "start": 375, - "end": 385, - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 375, - "end": 379, - "loc": { - "start": { - "line": 15, - "column": 9 - }, - "end": { - "line": 15, - "column": 13 - }, - "identifierName": "pred" - }, - "name": "pred" - }, - "property": { - "type": "Identifier", - "start": 380, - "end": 385, - "loc": { - "start": { - "line": 15, - "column": 14 - }, - "end": { - "line": 15, - "column": 19 - }, - "identifierName": "right" - }, - "name": "right" + "column": 12 }, - "computed": false + "identifierName": "pred" }, - "property": { - "type": "Identifier", - "start": 386, - "end": 392, - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 26 - }, - "identifierName": "isLeaf" + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 379, + "end": 384, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 18 }, - "name": "isLeaf" + "identifierName": "right" }, - "computed": false + "name": "right" }, - "arguments": [] + "computed": false }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 389, + "end": 393, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 27 + } + } } }, "body": { "type": "BlockStatement", - "start": 396, - "end": 459, + "start": 395, + "end": 458, "loc": { "start": { "line": 15, - "column": 30 + "column": 29 }, "end": { "line": 18, @@ -1488,8 +1412,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 400, - "end": 435, + "start": 399, + "end": 434, "loc": { "start": { "line": 16, @@ -1502,8 +1426,8 @@ }, "expression": { "type": "CallExpression", - "start": 400, - "end": 434, + "start": 399, + "end": 433, "loc": { "start": { "line": 16, @@ -1516,8 +1440,8 @@ }, "callee": { "type": "Identifier", - "start": 400, - "end": 406, + "start": 399, + "end": 405, "loc": { "start": { "line": 16, @@ -1534,8 +1458,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 407, - "end": 433, + "start": 406, + "end": 432, "loc": { "start": { "line": 16, @@ -1548,8 +1472,8 @@ }, "left": { "type": "MemberExpression", - "start": 407, - "end": 417, + "start": 406, + "end": 416, "loc": { "start": { "line": 16, @@ -1562,8 +1486,8 @@ }, "object": { "type": "Identifier", - "start": 407, - "end": 411, + "start": 406, + "end": 410, "loc": { "start": { "line": 16, @@ -1579,8 +1503,8 @@ }, "property": { "type": "Identifier", - "start": 412, - "end": 417, + "start": 411, + "end": 416, "loc": { "start": { "line": 16, @@ -1599,8 +1523,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 429, - "end": 433, + "start": 428, + "end": 432, "loc": { "start": { "line": 16, @@ -1620,8 +1544,8 @@ }, { "type": "ExpressionStatement", - "start": 438, - "end": 456, + "start": 437, + "end": 455, "loc": { "start": { "line": 17, @@ -1634,8 +1558,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 438, - "end": 455, + "start": 437, + "end": 454, "loc": { "start": { "line": 17, @@ -1649,8 +1573,8 @@ "operator": "=", "left": { "type": "Identifier", - "start": 438, - "end": 442, + "start": 437, + "end": 441, "loc": { "start": { "line": 17, @@ -1666,8 +1590,8 @@ }, "right": { "type": "MemberExpression", - "start": 445, - "end": 455, + "start": 444, + "end": 454, "loc": { "start": { "line": 17, @@ -1680,8 +1604,8 @@ }, "object": { "type": "Identifier", - "start": 445, - "end": 449, + "start": 444, + "end": 448, "loc": { "start": { "line": 17, @@ -1697,8 +1621,8 @@ }, "property": { "type": "Identifier", - "start": 450, - "end": 455, + "start": 449, + "end": 454, "loc": { "start": { "line": 17, @@ -1722,8 +1646,8 @@ }, { "type": "ReturnStatement", - "start": 462, - "end": 474, + "start": 461, + "end": 473, "loc": { "start": { "line": 20, @@ -1736,8 +1660,8 @@ }, "argument": { "type": "Identifier", - "start": 469, - "end": 473, + "start": 468, + "end": 472, "loc": { "start": { "line": 20, @@ -2765,33 +2689,6 @@ } } }, - { - "type": { - "label": "prefix", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "!", - "start": 374, - "end": 375, - "loc": { - "start": { - "line": 15, - "column": 8 - }, - "end": { - "line": 15, - "column": 9 - } - } - }, { "type": { "label": "name", @@ -2805,16 +2702,16 @@ "binop": null }, "value": "pred", - "start": 375, - "end": 379, + "start": 374, + "end": 378, "loc": { "start": { "line": 15, - "column": 9 + "column": 8 }, "end": { "line": 15, - "column": 13 + "column": 12 } } }, @@ -2831,16 +2728,16 @@ "binop": null, "updateContext": null }, - "start": 379, - "end": 380, + "start": 378, + "end": 379, "loc": { "start": { "line": 15, - "column": 13 + "column": 12 }, "end": { "line": 15, - "column": 14 + "column": 13 } } }, @@ -2857,34 +2754,35 @@ "binop": null }, "value": "right", - "start": 380, - "end": 385, + "start": 379, + "end": 384, "loc": { "start": { "line": 15, - "column": 14 + "column": 13 }, "end": { "line": 15, - "column": 19 + "column": 18 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, + "value": "!==", "start": 385, - "end": 386, + "end": 388, "loc": { "start": { "line": 15, @@ -2892,13 +2790,14 @@ }, "end": { "line": 15, - "column": 20 + "column": 22 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2906,40 +2805,16 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "value": "isLeaf", - "start": 386, - "end": 392, - "loc": { - "start": { - "line": 15, - "column": 20 - }, - "end": { - "line": 15, - "column": 26 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 392, + "value": "null", + "start": 389, "end": 393, "loc": { "start": { "line": 15, - "column": 26 + "column": 23 }, "end": { "line": 15, @@ -2972,31 +2847,6 @@ } } }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 394, - "end": 395, - "loc": { - "start": { - "line": 15, - "column": 28 - }, - "end": { - "line": 15, - "column": 29 - } - } - }, { "type": { "label": "{", @@ -3009,16 +2859,16 @@ "postfix": false, "binop": null }, - "start": 396, - "end": 397, + "start": 395, + "end": 396, "loc": { "start": { "line": 15, - "column": 30 + "column": 29 }, "end": { "line": 15, - "column": 31 + "column": 30 } } }, @@ -3035,8 +2885,8 @@ "binop": null }, "value": "assert", - "start": 400, - "end": 406, + "start": 399, + "end": 405, "loc": { "start": { "line": 16, @@ -3060,8 +2910,8 @@ "postfix": false, "binop": null }, - "start": 406, - "end": 407, + "start": 405, + "end": 406, "loc": { "start": { "line": 16, @@ -3086,8 +2936,8 @@ "binop": null }, "value": "pred", - "start": 407, - "end": 411, + "start": 406, + "end": 410, "loc": { "start": { "line": 16, @@ -3112,8 +2962,8 @@ "binop": null, "updateContext": null }, - "start": 411, - "end": 412, + "start": 410, + "end": 411, "loc": { "start": { "line": 16, @@ -3138,8 +2988,8 @@ "binop": null }, "value": "right", - "start": 412, - "end": 417, + "start": 411, + "end": 416, "loc": { "start": { "line": 16, @@ -3166,8 +3016,8 @@ "updateContext": null }, "value": "instanceof", - "start": 418, - "end": 428, + "start": 417, + "end": 427, "loc": { "start": { "line": 16, @@ -3192,8 +3042,8 @@ "binop": null }, "value": "Node", - "start": 429, - "end": 433, + "start": 428, + "end": 432, "loc": { "start": { "line": 16, @@ -3217,8 +3067,8 @@ "postfix": false, "binop": null }, - "start": 433, - "end": 434, + "start": 432, + "end": 433, "loc": { "start": { "line": 16, @@ -3243,8 +3093,8 @@ "binop": null, "updateContext": null }, - "start": 434, - "end": 435, + "start": 433, + "end": 434, "loc": { "start": { "line": 16, @@ -3269,8 +3119,8 @@ "binop": null }, "value": "pred", - "start": 438, - "end": 442, + "start": 437, + "end": 441, "loc": { "start": { "line": 17, @@ -3296,8 +3146,8 @@ "updateContext": null }, "value": "=", - "start": 443, - "end": 444, + "start": 442, + "end": 443, "loc": { "start": { "line": 17, @@ -3322,8 +3172,8 @@ "binop": null }, "value": "pred", - "start": 445, - "end": 449, + "start": 444, + "end": 448, "loc": { "start": { "line": 17, @@ -3348,8 +3198,8 @@ "binop": null, "updateContext": null }, - "start": 449, - "end": 450, + "start": 448, + "end": 449, "loc": { "start": { "line": 17, @@ -3374,8 +3224,8 @@ "binop": null }, "value": "right", - "start": 450, - "end": 455, + "start": 449, + "end": 454, "loc": { "start": { "line": 17, @@ -3400,8 +3250,8 @@ "binop": null, "updateContext": null }, - "start": 455, - "end": 456, + "start": 454, + "end": 455, "loc": { "start": { "line": 17, @@ -3425,8 +3275,8 @@ "postfix": false, "binop": null }, - "start": 458, - "end": 459, + "start": 457, + "end": 458, "loc": { "start": { "line": 18, @@ -3453,8 +3303,8 @@ "updateContext": null }, "value": "return", - "start": 462, - "end": 468, + "start": 461, + "end": 467, "loc": { "start": { "line": 20, @@ -3479,8 +3329,8 @@ "binop": null }, "value": "pred", - "start": 469, - "end": 473, + "start": 468, + "end": 472, "loc": { "start": { "line": 20, @@ -3505,8 +3355,8 @@ "binop": null, "updateContext": null }, - "start": 473, - "end": 474, + "start": 472, + "end": 473, "loc": { "start": { "line": 20, @@ -3530,8 +3380,8 @@ "postfix": false, "binop": null }, - "start": 475, - "end": 476, + "start": 474, + "end": 475, "loc": { "start": { "line": 21, @@ -3556,8 +3406,8 @@ "binop": null, "updateContext": null }, - "start": 476, - "end": 477, + "start": 475, + "end": 476, "loc": { "start": { "line": 21, @@ -3584,8 +3434,8 @@ "updateContext": null }, "value": "export", - "start": 479, - "end": 485, + "start": 478, + "end": 484, "loc": { "start": { "line": 23, @@ -3612,8 +3462,8 @@ "updateContext": null }, "value": "default", - "start": 486, - "end": 493, + "start": 485, + "end": 492, "loc": { "start": { "line": 23, @@ -3638,8 +3488,8 @@ "binop": null }, "value": "predecessor", - "start": 494, - "end": 505, + "start": 493, + "end": 504, "loc": { "start": { "line": 23, @@ -3664,8 +3514,8 @@ "binop": null, "updateContext": null }, - "start": 505, - "end": 506, + "start": 504, + "end": 505, "loc": { "start": { "line": 23, @@ -3690,8 +3540,8 @@ "binop": null, "updateContext": null }, - "start": 507, - "end": 507, + "start": 506, + "end": 506, "loc": { "start": { "line": 24, diff --git a/ast/source/family/sibling.js.json b/ast/source/family/sibling.js.json index 022e874..c2b2fe3 100644 --- a/ast/source/family/sibling.js.json +++ b/ast/source/family/sibling.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 499, + "end": 437, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 20, + "line": 19, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 499, + "end": 437, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 20, + "line": 19, "column": 0 } }, @@ -164,89 +164,20 @@ "raw": "'../types/Node.js'" }, "value": "../types/Node.js" - } - }, - { - "type": "ImportDeclaration", - "start": 66, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 73, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 73, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 83, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n ", - "start": 104, - "end": 226, + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 179, "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -255,44 +186,44 @@ }, { "type": "Identifier", - "start": 227, - "end": 473, + "start": 180, + "end": 411, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { - "line": 17, + "line": 16, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 233, - "end": 472, + "start": 186, + "end": 410, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 17, + "line": 16, "column": 1 } }, "id": { "type": "Identifier", - "start": 233, - "end": 240, + "start": 186, + "end": 193, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 11, + "line": 10, "column": 13 }, "identifierName": "sibling" @@ -302,15 +233,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 243, - "end": 472, + "start": 196, + "end": 410, "loc": { "start": { - "line": 11, + "line": 10, "column": 16 }, "end": { - "line": 17, + "line": 16, "column": 1 } }, @@ -321,15 +252,15 @@ "params": [ { "type": "Identifier", - "start": 244, - "end": 248, + "start": 197, + "end": 201, "loc": { "start": { - "line": 11, + "line": 10, "column": 17 }, "end": { - "line": 11, + "line": 10, "column": 21 }, "identifierName": "node" @@ -339,58 +270,58 @@ ], "body": { "type": "BlockStatement", - "start": 253, - "end": 472, + "start": 206, + "end": 410, "loc": { "start": { - "line": 11, + "line": 10, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 256, - "end": 309, + "start": 209, + "end": 238, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, - "column": 54 + "line": 11, + "column": 30 } }, "expression": { "type": "CallExpression", - "start": 256, - "end": 308, + "start": 209, + "end": 237, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, - "column": 53 + "line": 11, + "column": 29 } }, "callee": { "type": "Identifier", - "start": 256, - "end": 262, + "start": 209, + "end": 215, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 7 }, "identifierName": "assert" @@ -399,119 +330,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 263, - "end": 307, + "type": "BinaryExpression", + "start": 216, + "end": 236, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, - "column": 52 + "line": 11, + "column": 28 } }, "left": { - "type": "BinaryExpression", - "start": 263, - "end": 283, + "type": "Identifier", + "start": 216, + "end": 220, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, - "column": 28 - } - }, - "left": { - "type": "Identifier", - "start": 263, - "end": 267, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 12 - }, - "identifierName": "node" + "line": 11, + "column": 12 }, - "name": "node" + "identifierName": "node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 279, - "end": 283, - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 28 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "node" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 287, - "end": 307, + "type": "Identifier", + "start": 232, + "end": 236, "loc": { "start": { - "line": 12, - "column": 32 + "line": 11, + "column": 24 }, "end": { - "line": 12, - "column": 52 - } - }, - "left": { - "type": "Identifier", - "start": 287, - "end": 291, - "loc": { - "start": { - "line": 12, - "column": 32 - }, - "end": { - "line": 12, - "column": 36 - }, - "identifierName": "node" + "line": 11, + "column": 28 }, - "name": "node" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 303, - "end": 307, - "loc": { - "start": { - "line": 12, - "column": 48 - }, - "end": { - "line": 12, - "column": 52 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -519,17 +384,17 @@ "trailingComments": [ { "type": "CommentLine", - "value": " We only use this function when node HAS a sibling.", - "start": 311, - "end": 364, + "value": " We only use this function when node HAS a non-leaf sibling.", + "start": 240, + "end": 302, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 54 + "line": 12, + "column": 63 } } } @@ -537,43 +402,43 @@ }, { "type": "ExpressionStatement", - "start": 366, - "end": 395, + "start": 304, + "end": 333, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", - "start": 366, - "end": 394, + "start": 304, + "end": 332, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 29 } }, "callee": { "type": "Identifier", - "start": 366, - "end": 372, + "start": 304, + "end": 310, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 7 }, "identifierName": "assert" @@ -584,43 +449,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 373, - "end": 393, + "start": 311, + "end": 331, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 28 } }, "left": { "type": "MemberExpression", - "start": 373, - "end": 384, + "start": 311, + "end": 322, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 19 } }, "object": { "type": "Identifier", - "start": 373, - "end": 377, + "start": 311, + "end": 315, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 12 }, "identifierName": "node" @@ -629,15 +494,15 @@ }, "property": { "type": "Identifier", - "start": 378, - "end": 384, + "start": 316, + "end": 322, "loc": { "start": { - "line": 14, + "line": 13, "column": 13 }, "end": { - "line": 14, + "line": 13, "column": 19 }, "identifierName": "parent" @@ -649,15 +514,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 389, - "end": 393, + "start": 327, + "end": 331, "loc": { "start": { - "line": 14, + "line": 13, "column": 24 }, "end": { - "line": 14, + "line": 13, "column": 28 } } @@ -669,17 +534,17 @@ "leadingComments": [ { "type": "CommentLine", - "value": " We only use this function when node HAS a sibling.", - "start": 311, - "end": 364, + "value": " We only use this function when node HAS a non-leaf sibling.", + "start": 240, + "end": 302, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 54 + "line": 12, + "column": 63 } } } @@ -687,57 +552,57 @@ }, { "type": "ReturnStatement", - "start": 398, - "end": 470, + "start": 336, + "end": 408, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 73 } }, "argument": { "type": "ConditionalExpression", - "start": 405, - "end": 469, + "start": 343, + "end": 407, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 72 } }, "test": { "type": "BinaryExpression", - "start": 405, - "end": 430, + "start": 343, + "end": 368, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 33 } }, "left": { "type": "Identifier", - "start": 405, - "end": 409, + "start": 343, + "end": 347, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 12 }, "identifierName": "node" @@ -747,43 +612,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 414, - "end": 430, + "start": 352, + "end": 368, "loc": { "start": { - "line": 16, + "line": 15, "column": 17 }, "end": { - "line": 16, + "line": 15, "column": 33 } }, "object": { "type": "MemberExpression", - "start": 414, - "end": 425, + "start": 352, + "end": 363, "loc": { "start": { - "line": 16, + "line": 15, "column": 17 }, "end": { - "line": 16, + "line": 15, "column": 28 } }, "object": { "type": "Identifier", - "start": 414, - "end": 418, + "start": 352, + "end": 356, "loc": { "start": { - "line": 16, + "line": 15, "column": 17 }, "end": { - "line": 16, + "line": 15, "column": 21 }, "identifierName": "node" @@ -792,15 +657,15 @@ }, "property": { "type": "Identifier", - "start": 419, - "end": 425, + "start": 357, + "end": 363, "loc": { "start": { - "line": 16, + "line": 15, "column": 22 }, "end": { - "line": 16, + "line": 15, "column": 28 }, "identifierName": "parent" @@ -811,15 +676,15 @@ }, "property": { "type": "Identifier", - "start": 426, - "end": 430, + "start": 364, + "end": 368, "loc": { "start": { - "line": 16, + "line": 15, "column": 29 }, "end": { - "line": 16, + "line": 15, "column": 33 }, "identifierName": "left" @@ -831,43 +696,43 @@ }, "consequent": { "type": "MemberExpression", - "start": 433, - "end": 450, + "start": 371, + "end": 388, "loc": { "start": { - "line": 16, + "line": 15, "column": 36 }, "end": { - "line": 16, + "line": 15, "column": 53 } }, "object": { "type": "MemberExpression", - "start": 433, - "end": 444, + "start": 371, + "end": 382, "loc": { "start": { - "line": 16, + "line": 15, "column": 36 }, "end": { - "line": 16, + "line": 15, "column": 47 } }, "object": { "type": "Identifier", - "start": 433, - "end": 437, + "start": 371, + "end": 375, "loc": { "start": { - "line": 16, + "line": 15, "column": 36 }, "end": { - "line": 16, + "line": 15, "column": 40 }, "identifierName": "node" @@ -876,15 +741,15 @@ }, "property": { "type": "Identifier", - "start": 438, - "end": 444, + "start": 376, + "end": 382, "loc": { "start": { - "line": 16, + "line": 15, "column": 41 }, "end": { - "line": 16, + "line": 15, "column": 47 }, "identifierName": "parent" @@ -895,15 +760,15 @@ }, "property": { "type": "Identifier", - "start": 445, - "end": 450, + "start": 383, + "end": 388, "loc": { "start": { - "line": 16, + "line": 15, "column": 48 }, "end": { - "line": 16, + "line": 15, "column": 53 }, "identifierName": "right" @@ -914,43 +779,43 @@ }, "alternate": { "type": "MemberExpression", - "start": 453, - "end": 469, + "start": 391, + "end": 407, "loc": { "start": { - "line": 16, + "line": 15, "column": 56 }, "end": { - "line": 16, + "line": 15, "column": 72 } }, "object": { "type": "MemberExpression", - "start": 453, - "end": 464, + "start": 391, + "end": 402, "loc": { "start": { - "line": 16, + "line": 15, "column": 56 }, "end": { - "line": 16, + "line": 15, "column": 67 } }, "object": { "type": "Identifier", - "start": 453, - "end": 457, + "start": 391, + "end": 395, "loc": { "start": { - "line": 16, + "line": 15, "column": 56 }, "end": { - "line": 16, + "line": 15, "column": 60 }, "identifierName": "node" @@ -959,15 +824,15 @@ }, "property": { "type": "Identifier", - "start": 458, - "end": 464, + "start": 396, + "end": 402, "loc": { "start": { - "line": 16, + "line": 15, "column": 61 }, "end": { - "line": 16, + "line": 15, "column": 67 }, "identifierName": "parent" @@ -978,15 +843,15 @@ }, "property": { "type": "Identifier", - "start": 465, - "end": 469, + "start": 403, + "end": 407, "loc": { "start": { - "line": 16, + "line": 15, "column": 68 }, "end": { - "line": 16, + "line": 15, "column": 72 }, "identifierName": "left" @@ -1011,29 +876,29 @@ }, { "type": "Identifier", - "start": 475, - "end": 498, + "start": 413, + "end": 436, "loc": { "start": { - "line": 19, + "line": 18, "column": 0 }, "end": { - "line": 19, + "line": 18, "column": 23 } }, "declaration": { "type": "Identifier", - "start": 490, - "end": 497, + "start": 428, + "end": 435, "loc": { "start": { - "line": 19, + "line": 18, "column": 15 }, "end": { - "line": 19, + "line": 18, "column": 22 }, "identifierName": "sibling" @@ -1046,58 +911,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 475, - "end": 498, + "start": 413, + "end": 436, "loc": { "start": { - "line": 19, + "line": 18, "column": 0 }, "end": { - "line": 19, + "line": 18, "column": 23 } }, "declaration": { "type": "VariableDeclaration", - "start": 227, - "end": 473, + "start": 180, + "end": 411, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { - "line": 17, + "line": 16, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 233, - "end": 472, + "start": 186, + "end": 410, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 17, + "line": 16, "column": 1 } }, "id": { "type": "Identifier", - "start": 233, - "end": 240, + "start": 186, + "end": 193, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 11, + "line": 10, "column": 13 }, "identifierName": "sibling" @@ -1107,29 +972,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 243, - "end": 472, + "start": 196, + "end": 410, "loc": { "start": { - "line": 11, + "line": 10, "column": 16 }, "end": { - "line": 17, + "line": 16, "column": 1 } }, "id": { "type": "Identifier", - "start": 233, - "end": 240, + "start": 186, + "end": 193, "loc": { "start": { - "line": 11, + "line": 10, "column": 6 }, "end": { - "line": 11, + "line": 10, "column": 13 }, "identifierName": "sibling" @@ -1143,15 +1008,15 @@ "params": [ { "type": "Identifier", - "start": 244, - "end": 248, + "start": 197, + "end": 201, "loc": { "start": { - "line": 11, + "line": 10, "column": 17 }, "end": { - "line": 11, + "line": 10, "column": 21 }, "identifierName": "node" @@ -1161,58 +1026,58 @@ ], "body": { "type": "BlockStatement", - "start": 253, - "end": 472, + "start": 206, + "end": 410, "loc": { "start": { - "line": 11, + "line": 10, "column": 26 }, "end": { - "line": 17, + "line": 16, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 256, - "end": 309, + "start": 209, + "end": 238, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, - "column": 54 + "line": 11, + "column": 30 } }, "expression": { "type": "CallExpression", - "start": 256, - "end": 308, + "start": 209, + "end": 237, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, - "column": 53 + "line": 11, + "column": 29 } }, "callee": { "type": "Identifier", - "start": 256, - "end": 262, + "start": 209, + "end": 215, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 7 }, "identifierName": "assert" @@ -1221,119 +1086,53 @@ }, "arguments": [ { - "type": "LogicalExpression", - "start": 263, - "end": 307, + "type": "BinaryExpression", + "start": 216, + "end": 236, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, - "column": 52 + "line": 11, + "column": 28 } }, "left": { - "type": "BinaryExpression", - "start": 263, - "end": 283, + "type": "Identifier", + "start": 216, + "end": 220, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, - "column": 28 - } - }, - "left": { - "type": "Identifier", - "start": 263, - "end": 267, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 12 - }, - "identifierName": "node" + "line": 11, + "column": 12 }, - "name": "node" + "identifierName": "node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 279, - "end": 283, - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 28 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "name": "node" }, - "operator": "||", + "operator": "instanceof", "right": { - "type": "BinaryExpression", - "start": 287, - "end": 307, + "type": "Identifier", + "start": 232, + "end": 236, "loc": { "start": { - "line": 12, - "column": 32 + "line": 11, + "column": 24 }, "end": { - "line": 12, - "column": 52 - } - }, - "left": { - "type": "Identifier", - "start": 287, - "end": 291, - "loc": { - "start": { - "line": 12, - "column": 32 - }, - "end": { - "line": 12, - "column": 36 - }, - "identifierName": "node" + "line": 11, + "column": 28 }, - "name": "node" + "identifierName": "Node" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 303, - "end": 307, - "loc": { - "start": { - "line": 12, - "column": 48 - }, - "end": { - "line": 12, - "column": 52 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } + "name": "Node" } } ] @@ -1341,17 +1140,17 @@ "trailingComments": [ { "type": "CommentLine", - "value": " We only use this function when node HAS a sibling.", - "start": 311, - "end": 364, + "value": " We only use this function when node HAS a non-leaf sibling.", + "start": 240, + "end": 302, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 54 + "line": 12, + "column": 63 } } } @@ -1359,43 +1158,43 @@ }, { "type": "ExpressionStatement", - "start": 366, - "end": 395, + "start": 304, + "end": 333, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", - "start": 366, - "end": 394, + "start": 304, + "end": 332, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 29 } }, "callee": { "type": "Identifier", - "start": 366, - "end": 372, + "start": 304, + "end": 310, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 7 }, "identifierName": "assert" @@ -1406,43 +1205,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 373, - "end": 393, + "start": 311, + "end": 331, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 28 } }, "left": { "type": "MemberExpression", - "start": 373, - "end": 384, + "start": 311, + "end": 322, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 19 } }, "object": { "type": "Identifier", - "start": 373, - "end": 377, + "start": 311, + "end": 315, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 12 }, "identifierName": "node" @@ -1451,15 +1250,15 @@ }, "property": { "type": "Identifier", - "start": 378, - "end": 384, + "start": 316, + "end": 322, "loc": { "start": { - "line": 14, + "line": 13, "column": 13 }, "end": { - "line": 14, + "line": 13, "column": 19 }, "identifierName": "parent" @@ -1471,15 +1270,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 389, - "end": 393, + "start": 327, + "end": 331, "loc": { "start": { - "line": 14, + "line": 13, "column": 24 }, "end": { - "line": 14, + "line": 13, "column": 28 } } @@ -1491,17 +1290,17 @@ "leadingComments": [ { "type": "CommentLine", - "value": " We only use this function when node HAS a sibling.", - "start": 311, - "end": 364, + "value": " We only use this function when node HAS a non-leaf sibling.", + "start": 240, + "end": 302, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 54 + "line": 12, + "column": 63 } } } @@ -1509,57 +1308,57 @@ }, { "type": "ReturnStatement", - "start": 398, - "end": 470, + "start": 336, + "end": 408, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 73 } }, "argument": { "type": "ConditionalExpression", - "start": 405, - "end": 469, + "start": 343, + "end": 407, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 72 } }, "test": { "type": "BinaryExpression", - "start": 405, - "end": 430, + "start": 343, + "end": 368, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 33 } }, "left": { "type": "Identifier", - "start": 405, - "end": 409, + "start": 343, + "end": 347, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 12 }, "identifierName": "node" @@ -1569,43 +1368,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 414, - "end": 430, + "start": 352, + "end": 368, "loc": { "start": { - "line": 16, + "line": 15, "column": 17 }, "end": { - "line": 16, + "line": 15, "column": 33 } }, "object": { "type": "MemberExpression", - "start": 414, - "end": 425, + "start": 352, + "end": 363, "loc": { "start": { - "line": 16, + "line": 15, "column": 17 }, "end": { - "line": 16, + "line": 15, "column": 28 } }, "object": { "type": "Identifier", - "start": 414, - "end": 418, + "start": 352, + "end": 356, "loc": { "start": { - "line": 16, + "line": 15, "column": 17 }, "end": { - "line": 16, + "line": 15, "column": 21 }, "identifierName": "node" @@ -1614,15 +1413,15 @@ }, "property": { "type": "Identifier", - "start": 419, - "end": 425, + "start": 357, + "end": 363, "loc": { "start": { - "line": 16, + "line": 15, "column": 22 }, "end": { - "line": 16, + "line": 15, "column": 28 }, "identifierName": "parent" @@ -1633,15 +1432,15 @@ }, "property": { "type": "Identifier", - "start": 426, - "end": 430, + "start": 364, + "end": 368, "loc": { "start": { - "line": 16, + "line": 15, "column": 29 }, "end": { - "line": 16, + "line": 15, "column": 33 }, "identifierName": "left" @@ -1653,43 +1452,43 @@ }, "consequent": { "type": "MemberExpression", - "start": 433, - "end": 450, + "start": 371, + "end": 388, "loc": { "start": { - "line": 16, + "line": 15, "column": 36 }, "end": { - "line": 16, + "line": 15, "column": 53 } }, "object": { "type": "MemberExpression", - "start": 433, - "end": 444, + "start": 371, + "end": 382, "loc": { "start": { - "line": 16, + "line": 15, "column": 36 }, "end": { - "line": 16, + "line": 15, "column": 47 } }, "object": { "type": "Identifier", - "start": 433, - "end": 437, + "start": 371, + "end": 375, "loc": { "start": { - "line": 16, + "line": 15, "column": 36 }, "end": { - "line": 16, + "line": 15, "column": 40 }, "identifierName": "node" @@ -1698,15 +1497,15 @@ }, "property": { "type": "Identifier", - "start": 438, - "end": 444, + "start": 376, + "end": 382, "loc": { "start": { - "line": 16, + "line": 15, "column": 41 }, "end": { - "line": 16, + "line": 15, "column": 47 }, "identifierName": "parent" @@ -1717,15 +1516,15 @@ }, "property": { "type": "Identifier", - "start": 445, - "end": 450, + "start": 383, + "end": 388, "loc": { "start": { - "line": 16, + "line": 15, "column": 48 }, "end": { - "line": 16, + "line": 15, "column": 53 }, "identifierName": "right" @@ -1736,43 +1535,43 @@ }, "alternate": { "type": "MemberExpression", - "start": 453, - "end": 469, + "start": 391, + "end": 407, "loc": { "start": { - "line": 16, + "line": 15, "column": 56 }, "end": { - "line": 16, + "line": 15, "column": 72 } }, "object": { "type": "MemberExpression", - "start": 453, - "end": 464, + "start": 391, + "end": 402, "loc": { "start": { - "line": 16, + "line": 15, "column": 56 }, "end": { - "line": 16, + "line": 15, "column": 67 } }, "object": { "type": "Identifier", - "start": 453, - "end": 457, + "start": 391, + "end": 395, "loc": { "start": { - "line": 16, + "line": 15, "column": 56 }, "end": { - "line": 16, + "line": 15, "column": 60 }, "identifierName": "node" @@ -1781,15 +1580,15 @@ }, "property": { "type": "Identifier", - "start": 458, - "end": 464, + "start": 396, + "end": 402, "loc": { "start": { - "line": 16, + "line": 15, "column": 61 }, "end": { - "line": 16, + "line": 15, "column": 67 }, "identifierName": "parent" @@ -1800,15 +1599,15 @@ }, "property": { "type": "Identifier", - "start": 465, - "end": 469, + "start": 403, + "end": 407, "loc": { "start": { - "line": 16, + "line": 15, "column": 68 }, "end": { - "line": 16, + "line": 15, "column": 72 }, "identifierName": "left" @@ -1830,16 +1629,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n ", - "start": 104, - "end": 226, + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 179, "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } @@ -1854,33 +1653,33 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n ", - "start": 104, - "end": 226, + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 179, "loc": { "start": { - "line": 5, + "line": 4, "column": 0 }, "end": { - "line": 10, + "line": 9, "column": 3 } } }, { "type": "CommentLine", - "value": " We only use this function when node HAS a sibling.", - "start": 311, - "end": 364, + "value": " We only use this function when node HAS a non-leaf sibling.", + "start": 240, + "end": 302, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 54 + "line": 12, + "column": 63 } } } @@ -2152,12 +1951,28 @@ } } }, + { + "type": "CommentBlock", + "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 67, + "end": 179, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 9, + "column": 3 + } + } + }, { "type": { - "label": "import", - "keyword": "import", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2166,17 +1981,17 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 66, - "end": 72, + "value": "const", + "start": 180, + "end": 185, "loc": { "start": { - "line": 3, + "line": 10, "column": 0 }, "end": { - "line": 3, - "column": 6 + "line": 10, + "column": 5 } } }, @@ -2192,166 +2007,17 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 73, - "end": 77, + "value": "sibling", + "start": 186, + "end": 193, "loc": { "start": { - "line": 3, - "column": 7 + "line": 10, + "column": 6 }, "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 78, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Leaf.js", - "start": 83, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 101, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n ", - "start": 104, - "end": 226, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 227, - "end": 232, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "sibling", - "start": 233, - "end": 240, - "loc": { - "start": { - "line": 11, - "column": 6 - }, - "end": { - "line": 11, - "column": 13 + "line": 10, + "column": 13 } } }, @@ -2369,15 +2035,15 @@ "updateContext": null }, "value": "=", - "start": 241, - "end": 242, + "start": 194, + "end": 195, "loc": { "start": { - "line": 11, + "line": 10, "column": 14 }, "end": { - "line": 11, + "line": 10, "column": 15 } } @@ -2394,15 +2060,15 @@ "postfix": false, "binop": null }, - "start": 243, - "end": 244, + "start": 196, + "end": 197, "loc": { "start": { - "line": 11, + "line": 10, "column": 16 }, "end": { - "line": 11, + "line": 10, "column": 17 } } @@ -2420,15 +2086,15 @@ "binop": null }, "value": "node", - "start": 244, - "end": 248, + "start": 197, + "end": 201, "loc": { "start": { - "line": 11, + "line": 10, "column": 17 }, "end": { - "line": 11, + "line": 10, "column": 21 } } @@ -2445,15 +2111,15 @@ "postfix": false, "binop": null }, - "start": 248, - "end": 249, + "start": 201, + "end": 202, "loc": { "start": { - "line": 11, + "line": 10, "column": 21 }, "end": { - "line": 11, + "line": 10, "column": 22 } } @@ -2471,15 +2137,15 @@ "binop": null, "updateContext": null }, - "start": 250, - "end": 252, + "start": 203, + "end": 205, "loc": { "start": { - "line": 11, + "line": 10, "column": 23 }, "end": { - "line": 11, + "line": 10, "column": 25 } } @@ -2496,15 +2162,15 @@ "postfix": false, "binop": null }, - "start": 253, - "end": 254, + "start": 206, + "end": 207, "loc": { "start": { - "line": 11, + "line": 10, "column": 26 }, "end": { - "line": 11, + "line": 10, "column": 27 } } @@ -2522,15 +2188,15 @@ "binop": null }, "value": "assert", - "start": 256, - "end": 262, + "start": 209, + "end": 215, "loc": { "start": { - "line": 12, + "line": 11, "column": 1 }, "end": { - "line": 12, + "line": 11, "column": 7 } } @@ -2547,15 +2213,15 @@ "postfix": false, "binop": null }, - "start": 262, - "end": 263, + "start": 215, + "end": 216, "loc": { "start": { - "line": 12, + "line": 11, "column": 7 }, "end": { - "line": 12, + "line": 11, "column": 8 } } @@ -2573,15 +2239,15 @@ "binop": null }, "value": "node", - "start": 263, - "end": 267, + "start": 216, + "end": 220, "loc": { "start": { - "line": 12, + "line": 11, "column": 8 }, "end": { - "line": 12, + "line": 11, "column": 12 } } @@ -2601,15 +2267,15 @@ "updateContext": null }, "value": "instanceof", - "start": 268, - "end": 278, + "start": 221, + "end": 231, "loc": { "start": { - "line": 12, + "line": 11, "column": 13 }, "end": { - "line": 12, + "line": 11, "column": 23 } } @@ -2627,126 +2293,19 @@ "binop": null }, "value": "Node", - "start": 279, - "end": 283, + "start": 232, + "end": 236, "loc": { "start": { - "line": 12, + "line": 11, "column": 24 }, "end": { - "line": 12, + "line": 11, "column": 28 } } }, - { - "type": { - "label": "||", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 1, - "updateContext": null - }, - "value": "||", - "start": 284, - "end": 286, - "loc": { - "start": { - "line": 12, - "column": 29 - }, - "end": { - "line": 12, - "column": 31 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "node", - "start": 287, - "end": 291, - "loc": { - "start": { - "line": 12, - "column": 32 - }, - "end": { - "line": 12, - "column": 36 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 292, - "end": 302, - "loc": { - "start": { - "line": 12, - "column": 37 - }, - "end": { - "line": 12, - "column": 47 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 303, - "end": 307, - "loc": { - "start": { - "line": 12, - "column": 48 - }, - "end": { - "line": 12, - "column": 52 - } - } - }, { "type": { "label": ")", @@ -2759,16 +2318,16 @@ "postfix": false, "binop": null }, - "start": 307, - "end": 308, + "start": 236, + "end": 237, "loc": { "start": { - "line": 12, - "column": 52 + "line": 11, + "column": 28 }, "end": { - "line": 12, - "column": 53 + "line": 11, + "column": 29 } } }, @@ -2785,32 +2344,32 @@ "binop": null, "updateContext": null }, - "start": 308, - "end": 309, + "start": 237, + "end": 238, "loc": { "start": { - "line": 12, - "column": 53 + "line": 11, + "column": 29 }, "end": { - "line": 12, - "column": 54 + "line": 11, + "column": 30 } } }, { "type": "CommentLine", - "value": " We only use this function when node HAS a sibling.", - "start": 311, - "end": 364, + "value": " We only use this function when node HAS a non-leaf sibling.", + "start": 240, + "end": 302, "loc": { "start": { - "line": 13, + "line": 12, "column": 1 }, "end": { - "line": 13, - "column": 54 + "line": 12, + "column": 63 } } }, @@ -2827,15 +2386,15 @@ "binop": null }, "value": "assert", - "start": 366, - "end": 372, + "start": 304, + "end": 310, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 7 } } @@ -2852,15 +2411,15 @@ "postfix": false, "binop": null }, - "start": 372, - "end": 373, + "start": 310, + "end": 311, "loc": { "start": { - "line": 14, + "line": 13, "column": 7 }, "end": { - "line": 14, + "line": 13, "column": 8 } } @@ -2878,15 +2437,15 @@ "binop": null }, "value": "node", - "start": 373, - "end": 377, + "start": 311, + "end": 315, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 12 } } @@ -2904,15 +2463,15 @@ "binop": null, "updateContext": null }, - "start": 377, - "end": 378, + "start": 315, + "end": 316, "loc": { "start": { - "line": 14, + "line": 13, "column": 12 }, "end": { - "line": 14, + "line": 13, "column": 13 } } @@ -2930,15 +2489,15 @@ "binop": null }, "value": "parent", - "start": 378, - "end": 384, + "start": 316, + "end": 322, "loc": { "start": { - "line": 14, + "line": 13, "column": 13 }, "end": { - "line": 14, + "line": 13, "column": 19 } } @@ -2957,15 +2516,15 @@ "updateContext": null }, "value": "!==", - "start": 385, - "end": 388, + "start": 323, + "end": 326, "loc": { "start": { - "line": 14, + "line": 13, "column": 20 }, "end": { - "line": 14, + "line": 13, "column": 23 } } @@ -2985,15 +2544,15 @@ "updateContext": null }, "value": "null", - "start": 389, - "end": 393, + "start": 327, + "end": 331, "loc": { "start": { - "line": 14, + "line": 13, "column": 24 }, "end": { - "line": 14, + "line": 13, "column": 28 } } @@ -3010,15 +2569,15 @@ "postfix": false, "binop": null }, - "start": 393, - "end": 394, + "start": 331, + "end": 332, "loc": { "start": { - "line": 14, + "line": 13, "column": 28 }, "end": { - "line": 14, + "line": 13, "column": 29 } } @@ -3036,15 +2595,15 @@ "binop": null, "updateContext": null }, - "start": 394, - "end": 395, + "start": 332, + "end": 333, "loc": { "start": { - "line": 14, + "line": 13, "column": 29 }, "end": { - "line": 14, + "line": 13, "column": 30 } } @@ -3064,15 +2623,15 @@ "updateContext": null }, "value": "return", - "start": 398, - "end": 404, + "start": 336, + "end": 342, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 7 } } @@ -3090,15 +2649,15 @@ "binop": null }, "value": "node", - "start": 405, - "end": 409, + "start": 343, + "end": 347, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 12 } } @@ -3117,15 +2676,15 @@ "updateContext": null }, "value": "===", - "start": 410, - "end": 413, + "start": 348, + "end": 351, "loc": { "start": { - "line": 16, + "line": 15, "column": 13 }, "end": { - "line": 16, + "line": 15, "column": 16 } } @@ -3143,15 +2702,15 @@ "binop": null }, "value": "node", - "start": 414, - "end": 418, + "start": 352, + "end": 356, "loc": { "start": { - "line": 16, + "line": 15, "column": 17 }, "end": { - "line": 16, + "line": 15, "column": 21 } } @@ -3169,15 +2728,15 @@ "binop": null, "updateContext": null }, - "start": 418, - "end": 419, + "start": 356, + "end": 357, "loc": { "start": { - "line": 16, + "line": 15, "column": 21 }, "end": { - "line": 16, + "line": 15, "column": 22 } } @@ -3195,15 +2754,15 @@ "binop": null }, "value": "parent", - "start": 419, - "end": 425, + "start": 357, + "end": 363, "loc": { "start": { - "line": 16, + "line": 15, "column": 22 }, "end": { - "line": 16, + "line": 15, "column": 28 } } @@ -3221,15 +2780,15 @@ "binop": null, "updateContext": null }, - "start": 425, - "end": 426, + "start": 363, + "end": 364, "loc": { "start": { - "line": 16, + "line": 15, "column": 28 }, "end": { - "line": 16, + "line": 15, "column": 29 } } @@ -3247,15 +2806,15 @@ "binop": null }, "value": "left", - "start": 426, - "end": 430, + "start": 364, + "end": 368, "loc": { "start": { - "line": 16, + "line": 15, "column": 29 }, "end": { - "line": 16, + "line": 15, "column": 33 } } @@ -3273,15 +2832,15 @@ "binop": null, "updateContext": null }, - "start": 431, - "end": 432, + "start": 369, + "end": 370, "loc": { "start": { - "line": 16, + "line": 15, "column": 34 }, "end": { - "line": 16, + "line": 15, "column": 35 } } @@ -3299,15 +2858,15 @@ "binop": null }, "value": "node", - "start": 433, - "end": 437, + "start": 371, + "end": 375, "loc": { "start": { - "line": 16, + "line": 15, "column": 36 }, "end": { - "line": 16, + "line": 15, "column": 40 } } @@ -3325,15 +2884,15 @@ "binop": null, "updateContext": null }, - "start": 437, - "end": 438, + "start": 375, + "end": 376, "loc": { "start": { - "line": 16, + "line": 15, "column": 40 }, "end": { - "line": 16, + "line": 15, "column": 41 } } @@ -3351,15 +2910,15 @@ "binop": null }, "value": "parent", - "start": 438, - "end": 444, + "start": 376, + "end": 382, "loc": { "start": { - "line": 16, + "line": 15, "column": 41 }, "end": { - "line": 16, + "line": 15, "column": 47 } } @@ -3377,15 +2936,15 @@ "binop": null, "updateContext": null }, - "start": 444, - "end": 445, + "start": 382, + "end": 383, "loc": { "start": { - "line": 16, + "line": 15, "column": 47 }, "end": { - "line": 16, + "line": 15, "column": 48 } } @@ -3403,15 +2962,15 @@ "binop": null }, "value": "right", - "start": 445, - "end": 450, + "start": 383, + "end": 388, "loc": { "start": { - "line": 16, + "line": 15, "column": 48 }, "end": { - "line": 16, + "line": 15, "column": 53 } } @@ -3429,15 +2988,15 @@ "binop": null, "updateContext": null }, - "start": 451, - "end": 452, + "start": 389, + "end": 390, "loc": { "start": { - "line": 16, + "line": 15, "column": 54 }, "end": { - "line": 16, + "line": 15, "column": 55 } } @@ -3455,15 +3014,15 @@ "binop": null }, "value": "node", - "start": 453, - "end": 457, + "start": 391, + "end": 395, "loc": { "start": { - "line": 16, + "line": 15, "column": 56 }, "end": { - "line": 16, + "line": 15, "column": 60 } } @@ -3481,15 +3040,15 @@ "binop": null, "updateContext": null }, - "start": 457, - "end": 458, + "start": 395, + "end": 396, "loc": { "start": { - "line": 16, + "line": 15, "column": 60 }, "end": { - "line": 16, + "line": 15, "column": 61 } } @@ -3507,15 +3066,15 @@ "binop": null }, "value": "parent", - "start": 458, - "end": 464, + "start": 396, + "end": 402, "loc": { "start": { - "line": 16, + "line": 15, "column": 61 }, "end": { - "line": 16, + "line": 15, "column": 67 } } @@ -3533,15 +3092,15 @@ "binop": null, "updateContext": null }, - "start": 464, - "end": 465, + "start": 402, + "end": 403, "loc": { "start": { - "line": 16, + "line": 15, "column": 67 }, "end": { - "line": 16, + "line": 15, "column": 68 } } @@ -3559,15 +3118,15 @@ "binop": null }, "value": "left", - "start": 465, - "end": 469, + "start": 403, + "end": 407, "loc": { "start": { - "line": 16, + "line": 15, "column": 68 }, "end": { - "line": 16, + "line": 15, "column": 72 } } @@ -3585,15 +3144,15 @@ "binop": null, "updateContext": null }, - "start": 469, - "end": 470, + "start": 407, + "end": 408, "loc": { "start": { - "line": 16, + "line": 15, "column": 72 }, "end": { - "line": 16, + "line": 15, "column": 73 } } @@ -3610,15 +3169,15 @@ "postfix": false, "binop": null }, - "start": 471, - "end": 472, + "start": 409, + "end": 410, "loc": { "start": { - "line": 17, + "line": 16, "column": 0 }, "end": { - "line": 17, + "line": 16, "column": 1 } } @@ -3636,15 +3195,15 @@ "binop": null, "updateContext": null }, - "start": 472, - "end": 473, + "start": 410, + "end": 411, "loc": { "start": { - "line": 17, + "line": 16, "column": 1 }, "end": { - "line": 17, + "line": 16, "column": 2 } } @@ -3664,15 +3223,15 @@ "updateContext": null }, "value": "export", - "start": 475, - "end": 481, + "start": 413, + "end": 419, "loc": { "start": { - "line": 19, + "line": 18, "column": 0 }, "end": { - "line": 19, + "line": 18, "column": 6 } } @@ -3692,15 +3251,15 @@ "updateContext": null }, "value": "default", - "start": 482, - "end": 489, + "start": 420, + "end": 427, "loc": { "start": { - "line": 19, + "line": 18, "column": 7 }, "end": { - "line": 19, + "line": 18, "column": 14 } } @@ -3718,15 +3277,15 @@ "binop": null }, "value": "sibling", - "start": 490, - "end": 497, + "start": 428, + "end": 435, "loc": { "start": { - "line": 19, + "line": 18, "column": 15 }, "end": { - "line": 19, + "line": 18, "column": 22 } } @@ -3744,15 +3303,15 @@ "binop": null, "updateContext": null }, - "start": 497, - "end": 498, + "start": 435, + "end": 436, "loc": { "start": { - "line": 19, + "line": 18, "column": 22 }, "end": { - "line": 19, + "line": 18, "column": 23 } } @@ -3770,15 +3329,15 @@ "binop": null, "updateContext": null }, - "start": 499, - "end": 499, + "start": 437, + "end": 437, "loc": { "start": { - "line": 20, + "line": 19, "column": 0 }, "end": { - "line": 20, + "line": 19, "column": 0 } } diff --git a/ast/source/family/uncle.js.json b/ast/source/family/uncle.js.json index a18e99c..c1a3867 100644 --- a/ast/source/family/uncle.js.json +++ b/ast/source/family/uncle.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 559, + "end": 454, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 23, + "line": 20, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 559, + "end": 454, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 23, + "line": 20, "column": 0 } }, @@ -169,7 +169,7 @@ { "type": "ImportDeclaration", "start": 66, - "end": 102, + "end": 109, "loc": { "start": { "line": 3, @@ -177,14 +177,14 @@ }, "end": { "line": 3, - "column": 36 + "column": 43 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 73, - "end": 77, + "end": 84, "loc": { "start": { "line": 3, @@ -192,13 +192,13 @@ }, "end": { "line": 3, - "column": 11 + "column": 18 } }, "local": { "type": "Identifier", "start": 73, - "end": 77, + "end": 84, "loc": { "start": { "line": 3, @@ -206,75 +206,6 @@ }, "end": { "line": 3, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 83, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Leaf.js", - "raw": "'../types/Leaf.js'" - }, - "value": "../types/Leaf.js" - } - }, - { - "type": "ImportDeclaration", - "start": 103, - "end": 146, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 43 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 110, - "end": 121, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 18 - } - }, - "local": { - "type": "Identifier", - "start": 110, - "end": 121, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, "column": 18 }, "identifierName": "grandparent" @@ -285,15 +216,15 @@ ], "source": { "type": "StringLiteral", - "start": 127, - "end": 145, + "start": 90, + "end": 108, "loc": { "start": { - "line": 4, + "line": 3, "column": 24 }, "end": { - "line": 4, + "line": 3, "column": 42 } }, @@ -306,16 +237,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n ", - "start": 148, - "end": 310, + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 111, + "end": 268, "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 12, + "line": 11, "column": 3 } } @@ -324,44 +255,44 @@ }, { "type": "Identifier", - "start": 311, - "end": 535, + "start": 269, + "end": 430, "loc": { "start": { - "line": 13, + "line": 12, "column": 0 }, "end": { - "line": 20, + "line": 17, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 317, - "end": 534, + "start": 275, + "end": 429, "loc": { "start": { - "line": 13, + "line": 12, "column": 6 }, "end": { - "line": 20, + "line": 17, "column": 1 } }, "id": { "type": "Identifier", - "start": 317, - "end": 322, + "start": 275, + "end": 280, "loc": { "start": { - "line": 13, + "line": 12, "column": 6 }, "end": { - "line": 13, + "line": 12, "column": 11 }, "identifierName": "uncle" @@ -371,15 +302,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 325, - "end": 534, + "start": 283, + "end": 429, "loc": { "start": { - "line": 13, + "line": 12, "column": 14 }, "end": { - "line": 20, + "line": 17, "column": 1 } }, @@ -390,15 +321,15 @@ "params": [ { "type": "Identifier", - "start": 326, - "end": 330, + "start": 284, + "end": 288, "loc": { "start": { - "line": 13, + "line": 12, "column": 15 }, "end": { - "line": 13, + "line": 12, "column": 19 }, "identifierName": "node" @@ -408,58 +339,58 @@ ], "body": { "type": "BlockStatement", - "start": 335, - "end": 534, + "start": 293, + "end": 429, "loc": { "start": { - "line": 13, + "line": 12, "column": 24 }, "end": { - "line": 20, + "line": 17, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 338, - "end": 367, + "start": 296, + "end": 325, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", - "start": 338, - "end": 366, + "start": 296, + "end": 324, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 29 } }, "callee": { "type": "Identifier", - "start": 338, - "end": 344, + "start": 296, + "end": 302, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 7 }, "identifierName": "assert" @@ -469,29 +400,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 345, - "end": 365, + "start": 303, + "end": 323, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 28 } }, "left": { "type": "Identifier", - "start": 345, - "end": 349, + "start": 303, + "end": 307, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 12 }, "identifierName": "node" @@ -501,15 +432,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 361, - "end": 365, + "start": 319, + "end": 323, "loc": { "start": { - "line": 14, + "line": 13, "column": 24 }, "end": { - "line": 14, + "line": 13, "column": 28 }, "identifierName": "Node" @@ -522,44 +453,44 @@ }, { "type": "VariableDeclaration", - "start": 369, - "end": 397, + "start": 327, + "end": 355, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 29 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 375, - "end": 396, + "start": 333, + "end": 354, "loc": { "start": { - "line": 15, + "line": 14, "column": 7 }, "end": { - "line": 15, + "line": 14, "column": 28 } }, "id": { "type": "Identifier", - "start": 375, - "end": 376, + "start": 333, + "end": 334, "loc": { "start": { - "line": 15, + "line": 14, "column": 7 }, "end": { - "line": 15, + "line": 14, "column": 8 }, "identifierName": "g" @@ -568,29 +499,29 @@ }, "init": { "type": "CallExpression", - "start": 379, - "end": 396, + "start": 337, + "end": 354, "loc": { "start": { - "line": 15, + "line": 14, "column": 11 }, "end": { - "line": 15, + "line": 14, "column": 28 } }, "callee": { "type": "Identifier", - "start": 379, - "end": 390, + "start": 337, + "end": 348, "loc": { "start": { - "line": 15, + "line": 14, "column": 11 }, "end": { - "line": 15, + "line": 14, "column": 22 }, "identifierName": "grandparent" @@ -600,15 +531,15 @@ "arguments": [ { "type": "Identifier", - "start": 391, - "end": 395, + "start": 349, + "end": 353, "loc": { "start": { - "line": 15, + "line": 14, "column": 23 }, "end": { - "line": 15, + "line": 14, "column": 27 }, "identifierName": "node" @@ -623,43 +554,43 @@ }, { "type": "ExpressionStatement", - "start": 399, - "end": 418, + "start": 357, + "end": 376, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 20 } }, "expression": { "type": "CallExpression", - "start": 399, - "end": 417, + "start": 357, + "end": 375, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 19 } }, "callee": { "type": "Identifier", - "start": 399, - "end": 405, + "start": 357, + "end": 363, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 7 }, "identifierName": "assert" @@ -669,29 +600,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 406, - "end": 416, + "start": 364, + "end": 374, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 18 } }, "left": { "type": "Identifier", - "start": 406, - "end": 407, + "start": 364, + "end": 365, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 9 }, "identifierName": "g" @@ -701,15 +632,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 412, - "end": 416, + "start": 370, + "end": 374, "loc": { "start": { - "line": 16, + "line": 15, "column": 14 }, "end": { - "line": 16, + "line": 15, "column": 18 } } @@ -719,481 +650,249 @@ } }, { - "type": "VariableDeclaration", - "start": 420, - "end": 472, + "type": "ReturnStatement", + "start": 378, + "end": 427, "loc": { "start": { - "line": 17, + "line": 16, "column": 1 }, "end": { - "line": 17, - "column": 53 + "line": 16, + "column": 50 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 426, - "end": 471, + "argument": { + "type": "ConditionalExpression", + "start": 385, + "end": 426, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 49 + } + }, + "test": { + "type": "BinaryExpression", + "start": 385, + "end": 407, "loc": { "start": { - "line": 17, - "column": 7 + "line": 16, + "column": 8 }, "end": { - "line": 17, - "column": 52 + "line": 16, + "column": 30 } }, - "id": { - "type": "Identifier", - "start": 426, - "end": 427, + "left": { + "type": "MemberExpression", + "start": 385, + "end": 396, "loc": { "start": { - "line": 17, - "column": 7 + "line": 16, + "column": 8 }, "end": { - "line": 17, - "column": 8 + "line": 16, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 385, + "end": 389, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 390, + "end": 396, + "loc": { + "start": { + "line": 16, + "column": 13 + }, + "end": { + "line": 16, + "column": 19 + }, + "identifierName": "parent" }, - "identifierName": "u" + "name": "parent" }, - "name": "u" + "computed": false }, - "init": { - "type": "ConditionalExpression", - "start": 430, - "end": 471, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 401, + "end": 407, "loc": { "start": { - "line": 17, - "column": 11 + "line": 16, + "column": 24 }, "end": { - "line": 17, - "column": 52 + "line": 16, + "column": 30 } }, - "test": { - "type": "BinaryExpression", - "start": 430, - "end": 452, + "object": { + "type": "Identifier", + "start": 401, + "end": 402, "loc": { "start": { - "line": 17, - "column": 11 + "line": 16, + "column": 24 }, "end": { - "line": 17, - "column": 33 - } - }, - "left": { - "type": "MemberExpression", - "start": 430, - "end": 441, - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 430, - "end": 434, - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 15 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 435, - "end": 441, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 22 - }, - "identifierName": "parent" - }, - "name": "parent" + "line": 16, + "column": 25 }, - "computed": false + "identifierName": "g" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 446, - "end": 452, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 446, - "end": 447, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 28 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 448, - "end": 452, - "loc": { - "start": { - "line": 17, - "column": 29 - }, - "end": { - "line": 17, - "column": 33 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } + "name": "g" }, - "consequent": { - "type": "MemberExpression", - "start": 455, - "end": 462, + "property": { + "type": "Identifier", + "start": 403, + "end": 407, "loc": { "start": { - "line": 17, - "column": 36 + "line": 16, + "column": 26 }, "end": { - "line": 17, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 455, - "end": 456, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 37 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 457, - "end": 462, - "loc": { - "start": { - "line": 17, - "column": 38 - }, - "end": { - "line": 17, - "column": 43 - }, - "identifierName": "right" + "line": 16, + "column": 30 }, - "name": "right" + "identifierName": "left" }, - "computed": false + "name": "left" }, - "alternate": { - "type": "MemberExpression", - "start": 465, - "end": 471, - "loc": { - "start": { - "line": 17, - "column": 46 - }, - "end": { - "line": 17, - "column": 52 - } - }, - "object": { - "type": "Identifier", - "start": 465, - "end": 466, - "loc": { - "start": { - "line": 17, - "column": 46 - }, - "end": { - "line": 17, - "column": 47 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 467, - "end": 471, - "loc": { - "start": { - "line": 17, - "column": 48 - }, - "end": { - "line": 17, - "column": 52 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 474, - "end": 521, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 48 - } - }, - "expression": { - "type": "CallExpression", - "start": 474, - "end": 520, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 47 + "computed": false } }, - "callee": { - "type": "Identifier", - "start": 474, - "end": 480, + "consequent": { + "type": "MemberExpression", + "start": 410, + "end": 417, "loc": { "start": { - "line": 18, - "column": 1 + "line": 16, + "column": 33 }, "end": { - "line": 18, - "column": 7 - }, - "identifierName": "assert" + "line": 16, + "column": 40 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 481, - "end": 519, + "object": { + "type": "Identifier", + "start": 410, + "end": 411, "loc": { "start": { - "line": 18, - "column": 8 + "line": 16, + "column": 33 }, "end": { - "line": 18, - "column": 46 - } + "line": 16, + "column": 34 + }, + "identifierName": "g" }, - "left": { - "type": "BinaryExpression", - "start": 481, - "end": 498, - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 25 - } + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 412, + "end": 417, + "loc": { + "start": { + "line": 16, + "column": 35 }, - "left": { - "type": "Identifier", - "start": 481, - "end": 482, - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 9 - }, - "identifierName": "u" - }, - "name": "u" + "end": { + "line": 16, + "column": 40 }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 494, - "end": 498, - "loc": { - "start": { - "line": 18, - "column": 21 - }, - "end": { - "line": 18, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "identifierName": "right" }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 502, - "end": 519, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 46 - } + "name": "right" + }, + "computed": false + }, + "alternate": { + "type": "MemberExpression", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 16, + "column": 43 + }, + "end": { + "line": 16, + "column": 49 + } + }, + "object": { + "type": "Identifier", + "start": 420, + "end": 421, + "loc": { + "start": { + "line": 16, + "column": 43 }, - "left": { - "type": "Identifier", - "start": 502, - "end": 503, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 30 - }, - "identifierName": "u" - }, - "name": "u" + "end": { + "line": 16, + "column": 44 }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 515, - "end": 519, - "loc": { - "start": { - "line": 18, - "column": 42 - }, - "end": { - "line": 18, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - } - ] - } - }, - { - "type": "ReturnStatement", - "start": 523, - "end": 532, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 10 - } - }, - "argument": { - "type": "Identifier", - "start": 530, - "end": 531, - "loc": { - "start": { - "line": 19, - "column": 8 + "identifierName": "g" + }, + "name": "g" }, - "end": { - "line": 19, - "column": 9 + "property": { + "type": "Identifier", + "start": 422, + "end": 426, + "loc": { + "start": { + "line": 16, + "column": 45 + }, + "end": { + "line": 16, + "column": 49 + }, + "identifierName": "left" + }, + "name": "left" }, - "identifierName": "u" - }, - "name": "u" + "computed": false + } } } ], @@ -1210,29 +909,29 @@ }, { "type": "Identifier", - "start": 537, - "end": 558, + "start": 432, + "end": 453, "loc": { "start": { - "line": 22, + "line": 19, "column": 0 }, "end": { - "line": 22, + "line": 19, "column": 21 } }, "declaration": { "type": "Identifier", - "start": 552, - "end": 557, + "start": 447, + "end": 452, "loc": { "start": { - "line": 22, + "line": 19, "column": 15 }, "end": { - "line": 22, + "line": 19, "column": 20 }, "identifierName": "uncle" @@ -1245,58 +944,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 537, - "end": 558, + "start": 432, + "end": 453, "loc": { "start": { - "line": 22, + "line": 19, "column": 0 }, "end": { - "line": 22, + "line": 19, "column": 21 } }, "declaration": { "type": "VariableDeclaration", - "start": 311, - "end": 535, + "start": 269, + "end": 430, "loc": { "start": { - "line": 13, + "line": 12, "column": 0 }, "end": { - "line": 20, + "line": 17, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 317, - "end": 534, + "start": 275, + "end": 429, "loc": { "start": { - "line": 13, + "line": 12, "column": 6 }, "end": { - "line": 20, + "line": 17, "column": 1 } }, "id": { "type": "Identifier", - "start": 317, - "end": 322, + "start": 275, + "end": 280, "loc": { "start": { - "line": 13, + "line": 12, "column": 6 }, "end": { - "line": 13, + "line": 12, "column": 11 }, "identifierName": "uncle" @@ -1306,29 +1005,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 325, - "end": 534, + "start": 283, + "end": 429, "loc": { "start": { - "line": 13, + "line": 12, "column": 14 }, "end": { - "line": 20, + "line": 17, "column": 1 } }, "id": { "type": "Identifier", - "start": 317, - "end": 322, + "start": 275, + "end": 280, "loc": { "start": { - "line": 13, + "line": 12, "column": 6 }, "end": { - "line": 13, + "line": 12, "column": 11 }, "identifierName": "uncle" @@ -1342,15 +1041,15 @@ "params": [ { "type": "Identifier", - "start": 326, - "end": 330, + "start": 284, + "end": 288, "loc": { "start": { - "line": 13, + "line": 12, "column": 15 }, "end": { - "line": 13, + "line": 12, "column": 19 }, "identifierName": "node" @@ -1360,58 +1059,58 @@ ], "body": { "type": "BlockStatement", - "start": 335, - "end": 534, + "start": 293, + "end": 429, "loc": { "start": { - "line": 13, + "line": 12, "column": 24 }, "end": { - "line": 20, + "line": 17, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 338, - "end": 367, + "start": 296, + "end": 325, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 30 } }, "expression": { "type": "CallExpression", - "start": 338, - "end": 366, + "start": 296, + "end": 324, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 29 } }, "callee": { "type": "Identifier", - "start": 338, - "end": 344, + "start": 296, + "end": 302, "loc": { "start": { - "line": 14, + "line": 13, "column": 1 }, "end": { - "line": 14, + "line": 13, "column": 7 }, "identifierName": "assert" @@ -1421,29 +1120,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 345, - "end": 365, + "start": 303, + "end": 323, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 28 } }, "left": { "type": "Identifier", - "start": 345, - "end": 349, + "start": 303, + "end": 307, "loc": { "start": { - "line": 14, + "line": 13, "column": 8 }, "end": { - "line": 14, + "line": 13, "column": 12 }, "identifierName": "node" @@ -1453,15 +1152,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 361, - "end": 365, + "start": 319, + "end": 323, "loc": { "start": { - "line": 14, + "line": 13, "column": 24 }, "end": { - "line": 14, + "line": 13, "column": 28 }, "identifierName": "Node" @@ -1474,44 +1173,44 @@ }, { "type": "VariableDeclaration", - "start": 369, - "end": 397, + "start": 327, + "end": 355, "loc": { "start": { - "line": 15, + "line": 14, "column": 1 }, "end": { - "line": 15, + "line": 14, "column": 29 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 375, - "end": 396, + "start": 333, + "end": 354, "loc": { "start": { - "line": 15, + "line": 14, "column": 7 }, "end": { - "line": 15, + "line": 14, "column": 28 } }, "id": { "type": "Identifier", - "start": 375, - "end": 376, + "start": 333, + "end": 334, "loc": { "start": { - "line": 15, + "line": 14, "column": 7 }, "end": { - "line": 15, + "line": 14, "column": 8 }, "identifierName": "g" @@ -1520,29 +1219,29 @@ }, "init": { "type": "CallExpression", - "start": 379, - "end": 396, + "start": 337, + "end": 354, "loc": { "start": { - "line": 15, + "line": 14, "column": 11 }, "end": { - "line": 15, + "line": 14, "column": 28 } }, "callee": { "type": "Identifier", - "start": 379, - "end": 390, + "start": 337, + "end": 348, "loc": { "start": { - "line": 15, + "line": 14, "column": 11 }, "end": { - "line": 15, + "line": 14, "column": 22 }, "identifierName": "grandparent" @@ -1552,15 +1251,15 @@ "arguments": [ { "type": "Identifier", - "start": 391, - "end": 395, + "start": 349, + "end": 353, "loc": { "start": { - "line": 15, + "line": 14, "column": 23 }, "end": { - "line": 15, + "line": 14, "column": 27 }, "identifierName": "node" @@ -1575,43 +1274,43 @@ }, { "type": "ExpressionStatement", - "start": 399, - "end": 418, + "start": 357, + "end": 376, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 20 } }, "expression": { "type": "CallExpression", - "start": 399, - "end": 417, + "start": 357, + "end": 375, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 19 } }, "callee": { "type": "Identifier", - "start": 399, - "end": 405, + "start": 357, + "end": 363, "loc": { "start": { - "line": 16, + "line": 15, "column": 1 }, "end": { - "line": 16, + "line": 15, "column": 7 }, "identifierName": "assert" @@ -1621,29 +1320,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 406, - "end": 416, + "start": 364, + "end": 374, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 18 } }, "left": { "type": "Identifier", - "start": 406, - "end": 407, + "start": 364, + "end": 365, "loc": { "start": { - "line": 16, + "line": 15, "column": 8 }, "end": { - "line": 16, + "line": 15, "column": 9 }, "identifierName": "g" @@ -1653,15 +1352,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 412, - "end": 416, + "start": 370, + "end": 374, "loc": { "start": { - "line": 16, + "line": 15, "column": 14 }, "end": { - "line": 16, + "line": 15, "column": 18 } } @@ -1671,481 +1370,249 @@ } }, { - "type": "VariableDeclaration", - "start": 420, - "end": 472, + "type": "ReturnStatement", + "start": 378, + "end": 427, "loc": { "start": { - "line": 17, + "line": 16, "column": 1 }, "end": { - "line": 17, - "column": 53 + "line": 16, + "column": 50 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 426, - "end": 471, + "argument": { + "type": "ConditionalExpression", + "start": 385, + "end": 426, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 49 + } + }, + "test": { + "type": "BinaryExpression", + "start": 385, + "end": 407, "loc": { "start": { - "line": 17, - "column": 7 + "line": 16, + "column": 8 }, "end": { - "line": 17, - "column": 52 + "line": 16, + "column": 30 } }, - "id": { - "type": "Identifier", - "start": 426, - "end": 427, + "left": { + "type": "MemberExpression", + "start": 385, + "end": 396, "loc": { "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, + "line": 16, "column": 8 }, - "identifierName": "u" - }, - "name": "u" - }, - "init": { - "type": "ConditionalExpression", - "start": 430, - "end": 471, - "loc": { - "start": { - "line": 17, - "column": 11 - }, "end": { - "line": 17, - "column": 52 + "line": 16, + "column": 19 } }, - "test": { - "type": "BinaryExpression", - "start": 430, - "end": 452, + "object": { + "type": "Identifier", + "start": 385, + "end": 389, "loc": { "start": { - "line": 17, - "column": 11 + "line": 16, + "column": 8 }, "end": { - "line": 17, - "column": 33 - } - }, - "left": { - "type": "MemberExpression", - "start": 430, - "end": 441, - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 430, - "end": 434, - "loc": { - "start": { - "line": 17, - "column": 11 - }, - "end": { - "line": 17, - "column": 15 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 435, - "end": 441, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 22 - }, - "identifierName": "parent" - }, - "name": "parent" + "line": 16, + "column": 12 }, - "computed": false + "identifierName": "node" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 446, - "end": 452, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 446, - "end": 447, - "loc": { - "start": { - "line": 17, - "column": 27 - }, - "end": { - "line": 17, - "column": 28 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 448, - "end": 452, - "loc": { - "start": { - "line": 17, - "column": 29 - }, - "end": { - "line": 17, - "column": 33 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } + "name": "node" }, - "consequent": { - "type": "MemberExpression", - "start": 455, - "end": 462, + "property": { + "type": "Identifier", + "start": 390, + "end": 396, "loc": { "start": { - "line": 17, - "column": 36 + "line": 16, + "column": 13 }, "end": { - "line": 17, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 455, - "end": 456, - "loc": { - "start": { - "line": 17, - "column": 36 - }, - "end": { - "line": 17, - "column": 37 - }, - "identifierName": "g" + "line": 16, + "column": 19 }, - "name": "g" + "identifierName": "parent" }, - "property": { - "type": "Identifier", - "start": 457, - "end": 462, - "loc": { - "start": { - "line": 17, - "column": 38 - }, - "end": { - "line": 17, - "column": 43 - }, - "identifierName": "right" - }, - "name": "right" + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 401, + "end": 407, + "loc": { + "start": { + "line": 16, + "column": 24 }, - "computed": false + "end": { + "line": 16, + "column": 30 + } }, - "alternate": { - "type": "MemberExpression", - "start": 465, - "end": 471, + "object": { + "type": "Identifier", + "start": 401, + "end": 402, "loc": { "start": { - "line": 17, - "column": 46 + "line": 16, + "column": 24 }, "end": { - "line": 17, - "column": 52 - } - }, - "object": { - "type": "Identifier", - "start": 465, - "end": 466, - "loc": { - "start": { - "line": 17, - "column": 46 - }, - "end": { - "line": 17, - "column": 47 - }, - "identifierName": "g" + "line": 16, + "column": 25 }, - "name": "g" + "identifierName": "g" }, - "property": { - "type": "Identifier", - "start": 467, - "end": 471, - "loc": { - "start": { - "line": 17, - "column": 48 - }, - "end": { - "line": 17, - "column": 52 - }, - "identifierName": "left" + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 403, + "end": 407, + "loc": { + "start": { + "line": 16, + "column": 26 + }, + "end": { + "line": 16, + "column": 30 }, - "name": "left" + "identifierName": "left" }, - "computed": false - } - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 474, - "end": 521, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 48 - } - }, - "expression": { - "type": "CallExpression", - "start": 474, - "end": 520, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 47 + "name": "left" + }, + "computed": false } }, - "callee": { - "type": "Identifier", - "start": 474, - "end": 480, + "consequent": { + "type": "MemberExpression", + "start": 410, + "end": 417, "loc": { "start": { - "line": 18, - "column": 1 + "line": 16, + "column": 33 }, "end": { - "line": 18, - "column": 7 - }, - "identifierName": "assert" + "line": 16, + "column": 40 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "LogicalExpression", - "start": 481, - "end": 519, + "object": { + "type": "Identifier", + "start": 410, + "end": 411, "loc": { "start": { - "line": 18, - "column": 8 + "line": 16, + "column": 33 }, "end": { - "line": 18, - "column": 46 - } + "line": 16, + "column": 34 + }, + "identifierName": "g" }, - "left": { - "type": "BinaryExpression", - "start": 481, - "end": 498, - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 25 - } + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 412, + "end": 417, + "loc": { + "start": { + "line": 16, + "column": 35 }, - "left": { - "type": "Identifier", - "start": 481, - "end": 482, - "loc": { - "start": { - "line": 18, - "column": 8 - }, - "end": { - "line": 18, - "column": 9 - }, - "identifierName": "u" - }, - "name": "u" + "end": { + "line": 16, + "column": 40 }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 494, - "end": 498, - "loc": { - "start": { - "line": 18, - "column": 21 - }, - "end": { - "line": 18, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } + "identifierName": "right" }, - "operator": "||", - "right": { - "type": "BinaryExpression", - "start": 502, - "end": 519, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 46 - } + "name": "right" + }, + "computed": false + }, + "alternate": { + "type": "MemberExpression", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 16, + "column": 43 + }, + "end": { + "line": 16, + "column": 49 + } + }, + "object": { + "type": "Identifier", + "start": 420, + "end": 421, + "loc": { + "start": { + "line": 16, + "column": 43 }, - "left": { - "type": "Identifier", - "start": 502, - "end": 503, - "loc": { - "start": { - "line": 18, - "column": 29 - }, - "end": { - "line": 18, - "column": 30 - }, - "identifierName": "u" - }, - "name": "u" + "end": { + "line": 16, + "column": 44 }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 515, - "end": 519, - "loc": { - "start": { - "line": 18, - "column": 42 - }, - "end": { - "line": 18, - "column": 46 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - } - ] - } - }, - { - "type": "ReturnStatement", - "start": 523, - "end": 532, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 10 - } - }, - "argument": { - "type": "Identifier", - "start": 530, - "end": 531, - "loc": { - "start": { - "line": 19, - "column": 8 + "identifierName": "g" + }, + "name": "g" }, - "end": { - "line": 19, - "column": 9 + "property": { + "type": "Identifier", + "start": 422, + "end": 426, + "loc": { + "start": { + "line": 16, + "column": 45 + }, + "end": { + "line": 16, + "column": 49 + }, + "identifierName": "left" + }, + "name": "left" }, - "identifierName": "u" - }, - "name": "u" + "computed": false + } } } ], @@ -2159,16 +1626,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n ", - "start": 148, - "end": 310, + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 111, + "end": 268, "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 12, + "line": 11, "column": 3 } } @@ -2183,16 +1650,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n ", - "start": 148, - "end": 310, + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 111, + "end": 268, "loc": { "start": { - "line": 6, + "line": 5, "column": 0 }, "end": { - "line": 12, + "line": 11, "column": 3 } } @@ -2302,638 +1769,94 @@ }, "end": { "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 46, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 66, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 73, - "end": 77, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 78, - "end": 82, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Leaf.js", - "start": 83, - "end": 101, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 101, - "end": 102, - "loc": { - "start": { - "line": 3, - "column": 35 - }, - "end": { - "line": 3, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 103, - "end": 109, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "grandparent", - "start": 110, - "end": 121, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 122, - "end": 126, - "loc": { - "start": { - "line": 4, - "column": 19 - }, - "end": { - "line": 4, - "column": 23 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./grandparent.js", - "start": 127, - "end": 145, - "loc": { - "start": { - "line": 4, - "column": 24 - }, - "end": { - "line": 4, - "column": 42 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 145, - "end": 146, - "loc": { - "start": { - "line": 4, - "column": 42 - }, - "end": { - "line": 4, - "column": 43 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n ", - "start": 148, - "end": 310, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 12, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 311, - "end": 316, - "loc": { - "start": { - "line": 13, - "column": 0 - }, - "end": { - "line": 13, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "uncle", - "start": 317, - "end": 322, - "loc": { - "start": { - "line": 13, - "column": 6 - }, - "end": { - "line": 13, - "column": 11 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 323, - "end": 324, - "loc": { - "start": { - "line": 13, - "column": 12 - }, - "end": { - "line": 13, - "column": 13 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 325, - "end": 326, - "loc": { - "start": { - "line": 13, - "column": 14 - }, - "end": { - "line": 13, - "column": 15 + "column": 27 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 326, - "end": 330, + "start": 27, + "end": 28, "loc": { "start": { - "line": 13, - "column": 15 + "line": 1, + "column": 27 }, "end": { - "line": 13, - "column": 19 + "line": 1, + "column": 28 } } }, { "type": { - "label": ")", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 330, - "end": 331, + "value": "import", + "start": 29, + "end": 35, "loc": { "start": { - "line": 13, - "column": 19 + "line": 2, + "column": 0 }, "end": { - "line": 13, - "column": 20 + "line": 2, + "column": 6 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 332, - "end": 334, + "value": "Node", + "start": 36, + "end": 40, "loc": { "start": { - "line": 13, - "column": 21 + "line": 2, + "column": 7 }, "end": { - "line": 13, - "column": 23 + "line": 2, + "column": 11 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2942,22 +1865,23 @@ "postfix": false, "binop": null }, - "start": 335, - "end": 336, + "value": "from", + "start": 41, + "end": 45, "loc": { "start": { - "line": 13, - "column": 24 + "line": 2, + "column": 12 }, "end": { - "line": 13, - "column": 25 + "line": 2, + "column": 16 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2965,50 +1889,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 338, - "end": 344, + "value": "../types/Node.js", + "start": 46, + "end": 64, "loc": { "start": { - "line": 14, - "column": 1 + "line": 2, + "column": 17 }, "end": { - "line": 14, - "column": 7 + "line": 2, + "column": 35 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 344, - "end": 345, + "start": 64, + "end": 65, "loc": { "start": { - "line": 14, - "column": 7 + "line": 2, + "column": 35 }, "end": { - "line": 14, - "column": 8 + "line": 2, + "column": 36 } } }, { "type": { - "label": "name", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3016,47 +1943,46 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 345, - "end": 349, + "value": "import", + "start": 66, + "end": 72, "loc": { "start": { - "line": 14, - "column": 8 + "line": 3, + "column": 0 }, "end": { - "line": 14, - "column": 12 + "line": 3, + "column": 6 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, - "updateContext": null + "binop": null }, - "value": "instanceof", - "start": 350, - "end": 360, + "value": "grandparent", + "start": 73, + "end": 84, "loc": { "start": { - "line": 14, - "column": 13 + "line": 3, + "column": 7 }, "end": { - "line": 14, - "column": 23 + "line": 3, + "column": 18 } } }, @@ -3072,42 +1998,44 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 361, - "end": 365, + "value": "from", + "start": 85, + "end": 89, "loc": { "start": { - "line": 14, - "column": 24 + "line": 3, + "column": 19 }, "end": { - "line": 14, - "column": 28 + "line": 3, + "column": 23 } } }, { "type": { - "label": ")", + "label": "string", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 365, - "end": 366, + "value": "./grandparent.js", + "start": 90, + "end": 108, "loc": { "start": { - "line": 14, - "column": 28 + "line": 3, + "column": 24 }, "end": { - "line": 14, - "column": 29 + "line": 3, + "column": 42 } } }, @@ -3124,16 +2052,32 @@ "binop": null, "updateContext": null }, - "start": 366, - "end": 367, + "start": 108, + "end": 109, "loc": { "start": { - "line": 14, - "column": 29 + "line": 3, + "column": 42 }, "end": { - "line": 14, - "column": 30 + "line": 3, + "column": 43 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n ", + "start": 111, + "end": 268, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 } } }, @@ -3152,16 +2096,16 @@ "updateContext": null }, "value": "const", - "start": 369, - "end": 374, + "start": 269, + "end": 274, "loc": { "start": { - "line": 15, - "column": 1 + "line": 12, + "column": 0 }, "end": { - "line": 15, - "column": 6 + "line": 12, + "column": 5 } } }, @@ -3177,17 +2121,17 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 375, - "end": 376, + "value": "uncle", + "start": 275, + "end": 280, "loc": { "start": { - "line": 15, - "column": 7 + "line": 12, + "column": 6 }, "end": { - "line": 15, - "column": 8 + "line": 12, + "column": 11 } } }, @@ -3205,23 +2149,23 @@ "updateContext": null }, "value": "=", - "start": 377, - "end": 378, + "start": 281, + "end": 282, "loc": { "start": { - "line": 15, - "column": 9 + "line": 12, + "column": 12 }, "end": { - "line": 15, - "column": 10 + "line": 12, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3230,24 +2174,23 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 379, - "end": 390, + "start": 283, + "end": 284, "loc": { "start": { - "line": 15, - "column": 11 + "line": 12, + "column": 14 }, "end": { - "line": 15, - "column": 22 + "line": 12, + "column": 15 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3256,24 +2199,25 @@ "postfix": false, "binop": null }, - "start": 390, - "end": 391, + "value": "node", + "start": 284, + "end": 288, "loc": { "start": { - "line": 15, - "column": 22 + "line": 12, + "column": 15 }, "end": { - "line": 15, - "column": 23 + "line": 12, + "column": 19 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3281,68 +2225,67 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 391, - "end": 395, + "start": 288, + "end": 289, "loc": { "start": { - "line": 15, - "column": 23 + "line": 12, + "column": 19 }, "end": { - "line": 15, - "column": 27 + "line": 12, + "column": 20 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "=>", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 395, - "end": 396, + "start": 290, + "end": 292, "loc": { "start": { - "line": 15, - "column": 27 + "line": 12, + "column": 21 }, "end": { - "line": 15, - "column": 28 + "line": 12, + "column": 23 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 396, - "end": 397, + "start": 293, + "end": 294, "loc": { "start": { - "line": 15, - "column": 28 + "line": 12, + "column": 24 }, "end": { - "line": 15, - "column": 29 + "line": 12, + "column": 25 } } }, @@ -3359,15 +2302,15 @@ "binop": null }, "value": "assert", - "start": 399, - "end": 405, + "start": 296, + "end": 302, "loc": { "start": { - "line": 16, + "line": 13, "column": 1 }, "end": { - "line": 16, + "line": 13, "column": 7 } } @@ -3384,15 +2327,15 @@ "postfix": false, "binop": null }, - "start": 405, - "end": 406, + "start": 302, + "end": 303, "loc": { "start": { - "line": 16, + "line": 13, "column": 7 }, "end": { - "line": 16, + "line": 13, "column": 8 } } @@ -3409,23 +2352,24 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 406, - "end": 407, + "value": "node", + "start": 303, + "end": 307, "loc": { "start": { - "line": 16, + "line": 13, "column": 8 }, "end": { - "line": 16, - "column": 9 + "line": 13, + "column": 12 } } }, { "type": { - "label": "==/!=", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3433,27 +2377,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": 7, "updateContext": null }, - "value": "!==", - "start": 408, - "end": 411, + "value": "instanceof", + "start": 308, + "end": 318, "loc": { "start": { - "line": 16, - "column": 10 + "line": 13, + "column": 13 }, "end": { - "line": 16, - "column": 13 + "line": 13, + "column": 23 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3461,20 +2404,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 412, - "end": 416, + "value": "Node", + "start": 319, + "end": 323, "loc": { "start": { - "line": 16, - "column": 14 + "line": 13, + "column": 24 }, "end": { - "line": 16, - "column": 18 + "line": 13, + "column": 28 } } }, @@ -3490,16 +2432,16 @@ "postfix": false, "binop": null }, - "start": 416, - "end": 417, + "start": 323, + "end": 324, "loc": { "start": { - "line": 16, - "column": 18 + "line": 13, + "column": 28 }, "end": { - "line": 16, - "column": 19 + "line": 13, + "column": 29 } } }, @@ -3516,16 +2458,16 @@ "binop": null, "updateContext": null }, - "start": 417, - "end": 418, + "start": 324, + "end": 325, "loc": { "start": { - "line": 16, - "column": 19 + "line": 13, + "column": 29 }, "end": { - "line": 16, - "column": 20 + "line": 13, + "column": 30 } } }, @@ -3544,15 +2486,15 @@ "updateContext": null }, "value": "const", - "start": 420, - "end": 425, + "start": 327, + "end": 332, "loc": { "start": { - "line": 17, + "line": 14, "column": 1 }, "end": { - "line": 17, + "line": 14, "column": 6 } } @@ -3569,16 +2511,16 @@ "postfix": false, "binop": null }, - "value": "u", - "start": 426, - "end": 427, + "value": "g", + "start": 333, + "end": 334, "loc": { "start": { - "line": 17, + "line": 14, "column": 7 }, "end": { - "line": 17, + "line": 14, "column": 8 } } @@ -3597,15 +2539,15 @@ "updateContext": null }, "value": "=", - "start": 428, - "end": 429, + "start": 335, + "end": 336, "loc": { "start": { - "line": 17, + "line": 14, "column": 9 }, "end": { - "line": 17, + "line": 14, "column": 10 } } @@ -3622,43 +2564,42 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 430, - "end": 434, + "value": "grandparent", + "start": 337, + "end": 348, "loc": { "start": { - "line": 17, + "line": 14, "column": 11 }, "end": { - "line": 17, - "column": 15 + "line": 14, + "column": 22 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 434, - "end": 435, + "start": 348, + "end": 349, "loc": { "start": { - "line": 17, - "column": 15 + "line": 14, + "column": 22 }, "end": { - "line": 17, - "column": 16 + "line": 14, + "column": 23 } } }, @@ -3674,52 +2615,25 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 435, - "end": 441, - "loc": { - "start": { - "line": 17, - "column": 16 - }, - "end": { - "line": 17, - "column": 22 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 442, - "end": 445, + "value": "node", + "start": 349, + "end": 353, "loc": { "start": { - "line": 17, + "line": 14, "column": 23 }, "end": { - "line": 17, - "column": 26 + "line": 14, + "column": 27 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3727,24 +2641,23 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 446, - "end": 447, + "start": 353, + "end": 354, "loc": { "start": { - "line": 17, + "line": 14, "column": 27 }, "end": { - "line": 17, + "line": 14, "column": 28 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3754,15 +2667,15 @@ "binop": null, "updateContext": null }, - "start": 447, - "end": 448, + "start": 354, + "end": 355, "loc": { "start": { - "line": 17, + "line": 14, "column": 28 }, "end": { - "line": 17, + "line": 14, "column": 29 } } @@ -3779,43 +2692,42 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 448, - "end": 452, + "value": "assert", + "start": 357, + "end": 363, "loc": { "start": { - "line": 17, - "column": 29 + "line": 15, + "column": 1 }, "end": { - "line": 17, - "column": 33 + "line": 15, + "column": 7 } } }, { "type": { - "label": "?", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 453, - "end": 454, + "start": 363, + "end": 364, "loc": { "start": { - "line": 17, - "column": 34 + "line": 15, + "column": 7 }, "end": { - "line": 17, - "column": 35 + "line": 15, + "column": 8 } } }, @@ -3832,48 +2744,50 @@ "binop": null }, "value": "g", - "start": 455, - "end": 456, + "start": 364, + "end": 365, "loc": { "start": { - "line": 17, - "column": 36 + "line": 15, + "column": 8 }, "end": { - "line": 17, - "column": 37 + "line": 15, + "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 456, - "end": 457, + "value": "!==", + "start": 366, + "end": 369, "loc": { "start": { - "line": 17, - "column": 37 + "line": 15, + "column": 10 }, "end": { - "line": 17, - "column": 38 + "line": 15, + "column": 13 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3881,78 +2795,79 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "right", - "start": 457, - "end": 462, + "value": "null", + "start": 370, + "end": 374, "loc": { "start": { - "line": 17, - "column": 38 + "line": 15, + "column": 14 }, "end": { - "line": 17, - "column": 43 + "line": 15, + "column": 18 } } }, { "type": { - "label": ":", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 463, - "end": 464, + "start": 374, + "end": 375, "loc": { "start": { - "line": 17, - "column": 44 + "line": 15, + "column": 18 }, "end": { - "line": 17, - "column": 45 + "line": 15, + "column": 19 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "g", - "start": 465, - "end": 466, + "start": 375, + "end": 376, "loc": { "start": { - "line": 17, - "column": 46 + "line": 15, + "column": 19 }, "end": { - "line": 17, - "column": 47 + "line": 15, + "column": 20 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "return", + "keyword": "return", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3962,16 +2877,17 @@ "binop": null, "updateContext": null }, - "start": 466, - "end": 467, + "value": "return", + "start": 378, + "end": 384, "loc": { "start": { - "line": 17, - "column": 47 + "line": 16, + "column": 1 }, "end": { - "line": 17, - "column": 48 + "line": 16, + "column": 7 } } }, @@ -3987,24 +2903,24 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 467, - "end": 471, + "value": "node", + "start": 385, + "end": 389, "loc": { "start": { - "line": 17, - "column": 48 + "line": 16, + "column": 8 }, "end": { - "line": 17, - "column": 52 + "line": 16, + "column": 12 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4014,16 +2930,16 @@ "binop": null, "updateContext": null }, - "start": 471, - "end": 472, + "start": 389, + "end": 390, "loc": { "start": { - "line": 17, - "column": 52 + "line": 16, + "column": 12 }, "end": { - "line": 17, - "column": 53 + "line": 16, + "column": 13 } } }, @@ -4039,42 +2955,44 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 474, - "end": 480, + "value": "parent", + "start": 390, + "end": 396, "loc": { "start": { - "line": 18, - "column": 1 + "line": 16, + "column": 13 }, "end": { - "line": 18, - "column": 7 + "line": 16, + "column": 19 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 480, - "end": 481, + "value": "===", + "start": 397, + "end": 400, "loc": { "start": { - "line": 18, - "column": 7 + "line": 16, + "column": 20 }, "end": { - "line": 18, - "column": 8 + "line": 16, + "column": 23 } } }, @@ -4090,45 +3008,43 @@ "postfix": false, "binop": null }, - "value": "u", - "start": 481, - "end": 482, + "value": "g", + "start": 401, + "end": 402, "loc": { "start": { - "line": 18, - "column": 8 + "line": 16, + "column": 24 }, "end": { - "line": 18, - "column": 9 + "line": 16, + "column": 25 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 483, - "end": 493, + "start": 402, + "end": 403, "loc": { "start": { - "line": 18, - "column": 10 + "line": 16, + "column": 25 }, "end": { - "line": 18, - "column": 20 + "line": 16, + "column": 26 } } }, @@ -4144,23 +3060,23 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 494, - "end": 498, + "value": "left", + "start": 403, + "end": 407, "loc": { "start": { - "line": 18, - "column": 21 + "line": 16, + "column": 26 }, "end": { - "line": 18, - "column": 25 + "line": 16, + "column": 30 } } }, { "type": { - "label": "||", + "label": "?", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4168,20 +3084,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 1, + "binop": null, "updateContext": null }, - "value": "||", - "start": 499, - "end": 501, + "start": 408, + "end": 409, "loc": { "start": { - "line": 18, - "column": 26 + "line": 16, + "column": 31 }, "end": { - "line": 18, - "column": 28 + "line": 16, + "column": 32 } } }, @@ -4197,45 +3112,43 @@ "postfix": false, "binop": null }, - "value": "u", - "start": 502, - "end": 503, + "value": "g", + "start": 410, + "end": 411, "loc": { "start": { - "line": 18, - "column": 29 + "line": 16, + "column": 33 }, "end": { - "line": 18, - "column": 30 + "line": 16, + "column": 34 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 504, - "end": 514, + "start": 411, + "end": 412, "loc": { "start": { - "line": 18, - "column": 31 + "line": 16, + "column": 34 }, "end": { - "line": 18, - "column": 41 + "line": 16, + "column": 35 } } }, @@ -4251,76 +3164,76 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 515, - "end": 519, + "value": "right", + "start": 412, + "end": 417, "loc": { "start": { - "line": 18, - "column": 42 + "line": 16, + "column": 35 }, "end": { - "line": 18, - "column": 46 + "line": 16, + "column": 40 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ":", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 519, - "end": 520, + "start": 418, + "end": 419, "loc": { "start": { - "line": 18, - "column": 46 + "line": 16, + "column": 41 }, "end": { - "line": 18, - "column": 47 + "line": 16, + "column": 42 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 520, - "end": 521, + "value": "g", + "start": 420, + "end": 421, "loc": { "start": { - "line": 18, - "column": 47 + "line": 16, + "column": 43 }, "end": { - "line": 18, - "column": 48 + "line": 16, + "column": 44 } } }, { "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4330,17 +3243,16 @@ "binop": null, "updateContext": null }, - "value": "return", - "start": 523, - "end": 529, + "start": 421, + "end": 422, "loc": { "start": { - "line": 19, - "column": 1 + "line": 16, + "column": 44 }, "end": { - "line": 19, - "column": 7 + "line": 16, + "column": 45 } } }, @@ -4356,17 +3268,17 @@ "postfix": false, "binop": null }, - "value": "u", - "start": 530, - "end": 531, + "value": "left", + "start": 422, + "end": 426, "loc": { "start": { - "line": 19, - "column": 8 + "line": 16, + "column": 45 }, "end": { - "line": 19, - "column": 9 + "line": 16, + "column": 49 } } }, @@ -4383,16 +3295,16 @@ "binop": null, "updateContext": null }, - "start": 531, - "end": 532, + "start": 426, + "end": 427, "loc": { "start": { - "line": 19, - "column": 9 + "line": 16, + "column": 49 }, "end": { - "line": 19, - "column": 10 + "line": 16, + "column": 50 } } }, @@ -4408,15 +3320,15 @@ "postfix": false, "binop": null }, - "start": 533, - "end": 534, + "start": 428, + "end": 429, "loc": { "start": { - "line": 20, + "line": 17, "column": 0 }, "end": { - "line": 20, + "line": 17, "column": 1 } } @@ -4434,15 +3346,15 @@ "binop": null, "updateContext": null }, - "start": 534, - "end": 535, + "start": 429, + "end": 430, "loc": { "start": { - "line": 20, + "line": 17, "column": 1 }, "end": { - "line": 20, + "line": 17, "column": 2 } } @@ -4462,15 +3374,15 @@ "updateContext": null }, "value": "export", - "start": 537, - "end": 543, + "start": 432, + "end": 438, "loc": { "start": { - "line": 22, + "line": 19, "column": 0 }, "end": { - "line": 22, + "line": 19, "column": 6 } } @@ -4490,15 +3402,15 @@ "updateContext": null }, "value": "default", - "start": 544, - "end": 551, + "start": 439, + "end": 446, "loc": { "start": { - "line": 22, + "line": 19, "column": 7 }, "end": { - "line": 22, + "line": 19, "column": 14 } } @@ -4516,15 +3428,15 @@ "binop": null }, "value": "uncle", - "start": 552, - "end": 557, + "start": 447, + "end": 452, "loc": { "start": { - "line": 22, + "line": 19, "column": 15 }, "end": { - "line": 22, + "line": 19, "column": 20 } } @@ -4542,15 +3454,15 @@ "binop": null, "updateContext": null }, - "start": 557, - "end": 558, + "start": 452, + "end": 453, "loc": { "start": { - "line": 22, + "line": 19, "column": 20 }, "end": { - "line": 22, + "line": 19, "column": 21 } } @@ -4568,15 +3480,15 @@ "binop": null, "updateContext": null }, - "start": 559, - "end": 559, + "start": 454, + "end": 454, "loc": { "start": { - "line": 23, + "line": 20, "column": 0 }, "end": { - "line": 23, + "line": 20, "column": 0 } } diff --git a/ast/source/index.js.json b/ast/source/index.js.json index 6b83814..80f8312 100644 --- a/ast/source/index.js.json +++ b/ast/source/index.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1934, + "end": 2013, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 32, + "line": 33, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1934, + "end": 2013, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 32, + "line": 33, "column": 0 } }, @@ -523,9 +523,9 @@ "line": 6, "column": 31 }, - "identifierName": "delete_case1" + "identifierName": "delete_case0" }, - "name": "delete_case1" + "name": "delete_case0" } } ], @@ -544,10 +544,10 @@ } }, "extra": { - "rawValue": "./deletion/delete_case1.js", - "raw": "'./deletion/delete_case1.js'" + "rawValue": "./deletion/delete_case0.js", + "raw": "'./deletion/delete_case0.js'" }, - "value": "./deletion/delete_case1.js" + "value": "./deletion/delete_case0.js" } }, { @@ -610,9 +610,9 @@ "line": 7, "column": 31 }, - "identifierName": "delete_case2" + "identifierName": "delete_case1" }, - "name": "delete_case2" + "name": "delete_case1" } } ], @@ -631,10 +631,10 @@ } }, "extra": { - "rawValue": "./deletion/delete_case2.js", - "raw": "'./deletion/delete_case2.js'" + "rawValue": "./deletion/delete_case1.js", + "raw": "'./deletion/delete_case1.js'" }, - "value": "./deletion/delete_case2.js" + "value": "./deletion/delete_case1.js" } }, { @@ -697,9 +697,9 @@ "line": 8, "column": 31 }, - "identifierName": "delete_case3" + "identifierName": "delete_case2" }, - "name": "delete_case3" + "name": "delete_case2" } } ], @@ -718,10 +718,10 @@ } }, "extra": { - "rawValue": "./deletion/delete_case3.js", - "raw": "'./deletion/delete_case3.js'" + "rawValue": "./deletion/delete_case2.js", + "raw": "'./deletion/delete_case2.js'" }, - "value": "./deletion/delete_case3.js" + "value": "./deletion/delete_case2.js" } }, { @@ -784,9 +784,9 @@ "line": 9, "column": 31 }, - "identifierName": "delete_case4" + "identifierName": "delete_case3" }, - "name": "delete_case4" + "name": "delete_case3" } } ], @@ -805,10 +805,10 @@ } }, "extra": { - "rawValue": "./deletion/delete_case4.js", - "raw": "'./deletion/delete_case4.js'" + "rawValue": "./deletion/delete_case3.js", + "raw": "'./deletion/delete_case3.js'" }, - "value": "./deletion/delete_case4.js" + "value": "./deletion/delete_case3.js" } }, { @@ -871,9 +871,9 @@ "line": 10, "column": 31 }, - "identifierName": "delete_case5" + "identifierName": "delete_case4" }, - "name": "delete_case5" + "name": "delete_case4" } } ], @@ -892,10 +892,10 @@ } }, "extra": { - "rawValue": "./deletion/delete_case5.js", - "raw": "'./deletion/delete_case5.js'" + "rawValue": "./deletion/delete_case4.js", + "raw": "'./deletion/delete_case4.js'" }, - "value": "./deletion/delete_case5.js" + "value": "./deletion/delete_case4.js" } }, { @@ -958,9 +958,9 @@ "line": 11, "column": 31 }, - "identifierName": "delete_case6" + "identifierName": "delete_case5" }, - "name": "delete_case6" + "name": "delete_case5" } } ], @@ -979,16 +979,16 @@ } }, "extra": { - "rawValue": "./deletion/delete_case6.js", - "raw": "'./deletion/delete_case6.js'" + "rawValue": "./deletion/delete_case5.js", + "raw": "'./deletion/delete_case5.js'" }, - "value": "./deletion/delete_case6.js" + "value": "./deletion/delete_case5.js" } }, { "type": "ExportNamedDeclaration", "start": 655, - "end": 730, + "end": 728, "loc": { "start": { "line": 12, @@ -996,7 +996,7 @@ }, "end": { "line": 12, - "column": 75 + "column": 73 } }, "declaration": null, @@ -1004,7 +1004,7 @@ { "type": "ExportSpecifier", "start": 663, - "end": 690, + "end": 689, "loc": { "start": { "line": 12, @@ -1012,7 +1012,7 @@ }, "end": { "line": 12, - "column": 35 + "column": 34 } }, "local": { @@ -1035,7 +1035,7 @@ "exported": { "type": "Identifier", "start": 674, - "end": 690, + "end": 689, "loc": { "start": { "line": 12, @@ -1043,39 +1043,39 @@ }, "end": { "line": 12, - "column": 35 + "column": 34 }, - "identifierName": "delete_one_child" + "identifierName": "delete_no_child" }, - "name": "delete_one_child" + "name": "delete_no_child" } } ], "source": { "type": "StringLiteral", - "start": 697, - "end": 729, + "start": 696, + "end": 727, "loc": { "start": { "line": 12, - "column": 42 + "column": 41 }, "end": { "line": 12, - "column": 74 + "column": 72 } }, "extra": { - "rawValue": "./deletion/delete_one_child.js", - "raw": "'./deletion/delete_one_child.js'" + "rawValue": "./deletion/delete_no_child.js", + "raw": "'./deletion/delete_no_child.js'" }, - "value": "./deletion/delete_one_child.js" + "value": "./deletion/delete_no_child.js" } }, { "type": "ExportNamedDeclaration", - "start": 731, - "end": 798, + "start": 729, + "end": 804, "loc": { "start": { "line": 13, @@ -1083,15 +1083,15 @@ }, "end": { "line": 13, - "column": 67 + "column": 75 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 739, - "end": 762, + "start": 737, + "end": 764, "loc": { "start": { "line": 13, @@ -1099,13 +1099,13 @@ }, "end": { "line": 13, - "column": 31 + "column": 35 } }, "local": { "type": "Identifier", - "start": 739, - "end": 746, + "start": 737, + "end": 744, "loc": { "start": { "line": 13, @@ -1121,8 +1121,8 @@ }, "exported": { "type": "Identifier", - "start": 750, - "end": 762, + "start": 748, + "end": 764, "loc": { "start": { "line": 13, @@ -1130,39 +1130,39 @@ }, "end": { "line": 13, - "column": 31 + "column": 35 }, - "identifierName": "replace_node" + "identifierName": "delete_one_child" }, - "name": "replace_node" + "name": "delete_one_child" } } ], "source": { "type": "StringLiteral", - "start": 769, - "end": 797, + "start": 771, + "end": 803, "loc": { "start": { "line": 13, - "column": 38 + "column": 42 }, "end": { "line": 13, - "column": 66 + "column": 74 } }, "extra": { - "rawValue": "./deletion/replace_node.js", - "raw": "'./deletion/replace_node.js'" + "rawValue": "./deletion/delete_one_child.js", + "raw": "'./deletion/delete_one_child.js'" }, - "value": "./deletion/replace_node.js" + "value": "./deletion/delete_one_child.js" } }, { "type": "ExportNamedDeclaration", - "start": 799, - "end": 862, + "start": 805, + "end": 858, "loc": { "start": { "line": 14, @@ -1170,14 +1170,14 @@ }, "end": { "line": 14, - "column": 63 + "column": 53 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 807, + "start": 813, "end": 829, "loc": { "start": { @@ -1186,13 +1186,13 @@ }, "end": { "line": 14, - "column": 30 + "column": 24 } }, "local": { "type": "Identifier", - "start": 807, - "end": 814, + "start": 813, + "end": 820, "loc": { "start": { "line": 14, @@ -1208,7 +1208,7 @@ }, "exported": { "type": "Identifier", - "start": 818, + "start": 824, "end": 829, "loc": { "start": { @@ -1217,38 +1217,38 @@ }, "end": { "line": 14, - "column": 30 + "column": 24 }, - "identifierName": "grandparent" + "identifierName": "prune" }, - "name": "grandparent" + "name": "prune" } } ], "source": { "type": "StringLiteral", "start": 836, - "end": 861, + "end": 857, "loc": { "start": { "line": 14, - "column": 37 + "column": 31 }, "end": { "line": 14, - "column": 62 + "column": 52 } }, "extra": { - "rawValue": "./family/grandparent.js", - "raw": "'./family/grandparent.js'" + "rawValue": "./deletion/prune.js", + "raw": "'./deletion/prune.js'" }, - "value": "./family/grandparent.js" + "value": "./deletion/prune.js" } }, { "type": "ExportNamedDeclaration", - "start": 863, + "start": 859, "end": 926, "loc": { "start": { @@ -1257,15 +1257,15 @@ }, "end": { "line": 15, - "column": 63 + "column": 67 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 871, - "end": 893, + "start": 867, + "end": 890, "loc": { "start": { "line": 15, @@ -1273,13 +1273,13 @@ }, "end": { "line": 15, - "column": 30 + "column": 31 } }, "local": { "type": "Identifier", - "start": 871, - "end": 878, + "start": 867, + "end": 874, "loc": { "start": { "line": 15, @@ -1295,8 +1295,8 @@ }, "exported": { "type": "Identifier", - "start": 882, - "end": 893, + "start": 878, + "end": 890, "loc": { "start": { "line": 15, @@ -1304,39 +1304,39 @@ }, "end": { "line": 15, - "column": 30 + "column": 31 }, - "identifierName": "predecessor" + "identifierName": "replace_node" }, - "name": "predecessor" + "name": "replace_node" } } ], "source": { "type": "StringLiteral", - "start": 900, + "start": 897, "end": 925, "loc": { "start": { "line": 15, - "column": 37 + "column": 38 }, "end": { "line": 15, - "column": 62 + "column": 66 } }, "extra": { - "rawValue": "./family/predecessor.js", - "raw": "'./family/predecessor.js'" + "rawValue": "./deletion/replace_node.js", + "raw": "'./deletion/replace_node.js'" }, - "value": "./family/predecessor.js" + "value": "./deletion/replace_node.js" } }, { "type": "ExportNamedDeclaration", "start": 927, - "end": 982, + "end": 990, "loc": { "start": { "line": 16, @@ -1344,7 +1344,7 @@ }, "end": { "line": 16, - "column": 55 + "column": 63 } }, "declaration": null, @@ -1352,7 +1352,7 @@ { "type": "ExportSpecifier", "start": 935, - "end": 953, + "end": 957, "loc": { "start": { "line": 16, @@ -1360,7 +1360,7 @@ }, "end": { "line": 16, - "column": 26 + "column": 30 } }, "local": { @@ -1383,7 +1383,7 @@ "exported": { "type": "Identifier", "start": 946, - "end": 953, + "end": 957, "loc": { "start": { "line": 16, @@ -1391,39 +1391,39 @@ }, "end": { "line": 16, - "column": 26 + "column": 30 }, - "identifierName": "sibling" + "identifierName": "grandparent" }, - "name": "sibling" + "name": "grandparent" } } ], "source": { "type": "StringLiteral", - "start": 960, - "end": 981, + "start": 964, + "end": 989, "loc": { "start": { "line": 16, - "column": 33 + "column": 37 }, "end": { "line": 16, - "column": 54 + "column": 62 } }, "extra": { - "rawValue": "./family/sibling.js", - "raw": "'./family/sibling.js'" + "rawValue": "./family/grandparent.js", + "raw": "'./family/grandparent.js'" }, - "value": "./family/sibling.js" + "value": "./family/grandparent.js" } }, { "type": "ExportNamedDeclaration", - "start": 983, - "end": 1034, + "start": 991, + "end": 1054, "loc": { "start": { "line": 17, @@ -1431,15 +1431,15 @@ }, "end": { "line": 17, - "column": 51 + "column": 63 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 991, - "end": 1007, + "start": 999, + "end": 1021, "loc": { "start": { "line": 17, @@ -1447,13 +1447,13 @@ }, "end": { "line": 17, - "column": 24 + "column": 30 } }, "local": { "type": "Identifier", - "start": 991, - "end": 998, + "start": 999, + "end": 1006, "loc": { "start": { "line": 17, @@ -1469,8 +1469,8 @@ }, "exported": { "type": "Identifier", - "start": 1002, - "end": 1007, + "start": 1010, + "end": 1021, "loc": { "start": { "line": 17, @@ -1478,39 +1478,39 @@ }, "end": { "line": 17, - "column": 24 + "column": 30 }, - "identifierName": "uncle" + "identifierName": "predecessor" }, - "name": "uncle" + "name": "predecessor" } } ], "source": { "type": "StringLiteral", - "start": 1014, - "end": 1033, + "start": 1028, + "end": 1053, "loc": { "start": { "line": 17, - "column": 31 + "column": 37 }, "end": { "line": 17, - "column": 50 + "column": 62 } }, "extra": { - "rawValue": "./family/uncle.js", - "raw": "'./family/uncle.js'" + "rawValue": "./family/predecessor.js", + "raw": "'./family/predecessor.js'" }, - "value": "./family/uncle.js" + "value": "./family/predecessor.js" } }, { "type": "ExportNamedDeclaration", - "start": 1035, - "end": 1091, + "start": 1055, + "end": 1110, "loc": { "start": { "line": 18, @@ -1518,15 +1518,15 @@ }, "end": { "line": 18, - "column": 56 + "column": 55 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1043, - "end": 1060, + "start": 1063, + "end": 1081, "loc": { "start": { "line": 18, @@ -1534,13 +1534,13 @@ }, "end": { "line": 18, - "column": 25 + "column": 26 } }, "local": { "type": "Identifier", - "start": 1043, - "end": 1050, + "start": 1063, + "end": 1070, "loc": { "start": { "line": 18, @@ -1556,8 +1556,8 @@ }, "exported": { "type": "Identifier", - "start": 1054, - "end": 1060, + "start": 1074, + "end": 1081, "loc": { "start": { "line": 18, @@ -1565,39 +1565,39 @@ }, "end": { "line": 18, - "column": 25 + "column": 26 }, - "identifierName": "insert" + "identifierName": "sibling" }, - "name": "insert" + "name": "sibling" } } ], "source": { "type": "StringLiteral", - "start": 1067, - "end": 1090, + "start": 1088, + "end": 1109, "loc": { "start": { "line": 18, - "column": 32 + "column": 33 }, "end": { "line": 18, - "column": 55 + "column": 54 } }, "extra": { - "rawValue": "./insertion/insert.js", - "raw": "'./insertion/insert.js'" + "rawValue": "./family/sibling.js", + "raw": "'./family/sibling.js'" }, - "value": "./insertion/insert.js" + "value": "./family/sibling.js" } }, { "type": "ExportNamedDeclaration", - "start": 1092, - "end": 1160, + "start": 1111, + "end": 1162, "loc": { "start": { "line": 19, @@ -1605,15 +1605,15 @@ }, "end": { "line": 19, - "column": 68 + "column": 51 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1100, - "end": 1123, + "start": 1119, + "end": 1135, "loc": { "start": { "line": 19, @@ -1621,13 +1621,13 @@ }, "end": { "line": 19, - "column": 31 + "column": 24 } }, "local": { "type": "Identifier", - "start": 1100, - "end": 1107, + "start": 1119, + "end": 1126, "loc": { "start": { "line": 19, @@ -1643,8 +1643,8 @@ }, "exported": { "type": "Identifier", - "start": 1111, - "end": 1123, + "start": 1130, + "end": 1135, "loc": { "start": { "line": 19, @@ -1652,39 +1652,39 @@ }, "end": { "line": 19, - "column": 31 + "column": 24 }, - "identifierName": "insert_case1" + "identifierName": "uncle" }, - "name": "insert_case1" + "name": "uncle" } } ], "source": { "type": "StringLiteral", - "start": 1130, - "end": 1159, + "start": 1142, + "end": 1161, "loc": { "start": { "line": 19, - "column": 38 + "column": 31 }, "end": { "line": 19, - "column": 67 + "column": 50 } }, "extra": { - "rawValue": "./insertion/insert_case1.js", - "raw": "'./insertion/insert_case1.js'" + "rawValue": "./family/uncle.js", + "raw": "'./family/uncle.js'" }, - "value": "./insertion/insert_case1.js" + "value": "./family/uncle.js" } }, { "type": "ExportNamedDeclaration", - "start": 1161, - "end": 1229, + "start": 1163, + "end": 1219, "loc": { "start": { "line": 20, @@ -1692,15 +1692,15 @@ }, "end": { "line": 20, - "column": 68 + "column": 56 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1169, - "end": 1192, + "start": 1171, + "end": 1188, "loc": { "start": { "line": 20, @@ -1708,13 +1708,13 @@ }, "end": { "line": 20, - "column": 31 + "column": 25 } }, "local": { "type": "Identifier", - "start": 1169, - "end": 1176, + "start": 1171, + "end": 1178, "loc": { "start": { "line": 20, @@ -1730,8 +1730,8 @@ }, "exported": { "type": "Identifier", - "start": 1180, - "end": 1192, + "start": 1182, + "end": 1188, "loc": { "start": { "line": 20, @@ -1739,39 +1739,39 @@ }, "end": { "line": 20, - "column": 31 + "column": 25 }, - "identifierName": "insert_case2" + "identifierName": "insert" }, - "name": "insert_case2" + "name": "insert" } } ], "source": { "type": "StringLiteral", - "start": 1199, - "end": 1228, + "start": 1195, + "end": 1218, "loc": { "start": { "line": 20, - "column": 38 + "column": 32 }, "end": { "line": 20, - "column": 67 + "column": 55 } }, "extra": { - "rawValue": "./insertion/insert_case2.js", - "raw": "'./insertion/insert_case2.js'" + "rawValue": "./insertion/insert.js", + "raw": "'./insertion/insert.js'" }, - "value": "./insertion/insert_case2.js" + "value": "./insertion/insert.js" } }, { "type": "ExportNamedDeclaration", - "start": 1230, - "end": 1298, + "start": 1220, + "end": 1288, "loc": { "start": { "line": 21, @@ -1786,8 +1786,8 @@ "specifiers": [ { "type": "ExportSpecifier", - "start": 1238, - "end": 1261, + "start": 1228, + "end": 1251, "loc": { "start": { "line": 21, @@ -1800,8 +1800,8 @@ }, "local": { "type": "Identifier", - "start": 1238, - "end": 1245, + "start": 1228, + "end": 1235, "loc": { "start": { "line": 21, @@ -1817,8 +1817,8 @@ }, "exported": { "type": "Identifier", - "start": 1249, - "end": 1261, + "start": 1239, + "end": 1251, "loc": { "start": { "line": 21, @@ -1828,16 +1828,16 @@ "line": 21, "column": 31 }, - "identifierName": "insert_case3" + "identifierName": "insert_case0" }, - "name": "insert_case3" + "name": "insert_case0" } } ], "source": { "type": "StringLiteral", - "start": 1268, - "end": 1297, + "start": 1258, + "end": 1287, "loc": { "start": { "line": 21, @@ -1849,16 +1849,16 @@ } }, "extra": { - "rawValue": "./insertion/insert_case3.js", - "raw": "'./insertion/insert_case3.js'" + "rawValue": "./insertion/insert_case0.js", + "raw": "'./insertion/insert_case0.js'" }, - "value": "./insertion/insert_case3.js" + "value": "./insertion/insert_case0.js" } }, { "type": "ExportNamedDeclaration", - "start": 1299, - "end": 1367, + "start": 1289, + "end": 1357, "loc": { "start": { "line": 22, @@ -1873,8 +1873,8 @@ "specifiers": [ { "type": "ExportSpecifier", - "start": 1307, - "end": 1330, + "start": 1297, + "end": 1320, "loc": { "start": { "line": 22, @@ -1887,8 +1887,8 @@ }, "local": { "type": "Identifier", - "start": 1307, - "end": 1314, + "start": 1297, + "end": 1304, "loc": { "start": { "line": 22, @@ -1904,8 +1904,8 @@ }, "exported": { "type": "Identifier", - "start": 1318, - "end": 1330, + "start": 1308, + "end": 1320, "loc": { "start": { "line": 22, @@ -1915,16 +1915,16 @@ "line": 22, "column": 31 }, - "identifierName": "insert_case4" + "identifierName": "insert_case1" }, - "name": "insert_case4" + "name": "insert_case1" } } ], "source": { "type": "StringLiteral", - "start": 1337, - "end": 1366, + "start": 1327, + "end": 1356, "loc": { "start": { "line": 22, @@ -1936,16 +1936,16 @@ } }, "extra": { - "rawValue": "./insertion/insert_case4.js", - "raw": "'./insertion/insert_case4.js'" + "rawValue": "./insertion/insert_case1.js", + "raw": "'./insertion/insert_case1.js'" }, - "value": "./insertion/insert_case4.js" + "value": "./insertion/insert_case1.js" } }, { "type": "ExportNamedDeclaration", - "start": 1368, - "end": 1436, + "start": 1358, + "end": 1426, "loc": { "start": { "line": 23, @@ -1960,8 +1960,8 @@ "specifiers": [ { "type": "ExportSpecifier", - "start": 1376, - "end": 1399, + "start": 1366, + "end": 1389, "loc": { "start": { "line": 23, @@ -1974,8 +1974,8 @@ }, "local": { "type": "Identifier", - "start": 1376, - "end": 1383, + "start": 1366, + "end": 1373, "loc": { "start": { "line": 23, @@ -1991,8 +1991,8 @@ }, "exported": { "type": "Identifier", - "start": 1387, - "end": 1399, + "start": 1377, + "end": 1389, "loc": { "start": { "line": 23, @@ -2002,16 +2002,16 @@ "line": 23, "column": 31 }, - "identifierName": "insert_case5" + "identifierName": "insert_case2" }, - "name": "insert_case5" + "name": "insert_case2" } } ], "source": { "type": "StringLiteral", - "start": 1406, - "end": 1435, + "start": 1396, + "end": 1425, "loc": { "start": { "line": 23, @@ -2023,16 +2023,16 @@ } }, "extra": { - "rawValue": "./insertion/insert_case5.js", - "raw": "'./insertion/insert_case5.js'" + "rawValue": "./insertion/insert_case2.js", + "raw": "'./insertion/insert_case2.js'" }, - "value": "./insertion/insert_case5.js" + "value": "./insertion/insert_case2.js" } }, { "type": "ExportNamedDeclaration", - "start": 1437, - "end": 1500, + "start": 1427, + "end": 1495, "loc": { "start": { "line": 24, @@ -2040,15 +2040,15 @@ }, "end": { "line": 24, - "column": 63 + "column": 68 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1445, - "end": 1467, + "start": 1435, + "end": 1458, "loc": { "start": { "line": 24, @@ -2056,13 +2056,13 @@ }, "end": { "line": 24, - "column": 30 + "column": 31 } }, "local": { "type": "Identifier", - "start": 1445, - "end": 1452, + "start": 1435, + "end": 1442, "loc": { "start": { "line": 24, @@ -2078,8 +2078,8 @@ }, "exported": { "type": "Identifier", - "start": 1456, - "end": 1467, + "start": 1446, + "end": 1458, "loc": { "start": { "line": 24, @@ -2087,39 +2087,39 @@ }, "end": { "line": 24, - "column": 30 + "column": 31 }, - "identifierName": "rotate_left" + "identifierName": "insert_case3" }, - "name": "rotate_left" + "name": "insert_case3" } } ], "source": { "type": "StringLiteral", - "start": 1474, - "end": 1499, + "start": 1465, + "end": 1494, "loc": { "start": { "line": 24, - "column": 37 + "column": 38 }, "end": { "line": 24, - "column": 62 + "column": 67 } }, "extra": { - "rawValue": "./rotate/rotate_left.js", - "raw": "'./rotate/rotate_left.js'" + "rawValue": "./insertion/insert_case3.js", + "raw": "'./insertion/insert_case3.js'" }, - "value": "./rotate/rotate_left.js" + "value": "./insertion/insert_case3.js" } }, { "type": "ExportNamedDeclaration", - "start": 1501, - "end": 1566, + "start": 1496, + "end": 1564, "loc": { "start": { "line": 25, @@ -2127,15 +2127,15 @@ }, "end": { "line": 25, - "column": 65 + "column": 68 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1509, - "end": 1532, + "start": 1504, + "end": 1527, "loc": { "start": { "line": 25, @@ -2148,8 +2148,8 @@ }, "local": { "type": "Identifier", - "start": 1509, - "end": 1516, + "start": 1504, + "end": 1511, "loc": { "start": { "line": 25, @@ -2165,8 +2165,8 @@ }, "exported": { "type": "Identifier", - "start": 1520, - "end": 1532, + "start": 1515, + "end": 1527, "loc": { "start": { "line": 25, @@ -2176,16 +2176,16 @@ "line": 25, "column": 31 }, - "identifierName": "rotate_right" + "identifierName": "insert_case4" }, - "name": "rotate_right" + "name": "insert_case4" } } ], "source": { "type": "StringLiteral", - "start": 1539, - "end": 1565, + "start": 1534, + "end": 1563, "loc": { "start": { "line": 25, @@ -2193,20 +2193,20 @@ }, "end": { "line": 25, - "column": 64 + "column": 67 } }, "extra": { - "rawValue": "./rotate/rotate_right.js", - "raw": "'./rotate/rotate_right.js'" + "rawValue": "./insertion/insert_case4.js", + "raw": "'./insertion/insert_case4.js'" }, - "value": "./rotate/rotate_right.js" + "value": "./insertion/insert_case4.js" } }, { "type": "ExportNamedDeclaration", - "start": 1567, - "end": 1620, + "start": 1565, + "end": 1628, "loc": { "start": { "line": 26, @@ -2214,15 +2214,15 @@ }, "end": { "line": 26, - "column": 53 + "column": 63 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1575, - "end": 1592, + "start": 1573, + "end": 1595, "loc": { "start": { "line": 26, @@ -2230,13 +2230,13 @@ }, "end": { "line": 26, - "column": 25 + "column": 30 } }, "local": { "type": "Identifier", - "start": 1575, - "end": 1582, + "start": 1573, + "end": 1580, "loc": { "start": { "line": 26, @@ -2252,8 +2252,8 @@ }, "exported": { "type": "Identifier", - "start": 1586, - "end": 1592, + "start": 1584, + "end": 1595, "loc": { "start": { "line": 26, @@ -2261,39 +2261,39 @@ }, "end": { "line": 26, - "column": 25 + "column": 30 }, - "identifierName": "search" + "identifierName": "rotate_left" }, - "name": "search" + "name": "rotate_left" } } ], "source": { "type": "StringLiteral", - "start": 1599, - "end": 1619, + "start": 1602, + "end": 1627, "loc": { "start": { "line": 26, - "column": 32 + "column": 37 }, "end": { "line": 26, - "column": 52 + "column": 62 } }, "extra": { - "rawValue": "./search/search.js", - "raw": "'./search/search.js'" + "rawValue": "./rotate/rotate_left.js", + "raw": "'./rotate/rotate_left.js'" }, - "value": "./search/search.js" + "value": "./rotate/rotate_left.js" } }, { "type": "ExportNamedDeclaration", - "start": 1621, - "end": 1697, + "start": 1629, + "end": 1694, "loc": { "start": { "line": 27, @@ -2301,15 +2301,15 @@ }, "end": { "line": 27, - "column": 76 + "column": 65 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1629, - "end": 1656, + "start": 1637, + "end": 1660, "loc": { "start": { "line": 27, @@ -2317,13 +2317,13 @@ }, "end": { "line": 27, - "column": 35 + "column": 31 } }, "local": { "type": "Identifier", - "start": 1629, - "end": 1636, + "start": 1637, + "end": 1644, "loc": { "start": { "line": 27, @@ -2339,8 +2339,8 @@ }, "exported": { "type": "Identifier", - "start": 1640, - "end": 1656, + "start": 1648, + "end": 1660, "loc": { "start": { "line": 27, @@ -2348,39 +2348,39 @@ }, "end": { "line": 27, - "column": 35 + "column": 31 }, - "identifierName": "inordertraversal" + "identifierName": "rotate_right" }, - "name": "inordertraversal" + "name": "rotate_right" } } ], "source": { "type": "StringLiteral", - "start": 1663, - "end": 1696, + "start": 1667, + "end": 1693, "loc": { "start": { "line": 27, - "column": 42 + "column": 38 }, "end": { "line": 27, - "column": 75 + "column": 64 } }, "extra": { - "rawValue": "./traversal/inordertraversal.js", - "raw": "'./traversal/inordertraversal.js'" + "rawValue": "./rotate/rotate_right.js", + "raw": "'./rotate/rotate_right.js'" }, - "value": "./traversal/inordertraversal.js" + "value": "./rotate/rotate_right.js" } }, { "type": "ExportNamedDeclaration", - "start": 1698, - "end": 1770, + "start": 1695, + "end": 1748, "loc": { "start": { "line": 28, @@ -2388,15 +2388,15 @@ }, "end": { "line": 28, - "column": 72 + "column": 53 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1706, - "end": 1731, + "start": 1703, + "end": 1720, "loc": { "start": { "line": 28, @@ -2404,13 +2404,13 @@ }, "end": { "line": 28, - "column": 33 + "column": 25 } }, "local": { "type": "Identifier", - "start": 1706, - "end": 1713, + "start": 1703, + "end": 1710, "loc": { "start": { "line": 28, @@ -2426,8 +2426,8 @@ }, "exported": { "type": "Identifier", - "start": 1717, - "end": 1731, + "start": 1714, + "end": 1720, "loc": { "start": { "line": 28, @@ -2435,39 +2435,39 @@ }, "end": { "line": 28, - "column": 33 + "column": 25 }, - "identifierName": "rangetraversal" + "identifierName": "search" }, - "name": "rangetraversal" + "name": "search" } } ], "source": { "type": "StringLiteral", - "start": 1738, - "end": 1769, + "start": 1727, + "end": 1747, "loc": { "start": { "line": 28, - "column": 40 + "column": 32 }, "end": { "line": 28, - "column": 71 + "column": 52 } }, "extra": { - "rawValue": "./traversal/rangetraversal.js", - "raw": "'./traversal/rangetraversal.js'" + "rawValue": "./search/search.js", + "raw": "'./search/search.js'" }, - "value": "./traversal/rangetraversal.js" + "value": "./search/search.js" } }, { "type": "ExportNamedDeclaration", - "start": 1771, - "end": 1819, + "start": 1749, + "end": 1825, "loc": { "start": { "line": 29, @@ -2475,15 +2475,15 @@ }, "end": { "line": 29, - "column": 48 + "column": 76 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1779, - "end": 1794, + "start": 1757, + "end": 1784, "loc": { "start": { "line": 29, @@ -2491,13 +2491,13 @@ }, "end": { "line": 29, - "column": 23 + "column": 35 } }, "local": { "type": "Identifier", - "start": 1779, - "end": 1786, + "start": 1757, + "end": 1764, "loc": { "start": { "line": 29, @@ -2513,8 +2513,8 @@ }, "exported": { "type": "Identifier", - "start": 1790, - "end": 1794, + "start": 1768, + "end": 1784, "loc": { "start": { "line": 29, @@ -2522,39 +2522,39 @@ }, "end": { "line": 29, - "column": 23 + "column": 35 }, - "identifierName": "Leaf" + "identifierName": "inordertraversal" }, - "name": "Leaf" + "name": "inordertraversal" } } ], "source": { "type": "StringLiteral", - "start": 1801, - "end": 1818, + "start": 1791, + "end": 1824, "loc": { "start": { "line": 29, - "column": 30 + "column": 42 }, "end": { "line": 29, - "column": 47 + "column": 75 } }, "extra": { - "rawValue": "./types/Leaf.js", - "raw": "'./types/Leaf.js'" + "rawValue": "./traversal/inordertraversal.js", + "raw": "'./traversal/inordertraversal.js'" }, - "value": "./types/Leaf.js" + "value": "./traversal/inordertraversal.js" } }, { "type": "ExportNamedDeclaration", - "start": 1820, - "end": 1868, + "start": 1826, + "end": 1898, "loc": { "start": { "line": 30, @@ -2562,15 +2562,15 @@ }, "end": { "line": 30, - "column": 48 + "column": 72 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1828, - "end": 1843, + "start": 1834, + "end": 1859, "loc": { "start": { "line": 30, @@ -2578,13 +2578,13 @@ }, "end": { "line": 30, - "column": 23 + "column": 33 } }, "local": { "type": "Identifier", - "start": 1828, - "end": 1835, + "start": 1834, + "end": 1841, "loc": { "start": { "line": 30, @@ -2600,8 +2600,8 @@ }, "exported": { "type": "Identifier", - "start": 1839, - "end": 1843, + "start": 1845, + "end": 1859, "loc": { "start": { "line": 30, @@ -2609,39 +2609,39 @@ }, "end": { "line": 30, - "column": 23 + "column": 33 }, - "identifierName": "Node" + "identifierName": "rangetraversal" }, - "name": "Node" + "name": "rangetraversal" } } ], "source": { "type": "StringLiteral", - "start": 1850, - "end": 1867, + "start": 1866, + "end": 1897, "loc": { "start": { "line": 30, - "column": 30 + "column": 40 }, "end": { "line": 30, - "column": 47 + "column": 71 } }, "extra": { - "rawValue": "./types/Node.js", - "raw": "'./types/Node.js'" + "rawValue": "./traversal/rangetraversal.js", + "raw": "'./traversal/rangetraversal.js'" }, - "value": "./types/Node.js" + "value": "./traversal/rangetraversal.js" } }, { "type": "ExportNamedDeclaration", - "start": 1869, - "end": 1933, + "start": 1899, + "end": 1947, "loc": { "start": { "line": 31, @@ -2649,15 +2649,15 @@ }, "end": { "line": 31, - "column": 64 + "column": 48 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1877, - "end": 1900, + "start": 1907, + "end": 1922, "loc": { "start": { "line": 31, @@ -2665,13 +2665,13 @@ }, "end": { "line": 31, - "column": 31 + "column": 23 } }, "local": { "type": "Identifier", - "start": 1877, - "end": 1884, + "start": 1907, + "end": 1914, "loc": { "start": { "line": 31, @@ -2687,8 +2687,8 @@ }, "exported": { "type": "Identifier", - "start": 1888, - "end": 1900, + "start": 1918, + "end": 1922, "loc": { "start": { "line": 31, @@ -2696,6 +2696,93 @@ }, "end": { "line": 31, + "column": 23 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 1929, + "end": 1946, + "loc": { + "start": { + "line": 31, + "column": 30 + }, + "end": { + "line": 31, + "column": 47 + } + }, + "extra": { + "rawValue": "./types/Node.js", + "raw": "'./types/Node.js'" + }, + "value": "./types/Node.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 1948, + "end": 2012, + "loc": { + "start": { + "line": 32, + "column": 0 + }, + "end": { + "line": 32, + "column": 64 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 1956, + "end": 1979, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 1956, + "end": 1963, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 1967, + "end": 1979, + "loc": { + "start": { + "line": 32, + "column": 19 + }, + "end": { + "line": 32, "column": 31 }, "identifierName": "RedBlackTree" @@ -2706,15 +2793,15 @@ ], "source": { "type": "StringLiteral", - "start": 1907, - "end": 1932, + "start": 1986, + "end": 2011, "loc": { "start": { - "line": 31, + "line": 32, "column": 38 }, "end": { - "line": 31, + "line": 32, "column": 63 } }, @@ -4034,7 +4121,7 @@ "postfix": false, "binop": null }, - "value": "delete_case1", + "value": "delete_case0", "start": 266, "end": 278, "loc": { @@ -4112,7 +4199,7 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case1.js", + "value": "./deletion/delete_case0.js", "start": 285, "end": 313, "loc": { @@ -4271,7 +4358,7 @@ "postfix": false, "binop": null }, - "value": "delete_case2", + "value": "delete_case1", "start": 334, "end": 346, "loc": { @@ -4349,7 +4436,7 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case2.js", + "value": "./deletion/delete_case1.js", "start": 353, "end": 381, "loc": { @@ -4508,7 +4595,7 @@ "postfix": false, "binop": null }, - "value": "delete_case3", + "value": "delete_case2", "start": 402, "end": 414, "loc": { @@ -4586,7 +4673,7 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case3.js", + "value": "./deletion/delete_case2.js", "start": 421, "end": 449, "loc": { @@ -4745,7 +4832,7 @@ "postfix": false, "binop": null }, - "value": "delete_case4", + "value": "delete_case3", "start": 470, "end": 482, "loc": { @@ -4823,7 +4910,7 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case4.js", + "value": "./deletion/delete_case3.js", "start": 489, "end": 517, "loc": { @@ -4982,7 +5069,7 @@ "postfix": false, "binop": null }, - "value": "delete_case5", + "value": "delete_case4", "start": 538, "end": 550, "loc": { @@ -5060,7 +5147,7 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case5.js", + "value": "./deletion/delete_case4.js", "start": 557, "end": 585, "loc": { @@ -5219,7 +5306,7 @@ "postfix": false, "binop": null }, - "value": "delete_case6", + "value": "delete_case5", "start": 606, "end": 618, "loc": { @@ -5297,7 +5384,7 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case6.js", + "value": "./deletion/delete_case5.js", "start": 625, "end": 653, "loc": { @@ -5456,9 +5543,9 @@ "postfix": false, "binop": null }, - "value": "delete_one_child", + "value": "delete_no_child", "start": 674, - "end": 690, + "end": 689, "loc": { "start": { "line": 12, @@ -5466,7 +5553,7 @@ }, "end": { "line": 12, - "column": 35 + "column": 34 } } }, @@ -5482,16 +5569,16 @@ "postfix": false, "binop": null }, - "start": 690, - "end": 691, + "start": 689, + "end": 690, "loc": { "start": { "line": 12, - "column": 35 + "column": 34 }, "end": { "line": 12, - "column": 36 + "column": 35 } } }, @@ -5508,16 +5595,16 @@ "binop": null }, "value": "from", - "start": 692, - "end": 696, + "start": 691, + "end": 695, "loc": { "start": { "line": 12, - "column": 37 + "column": 36 }, "end": { "line": 12, - "column": 41 + "column": 40 } } }, @@ -5534,17 +5621,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_one_child.js", - "start": 697, - "end": 729, + "value": "./deletion/delete_no_child.js", + "start": 696, + "end": 727, "loc": { "start": { "line": 12, - "column": 42 + "column": 41 }, "end": { "line": 12, - "column": 74 + "column": 72 } } }, @@ -5561,16 +5648,16 @@ "binop": null, "updateContext": null }, - "start": 729, - "end": 730, + "start": 727, + "end": 728, "loc": { "start": { "line": 12, - "column": 74 + "column": 72 }, "end": { "line": 12, - "column": 75 + "column": 73 } } }, @@ -5589,8 +5676,8 @@ "updateContext": null }, "value": "export", - "start": 731, - "end": 737, + "start": 729, + "end": 735, "loc": { "start": { "line": 13, @@ -5614,8 +5701,8 @@ "postfix": false, "binop": null }, - "start": 738, - "end": 739, + "start": 736, + "end": 737, "loc": { "start": { "line": 13, @@ -5642,8 +5729,8 @@ "updateContext": null }, "value": "default", - "start": 739, - "end": 746, + "start": 737, + "end": 744, "loc": { "start": { "line": 13, @@ -5668,8 +5755,8 @@ "binop": null }, "value": "as", - "start": 747, - "end": 749, + "start": 745, + "end": 747, "loc": { "start": { "line": 13, @@ -5693,9 +5780,9 @@ "postfix": false, "binop": null }, - "value": "replace_node", - "start": 750, - "end": 762, + "value": "delete_one_child", + "start": 748, + "end": 764, "loc": { "start": { "line": 13, @@ -5703,7 +5790,7 @@ }, "end": { "line": 13, - "column": 31 + "column": 35 } } }, @@ -5719,16 +5806,16 @@ "postfix": false, "binop": null }, - "start": 762, - "end": 763, + "start": 764, + "end": 765, "loc": { "start": { "line": 13, - "column": 31 + "column": 35 }, "end": { "line": 13, - "column": 32 + "column": 36 } } }, @@ -5745,16 +5832,16 @@ "binop": null }, "value": "from", - "start": 764, - "end": 768, + "start": 766, + "end": 770, "loc": { "start": { "line": 13, - "column": 33 + "column": 37 }, "end": { "line": 13, - "column": 37 + "column": 41 } } }, @@ -5771,17 +5858,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/replace_node.js", - "start": 769, - "end": 797, + "value": "./deletion/delete_one_child.js", + "start": 771, + "end": 803, "loc": { "start": { "line": 13, - "column": 38 + "column": 42 }, "end": { "line": 13, - "column": 66 + "column": 74 } } }, @@ -5798,16 +5885,16 @@ "binop": null, "updateContext": null }, - "start": 797, - "end": 798, + "start": 803, + "end": 804, "loc": { "start": { "line": 13, - "column": 66 + "column": 74 }, "end": { "line": 13, - "column": 67 + "column": 75 } } }, @@ -5826,8 +5913,8 @@ "updateContext": null }, "value": "export", - "start": 799, - "end": 805, + "start": 805, + "end": 811, "loc": { "start": { "line": 14, @@ -5851,8 +5938,8 @@ "postfix": false, "binop": null }, - "start": 806, - "end": 807, + "start": 812, + "end": 813, "loc": { "start": { "line": 14, @@ -5879,8 +5966,8 @@ "updateContext": null }, "value": "default", - "start": 807, - "end": 814, + "start": 813, + "end": 820, "loc": { "start": { "line": 14, @@ -5905,8 +5992,8 @@ "binop": null }, "value": "as", - "start": 815, - "end": 817, + "start": 821, + "end": 823, "loc": { "start": { "line": 14, @@ -5930,8 +6017,8 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 818, + "value": "prune", + "start": 824, "end": 829, "loc": { "start": { @@ -5940,7 +6027,7 @@ }, "end": { "line": 14, - "column": 30 + "column": 24 } } }, @@ -5961,11 +6048,11 @@ "loc": { "start": { "line": 14, - "column": 30 + "column": 24 }, "end": { "line": 14, - "column": 31 + "column": 25 } } }, @@ -5987,11 +6074,11 @@ "loc": { "start": { "line": 14, - "column": 32 + "column": 26 }, "end": { "line": 14, - "column": 36 + "column": 30 } } }, @@ -6008,17 +6095,17 @@ "binop": null, "updateContext": null }, - "value": "./family/grandparent.js", + "value": "./deletion/prune.js", "start": 836, - "end": 861, + "end": 857, "loc": { "start": { "line": 14, - "column": 37 + "column": 31 }, "end": { "line": 14, - "column": 62 + "column": 52 } } }, @@ -6035,16 +6122,16 @@ "binop": null, "updateContext": null }, - "start": 861, - "end": 862, + "start": 857, + "end": 858, "loc": { "start": { "line": 14, - "column": 62 + "column": 52 }, "end": { "line": 14, - "column": 63 + "column": 53 } } }, @@ -6063,8 +6150,8 @@ "updateContext": null }, "value": "export", - "start": 863, - "end": 869, + "start": 859, + "end": 865, "loc": { "start": { "line": 15, @@ -6088,8 +6175,8 @@ "postfix": false, "binop": null }, - "start": 870, - "end": 871, + "start": 866, + "end": 867, "loc": { "start": { "line": 15, @@ -6116,8 +6203,8 @@ "updateContext": null }, "value": "default", - "start": 871, - "end": 878, + "start": 867, + "end": 874, "loc": { "start": { "line": 15, @@ -6142,8 +6229,8 @@ "binop": null }, "value": "as", - "start": 879, - "end": 881, + "start": 875, + "end": 877, "loc": { "start": { "line": 15, @@ -6167,9 +6254,9 @@ "postfix": false, "binop": null }, - "value": "predecessor", - "start": 882, - "end": 893, + "value": "replace_node", + "start": 878, + "end": 890, "loc": { "start": { "line": 15, @@ -6177,7 +6264,7 @@ }, "end": { "line": 15, - "column": 30 + "column": 31 } } }, @@ -6193,16 +6280,16 @@ "postfix": false, "binop": null }, - "start": 893, - "end": 894, + "start": 890, + "end": 891, "loc": { "start": { "line": 15, - "column": 30 + "column": 31 }, "end": { "line": 15, - "column": 31 + "column": 32 } } }, @@ -6219,16 +6306,16 @@ "binop": null }, "value": "from", - "start": 895, - "end": 899, + "start": 892, + "end": 896, "loc": { "start": { "line": 15, - "column": 32 + "column": 33 }, "end": { "line": 15, - "column": 36 + "column": 37 } } }, @@ -6245,17 +6332,17 @@ "binop": null, "updateContext": null }, - "value": "./family/predecessor.js", - "start": 900, + "value": "./deletion/replace_node.js", + "start": 897, "end": 925, "loc": { "start": { "line": 15, - "column": 37 + "column": 38 }, "end": { "line": 15, - "column": 62 + "column": 66 } } }, @@ -6277,11 +6364,11 @@ "loc": { "start": { "line": 15, - "column": 62 + "column": 66 }, "end": { "line": 15, - "column": 63 + "column": 67 } } }, @@ -6404,9 +6491,9 @@ "postfix": false, "binop": null }, - "value": "sibling", + "value": "grandparent", "start": 946, - "end": 953, + "end": 957, "loc": { "start": { "line": 16, @@ -6414,7 +6501,7 @@ }, "end": { "line": 16, - "column": 26 + "column": 30 } } }, @@ -6430,16 +6517,16 @@ "postfix": false, "binop": null }, - "start": 953, - "end": 954, + "start": 957, + "end": 958, "loc": { "start": { "line": 16, - "column": 26 + "column": 30 }, "end": { "line": 16, - "column": 27 + "column": 31 } } }, @@ -6456,16 +6543,16 @@ "binop": null }, "value": "from", - "start": 955, - "end": 959, + "start": 959, + "end": 963, "loc": { "start": { "line": 16, - "column": 28 + "column": 32 }, "end": { "line": 16, - "column": 32 + "column": 36 } } }, @@ -6482,17 +6569,17 @@ "binop": null, "updateContext": null }, - "value": "./family/sibling.js", - "start": 960, - "end": 981, + "value": "./family/grandparent.js", + "start": 964, + "end": 989, "loc": { "start": { "line": 16, - "column": 33 + "column": 37 }, "end": { "line": 16, - "column": 54 + "column": 62 } } }, @@ -6509,16 +6596,16 @@ "binop": null, "updateContext": null }, - "start": 981, - "end": 982, + "start": 989, + "end": 990, "loc": { "start": { "line": 16, - "column": 54 + "column": 62 }, "end": { "line": 16, - "column": 55 + "column": 63 } } }, @@ -6537,8 +6624,8 @@ "updateContext": null }, "value": "export", - "start": 983, - "end": 989, + "start": 991, + "end": 997, "loc": { "start": { "line": 17, @@ -6562,8 +6649,8 @@ "postfix": false, "binop": null }, - "start": 990, - "end": 991, + "start": 998, + "end": 999, "loc": { "start": { "line": 17, @@ -6590,8 +6677,8 @@ "updateContext": null }, "value": "default", - "start": 991, - "end": 998, + "start": 999, + "end": 1006, "loc": { "start": { "line": 17, @@ -6616,8 +6703,8 @@ "binop": null }, "value": "as", - "start": 999, - "end": 1001, + "start": 1007, + "end": 1009, "loc": { "start": { "line": 17, @@ -6641,9 +6728,9 @@ "postfix": false, "binop": null }, - "value": "uncle", - "start": 1002, - "end": 1007, + "value": "predecessor", + "start": 1010, + "end": 1021, "loc": { "start": { "line": 17, @@ -6651,7 +6738,7 @@ }, "end": { "line": 17, - "column": 24 + "column": 30 } } }, @@ -6667,16 +6754,16 @@ "postfix": false, "binop": null }, - "start": 1007, - "end": 1008, + "start": 1021, + "end": 1022, "loc": { "start": { "line": 17, - "column": 24 + "column": 30 }, "end": { "line": 17, - "column": 25 + "column": 31 } } }, @@ -6693,16 +6780,16 @@ "binop": null }, "value": "from", - "start": 1009, - "end": 1013, + "start": 1023, + "end": 1027, "loc": { "start": { "line": 17, - "column": 26 + "column": 32 }, "end": { "line": 17, - "column": 30 + "column": 36 } } }, @@ -6719,17 +6806,17 @@ "binop": null, "updateContext": null }, - "value": "./family/uncle.js", - "start": 1014, - "end": 1033, + "value": "./family/predecessor.js", + "start": 1028, + "end": 1053, "loc": { "start": { "line": 17, - "column": 31 + "column": 37 }, "end": { "line": 17, - "column": 50 + "column": 62 } } }, @@ -6746,16 +6833,16 @@ "binop": null, "updateContext": null }, - "start": 1033, - "end": 1034, + "start": 1053, + "end": 1054, "loc": { "start": { "line": 17, - "column": 50 + "column": 62 }, "end": { "line": 17, - "column": 51 + "column": 63 } } }, @@ -6774,8 +6861,8 @@ "updateContext": null }, "value": "export", - "start": 1035, - "end": 1041, + "start": 1055, + "end": 1061, "loc": { "start": { "line": 18, @@ -6799,8 +6886,8 @@ "postfix": false, "binop": null }, - "start": 1042, - "end": 1043, + "start": 1062, + "end": 1063, "loc": { "start": { "line": 18, @@ -6827,8 +6914,8 @@ "updateContext": null }, "value": "default", - "start": 1043, - "end": 1050, + "start": 1063, + "end": 1070, "loc": { "start": { "line": 18, @@ -6853,8 +6940,8 @@ "binop": null }, "value": "as", - "start": 1051, - "end": 1053, + "start": 1071, + "end": 1073, "loc": { "start": { "line": 18, @@ -6878,9 +6965,9 @@ "postfix": false, "binop": null }, - "value": "insert", - "start": 1054, - "end": 1060, + "value": "sibling", + "start": 1074, + "end": 1081, "loc": { "start": { "line": 18, @@ -6888,7 +6975,7 @@ }, "end": { "line": 18, - "column": 25 + "column": 26 } } }, @@ -6904,16 +6991,16 @@ "postfix": false, "binop": null }, - "start": 1060, - "end": 1061, + "start": 1081, + "end": 1082, "loc": { "start": { "line": 18, - "column": 25 + "column": 26 }, "end": { "line": 18, - "column": 26 + "column": 27 } } }, @@ -6930,16 +7017,16 @@ "binop": null }, "value": "from", - "start": 1062, - "end": 1066, + "start": 1083, + "end": 1087, "loc": { "start": { "line": 18, - "column": 27 + "column": 28 }, "end": { "line": 18, - "column": 31 + "column": 32 } } }, @@ -6956,17 +7043,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert.js", - "start": 1067, - "end": 1090, + "value": "./family/sibling.js", + "start": 1088, + "end": 1109, "loc": { "start": { "line": 18, - "column": 32 + "column": 33 }, "end": { "line": 18, - "column": 55 + "column": 54 } } }, @@ -6983,16 +7070,16 @@ "binop": null, "updateContext": null }, - "start": 1090, - "end": 1091, + "start": 1109, + "end": 1110, "loc": { "start": { "line": 18, - "column": 55 + "column": 54 }, "end": { "line": 18, - "column": 56 + "column": 55 } } }, @@ -7011,8 +7098,8 @@ "updateContext": null }, "value": "export", - "start": 1092, - "end": 1098, + "start": 1111, + "end": 1117, "loc": { "start": { "line": 19, @@ -7036,8 +7123,8 @@ "postfix": false, "binop": null }, - "start": 1099, - "end": 1100, + "start": 1118, + "end": 1119, "loc": { "start": { "line": 19, @@ -7064,8 +7151,8 @@ "updateContext": null }, "value": "default", - "start": 1100, - "end": 1107, + "start": 1119, + "end": 1126, "loc": { "start": { "line": 19, @@ -7090,8 +7177,8 @@ "binop": null }, "value": "as", - "start": 1108, - "end": 1110, + "start": 1127, + "end": 1129, "loc": { "start": { "line": 19, @@ -7115,9 +7202,9 @@ "postfix": false, "binop": null }, - "value": "insert_case1", - "start": 1111, - "end": 1123, + "value": "uncle", + "start": 1130, + "end": 1135, "loc": { "start": { "line": 19, @@ -7125,7 +7212,7 @@ }, "end": { "line": 19, - "column": 31 + "column": 24 } } }, @@ -7141,16 +7228,16 @@ "postfix": false, "binop": null }, - "start": 1123, - "end": 1124, + "start": 1135, + "end": 1136, "loc": { "start": { "line": 19, - "column": 31 + "column": 24 }, "end": { "line": 19, - "column": 32 + "column": 25 } } }, @@ -7167,16 +7254,16 @@ "binop": null }, "value": "from", - "start": 1125, - "end": 1129, + "start": 1137, + "end": 1141, "loc": { "start": { "line": 19, - "column": 33 + "column": 26 }, "end": { "line": 19, - "column": 37 + "column": 30 } } }, @@ -7193,17 +7280,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case1.js", - "start": 1130, - "end": 1159, + "value": "./family/uncle.js", + "start": 1142, + "end": 1161, "loc": { "start": { "line": 19, - "column": 38 + "column": 31 }, "end": { "line": 19, - "column": 67 + "column": 50 } } }, @@ -7220,16 +7307,16 @@ "binop": null, "updateContext": null }, - "start": 1159, - "end": 1160, + "start": 1161, + "end": 1162, "loc": { "start": { "line": 19, - "column": 67 + "column": 50 }, "end": { "line": 19, - "column": 68 + "column": 51 } } }, @@ -7248,8 +7335,8 @@ "updateContext": null }, "value": "export", - "start": 1161, - "end": 1167, + "start": 1163, + "end": 1169, "loc": { "start": { "line": 20, @@ -7273,8 +7360,8 @@ "postfix": false, "binop": null }, - "start": 1168, - "end": 1169, + "start": 1170, + "end": 1171, "loc": { "start": { "line": 20, @@ -7301,8 +7388,8 @@ "updateContext": null }, "value": "default", - "start": 1169, - "end": 1176, + "start": 1171, + "end": 1178, "loc": { "start": { "line": 20, @@ -7327,8 +7414,8 @@ "binop": null }, "value": "as", - "start": 1177, - "end": 1179, + "start": 1179, + "end": 1181, "loc": { "start": { "line": 20, @@ -7352,9 +7439,9 @@ "postfix": false, "binop": null }, - "value": "insert_case2", - "start": 1180, - "end": 1192, + "value": "insert", + "start": 1182, + "end": 1188, "loc": { "start": { "line": 20, @@ -7362,7 +7449,7 @@ }, "end": { "line": 20, - "column": 31 + "column": 25 } } }, @@ -7378,16 +7465,16 @@ "postfix": false, "binop": null }, - "start": 1192, - "end": 1193, + "start": 1188, + "end": 1189, "loc": { "start": { "line": 20, - "column": 31 + "column": 25 }, "end": { "line": 20, - "column": 32 + "column": 26 } } }, @@ -7404,16 +7491,16 @@ "binop": null }, "value": "from", - "start": 1194, - "end": 1198, + "start": 1190, + "end": 1194, "loc": { "start": { "line": 20, - "column": 33 + "column": 27 }, "end": { "line": 20, - "column": 37 + "column": 31 } } }, @@ -7430,17 +7517,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case2.js", - "start": 1199, - "end": 1228, + "value": "./insertion/insert.js", + "start": 1195, + "end": 1218, "loc": { "start": { "line": 20, - "column": 38 + "column": 32 }, "end": { "line": 20, - "column": 67 + "column": 55 } } }, @@ -7457,16 +7544,16 @@ "binop": null, "updateContext": null }, - "start": 1228, - "end": 1229, + "start": 1218, + "end": 1219, "loc": { "start": { "line": 20, - "column": 67 + "column": 55 }, "end": { "line": 20, - "column": 68 + "column": 56 } } }, @@ -7485,8 +7572,8 @@ "updateContext": null }, "value": "export", - "start": 1230, - "end": 1236, + "start": 1220, + "end": 1226, "loc": { "start": { "line": 21, @@ -7510,8 +7597,8 @@ "postfix": false, "binop": null }, - "start": 1237, - "end": 1238, + "start": 1227, + "end": 1228, "loc": { "start": { "line": 21, @@ -7538,8 +7625,8 @@ "updateContext": null }, "value": "default", - "start": 1238, - "end": 1245, + "start": 1228, + "end": 1235, "loc": { "start": { "line": 21, @@ -7564,8 +7651,8 @@ "binop": null }, "value": "as", - "start": 1246, - "end": 1248, + "start": 1236, + "end": 1238, "loc": { "start": { "line": 21, @@ -7589,9 +7676,9 @@ "postfix": false, "binop": null }, - "value": "insert_case3", - "start": 1249, - "end": 1261, + "value": "insert_case0", + "start": 1239, + "end": 1251, "loc": { "start": { "line": 21, @@ -7615,8 +7702,8 @@ "postfix": false, "binop": null }, - "start": 1261, - "end": 1262, + "start": 1251, + "end": 1252, "loc": { "start": { "line": 21, @@ -7641,8 +7728,8 @@ "binop": null }, "value": "from", - "start": 1263, - "end": 1267, + "start": 1253, + "end": 1257, "loc": { "start": { "line": 21, @@ -7667,9 +7754,9 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case3.js", - "start": 1268, - "end": 1297, + "value": "./insertion/insert_case0.js", + "start": 1258, + "end": 1287, "loc": { "start": { "line": 21, @@ -7694,8 +7781,8 @@ "binop": null, "updateContext": null }, - "start": 1297, - "end": 1298, + "start": 1287, + "end": 1288, "loc": { "start": { "line": 21, @@ -7722,8 +7809,8 @@ "updateContext": null }, "value": "export", - "start": 1299, - "end": 1305, + "start": 1289, + "end": 1295, "loc": { "start": { "line": 22, @@ -7747,8 +7834,8 @@ "postfix": false, "binop": null }, - "start": 1306, - "end": 1307, + "start": 1296, + "end": 1297, "loc": { "start": { "line": 22, @@ -7775,8 +7862,8 @@ "updateContext": null }, "value": "default", - "start": 1307, - "end": 1314, + "start": 1297, + "end": 1304, "loc": { "start": { "line": 22, @@ -7801,8 +7888,8 @@ "binop": null }, "value": "as", - "start": 1315, - "end": 1317, + "start": 1305, + "end": 1307, "loc": { "start": { "line": 22, @@ -7826,9 +7913,9 @@ "postfix": false, "binop": null }, - "value": "insert_case4", - "start": 1318, - "end": 1330, + "value": "insert_case1", + "start": 1308, + "end": 1320, "loc": { "start": { "line": 22, @@ -7852,8 +7939,8 @@ "postfix": false, "binop": null }, - "start": 1330, - "end": 1331, + "start": 1320, + "end": 1321, "loc": { "start": { "line": 22, @@ -7878,8 +7965,8 @@ "binop": null }, "value": "from", - "start": 1332, - "end": 1336, + "start": 1322, + "end": 1326, "loc": { "start": { "line": 22, @@ -7904,9 +7991,9 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case4.js", - "start": 1337, - "end": 1366, + "value": "./insertion/insert_case1.js", + "start": 1327, + "end": 1356, "loc": { "start": { "line": 22, @@ -7931,8 +8018,8 @@ "binop": null, "updateContext": null }, - "start": 1366, - "end": 1367, + "start": 1356, + "end": 1357, "loc": { "start": { "line": 22, @@ -7959,8 +8046,8 @@ "updateContext": null }, "value": "export", - "start": 1368, - "end": 1374, + "start": 1358, + "end": 1364, "loc": { "start": { "line": 23, @@ -7984,8 +8071,8 @@ "postfix": false, "binop": null }, - "start": 1375, - "end": 1376, + "start": 1365, + "end": 1366, "loc": { "start": { "line": 23, @@ -8012,8 +8099,8 @@ "updateContext": null }, "value": "default", - "start": 1376, - "end": 1383, + "start": 1366, + "end": 1373, "loc": { "start": { "line": 23, @@ -8038,8 +8125,8 @@ "binop": null }, "value": "as", - "start": 1384, - "end": 1386, + "start": 1374, + "end": 1376, "loc": { "start": { "line": 23, @@ -8063,9 +8150,9 @@ "postfix": false, "binop": null }, - "value": "insert_case5", - "start": 1387, - "end": 1399, + "value": "insert_case2", + "start": 1377, + "end": 1389, "loc": { "start": { "line": 23, @@ -8089,8 +8176,8 @@ "postfix": false, "binop": null }, - "start": 1399, - "end": 1400, + "start": 1389, + "end": 1390, "loc": { "start": { "line": 23, @@ -8115,8 +8202,8 @@ "binop": null }, "value": "from", - "start": 1401, - "end": 1405, + "start": 1391, + "end": 1395, "loc": { "start": { "line": 23, @@ -8141,9 +8228,9 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case5.js", - "start": 1406, - "end": 1435, + "value": "./insertion/insert_case2.js", + "start": 1396, + "end": 1425, "loc": { "start": { "line": 23, @@ -8168,8 +8255,8 @@ "binop": null, "updateContext": null }, - "start": 1435, - "end": 1436, + "start": 1425, + "end": 1426, "loc": { "start": { "line": 23, @@ -8196,8 +8283,8 @@ "updateContext": null }, "value": "export", - "start": 1437, - "end": 1443, + "start": 1427, + "end": 1433, "loc": { "start": { "line": 24, @@ -8221,8 +8308,8 @@ "postfix": false, "binop": null }, - "start": 1444, - "end": 1445, + "start": 1434, + "end": 1435, "loc": { "start": { "line": 24, @@ -8249,8 +8336,8 @@ "updateContext": null }, "value": "default", - "start": 1445, - "end": 1452, + "start": 1435, + "end": 1442, "loc": { "start": { "line": 24, @@ -8275,8 +8362,8 @@ "binop": null }, "value": "as", - "start": 1453, - "end": 1455, + "start": 1443, + "end": 1445, "loc": { "start": { "line": 24, @@ -8300,9 +8387,9 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 1456, - "end": 1467, + "value": "insert_case3", + "start": 1446, + "end": 1458, "loc": { "start": { "line": 24, @@ -8310,7 +8397,7 @@ }, "end": { "line": 24, - "column": 30 + "column": 31 } } }, @@ -8326,16 +8413,16 @@ "postfix": false, "binop": null }, - "start": 1467, - "end": 1468, + "start": 1458, + "end": 1459, "loc": { "start": { "line": 24, - "column": 30 + "column": 31 }, "end": { "line": 24, - "column": 31 + "column": 32 } } }, @@ -8352,16 +8439,16 @@ "binop": null }, "value": "from", - "start": 1469, - "end": 1473, + "start": 1460, + "end": 1464, "loc": { "start": { "line": 24, - "column": 32 + "column": 33 }, "end": { "line": 24, - "column": 36 + "column": 37 } } }, @@ -8378,17 +8465,17 @@ "binop": null, "updateContext": null }, - "value": "./rotate/rotate_left.js", - "start": 1474, - "end": 1499, + "value": "./insertion/insert_case3.js", + "start": 1465, + "end": 1494, "loc": { "start": { "line": 24, - "column": 37 + "column": 38 }, "end": { "line": 24, - "column": 62 + "column": 67 } } }, @@ -8405,16 +8492,16 @@ "binop": null, "updateContext": null }, - "start": 1499, - "end": 1500, + "start": 1494, + "end": 1495, "loc": { "start": { "line": 24, - "column": 62 + "column": 67 }, "end": { "line": 24, - "column": 63 + "column": 68 } } }, @@ -8433,8 +8520,8 @@ "updateContext": null }, "value": "export", - "start": 1501, - "end": 1507, + "start": 1496, + "end": 1502, "loc": { "start": { "line": 25, @@ -8458,8 +8545,8 @@ "postfix": false, "binop": null }, - "start": 1508, - "end": 1509, + "start": 1503, + "end": 1504, "loc": { "start": { "line": 25, @@ -8486,8 +8573,8 @@ "updateContext": null }, "value": "default", - "start": 1509, - "end": 1516, + "start": 1504, + "end": 1511, "loc": { "start": { "line": 25, @@ -8512,8 +8599,8 @@ "binop": null }, "value": "as", - "start": 1517, - "end": 1519, + "start": 1512, + "end": 1514, "loc": { "start": { "line": 25, @@ -8537,9 +8624,9 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 1520, - "end": 1532, + "value": "insert_case4", + "start": 1515, + "end": 1527, "loc": { "start": { "line": 25, @@ -8563,8 +8650,8 @@ "postfix": false, "binop": null }, - "start": 1532, - "end": 1533, + "start": 1527, + "end": 1528, "loc": { "start": { "line": 25, @@ -8589,8 +8676,8 @@ "binop": null }, "value": "from", - "start": 1534, - "end": 1538, + "start": 1529, + "end": 1533, "loc": { "start": { "line": 25, @@ -8615,9 +8702,9 @@ "binop": null, "updateContext": null }, - "value": "./rotate/rotate_right.js", - "start": 1539, - "end": 1565, + "value": "./insertion/insert_case4.js", + "start": 1534, + "end": 1563, "loc": { "start": { "line": 25, @@ -8625,7 +8712,7 @@ }, "end": { "line": 25, - "column": 64 + "column": 67 } } }, @@ -8642,16 +8729,16 @@ "binop": null, "updateContext": null }, - "start": 1565, - "end": 1566, + "start": 1563, + "end": 1564, "loc": { "start": { "line": 25, - "column": 64 + "column": 67 }, "end": { "line": 25, - "column": 65 + "column": 68 } } }, @@ -8670,8 +8757,8 @@ "updateContext": null }, "value": "export", - "start": 1567, - "end": 1573, + "start": 1565, + "end": 1571, "loc": { "start": { "line": 26, @@ -8695,8 +8782,8 @@ "postfix": false, "binop": null }, - "start": 1574, - "end": 1575, + "start": 1572, + "end": 1573, "loc": { "start": { "line": 26, @@ -8723,8 +8810,8 @@ "updateContext": null }, "value": "default", - "start": 1575, - "end": 1582, + "start": 1573, + "end": 1580, "loc": { "start": { "line": 26, @@ -8749,8 +8836,8 @@ "binop": null }, "value": "as", - "start": 1583, - "end": 1585, + "start": 1581, + "end": 1583, "loc": { "start": { "line": 26, @@ -8774,9 +8861,9 @@ "postfix": false, "binop": null }, - "value": "search", - "start": 1586, - "end": 1592, + "value": "rotate_left", + "start": 1584, + "end": 1595, "loc": { "start": { "line": 26, @@ -8784,7 +8871,7 @@ }, "end": { "line": 26, - "column": 25 + "column": 30 } } }, @@ -8800,16 +8887,16 @@ "postfix": false, "binop": null }, - "start": 1592, - "end": 1593, + "start": 1595, + "end": 1596, "loc": { "start": { "line": 26, - "column": 25 + "column": 30 }, "end": { "line": 26, - "column": 26 + "column": 31 } } }, @@ -8826,16 +8913,16 @@ "binop": null }, "value": "from", - "start": 1594, - "end": 1598, + "start": 1597, + "end": 1601, "loc": { "start": { "line": 26, - "column": 27 + "column": 32 }, "end": { "line": 26, - "column": 31 + "column": 36 } } }, @@ -8852,17 +8939,17 @@ "binop": null, "updateContext": null }, - "value": "./search/search.js", - "start": 1599, - "end": 1619, + "value": "./rotate/rotate_left.js", + "start": 1602, + "end": 1627, "loc": { "start": { "line": 26, - "column": 32 + "column": 37 }, "end": { "line": 26, - "column": 52 + "column": 62 } } }, @@ -8879,16 +8966,16 @@ "binop": null, "updateContext": null }, - "start": 1619, - "end": 1620, + "start": 1627, + "end": 1628, "loc": { "start": { "line": 26, - "column": 52 + "column": 62 }, "end": { "line": 26, - "column": 53 + "column": 63 } } }, @@ -8907,8 +8994,8 @@ "updateContext": null }, "value": "export", - "start": 1621, - "end": 1627, + "start": 1629, + "end": 1635, "loc": { "start": { "line": 27, @@ -8932,8 +9019,8 @@ "postfix": false, "binop": null }, - "start": 1628, - "end": 1629, + "start": 1636, + "end": 1637, "loc": { "start": { "line": 27, @@ -8960,8 +9047,8 @@ "updateContext": null }, "value": "default", - "start": 1629, - "end": 1636, + "start": 1637, + "end": 1644, "loc": { "start": { "line": 27, @@ -8986,8 +9073,8 @@ "binop": null }, "value": "as", - "start": 1637, - "end": 1639, + "start": 1645, + "end": 1647, "loc": { "start": { "line": 27, @@ -9011,9 +9098,9 @@ "postfix": false, "binop": null }, - "value": "inordertraversal", - "start": 1640, - "end": 1656, + "value": "rotate_right", + "start": 1648, + "end": 1660, "loc": { "start": { "line": 27, @@ -9021,7 +9108,7 @@ }, "end": { "line": 27, - "column": 35 + "column": 31 } } }, @@ -9037,16 +9124,16 @@ "postfix": false, "binop": null }, - "start": 1656, - "end": 1657, + "start": 1660, + "end": 1661, "loc": { "start": { "line": 27, - "column": 35 + "column": 31 }, "end": { "line": 27, - "column": 36 + "column": 32 } } }, @@ -9063,16 +9150,16 @@ "binop": null }, "value": "from", - "start": 1658, - "end": 1662, + "start": 1662, + "end": 1666, "loc": { "start": { "line": 27, - "column": 37 + "column": 33 }, "end": { "line": 27, - "column": 41 + "column": 37 } } }, @@ -9089,17 +9176,17 @@ "binop": null, "updateContext": null }, - "value": "./traversal/inordertraversal.js", - "start": 1663, - "end": 1696, + "value": "./rotate/rotate_right.js", + "start": 1667, + "end": 1693, "loc": { "start": { "line": 27, - "column": 42 + "column": 38 }, "end": { "line": 27, - "column": 75 + "column": 64 } } }, @@ -9116,16 +9203,16 @@ "binop": null, "updateContext": null }, - "start": 1696, - "end": 1697, + "start": 1693, + "end": 1694, "loc": { "start": { "line": 27, - "column": 75 + "column": 64 }, "end": { "line": 27, - "column": 76 + "column": 65 } } }, @@ -9144,8 +9231,8 @@ "updateContext": null }, "value": "export", - "start": 1698, - "end": 1704, + "start": 1695, + "end": 1701, "loc": { "start": { "line": 28, @@ -9169,8 +9256,8 @@ "postfix": false, "binop": null }, - "start": 1705, - "end": 1706, + "start": 1702, + "end": 1703, "loc": { "start": { "line": 28, @@ -9197,8 +9284,8 @@ "updateContext": null }, "value": "default", - "start": 1706, - "end": 1713, + "start": 1703, + "end": 1710, "loc": { "start": { "line": 28, @@ -9223,8 +9310,8 @@ "binop": null }, "value": "as", - "start": 1714, - "end": 1716, + "start": 1711, + "end": 1713, "loc": { "start": { "line": 28, @@ -9248,9 +9335,9 @@ "postfix": false, "binop": null }, - "value": "rangetraversal", - "start": 1717, - "end": 1731, + "value": "search", + "start": 1714, + "end": 1720, "loc": { "start": { "line": 28, @@ -9258,7 +9345,7 @@ }, "end": { "line": 28, - "column": 33 + "column": 25 } } }, @@ -9274,16 +9361,16 @@ "postfix": false, "binop": null }, - "start": 1731, - "end": 1732, + "start": 1720, + "end": 1721, "loc": { "start": { "line": 28, - "column": 33 + "column": 25 }, "end": { "line": 28, - "column": 34 + "column": 26 } } }, @@ -9300,16 +9387,16 @@ "binop": null }, "value": "from", - "start": 1733, - "end": 1737, + "start": 1722, + "end": 1726, "loc": { "start": { "line": 28, - "column": 35 + "column": 27 }, "end": { "line": 28, - "column": 39 + "column": 31 } } }, @@ -9326,17 +9413,17 @@ "binop": null, "updateContext": null }, - "value": "./traversal/rangetraversal.js", - "start": 1738, - "end": 1769, + "value": "./search/search.js", + "start": 1727, + "end": 1747, "loc": { "start": { "line": 28, - "column": 40 + "column": 32 }, "end": { "line": 28, - "column": 71 + "column": 52 } } }, @@ -9353,16 +9440,16 @@ "binop": null, "updateContext": null }, - "start": 1769, - "end": 1770, + "start": 1747, + "end": 1748, "loc": { "start": { "line": 28, - "column": 71 + "column": 52 }, "end": { "line": 28, - "column": 72 + "column": 53 } } }, @@ -9381,8 +9468,8 @@ "updateContext": null }, "value": "export", - "start": 1771, - "end": 1777, + "start": 1749, + "end": 1755, "loc": { "start": { "line": 29, @@ -9406,8 +9493,8 @@ "postfix": false, "binop": null }, - "start": 1778, - "end": 1779, + "start": 1756, + "end": 1757, "loc": { "start": { "line": 29, @@ -9434,8 +9521,8 @@ "updateContext": null }, "value": "default", - "start": 1779, - "end": 1786, + "start": 1757, + "end": 1764, "loc": { "start": { "line": 29, @@ -9460,8 +9547,8 @@ "binop": null }, "value": "as", - "start": 1787, - "end": 1789, + "start": 1765, + "end": 1767, "loc": { "start": { "line": 29, @@ -9485,9 +9572,9 @@ "postfix": false, "binop": null }, - "value": "Leaf", - "start": 1790, - "end": 1794, + "value": "inordertraversal", + "start": 1768, + "end": 1784, "loc": { "start": { "line": 29, @@ -9495,7 +9582,7 @@ }, "end": { "line": 29, - "column": 23 + "column": 35 } } }, @@ -9511,16 +9598,16 @@ "postfix": false, "binop": null }, - "start": 1794, - "end": 1795, + "start": 1784, + "end": 1785, "loc": { "start": { "line": 29, - "column": 23 + "column": 35 }, "end": { "line": 29, - "column": 24 + "column": 36 } } }, @@ -9537,16 +9624,16 @@ "binop": null }, "value": "from", - "start": 1796, - "end": 1800, + "start": 1786, + "end": 1790, "loc": { "start": { "line": 29, - "column": 25 + "column": 37 }, "end": { "line": 29, - "column": 29 + "column": 41 } } }, @@ -9563,17 +9650,17 @@ "binop": null, "updateContext": null }, - "value": "./types/Leaf.js", - "start": 1801, - "end": 1818, + "value": "./traversal/inordertraversal.js", + "start": 1791, + "end": 1824, "loc": { "start": { "line": 29, - "column": 30 + "column": 42 }, "end": { "line": 29, - "column": 47 + "column": 75 } } }, @@ -9590,16 +9677,16 @@ "binop": null, "updateContext": null }, - "start": 1818, - "end": 1819, + "start": 1824, + "end": 1825, "loc": { "start": { "line": 29, - "column": 47 + "column": 75 }, "end": { "line": 29, - "column": 48 + "column": 76 } } }, @@ -9618,8 +9705,8 @@ "updateContext": null }, "value": "export", - "start": 1820, - "end": 1826, + "start": 1826, + "end": 1832, "loc": { "start": { "line": 30, @@ -9643,8 +9730,8 @@ "postfix": false, "binop": null }, - "start": 1827, - "end": 1828, + "start": 1833, + "end": 1834, "loc": { "start": { "line": 30, @@ -9671,8 +9758,8 @@ "updateContext": null }, "value": "default", - "start": 1828, - "end": 1835, + "start": 1834, + "end": 1841, "loc": { "start": { "line": 30, @@ -9697,8 +9784,8 @@ "binop": null }, "value": "as", - "start": 1836, - "end": 1838, + "start": 1842, + "end": 1844, "loc": { "start": { "line": 30, @@ -9722,9 +9809,9 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 1839, - "end": 1843, + "value": "rangetraversal", + "start": 1845, + "end": 1859, "loc": { "start": { "line": 30, @@ -9732,7 +9819,7 @@ }, "end": { "line": 30, - "column": 23 + "column": 33 } } }, @@ -9748,16 +9835,16 @@ "postfix": false, "binop": null }, - "start": 1843, - "end": 1844, + "start": 1859, + "end": 1860, "loc": { "start": { "line": 30, - "column": 23 + "column": 33 }, "end": { "line": 30, - "column": 24 + "column": 34 } } }, @@ -9774,16 +9861,16 @@ "binop": null }, "value": "from", - "start": 1845, - "end": 1849, + "start": 1861, + "end": 1865, "loc": { "start": { "line": 30, - "column": 25 + "column": 35 }, "end": { "line": 30, - "column": 29 + "column": 39 } } }, @@ -9800,17 +9887,17 @@ "binop": null, "updateContext": null }, - "value": "./types/Node.js", - "start": 1850, - "end": 1867, + "value": "./traversal/rangetraversal.js", + "start": 1866, + "end": 1897, "loc": { "start": { "line": 30, - "column": 30 + "column": 40 }, "end": { "line": 30, - "column": 47 + "column": 71 } } }, @@ -9827,16 +9914,16 @@ "binop": null, "updateContext": null }, - "start": 1867, - "end": 1868, + "start": 1897, + "end": 1898, "loc": { "start": { "line": 30, - "column": 47 + "column": 71 }, "end": { "line": 30, - "column": 48 + "column": 72 } } }, @@ -9855,8 +9942,8 @@ "updateContext": null }, "value": "export", - "start": 1869, - "end": 1875, + "start": 1899, + "end": 1905, "loc": { "start": { "line": 31, @@ -9880,8 +9967,8 @@ "postfix": false, "binop": null }, - "start": 1876, - "end": 1877, + "start": 1906, + "end": 1907, "loc": { "start": { "line": 31, @@ -9908,8 +9995,8 @@ "updateContext": null }, "value": "default", - "start": 1877, - "end": 1884, + "start": 1907, + "end": 1914, "loc": { "start": { "line": 31, @@ -9934,8 +10021,8 @@ "binop": null }, "value": "as", - "start": 1885, - "end": 1887, + "start": 1915, + "end": 1917, "loc": { "start": { "line": 31, @@ -9959,9 +10046,9 @@ "postfix": false, "binop": null }, - "value": "RedBlackTree", - "start": 1888, - "end": 1900, + "value": "Node", + "start": 1918, + "end": 1922, "loc": { "start": { "line": 31, @@ -9969,7 +10056,7 @@ }, "end": { "line": 31, - "column": 31 + "column": 23 } } }, @@ -9985,16 +10072,16 @@ "postfix": false, "binop": null }, - "start": 1900, - "end": 1901, + "start": 1922, + "end": 1923, "loc": { "start": { "line": 31, - "column": 31 + "column": 23 }, "end": { "line": 31, - "column": 32 + "column": 24 } } }, @@ -10011,15 +10098,252 @@ "binop": null }, "value": "from", - "start": 1902, - "end": 1906, + "start": 1924, + "end": 1928, "loc": { "start": { "line": 31, - "column": 33 + "column": 25 + }, + "end": { + "line": 31, + "column": 29 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./types/Node.js", + "start": 1929, + "end": 1946, + "loc": { + "start": { + "line": 31, + "column": 30 + }, + "end": { + "line": 31, + "column": 47 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1946, + "end": 1947, + "loc": { + "start": { + "line": 31, + "column": 47 }, "end": { "line": 31, + "column": 48 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1948, + "end": 1954, + "loc": { + "start": { + "line": 32, + "column": 0 + }, + "end": { + "line": 32, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1955, + "end": 1956, + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1956, + "end": 1963, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 1964, + "end": 1966, + "loc": { + "start": { + "line": 32, + "column": 16 + }, + "end": { + "line": 32, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RedBlackTree", + "start": 1967, + "end": 1979, + "loc": { + "start": { + "line": 32, + "column": 19 + }, + "end": { + "line": 32, + "column": 31 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1979, + "end": 1980, + "loc": { + "start": { + "line": 32, + "column": 31 + }, + "end": { + "line": 32, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 1981, + "end": 1985, + "loc": { + "start": { + "line": 32, + "column": 33 + }, + "end": { + "line": 32, "column": 37 } } @@ -10038,15 +10362,15 @@ "updateContext": null }, "value": "./types/RedBlackTree.js", - "start": 1907, - "end": 1932, + "start": 1986, + "end": 2011, "loc": { "start": { - "line": 31, + "line": 32, "column": 38 }, "end": { - "line": 31, + "line": 32, "column": 63 } } @@ -10064,15 +10388,15 @@ "binop": null, "updateContext": null }, - "start": 1932, - "end": 1933, + "start": 2011, + "end": 2012, "loc": { "start": { - "line": 31, + "line": 32, "column": 63 }, "end": { - "line": 31, + "line": 32, "column": 64 } } @@ -10090,15 +10414,15 @@ "binop": null, "updateContext": null }, - "start": 1934, - "end": 1934, + "start": 2013, + "end": 2013, "loc": { "start": { - "line": 32, + "line": 33, "column": 0 }, "end": { - "line": 32, + "line": 33, "column": 0 } } diff --git a/ast/source/insertion/insert.js.json b/ast/source/insertion/insert.js.json index 10a3b37..613f720 100644 --- a/ast/source/insertion/insert.js.json +++ b/ast/source/insertion/insert.js.json @@ -168,7 +168,7 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case0}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", "start": 67, "end": 866, "loc": { @@ -676,7 +676,7 @@ } }, "test": { - "type": "CallExpression", + "type": "BinaryExpression", "start": 986, "end": 999, "loc": { @@ -689,10 +689,10 @@ "column": 20 } }, - "callee": { - "type": "MemberExpression", + "left": { + "type": "Identifier", "start": 986, - "end": 997, + "end": 990, "loc": { "start": { "line": 25, @@ -700,46 +700,28 @@ }, "end": { "line": 25, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 986, - "end": 990, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 11 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 991, - "end": 997, - "loc": { - "start": { - "line": 25, - "column": 12 - }, - "end": { - "line": 25, - "column": 18 - }, - "identifierName": "isLeaf" + "column": 11 }, - "name": "isLeaf" + "identifierName": "node" }, - "computed": false + "name": "node" }, - "arguments": [] + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 995, + "end": 999, + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 20 + } + } + } }, "consequent": { "type": "BlockStatement", @@ -1172,7 +1154,7 @@ } }, "test": { - "type": "CallExpression", + "type": "BinaryExpression", "start": 1126, "end": 1139, "loc": { @@ -1185,10 +1167,10 @@ "column": 20 } }, - "callee": { - "type": "MemberExpression", + "left": { + "type": "Identifier", "start": 1126, - "end": 1137, + "end": 1130, "loc": { "start": { "line": 35, @@ -1196,46 +1178,28 @@ }, "end": { "line": 35, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 1126, - "end": 1130, - "loc": { - "start": { - "line": 35, - "column": 7 - }, - "end": { - "line": 35, - "column": 11 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 1131, - "end": 1137, - "loc": { - "start": { - "line": 35, - "column": 12 - }, - "end": { - "line": 35, - "column": 18 - }, - "identifierName": "isLeaf" + "column": 11 }, - "name": "isLeaf" + "identifierName": "node" }, - "computed": false + "name": "node" }, - "arguments": [] + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 1135, + "end": 1139, + "loc": { + "start": { + "line": 35, + "column": 16 + }, + "end": { + "line": 35, + "column": 20 + } + } + } }, "consequent": { "type": "BlockStatement", @@ -2243,7 +2207,7 @@ } }, "test": { - "type": "CallExpression", + "type": "BinaryExpression", "start": 986, "end": 999, "loc": { @@ -2256,10 +2220,10 @@ "column": 20 } }, - "callee": { - "type": "MemberExpression", + "left": { + "type": "Identifier", "start": 986, - "end": 997, + "end": 990, "loc": { "start": { "line": 25, @@ -2267,46 +2231,28 @@ }, "end": { "line": 25, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 986, - "end": 990, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 11 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 991, - "end": 997, - "loc": { - "start": { - "line": 25, - "column": 12 - }, - "end": { - "line": 25, - "column": 18 - }, - "identifierName": "isLeaf" + "column": 11 }, - "name": "isLeaf" + "identifierName": "node" }, - "computed": false + "name": "node" }, - "arguments": [] + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 995, + "end": 999, + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 20 + } + } + } }, "consequent": { "type": "BlockStatement", @@ -2739,7 +2685,7 @@ } }, "test": { - "type": "CallExpression", + "type": "BinaryExpression", "start": 1126, "end": 1139, "loc": { @@ -2752,10 +2698,10 @@ "column": 20 } }, - "callee": { - "type": "MemberExpression", + "left": { + "type": "Identifier", "start": 1126, - "end": 1137, + "end": 1130, "loc": { "start": { "line": 35, @@ -2763,46 +2709,28 @@ }, "end": { "line": 35, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 1126, - "end": 1130, - "loc": { - "start": { - "line": 35, - "column": 7 - }, - "end": { - "line": 35, - "column": 11 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 1131, - "end": 1137, - "loc": { - "start": { - "line": 35, - "column": 12 - }, - "end": { - "line": 35, - "column": 18 - }, - "identifierName": "isLeaf" + "column": 11 }, - "name": "isLeaf" + "identifierName": "node" }, - "computed": false + "name": "node" }, - "arguments": [] + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 1135, + "end": 1139, + "loc": { + "start": { + "line": 35, + "column": 16 + }, + "end": { + "line": 35, + "column": 20 + } + } + } }, "consequent": { "type": "BlockStatement", @@ -3251,7 +3179,7 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case0}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", "start": 67, "end": 866, "loc": { @@ -3275,7 +3203,7 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case0}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", "start": 67, "end": 866, "loc": { @@ -3559,7 +3487,7 @@ }, { "type": "CommentBlock", - "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", + "value": "*\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case0}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n ", "start": 67, "end": 866, "loc": { @@ -4697,45 +4625,20 @@ }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 990, - "end": 991, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "isLeaf", + "value": "===", "start": 991, - "end": 997, + "end": 994, "loc": { "start": { "line": 25, @@ -4743,53 +4646,31 @@ }, "end": { "line": 25, - "column": 18 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 997, - "end": 998, - "loc": { - "start": { - "line": 25, - "column": 18 - }, - "end": { - "line": 25, - "column": 19 + "column": 15 } } }, { "type": { - "label": ")", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 998, + "value": "null", + "start": 995, "end": 999, "loc": { "start": { "line": 25, - "column": 19 + "column": 16 }, "end": { "line": 25, @@ -5714,45 +5595,20 @@ }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1130, - "end": 1131, - "loc": { - "start": { - "line": 35, - "column": 11 - }, - "end": { - "line": 35, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "isLeaf", + "value": "===", "start": 1131, - "end": 1137, + "end": 1134, "loc": { "start": { "line": 35, @@ -5760,53 +5616,31 @@ }, "end": { "line": 35, - "column": 18 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1137, - "end": 1138, - "loc": { - "start": { - "line": 35, - "column": 18 - }, - "end": { - "line": 35, - "column": 19 + "column": 15 } } }, { "type": { - "label": ")", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1138, + "value": "null", + "start": 1135, "end": 1139, "loc": { "start": { "line": 35, - "column": 19 + "column": 16 }, "end": { "line": 35, diff --git a/ast/source/insertion/insert_case0.js.json b/ast/source/insertion/insert_case0.js.json new file mode 100644 index 0000000..5926303 --- /dev/null +++ b/ast/source/insertion/insert_case0.js.json @@ -0,0 +1,5057 @@ +{ + "type": "File", + "start": 0, + "end": 671, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 31, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 671, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 31, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 38 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + }, + "extra": { + "rawValue": "../color/BLACK.js", + "raw": "'../color/BLACK.js'" + }, + "value": "../color/BLACK.js" + } + }, + { + "type": "ImportDeclaration", + "start": 105, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 34 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + }, + "local": { + "type": "Identifier", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + }, + "extra": { + "rawValue": "../color/RED.js", + "raw": "'../color/RED.js'" + }, + "value": "../color/RED.js" + } + }, + { + "type": "ImportDeclaration", + "start": 140, + "end": 185, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 147, + "end": 159, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 147, + "end": 159, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 165, + "end": 184, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 44 + } + }, + "extra": { + "rawValue": "./insert_case1.js", + "raw": "'./insert_case1.js'" + }, + "value": "./insert_case1.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 299, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 300, + "end": 640, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 28, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 306, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + }, + "identifierName": "insert_case0" + }, + "name": "insert_case0", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 321, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 328, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 331, + "end": 357, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 331, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 331, + "end": 337, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 338, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 338, + "end": 339, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 351, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 359, + "end": 384, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 359, + "end": 383, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 359, + "end": 365, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 366, + "end": 382, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 366, + "end": 374, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 366, + "end": 367, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 368, + "end": 374, + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 379, + "end": 382, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 386, + "end": 418, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 386, + "end": 417, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 386, + "end": 392, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 393, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 393, + "end": 406, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 393, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 393, + "end": 394, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 395, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 400, + "end": 406, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 411, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 420, + "end": 453, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 420, + "end": 452, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 427, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 427, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 427, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 429, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 435, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 446, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 574, + "end": 637, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "test": { + "type": "BinaryExpression", + "start": 578, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 578, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 578, + "end": 579, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 580, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 591, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 22 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 597, + "end": 614, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 41 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 597, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 40 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 597, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 32 + } + }, + "object": { + "type": "Identifier", + "start": 597, + "end": 598, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 599, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 32 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 608, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 40 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 621, + "end": 637, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 621, + "end": 636, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 621, + "end": 633, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + }, + "arguments": [ + { + "type": "Identifier", + "start": 634, + "end": 635, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 642, + "end": 670, + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 657, + "end": 669, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 27 + }, + "identifierName": "insert_case0" + }, + "name": "insert_case0" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 642, + "end": 670, + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 300, + "end": 640, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 28, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 306, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + }, + "identifierName": "insert_case0" + }, + "name": "insert_case0", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 321, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + }, + "identifierName": "insert_case0" + }, + "name": "insert_case0", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 328, + "end": 639, + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 28, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 331, + "end": 357, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 331, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 331, + "end": 337, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 338, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 338, + "end": 339, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 351, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 359, + "end": 384, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 359, + "end": 383, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 359, + "end": 365, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 366, + "end": 382, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 366, + "end": 374, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 366, + "end": 367, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 368, + "end": 374, + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 379, + "end": 382, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 386, + "end": 418, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 386, + "end": 417, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 386, + "end": 392, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 393, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 393, + "end": 406, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 21 + } + }, + "object": { + "type": "MemberExpression", + "start": 393, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 393, + "end": 394, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 395, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 400, + "end": 406, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 411, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 420, + "end": 453, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 420, + "end": 452, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 427, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 427, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 22 + } + }, + "object": { + "type": "MemberExpression", + "start": 427, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 429, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 435, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 22 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 446, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 32 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 574, + "end": 637, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "test": { + "type": "BinaryExpression", + "start": 578, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 578, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 578, + "end": 579, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 580, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 591, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 22 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "ExpressionStatement", + "start": 597, + "end": 614, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 41 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 597, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 40 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 597, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 32 + } + }, + "object": { + "type": "Identifier", + "start": 597, + "end": 598, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 599, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 32 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 608, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 40 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 621, + "end": 637, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 22 + } + }, + "expression": { + "type": "CallExpression", + "start": 621, + "end": 636, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 21 + } + }, + "callee": { + "type": "Identifier", + "start": 621, + "end": 633, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + }, + "arguments": [ + { + "type": "Identifier", + "start": 634, + "end": 635, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 299, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 299, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case1", + "start": 147, + "end": 159, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 160, + "end": 164, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case1.js", + "start": 165, + "end": 184, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 184, + "end": 185, + "loc": { + "start": { + "line": 5, + "column": 44 + }, + "end": { + "line": 5, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 299, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 300, + "end": 305, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case0", + "start": 306, + "end": 318, + "loc": { + "start": { + "line": 14, + "column": 6 + }, + "end": { + "line": 14, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 319, + "end": 320, + "loc": { + "start": { + "line": 14, + "column": 19 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 321, + "end": 322, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 14, + "column": 22 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 323, + "end": 324, + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 325, + "end": 327, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 328, + "end": 329, + "loc": { + "start": { + "line": 14, + "column": 28 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 331, + "end": 337, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 337, + "end": 338, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 338, + "end": 339, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 340, + "end": 350, + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 351, + "end": 355, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 355, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 356, + "end": 357, + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 359, + "end": 365, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 16, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 365, + "end": 366, + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 366, + "end": 367, + "loc": { + "start": { + "line": 16, + "column": 8 + }, + "end": { + "line": 16, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 367, + "end": 368, + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 16, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 368, + "end": 374, + "loc": { + "start": { + "line": 16, + "column": 10 + }, + "end": { + "line": 16, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 375, + "end": 378, + "loc": { + "start": { + "line": 16, + "column": 17 + }, + "end": { + "line": 16, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 379, + "end": 382, + "loc": { + "start": { + "line": 16, + "column": 21 + }, + "end": { + "line": 16, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 382, + "end": 383, + "loc": { + "start": { + "line": 16, + "column": 24 + }, + "end": { + "line": 16, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 383, + "end": 384, + "loc": { + "start": { + "line": 16, + "column": 25 + }, + "end": { + "line": 16, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 386, + "end": 392, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 392, + "end": 393, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 393, + "end": 394, + "loc": { + "start": { + "line": 17, + "column": 8 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 394, + "end": 395, + "loc": { + "start": { + "line": 17, + "column": 9 + }, + "end": { + "line": 17, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 395, + "end": 399, + "loc": { + "start": { + "line": 17, + "column": 10 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 399, + "end": 400, + "loc": { + "start": { + "line": 17, + "column": 14 + }, + "end": { + "line": 17, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 400, + "end": 406, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 21 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 407, + "end": 410, + "loc": { + "start": { + "line": 17, + "column": 22 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 411, + "end": 416, + "loc": { + "start": { + "line": 17, + "column": 26 + }, + "end": { + "line": 17, + "column": 31 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 416, + "end": 417, + "loc": { + "start": { + "line": 17, + "column": 31 + }, + "end": { + "line": 17, + "column": 32 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 417, + "end": 418, + "loc": { + "start": { + "line": 17, + "column": 32 + }, + "end": { + "line": 17, + "column": 33 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 426, + "end": 427, + "loc": { + "start": { + "line": 18, + "column": 7 + }, + "end": { + "line": 18, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 18, + "column": 8 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 428, + "end": 429, + "loc": { + "start": { + "line": 18, + "column": 9 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 429, + "end": 434, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 434, + "end": 435, + "loc": { + "start": { + "line": 18, + "column": 15 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 435, + "end": 441, + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 22 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 442, + "end": 445, + "loc": { + "start": { + "line": 18, + "column": 23 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 446, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 32 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 451, + "end": 452, + "loc": { + "start": { + "line": 18, + "column": 32 + }, + "end": { + "line": 18, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 452, + "end": 453, + "loc": { + "start": { + "line": 18, + "column": 33 + }, + "end": { + "line": 18, + "column": 34 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 455, + "end": 572, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 25, + "column": 4 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 574, + "end": 576, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 577, + "end": 578, + "loc": { + "start": { + "line": 26, + "column": 4 + }, + "end": { + "line": 26, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 578, + "end": 579, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 579, + "end": 580, + "loc": { + "start": { + "line": 26, + "column": 6 + }, + "end": { + "line": 26, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 580, + "end": 586, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 587, + "end": 590, + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 17 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 591, + "end": 595, + "loc": { + "start": { + "line": 26, + "column": 18 + }, + "end": { + "line": 26, + "column": 22 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 595, + "end": 596, + "loc": { + "start": { + "line": 26, + "column": 22 + }, + "end": { + "line": 26, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 597, + "end": 598, + "loc": { + "start": { + "line": 26, + "column": 24 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 598, + "end": 599, + "loc": { + "start": { + "line": 26, + "column": 25 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 599, + "end": 605, + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 32 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 606, + "end": 607, + "loc": { + "start": { + "line": 26, + "column": 33 + }, + "end": { + "line": 26, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 608, + "end": 613, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 40 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 613, + "end": 614, + "loc": { + "start": { + "line": 26, + "column": 40 + }, + "end": { + "line": 26, + "column": 41 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 616, + "end": 620, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case1", + "start": 621, + "end": 633, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 18 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 633, + "end": 634, + "loc": { + "start": { + "line": 27, + "column": 18 + }, + "end": { + "line": 27, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 634, + "end": 635, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 635, + "end": 636, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 636, + "end": 637, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 22 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 638, + "end": 639, + "loc": { + "start": { + "line": 28, + "column": 0 + }, + "end": { + "line": 28, + "column": 1 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 639, + "end": 640, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 2 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 642, + "end": 648, + "loc": { + "start": { + "line": 30, + "column": 0 + }, + "end": { + "line": 30, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 649, + "end": 656, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case0", + "start": 657, + "end": 669, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 669, + "end": 670, + "loc": { + "start": { + "line": 30, + "column": 27 + }, + "end": { + "line": 30, + "column": 28 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 671, + "end": 671, + "loc": { + "start": { + "line": 31, + "column": 0 + }, + "end": { + "line": 31, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/insertion/insert_case1.js.json b/ast/source/insertion/insert_case1.js.json index 153742a..da0db38 100644 --- a/ast/source/insertion/insert_case1.js.json +++ b/ast/source/insertion/insert_case1.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 671, + "end": 798, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 31, + "line": 37, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 671, + "end": 798, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 31, + "line": 37, "column": 0 } }, @@ -375,16 +375,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", "start": 187, - "end": 299, + "end": 337, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -393,44 +393,44 @@ }, { "type": "Identifier", - "start": 300, - "end": 640, + "start": 338, + "end": 767, "loc": { "start": { - "line": 14, + "line": 15, "column": 0 }, "end": { - "line": 28, + "line": 34, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 306, - "end": 639, + "start": 344, + "end": 766, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 28, + "line": 34, "column": 1 } }, "id": { "type": "Identifier", - "start": 306, - "end": 318, + "start": 344, + "end": 356, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "insert_case1" @@ -440,15 +440,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 321, - "end": 639, + "start": 359, + "end": 766, "loc": { "start": { - "line": 14, + "line": 15, "column": 21 }, "end": { - "line": 28, + "line": 34, "column": 1 } }, @@ -459,15 +459,15 @@ "params": [ { "type": "Identifier", - "start": 322, - "end": 323, + "start": 360, + "end": 361, "loc": { "start": { - "line": 14, + "line": 15, "column": 22 }, "end": { - "line": 14, + "line": 15, "column": 23 }, "identifierName": "n" @@ -477,58 +477,58 @@ ], "body": { "type": "BlockStatement", - "start": 328, - "end": 639, + "start": 366, + "end": 766, "loc": { "start": { - "line": 14, + "line": 15, "column": 28 }, "end": { - "line": 28, + "line": 34, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 331, - "end": 357, + "start": 369, + "end": 395, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 331, - "end": 356, + "start": 369, + "end": 394, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 26 } }, "callee": { "type": "Identifier", - "start": 331, - "end": 337, + "start": 369, + "end": 375, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 7 }, "identifierName": "assert" @@ -538,29 +538,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 338, - "end": 355, + "start": 376, + "end": 393, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 25 } }, "left": { "type": "Identifier", - "start": 338, - "end": 339, + "start": 376, + "end": 377, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 9 }, "identifierName": "n" @@ -570,15 +570,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 351, - "end": 355, + "start": 389, + "end": 393, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 25 }, "identifierName": "Node" @@ -591,43 +591,43 @@ }, { "type": "ExpressionStatement", - "start": 359, - "end": 384, + "start": 397, + "end": 422, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 359, - "end": 383, + "start": 397, + "end": 421, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 25 } }, "callee": { "type": "Identifier", - "start": 359, - "end": 365, + "start": 397, + "end": 403, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 }, "identifierName": "assert" @@ -637,43 +637,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 366, - "end": 382, + "start": 404, + "end": 420, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 366, - "end": 374, + "start": 404, + "end": 412, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 16 } }, "object": { "type": "Identifier", - "start": 366, - "end": 367, + "start": 404, + "end": 405, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 }, "identifierName": "n" @@ -682,15 +682,15 @@ }, "property": { "type": "Identifier", - "start": 368, - "end": 374, + "start": 406, + "end": 412, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 16 }, "identifierName": "_color" @@ -702,15 +702,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 379, - "end": 382, + "start": 417, + "end": 420, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 24 }, "identifierName": "RED" @@ -723,43 +723,43 @@ }, { "type": "ExpressionStatement", - "start": 386, - "end": 418, + "start": 424, + "end": 475, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, - "column": 33 + "line": 18, + "column": 52 } }, "expression": { "type": "CallExpression", - "start": 386, - "end": 417, + "start": 424, + "end": 474, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, - "column": 32 + "line": 18, + "column": 51 } }, "callee": { "type": "Identifier", - "start": 386, - "end": 392, + "start": 424, + "end": 430, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 7 }, "identifierName": "assert" @@ -768,58 +768,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 393, - "end": 416, + "type": "LogicalExpression", + "start": 431, + "end": 473, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, - "column": 31 + "line": 18, + "column": 50 } }, "left": { - "type": "MemberExpression", - "start": 393, - "end": 406, + "type": "BinaryExpression", + "start": 431, + "end": 446, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, - "column": 21 + "line": 18, + "column": 23 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 393, - "end": 399, + "start": 431, + "end": 437, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 14 } }, "object": { "type": "Identifier", - "start": 393, - "end": 394, + "start": 431, + "end": 432, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 9 }, "identifierName": "n" @@ -828,15 +828,15 @@ }, "property": { "type": "Identifier", - "start": 395, - "end": 399, + "start": 433, + "end": 437, "loc": { "start": { - "line": 17, + "line": 18, "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 14 }, "identifierName": "left" @@ -845,42 +845,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 400, - "end": 406, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 442, + "end": 446, "loc": { "start": { - "line": 17, - "column": 15 + "line": 18, + "column": 19 }, "end": { - "line": 17, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 18, + "column": 23 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 411, - "end": 416, + "type": "BinaryExpression", + "start": 450, + "end": 473, "loc": { "start": { - "line": 17, - "column": 26 + "line": 18, + "column": 27 }, "end": { - "line": 17, - "column": 31 + "line": 18, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 450, + "end": 463, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 40 + } + }, + "object": { + "type": "MemberExpression", + "start": 450, + "end": 456, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 450, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 28 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 452, + "end": 456, + "loc": { + "start": { + "line": 18, + "column": 29 + }, + "end": { + "line": 18, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 457, + "end": 463, + "loc": { + "start": { + "line": 18, + "column": 34 + }, + "end": { + "line": 18, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "BLACK" + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 468, + "end": 473, + "loc": { + "start": { + "line": 18, + "column": 45 + }, + "end": { + "line": 18, + "column": 50 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -888,43 +985,43 @@ }, { "type": "ExpressionStatement", - "start": 420, - "end": 453, + "start": 477, + "end": 530, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, - "column": 34 + "line": 19, + "column": 54 } }, "expression": { "type": "CallExpression", - "start": 420, - "end": 452, + "start": 477, + "end": 529, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, - "column": 33 + "line": 19, + "column": 53 } }, "callee": { "type": "Identifier", - "start": 420, - "end": 426, + "start": 477, + "end": 483, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 7 }, "identifierName": "assert" @@ -933,58 +1030,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 427, - "end": 451, + "type": "LogicalExpression", + "start": 484, + "end": 528, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, - "column": 32 + "line": 19, + "column": 52 } }, "left": { - "type": "MemberExpression", - "start": 427, - "end": 441, + "type": "BinaryExpression", + "start": 484, + "end": 500, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, - "column": 22 + "line": 19, + "column": 24 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 427, - "end": 434, + "start": 484, + "end": 491, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 15 } }, "object": { "type": "Identifier", - "start": 427, - "end": 428, + "start": 484, + "end": 485, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 9 }, "identifierName": "n" @@ -993,15 +1090,15 @@ }, "property": { "type": "Identifier", - "start": 429, - "end": 434, + "start": 486, + "end": 491, "loc": { "start": { - "line": 18, + "line": 19, "column": 10 }, "end": { - "line": 18, + "line": 19, "column": 15 }, "identifierName": "right" @@ -1010,345 +1107,527 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 435, - "end": 441, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 496, + "end": 500, "loc": { "start": { - "line": 18, - "column": 16 + "line": 19, + "column": 20 }, "end": { - "line": 18, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 19, + "column": 24 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 446, - "end": 451, + "type": "BinaryExpression", + "start": 504, + "end": 528, "loc": { "start": { - "line": 18, - "column": 27 + "line": 19, + "column": 28 }, "end": { - "line": 18, - "column": 32 - }, - "identifierName": "BLACK" + "line": 19, + "column": 52 + } }, - "name": "BLACK" - } - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 25, - "column": 4 + "left": { + "type": "MemberExpression", + "start": 504, + "end": 518, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 504, + "end": 511, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 504, + "end": 505, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 29 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 506, + "end": 511, + "loc": { + "start": { + "line": 19, + "column": 30 + }, + "end": { + "line": 19, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 512, + "end": 518, + "loc": { + "start": { + "line": 19, + "column": 36 + }, + "end": { + "line": 19, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 523, + "end": 528, + "loc": { + "start": { + "line": 19, + "column": 47 + }, + "end": { + "line": 19, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } - } - ] + ] + } }, { - "type": "IfStatement", - "start": 574, - "end": 637, + "type": "ExpressionStatement", + "start": 532, + "end": 558, "loc": { "start": { - "line": 26, + "line": 20, "column": 1 }, "end": { - "line": 27, - "column": 22 + "line": 20, + "column": 27 } }, - "test": { - "type": "BinaryExpression", - "start": 578, - "end": 595, + "expression": { + "type": "CallExpression", + "start": 532, + "end": 557, "loc": { "start": { - "line": 26, - "column": 5 + "line": 20, + "column": 1 }, "end": { - "line": 26, - "column": 22 + "line": 20, + "column": 26 } }, - "left": { - "type": "MemberExpression", - "start": 578, - "end": 586, + "callee": { + "type": "Identifier", + "start": 532, + "end": 538, "loc": { "start": { - "line": 26, - "column": 5 + "line": 20, + "column": 1 }, "end": { - "line": 26, - "column": 13 - } + "line": 20, + "column": 7 + }, + "identifierName": "assert" }, - "object": { - "type": "Identifier", - "start": 578, - "end": 579, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 539, + "end": 556, "loc": { "start": { - "line": 26, - "column": 5 + "line": 20, + "column": 8 }, "end": { - "line": 26, - "column": 6 - }, - "identifierName": "n" + "line": 20, + "column": 25 + } }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 580, - "end": 586, - "loc": { - "start": { - "line": 26, - "column": 7 + "left": { + "type": "MemberExpression", + "start": 539, + "end": 547, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 16 + } }, - "end": { - "line": 26, - "column": 13 + "object": { + "type": "Identifier", + "start": 539, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 541, + "end": 547, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" }, - "identifierName": "parent" + "computed": false }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "NullLiteral", - "start": 591, - "end": 595, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 552, + "end": 556, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + } + } + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 561, + "end": 705, "loc": { "start": { - "line": 26, - "column": 18 + "line": 22, + "column": 1 }, "end": { - "line": 26, - "column": 22 + "line": 30, + "column": 4 } } + } + ] + }, + { + "type": "IfStatement", + "start": 707, + "end": 745, + "loc": { + "start": { + "line": 31, + "column": 1 }, - "leadingComments": null + "end": { + "line": 31, + "column": 39 + } }, - "consequent": { - "type": "ExpressionStatement", - "start": 597, - "end": 614, + "test": { + "type": "BinaryExpression", + "start": 711, + "end": 736, "loc": { "start": { - "line": 26, - "column": 24 + "line": 31, + "column": 5 }, "end": { - "line": 26, - "column": 41 + "line": 31, + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 597, - "end": 613, + "left": { + "type": "MemberExpression", + "start": 711, + "end": 726, "loc": { "start": { - "line": 26, - "column": 24 + "line": 31, + "column": 5 }, "end": { - "line": 26, - "column": 40 + "line": 31, + "column": 20 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 597, - "end": 605, + "start": 711, + "end": 719, "loc": { "start": { - "line": 26, - "column": 24 + "line": 31, + "column": 5 }, "end": { - "line": 26, - "column": 32 + "line": 31, + "column": 13 } }, "object": { "type": "Identifier", - "start": 597, - "end": 598, + "start": 711, + "end": 712, "loc": { "start": { - "line": 26, - "column": 24 + "line": 31, + "column": 5 }, "end": { - "line": 26, - "column": 25 + "line": 31, + "column": 6 }, "identifierName": "n" }, - "name": "n" + "name": "n", + "leadingComments": null }, "property": { "type": "Identifier", - "start": 599, - "end": 605, + "start": 713, + "end": 719, "loc": { "start": { - "line": 26, - "column": 26 + "line": 31, + "column": 7 }, "end": { - "line": 26, - "column": 32 + "line": 31, + "column": 13 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, - "computed": false + "computed": false, + "leadingComments": null }, - "right": { + "property": { "type": "Identifier", - "start": 608, - "end": 613, + "start": 720, + "end": 726, "loc": { "start": { - "line": 26, - "column": 35 + "line": 31, + "column": 14 }, "end": { - "line": 26, - "column": 40 + "line": 31, + "column": 20 }, - "identifierName": "BLACK" + "identifierName": "_color" }, - "name": "BLACK" - } - } + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 731, + "end": 736, + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 30 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null }, - "alternate": { - "type": "ExpressionStatement", - "start": 621, - "end": 637, + "consequent": { + "type": "ReturnStatement", + "start": 738, + "end": 745, "loc": { "start": { - "line": 27, - "column": 6 + "line": 31, + "column": 32 }, "end": { - "line": 27, - "column": 22 + "line": 31, + "column": 39 } }, - "expression": { - "type": "CallExpression", - "start": 621, - "end": 636, + "argument": null + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 561, + "end": 705, "loc": { "start": { - "line": 27, - "column": 6 + "line": 22, + "column": 1 }, "end": { - "line": 27, - "column": 21 + "line": 30, + "column": 4 } - }, - "callee": { - "type": "Identifier", - "start": 621, - "end": 633, - "loc": { - "start": { - "line": 27, - "column": 6 - }, - "end": { - "line": 27, - "column": 18 - }, - "identifierName": "insert_case2" - }, - "name": "insert_case2" - }, - "arguments": [ - { - "type": "Identifier", - "start": 634, - "end": 635, - "loc": { - "start": { - "line": 27, - "column": 19 - }, - "end": { - "line": 27, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 748, + "end": 764, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 17 } }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "expression": { + "type": "CallExpression", + "start": 748, + "end": 763, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 748, + "end": 760, "loc": { "start": { - "line": 19, + "line": 33, "column": 1 }, "end": { - "line": 25, - "column": 4 - } + "line": 33, + "column": 13 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2" + }, + "arguments": [ + { + "type": "Identifier", + "start": 761, + "end": 762, + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" } - } - ] + ] + } } ], "directives": [] @@ -1364,29 +1643,29 @@ }, { "type": "Identifier", - "start": 642, - "end": 670, + "start": 769, + "end": 797, "loc": { "start": { - "line": 30, + "line": 36, "column": 0 }, "end": { - "line": 30, + "line": 36, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 657, - "end": 669, + "start": 784, + "end": 796, "loc": { "start": { - "line": 30, + "line": 36, "column": 15 }, "end": { - "line": 30, + "line": 36, "column": 27 }, "identifierName": "insert_case1" @@ -1399,58 +1678,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 642, - "end": 670, + "start": 769, + "end": 797, "loc": { "start": { - "line": 30, + "line": 36, "column": 0 }, "end": { - "line": 30, + "line": 36, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 300, - "end": 640, + "start": 338, + "end": 767, "loc": { "start": { - "line": 14, + "line": 15, "column": 0 }, "end": { - "line": 28, + "line": 34, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 306, - "end": 639, + "start": 344, + "end": 766, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 28, + "line": 34, "column": 1 } }, "id": { "type": "Identifier", - "start": 306, - "end": 318, + "start": 344, + "end": 356, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "insert_case1" @@ -1460,29 +1739,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 321, - "end": 639, + "start": 359, + "end": 766, "loc": { "start": { - "line": 14, + "line": 15, "column": 21 }, "end": { - "line": 28, + "line": 34, "column": 1 } }, "id": { "type": "Identifier", - "start": 306, - "end": 318, + "start": 344, + "end": 356, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "insert_case1" @@ -1496,15 +1775,15 @@ "params": [ { "type": "Identifier", - "start": 322, - "end": 323, + "start": 360, + "end": 361, "loc": { "start": { - "line": 14, + "line": 15, "column": 22 }, "end": { - "line": 14, + "line": 15, "column": 23 }, "identifierName": "n" @@ -1514,58 +1793,58 @@ ], "body": { "type": "BlockStatement", - "start": 328, - "end": 639, + "start": 366, + "end": 766, "loc": { "start": { - "line": 14, + "line": 15, "column": 28 }, "end": { - "line": 28, + "line": 34, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 331, - "end": 357, + "start": 369, + "end": 395, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 331, - "end": 356, + "start": 369, + "end": 394, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 26 } }, "callee": { "type": "Identifier", - "start": 331, - "end": 337, + "start": 369, + "end": 375, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 7 }, "identifierName": "assert" @@ -1575,29 +1854,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 338, - "end": 355, + "start": 376, + "end": 393, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 25 } }, "left": { "type": "Identifier", - "start": 338, - "end": 339, + "start": 376, + "end": 377, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 9 }, "identifierName": "n" @@ -1607,15 +1886,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 351, - "end": 355, + "start": 389, + "end": 393, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 25 }, "identifierName": "Node" @@ -1628,43 +1907,43 @@ }, { "type": "ExpressionStatement", - "start": 359, - "end": 384, + "start": 397, + "end": 422, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 359, - "end": 383, + "start": 397, + "end": 421, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 25 } }, "callee": { "type": "Identifier", - "start": 359, - "end": 365, + "start": 397, + "end": 403, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 }, "identifierName": "assert" @@ -1674,43 +1953,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 366, - "end": 382, + "start": 404, + "end": 420, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 366, - "end": 374, + "start": 404, + "end": 412, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 16 } }, "object": { "type": "Identifier", - "start": 366, - "end": 367, + "start": 404, + "end": 405, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 }, "identifierName": "n" @@ -1719,15 +1998,15 @@ }, "property": { "type": "Identifier", - "start": 368, - "end": 374, + "start": 406, + "end": 412, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 16 }, "identifierName": "_color" @@ -1739,15 +2018,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 379, - "end": 382, + "start": 417, + "end": 420, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 24 }, "identifierName": "RED" @@ -1760,43 +2039,43 @@ }, { "type": "ExpressionStatement", - "start": 386, - "end": 418, + "start": 424, + "end": 475, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, - "column": 33 + "line": 18, + "column": 52 } }, "expression": { "type": "CallExpression", - "start": 386, - "end": 417, + "start": 424, + "end": 474, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, - "column": 32 + "line": 18, + "column": 51 } }, "callee": { "type": "Identifier", - "start": 386, - "end": 392, + "start": 424, + "end": 430, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 7 }, "identifierName": "assert" @@ -1805,58 +2084,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 393, - "end": 416, + "type": "LogicalExpression", + "start": 431, + "end": 473, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, - "column": 31 + "line": 18, + "column": 50 } }, "left": { - "type": "MemberExpression", - "start": 393, - "end": 406, + "type": "BinaryExpression", + "start": 431, + "end": 446, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, - "column": 21 + "line": 18, + "column": 23 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 393, - "end": 399, + "start": 431, + "end": 437, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 14 } }, "object": { "type": "Identifier", - "start": 393, - "end": 394, + "start": 431, + "end": 432, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 9 }, "identifierName": "n" @@ -1865,15 +2144,15 @@ }, "property": { "type": "Identifier", - "start": 395, - "end": 399, + "start": 433, + "end": 437, "loc": { "start": { - "line": 17, + "line": 18, "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 14 }, "identifierName": "left" @@ -1882,42 +2161,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 400, - "end": 406, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 442, + "end": 446, "loc": { "start": { - "line": 17, - "column": 15 + "line": 18, + "column": 19 }, "end": { - "line": 17, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 18, + "column": 23 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 411, - "end": 416, + "type": "BinaryExpression", + "start": 450, + "end": 473, "loc": { "start": { - "line": 17, - "column": 26 + "line": 18, + "column": 27 }, "end": { - "line": 17, - "column": 31 + "line": 18, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 450, + "end": 463, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 40 + } }, - "identifierName": "BLACK" + "object": { + "type": "MemberExpression", + "start": 450, + "end": 456, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 450, + "end": 451, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 28 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 452, + "end": 456, + "loc": { + "start": { + "line": 18, + "column": 29 + }, + "end": { + "line": 18, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 457, + "end": 463, + "loc": { + "start": { + "line": 18, + "column": 34 + }, + "end": { + "line": 18, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 468, + "end": 473, + "loc": { + "start": { + "line": 18, + "column": 45 + }, + "end": { + "line": 18, + "column": 50 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -1925,43 +2301,43 @@ }, { "type": "ExpressionStatement", - "start": 420, - "end": 453, + "start": 477, + "end": 530, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, - "column": 34 + "line": 19, + "column": 54 } }, "expression": { "type": "CallExpression", - "start": 420, - "end": 452, + "start": 477, + "end": 529, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, - "column": 33 + "line": 19, + "column": 53 } }, "callee": { "type": "Identifier", - "start": 420, - "end": 426, + "start": 477, + "end": 483, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 7 }, "identifierName": "assert" @@ -1970,58 +2346,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 427, - "end": 451, + "type": "LogicalExpression", + "start": 484, + "end": 528, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, - "column": 32 + "line": 19, + "column": 52 } }, "left": { - "type": "MemberExpression", - "start": 427, - "end": 441, + "type": "BinaryExpression", + "start": 484, + "end": 500, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, - "column": 22 + "line": 19, + "column": 24 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 427, - "end": 434, + "start": 484, + "end": 491, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 15 } }, "object": { "type": "Identifier", - "start": 427, - "end": 428, + "start": 484, + "end": 485, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 9 }, "identifierName": "n" @@ -2030,15 +2406,15 @@ }, "property": { "type": "Identifier", - "start": 429, - "end": 434, + "start": 486, + "end": 491, "loc": { "start": { - "line": 18, + "line": 19, "column": 10 }, "end": { - "line": 18, + "line": 19, "column": 15 }, "identifierName": "right" @@ -2047,42 +2423,269 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 435, - "end": 441, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 496, + "end": 500, "loc": { "start": { - "line": 18, - "column": 16 + "line": 19, + "column": 20 }, "end": { - "line": 18, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 19, + "column": 24 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 446, - "end": 451, + "type": "BinaryExpression", + "start": 504, + "end": 528, "loc": { "start": { - "line": 18, - "column": 27 + "line": 19, + "column": 28 }, "end": { - "line": 18, - "column": 32 - }, - "identifierName": "BLACK" + "line": 19, + "column": 52 + } }, - "name": "BLACK" + "left": { + "type": "MemberExpression", + "start": 504, + "end": 518, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 504, + "end": 511, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 504, + "end": 505, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 29 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 506, + "end": 511, + "loc": { + "start": { + "line": 19, + "column": 30 + }, + "end": { + "line": 19, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 512, + "end": 518, + "loc": { + "start": { + "line": 19, + "column": 36 + }, + "end": { + "line": 19, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 523, + "end": 528, + "loc": { + "start": { + "line": 19, + "column": 47 + }, + "end": { + "line": 19, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 532, + "end": 558, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 532, + "end": 557, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 532, + "end": 538, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 539, + "end": 556, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 539, + "end": 547, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 539, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 541, + "end": 547, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 552, + "end": 556, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + } + } } } ] @@ -2090,16 +2693,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 561, + "end": 705, "loc": { "start": { - "line": 19, + "line": 22, "column": 1 }, "end": { - "line": 25, + "line": 30, "column": 4 } } @@ -2108,284 +2711,239 @@ }, { "type": "IfStatement", - "start": 574, - "end": 637, + "start": 707, + "end": 745, "loc": { "start": { - "line": 26, + "line": 31, "column": 1 }, "end": { - "line": 27, - "column": 22 + "line": 31, + "column": 39 } }, "test": { "type": "BinaryExpression", - "start": 578, - "end": 595, + "start": 711, + "end": 736, "loc": { "start": { - "line": 26, + "line": 31, "column": 5 }, "end": { - "line": 26, - "column": 22 + "line": 31, + "column": 30 } }, "left": { "type": "MemberExpression", - "start": 578, - "end": 586, + "start": 711, + "end": 726, "loc": { "start": { - "line": 26, + "line": 31, "column": 5 }, "end": { - "line": 26, - "column": 13 + "line": 31, + "column": 20 } }, "object": { - "type": "Identifier", - "start": 578, - "end": 579, + "type": "MemberExpression", + "start": 711, + "end": 719, "loc": { "start": { - "line": 26, + "line": 31, "column": 5 }, "end": { - "line": 26, - "column": 6 + "line": 31, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 711, + "end": 712, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 6 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n", + "leadingComments": null }, - "name": "n", + "property": { + "type": "Identifier", + "start": 713, + "end": 719, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, "leadingComments": null }, "property": { "type": "Identifier", - "start": 580, - "end": 586, + "start": 720, + "end": 726, "loc": { "start": { - "line": 26, - "column": 7 + "line": 31, + "column": 14 }, "end": { - "line": 26, - "column": 13 + "line": 31, + "column": 20 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false, "leadingComments": null }, "operator": "===", "right": { - "type": "NullLiteral", - "start": 591, - "end": 595, + "type": "Identifier", + "start": 731, + "end": 736, "loc": { "start": { - "line": 26, - "column": 18 + "line": 31, + "column": 25 }, "end": { - "line": 26, - "column": 22 - } - } + "line": 31, + "column": 30 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" }, "leadingComments": null }, "consequent": { - "type": "ExpressionStatement", - "start": 597, - "end": 614, + "type": "ReturnStatement", + "start": 738, + "end": 745, "loc": { "start": { - "line": 26, - "column": 24 + "line": 31, + "column": 32 }, "end": { - "line": 26, - "column": 41 + "line": 31, + "column": 39 } }, - "expression": { - "type": "AssignmentExpression", - "start": 597, - "end": 613, + "argument": null + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 561, + "end": 705, "loc": { "start": { - "line": 26, - "column": 24 + "line": 22, + "column": 1 }, "end": { - "line": 26, - "column": 40 + "line": 30, + "column": 4 } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 597, - "end": 605, - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 32 - } - }, - "object": { - "type": "Identifier", - "start": 597, - "end": 598, - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 25 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 599, - "end": 605, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 32 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 608, - "end": 613, - "loc": { - "start": { - "line": 26, - "column": 35 - }, - "end": { - "line": 26, - "column": 40 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" } } + ] + }, + { + "type": "ExpressionStatement", + "start": 748, + "end": 764, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 17 + } }, - "alternate": { - "type": "ExpressionStatement", - "start": 621, - "end": 637, + "expression": { + "type": "CallExpression", + "start": 748, + "end": 763, "loc": { "start": { - "line": 27, - "column": 6 + "line": 33, + "column": 1 }, "end": { - "line": 27, - "column": 22 + "line": 33, + "column": 16 } }, - "expression": { - "type": "CallExpression", - "start": 621, - "end": 636, + "callee": { + "type": "Identifier", + "start": 748, + "end": 760, "loc": { "start": { - "line": 27, - "column": 6 + "line": 33, + "column": 1 }, "end": { - "line": 27, - "column": 21 - } + "line": 33, + "column": 13 + }, + "identifierName": "insert_case2" }, - "callee": { + "name": "insert_case2" + }, + "arguments": [ + { "type": "Identifier", - "start": 621, - "end": 633, + "start": 761, + "end": 762, "loc": { "start": { - "line": 27, - "column": 6 + "line": 33, + "column": 14 }, "end": { - "line": 27, - "column": 18 + "line": 33, + "column": 15 }, - "identifierName": "insert_case2" + "identifierName": "n" }, - "name": "insert_case2" - }, - "arguments": [ - { - "type": "Identifier", - "start": 634, - "end": 635, - "loc": { - "start": { - "line": 27, - "column": 19 - }, - "end": { - "line": 27, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 25, - "column": 4 - } + "name": "n" } - } - ] + ] + } } ], "directives": [] @@ -2398,16 +2956,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", "start": 187, - "end": 299, + "end": 337, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -2416,48 +2974,756 @@ "trailingComments": [] } } - ], - "directives": [] - }, - "comments": [ + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "start": 187, + "end": 337, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 14, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 561, + "end": 705, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 30, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case2", + "start": 147, + "end": 159, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 160, + "end": 164, + "loc": { + "start": { + "line": 5, + "column": 20 + }, + "end": { + "line": 5, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case2.js", + "start": 165, + "end": 184, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 184, + "end": 185, + "loc": { + "start": { + "line": 5, + "column": 44 + }, + "end": { + "line": 5, + "column": 45 + } + } + }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", "start": 187, - "end": 299, + "end": 337, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 338, + "end": 343, "loc": { "start": { - "line": 19, - "column": 1 + "line": 15, + "column": 0 }, "end": { - "line": 25, - "column": 4 + "line": 15, + "column": 5 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2465,27 +3731,53 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "value": "insert_case1", + "start": 344, + "end": 356, + "loc": { + "start": { + "line": 15, + "column": 6 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "=", + "start": 357, + "end": 358, "loc": { "start": { - "line": 1, - "column": 0 + "line": 15, + "column": 19 }, "end": { - "line": 1, - "column": 6 + "line": 15, + "column": 20 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2494,17 +3786,16 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 7, - "end": 13, + "start": 359, + "end": 360, "loc": { "start": { - "line": 1, - "column": 7 + "line": 15, + "column": 21 }, "end": { - "line": 1, - "column": 13 + "line": 15, + "column": 22 } } }, @@ -2520,50 +3811,48 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 14, - "end": 18, + "value": "n", + "start": 360, + "end": 361, "loc": { "start": { - "line": 1, - "column": 14 + "line": 15, + "column": 22 }, "end": { - "line": 1, - "column": 18 + "line": 15, + "column": 23 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "assert", - "start": 19, - "end": 27, + "start": 361, + "end": 362, "loc": { "start": { - "line": 1, - "column": 19 + "line": 15, + "column": 23 }, "end": { - "line": 1, - "column": 27 + "line": 15, + "column": 24 } } }, { "type": { - "label": ";", + "label": "=>", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2574,44 +3863,41 @@ "binop": null, "updateContext": null }, - "start": 27, - "end": 28, + "start": 363, + "end": 365, "loc": { "start": { - "line": 1, - "column": 27 + "line": 15, + "column": 25 }, "end": { - "line": 1, - "column": 28 + "line": 15, + "column": 27 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 29, - "end": 35, + "start": 366, + "end": 367, "loc": { "start": { - "line": 2, - "column": 0 + "line": 15, + "column": 28 }, "end": { - "line": 2, - "column": 6 + "line": 15, + "column": 29 } } }, @@ -2627,24 +3913,24 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 36, - "end": 40, + "value": "assert", + "start": 369, + "end": 375, "loc": { "start": { - "line": 2, - "column": 7 + "line": 16, + "column": 1 }, "end": { - "line": 2, - "column": 11 + "line": 16, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2653,23 +3939,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 41, - "end": 45, + "start": 375, + "end": 376, "loc": { "start": { - "line": 2, - "column": 12 + "line": 16, + "column": 7 }, "end": { - "line": 2, - "column": 16 + "line": 16, + "column": 8 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2677,26 +3962,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../types/Node.js", - "start": 46, - "end": 64, + "value": "n", + "start": 376, + "end": 377, "loc": { "start": { - "line": 2, - "column": 17 + "line": 16, + "column": 8 }, "end": { - "line": 2, - "column": 35 + "line": 16, + "column": 9 } } }, { "type": { - "label": ";", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2704,26 +3989,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 64, - "end": 65, + "value": "instanceof", + "start": 378, + "end": 388, "loc": { "start": { - "line": 2, - "column": 35 + "line": 16, + "column": 10 }, "end": { - "line": 2, - "column": 36 + "line": 16, + "column": 20 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2731,28 +4016,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 66, - "end": 72, + "value": "Node", + "start": 389, + "end": 393, "loc": { "start": { - "line": 3, - "column": 0 + "line": 16, + "column": 21 }, "end": { - "line": 3, - "column": 6 + "line": 16, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2760,49 +4044,48 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 73, - "end": 78, + "start": 393, + "end": 394, "loc": { "start": { - "line": 3, - "column": 7 + "line": 16, + "column": 25 }, "end": { - "line": 3, - "column": 12 + "line": 16, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 79, - "end": 83, + "start": 394, + "end": 395, "loc": { "start": { - "line": 3, - "column": 13 + "line": 16, + "column": 26 }, "end": { - "line": 3, - "column": 17 + "line": 16, + "column": 27 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2810,53 +4093,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/BLACK.js", - "start": 84, - "end": 103, + "value": "assert", + "start": 397, + "end": 403, "loc": { "start": { - "line": 3, - "column": 18 + "line": 17, + "column": 1 }, "end": { - "line": 3, - "column": 37 + "line": 17, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 103, - "end": 104, + "start": 403, + "end": 404, "loc": { "start": { - "line": 3, - "column": 37 + "line": 17, + "column": 7 }, "end": { - "line": 3, - "column": 38 + "line": 17, + "column": 8 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2864,45 +4144,44 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 105, - "end": 111, + "value": "n", + "start": 404, + "end": 405, "loc": { "start": { - "line": 4, - "column": 0 + "line": 17, + "column": 8 }, "end": { - "line": 4, - "column": 6 + "line": 17, + "column": 9 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 112, - "end": 115, + "start": 405, + "end": 406, "loc": { "start": { - "line": 4, - "column": 7 + "line": 17, + "column": 9 }, "end": { - "line": 4, + "line": 17, "column": 10 } } @@ -2919,124 +4198,121 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 116, - "end": 120, + "value": "_color", + "start": 406, + "end": 412, "loc": { "start": { - "line": 4, - "column": 11 + "line": 17, + "column": 10 }, "end": { - "line": 4, - "column": 15 + "line": 17, + "column": 16 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "../color/RED.js", - "start": 121, - "end": 138, + "value": "===", + "start": 413, + "end": 416, "loc": { "start": { - "line": 4, - "column": 16 + "line": 17, + "column": 17 }, "end": { - "line": 4, - "column": 33 + "line": 17, + "column": 20 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 138, - "end": 139, + "value": "RED", + "start": 417, + "end": 420, "loc": { "start": { - "line": 4, - "column": 33 + "line": 17, + "column": 21 }, "end": { - "line": 4, - "column": 34 + "line": 17, + "column": 24 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 140, - "end": 146, + "start": 420, + "end": 421, "loc": { "start": { - "line": 5, - "column": 0 + "line": 17, + "column": 24 }, "end": { - "line": 5, - "column": 6 + "line": 17, + "column": 25 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "insert_case2", - "start": 147, - "end": 159, + "start": 421, + "end": 422, "loc": { "start": { - "line": 5, - "column": 7 + "line": 17, + "column": 25 }, "end": { - "line": 5, - "column": 19 + "line": 17, + "column": 26 } } }, @@ -3052,93 +4328,74 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 160, - "end": 164, + "value": "assert", + "start": 424, + "end": 430, "loc": { "start": { - "line": 5, - "column": 20 + "line": 18, + "column": 1 }, "end": { - "line": 5, - "column": 24 + "line": 18, + "column": 7 } } }, { "type": { - "label": "string", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./insert_case2.js", - "start": 165, - "end": 184, + "start": 430, + "end": 431, "loc": { "start": { - "line": 5, - "column": 25 + "line": 18, + "column": 7 }, "end": { - "line": 5, - "column": 44 + "line": 18, + "column": 8 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 184, - "end": 185, - "loc": { - "start": { - "line": 5, - "column": 44 - }, - "end": { - "line": 5, - "column": 45 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", - "start": 187, - "end": 299, + "value": "n", + "start": 431, + "end": 432, "loc": { "start": { - "line": 7, - "column": 0 + "line": 18, + "column": 8 }, "end": { - "line": 13, - "column": 3 + "line": 18, + "column": 9 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3149,17 +4406,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 300, - "end": 305, + "start": 432, + "end": 433, "loc": { "start": { - "line": 14, - "column": 0 + "line": 18, + "column": 9 }, "end": { - "line": 14, - "column": 5 + "line": 18, + "column": 10 } } }, @@ -3175,103 +4431,107 @@ "postfix": false, "binop": null }, - "value": "insert_case1", - "start": 306, - "end": 318, + "value": "left", + "start": 433, + "end": 437, "loc": { "start": { - "line": 14, - "column": 6 + "line": 18, + "column": 10 }, "end": { - "line": 14, - "column": 18 + "line": 18, + "column": 14 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 319, - "end": 320, + "value": "===", + "start": 438, + "end": 441, "loc": { "start": { - "line": 14, - "column": 19 + "line": 18, + "column": 15 }, "end": { - "line": 14, - "column": 20 + "line": 18, + "column": 18 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "null", + "keyword": "null", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 321, - "end": 322, + "value": "null", + "start": 442, + "end": 446, "loc": { "start": { - "line": 14, - "column": 21 + "line": 18, + "column": 19 }, "end": { - "line": 14, - "column": 22 + "line": 18, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "||", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 1, + "updateContext": null }, - "value": "n", - "start": 322, - "end": 323, + "value": "||", + "start": 447, + "end": 449, "loc": { "start": { - "line": 14, - "column": 22 + "line": 18, + "column": 24 }, "end": { - "line": 14, - "column": 23 + "line": 18, + "column": 26 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3279,23 +4539,24 @@ "postfix": false, "binop": null }, - "start": 323, - "end": 324, + "value": "n", + "start": 450, + "end": 451, "loc": { "start": { - "line": 14, - "column": 23 + "line": 18, + "column": 27 }, "end": { - "line": 14, - "column": 24 + "line": 18, + "column": 28 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3305,40 +4566,15 @@ "binop": null, "updateContext": null }, - "start": 325, - "end": 327, - "loc": { - "start": { - "line": 14, - "column": 25 - }, - "end": { - "line": 14, - "column": 27 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 328, - "end": 329, + "start": 451, + "end": 452, "loc": { "start": { - "line": 14, + "line": 18, "column": 28 }, "end": { - "line": 14, + "line": 18, "column": 29 } } @@ -3355,42 +4591,43 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 331, - "end": 337, + "value": "left", + "start": 452, + "end": 456, "loc": { "start": { - "line": 15, - "column": 1 + "line": 18, + "column": 29 }, "end": { - "line": 15, - "column": 7 + "line": 18, + "column": 33 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 337, - "end": 338, + "start": 456, + "end": 457, "loc": { "start": { - "line": 15, - "column": 7 + "line": 18, + "column": 33 }, "end": { - "line": 15, - "column": 8 + "line": 18, + "column": 34 } } }, @@ -3406,24 +4643,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 338, - "end": 339, + "value": "_color", + "start": 457, + "end": 463, "loc": { "start": { - "line": 15, - "column": 8 + "line": 18, + "column": 34 }, "end": { - "line": 15, - "column": 9 + "line": 18, + "column": 40 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3431,20 +4667,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": 6, "updateContext": null }, - "value": "instanceof", - "start": 340, - "end": 350, + "value": "===", + "start": 464, + "end": 467, "loc": { "start": { - "line": 15, - "column": 10 + "line": 18, + "column": 41 }, "end": { - "line": 15, - "column": 20 + "line": 18, + "column": 44 } } }, @@ -3460,17 +4696,17 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 351, - "end": 355, + "value": "BLACK", + "start": 468, + "end": 473, "loc": { "start": { - "line": 15, - "column": 21 + "line": 18, + "column": 45 }, "end": { - "line": 15, - "column": 25 + "line": 18, + "column": 50 } } }, @@ -3486,16 +4722,16 @@ "postfix": false, "binop": null }, - "start": 355, - "end": 356, + "start": 473, + "end": 474, "loc": { "start": { - "line": 15, - "column": 25 + "line": 18, + "column": 50 }, - "end": { - "line": 15, - "column": 26 + "end": { + "line": 18, + "column": 51 } } }, @@ -3512,16 +4748,16 @@ "binop": null, "updateContext": null }, - "start": 356, - "end": 357, + "start": 474, + "end": 475, "loc": { "start": { - "line": 15, - "column": 26 + "line": 18, + "column": 51 }, "end": { - "line": 15, - "column": 27 + "line": 18, + "column": 52 } } }, @@ -3538,15 +4774,15 @@ "binop": null }, "value": "assert", - "start": 359, - "end": 365, + "start": 477, + "end": 483, "loc": { "start": { - "line": 16, + "line": 19, "column": 1 }, "end": { - "line": 16, + "line": 19, "column": 7 } } @@ -3563,15 +4799,15 @@ "postfix": false, "binop": null }, - "start": 365, - "end": 366, + "start": 483, + "end": 484, "loc": { "start": { - "line": 16, + "line": 19, "column": 7 }, "end": { - "line": 16, + "line": 19, "column": 8 } } @@ -3589,15 +4825,15 @@ "binop": null }, "value": "n", - "start": 366, - "end": 367, + "start": 484, + "end": 485, "loc": { "start": { - "line": 16, + "line": 19, "column": 8 }, "end": { - "line": 16, + "line": 19, "column": 9 } } @@ -3615,15 +4851,15 @@ "binop": null, "updateContext": null }, - "start": 367, - "end": 368, + "start": 485, + "end": 486, "loc": { "start": { - "line": 16, + "line": 19, "column": 9 }, "end": { - "line": 16, + "line": 19, "column": 10 } } @@ -3640,17 +4876,17 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 368, - "end": 374, + "value": "right", + "start": 486, + "end": 491, "loc": { "start": { - "line": 16, + "line": 19, "column": 10 }, "end": { - "line": 16, - "column": 16 + "line": 19, + "column": 15 } } }, @@ -3668,22 +4904,23 @@ "updateContext": null }, "value": "===", - "start": 375, - "end": 378, + "start": 492, + "end": 495, "loc": { "start": { - "line": 16, - "column": 17 + "line": 19, + "column": 16 }, "end": { - "line": 16, - "column": 20 + "line": 19, + "column": 19 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3691,50 +4928,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 379, - "end": 382, + "value": "null", + "start": 496, + "end": 500, "loc": { "start": { - "line": 16, - "column": 21 + "line": 19, + "column": 20 }, "end": { - "line": 16, - "column": 24 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 382, - "end": 383, - "loc": { - "start": { - "line": 16, + "line": 19, "column": 24 - }, - "end": { - "line": 16, - "column": 25 } } }, { "type": { - "label": ";", + "label": "||", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3742,70 +4955,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "start": 383, - "end": 384, + "value": "||", + "start": 501, + "end": 503, "loc": { "start": { - "line": 16, + "line": 19, "column": 25 }, "end": { - "line": 16, - "column": 26 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 386, - "end": 392, - "loc": { - "start": { - "line": 17, - "column": 1 - }, - "end": { - "line": 17, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 392, - "end": 393, - "loc": { - "start": { - "line": 17, - "column": 7 - }, - "end": { - "line": 17, - "column": 8 + "line": 19, + "column": 27 } } }, @@ -3822,16 +4985,16 @@ "binop": null }, "value": "n", - "start": 393, - "end": 394, + "start": 504, + "end": 505, "loc": { "start": { - "line": 17, - "column": 8 + "line": 19, + "column": 28 }, "end": { - "line": 17, - "column": 9 + "line": 19, + "column": 29 } } }, @@ -3848,16 +5011,16 @@ "binop": null, "updateContext": null }, - "start": 394, - "end": 395, + "start": 505, + "end": 506, "loc": { "start": { - "line": 17, - "column": 9 + "line": 19, + "column": 29 }, "end": { - "line": 17, - "column": 10 + "line": 19, + "column": 30 } } }, @@ -3873,17 +5036,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 395, - "end": 399, + "value": "right", + "start": 506, + "end": 511, "loc": { "start": { - "line": 17, - "column": 10 + "line": 19, + "column": 30 }, "end": { - "line": 17, - "column": 14 + "line": 19, + "column": 35 } } }, @@ -3900,16 +5063,16 @@ "binop": null, "updateContext": null }, - "start": 399, - "end": 400, + "start": 511, + "end": 512, "loc": { "start": { - "line": 17, - "column": 14 + "line": 19, + "column": 35 }, "end": { - "line": 17, - "column": 15 + "line": 19, + "column": 36 } } }, @@ -3926,16 +5089,16 @@ "binop": null }, "value": "_color", - "start": 400, - "end": 406, + "start": 512, + "end": 518, "loc": { "start": { - "line": 17, - "column": 15 + "line": 19, + "column": 36 }, "end": { - "line": 17, - "column": 21 + "line": 19, + "column": 42 } } }, @@ -3953,16 +5116,16 @@ "updateContext": null }, "value": "===", - "start": 407, - "end": 410, + "start": 519, + "end": 522, "loc": { "start": { - "line": 17, - "column": 22 + "line": 19, + "column": 43 }, "end": { - "line": 17, - "column": 25 + "line": 19, + "column": 46 } } }, @@ -3979,16 +5142,16 @@ "binop": null }, "value": "BLACK", - "start": 411, - "end": 416, + "start": 523, + "end": 528, "loc": { "start": { - "line": 17, - "column": 26 + "line": 19, + "column": 47 }, "end": { - "line": 17, - "column": 31 + "line": 19, + "column": 52 } } }, @@ -4004,16 +5167,16 @@ "postfix": false, "binop": null }, - "start": 416, - "end": 417, + "start": 528, + "end": 529, "loc": { "start": { - "line": 17, - "column": 31 + "line": 19, + "column": 52 }, "end": { - "line": 17, - "column": 32 + "line": 19, + "column": 53 } } }, @@ -4030,67 +5193,16 @@ "binop": null, "updateContext": null }, - "start": 417, - "end": 418, - "loc": { - "start": { - "line": 17, - "column": 32 - }, - "end": { - "line": 17, - "column": 33 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 420, - "end": 426, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 426, - "end": 427, + "start": 529, + "end": 530, "loc": { "start": { - "line": 18, - "column": 7 + "line": 19, + "column": 53 }, "end": { - "line": 18, - "column": 8 + "line": 19, + "column": 54 } } }, @@ -4106,43 +5218,42 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 427, - "end": 428, + "value": "assert", + "start": 532, + "end": 538, "loc": { "start": { - "line": 18, - "column": 8 + "line": 20, + "column": 1 }, "end": { - "line": 18, - "column": 9 + "line": 20, + "column": 7 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 428, - "end": 429, + "start": 538, + "end": 539, "loc": { "start": { - "line": 18, - "column": 9 + "line": 20, + "column": 7 }, "end": { - "line": 18, - "column": 10 + "line": 20, + "column": 8 } } }, @@ -4158,17 +5269,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 429, - "end": 434, + "value": "n", + "start": 539, + "end": 540, "loc": { "start": { - "line": 18, - "column": 10 + "line": 20, + "column": 8 }, "end": { - "line": 18, - "column": 15 + "line": 20, + "column": 9 } } }, @@ -4185,16 +5296,16 @@ "binop": null, "updateContext": null }, - "start": 434, - "end": 435, + "start": 540, + "end": 541, "loc": { "start": { - "line": 18, - "column": 15 + "line": 20, + "column": 9 }, "end": { - "line": 18, - "column": 16 + "line": 20, + "column": 10 } } }, @@ -4210,17 +5321,17 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 435, - "end": 441, + "value": "parent", + "start": 541, + "end": 547, "loc": { "start": { - "line": 18, - "column": 16 + "line": 20, + "column": 10 }, "end": { - "line": 18, - "column": 22 + "line": 20, + "column": 16 } } }, @@ -4237,23 +5348,24 @@ "binop": 6, "updateContext": null }, - "value": "===", - "start": 442, - "end": 445, + "value": "!==", + "start": 548, + "end": 551, "loc": { "start": { - "line": 18, - "column": 23 + "line": 20, + "column": 17 }, "end": { - "line": 18, - "column": 26 + "line": 20, + "column": 20 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4261,19 +5373,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "BLACK", - "start": 446, - "end": 451, + "value": "null", + "start": 552, + "end": 556, "loc": { "start": { - "line": 18, - "column": 27 + "line": 20, + "column": 21 }, "end": { - "line": 18, - "column": 32 + "line": 20, + "column": 25 } } }, @@ -4289,16 +5402,16 @@ "postfix": false, "binop": null }, - "start": 451, - "end": 452, + "start": 556, + "end": 557, "loc": { "start": { - "line": 18, - "column": 32 + "line": 20, + "column": 25 }, "end": { - "line": 18, - "column": 33 + "line": 20, + "column": 26 } } }, @@ -4315,31 +5428,31 @@ "binop": null, "updateContext": null }, - "start": 452, - "end": 453, + "start": 557, + "end": 558, "loc": { "start": { - "line": 18, - "column": 33 + "line": 20, + "column": 26 }, "end": { - "line": 18, - "column": 34 + "line": 20, + "column": 27 } } }, { "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 561, + "end": 705, "loc": { "start": { - "line": 19, + "line": 22, "column": 1 }, "end": { - "line": 25, + "line": 30, "column": 4 } } @@ -4359,15 +5472,15 @@ "updateContext": null }, "value": "if", - "start": 574, - "end": 576, + "start": 707, + "end": 709, "loc": { "start": { - "line": 26, + "line": 31, "column": 1 }, "end": { - "line": 26, + "line": 31, "column": 3 } } @@ -4384,15 +5497,15 @@ "postfix": false, "binop": null }, - "start": 577, - "end": 578, + "start": 710, + "end": 711, "loc": { "start": { - "line": 26, + "line": 31, "column": 4 }, "end": { - "line": 26, + "line": 31, "column": 5 } } @@ -4410,15 +5523,15 @@ "binop": null }, "value": "n", - "start": 578, - "end": 579, + "start": 711, + "end": 712, "loc": { "start": { - "line": 26, + "line": 31, "column": 5 }, "end": { - "line": 26, + "line": 31, "column": 6 } } @@ -4436,15 +5549,15 @@ "binop": null, "updateContext": null }, - "start": 579, - "end": 580, + "start": 712, + "end": 713, "loc": { "start": { - "line": 26, + "line": 31, "column": 6 }, "end": { - "line": 26, + "line": 31, "column": 7 } } @@ -4462,52 +5575,24 @@ "binop": null }, "value": "parent", - "start": 580, - "end": 586, + "start": 713, + "end": 719, "loc": { "start": { - "line": 26, + "line": 31, "column": 7 }, "end": { - "line": 26, + "line": 31, "column": 13 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 587, - "end": 590, - "loc": { - "start": { - "line": 26, - "column": 14 - }, - "end": { - "line": 26, - "column": 17 - } - } - }, - { - "type": { - "label": "null", - "keyword": "null", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4516,42 +5601,16 @@ "binop": null, "updateContext": null }, - "value": "null", - "start": 591, - "end": 595, - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 22 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 595, - "end": 596, + "start": 719, + "end": 720, "loc": { "start": { - "line": 26, - "column": 22 + "line": 31, + "column": 13 }, "end": { - "line": 26, - "column": 23 + "line": 31, + "column": 14 } } }, @@ -4567,43 +5626,44 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 597, - "end": 598, + "value": "_color", + "start": 720, + "end": 726, "loc": { "start": { - "line": 26, - "column": 24 + "line": 31, + "column": 14 }, "end": { - "line": 26, - "column": 25 + "line": 31, + "column": 20 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 598, - "end": 599, + "value": "===", + "start": 727, + "end": 730, "loc": { "start": { - "line": 26, - "column": 25 + "line": 31, + "column": 21 }, "end": { - "line": 26, - "column": 26 + "line": 31, + "column": 24 } } }, @@ -4619,52 +5679,25 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 599, - "end": 605, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 32 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 606, - "end": 607, + "value": "BLACK", + "start": 731, + "end": 736, "loc": { "start": { - "line": 26, - "column": 33 + "line": 31, + "column": 25 }, "end": { - "line": 26, - "column": 34 + "line": 31, + "column": 30 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4672,23 +5705,23 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 608, - "end": 613, + "start": 736, + "end": 737, "loc": { "start": { - "line": 26, - "column": 35 + "line": 31, + "column": 30 }, "end": { - "line": 26, - "column": 40 + "line": 31, + "column": 31 } } }, { "type": { - "label": ";", + "label": "return", + "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4699,23 +5732,23 @@ "binop": null, "updateContext": null }, - "start": 613, - "end": 614, + "value": "return", + "start": 738, + "end": 744, "loc": { "start": { - "line": 26, - "column": 40 + "line": 31, + "column": 32 }, "end": { - "line": 26, - "column": 41 + "line": 31, + "column": 38 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4726,17 +5759,16 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 616, - "end": 620, + "start": 744, + "end": 745, "loc": { "start": { - "line": 27, - "column": 1 + "line": 31, + "column": 38 }, "end": { - "line": 27, - "column": 5 + "line": 31, + "column": 39 } } }, @@ -4753,16 +5785,16 @@ "binop": null }, "value": "insert_case2", - "start": 621, - "end": 633, + "start": 748, + "end": 760, "loc": { "start": { - "line": 27, - "column": 6 + "line": 33, + "column": 1 }, "end": { - "line": 27, - "column": 18 + "line": 33, + "column": 13 } } }, @@ -4778,16 +5810,16 @@ "postfix": false, "binop": null }, - "start": 633, - "end": 634, + "start": 760, + "end": 761, "loc": { "start": { - "line": 27, - "column": 18 + "line": 33, + "column": 13 }, "end": { - "line": 27, - "column": 19 + "line": 33, + "column": 14 } } }, @@ -4804,16 +5836,16 @@ "binop": null }, "value": "n", - "start": 634, - "end": 635, + "start": 761, + "end": 762, "loc": { "start": { - "line": 27, - "column": 19 + "line": 33, + "column": 14 }, "end": { - "line": 27, - "column": 20 + "line": 33, + "column": 15 } } }, @@ -4829,16 +5861,16 @@ "postfix": false, "binop": null }, - "start": 635, - "end": 636, + "start": 762, + "end": 763, "loc": { "start": { - "line": 27, - "column": 20 + "line": 33, + "column": 15 }, "end": { - "line": 27, - "column": 21 + "line": 33, + "column": 16 } } }, @@ -4855,16 +5887,16 @@ "binop": null, "updateContext": null }, - "start": 636, - "end": 637, + "start": 763, + "end": 764, "loc": { "start": { - "line": 27, - "column": 21 + "line": 33, + "column": 16 }, "end": { - "line": 27, - "column": 22 + "line": 33, + "column": 17 } } }, @@ -4880,15 +5912,15 @@ "postfix": false, "binop": null }, - "start": 638, - "end": 639, + "start": 765, + "end": 766, "loc": { "start": { - "line": 28, + "line": 34, "column": 0 }, "end": { - "line": 28, + "line": 34, "column": 1 } } @@ -4906,15 +5938,15 @@ "binop": null, "updateContext": null }, - "start": 639, - "end": 640, + "start": 766, + "end": 767, "loc": { "start": { - "line": 28, + "line": 34, "column": 1 }, "end": { - "line": 28, + "line": 34, "column": 2 } } @@ -4934,15 +5966,15 @@ "updateContext": null }, "value": "export", - "start": 642, - "end": 648, + "start": 769, + "end": 775, "loc": { "start": { - "line": 30, + "line": 36, "column": 0 }, "end": { - "line": 30, + "line": 36, "column": 6 } } @@ -4962,15 +5994,15 @@ "updateContext": null }, "value": "default", - "start": 649, - "end": 656, + "start": 776, + "end": 783, "loc": { "start": { - "line": 30, + "line": 36, "column": 7 }, "end": { - "line": 30, + "line": 36, "column": 14 } } @@ -4988,15 +6020,15 @@ "binop": null }, "value": "insert_case1", - "start": 657, - "end": 669, + "start": 784, + "end": 796, "loc": { "start": { - "line": 30, + "line": 36, "column": 15 }, "end": { - "line": 30, + "line": 36, "column": 27 } } @@ -5014,15 +6046,15 @@ "binop": null, "updateContext": null }, - "start": 669, - "end": 670, + "start": 796, + "end": 797, "loc": { "start": { - "line": 30, + "line": 36, "column": 27 }, "end": { - "line": 30, + "line": 36, "column": 28 } } @@ -5040,15 +6072,15 @@ "binop": null, "updateContext": null }, - "start": 671, - "end": 671, + "start": 798, + "end": 798, "loc": { "start": { - "line": 31, + "line": 37, "column": 0 }, "end": { - "line": 31, + "line": 37, "column": 0 } } diff --git a/ast/source/insertion/insert_case2.js.json b/ast/source/insertion/insert_case2.js.json index 3cfb841..a54ebd0 100644 --- a/ast/source/insertion/insert_case2.js.json +++ b/ast/source/insertion/insert_case2.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 759, + "end": 1516, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 37, + "line": 53, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 759, + "end": 1516, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 37, + "line": 53, "column": 0 } }, @@ -307,7 +307,7 @@ { "type": "ImportDeclaration", "start": 140, - "end": 185, + "end": 179, "loc": { "start": { "line": 5, @@ -315,14 +315,14 @@ }, "end": { "line": 5, - "column": 45 + "column": 39 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 147, - "end": 159, + "end": 152, "loc": { "start": { "line": 5, @@ -330,13 +330,13 @@ }, "end": { "line": 5, - "column": 19 + "column": 12 } }, "local": { "type": "Identifier", "start": 147, - "end": 159, + "end": 152, "loc": { "start": { "line": 5, @@ -344,6 +344,213 @@ }, "end": { "line": 5, + "column": 12 + }, + "identifierName": "uncle" + }, + "name": "uncle" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 158, + "end": 178, + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 38 + } + }, + "extra": { + "rawValue": "../family/uncle.js", + "raw": "'../family/uncle.js'" + }, + "value": "../family/uncle.js" + } + }, + { + "type": "ImportDeclaration", + "start": 180, + "end": 231, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 51 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 187, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + } + }, + "local": { + "type": "Identifier", + "start": 187, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 204, + "end": 230, + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 50 + } + }, + "extra": { + "rawValue": "../family/grandparent.js", + "raw": "'../family/grandparent.js'" + }, + "value": "../family/grandparent.js" + } + }, + { + "type": "ImportDeclaration", + "start": 232, + "end": 277, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 239, + "end": 251, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 239, + "end": 251, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + }, + "identifierName": "insert_case0" + }, + "name": "insert_case0" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 257, + "end": 276, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 44 + } + }, + "extra": { + "rawValue": "./insert_case0.js", + "raw": "'./insert_case0.js'" + }, + "value": "./insert_case0.js" + } + }, + { + "type": "ImportDeclaration", + "start": 278, + "end": 323, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 285, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 285, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, "column": 19 }, "identifierName": "insert_case3" @@ -354,15 +561,15 @@ ], "source": { "type": "StringLiteral", - "start": 165, - "end": 184, + "start": 303, + "end": 322, "loc": { "start": { - "line": 5, + "line": 8, "column": 25 }, "end": { - "line": 5, + "line": 8, "column": 44 } }, @@ -375,16 +582,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 187, - "end": 337, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "start": 325, + "end": 501, "loc": { "start": { - "line": 7, + "line": 10, "column": 0 }, "end": { - "line": 14, + "line": 18, "column": 3 } } @@ -393,44 +600,44 @@ }, { "type": "Identifier", - "start": 338, - "end": 728, + "start": 502, + "end": 1485, "loc": { "start": { - "line": 15, + "line": 19, "column": 0 }, "end": { - "line": 34, + "line": 50, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 344, - "end": 727, + "start": 508, + "end": 1484, "loc": { "start": { - "line": 15, + "line": 19, "column": 6 }, "end": { - "line": 34, + "line": 50, "column": 1 } }, "id": { "type": "Identifier", - "start": 344, - "end": 356, + "start": 508, + "end": 520, "loc": { "start": { - "line": 15, + "line": 19, "column": 6 }, "end": { - "line": 15, + "line": 19, "column": 18 }, "identifierName": "insert_case2" @@ -440,15 +647,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 359, - "end": 727, + "start": 523, + "end": 1484, "loc": { "start": { - "line": 15, + "line": 19, "column": 21 }, "end": { - "line": 34, + "line": 50, "column": 1 } }, @@ -459,15 +666,15 @@ "params": [ { "type": "Identifier", - "start": 360, - "end": 361, + "start": 524, + "end": 525, "loc": { "start": { - "line": 15, + "line": 19, "column": 22 }, "end": { - "line": 15, + "line": 19, "column": 23 }, "identifierName": "n" @@ -477,58 +684,58 @@ ], "body": { "type": "BlockStatement", - "start": 366, - "end": 727, + "start": 530, + "end": 1484, "loc": { "start": { - "line": 15, + "line": 19, "column": 28 }, "end": { - "line": 34, + "line": 50, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 369, - "end": 395, + "start": 533, + "end": 559, "loc": { "start": { - "line": 16, + "line": 20, "column": 1 }, "end": { - "line": 16, + "line": 20, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 369, - "end": 394, + "start": 533, + "end": 558, "loc": { "start": { - "line": 16, + "line": 20, "column": 1 }, "end": { - "line": 16, + "line": 20, "column": 26 } }, "callee": { "type": "Identifier", - "start": 369, - "end": 375, + "start": 533, + "end": 539, "loc": { "start": { - "line": 16, + "line": 20, "column": 1 }, "end": { - "line": 16, + "line": 20, "column": 7 }, "identifierName": "assert" @@ -538,29 +745,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 376, - "end": 393, + "start": 540, + "end": 557, "loc": { "start": { - "line": 16, + "line": 20, "column": 8 }, "end": { - "line": 16, + "line": 20, "column": 25 } }, "left": { "type": "Identifier", - "start": 376, - "end": 377, + "start": 540, + "end": 541, "loc": { "start": { - "line": 16, + "line": 20, "column": 8 }, "end": { - "line": 16, + "line": 20, "column": 9 }, "identifierName": "n" @@ -570,15 +777,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 389, - "end": 393, + "start": 553, + "end": 557, "loc": { "start": { - "line": 16, + "line": 20, "column": 21 }, "end": { - "line": 16, + "line": 20, "column": 25 }, "identifierName": "Node" @@ -591,43 +798,43 @@ }, { "type": "ExpressionStatement", - "start": 397, - "end": 422, + "start": 561, + "end": 586, "loc": { "start": { - "line": 17, + "line": 21, "column": 1 }, "end": { - "line": 17, + "line": 21, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 397, - "end": 421, + "start": 561, + "end": 585, "loc": { "start": { - "line": 17, + "line": 21, "column": 1 }, "end": { - "line": 17, + "line": 21, "column": 25 } }, "callee": { "type": "Identifier", - "start": 397, - "end": 403, + "start": 561, + "end": 567, "loc": { "start": { - "line": 17, + "line": 21, "column": 1 }, "end": { - "line": 17, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -637,43 +844,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 404, - "end": 420, + "start": 568, + "end": 584, "loc": { "start": { - "line": 17, + "line": 21, "column": 8 }, "end": { - "line": 17, + "line": 21, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 404, - "end": 412, + "start": 568, + "end": 576, "loc": { "start": { - "line": 17, + "line": 21, "column": 8 }, "end": { - "line": 17, + "line": 21, "column": 16 } }, "object": { "type": "Identifier", - "start": 404, - "end": 405, + "start": 568, + "end": 569, "loc": { "start": { - "line": 17, + "line": 21, "column": 8 }, "end": { - "line": 17, + "line": 21, "column": 9 }, "identifierName": "n" @@ -682,15 +889,15 @@ }, "property": { "type": "Identifier", - "start": 406, - "end": 412, + "start": 570, + "end": 576, "loc": { "start": { - "line": 17, + "line": 21, "column": 10 }, "end": { - "line": 17, + "line": 21, "column": 16 }, "identifierName": "_color" @@ -702,15 +909,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 417, - "end": 420, + "start": 581, + "end": 584, "loc": { "start": { - "line": 17, + "line": 21, "column": 21 }, "end": { - "line": 17, + "line": 21, "column": 24 }, "identifierName": "RED" @@ -723,43 +930,43 @@ }, { "type": "ExpressionStatement", - "start": 424, - "end": 456, + "start": 588, + "end": 639, "loc": { "start": { - "line": 18, + "line": 22, "column": 1 }, "end": { - "line": 18, - "column": 33 + "line": 22, + "column": 52 } }, "expression": { "type": "CallExpression", - "start": 424, - "end": 455, + "start": 588, + "end": 638, "loc": { "start": { - "line": 18, + "line": 22, "column": 1 }, "end": { - "line": 18, - "column": 32 + "line": 22, + "column": 51 } }, "callee": { "type": "Identifier", - "start": 424, - "end": 430, + "start": 588, + "end": 594, "loc": { "start": { - "line": 18, + "line": 22, "column": 1 }, "end": { - "line": 18, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -768,58 +975,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 431, - "end": 454, + "type": "LogicalExpression", + "start": 595, + "end": 637, "loc": { "start": { - "line": 18, + "line": 22, "column": 8 }, "end": { - "line": 18, - "column": 31 + "line": 22, + "column": 50 } }, "left": { - "type": "MemberExpression", - "start": 431, - "end": 444, + "type": "BinaryExpression", + "start": 595, + "end": 610, "loc": { "start": { - "line": 18, + "line": 22, "column": 8 }, "end": { - "line": 18, - "column": 21 + "line": 22, + "column": 23 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 431, - "end": 437, + "start": 595, + "end": 601, "loc": { "start": { - "line": 18, + "line": 22, "column": 8 }, "end": { - "line": 18, + "line": 22, "column": 14 } }, "object": { "type": "Identifier", - "start": 431, - "end": 432, + "start": 595, + "end": 596, "loc": { "start": { - "line": 18, + "line": 22, "column": 8 }, "end": { - "line": 18, + "line": 22, "column": 9 }, "identifierName": "n" @@ -828,15 +1035,15 @@ }, "property": { "type": "Identifier", - "start": 433, - "end": 437, + "start": 597, + "end": 601, "loc": { "start": { - "line": 18, + "line": 22, "column": 10 }, "end": { - "line": 18, + "line": 22, "column": 14 }, "identifierName": "left" @@ -845,42 +1052,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 438, - "end": 444, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 606, + "end": 610, "loc": { "start": { - "line": 18, - "column": 15 + "line": 22, + "column": 19 }, "end": { - "line": 18, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 22, + "column": 23 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 449, - "end": 454, + "type": "BinaryExpression", + "start": 614, + "end": 637, "loc": { "start": { - "line": 18, - "column": 26 + "line": 22, + "column": 27 }, "end": { - "line": 18, - "column": 31 + "line": 22, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 614, + "end": 627, + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 40 + } }, - "identifierName": "BLACK" + "object": { + "type": "MemberExpression", + "start": 614, + "end": 620, + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 614, + "end": 615, + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 28 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 616, + "end": 620, + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 621, + "end": 627, + "loc": { + "start": { + "line": 22, + "column": 34 + }, + "end": { + "line": 22, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 632, + "end": 637, + "loc": { + "start": { + "line": 22, + "column": 45 + }, + "end": { + "line": 22, + "column": 50 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -888,43 +1192,43 @@ }, { "type": "ExpressionStatement", - "start": 458, - "end": 491, + "start": 641, + "end": 694, "loc": { "start": { - "line": 19, + "line": 23, "column": 1 }, "end": { - "line": 19, - "column": 34 + "line": 23, + "column": 54 } }, "expression": { "type": "CallExpression", - "start": 458, - "end": 490, + "start": 641, + "end": 693, "loc": { "start": { - "line": 19, + "line": 23, "column": 1 }, "end": { - "line": 19, - "column": 33 + "line": 23, + "column": 53 } }, "callee": { "type": "Identifier", - "start": 458, - "end": 464, + "start": 641, + "end": 647, "loc": { "start": { - "line": 19, + "line": 23, "column": 1 }, "end": { - "line": 19, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -933,58 +1237,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 465, - "end": 489, + "type": "LogicalExpression", + "start": 648, + "end": 692, "loc": { "start": { - "line": 19, + "line": 23, "column": 8 }, "end": { - "line": 19, - "column": 32 + "line": 23, + "column": 52 } }, "left": { - "type": "MemberExpression", - "start": 465, - "end": 479, + "type": "BinaryExpression", + "start": 648, + "end": 664, "loc": { "start": { - "line": 19, + "line": 23, "column": 8 }, "end": { - "line": 19, - "column": 22 + "line": 23, + "column": 24 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 465, - "end": 472, + "start": 648, + "end": 655, "loc": { "start": { - "line": 19, + "line": 23, "column": 8 }, "end": { - "line": 19, + "line": 23, "column": 15 } }, "object": { "type": "Identifier", - "start": 465, - "end": 466, + "start": 648, + "end": 649, "loc": { "start": { - "line": 19, + "line": 23, "column": 8 }, "end": { - "line": 19, + "line": 23, "column": 9 }, "identifierName": "n" @@ -993,15 +1297,15 @@ }, "property": { "type": "Identifier", - "start": 467, - "end": 472, + "start": 650, + "end": 655, "loc": { "start": { - "line": 19, + "line": 23, "column": 10 }, "end": { - "line": 19, + "line": 23, "column": 15 }, "identifierName": "right" @@ -1010,42 +1314,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 473, - "end": 479, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 660, + "end": 664, "loc": { "start": { - "line": 19, - "column": 16 + "line": 23, + "column": 20 }, "end": { - "line": 19, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 23, + "column": 24 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 484, - "end": 489, + "type": "BinaryExpression", + "start": 668, + "end": 692, "loc": { "start": { - "line": 19, - "column": 27 + "line": 23, + "column": 28 }, "end": { - "line": 19, - "column": 32 + "line": 23, + "column": 52 + } + }, + "left": { + "type": "MemberExpression", + "start": 668, + "end": 682, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 42 + } }, - "identifierName": "BLACK" + "object": { + "type": "MemberExpression", + "start": 668, + "end": 675, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 668, + "end": 669, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 29 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 670, + "end": 675, + "loc": { + "start": { + "line": 23, + "column": 30 + }, + "end": { + "line": 23, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 676, + "end": 682, + "loc": { + "start": { + "line": 23, + "column": 36 + }, + "end": { + "line": 23, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 687, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 47 + }, + "end": { + "line": 23, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -1053,43 +1454,43 @@ }, { "type": "ExpressionStatement", - "start": 493, - "end": 519, + "start": 696, + "end": 722, "loc": { "start": { - "line": 20, + "line": 24, "column": 1 }, "end": { - "line": 20, + "line": 24, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 493, - "end": 518, + "start": 696, + "end": 721, "loc": { "start": { - "line": 20, + "line": 24, "column": 1 }, "end": { - "line": 20, + "line": 24, "column": 26 } }, "callee": { "type": "Identifier", - "start": 493, - "end": 499, + "start": 696, + "end": 702, "loc": { "start": { - "line": 20, + "line": 24, "column": 1 }, "end": { - "line": 20, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -1099,43 +1500,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 500, - "end": 517, + "start": 703, + "end": 720, "loc": { "start": { - "line": 20, + "line": 24, "column": 8 }, "end": { - "line": 20, + "line": 24, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 500, - "end": 508, + "start": 703, + "end": 711, "loc": { "start": { - "line": 20, + "line": 24, "column": 8 }, "end": { - "line": 20, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 500, - "end": 501, + "start": 703, + "end": 704, "loc": { "start": { - "line": 20, + "line": 24, "column": 8 }, "end": { - "line": 20, + "line": 24, "column": 9 }, "identifierName": "n" @@ -1144,15 +1545,15 @@ }, "property": { "type": "Identifier", - "start": 502, - "end": 508, + "start": 705, + "end": 711, "loc": { "start": { - "line": 20, + "line": 24, "column": 10 }, "end": { - "line": 20, + "line": 24, "column": 16 }, "identifierName": "parent" @@ -1164,205 +1565,301 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 513, - "end": 517, + "start": 716, + "end": 720, "loc": { "start": { - "line": 20, + "line": 24, "column": 21 }, "end": { - "line": 20, + "line": 24, "column": 25 } } } } ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 522, - "end": 666, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 30, - "column": 4 - } - } - } - ] + } }, { - "type": "IfStatement", - "start": 668, - "end": 706, + "type": "ExpressionStatement", + "start": 724, + "end": 756, "loc": { "start": { - "line": 31, + "line": 25, "column": 1 }, "end": { - "line": 31, - "column": 39 + "line": 25, + "column": 33 } }, - "test": { - "type": "BinaryExpression", - "start": 672, - "end": 697, + "expression": { + "type": "CallExpression", + "start": 724, + "end": 755, "loc": { "start": { - "line": 31, - "column": 5 + "line": 25, + "column": 1 }, "end": { - "line": 31, - "column": 30 + "line": 25, + "column": 32 } }, - "left": { - "type": "MemberExpression", - "start": 672, - "end": 687, + "callee": { + "type": "Identifier", + "start": 724, + "end": 730, "loc": { "start": { - "line": 31, - "column": 5 + "line": 25, + "column": 1 }, "end": { - "line": 31, - "column": 20 - } + "line": 25, + "column": 7 + }, + "identifierName": "assert" }, - "object": { - "type": "MemberExpression", - "start": 672, - "end": 680, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 731, + "end": 754, "loc": { "start": { - "line": 31, - "column": 5 + "line": 25, + "column": 8 }, "end": { - "line": 31, - "column": 13 + "line": 25, + "column": 31 } }, - "object": { - "type": "Identifier", - "start": 672, - "end": 673, + "left": { + "type": "MemberExpression", + "start": 731, + "end": 746, "loc": { "start": { - "line": 31, - "column": 5 + "line": 25, + "column": 8 }, "end": { - "line": 31, - "column": 6 + "line": 25, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 731, + "end": 739, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } }, - "identifierName": "n" + "object": { + "type": "Identifier", + "start": 731, + "end": 732, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 733, + "end": 739, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "name": "n", - "leadingComments": null + "property": { + "type": "Identifier", + "start": 740, + "end": 746, + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 674, - "end": 680, + "start": 751, + "end": 754, "loc": { "start": { - "line": 31, - "column": 7 + "line": 25, + "column": 28 }, "end": { - "line": 31, - "column": 13 + "line": 25, + "column": 31 }, - "identifierName": "parent" + "identifierName": "RED" }, - "name": "parent" + "name": "RED" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 758, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 764, + "end": 776, + "loc": { + "start": { + "line": 26, + "column": 7 }, - "computed": false, - "leadingComments": null + "end": { + "line": 26, + "column": 19 + } }, - "property": { + "id": { "type": "Identifier", - "start": 681, - "end": 687, + "start": 764, + "end": 765, "loc": { "start": { - "line": 31, - "column": 14 + "line": 26, + "column": 7 }, "end": { - "line": 31, - "column": 20 + "line": 26, + "column": 8 }, - "identifierName": "_color" + "identifierName": "u" }, - "name": "_color" + "name": "u" }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 692, - "end": 697, - "loc": { - "start": { - "line": 31, - "column": 25 + "init": { + "type": "CallExpression", + "start": 768, + "end": 776, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 19 + } }, - "end": { - "line": 31, - "column": 30 + "callee": { + "type": "Identifier", + "start": 768, + "end": 773, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "uncle" + }, + "name": "uncle" }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "consequent": { - "type": "ReturnStatement", - "start": 699, - "end": 706, - "loc": { - "start": { - "line": 31, - "column": 32 - }, - "end": { - "line": 31, - "column": 39 + "arguments": [ + { + "type": "Identifier", + "start": 774, + "end": 775, + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 18 + }, + "identifierName": "n" + }, + "name": "n" + } + ] } - }, - "argument": null - }, - "alternate": null, - "leadingComments": [ + } + ], + "kind": "const", + "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 522, - "end": 666, + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 780, + "end": 1275, "loc": { "start": { - "line": 22, + "line": 28, "column": 1 }, "end": { - "line": 30, + "line": 40, "column": 4 } } @@ -1370,579 +1867,385 @@ ] }, { - "type": "ExpressionStatement", - "start": 709, - "end": 725, + "type": "IfStatement", + "start": 1278, + "end": 1482, "loc": { "start": { - "line": 33, + "line": 42, "column": 1 }, "end": { - "line": 33, - "column": 17 + "line": 49, + "column": 24 } }, - "expression": { - "type": "CallExpression", - "start": 709, - "end": 724, + "test": { + "type": "LogicalExpression", + "start": 1282, + "end": 1314, "loc": { "start": { - "line": 33, - "column": 1 + "line": 42, + "column": 5 }, "end": { - "line": 33, - "column": 16 + "line": 42, + "column": 37 } }, - "callee": { - "type": "Identifier", - "start": 709, - "end": 721, + "left": { + "type": "BinaryExpression", + "start": 1282, + "end": 1292, "loc": { "start": { - "line": 33, - "column": 1 + "line": 42, + "column": 5 }, "end": { - "line": 33, - "column": 13 - }, - "identifierName": "insert_case3" + "line": 42, + "column": 15 + } }, - "name": "insert_case3" - }, - "arguments": [ - { + "left": { "type": "Identifier", - "start": 722, - "end": 723, + "start": 1282, + "end": 1283, "loc": { "start": { - "line": 33, - "column": 14 + "line": 42, + "column": 5 }, "end": { - "line": 33, - "column": 15 + "line": 42, + "column": 6 }, - "identifierName": "n" + "identifierName": "u" }, - "name": "n" - } - ] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [], - "name": "_", - "trailingComments": [] - }, - { - "type": "Identifier", - "start": 730, - "end": 758, - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 36, - "column": 28 - } - }, - "declaration": { - "type": "Identifier", - "start": 745, - "end": 757, - "loc": { - "start": { - "line": 36, - "column": 15 - }, - "end": { - "line": 36, - "column": 27 - }, - "identifierName": "insert_case2" - }, - "name": "insert_case2" - }, - "name": "_", - "leadingComments": [], - "trailingComments": [] - }, - { - "type": "ExportDefaultDeclaration", - "start": 730, - "end": 758, - "loc": { - "start": { - "line": 36, - "column": 0 - }, - "end": { - "line": 36, - "column": 28 - } - }, - "declaration": { - "type": "VariableDeclaration", - "start": 338, - "end": 728, - "loc": { - "start": { - "line": 15, - "column": 0 - }, - "end": { - "line": 34, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 344, - "end": 727, - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 34, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 344, - "end": 356, - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 15, - "column": 18 - }, - "identifierName": "insert_case2" - }, - "name": "insert_case2", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 359, - "end": 727, - "loc": { - "start": { - "line": 15, - "column": 21 - }, - "end": { - "line": 34, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 344, - "end": 356, - "loc": { - "start": { - "line": 15, - "column": 6 - }, - "end": { - "line": 15, - "column": 18 - }, - "identifierName": "insert_case2" - }, - "name": "insert_case2", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 360, - "end": 361, - "loc": { - "start": { - "line": 15, - "column": 22 - }, - "end": { - "line": 15, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 366, - "end": 727, - "loc": { - "start": { - "line": 15, - "column": 28 - }, - "end": { - "line": 34, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 369, - "end": 395, - "loc": { - "start": { - "line": 16, - "column": 1 + "name": "u", + "leadingComments": null }, - "end": { - "line": 16, - "column": 27 - } + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1288, + "end": 1292, + "loc": { + "start": { + "line": 42, + "column": 11 + }, + "end": { + "line": 42, + "column": 15 + } + } + }, + "leadingComments": null }, - "expression": { - "type": "CallExpression", - "start": 369, - "end": 394, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1296, + "end": 1314, "loc": { "start": { - "line": 16, - "column": 1 + "line": 42, + "column": 19 }, "end": { - "line": 16, - "column": 26 + "line": 42, + "column": 37 } }, - "callee": { - "type": "Identifier", - "start": 369, - "end": 375, + "left": { + "type": "MemberExpression", + "start": 1296, + "end": 1304, "loc": { "start": { - "line": 16, - "column": 1 + "line": 42, + "column": 19 }, "end": { - "line": 16, - "column": 7 - }, - "identifierName": "assert" + "line": 42, + "column": 27 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 376, - "end": 393, - "loc": { + "object": { + "type": "Identifier", + "start": 1296, + "end": 1297, + "loc": { "start": { - "line": 16, - "column": 8 + "line": 42, + "column": 19 }, "end": { - "line": 16, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 376, - "end": 377, - "loc": { - "start": { - "line": 16, - "column": 8 - }, - "end": { - "line": 16, - "column": 9 - }, - "identifierName": "n" + "line": 42, + "column": 20 }, - "name": "n" + "identifierName": "u" }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 389, - "end": 393, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 25 - }, - "identifierName": "Node" + "name": "u" + }, + "property": { + "type": "Identifier", + "start": 1298, + "end": 1304, + "loc": { + "start": { + "line": 42, + "column": 21 }, - "name": "Node" - } - } - ] - } + "end": { + "line": 42, + "column": 27 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "Identifier", + "start": 1309, + "end": 1314, + "loc": { + "start": { + "line": 42, + "column": 32 + }, + "end": { + "line": 42, + "column": 37 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null }, - { - "type": "ExpressionStatement", - "start": 397, - "end": 422, + "consequent": { + "type": "BlockStatement", + "start": 1316, + "end": 1460, "loc": { "start": { - "line": 17, - "column": 1 + "line": 42, + "column": 39 }, "end": { - "line": 17, - "column": 26 + "line": 49, + "column": 2 } }, - "expression": { - "type": "CallExpression", - "start": 397, - "end": 421, - "loc": { - "start": { - "line": 17, - "column": 1 - }, - "end": { - "line": 17, - "column": 25 - } - }, - "callee": { - "type": "Identifier", - "start": 397, - "end": 403, + "body": [ + { + "type": "ExpressionStatement", + "start": 1320, + "end": 1345, "loc": { "start": { - "line": 17, - "column": 1 + "line": 43, + "column": 2 }, "end": { - "line": 17, - "column": 7 - }, - "identifierName": "assert" + "line": 43, + "column": 27 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 404, - "end": 420, + "expression": { + "type": "CallExpression", + "start": 1320, + "end": 1344, "loc": { "start": { - "line": 17, - "column": 8 + "line": 43, + "column": 2 }, "end": { - "line": 17, - "column": 24 + "line": 43, + "column": 26 } }, - "left": { - "type": "MemberExpression", - "start": 404, - "end": 412, + "callee": { + "type": "Identifier", + "start": 1320, + "end": 1326, "loc": { "start": { - "line": 17, - "column": 8 + "line": 43, + "column": 2 }, "end": { - "line": 17, - "column": 16 - } + "line": 43, + "column": 8 + }, + "identifierName": "assert" }, - "object": { - "type": "Identifier", - "start": 404, - "end": 405, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1327, + "end": 1343, "loc": { "start": { - "line": 17, - "column": 8 - }, - "end": { - "line": 17, + "line": 43, "column": 9 }, - "identifierName": "n" + "end": { + "line": 43, + "column": 25 + } }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 406, - "end": 412, - "loc": { - "start": { - "line": 17, - "column": 10 + "left": { + "type": "MemberExpression", + "start": 1327, + "end": 1335, + "loc": { + "start": { + "line": 43, + "column": 9 + }, + "end": { + "line": 43, + "column": 17 + } }, - "end": { - "line": 17, - "column": 16 + "object": { + "type": "Identifier", + "start": 1327, + "end": 1328, + "loc": { + "start": { + "line": 43, + "column": 9 + }, + "end": { + "line": 43, + "column": 10 + }, + "identifierName": "u" + }, + "name": "u" }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 417, - "end": 420, - "loc": { - "start": { - "line": 17, - "column": 21 - }, - "end": { - "line": 17, - "column": 24 + "property": { + "type": "Identifier", + "start": 1329, + "end": 1335, + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 43, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 424, - "end": 456, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 424, - "end": 455, - "loc": { - "start": { - "line": 18, - "column": 1 - }, - "end": { - "line": 18, - "column": 32 + "operator": "===", + "right": { + "type": "Identifier", + "start": 1340, + "end": 1343, + "loc": { + "start": { + "line": 43, + "column": 22 + }, + "end": { + "line": 43, + "column": 25 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] } }, - "callee": { - "type": "Identifier", - "start": 424, - "end": 430, + { + "type": "ExpressionStatement", + "start": 1348, + "end": 1372, "loc": { "start": { - "line": 18, - "column": 1 + "line": 44, + "column": 2 }, "end": { - "line": 18, - "column": 7 - }, - "identifierName": "assert" + "line": 44, + "column": 26 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 431, - "end": 454, + "expression": { + "type": "AssignmentExpression", + "start": 1348, + "end": 1371, "loc": { "start": { - "line": 18, - "column": 8 + "line": 44, + "column": 2 }, "end": { - "line": 18, - "column": 31 + "line": 44, + "column": 25 } }, + "operator": "=", "left": { "type": "MemberExpression", - "start": 431, - "end": 444, + "start": 1348, + "end": 1363, "loc": { "start": { - "line": 18, - "column": 8 + "line": 44, + "column": 2 }, "end": { - "line": 18, - "column": 21 + "line": 44, + "column": 17 } }, "object": { "type": "MemberExpression", - "start": 431, - "end": 437, + "start": 1348, + "end": 1356, "loc": { "start": { - "line": 18, - "column": 8 + "line": 44, + "column": 2 }, "end": { - "line": 18, - "column": 14 + "line": 44, + "column": 10 } }, "object": { "type": "Identifier", - "start": 431, - "end": 432, + "start": 1348, + "end": 1349, "loc": { "start": { - "line": 18, - "column": 8 + "line": 44, + "column": 2 }, "end": { - "line": 18, - "column": 9 + "line": 44, + "column": 3 }, "identifierName": "n" }, @@ -1950,35 +2253,35 @@ }, "property": { "type": "Identifier", - "start": 433, - "end": 437, + "start": 1350, + "end": 1356, "loc": { "start": { - "line": 18, - "column": 10 + "line": 44, + "column": 4 }, "end": { - "line": 18, - "column": 14 + "line": 44, + "column": 10 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false }, "property": { "type": "Identifier", - "start": 438, - "end": 444, + "start": 1357, + "end": 1363, "loc": { "start": { - "line": 18, - "column": 15 + "line": 44, + "column": 11 }, "end": { - "line": 18, - "column": 21 + "line": 44, + "column": 17 }, "identifierName": "_color" }, @@ -1986,164 +2289,97 @@ }, "computed": false }, - "operator": "===", "right": { "type": "Identifier", - "start": 449, - "end": 454, + "start": 1366, + "end": 1371, "loc": { "start": { - "line": 18, - "column": 26 + "line": 44, + "column": 20 }, "end": { - "line": 18, - "column": 31 + "line": 44, + "column": 25 }, "identifierName": "BLACK" }, "name": "BLACK" } } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 458, - "end": 491, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 458, - "end": 490, - "loc": { - "start": { - "line": 19, - "column": 1 - }, - "end": { - "line": 19, - "column": 33 - } }, - "callee": { - "type": "Identifier", - "start": 458, - "end": 464, + { + "type": "ExpressionStatement", + "start": 1375, + "end": 1392, "loc": { "start": { - "line": 19, - "column": 1 + "line": 45, + "column": 2 }, "end": { - "line": 19, - "column": 7 - }, - "identifierName": "assert" + "line": 45, + "column": 19 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 465, - "end": 489, + "expression": { + "type": "AssignmentExpression", + "start": 1375, + "end": 1391, "loc": { "start": { - "line": 19, - "column": 8 + "line": 45, + "column": 2 }, "end": { - "line": 19, - "column": 32 + "line": 45, + "column": 18 } }, + "operator": "=", "left": { "type": "MemberExpression", - "start": 465, - "end": 479, + "start": 1375, + "end": 1383, "loc": { "start": { - "line": 19, - "column": 8 + "line": 45, + "column": 2 }, "end": { - "line": 19, - "column": 22 + "line": 45, + "column": 10 } }, "object": { - "type": "MemberExpression", - "start": 465, - "end": 472, + "type": "Identifier", + "start": 1375, + "end": 1376, "loc": { "start": { - "line": 19, - "column": 8 + "line": 45, + "column": 2 }, "end": { - "line": 19, - "column": 15 - } + "line": 45, + "column": 3 + }, + "identifierName": "u" }, - "object": { - "type": "Identifier", - "start": 465, - "end": 466, - "loc": { - "start": { - "line": 19, - "column": 8 - }, - "end": { - "line": 19, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 467, - "end": 472, - "loc": { - "start": { - "line": 19, - "column": 10 - }, - "end": { - "line": 19, - "column": 15 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false + "name": "u" }, "property": { "type": "Identifier", - "start": 473, - "end": 479, + "start": 1377, + "end": 1383, "loc": { "start": { - "line": 19, - "column": 16 + "line": 45, + "column": 4 }, "end": { - "line": 19, - "column": 22 + "line": 45, + "column": 10 }, "identifierName": "_color" }, @@ -2151,483 +2387,4886 @@ }, "computed": false }, - "operator": "===", "right": { "type": "Identifier", - "start": 484, - "end": 489, + "start": 1386, + "end": 1391, "loc": { "start": { - "line": 19, - "column": 27 + "line": 45, + "column": 13 }, "end": { - "line": 19, - "column": 32 + "line": 45, + "column": 18 }, "identifierName": "BLACK" }, "name": "BLACK" } } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 493, - "end": 519, - "loc": { - "start": { - "line": 20, - "column": 1 }, - "end": { - "line": 20, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 493, - "end": 518, - "loc": { - "start": { - "line": 20, - "column": 1 + { + "type": "VariableDeclaration", + "start": 1395, + "end": 1420, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 27 + } }, - "end": { - "line": 20, - "column": 26 - } + "declarations": [ + { + "type": "VariableDeclarator", + "start": 1401, + "end": 1419, + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 1401, + "end": 1402, + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 9 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 1405, + "end": 1419, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 1405, + "end": 1416, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 23 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1417, + "end": 1418, + "loc": { + "start": { + "line": 46, + "column": 24 + }, + "end": { + "line": 46, + "column": 25 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" }, - "callee": { - "type": "Identifier", - "start": 493, - "end": 499, + { + "type": "ExpressionStatement", + "start": 1423, + "end": 1438, "loc": { "start": { - "line": 20, - "column": 1 + "line": 47, + "column": 2 }, "end": { - "line": 20, - "column": 7 - }, - "identifierName": "assert" + "line": 47, + "column": 17 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 500, - "end": 517, + "expression": { + "type": "AssignmentExpression", + "start": 1423, + "end": 1437, "loc": { "start": { - "line": 20, - "column": 8 + "line": 47, + "column": 2 }, "end": { - "line": 20, - "column": 25 + "line": 47, + "column": 16 } }, + "operator": "=", "left": { "type": "MemberExpression", - "start": 500, - "end": 508, + "start": 1423, + "end": 1431, "loc": { "start": { - "line": 20, - "column": 8 + "line": 47, + "column": 2 }, "end": { - "line": 20, - "column": 16 + "line": 47, + "column": 10 } }, "object": { "type": "Identifier", - "start": 500, - "end": 501, + "start": 1423, + "end": 1424, "loc": { "start": { - "line": 20, - "column": 8 + "line": 47, + "column": 2 }, "end": { - "line": 20, - "column": 9 + "line": 47, + "column": 3 }, - "identifierName": "n" + "identifierName": "g" }, - "name": "n" + "name": "g" }, "property": { "type": "Identifier", - "start": 502, - "end": 508, + "start": 1425, + "end": 1431, "loc": { "start": { - "line": 20, - "column": 10 + "line": 47, + "column": 4 }, "end": { - "line": 20, - "column": 16 + "line": 47, + "column": 10 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false }, - "operator": "!==", "right": { - "type": "NullLiteral", - "start": 513, - "end": 517, + "type": "Identifier", + "start": 1434, + "end": 1437, "loc": { "start": { - "line": 20, - "column": 21 + "line": 47, + "column": 13 }, "end": { - "line": 20, - "column": 25 - } - } + "line": 47, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" } } - ] - }, - "trailingComments": [ + }, { - "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 522, - "end": 666, + "type": "ExpressionStatement", + "start": 1441, + "end": 1457, "loc": { "start": { - "line": 22, - "column": 1 + "line": 48, + "column": 2 }, "end": { - "line": 30, - "column": 4 + "line": 48, + "column": 18 } + }, + "expression": { + "type": "CallExpression", + "start": 1441, + "end": 1456, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1441, + "end": 1453, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 14 + }, + "identifierName": "insert_case0" + }, + "name": "insert_case0" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1454, + "end": 1455, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + } + ] } } - ] + ], + "directives": [] }, - { - "type": "IfStatement", - "start": 668, - "end": 706, + "alternate": { + "type": "ExpressionStatement", + "start": 1466, + "end": 1482, "loc": { "start": { - "line": 31, - "column": 1 + "line": 49, + "column": 8 }, "end": { - "line": 31, - "column": 39 + "line": 49, + "column": 24 } }, - "test": { - "type": "BinaryExpression", - "start": 672, - "end": 697, + "expression": { + "type": "CallExpression", + "start": 1466, + "end": 1481, "loc": { "start": { - "line": 31, - "column": 5 + "line": 49, + "column": 8 }, "end": { - "line": 31, - "column": 30 + "line": 49, + "column": 23 } }, - "left": { - "type": "MemberExpression", - "start": 672, - "end": 687, + "callee": { + "type": "Identifier", + "start": 1466, + "end": 1478, "loc": { "start": { - "line": 31, - "column": 5 + "line": 49, + "column": 8 }, "end": { - "line": 31, + "line": 49, "column": 20 - } - }, - "object": { - "type": "MemberExpression", - "start": 672, - "end": 680, - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 31, - "column": 13 - } - }, - "object": { - "type": "Identifier", - "start": 672, - "end": 673, - "loc": { - "start": { - "line": 31, - "column": 5 - }, - "end": { - "line": 31, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 674, - "end": 680, - "loc": { - "start": { - "line": 31, - "column": 7 - }, - "end": { - "line": 31, - "column": 13 - }, - "identifierName": "parent" - }, - "name": "parent" }, - "computed": false, - "leadingComments": null + "identifierName": "insert_case3" }, - "property": { + "name": "insert_case3" + }, + "arguments": [ + { "type": "Identifier", - "start": 681, - "end": 687, + "start": 1479, + "end": 1480, "loc": { "start": { - "line": 31, - "column": 14 + "line": 49, + "column": 21 }, "end": { - "line": 31, - "column": 20 + "line": 49, + "column": 22 }, - "identifierName": "_color" + "identifierName": "n" }, - "name": "_color" + "name": "n" + } + ] + } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 780, + "end": 1275, + "loc": { + "start": { + "line": 28, + "column": 1 }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 692, - "end": 697, - "loc": { - "start": { - "line": 31, - "column": 25 - }, - "end": { - "line": 31, - "column": 30 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" + "end": { + "line": 40, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1487, + "end": 1515, + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 1502, + "end": 1514, + "loc": { + "start": { + "line": 52, + "column": 15 + }, + "end": { + "line": 52, + "column": 27 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1487, + "end": 1515, + "loc": { + "start": { + "line": 52, + "column": 0 + }, + "end": { + "line": 52, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 502, + "end": 1485, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 50, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 508, + "end": 1484, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 508, + "end": 520, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 523, + "end": 1484, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 508, + "end": 520, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 524, + "end": 525, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 530, + "end": 1484, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 50, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 533, + "end": 559, + "loc": { + "start": { + "line": 20, + "column": 1 }, - "leadingComments": null + "end": { + "line": 20, + "column": 27 + } }, - "consequent": { - "type": "ReturnStatement", - "start": 699, - "end": 706, + "expression": { + "type": "CallExpression", + "start": 533, + "end": 558, "loc": { "start": { - "line": 31, - "column": 32 + "line": 20, + "column": 1 }, "end": { - "line": 31, - "column": 39 + "line": 20, + "column": 26 } }, - "argument": null - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 522, - "end": 666, + "callee": { + "type": "Identifier", + "start": 533, + "end": 539, "loc": { "start": { - "line": 22, + "line": 20, "column": 1 }, "end": { - "line": 30, - "column": 4 + "line": 20, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 540, + "end": 557, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 540, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" } } - } - ] + ] + } }, { "type": "ExpressionStatement", - "start": 709, - "end": 725, + "start": 561, + "end": 586, "loc": { "start": { - "line": 33, + "line": 21, "column": 1 }, "end": { - "line": 33, - "column": 17 + "line": 21, + "column": 26 } }, "expression": { "type": "CallExpression", - "start": 709, - "end": 724, + "start": 561, + "end": 585, "loc": { "start": { - "line": 33, + "line": 21, "column": 1 }, "end": { - "line": 33, - "column": 16 + "line": 21, + "column": 25 } }, "callee": { "type": "Identifier", - "start": 709, - "end": 721, + "start": 561, + "end": 567, "loc": { "start": { - "line": 33, + "line": 21, "column": 1 }, "end": { - "line": 33, - "column": 13 + "line": 21, + "column": 7 }, - "identifierName": "insert_case3" + "identifierName": "assert" }, - "name": "insert_case3" + "name": "assert" }, "arguments": [ { - "type": "Identifier", - "start": 722, - "end": 723, + "type": "BinaryExpression", + "start": 568, + "end": 584, "loc": { "start": { - "line": 33, - "column": 14 + "line": 21, + "column": 8 }, "end": { - "line": 33, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" + "line": 21, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 568, + "end": 576, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 568, + "end": 569, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 570, + "end": 576, + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 581, + "end": 584, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 24 + }, + "identifierName": "RED" + }, + "name": "RED" + } } ] } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 187, - "end": 337, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 14, - "column": 3 - } - } - } - ], - "trailingComments": [] + }, + { + "type": "ExpressionStatement", + "start": 588, + "end": 639, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 52 + } + }, + "expression": { + "type": "CallExpression", + "start": 588, + "end": 638, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 51 + } + }, + "callee": { + "type": "Identifier", + "start": 588, + "end": 594, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 595, + "end": 637, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 50 + } + }, + "left": { + "type": "BinaryExpression", + "start": 595, + "end": 610, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 23 + } + }, + "left": { + "type": "MemberExpression", + "start": 595, + "end": 601, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 595, + "end": 596, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 597, + "end": 601, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 606, + "end": 610, + "loc": { + "start": { + "line": 22, + "column": 19 + }, + "end": { + "line": 22, + "column": 23 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 614, + "end": 637, + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 614, + "end": 627, + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 40 + } + }, + "object": { + "type": "MemberExpression", + "start": 614, + "end": 620, + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 614, + "end": 615, + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 28 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 616, + "end": 620, + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 621, + "end": 627, + "loc": { + "start": { + "line": 22, + "column": 34 + }, + "end": { + "line": 22, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 632, + "end": 637, + "loc": { + "start": { + "line": 22, + "column": 45 + }, + "end": { + "line": 22, + "column": 50 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 641, + "end": 694, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 54 + } + }, + "expression": { + "type": "CallExpression", + "start": 641, + "end": 693, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 53 + } + }, + "callee": { + "type": "Identifier", + "start": 641, + "end": 647, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 648, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 52 + } + }, + "left": { + "type": "BinaryExpression", + "start": 648, + "end": 664, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 648, + "end": 655, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 648, + "end": 649, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 650, + "end": 655, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 660, + "end": 664, + "loc": { + "start": { + "line": 23, + "column": 20 + }, + "end": { + "line": 23, + "column": 24 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 668, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 52 + } + }, + "left": { + "type": "MemberExpression", + "start": 668, + "end": 682, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 668, + "end": 675, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 668, + "end": 669, + "loc": { + "start": { + "line": 23, + "column": 28 + }, + "end": { + "line": 23, + "column": 29 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 670, + "end": 675, + "loc": { + "start": { + "line": 23, + "column": 30 + }, + "end": { + "line": 23, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 676, + "end": 682, + "loc": { + "start": { + "line": 23, + "column": 36 + }, + "end": { + "line": 23, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 687, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 47 + }, + "end": { + "line": 23, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 696, + "end": 722, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 696, + "end": 721, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 696, + "end": 702, + "loc": { + "start": { + "line": 24, + "column": 1 + }, + "end": { + "line": 24, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 703, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 703, + "end": 711, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 703, + "end": 704, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 705, + "end": 711, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 716, + "end": 720, + "loc": { + "start": { + "line": 24, + "column": 21 + }, + "end": { + "line": 24, + "column": 25 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 724, + "end": 756, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 724, + "end": 755, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 724, + "end": 730, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 731, + "end": 754, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 731, + "end": 746, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 23 + } + }, + "object": { + "type": "MemberExpression", + "start": 731, + "end": 739, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 731, + "end": 732, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 733, + "end": 739, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 740, + "end": 746, + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 751, + "end": 754, + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 31 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 758, + "end": 777, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 764, + "end": 776, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 764, + "end": 765, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + }, + "identifierName": "u" + }, + "name": "u" + }, + "init": { + "type": "CallExpression", + "start": 768, + "end": 776, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 768, + "end": 773, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "uncle" + }, + "name": "uncle" + }, + "arguments": [ + { + "type": "Identifier", + "start": 774, + "end": 775, + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 18 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 780, + "end": 1275, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + } + ] + }, + { + "type": "IfStatement", + "start": 1278, + "end": 1482, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 49, + "column": 24 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1282, + "end": 1314, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 37 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1282, + "end": 1292, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1282, + "end": 1283, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 6 + }, + "identifierName": "u" + }, + "name": "u", + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1288, + "end": 1292, + "loc": { + "start": { + "line": 42, + "column": 11 + }, + "end": { + "line": 42, + "column": 15 + } + } + }, + "leadingComments": null + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1296, + "end": 1314, + "loc": { + "start": { + "line": 42, + "column": 19 + }, + "end": { + "line": 42, + "column": 37 + } + }, + "left": { + "type": "MemberExpression", + "start": 1296, + "end": 1304, + "loc": { + "start": { + "line": 42, + "column": 19 + }, + "end": { + "line": 42, + "column": 27 + } + }, + "object": { + "type": "Identifier", + "start": 1296, + "end": 1297, + "loc": { + "start": { + "line": 42, + "column": 19 + }, + "end": { + "line": 42, + "column": 20 + }, + "identifierName": "u" + }, + "name": "u" + }, + "property": { + "type": "Identifier", + "start": 1298, + "end": 1304, + "loc": { + "start": { + "line": 42, + "column": 21 + }, + "end": { + "line": 42, + "column": 27 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "Identifier", + "start": 1309, + "end": 1314, + "loc": { + "start": { + "line": 42, + "column": 32 + }, + "end": { + "line": 42, + "column": 37 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1316, + "end": 1460, + "loc": { + "start": { + "line": 42, + "column": 39 + }, + "end": { + "line": 49, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1320, + "end": 1345, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 1320, + "end": 1344, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 1320, + "end": 1326, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1327, + "end": 1343, + "loc": { + "start": { + "line": 43, + "column": 9 + }, + "end": { + "line": 43, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1327, + "end": 1335, + "loc": { + "start": { + "line": 43, + "column": 9 + }, + "end": { + "line": 43, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 1327, + "end": 1328, + "loc": { + "start": { + "line": 43, + "column": 9 + }, + "end": { + "line": 43, + "column": 10 + }, + "identifierName": "u" + }, + "name": "u" + }, + "property": { + "type": "Identifier", + "start": 1329, + "end": 1335, + "loc": { + "start": { + "line": 43, + "column": 11 + }, + "end": { + "line": 43, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1340, + "end": 1343, + "loc": { + "start": { + "line": 43, + "column": 22 + }, + "end": { + "line": 43, + "column": 25 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1348, + "end": 1372, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 26 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1348, + "end": 1371, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 25 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1348, + "end": 1363, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 17 + } + }, + "object": { + "type": "MemberExpression", + "start": 1348, + "end": 1356, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1348, + "end": 1349, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1350, + "end": 1356, + "loc": { + "start": { + "line": 44, + "column": 4 + }, + "end": { + "line": 44, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1357, + "end": 1363, + "loc": { + "start": { + "line": 44, + "column": 11 + }, + "end": { + "line": 44, + "column": 17 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1366, + "end": 1371, + "loc": { + "start": { + "line": 44, + "column": 20 + }, + "end": { + "line": 44, + "column": 25 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1375, + "end": 1392, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1375, + "end": 1391, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1375, + "end": 1383, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1375, + "end": 1376, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 3 + }, + "identifierName": "u" + }, + "name": "u" + }, + "property": { + "type": "Identifier", + "start": 1377, + "end": 1383, + "loc": { + "start": { + "line": 45, + "column": 4 + }, + "end": { + "line": 45, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1386, + "end": 1391, + "loc": { + "start": { + "line": 45, + "column": 13 + }, + "end": { + "line": 45, + "column": 18 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "VariableDeclaration", + "start": 1395, + "end": 1420, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 1401, + "end": 1419, + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 1401, + "end": 1402, + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 9 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 1405, + "end": 1419, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 1405, + "end": 1416, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 23 + }, + "identifierName": "grandparent" + }, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1417, + "end": 1418, + "loc": { + "start": { + "line": 46, + "column": 24 + }, + "end": { + "line": 46, + "column": 25 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 1423, + "end": 1438, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 17 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1423, + "end": 1437, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 16 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1423, + "end": 1431, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 1423, + "end": 1424, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 3 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1425, + "end": 1431, + "loc": { + "start": { + "line": 47, + "column": 4 + }, + "end": { + "line": 47, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1434, + "end": 1437, + "loc": { + "start": { + "line": 47, + "column": 13 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1441, + "end": 1457, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1441, + "end": 1456, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1441, + "end": 1453, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 14 + }, + "identifierName": "insert_case0" + }, + "name": "insert_case0" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1454, + "end": 1455, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1466, + "end": 1482, + "loc": { + "start": { + "line": 49, + "column": 8 + }, + "end": { + "line": 49, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1466, + "end": 1481, + "loc": { + "start": { + "line": 49, + "column": 8 + }, + "end": { + "line": 49, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1466, + "end": 1478, + "loc": { + "start": { + "line": 49, + "column": 8 + }, + "end": { + "line": 49, + "column": 20 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1479, + "end": 1480, + "loc": { + "start": { + "line": 49, + "column": 21 + }, + "end": { + "line": 49, + "column": 22 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 780, + "end": 1275, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + } + ] + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "start": 325, + "end": 501, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "start": 325, + "end": 501, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 780, + "end": 1275, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "uncle", + "start": 147, + "end": 152, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 153, + "end": 157, + "loc": { + "start": { + "line": 5, + "column": 13 + }, + "end": { + "line": 5, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/uncle.js", + "start": 158, + "end": 178, + "loc": { + "start": { + "line": 5, + "column": 18 + }, + "end": { + "line": 5, + "column": 38 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 178, + "end": 179, + "loc": { + "start": { + "line": 5, + "column": 38 + }, + "end": { + "line": 5, + "column": 39 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 180, + "end": 186, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 187, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 199, + "end": 203, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/grandparent.js", + "start": 204, + "end": 230, + "loc": { + "start": { + "line": 6, + "column": 24 + }, + "end": { + "line": 6, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 230, + "end": 231, + "loc": { + "start": { + "line": 6, + "column": 50 + }, + "end": { + "line": 6, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 232, + "end": 238, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case0", + "start": 239, + "end": 251, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 252, + "end": 256, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case0.js", + "start": 257, + "end": 276, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 276, + "end": 277, + "loc": { + "start": { + "line": 7, + "column": 44 + }, + "end": { + "line": 7, + "column": 45 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 278, + "end": 284, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case3", + "start": 285, + "end": 297, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 298, + "end": 302, + "loc": { + "start": { + "line": 8, + "column": 20 + }, + "end": { + "line": 8, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./insert_case3.js", + "start": 303, + "end": 322, + "loc": { + "start": { + "line": 8, + "column": 25 + }, + "end": { + "line": 8, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 322, + "end": 323, + "loc": { + "start": { + "line": 8, + "column": 44 + }, + "end": { + "line": 8, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "start": 325, + "end": 501, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 502, + "end": 507, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case2", + "start": 508, + "end": 520, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 521, + "end": 522, + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 523, + "end": 524, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 524, + "end": 525, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 525, + "end": 526, + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 527, + "end": 529, + "loc": { + "start": { + "line": 19, + "column": 25 + }, + "end": { + "line": 19, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 530, + "end": 531, + "loc": { + "start": { + "line": 19, + "column": 28 + }, + "end": { + "line": 19, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 533, + "end": 539, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 539, + "end": 540, + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 540, + "end": 541, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 542, + "end": 552, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 557, + "end": 558, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 558, + "end": 559, + "loc": { + "start": { + "line": 20, + "column": 26 + }, + "end": { + "line": 20, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 561, + "end": 567, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 567, + "end": 568, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 568, + "end": 569, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 569, + "end": 570, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 570, + "end": 576, + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 577, + "end": 580, + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 581, + "end": 584, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 584, + "end": 585, + "loc": { + "start": { + "line": 21, + "column": 24 + }, + "end": { + "line": 21, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 585, + "end": 586, + "loc": { + "start": { + "line": 21, + "column": 25 + }, + "end": { + "line": 21, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 588, + "end": 594, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 594, + "end": 595, + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 595, + "end": 596, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 596, + "end": 597, + "loc": { + "start": { + "line": 22, + "column": 9 + }, + "end": { + "line": 22, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 597, + "end": 601, + "loc": { + "start": { + "line": 22, + "column": 10 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 602, + "end": 605, + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 18 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 606, + "end": 610, + "loc": { + "start": { + "line": 22, + "column": 19 + }, + "end": { + "line": 22, + "column": 23 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 611, + "end": 613, + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 614, + "end": 615, + "loc": { + "start": { + "line": 22, + "column": 27 + }, + "end": { + "line": 22, + "column": 28 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 615, + "end": 616, + "loc": { + "start": { + "line": 22, + "column": 28 + }, + "end": { + "line": 22, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 616, + "end": 620, + "loc": { + "start": { + "line": 22, + "column": 29 + }, + "end": { + "line": 22, + "column": 33 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 620, + "end": 621, + "loc": { + "start": { + "line": 22, + "column": 33 + }, + "end": { + "line": 22, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 621, + "end": 627, + "loc": { + "start": { + "line": 22, + "column": 34 + }, + "end": { + "line": 22, + "column": 40 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 628, + "end": 631, + "loc": { + "start": { + "line": 22, + "column": 41 + }, + "end": { + "line": 22, + "column": 44 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 632, + "end": 637, + "loc": { + "start": { + "line": 22, + "column": 45 + }, + "end": { + "line": 22, + "column": 50 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 637, + "end": 638, + "loc": { + "start": { + "line": 22, + "column": 50 + }, + "end": { + "line": 22, + "column": 51 } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 187, - "end": 337, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 638, + "end": 639, "loc": { "start": { - "line": 7, - "column": 0 + "line": 22, + "column": 51 }, "end": { - "line": 14, - "column": 3 + "line": 22, + "column": 52 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 522, - "end": 666, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 641, + "end": 647, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 30, - "column": 4 + "line": 23, + "column": 7 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 647, + "end": 648, + "loc": { + "start": { + "line": 23, + "column": 7 + }, + "end": { + "line": 23, + "column": 8 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2635,20 +7274,45 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "value": "n", + "start": 648, + "end": 649, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "import", - "start": 0, - "end": 6, + "start": 649, + "end": 650, "loc": { "start": { - "line": 1, - "column": 0 + "line": 23, + "column": 9 }, "end": { - "line": 1, - "column": 6 + "line": 23, + "column": 10 } } }, @@ -2664,17 +7328,99 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 7, - "end": 13, + "value": "right", + "start": 650, + "end": 655, "loc": { "start": { - "line": 1, - "column": 7 + "line": 23, + "column": 10 }, "end": { - "line": 1, - "column": 13 + "line": 23, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 656, + "end": 659, + "loc": { + "start": { + "line": 23, + "column": 16 + }, + "end": { + "line": 23, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 660, + "end": 664, + "loc": { + "start": { + "line": 23, + "column": 20 + }, + "end": { + "line": 23, + "column": 24 + } + } + }, + { + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 665, + "end": 667, + "loc": { + "start": { + "line": 23, + "column": 25 + }, + "end": { + "line": 23, + "column": 27 } } }, @@ -2690,23 +7436,49 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 14, - "end": 18, + "value": "n", + "start": 668, + "end": 669, "loc": { "start": { - "line": 1, - "column": 14 + "line": 23, + "column": 28 }, "end": { - "line": 1, - "column": 18 + "line": 23, + "column": 29 } } }, { "type": { - "label": "string", + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 669, + "end": 670, + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 30 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2714,26 +7486,77 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "value": "right", + "start": 670, + "end": 675, + "loc": { + "start": { + "line": 23, + "column": 30 + }, + "end": { + "line": 23, + "column": 35 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "assert", - "start": 19, - "end": 27, + "start": 675, + "end": 676, + "loc": { + "start": { + "line": 23, + "column": 35 + }, + "end": { + "line": 23, + "column": 36 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 676, + "end": 682, "loc": { "start": { - "line": 1, - "column": 19 + "line": 23, + "column": 36 }, "end": { - "line": 1, - "column": 27 + "line": 23, + "column": 42 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2741,26 +7564,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 27, - "end": 28, + "value": "===", + "start": 683, + "end": 686, "loc": { "start": { - "line": 1, - "column": 27 + "line": 23, + "column": 43 }, "end": { - "line": 1, - "column": 28 + "line": 23, + "column": 46 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2768,28 +7591,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 29, - "end": 35, + "value": "BLACK", + "start": 687, + "end": 692, "loc": { "start": { - "line": 2, - "column": 0 + "line": 23, + "column": 47 }, "end": { - "line": 2, - "column": 6 + "line": 23, + "column": 52 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2797,49 +7619,48 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 36, - "end": 40, + "start": 692, + "end": 693, "loc": { "start": { - "line": 2, - "column": 7 + "line": 23, + "column": 52 }, "end": { - "line": 2, - "column": 11 + "line": 23, + "column": 53 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 41, - "end": 45, + "start": 693, + "end": 694, "loc": { "start": { - "line": 2, - "column": 12 + "line": 23, + "column": 53 }, "end": { - "line": 2, - "column": 16 + "line": 23, + "column": 54 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2847,53 +7668,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../types/Node.js", - "start": 46, - "end": 64, + "value": "assert", + "start": 696, + "end": 702, "loc": { "start": { - "line": 2, - "column": 17 + "line": 24, + "column": 1 }, "end": { - "line": 2, - "column": 35 + "line": 24, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 64, - "end": 65, + "start": 702, + "end": 703, "loc": { "start": { - "line": 2, - "column": 35 + "line": 24, + "column": 7 }, "end": { - "line": 2, - "column": 36 + "line": 24, + "column": 8 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2901,46 +7719,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 66, - "end": 72, + "value": "n", + "start": 703, + "end": 704, "loc": { "start": { - "line": 3, - "column": 0 + "line": 24, + "column": 8 }, "end": { - "line": 3, - "column": 6 + "line": 24, + "column": 9 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "BLACK", - "start": 73, - "end": 78, + "start": 704, + "end": 705, "loc": { "start": { - "line": 3, - "column": 7 + "line": 24, + "column": 9 }, "end": { - "line": 3, - "column": 12 + "line": 24, + "column": 10 } } }, @@ -2956,52 +7773,53 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 79, - "end": 83, + "value": "parent", + "start": 705, + "end": 711, "loc": { "start": { - "line": 3, - "column": 13 + "line": 24, + "column": 10 }, "end": { - "line": 3, - "column": 17 + "line": 24, + "column": 16 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "../color/BLACK.js", - "start": 84, - "end": 103, + "value": "!==", + "start": 712, + "end": 715, "loc": { "start": { - "line": 3, - "column": 18 + "line": 24, + "column": 17 }, "end": { - "line": 3, - "column": 37 + "line": 24, + "column": 20 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3010,70 +7828,68 @@ "binop": null, "updateContext": null }, - "start": 103, - "end": 104, + "value": "null", + "start": 716, + "end": 720, "loc": { "start": { - "line": 3, - "column": 37 + "line": 24, + "column": 21 }, "end": { - "line": 3, - "column": 38 + "line": 24, + "column": 25 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 105, - "end": 111, + "start": 720, + "end": 721, "loc": { "start": { - "line": 4, - "column": 0 + "line": 24, + "column": 25 }, "end": { - "line": 4, - "column": 6 + "line": 24, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 112, - "end": 115, + "start": 721, + "end": 722, "loc": { "start": { - "line": 4, - "column": 7 + "line": 24, + "column": 26 }, "end": { - "line": 4, - "column": 10 + "line": 24, + "column": 27 } } }, @@ -3089,79 +7905,76 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 116, - "end": 120, + "value": "assert", + "start": 724, + "end": 730, "loc": { "start": { - "line": 4, - "column": 11 + "line": 25, + "column": 1 }, "end": { - "line": 4, - "column": 15 + "line": 25, + "column": 7 } } }, { "type": { - "label": "string", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/RED.js", - "start": 121, - "end": 138, + "start": 730, + "end": 731, "loc": { "start": { - "line": 4, - "column": 16 + "line": 25, + "column": 7 }, "end": { - "line": 4, - "column": 33 + "line": 25, + "column": 8 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 138, - "end": 139, + "value": "n", + "start": 731, + "end": 732, "loc": { "start": { - "line": 4, - "column": 33 + "line": 25, + "column": 8 }, "end": { - "line": 4, - "column": 34 + "line": 25, + "column": 9 } } }, { - "type": { - "label": "import", - "keyword": "import", + "type": { + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3170,17 +7983,16 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 140, - "end": 146, + "start": 732, + "end": 733, "loc": { "start": { - "line": 5, - "column": 0 + "line": 25, + "column": 9 }, "end": { - "line": 5, - "column": 6 + "line": 25, + "column": 10 } } }, @@ -3196,49 +8008,49 @@ "postfix": false, "binop": null }, - "value": "insert_case3", - "start": 147, - "end": 159, + "value": "parent", + "start": 733, + "end": 739, "loc": { "start": { - "line": 5, - "column": 7 + "line": 25, + "column": 10 }, "end": { - "line": 5, - "column": 19 + "line": 25, + "column": 16 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 160, - "end": 164, + "start": 739, + "end": 740, "loc": { "start": { - "line": 5, - "column": 20 + "line": 25, + "column": 16 }, "end": { - "line": 5, - "column": 24 + "line": 25, + "column": 17 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3246,26 +8058,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./insert_case3.js", - "start": 165, - "end": 184, + "value": "_color", + "start": 740, + "end": 746, "loc": { "start": { - "line": 5, - "column": 25 + "line": 25, + "column": 17 }, "end": { - "line": 5, - "column": 44 + "line": 25, + "column": 23 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3273,71 +8084,54 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 184, - "end": 185, - "loc": { - "start": { - "line": 5, - "column": 44 - }, - "end": { - "line": 5, - "column": 45 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", - "start": 187, - "end": 337, + "value": "===", + "start": 747, + "end": 750, "loc": { "start": { - "line": 7, - "column": 0 + "line": 25, + "column": 24 }, "end": { - "line": 14, - "column": 3 + "line": 25, + "column": 27 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 338, - "end": 343, + "value": "RED", + "start": 751, + "end": 754, "loc": { "start": { - "line": 15, - "column": 0 + "line": 25, + "column": 28 }, "end": { - "line": 15, - "column": 5 + "line": 25, + "column": 31 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3345,69 +8139,70 @@ "postfix": false, "binop": null }, - "value": "insert_case2", - "start": 344, - "end": 356, + "start": 754, + "end": 755, "loc": { "start": { - "line": 15, - "column": 6 + "line": 25, + "column": 31 }, "end": { - "line": 15, - "column": 18 + "line": 25, + "column": 32 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 357, - "end": 358, + "start": 755, + "end": 756, "loc": { "start": { - "line": 15, - "column": 19 + "line": 25, + "column": 32 }, "end": { - "line": 15, - "column": 20 + "line": 25, + "column": 33 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 359, - "end": 360, + "value": "const", + "start": 758, + "end": 763, "loc": { "start": { - "line": 15, - "column": 21 + "line": 26, + "column": 1 }, "end": { - "line": 15, - "column": 22 + "line": 26, + "column": 6 } } }, @@ -3423,74 +8218,76 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 360, - "end": 361, + "value": "u", + "start": 764, + "end": 765, "loc": { "start": { - "line": 15, - "column": 22 + "line": 26, + "column": 7 }, "end": { - "line": 15, - "column": 23 + "line": 26, + "column": 8 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 361, - "end": 362, + "value": "=", + "start": 766, + "end": 767, "loc": { "start": { - "line": 15, - "column": 23 + "line": 26, + "column": 9 }, "end": { - "line": 15, - "column": 24 + "line": 26, + "column": 10 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 363, - "end": 365, + "value": "uncle", + "start": 768, + "end": 773, "loc": { "start": { - "line": 15, - "column": 25 + "line": 26, + "column": 11 }, "end": { - "line": 15, - "column": 27 + "line": 26, + "column": 16 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -3500,16 +8297,16 @@ "postfix": false, "binop": null }, - "start": 366, - "end": 367, + "start": 773, + "end": 774, "loc": { "start": { - "line": 15, - "column": 28 + "line": 26, + "column": 16 }, "end": { - "line": 15, - "column": 29 + "line": 26, + "column": 17 } } }, @@ -3525,25 +8322,25 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 369, - "end": 375, + "value": "n", + "start": 774, + "end": 775, "loc": { "start": { - "line": 16, - "column": 1 + "line": 26, + "column": 17 }, "end": { - "line": 16, - "column": 7 + "line": 26, + "column": 18 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3551,77 +8348,93 @@ "postfix": false, "binop": null }, - "start": 375, - "end": 376, + "start": 775, + "end": 776, "loc": { "start": { - "line": 16, - "column": 7 + "line": 26, + "column": 18 }, "end": { - "line": 16, - "column": 8 + "line": 26, + "column": 19 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 376, - "end": 377, + "start": 776, + "end": 777, "loc": { "start": { - "line": 16, - "column": 8 + "line": 26, + "column": 19 }, "end": { - "line": 16, - "column": 9 + "line": 26, + "column": 20 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 780, + "end": 1275, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 40, + "column": 4 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, + "label": "if", + "keyword": "if", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 378, - "end": 388, + "value": "if", + "start": 1278, + "end": 1280, "loc": { "start": { - "line": 16, - "column": 10 + "line": 42, + "column": 1 }, "end": { - "line": 16, - "column": 20 + "line": 42, + "column": 3 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3630,25 +8443,24 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 389, - "end": 393, + "start": 1281, + "end": 1282, "loc": { "start": { - "line": 16, - "column": 21 + "line": 42, + "column": 4 }, "end": { - "line": 16, - "column": 25 + "line": 42, + "column": 5 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3656,22 +8468,23 @@ "postfix": false, "binop": null }, - "start": 393, - "end": 394, + "value": "u", + "start": 1282, + "end": 1283, "loc": { "start": { - "line": 16, - "column": 25 + "line": 42, + "column": 5 }, "end": { - "line": 16, - "column": 26 + "line": 42, + "column": 6 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3679,25 +8492,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 394, - "end": 395, + "value": "!==", + "start": 1284, + "end": 1287, "loc": { "start": { - "line": 16, - "column": 26 + "line": 42, + "column": 7 }, "end": { - "line": 16, - "column": 27 + "line": 42, + "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3705,44 +8520,47 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 397, - "end": 403, + "value": "null", + "start": 1288, + "end": 1292, "loc": { "start": { - "line": 17, - "column": 1 + "line": 42, + "column": 11 }, "end": { - "line": 17, - "column": 7 + "line": 42, + "column": 15 } } }, { "type": { - "label": "(", + "label": "&&", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 2, + "updateContext": null }, - "start": 403, - "end": 404, + "value": "&&", + "start": 1293, + "end": 1295, "loc": { "start": { - "line": 17, - "column": 7 + "line": 42, + "column": 16 }, "end": { - "line": 17, - "column": 8 + "line": 42, + "column": 18 } } }, @@ -3758,17 +8576,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 404, - "end": 405, + "value": "u", + "start": 1296, + "end": 1297, "loc": { "start": { - "line": 17, - "column": 8 + "line": 42, + "column": 19 }, "end": { - "line": 17, - "column": 9 + "line": 42, + "column": 20 } } }, @@ -3785,16 +8603,16 @@ "binop": null, "updateContext": null }, - "start": 405, - "end": 406, + "start": 1297, + "end": 1298, "loc": { "start": { - "line": 17, - "column": 9 + "line": 42, + "column": 20 }, "end": { - "line": 17, - "column": 10 + "line": 42, + "column": 21 } } }, @@ -3811,16 +8629,16 @@ "binop": null }, "value": "_color", - "start": 406, - "end": 412, + "start": 1298, + "end": 1304, "loc": { "start": { - "line": 17, - "column": 10 + "line": 42, + "column": 21 }, "end": { - "line": 17, - "column": 16 + "line": 42, + "column": 27 } } }, @@ -3837,17 +8655,17 @@ "binop": 6, "updateContext": null }, - "value": "===", - "start": 413, - "end": 416, + "value": "!==", + "start": 1305, + "end": 1308, "loc": { "start": { - "line": 17, - "column": 17 + "line": 42, + "column": 28 }, "end": { - "line": 17, - "column": 20 + "line": 42, + "column": 31 } } }, @@ -3863,17 +8681,17 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 417, - "end": 420, + "value": "BLACK", + "start": 1309, + "end": 1314, "loc": { "start": { - "line": 17, - "column": 21 + "line": 42, + "column": 32 }, "end": { - "line": 17, - "column": 24 + "line": 42, + "column": 37 } } }, @@ -3889,42 +8707,41 @@ "postfix": false, "binop": null }, - "start": 420, - "end": 421, + "start": 1314, + "end": 1315, "loc": { "start": { - "line": 17, - "column": 24 + "line": 42, + "column": 37 }, "end": { - "line": 17, - "column": 25 + "line": 42, + "column": 38 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 421, - "end": 422, + "start": 1316, + "end": 1317, "loc": { "start": { - "line": 17, - "column": 25 + "line": 42, + "column": 39 }, "end": { - "line": 17, - "column": 26 + "line": 42, + "column": 40 } } }, @@ -3941,16 +8758,16 @@ "binop": null }, "value": "assert", - "start": 424, - "end": 430, + "start": 1320, + "end": 1326, "loc": { "start": { - "line": 18, - "column": 1 + "line": 43, + "column": 2 }, "end": { - "line": 18, - "column": 7 + "line": 43, + "column": 8 } } }, @@ -3966,16 +8783,16 @@ "postfix": false, "binop": null }, - "start": 430, - "end": 431, + "start": 1326, + "end": 1327, "loc": { "start": { - "line": 18, - "column": 7 + "line": 43, + "column": 8 }, "end": { - "line": 18, - "column": 8 + "line": 43, + "column": 9 } } }, @@ -3991,17 +8808,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 431, - "end": 432, + "value": "u", + "start": 1327, + "end": 1328, "loc": { "start": { - "line": 18, - "column": 8 + "line": 43, + "column": 9 }, "end": { - "line": 18, - "column": 9 + "line": 43, + "column": 10 } } }, @@ -4018,16 +8835,16 @@ "binop": null, "updateContext": null }, - "start": 432, - "end": 433, + "start": 1328, + "end": 1329, "loc": { "start": { - "line": 18, - "column": 9 + "line": 43, + "column": 10 }, "end": { - "line": 18, - "column": 10 + "line": 43, + "column": 11 } } }, @@ -4043,43 +8860,44 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 433, - "end": 437, + "value": "_color", + "start": 1329, + "end": 1335, "loc": { "start": { - "line": 18, - "column": 10 + "line": 43, + "column": 11 }, "end": { - "line": 18, - "column": 14 + "line": 43, + "column": 17 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 437, - "end": 438, + "value": "===", + "start": 1336, + "end": 1339, "loc": { "start": { - "line": 18, - "column": 14 + "line": 43, + "column": 18 }, "end": { - "line": 18, - "column": 15 + "line": 43, + "column": 21 } } }, @@ -4095,78 +8913,76 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 438, - "end": 444, + "value": "RED", + "start": 1340, + "end": 1343, "loc": { "start": { - "line": 18, - "column": 15 + "line": 43, + "column": 22 }, "end": { - "line": 18, - "column": 21 + "line": 43, + "column": 25 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 445, - "end": 448, + "start": 1343, + "end": 1344, "loc": { "start": { - "line": 18, - "column": 22 + "line": 43, + "column": 25 }, "end": { - "line": 18, - "column": 25 + "line": 43, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "BLACK", - "start": 449, - "end": 454, + "start": 1344, + "end": 1345, "loc": { "start": { - "line": 18, + "line": 43, "column": 26 }, "end": { - "line": 18, - "column": 31 + "line": 43, + "column": 27 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4174,23 +8990,24 @@ "postfix": false, "binop": null }, - "start": 454, - "end": 455, + "value": "n", + "start": 1348, + "end": 1349, "loc": { "start": { - "line": 18, - "column": 31 + "line": 44, + "column": 2 }, "end": { - "line": 18, - "column": 32 + "line": 44, + "column": 3 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4200,16 +9017,16 @@ "binop": null, "updateContext": null }, - "start": 455, - "end": 456, + "start": 1349, + "end": 1350, "loc": { "start": { - "line": 18, - "column": 32 + "line": 44, + "column": 3 }, "end": { - "line": 18, - "column": 33 + "line": 44, + "column": 4 } } }, @@ -4225,42 +9042,43 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 458, - "end": 464, + "value": "parent", + "start": 1350, + "end": 1356, "loc": { "start": { - "line": 19, - "column": 1 + "line": 44, + "column": 4 }, "end": { - "line": 19, - "column": 7 + "line": 44, + "column": 10 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 464, - "end": 465, + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 19, - "column": 7 + "line": 44, + "column": 10 }, "end": { - "line": 19, - "column": 8 + "line": 44, + "column": 11 } } }, @@ -4276,43 +9094,44 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 465, - "end": 466, + "value": "_color", + "start": 1357, + "end": 1363, "loc": { "start": { - "line": 19, - "column": 8 + "line": 44, + "column": 11 }, "end": { - "line": 19, - "column": 9 + "line": 44, + "column": 17 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 466, - "end": 467, + "value": "=", + "start": 1364, + "end": 1365, "loc": { "start": { - "line": 19, - "column": 9 + "line": 44, + "column": 18 }, "end": { - "line": 19, - "column": 10 + "line": 44, + "column": 19 } } }, @@ -4328,24 +9147,24 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 467, - "end": 472, + "value": "BLACK", + "start": 1366, + "end": 1371, "loc": { "start": { - "line": 19, - "column": 10 + "line": 44, + "column": 20 }, "end": { - "line": 19, - "column": 15 + "line": 44, + "column": 25 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4355,16 +9174,16 @@ "binop": null, "updateContext": null }, - "start": 472, - "end": 473, + "start": 1371, + "end": 1372, "loc": { "start": { - "line": 19, - "column": 15 + "line": 44, + "column": 25 }, "end": { - "line": 19, - "column": 16 + "line": 44, + "column": 26 } } }, @@ -4380,44 +9199,43 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 473, - "end": 479, + "value": "u", + "start": 1375, + "end": 1376, "loc": { "start": { - "line": 19, - "column": 16 + "line": 45, + "column": 2 }, "end": { - "line": 19, - "column": 22 + "line": 45, + "column": 3 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 480, - "end": 483, + "start": 1376, + "end": 1377, "loc": { "start": { - "line": 19, - "column": 23 + "line": 45, + "column": 3 }, "end": { - "line": 19, - "column": 26 + "line": 45, + "column": 4 } } }, @@ -4433,119 +9251,124 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 484, - "end": 489, + "value": "_color", + "start": 1377, + "end": 1383, "loc": { "start": { - "line": 19, - "column": 27 + "line": 45, + "column": 4 }, "end": { - "line": 19, - "column": 32 + "line": 45, + "column": 10 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 489, - "end": 490, + "value": "=", + "start": 1384, + "end": 1385, "loc": { "start": { - "line": 19, - "column": 32 + "line": 45, + "column": 11 }, "end": { - "line": 19, - "column": 33 + "line": 45, + "column": 12 } } }, { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 490, - "end": 491, + "value": "BLACK", + "start": 1386, + "end": 1391, "loc": { "start": { - "line": 19, - "column": 33 + "line": 45, + "column": 13 }, "end": { - "line": 19, - "column": 34 + "line": 45, + "column": 18 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 493, - "end": 499, + "start": 1391, + "end": 1392, "loc": { "start": { - "line": 20, - "column": 1 + "line": 45, + "column": 18 }, "end": { - "line": 20, - "column": 7 + "line": 45, + "column": 19 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 499, - "end": 500, + "value": "const", + "start": 1395, + "end": 1400, "loc": { "start": { - "line": 20, - "column": 7 + "line": 46, + "column": 2 }, "end": { - "line": 20, - "column": 8 + "line": 46, + "column": 7 } } }, @@ -4561,43 +9384,44 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 500, - "end": 501, + "value": "g", + "start": 1401, + "end": 1402, "loc": { "start": { - "line": 20, + "line": 46, "column": 8 }, "end": { - "line": 20, + "line": 46, "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 501, - "end": 502, + "value": "=", + "start": 1403, + "end": 1404, "loc": { "start": { - "line": 20, - "column": 9 + "line": 46, + "column": 10 }, "end": { - "line": 20, - "column": 10 + "line": 46, + "column": 11 } } }, @@ -4613,51 +9437,48 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 502, - "end": 508, + "value": "grandparent", + "start": 1405, + "end": 1416, "loc": { "start": { - "line": 20, - "column": 10 + "line": 46, + "column": 12 }, "end": { - "line": 20, - "column": 16 + "line": 46, + "column": 23 } } }, { "type": { - "label": "==/!=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "!==", - "start": 509, - "end": 512, + "start": 1416, + "end": 1417, "loc": { "start": { - "line": 20, - "column": 17 + "line": 46, + "column": 23 }, "end": { - "line": 20, - "column": 20 + "line": 46, + "column": 24 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4665,19 +9486,18 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 513, - "end": 517, + "value": "n", + "start": 1417, + "end": 1418, "loc": { "start": { - "line": 20, - "column": 21 + "line": 46, + "column": 24 }, "end": { - "line": 20, + "line": 46, "column": 25 } } @@ -4694,15 +9514,15 @@ "postfix": false, "binop": null }, - "start": 517, - "end": 518, + "start": 1418, + "end": 1419, "loc": { "start": { - "line": 20, + "line": 46, "column": 25 }, "end": { - "line": 20, + "line": 46, "column": 26 } } @@ -4720,85 +9540,68 @@ "binop": null, "updateContext": null }, - "start": 518, - "end": 519, + "start": 1419, + "end": 1420, "loc": { "start": { - "line": 20, + "line": 46, "column": 26 }, "end": { - "line": 20, + "line": 46, "column": 27 } } }, - { - "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 522, - "end": 666, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 30, - "column": 4 - } - } - }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 668, - "end": 670, + "value": "g", + "start": 1423, + "end": 1424, "loc": { "start": { - "line": 31, - "column": 1 + "line": 47, + "column": 2 }, "end": { - "line": 31, + "line": 47, "column": 3 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 671, - "end": 672, + "start": 1424, + "end": 1425, "loc": { "start": { - "line": 31, - "column": 4 + "line": 47, + "column": 3 }, "end": { - "line": 31, - "column": 5 + "line": 47, + "column": 4 } } }, @@ -4814,43 +9617,44 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 672, - "end": 673, + "value": "_color", + "start": 1425, + "end": 1431, "loc": { "start": { - "line": 31, - "column": 5 + "line": 47, + "column": 4 }, "end": { - "line": 31, - "column": 6 + "line": 47, + "column": 10 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 673, - "end": 674, + "value": "=", + "start": 1432, + "end": 1433, "loc": { "start": { - "line": 31, - "column": 6 + "line": 47, + "column": 11 }, "end": { - "line": 31, - "column": 7 + "line": 47, + "column": 12 } } }, @@ -4866,24 +9670,24 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 674, - "end": 680, + "value": "RED", + "start": 1434, + "end": 1437, "loc": { "start": { - "line": 31, - "column": 7 + "line": 47, + "column": 13 }, "end": { - "line": 31, - "column": 13 + "line": 47, + "column": 16 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4893,16 +9697,16 @@ "binop": null, "updateContext": null }, - "start": 680, - "end": 681, + "start": 1437, + "end": 1438, "loc": { "start": { - "line": 31, - "column": 13 + "line": 47, + "column": 16 }, "end": { - "line": 31, - "column": 14 + "line": 47, + "column": 17 } } }, @@ -4918,44 +9722,42 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 681, - "end": 687, + "value": "insert_case0", + "start": 1441, + "end": 1453, "loc": { "start": { - "line": 31, - "column": 14 + "line": 48, + "column": 2 }, "end": { - "line": 31, - "column": 20 + "line": 48, + "column": 14 } } }, { "type": { - "label": "==/!=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 688, - "end": 691, + "start": 1453, + "end": 1454, "loc": { "start": { - "line": 31, - "column": 21 + "line": 48, + "column": 14 }, "end": { - "line": 31, - "column": 24 + "line": 48, + "column": 15 } } }, @@ -4971,17 +9773,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 692, - "end": 697, + "value": "g", + "start": 1454, + "end": 1455, "loc": { "start": { - "line": 31, - "column": 25 + "line": 48, + "column": 15 }, "end": { - "line": 31, - "column": 30 + "line": 48, + "column": 16 } } }, @@ -4997,23 +9799,22 @@ "postfix": false, "binop": null }, - "start": 697, - "end": 698, + "start": 1455, + "end": 1456, "loc": { "start": { - "line": 31, - "column": 30 + "line": 48, + "column": 16 }, "end": { - "line": 31, - "column": 31 + "line": 48, + "column": 17 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5024,23 +9825,48 @@ "binop": null, "updateContext": null }, - "value": "return", - "start": 699, - "end": 705, + "start": 1456, + "end": 1457, "loc": { "start": { - "line": 31, - "column": 32 + "line": 48, + "column": 17 }, "end": { - "line": 31, - "column": 38 + "line": 48, + "column": 18 } } }, { "type": { - "label": ";", + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1459, + "end": 1460, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 2 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5051,16 +9877,17 @@ "binop": null, "updateContext": null }, - "start": 705, - "end": 706, + "value": "else", + "start": 1461, + "end": 1465, "loc": { "start": { - "line": 31, - "column": 38 + "line": 49, + "column": 3 }, "end": { - "line": 31, - "column": 39 + "line": 49, + "column": 7 } } }, @@ -5077,16 +9904,16 @@ "binop": null }, "value": "insert_case3", - "start": 709, - "end": 721, + "start": 1466, + "end": 1478, "loc": { "start": { - "line": 33, - "column": 1 + "line": 49, + "column": 8 }, "end": { - "line": 33, - "column": 13 + "line": 49, + "column": 20 } } }, @@ -5102,16 +9929,16 @@ "postfix": false, "binop": null }, - "start": 721, - "end": 722, + "start": 1478, + "end": 1479, "loc": { "start": { - "line": 33, - "column": 13 + "line": 49, + "column": 20 }, "end": { - "line": 33, - "column": 14 + "line": 49, + "column": 21 } } }, @@ -5128,16 +9955,16 @@ "binop": null }, "value": "n", - "start": 722, - "end": 723, + "start": 1479, + "end": 1480, "loc": { "start": { - "line": 33, - "column": 14 + "line": 49, + "column": 21 }, "end": { - "line": 33, - "column": 15 + "line": 49, + "column": 22 } } }, @@ -5153,16 +9980,16 @@ "postfix": false, "binop": null }, - "start": 723, - "end": 724, + "start": 1480, + "end": 1481, "loc": { "start": { - "line": 33, - "column": 15 + "line": 49, + "column": 22 }, "end": { - "line": 33, - "column": 16 + "line": 49, + "column": 23 } } }, @@ -5179,16 +10006,16 @@ "binop": null, "updateContext": null }, - "start": 724, - "end": 725, + "start": 1481, + "end": 1482, "loc": { "start": { - "line": 33, - "column": 16 + "line": 49, + "column": 23 }, "end": { - "line": 33, - "column": 17 + "line": 49, + "column": 24 } } }, @@ -5204,15 +10031,15 @@ "postfix": false, "binop": null }, - "start": 726, - "end": 727, + "start": 1483, + "end": 1484, "loc": { "start": { - "line": 34, + "line": 50, "column": 0 }, "end": { - "line": 34, + "line": 50, "column": 1 } } @@ -5230,15 +10057,15 @@ "binop": null, "updateContext": null }, - "start": 727, - "end": 728, + "start": 1484, + "end": 1485, "loc": { "start": { - "line": 34, + "line": 50, "column": 1 }, "end": { - "line": 34, + "line": 50, "column": 2 } } @@ -5258,15 +10085,15 @@ "updateContext": null }, "value": "export", - "start": 730, - "end": 736, + "start": 1487, + "end": 1493, "loc": { "start": { - "line": 36, + "line": 52, "column": 0 }, "end": { - "line": 36, + "line": 52, "column": 6 } } @@ -5286,15 +10113,15 @@ "updateContext": null }, "value": "default", - "start": 737, - "end": 744, + "start": 1494, + "end": 1501, "loc": { "start": { - "line": 36, + "line": 52, "column": 7 }, "end": { - "line": 36, + "line": 52, "column": 14 } } @@ -5312,15 +10139,15 @@ "binop": null }, "value": "insert_case2", - "start": 745, - "end": 757, + "start": 1502, + "end": 1514, "loc": { "start": { - "line": 36, + "line": 52, "column": 15 }, "end": { - "line": 36, + "line": 52, "column": 27 } } @@ -5338,15 +10165,15 @@ "binop": null, "updateContext": null }, - "start": 757, - "end": 758, + "start": 1514, + "end": 1515, "loc": { "start": { - "line": 36, + "line": 52, "column": 27 }, "end": { - "line": 36, + "line": 52, "column": 28 } } @@ -5364,15 +10191,15 @@ "binop": null, "updateContext": null }, - "start": 759, - "end": 759, + "start": 1516, + "end": 1516, "loc": { "start": { - "line": 37, + "line": 53, "column": 0 }, "end": { - "line": 37, + "line": 53, "column": 0 } } diff --git a/ast/source/insertion/insert_case3.js.json b/ast/source/insertion/insert_case3.js.json index 4aee9eb..b0eb83c 100644 --- a/ast/source/insertion/insert_case3.js.json +++ b/ast/source/insertion/insert_case3.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1433, + "end": 2698, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 52, + "line": 93, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1433, + "end": 2698, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 52, + "line": 93, "column": 0 } }, @@ -307,7 +307,7 @@ { "type": "ImportDeclaration", "start": 140, - "end": 179, + "end": 191, "loc": { "start": { "line": 5, @@ -315,14 +315,14 @@ }, "end": { "line": 5, - "column": 39 + "column": 51 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 147, - "end": 152, + "end": 158, "loc": { "start": { "line": 5, @@ -330,13 +330,13 @@ }, "end": { "line": 5, - "column": 12 + "column": 18 } }, "local": { "type": "Identifier", "start": 147, - "end": 152, + "end": 158, "loc": { "start": { "line": 5, @@ -344,39 +344,39 @@ }, "end": { "line": 5, - "column": 12 + "column": 18 }, - "identifierName": "uncle" + "identifierName": "rotate_left" }, - "name": "uncle" + "name": "rotate_left" } } ], "source": { "type": "StringLiteral", - "start": 158, - "end": 178, + "start": 164, + "end": 190, "loc": { "start": { "line": 5, - "column": 18 + "column": 24 }, "end": { "line": 5, - "column": 38 + "column": 50 } }, "extra": { - "rawValue": "../family/uncle.js", - "raw": "'../family/uncle.js'" + "rawValue": "../rotate/rotate_left.js", + "raw": "'../rotate/rotate_left.js'" }, - "value": "../family/uncle.js" + "value": "../rotate/rotate_left.js" } }, { "type": "ImportDeclaration", - "start": 180, - "end": 231, + "start": 192, + "end": 245, "loc": { "start": { "line": 6, @@ -384,14 +384,14 @@ }, "end": { "line": 6, - "column": 51 + "column": 53 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 187, - "end": 198, + "start": 199, + "end": 211, "loc": { "start": { "line": 6, @@ -399,13 +399,13 @@ }, "end": { "line": 6, - "column": 18 + "column": 19 } }, "local": { "type": "Identifier", - "start": 187, - "end": 198, + "start": 199, + "end": 211, "loc": { "start": { "line": 6, @@ -413,39 +413,39 @@ }, "end": { "line": 6, - "column": 18 + "column": 19 }, - "identifierName": "grandparent" + "identifierName": "rotate_right" }, - "name": "grandparent" + "name": "rotate_right" } } ], "source": { "type": "StringLiteral", - "start": 204, - "end": 230, + "start": 217, + "end": 244, "loc": { "start": { "line": 6, - "column": 24 + "column": 25 }, "end": { "line": 6, - "column": 50 + "column": 52 } }, "extra": { - "rawValue": "../family/grandparent.js", - "raw": "'../family/grandparent.js'" + "rawValue": "../rotate/rotate_right.js", + "raw": "'../rotate/rotate_right.js'" }, - "value": "../family/grandparent.js" + "value": "../rotate/rotate_right.js" } }, { "type": "ImportDeclaration", - "start": 232, - "end": 277, + "start": 246, + "end": 297, "loc": { "start": { "line": 7, @@ -453,14 +453,14 @@ }, "end": { "line": 7, - "column": 45 + "column": 51 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 239, - "end": 251, + "start": 253, + "end": 264, "loc": { "start": { "line": 7, @@ -468,13 +468,13 @@ }, "end": { "line": 7, - "column": 19 + "column": 18 } }, "local": { "type": "Identifier", - "start": 239, - "end": 251, + "start": 253, + "end": 264, "loc": { "start": { "line": 7, @@ -482,39 +482,39 @@ }, "end": { "line": 7, - "column": 19 + "column": 18 }, - "identifierName": "insert_case1" + "identifierName": "grandparent" }, - "name": "insert_case1" + "name": "grandparent" } } ], "source": { "type": "StringLiteral", - "start": 257, - "end": 276, + "start": 270, + "end": 296, "loc": { "start": { "line": 7, - "column": 25 + "column": 24 }, "end": { "line": 7, - "column": 44 + "column": 50 } }, "extra": { - "rawValue": "./insert_case1.js", - "raw": "'./insert_case1.js'" + "rawValue": "../family/grandparent.js", + "raw": "'../family/grandparent.js'" }, - "value": "./insert_case1.js" + "value": "../family/grandparent.js" } }, { "type": "ImportDeclaration", - "start": 278, - "end": 323, + "start": 298, + "end": 343, "loc": { "start": { "line": 8, @@ -528,8 +528,8 @@ "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 285, - "end": 297, + "start": 305, + "end": 317, "loc": { "start": { "line": 8, @@ -542,8 +542,8 @@ }, "local": { "type": "Identifier", - "start": 285, - "end": 297, + "start": 305, + "end": 317, "loc": { "start": { "line": 8, @@ -561,8 +561,8 @@ ], "source": { "type": "StringLiteral", - "start": 303, - "end": 322, + "start": 323, + "end": 342, "loc": { "start": { "line": 8, @@ -582,16 +582,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 325, - "end": 501, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n ", + "start": 345, + "end": 635, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 18, + "line": 21, "column": 3 } } @@ -600,44 +600,44 @@ }, { "type": "Identifier", - "start": 502, - "end": 1402, + "start": 636, + "end": 2667, "loc": { "start": { - "line": 19, + "line": 22, "column": 0 }, "end": { - "line": 49, + "line": 90, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 508, - "end": 1401, + "start": 642, + "end": 2666, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 49, + "line": 90, "column": 1 } }, "id": { "type": "Identifier", - "start": 508, - "end": 520, + "start": 642, + "end": 654, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 19, + "line": 22, "column": 18 }, "identifierName": "insert_case3" @@ -647,15 +647,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 523, - "end": 1401, + "start": 657, + "end": 2666, "loc": { "start": { - "line": 19, + "line": 22, "column": 21 }, "end": { - "line": 49, + "line": 90, "column": 1 } }, @@ -666,15 +666,15 @@ "params": [ { "type": "Identifier", - "start": 524, - "end": 525, + "start": 658, + "end": 659, "loc": { "start": { - "line": 19, + "line": 22, "column": 22 }, "end": { - "line": 19, + "line": 22, "column": 23 }, "identifierName": "n" @@ -684,58 +684,58 @@ ], "body": { "type": "BlockStatement", - "start": 530, - "end": 1401, + "start": 664, + "end": 2666, "loc": { "start": { - "line": 19, + "line": 22, "column": 28 }, "end": { - "line": 49, + "line": 90, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 533, - "end": 559, + "start": 667, + "end": 693, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 533, - "end": 558, + "start": 667, + "end": 692, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 533, - "end": 539, + "start": 667, + "end": 673, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -745,29 +745,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 540, - "end": 557, + "start": 674, + "end": 691, "loc": { "start": { - "line": 20, + "line": 23, "column": 8 }, "end": { - "line": 20, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 540, - "end": 541, + "start": 674, + "end": 675, "loc": { "start": { - "line": 20, + "line": 23, "column": 8 }, "end": { - "line": 20, + "line": 23, "column": 9 }, "identifierName": "n" @@ -777,15 +777,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 553, - "end": 557, + "start": 687, + "end": 691, "loc": { "start": { - "line": 20, + "line": 23, "column": 21 }, "end": { - "line": 20, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -798,43 +798,43 @@ }, { "type": "ExpressionStatement", - "start": 561, - "end": 586, + "start": 695, + "end": 720, "loc": { "start": { - "line": 21, + "line": 24, "column": 1 }, "end": { - "line": 21, + "line": 24, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 561, - "end": 585, + "start": 695, + "end": 719, "loc": { "start": { - "line": 21, + "line": 24, "column": 1 }, "end": { - "line": 21, + "line": 24, "column": 25 } }, "callee": { "type": "Identifier", - "start": 561, - "end": 567, + "start": 695, + "end": 701, "loc": { "start": { - "line": 21, + "line": 24, "column": 1 }, "end": { - "line": 21, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -844,43 +844,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 568, - "end": 584, + "start": 702, + "end": 718, "loc": { "start": { - "line": 21, + "line": 24, "column": 8 }, "end": { - "line": 21, + "line": 24, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 568, - "end": 576, + "start": 702, + "end": 710, "loc": { "start": { - "line": 21, + "line": 24, "column": 8 }, "end": { - "line": 21, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 568, - "end": 569, + "start": 702, + "end": 703, "loc": { "start": { - "line": 21, + "line": 24, "column": 8 }, "end": { - "line": 21, + "line": 24, "column": 9 }, "identifierName": "n" @@ -889,15 +889,15 @@ }, "property": { "type": "Identifier", - "start": 570, - "end": 576, + "start": 704, + "end": 710, "loc": { "start": { - "line": 21, + "line": 24, "column": 10 }, "end": { - "line": 21, + "line": 24, "column": 16 }, "identifierName": "_color" @@ -909,15 +909,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 581, - "end": 584, + "start": 715, + "end": 718, "loc": { "start": { - "line": 21, + "line": 24, "column": 21 }, "end": { - "line": 21, + "line": 24, "column": 24 }, "identifierName": "RED" @@ -930,43 +930,43 @@ }, { "type": "ExpressionStatement", - "start": 588, - "end": 620, + "start": 722, + "end": 773, "loc": { "start": { - "line": 22, + "line": 25, "column": 1 }, "end": { - "line": 22, - "column": 33 + "line": 25, + "column": 52 } }, "expression": { "type": "CallExpression", - "start": 588, - "end": 619, + "start": 722, + "end": 772, "loc": { "start": { - "line": 22, + "line": 25, "column": 1 }, "end": { - "line": 22, - "column": 32 + "line": 25, + "column": 51 } }, "callee": { "type": "Identifier", - "start": 588, - "end": 594, + "start": 722, + "end": 728, "loc": { "start": { - "line": 22, + "line": 25, "column": 1 }, "end": { - "line": 22, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -975,58 +975,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 595, - "end": 618, + "type": "LogicalExpression", + "start": 729, + "end": 771, "loc": { "start": { - "line": 22, + "line": 25, "column": 8 }, "end": { - "line": 22, - "column": 31 + "line": 25, + "column": 50 } }, "left": { - "type": "MemberExpression", - "start": 595, - "end": 608, + "type": "BinaryExpression", + "start": 729, + "end": 744, "loc": { "start": { - "line": 22, + "line": 25, "column": 8 }, "end": { - "line": 22, - "column": 21 + "line": 25, + "column": 23 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 595, - "end": 601, + "start": 729, + "end": 735, "loc": { "start": { - "line": 22, + "line": 25, "column": 8 }, "end": { - "line": 22, + "line": 25, "column": 14 } }, "object": { "type": "Identifier", - "start": 595, - "end": 596, + "start": 729, + "end": 730, "loc": { "start": { - "line": 22, + "line": 25, "column": 8 }, "end": { - "line": 22, + "line": 25, "column": 9 }, "identifierName": "n" @@ -1035,15 +1035,15 @@ }, "property": { "type": "Identifier", - "start": 597, - "end": 601, + "start": 731, + "end": 735, "loc": { "start": { - "line": 22, + "line": 25, "column": 10 }, "end": { - "line": 22, + "line": 25, "column": 14 }, "identifierName": "left" @@ -1052,42 +1052,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 602, - "end": 608, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 740, + "end": 744, "loc": { "start": { - "line": 22, - "column": 15 + "line": 25, + "column": 19 }, "end": { - "line": 22, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 25, + "column": 23 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 613, - "end": 618, + "type": "BinaryExpression", + "start": 748, + "end": 771, "loc": { "start": { - "line": 22, - "column": 26 + "line": 25, + "column": 27 }, "end": { - "line": 22, - "column": 31 + "line": 25, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 748, + "end": 761, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 40 + } + }, + "object": { + "type": "MemberExpression", + "start": 748, + "end": 754, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 748, + "end": 749, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 28 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 750, + "end": 754, + "loc": { + "start": { + "line": 25, + "column": 29 + }, + "end": { + "line": 25, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 755, + "end": 761, + "loc": { + "start": { + "line": 25, + "column": 34 + }, + "end": { + "line": 25, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "BLACK" + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 766, + "end": 771, + "loc": { + "start": { + "line": 25, + "column": 45 + }, + "end": { + "line": 25, + "column": 50 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -1095,43 +1192,43 @@ }, { "type": "ExpressionStatement", - "start": 622, - "end": 655, + "start": 775, + "end": 828, "loc": { "start": { - "line": 23, + "line": 26, "column": 1 }, "end": { - "line": 23, - "column": 34 + "line": 26, + "column": 54 } }, "expression": { "type": "CallExpression", - "start": 622, - "end": 654, + "start": 775, + "end": 827, "loc": { "start": { - "line": 23, + "line": 26, "column": 1 }, "end": { - "line": 23, - "column": 33 + "line": 26, + "column": 53 } }, "callee": { "type": "Identifier", - "start": 622, - "end": 628, + "start": 775, + "end": 781, "loc": { "start": { - "line": 23, + "line": 26, "column": 1 }, "end": { - "line": 23, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -1140,58 +1237,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 629, - "end": 653, + "type": "LogicalExpression", + "start": 782, + "end": 826, "loc": { "start": { - "line": 23, + "line": 26, "column": 8 }, "end": { - "line": 23, - "column": 32 + "line": 26, + "column": 52 } }, "left": { - "type": "MemberExpression", - "start": 629, - "end": 643, + "type": "BinaryExpression", + "start": 782, + "end": 798, "loc": { "start": { - "line": 23, + "line": 26, "column": 8 }, "end": { - "line": 23, - "column": 22 + "line": 26, + "column": 24 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 629, - "end": 636, + "start": 782, + "end": 789, "loc": { "start": { - "line": 23, + "line": 26, "column": 8 }, "end": { - "line": 23, + "line": 26, "column": 15 } }, "object": { "type": "Identifier", - "start": 629, - "end": 630, + "start": 782, + "end": 783, "loc": { "start": { - "line": 23, + "line": 26, "column": 8 }, "end": { - "line": 23, + "line": 26, "column": 9 }, "identifierName": "n" @@ -1200,15 +1297,15 @@ }, "property": { "type": "Identifier", - "start": 631, - "end": 636, + "start": 784, + "end": 789, "loc": { "start": { - "line": 23, + "line": 26, "column": 10 }, "end": { - "line": 23, + "line": 26, "column": 15 }, "identifierName": "right" @@ -1217,42 +1314,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 637, - "end": 643, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 794, + "end": 798, "loc": { "start": { - "line": 23, - "column": 16 + "line": 26, + "column": 20 }, "end": { - "line": 23, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 648, - "end": 653, + "line": 26, + "column": 24 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 802, + "end": 826, "loc": { "start": { - "line": 23, - "column": 27 + "line": 26, + "column": 28 }, "end": { - "line": 23, - "column": 32 + "line": 26, + "column": 52 + } + }, + "left": { + "type": "MemberExpression", + "start": 802, + "end": 816, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 802, + "end": 809, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 802, + "end": 803, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 29 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 804, + "end": 809, + "loc": { + "start": { + "line": 26, + "column": 30 + }, + "end": { + "line": 26, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 810, + "end": 816, + "loc": { + "start": { + "line": 26, + "column": 36 + }, + "end": { + "line": 26, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "BLACK" + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 821, + "end": 826, + "loc": { + "start": { + "line": 26, + "column": 47 + }, + "end": { + "line": 26, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -1260,43 +1454,43 @@ }, { "type": "ExpressionStatement", - "start": 657, - "end": 683, + "start": 830, + "end": 856, "loc": { "start": { - "line": 24, + "line": 27, "column": 1 }, "end": { - "line": 24, + "line": 27, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 657, - "end": 682, + "start": 830, + "end": 855, "loc": { "start": { - "line": 24, + "line": 27, "column": 1 }, "end": { - "line": 24, + "line": 27, "column": 26 } }, "callee": { "type": "Identifier", - "start": 657, - "end": 663, + "start": 830, + "end": 836, "loc": { "start": { - "line": 24, + "line": 27, "column": 1 }, "end": { - "line": 24, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -1306,43 +1500,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 664, - "end": 681, + "start": 837, + "end": 854, "loc": { "start": { - "line": 24, + "line": 27, "column": 8 }, "end": { - "line": 24, + "line": 27, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 664, - "end": 672, + "start": 837, + "end": 845, "loc": { "start": { - "line": 24, + "line": 27, "column": 8 }, "end": { - "line": 24, + "line": 27, "column": 16 } }, "object": { "type": "Identifier", - "start": 664, - "end": 665, + "start": 837, + "end": 838, "loc": { "start": { - "line": 24, + "line": 27, "column": 8 }, "end": { - "line": 24, + "line": 27, "column": 9 }, "identifierName": "n" @@ -1351,15 +1545,15 @@ }, "property": { "type": "Identifier", - "start": 666, - "end": 672, + "start": 839, + "end": 845, "loc": { "start": { - "line": 24, + "line": 27, "column": 10 }, "end": { - "line": 24, + "line": 27, "column": 16 }, "identifierName": "parent" @@ -1371,15 +1565,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 677, - "end": 681, + "start": 850, + "end": 854, "loc": { "start": { - "line": 24, + "line": 27, "column": 21 }, "end": { - "line": 24, + "line": 27, "column": 25 } } @@ -1390,43 +1584,43 @@ }, { "type": "ExpressionStatement", - "start": 685, - "end": 717, + "start": 858, + "end": 890, "loc": { "start": { - "line": 25, + "line": 28, "column": 1 }, "end": { - "line": 25, + "line": 28, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 685, - "end": 716, + "start": 858, + "end": 889, "loc": { "start": { - "line": 25, + "line": 28, "column": 1 }, "end": { - "line": 25, + "line": 28, "column": 32 } }, "callee": { "type": "Identifier", - "start": 685, - "end": 691, + "start": 858, + "end": 864, "loc": { "start": { - "line": 25, + "line": 28, "column": 1 }, "end": { - "line": 25, + "line": 28, "column": 7 }, "identifierName": "assert" @@ -1436,57 +1630,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 692, - "end": 715, + "start": 865, + "end": 888, "loc": { "start": { - "line": 25, + "line": 28, "column": 8 }, "end": { - "line": 25, + "line": 28, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 692, - "end": 707, + "start": 865, + "end": 880, "loc": { "start": { - "line": 25, + "line": 28, "column": 8 }, "end": { - "line": 25, + "line": 28, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 692, - "end": 700, + "start": 865, + "end": 873, "loc": { "start": { - "line": 25, + "line": 28, "column": 8 }, "end": { - "line": 25, + "line": 28, "column": 16 } }, "object": { "type": "Identifier", - "start": 692, - "end": 693, + "start": 865, + "end": 866, "loc": { "start": { - "line": 25, + "line": 28, "column": 8 }, "end": { - "line": 25, + "line": 28, "column": 9 }, "identifierName": "n" @@ -1495,15 +1689,15 @@ }, "property": { "type": "Identifier", - "start": 694, - "end": 700, + "start": 867, + "end": 873, "loc": { "start": { - "line": 25, + "line": 28, "column": 10 }, "end": { - "line": 25, + "line": 28, "column": 16 }, "identifierName": "parent" @@ -1514,15 +1708,15 @@ }, "property": { "type": "Identifier", - "start": 701, - "end": 707, + "start": 874, + "end": 880, "loc": { "start": { - "line": 25, + "line": 28, "column": 17 }, "end": { - "line": 25, + "line": 28, "column": 23 }, "identifierName": "_color" @@ -1534,15 +1728,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 712, - "end": 715, + "start": 885, + "end": 888, "loc": { "start": { - "line": 25, + "line": 28, "column": 28 }, "end": { - "line": 25, + "line": 28, "column": 31 }, "identifierName": "RED" @@ -1555,94 +1749,94 @@ }, { "type": "VariableDeclaration", - "start": 719, - "end": 738, + "start": 892, + "end": 917, "loc": { "start": { - "line": 26, + "line": 29, "column": 1 }, "end": { - "line": 26, - "column": 20 + "line": 29, + "column": 26 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 725, - "end": 737, + "start": 898, + "end": 916, "loc": { "start": { - "line": 26, + "line": 29, "column": 7 }, "end": { - "line": 26, - "column": 19 + "line": 29, + "column": 25 } }, "id": { "type": "Identifier", - "start": 725, - "end": 726, + "start": 898, + "end": 899, "loc": { "start": { - "line": 26, + "line": 29, "column": 7 }, "end": { - "line": 26, + "line": 29, "column": 8 }, - "identifierName": "u" + "identifierName": "g" }, - "name": "u" + "name": "g" }, "init": { "type": "CallExpression", - "start": 729, - "end": 737, + "start": 902, + "end": 916, "loc": { "start": { - "line": 26, + "line": 29, "column": 11 }, "end": { - "line": 26, - "column": 19 + "line": 29, + "column": 25 } }, "callee": { "type": "Identifier", - "start": 729, - "end": 734, + "start": 902, + "end": 913, "loc": { "start": { - "line": 26, + "line": 29, "column": 11 }, "end": { - "line": 26, - "column": 16 + "line": 29, + "column": 22 }, - "identifierName": "uncle" + "identifierName": "grandparent" }, - "name": "uncle" + "name": "grandparent" }, "arguments": [ { "type": "Identifier", - "start": 735, - "end": 736, + "start": 914, + "end": 915, "loc": { "start": { - "line": 26, - "column": 17 + "line": 29, + "column": 23 }, "end": { - "line": 26, - "column": 18 + "line": 29, + "column": 24 }, "identifierName": "n" }, @@ -1656,16 +1850,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 741, - "end": 1236, + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 920, + "end": 1382, "loc": { "start": { - "line": 28, + "line": 31, "column": 1 }, "end": { - "line": 40, + "line": 43, "column": 4 } } @@ -1674,188 +1868,356 @@ }, { "type": "IfStatement", - "start": 1239, - "end": 1399, + "start": 1385, + "end": 2645, "loc": { "start": { - "line": 42, + "line": 45, "column": 1 }, "end": { - "line": 48, - "column": 24 + "line": 87, + "column": 2 } }, "test": { - "type": "BinaryExpression", - "start": 1243, - "end": 1259, + "type": "LogicalExpression", + "start": 1389, + "end": 1432, "loc": { "start": { - "line": 42, + "line": 45, "column": 5 }, "end": { - "line": 42, - "column": 21 + "line": 45, + "column": 48 } }, "left": { - "type": "MemberExpression", - "start": 1243, - "end": 1251, + "type": "BinaryExpression", + "start": 1389, + "end": 1409, "loc": { "start": { - "line": 42, + "line": 45, "column": 5 }, "end": { - "line": 42, - "column": 13 + "line": 45, + "column": 25 } }, - "object": { + "left": { "type": "Identifier", - "start": 1243, - "end": 1244, + "start": 1389, + "end": 1390, "loc": { "start": { - "line": 42, + "line": 45, "column": 5 }, "end": { - "line": 42, + "line": 45, "column": 6 }, - "identifierName": "u" + "identifierName": "n" }, - "name": "u", + "name": "n", "leadingComments": null }, - "property": { - "type": "Identifier", - "start": 1245, - "end": 1251, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1395, + "end": 1409, "loc": { "start": { - "line": 42, - "column": 7 + "line": 45, + "column": 11 }, "end": { - "line": 42, - "column": 13 + "line": 45, + "column": 25 + } + }, + "object": { + "type": "MemberExpression", + "start": 1395, + "end": 1403, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 1395, + "end": 1396, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1397, + "end": 1403, + "loc": { + "start": { + "line": 45, + "column": 13 + }, + "end": { + "line": 45, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1404, + "end": 1409, + "loc": { + "start": { + "line": 45, + "column": 20 + }, + "end": { + "line": 45, + "column": 25 + }, + "identifierName": "right" }, - "identifierName": "_color" + "name": "right" }, - "name": "_color" + "computed": false }, - "computed": false, "leadingComments": null }, - "operator": "===", + "operator": "&&", "right": { - "type": "Identifier", - "start": 1256, - "end": 1259, + "type": "BinaryExpression", + "start": 1413, + "end": 1432, "loc": { "start": { - "line": 42, - "column": 18 + "line": 45, + "column": 29 }, "end": { - "line": 42, - "column": 21 - }, - "identifierName": "RED" - }, - "name": "RED" - }, - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 1261, - "end": 1377, - "loc": { - "start": { - "line": 42, - "column": 23 + "line": 45, + "column": 48 + } }, - "end": { - "line": 48, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1265, - "end": 1289, + "left": { + "type": "MemberExpression", + "start": 1413, + "end": 1421, "loc": { "start": { - "line": 43, - "column": 2 + "line": 45, + "column": 29 }, "end": { - "line": 43, - "column": 26 + "line": 45, + "column": 37 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1265, - "end": 1288, + "object": { + "type": "Identifier", + "start": 1413, + "end": 1414, "loc": { "start": { - "line": 43, - "column": 2 + "line": 45, + "column": 29 }, "end": { - "line": 43, - "column": 25 + "line": 45, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1415, + "end": 1421, + "loc": { + "start": { + "line": 45, + "column": 31 + }, + "end": { + "line": 45, + "column": 37 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1426, + "end": 1432, + "loc": { + "start": { + "line": 45, + "column": 42 + }, + "end": { + "line": 45, + "column": 48 + } + }, + "object": { + "type": "Identifier", + "start": 1426, + "end": 1427, + "loc": { + "start": { + "line": 45, + "column": 42 + }, + "end": { + "line": 45, + "column": 43 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1428, + "end": 1432, + "loc": { + "start": { + "line": 45, + "column": 44 + }, + "end": { + "line": 45, + "column": 48 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1434, + "end": 1804, + "loc": { + "start": { + "line": 45, + "column": 50 + }, + "end": { + "line": 60, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1438, + "end": 1460, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1438, + "end": 1459, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 23 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1265, - "end": 1280, + "callee": { + "type": "Identifier", + "start": 1438, + "end": 1449, "loc": { "start": { - "line": 43, + "line": 46, "column": 2 }, "end": { - "line": 43, - "column": 17 - } + "line": 46, + "column": 13 + }, + "identifierName": "rotate_left" }, - "object": { + "name": "rotate_left" + }, + "arguments": [ + { "type": "MemberExpression", - "start": 1265, - "end": 1273, + "start": 1450, + "end": 1458, "loc": { "start": { - "line": 43, - "column": 2 + "line": 46, + "column": 14 }, "end": { - "line": 43, - "column": 10 + "line": 46, + "column": 22 } }, "object": { "type": "Identifier", - "start": 1265, - "end": 1266, + "start": 1450, + "end": 1451, "loc": { "start": { - "line": 43, - "column": 2 + "line": 46, + "column": 14 }, "end": { - "line": 43, - "column": 3 + "line": 46, + "column": 15 }, "identifierName": "n" }, @@ -1863,511 +2225,582 @@ }, "property": { "type": "Identifier", - "start": 1267, - "end": 1273, + "start": 1452, + "end": 1458, "loc": { "start": { - "line": 43, - "column": 4 + "line": 46, + "column": 16 }, "end": { - "line": 43, - "column": 10 + "line": 46, + "column": 22 }, "identifierName": "parent" }, "name": "parent" }, "computed": false - }, - "property": { - "type": "Identifier", - "start": 1274, - "end": 1280, - "loc": { - "start": { - "line": 43, - "column": 11 - }, - "end": { - "line": 43, - "column": 17 - }, - "identifierName": "_color" + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1464, + "end": 1720, + "loc": { + "start": { + "line": 48, + "column": 2 }, - "name": "_color" - }, - "computed": false + "end": { + "line": 57, + "column": 5 + } + } }, - "right": { - "type": "Identifier", - "start": 1283, - "end": 1288, + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1724, + "end": 1801, "loc": { "start": { - "line": 43, - "column": 20 + "line": 59, + "column": 2 }, "end": { - "line": 43, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" + "line": 59, + "column": 79 + } + } } + ] + } + ], + "directives": [] + }, + "alternate": { + "type": "IfStatement", + "start": 1810, + "end": 2645, + "loc": { + "start": { + "line": 60, + "column": 8 + }, + "end": { + "line": 87, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1814, + "end": 1857, + "loc": { + "start": { + "line": 60, + "column": 12 + }, + "end": { + "line": 60, + "column": 55 } }, - { - "type": "ExpressionStatement", - "start": 1292, - "end": 1309, + "left": { + "type": "BinaryExpression", + "start": 1814, + "end": 1833, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 12 }, "end": { - "line": 44, - "column": 19 + "line": 60, + "column": 31 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1292, - "end": 1308, + "left": { + "type": "Identifier", + "start": 1814, + "end": 1815, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 12 }, "end": { - "line": 44, + "line": 60, + "column": 13 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1820, + "end": 1833, + "loc": { + "start": { + "line": 60, "column": 18 + }, + "end": { + "line": 60, + "column": 31 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 1292, - "end": 1300, + "start": 1820, + "end": 1828, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 18 }, "end": { - "line": 44, - "column": 10 + "line": 60, + "column": 26 } }, "object": { "type": "Identifier", - "start": 1292, - "end": 1293, + "start": 1820, + "end": 1821, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 18 }, "end": { - "line": 44, - "column": 3 + "line": 60, + "column": 19 }, - "identifierName": "u" + "identifierName": "n" }, - "name": "u" + "name": "n" }, "property": { "type": "Identifier", - "start": 1294, - "end": 1300, + "start": 1822, + "end": 1828, "loc": { "start": { - "line": 44, - "column": 4 + "line": 60, + "column": 20 }, "end": { - "line": 44, - "column": 10 + "line": 60, + "column": 26 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false }, - "right": { + "property": { "type": "Identifier", - "start": 1303, - "end": 1308, + "start": 1829, + "end": 1833, "loc": { "start": { - "line": 44, - "column": 13 + "line": 60, + "column": 27 }, "end": { - "line": 44, - "column": 18 + "line": 60, + "column": 31 }, - "identifierName": "BLACK" + "identifierName": "left" }, - "name": "BLACK" - } + "name": "left" + }, + "computed": false } }, - { - "type": "VariableDeclaration", - "start": 1312, - "end": 1337, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1837, + "end": 1857, "loc": { "start": { - "line": 45, - "column": 2 + "line": 60, + "column": 35 }, "end": { - "line": 45, - "column": 27 + "line": 60, + "column": 55 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 1318, - "end": 1336, + "left": { + "type": "MemberExpression", + "start": 1837, + "end": 1845, + "loc": { + "start": { + "line": 60, + "column": 35 + }, + "end": { + "line": 60, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 1837, + "end": 1838, "loc": { "start": { - "line": 45, - "column": 8 + "line": 60, + "column": 35 }, "end": { - "line": 45, - "column": 26 - } + "line": 60, + "column": 36 + }, + "identifierName": "n" }, - "id": { - "type": "Identifier", - "start": 1318, - "end": 1319, - "loc": { - "start": { - "line": 45, - "column": 8 - }, - "end": { - "line": 45, - "column": 9 - }, - "identifierName": "g" - }, - "name": "g" - }, - "init": { - "type": "CallExpression", - "start": 1322, - "end": 1336, - "loc": { - "start": { - "line": 45, - "column": 12 - }, - "end": { - "line": 45, - "column": 26 - } + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1839, + "end": 1845, + "loc": { + "start": { + "line": 60, + "column": 37 }, - "callee": { - "type": "Identifier", - "start": 1322, - "end": 1333, - "loc": { - "start": { - "line": 45, - "column": 12 - }, - "end": { - "line": 45, - "column": 23 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" + "end": { + "line": 60, + "column": 43 }, - "arguments": [ - { - "type": "Identifier", - "start": 1334, - "end": 1335, - "loc": { - "start": { - "line": 45, - "column": 24 - }, - "end": { - "line": 45, - "column": 25 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 1340, - "end": 1355, - "loc": { - "start": { - "line": 46, - "column": 2 + "identifierName": "parent" + }, + "name": "parent" }, - "end": { - "line": 46, - "column": 17 - } + "computed": false }, - "expression": { - "type": "AssignmentExpression", - "start": 1340, - "end": 1354, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1850, + "end": 1857, "loc": { "start": { - "line": 46, - "column": 2 + "line": 60, + "column": 48 }, "end": { - "line": 46, - "column": 16 + "line": 60, + "column": 55 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1340, - "end": 1348, + "object": { + "type": "Identifier", + "start": 1850, + "end": 1851, "loc": { "start": { - "line": 46, - "column": 2 + "line": 60, + "column": 48 }, "end": { - "line": 46, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1340, - "end": 1341, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 3 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1342, - "end": 1348, - "loc": { - "start": { - "line": 46, - "column": 4 - }, - "end": { - "line": 46, - "column": 10 - }, - "identifierName": "_color" + "line": 60, + "column": 49 }, - "name": "_color" + "identifierName": "g" }, - "computed": false + "name": "g" }, - "right": { + "property": { "type": "Identifier", - "start": 1351, - "end": 1354, + "start": 1852, + "end": 1857, "loc": { "start": { - "line": 46, - "column": 13 + "line": 60, + "column": 50 }, "end": { - "line": 46, - "column": 16 + "line": 60, + "column": 55 }, - "identifierName": "RED" + "identifierName": "right" }, - "name": "RED" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1358, - "end": 1374, - "loc": { - "start": { - "line": 47, - "column": 2 + "name": "right" }, - "end": { - "line": 47, - "column": 18 - } + "computed": false + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1859, + "end": 2645, + "loc": { + "start": { + "line": 60, + "column": 57 }, - "expression": { - "type": "CallExpression", - "start": 1358, - "end": 1373, + "end": { + "line": 87, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2367, + "end": 2390, "loc": { "start": { - "line": 47, + "line": 74, "column": 2 }, "end": { - "line": 47, - "column": 17 + "line": 74, + "column": 25 } }, - "callee": { - "type": "Identifier", - "start": 1358, - "end": 1370, + "expression": { + "type": "CallExpression", + "start": 2367, + "end": 2389, "loc": { "start": { - "line": 47, + "line": 74, "column": 2 }, "end": { - "line": 47, - "column": 14 + "line": 74, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 2367, + "end": 2379, + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 14 + }, + "identifierName": "rotate_right" }, - "identifierName": "insert_case1" + "name": "rotate_right", + "leadingComments": null }, - "name": "insert_case1" + "arguments": [ + { + "type": "MemberExpression", + "start": 2380, + "end": 2388, + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 2380, + "end": 2381, + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 2382, + "end": 2388, + "loc": { + "start": { + "line": 74, + "column": 17 + }, + "end": { + "line": 74, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ], + "leadingComments": null }, - "arguments": [ + "leadingComments": [ { - "type": "Identifier", - "start": 1371, - "end": 1372, + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1863, + "end": 2364, "loc": { "start": { - "line": 47, - "column": 15 + "line": 61, + "column": 2 }, "end": { - "line": 47, - "column": 16 + "line": 73, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2394, + "end": 2622, + "loc": { + "start": { + "line": 76, + "column": 2 }, - "identifierName": "g" - }, - "name": "g" + "end": { + "line": 84, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2626, + "end": 2642, + "loc": { + "start": { + "line": 86, + "column": 2 + }, + "end": { + "line": 86, + "column": 18 + } + } } ] } - } - ], - "directives": [] - }, - "alternate": { - "type": "ExpressionStatement", - "start": 1383, - "end": 1399, - "loc": { - "start": { - "line": 48, - "column": 8 - }, - "end": { - "line": 48, - "column": 24 - } + ], + "directives": [] }, - "expression": { - "type": "CallExpression", - "start": 1383, - "end": 1398, + "alternate": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 920, + "end": 1382, "loc": { "start": { - "line": 48, - "column": 8 + "line": 31, + "column": 1 }, "end": { - "line": 48, - "column": 23 + "line": 43, + "column": 4 } - }, - "callee": { - "type": "Identifier", - "start": 1383, - "end": 1395, - "loc": { - "start": { - "line": 48, - "column": 8 - }, - "end": { - "line": 48, - "column": 20 - }, - "identifierName": "insert_case4" - }, - "name": "insert_case4" - }, - "arguments": [ - { - "type": "Identifier", - "start": 1396, - "end": 1397, - "loc": { - "start": { - "line": 48, - "column": 21 - }, - "end": { - "line": 48, - "column": 22 - }, - "identifierName": "n" - }, - "name": "n" - } - ] + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 2648, + "end": 2664, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 17 } }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 741, - "end": 1236, + "expression": { + "type": "CallExpression", + "start": 2648, + "end": 2663, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2648, + "end": 2660, "loc": { "start": { - "line": 28, + "line": 89, "column": 1 }, "end": { - "line": 40, - "column": 4 - } + "line": 89, + "column": 13 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2661, + "end": 2662, + "loc": { + "start": { + "line": 89, + "column": 14 + }, + "end": { + "line": 89, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" } - } - ] + ] + } } ], "directives": [] @@ -2383,29 +2816,29 @@ }, { "type": "Identifier", - "start": 1404, - "end": 1432, + "start": 2669, + "end": 2697, "loc": { "start": { - "line": 51, + "line": 92, "column": 0 }, "end": { - "line": 51, + "line": 92, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 1419, - "end": 1431, + "start": 2684, + "end": 2696, "loc": { "start": { - "line": 51, + "line": 92, "column": 15 }, "end": { - "line": 51, + "line": 92, "column": 27 }, "identifierName": "insert_case3" @@ -2418,58 +2851,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1404, - "end": 1432, + "start": 2669, + "end": 2697, "loc": { "start": { - "line": 51, + "line": 92, "column": 0 }, "end": { - "line": 51, + "line": 92, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 502, - "end": 1402, + "start": 636, + "end": 2667, "loc": { "start": { - "line": 19, + "line": 22, "column": 0 }, "end": { - "line": 49, + "line": 90, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 508, - "end": 1401, + "start": 642, + "end": 2666, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 49, + "line": 90, "column": 1 } }, "id": { "type": "Identifier", - "start": 508, - "end": 520, + "start": 642, + "end": 654, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 19, + "line": 22, "column": 18 }, "identifierName": "insert_case3" @@ -2479,29 +2912,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 523, - "end": 1401, + "start": 657, + "end": 2666, "loc": { "start": { - "line": 19, + "line": 22, "column": 21 }, "end": { - "line": 49, + "line": 90, "column": 1 } }, "id": { "type": "Identifier", - "start": 508, - "end": 520, + "start": 642, + "end": 654, "loc": { "start": { - "line": 19, + "line": 22, "column": 6 }, "end": { - "line": 19, + "line": 22, "column": 18 }, "identifierName": "insert_case3" @@ -2515,15 +2948,15 @@ "params": [ { "type": "Identifier", - "start": 524, - "end": 525, + "start": 658, + "end": 659, "loc": { "start": { - "line": 19, + "line": 22, "column": 22 }, "end": { - "line": 19, + "line": 22, "column": 23 }, "identifierName": "n" @@ -2533,58 +2966,58 @@ ], "body": { "type": "BlockStatement", - "start": 530, - "end": 1401, + "start": 664, + "end": 2666, "loc": { "start": { - "line": 19, + "line": 22, "column": 28 }, "end": { - "line": 49, + "line": 90, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 533, - "end": 559, + "start": 667, + "end": 693, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 533, - "end": 558, + "start": 667, + "end": 692, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 533, - "end": 539, + "start": 667, + "end": 673, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -2594,29 +3027,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 540, - "end": 557, + "start": 674, + "end": 691, "loc": { "start": { - "line": 20, + "line": 23, "column": 8 }, "end": { - "line": 20, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 540, - "end": 541, + "start": 674, + "end": 675, "loc": { "start": { - "line": 20, + "line": 23, "column": 8 }, "end": { - "line": 20, + "line": 23, "column": 9 }, "identifierName": "n" @@ -2626,15 +3059,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 553, - "end": 557, + "start": 687, + "end": 691, "loc": { "start": { - "line": 20, + "line": 23, "column": 21 }, "end": { - "line": 20, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -2647,43 +3080,43 @@ }, { "type": "ExpressionStatement", - "start": 561, - "end": 586, + "start": 695, + "end": 720, "loc": { "start": { - "line": 21, + "line": 24, "column": 1 }, "end": { - "line": 21, + "line": 24, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 561, - "end": 585, + "start": 695, + "end": 719, "loc": { "start": { - "line": 21, + "line": 24, "column": 1 }, "end": { - "line": 21, + "line": 24, "column": 25 } }, "callee": { "type": "Identifier", - "start": 561, - "end": 567, + "start": 695, + "end": 701, "loc": { "start": { - "line": 21, + "line": 24, "column": 1 }, "end": { - "line": 21, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -2693,43 +3126,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 568, - "end": 584, + "start": 702, + "end": 718, "loc": { "start": { - "line": 21, + "line": 24, "column": 8 }, "end": { - "line": 21, + "line": 24, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 568, - "end": 576, + "start": 702, + "end": 710, "loc": { "start": { - "line": 21, + "line": 24, "column": 8 }, "end": { - "line": 21, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 568, - "end": 569, + "start": 702, + "end": 703, "loc": { "start": { - "line": 21, + "line": 24, "column": 8 }, "end": { - "line": 21, + "line": 24, "column": 9 }, "identifierName": "n" @@ -2738,15 +3171,15 @@ }, "property": { "type": "Identifier", - "start": 570, - "end": 576, + "start": 704, + "end": 710, "loc": { "start": { - "line": 21, + "line": 24, "column": 10 }, "end": { - "line": 21, + "line": 24, "column": 16 }, "identifierName": "_color" @@ -2758,15 +3191,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 581, - "end": 584, + "start": 715, + "end": 718, "loc": { "start": { - "line": 21, + "line": 24, "column": 21 }, "end": { - "line": 21, + "line": 24, "column": 24 }, "identifierName": "RED" @@ -2779,43 +3212,43 @@ }, { "type": "ExpressionStatement", - "start": 588, - "end": 620, + "start": 722, + "end": 773, "loc": { "start": { - "line": 22, + "line": 25, "column": 1 }, "end": { - "line": 22, - "column": 33 + "line": 25, + "column": 52 } }, "expression": { "type": "CallExpression", - "start": 588, - "end": 619, + "start": 722, + "end": 772, "loc": { "start": { - "line": 22, + "line": 25, "column": 1 }, "end": { - "line": 22, - "column": 32 + "line": 25, + "column": 51 } }, "callee": { "type": "Identifier", - "start": 588, - "end": 594, + "start": 722, + "end": 728, "loc": { "start": { - "line": 22, + "line": 25, "column": 1 }, "end": { - "line": 22, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -2824,58 +3257,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 595, - "end": 618, + "type": "LogicalExpression", + "start": 729, + "end": 771, "loc": { "start": { - "line": 22, + "line": 25, "column": 8 }, "end": { - "line": 22, - "column": 31 + "line": 25, + "column": 50 } }, "left": { - "type": "MemberExpression", - "start": 595, - "end": 608, + "type": "BinaryExpression", + "start": 729, + "end": 744, "loc": { "start": { - "line": 22, + "line": 25, "column": 8 }, "end": { - "line": 22, - "column": 21 + "line": 25, + "column": 23 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 595, - "end": 601, + "start": 729, + "end": 735, "loc": { "start": { - "line": 22, + "line": 25, "column": 8 }, "end": { - "line": 22, + "line": 25, "column": 14 } }, "object": { "type": "Identifier", - "start": 595, - "end": 596, + "start": 729, + "end": 730, "loc": { "start": { - "line": 22, + "line": 25, "column": 8 }, "end": { - "line": 22, + "line": 25, "column": 9 }, "identifierName": "n" @@ -2884,15 +3317,15 @@ }, "property": { "type": "Identifier", - "start": 597, - "end": 601, + "start": 731, + "end": 735, "loc": { "start": { - "line": 22, + "line": 25, "column": 10 }, "end": { - "line": 22, + "line": 25, "column": 14 }, "identifierName": "left" @@ -2901,42 +3334,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 602, - "end": 608, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 740, + "end": 744, "loc": { "start": { - "line": 22, - "column": 15 + "line": 25, + "column": 19 }, "end": { - "line": 22, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 25, + "column": 23 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 613, - "end": 618, + "type": "BinaryExpression", + "start": 748, + "end": 771, "loc": { "start": { - "line": 22, - "column": 26 + "line": 25, + "column": 27 }, "end": { - "line": 22, - "column": 31 + "line": 25, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 748, + "end": 761, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 40 + } }, - "identifierName": "BLACK" + "object": { + "type": "MemberExpression", + "start": 748, + "end": 754, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 748, + "end": 749, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 28 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 750, + "end": 754, + "loc": { + "start": { + "line": 25, + "column": 29 + }, + "end": { + "line": 25, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 755, + "end": 761, + "loc": { + "start": { + "line": 25, + "column": 34 + }, + "end": { + "line": 25, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 766, + "end": 771, + "loc": { + "start": { + "line": 25, + "column": 45 + }, + "end": { + "line": 25, + "column": 50 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -2944,43 +3474,43 @@ }, { "type": "ExpressionStatement", - "start": 622, - "end": 655, + "start": 775, + "end": 828, "loc": { "start": { - "line": 23, + "line": 26, "column": 1 }, "end": { - "line": 23, - "column": 34 + "line": 26, + "column": 54 } }, "expression": { "type": "CallExpression", - "start": 622, - "end": 654, + "start": 775, + "end": 827, "loc": { "start": { - "line": 23, + "line": 26, "column": 1 }, "end": { - "line": 23, - "column": 33 + "line": 26, + "column": 53 } }, "callee": { "type": "Identifier", - "start": 622, - "end": 628, + "start": 775, + "end": 781, "loc": { "start": { - "line": 23, + "line": 26, "column": 1 }, "end": { - "line": 23, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -2989,58 +3519,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 629, - "end": 653, + "type": "LogicalExpression", + "start": 782, + "end": 826, "loc": { "start": { - "line": 23, + "line": 26, "column": 8 }, "end": { - "line": 23, - "column": 32 + "line": 26, + "column": 52 } }, "left": { - "type": "MemberExpression", - "start": 629, - "end": 643, + "type": "BinaryExpression", + "start": 782, + "end": 798, "loc": { "start": { - "line": 23, + "line": 26, "column": 8 }, "end": { - "line": 23, - "column": 22 + "line": 26, + "column": 24 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 629, - "end": 636, + "start": 782, + "end": 789, "loc": { "start": { - "line": 23, + "line": 26, "column": 8 }, "end": { - "line": 23, + "line": 26, "column": 15 } }, "object": { "type": "Identifier", - "start": 629, - "end": 630, + "start": 782, + "end": 783, "loc": { "start": { - "line": 23, + "line": 26, "column": 8 }, "end": { - "line": 23, + "line": 26, "column": 9 }, "identifierName": "n" @@ -3049,15 +3579,15 @@ }, "property": { "type": "Identifier", - "start": 631, - "end": 636, + "start": 784, + "end": 789, "loc": { "start": { - "line": 23, + "line": 26, "column": 10 }, "end": { - "line": 23, + "line": 26, "column": 15 }, "identifierName": "right" @@ -3066,42 +3596,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 637, - "end": 643, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 794, + "end": 798, "loc": { "start": { - "line": 23, - "column": 16 + "line": 26, + "column": 20 }, "end": { - "line": 23, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 26, + "column": 24 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 648, - "end": 653, + "type": "BinaryExpression", + "start": 802, + "end": 826, "loc": { "start": { - "line": 23, - "column": 27 + "line": 26, + "column": 28 }, "end": { - "line": 23, - "column": 32 + "line": 26, + "column": 52 + } + }, + "left": { + "type": "MemberExpression", + "start": 802, + "end": 816, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 42 + } }, - "identifierName": "BLACK" + "object": { + "type": "MemberExpression", + "start": 802, + "end": 809, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 802, + "end": 803, + "loc": { + "start": { + "line": 26, + "column": 28 + }, + "end": { + "line": 26, + "column": 29 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 804, + "end": 809, + "loc": { + "start": { + "line": 26, + "column": 30 + }, + "end": { + "line": 26, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 810, + "end": 816, + "loc": { + "start": { + "line": 26, + "column": 36 + }, + "end": { + "line": 26, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 821, + "end": 826, + "loc": { + "start": { + "line": 26, + "column": 47 + }, + "end": { + "line": 26, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -3109,43 +3736,43 @@ }, { "type": "ExpressionStatement", - "start": 657, - "end": 683, + "start": 830, + "end": 856, "loc": { "start": { - "line": 24, + "line": 27, "column": 1 }, "end": { - "line": 24, + "line": 27, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 657, - "end": 682, + "start": 830, + "end": 855, "loc": { "start": { - "line": 24, + "line": 27, "column": 1 }, "end": { - "line": 24, + "line": 27, "column": 26 } }, "callee": { "type": "Identifier", - "start": 657, - "end": 663, + "start": 830, + "end": 836, "loc": { "start": { - "line": 24, + "line": 27, "column": 1 }, "end": { - "line": 24, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -3155,43 +3782,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 664, - "end": 681, + "start": 837, + "end": 854, "loc": { "start": { - "line": 24, + "line": 27, "column": 8 }, "end": { - "line": 24, + "line": 27, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 664, - "end": 672, + "start": 837, + "end": 845, "loc": { "start": { - "line": 24, + "line": 27, "column": 8 }, "end": { - "line": 24, + "line": 27, "column": 16 } }, "object": { "type": "Identifier", - "start": 664, - "end": 665, + "start": 837, + "end": 838, "loc": { "start": { - "line": 24, + "line": 27, "column": 8 }, "end": { - "line": 24, + "line": 27, "column": 9 }, "identifierName": "n" @@ -3200,15 +3827,15 @@ }, "property": { "type": "Identifier", - "start": 666, - "end": 672, + "start": 839, + "end": 845, "loc": { "start": { - "line": 24, + "line": 27, "column": 10 }, "end": { - "line": 24, + "line": 27, "column": 16 }, "identifierName": "parent" @@ -3220,15 +3847,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 677, - "end": 681, + "start": 850, + "end": 854, "loc": { "start": { - "line": 24, + "line": 27, "column": 21 }, "end": { - "line": 24, + "line": 27, "column": 25 } } @@ -3239,43 +3866,43 @@ }, { "type": "ExpressionStatement", - "start": 685, - "end": 717, + "start": 858, + "end": 890, "loc": { "start": { - "line": 25, + "line": 28, "column": 1 }, "end": { - "line": 25, + "line": 28, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 685, - "end": 716, + "start": 858, + "end": 889, "loc": { "start": { - "line": 25, + "line": 28, "column": 1 }, "end": { - "line": 25, + "line": 28, "column": 32 } }, "callee": { "type": "Identifier", - "start": 685, - "end": 691, + "start": 858, + "end": 864, "loc": { "start": { - "line": 25, + "line": 28, "column": 1 }, "end": { - "line": 25, + "line": 28, "column": 7 }, "identifierName": "assert" @@ -3285,57 +3912,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 692, - "end": 715, + "start": 865, + "end": 888, "loc": { "start": { - "line": 25, + "line": 28, "column": 8 }, "end": { - "line": 25, + "line": 28, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 692, - "end": 707, + "start": 865, + "end": 880, "loc": { "start": { - "line": 25, + "line": 28, "column": 8 }, "end": { - "line": 25, + "line": 28, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 692, - "end": 700, + "start": 865, + "end": 873, "loc": { "start": { - "line": 25, + "line": 28, "column": 8 }, "end": { - "line": 25, + "line": 28, "column": 16 } }, "object": { "type": "Identifier", - "start": 692, - "end": 693, + "start": 865, + "end": 866, "loc": { "start": { - "line": 25, + "line": 28, "column": 8 }, "end": { - "line": 25, + "line": 28, "column": 9 }, "identifierName": "n" @@ -3344,15 +3971,15 @@ }, "property": { "type": "Identifier", - "start": 694, - "end": 700, + "start": 867, + "end": 873, "loc": { "start": { - "line": 25, + "line": 28, "column": 10 }, "end": { - "line": 25, + "line": 28, "column": 16 }, "identifierName": "parent" @@ -3363,15 +3990,15 @@ }, "property": { "type": "Identifier", - "start": 701, - "end": 707, + "start": 874, + "end": 880, "loc": { "start": { - "line": 25, + "line": 28, "column": 17 }, "end": { - "line": 25, + "line": 28, "column": 23 }, "identifierName": "_color" @@ -3383,15 +4010,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 712, - "end": 715, + "start": 885, + "end": 888, "loc": { "start": { - "line": 25, + "line": 28, "column": 28 }, "end": { - "line": 25, + "line": 28, "column": 31 }, "identifierName": "RED" @@ -3404,94 +4031,94 @@ }, { "type": "VariableDeclaration", - "start": 719, - "end": 738, + "start": 892, + "end": 917, "loc": { "start": { - "line": 26, + "line": 29, "column": 1 }, "end": { - "line": 26, - "column": 20 + "line": 29, + "column": 26 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 725, - "end": 737, + "start": 898, + "end": 916, "loc": { "start": { - "line": 26, + "line": 29, "column": 7 }, "end": { - "line": 26, - "column": 19 + "line": 29, + "column": 25 } }, "id": { "type": "Identifier", - "start": 725, - "end": 726, + "start": 898, + "end": 899, "loc": { "start": { - "line": 26, + "line": 29, "column": 7 }, "end": { - "line": 26, + "line": 29, "column": 8 }, - "identifierName": "u" + "identifierName": "g" }, - "name": "u" + "name": "g" }, "init": { "type": "CallExpression", - "start": 729, - "end": 737, + "start": 902, + "end": 916, "loc": { "start": { - "line": 26, + "line": 29, "column": 11 }, "end": { - "line": 26, - "column": 19 + "line": 29, + "column": 25 } }, "callee": { "type": "Identifier", - "start": 729, - "end": 734, + "start": 902, + "end": 913, "loc": { "start": { - "line": 26, + "line": 29, "column": 11 }, "end": { - "line": 26, - "column": 16 + "line": 29, + "column": 22 }, - "identifierName": "uncle" + "identifierName": "grandparent" }, - "name": "uncle" + "name": "grandparent" }, "arguments": [ { "type": "Identifier", - "start": 735, - "end": 736, + "start": 914, + "end": 915, "loc": { "start": { - "line": 26, - "column": 17 + "line": 29, + "column": 23 }, "end": { - "line": 26, - "column": 18 + "line": 29, + "column": 24 }, "identifierName": "n" }, @@ -3505,16 +4132,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 741, - "end": 1236, + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 920, + "end": 1382, "loc": { "start": { - "line": 28, + "line": 31, "column": 1 }, "end": { - "line": 40, + "line": 43, "column": 4 } } @@ -3523,188 +4150,356 @@ }, { "type": "IfStatement", - "start": 1239, - "end": 1399, + "start": 1385, + "end": 2645, "loc": { "start": { - "line": 42, + "line": 45, "column": 1 }, "end": { - "line": 48, - "column": 24 + "line": 87, + "column": 2 } }, "test": { - "type": "BinaryExpression", - "start": 1243, - "end": 1259, + "type": "LogicalExpression", + "start": 1389, + "end": 1432, "loc": { "start": { - "line": 42, + "line": 45, "column": 5 }, "end": { - "line": 42, - "column": 21 + "line": 45, + "column": 48 } }, "left": { - "type": "MemberExpression", - "start": 1243, - "end": 1251, + "type": "BinaryExpression", + "start": 1389, + "end": 1409, "loc": { "start": { - "line": 42, + "line": 45, "column": 5 }, "end": { - "line": 42, - "column": 13 + "line": 45, + "column": 25 } }, - "object": { + "left": { "type": "Identifier", - "start": 1243, - "end": 1244, + "start": 1389, + "end": 1390, "loc": { "start": { - "line": 42, + "line": 45, "column": 5 }, "end": { - "line": 42, + "line": 45, "column": 6 }, - "identifierName": "u" + "identifierName": "n" }, - "name": "u", + "name": "n", "leadingComments": null }, - "property": { - "type": "Identifier", - "start": 1245, - "end": 1251, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1395, + "end": 1409, "loc": { "start": { - "line": 42, - "column": 7 + "line": 45, + "column": 11 }, "end": { - "line": 42, - "column": 13 + "line": 45, + "column": 25 + } + }, + "object": { + "type": "MemberExpression", + "start": 1395, + "end": 1403, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 1395, + "end": 1396, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1397, + "end": 1403, + "loc": { + "start": { + "line": 45, + "column": 13 + }, + "end": { + "line": 45, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1404, + "end": 1409, + "loc": { + "start": { + "line": 45, + "column": 20 + }, + "end": { + "line": 45, + "column": 25 + }, + "identifierName": "right" }, - "identifierName": "_color" + "name": "right" }, - "name": "_color" + "computed": false }, - "computed": false, "leadingComments": null }, - "operator": "===", + "operator": "&&", "right": { - "type": "Identifier", - "start": 1256, - "end": 1259, + "type": "BinaryExpression", + "start": 1413, + "end": 1432, "loc": { "start": { - "line": 42, - "column": 18 + "line": 45, + "column": 29 }, "end": { - "line": 42, - "column": 21 - }, - "identifierName": "RED" - }, - "name": "RED" - }, - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 1261, - "end": 1377, - "loc": { - "start": { - "line": 42, - "column": 23 + "line": 45, + "column": 48 + } }, - "end": { - "line": 48, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1265, - "end": 1289, + "left": { + "type": "MemberExpression", + "start": 1413, + "end": 1421, "loc": { "start": { - "line": 43, - "column": 2 + "line": 45, + "column": 29 }, "end": { - "line": 43, - "column": 26 + "line": 45, + "column": 37 + } + }, + "object": { + "type": "Identifier", + "start": 1413, + "end": 1414, + "loc": { + "start": { + "line": 45, + "column": 29 + }, + "end": { + "line": 45, + "column": 30 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1415, + "end": 1421, + "loc": { + "start": { + "line": 45, + "column": 31 + }, + "end": { + "line": 45, + "column": 37 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1426, + "end": 1432, + "loc": { + "start": { + "line": 45, + "column": 42 + }, + "end": { + "line": 45, + "column": 48 + } + }, + "object": { + "type": "Identifier", + "start": 1426, + "end": 1427, + "loc": { + "start": { + "line": 45, + "column": 42 + }, + "end": { + "line": 45, + "column": 43 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1428, + "end": 1432, + "loc": { + "start": { + "line": 45, + "column": 44 + }, + "end": { + "line": 45, + "column": 48 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 1434, + "end": 1804, + "loc": { + "start": { + "line": 45, + "column": 50 + }, + "end": { + "line": 60, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1438, + "end": 1460, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 24 } }, "expression": { - "type": "AssignmentExpression", - "start": 1265, - "end": 1288, + "type": "CallExpression", + "start": 1438, + "end": 1459, "loc": { "start": { - "line": 43, + "line": 46, "column": 2 }, "end": { - "line": 43, - "column": 25 + "line": 46, + "column": 23 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1265, - "end": 1280, + "callee": { + "type": "Identifier", + "start": 1438, + "end": 1449, "loc": { "start": { - "line": 43, + "line": 46, "column": 2 }, "end": { - "line": 43, - "column": 17 - } + "line": 46, + "column": 13 + }, + "identifierName": "rotate_left" }, - "object": { + "name": "rotate_left" + }, + "arguments": [ + { "type": "MemberExpression", - "start": 1265, - "end": 1273, + "start": 1450, + "end": 1458, "loc": { "start": { - "line": 43, - "column": 2 + "line": 46, + "column": 14 }, "end": { - "line": 43, - "column": 10 + "line": 46, + "column": 22 } }, "object": { "type": "Identifier", - "start": 1265, - "end": 1266, + "start": 1450, + "end": 1451, "loc": { "start": { - "line": 43, - "column": 2 + "line": 46, + "column": 14 }, "end": { - "line": 43, - "column": 3 + "line": 46, + "column": 15 }, "identifierName": "n" }, @@ -3712,511 +4507,582 @@ }, "property": { "type": "Identifier", - "start": 1267, - "end": 1273, + "start": 1452, + "end": 1458, "loc": { "start": { - "line": 43, - "column": 4 + "line": 46, + "column": 16 }, "end": { - "line": 43, - "column": 10 + "line": 46, + "column": 22 }, "identifierName": "parent" }, "name": "parent" }, "computed": false - }, - "property": { - "type": "Identifier", - "start": 1274, - "end": 1280, - "loc": { - "start": { - "line": 43, - "column": 11 - }, - "end": { - "line": 43, - "column": 17 - }, - "identifierName": "_color" + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1464, + "end": 1720, + "loc": { + "start": { + "line": 48, + "column": 2 }, - "name": "_color" - }, - "computed": false + "end": { + "line": 57, + "column": 5 + } + } }, - "right": { - "type": "Identifier", - "start": 1283, - "end": 1288, + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1724, + "end": 1801, "loc": { "start": { - "line": 43, - "column": 20 + "line": 59, + "column": 2 }, "end": { - "line": 43, - "column": 25 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" + "line": 59, + "column": 79 + } + } } + ] + } + ], + "directives": [] + }, + "alternate": { + "type": "IfStatement", + "start": 1810, + "end": 2645, + "loc": { + "start": { + "line": 60, + "column": 8 + }, + "end": { + "line": 87, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1814, + "end": 1857, + "loc": { + "start": { + "line": 60, + "column": 12 + }, + "end": { + "line": 60, + "column": 55 } }, - { - "type": "ExpressionStatement", - "start": 1292, - "end": 1309, + "left": { + "type": "BinaryExpression", + "start": 1814, + "end": 1833, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 12 }, "end": { - "line": 44, - "column": 19 + "line": 60, + "column": 31 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1292, - "end": 1308, + "left": { + "type": "Identifier", + "start": 1814, + "end": 1815, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 12 }, "end": { - "line": 44, + "line": 60, + "column": 13 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1820, + "end": 1833, + "loc": { + "start": { + "line": 60, "column": 18 + }, + "end": { + "line": 60, + "column": 31 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 1292, - "end": 1300, + "start": 1820, + "end": 1828, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 18 }, "end": { - "line": 44, - "column": 10 + "line": 60, + "column": 26 } }, "object": { "type": "Identifier", - "start": 1292, - "end": 1293, + "start": 1820, + "end": 1821, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 18 }, "end": { - "line": 44, - "column": 3 + "line": 60, + "column": 19 }, - "identifierName": "u" + "identifierName": "n" }, - "name": "u" + "name": "n" }, "property": { "type": "Identifier", - "start": 1294, - "end": 1300, + "start": 1822, + "end": 1828, "loc": { "start": { - "line": 44, - "column": 4 + "line": 60, + "column": 20 }, "end": { - "line": 44, - "column": 10 + "line": 60, + "column": 26 }, - "identifierName": "_color" + "identifierName": "parent" }, - "name": "_color" + "name": "parent" }, "computed": false }, - "right": { + "property": { "type": "Identifier", - "start": 1303, - "end": 1308, + "start": 1829, + "end": 1833, "loc": { "start": { - "line": 44, - "column": 13 + "line": 60, + "column": 27 }, "end": { - "line": 44, - "column": 18 + "line": 60, + "column": 31 }, - "identifierName": "BLACK" + "identifierName": "left" }, - "name": "BLACK" - } + "name": "left" + }, + "computed": false } }, - { - "type": "VariableDeclaration", - "start": 1312, - "end": 1337, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1837, + "end": 1857, "loc": { "start": { - "line": 45, - "column": 2 + "line": 60, + "column": 35 }, "end": { - "line": 45, - "column": 27 + "line": 60, + "column": 55 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 1318, - "end": 1336, + "left": { + "type": "MemberExpression", + "start": 1837, + "end": 1845, + "loc": { + "start": { + "line": 60, + "column": 35 + }, + "end": { + "line": 60, + "column": 43 + } + }, + "object": { + "type": "Identifier", + "start": 1837, + "end": 1838, "loc": { "start": { - "line": 45, - "column": 8 + "line": 60, + "column": 35 }, "end": { - "line": 45, - "column": 26 - } - }, - "id": { - "type": "Identifier", - "start": 1318, - "end": 1319, - "loc": { - "start": { - "line": 45, - "column": 8 - }, - "end": { - "line": 45, - "column": 9 - }, - "identifierName": "g" + "line": 60, + "column": 36 }, - "name": "g" + "identifierName": "n" }, - "init": { - "type": "CallExpression", - "start": 1322, - "end": 1336, - "loc": { - "start": { - "line": 45, - "column": 12 - }, - "end": { - "line": 45, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 1322, - "end": 1333, - "loc": { - "start": { - "line": 45, - "column": 12 - }, - "end": { - "line": 45, - "column": 23 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1839, + "end": 1845, + "loc": { + "start": { + "line": 60, + "column": 37 }, - "arguments": [ - { - "type": "Identifier", - "start": 1334, - "end": 1335, - "loc": { - "start": { - "line": 45, - "column": 24 - }, - "end": { - "line": 45, - "column": 25 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const" - }, - { - "type": "ExpressionStatement", - "start": 1340, - "end": 1355, - "loc": { - "start": { - "line": 46, - "column": 2 + "end": { + "line": 60, + "column": 43 + }, + "identifierName": "parent" + }, + "name": "parent" }, - "end": { - "line": 46, - "column": 17 - } + "computed": false }, - "expression": { - "type": "AssignmentExpression", - "start": 1340, - "end": 1354, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1850, + "end": 1857, "loc": { "start": { - "line": 46, - "column": 2 + "line": 60, + "column": 48 }, "end": { - "line": 46, - "column": 16 + "line": 60, + "column": 55 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1340, - "end": 1348, + "object": { + "type": "Identifier", + "start": 1850, + "end": 1851, "loc": { "start": { - "line": 46, - "column": 2 + "line": 60, + "column": 48 }, "end": { - "line": 46, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1340, - "end": 1341, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 3 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1342, - "end": 1348, - "loc": { - "start": { - "line": 46, - "column": 4 - }, - "end": { - "line": 46, - "column": 10 - }, - "identifierName": "_color" + "line": 60, + "column": 49 }, - "name": "_color" + "identifierName": "g" }, - "computed": false + "name": "g" }, - "right": { + "property": { "type": "Identifier", - "start": 1351, - "end": 1354, + "start": 1852, + "end": 1857, "loc": { "start": { - "line": 46, - "column": 13 + "line": 60, + "column": 50 }, "end": { - "line": 46, - "column": 16 + "line": 60, + "column": 55 }, - "identifierName": "RED" + "identifierName": "right" }, - "name": "RED" - } - } - }, - { - "type": "ExpressionStatement", - "start": 1358, - "end": 1374, - "loc": { - "start": { - "line": 47, - "column": 2 + "name": "right" }, - "end": { - "line": 47, - "column": 18 - } + "computed": false + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1859, + "end": 2645, + "loc": { + "start": { + "line": 60, + "column": 57 }, - "expression": { - "type": "CallExpression", - "start": 1358, - "end": 1373, + "end": { + "line": 87, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2367, + "end": 2390, "loc": { "start": { - "line": 47, + "line": 74, "column": 2 }, "end": { - "line": 47, - "column": 17 + "line": 74, + "column": 25 } }, - "callee": { - "type": "Identifier", - "start": 1358, - "end": 1370, + "expression": { + "type": "CallExpression", + "start": 2367, + "end": 2389, "loc": { "start": { - "line": 47, + "line": 74, "column": 2 }, "end": { - "line": 47, - "column": 14 + "line": 74, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 2367, + "end": 2379, + "loc": { + "start": { + "line": 74, + "column": 2 + }, + "end": { + "line": 74, + "column": 14 + }, + "identifierName": "rotate_right" }, - "identifierName": "insert_case1" + "name": "rotate_right", + "leadingComments": null }, - "name": "insert_case1" + "arguments": [ + { + "type": "MemberExpression", + "start": 2380, + "end": 2388, + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 2380, + "end": 2381, + "loc": { + "start": { + "line": 74, + "column": 15 + }, + "end": { + "line": 74, + "column": 16 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 2382, + "end": 2388, + "loc": { + "start": { + "line": 74, + "column": 17 + }, + "end": { + "line": 74, + "column": 23 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + ], + "leadingComments": null }, - "arguments": [ + "leadingComments": [ { - "type": "Identifier", - "start": 1371, - "end": 1372, + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1863, + "end": 2364, "loc": { "start": { - "line": 47, - "column": 15 + "line": 61, + "column": 2 }, "end": { - "line": 47, - "column": 16 + "line": 73, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2394, + "end": 2622, + "loc": { + "start": { + "line": 76, + "column": 2 }, - "identifierName": "g" - }, - "name": "g" + "end": { + "line": 84, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2626, + "end": 2642, + "loc": { + "start": { + "line": 86, + "column": 2 + }, + "end": { + "line": 86, + "column": 18 + } + } } ] } + ], + "directives": [] + }, + "alternate": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 920, + "end": 1382, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 43, + "column": 4 + } } - ], - "directives": [] + } + ] + }, + { + "type": "ExpressionStatement", + "start": 2648, + "end": 2664, + "loc": { + "start": { + "line": 89, + "column": 1 + }, + "end": { + "line": 89, + "column": 17 + } }, - "alternate": { - "type": "ExpressionStatement", - "start": 1383, - "end": 1399, + "expression": { + "type": "CallExpression", + "start": 2648, + "end": 2663, "loc": { "start": { - "line": 48, - "column": 8 + "line": 89, + "column": 1 }, "end": { - "line": 48, - "column": 24 + "line": 89, + "column": 16 } }, - "expression": { - "type": "CallExpression", - "start": 1383, - "end": 1398, + "callee": { + "type": "Identifier", + "start": 2648, + "end": 2660, "loc": { "start": { - "line": 48, - "column": 8 + "line": 89, + "column": 1 }, "end": { - "line": 48, - "column": 23 - } + "line": 89, + "column": 13 + }, + "identifierName": "insert_case4" }, - "callee": { + "name": "insert_case4" + }, + "arguments": [ + { "type": "Identifier", - "start": 1383, - "end": 1395, + "start": 2661, + "end": 2662, "loc": { "start": { - "line": 48, - "column": 8 + "line": 89, + "column": 14 }, "end": { - "line": 48, - "column": 20 + "line": 89, + "column": 15 }, - "identifierName": "insert_case4" + "identifierName": "n" }, - "name": "insert_case4" - }, - "arguments": [ - { - "type": "Identifier", - "start": 1396, - "end": 1397, - "loc": { - "start": { - "line": 48, - "column": 21 - }, - "end": { - "line": 48, - "column": 22 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 741, - "end": 1236, - "loc": { - "start": { - "line": 28, - "column": 1 - }, - "end": { - "line": 40, - "column": 4 - } + "name": "n" } - } - ] + ] + } } ], "directives": [] @@ -4229,16 +5095,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 325, - "end": 501, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n ", + "start": 345, + "end": 635, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 18, + "line": 21, "column": 3 } } @@ -4253,38 +5119,783 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 325, - "end": 501, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n ", + "start": 345, + "end": 635, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 18, + "line": 21, "column": 3 } } }, { "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 741, - "end": 1236, + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 920, + "end": 1382, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 43, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1464, + "end": 1720, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 57, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1724, + "end": 1801, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 79 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1863, + "end": 2364, + "loc": { + "start": { + "line": 61, + "column": 2 + }, + "end": { + "line": 73, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2394, + "end": 2622, + "loc": { + "start": { + "line": 76, + "column": 2 + }, + "end": { + "line": 84, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2626, + "end": 2642, + "loc": { + "start": { + "line": 86, + "column": 2 + }, + "end": { + "line": 86, + "column": 18 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 147, + "end": 158, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 159, + "end": 163, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_left.js", + "start": 164, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 190, + "end": 191, "loc": { "start": { - "line": 28, - "column": 1 + "line": 5, + "column": 50 }, "end": { - "line": 40, - "column": 4 + "line": 5, + "column": 51 } } - } - ], - "tokens": [ + }, { "type": { "label": "import", @@ -4300,15 +5911,15 @@ "updateContext": null }, "value": "import", - "start": 0, - "end": 6, + "start": 192, + "end": 198, "loc": { "start": { - "line": 1, + "line": 6, "column": 0 }, "end": { - "line": 1, + "line": 6, "column": 6 } } @@ -4325,17 +5936,17 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 7, - "end": 13, + "value": "rotate_right", + "start": 199, + "end": 211, "loc": { "start": { - "line": 1, + "line": 6, "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 6, + "column": 19 } } }, @@ -4352,16 +5963,16 @@ "binop": null }, "value": "from", - "start": 14, - "end": 18, + "start": 212, + "end": 216, "loc": { "start": { - "line": 1, - "column": 14 + "line": 6, + "column": 20 }, "end": { - "line": 1, - "column": 18 + "line": 6, + "column": 24 } } }, @@ -4378,17 +5989,17 @@ "binop": null, "updateContext": null }, - "value": "assert", - "start": 19, - "end": 27, + "value": "../rotate/rotate_right.js", + "start": 217, + "end": 244, "loc": { "start": { - "line": 1, - "column": 19 + "line": 6, + "column": 25 }, "end": { - "line": 1, - "column": 27 + "line": 6, + "column": 52 } } }, @@ -4405,16 +6016,16 @@ "binop": null, "updateContext": null }, - "start": 27, - "end": 28, + "start": 244, + "end": 245, "loc": { "start": { - "line": 1, - "column": 27 + "line": 6, + "column": 52 }, "end": { - "line": 1, - "column": 28 + "line": 6, + "column": 53 } } }, @@ -4433,15 +6044,15 @@ "updateContext": null }, "value": "import", - "start": 29, - "end": 35, + "start": 246, + "end": 252, "loc": { "start": { - "line": 2, + "line": 7, "column": 0 }, "end": { - "line": 2, + "line": 7, "column": 6 } } @@ -4458,17 +6069,17 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 36, - "end": 40, + "value": "grandparent", + "start": 253, + "end": 264, "loc": { "start": { - "line": 2, + "line": 7, "column": 7 }, "end": { - "line": 2, - "column": 11 + "line": 7, + "column": 18 } } }, @@ -4485,16 +6096,16 @@ "binop": null }, "value": "from", - "start": 41, - "end": 45, + "start": 265, + "end": 269, "loc": { "start": { - "line": 2, - "column": 12 + "line": 7, + "column": 19 }, "end": { - "line": 2, - "column": 16 + "line": 7, + "column": 23 } } }, @@ -4511,17 +6122,17 @@ "binop": null, "updateContext": null }, - "value": "../types/Node.js", - "start": 46, - "end": 64, + "value": "../family/grandparent.js", + "start": 270, + "end": 296, "loc": { "start": { - "line": 2, - "column": 17 + "line": 7, + "column": 24 }, "end": { - "line": 2, - "column": 35 + "line": 7, + "column": 50 } } }, @@ -4538,16 +6149,16 @@ "binop": null, "updateContext": null }, - "start": 64, - "end": 65, + "start": 296, + "end": 297, "loc": { "start": { - "line": 2, - "column": 35 + "line": 7, + "column": 50 }, "end": { - "line": 2, - "column": 36 + "line": 7, + "column": 51 } } }, @@ -4566,15 +6177,15 @@ "updateContext": null }, "value": "import", - "start": 66, - "end": 72, + "start": 298, + "end": 304, "loc": { "start": { - "line": 3, + "line": 8, "column": 0 }, "end": { - "line": 3, + "line": 8, "column": 6 } } @@ -4591,17 +6202,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 73, - "end": 78, + "value": "insert_case4", + "start": 305, + "end": 317, "loc": { "start": { - "line": 3, + "line": 8, "column": 7 }, "end": { - "line": 3, - "column": 12 + "line": 8, + "column": 19 } } }, @@ -4618,16 +6229,16 @@ "binop": null }, "value": "from", - "start": 79, - "end": 83, + "start": 318, + "end": 322, "loc": { "start": { - "line": 3, - "column": 13 + "line": 8, + "column": 20 }, "end": { - "line": 3, - "column": 17 + "line": 8, + "column": 24 } } }, @@ -4644,17 +6255,17 @@ "binop": null, "updateContext": null }, - "value": "../color/BLACK.js", - "start": 84, - "end": 103, + "value": "./insert_case4.js", + "start": 323, + "end": 342, "loc": { "start": { - "line": 3, - "column": 18 + "line": 8, + "column": 25 }, "end": { - "line": 3, - "column": 37 + "line": 8, + "column": 44 } } }, @@ -4671,70 +6282,60 @@ "binop": null, "updateContext": null }, - "start": 103, - "end": 104, + "start": 342, + "end": 343, "loc": { "start": { - "line": 3, - "column": 37 + "line": 8, + "column": 44 }, "end": { - "line": 3, - "column": 38 + "line": 8, + "column": 45 } } }, { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 105, - "end": 111, + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n ", + "start": 345, + "end": 635, "loc": { "start": { - "line": 4, + "line": 10, "column": 0 }, "end": { - "line": 4, - "column": 6 + "line": 21, + "column": 3 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 112, - "end": 115, + "value": "const", + "start": 636, + "end": 641, "loc": { "start": { - "line": 4, - "column": 7 + "line": 22, + "column": 0 }, "end": { - "line": 4, - "column": 10 + "line": 22, + "column": 5 } } }, @@ -4750,98 +6351,69 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 116, - "end": 120, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/RED.js", - "start": 121, - "end": 138, + "value": "insert_case3", + "start": 642, + "end": 654, "loc": { "start": { - "line": 4, - "column": 16 + "line": 22, + "column": 6 }, "end": { - "line": 4, - "column": 33 + "line": 22, + "column": 18 } } }, { "type": { - "label": ";", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 138, - "end": 139, + "value": "=", + "start": 655, + "end": 656, "loc": { "start": { - "line": 4, - "column": 33 + "line": 22, + "column": 19 }, "end": { - "line": 4, - "column": 34 + "line": 22, + "column": 20 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 140, - "end": 146, + "start": 657, + "end": 658, "loc": { "start": { - "line": 5, - "column": 0 + "line": 22, + "column": 21 }, "end": { - "line": 5, - "column": 6 + "line": 22, + "column": 22 } } }, @@ -4857,25 +6429,25 @@ "postfix": false, "binop": null }, - "value": "uncle", - "start": 147, - "end": 152, + "value": "n", + "start": 658, + "end": 659, "loc": { "start": { - "line": 5, - "column": 7 + "line": 22, + "column": 22 }, "end": { - "line": 5, - "column": 12 + "line": 22, + "column": 23 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4883,25 +6455,24 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 153, - "end": 157, + "start": 659, + "end": 660, "loc": { "start": { - "line": 5, - "column": 13 + "line": 22, + "column": 23 }, "end": { - "line": 5, - "column": 17 + "line": 22, + "column": 24 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "=>", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4910,50 +6481,47 @@ "binop": null, "updateContext": null }, - "value": "../family/uncle.js", - "start": 158, - "end": 178, + "start": 661, + "end": 663, "loc": { "start": { - "line": 5, - "column": 18 + "line": 22, + "column": 25 }, "end": { - "line": 5, - "column": 38 + "line": 22, + "column": 27 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 178, - "end": 179, + "start": 664, + "end": 665, "loc": { "start": { - "line": 5, - "column": 38 + "line": 22, + "column": 28 }, "end": { - "line": 5, - "column": 39 + "line": 22, + "column": 29 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4961,27 +6529,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 180, - "end": 186, + "value": "assert", + "start": 667, + "end": 673, "loc": { "start": { - "line": 6, - "column": 0 + "line": 23, + "column": 1 }, "end": { - "line": 6, - "column": 6 + "line": 23, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4990,17 +6557,16 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 187, - "end": 198, + "start": 673, + "end": 674, "loc": { "start": { - "line": 6, + "line": 23, "column": 7 }, "end": { - "line": 6, - "column": 18 + "line": 23, + "column": 8 } } }, @@ -5016,23 +6582,51 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 199, - "end": 203, + "value": "n", + "start": 674, + "end": 675, "loc": { "start": { - "line": 6, - "column": 19 + "line": 23, + "column": 8 }, "end": { - "line": 6, - "column": 23 + "line": 23, + "column": 9 } } }, { "type": { - "label": "string", + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 676, + "end": 686, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 20 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5040,55 +6634,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/grandparent.js", - "start": 204, - "end": 230, + "value": "Node", + "start": 687, + "end": 691, "loc": { "start": { - "line": 6, - "column": 24 + "line": 23, + "column": 21 }, "end": { - "line": 6, - "column": 50 + "line": 23, + "column": 25 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 230, - "end": 231, + "start": 691, + "end": 692, "loc": { "start": { - "line": 6, - "column": 50 + "line": 23, + "column": 25 }, "end": { - "line": 6, - "column": 51 + "line": 23, + "column": 26 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5097,17 +6688,16 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 232, - "end": 238, + "start": 692, + "end": 693, "loc": { "start": { - "line": 7, - "column": 0 + "line": 23, + "column": 26 }, "end": { - "line": 7, - "column": 6 + "line": 23, + "column": 27 } } }, @@ -5123,24 +6713,24 @@ "postfix": false, "binop": null }, - "value": "insert_case1", - "start": 239, - "end": 251, + "value": "assert", + "start": 695, + "end": 701, "loc": { "start": { - "line": 7, - "column": 7 + "line": 24, + "column": 1 }, "end": { - "line": 7, - "column": 19 + "line": 24, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5149,23 +6739,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 252, - "end": 256, + "start": 701, + "end": 702, "loc": { "start": { - "line": 7, - "column": 20 + "line": 24, + "column": 7 }, "end": { - "line": 7, - "column": 24 + "line": 24, + "column": 8 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5173,27 +6762,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./insert_case1.js", - "start": 257, - "end": 276, + "value": "n", + "start": 702, + "end": 703, "loc": { "start": { - "line": 7, - "column": 25 + "line": 24, + "column": 8 }, "end": { - "line": 7, - "column": 44 + "line": 24, + "column": 9 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5203,23 +6791,22 @@ "binop": null, "updateContext": null }, - "start": 276, - "end": 277, + "start": 703, + "end": 704, "loc": { "start": { - "line": 7, - "column": 44 + "line": 24, + "column": 9 }, "end": { - "line": 7, - "column": 45 + "line": 24, + "column": 10 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5227,46 +6814,46 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 278, - "end": 284, + "value": "_color", + "start": 704, + "end": 710, "loc": { - "start": { - "line": 8, - "column": 0 + "start": { + "line": 24, + "column": 10 }, "end": { - "line": 8, - "column": 6 + "line": 24, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "insert_case4", - "start": 285, - "end": 297, + "value": "===", + "start": 711, + "end": 714, "loc": { "start": { - "line": 8, - "column": 7 + "line": 24, + "column": 17 }, "end": { - "line": 8, - "column": 19 + "line": 24, + "column": 20 } } }, @@ -5282,44 +6869,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 298, - "end": 302, + "value": "RED", + "start": 715, + "end": 718, "loc": { "start": { - "line": 8, - "column": 20 + "line": 24, + "column": 21 }, "end": { - "line": 8, + "line": 24, "column": 24 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./insert_case4.js", - "start": 303, - "end": 322, + "start": 718, + "end": 719, "loc": { "start": { - "line": 8, - "column": 25 + "line": 24, + "column": 24 }, "end": { - "line": 8, - "column": 44 + "line": 24, + "column": 25 } } }, @@ -5336,60 +6921,67 @@ "binop": null, "updateContext": null }, - "start": 322, - "end": 323, + "start": 719, + "end": 720, "loc": { "start": { - "line": 8, - "column": 44 + "line": 24, + "column": 25 }, "end": { - "line": 8, - "column": 45 + "line": 24, + "column": 26 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", - "start": 325, - "end": 501, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 722, + "end": 728, "loc": { "start": { - "line": 10, - "column": 0 + "line": 25, + "column": 1 }, "end": { - "line": 18, - "column": 3 + "line": 25, + "column": 7 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 502, - "end": 507, + "start": 728, + "end": 729, "loc": { "start": { - "line": 19, - "column": 0 + "line": 25, + "column": 7 }, "end": { - "line": 19, - "column": 5 + "line": 25, + "column": 8 } } }, @@ -5405,51 +6997,50 @@ "postfix": false, "binop": null }, - "value": "insert_case3", - "start": 508, - "end": 520, + "value": "n", + "start": 729, + "end": 730, "loc": { "start": { - "line": 19, - "column": 6 + "line": 25, + "column": 8 }, "end": { - "line": 19, - "column": 18 + "line": 25, + "column": 9 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 521, - "end": 522, + "start": 730, + "end": 731, "loc": { "start": { - "line": 19, - "column": 19 + "line": 25, + "column": 9 }, "end": { - "line": 19, - "column": 20 + "line": 25, + "column": 10 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5458,73 +7049,78 @@ "postfix": false, "binop": null }, - "start": 523, - "end": 524, + "value": "left", + "start": 731, + "end": 735, "loc": { "start": { - "line": 19, - "column": 21 + "line": 25, + "column": 10 }, "end": { - "line": 19, - "column": 22 + "line": 25, + "column": 14 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "n", - "start": 524, - "end": 525, + "value": "===", + "start": 736, + "end": 739, "loc": { "start": { - "line": 19, - "column": 22 + "line": 25, + "column": 15 }, "end": { - "line": 19, - "column": 23 + "line": 25, + "column": 18 } } }, { "type": { - "label": ")", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 525, - "end": 526, + "value": "null", + "start": 740, + "end": 744, "loc": { "start": { - "line": 19, - "column": 23 + "line": 25, + "column": 19 }, "end": { - "line": 19, - "column": 24 + "line": 25, + "column": 23 } } }, { "type": { - "label": "=>", + "label": "||", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5532,26 +7128,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "start": 527, - "end": 529, + "value": "||", + "start": 745, + "end": 747, "loc": { "start": { - "line": 19, - "column": 25 + "line": 25, + "column": 24 }, "end": { - "line": 19, - "column": 27 + "line": 25, + "column": 26 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5560,15 +7157,42 @@ "postfix": false, "binop": null }, - "start": 530, - "end": 531, + "value": "n", + "start": 748, + "end": 749, + "loc": { + "start": { + "line": 25, + "column": 27 + }, + "end": { + "line": 25, + "column": 28 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 749, + "end": 750, "loc": { "start": { - "line": 19, + "line": 25, "column": 28 }, "end": { - "line": 19, + "line": 25, "column": 29 } } @@ -5585,42 +7209,43 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 533, - "end": 539, + "value": "left", + "start": 750, + "end": 754, "loc": { "start": { - "line": 20, - "column": 1 + "line": 25, + "column": 29 }, "end": { - "line": 20, - "column": 7 + "line": 25, + "column": 33 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 539, - "end": 540, + "start": 754, + "end": 755, "loc": { "start": { - "line": 20, - "column": 7 + "line": 25, + "column": 33 }, "end": { - "line": 20, - "column": 8 + "line": 25, + "column": 34 } } }, @@ -5636,24 +7261,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 540, - "end": 541, + "value": "_color", + "start": 755, + "end": 761, "loc": { "start": { - "line": 20, - "column": 8 + "line": 25, + "column": 34 }, "end": { - "line": 20, - "column": 9 + "line": 25, + "column": 40 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5661,20 +7285,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": 6, "updateContext": null }, - "value": "instanceof", - "start": 542, - "end": 552, + "value": "===", + "start": 762, + "end": 765, "loc": { "start": { - "line": 20, - "column": 10 + "line": 25, + "column": 41 }, "end": { - "line": 20, - "column": 20 + "line": 25, + "column": 44 } } }, @@ -5690,17 +7314,17 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 553, - "end": 557, + "value": "BLACK", + "start": 766, + "end": 771, "loc": { "start": { - "line": 20, - "column": 21 + "line": 25, + "column": 45 }, "end": { - "line": 20, - "column": 25 + "line": 25, + "column": 50 } } }, @@ -5716,16 +7340,16 @@ "postfix": false, "binop": null }, - "start": 557, - "end": 558, + "start": 771, + "end": 772, "loc": { "start": { - "line": 20, - "column": 25 + "line": 25, + "column": 50 }, "end": { - "line": 20, - "column": 26 + "line": 25, + "column": 51 } } }, @@ -5742,16 +7366,16 @@ "binop": null, "updateContext": null }, - "start": 558, - "end": 559, + "start": 772, + "end": 773, "loc": { "start": { - "line": 20, - "column": 26 + "line": 25, + "column": 51 }, "end": { - "line": 20, - "column": 27 + "line": 25, + "column": 52 } } }, @@ -5768,15 +7392,15 @@ "binop": null }, "value": "assert", - "start": 561, - "end": 567, + "start": 775, + "end": 781, "loc": { "start": { - "line": 21, + "line": 26, "column": 1 }, "end": { - "line": 21, + "line": 26, "column": 7 } } @@ -5793,15 +7417,15 @@ "postfix": false, "binop": null }, - "start": 567, - "end": 568, + "start": 781, + "end": 782, "loc": { "start": { - "line": 21, + "line": 26, "column": 7 }, "end": { - "line": 21, + "line": 26, "column": 8 } } @@ -5819,15 +7443,15 @@ "binop": null }, "value": "n", - "start": 568, - "end": 569, + "start": 782, + "end": 783, "loc": { "start": { - "line": 21, + "line": 26, "column": 8 }, "end": { - "line": 21, + "line": 26, "column": 9 } } @@ -5845,15 +7469,15 @@ "binop": null, "updateContext": null }, - "start": 569, - "end": 570, + "start": 783, + "end": 784, "loc": { "start": { - "line": 21, + "line": 26, "column": 9 }, "end": { - "line": 21, + "line": 26, "column": 10 } } @@ -5870,17 +7494,17 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 570, - "end": 576, + "value": "right", + "start": 784, + "end": 789, "loc": { "start": { - "line": 21, + "line": 26, "column": 10 }, "end": { - "line": 21, - "column": 16 + "line": 26, + "column": 15 } } }, @@ -5898,22 +7522,23 @@ "updateContext": null }, "value": "===", - "start": 577, - "end": 580, + "start": 790, + "end": 793, "loc": { "start": { - "line": 21, - "column": 17 + "line": 26, + "column": 16 }, "end": { - "line": 21, - "column": 20 + "line": 26, + "column": 19 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5921,50 +7546,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 581, - "end": 584, + "value": "null", + "start": 794, + "end": 798, "loc": { "start": { - "line": 21, - "column": 21 + "line": 26, + "column": 20 }, "end": { - "line": 21, - "column": 24 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 584, - "end": 585, - "loc": { - "start": { - "line": 21, + "line": 26, "column": 24 - }, - "end": { - "line": 21, - "column": 25 } } }, { "type": { - "label": ";", + "label": "||", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5972,70 +7573,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "start": 585, - "end": 586, + "value": "||", + "start": 799, + "end": 801, "loc": { "start": { - "line": 21, + "line": 26, "column": 25 }, "end": { - "line": 21, - "column": 26 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 588, - "end": 594, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 594, - "end": 595, - "loc": { - "start": { - "line": 22, - "column": 7 - }, - "end": { - "line": 22, - "column": 8 + "line": 26, + "column": 27 } } }, @@ -6052,16 +7603,16 @@ "binop": null }, "value": "n", - "start": 595, - "end": 596, + "start": 802, + "end": 803, "loc": { "start": { - "line": 22, - "column": 8 + "line": 26, + "column": 28 }, "end": { - "line": 22, - "column": 9 + "line": 26, + "column": 29 } } }, @@ -6078,16 +7629,16 @@ "binop": null, "updateContext": null }, - "start": 596, - "end": 597, + "start": 803, + "end": 804, "loc": { "start": { - "line": 22, - "column": 9 + "line": 26, + "column": 29 }, "end": { - "line": 22, - "column": 10 + "line": 26, + "column": 30 } } }, @@ -6103,17 +7654,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 597, - "end": 601, + "value": "right", + "start": 804, + "end": 809, "loc": { "start": { - "line": 22, - "column": 10 + "line": 26, + "column": 30 }, "end": { - "line": 22, - "column": 14 + "line": 26, + "column": 35 } } }, @@ -6130,16 +7681,16 @@ "binop": null, "updateContext": null }, - "start": 601, - "end": 602, + "start": 809, + "end": 810, "loc": { "start": { - "line": 22, - "column": 14 + "line": 26, + "column": 35 }, "end": { - "line": 22, - "column": 15 + "line": 26, + "column": 36 } } }, @@ -6156,16 +7707,16 @@ "binop": null }, "value": "_color", - "start": 602, - "end": 608, + "start": 810, + "end": 816, "loc": { "start": { - "line": 22, - "column": 15 + "line": 26, + "column": 36 }, "end": { - "line": 22, - "column": 21 + "line": 26, + "column": 42 } } }, @@ -6183,16 +7734,16 @@ "updateContext": null }, "value": "===", - "start": 609, - "end": 612, + "start": 817, + "end": 820, "loc": { "start": { - "line": 22, - "column": 22 + "line": 26, + "column": 43 }, "end": { - "line": 22, - "column": 25 + "line": 26, + "column": 46 } } }, @@ -6209,16 +7760,16 @@ "binop": null }, "value": "BLACK", - "start": 613, - "end": 618, + "start": 821, + "end": 826, "loc": { "start": { - "line": 22, - "column": 26 + "line": 26, + "column": 47 }, "end": { - "line": 22, - "column": 31 + "line": 26, + "column": 52 } } }, @@ -6234,16 +7785,16 @@ "postfix": false, "binop": null }, - "start": 618, - "end": 619, + "start": 826, + "end": 827, "loc": { "start": { - "line": 22, - "column": 31 + "line": 26, + "column": 52 }, "end": { - "line": 22, - "column": 32 + "line": 26, + "column": 53 } } }, @@ -6260,16 +7811,16 @@ "binop": null, "updateContext": null }, - "start": 619, - "end": 620, + "start": 827, + "end": 828, "loc": { "start": { - "line": 22, - "column": 32 + "line": 26, + "column": 53 }, "end": { - "line": 22, - "column": 33 + "line": 26, + "column": 54 } } }, @@ -6286,15 +7837,15 @@ "binop": null }, "value": "assert", - "start": 622, - "end": 628, + "start": 830, + "end": 836, "loc": { "start": { - "line": 23, + "line": 27, "column": 1 }, "end": { - "line": 23, + "line": 27, "column": 7 } } @@ -6311,15 +7862,15 @@ "postfix": false, "binop": null }, - "start": 628, - "end": 629, + "start": 836, + "end": 837, "loc": { "start": { - "line": 23, + "line": 27, "column": 7 }, "end": { - "line": 23, + "line": 27, "column": 8 } } @@ -6337,68 +7888,16 @@ "binop": null }, "value": "n", - "start": 629, - "end": 630, + "start": 837, + "end": 838, "loc": { "start": { - "line": 23, + "line": 27, "column": 8 }, "end": { - "line": 23, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 630, - "end": 631, - "loc": { - "start": { - "line": 23, + "line": 27, "column": 9 - }, - "end": { - "line": 23, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 631, - "end": 636, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 15 } } }, @@ -6415,16 +7914,16 @@ "binop": null, "updateContext": null }, - "start": 636, - "end": 637, + "start": 838, + "end": 839, "loc": { "start": { - "line": 23, - "column": 15 + "line": 27, + "column": 9 }, "end": { - "line": 23, - "column": 16 + "line": 27, + "column": 10 } } }, @@ -6440,17 +7939,17 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 637, - "end": 643, + "value": "parent", + "start": 839, + "end": 845, "loc": { "start": { - "line": 23, - "column": 16 + "line": 27, + "column": 10 }, "end": { - "line": 23, - "column": 22 + "line": 27, + "column": 16 } } }, @@ -6467,23 +7966,24 @@ "binop": 6, "updateContext": null }, - "value": "===", - "start": 644, - "end": 647, + "value": "!==", + "start": 846, + "end": 849, "loc": { "start": { - "line": 23, - "column": 23 + "line": 27, + "column": 17 }, "end": { - "line": 23, - "column": 26 + "line": 27, + "column": 20 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -6491,19 +7991,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "BLACK", - "start": 648, - "end": 653, + "value": "null", + "start": 850, + "end": 854, "loc": { "start": { - "line": 23, - "column": 27 + "line": 27, + "column": 21 }, "end": { - "line": 23, - "column": 32 + "line": 27, + "column": 25 } } }, @@ -6519,16 +8020,16 @@ "postfix": false, "binop": null }, - "start": 653, - "end": 654, + "start": 854, + "end": 855, "loc": { "start": { - "line": 23, - "column": 32 + "line": 27, + "column": 25 }, "end": { - "line": 23, - "column": 33 + "line": 27, + "column": 26 } } }, @@ -6545,16 +8046,16 @@ "binop": null, "updateContext": null }, - "start": 654, - "end": 655, + "start": 855, + "end": 856, "loc": { "start": { - "line": 23, - "column": 33 + "line": 27, + "column": 26 }, "end": { - "line": 23, - "column": 34 + "line": 27, + "column": 27 } } }, @@ -6571,15 +8072,15 @@ "binop": null }, "value": "assert", - "start": 657, - "end": 663, + "start": 858, + "end": 864, "loc": { "start": { - "line": 24, + "line": 28, "column": 1 }, "end": { - "line": 24, + "line": 28, "column": 7 } } @@ -6596,15 +8097,15 @@ "postfix": false, "binop": null }, - "start": 663, - "end": 664, + "start": 864, + "end": 865, "loc": { "start": { - "line": 24, + "line": 28, "column": 7 }, "end": { - "line": 24, + "line": 28, "column": 8 } } @@ -6622,15 +8123,15 @@ "binop": null }, "value": "n", - "start": 664, - "end": 665, + "start": 865, + "end": 866, "loc": { "start": { - "line": 24, + "line": 28, "column": 8 }, "end": { - "line": 24, + "line": 28, "column": 9 } } @@ -6648,15 +8149,15 @@ "binop": null, "updateContext": null }, - "start": 665, - "end": 666, + "start": 866, + "end": 867, "loc": { "start": { - "line": 24, + "line": 28, "column": 9 }, "end": { - "line": 24, + "line": 28, "column": 10 } } @@ -6674,16 +8175,68 @@ "binop": null }, "value": "parent", - "start": 666, - "end": 672, + "start": 867, + "end": 873, "loc": { "start": { - "line": 24, + "line": 28, "column": 10 }, "end": { - "line": 24, + "line": 28, + "column": 16 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 873, + "end": 874, + "loc": { + "start": { + "line": 28, "column": 16 + }, + "end": { + "line": 28, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 874, + "end": 880, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 23 } } }, @@ -6700,24 +8253,23 @@ "binop": 6, "updateContext": null }, - "value": "!==", - "start": 673, - "end": 676, + "value": "===", + "start": 881, + "end": 884, "loc": { "start": { - "line": 24, - "column": 17 + "line": 28, + "column": 24 }, "end": { - "line": 24, - "column": 20 + "line": 28, + "column": 27 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -6725,20 +8277,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 677, - "end": 681, + "value": "RED", + "start": 885, + "end": 888, "loc": { "start": { - "line": 24, - "column": 21 + "line": 28, + "column": 28 }, "end": { - "line": 24, - "column": 25 + "line": 28, + "column": 31 } } }, @@ -6754,16 +8305,16 @@ "postfix": false, "binop": null }, - "start": 681, - "end": 682, + "start": 888, + "end": 889, "loc": { "start": { - "line": 24, - "column": 25 + "line": 28, + "column": 31 }, "end": { - "line": 24, - "column": 26 + "line": 28, + "column": 32 } } }, @@ -6780,49 +8331,51 @@ "binop": null, "updateContext": null }, - "start": 682, - "end": 683, + "start": 889, + "end": 890, "loc": { "start": { - "line": 24, - "column": 26 + "line": 28, + "column": 32 }, "end": { - "line": 24, - "column": 27 + "line": 28, + "column": 33 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 685, - "end": 691, + "value": "const", + "start": 892, + "end": 897, "loc": { "start": { - "line": 25, + "line": 29, "column": 1 }, "end": { - "line": 25, - "column": 7 + "line": 29, + "column": 6 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6831,19 +8384,47 @@ "postfix": false, "binop": null }, - "start": 691, - "end": 692, + "value": "g", + "start": 898, + "end": 899, "loc": { "start": { - "line": 25, + "line": 29, "column": 7 }, "end": { - "line": 25, + "line": 29, "column": 8 } } }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 900, + "end": 901, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + } + } + }, { "type": { "label": "name", @@ -6856,43 +8437,42 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 692, - "end": 693, + "value": "grandparent", + "start": 902, + "end": 913, "loc": { "start": { - "line": 25, - "column": 8 + "line": 29, + "column": 11 }, "end": { - "line": 25, - "column": 9 + "line": 29, + "column": 22 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 693, - "end": 694, + "start": 913, + "end": 914, "loc": { "start": { - "line": 25, - "column": 9 + "line": 29, + "column": 22 }, "end": { - "line": 25, - "column": 10 + "line": 29, + "column": 23 } } }, @@ -6908,24 +8488,49 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 694, - "end": 700, + "value": "n", + "start": 914, + "end": 915, + "loc": { + "start": { + "line": 29, + "column": 23 + }, + "end": { + "line": 29, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 915, + "end": 916, "loc": { "start": { - "line": 25, - "column": 10 + "line": 29, + "column": 24 }, "end": { - "line": 25, - "column": 16 + "line": 29, + "column": 25 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6935,69 +8540,85 @@ "binop": null, "updateContext": null }, - "start": 700, - "end": 701, + "start": 916, + "end": 917, "loc": { "start": { - "line": 25, - "column": 16 + "line": 29, + "column": 25 }, "end": { - "line": 25, - "column": 17 + "line": 29, + "column": 26 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", + "start": 920, + "end": 1382, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 43, + "column": 4 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_color", - "start": 701, - "end": 707, + "value": "if", + "start": 1385, + "end": 1387, "loc": { "start": { - "line": 25, - "column": 17 + "line": 45, + "column": 1 }, "end": { - "line": 25, - "column": 23 + "line": 45, + "column": 3 } } }, { "type": { - "label": "==/!=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 708, - "end": 711, + "start": 1388, + "end": 1389, "loc": { "start": { - "line": 25, - "column": 24 + "line": 45, + "column": 4 }, "end": { - "line": 25, - "column": 27 + "line": 45, + "column": 5 } } }, @@ -7013,75 +8634,76 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 712, - "end": 715, + "value": "n", + "start": 1389, + "end": 1390, "loc": { "start": { - "line": 25, - "column": 28 + "line": 45, + "column": 5 }, "end": { - "line": 25, - "column": 31 + "line": 45, + "column": 6 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 715, - "end": 716, + "value": "===", + "start": 1391, + "end": 1394, "loc": { "start": { - "line": 25, - "column": 31 + "line": 45, + "column": 7 }, "end": { - "line": 25, - "column": 32 + "line": 45, + "column": 10 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 716, - "end": 717, + "value": "n", + "start": 1395, + "end": 1396, "loc": { "start": { - "line": 25, - "column": 32 + "line": 45, + "column": 11 }, "end": { - "line": 25, - "column": 33 + "line": 45, + "column": 12 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7092,17 +8714,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 719, - "end": 724, + "start": 1396, + "end": 1397, "loc": { "start": { - "line": 26, - "column": 1 + "line": 45, + "column": 12 }, "end": { - "line": 26, - "column": 6 + "line": 45, + "column": 13 } } }, @@ -7118,44 +8739,43 @@ "postfix": false, "binop": null }, - "value": "u", - "start": 725, - "end": 726, + "value": "parent", + "start": 1397, + "end": 1403, "loc": { "start": { - "line": 26, - "column": 7 + "line": 45, + "column": 13 }, "end": { - "line": 26, - "column": 8 + "line": 45, + "column": 19 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 727, - "end": 728, + "start": 1403, + "end": 1404, "loc": { "start": { - "line": 26, - "column": 9 + "line": 45, + "column": 19 }, "end": { - "line": 26, - "column": 10 + "line": 45, + "column": 20 } } }, @@ -7171,42 +8791,44 @@ "postfix": false, "binop": null }, - "value": "uncle", - "start": 729, - "end": 734, + "value": "right", + "start": 1404, + "end": 1409, "loc": { "start": { - "line": 26, - "column": 11 + "line": 45, + "column": 20 }, "end": { - "line": 26, - "column": 16 + "line": 45, + "column": 25 } } }, { "type": { - "label": "(", + "label": "&&", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 2, + "updateContext": null }, - "start": 734, - "end": 735, + "value": "&&", + "start": 1410, + "end": 1412, "loc": { "start": { - "line": 26, - "column": 16 + "line": 45, + "column": 26 }, "end": { - "line": 26, - "column": 17 + "line": 45, + "column": 28 } } }, @@ -7223,22 +8845,22 @@ "binop": null }, "value": "n", - "start": 735, - "end": 736, + "start": 1413, + "end": 1414, "loc": { "start": { - "line": 26, - "column": 17 + "line": 45, + "column": 29 }, "end": { - "line": 26, - "column": 18 + "line": 45, + "column": 30 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7246,113 +8868,72 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "start": 736, - "end": 737, - "loc": { - "start": { - "line": 26, - "column": 18 - }, - "end": { - "line": 26, - "column": 19 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, "binop": null, "updateContext": null }, - "start": 737, - "end": 738, - "loc": { - "start": { - "line": 26, - "column": 19 - }, - "end": { - "line": 26, - "column": 20 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 741, - "end": 1236, + "start": 1414, + "end": 1415, "loc": { "start": { - "line": 28, - "column": 1 + "line": 45, + "column": 30 }, "end": { - "line": 40, - "column": 4 + "line": 45, + "column": 31 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1239, - "end": 1241, + "value": "parent", + "start": 1415, + "end": 1421, "loc": { "start": { - "line": 42, - "column": 1 + "line": 45, + "column": 31 }, "end": { - "line": 42, - "column": 3 + "line": 45, + "column": 37 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 1242, - "end": 1243, + "value": "===", + "start": 1422, + "end": 1425, "loc": { "start": { - "line": 42, - "column": 4 + "line": 45, + "column": 38 }, "end": { - "line": 42, - "column": 5 + "line": 45, + "column": 41 } } }, @@ -7368,17 +8949,17 @@ "postfix": false, "binop": null }, - "value": "u", - "start": 1243, - "end": 1244, + "value": "g", + "start": 1426, + "end": 1427, "loc": { "start": { - "line": 42, - "column": 5 + "line": 45, + "column": 42 }, "end": { - "line": 42, - "column": 6 + "line": 45, + "column": 43 } } }, @@ -7395,16 +8976,16 @@ "binop": null, "updateContext": null }, - "start": 1244, - "end": 1245, + "start": 1427, + "end": 1428, "loc": { "start": { - "line": 42, - "column": 6 + "line": 45, + "column": 43 }, "end": { - "line": 42, - "column": 7 + "line": 45, + "column": 44 } } }, @@ -7420,51 +9001,49 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1245, - "end": 1251, + "value": "left", + "start": 1428, + "end": 1432, "loc": { "start": { - "line": 42, - "column": 7 + "line": 45, + "column": 44 }, "end": { - "line": 42, - "column": 13 + "line": 45, + "column": 48 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 1252, - "end": 1255, + "start": 1432, + "end": 1433, "loc": { "start": { - "line": 42, - "column": 14 + "line": 45, + "column": 48 }, "end": { - "line": 42, - "column": 17 + "line": 45, + "column": 49 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7473,25 +9052,24 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 1256, - "end": 1259, + "start": 1434, + "end": 1435, "loc": { "start": { - "line": 42, - "column": 18 + "line": 45, + "column": 50 }, "end": { - "line": 42, - "column": 21 + "line": 45, + "column": 51 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7499,22 +9077,23 @@ "postfix": false, "binop": null }, - "start": 1259, - "end": 1260, + "value": "rotate_left", + "start": 1438, + "end": 1449, "loc": { "start": { - "line": 42, - "column": 21 + "line": 46, + "column": 2 }, "end": { - "line": 42, - "column": 22 + "line": 46, + "column": 13 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -7524,16 +9103,16 @@ "postfix": false, "binop": null }, - "start": 1261, - "end": 1262, + "start": 1449, + "end": 1450, "loc": { "start": { - "line": 42, - "column": 23 + "line": 46, + "column": 13 }, "end": { - "line": 42, - "column": 24 + "line": 46, + "column": 14 } } }, @@ -7550,16 +9129,16 @@ "binop": null }, "value": "n", - "start": 1265, - "end": 1266, + "start": 1450, + "end": 1451, "loc": { "start": { - "line": 43, - "column": 2 + "line": 46, + "column": 14 }, "end": { - "line": 43, - "column": 3 + "line": 46, + "column": 15 } } }, @@ -7576,16 +9155,16 @@ "binop": null, "updateContext": null }, - "start": 1266, - "end": 1267, + "start": 1451, + "end": 1452, "loc": { "start": { - "line": 43, - "column": 3 + "line": 46, + "column": 15 }, "end": { - "line": 43, - "column": 4 + "line": 46, + "column": 16 } } }, @@ -7602,22 +9181,22 @@ "binop": null }, "value": "parent", - "start": 1267, - "end": 1273, + "start": 1452, + "end": 1458, "loc": { "start": { - "line": 43, - "column": 4 + "line": 46, + "column": 16 }, "end": { - "line": 43, - "column": 10 + "line": 46, + "column": 22 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7625,80 +9204,84 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1273, - "end": 1274, + "start": 1458, + "end": 1459, "loc": { "start": { - "line": 43, - "column": 10 + "line": 46, + "column": 22 }, "end": { - "line": 43, - "column": 11 + "line": 46, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_color", - "start": 1274, - "end": 1280, + "start": 1459, + "end": 1460, "loc": { "start": { - "line": 43, - "column": 11 + "line": 46, + "column": 23 }, "end": { - "line": 43, - "column": 17 + "line": 46, + "column": 24 } } }, { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 1281, - "end": 1282, + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1464, + "end": 1720, "loc": { "start": { - "line": 43, - "column": 18 + "line": 48, + "column": 2 }, "end": { - "line": 43, - "column": 19 + "line": 57, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1724, + "end": 1801, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 79 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7706,23 +9289,23 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1283, - "end": 1288, + "start": 1803, + "end": 1804, "loc": { "start": { - "line": 43, - "column": 20 + "line": 60, + "column": 1 }, "end": { - "line": 43, - "column": 25 + "line": 60, + "column": 2 } } }, { "type": { - "label": ";", + "label": "else", + "keyword": "else", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7733,68 +9316,70 @@ "binop": null, "updateContext": null }, - "start": 1288, - "end": 1289, + "value": "else", + "start": 1805, + "end": 1809, "loc": { "start": { - "line": 43, - "column": 25 + "line": 60, + "column": 3 }, "end": { - "line": 43, - "column": 26 + "line": 60, + "column": 7 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "u", - "start": 1292, - "end": 1293, + "value": "if", + "start": 1810, + "end": 1812, "loc": { "start": { - "line": 44, - "column": 2 + "line": 60, + "column": 8 }, "end": { - "line": 44, - "column": 3 + "line": 60, + "column": 10 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1293, - "end": 1294, + "start": 1813, + "end": 1814, "loc": { "start": { - "line": 44, - "column": 3 + "line": 60, + "column": 11 }, "end": { - "line": 44, - "column": 4 + "line": 60, + "column": 12 } } }, @@ -7810,44 +9395,44 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1294, - "end": 1300, + "value": "n", + "start": 1814, + "end": 1815, "loc": { "start": { - "line": 44, - "column": 4 + "line": 60, + "column": 12 }, "end": { - "line": 44, - "column": 10 + "line": 60, + "column": 13 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 1301, - "end": 1302, + "value": "===", + "start": 1816, + "end": 1819, "loc": { "start": { - "line": 44, - "column": 11 + "line": 60, + "column": 14 }, "end": { - "line": 44, - "column": 12 + "line": 60, + "column": 17 } } }, @@ -7863,50 +9448,23 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1303, - "end": 1308, - "loc": { - "start": { - "line": 44, - "column": 13 - }, - "end": { - "line": 44, - "column": 18 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1308, - "end": 1309, + "value": "n", + "start": 1820, + "end": 1821, "loc": { "start": { - "line": 44, + "line": 60, "column": 18 }, "end": { - "line": 44, + "line": 60, "column": 19 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7917,17 +9475,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 1312, - "end": 1317, + "start": 1821, + "end": 1822, "loc": { "start": { - "line": 45, - "column": 2 + "line": 60, + "column": 19 }, "end": { - "line": 45, - "column": 7 + "line": 60, + "column": 20 } } }, @@ -7943,44 +9500,43 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 1318, - "end": 1319, + "value": "parent", + "start": 1822, + "end": 1828, "loc": { "start": { - "line": 45, - "column": 8 + "line": 60, + "column": 20 }, - "end": { - "line": 45, - "column": 9 + "end": { + "line": 60, + "column": 26 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 1320, - "end": 1321, + "start": 1828, + "end": 1829, "loc": { "start": { - "line": 45, - "column": 10 + "line": 60, + "column": 26 }, "end": { - "line": 45, - "column": 11 + "line": 60, + "column": 27 } } }, @@ -7996,42 +9552,44 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 1322, - "end": 1333, + "value": "left", + "start": 1829, + "end": 1833, "loc": { "start": { - "line": 45, - "column": 12 + "line": 60, + "column": 27 }, "end": { - "line": 45, - "column": 23 + "line": 60, + "column": 31 } } }, { "type": { - "label": "(", + "label": "&&", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 2, + "updateContext": null }, - "start": 1333, - "end": 1334, + "value": "&&", + "start": 1834, + "end": 1836, "loc": { "start": { - "line": 45, - "column": 23 + "line": 60, + "column": 32 }, "end": { - "line": 45, - "column": 24 + "line": 60, + "column": 34 } } }, @@ -8048,22 +9606,22 @@ "binop": null }, "value": "n", - "start": 1334, - "end": 1335, + "start": 1837, + "end": 1838, "loc": { "start": { - "line": 45, - "column": 24 + "line": 60, + "column": 35 }, "end": { - "line": 45, - "column": 25 + "line": 60, + "column": 36 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -8071,24 +9629,51 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1838, + "end": 1839, + "loc": { + "start": { + "line": 60, + "column": 36 + }, + "end": { + "line": 60, + "column": 37 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null }, - "start": 1335, - "end": 1336, + "value": "parent", + "start": 1839, + "end": 1845, "loc": { "start": { - "line": 45, - "column": 25 + "line": 60, + "column": 37 }, "end": { - "line": 45, - "column": 26 + "line": 60, + "column": 43 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8096,19 +9681,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1336, - "end": 1337, + "value": "===", + "start": 1846, + "end": 1849, "loc": { "start": { - "line": 45, - "column": 26 + "line": 60, + "column": 44 }, "end": { - "line": 45, - "column": 27 + "line": 60, + "column": 47 } } }, @@ -8125,16 +9711,16 @@ "binop": null }, "value": "g", - "start": 1340, - "end": 1341, + "start": 1850, + "end": 1851, "loc": { "start": { - "line": 46, - "column": 2 + "line": 60, + "column": 48 }, "end": { - "line": 46, - "column": 3 + "line": 60, + "column": 49 } } }, @@ -8151,16 +9737,16 @@ "binop": null, "updateContext": null }, - "start": 1341, - "end": 1342, + "start": 1851, + "end": 1852, "loc": { "start": { - "line": 46, - "column": 3 + "line": 60, + "column": 49 }, "end": { - "line": 46, - "column": 4 + "line": 60, + "column": 50 } } }, @@ -8176,51 +9762,49 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 1342, - "end": 1348, + "value": "right", + "start": 1852, + "end": 1857, "loc": { "start": { - "line": 46, - "column": 4 + "line": 60, + "column": 50 }, "end": { - "line": 46, - "column": 10 + "line": 60, + "column": 55 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 1349, - "end": 1350, + "start": 1857, + "end": 1858, "loc": { "start": { - "line": 46, - "column": 11 + "line": 60, + "column": 55 }, "end": { - "line": 46, - "column": 12 + "line": 60, + "column": 56 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -8229,43 +9813,32 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 1351, - "end": 1354, + "start": 1859, + "end": 1860, "loc": { "start": { - "line": 46, - "column": 13 + "line": 60, + "column": 57 }, "end": { - "line": 46, - "column": 16 + "line": 60, + "column": 58 } } }, { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1354, - "end": 1355, + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1863, + "end": 2364, "loc": { "start": { - "line": 46, - "column": 16 + "line": 61, + "column": 2 }, "end": { - "line": 46, - "column": 17 + "line": 73, + "column": 5 } } }, @@ -8281,16 +9854,16 @@ "postfix": false, "binop": null }, - "value": "insert_case1", - "start": 1358, - "end": 1370, + "value": "rotate_right", + "start": 2367, + "end": 2379, "loc": { "start": { - "line": 47, + "line": 74, "column": 2 }, "end": { - "line": 47, + "line": 74, "column": 14 } } @@ -8307,15 +9880,15 @@ "postfix": false, "binop": null }, - "start": 1370, - "end": 1371, + "start": 2379, + "end": 2380, "loc": { "start": { - "line": 47, + "line": 74, "column": 14 }, "end": { - "line": 47, + "line": 74, "column": 15 } } @@ -8332,23 +9905,23 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 1371, - "end": 1372, + "value": "n", + "start": 2380, + "end": 2381, "loc": { "start": { - "line": 47, + "line": 74, "column": 15 }, "end": { - "line": 47, + "line": 74, "column": 16 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -8356,50 +9929,51 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1372, - "end": 1373, + "start": 2381, + "end": 2382, "loc": { "start": { - "line": 47, + "line": 74, "column": 16 }, "end": { - "line": 47, + "line": 74, "column": 17 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1373, - "end": 1374, + "value": "parent", + "start": 2382, + "end": 2388, "loc": { "start": { - "line": 47, + "line": 74, "column": 17 }, "end": { - "line": 47, - "column": 18 + "line": 74, + "column": 23 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -8409,23 +9983,22 @@ "postfix": false, "binop": null }, - "start": 1376, - "end": 1377, + "start": 2388, + "end": 2389, "loc": { "start": { - "line": 48, - "column": 1 + "line": 74, + "column": 23 }, "end": { - "line": 48, - "column": 2 + "line": 74, + "column": 24 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8436,17 +10009,73 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1378, - "end": 1382, + "start": 2389, + "end": 2390, "loc": { "start": { - "line": 48, - "column": 3 + "line": 74, + "column": 24 }, "end": { - "line": 48, - "column": 7 + "line": 74, + "column": 25 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2394, + "end": 2622, + "loc": { + "start": { + "line": 76, + "column": 2 + }, + "end": { + "line": 84, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2626, + "end": 2642, + "loc": { + "start": { + "line": 86, + "column": 2 + }, + "end": { + "line": 86, + "column": 18 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2644, + "end": 2645, + "loc": { + "start": { + "line": 87, + "column": 1 + }, + "end": { + "line": 87, + "column": 2 } } }, @@ -8463,16 +10092,16 @@ "binop": null }, "value": "insert_case4", - "start": 1383, - "end": 1395, + "start": 2648, + "end": 2660, "loc": { "start": { - "line": 48, - "column": 8 + "line": 89, + "column": 1 }, "end": { - "line": 48, - "column": 20 + "line": 89, + "column": 13 } } }, @@ -8488,16 +10117,16 @@ "postfix": false, "binop": null }, - "start": 1395, - "end": 1396, + "start": 2660, + "end": 2661, "loc": { "start": { - "line": 48, - "column": 20 + "line": 89, + "column": 13 }, "end": { - "line": 48, - "column": 21 + "line": 89, + "column": 14 } } }, @@ -8514,16 +10143,16 @@ "binop": null }, "value": "n", - "start": 1396, - "end": 1397, + "start": 2661, + "end": 2662, "loc": { "start": { - "line": 48, - "column": 21 + "line": 89, + "column": 14 }, "end": { - "line": 48, - "column": 22 + "line": 89, + "column": 15 } } }, @@ -8539,16 +10168,16 @@ "postfix": false, "binop": null }, - "start": 1397, - "end": 1398, + "start": 2662, + "end": 2663, "loc": { "start": { - "line": 48, - "column": 22 + "line": 89, + "column": 15 }, "end": { - "line": 48, - "column": 23 + "line": 89, + "column": 16 } } }, @@ -8565,16 +10194,16 @@ "binop": null, "updateContext": null }, - "start": 1398, - "end": 1399, + "start": 2663, + "end": 2664, "loc": { "start": { - "line": 48, - "column": 23 + "line": 89, + "column": 16 }, "end": { - "line": 48, - "column": 24 + "line": 89, + "column": 17 } } }, @@ -8590,15 +10219,15 @@ "postfix": false, "binop": null }, - "start": 1400, - "end": 1401, + "start": 2665, + "end": 2666, "loc": { "start": { - "line": 49, + "line": 90, "column": 0 }, "end": { - "line": 49, + "line": 90, "column": 1 } } @@ -8616,15 +10245,15 @@ "binop": null, "updateContext": null }, - "start": 1401, - "end": 1402, + "start": 2666, + "end": 2667, "loc": { "start": { - "line": 49, + "line": 90, "column": 1 }, "end": { - "line": 49, + "line": 90, "column": 2 } } @@ -8644,15 +10273,15 @@ "updateContext": null }, "value": "export", - "start": 1404, - "end": 1410, + "start": 2669, + "end": 2675, "loc": { "start": { - "line": 51, + "line": 92, "column": 0 }, "end": { - "line": 51, + "line": 92, "column": 6 } } @@ -8672,15 +10301,15 @@ "updateContext": null }, "value": "default", - "start": 1411, - "end": 1418, + "start": 2676, + "end": 2683, "loc": { "start": { - "line": 51, + "line": 92, "column": 7 }, "end": { - "line": 51, + "line": 92, "column": 14 } } @@ -8698,15 +10327,15 @@ "binop": null }, "value": "insert_case3", - "start": 1419, - "end": 1431, + "start": 2684, + "end": 2696, "loc": { "start": { - "line": 51, + "line": 92, "column": 15 }, "end": { - "line": 51, + "line": 92, "column": 27 } } @@ -8724,15 +10353,15 @@ "binop": null, "updateContext": null }, - "start": 1431, - "end": 1432, + "start": 2696, + "end": 2697, "loc": { "start": { - "line": 51, + "line": 92, "column": 27 }, "end": { - "line": 51, + "line": 92, "column": 28 } } @@ -8750,15 +10379,15 @@ "binop": null, "updateContext": null }, - "start": 1433, - "end": 1433, + "start": 2698, + "end": 2698, "loc": { "start": { - "line": 52, + "line": 93, "column": 0 }, "end": { - "line": 52, + "line": 93, "column": 0 } } diff --git a/ast/source/insertion/insert_case4.js.json b/ast/source/insertion/insert_case4.js.json index c1faf79..6d1f113 100644 --- a/ast/source/insertion/insert_case4.js.json +++ b/ast/source/insertion/insert_case4.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 2659, + "end": 2141, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 93, + "line": 71, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 2659, + "end": 2141, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 93, + "line": 71, "column": 0 } }, @@ -509,89 +509,20 @@ "raw": "'../family/grandparent.js'" }, "value": "../family/grandparent.js" - } - }, - { - "type": "ImportDeclaration", - "start": 298, - "end": 343, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 45 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 305, - "end": 317, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 305, - "end": 317, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - }, - "identifierName": "insert_case5" - }, - "name": "insert_case5" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 323, - "end": 342, - "loc": { - "start": { - "line": 8, - "column": 25 - }, - "end": { - "line": 8, - "column": 44 - } - }, - "extra": { - "rawValue": "./insert_case5.js", - "raw": "'./insert_case5.js'" - }, - "value": "./insert_case5.js" }, "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 345, - "end": 635, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "start": 299, + "end": 578, "loc": { "start": { - "line": 10, + "line": 9, "column": 0 }, "end": { - "line": 21, + "line": 19, "column": 3 } } @@ -600,44 +531,44 @@ }, { "type": "Identifier", - "start": 636, - "end": 2628, + "start": 579, + "end": 2110, "loc": { "start": { - "line": 22, + "line": 20, "column": 0 }, "end": { - "line": 90, + "line": 68, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 642, - "end": 2627, + "start": 585, + "end": 2109, "loc": { "start": { - "line": 22, + "line": 20, "column": 6 }, "end": { - "line": 90, + "line": 68, "column": 1 } }, "id": { "type": "Identifier", - "start": 642, - "end": 654, + "start": 585, + "end": 597, "loc": { "start": { - "line": 22, + "line": 20, "column": 6 }, "end": { - "line": 22, + "line": 20, "column": 18 }, "identifierName": "insert_case4" @@ -647,15 +578,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 657, - "end": 2627, + "start": 600, + "end": 2109, "loc": { "start": { - "line": 22, + "line": 20, "column": 21 }, "end": { - "line": 90, + "line": 68, "column": 1 } }, @@ -666,15 +597,15 @@ "params": [ { "type": "Identifier", - "start": 658, - "end": 659, + "start": 601, + "end": 602, "loc": { "start": { - "line": 22, + "line": 20, "column": 22 }, "end": { - "line": 22, + "line": 20, "column": 23 }, "identifierName": "n" @@ -684,58 +615,58 @@ ], "body": { "type": "BlockStatement", - "start": 664, - "end": 2627, + "start": 607, + "end": 2109, "loc": { "start": { - "line": 22, + "line": 20, "column": 28 }, "end": { - "line": 90, + "line": 68, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 667, - "end": 693, + "start": 610, + "end": 636, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 667, - "end": 692, + "start": 610, + "end": 635, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 667, - "end": 673, + "start": 610, + "end": 616, "loc": { "start": { - "line": 23, + "line": 21, "column": 1 }, "end": { - "line": 23, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -745,29 +676,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 674, - "end": 691, + "start": 617, + "end": 634, "loc": { "start": { - "line": 23, + "line": 21, "column": 8 }, "end": { - "line": 23, + "line": 21, "column": 25 } }, "left": { "type": "Identifier", - "start": 674, - "end": 675, + "start": 617, + "end": 618, "loc": { "start": { - "line": 23, + "line": 21, "column": 8 }, "end": { - "line": 23, + "line": 21, "column": 9 }, "identifierName": "n" @@ -777,15 +708,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 687, - "end": 691, + "start": 630, + "end": 634, "loc": { "start": { - "line": 23, + "line": 21, "column": 21 }, "end": { - "line": 23, + "line": 21, "column": 25 }, "identifierName": "Node" @@ -798,43 +729,43 @@ }, { "type": "ExpressionStatement", - "start": 695, - "end": 720, + "start": 638, + "end": 663, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 695, - "end": 719, + "start": 638, + "end": 662, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 25 } }, "callee": { "type": "Identifier", - "start": 695, - "end": 701, + "start": 638, + "end": 644, "loc": { "start": { - "line": 24, + "line": 22, "column": 1 }, "end": { - "line": 24, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -844,43 +775,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 702, - "end": 718, + "start": 645, + "end": 661, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 702, - "end": 710, + "start": 645, + "end": 653, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 16 } }, "object": { "type": "Identifier", - "start": 702, - "end": 703, + "start": 645, + "end": 646, "loc": { "start": { - "line": 24, + "line": 22, "column": 8 }, "end": { - "line": 24, + "line": 22, "column": 9 }, "identifierName": "n" @@ -889,15 +820,15 @@ }, "property": { "type": "Identifier", - "start": 704, - "end": 710, + "start": 647, + "end": 653, "loc": { "start": { - "line": 24, + "line": 22, "column": 10 }, "end": { - "line": 24, + "line": 22, "column": 16 }, "identifierName": "_color" @@ -909,15 +840,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 715, - "end": 718, + "start": 658, + "end": 661, "loc": { "start": { - "line": 24, + "line": 22, "column": 21 }, "end": { - "line": 24, + "line": 22, "column": 24 }, "identifierName": "RED" @@ -930,43 +861,43 @@ }, { "type": "ExpressionStatement", - "start": 722, - "end": 754, + "start": 665, + "end": 716, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, - "column": 33 + "line": 23, + "column": 52 } }, "expression": { "type": "CallExpression", - "start": 722, - "end": 753, + "start": 665, + "end": 715, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, - "column": 32 + "line": 23, + "column": 51 } }, "callee": { "type": "Identifier", - "start": 722, - "end": 728, + "start": 665, + "end": 671, "loc": { "start": { - "line": 25, + "line": 23, "column": 1 }, "end": { - "line": 25, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -975,58 +906,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 729, - "end": 752, + "type": "LogicalExpression", + "start": 672, + "end": 714, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, - "column": 31 + "line": 23, + "column": 50 } }, "left": { - "type": "MemberExpression", - "start": 729, - "end": 742, + "type": "BinaryExpression", + "start": 672, + "end": 687, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, - "column": 21 + "line": 23, + "column": 23 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 729, - "end": 735, + "start": 672, + "end": 678, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 14 } }, "object": { "type": "Identifier", - "start": 729, - "end": 730, + "start": 672, + "end": 673, "loc": { "start": { - "line": 25, + "line": 23, "column": 8 }, "end": { - "line": 25, + "line": 23, "column": 9 }, "identifierName": "n" @@ -1035,15 +966,15 @@ }, "property": { "type": "Identifier", - "start": 731, - "end": 735, + "start": 674, + "end": 678, "loc": { "start": { - "line": 25, + "line": 23, "column": 10 }, "end": { - "line": 25, + "line": 23, "column": 14 }, "identifierName": "left" @@ -1052,42 +983,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 736, - "end": 742, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 683, + "end": 687, "loc": { "start": { - "line": 25, - "column": 15 + "line": 23, + "column": 19 }, "end": { - "line": 25, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 23, + "column": 23 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 747, - "end": 752, + "type": "BinaryExpression", + "start": 691, + "end": 714, "loc": { "start": { - "line": 25, - "column": 26 + "line": 23, + "column": 27 }, "end": { - "line": 25, - "column": 31 + "line": 23, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 691, + "end": 704, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 40 + } + }, + "object": { + "type": "MemberExpression", + "start": 691, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 691, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 28 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 693, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 698, + "end": 704, + "loc": { + "start": { + "line": 23, + "column": 34 + }, + "end": { + "line": 23, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "BLACK" + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 709, + "end": 714, + "loc": { + "start": { + "line": 23, + "column": 45 + }, + "end": { + "line": 23, + "column": 50 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -1095,43 +1123,43 @@ }, { "type": "ExpressionStatement", - "start": 756, - "end": 789, + "start": 718, + "end": 771, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, - "column": 34 + "line": 24, + "column": 54 } }, "expression": { "type": "CallExpression", - "start": 756, - "end": 788, + "start": 718, + "end": 770, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, - "column": 33 + "line": 24, + "column": 53 } }, "callee": { "type": "Identifier", - "start": 756, - "end": 762, + "start": 718, + "end": 724, "loc": { "start": { - "line": 26, + "line": 24, "column": 1 }, "end": { - "line": 26, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -1140,58 +1168,58 @@ }, "arguments": [ { - "type": "BinaryExpression", - "start": 763, - "end": 787, + "type": "LogicalExpression", + "start": 725, + "end": 769, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, - "column": 32 + "line": 24, + "column": 52 } }, "left": { - "type": "MemberExpression", - "start": 763, - "end": 777, + "type": "BinaryExpression", + "start": 725, + "end": 741, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, - "column": 22 + "line": 24, + "column": 24 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 763, - "end": 770, + "start": 725, + "end": 732, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 15 } }, "object": { "type": "Identifier", - "start": 763, - "end": 764, + "start": 725, + "end": 726, "loc": { "start": { - "line": 26, + "line": 24, "column": 8 }, "end": { - "line": 26, + "line": 24, "column": 9 }, "identifierName": "n" @@ -1200,15 +1228,15 @@ }, "property": { "type": "Identifier", - "start": 765, - "end": 770, + "start": 727, + "end": 732, "loc": { "start": { - "line": 26, + "line": 24, "column": 10 }, "end": { - "line": 26, + "line": 24, "column": 15 }, "identifierName": "right" @@ -1217,42 +1245,139 @@ }, "computed": false }, - "property": { - "type": "Identifier", - "start": 771, - "end": 777, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 737, + "end": 741, "loc": { "start": { - "line": 26, - "column": 16 + "line": 24, + "column": 20 }, "end": { - "line": 26, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 24, + "column": 24 + } + } + } }, - "operator": "===", + "operator": "||", "right": { - "type": "Identifier", - "start": 782, - "end": 787, + "type": "BinaryExpression", + "start": 745, + "end": 769, "loc": { "start": { - "line": 26, - "column": 27 + "line": 24, + "column": 28 }, "end": { - "line": 26, - "column": 32 + "line": 24, + "column": 52 + } + }, + "left": { + "type": "MemberExpression", + "start": 745, + "end": 759, + "loc": { + "start": { + "line": 24, + "column": 28 + }, + "end": { + "line": 24, + "column": 42 + } + }, + "object": { + "type": "MemberExpression", + "start": 745, + "end": 752, + "loc": { + "start": { + "line": 24, + "column": 28 + }, + "end": { + "line": 24, + "column": 35 + } + }, + "object": { + "type": "Identifier", + "start": 745, + "end": 746, + "loc": { + "start": { + "line": 24, + "column": 28 + }, + "end": { + "line": 24, + "column": 29 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 747, + "end": 752, + "loc": { + "start": { + "line": 24, + "column": 30 + }, + "end": { + "line": 24, + "column": 35 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 753, + "end": 759, + "loc": { + "start": { + "line": 24, + "column": 36 + }, + "end": { + "line": 24, + "column": 42 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "BLACK" + "computed": false }, - "name": "BLACK" + "operator": "===", + "right": { + "type": "Identifier", + "start": 764, + "end": 769, + "loc": { + "start": { + "line": 24, + "column": 47 + }, + "end": { + "line": 24, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } } ] @@ -1260,43 +1385,43 @@ }, { "type": "ExpressionStatement", - "start": 791, - "end": 817, + "start": 773, + "end": 799, "loc": { "start": { - "line": 27, + "line": 25, "column": 1 }, "end": { - "line": 27, + "line": 25, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 791, - "end": 816, + "start": 773, + "end": 798, "loc": { "start": { - "line": 27, + "line": 25, "column": 1 }, "end": { - "line": 27, + "line": 25, "column": 26 } }, "callee": { "type": "Identifier", - "start": 791, - "end": 797, + "start": 773, + "end": 779, "loc": { "start": { - "line": 27, + "line": 25, "column": 1 }, "end": { - "line": 27, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -1306,43 +1431,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 798, - "end": 815, + "start": 780, + "end": 797, "loc": { "start": { - "line": 27, + "line": 25, "column": 8 }, "end": { - "line": 27, + "line": 25, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 798, - "end": 806, + "start": 780, + "end": 788, "loc": { "start": { - "line": 27, + "line": 25, "column": 8 }, "end": { - "line": 27, + "line": 25, "column": 16 } }, "object": { "type": "Identifier", - "start": 798, - "end": 799, + "start": 780, + "end": 781, "loc": { "start": { - "line": 27, + "line": 25, "column": 8 }, "end": { - "line": 27, + "line": 25, "column": 9 }, "identifierName": "n" @@ -1351,15 +1476,15 @@ }, "property": { "type": "Identifier", - "start": 800, - "end": 806, + "start": 782, + "end": 788, "loc": { "start": { - "line": 27, + "line": 25, "column": 10 }, "end": { - "line": 27, + "line": 25, "column": 16 }, "identifierName": "parent" @@ -1371,15 +1496,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 811, - "end": 815, + "start": 793, + "end": 797, "loc": { "start": { - "line": 27, + "line": 25, "column": 21 }, "end": { - "line": 27, + "line": 25, "column": 25 } } @@ -1390,43 +1515,43 @@ }, { "type": "ExpressionStatement", - "start": 819, - "end": 851, + "start": 801, + "end": 833, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 819, - "end": 850, + "start": 801, + "end": 832, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 32 } }, "callee": { "type": "Identifier", - "start": 819, - "end": 825, + "start": 801, + "end": 807, "loc": { "start": { - "line": 28, + "line": 26, "column": 1 }, "end": { - "line": 28, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -1436,57 +1561,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 826, - "end": 849, + "start": 808, + "end": 831, "loc": { "start": { - "line": 28, + "line": 26, "column": 8 }, "end": { - "line": 28, + "line": 26, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 826, - "end": 841, + "start": 808, + "end": 823, "loc": { "start": { - "line": 28, + "line": 26, "column": 8 }, "end": { - "line": 28, + "line": 26, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 826, - "end": 834, + "start": 808, + "end": 816, "loc": { "start": { - "line": 28, + "line": 26, "column": 8 }, "end": { - "line": 28, + "line": 26, "column": 16 } }, "object": { "type": "Identifier", - "start": 826, - "end": 827, + "start": 808, + "end": 809, "loc": { "start": { - "line": 28, + "line": 26, "column": 8 }, "end": { - "line": 28, + "line": 26, "column": 9 }, "identifierName": "n" @@ -1495,15 +1620,15 @@ }, "property": { "type": "Identifier", - "start": 828, - "end": 834, + "start": 810, + "end": 816, "loc": { "start": { - "line": 28, + "line": 26, "column": 10 }, "end": { - "line": 28, + "line": 26, "column": 16 }, "identifierName": "parent" @@ -1514,15 +1639,15 @@ }, "property": { "type": "Identifier", - "start": 835, - "end": 841, + "start": 817, + "end": 823, "loc": { "start": { - "line": 28, + "line": 26, "column": 17 }, "end": { - "line": 28, + "line": 26, "column": 23 }, "identifierName": "_color" @@ -1534,15 +1659,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 846, - "end": 849, + "start": 828, + "end": 831, "loc": { "start": { - "line": 28, + "line": 26, "column": 28 }, "end": { - "line": 28, + "line": 26, "column": 31 }, "identifierName": "RED" @@ -1555,44 +1680,44 @@ }, { "type": "VariableDeclaration", - "start": 853, - "end": 878, + "start": 835, + "end": 860, "loc": { "start": { - "line": 29, + "line": 27, "column": 1 }, "end": { - "line": 29, + "line": 27, "column": 26 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 859, - "end": 877, + "start": 841, + "end": 859, "loc": { "start": { - "line": 29, + "line": 27, "column": 7 }, "end": { - "line": 29, + "line": 27, "column": 25 } }, "id": { "type": "Identifier", - "start": 859, - "end": 860, + "start": 841, + "end": 842, "loc": { "start": { - "line": 29, + "line": 27, "column": 7 }, "end": { - "line": 29, + "line": 27, "column": 8 }, "identifierName": "g" @@ -1601,29 +1726,29 @@ }, "init": { "type": "CallExpression", - "start": 863, - "end": 877, + "start": 845, + "end": 859, "loc": { "start": { - "line": 29, + "line": 27, "column": 11 }, "end": { - "line": 29, + "line": 27, "column": 25 } }, "callee": { "type": "Identifier", - "start": 863, - "end": 874, + "start": 845, + "end": 856, "loc": { "start": { - "line": 29, + "line": 27, "column": 11 }, "end": { - "line": 29, + "line": 27, "column": 22 }, "identifierName": "grandparent" @@ -1633,15 +1758,15 @@ "arguments": [ { "type": "Identifier", - "start": 875, - "end": 876, + "start": 857, + "end": 858, "loc": { "start": { - "line": 29, + "line": 27, "column": 23 }, "end": { - "line": 29, + "line": 27, "column": 24 }, "identifierName": "n" @@ -1655,210 +1780,360 @@ "kind": "const", "trailingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 881, - "end": 1343, + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 863, + "end": 911, "loc": { "start": { - "line": 31, + "line": 29, "column": 1 }, "end": { - "line": 43, - "column": 4 + "line": 29, + "column": 49 } } } ] }, { - "type": "IfStatement", - "start": 1346, - "end": 2606, + "type": "ExpressionStatement", + "start": 913, + "end": 937, "loc": { "start": { - "line": 45, + "line": 30, "column": 1 }, "end": { - "line": 87, - "column": 2 + "line": 30, + "column": 25 } }, - "test": { - "type": "LogicalExpression", - "start": 1350, - "end": 1393, + "expression": { + "type": "AssignmentExpression", + "start": 913, + "end": 936, "loc": { "start": { - "line": 45, - "column": 5 + "line": 30, + "column": 1 }, "end": { - "line": 45, - "column": 48 + "line": 30, + "column": 24 } }, + "operator": "=", "left": { - "type": "BinaryExpression", - "start": 1350, - "end": 1370, + "type": "MemberExpression", + "start": 913, + "end": 928, "loc": { "start": { - "line": 45, - "column": 5 + "line": 30, + "column": 1 }, "end": { - "line": 45, - "column": 25 + "line": 30, + "column": 16 } }, - "left": { - "type": "Identifier", - "start": 1350, - "end": 1351, - "loc": { - "start": { - "line": 45, - "column": 5 - }, - "end": { - "line": 45, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "operator": "===", - "right": { + "object": { "type": "MemberExpression", - "start": 1356, - "end": 1370, + "start": 913, + "end": 921, "loc": { "start": { - "line": 45, - "column": 11 + "line": 30, + "column": 1 }, "end": { - "line": 45, - "column": 25 + "line": 30, + "column": 9 } }, "object": { - "type": "MemberExpression", - "start": 1356, - "end": 1364, + "type": "Identifier", + "start": 913, + "end": 914, "loc": { "start": { - "line": 45, - "column": 11 + "line": 30, + "column": 1 }, "end": { - "line": 45, - "column": 19 - } + "line": 30, + "column": 2 + }, + "identifierName": "n" }, - "object": { - "type": "Identifier", - "start": 1356, - "end": 1357, - "loc": { - "start": { - "line": 45, - "column": 11 - }, - "end": { - "line": 45, - "column": 12 - }, - "identifierName": "n" + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 915, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 3 }, - "name": "n" + "end": { + "line": 30, + "column": 9 + }, + "identifierName": "parent" }, - "property": { - "type": "Identifier", - "start": 1358, - "end": 1364, - "loc": { - "start": { - "line": 45, - "column": 13 - }, - "end": { - "line": 45, - "column": 19 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false + "name": "parent" }, - "property": { - "type": "Identifier", - "start": 1365, - "end": 1370, - "loc": { - "start": { - "line": 45, - "column": 20 - }, - "end": { - "line": 45, - "column": 25 - }, - "identifierName": "right" + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 922, + "end": 928, + "loc": { + "start": { + "line": 30, + "column": 10 + }, + "end": { + "line": 30, + "column": 16 }, - "name": "right" + "identifierName": "_color" }, - "computed": false + "name": "_color" }, + "computed": false, "leadingComments": null }, - "operator": "&&", "right": { - "type": "BinaryExpression", - "start": 1374, - "end": 1393, + "type": "Identifier", + "start": 931, + "end": 936, + "loc": { + "start": { + "line": 30, + "column": 19 + }, + "end": { + "line": 30, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 863, + "end": 911, "loc": { "start": { - "line": 45, - "column": 29 + "line": 29, + "column": 1 }, "end": { - "line": 45, - "column": 48 + "line": 29, + "column": 49 } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 939, + "end": 954, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 939, + "end": 953, + "loc": { + "start": { + "line": 31, + "column": 1 }, - "left": { + "end": { + "line": 31, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 939, + "end": 947, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 939, + "end": 940, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 941, + "end": 947, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 950, + "end": 953, + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 15 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "IfStatement", + "start": 957, + "end": 2107, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 67, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 961, + "end": 980, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 961, + "end": 962, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 967, + "end": 980, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "object": { "type": "MemberExpression", - "start": 1374, - "end": 1382, + "start": 967, + "end": 975, "loc": { "start": { - "line": 45, - "column": 29 + "line": 33, + "column": 11 }, "end": { - "line": 45, - "column": 37 + "line": 33, + "column": 19 } }, "object": { "type": "Identifier", - "start": 1374, - "end": 1375, + "start": 967, + "end": 968, "loc": { "start": { - "line": 45, - "column": 29 + "line": 33, + "column": 11 }, "end": { - "line": 45, - "column": 30 + "line": 33, + "column": 12 }, "identifierName": "n" }, @@ -1866,16 +2141,16 @@ }, "property": { "type": "Identifier", - "start": 1376, - "end": 1382, + "start": 969, + "end": 975, "loc": { "start": { - "line": 45, - "column": 31 + "line": 33, + "column": 13 }, "end": { - "line": 45, - "column": 37 + "line": 33, + "column": 19 }, "identifierName": "parent" }, @@ -1883,79 +2158,45 @@ }, "computed": false }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1387, - "end": 1393, + "property": { + "type": "Identifier", + "start": 976, + "end": 980, "loc": { "start": { - "line": 45, - "column": 42 + "line": 33, + "column": 20 }, "end": { - "line": 45, - "column": 48 - } - }, - "object": { - "type": "Identifier", - "start": 1387, - "end": 1388, - "loc": { - "start": { - "line": 45, - "column": 42 - }, - "end": { - "line": 45, - "column": 43 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1389, - "end": 1393, - "loc": { - "start": { - "line": 45, - "column": 44 - }, - "end": { - "line": 45, - "column": 48 - }, - "identifierName": "left" + "line": 33, + "column": 24 }, - "name": "left" + "identifierName": "left" }, - "computed": false - } - }, - "leadingComments": null + "name": "left" + }, + "computed": false + } }, "consequent": { "type": "BlockStatement", - "start": 1395, - "end": 1765, + "start": 982, + "end": 1553, "loc": { "start": { - "line": 45, - "column": 50 + "line": 33, + "column": 26 }, "end": { - "line": 60, + "line": 50, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1399, - "end": 1421, + "start": 1415, + "end": 1446, "loc": { "start": { "line": 46, @@ -1963,13 +2204,13 @@ }, "end": { "line": 46, - "column": 24 + "column": 33 } }, "expression": { "type": "CallExpression", - "start": 1399, - "end": 1420, + "start": 1415, + "end": 1445, "loc": { "start": { "line": 46, @@ -1977,13 +2218,13 @@ }, "end": { "line": 46, - "column": 23 + "column": 32 } }, "callee": { "type": "Identifier", - "start": 1399, - "end": 1410, + "start": 1415, + "end": 1421, "loc": { "start": { "line": 46, @@ -1991,1400 +2232,1495 @@ }, "end": { "line": 46, - "column": 13 + "column": 8 }, - "identifierName": "rotate_left" + "identifierName": "assert" }, - "name": "rotate_left" + "name": "assert", + "leadingComments": null }, "arguments": [ { - "type": "MemberExpression", - "start": 1411, - "end": 1419, + "type": "BinaryExpression", + "start": 1422, + "end": 1444, "loc": { "start": { "line": 46, - "column": 14 + "column": 9 }, "end": { "line": 46, - "column": 22 + "column": 31 } }, - "object": { - "type": "Identifier", - "start": 1411, - "end": 1412, + "left": { + "type": "MemberExpression", + "start": 1422, + "end": 1428, "loc": { "start": { "line": 46, - "column": 14 + "column": 9 }, "end": { "line": 46, "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1422, + "end": 1423, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 10 + }, + "identifierName": "g" }, - "identifierName": "n" + "name": "g" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1424, + "end": 1428, + "loc": { + "start": { + "line": 46, + "column": 11 + }, + "end": { + "line": 46, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 1413, - "end": 1419, + "start": 1440, + "end": 1444, "loc": { "start": { "line": 46, - "column": 16 + "column": 27 }, "end": { "line": 46, - "column": 22 + "column": 31 }, - "identifierName": "parent" + "identifierName": "Node" }, - "name": "parent" - }, - "computed": false + "name": "Node" + } } - ] + ], + "leadingComments": null }, - "trailingComments": [ + "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1425, - "end": 1681, + "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 986, + "end": 1412, "loc": { "start": { - "line": 48, + "line": 34, "column": 2 }, "end": { - "line": 57, + "line": 45, "column": 5 } } - }, - { - "type": "CommentLine", - "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1685, - "end": 1762, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 79 - } - } } ] - } - ], - "directives": [] - }, - "alternate": { - "type": "IfStatement", - "start": 1771, - "end": 2606, - "loc": { - "start": { - "line": 60, - "column": 8 - }, - "end": { - "line": 87, - "column": 2 - } - }, - "test": { - "type": "LogicalExpression", - "start": 1775, - "end": 1818, - "loc": { - "start": { - "line": 60, - "column": 12 - }, - "end": { - "line": 60, - "column": 55 - } - }, - "left": { - "type": "BinaryExpression", - "start": 1775, - "end": 1794, - "loc": { - "start": { - "line": 60, - "column": 12 - }, - "end": { - "line": 60, - "column": 31 - } - }, - "left": { - "type": "Identifier", - "start": 1775, - "end": 1776, - "loc": { - "start": { - "line": 60, - "column": 12 - }, - "end": { - "line": 60, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1781, - "end": 1794, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 31 - } - }, - "object": { - "type": "MemberExpression", - "start": 1781, - "end": 1789, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 1781, - "end": 1782, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 19 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1783, - "end": 1789, - "loc": { - "start": { - "line": 60, - "column": 20 - }, - "end": { - "line": 60, - "column": 26 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1790, - "end": 1794, - "loc": { - "start": { - "line": 60, - "column": 27 - }, - "end": { - "line": 60, - "column": 31 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1798, - "end": 1818, + { + "type": "ExpressionStatement", + "start": 1449, + "end": 1475, "loc": { "start": { - "line": 60, - "column": 35 + "line": 47, + "column": 2 }, "end": { - "line": 60, - "column": 55 + "line": 47, + "column": 28 } }, - "left": { - "type": "MemberExpression", - "start": 1798, - "end": 1806, - "loc": { - "start": { - "line": 60, - "column": 35 - }, - "end": { - "line": 60, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 1798, - "end": 1799, - "loc": { - "start": { - "line": 60, - "column": 35 - }, - "end": { - "line": 60, - "column": 36 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1800, - "end": 1806, - "loc": { - "start": { - "line": 60, - "column": 37 - }, - "end": { - "line": 60, - "column": 43 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1811, - "end": 1818, + "expression": { + "type": "CallExpression", + "start": 1449, + "end": 1474, "loc": { "start": { - "line": 60, - "column": 48 + "line": 47, + "column": 2 }, "end": { - "line": 60, - "column": 55 + "line": 47, + "column": 27 } }, - "object": { - "type": "Identifier", - "start": 1811, - "end": 1812, - "loc": { - "start": { - "line": 60, - "column": 48 - }, - "end": { - "line": 60, - "column": 49 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { + "callee": { "type": "Identifier", - "start": 1813, - "end": 1818, + "start": 1449, + "end": 1455, "loc": { "start": { - "line": 60, - "column": 50 + "line": 47, + "column": 2 }, "end": { - "line": 60, - "column": 55 + "line": 47, + "column": 8 }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } - } - }, - "consequent": { - "type": "BlockStatement", - "start": 1820, - "end": 2606, - "loc": { - "start": { - "line": 60, - "column": 57 - }, - "end": { - "line": 87, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 2328, - "end": 2351, - "loc": { - "start": { - "line": 74, - "column": 2 + "identifierName": "assert" }, - "end": { - "line": 74, - "column": 25 - } + "name": "assert" }, - "expression": { - "type": "CallExpression", - "start": 2328, - "end": 2350, - "loc": { - "start": { - "line": 74, - "column": 2 - }, - "end": { - "line": 74, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 2328, - "end": 2340, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1456, + "end": 1473, "loc": { "start": { - "line": 74, - "column": 2 + "line": 47, + "column": 9 }, "end": { - "line": 74, - "column": 14 + "line": 47, + "column": 26 + } + }, + "left": { + "type": "Identifier", + "start": 1456, + "end": 1457, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 10 + }, + "identifierName": "n" }, - "identifierName": "rotate_right" + "name": "n" }, - "name": "rotate_right", - "leadingComments": null - }, - "arguments": [ - { + "operator": "===", + "right": { "type": "MemberExpression", - "start": 2341, - "end": 2349, + "start": 1462, + "end": 1473, "loc": { "start": { - "line": 74, + "line": 47, "column": 15 }, "end": { - "line": 74, - "column": 23 + "line": 47, + "column": 26 } }, "object": { - "type": "Identifier", - "start": 2341, - "end": 2342, + "type": "MemberExpression", + "start": 1462, + "end": 1468, "loc": { "start": { - "line": 74, + "line": 47, "column": 15 }, "end": { - "line": 74, - "column": 16 + "line": 47, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 1462, + "end": 1463, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "g" }, - "identifierName": "n" + "name": "g" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 1464, + "end": 1468, + "loc": { + "start": { + "line": 47, + "column": 17 + }, + "end": { + "line": 47, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 2343, - "end": 2349, + "start": 1469, + "end": 1473, "loc": { "start": { - "line": 74, - "column": 17 + "line": 47, + "column": 22 }, "end": { - "line": 74, - "column": 23 + "line": 47, + "column": 26 }, - "identifierName": "parent" + "identifierName": "left" }, - "name": "parent" + "name": "left" }, "computed": false } - ], - "leadingComments": null - }, - "leadingComments": [ + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1478, + "end": 1531, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 55 + } + }, + "expression": { + "type": "CallExpression", + "start": 1478, + "end": 1530, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 54 + } + }, + "callee": { + "type": "Identifier", + "start": 1478, + "end": 1484, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1824, - "end": 2325, + "type": "LogicalExpression", + "start": 1485, + "end": 1529, "loc": { "start": { - "line": 61, - "column": 2 + "line": 48, + "column": 9 }, "end": { - "line": 73, - "column": 5 + "line": 48, + "column": 53 } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 2355, - "end": 2583, - "loc": { - "start": { - "line": 76, - "column": 2 + }, + "left": { + "type": "BinaryExpression", + "start": 1485, + "end": 1501, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 25 + } }, - "end": { - "line": 84, - "column": 5 + "left": { + "type": "MemberExpression", + "start": 1485, + "end": 1492, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1485, + "end": 1486, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1487, + "end": 1492, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 1497, + "end": 1501, + "loc": { + "start": { + "line": 48, + "column": 21 + }, + "end": { + "line": 48, + "column": 25 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 1505, + "end": 1529, + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 53 + } + }, + "left": { + "type": "MemberExpression", + "start": 1505, + "end": 1519, + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 43 + } + }, + "object": { + "type": "MemberExpression", + "start": 1505, + "end": 1512, + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 36 + } + }, + "object": { + "type": "Identifier", + "start": 1505, + "end": 1506, + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 30 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1507, + "end": 1512, + "loc": { + "start": { + "line": 48, + "column": 31 + }, + "end": { + "line": 48, + "column": 36 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1513, + "end": 1519, + "loc": { + "start": { + "line": 48, + "column": 37 + }, + "end": { + "line": 48, + "column": 43 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1524, + "end": 1529, + "loc": { + "start": { + "line": 48, + "column": 48 + }, + "end": { + "line": 48, + "column": 53 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1534, + "end": 1550, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1534, + "end": 1549, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1534, + "end": 1546, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 14 + }, + "identifierName": "rotate_right" }, + "name": "rotate_right" + }, + "arguments": [ { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2587, - "end": 2603, + "type": "Identifier", + "start": 1547, + "end": 1548, "loc": { "start": { - "line": 86, - "column": 2 + "line": 49, + "column": 15 }, "end": { - "line": 86, - "column": 18 - } - } + "line": 49, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" } ] } - ], - "directives": [] - }, - "alternate": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 881, - "end": 1343, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 43, - "column": 4 - } } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 2609, - "end": 2625, - "loc": { - "start": { - "line": 89, - "column": 1 - }, - "end": { - "line": 89, - "column": 17 - } + ], + "directives": [] }, - "expression": { - "type": "CallExpression", - "start": 2609, - "end": 2624, + "alternate": { + "type": "BlockStatement", + "start": 1559, + "end": 2107, "loc": { "start": { - "line": 89, - "column": 1 + "line": 50, + "column": 8 }, "end": { - "line": 89, - "column": 16 + "line": 67, + "column": 2 } }, - "callee": { - "type": "Identifier", - "start": 2609, - "end": 2621, - "loc": { - "start": { - "line": 89, - "column": 1 - }, - "end": { - "line": 89, - "column": 13 - }, - "identifierName": "insert_case5" - }, - "name": "insert_case5" - }, - "arguments": [ + "body": [ { - "type": "Identifier", - "start": 2622, - "end": 2623, + "type": "ExpressionStatement", + "start": 1969, + "end": 2001, "loc": { "start": { - "line": 89, - "column": 14 + "line": 63, + "column": 2 }, "end": { - "line": 89, - "column": 15 - }, - "identifierName": "n" + "line": 63, + "column": 34 + } }, - "name": "n" - } - ] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [], - "name": "_", - "trailingComments": [] - }, - { - "type": "Identifier", - "start": 2630, - "end": 2658, - "loc": { - "start": { - "line": 92, - "column": 0 - }, - "end": { - "line": 92, - "column": 28 - } - }, - "declaration": { - "type": "Identifier", - "start": 2645, - "end": 2657, - "loc": { - "start": { - "line": 92, - "column": 15 - }, - "end": { - "line": 92, - "column": 27 - }, - "identifierName": "insert_case4" - }, - "name": "insert_case4" - }, - "name": "_", - "leadingComments": [], - "trailingComments": [] - }, - { - "type": "ExportDefaultDeclaration", - "start": 2630, - "end": 2658, - "loc": { - "start": { - "line": 92, - "column": 0 - }, - "end": { - "line": 92, - "column": 28 - } - }, - "declaration": { - "type": "VariableDeclaration", - "start": 636, - "end": 2628, - "loc": { - "start": { - "line": 22, - "column": 0 - }, - "end": { - "line": 90, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 642, - "end": 2627, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 90, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 642, - "end": 654, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 18 - }, - "identifierName": "insert_case4" - }, - "name": "insert_case4", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 657, - "end": 2627, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 90, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 642, - "end": 654, - "loc": { - "start": { - "line": 22, - "column": 6 - }, - "end": { - "line": 22, - "column": 18 - }, - "identifierName": "insert_case4" - }, - "name": "insert_case4", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 658, - "end": 659, - "loc": { - "start": { - "line": 22, - "column": 22 - }, - "end": { - "line": 22, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 664, - "end": 2627, - "loc": { - "start": { - "line": 22, - "column": 28 - }, - "end": { - "line": 90, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 667, - "end": 693, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 667, - "end": 692, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 667, - "end": 673, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 674, - "end": 691, + "expression": { + "type": "CallExpression", + "start": 1969, + "end": 2000, "loc": { "start": { - "line": 23, - "column": 8 + "line": 63, + "column": 2 }, "end": { - "line": 23, - "column": 25 + "line": 63, + "column": 33 } }, - "left": { + "callee": { "type": "Identifier", - "start": 674, - "end": 675, + "start": 1969, + "end": 1975, "loc": { "start": { - "line": 23, - "column": 8 + "line": 63, + "column": 2 }, "end": { - "line": 23, - "column": 9 + "line": 63, + "column": 8 }, - "identifierName": "n" + "identifierName": "assert" }, - "name": "n" + "name": "assert", + "leadingComments": null }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 687, - "end": 691, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1976, + "end": 1999, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 1976, + "end": 1983, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1976, + "end": 1977, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1978, + "end": 1983, + "loc": { + "start": { + "line": 63, + "column": 11 + }, + "end": { + "line": 63, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1995, + "end": 1999, + "loc": { + "start": { + "line": 63, + "column": 28 + }, + "end": { + "line": 63, + "column": 32 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 1563, + "end": 1966, "loc": { "start": { - "line": 23, - "column": 21 + "line": 51, + "column": 2 }, "end": { - "line": 23, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" + "line": 62, + "column": 5 + } + } } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 695, - "end": 720, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 26 - } - }, - "expression": { - "type": "CallExpression", - "start": 695, - "end": 719, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 25 - } + ] }, - "callee": { - "type": "Identifier", - "start": 695, - "end": 701, + { + "type": "ExpressionStatement", + "start": 2004, + "end": 2032, "loc": { "start": { - "line": 24, - "column": 1 + "line": 64, + "column": 2 }, "end": { - "line": 24, - "column": 7 - }, - "identifierName": "assert" + "line": 64, + "column": 30 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 702, - "end": 718, + "expression": { + "type": "CallExpression", + "start": 2004, + "end": 2031, "loc": { "start": { - "line": 24, - "column": 8 + "line": 64, + "column": 2 }, "end": { - "line": 24, - "column": 24 + "line": 64, + "column": 29 } }, - "left": { - "type": "MemberExpression", - "start": 702, - "end": 710, + "callee": { + "type": "Identifier", + "start": 2004, + "end": 2010, "loc": { "start": { - "line": 24, - "column": 8 + "line": 64, + "column": 2 }, "end": { - "line": 24, - "column": 16 - } + "line": 64, + "column": 8 + }, + "identifierName": "assert" }, - "object": { - "type": "Identifier", - "start": 702, - "end": 703, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 2011, + "end": 2030, "loc": { "start": { - "line": 24, - "column": 8 + "line": 64, + "column": 9 }, "end": { - "line": 24, - "column": 9 + "line": 64, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 2011, + "end": 2012, + "loc": { + "start": { + "line": 64, + "column": 9 + }, + "end": { + "line": 64, + "column": 10 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 704, - "end": 710, - "loc": { - "start": { - "line": 24, - "column": 10 + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 2017, + "end": 2030, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 28 + } }, - "end": { - "line": 24, - "column": 16 + "object": { + "type": "MemberExpression", + "start": 2017, + "end": 2024, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 2017, + "end": 2018, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 2019, + "end": 2024, + "loc": { + "start": { + "line": 64, + "column": 17 + }, + "end": { + "line": 64, + "column": 22 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 715, - "end": 718, - "loc": { - "start": { - "line": 24, - "column": 21 - }, - "end": { - "line": 24, - "column": 24 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 722, - "end": 754, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 722, - "end": 753, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 32 + "property": { + "type": "Identifier", + "start": 2025, + "end": 2030, + "loc": { + "start": { + "line": 64, + "column": 23 + }, + "end": { + "line": 64, + "column": 28 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ] } }, - "callee": { - "type": "Identifier", - "start": 722, - "end": 728, + { + "type": "ExpressionStatement", + "start": 2035, + "end": 2086, "loc": { "start": { - "line": 25, - "column": 1 + "line": 65, + "column": 2 }, "end": { - "line": 25, - "column": 7 - }, - "identifierName": "assert" + "line": 65, + "column": 53 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 729, - "end": 752, + "expression": { + "type": "CallExpression", + "start": 2035, + "end": 2085, "loc": { "start": { - "line": 25, - "column": 8 + "line": 65, + "column": 2 }, "end": { - "line": 25, - "column": 31 + "line": 65, + "column": 52 } }, - "left": { - "type": "MemberExpression", - "start": 729, - "end": 742, + "callee": { + "type": "Identifier", + "start": 2035, + "end": 2041, "loc": { "start": { - "line": 25, - "column": 8 + "line": 65, + "column": 2 }, "end": { - "line": 25, - "column": 21 - } + "line": 65, + "column": 8 + }, + "identifierName": "assert" }, - "object": { - "type": "MemberExpression", - "start": 729, - "end": 735, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 2042, + "end": 2084, "loc": { "start": { - "line": 25, - "column": 8 + "line": 65, + "column": 9 }, "end": { - "line": 25, - "column": 14 + "line": 65, + "column": 51 } }, - "object": { - "type": "Identifier", - "start": 729, - "end": 730, + "left": { + "type": "BinaryExpression", + "start": 2042, + "end": 2057, "loc": { "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, + "line": 65, "column": 9 }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 731, - "end": 735, - "loc": { - "start": { - "line": 25, - "column": 10 - }, "end": { - "line": 25, - "column": 14 + "line": 65, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 2042, + "end": 2048, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 15 + } }, - "identifierName": "left" + "object": { + "type": "Identifier", + "start": 2042, + "end": 2043, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 2044, + "end": 2048, + "loc": { + "start": { + "line": 65, + "column": 11 + }, + "end": { + "line": 65, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "name": "left" + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 2053, + "end": 2057, + "loc": { + "start": { + "line": 65, + "column": 20 + }, + "end": { + "line": 65, + "column": 24 + } + } + } }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 736, - "end": 742, - "loc": { - "start": { - "line": 25, - "column": 15 + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 2061, + "end": 2084, + "loc": { + "start": { + "line": 65, + "column": 28 + }, + "end": { + "line": 65, + "column": 51 + } }, - "end": { - "line": 25, - "column": 21 + "left": { + "type": "MemberExpression", + "start": 2061, + "end": 2074, + "loc": { + "start": { + "line": 65, + "column": 28 + }, + "end": { + "line": 65, + "column": 41 + } + }, + "object": { + "type": "MemberExpression", + "start": 2061, + "end": 2067, + "loc": { + "start": { + "line": 65, + "column": 28 + }, + "end": { + "line": 65, + "column": 34 + } + }, + "object": { + "type": "Identifier", + "start": 2061, + "end": 2062, + "loc": { + "start": { + "line": 65, + "column": 28 + }, + "end": { + "line": 65, + "column": 29 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 2063, + "end": 2067, + "loc": { + "start": { + "line": 65, + "column": 30 + }, + "end": { + "line": 65, + "column": 34 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 2068, + "end": 2074, + "loc": { + "start": { + "line": 65, + "column": 35 + }, + "end": { + "line": 65, + "column": 41 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 747, - "end": 752, - "loc": { - "start": { - "line": 25, - "column": 26 - }, - "end": { - "line": 25, - "column": 31 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 756, - "end": 789, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 756, - "end": 788, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 33 + "operator": "===", + "right": { + "type": "Identifier", + "start": 2079, + "end": 2084, + "loc": { + "start": { + "line": 65, + "column": 46 + }, + "end": { + "line": 65, + "column": 51 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ] } }, - "callee": { - "type": "Identifier", - "start": 756, - "end": 762, + { + "type": "ExpressionStatement", + "start": 2089, + "end": 2104, "loc": { "start": { - "line": 26, - "column": 1 + "line": 66, + "column": 2 }, "end": { - "line": 26, - "column": 7 - }, - "identifierName": "assert" + "line": 66, + "column": 17 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 763, - "end": 787, + "expression": { + "type": "CallExpression", + "start": 2089, + "end": 2103, "loc": { "start": { - "line": 26, - "column": 8 + "line": 66, + "column": 2 }, "end": { - "line": 26, - "column": 32 + "line": 66, + "column": 16 } }, - "left": { - "type": "MemberExpression", - "start": 763, - "end": 777, + "callee": { + "type": "Identifier", + "start": 2089, + "end": 2100, "loc": { "start": { - "line": 26, - "column": 8 + "line": 66, + "column": 2 }, "end": { - "line": 26, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 763, - "end": 770, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 763, - "end": 764, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 765, - "end": 770, - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 15 - }, - "identifierName": "right" - }, - "name": "right" + "line": 66, + "column": 13 }, - "computed": false + "identifierName": "rotate_left" }, - "property": { + "name": "rotate_left" + }, + "arguments": [ + { "type": "Identifier", - "start": 771, - "end": 777, + "start": 2101, + "end": 2102, "loc": { "start": { - "line": 26, - "column": 16 + "line": 66, + "column": 14 }, "end": { - "line": 26, - "column": 22 + "line": 66, + "column": 15 }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 782, - "end": 787, - "loc": { - "start": { - "line": 26, - "column": 27 - }, - "end": { - "line": 26, - "column": 32 + "identifierName": "g" }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } + "name": "g" + } + ] } - ] - } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 2112, + "end": 2140, + "loc": { + "start": { + "line": 70, + "column": 0 + }, + "end": { + "line": 70, + "column": 28 + } + }, + "declaration": { + "type": "Identifier", + "start": 2127, + "end": 2139, + "loc": { + "start": { + "line": 70, + "column": 15 + }, + "end": { + "line": 70, + "column": 27 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 2112, + "end": 2140, + "loc": { + "start": { + "line": 70, + "column": 0 + }, + "end": { + "line": 70, + "column": 28 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 579, + "end": 2110, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 68, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 585, + "end": 2109, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 68, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 585, + "end": 597, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 18 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 600, + "end": 2109, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 68, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 585, + "end": 597, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 18 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 601, + "end": 602, + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "body": { + "type": "BlockStatement", + "start": 607, + "end": 2109, + "loc": { + "start": { + "line": 20, + "column": 28 }, + "end": { + "line": 68, + "column": 1 + } + }, + "body": [ { "type": "ExpressionStatement", - "start": 791, - "end": 817, + "start": 610, + "end": 636, "loc": { "start": { - "line": 27, + "line": 21, "column": 1 }, "end": { - "line": 27, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 791, - "end": 816, + "start": 610, + "end": 635, "loc": { "start": { - "line": 27, + "line": 21, "column": 1 }, "end": { - "line": 27, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 791, - "end": 797, + "start": 610, + "end": 616, "loc": { "start": { - "line": 27, + "line": 21, "column": 1 }, "end": { - "line": 27, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -3394,83 +3730,52 @@ "arguments": [ { "type": "BinaryExpression", - "start": 798, - "end": 815, + "start": 617, + "end": 634, "loc": { "start": { - "line": 27, + "line": 21, "column": 8 }, "end": { - "line": 27, + "line": 21, "column": 25 } }, "left": { - "type": "MemberExpression", - "start": 798, - "end": 806, + "type": "Identifier", + "start": 617, + "end": 618, "loc": { "start": { - "line": 27, + "line": 21, "column": 8 }, "end": { - "line": 27, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 798, - "end": 799, - "loc": { - "start": { - "line": 27, - "column": 8 - }, - "end": { - "line": 27, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 800, - "end": 806, - "loc": { - "start": { - "line": 27, - "column": 10 - }, - "end": { - "line": 27, - "column": 16 - }, - "identifierName": "parent" + "line": 21, + "column": 9 }, - "name": "parent" + "identifierName": "n" }, - "computed": false + "name": "n" }, - "operator": "!==", + "operator": "instanceof", "right": { - "type": "NullLiteral", - "start": 811, - "end": 815, + "type": "Identifier", + "start": 630, + "end": 634, "loc": { "start": { - "line": 27, + "line": 21, "column": 21 }, "end": { - "line": 27, + "line": 21, "column": 25 - } - } + }, + "identifierName": "Node" + }, + "name": "Node" } } ] @@ -3478,43 +3783,43 @@ }, { "type": "ExpressionStatement", - "start": 819, - "end": 851, + "start": 638, + "end": 663, "loc": { "start": { - "line": 28, + "line": 22, "column": 1 }, "end": { - "line": 28, - "column": 33 + "line": 22, + "column": 26 } }, "expression": { "type": "CallExpression", - "start": 819, - "end": 850, + "start": 638, + "end": 662, "loc": { "start": { - "line": 28, + "line": 22, "column": 1 }, "end": { - "line": 28, - "column": 32 + "line": 22, + "column": 25 } }, "callee": { "type": "Identifier", - "start": 819, - "end": 825, + "start": 638, + "end": 644, "loc": { "start": { - "line": 28, + "line": 22, "column": 1 }, "end": { - "line": 28, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -3524,94 +3829,61 @@ "arguments": [ { "type": "BinaryExpression", - "start": 826, - "end": 849, + "start": 645, + "end": 661, "loc": { "start": { - "line": 28, + "line": 22, "column": 8 }, "end": { - "line": 28, - "column": 31 + "line": 22, + "column": 24 } }, "left": { "type": "MemberExpression", - "start": 826, - "end": 841, + "start": 645, + "end": 653, "loc": { "start": { - "line": 28, + "line": 22, "column": 8 }, "end": { - "line": 28, - "column": 23 + "line": 22, + "column": 16 } }, "object": { - "type": "MemberExpression", - "start": 826, - "end": 834, + "type": "Identifier", + "start": 645, + "end": 646, "loc": { "start": { - "line": 28, + "line": 22, "column": 8 }, "end": { - "line": 28, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 826, - "end": 827, - "loc": { - "start": { - "line": 28, - "column": 8 - }, - "end": { - "line": 28, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 828, - "end": 834, - "loc": { - "start": { - "line": 28, - "column": 10 - }, - "end": { - "line": 28, - "column": 16 - }, - "identifierName": "parent" + "line": 22, + "column": 9 }, - "name": "parent" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 835, - "end": 841, + "start": 647, + "end": 653, "loc": { "start": { - "line": 28, - "column": 17 + "line": 22, + "column": 10 }, "end": { - "line": 28, - "column": 23 + "line": 22, + "column": 16 }, "identifierName": "_color" }, @@ -3622,16 +3894,16 @@ "operator": "===", "right": { "type": "Identifier", - "start": 846, - "end": 849, + "start": 658, + "end": 661, "loc": { "start": { - "line": 28, - "column": 28 + "line": 22, + "column": 21 }, "end": { - "line": 28, - "column": 31 + "line": 22, + "column": 24 }, "identifierName": "RED" }, @@ -3642,476 +3914,463 @@ } }, { - "type": "VariableDeclaration", - "start": 853, - "end": 878, + "type": "ExpressionStatement", + "start": 665, + "end": 716, "loc": { "start": { - "line": 29, + "line": 23, "column": 1 }, "end": { - "line": 29, - "column": 26 + "line": 23, + "column": 52 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 859, - "end": 877, + "expression": { + "type": "CallExpression", + "start": 665, + "end": 715, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 23, + "column": 51 + } + }, + "callee": { + "type": "Identifier", + "start": 665, + "end": 671, "loc": { "start": { - "line": 29, - "column": 7 + "line": 23, + "column": 1 }, "end": { - "line": 29, - "column": 25 - } - }, - "id": { - "type": "Identifier", - "start": 859, - "end": 860, - "loc": { - "start": { - "line": 29, - "column": 7 - }, - "end": { - "line": 29, - "column": 8 - }, - "identifierName": "g" + "line": 23, + "column": 7 }, - "name": "g" + "identifierName": "assert" }, - "init": { - "type": "CallExpression", - "start": 863, - "end": 877, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 672, + "end": 714, "loc": { "start": { - "line": 29, - "column": 11 + "line": 23, + "column": 8 }, "end": { - "line": 29, - "column": 25 + "line": 23, + "column": 50 } }, - "callee": { - "type": "Identifier", - "start": 863, - "end": 874, + "left": { + "type": "BinaryExpression", + "start": 672, + "end": 687, "loc": { "start": { - "line": 29, - "column": 11 + "line": 23, + "column": 8 }, "end": { - "line": 29, - "column": 22 + "line": 23, + "column": 23 + } + }, + "left": { + "type": "MemberExpression", + "start": 672, + "end": 678, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 14 + } }, - "identifierName": "grandparent" + "object": { + "type": "Identifier", + "start": 672, + "end": 673, + "loc": { + "start": { + "line": 23, + "column": 8 + }, + "end": { + "line": 23, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 674, + "end": 678, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 14 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "name": "grandparent" + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 683, + "end": 687, + "loc": { + "start": { + "line": 23, + "column": 19 + }, + "end": { + "line": 23, + "column": 23 + } + } + } }, - "arguments": [ - { + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 691, + "end": 714, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 50 + } + }, + "left": { + "type": "MemberExpression", + "start": 691, + "end": 704, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 40 + } + }, + "object": { + "type": "MemberExpression", + "start": 691, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 33 + } + }, + "object": { + "type": "Identifier", + "start": 691, + "end": 692, + "loc": { + "start": { + "line": 23, + "column": 27 + }, + "end": { + "line": 23, + "column": 28 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 693, + "end": 697, + "loc": { + "start": { + "line": 23, + "column": 29 + }, + "end": { + "line": 23, + "column": 33 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 698, + "end": 704, + "loc": { + "start": { + "line": 23, + "column": 34 + }, + "end": { + "line": 23, + "column": 40 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { "type": "Identifier", - "start": 875, - "end": 876, + "start": 709, + "end": 714, "loc": { "start": { - "line": 29, - "column": 23 + "line": 23, + "column": 45 }, "end": { - "line": 29, - "column": 24 + "line": 23, + "column": 50 }, - "identifierName": "n" + "identifierName": "BLACK" }, - "name": "n" + "name": "BLACK" } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 881, - "end": 1343, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 43, - "column": 4 } } - } - ] + ] + } }, { - "type": "IfStatement", - "start": 1346, - "end": 2606, + "type": "ExpressionStatement", + "start": 718, + "end": 771, "loc": { "start": { - "line": 45, + "line": 24, "column": 1 }, "end": { - "line": 87, - "column": 2 + "line": 24, + "column": 54 } }, - "test": { - "type": "LogicalExpression", - "start": 1350, - "end": 1393, + "expression": { + "type": "CallExpression", + "start": 718, + "end": 770, "loc": { "start": { - "line": 45, - "column": 5 + "line": 24, + "column": 1 }, "end": { - "line": 45, - "column": 48 + "line": 24, + "column": 53 } }, - "left": { - "type": "BinaryExpression", - "start": 1350, - "end": 1370, + "callee": { + "type": "Identifier", + "start": 718, + "end": 724, "loc": { "start": { - "line": 45, - "column": 5 + "line": 24, + "column": 1 }, "end": { - "line": 45, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 1350, - "end": 1351, - "loc": { - "start": { - "line": 45, - "column": 5 - }, - "end": { - "line": 45, - "column": 6 - }, - "identifierName": "n" + "line": 24, + "column": 7 }, - "name": "n", - "leadingComments": null + "identifierName": "assert" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1356, - "end": 1370, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 725, + "end": 769, "loc": { "start": { - "line": 45, - "column": 11 + "line": 24, + "column": 8 }, "end": { - "line": 45, - "column": 25 + "line": 24, + "column": 52 } }, - "object": { - "type": "MemberExpression", - "start": 1356, - "end": 1364, + "left": { + "type": "BinaryExpression", + "start": 725, + "end": 741, "loc": { "start": { - "line": 45, - "column": 11 + "line": 24, + "column": 8 }, "end": { - "line": 45, - "column": 19 + "line": 24, + "column": 24 } }, - "object": { - "type": "Identifier", - "start": 1356, - "end": 1357, + "left": { + "type": "MemberExpression", + "start": 725, + "end": 732, "loc": { "start": { - "line": 45, - "column": 11 + "line": 24, + "column": 8 }, "end": { - "line": 45, - "column": 12 - }, - "identifierName": "n" + "line": 24, + "column": 15 + } }, - "name": "n" + "object": { + "type": "Identifier", + "start": 725, + "end": 726, + "loc": { + "start": { + "line": 24, + "column": 8 + }, + "end": { + "line": 24, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 727, + "end": 732, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "property": { - "type": "Identifier", - "start": 1358, - "end": 1364, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 737, + "end": 741, "loc": { "start": { - "line": 45, - "column": 13 + "line": 24, + "column": 20 }, "end": { - "line": 45, - "column": 19 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1365, - "end": 1370, - "loc": { - "start": { - "line": 45, - "column": 20 - }, - "end": { - "line": 45, - "column": 25 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "leadingComments": null - }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1374, - "end": 1393, - "loc": { - "start": { - "line": 45, - "column": 29 - }, - "end": { - "line": 45, - "column": 48 - } - }, - "left": { - "type": "MemberExpression", - "start": 1374, - "end": 1382, - "loc": { - "start": { - "line": 45, - "column": 29 - }, - "end": { - "line": 45, - "column": 37 - } - }, - "object": { - "type": "Identifier", - "start": 1374, - "end": 1375, - "loc": { - "start": { - "line": 45, - "column": 29 - }, - "end": { - "line": 45, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1376, - "end": 1382, - "loc": { - "start": { - "line": 45, - "column": 31 - }, - "end": { - "line": 45, - "column": 37 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1387, - "end": 1393, - "loc": { - "start": { - "line": 45, - "column": 42 - }, - "end": { - "line": 45, - "column": 48 - } - }, - "object": { - "type": "Identifier", - "start": 1387, - "end": 1388, - "loc": { - "start": { - "line": 45, - "column": 42 - }, - "end": { - "line": 45, - "column": 43 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1389, - "end": 1393, - "loc": { - "start": { - "line": 45, - "column": 44 - }, - "end": { - "line": 45, - "column": 48 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - }, - "leadingComments": null - }, - "consequent": { - "type": "BlockStatement", - "start": 1395, - "end": 1765, - "loc": { - "start": { - "line": 45, - "column": 50 - }, - "end": { - "line": 60, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1399, - "end": 1421, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 24 + "line": 24, + "column": 24 + } + } } }, - "expression": { - "type": "CallExpression", - "start": 1399, - "end": 1420, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 745, + "end": 769, "loc": { "start": { - "line": 46, - "column": 2 + "line": 24, + "column": 28 }, "end": { - "line": 46, - "column": 23 + "line": 24, + "column": 52 } }, - "callee": { - "type": "Identifier", - "start": 1399, - "end": 1410, + "left": { + "type": "MemberExpression", + "start": 745, + "end": 759, "loc": { "start": { - "line": 46, - "column": 2 + "line": 24, + "column": 28 }, "end": { - "line": 46, - "column": 13 - }, - "identifierName": "rotate_left" + "line": 24, + "column": 42 + } }, - "name": "rotate_left" - }, - "arguments": [ - { + "object": { "type": "MemberExpression", - "start": 1411, - "end": 1419, + "start": 745, + "end": 752, "loc": { "start": { - "line": 46, - "column": 14 + "line": 24, + "column": 28 }, "end": { - "line": 46, - "column": 22 + "line": 24, + "column": 35 } }, "object": { "type": "Identifier", - "start": 1411, - "end": 1412, + "start": 745, + "end": 746, "loc": { "start": { - "line": 46, - "column": 14 + "line": 24, + "column": 28 }, "end": { - "line": 46, - "column": 15 + "line": 24, + "column": 29 }, "identifierName": "n" }, @@ -4119,512 +4378,474 @@ }, "property": { "type": "Identifier", - "start": 1413, - "end": 1419, + "start": 747, + "end": 752, "loc": { "start": { - "line": 46, - "column": 16 + "line": 24, + "column": 30 }, "end": { - "line": 46, - "column": 22 + "line": 24, + "column": 35 }, - "identifierName": "parent" + "identifierName": "right" }, - "name": "parent" + "name": "right" }, "computed": false - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1425, - "end": 1681, - "loc": { - "start": { - "line": 48, - "column": 2 + }, + "property": { + "type": "Identifier", + "start": 753, + "end": 759, + "loc": { + "start": { + "line": 24, + "column": 36 + }, + "end": { + "line": 24, + "column": 42 + }, + "identifierName": "_color" }, - "end": { - "line": 57, - "column": 5 - } - } + "name": "_color" + }, + "computed": false }, - { - "type": "CommentLine", - "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1685, - "end": 1762, + "operator": "===", + "right": { + "type": "Identifier", + "start": 764, + "end": 769, "loc": { "start": { - "line": 59, - "column": 2 + "line": 24, + "column": 47 }, "end": { - "line": 59, - "column": 79 - } - } + "line": 24, + "column": 52 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } - ] - } - ], - "directives": [] - }, - "alternate": { - "type": "IfStatement", - "start": 1771, - "end": 2606, - "loc": { - "start": { - "line": 60, - "column": 8 - }, - "end": { - "line": 87, - "column": 2 + } } - }, - "test": { - "type": "LogicalExpression", - "start": 1775, - "end": 1818, - "loc": { + ] + } + }, + { + "type": "ExpressionStatement", + "start": 773, + "end": 799, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 773, + "end": 798, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 773, + "end": 779, + "loc": { "start": { - "line": 60, - "column": 12 + "line": 25, + "column": 1 }, "end": { - "line": 60, - "column": 55 - } + "line": 25, + "column": 7 + }, + "identifierName": "assert" }, - "left": { + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 1775, - "end": 1794, + "start": 780, + "end": 797, "loc": { "start": { - "line": 60, - "column": 12 + "line": 25, + "column": 8 }, "end": { - "line": 60, - "column": 31 + "line": 25, + "column": 25 } }, "left": { - "type": "Identifier", - "start": 1775, - "end": 1776, - "loc": { - "start": { - "line": 60, - "column": 12 - }, - "end": { - "line": 60, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { "type": "MemberExpression", - "start": 1781, - "end": 1794, + "start": 780, + "end": 788, "loc": { "start": { - "line": 60, - "column": 18 + "line": 25, + "column": 8 }, "end": { - "line": 60, - "column": 31 + "line": 25, + "column": 16 } }, "object": { - "type": "MemberExpression", - "start": 1781, - "end": 1789, + "type": "Identifier", + "start": 780, + "end": 781, "loc": { "start": { - "line": 60, - "column": 18 + "line": 25, + "column": 8 }, "end": { - "line": 60, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 1781, - "end": 1782, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 19 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1783, - "end": 1789, - "loc": { - "start": { - "line": 60, - "column": 20 - }, - "end": { - "line": 60, - "column": 26 - }, - "identifierName": "parent" + "line": 25, + "column": 9 }, - "name": "parent" + "identifierName": "n" }, - "computed": false + "name": "n" }, "property": { "type": "Identifier", - "start": 1790, - "end": 1794, + "start": 782, + "end": 788, "loc": { "start": { - "line": 60, - "column": 27 + "line": 25, + "column": 10 }, "end": { - "line": 60, - "column": 31 + "line": 25, + "column": 16 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 793, + "end": 797, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 801, + "end": 833, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 801, + "end": 832, + "loc": { + "start": { + "line": 26, + "column": 1 }, - "operator": "&&", - "right": { + "end": { + "line": 26, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 801, + "end": 807, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { "type": "BinaryExpression", - "start": 1798, - "end": 1818, + "start": 808, + "end": 831, "loc": { "start": { - "line": 60, - "column": 35 + "line": 26, + "column": 8 }, "end": { - "line": 60, - "column": 55 + "line": 26, + "column": 31 } }, "left": { "type": "MemberExpression", - "start": 1798, - "end": 1806, + "start": 808, + "end": 823, "loc": { "start": { - "line": 60, - "column": 35 + "line": 26, + "column": 8 }, "end": { - "line": 60, - "column": 43 + "line": 26, + "column": 23 } }, "object": { - "type": "Identifier", - "start": 1798, - "end": 1799, + "type": "MemberExpression", + "start": 808, + "end": 816, "loc": { "start": { - "line": 60, - "column": 35 + "line": 26, + "column": 8 }, "end": { - "line": 60, - "column": 36 + "line": 26, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 808, + "end": 809, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n" }, - "name": "n" + "property": { + "type": "Identifier", + "start": 810, + "end": 816, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 1800, - "end": 1806, + "start": 817, + "end": 823, "loc": { "start": { - "line": 60, - "column": 37 + "line": 26, + "column": 17 }, "end": { - "line": 60, - "column": 43 + "line": 26, + "column": 23 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false }, "operator": "===", "right": { - "type": "MemberExpression", - "start": 1811, - "end": 1818, + "type": "Identifier", + "start": 828, + "end": 831, "loc": { "start": { - "line": 60, - "column": 48 + "line": 26, + "column": 28 }, "end": { - "line": 60, - "column": 55 - } - }, - "object": { - "type": "Identifier", - "start": 1811, - "end": 1812, - "loc": { - "start": { - "line": 60, - "column": 48 - }, - "end": { - "line": 60, - "column": 49 - }, - "identifierName": "g" + "line": 26, + "column": 31 }, - "name": "g" + "identifierName": "RED" }, - "property": { - "type": "Identifier", - "start": 1813, - "end": 1818, - "loc": { - "start": { - "line": 60, - "column": 50 - }, - "end": { - "line": 60, - "column": 55 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false + "name": "RED" } } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 835, + "end": 860, + "loc": { + "start": { + "line": 27, + "column": 1 }, - "consequent": { - "type": "BlockStatement", - "start": 1820, - "end": 2606, + "end": { + "line": 27, + "column": 26 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 841, + "end": 859, "loc": { "start": { - "line": 60, - "column": 57 + "line": 27, + "column": 7 }, "end": { - "line": 87, - "column": 2 + "line": 27, + "column": 25 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 2328, - "end": 2351, + "id": { + "type": "Identifier", + "start": 841, + "end": 842, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "CallExpression", + "start": 845, + "end": 859, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 845, + "end": 856, "loc": { "start": { - "line": 74, - "column": 2 + "line": 27, + "column": 11 }, "end": { - "line": 74, - "column": 25 - } + "line": 27, + "column": 22 + }, + "identifierName": "grandparent" }, - "expression": { - "type": "CallExpression", - "start": 2328, - "end": 2350, + "name": "grandparent" + }, + "arguments": [ + { + "type": "Identifier", + "start": 857, + "end": 858, "loc": { "start": { - "line": 74, - "column": 2 + "line": 27, + "column": 23 }, "end": { - "line": 74, + "line": 27, "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 2328, - "end": 2340, - "loc": { - "start": { - "line": 74, - "column": 2 - }, - "end": { - "line": 74, - "column": 14 - }, - "identifierName": "rotate_right" }, - "name": "rotate_right", - "leadingComments": null - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 2341, - "end": 2349, - "loc": { - "start": { - "line": 74, - "column": 15 - }, - "end": { - "line": 74, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 2341, - "end": 2342, - "loc": { - "start": { - "line": 74, - "column": 15 - }, - "end": { - "line": 74, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 2343, - "end": 2349, - "loc": { - "start": { - "line": 74, - "column": 17 - }, - "end": { - "line": 74, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1824, - "end": 2325, - "loc": { - "start": { - "line": 61, - "column": 2 - }, - "end": { - "line": 73, - "column": 5 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 2355, - "end": 2583, - "loc": { - "start": { - "line": 76, - "column": 2 - }, - "end": { - "line": 84, - "column": 5 - } - } + "identifierName": "n" }, - { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2587, - "end": 2603, - "loc": { - "start": { - "line": 86, - "column": 2 - }, - "end": { - "line": 86, - "column": 18 - } - } - } - ] - } - ], - "directives": [] - }, - "alternate": null - }, - "leadingComments": [ + "name": "n" + } + ] + } + } + ], + "kind": "const", + "trailingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 881, - "end": 1343, + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 863, + "end": 911, "loc": { "start": { - "line": 31, + "line": 29, "column": 1 }, "end": { - "line": 43, - "column": 4 + "line": 29, + "column": 49 } } } @@ -4632,91 +4853,1733 @@ }, { "type": "ExpressionStatement", - "start": 2609, - "end": 2625, + "start": 913, + "end": 937, "loc": { "start": { - "line": 89, + "line": 30, "column": 1 }, "end": { - "line": 89, - "column": 17 + "line": 30, + "column": 25 } }, "expression": { - "type": "CallExpression", - "start": 2609, - "end": 2624, + "type": "AssignmentExpression", + "start": 913, + "end": 936, "loc": { "start": { - "line": 89, + "line": 30, "column": 1 }, "end": { - "line": 89, - "column": 16 + "line": 30, + "column": 24 } }, - "callee": { - "type": "Identifier", - "start": 2609, - "end": 2621, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 913, + "end": 928, "loc": { "start": { - "line": 89, + "line": 30, "column": 1 }, "end": { - "line": 89, - "column": 13 + "line": 30, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 913, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 913, + "end": 914, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 2 + }, + "identifierName": "n" + }, + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 915, + "end": 921, + "loc": { + "start": { + "line": 30, + "column": 3 + }, + "end": { + "line": 30, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" }, - "identifierName": "insert_case5" + "computed": false, + "leadingComments": null }, - "name": "insert_case5" - }, - "arguments": [ - { + "property": { "type": "Identifier", - "start": 2622, - "end": 2623, + "start": 922, + "end": 928, "loc": { "start": { - "line": 89, - "column": 14 + "line": 30, + "column": 10 }, "end": { - "line": 89, - "column": 15 + "line": 30, + "column": 16 }, - "identifierName": "n" + "identifierName": "_color" }, - "name": "n" + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 931, + "end": 936, + "loc": { + "start": { + "line": 30, + "column": 19 + }, + "end": { + "line": 30, + "column": 24 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 863, + "end": 911, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 + } } - ] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 345, - "end": 635, - "loc": { - "start": { - "line": 10, - "column": 0 - }, - "end": { - "line": 21, + } + ] + }, + { + "type": "ExpressionStatement", + "start": 939, + "end": 954, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 939, + "end": 953, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 939, + "end": 947, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 939, + "end": 940, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 941, + "end": 947, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 950, + "end": 953, + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 15 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + }, + { + "type": "IfStatement", + "start": 957, + "end": 2107, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 67, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 961, + "end": 980, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 961, + "end": 962, + "loc": { + "start": { + "line": 33, + "column": 5 + }, + "end": { + "line": 33, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 967, + "end": 980, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 24 + } + }, + "object": { + "type": "MemberExpression", + "start": 967, + "end": 975, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 967, + "end": 968, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 12 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 969, + "end": 975, + "loc": { + "start": { + "line": 33, + "column": 13 + }, + "end": { + "line": 33, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 976, + "end": 980, + "loc": { + "start": { + "line": 33, + "column": 20 + }, + "end": { + "line": 33, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "BlockStatement", + "start": 982, + "end": 1553, + "loc": { + "start": { + "line": 33, + "column": 26 + }, + "end": { + "line": 50, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1415, + "end": 1446, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 1415, + "end": 1445, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 1415, + "end": 1421, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1422, + "end": 1444, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 1422, + "end": 1428, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 1422, + "end": 1423, + "loc": { + "start": { + "line": 46, + "column": 9 + }, + "end": { + "line": 46, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1424, + "end": 1428, + "loc": { + "start": { + "line": 46, + "column": 11 + }, + "end": { + "line": 46, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1440, + "end": 1444, + "loc": { + "start": { + "line": 46, + "column": 27 + }, + "end": { + "line": 46, + "column": 31 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 986, + "end": 1412, + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 45, + "column": 5 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1449, + "end": 1475, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 28 + } + }, + "expression": { + "type": "CallExpression", + "start": 1449, + "end": 1474, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 27 + } + }, + "callee": { + "type": "Identifier", + "start": 1449, + "end": 1455, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1456, + "end": 1473, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 26 + } + }, + "left": { + "type": "Identifier", + "start": 1456, + "end": 1457, + "loc": { + "start": { + "line": 47, + "column": 9 + }, + "end": { + "line": 47, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1462, + "end": 1473, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 26 + } + }, + "object": { + "type": "MemberExpression", + "start": 1462, + "end": 1468, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 1462, + "end": 1463, + "loc": { + "start": { + "line": 47, + "column": 15 + }, + "end": { + "line": 47, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1464, + "end": 1468, + "loc": { + "start": { + "line": 47, + "column": 17 + }, + "end": { + "line": 47, + "column": 21 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1469, + "end": 1473, + "loc": { + "start": { + "line": 47, + "column": 22 + }, + "end": { + "line": 47, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1478, + "end": 1531, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 55 + } + }, + "expression": { + "type": "CallExpression", + "start": 1478, + "end": 1530, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 54 + } + }, + "callee": { + "type": "Identifier", + "start": 1478, + "end": 1484, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 1485, + "end": 1529, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 53 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1485, + "end": 1501, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1485, + "end": 1492, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1485, + "end": 1486, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1487, + "end": 1492, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 1497, + "end": 1501, + "loc": { + "start": { + "line": 48, + "column": 21 + }, + "end": { + "line": 48, + "column": 25 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 1505, + "end": 1529, + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 53 + } + }, + "left": { + "type": "MemberExpression", + "start": 1505, + "end": 1519, + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 43 + } + }, + "object": { + "type": "MemberExpression", + "start": 1505, + "end": 1512, + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 36 + } + }, + "object": { + "type": "Identifier", + "start": 1505, + "end": 1506, + "loc": { + "start": { + "line": 48, + "column": 29 + }, + "end": { + "line": 48, + "column": 30 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1507, + "end": 1512, + "loc": { + "start": { + "line": 48, + "column": 31 + }, + "end": { + "line": 48, + "column": 36 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1513, + "end": 1519, + "loc": { + "start": { + "line": 48, + "column": 37 + }, + "end": { + "line": 48, + "column": 43 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1524, + "end": 1529, + "loc": { + "start": { + "line": 48, + "column": 48 + }, + "end": { + "line": 48, + "column": 53 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1534, + "end": 1550, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1534, + "end": 1549, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1534, + "end": 1546, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 14 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1547, + "end": 1548, + "loc": { + "start": { + "line": 49, + "column": 15 + }, + "end": { + "line": 49, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 1559, + "end": 2107, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 67, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1969, + "end": 2001, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 34 + } + }, + "expression": { + "type": "CallExpression", + "start": 1969, + "end": 2000, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 33 + } + }, + "callee": { + "type": "Identifier", + "start": 1969, + "end": 1975, + "loc": { + "start": { + "line": 63, + "column": 2 + }, + "end": { + "line": 63, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1976, + "end": 1999, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 32 + } + }, + "left": { + "type": "MemberExpression", + "start": 1976, + "end": 1983, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1976, + "end": 1977, + "loc": { + "start": { + "line": 63, + "column": 9 + }, + "end": { + "line": 63, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1978, + "end": 1983, + "loc": { + "start": { + "line": 63, + "column": 11 + }, + "end": { + "line": 63, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1995, + "end": 1999, + "loc": { + "start": { + "line": 63, + "column": 28 + }, + "end": { + "line": 63, + "column": 32 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 1563, + "end": 1966, + "loc": { + "start": { + "line": 51, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 2004, + "end": 2032, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 2004, + "end": 2031, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 2004, + "end": 2010, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 2011, + "end": 2030, + "loc": { + "start": { + "line": 64, + "column": 9 + }, + "end": { + "line": 64, + "column": 28 + } + }, + "left": { + "type": "Identifier", + "start": 2011, + "end": 2012, + "loc": { + "start": { + "line": 64, + "column": 9 + }, + "end": { + "line": 64, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 2017, + "end": 2030, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 28 + } + }, + "object": { + "type": "MemberExpression", + "start": 2017, + "end": 2024, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 2017, + "end": 2018, + "loc": { + "start": { + "line": 64, + "column": 15 + }, + "end": { + "line": 64, + "column": 16 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 2019, + "end": 2024, + "loc": { + "start": { + "line": 64, + "column": 17 + }, + "end": { + "line": 64, + "column": 22 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 2025, + "end": 2030, + "loc": { + "start": { + "line": 64, + "column": 23 + }, + "end": { + "line": 64, + "column": 28 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 2035, + "end": 2086, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 53 + } + }, + "expression": { + "type": "CallExpression", + "start": 2035, + "end": 2085, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 52 + } + }, + "callee": { + "type": "Identifier", + "start": 2035, + "end": 2041, + "loc": { + "start": { + "line": 65, + "column": 2 + }, + "end": { + "line": 65, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "LogicalExpression", + "start": 2042, + "end": 2084, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 51 + } + }, + "left": { + "type": "BinaryExpression", + "start": 2042, + "end": 2057, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 2042, + "end": 2048, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 2042, + "end": 2043, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 10 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 2044, + "end": 2048, + "loc": { + "start": { + "line": 65, + "column": 11 + }, + "end": { + "line": 65, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 2053, + "end": 2057, + "loc": { + "start": { + "line": 65, + "column": 20 + }, + "end": { + "line": 65, + "column": 24 + } + } + } + }, + "operator": "||", + "right": { + "type": "BinaryExpression", + "start": 2061, + "end": 2084, + "loc": { + "start": { + "line": 65, + "column": 28 + }, + "end": { + "line": 65, + "column": 51 + } + }, + "left": { + "type": "MemberExpression", + "start": 2061, + "end": 2074, + "loc": { + "start": { + "line": 65, + "column": 28 + }, + "end": { + "line": 65, + "column": 41 + } + }, + "object": { + "type": "MemberExpression", + "start": 2061, + "end": 2067, + "loc": { + "start": { + "line": 65, + "column": 28 + }, + "end": { + "line": 65, + "column": 34 + } + }, + "object": { + "type": "Identifier", + "start": 2061, + "end": 2062, + "loc": { + "start": { + "line": 65, + "column": 28 + }, + "end": { + "line": 65, + "column": 29 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 2063, + "end": 2067, + "loc": { + "start": { + "line": 65, + "column": 30 + }, + "end": { + "line": 65, + "column": 34 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 2068, + "end": 2074, + "loc": { + "start": { + "line": 65, + "column": 35 + }, + "end": { + "line": 65, + "column": 41 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 2079, + "end": 2084, + "loc": { + "start": { + "line": 65, + "column": 46 + }, + "end": { + "line": 65, + "column": 51 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 2089, + "end": 2104, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 17 + } + }, + "expression": { + "type": "CallExpression", + "start": 2089, + "end": 2103, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 16 + } + }, + "callee": { + "type": "Identifier", + "start": 2089, + "end": 2100, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 13 + }, + "identifierName": "rotate_left" + }, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2101, + "end": 2102, + "loc": { + "start": { + "line": 66, + "column": 14 + }, + "end": { + "line": 66, + "column": 15 + }, + "identifierName": "g" + }, + "name": "g" + } + ] + } + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "start": 299, + "end": 578, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 19, "column": 3 } } @@ -4725,149 +6588,1694 @@ "trailingComments": [] } } - ], - "directives": [] - }, - "comments": [ + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "start": 299, + "end": 578, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 863, + "end": 911, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 986, + "end": 1412, + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 45, + "column": 5 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 1563, + "end": 1966, + "loc": { + "start": { + "line": 51, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 73, + "end": 78, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 79, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 84, + "end": 103, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 105, + "end": 111, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 112, + "end": 115, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 116, + "end": 120, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 121, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 138, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 140, + "end": 146, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 147, + "end": 158, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 159, + "end": 163, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_left.js", + "start": 164, + "end": 190, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 190, + "end": 191, + "loc": { + "start": { + "line": 5, + "column": 50 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 192, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 199, + "end": 211, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 212, + "end": 216, + "loc": { + "start": { + "line": 6, + "column": 20 + }, + "end": { + "line": 6, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../rotate/rotate_right.js", + "start": 217, + "end": 244, + "loc": { + "start": { + "line": 6, + "column": 25 + }, + "end": { + "line": 6, + "column": 52 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 244, + "end": 245, + "loc": { + "start": { + "line": 6, + "column": 52 + }, + "end": { + "line": 6, + "column": 53 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 246, + "end": 252, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "grandparent", + "start": 253, + "end": 264, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 265, + "end": 269, + "loc": { + "start": { + "line": 7, + "column": 19 + }, + "end": { + "line": 7, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/grandparent.js", + "start": 270, + "end": 296, + "loc": { + "start": { + "line": 7, + "column": 24 + }, + "end": { + "line": 7, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 296, + "end": 297, + "loc": { + "start": { + "line": 7, + "column": 50 + }, + "end": { + "line": 7, + "column": 51 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "start": 299, + "end": 578, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 579, + "end": 584, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case4", + "start": 585, + "end": 597, + "loc": { + "start": { + "line": 20, + "column": 6 + }, + "end": { + "line": 20, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 598, + "end": 599, + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 600, + "end": 601, + "loc": { + "start": { + "line": 20, + "column": 21 + }, + "end": { + "line": 20, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 601, + "end": 602, + "loc": { + "start": { + "line": 20, + "column": 22 + }, + "end": { + "line": 20, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 602, + "end": 603, + "loc": { + "start": { + "line": 20, + "column": 23 + }, + "end": { + "line": 20, + "column": 24 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 604, + "end": 606, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 27 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 607, + "end": 608, + "loc": { + "start": { + "line": 20, + "column": 28 + }, + "end": { + "line": 20, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 610, + "end": 616, + "loc": { + "start": { + "line": 21, + "column": 1 + }, + "end": { + "line": 21, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 616, + "end": 617, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 617, + "end": 618, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 619, + "end": 629, + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 630, + "end": 634, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 25 + } + } + }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 345, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 634, "end": 635, "loc": { "start": { - "line": 10, - "column": 0 + "line": 21, + "column": 25 }, "end": { "line": 21, - "column": 3 + "column": 26 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 881, - "end": 1343, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 635, + "end": 636, "loc": { "start": { - "line": 31, + "line": 21, + "column": 26 + }, + "end": { + "line": 21, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 638, + "end": 644, + "loc": { + "start": { + "line": 22, "column": 1 }, "end": { - "line": 43, - "column": 4 + "line": 22, + "column": 7 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1425, - "end": 1681, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 644, + "end": 645, "loc": { "start": { - "line": 48, - "column": 2 + "line": 22, + "column": 7 }, "end": { - "line": 57, - "column": 5 + "line": 22, + "column": 8 } } }, { - "type": "CommentLine", - "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1685, - "end": 1762, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 645, + "end": 646, "loc": { "start": { - "line": 59, - "column": 2 + "line": 22, + "column": 8 }, "end": { - "line": 59, - "column": 79 + "line": 22, + "column": 9 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1824, - "end": 2325, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 646, + "end": 647, "loc": { "start": { - "line": 61, - "column": 2 + "line": 22, + "column": 9 }, "end": { - "line": 73, - "column": 5 + "line": 22, + "column": 10 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 2355, - "end": 2583, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 647, + "end": 653, "loc": { "start": { - "line": 76, - "column": 2 + "line": 22, + "column": 10 }, "end": { - "line": 84, - "column": 5 + "line": 22, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 654, + "end": 657, + "loc": { + "start": { + "line": 22, + "column": 17 + }, + "end": { + "line": 22, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 658, + "end": 661, + "loc": { + "start": { + "line": 22, + "column": 21 + }, + "end": { + "line": 22, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 661, + "end": 662, + "loc": { + "start": { + "line": 22, + "column": 24 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 662, + "end": 663, + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 22, + "column": 26 } } }, { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2587, - "end": 2603, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 665, + "end": 671, "loc": { "start": { - "line": 86, - "column": 2 + "line": 23, + "column": 1 }, "end": { - "line": 86, - "column": 18 + "line": 23, + "column": 7 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 0, - "end": 6, + "start": 671, + "end": 672, "loc": { "start": { - "line": 1, - "column": 0 + "line": 23, + "column": 7 }, "end": { - "line": 1, - "column": 6 + "line": 23, + "column": 8 } } }, @@ -4883,49 +8291,49 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 7, - "end": 13, + "value": "n", + "start": 672, + "end": 673, "loc": { "start": { - "line": 1, - "column": 7 + "line": 23, + "column": 8 }, "end": { - "line": 1, - "column": 13 + "line": 23, + "column": 9 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 14, - "end": 18, + "start": 673, + "end": 674, "loc": { "start": { - "line": 1, - "column": 14 + "line": 23, + "column": 9 }, "end": { - "line": 1, - "column": 18 + "line": 23, + "column": 10 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4933,26 +8341,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "assert", - "start": 19, - "end": 27, + "value": "left", + "start": 674, + "end": 678, "loc": { "start": { - "line": 1, - "column": 19 + "line": 23, + "column": 10 }, "end": { - "line": 1, - "column": 27 + "line": 23, + "column": 14 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4960,26 +8367,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 27, - "end": 28, + "value": "===", + "start": 679, + "end": 682, "loc": { "start": { - "line": 1, - "column": 27 + "line": 23, + "column": 15 }, "end": { - "line": 1, - "column": 28 + "line": 23, + "column": 18 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4990,43 +8398,44 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 29, - "end": 35, + "value": "null", + "start": 683, + "end": 687, "loc": { "start": { - "line": 2, - "column": 0 + "line": 23, + "column": 19 }, "end": { - "line": 2, - "column": 6 + "line": 23, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "||", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 1, + "updateContext": null }, - "value": "Node", - "start": 36, - "end": 40, + "value": "||", + "start": 688, + "end": 690, "loc": { "start": { - "line": 2, - "column": 7 + "line": 23, + "column": 24 }, "end": { - "line": 2, - "column": 11 + "line": 23, + "column": 26 } } }, @@ -5042,25 +8451,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 41, - "end": 45, + "value": "n", + "start": 691, + "end": 692, "loc": { "start": { - "line": 2, - "column": 12 + "line": 23, + "column": 27 }, "end": { - "line": 2, - "column": 16 + "line": 23, + "column": 28 } } }, { "type": { - "label": "string", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5069,52 +8478,50 @@ "binop": null, "updateContext": null }, - "value": "../types/Node.js", - "start": 46, - "end": 64, + "start": 692, + "end": 693, "loc": { "start": { - "line": 2, - "column": 17 + "line": 23, + "column": 28 }, "end": { - "line": 2, - "column": 35 + "line": 23, + "column": 29 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 64, - "end": 65, + "value": "left", + "start": 693, + "end": 697, "loc": { "start": { - "line": 2, - "column": 35 + "line": 23, + "column": 29 }, "end": { - "line": 2, - "column": 36 + "line": 23, + "column": 33 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5123,17 +8530,16 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 66, - "end": 72, + "start": 697, + "end": 698, "loc": { "start": { - "line": 3, - "column": 0 + "line": 23, + "column": 33 }, "end": { - "line": 3, - "column": 6 + "line": 23, + "column": 34 } } }, @@ -5149,49 +8555,50 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 73, - "end": 78, + "value": "_color", + "start": 698, + "end": 704, "loc": { "start": { - "line": 3, - "column": 7 + "line": 23, + "column": 34 }, "end": { - "line": 3, - "column": 12 + "line": 23, + "column": 40 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "from", - "start": 79, - "end": 83, + "value": "===", + "start": 705, + "end": 708, "loc": { "start": { - "line": 3, - "column": 13 + "line": 23, + "column": 41 }, "end": { - "line": 3, - "column": 17 + "line": 23, + "column": 44 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5199,55 +8606,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/BLACK.js", - "start": 84, - "end": 103, + "value": "BLACK", + "start": 709, + "end": 714, "loc": { "start": { - "line": 3, - "column": 18 + "line": 23, + "column": 45 }, "end": { - "line": 3, - "column": 37 + "line": 23, + "column": 50 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 103, - "end": 104, + "start": 714, + "end": 715, "loc": { "start": { - "line": 3, - "column": 37 + "line": 23, + "column": 50 }, "end": { - "line": 3, - "column": 38 + "line": 23, + "column": 51 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5256,17 +8660,16 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 105, - "end": 111, + "start": 715, + "end": 716, "loc": { "start": { - "line": 4, - "column": 0 + "line": 23, + "column": 51 }, "end": { - "line": 4, - "column": 6 + "line": 23, + "column": 52 } } }, @@ -5282,24 +8685,24 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 112, - "end": 115, + "value": "assert", + "start": 718, + "end": 724, "loc": { "start": { - "line": 4, - "column": 7 + "line": 24, + "column": 1 }, "end": { - "line": 4, - "column": 10 + "line": 24, + "column": 7 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5308,23 +8711,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 116, - "end": 120, + "start": 724, + "end": 725, "loc": { "start": { - "line": 4, - "column": 11 + "line": 24, + "column": 7 }, "end": { - "line": 4, - "column": 15 + "line": 24, + "column": 8 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5332,27 +8734,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/RED.js", - "start": 121, - "end": 138, + "value": "n", + "start": 725, + "end": 726, "loc": { "start": { - "line": 4, - "column": 16 + "line": 24, + "column": 8 }, "end": { - "line": 4, - "column": 33 + "line": 24, + "column": 9 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5362,23 +8763,22 @@ "binop": null, "updateContext": null }, - "start": 138, - "end": 139, + "start": 726, + "end": 727, "loc": { "start": { - "line": 4, - "column": 33 + "line": 24, + "column": 9 }, "end": { - "line": 4, - "column": 34 + "line": 24, + "column": 10 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5386,52 +8786,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 140, - "end": 146, + "value": "right", + "start": 727, + "end": 732, "loc": { "start": { - "line": 5, - "column": 0 + "line": 24, + "column": 10 }, "end": { - "line": 5, - "column": 6 + "line": 24, + "column": 15 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "rotate_left", - "start": 147, - "end": 158, + "value": "===", + "start": 733, + "end": 736, "loc": { "start": { - "line": 5, - "column": 7 + "line": 24, + "column": 16 }, "end": { - "line": 5, - "column": 18 + "line": 24, + "column": 19 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5439,81 +8840,81 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 159, - "end": 163, + "value": "null", + "start": 737, + "end": 741, "loc": { "start": { - "line": 5, - "column": 19 + "line": 24, + "column": 20 }, "end": { - "line": 5, - "column": 23 + "line": 24, + "column": 24 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "||", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 1, "updateContext": null }, - "value": "../rotate/rotate_left.js", - "start": 164, - "end": 190, + "value": "||", + "start": 742, + "end": 744, "loc": { "start": { - "line": 5, - "column": 24 + "line": 24, + "column": 25 }, "end": { - "line": 5, - "column": 50 + "line": 24, + "column": 27 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 190, - "end": 191, + "value": "n", + "start": 745, + "end": 746, "loc": { "start": { - "line": 5, - "column": 50 + "line": 24, + "column": 28 }, "end": { - "line": 5, - "column": 51 + "line": 24, + "column": 29 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5522,17 +8923,16 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 192, - "end": 198, + "start": 746, + "end": 747, "loc": { "start": { - "line": 6, - "column": 0 + "line": 24, + "column": 29 }, "end": { - "line": 6, - "column": 6 + "line": 24, + "column": 30 } } }, @@ -5548,49 +8948,49 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 199, - "end": 211, + "value": "right", + "start": 747, + "end": 752, "loc": { "start": { - "line": 6, - "column": 7 + "line": 24, + "column": 30 }, "end": { - "line": 6, - "column": 19 + "line": 24, + "column": 35 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 212, - "end": 216, + "start": 752, + "end": 753, "loc": { "start": { - "line": 6, - "column": 20 + "line": 24, + "column": 35 }, "end": { - "line": 6, - "column": 24 + "line": 24, + "column": 36 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5598,26 +8998,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../rotate/rotate_right.js", - "start": 217, - "end": 244, + "binop": null + }, + "value": "_color", + "start": 753, + "end": 759, "loc": { "start": { - "line": 6, - "column": 25 + "line": 24, + "column": 36 }, "end": { - "line": 6, - "column": 52 + "line": 24, + "column": 42 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5625,26 +9024,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 244, - "end": 245, + "value": "===", + "start": 760, + "end": 763, "loc": { "start": { - "line": 6, - "column": 52 + "line": 24, + "column": 43 }, "end": { - "line": 6, - "column": 53 + "line": 24, + "column": 46 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5652,28 +9051,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 246, - "end": 252, + "value": "BLACK", + "start": 764, + "end": 769, "loc": { "start": { - "line": 7, - "column": 0 + "line": 24, + "column": 47 }, "end": { - "line": 7, - "column": 6 + "line": 24, + "column": 52 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5681,49 +9079,48 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 253, - "end": 264, + "start": 769, + "end": 770, "loc": { "start": { - "line": 7, - "column": 7 + "line": 24, + "column": 52 }, "end": { - "line": 7, - "column": 18 + "line": 24, + "column": 53 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 265, - "end": 269, + "start": 770, + "end": 771, "loc": { "start": { - "line": 7, - "column": 19 + "line": 24, + "column": 53 }, "end": { - "line": 7, - "column": 23 + "line": 24, + "column": 54 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5731,53 +9128,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/grandparent.js", - "start": 270, - "end": 296, + "value": "assert", + "start": 773, + "end": 779, "loc": { "start": { - "line": 7, - "column": 24 + "line": 25, + "column": 1 }, "end": { - "line": 7, - "column": 50 + "line": 25, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 296, - "end": 297, + "start": 779, + "end": 780, "loc": { "start": { - "line": 7, - "column": 50 + "line": 25, + "column": 7 }, "end": { - "line": 7, - "column": 51 + "line": 25, + "column": 8 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5785,46 +9179,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 298, - "end": 304, + "value": "n", + "start": 780, + "end": 781, "loc": { "start": { - "line": 8, - "column": 0 + "line": 25, + "column": 8 }, "end": { - "line": 8, - "column": 6 + "line": 25, + "column": 9 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "insert_case5", - "start": 305, - "end": 317, + "start": 781, + "end": 782, "loc": { "start": { - "line": 8, - "column": 7 + "line": 25, + "column": 9 }, "end": { - "line": 8, - "column": 19 + "line": 25, + "column": 10 } } }, @@ -5840,52 +9233,53 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 318, - "end": 322, + "value": "parent", + "start": 782, + "end": 788, "loc": { "start": { - "line": 8, - "column": 20 + "line": 25, + "column": 10 }, "end": { - "line": 8, - "column": 24 + "line": 25, + "column": 16 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "./insert_case5.js", - "start": 323, - "end": 342, + "value": "!==", + "start": 789, + "end": 792, "loc": { "start": { - "line": 8, - "column": 25 + "line": 25, + "column": 17 }, "end": { - "line": 8, - "column": 44 + "line": 25, + "column": 20 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5894,40 +9288,49 @@ "binop": null, "updateContext": null }, - "start": 342, - "end": 343, + "value": "null", + "start": 793, + "end": 797, "loc": { "start": { - "line": 8, - "column": 44 + "line": 25, + "column": 21 }, "end": { - "line": 8, - "column": 45 + "line": 25, + "column": 25 } } }, { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n ", - "start": 345, - "end": 635, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 797, + "end": 798, "loc": { "start": { - "line": 10, - "column": 0 + "line": 25, + "column": 25 }, "end": { - "line": 21, - "column": 3 + "line": 25, + "column": 26 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5937,17 +9340,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 636, - "end": 641, + "start": 798, + "end": 799, "loc": { "start": { - "line": 22, - "column": 0 + "line": 25, + "column": 26 }, "end": { - "line": 22, - "column": 5 + "line": 25, + "column": 27 } } }, @@ -5963,51 +9365,49 @@ "postfix": false, "binop": null }, - "value": "insert_case4", - "start": 642, - "end": 654, + "value": "assert", + "start": 801, + "end": 807, "loc": { "start": { - "line": 22, - "column": 6 + "line": 26, + "column": 1 }, "end": { - "line": 22, - "column": 18 + "line": 26, + "column": 7 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 655, - "end": 656, + "start": 807, + "end": 808, "loc": { "start": { - "line": 22, - "column": 19 + "line": 26, + "column": 7 }, "end": { - "line": 22, - "column": 20 + "line": 26, + "column": 8 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6016,50 +9416,51 @@ "postfix": false, "binop": null }, - "start": 657, - "end": 658, + "value": "n", + "start": 808, + "end": 809, "loc": { "start": { - "line": 22, - "column": 21 + "line": 26, + "column": 8 }, "end": { - "line": 22, - "column": 22 + "line": 26, + "column": 9 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 658, - "end": 659, + "start": 809, + "end": 810, "loc": { "start": { - "line": 22, - "column": 22 + "line": 26, + "column": 9 }, "end": { - "line": 22, - "column": 23 + "line": 26, + "column": 10 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6067,23 +9468,24 @@ "postfix": false, "binop": null }, - "start": 659, - "end": 660, + "value": "parent", + "start": 810, + "end": 816, "loc": { "start": { - "line": 22, - "column": 23 + "line": 26, + "column": 10 }, "end": { - "line": 22, - "column": 24 + "line": 26, + "column": 16 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6093,23 +9495,23 @@ "binop": null, "updateContext": null }, - "start": 661, - "end": 663, + "start": 816, + "end": 817, "loc": { "start": { - "line": 22, - "column": 25 + "line": 26, + "column": 16 }, "end": { - "line": 22, - "column": 27 + "line": 26, + "column": 17 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6118,49 +9520,51 @@ "postfix": false, "binop": null }, - "start": 664, - "end": 665, + "value": "_color", + "start": 817, + "end": 823, "loc": { "start": { - "line": 22, - "column": 28 + "line": 26, + "column": 17 }, "end": { - "line": 22, - "column": 29 + "line": 26, + "column": 23 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "assert", - "start": 667, - "end": 673, + "value": "===", + "start": 824, + "end": 827, "loc": { "start": { - "line": 23, - "column": 1 + "line": 26, + "column": 24 }, "end": { - "line": 23, - "column": 7 + "line": 26, + "column": 27 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6169,24 +9573,25 @@ "postfix": false, "binop": null }, - "start": 673, - "end": 674, + "value": "RED", + "start": 828, + "end": 831, "loc": { "start": { - "line": 23, - "column": 7 + "line": 26, + "column": 28 }, "end": { - "line": 23, - "column": 8 + "line": 26, + "column": 31 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6194,24 +9599,22 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 674, - "end": 675, + "start": 831, + "end": 832, "loc": { "start": { - "line": 23, - "column": 8 + "line": 26, + "column": 31 }, "end": { - "line": 23, - "column": 9 + "line": 26, + "column": 32 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -6219,54 +9622,55 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 676, - "end": 686, + "start": 832, + "end": 833, "loc": { "start": { - "line": 23, - "column": 10 + "line": 26, + "column": 32 }, "end": { - "line": 23, - "column": 20 + "line": 26, + "column": 33 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Node", - "start": 687, - "end": 691, + "value": "const", + "start": 835, + "end": 840, "loc": { "start": { - "line": 23, - "column": 21 + "line": 27, + "column": 1 }, "end": { - "line": 23, - "column": 25 + "line": 27, + "column": 6 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6274,42 +9678,44 @@ "postfix": false, "binop": null }, - "start": 691, - "end": 692, + "value": "g", + "start": 841, + "end": 842, "loc": { "start": { - "line": 23, - "column": 25 + "line": 27, + "column": 7 }, "end": { - "line": 23, - "column": 26 + "line": 27, + "column": 8 } } }, { "type": { - "label": ";", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 692, - "end": 693, + "value": "=", + "start": 843, + "end": 844, "loc": { "start": { - "line": 23, - "column": 26 + "line": 27, + "column": 9 }, "end": { - "line": 23, - "column": 27 + "line": 27, + "column": 10 } } }, @@ -6325,17 +9731,17 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 695, - "end": 701, + "value": "grandparent", + "start": 845, + "end": 856, "loc": { "start": { - "line": 24, - "column": 1 + "line": 27, + "column": 11 }, "end": { - "line": 24, - "column": 7 + "line": 27, + "column": 22 } } }, @@ -6351,16 +9757,16 @@ "postfix": false, "binop": null }, - "start": 701, - "end": 702, + "start": 856, + "end": 857, "loc": { "start": { - "line": 24, - "column": 7 + "line": 27, + "column": 22 }, "end": { - "line": 24, - "column": 8 + "line": 27, + "column": 23 } } }, @@ -6377,22 +9783,22 @@ "binop": null }, "value": "n", - "start": 702, - "end": 703, + "start": 857, + "end": 858, "loc": { "start": { - "line": 24, - "column": 8 + "line": 27, + "column": 23 }, "end": { - "line": 24, - "column": 9 + "line": 27, + "column": 24 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6400,106 +9806,120 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 703, - "end": 704, + "start": 858, + "end": 859, "loc": { "start": { - "line": 24, - "column": 9 + "line": 27, + "column": 24 }, "end": { - "line": 24, - "column": 10 + "line": 27, + "column": 25 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_color", - "start": 704, - "end": 710, + "start": 859, + "end": 860, "loc": { "start": { - "line": 24, - "column": 10 + "line": 27, + "column": 25 }, "end": { - "line": 24, - "column": 16 + "line": 27, + "column": 26 + } + } + }, + { + "type": "CommentLine", + "value": " Repaint n's parent black, n's grandparent red", + "start": 863, + "end": 911, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 49 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 711, - "end": 714, + "value": "n", + "start": 913, + "end": 914, "loc": { "start": { - "line": 24, - "column": 17 + "line": 30, + "column": 1 }, "end": { - "line": 24, - "column": 20 + "line": 30, + "column": 2 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "RED", - "start": 715, - "end": 718, + "start": 914, + "end": 915, "loc": { "start": { - "line": 24, - "column": 21 + "line": 30, + "column": 2 }, "end": { - "line": 24, - "column": 24 + "line": 30, + "column": 3 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6507,23 +9927,24 @@ "postfix": false, "binop": null }, - "start": 718, - "end": 719, + "value": "parent", + "start": 915, + "end": 921, "loc": { "start": { - "line": 24, - "column": 24 + "line": 30, + "column": 3 }, "end": { - "line": 24, - "column": 25 + "line": 30, + "column": 9 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6533,16 +9954,16 @@ "binop": null, "updateContext": null }, - "start": 719, - "end": 720, + "start": 921, + "end": 922, "loc": { "start": { - "line": 24, - "column": 25 + "line": 30, + "column": 9 }, "end": { - "line": 24, - "column": 26 + "line": 30, + "column": 10 } } }, @@ -6558,42 +9979,44 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 722, - "end": 728, + "value": "_color", + "start": 922, + "end": 928, "loc": { "start": { - "line": 25, - "column": 1 + "line": 30, + "column": 10 }, "end": { - "line": 25, - "column": 7 + "line": 30, + "column": 16 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 728, - "end": 729, + "value": "=", + "start": 929, + "end": 930, "loc": { "start": { - "line": 25, - "column": 7 + "line": 30, + "column": 17 }, "end": { - "line": 25, - "column": 8 + "line": 30, + "column": 18 } } }, @@ -6609,24 +10032,24 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 729, - "end": 730, + "value": "BLACK", + "start": 931, + "end": 936, "loc": { "start": { - "line": 25, - "column": 8 + "line": 30, + "column": 19 }, "end": { - "line": 25, - "column": 9 + "line": 30, + "column": 24 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6636,16 +10059,16 @@ "binop": null, "updateContext": null }, - "start": 730, - "end": 731, + "start": 936, + "end": 937, "loc": { "start": { - "line": 25, - "column": 9 + "line": 30, + "column": 24 }, "end": { - "line": 25, - "column": 10 + "line": 30, + "column": 25 } } }, @@ -6661,17 +10084,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 731, - "end": 735, + "value": "g", + "start": 939, + "end": 940, "loc": { "start": { - "line": 25, - "column": 10 + "line": 31, + "column": 1 }, "end": { - "line": 25, - "column": 14 + "line": 31, + "column": 2 } } }, @@ -6688,16 +10111,16 @@ "binop": null, "updateContext": null }, - "start": 735, - "end": 736, + "start": 940, + "end": 941, "loc": { "start": { - "line": 25, - "column": 14 + "line": 31, + "column": 2 }, "end": { - "line": 25, - "column": 15 + "line": 31, + "column": 3 } } }, @@ -6714,43 +10137,43 @@ "binop": null }, "value": "_color", - "start": 736, - "end": 742, + "start": 941, + "end": 947, "loc": { "start": { - "line": 25, - "column": 15 + "line": 31, + "column": 3 }, "end": { - "line": 25, - "column": 21 + "line": 31, + "column": 9 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 743, - "end": 746, + "value": "=", + "start": 948, + "end": 949, "loc": { "start": { - "line": 25, - "column": 22 + "line": 31, + "column": 10 }, "end": { - "line": 25, - "column": 25 + "line": 31, + "column": 11 } } }, @@ -6766,42 +10189,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 747, - "end": 752, - "loc": { - "start": { - "line": 25, - "column": 26 - }, - "end": { - "line": 25, - "column": 31 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 752, - "end": 753, + "value": "RED", + "start": 950, + "end": 953, "loc": { "start": { - "line": 25, - "column": 31 + "line": 31, + "column": 12 }, "end": { - "line": 25, - "column": 32 + "line": 31, + "column": 15 } } }, @@ -6818,42 +10216,44 @@ "binop": null, "updateContext": null }, - "start": 753, - "end": 754, + "start": 953, + "end": 954, "loc": { "start": { - "line": 25, - "column": 32 + "line": 31, + "column": 15 }, "end": { - "line": 25, - "column": 33 + "line": 31, + "column": 16 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 756, - "end": 762, + "value": "if", + "start": 957, + "end": 959, "loc": { "start": { - "line": 26, + "line": 33, "column": 1 }, "end": { - "line": 26, - "column": 7 + "line": 33, + "column": 3 } } }, @@ -6869,16 +10269,16 @@ "postfix": false, "binop": null }, - "start": 762, - "end": 763, + "start": 960, + "end": 961, "loc": { "start": { - "line": 26, - "column": 7 + "line": 33, + "column": 4 }, "end": { - "line": 26, - "column": 8 + "line": 33, + "column": 5 } } }, @@ -6895,41 +10295,42 @@ "binop": null }, "value": "n", - "start": 763, - "end": 764, + "start": 961, + "end": 962, "loc": { "start": { - "line": 26, - "column": 8 + "line": 33, + "column": 5 }, "end": { - "line": 26, - "column": 9 + "line": 33, + "column": 6 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 764, - "end": 765, + "value": "===", + "start": 963, + "end": 966, "loc": { "start": { - "line": 26, - "column": 9 + "line": 33, + "column": 7 }, "end": { - "line": 26, + "line": 33, "column": 10 } } @@ -6946,17 +10347,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 765, - "end": 770, + "value": "n", + "start": 967, + "end": 968, "loc": { "start": { - "line": 26, - "column": 10 + "line": 33, + "column": 11 }, "end": { - "line": 26, - "column": 15 + "line": 33, + "column": 12 } } }, @@ -6973,16 +10374,16 @@ "binop": null, "updateContext": null }, - "start": 770, - "end": 771, + "start": 968, + "end": 969, "loc": { "start": { - "line": 26, - "column": 15 + "line": 33, + "column": 12 }, "end": { - "line": 26, - "column": 16 + "line": 33, + "column": 13 } } }, @@ -6998,44 +10399,43 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 771, - "end": 777, + "value": "parent", + "start": 969, + "end": 975, "loc": { "start": { - "line": 26, - "column": 16 + "line": 33, + "column": 13 }, "end": { - "line": 26, - "column": 22 + "line": 33, + "column": 19 } } }, { - "type": { - "label": "==/!=", - "beforeExpr": true, + "type": { + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 778, - "end": 781, + "start": 975, + "end": 976, "loc": { "start": { - "line": 26, - "column": 23 + "line": 33, + "column": 19 }, "end": { - "line": 26, - "column": 26 + "line": 33, + "column": 20 } } }, @@ -7051,17 +10451,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 782, - "end": 787, + "value": "left", + "start": 976, + "end": 980, "loc": { "start": { - "line": 26, - "column": 27 + "line": 33, + "column": 20 }, "end": { - "line": 26, - "column": 32 + "line": 33, + "column": 24 } } }, @@ -7077,42 +10477,57 @@ "postfix": false, "binop": null }, - "start": 787, - "end": 788, + "start": 980, + "end": 981, "loc": { "start": { - "line": 26, - "column": 32 + "line": 33, + "column": 24 }, "end": { - "line": 26, - "column": 33 + "line": 33, + "column": 25 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 788, - "end": 789, + "start": 982, + "end": 983, "loc": { "start": { - "line": 26, - "column": 33 + "line": 33, + "column": 26 }, "end": { - "line": 26, - "column": 34 + "line": 33, + "column": 27 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 986, + "end": 1412, + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 45, + "column": 5 } } }, @@ -7129,16 +10544,16 @@ "binop": null }, "value": "assert", - "start": 791, - "end": 797, + "start": 1415, + "end": 1421, "loc": { "start": { - "line": 27, - "column": 1 + "line": 46, + "column": 2 }, "end": { - "line": 27, - "column": 7 + "line": 46, + "column": 8 } } }, @@ -7154,16 +10569,16 @@ "postfix": false, "binop": null }, - "start": 797, - "end": 798, + "start": 1421, + "end": 1422, "loc": { "start": { - "line": 27, - "column": 7 + "line": 46, + "column": 8 }, "end": { - "line": 27, - "column": 8 + "line": 46, + "column": 9 } } }, @@ -7179,17 +10594,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 798, - "end": 799, + "value": "g", + "start": 1422, + "end": 1423, "loc": { "start": { - "line": 27, - "column": 8 + "line": 46, + "column": 9 }, "end": { - "line": 27, - "column": 9 + "line": 46, + "column": 10 } } }, @@ -7206,16 +10621,16 @@ "binop": null, "updateContext": null }, - "start": 799, - "end": 800, + "start": 1423, + "end": 1424, "loc": { "start": { - "line": 27, - "column": 9 + "line": 46, + "column": 10 }, "end": { - "line": 27, - "column": 10 + "line": 46, + "column": 11 } } }, @@ -7231,23 +10646,24 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 800, - "end": 806, + "value": "left", + "start": 1424, + "end": 1428, "loc": { "start": { - "line": 27, - "column": 10 + "line": 46, + "column": 11 }, "end": { - "line": 27, - "column": 16 + "line": 46, + "column": 15 } } }, { "type": { - "label": "==/!=", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7255,27 +10671,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": 7, "updateContext": null }, - "value": "!==", - "start": 807, - "end": 810, + "value": "instanceof", + "start": 1429, + "end": 1439, "loc": { "start": { - "line": 27, - "column": 17 + "line": 46, + "column": 16 }, "end": { - "line": 27, - "column": 20 + "line": 46, + "column": 26 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7283,20 +10698,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 811, - "end": 815, + "value": "Node", + "start": 1440, + "end": 1444, "loc": { "start": { - "line": 27, - "column": 21 + "line": 46, + "column": 27 }, "end": { - "line": 27, - "column": 25 + "line": 46, + "column": 31 } } }, @@ -7312,16 +10726,16 @@ "postfix": false, "binop": null }, - "start": 815, - "end": 816, + "start": 1444, + "end": 1445, "loc": { "start": { - "line": 27, - "column": 25 + "line": 46, + "column": 31 }, "end": { - "line": 27, - "column": 26 + "line": 46, + "column": 32 } } }, @@ -7338,16 +10752,16 @@ "binop": null, "updateContext": null }, - "start": 816, - "end": 817, + "start": 1445, + "end": 1446, "loc": { "start": { - "line": 27, - "column": 26 + "line": 46, + "column": 32 }, "end": { - "line": 27, - "column": 27 + "line": 46, + "column": 33 } } }, @@ -7364,16 +10778,16 @@ "binop": null }, "value": "assert", - "start": 819, - "end": 825, + "start": 1449, + "end": 1455, "loc": { "start": { - "line": 28, - "column": 1 + "line": 47, + "column": 2 }, "end": { - "line": 28, - "column": 7 + "line": 47, + "column": 8 } } }, @@ -7389,16 +10803,16 @@ "postfix": false, "binop": null }, - "start": 825, - "end": 826, + "start": 1455, + "end": 1456, "loc": { "start": { - "line": 28, - "column": 7 + "line": 47, + "column": 8 }, "end": { - "line": 28, - "column": 8 + "line": 47, + "column": 9 } } }, @@ -7415,42 +10829,43 @@ "binop": null }, "value": "n", - "start": 826, - "end": 827, + "start": 1456, + "end": 1457, "loc": { "start": { - "line": 28, - "column": 8 + "line": 47, + "column": 9 }, "end": { - "line": 28, - "column": 9 + "line": 47, + "column": 10 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 827, - "end": 828, + "value": "===", + "start": 1458, + "end": 1461, "loc": { "start": { - "line": 28, - "column": 9 + "line": 47, + "column": 11 }, "end": { - "line": 28, - "column": 10 + "line": 47, + "column": 14 } } }, @@ -7466,16 +10881,16 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 828, - "end": 834, + "value": "g", + "start": 1462, + "end": 1463, "loc": { "start": { - "line": 28, - "column": 10 + "line": 47, + "column": 15 }, "end": { - "line": 28, + "line": 47, "column": 16 } } @@ -7493,15 +10908,15 @@ "binop": null, "updateContext": null }, - "start": 834, - "end": 835, + "start": 1463, + "end": 1464, "loc": { "start": { - "line": 28, + "line": 47, "column": 16 }, "end": { - "line": 28, + "line": 47, "column": 17 } } @@ -7518,102 +10933,24 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 835, - "end": 841, + "value": "left", + "start": 1464, + "end": 1468, "loc": { "start": { - "line": 28, + "line": 47, "column": 17 }, "end": { - "line": 28, - "column": 23 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 842, - "end": 845, - "loc": { - "start": { - "line": 28, - "column": 24 - }, - "end": { - "line": 28, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 846, - "end": 849, - "loc": { - "start": { - "line": 28, - "column": 28 - }, - "end": { - "line": 28, - "column": 31 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 849, - "end": 850, - "loc": { - "start": { - "line": 28, - "column": 31 - }, - "end": { - "line": 28, - "column": 32 + "line": 47, + "column": 21 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -7623,52 +10960,50 @@ "binop": null, "updateContext": null }, - "start": 850, - "end": 851, + "start": 1468, + "end": 1469, "loc": { "start": { - "line": 28, - "column": 32 + "line": 47, + "column": 21 }, "end": { - "line": 28, - "column": 33 + "line": 47, + "column": 22 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 853, - "end": 858, + "value": "left", + "start": 1469, + "end": 1473, "loc": { "start": { - "line": 29, - "column": 1 + "line": 47, + "column": 22 }, "end": { - "line": 29, - "column": 6 + "line": 47, + "column": 26 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7676,44 +11011,42 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 859, - "end": 860, + "start": 1473, + "end": 1474, "loc": { "start": { - "line": 29, - "column": 7 + "line": 47, + "column": 26 }, "end": { - "line": 29, - "column": 8 + "line": 47, + "column": 27 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 861, - "end": 862, + "start": 1474, + "end": 1475, "loc": { "start": { - "line": 29, - "column": 9 + "line": 47, + "column": 27 }, "end": { - "line": 29, - "column": 10 + "line": 47, + "column": 28 } } }, @@ -7729,17 +11062,17 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 863, - "end": 874, + "value": "assert", + "start": 1478, + "end": 1484, "loc": { "start": { - "line": 29, - "column": 11 + "line": 48, + "column": 2 }, "end": { - "line": 29, - "column": 22 + "line": 48, + "column": 8 } } }, @@ -7755,16 +11088,16 @@ "postfix": false, "binop": null }, - "start": 874, - "end": 875, + "start": 1484, + "end": 1485, "loc": { "start": { - "line": 29, - "column": 22 + "line": 48, + "column": 8 }, "end": { - "line": 29, - "column": 23 + "line": 48, + "column": 9 } } }, @@ -7780,23 +11113,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 875, - "end": 876, + "value": "g", + "start": 1485, + "end": 1486, "loc": { "start": { - "line": 29, - "column": 23 + "line": 48, + "column": 9 }, "end": { - "line": 29, - "column": 24 + "line": 48, + "column": 10 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7804,69 +11137,81 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 876, - "end": 877, + "start": 1486, + "end": 1487, "loc": { "start": { - "line": 29, - "column": 24 + "line": 48, + "column": 10 }, "end": { - "line": 29, - "column": 25 + "line": 48, + "column": 11 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 877, - "end": 878, + "value": "right", + "start": 1487, + "end": 1492, "loc": { "start": { - "line": 29, - "column": 25 + "line": 48, + "column": 11 }, "end": { - "line": 29, - "column": 26 + "line": 48, + "column": 16 } } }, { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 881, - "end": 1343, + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 1493, + "end": 1496, "loc": { "start": { - "line": 31, - "column": 1 + "line": 48, + "column": 17 }, "end": { - "line": 43, - "column": 4 + "line": 48, + "column": 20 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7875,42 +11220,44 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 1346, - "end": 1348, + "value": "null", + "start": 1497, + "end": 1501, "loc": { "start": { - "line": 45, - "column": 1 + "line": 48, + "column": 21 }, "end": { - "line": 45, - "column": 3 + "line": 48, + "column": 25 } } }, { "type": { - "label": "(", + "label": "||", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 1, + "updateContext": null }, - "start": 1349, - "end": 1350, + "value": "||", + "start": 1502, + "end": 1504, "loc": { "start": { - "line": 45, - "column": 4 + "line": 48, + "column": 26 }, "end": { - "line": 45, - "column": 5 + "line": 48, + "column": 28 } } }, @@ -7926,44 +11273,43 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1350, - "end": 1351, + "value": "g", + "start": 1505, + "end": 1506, "loc": { "start": { - "line": 45, - "column": 5 + "line": 48, + "column": 29 }, "end": { - "line": 45, - "column": 6 + "line": 48, + "column": 30 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1352, - "end": 1355, + "start": 1506, + "end": 1507, "loc": { "start": { - "line": 45, - "column": 7 + "line": 48, + "column": 30 }, "end": { - "line": 45, - "column": 10 + "line": 48, + "column": 31 } } }, @@ -7979,17 +11325,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1356, - "end": 1357, + "value": "right", + "start": 1507, + "end": 1512, "loc": { "start": { - "line": 45, - "column": 11 + "line": 48, + "column": 31 }, "end": { - "line": 45, - "column": 12 + "line": 48, + "column": 36 } } }, @@ -8006,16 +11352,16 @@ "binop": null, "updateContext": null }, - "start": 1357, - "end": 1358, + "start": 1512, + "end": 1513, "loc": { "start": { - "line": 45, - "column": 12 + "line": 48, + "column": 36 }, "end": { - "line": 45, - "column": 13 + "line": 48, + "column": 37 } } }, @@ -8031,43 +11377,44 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1358, - "end": 1364, + "value": "_color", + "start": 1513, + "end": 1519, "loc": { "start": { - "line": 45, - "column": 13 + "line": 48, + "column": 37 }, "end": { - "line": 45, - "column": 19 + "line": 48, + "column": 43 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1364, - "end": 1365, + "value": "===", + "start": 1520, + "end": 1523, "loc": { "start": { - "line": 45, - "column": 19 + "line": 48, + "column": 44 }, "end": { - "line": 45, - "column": 20 + "line": 48, + "column": 47 } } }, @@ -8083,52 +11430,25 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1365, - "end": 1370, - "loc": { - "start": { - "line": 45, - "column": 20 - }, - "end": { - "line": 45, - "column": 25 - } - } - }, - { - "type": { - "label": "&&", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 2, - "updateContext": null - }, - "value": "&&", - "start": 1371, - "end": 1373, + "value": "BLACK", + "start": 1524, + "end": 1529, "loc": { "start": { - "line": 45, - "column": 26 + "line": 48, + "column": 48 }, "end": { - "line": 45, - "column": 28 + "line": 48, + "column": 53 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8136,24 +11456,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1374, - "end": 1375, + "start": 1529, + "end": 1530, "loc": { "start": { - "line": 45, - "column": 29 + "line": 48, + "column": 53 }, "end": { - "line": 45, - "column": 30 + "line": 48, + "column": 54 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -8163,16 +11482,16 @@ "binop": null, "updateContext": null }, - "start": 1375, - "end": 1376, + "start": 1530, + "end": 1531, "loc": { "start": { - "line": 45, - "column": 30 + "line": 48, + "column": 54 }, "end": { - "line": 45, - "column": 31 + "line": 48, + "column": 55 } } }, @@ -8188,44 +11507,42 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1376, - "end": 1382, + "value": "rotate_right", + "start": 1534, + "end": 1546, "loc": { "start": { - "line": 45, - "column": 31 + "line": 49, + "column": 2 }, "end": { - "line": 45, - "column": 37 + "line": 49, + "column": 14 } } }, { "type": { - "label": "==/!=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 1383, - "end": 1386, + "start": 1546, + "end": 1547, "loc": { "start": { - "line": 45, - "column": 38 + "line": 49, + "column": 14 }, "end": { - "line": 45, - "column": 41 + "line": 49, + "column": 15 } } }, @@ -8242,22 +11559,22 @@ "binop": null }, "value": "g", - "start": 1387, - "end": 1388, + "start": 1547, + "end": 1548, "loc": { "start": { - "line": 45, - "column": 42 + "line": 49, + "column": 15 }, "end": { - "line": 45, - "column": 43 + "line": 49, + "column": 16 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -8265,27 +11582,52 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "start": 1548, + "end": 1549, + "loc": { + "start": { + "line": 49, + "column": 16 + }, + "end": { + "line": 49, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "start": 1388, - "end": 1389, + "start": 1549, + "end": 1550, "loc": { "start": { - "line": 45, - "column": 43 + "line": 49, + "column": 17 }, "end": { - "line": 45, - "column": 44 + "line": 49, + "column": 18 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8293,42 +11635,44 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1389, - "end": 1393, + "start": 1552, + "end": 1553, "loc": { "start": { - "line": 45, - "column": 44 + "line": 50, + "column": 1 }, "end": { - "line": 45, - "column": 48 + "line": 50, + "column": 2 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "else", + "keyword": "else", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1393, - "end": 1394, + "value": "else", + "start": 1554, + "end": 1558, "loc": { "start": { - "line": 45, - "column": 48 + "line": 50, + "column": 3 }, "end": { - "line": 45, - "column": 49 + "line": 50, + "column": 7 } } }, @@ -8344,16 +11688,32 @@ "postfix": false, "binop": null }, - "start": 1395, - "end": 1396, + "start": 1559, + "end": 1560, "loc": { "start": { - "line": 45, - "column": 50 + "line": 50, + "column": 8 }, "end": { - "line": 45, - "column": 51 + "line": 50, + "column": 9 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", + "start": 1563, + "end": 1966, + "loc": { + "start": { + "line": 51, + "column": 2 + }, + "end": { + "line": 62, + "column": 5 } } }, @@ -8369,17 +11729,17 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 1399, - "end": 1410, + "value": "assert", + "start": 1969, + "end": 1975, "loc": { "start": { - "line": 46, + "line": 63, "column": 2 }, "end": { - "line": 46, - "column": 13 + "line": 63, + "column": 8 } } }, @@ -8395,16 +11755,16 @@ "postfix": false, "binop": null }, - "start": 1410, - "end": 1411, + "start": 1975, + "end": 1976, "loc": { "start": { - "line": 46, - "column": 13 + "line": 63, + "column": 8 }, "end": { - "line": 46, - "column": 14 + "line": 63, + "column": 9 } } }, @@ -8420,17 +11780,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1411, - "end": 1412, + "value": "g", + "start": 1976, + "end": 1977, "loc": { "start": { - "line": 46, - "column": 14 + "line": 63, + "column": 9 }, "end": { - "line": 46, - "column": 15 + "line": 63, + "column": 10 } } }, @@ -8447,16 +11807,16 @@ "binop": null, "updateContext": null }, - "start": 1412, - "end": 1413, + "start": 1977, + "end": 1978, "loc": { "start": { - "line": 46, - "column": 15 + "line": 63, + "column": 10 }, "end": { - "line": 46, - "column": 16 + "line": 63, + "column": 11 } } }, @@ -8472,106 +11832,77 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1413, - "end": 1419, + "value": "right", + "start": 1978, + "end": 1983, "loc": { "start": { - "line": 46, - "column": 16 + "line": 63, + "column": 11 }, "end": { - "line": 46, - "column": 22 + "line": 63, + "column": 16 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 1419, - "end": 1420, + "value": "instanceof", + "start": 1984, + "end": 1994, "loc": { "start": { - "line": 46, - "column": 22 + "line": 63, + "column": 17 }, "end": { - "line": 46, - "column": 23 + "line": 63, + "column": 27 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1420, - "end": 1421, - "loc": { - "start": { - "line": 46, - "column": 23 - }, - "end": { - "line": 46, - "column": 24 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1425, - "end": 1681, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 57, - "column": 5 - } - } - }, - { - "type": "CommentLine", - "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1685, - "end": 1762, + "value": "Node", + "start": 1995, + "end": 1999, "loc": { "start": { - "line": 59, - "column": 2 + "line": 63, + "column": 28 }, "end": { - "line": 59, - "column": 79 + "line": 63, + "column": 32 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -8581,23 +11912,22 @@ "postfix": false, "binop": null }, - "start": 1764, - "end": 1765, + "start": 1999, + "end": 2000, "loc": { "start": { - "line": 60, - "column": 1 + "line": 63, + "column": 32 }, "end": { - "line": 60, - "column": 2 + "line": 63, + "column": 33 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8608,45 +11938,42 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1766, - "end": 1770, + "start": 2000, + "end": 2001, "loc": { "start": { - "line": 60, - "column": 3 + "line": 63, + "column": 33 }, "end": { - "line": 60, - "column": 7 + "line": 63, + "column": 34 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1771, - "end": 1773, + "value": "assert", + "start": 2004, + "end": 2010, "loc": { "start": { - "line": 60, - "column": 8 + "line": 64, + "column": 2 }, "end": { - "line": 60, - "column": 10 + "line": 64, + "column": 8 } } }, @@ -8662,16 +11989,16 @@ "postfix": false, "binop": null }, - "start": 1774, - "end": 1775, + "start": 2010, + "end": 2011, "loc": { "start": { - "line": 60, - "column": 11 + "line": 64, + "column": 8 }, "end": { - "line": 60, - "column": 12 + "line": 64, + "column": 9 } } }, @@ -8688,16 +12015,16 @@ "binop": null }, "value": "n", - "start": 1775, - "end": 1776, + "start": 2011, + "end": 2012, "loc": { "start": { - "line": 60, - "column": 12 + "line": 64, + "column": 9 }, "end": { - "line": 60, - "column": 13 + "line": 64, + "column": 10 } } }, @@ -8715,16 +12042,16 @@ "updateContext": null }, "value": "===", - "start": 1777, - "end": 1780, + "start": 2013, + "end": 2016, "loc": { "start": { - "line": 60, - "column": 14 + "line": 64, + "column": 11 }, "end": { - "line": 60, - "column": 17 + "line": 64, + "column": 14 } } }, @@ -8740,17 +12067,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1781, - "end": 1782, + "value": "g", + "start": 2017, + "end": 2018, "loc": { "start": { - "line": 60, - "column": 18 + "line": 64, + "column": 15 }, "end": { - "line": 60, - "column": 19 + "line": 64, + "column": 16 } } }, @@ -8767,16 +12094,16 @@ "binop": null, "updateContext": null }, - "start": 1782, - "end": 1783, + "start": 2018, + "end": 2019, "loc": { "start": { - "line": 60, - "column": 19 + "line": 64, + "column": 16 }, "end": { - "line": 60, - "column": 20 + "line": 64, + "column": 17 } } }, @@ -8792,17 +12119,17 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1783, - "end": 1789, + "value": "right", + "start": 2019, + "end": 2024, "loc": { "start": { - "line": 60, - "column": 20 + "line": 64, + "column": 17 }, "end": { - "line": 60, - "column": 26 + "line": 64, + "column": 22 } } }, @@ -8819,16 +12146,16 @@ "binop": null, "updateContext": null }, - "start": 1789, - "end": 1790, + "start": 2024, + "end": 2025, "loc": { "start": { - "line": 60, - "column": 26 + "line": 64, + "column": 22 }, "end": { - "line": 60, - "column": 27 + "line": 64, + "column": 23 } } }, @@ -8844,52 +12171,25 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1790, - "end": 1794, - "loc": { - "start": { - "line": 60, - "column": 27 - }, - "end": { - "line": 60, - "column": 31 - } - } - }, - { - "type": { - "label": "&&", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 2, - "updateContext": null - }, - "value": "&&", - "start": 1795, - "end": 1797, + "value": "right", + "start": 2025, + "end": 2030, "loc": { "start": { - "line": 60, - "column": 32 + "line": 64, + "column": 23 }, "end": { - "line": 60, - "column": 34 + "line": 64, + "column": 28 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8897,24 +12197,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1798, - "end": 1799, + "start": 2030, + "end": 2031, "loc": { "start": { - "line": 60, - "column": 35 + "line": 64, + "column": 28 }, "end": { - "line": 60, - "column": 36 + "line": 64, + "column": 29 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -8924,16 +12223,16 @@ "binop": null, "updateContext": null }, - "start": 1799, - "end": 1800, + "start": 2031, + "end": 2032, "loc": { "start": { - "line": 60, - "column": 36 + "line": 64, + "column": 29 }, "end": { - "line": 60, - "column": 37 + "line": 64, + "column": 30 } } }, @@ -8949,44 +12248,42 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1800, - "end": 1806, + "value": "assert", + "start": 2035, + "end": 2041, "loc": { "start": { - "line": 60, - "column": 37 + "line": 65, + "column": 2 }, "end": { - "line": 60, - "column": 43 + "line": 65, + "column": 8 } } }, { "type": { - "label": "==/!=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 1807, - "end": 1810, + "start": 2041, + "end": 2042, "loc": { "start": { - "line": 60, - "column": 44 + "line": 65, + "column": 8 }, "end": { - "line": 60, - "column": 47 + "line": 65, + "column": 9 } } }, @@ -9003,16 +12300,16 @@ "binop": null }, "value": "g", - "start": 1811, - "end": 1812, + "start": 2042, + "end": 2043, "loc": { "start": { - "line": 60, - "column": 48 + "line": 65, + "column": 9 }, "end": { - "line": 60, - "column": 49 + "line": 65, + "column": 10 } } }, @@ -9029,16 +12326,16 @@ "binop": null, "updateContext": null }, - "start": 1812, - "end": 1813, + "start": 2043, + "end": 2044, "loc": { "start": { - "line": 60, - "column": 49 + "line": 65, + "column": 10 }, "end": { - "line": 60, - "column": 50 + "line": 65, + "column": 11 } } }, @@ -9054,83 +12351,99 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1813, - "end": 1818, + "value": "left", + "start": 2044, + "end": 2048, "loc": { "start": { - "line": 60, - "column": 50 + "line": 65, + "column": 11 }, "end": { - "line": 60, - "column": 55 + "line": 65, + "column": 15 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 1818, - "end": 1819, + "value": "===", + "start": 2049, + "end": 2052, "loc": { "start": { - "line": 60, - "column": 55 + "line": 65, + "column": 16 }, "end": { - "line": 60, - "column": 56 + "line": 65, + "column": 19 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "null", + "keyword": "null", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1820, - "end": 1821, + "value": "null", + "start": 2053, + "end": 2057, "loc": { "start": { - "line": 60, - "column": 57 + "line": 65, + "column": 20 }, "end": { - "line": 60, - "column": 58 + "line": 65, + "column": 24 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1824, - "end": 2325, + "type": { + "label": "||", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 1, + "updateContext": null + }, + "value": "||", + "start": 2058, + "end": 2060, "loc": { "start": { - "line": 61, - "column": 2 + "line": 65, + "column": 25 }, "end": { - "line": 73, - "column": 5 + "line": 65, + "column": 27 } } }, @@ -9146,42 +12459,43 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 2328, - "end": 2340, + "value": "g", + "start": 2061, + "end": 2062, "loc": { "start": { - "line": 74, - "column": 2 + "line": 65, + "column": 28 }, "end": { - "line": 74, - "column": 14 + "line": 65, + "column": 29 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2340, - "end": 2341, + "start": 2062, + "end": 2063, "loc": { "start": { - "line": 74, - "column": 14 + "line": 65, + "column": 29 }, "end": { - "line": 74, - "column": 15 + "line": 65, + "column": 30 } } }, @@ -9197,17 +12511,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 2341, - "end": 2342, + "value": "left", + "start": 2063, + "end": 2067, "loc": { "start": { - "line": 74, - "column": 15 + "line": 65, + "column": 30 }, "end": { - "line": 74, - "column": 16 + "line": 65, + "column": 34 } } }, @@ -9224,16 +12538,16 @@ "binop": null, "updateContext": null }, - "start": 2342, - "end": 2343, + "start": 2067, + "end": 2068, "loc": { "start": { - "line": 74, - "column": 16 + "line": 65, + "column": 34 }, "end": { - "line": 74, - "column": 17 + "line": 65, + "column": 35 } } }, @@ -9249,125 +12563,121 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 2343, - "end": 2349, + "value": "_color", + "start": 2068, + "end": 2074, "loc": { "start": { - "line": 74, - "column": 17 + "line": 65, + "column": 35 }, "end": { - "line": 74, - "column": 23 + "line": 65, + "column": 41 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 2349, - "end": 2350, + "value": "===", + "start": 2075, + "end": 2078, "loc": { "start": { - "line": 74, - "column": 23 + "line": 65, + "column": 42 }, "end": { - "line": 74, - "column": 24 + "line": 65, + "column": 45 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2350, - "end": 2351, - "loc": { - "start": { - "line": 74, - "column": 24 - }, - "end": { - "line": 74, - "column": 25 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 2355, - "end": 2583, + "value": "BLACK", + "start": 2079, + "end": 2084, "loc": { "start": { - "line": 76, - "column": 2 + "line": 65, + "column": 46 }, "end": { - "line": 84, - "column": 5 + "line": 65, + "column": 51 } } }, { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2587, - "end": 2603, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2084, + "end": 2085, "loc": { "start": { - "line": 86, - "column": 2 + "line": 65, + "column": 51 }, "end": { - "line": 86, - "column": 18 + "line": 65, + "column": 52 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2605, - "end": 2606, + "start": 2085, + "end": 2086, "loc": { "start": { - "line": 87, - "column": 1 + "line": 65, + "column": 52 }, "end": { - "line": 87, - "column": 2 + "line": 65, + "column": 53 } } }, @@ -9383,16 +12693,16 @@ "postfix": false, "binop": null }, - "value": "insert_case5", - "start": 2609, - "end": 2621, + "value": "rotate_left", + "start": 2089, + "end": 2100, "loc": { "start": { - "line": 89, - "column": 1 + "line": 66, + "column": 2 }, "end": { - "line": 89, + "line": 66, "column": 13 } } @@ -9409,15 +12719,15 @@ "postfix": false, "binop": null }, - "start": 2621, - "end": 2622, + "start": 2100, + "end": 2101, "loc": { "start": { - "line": 89, + "line": 66, "column": 13 }, "end": { - "line": 89, + "line": 66, "column": 14 } } @@ -9434,16 +12744,16 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 2622, - "end": 2623, + "value": "g", + "start": 2101, + "end": 2102, "loc": { "start": { - "line": 89, + "line": 66, "column": 14 }, "end": { - "line": 89, + "line": 66, "column": 15 } } @@ -9460,15 +12770,15 @@ "postfix": false, "binop": null }, - "start": 2623, - "end": 2624, + "start": 2102, + "end": 2103, "loc": { "start": { - "line": 89, + "line": 66, "column": 15 }, "end": { - "line": 89, + "line": 66, "column": 16 } } @@ -9486,15 +12796,15 @@ "binop": null, "updateContext": null }, - "start": 2624, - "end": 2625, + "start": 2103, + "end": 2104, "loc": { "start": { - "line": 89, + "line": 66, "column": 16 }, "end": { - "line": 89, + "line": 66, "column": 17 } } @@ -9511,15 +12821,40 @@ "postfix": false, "binop": null }, - "start": 2626, - "end": 2627, + "start": 2106, + "end": 2107, + "loc": { + "start": { + "line": 67, + "column": 1 + }, + "end": { + "line": 67, + "column": 2 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2108, + "end": 2109, "loc": { "start": { - "line": 90, + "line": 68, "column": 0 }, "end": { - "line": 90, + "line": 68, "column": 1 } } @@ -9537,15 +12872,15 @@ "binop": null, "updateContext": null }, - "start": 2627, - "end": 2628, + "start": 2109, + "end": 2110, "loc": { "start": { - "line": 90, + "line": 68, "column": 1 }, "end": { - "line": 90, + "line": 68, "column": 2 } } @@ -9565,15 +12900,15 @@ "updateContext": null }, "value": "export", - "start": 2630, - "end": 2636, + "start": 2112, + "end": 2118, "loc": { "start": { - "line": 92, + "line": 70, "column": 0 }, "end": { - "line": 92, + "line": 70, "column": 6 } } @@ -9593,15 +12928,15 @@ "updateContext": null }, "value": "default", - "start": 2637, - "end": 2644, + "start": 2119, + "end": 2126, "loc": { "start": { - "line": 92, + "line": 70, "column": 7 }, "end": { - "line": 92, + "line": 70, "column": 14 } } @@ -9619,15 +12954,15 @@ "binop": null }, "value": "insert_case4", - "start": 2645, - "end": 2657, + "start": 2127, + "end": 2139, "loc": { "start": { - "line": 92, + "line": 70, "column": 15 }, "end": { - "line": 92, + "line": 70, "column": 27 } } @@ -9645,15 +12980,15 @@ "binop": null, "updateContext": null }, - "start": 2657, - "end": 2658, + "start": 2139, + "end": 2140, "loc": { "start": { - "line": 92, + "line": 70, "column": 27 }, "end": { - "line": 92, + "line": 70, "column": 28 } } @@ -9671,15 +13006,15 @@ "binop": null, "updateContext": null }, - "start": 2659, - "end": 2659, + "start": 2141, + "end": 2141, "loc": { "start": { - "line": 93, + "line": 71, "column": 0 }, "end": { - "line": 93, + "line": 71, "column": 0 } } diff --git a/ast/source/insertion/insert_case5.js.json b/ast/source/insertion/insert_case5.js.json deleted file mode 100644 index 7ab7ea0..0000000 --- a/ast/source/insertion/insert_case5.js.json +++ /dev/null @@ -1,11607 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 2063, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 71, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 2063, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 71, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ImportDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "local": { - "type": "Identifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "assert" - }, - "name": "assert" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "extra": { - "rawValue": "assert", - "raw": "'assert'" - }, - "value": "assert" - } - }, - { - "type": "ImportDeclaration", - "start": 29, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 36 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 46, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 35 - } - }, - "extra": { - "rawValue": "../types/Node.js", - "raw": "'../types/Node.js'" - }, - "value": "../types/Node.js" - } - }, - { - "type": "ImportDeclaration", - "start": 66, - "end": 104, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 38 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 73, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 12 - } - }, - "local": { - "type": "Identifier", - "start": 73, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 12 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 84, - "end": 103, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 37 - } - }, - "extra": { - "rawValue": "../color/BLACK.js", - "raw": "'../color/BLACK.js'" - }, - "value": "../color/BLACK.js" - } - }, - { - "type": "ImportDeclaration", - "start": 105, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 34 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 112, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - }, - "local": { - "type": "Identifier", - "start": 112, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 121, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 33 - } - }, - "extra": { - "rawValue": "../color/RED.js", - "raw": "'../color/RED.js'" - }, - "value": "../color/RED.js" - } - }, - { - "type": "ImportDeclaration", - "start": 140, - "end": 191, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 51 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 147, - "end": 158, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 18 - } - }, - "local": { - "type": "Identifier", - "start": 147, - "end": 158, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 18 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 164, - "end": 190, - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 50 - } - }, - "extra": { - "rawValue": "../rotate/rotate_left.js", - "raw": "'../rotate/rotate_left.js'" - }, - "value": "../rotate/rotate_left.js" - } - }, - { - "type": "ImportDeclaration", - "start": 192, - "end": 245, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 53 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 199, - "end": 211, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 199, - "end": 211, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 19 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 217, - "end": 244, - "loc": { - "start": { - "line": 6, - "column": 25 - }, - "end": { - "line": 6, - "column": 52 - } - }, - "extra": { - "rawValue": "../rotate/rotate_right.js", - "raw": "'../rotate/rotate_right.js'" - }, - "value": "../rotate/rotate_right.js" - } - }, - { - "type": "ImportDeclaration", - "start": 246, - "end": 297, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 51 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 253, - "end": 264, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 18 - } - }, - "local": { - "type": "Identifier", - "start": 253, - "end": 264, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 18 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 270, - "end": 296, - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 50 - } - }, - "extra": { - "rawValue": "../family/grandparent.js", - "raw": "'../family/grandparent.js'" - }, - "value": "../family/grandparent.js" - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 299, - "end": 578, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 19, - "column": 3 - } - } - } - ] - }, - { - "type": "Identifier", - "start": 579, - "end": 2032, - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 68, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 585, - "end": 2031, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 68, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 585, - "end": 597, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 20, - "column": 18 - }, - "identifierName": "insert_case5" - }, - "name": "insert_case5", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 600, - "end": 2031, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 68, - "column": 1 - } - }, - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 601, - "end": 602, - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 607, - "end": 2031, - "loc": { - "start": { - "line": 20, - "column": 28 - }, - "end": { - "line": 68, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 610, - "end": 636, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 610, - "end": 635, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 610, - "end": 616, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 617, - "end": 634, - "loc": { - "start": { - "line": 21, - "column": 8 - }, - "end": { - "line": 21, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 617, - "end": 618, - "loc": { - "start": { - "line": 21, - "column": 8 - }, - "end": { - "line": 21, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 630, - "end": 634, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 638, - "end": 663, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 26 - } - }, - "expression": { - "type": "CallExpression", - "start": 638, - "end": 662, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 25 - } - }, - "callee": { - "type": "Identifier", - "start": 638, - "end": 644, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 645, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 24 - } - }, - "left": { - "type": "MemberExpression", - "start": 645, - "end": 653, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 645, - "end": 646, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 647, - "end": 653, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 658, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 24 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 665, - "end": 697, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 665, - "end": 696, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 665, - "end": 671, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 672, - "end": 695, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 672, - "end": 685, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 21 - } - }, - "object": { - "type": "MemberExpression", - "start": 672, - "end": 678, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 672, - "end": 673, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 674, - "end": 678, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 679, - "end": 685, - "loc": { - "start": { - "line": 23, - "column": 15 - }, - "end": { - "line": 23, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 690, - "end": 695, - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 31 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 699, - "end": 732, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 699, - "end": 731, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 33 - } - }, - "callee": { - "type": "Identifier", - "start": 699, - "end": 705, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 706, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 32 - } - }, - "left": { - "type": "MemberExpression", - "start": 706, - "end": 720, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 706, - "end": 713, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 706, - "end": 707, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 708, - "end": 713, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 15 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 714, - "end": 720, - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 725, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 27 - }, - "end": { - "line": 24, - "column": 32 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 734, - "end": 760, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 734, - "end": 759, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 734, - "end": 740, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 741, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 741, - "end": 749, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 741, - "end": 742, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 743, - "end": 749, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 16 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 754, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 25 - } - } - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 762, - "end": 794, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 762, - "end": 793, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 762, - "end": 768, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 769, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 769, - "end": 784, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 769, - "end": 777, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 769, - "end": 770, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 771, - "end": 777, - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 16 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 778, - "end": 784, - "loc": { - "start": { - "line": 26, - "column": 17 - }, - "end": { - "line": 26, - "column": 23 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 789, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 31 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ] - } - }, - { - "type": "VariableDeclaration", - "start": 796, - "end": 821, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 26 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 802, - "end": 820, - "loc": { - "start": { - "line": 27, - "column": 7 - }, - "end": { - "line": 27, - "column": 25 - } - }, - "id": { - "type": "Identifier", - "start": 802, - "end": 803, - "loc": { - "start": { - "line": 27, - "column": 7 - }, - "end": { - "line": 27, - "column": 8 - }, - "identifierName": "g" - }, - "name": "g" - }, - "init": { - "type": "CallExpression", - "start": 806, - "end": 820, - "loc": { - "start": { - "line": 27, - "column": 11 - }, - "end": { - "line": 27, - "column": 25 - } - }, - "callee": { - "type": "Identifier", - "start": 806, - "end": 817, - "loc": { - "start": { - "line": 27, - "column": 11 - }, - "end": { - "line": 27, - "column": 22 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" - }, - "arguments": [ - { - "type": "Identifier", - "start": 818, - "end": 819, - "loc": { - "start": { - "line": 27, - "column": 23 - }, - "end": { - "line": 27, - "column": 24 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 824, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 49 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 874, - "end": 898, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 25 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 874, - "end": 897, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 24 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 874, - "end": 889, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 874, - "end": 882, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 874, - "end": 875, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 2 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 876, - "end": 882, - "loc": { - "start": { - "line": 30, - "column": 3 - }, - "end": { - "line": 30, - "column": 9 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 883, - "end": 889, - "loc": { - "start": { - "line": 30, - "column": 10 - }, - "end": { - "line": 30, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 892, - "end": 897, - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 824, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 49 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 900, - "end": 915, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 16 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 900, - "end": 914, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 15 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 900, - "end": 908, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 900, - "end": 901, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 2 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 902, - "end": 908, - "loc": { - "start": { - "line": 31, - "column": 3 - }, - "end": { - "line": 31, - "column": 9 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 911, - "end": 914, - "loc": { - "start": { - "line": 31, - "column": 12 - }, - "end": { - "line": 31, - "column": 15 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - }, - { - "type": "IfStatement", - "start": 918, - "end": 2029, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 67, - "column": 2 - } - }, - "test": { - "type": "BinaryExpression", - "start": 922, - "end": 941, - "loc": { - "start": { - "line": 33, - "column": 5 - }, - "end": { - "line": 33, - "column": 24 - } - }, - "left": { - "type": "Identifier", - "start": 922, - "end": 923, - "loc": { - "start": { - "line": 33, - "column": 5 - }, - "end": { - "line": 33, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 928, - "end": 941, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 24 - } - }, - "object": { - "type": "MemberExpression", - "start": 928, - "end": 936, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 928, - "end": 929, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 930, - "end": 936, - "loc": { - "start": { - "line": 33, - "column": 13 - }, - "end": { - "line": 33, - "column": 19 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 937, - "end": 941, - "loc": { - "start": { - "line": 33, - "column": 20 - }, - "end": { - "line": 33, - "column": 24 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - }, - "consequent": { - "type": "BlockStatement", - "start": 943, - "end": 1494, - "loc": { - "start": { - "line": 33, - "column": 26 - }, - "end": { - "line": 50, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1376, - "end": 1407, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 1376, - "end": 1406, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 1376, - "end": 1382, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert", - "leadingComments": null - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1383, - "end": 1405, - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 46, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 1383, - "end": 1389, - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 46, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 1383, - "end": 1384, - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 46, - "column": 10 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1385, - "end": 1389, - "loc": { - "start": { - "line": 46, - "column": 11 - }, - "end": { - "line": 46, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 1401, - "end": 1405, - "loc": { - "start": { - "line": 46, - "column": 27 - }, - "end": { - "line": 46, - "column": 31 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 947, - "end": 1373, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 45, - "column": 5 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1410, - "end": 1436, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 1410, - "end": 1435, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 1410, - "end": 1416, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1417, - "end": 1434, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 26 - } - }, - "left": { - "type": "Identifier", - "start": 1417, - "end": 1418, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 10 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1423, - "end": 1434, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 26 - } - }, - "object": { - "type": "MemberExpression", - "start": 1423, - "end": 1429, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 21 - } - }, - "object": { - "type": "Identifier", - "start": 1423, - "end": 1424, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 16 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1425, - "end": 1429, - "loc": { - "start": { - "line": 47, - "column": 17 - }, - "end": { - "line": 47, - "column": 21 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1430, - "end": 1434, - "loc": { - "start": { - "line": 47, - "column": 22 - }, - "end": { - "line": 47, - "column": 26 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 1439, - "end": 1472, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 35 - } - }, - "expression": { - "type": "CallExpression", - "start": 1439, - "end": 1471, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 34 - } - }, - "callee": { - "type": "Identifier", - "start": 1439, - "end": 1445, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1446, - "end": 1470, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 33 - } - }, - "left": { - "type": "MemberExpression", - "start": 1446, - "end": 1460, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 1446, - "end": 1453, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 1446, - "end": 1447, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 10 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1448, - "end": 1453, - "loc": { - "start": { - "line": 48, - "column": 11 - }, - "end": { - "line": 48, - "column": 16 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1454, - "end": 1460, - "loc": { - "start": { - "line": 48, - "column": 17 - }, - "end": { - "line": 48, - "column": 23 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1465, - "end": 1470, - "loc": { - "start": { - "line": 48, - "column": 28 - }, - "end": { - "line": 48, - "column": 33 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 1475, - "end": 1491, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 18 - } - }, - "expression": { - "type": "CallExpression", - "start": 1475, - "end": 1490, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 17 - } - }, - "callee": { - "type": "Identifier", - "start": 1475, - "end": 1487, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 14 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - }, - "arguments": [ - { - "type": "Identifier", - "start": 1488, - "end": 1489, - "loc": { - "start": { - "line": 49, - "column": 15 - }, - "end": { - "line": 49, - "column": 16 - }, - "identifierName": "g" - }, - "name": "g" - } - ] - } - } - ], - "directives": [] - }, - "alternate": { - "type": "BlockStatement", - "start": 1500, - "end": 2029, - "loc": { - "start": { - "line": 50, - "column": 8 - }, - "end": { - "line": 67, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1910, - "end": 1942, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 1910, - "end": 1941, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 33 - } - }, - "callee": { - "type": "Identifier", - "start": 1910, - "end": 1916, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert", - "leadingComments": null - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1917, - "end": 1940, - "loc": { - "start": { - "line": 63, - "column": 9 - }, - "end": { - "line": 63, - "column": 32 - } - }, - "left": { - "type": "MemberExpression", - "start": 1917, - "end": 1924, - "loc": { - "start": { - "line": 63, - "column": 9 - }, - "end": { - "line": 63, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 1917, - "end": 1918, - "loc": { - "start": { - "line": 63, - "column": 9 - }, - "end": { - "line": 63, - "column": 10 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1919, - "end": 1924, - "loc": { - "start": { - "line": 63, - "column": 11 - }, - "end": { - "line": 63, - "column": 16 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 1936, - "end": 1940, - "loc": { - "start": { - "line": 63, - "column": 28 - }, - "end": { - "line": 63, - "column": 32 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 1504, - "end": 1907, - "loc": { - "start": { - "line": 51, - "column": 2 - }, - "end": { - "line": 62, - "column": 5 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1945, - "end": 1973, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 30 - } - }, - "expression": { - "type": "CallExpression", - "start": 1945, - "end": 1972, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 29 - } - }, - "callee": { - "type": "Identifier", - "start": 1945, - "end": 1951, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1952, - "end": 1971, - "loc": { - "start": { - "line": 64, - "column": 9 - }, - "end": { - "line": 64, - "column": 28 - } - }, - "left": { - "type": "Identifier", - "start": 1952, - "end": 1953, - "loc": { - "start": { - "line": 64, - "column": 9 - }, - "end": { - "line": 64, - "column": 10 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1958, - "end": 1971, - "loc": { - "start": { - "line": 64, - "column": 15 - }, - "end": { - "line": 64, - "column": 28 - } - }, - "object": { - "type": "MemberExpression", - "start": 1958, - "end": 1965, - "loc": { - "start": { - "line": 64, - "column": 15 - }, - "end": { - "line": 64, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 1958, - "end": 1959, - "loc": { - "start": { - "line": 64, - "column": 15 - }, - "end": { - "line": 64, - "column": 16 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1960, - "end": 1965, - "loc": { - "start": { - "line": 64, - "column": 17 - }, - "end": { - "line": 64, - "column": 22 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1966, - "end": 1971, - "loc": { - "start": { - "line": 64, - "column": 23 - }, - "end": { - "line": 64, - "column": 28 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 1976, - "end": 2008, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 1976, - "end": 2007, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 33 - } - }, - "callee": { - "type": "Identifier", - "start": 1976, - "end": 1982, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1983, - "end": 2006, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 32 - } - }, - "left": { - "type": "MemberExpression", - "start": 1983, - "end": 1996, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 1983, - "end": 1989, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 1983, - "end": 1984, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 10 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1985, - "end": 1989, - "loc": { - "start": { - "line": 65, - "column": 11 - }, - "end": { - "line": 65, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1990, - "end": 1996, - "loc": { - "start": { - "line": 65, - "column": 16 - }, - "end": { - "line": 65, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 2001, - "end": 2006, - "loc": { - "start": { - "line": 65, - "column": 27 - }, - "end": { - "line": 65, - "column": 32 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 2011, - "end": 2026, - "loc": { - "start": { - "line": 66, - "column": 2 - }, - "end": { - "line": 66, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 2011, - "end": 2025, - "loc": { - "start": { - "line": 66, - "column": 2 - }, - "end": { - "line": 66, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 2011, - "end": 2022, - "loc": { - "start": { - "line": 66, - "column": 2 - }, - "end": { - "line": 66, - "column": 13 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "Identifier", - "start": 2023, - "end": 2024, - "loc": { - "start": { - "line": 66, - "column": 14 - }, - "end": { - "line": 66, - "column": 15 - }, - "identifierName": "g" - }, - "name": "g" - } - ] - } - } - ], - "directives": [] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [], - "name": "_", - "trailingComments": [] - }, - { - "type": "Identifier", - "start": 2034, - "end": 2062, - "loc": { - "start": { - "line": 70, - "column": 0 - }, - "end": { - "line": 70, - "column": 28 - } - }, - "declaration": { - "type": "Identifier", - "start": 2049, - "end": 2061, - "loc": { - "start": { - "line": 70, - "column": 15 - }, - "end": { - "line": 70, - "column": 27 - }, - "identifierName": "insert_case5" - }, - "name": "insert_case5" - }, - "name": "_", - "leadingComments": [], - "trailingComments": [] - }, - { - "type": "ExportDefaultDeclaration", - "start": 2034, - "end": 2062, - "loc": { - "start": { - "line": 70, - "column": 0 - }, - "end": { - "line": 70, - "column": 28 - } - }, - "declaration": { - "type": "VariableDeclaration", - "start": 579, - "end": 2032, - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 68, - "column": 2 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 585, - "end": 2031, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 68, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 585, - "end": 597, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 20, - "column": 18 - }, - "identifierName": "insert_case5" - }, - "name": "insert_case5", - "leadingComments": null - }, - "init": { - "type": "ArrowFunctionExpression", - "start": 600, - "end": 2031, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 68, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 585, - "end": 597, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 20, - "column": 18 - }, - "identifierName": "insert_case5" - }, - "name": "insert_case5", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 601, - "end": 602, - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 23 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "body": { - "type": "BlockStatement", - "start": 607, - "end": 2031, - "loc": { - "start": { - "line": 20, - "column": 28 - }, - "end": { - "line": 68, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 610, - "end": 636, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 610, - "end": 635, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 610, - "end": 616, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 617, - "end": 634, - "loc": { - "start": { - "line": 21, - "column": 8 - }, - "end": { - "line": 21, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 617, - "end": 618, - "loc": { - "start": { - "line": 21, - "column": 8 - }, - "end": { - "line": 21, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 630, - "end": 634, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 638, - "end": 663, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 26 - } - }, - "expression": { - "type": "CallExpression", - "start": 638, - "end": 662, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 25 - } - }, - "callee": { - "type": "Identifier", - "start": 638, - "end": 644, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 645, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 24 - } - }, - "left": { - "type": "MemberExpression", - "start": 645, - "end": 653, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 645, - "end": 646, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 647, - "end": 653, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 658, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 24 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 665, - "end": 697, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 665, - "end": 696, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 665, - "end": 671, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 672, - "end": 695, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 672, - "end": 685, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 21 - } - }, - "object": { - "type": "MemberExpression", - "start": 672, - "end": 678, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 672, - "end": 673, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 674, - "end": 678, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 679, - "end": 685, - "loc": { - "start": { - "line": 23, - "column": 15 - }, - "end": { - "line": 23, - "column": 21 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 690, - "end": 695, - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 31 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 699, - "end": 732, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 699, - "end": 731, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 33 - } - }, - "callee": { - "type": "Identifier", - "start": 699, - "end": 705, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 706, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 32 - } - }, - "left": { - "type": "MemberExpression", - "start": 706, - "end": 720, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 706, - "end": 713, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 706, - "end": 707, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 708, - "end": 713, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 15 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 714, - "end": 720, - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 725, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 27 - }, - "end": { - "line": 24, - "column": 32 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 734, - "end": 760, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 27 - } - }, - "expression": { - "type": "CallExpression", - "start": 734, - "end": 759, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 26 - } - }, - "callee": { - "type": "Identifier", - "start": 734, - "end": 740, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 741, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 25 - } - }, - "left": { - "type": "MemberExpression", - "start": 741, - "end": 749, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 741, - "end": 742, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 743, - "end": 749, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 16 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 754, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 25 - } - } - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 762, - "end": 794, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 762, - "end": 793, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 762, - "end": 768, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 769, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 769, - "end": 784, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 769, - "end": 777, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 769, - "end": 770, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 9 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 771, - "end": 777, - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 16 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 778, - "end": 784, - "loc": { - "start": { - "line": 26, - "column": 17 - }, - "end": { - "line": 26, - "column": 23 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 789, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 31 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ] - } - }, - { - "type": "VariableDeclaration", - "start": 796, - "end": 821, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 26 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 802, - "end": 820, - "loc": { - "start": { - "line": 27, - "column": 7 - }, - "end": { - "line": 27, - "column": 25 - } - }, - "id": { - "type": "Identifier", - "start": 802, - "end": 803, - "loc": { - "start": { - "line": 27, - "column": 7 - }, - "end": { - "line": 27, - "column": 8 - }, - "identifierName": "g" - }, - "name": "g" - }, - "init": { - "type": "CallExpression", - "start": 806, - "end": 820, - "loc": { - "start": { - "line": 27, - "column": 11 - }, - "end": { - "line": 27, - "column": 25 - } - }, - "callee": { - "type": "Identifier", - "start": 806, - "end": 817, - "loc": { - "start": { - "line": 27, - "column": 11 - }, - "end": { - "line": 27, - "column": 22 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" - }, - "arguments": [ - { - "type": "Identifier", - "start": 818, - "end": 819, - "loc": { - "start": { - "line": 27, - "column": 23 - }, - "end": { - "line": 27, - "column": 24 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 824, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 49 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 874, - "end": 898, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 25 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 874, - "end": 897, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 24 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 874, - "end": 889, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 16 - } - }, - "object": { - "type": "MemberExpression", - "start": 874, - "end": 882, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 874, - "end": 875, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 2 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 876, - "end": 882, - "loc": { - "start": { - "line": 30, - "column": 3 - }, - "end": { - "line": 30, - "column": 9 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 883, - "end": 889, - "loc": { - "start": { - "line": 30, - "column": 10 - }, - "end": { - "line": 30, - "column": 16 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 892, - "end": 897, - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 24 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 824, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 49 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 900, - "end": 915, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 16 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 900, - "end": 914, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 15 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 900, - "end": 908, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 900, - "end": 901, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 2 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 902, - "end": 908, - "loc": { - "start": { - "line": 31, - "column": 3 - }, - "end": { - "line": 31, - "column": 9 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 911, - "end": 914, - "loc": { - "start": { - "line": 31, - "column": 12 - }, - "end": { - "line": 31, - "column": 15 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - }, - { - "type": "IfStatement", - "start": 918, - "end": 2029, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 67, - "column": 2 - } - }, - "test": { - "type": "BinaryExpression", - "start": 922, - "end": 941, - "loc": { - "start": { - "line": 33, - "column": 5 - }, - "end": { - "line": 33, - "column": 24 - } - }, - "left": { - "type": "Identifier", - "start": 922, - "end": 923, - "loc": { - "start": { - "line": 33, - "column": 5 - }, - "end": { - "line": 33, - "column": 6 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 928, - "end": 941, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 24 - } - }, - "object": { - "type": "MemberExpression", - "start": 928, - "end": 936, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 928, - "end": 929, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 930, - "end": 936, - "loc": { - "start": { - "line": 33, - "column": 13 - }, - "end": { - "line": 33, - "column": 19 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 937, - "end": 941, - "loc": { - "start": { - "line": 33, - "column": 20 - }, - "end": { - "line": 33, - "column": 24 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - }, - "consequent": { - "type": "BlockStatement", - "start": 943, - "end": 1494, - "loc": { - "start": { - "line": 33, - "column": 26 - }, - "end": { - "line": 50, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1376, - "end": 1407, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 33 - } - }, - "expression": { - "type": "CallExpression", - "start": 1376, - "end": 1406, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 32 - } - }, - "callee": { - "type": "Identifier", - "start": 1376, - "end": 1382, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert", - "leadingComments": null - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1383, - "end": 1405, - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 46, - "column": 31 - } - }, - "left": { - "type": "MemberExpression", - "start": 1383, - "end": 1389, - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 46, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 1383, - "end": 1384, - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 46, - "column": 10 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1385, - "end": 1389, - "loc": { - "start": { - "line": 46, - "column": 11 - }, - "end": { - "line": 46, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 1401, - "end": 1405, - "loc": { - "start": { - "line": 46, - "column": 27 - }, - "end": { - "line": 46, - "column": 31 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 947, - "end": 1373, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 45, - "column": 5 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1410, - "end": 1436, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 28 - } - }, - "expression": { - "type": "CallExpression", - "start": 1410, - "end": 1435, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 1410, - "end": 1416, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1417, - "end": 1434, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 26 - } - }, - "left": { - "type": "Identifier", - "start": 1417, - "end": 1418, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 10 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1423, - "end": 1434, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 26 - } - }, - "object": { - "type": "MemberExpression", - "start": 1423, - "end": 1429, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 21 - } - }, - "object": { - "type": "Identifier", - "start": 1423, - "end": 1424, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 16 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1425, - "end": 1429, - "loc": { - "start": { - "line": 47, - "column": 17 - }, - "end": { - "line": 47, - "column": 21 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1430, - "end": 1434, - "loc": { - "start": { - "line": 47, - "column": 22 - }, - "end": { - "line": 47, - "column": 26 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 1439, - "end": 1472, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 35 - } - }, - "expression": { - "type": "CallExpression", - "start": 1439, - "end": 1471, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 34 - } - }, - "callee": { - "type": "Identifier", - "start": 1439, - "end": 1445, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1446, - "end": 1470, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 33 - } - }, - "left": { - "type": "MemberExpression", - "start": 1446, - "end": 1460, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 1446, - "end": 1453, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 1446, - "end": 1447, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 10 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1448, - "end": 1453, - "loc": { - "start": { - "line": 48, - "column": 11 - }, - "end": { - "line": 48, - "column": 16 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1454, - "end": 1460, - "loc": { - "start": { - "line": 48, - "column": 17 - }, - "end": { - "line": 48, - "column": 23 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1465, - "end": 1470, - "loc": { - "start": { - "line": 48, - "column": 28 - }, - "end": { - "line": 48, - "column": 33 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 1475, - "end": 1491, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 18 - } - }, - "expression": { - "type": "CallExpression", - "start": 1475, - "end": 1490, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 17 - } - }, - "callee": { - "type": "Identifier", - "start": 1475, - "end": 1487, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 14 - }, - "identifierName": "rotate_right" - }, - "name": "rotate_right" - }, - "arguments": [ - { - "type": "Identifier", - "start": 1488, - "end": 1489, - "loc": { - "start": { - "line": 49, - "column": 15 - }, - "end": { - "line": 49, - "column": 16 - }, - "identifierName": "g" - }, - "name": "g" - } - ] - } - } - ], - "directives": [] - }, - "alternate": { - "type": "BlockStatement", - "start": 1500, - "end": 2029, - "loc": { - "start": { - "line": 50, - "column": 8 - }, - "end": { - "line": 67, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1910, - "end": 1942, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 1910, - "end": 1941, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 33 - } - }, - "callee": { - "type": "Identifier", - "start": 1910, - "end": 1916, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert", - "leadingComments": null - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1917, - "end": 1940, - "loc": { - "start": { - "line": 63, - "column": 9 - }, - "end": { - "line": 63, - "column": 32 - } - }, - "left": { - "type": "MemberExpression", - "start": 1917, - "end": 1924, - "loc": { - "start": { - "line": 63, - "column": 9 - }, - "end": { - "line": 63, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 1917, - "end": 1918, - "loc": { - "start": { - "line": 63, - "column": 9 - }, - "end": { - "line": 63, - "column": 10 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1919, - "end": 1924, - "loc": { - "start": { - "line": 63, - "column": 11 - }, - "end": { - "line": 63, - "column": 16 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 1936, - "end": 1940, - "loc": { - "start": { - "line": 63, - "column": 28 - }, - "end": { - "line": 63, - "column": 32 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 1504, - "end": 1907, - "loc": { - "start": { - "line": 51, - "column": 2 - }, - "end": { - "line": 62, - "column": 5 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1945, - "end": 1973, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 30 - } - }, - "expression": { - "type": "CallExpression", - "start": 1945, - "end": 1972, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 29 - } - }, - "callee": { - "type": "Identifier", - "start": 1945, - "end": 1951, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1952, - "end": 1971, - "loc": { - "start": { - "line": 64, - "column": 9 - }, - "end": { - "line": 64, - "column": 28 - } - }, - "left": { - "type": "Identifier", - "start": 1952, - "end": 1953, - "loc": { - "start": { - "line": 64, - "column": 9 - }, - "end": { - "line": 64, - "column": 10 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1958, - "end": 1971, - "loc": { - "start": { - "line": 64, - "column": 15 - }, - "end": { - "line": 64, - "column": 28 - } - }, - "object": { - "type": "MemberExpression", - "start": 1958, - "end": 1965, - "loc": { - "start": { - "line": 64, - "column": 15 - }, - "end": { - "line": 64, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 1958, - "end": 1959, - "loc": { - "start": { - "line": 64, - "column": 15 - }, - "end": { - "line": 64, - "column": 16 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1960, - "end": 1965, - "loc": { - "start": { - "line": 64, - "column": 17 - }, - "end": { - "line": 64, - "column": 22 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1966, - "end": 1971, - "loc": { - "start": { - "line": 64, - "column": 23 - }, - "end": { - "line": 64, - "column": 28 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 1976, - "end": 2008, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 34 - } - }, - "expression": { - "type": "CallExpression", - "start": 1976, - "end": 2007, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 33 - } - }, - "callee": { - "type": "Identifier", - "start": 1976, - "end": 1982, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1983, - "end": 2006, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 32 - } - }, - "left": { - "type": "MemberExpression", - "start": 1983, - "end": 1996, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 1983, - "end": 1989, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 1983, - "end": 1984, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 10 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1985, - "end": 1989, - "loc": { - "start": { - "line": 65, - "column": 11 - }, - "end": { - "line": 65, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1990, - "end": 1996, - "loc": { - "start": { - "line": 65, - "column": 16 - }, - "end": { - "line": 65, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 2001, - "end": 2006, - "loc": { - "start": { - "line": 65, - "column": 27 - }, - "end": { - "line": 65, - "column": 32 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 2011, - "end": 2026, - "loc": { - "start": { - "line": 66, - "column": 2 - }, - "end": { - "line": 66, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 2011, - "end": 2025, - "loc": { - "start": { - "line": 66, - "column": 2 - }, - "end": { - "line": 66, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 2011, - "end": 2022, - "loc": { - "start": { - "line": 66, - "column": 2 - }, - "end": { - "line": 66, - "column": 13 - }, - "identifierName": "rotate_left" - }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "Identifier", - "start": 2023, - "end": 2024, - "loc": { - "start": { - "line": 66, - "column": 14 - }, - "end": { - "line": 66, - "column": 15 - }, - "identifierName": "g" - }, - "name": "g" - } - ] - } - } - ], - "directives": [] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 299, - "end": 578, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 19, - "column": 3 - } - } - } - ], - "trailingComments": [] - } - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 299, - "end": 578, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 19, - "column": 3 - } - } - }, - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 824, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 49 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 947, - "end": 1373, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 45, - "column": 5 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 1504, - "end": 1907, - "loc": { - "start": { - "line": 51, - "column": 2 - }, - "end": { - "line": 62, - "column": 5 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 46, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 66, - "end": 72, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 73, - "end": 78, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 79, - "end": 83, - "loc": { - "start": { - "line": 3, - "column": 13 - }, - "end": { - "line": 3, - "column": 17 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/BLACK.js", - "start": 84, - "end": 103, - "loc": { - "start": { - "line": 3, - "column": 18 - }, - "end": { - "line": 3, - "column": 37 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 103, - "end": 104, - "loc": { - "start": { - "line": 3, - "column": 37 - }, - "end": { - "line": 3, - "column": 38 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 105, - "end": 111, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 4, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 112, - "end": 115, - "loc": { - "start": { - "line": 4, - "column": 7 - }, - "end": { - "line": 4, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 116, - "end": 120, - "loc": { - "start": { - "line": 4, - "column": 11 - }, - "end": { - "line": 4, - "column": 15 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/RED.js", - "start": 121, - "end": 138, - "loc": { - "start": { - "line": 4, - "column": 16 - }, - "end": { - "line": 4, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 138, - "end": 139, - "loc": { - "start": { - "line": 4, - "column": 33 - }, - "end": { - "line": 4, - "column": 34 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 140, - "end": 146, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 5, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_left", - "start": 147, - "end": 158, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 159, - "end": 163, - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../rotate/rotate_left.js", - "start": 164, - "end": 190, - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 50 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 190, - "end": 191, - "loc": { - "start": { - "line": 5, - "column": 50 - }, - "end": { - "line": 5, - "column": 51 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 192, - "end": 198, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_right", - "start": 199, - "end": 211, - "loc": { - "start": { - "line": 6, - "column": 7 - }, - "end": { - "line": 6, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 212, - "end": 216, - "loc": { - "start": { - "line": 6, - "column": 20 - }, - "end": { - "line": 6, - "column": 24 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../rotate/rotate_right.js", - "start": 217, - "end": 244, - "loc": { - "start": { - "line": 6, - "column": 25 - }, - "end": { - "line": 6, - "column": 52 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 244, - "end": 245, - "loc": { - "start": { - "line": 6, - "column": 52 - }, - "end": { - "line": 6, - "column": 53 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 246, - "end": 252, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "grandparent", - "start": 253, - "end": 264, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 265, - "end": 269, - "loc": { - "start": { - "line": 7, - "column": 19 - }, - "end": { - "line": 7, - "column": 23 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../family/grandparent.js", - "start": 270, - "end": 296, - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 50 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 296, - "end": 297, - "loc": { - "start": { - "line": 7, - "column": 50 - }, - "end": { - "line": 7, - "column": 51 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", - "start": 299, - "end": 578, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 19, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 579, - "end": 584, - "loc": { - "start": { - "line": 20, - "column": 0 - }, - "end": { - "line": 20, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "insert_case5", - "start": 585, - "end": 597, - "loc": { - "start": { - "line": 20, - "column": 6 - }, - "end": { - "line": 20, - "column": 18 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 598, - "end": 599, - "loc": { - "start": { - "line": 20, - "column": 19 - }, - "end": { - "line": 20, - "column": 20 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 600, - "end": 601, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 22 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 601, - "end": 602, - "loc": { - "start": { - "line": 20, - "column": 22 - }, - "end": { - "line": 20, - "column": 23 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 602, - "end": 603, - "loc": { - "start": { - "line": 20, - "column": 23 - }, - "end": { - "line": 20, - "column": 24 - } - } - }, - { - "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 604, - "end": 606, - "loc": { - "start": { - "line": 20, - "column": 25 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 607, - "end": 608, - "loc": { - "start": { - "line": 20, - "column": 28 - }, - "end": { - "line": 20, - "column": 29 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 610, - "end": 616, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 616, - "end": 617, - "loc": { - "start": { - "line": 21, - "column": 7 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 617, - "end": 618, - "loc": { - "start": { - "line": 21, - "column": 8 - }, - "end": { - "line": 21, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 619, - "end": 629, - "loc": { - "start": { - "line": 21, - "column": 10 - }, - "end": { - "line": 21, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 630, - "end": 634, - "loc": { - "start": { - "line": 21, - "column": 21 - }, - "end": { - "line": 21, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 634, - "end": 635, - "loc": { - "start": { - "line": 21, - "column": 25 - }, - "end": { - "line": 21, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 635, - "end": 636, - "loc": { - "start": { - "line": 21, - "column": 26 - }, - "end": { - "line": 21, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 638, - "end": 644, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 644, - "end": 645, - "loc": { - "start": { - "line": 22, - "column": 7 - }, - "end": { - "line": 22, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 645, - "end": 646, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 646, - "end": 647, - "loc": { - "start": { - "line": 22, - "column": 9 - }, - "end": { - "line": 22, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 647, - "end": 653, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 654, - "end": 657, - "loc": { - "start": { - "line": 22, - "column": 17 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 658, - "end": 661, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 24 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 661, - "end": 662, - "loc": { - "start": { - "line": 22, - "column": 24 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 662, - "end": 663, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 26 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 665, - "end": 671, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 671, - "end": 672, - "loc": { - "start": { - "line": 23, - "column": 7 - }, - "end": { - "line": 23, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 672, - "end": 673, - "loc": { - "start": { - "line": 23, - "column": 8 - }, - "end": { - "line": 23, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 673, - "end": 674, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 674, - "end": 678, - "loc": { - "start": { - "line": 23, - "column": 10 - }, - "end": { - "line": 23, - "column": 14 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 678, - "end": 679, - "loc": { - "start": { - "line": 23, - "column": 14 - }, - "end": { - "line": 23, - "column": 15 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 679, - "end": 685, - "loc": { - "start": { - "line": 23, - "column": 15 - }, - "end": { - "line": 23, - "column": 21 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 686, - "end": 689, - "loc": { - "start": { - "line": 23, - "column": 22 - }, - "end": { - "line": 23, - "column": 25 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 690, - "end": 695, - "loc": { - "start": { - "line": 23, - "column": 26 - }, - "end": { - "line": 23, - "column": 31 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 695, - "end": 696, - "loc": { - "start": { - "line": 23, - "column": 31 - }, - "end": { - "line": 23, - "column": 32 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 696, - "end": 697, - "loc": { - "start": { - "line": 23, - "column": 32 - }, - "end": { - "line": 23, - "column": 33 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 699, - "end": 705, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 705, - "end": 706, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 706, - "end": 707, - "loc": { - "start": { - "line": 24, - "column": 8 - }, - "end": { - "line": 24, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 707, - "end": 708, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 708, - "end": 713, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 15 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 713, - "end": 714, - "loc": { - "start": { - "line": 24, - "column": 15 - }, - "end": { - "line": 24, - "column": 16 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 714, - "end": 720, - "loc": { - "start": { - "line": 24, - "column": 16 - }, - "end": { - "line": 24, - "column": 22 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 721, - "end": 724, - "loc": { - "start": { - "line": 24, - "column": 23 - }, - "end": { - "line": 24, - "column": 26 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 725, - "end": 730, - "loc": { - "start": { - "line": 24, - "column": 27 - }, - "end": { - "line": 24, - "column": 32 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 730, - "end": 731, - "loc": { - "start": { - "line": 24, - "column": 32 - }, - "end": { - "line": 24, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 731, - "end": 732, - "loc": { - "start": { - "line": 24, - "column": 33 - }, - "end": { - "line": 24, - "column": 34 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 734, - "end": 740, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 740, - "end": 741, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 741, - "end": 742, - "loc": { - "start": { - "line": 25, - "column": 8 - }, - "end": { - "line": 25, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 742, - "end": 743, - "loc": { - "start": { - "line": 25, - "column": 9 - }, - "end": { - "line": 25, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 743, - "end": 749, - "loc": { - "start": { - "line": 25, - "column": 10 - }, - "end": { - "line": 25, - "column": 16 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "!==", - "start": 750, - "end": 753, - "loc": { - "start": { - "line": 25, - "column": 17 - }, - "end": { - "line": 25, - "column": 20 - } - } - }, - { - "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "null", - "start": 754, - "end": 758, - "loc": { - "start": { - "line": 25, - "column": 21 - }, - "end": { - "line": 25, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 758, - "end": 759, - "loc": { - "start": { - "line": 25, - "column": 25 - }, - "end": { - "line": 25, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 759, - "end": 760, - "loc": { - "start": { - "line": 25, - "column": 26 - }, - "end": { - "line": 25, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 762, - "end": 768, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 768, - "end": 769, - "loc": { - "start": { - "line": 26, - "column": 7 - }, - "end": { - "line": 26, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 769, - "end": 770, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 770, - "end": 771, - "loc": { - "start": { - "line": 26, - "column": 9 - }, - "end": { - "line": 26, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 771, - "end": 777, - "loc": { - "start": { - "line": 26, - "column": 10 - }, - "end": { - "line": 26, - "column": 16 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 777, - "end": 778, - "loc": { - "start": { - "line": 26, - "column": 16 - }, - "end": { - "line": 26, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 778, - "end": 784, - "loc": { - "start": { - "line": 26, - "column": 17 - }, - "end": { - "line": 26, - "column": 23 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 785, - "end": 788, - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 789, - "end": 792, - "loc": { - "start": { - "line": 26, - "column": 28 - }, - "end": { - "line": 26, - "column": 31 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 792, - "end": 793, - "loc": { - "start": { - "line": 26, - "column": 31 - }, - "end": { - "line": 26, - "column": 32 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 793, - "end": 794, - "loc": { - "start": { - "line": 26, - "column": 32 - }, - "end": { - "line": 26, - "column": 33 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 796, - "end": 801, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 802, - "end": 803, - "loc": { - "start": { - "line": 27, - "column": 7 - }, - "end": { - "line": 27, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 804, - "end": 805, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "grandparent", - "start": 806, - "end": 817, - "loc": { - "start": { - "line": 27, - "column": 11 - }, - "end": { - "line": 27, - "column": 22 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 817, - "end": 818, - "loc": { - "start": { - "line": 27, - "column": 22 - }, - "end": { - "line": 27, - "column": 23 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 818, - "end": 819, - "loc": { - "start": { - "line": 27, - "column": 23 - }, - "end": { - "line": 27, - "column": 24 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 819, - "end": 820, - "loc": { - "start": { - "line": 27, - "column": 24 - }, - "end": { - "line": 27, - "column": 25 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 820, - "end": 821, - "loc": { - "start": { - "line": 27, - "column": 25 - }, - "end": { - "line": 27, - "column": 26 - } - } - }, - { - "type": "CommentLine", - "value": " Repaint n's parent black, n's grandparent red", - "start": 824, - "end": 872, - "loc": { - "start": { - "line": 29, - "column": 1 - }, - "end": { - "line": 29, - "column": 49 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 874, - "end": 875, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 2 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 875, - "end": 876, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 30, - "column": 3 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 876, - "end": 882, - "loc": { - "start": { - "line": 30, - "column": 3 - }, - "end": { - "line": 30, - "column": 9 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 882, - "end": 883, - "loc": { - "start": { - "line": 30, - "column": 9 - }, - "end": { - "line": 30, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 883, - "end": 889, - "loc": { - "start": { - "line": 30, - "column": 10 - }, - "end": { - "line": 30, - "column": 16 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 890, - "end": 891, - "loc": { - "start": { - "line": 30, - "column": 17 - }, - "end": { - "line": 30, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 892, - "end": 897, - "loc": { - "start": { - "line": 30, - "column": 19 - }, - "end": { - "line": 30, - "column": 24 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 897, - "end": 898, - "loc": { - "start": { - "line": 30, - "column": 24 - }, - "end": { - "line": 30, - "column": 25 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 900, - "end": 901, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 2 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 901, - "end": 902, - "loc": { - "start": { - "line": 31, - "column": 2 - }, - "end": { - "line": 31, - "column": 3 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 902, - "end": 908, - "loc": { - "start": { - "line": 31, - "column": 3 - }, - "end": { - "line": 31, - "column": 9 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 909, - "end": 910, - "loc": { - "start": { - "line": 31, - "column": 10 - }, - "end": { - "line": 31, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "RED", - "start": 911, - "end": 914, - "loc": { - "start": { - "line": 31, - "column": 12 - }, - "end": { - "line": 31, - "column": 15 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 914, - "end": 915, - "loc": { - "start": { - "line": 31, - "column": 15 - }, - "end": { - "line": 31, - "column": 16 - } - } - }, - { - "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "if", - "start": 918, - "end": 920, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 3 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 921, - "end": 922, - "loc": { - "start": { - "line": 33, - "column": 4 - }, - "end": { - "line": 33, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 922, - "end": 923, - "loc": { - "start": { - "line": 33, - "column": 5 - }, - "end": { - "line": 33, - "column": 6 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 924, - "end": 927, - "loc": { - "start": { - "line": 33, - "column": 7 - }, - "end": { - "line": 33, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 928, - "end": 929, - "loc": { - "start": { - "line": 33, - "column": 11 - }, - "end": { - "line": 33, - "column": 12 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 929, - "end": 930, - "loc": { - "start": { - "line": 33, - "column": 12 - }, - "end": { - "line": 33, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 930, - "end": 936, - "loc": { - "start": { - "line": 33, - "column": 13 - }, - "end": { - "line": 33, - "column": 19 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 936, - "end": 937, - "loc": { - "start": { - "line": 33, - "column": 19 - }, - "end": { - "line": 33, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 937, - "end": 941, - "loc": { - "start": { - "line": 33, - "column": 20 - }, - "end": { - "line": 33, - "column": 24 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 941, - "end": 942, - "loc": { - "start": { - "line": 33, - "column": 24 - }, - "end": { - "line": 33, - "column": 25 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 943, - "end": 944, - "loc": { - "start": { - "line": 33, - "column": 26 - }, - "end": { - "line": 33, - "column": 27 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 947, - "end": 1373, - "loc": { - "start": { - "line": 34, - "column": 2 - }, - "end": { - "line": 45, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 1376, - "end": 1382, - "loc": { - "start": { - "line": 46, - "column": 2 - }, - "end": { - "line": 46, - "column": 8 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1382, - "end": 1383, - "loc": { - "start": { - "line": 46, - "column": 8 - }, - "end": { - "line": 46, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 1383, - "end": 1384, - "loc": { - "start": { - "line": 46, - "column": 9 - }, - "end": { - "line": 46, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1384, - "end": 1385, - "loc": { - "start": { - "line": 46, - "column": 10 - }, - "end": { - "line": 46, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1385, - "end": 1389, - "loc": { - "start": { - "line": 46, - "column": 11 - }, - "end": { - "line": 46, - "column": 15 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 1390, - "end": 1400, - "loc": { - "start": { - "line": 46, - "column": 16 - }, - "end": { - "line": 46, - "column": 26 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 1401, - "end": 1405, - "loc": { - "start": { - "line": 46, - "column": 27 - }, - "end": { - "line": 46, - "column": 31 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1405, - "end": 1406, - "loc": { - "start": { - "line": 46, - "column": 31 - }, - "end": { - "line": 46, - "column": 32 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1406, - "end": 1407, - "loc": { - "start": { - "line": 46, - "column": 32 - }, - "end": { - "line": 46, - "column": 33 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 1410, - "end": 1416, - "loc": { - "start": { - "line": 47, - "column": 2 - }, - "end": { - "line": 47, - "column": 8 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1416, - "end": 1417, - "loc": { - "start": { - "line": 47, - "column": 8 - }, - "end": { - "line": 47, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1417, - "end": 1418, - "loc": { - "start": { - "line": 47, - "column": 9 - }, - "end": { - "line": 47, - "column": 10 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1419, - "end": 1422, - "loc": { - "start": { - "line": 47, - "column": 11 - }, - "end": { - "line": 47, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 1423, - "end": 1424, - "loc": { - "start": { - "line": 47, - "column": 15 - }, - "end": { - "line": 47, - "column": 16 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1424, - "end": 1425, - "loc": { - "start": { - "line": 47, - "column": 16 - }, - "end": { - "line": 47, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1425, - "end": 1429, - "loc": { - "start": { - "line": 47, - "column": 17 - }, - "end": { - "line": 47, - "column": 21 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1429, - "end": 1430, - "loc": { - "start": { - "line": 47, - "column": 21 - }, - "end": { - "line": 47, - "column": 22 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1430, - "end": 1434, - "loc": { - "start": { - "line": 47, - "column": 22 - }, - "end": { - "line": 47, - "column": 26 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1434, - "end": 1435, - "loc": { - "start": { - "line": 47, - "column": 26 - }, - "end": { - "line": 47, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1435, - "end": 1436, - "loc": { - "start": { - "line": 47, - "column": 27 - }, - "end": { - "line": 47, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 1439, - "end": 1445, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 8 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1445, - "end": 1446, - "loc": { - "start": { - "line": 48, - "column": 8 - }, - "end": { - "line": 48, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 1446, - "end": 1447, - "loc": { - "start": { - "line": 48, - "column": 9 - }, - "end": { - "line": 48, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1447, - "end": 1448, - "loc": { - "start": { - "line": 48, - "column": 10 - }, - "end": { - "line": 48, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 1448, - "end": 1453, - "loc": { - "start": { - "line": 48, - "column": 11 - }, - "end": { - "line": 48, - "column": 16 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1453, - "end": 1454, - "loc": { - "start": { - "line": 48, - "column": 16 - }, - "end": { - "line": 48, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1454, - "end": 1460, - "loc": { - "start": { - "line": 48, - "column": 17 - }, - "end": { - "line": 48, - "column": 23 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1461, - "end": 1464, - "loc": { - "start": { - "line": 48, - "column": 24 - }, - "end": { - "line": 48, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 1465, - "end": 1470, - "loc": { - "start": { - "line": 48, - "column": 28 - }, - "end": { - "line": 48, - "column": 33 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1470, - "end": 1471, - "loc": { - "start": { - "line": 48, - "column": 33 - }, - "end": { - "line": 48, - "column": 34 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1471, - "end": 1472, - "loc": { - "start": { - "line": 48, - "column": 34 - }, - "end": { - "line": 48, - "column": 35 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_right", - "start": 1475, - "end": 1487, - "loc": { - "start": { - "line": 49, - "column": 2 - }, - "end": { - "line": 49, - "column": 14 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1487, - "end": 1488, - "loc": { - "start": { - "line": 49, - "column": 14 - }, - "end": { - "line": 49, - "column": 15 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 1488, - "end": 1489, - "loc": { - "start": { - "line": 49, - "column": 15 - }, - "end": { - "line": 49, - "column": 16 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1489, - "end": 1490, - "loc": { - "start": { - "line": 49, - "column": 16 - }, - "end": { - "line": 49, - "column": 17 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1490, - "end": 1491, - "loc": { - "start": { - "line": 49, - "column": 17 - }, - "end": { - "line": 49, - "column": 18 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1493, - "end": 1494, - "loc": { - "start": { - "line": 50, - "column": 1 - }, - "end": { - "line": 50, - "column": 2 - } - } - }, - { - "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "else", - "start": 1495, - "end": 1499, - "loc": { - "start": { - "line": 50, - "column": 3 - }, - "end": { - "line": 50, - "column": 7 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1500, - "end": 1501, - "loc": { - "start": { - "line": 50, - "column": 8 - }, - "end": { - "line": 50, - "column": 9 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 1504, - "end": 1907, - "loc": { - "start": { - "line": 51, - "column": 2 - }, - "end": { - "line": 62, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 1910, - "end": 1916, - "loc": { - "start": { - "line": 63, - "column": 2 - }, - "end": { - "line": 63, - "column": 8 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1916, - "end": 1917, - "loc": { - "start": { - "line": 63, - "column": 8 - }, - "end": { - "line": 63, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 1917, - "end": 1918, - "loc": { - "start": { - "line": 63, - "column": 9 - }, - "end": { - "line": 63, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1918, - "end": 1919, - "loc": { - "start": { - "line": 63, - "column": 10 - }, - "end": { - "line": 63, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 1919, - "end": 1924, - "loc": { - "start": { - "line": 63, - "column": 11 - }, - "end": { - "line": 63, - "column": 16 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 1925, - "end": 1935, - "loc": { - "start": { - "line": 63, - "column": 17 - }, - "end": { - "line": 63, - "column": 27 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 1936, - "end": 1940, - "loc": { - "start": { - "line": 63, - "column": 28 - }, - "end": { - "line": 63, - "column": 32 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1940, - "end": 1941, - "loc": { - "start": { - "line": 63, - "column": 32 - }, - "end": { - "line": 63, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1941, - "end": 1942, - "loc": { - "start": { - "line": 63, - "column": 33 - }, - "end": { - "line": 63, - "column": 34 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 1945, - "end": 1951, - "loc": { - "start": { - "line": 64, - "column": 2 - }, - "end": { - "line": 64, - "column": 8 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1951, - "end": 1952, - "loc": { - "start": { - "line": 64, - "column": 8 - }, - "end": { - "line": 64, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 1952, - "end": 1953, - "loc": { - "start": { - "line": 64, - "column": 9 - }, - "end": { - "line": 64, - "column": 10 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1954, - "end": 1957, - "loc": { - "start": { - "line": 64, - "column": 11 - }, - "end": { - "line": 64, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 1958, - "end": 1959, - "loc": { - "start": { - "line": 64, - "column": 15 - }, - "end": { - "line": 64, - "column": 16 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1959, - "end": 1960, - "loc": { - "start": { - "line": 64, - "column": 16 - }, - "end": { - "line": 64, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 1960, - "end": 1965, - "loc": { - "start": { - "line": 64, - "column": 17 - }, - "end": { - "line": 64, - "column": 22 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1965, - "end": 1966, - "loc": { - "start": { - "line": 64, - "column": 22 - }, - "end": { - "line": 64, - "column": 23 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 1966, - "end": 1971, - "loc": { - "start": { - "line": 64, - "column": 23 - }, - "end": { - "line": 64, - "column": 28 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1971, - "end": 1972, - "loc": { - "start": { - "line": 64, - "column": 28 - }, - "end": { - "line": 64, - "column": 29 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1972, - "end": 1973, - "loc": { - "start": { - "line": 64, - "column": 29 - }, - "end": { - "line": 64, - "column": 30 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 1976, - "end": 1982, - "loc": { - "start": { - "line": 65, - "column": 2 - }, - "end": { - "line": 65, - "column": 8 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1982, - "end": 1983, - "loc": { - "start": { - "line": 65, - "column": 8 - }, - "end": { - "line": 65, - "column": 9 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 1983, - "end": 1984, - "loc": { - "start": { - "line": 65, - "column": 9 - }, - "end": { - "line": 65, - "column": 10 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1984, - "end": 1985, - "loc": { - "start": { - "line": 65, - "column": 10 - }, - "end": { - "line": 65, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1985, - "end": 1989, - "loc": { - "start": { - "line": 65, - "column": 11 - }, - "end": { - "line": 65, - "column": 15 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1989, - "end": 1990, - "loc": { - "start": { - "line": 65, - "column": 15 - }, - "end": { - "line": 65, - "column": 16 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 1990, - "end": 1996, - "loc": { - "start": { - "line": 65, - "column": 16 - }, - "end": { - "line": 65, - "column": 22 - } - } - }, - { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1997, - "end": 2000, - "loc": { - "start": { - "line": 65, - "column": 23 - }, - "end": { - "line": 65, - "column": 26 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 2001, - "end": 2006, - "loc": { - "start": { - "line": 65, - "column": 27 - }, - "end": { - "line": 65, - "column": 32 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 2006, - "end": 2007, - "loc": { - "start": { - "line": 65, - "column": 32 - }, - "end": { - "line": 65, - "column": 33 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 2007, - "end": 2008, - "loc": { - "start": { - "line": 65, - "column": 33 - }, - "end": { - "line": 65, - "column": 34 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_left", - "start": 2011, - "end": 2022, - "loc": { - "start": { - "line": 66, - "column": 2 - }, - "end": { - "line": 66, - "column": 13 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 2022, - "end": 2023, - "loc": { - "start": { - "line": 66, - "column": 13 - }, - "end": { - "line": 66, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "g", - "start": 2023, - "end": 2024, - "loc": { - "start": { - "line": 66, - "column": 14 - }, - "end": { - "line": 66, - "column": 15 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 2024, - "end": 2025, - "loc": { - "start": { - "line": 66, - "column": 15 - }, - "end": { - "line": 66, - "column": 16 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 2025, - "end": 2026, - "loc": { - "start": { - "line": 66, - "column": 16 - }, - "end": { - "line": 66, - "column": 17 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 2028, - "end": 2029, - "loc": { - "start": { - "line": 67, - "column": 1 - }, - "end": { - "line": 67, - "column": 2 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 2030, - "end": 2031, - "loc": { - "start": { - "line": 68, - "column": 0 - }, - "end": { - "line": 68, - "column": 1 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 2031, - "end": 2032, - "loc": { - "start": { - "line": 68, - "column": 1 - }, - "end": { - "line": 68, - "column": 2 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 2034, - "end": 2040, - "loc": { - "start": { - "line": 70, - "column": 0 - }, - "end": { - "line": 70, - "column": 6 - } - } - }, - { - "type": { - "label": "default", - "keyword": "default", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "default", - "start": 2041, - "end": 2048, - "loc": { - "start": { - "line": 70, - "column": 7 - }, - "end": { - "line": 70, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "insert_case5", - "start": 2049, - "end": 2061, - "loc": { - "start": { - "line": 70, - "column": 15 - }, - "end": { - "line": 70, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 2061, - "end": 2062, - "loc": { - "start": { - "line": 70, - "column": 27 - }, - "end": { - "line": 70, - "column": 28 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 2063, - "end": 2063, - "loc": { - "start": { - "line": 71, - "column": 0 - }, - "end": { - "line": 71, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/rotate/rotate_left.js.json b/ast/source/rotate/rotate_left.js.json index 643ff58..427772d 100644 --- a/ast/source/rotate/rotate_left.js.json +++ b/ast/source/rotate/rotate_left.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 777, + "end": 825, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 777, + "end": 825, "loc": { "start": { "line": 1, @@ -187,7 +187,7 @@ { "type": "Identifier", "start": 399, - "end": 747, + "end": 795, "loc": { "start": { "line": 19, @@ -202,7 +202,7 @@ { "type": "VariableDeclarator", "start": 405, - "end": 746, + "end": 794, "loc": { "start": { "line": 19, @@ -234,7 +234,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 419, - "end": 746, + "end": 794, "loc": { "start": { "line": 19, @@ -271,7 +271,7 @@ "body": { "type": "BlockStatement", "start": 426, - "end": 746, + "end": 794, "loc": { "start": { "line": 19, @@ -1804,9 +1804,9 @@ } }, { - "type": "ExpressionStatement", + "type": "IfStatement", "start": 701, - "end": 714, + "end": 730, "loc": { "start": { "line": 36, @@ -1814,97 +1814,161 @@ }, "end": { "line": 36, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 701, - "end": 713, + "test": { + "type": "BinaryExpression", + "start": 705, + "end": 715, "loc": { "start": { "line": 36, - "column": 1 + "column": 5 }, "end": { "line": 36, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 701, - "end": 709, + "type": "Identifier", + "start": 705, + "end": 706, "loc": { "start": { "line": 36, - "column": 1 + "column": 5 + }, + "end": { + "line": 36, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 711, + "end": 715, + "loc": { + "start": { + "line": 36, + "column": 11 }, "end": { "line": 36, - "column": 9 + "column": 15 } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 717, + "end": 730, + "loc": { + "start": { + "line": 36, + "column": 17 }, - "object": { - "type": "Identifier", - "start": 701, - "end": 702, + "end": { + "line": 36, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 717, + "end": 729, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 717, + "end": 725, "loc": { "start": { "line": 36, - "column": 1 + "column": 17 }, "end": { "line": 36, - "column": 2 + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 717, + "end": 718, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 18 + }, + "identifierName": "a" }, - "identifierName": "a" + "name": "a" }, - "name": "a" + "property": { + "type": "Identifier", + "start": 719, + "end": 725, + "loc": { + "start": { + "line": 36, + "column": 19 + }, + "end": { + "line": 36, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 703, - "end": 709, + "start": 728, + "end": 729, "loc": { "start": { "line": 36, - "column": 3 + "column": 28 }, "end": { "line": 36, - "column": 9 + "column": 29 }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 712, - "end": 713, - "loc": { - "start": { - "line": 36, - "column": 12 - }, - "end": { - "line": 36, - "column": 13 + "identifierName": "B" }, - "identifierName": "B" - }, - "name": "B" + "name": "B" + } } - } + }, + "alternate": null }, { - "type": "ExpressionStatement", - "start": 716, - "end": 729, + "type": "IfStatement", + "start": 732, + "end": 761, "loc": { "start": { "line": 37, @@ -1912,97 +1976,161 @@ }, "end": { "line": 37, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 716, - "end": 728, + "test": { + "type": "BinaryExpression", + "start": 736, + "end": 746, "loc": { "start": { "line": 37, - "column": 1 + "column": 5 }, "end": { "line": 37, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 716, - "end": 724, + "type": "Identifier", + "start": 736, + "end": 737, "loc": { "start": { "line": 37, - "column": 1 + "column": 5 + }, + "end": { + "line": 37, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 742, + "end": 746, + "loc": { + "start": { + "line": 37, + "column": 11 }, "end": { "line": 37, - "column": 9 + "column": 15 } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 748, + "end": 761, + "loc": { + "start": { + "line": 37, + "column": 17 }, - "object": { - "type": "Identifier", - "start": 716, - "end": 717, + "end": { + "line": 37, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 748, + "end": 760, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 748, + "end": 756, "loc": { "start": { "line": 37, - "column": 1 + "column": 17 }, "end": { "line": 37, - "column": 2 + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 748, + "end": 749, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 18 + }, + "identifierName": "b" }, - "identifierName": "b" + "name": "b" }, - "name": "b" + "property": { + "type": "Identifier", + "start": 750, + "end": 756, + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 718, - "end": 724, + "start": 759, + "end": 760, "loc": { "start": { "line": 37, - "column": 3 + "column": 28 }, "end": { "line": 37, - "column": 9 + "column": 29 }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 727, - "end": 728, - "loc": { - "start": { - "line": 37, - "column": 12 - }, - "end": { - "line": 37, - "column": 13 + "identifierName": "B" }, - "identifierName": "B" - }, - "name": "B" + "name": "B" + } } - } + }, + "alternate": null }, { - "type": "ExpressionStatement", - "start": 731, - "end": 744, + "type": "IfStatement", + "start": 763, + "end": 792, "loc": { "start": { "line": 38, @@ -2010,92 +2138,156 @@ }, "end": { "line": 38, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 731, - "end": 743, + "test": { + "type": "BinaryExpression", + "start": 767, + "end": 777, "loc": { "start": { "line": 38, - "column": 1 + "column": 5 }, "end": { "line": 38, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 731, - "end": 739, + "type": "Identifier", + "start": 767, + "end": 768, "loc": { "start": { "line": 38, - "column": 1 + "column": 5 }, "end": { "line": 38, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 731, - "end": 732, - "loc": { - "start": { - "line": 38, - "column": 1 - }, - "end": { - "line": 38, - "column": 2 - }, - "identifierName": "c" + "column": 6 }, - "name": "c" + "identifierName": "c" }, - "property": { - "type": "Identifier", - "start": 733, - "end": 739, - "loc": { - "start": { - "line": 38, - "column": 3 - }, - "end": { - "line": 38, - "column": 9 - }, - "identifierName": "parent" + "name": "c" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 773, + "end": 777, + "loc": { + "start": { + "line": 38, + "column": 11 }, - "name": "parent" + "end": { + "line": 38, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 779, + "end": 792, + "loc": { + "start": { + "line": 38, + "column": 17 }, - "computed": false + "end": { + "line": 38, + "column": 30 + } }, - "right": { - "type": "Identifier", - "start": 742, - "end": 743, + "expression": { + "type": "AssignmentExpression", + "start": 779, + "end": 791, "loc": { "start": { "line": 38, - "column": 12 + "column": 17 }, "end": { "line": 38, - "column": 13 + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 779, + "end": 787, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 779, + "end": 780, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 18 + }, + "identifierName": "c" + }, + "name": "c" + }, + "property": { + "type": "Identifier", + "start": 781, + "end": 787, + "loc": { + "start": { + "line": 38, + "column": 19 + }, + "end": { + "line": 38, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" }, - "identifierName": "A" + "computed": false }, - "name": "A" + "right": { + "type": "Identifier", + "start": 790, + "end": 791, + "loc": { + "start": { + "line": 38, + "column": 28 + }, + "end": { + "line": 38, + "column": 29 + }, + "identifierName": "A" + }, + "name": "A" + } } - } + }, + "alternate": null } ], "directives": [] @@ -2111,8 +2303,8 @@ }, { "type": "Identifier", - "start": 749, - "end": 776, + "start": 797, + "end": 824, "loc": { "start": { "line": 41, @@ -2125,8 +2317,8 @@ }, "declaration": { "type": "Identifier", - "start": 764, - "end": 775, + "start": 812, + "end": 823, "loc": { "start": { "line": 41, @@ -2146,8 +2338,8 @@ }, { "type": "ExportDefaultDeclaration", - "start": 749, - "end": 776, + "start": 797, + "end": 824, "loc": { "start": { "line": 41, @@ -2161,7 +2353,7 @@ "declaration": { "type": "VariableDeclaration", "start": 399, - "end": 747, + "end": 795, "loc": { "start": { "line": 19, @@ -2176,7 +2368,7 @@ { "type": "VariableDeclarator", "start": 405, - "end": 746, + "end": 794, "loc": { "start": { "line": 19, @@ -2208,7 +2400,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 419, - "end": 746, + "end": 794, "loc": { "start": { "line": 19, @@ -2262,7 +2454,7 @@ "body": { "type": "BlockStatement", "start": 426, - "end": 746, + "end": 794, "loc": { "start": { "line": 19, @@ -3795,9 +3987,9 @@ } }, { - "type": "ExpressionStatement", + "type": "IfStatement", "start": 701, - "end": 714, + "end": 730, "loc": { "start": { "line": 36, @@ -3805,97 +3997,161 @@ }, "end": { "line": 36, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 701, - "end": 713, + "test": { + "type": "BinaryExpression", + "start": 705, + "end": 715, "loc": { "start": { "line": 36, - "column": 1 + "column": 5 }, "end": { "line": 36, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 701, - "end": 709, + "type": "Identifier", + "start": 705, + "end": 706, "loc": { "start": { "line": 36, - "column": 1 + "column": 5 + }, + "end": { + "line": 36, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 711, + "end": 715, + "loc": { + "start": { + "line": 36, + "column": 11 }, "end": { "line": 36, - "column": 9 + "column": 15 } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 717, + "end": 730, + "loc": { + "start": { + "line": 36, + "column": 17 }, - "object": { - "type": "Identifier", - "start": 701, - "end": 702, + "end": { + "line": 36, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 717, + "end": 729, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 717, + "end": 725, "loc": { "start": { "line": 36, - "column": 1 + "column": 17 }, "end": { "line": 36, - "column": 2 + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 717, + "end": 718, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 18 + }, + "identifierName": "a" }, - "identifierName": "a" + "name": "a" }, - "name": "a" + "property": { + "type": "Identifier", + "start": 719, + "end": 725, + "loc": { + "start": { + "line": 36, + "column": 19 + }, + "end": { + "line": 36, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 703, - "end": 709, + "start": 728, + "end": 729, "loc": { "start": { "line": 36, - "column": 3 + "column": 28 }, "end": { "line": 36, - "column": 9 + "column": 29 }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 712, - "end": 713, - "loc": { - "start": { - "line": 36, - "column": 12 - }, - "end": { - "line": 36, - "column": 13 + "identifierName": "B" }, - "identifierName": "B" - }, - "name": "B" + "name": "B" + } } - } + }, + "alternate": null }, { - "type": "ExpressionStatement", - "start": 716, - "end": 729, + "type": "IfStatement", + "start": 732, + "end": 761, "loc": { "start": { "line": 37, @@ -3903,190 +4159,318 @@ }, "end": { "line": 37, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 716, - "end": 728, + "test": { + "type": "BinaryExpression", + "start": 736, + "end": 746, "loc": { "start": { "line": 37, - "column": 1 + "column": 5 }, "end": { "line": 37, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 716, - "end": 724, + "type": "Identifier", + "start": 736, + "end": 737, "loc": { "start": { "line": 37, - "column": 1 + "column": 5 }, "end": { "line": 37, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 716, - "end": 717, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 2 - }, - "identifierName": "b" - }, - "name": "b" - }, - "property": { - "type": "Identifier", - "start": 718, - "end": 724, - "loc": { - "start": { - "line": 37, - "column": 3 - }, - "end": { - "line": 37, - "column": 9 - }, - "identifierName": "parent" + "column": 6 }, - "name": "parent" + "identifierName": "b" }, - "computed": false + "name": "b" }, + "operator": "!==", "right": { - "type": "Identifier", - "start": 727, - "end": 728, + "type": "NullLiteral", + "start": 742, + "end": 746, "loc": { "start": { "line": 37, - "column": 12 + "column": 11 }, "end": { "line": 37, - "column": 13 - }, - "identifierName": "B" - }, - "name": "B" + "column": 15 + } + } } - } - }, - { - "type": "ExpressionStatement", - "start": 731, - "end": 744, - "loc": { - "start": { - "line": 38, - "column": 1 + }, + "consequent": { + "type": "ExpressionStatement", + "start": 748, + "end": 761, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 748, + "end": 760, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 748, + "end": 756, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 748, + "end": 749, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 18 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "Identifier", + "start": 750, + "end": 756, + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 37, + "column": 28 + }, + "end": { + "line": 37, + "column": 29 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": null + }, + { + "type": "IfStatement", + "start": 763, + "end": 792, + "loc": { + "start": { + "line": 38, + "column": 1 }, "end": { "line": 38, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 731, - "end": 743, + "test": { + "type": "BinaryExpression", + "start": 767, + "end": 777, "loc": { "start": { "line": 38, - "column": 1 + "column": 5 }, "end": { "line": 38, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 731, - "end": 739, + "type": "Identifier", + "start": 767, + "end": 768, "loc": { "start": { "line": 38, - "column": 1 + "column": 5 + }, + "end": { + "line": 38, + "column": 6 + }, + "identifierName": "c" + }, + "name": "c" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 773, + "end": 777, + "loc": { + "start": { + "line": 38, + "column": 11 }, "end": { "line": 38, - "column": 9 + "column": 15 } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 779, + "end": 792, + "loc": { + "start": { + "line": 38, + "column": 17 }, - "object": { - "type": "Identifier", - "start": 731, - "end": 732, + "end": { + "line": 38, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 779, + "end": 791, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 779, + "end": 787, "loc": { "start": { "line": 38, - "column": 1 + "column": 17 }, "end": { "line": 38, - "column": 2 + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 779, + "end": 780, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 18 + }, + "identifierName": "c" }, - "identifierName": "c" + "name": "c" }, - "name": "c" + "property": { + "type": "Identifier", + "start": 781, + "end": 787, + "loc": { + "start": { + "line": 38, + "column": 19 + }, + "end": { + "line": 38, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 733, - "end": 739, + "start": 790, + "end": 791, "loc": { "start": { "line": 38, - "column": 3 + "column": 28 }, "end": { "line": 38, - "column": 9 + "column": 29 }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 742, - "end": 743, - "loc": { - "start": { - "line": 38, - "column": 12 - }, - "end": { - "line": 38, - "column": 13 + "identifierName": "A" }, - "identifierName": "A" - }, - "name": "A" + "name": "A" + } } - } + }, + "alternate": null } ], "directives": [] @@ -4177,26 +4561,437 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "start": 67, + "end": 397, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 399, + "end": 404, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_left", + "start": 405, + "end": 416, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 417, + "end": 418, + "loc": { + "start": { + "line": 19, + "column": 18 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 419, + "end": 420, + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 420, + "end": 421, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 421, + "end": 422, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 7, - "end": 13, + "start": 423, + "end": 425, "loc": { "start": { - "line": 1, - "column": 7 + "line": 19, + "column": 24 }, "end": { - "line": 1, - "column": 13 + "line": 19, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4205,23 +5000,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 14, - "end": 18, + "start": 426, + "end": 427, "loc": { "start": { - "line": 1, - "column": 14 + "line": 19, + "column": 27 }, "end": { - "line": 1, - "column": 18 + "line": 19, + "column": 28 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4229,53 +5023,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, "value": "assert", - "start": 19, - "end": 27, + "start": 429, + "end": 435, "loc": { "start": { - "line": 1, - "column": 19 + "line": 20, + "column": 1 }, "end": { - "line": 1, - "column": 27 + "line": 20, + "column": 7 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 27, - "end": 28, + "start": 435, + "end": 436, "loc": { "start": { - "line": 1, - "column": 27 + "line": 20, + "column": 7 }, "end": { - "line": 1, - "column": 28 + "line": 20, + "column": 8 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4283,46 +5074,47 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 29, - "end": 35, + "value": "A", + "start": 436, + "end": 437, "loc": { "start": { - "line": 2, - "column": 0 + "line": 20, + "column": 8 }, "end": { - "line": 2, - "column": 6 + "line": 20, + "column": 9 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "value": "Node", - "start": 36, - "end": 40, + "value": "instanceof", + "start": 438, + "end": 448, "loc": { "start": { - "line": 2, - "column": 7 + "line": 20, + "column": 10 }, "end": { - "line": 2, - "column": 11 + "line": 20, + "column": 20 } } }, @@ -4338,44 +5130,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 41, - "end": 45, + "value": "Node", + "start": 449, + "end": 453, "loc": { "start": { - "line": 2, - "column": 12 + "line": 20, + "column": 21 }, "end": { - "line": 2, - "column": 16 + "line": 20, + "column": 25 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../types/Node.js", - "start": 46, - "end": 64, + "start": 453, + "end": 454, "loc": { "start": { - "line": 2, - "column": 17 + "line": 20, + "column": 25 }, "end": { - "line": 2, - "column": 35 + "line": 20, + "column": 26 } } }, @@ -4392,32 +5182,16 @@ "binop": null, "updateContext": null }, - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", - "start": 67, - "end": 397, + "start": 454, + "end": 455, "loc": { "start": { - "line": 4, - "column": 0 + "line": 20, + "column": 26 }, "end": { - "line": 17, - "column": 3 + "line": 20, + "column": 27 } } }, @@ -4436,16 +5210,16 @@ "updateContext": null }, "value": "const", - "start": 399, - "end": 404, + "start": 457, + "end": 462, "loc": { "start": { - "line": 19, - "column": 0 + "line": 21, + "column": 1 }, "end": { - "line": 19, - "column": 5 + "line": 21, + "column": 6 } } }, @@ -4461,17 +5235,17 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 405, - "end": 416, + "value": "B", + "start": 463, + "end": 464, "loc": { "start": { - "line": 19, - "column": 6 + "line": 21, + "column": 7 }, "end": { - "line": 19, - "column": 17 + "line": 21, + "column": 8 } } }, @@ -4489,41 +5263,16 @@ "updateContext": null }, "value": "=", - "start": 417, - "end": 418, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 19 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 419, - "end": 420, + "start": 465, + "end": 466, "loc": { "start": { - "line": 19, - "column": 20 + "line": 21, + "column": 9 }, "end": { - "line": 19, - "column": 21 + "line": 21, + "column": 10 } } }, @@ -4540,22 +5289,22 @@ "binop": null }, "value": "A", - "start": 420, - "end": 421, + "start": 467, + "end": 468, "loc": { "start": { - "line": 19, - "column": 21 + "line": 21, + "column": 11 }, "end": { - "line": 19, - "column": 22 + "line": 21, + "column": 12 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -4563,69 +5312,71 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 421, - "end": 422, + "start": 468, + "end": 469, "loc": { "start": { - "line": 19, - "column": 22 + "line": 21, + "column": 12 }, "end": { - "line": 19, - "column": 23 + "line": 21, + "column": 13 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 423, - "end": 425, + "value": "right", + "start": 469, + "end": 474, "loc": { "start": { - "line": 19, - "column": 24 + "line": 21, + "column": 13 }, "end": { - "line": 19, - "column": 26 + "line": 21, + "column": 18 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 426, - "end": 427, + "start": 474, + "end": 475, "loc": { "start": { - "line": 19, - "column": 27 + "line": 21, + "column": 18 }, "end": { - "line": 19, - "column": 28 + "line": 21, + "column": 19 } } }, @@ -4642,15 +5393,15 @@ "binop": null }, "value": "assert", - "start": 429, - "end": 435, + "start": 477, + "end": 483, "loc": { "start": { - "line": 20, + "line": 22, "column": 1 }, "end": { - "line": 20, + "line": 22, "column": 7 } } @@ -4667,15 +5418,15 @@ "postfix": false, "binop": null }, - "start": 435, - "end": 436, + "start": 483, + "end": 484, "loc": { "start": { - "line": 20, + "line": 22, "column": 7 }, "end": { - "line": 20, + "line": 22, "column": 8 } } @@ -4692,16 +5443,16 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 436, - "end": 437, + "value": "B", + "start": 484, + "end": 485, "loc": { "start": { - "line": 20, + "line": 22, "column": 8 }, "end": { - "line": 20, + "line": 22, "column": 9 } } @@ -4721,15 +5472,15 @@ "updateContext": null }, "value": "instanceof", - "start": 438, - "end": 448, + "start": 486, + "end": 496, "loc": { "start": { - "line": 20, + "line": 22, "column": 10 }, "end": { - "line": 20, + "line": 22, "column": 20 } } @@ -4747,15 +5498,15 @@ "binop": null }, "value": "Node", - "start": 449, - "end": 453, + "start": 497, + "end": 501, "loc": { "start": { - "line": 20, + "line": 22, "column": 21 }, "end": { - "line": 20, + "line": 22, "column": 25 } } @@ -4772,15 +5523,15 @@ "postfix": false, "binop": null }, - "start": 453, - "end": 454, + "start": 501, + "end": 502, "loc": { "start": { - "line": 20, + "line": 22, "column": 25 }, "end": { - "line": 20, + "line": 22, "column": 26 } } @@ -4798,15 +5549,15 @@ "binop": null, "updateContext": null }, - "start": 454, - "end": 455, + "start": 502, + "end": 503, "loc": { "start": { - "line": 20, + "line": 22, "column": 26 }, "end": { - "line": 20, + "line": 22, "column": 27 } } @@ -4826,15 +5577,15 @@ "updateContext": null }, "value": "const", - "start": 457, - "end": 462, + "start": 505, + "end": 510, "loc": { "start": { - "line": 21, + "line": 23, "column": 1 }, "end": { - "line": 21, + "line": 23, "column": 6 } } @@ -4851,16 +5602,16 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 463, - "end": 464, + "value": "a", + "start": 511, + "end": 512, "loc": { "start": { - "line": 21, + "line": 23, "column": 7 }, "end": { - "line": 21, + "line": 23, "column": 8 } } @@ -4879,15 +5630,15 @@ "updateContext": null }, "value": "=", - "start": 465, - "end": 466, + "start": 513, + "end": 514, "loc": { "start": { - "line": 21, + "line": 23, "column": 9 }, "end": { - "line": 21, + "line": 23, "column": 10 } } @@ -4905,15 +5656,15 @@ "binop": null }, "value": "A", - "start": 467, - "end": 468, + "start": 515, + "end": 516, "loc": { "start": { - "line": 21, + "line": 23, "column": 11 }, "end": { - "line": 21, + "line": 23, "column": 12 } } @@ -4931,15 +5682,15 @@ "binop": null, "updateContext": null }, - "start": 468, - "end": 469, + "start": 516, + "end": 517, "loc": { "start": { - "line": 21, + "line": 23, "column": 12 }, "end": { - "line": 21, + "line": 23, "column": 13 } } @@ -4956,17 +5707,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 469, - "end": 474, + "value": "left", + "start": 517, + "end": 521, "loc": { "start": { - "line": 21, + "line": 23, "column": 13 }, "end": { - "line": 21, - "column": 18 + "line": 23, + "column": 17 } } }, @@ -4983,49 +5734,51 @@ "binop": null, "updateContext": null }, - "start": 474, - "end": 475, + "start": 521, + "end": 522, "loc": { "start": { - "line": 21, - "column": 18 + "line": 23, + "column": 17 }, "end": { - "line": 21, - "column": 19 + "line": 23, + "column": 18 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 477, - "end": 483, + "value": "const", + "start": 524, + "end": 529, "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, - "column": 7 + "line": 24, + "column": 6 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -5034,104 +5787,104 @@ "postfix": false, "binop": null }, - "start": 483, - "end": 484, + "value": "b", + "start": 530, + "end": 531, "loc": { "start": { - "line": 22, + "line": 24, "column": 7 }, "end": { - "line": 22, + "line": 24, "column": 8 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "B", - "start": 484, - "end": 485, + "value": "=", + "start": 532, + "end": 533, "loc": { "start": { - "line": 22, - "column": 8 + "line": 24, + "column": 9 }, "end": { - "line": 22, - "column": 9 + "line": 24, + "column": 10 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, - "updateContext": null + "binop": null }, - "value": "instanceof", - "start": 486, - "end": 496, + "value": "B", + "start": 534, + "end": 535, "loc": { "start": { - "line": 22, - "column": 10 + "line": 24, + "column": 11 }, "end": { - "line": 22, - "column": 20 + "line": 24, + "column": 12 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Node", - "start": 497, - "end": 501, + "start": 535, + "end": 536, "loc": { "start": { - "line": 22, - "column": 21 + "line": 24, + "column": 12 }, "end": { - "line": 22, - "column": 25 + "line": 24, + "column": 13 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5139,16 +5892,17 @@ "postfix": false, "binop": null }, - "start": 501, - "end": 502, + "value": "left", + "start": 536, + "end": 540, "loc": { "start": { - "line": 22, - "column": 25 + "line": 24, + "column": 13 }, "end": { - "line": 22, - "column": 26 + "line": 24, + "column": 17 } } }, @@ -5165,16 +5919,16 @@ "binop": null, "updateContext": null }, - "start": 502, - "end": 503, + "start": 540, + "end": 541, "loc": { "start": { - "line": 22, - "column": 26 + "line": 24, + "column": 17 }, "end": { - "line": 22, - "column": 27 + "line": 24, + "column": 18 } } }, @@ -5193,15 +5947,15 @@ "updateContext": null }, "value": "const", - "start": 505, - "end": 510, + "start": 543, + "end": 548, "loc": { "start": { - "line": 23, + "line": 25, "column": 1 }, "end": { - "line": 23, + "line": 25, "column": 6 } } @@ -5218,16 +5972,16 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 511, - "end": 512, + "value": "c", + "start": 549, + "end": 550, "loc": { "start": { - "line": 23, + "line": 25, "column": 7 }, "end": { - "line": 23, + "line": 25, "column": 8 } } @@ -5246,15 +6000,15 @@ "updateContext": null }, "value": "=", - "start": 513, - "end": 514, + "start": 551, + "end": 552, "loc": { "start": { - "line": 23, + "line": 25, "column": 9 }, "end": { - "line": 23, + "line": 25, "column": 10 } } @@ -5271,16 +6025,16 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 515, - "end": 516, + "value": "B", + "start": 553, + "end": 554, "loc": { "start": { - "line": 23, + "line": 25, "column": 11 }, "end": { - "line": 23, + "line": 25, "column": 12 } } @@ -5298,15 +6052,15 @@ "binop": null, "updateContext": null }, - "start": 516, - "end": 517, + "start": 554, + "end": 555, "loc": { "start": { - "line": 23, + "line": 25, "column": 12 }, "end": { - "line": 23, + "line": 25, "column": 13 } } @@ -5323,17 +6077,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 517, - "end": 521, + "value": "right", + "start": 555, + "end": 560, "loc": { "start": { - "line": 23, + "line": 25, "column": 13 }, "end": { - "line": 23, - "column": 17 + "line": 25, + "column": 18 } } }, @@ -5350,23 +6104,74 @@ "binop": null, "updateContext": null }, - "start": 521, - "end": 522, + "start": 560, + "end": 561, "loc": { "start": { - "line": 23, - "column": 17 + "line": 25, + "column": 18 }, "end": { - "line": 23, - "column": 18 + "line": 25, + "column": 19 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "[", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 564, + "end": 565, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 2 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 565, + "end": 566, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 3 + } + } + }, + { + "type": { + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -5377,17 +6182,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 524, - "end": 529, + "start": 566, + "end": 567, "loc": { "start": { - "line": 24, - "column": 1 + "line": 27, + "column": 3 }, "end": { - "line": 24, - "column": 6 + "line": 27, + "column": 4 } } }, @@ -5403,44 +6207,95 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 530, - "end": 531, + "value": "key", + "start": 567, + "end": 570, "loc": { "start": { - "line": 24, + "line": 27, + "column": 4 + }, + "end": { + "line": 27, + "column": 7 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 570, + "end": 571, + "loc": { + "start": { + "line": 27, "column": 7 }, "end": { - "line": 24, + "line": 27, "column": 8 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 572, + "end": 573, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 532, - "end": 533, + "start": 573, + "end": 574, "loc": { "start": { - "line": 24, - "column": 9 + "line": 27, + "column": 10 }, "end": { - "line": 24, - "column": 10 + "line": 27, + "column": 11 } } }, @@ -5456,23 +6311,23 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 534, - "end": 535, + "value": "key", + "start": 574, + "end": 577, "loc": { "start": { - "line": 24, + "line": 27, "column": 11 }, "end": { - "line": 24, - "column": 12 + "line": 27, + "column": 14 } } }, { "type": { - "label": ".", + "label": "]", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -5483,50 +6338,51 @@ "binop": null, "updateContext": null }, - "start": 535, - "end": 536, + "start": 577, + "end": 578, "loc": { "start": { - "line": 24, - "column": 12 + "line": 27, + "column": 14 }, "end": { - "line": 24, - "column": 13 + "line": 27, + "column": 15 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "left", - "start": 536, - "end": 540, + "value": "=", + "start": 579, + "end": 580, "loc": { "start": { - "line": 24, - "column": 13 + "line": 27, + "column": 16 }, "end": { - "line": 24, + "line": 27, "column": 17 } } }, { "type": { - "label": ";", + "label": "[", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5535,23 +6391,48 @@ "binop": null, "updateContext": null }, - "start": 540, - "end": 541, + "start": 581, + "end": 582, "loc": { "start": { - "line": 24, - "column": 17 + "line": 27, + "column": 18 }, "end": { - "line": 24, - "column": 18 + "line": 27, + "column": 19 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 582, + "end": 583, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + } + } + }, + { + "type": { + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -5562,17 +6443,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 543, - "end": 548, + "start": 583, + "end": 584, "loc": { "start": { - "line": 25, - "column": 1 + "line": 27, + "column": 20 }, "end": { - "line": 25, - "column": 6 + "line": 27, + "column": 21 } } }, @@ -5588,44 +6468,43 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 549, - "end": 550, + "value": "key", + "start": 584, + "end": 587, "loc": { "start": { - "line": 25, - "column": 7 + "line": 27, + "column": 21 }, "end": { - "line": 25, - "column": 8 + "line": 27, + "column": 24 } } }, { "type": { - "label": "=", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 551, - "end": 552, + "start": 587, + "end": 588, "loc": { "start": { - "line": 25, - "column": 9 + "line": 27, + "column": 24 }, "end": { - "line": 25, - "column": 10 + "line": 27, + "column": 25 } } }, @@ -5641,17 +6520,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 553, - "end": 554, + "value": "A", + "start": 589, + "end": 590, "loc": { "start": { - "line": 25, - "column": 11 + "line": 27, + "column": 26 }, "end": { - "line": 25, - "column": 12 + "line": 27, + "column": 27 } } }, @@ -5668,16 +6547,16 @@ "binop": null, "updateContext": null }, - "start": 554, - "end": 555, + "start": 590, + "end": 591, "loc": { "start": { - "line": 25, - "column": 12 + "line": 27, + "column": 27 }, "end": { - "line": 25, - "column": 13 + "line": 27, + "column": 28 } } }, @@ -5693,17 +6572,43 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 555, - "end": 560, + "value": "key", + "start": 591, + "end": 594, "loc": { "start": { - "line": 25, - "column": 13 + "line": 27, + "column": 28 }, "end": { - "line": 25, - "column": 18 + "line": 27, + "column": 31 + } + } + }, + { + "type": { + "label": "]", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 594, + "end": 595, + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 32 } } }, @@ -5720,16 +6625,16 @@ "binop": null, "updateContext": null }, - "start": 560, - "end": 561, + "start": 595, + "end": 596, "loc": { "start": { - "line": 25, - "column": 18 + "line": 27, + "column": 32 }, "end": { - "line": 25, - "column": 19 + "line": 27, + "column": 33 } } }, @@ -5746,15 +6651,15 @@ "binop": null, "updateContext": null }, - "start": 564, - "end": 565, + "start": 598, + "end": 599, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 2 } } @@ -5772,15 +6677,15 @@ "binop": null }, "value": "A", - "start": 565, - "end": 566, + "start": 599, + "end": 600, "loc": { "start": { - "line": 27, + "line": 28, "column": 2 }, "end": { - "line": 27, + "line": 28, "column": 3 } } @@ -5798,15 +6703,15 @@ "binop": null, "updateContext": null }, - "start": 566, - "end": 567, + "start": 600, + "end": 601, "loc": { "start": { - "line": 27, + "line": 28, "column": 3 }, "end": { - "line": 27, + "line": 28, "column": 4 } } @@ -5823,17 +6728,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 567, - "end": 570, + "value": "_color", + "start": 601, + "end": 607, "loc": { "start": { - "line": 27, + "line": 28, "column": 4 }, "end": { - "line": 27, - "column": 7 + "line": 28, + "column": 10 } } }, @@ -5850,16 +6755,16 @@ "binop": null, "updateContext": null }, - "start": 570, - "end": 571, + "start": 607, + "end": 608, "loc": { "start": { - "line": 27, - "column": 7 + "line": 28, + "column": 10 }, "end": { - "line": 27, - "column": 8 + "line": 28, + "column": 11 } } }, @@ -5876,16 +6781,16 @@ "binop": null }, "value": "B", - "start": 572, - "end": 573, + "start": 609, + "end": 610, "loc": { "start": { - "line": 27, - "column": 9 + "line": 28, + "column": 12 }, "end": { - "line": 27, - "column": 10 + "line": 28, + "column": 13 } } }, @@ -5902,16 +6807,16 @@ "binop": null, "updateContext": null }, - "start": 573, - "end": 574, + "start": 610, + "end": 611, "loc": { "start": { - "line": 27, - "column": 10 + "line": 28, + "column": 13 }, "end": { - "line": 27, - "column": 11 + "line": 28, + "column": 14 } } }, @@ -5927,17 +6832,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 574, - "end": 577, + "value": "_color", + "start": 611, + "end": 617, "loc": { "start": { - "line": 27, - "column": 11 + "line": 28, + "column": 14 }, "end": { - "line": 27, - "column": 14 + "line": 28, + "column": 20 } } }, @@ -5954,16 +6859,16 @@ "binop": null, "updateContext": null }, - "start": 577, - "end": 578, + "start": 617, + "end": 618, "loc": { "start": { - "line": 27, - "column": 14 + "line": 28, + "column": 20 }, "end": { - "line": 27, - "column": 15 + "line": 28, + "column": 21 } } }, @@ -5981,16 +6886,16 @@ "updateContext": null }, "value": "=", - "start": 579, - "end": 580, + "start": 619, + "end": 620, "loc": { "start": { - "line": 27, - "column": 16 + "line": 28, + "column": 22 }, "end": { - "line": 27, - "column": 17 + "line": 28, + "column": 23 } } }, @@ -6007,16 +6912,16 @@ "binop": null, "updateContext": null }, - "start": 581, - "end": 582, + "start": 621, + "end": 622, "loc": { "start": { - "line": 27, - "column": 18 + "line": 28, + "column": 24 }, "end": { - "line": 27, - "column": 19 + "line": 28, + "column": 25 } } }, @@ -6033,16 +6938,16 @@ "binop": null }, "value": "B", - "start": 582, - "end": 583, + "start": 622, + "end": 623, "loc": { "start": { - "line": 27, - "column": 19 + "line": 28, + "column": 25 }, "end": { - "line": 27, - "column": 20 + "line": 28, + "column": 26 } } }, @@ -6059,16 +6964,16 @@ "binop": null, "updateContext": null }, - "start": 583, - "end": 584, + "start": 623, + "end": 624, "loc": { "start": { - "line": 27, - "column": 20 + "line": 28, + "column": 26 }, "end": { - "line": 27, - "column": 21 + "line": 28, + "column": 27 } } }, @@ -6084,17 +6989,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 584, - "end": 587, + "value": "_color", + "start": 624, + "end": 630, "loc": { "start": { - "line": 27, - "column": 21 + "line": 28, + "column": 27 }, "end": { - "line": 27, - "column": 24 + "line": 28, + "column": 33 } } }, @@ -6111,16 +7016,16 @@ "binop": null, "updateContext": null }, - "start": 587, - "end": 588, + "start": 630, + "end": 631, "loc": { "start": { - "line": 27, - "column": 24 + "line": 28, + "column": 33 }, "end": { - "line": 27, - "column": 25 + "line": 28, + "column": 34 } } }, @@ -6137,16 +7042,16 @@ "binop": null }, "value": "A", - "start": 589, - "end": 590, + "start": 632, + "end": 633, "loc": { "start": { - "line": 27, - "column": 26 + "line": 28, + "column": 35 }, "end": { - "line": 27, - "column": 27 + "line": 28, + "column": 36 } } }, @@ -6163,16 +7068,16 @@ "binop": null, "updateContext": null }, - "start": 590, - "end": 591, + "start": 633, + "end": 634, "loc": { "start": { - "line": 27, - "column": 27 + "line": 28, + "column": 36 }, "end": { - "line": 27, - "column": 28 + "line": 28, + "column": 37 } } }, @@ -6188,17 +7093,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 591, - "end": 594, + "value": "_color", + "start": 634, + "end": 640, "loc": { "start": { - "line": 27, - "column": 28 + "line": 28, + "column": 37 }, "end": { - "line": 27, - "column": 31 + "line": 28, + "column": 43 } } }, @@ -6215,16 +7120,16 @@ "binop": null, "updateContext": null }, - "start": 594, - "end": 595, + "start": 640, + "end": 641, "loc": { "start": { - "line": 27, - "column": 31 + "line": 28, + "column": 43 }, "end": { - "line": 27, - "column": 32 + "line": 28, + "column": 44 } } }, @@ -6241,42 +7146,16 @@ "binop": null, "updateContext": null }, - "start": 595, - "end": 596, - "loc": { - "start": { - "line": 27, - "column": 32 - }, - "end": { - "line": 27, - "column": 33 - } - } - }, - { - "type": { - "label": "[", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 598, - "end": 599, + "start": 641, + "end": 642, "loc": { "start": { "line": 28, - "column": 1 + "column": 44 }, "end": { "line": 28, - "column": 2 + "column": 45 } } }, @@ -6293,16 +7172,16 @@ "binop": null }, "value": "A", - "start": 599, - "end": 600, + "start": 645, + "end": 646, "loc": { "start": { - "line": 28, - "column": 2 + "line": 30, + "column": 1 }, "end": { - "line": 28, - "column": 3 + "line": 30, + "column": 2 } } }, @@ -6319,16 +7198,16 @@ "binop": null, "updateContext": null }, - "start": 600, - "end": 601, + "start": 646, + "end": 647, "loc": { "start": { - "line": 28, - "column": 3 + "line": 30, + "column": 2 }, "end": { - "line": 28, - "column": 4 + "line": 30, + "column": 3 } } }, @@ -6344,43 +7223,44 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 601, - "end": 607, + "value": "left", + "start": 647, + "end": 651, "loc": { "start": { - "line": 28, - "column": 4 + "line": 30, + "column": 3 }, "end": { - "line": 28, - "column": 10 + "line": 30, + "column": 7 } } }, { "type": { - "label": ",", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 607, - "end": 608, + "value": "=", + "start": 652, + "end": 653, "loc": { "start": { - "line": 28, - "column": 10 + "line": 30, + "column": 8 }, "end": { - "line": 28, - "column": 11 + "line": 30, + "column": 9 } } }, @@ -6397,23 +7277,23 @@ "binop": null }, "value": "B", - "start": 609, - "end": 610, + "start": 654, + "end": 655, "loc": { "start": { - "line": 28, - "column": 12 + "line": 30, + "column": 10 }, "end": { - "line": 28, - "column": 13 + "line": 30, + "column": 11 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6423,16 +7303,16 @@ "binop": null, "updateContext": null }, - "start": 610, - "end": 611, + "start": 655, + "end": 656, "loc": { "start": { - "line": 28, - "column": 13 + "line": 30, + "column": 11 }, "end": { - "line": 28, - "column": 14 + "line": 30, + "column": 12 } } }, @@ -6448,23 +7328,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 611, - "end": 617, + "value": "A", + "start": 658, + "end": 659, "loc": { "start": { - "line": 28, - "column": 14 + "line": 31, + "column": 1 }, "end": { - "line": 28, - "column": 20 + "line": 31, + "column": 2 } } }, { "type": { - "label": "]", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6475,69 +7355,69 @@ "binop": null, "updateContext": null }, - "start": 617, - "end": 618, + "start": 659, + "end": 660, "loc": { "start": { - "line": 28, - "column": 20 + "line": 31, + "column": 2 }, "end": { - "line": 28, - "column": 21 + "line": 31, + "column": 3 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 619, - "end": 620, + "value": "right", + "start": 660, + "end": 665, "loc": { "start": { - "line": 28, - "column": 22 + "line": 31, + "column": 3 }, "end": { - "line": 28, - "column": 23 + "line": 31, + "column": 8 } } }, { "type": { - "label": "[", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 621, - "end": 622, + "value": "=", + "start": 666, + "end": 667, "loc": { "start": { - "line": 28, - "column": 24 + "line": 31, + "column": 9 }, "end": { - "line": 28, - "column": 25 + "line": 31, + "column": 10 } } }, @@ -6553,24 +7433,24 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 622, - "end": 623, + "value": "c", + "start": 668, + "end": 669, "loc": { "start": { - "line": 28, - "column": 25 + "line": 31, + "column": 11 }, "end": { - "line": 28, - "column": 26 + "line": 31, + "column": 12 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6580,16 +7460,16 @@ "binop": null, "updateContext": null }, - "start": 623, - "end": 624, + "start": 669, + "end": 670, "loc": { "start": { - "line": 28, - "column": 26 + "line": 31, + "column": 12 }, "end": { - "line": 28, - "column": 27 + "line": 31, + "column": 13 } } }, @@ -6605,24 +7485,24 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 624, - "end": 630, + "value": "B", + "start": 673, + "end": 674, "loc": { "start": { - "line": 28, - "column": 27 + "line": 33, + "column": 1 }, "end": { - "line": 28, - "column": 33 + "line": 33, + "column": 2 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6632,16 +7512,16 @@ "binop": null, "updateContext": null }, - "start": 630, - "end": 631, + "start": 674, + "end": 675, "loc": { "start": { - "line": 28, - "column": 33 + "line": 33, + "column": 2 }, "end": { - "line": 28, - "column": 34 + "line": 33, + "column": 3 } } }, @@ -6657,43 +7537,44 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 632, - "end": 633, + "value": "left", + "start": 675, + "end": 679, "loc": { "start": { - "line": 28, - "column": 35 + "line": 33, + "column": 3 }, "end": { - "line": 28, - "column": 36 + "line": 33, + "column": 7 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 633, - "end": 634, + "value": "=", + "start": 680, + "end": 681, "loc": { "start": { - "line": 28, - "column": 36 + "line": 33, + "column": 8 }, "end": { - "line": 28, - "column": 37 + "line": 33, + "column": 9 } } }, @@ -6709,43 +7590,17 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 634, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 37 - }, - "end": { - "line": 28, - "column": 43 - } - } - }, - { - "type": { - "label": "]", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 640, - "end": 641, + "value": "a", + "start": 682, + "end": 683, "loc": { "start": { - "line": 28, - "column": 43 + "line": 33, + "column": 10 }, "end": { - "line": 28, - "column": 44 + "line": 33, + "column": 11 } } }, @@ -6762,16 +7617,16 @@ "binop": null, "updateContext": null }, - "start": 641, - "end": 642, + "start": 683, + "end": 684, "loc": { "start": { - "line": 28, - "column": 44 + "line": 33, + "column": 11 }, "end": { - "line": 28, - "column": 45 + "line": 33, + "column": 12 } } }, @@ -6787,16 +7642,16 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 645, - "end": 646, + "value": "B", + "start": 686, + "end": 687, "loc": { "start": { - "line": 30, + "line": 34, "column": 1 }, "end": { - "line": 30, + "line": 34, "column": 2 } } @@ -6814,15 +7669,15 @@ "binop": null, "updateContext": null }, - "start": 646, - "end": 647, + "start": 687, + "end": 688, "loc": { "start": { - "line": 30, + "line": 34, "column": 2 }, "end": { - "line": 30, + "line": 34, "column": 3 } } @@ -6839,17 +7694,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 647, - "end": 651, + "value": "right", + "start": 688, + "end": 693, "loc": { "start": { - "line": 30, + "line": 34, "column": 3 }, "end": { - "line": 30, - "column": 7 + "line": 34, + "column": 8 } } }, @@ -6867,16 +7722,16 @@ "updateContext": null }, "value": "=", - "start": 652, - "end": 653, + "start": 694, + "end": 695, "loc": { "start": { - "line": 30, - "column": 8 + "line": 34, + "column": 9 }, "end": { - "line": 30, - "column": 9 + "line": 34, + "column": 10 } } }, @@ -6892,17 +7747,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 654, - "end": 655, + "value": "b", + "start": 696, + "end": 697, "loc": { "start": { - "line": 30, - "column": 10 + "line": 34, + "column": 11 }, "end": { - "line": 30, - "column": 11 + "line": 34, + "column": 12 } } }, @@ -6919,68 +7774,69 @@ "binop": null, "updateContext": null }, - "start": 655, - "end": 656, + "start": 697, + "end": 698, "loc": { "start": { - "line": 30, - "column": 11 + "line": 34, + "column": 12 }, "end": { - "line": 30, - "column": 12 + "line": 34, + "column": 13 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "A", - "start": 658, - "end": 659, + "value": "if", + "start": 701, + "end": 703, "loc": { "start": { - "line": 31, + "line": 36, "column": 1 }, "end": { - "line": 31, - "column": 2 + "line": 36, + "column": 3 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 659, - "end": 660, + "start": 704, + "end": 705, "loc": { "start": { - "line": 31, - "column": 2 + "line": 36, + "column": 4 }, "end": { - "line": 31, - "column": 3 + "line": 36, + "column": 5 } } }, @@ -6996,50 +7852,51 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 660, - "end": 665, + "value": "a", + "start": 705, + "end": 706, "loc": { "start": { - "line": 31, - "column": 3 + "line": 36, + "column": 5 }, "end": { - "line": 31, - "column": 8 + "line": 36, + "column": 6 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 666, - "end": 667, + "value": "!==", + "start": 707, + "end": 710, "loc": { "start": { - "line": 31, - "column": 9 + "line": 36, + "column": 7 }, "end": { - "line": 31, + "line": 36, "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7047,45 +7904,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "c", - "start": 668, - "end": 669, + "value": "null", + "start": 711, + "end": 715, "loc": { "start": { - "line": 31, + "line": 36, "column": 11 }, "end": { - "line": 31, - "column": 12 + "line": 36, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 669, - "end": 670, + "start": 715, + "end": 716, "loc": { "start": { - "line": 31, - "column": 12 + "line": 36, + "column": 15 }, "end": { - "line": 31, - "column": 13 + "line": 36, + "column": 16 } } }, @@ -7101,17 +7958,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 673, - "end": 674, + "value": "a", + "start": 717, + "end": 718, "loc": { "start": { - "line": 33, - "column": 1 + "line": 36, + "column": 17 }, "end": { - "line": 33, - "column": 2 + "line": 36, + "column": 18 } } }, @@ -7128,16 +7985,16 @@ "binop": null, "updateContext": null }, - "start": 674, - "end": 675, + "start": 718, + "end": 719, "loc": { "start": { - "line": 33, - "column": 2 + "line": 36, + "column": 18 }, "end": { - "line": 33, - "column": 3 + "line": 36, + "column": 19 } } }, @@ -7153,17 +8010,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 675, - "end": 679, + "value": "parent", + "start": 719, + "end": 725, "loc": { "start": { - "line": 33, - "column": 3 + "line": 36, + "column": 19 }, "end": { - "line": 33, - "column": 7 + "line": 36, + "column": 25 } } }, @@ -7181,16 +8038,16 @@ "updateContext": null }, "value": "=", - "start": 680, - "end": 681, + "start": 726, + "end": 727, "loc": { "start": { - "line": 33, - "column": 8 + "line": 36, + "column": 26 }, "end": { - "line": 33, - "column": 9 + "line": 36, + "column": 27 } } }, @@ -7206,17 +8063,17 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 682, - "end": 683, + "value": "B", + "start": 728, + "end": 729, "loc": { "start": { - "line": 33, - "column": 10 + "line": 36, + "column": 28 }, "end": { - "line": 33, - "column": 11 + "line": 36, + "column": 29 } } }, @@ -7233,68 +8090,69 @@ "binop": null, "updateContext": null }, - "start": 683, - "end": 684, + "start": 729, + "end": 730, "loc": { "start": { - "line": 33, - "column": 11 + "line": 36, + "column": 29 }, "end": { - "line": 33, - "column": 12 + "line": 36, + "column": 30 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "value": "B", - "start": 686, - "end": 687, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 732, + "end": 734, "loc": { "start": { - "line": 34, + "line": 37, "column": 1 }, "end": { - "line": 34, - "column": 2 + "line": 37, + "column": 3 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 687, - "end": 688, + "start": 735, + "end": 736, "loc": { "start": { - "line": 34, - "column": 2 + "line": 37, + "column": 4 }, "end": { - "line": 34, - "column": 3 + "line": 37, + "column": 5 } } }, @@ -7310,50 +8168,51 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 688, - "end": 693, + "value": "b", + "start": 736, + "end": 737, "loc": { "start": { - "line": 34, - "column": 3 + "line": 37, + "column": 5 }, "end": { - "line": 34, - "column": 8 + "line": 37, + "column": 6 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 694, - "end": 695, + "value": "!==", + "start": 738, + "end": 741, "loc": { "start": { - "line": 34, - "column": 9 + "line": 37, + "column": 7 }, "end": { - "line": 34, + "line": 37, "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7361,45 +8220,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "b", - "start": 696, - "end": 697, + "value": "null", + "start": 742, + "end": 746, "loc": { "start": { - "line": 34, + "line": 37, "column": 11 }, "end": { - "line": 34, - "column": 12 + "line": 37, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 697, - "end": 698, + "start": 746, + "end": 747, "loc": { "start": { - "line": 34, - "column": 12 + "line": 37, + "column": 15 }, "end": { - "line": 34, - "column": 13 + "line": 37, + "column": 16 } } }, @@ -7415,17 +8274,17 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 701, - "end": 702, + "value": "b", + "start": 748, + "end": 749, "loc": { "start": { - "line": 36, - "column": 1 + "line": 37, + "column": 17 }, "end": { - "line": 36, - "column": 2 + "line": 37, + "column": 18 } } }, @@ -7442,16 +8301,16 @@ "binop": null, "updateContext": null }, - "start": 702, - "end": 703, + "start": 749, + "end": 750, "loc": { "start": { - "line": 36, - "column": 2 + "line": 37, + "column": 18 }, "end": { - "line": 36, - "column": 3 + "line": 37, + "column": 19 } } }, @@ -7468,16 +8327,16 @@ "binop": null }, "value": "parent", - "start": 703, - "end": 709, + "start": 750, + "end": 756, "loc": { "start": { - "line": 36, - "column": 3 + "line": 37, + "column": 19 }, "end": { - "line": 36, - "column": 9 + "line": 37, + "column": 25 } } }, @@ -7495,16 +8354,16 @@ "updateContext": null }, "value": "=", - "start": 710, - "end": 711, + "start": 757, + "end": 758, "loc": { "start": { - "line": 36, - "column": 10 + "line": 37, + "column": 26 }, "end": { - "line": 36, - "column": 11 + "line": 37, + "column": 27 } } }, @@ -7521,16 +8380,16 @@ "binop": null }, "value": "B", - "start": 712, - "end": 713, + "start": 759, + "end": 760, "loc": { "start": { - "line": 36, - "column": 12 + "line": 37, + "column": 28 }, "end": { - "line": 36, - "column": 13 + "line": 37, + "column": 29 } } }, @@ -7547,68 +8406,69 @@ "binop": null, "updateContext": null }, - "start": 713, - "end": 714, + "start": 760, + "end": 761, "loc": { "start": { - "line": 36, - "column": 13 + "line": 37, + "column": 29 }, "end": { - "line": 36, - "column": 14 + "line": 37, + "column": 30 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "b", - "start": 716, - "end": 717, + "value": "if", + "start": 763, + "end": 765, "loc": { "start": { - "line": 37, + "line": 38, "column": 1 }, "end": { - "line": 37, - "column": 2 + "line": 38, + "column": 3 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 717, - "end": 718, + "start": 766, + "end": 767, "loc": { "start": { - "line": 37, - "column": 2 + "line": 38, + "column": 4 }, "end": { - "line": 37, - "column": 3 + "line": 38, + "column": 5 } } }, @@ -7624,50 +8484,51 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 718, - "end": 724, + "value": "c", + "start": 767, + "end": 768, "loc": { "start": { - "line": 37, - "column": 3 + "line": 38, + "column": 5 }, "end": { - "line": 37, - "column": 9 + "line": 38, + "column": 6 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 725, - "end": 726, + "value": "!==", + "start": 769, + "end": 772, "loc": { "start": { - "line": 37, - "column": 10 + "line": 38, + "column": 7 }, "end": { - "line": 37, - "column": 11 + "line": 38, + "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7675,45 +8536,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "B", - "start": 727, - "end": 728, + "value": "null", + "start": 773, + "end": 777, "loc": { "start": { - "line": 37, - "column": 12 + "line": 38, + "column": 11 }, "end": { - "line": 37, - "column": 13 + "line": 38, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 728, - "end": 729, + "start": 777, + "end": 778, "loc": { "start": { - "line": 37, - "column": 13 + "line": 38, + "column": 15 }, "end": { - "line": 37, - "column": 14 + "line": 38, + "column": 16 } } }, @@ -7730,16 +8591,16 @@ "binop": null }, "value": "c", - "start": 731, - "end": 732, + "start": 779, + "end": 780, "loc": { "start": { "line": 38, - "column": 1 + "column": 17 }, "end": { "line": 38, - "column": 2 + "column": 18 } } }, @@ -7756,16 +8617,16 @@ "binop": null, "updateContext": null }, - "start": 732, - "end": 733, + "start": 780, + "end": 781, "loc": { "start": { "line": 38, - "column": 2 + "column": 18 }, "end": { "line": 38, - "column": 3 + "column": 19 } } }, @@ -7782,16 +8643,16 @@ "binop": null }, "value": "parent", - "start": 733, - "end": 739, + "start": 781, + "end": 787, "loc": { "start": { "line": 38, - "column": 3 + "column": 19 }, "end": { "line": 38, - "column": 9 + "column": 25 } } }, @@ -7809,16 +8670,16 @@ "updateContext": null }, "value": "=", - "start": 740, - "end": 741, + "start": 788, + "end": 789, "loc": { "start": { "line": 38, - "column": 10 + "column": 26 }, "end": { "line": 38, - "column": 11 + "column": 27 } } }, @@ -7835,16 +8696,16 @@ "binop": null }, "value": "A", - "start": 742, - "end": 743, + "start": 790, + "end": 791, "loc": { "start": { "line": 38, - "column": 12 + "column": 28 }, "end": { "line": 38, - "column": 13 + "column": 29 } } }, @@ -7861,16 +8722,16 @@ "binop": null, "updateContext": null }, - "start": 743, - "end": 744, + "start": 791, + "end": 792, "loc": { "start": { "line": 38, - "column": 13 + "column": 29 }, "end": { "line": 38, - "column": 14 + "column": 30 } } }, @@ -7886,8 +8747,8 @@ "postfix": false, "binop": null }, - "start": 745, - "end": 746, + "start": 793, + "end": 794, "loc": { "start": { "line": 39, @@ -7912,8 +8773,8 @@ "binop": null, "updateContext": null }, - "start": 746, - "end": 747, + "start": 794, + "end": 795, "loc": { "start": { "line": 39, @@ -7940,8 +8801,8 @@ "updateContext": null }, "value": "export", - "start": 749, - "end": 755, + "start": 797, + "end": 803, "loc": { "start": { "line": 41, @@ -7968,8 +8829,8 @@ "updateContext": null }, "value": "default", - "start": 756, - "end": 763, + "start": 804, + "end": 811, "loc": { "start": { "line": 41, @@ -7994,8 +8855,8 @@ "binop": null }, "value": "rotate_left", - "start": 764, - "end": 775, + "start": 812, + "end": 823, "loc": { "start": { "line": 41, @@ -8020,8 +8881,8 @@ "binop": null, "updateContext": null }, - "start": 775, - "end": 776, + "start": 823, + "end": 824, "loc": { "start": { "line": 41, @@ -8046,8 +8907,8 @@ "binop": null, "updateContext": null }, - "start": 777, - "end": 777, + "start": 825, + "end": 825, "loc": { "start": { "line": 42, diff --git a/ast/source/rotate/rotate_right.js.json b/ast/source/rotate/rotate_right.js.json index fca0294..c84d367 100644 --- a/ast/source/rotate/rotate_right.js.json +++ b/ast/source/rotate/rotate_right.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 788, + "end": 836, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 788, + "end": 836, "loc": { "start": { "line": 1, @@ -187,7 +187,7 @@ { "type": "Identifier", "start": 408, - "end": 757, + "end": 805, "loc": { "start": { "line": 19, @@ -202,7 +202,7 @@ { "type": "VariableDeclarator", "start": 414, - "end": 756, + "end": 804, "loc": { "start": { "line": 19, @@ -234,7 +234,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 429, - "end": 756, + "end": 804, "loc": { "start": { "line": 19, @@ -271,7 +271,7 @@ "body": { "type": "BlockStatement", "start": 436, - "end": 756, + "end": 804, "loc": { "start": { "line": 19, @@ -1804,9 +1804,9 @@ } }, { - "type": "ExpressionStatement", + "type": "IfStatement", "start": 711, - "end": 724, + "end": 740, "loc": { "start": { "line": 36, @@ -1814,97 +1814,161 @@ }, "end": { "line": 36, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 711, - "end": 723, + "test": { + "type": "BinaryExpression", + "start": 715, + "end": 725, "loc": { "start": { "line": 36, - "column": 1 + "column": 5 }, "end": { "line": 36, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 711, - "end": 719, + "type": "Identifier", + "start": 715, + "end": 716, "loc": { "start": { "line": 36, - "column": 1 + "column": 5 + }, + "end": { + "line": 36, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 721, + "end": 725, + "loc": { + "start": { + "line": 36, + "column": 11 }, "end": { "line": 36, - "column": 9 + "column": 15 } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 727, + "end": 740, + "loc": { + "start": { + "line": 36, + "column": 17 }, - "object": { - "type": "Identifier", - "start": 711, - "end": 712, + "end": { + "line": 36, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 727, + "end": 739, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 727, + "end": 735, "loc": { "start": { "line": 36, - "column": 1 + "column": 17 }, "end": { "line": 36, - "column": 2 + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 727, + "end": 728, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 18 + }, + "identifierName": "a" }, - "identifierName": "a" + "name": "a" }, - "name": "a" + "property": { + "type": "Identifier", + "start": 729, + "end": 735, + "loc": { + "start": { + "line": 36, + "column": 19 + }, + "end": { + "line": 36, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 713, - "end": 719, + "start": 738, + "end": 739, "loc": { "start": { "line": 36, - "column": 3 + "column": 28 }, "end": { "line": 36, - "column": 9 + "column": 29 }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 722, - "end": 723, - "loc": { - "start": { - "line": 36, - "column": 12 - }, - "end": { - "line": 36, - "column": 13 + "identifierName": "B" }, - "identifierName": "B" - }, - "name": "B" + "name": "B" + } } - } + }, + "alternate": null }, { - "type": "ExpressionStatement", - "start": 726, - "end": 739, + "type": "IfStatement", + "start": 742, + "end": 771, "loc": { "start": { "line": 37, @@ -1912,97 +1976,161 @@ }, "end": { "line": 37, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 726, - "end": 738, + "test": { + "type": "BinaryExpression", + "start": 746, + "end": 756, "loc": { "start": { "line": 37, - "column": 1 + "column": 5 }, "end": { "line": 37, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 726, - "end": 734, + "type": "Identifier", + "start": 746, + "end": 747, "loc": { "start": { "line": 37, - "column": 1 + "column": 5 + }, + "end": { + "line": 37, + "column": 6 + }, + "identifierName": "b" + }, + "name": "b" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 752, + "end": 756, + "loc": { + "start": { + "line": 37, + "column": 11 }, "end": { "line": 37, - "column": 9 + "column": 15 } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 758, + "end": 771, + "loc": { + "start": { + "line": 37, + "column": 17 }, - "object": { - "type": "Identifier", - "start": 726, - "end": 727, + "end": { + "line": 37, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 758, + "end": 770, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 758, + "end": 766, "loc": { "start": { "line": 37, - "column": 1 + "column": 17 }, "end": { "line": 37, - "column": 2 + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 758, + "end": 759, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 18 + }, + "identifierName": "b" }, - "identifierName": "b" + "name": "b" }, - "name": "b" + "property": { + "type": "Identifier", + "start": 760, + "end": 766, + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 728, - "end": 734, + "start": 769, + "end": 770, "loc": { "start": { "line": 37, - "column": 3 + "column": 28 }, "end": { "line": 37, - "column": 9 + "column": 29 }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 737, - "end": 738, - "loc": { - "start": { - "line": 37, - "column": 12 - }, - "end": { - "line": 37, - "column": 13 + "identifierName": "A" }, - "identifierName": "A" - }, - "name": "A" + "name": "A" + } } - } + }, + "alternate": null }, { - "type": "ExpressionStatement", - "start": 741, - "end": 754, + "type": "IfStatement", + "start": 773, + "end": 802, "loc": { "start": { "line": 38, @@ -2010,92 +2138,156 @@ }, "end": { "line": 38, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 741, - "end": 753, + "test": { + "type": "BinaryExpression", + "start": 777, + "end": 787, "loc": { "start": { "line": 38, - "column": 1 + "column": 5 }, "end": { "line": 38, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 741, - "end": 749, + "type": "Identifier", + "start": 777, + "end": 778, "loc": { "start": { "line": 38, - "column": 1 + "column": 5 }, "end": { "line": 38, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 741, - "end": 742, - "loc": { - "start": { - "line": 38, - "column": 1 - }, - "end": { - "line": 38, - "column": 2 - }, - "identifierName": "c" + "column": 6 }, - "name": "c" + "identifierName": "c" }, - "property": { - "type": "Identifier", - "start": 743, - "end": 749, - "loc": { - "start": { - "line": 38, - "column": 3 - }, - "end": { - "line": 38, - "column": 9 - }, - "identifierName": "parent" + "name": "c" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 783, + "end": 787, + "loc": { + "start": { + "line": 38, + "column": 11 }, - "name": "parent" + "end": { + "line": 38, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 789, + "end": 802, + "loc": { + "start": { + "line": 38, + "column": 17 }, - "computed": false + "end": { + "line": 38, + "column": 30 + } }, - "right": { - "type": "Identifier", - "start": 752, - "end": 753, + "expression": { + "type": "AssignmentExpression", + "start": 789, + "end": 801, "loc": { "start": { "line": 38, - "column": 12 + "column": 17 }, "end": { "line": 38, - "column": 13 + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 789, + "end": 797, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 25 + } }, - "identifierName": "A" + "object": { + "type": "Identifier", + "start": 789, + "end": 790, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 18 + }, + "identifierName": "c" + }, + "name": "c" + }, + "property": { + "type": "Identifier", + "start": 791, + "end": 797, + "loc": { + "start": { + "line": 38, + "column": 19 + }, + "end": { + "line": 38, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "name": "A" + "right": { + "type": "Identifier", + "start": 800, + "end": 801, + "loc": { + "start": { + "line": 38, + "column": 28 + }, + "end": { + "line": 38, + "column": 29 + }, + "identifierName": "A" + }, + "name": "A" + } } - } + }, + "alternate": null } ], "directives": [] @@ -2111,8 +2303,8 @@ }, { "type": "Identifier", - "start": 759, - "end": 787, + "start": 807, + "end": 835, "loc": { "start": { "line": 41, @@ -2125,8 +2317,8 @@ }, "declaration": { "type": "Identifier", - "start": 774, - "end": 786, + "start": 822, + "end": 834, "loc": { "start": { "line": 41, @@ -2146,8 +2338,8 @@ }, { "type": "ExportDefaultDeclaration", - "start": 759, - "end": 787, + "start": 807, + "end": 835, "loc": { "start": { "line": 41, @@ -2161,7 +2353,7 @@ "declaration": { "type": "VariableDeclaration", "start": 408, - "end": 757, + "end": 805, "loc": { "start": { "line": 19, @@ -2176,7 +2368,7 @@ { "type": "VariableDeclarator", "start": 414, - "end": 756, + "end": 804, "loc": { "start": { "line": 19, @@ -2208,7 +2400,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 429, - "end": 756, + "end": 804, "loc": { "start": { "line": 19, @@ -2262,7 +2454,7 @@ "body": { "type": "BlockStatement", "start": 436, - "end": 756, + "end": 804, "loc": { "start": { "line": 19, @@ -3795,9 +3987,9 @@ } }, { - "type": "ExpressionStatement", + "type": "IfStatement", "start": 711, - "end": 724, + "end": 740, "loc": { "start": { "line": 36, @@ -3805,97 +3997,161 @@ }, "end": { "line": 36, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 711, - "end": 723, + "test": { + "type": "BinaryExpression", + "start": 715, + "end": 725, "loc": { "start": { "line": 36, - "column": 1 + "column": 5 }, "end": { "line": 36, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 711, - "end": 719, + "type": "Identifier", + "start": 715, + "end": 716, "loc": { "start": { "line": 36, - "column": 1 + "column": 5 + }, + "end": { + "line": 36, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 721, + "end": 725, + "loc": { + "start": { + "line": 36, + "column": 11 }, "end": { "line": 36, - "column": 9 + "column": 15 } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 727, + "end": 740, + "loc": { + "start": { + "line": 36, + "column": 17 }, - "object": { - "type": "Identifier", - "start": 711, - "end": 712, + "end": { + "line": 36, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 727, + "end": 739, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 727, + "end": 735, "loc": { "start": { "line": 36, - "column": 1 + "column": 17 }, "end": { "line": 36, - "column": 2 + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 727, + "end": 728, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 18 + }, + "identifierName": "a" }, - "identifierName": "a" + "name": "a" }, - "name": "a" + "property": { + "type": "Identifier", + "start": 729, + "end": 735, + "loc": { + "start": { + "line": 36, + "column": 19 + }, + "end": { + "line": 36, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 713, - "end": 719, + "start": 738, + "end": 739, "loc": { "start": { "line": 36, - "column": 3 + "column": 28 }, "end": { "line": 36, - "column": 9 + "column": 29 }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 722, - "end": 723, - "loc": { - "start": { - "line": 36, - "column": 12 - }, - "end": { - "line": 36, - "column": 13 + "identifierName": "B" }, - "identifierName": "B" - }, - "name": "B" + "name": "B" + } } - } + }, + "alternate": null }, { - "type": "ExpressionStatement", - "start": 726, - "end": 739, + "type": "IfStatement", + "start": 742, + "end": 771, "loc": { "start": { "line": 37, @@ -3903,190 +4159,318 @@ }, "end": { "line": 37, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 726, - "end": 738, + "test": { + "type": "BinaryExpression", + "start": 746, + "end": 756, "loc": { "start": { "line": 37, - "column": 1 + "column": 5 }, "end": { "line": 37, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 726, - "end": 734, + "type": "Identifier", + "start": 746, + "end": 747, "loc": { "start": { "line": 37, - "column": 1 + "column": 5 }, "end": { "line": 37, - "column": 9 - } - }, - "object": { - "type": "Identifier", - "start": 726, - "end": 727, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 2 - }, - "identifierName": "b" - }, - "name": "b" - }, - "property": { - "type": "Identifier", - "start": 728, - "end": 734, - "loc": { - "start": { - "line": 37, - "column": 3 - }, - "end": { - "line": 37, - "column": 9 - }, - "identifierName": "parent" + "column": 6 }, - "name": "parent" + "identifierName": "b" }, - "computed": false + "name": "b" }, + "operator": "!==", "right": { - "type": "Identifier", - "start": 737, - "end": 738, + "type": "NullLiteral", + "start": 752, + "end": 756, "loc": { "start": { "line": 37, - "column": 12 + "column": 11 }, "end": { "line": 37, - "column": 13 - }, - "identifierName": "A" - }, - "name": "A" + "column": 15 + } + } } - } - }, - { - "type": "ExpressionStatement", - "start": 741, - "end": 754, - "loc": { - "start": { - "line": 38, - "column": 1 + }, + "consequent": { + "type": "ExpressionStatement", + "start": 758, + "end": 771, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 758, + "end": 770, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 758, + "end": 766, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 758, + "end": 759, + "loc": { + "start": { + "line": 37, + "column": 17 + }, + "end": { + "line": 37, + "column": 18 + }, + "identifierName": "b" + }, + "name": "b" + }, + "property": { + "type": "Identifier", + "start": 760, + "end": 766, + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 769, + "end": 770, + "loc": { + "start": { + "line": 37, + "column": 28 + }, + "end": { + "line": 37, + "column": 29 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + "alternate": null + }, + { + "type": "IfStatement", + "start": 773, + "end": 802, + "loc": { + "start": { + "line": 38, + "column": 1 }, "end": { "line": 38, - "column": 14 + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 741, - "end": 753, + "test": { + "type": "BinaryExpression", + "start": 777, + "end": 787, "loc": { "start": { "line": 38, - "column": 1 + "column": 5 }, "end": { "line": 38, - "column": 13 + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 741, - "end": 749, + "type": "Identifier", + "start": 777, + "end": 778, "loc": { "start": { "line": 38, - "column": 1 + "column": 5 + }, + "end": { + "line": 38, + "column": 6 + }, + "identifierName": "c" + }, + "name": "c" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 783, + "end": 787, + "loc": { + "start": { + "line": 38, + "column": 11 }, "end": { "line": 38, - "column": 9 + "column": 15 } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 789, + "end": 802, + "loc": { + "start": { + "line": 38, + "column": 17 }, - "object": { - "type": "Identifier", - "start": 741, - "end": 742, + "end": { + "line": 38, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 789, + "end": 801, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 789, + "end": 797, "loc": { "start": { "line": 38, - "column": 1 + "column": 17 }, "end": { "line": 38, - "column": 2 + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 789, + "end": 790, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 18 + }, + "identifierName": "c" }, - "identifierName": "c" + "name": "c" }, - "name": "c" + "property": { + "type": "Identifier", + "start": 791, + "end": 797, + "loc": { + "start": { + "line": 38, + "column": 19 + }, + "end": { + "line": 38, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 743, - "end": 749, + "start": 800, + "end": 801, "loc": { "start": { "line": 38, - "column": 3 + "column": 28 }, "end": { "line": 38, - "column": 9 + "column": 29 }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 752, - "end": 753, - "loc": { - "start": { - "line": 38, - "column": 12 - }, - "end": { - "line": 38, - "column": 13 + "identifierName": "A" }, - "identifierName": "A" - }, - "name": "A" + "name": "A" + } } - } + }, + "alternate": null } ], "directives": [] @@ -4117,53 +4501,515 @@ "trailingComments": [] } } - ], - "directives": [] - }, - "comments": [ + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 406, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 406, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 17, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 408, + "end": 413, + "loc": { + "start": { + "line": 19, + "column": 0 + }, + "end": { + "line": 19, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rotate_right", + "start": 414, + "end": 426, + "loc": { + "start": { + "line": 19, + "column": 6 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 427, + "end": 428, + "loc": { + "start": { + "line": 19, + "column": 19 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 429, + "end": 430, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 430, + "end": 431, + "loc": { + "start": { + "line": 19, + "column": 22 + }, + "end": { + "line": 19, + "column": 23 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 431, + "end": 432, + "loc": { + "start": { + "line": 19, + "column": 23 + }, + "end": { + "line": 19, + "column": 24 + } + } + }, { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 67, - "end": 406, + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 433, + "end": 435, "loc": { "start": { - "line": 4, - "column": 0 + "line": 19, + "column": 25 }, "end": { - "line": 17, - "column": 3 + "line": 19, + "column": 27 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 0, - "end": 6, + "start": 436, + "end": 437, "loc": { "start": { - "line": 1, - "column": 0 + "line": 19, + "column": 28 }, "end": { - "line": 1, - "column": 6 + "line": 19, + "column": 29 } } }, @@ -4180,16 +5026,41 @@ "binop": null }, "value": "assert", - "start": 7, - "end": 13, + "start": 439, + "end": 445, "loc": { "start": { - "line": 1, + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 445, + "end": 446, + "loc": { + "start": { + "line": 20, "column": 7 }, "end": { - "line": 1, - "column": 13 + "line": 20, + "column": 8 } } }, @@ -4205,23 +5076,51 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 14, - "end": 18, + "value": "B", + "start": 446, + "end": 447, "loc": { "start": { - "line": 1, - "column": 14 + "line": 20, + "column": 8 }, "end": { - "line": 1, - "column": 18 + "line": 20, + "column": 9 } } }, { "type": { - "label": "string", + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 448, + "end": 458, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + { + "type": { + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4229,20 +5128,44 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "assert", - "start": 19, - "end": 27, + "value": "Node", + "start": 459, + "end": 463, "loc": { "start": { - "line": 1, - "column": 19 + "line": 20, + "column": 21 }, "end": { - "line": 1, - "column": 27 + "line": 20, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 463, + "end": 464, + "loc": { + "start": { + "line": 20, + "column": 25 + }, + "end": { + "line": 20, + "column": 26 } } }, @@ -4259,25 +5182,25 @@ "binop": null, "updateContext": null }, - "start": 27, - "end": 28, + "start": 464, + "end": 465, "loc": { "start": { - "line": 1, - "column": 27 + "line": 20, + "column": 26 }, "end": { - "line": 1, - "column": 28 + "line": 20, + "column": 27 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4286,16 +5209,16 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 29, - "end": 35, + "value": "const", + "start": 467, + "end": 472, "loc": { "start": { - "line": 2, - "column": 0 + "line": 21, + "column": 1 }, "end": { - "line": 2, + "line": 21, "column": 6 } } @@ -4312,17 +5235,44 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 36, - "end": 40, + "value": "A", + "start": 473, + "end": 474, "loc": { "start": { - "line": 2, + "line": 21, "column": 7 }, "end": { - "line": 2, - "column": 11 + "line": 21, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 475, + "end": 476, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 10 } } }, @@ -4338,25 +5288,25 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 41, - "end": 45, + "value": "B", + "start": 477, + "end": 478, "loc": { "start": { - "line": 2, - "column": 12 + "line": 21, + "column": 11 }, "end": { - "line": 2, - "column": 16 + "line": 21, + "column": 12 } } }, { "type": { - "label": "string", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4365,67 +5315,49 @@ "binop": null, "updateContext": null }, - "value": "../types/Node.js", - "start": 46, - "end": 64, + "start": 478, + "end": 479, "loc": { "start": { - "line": 2, - "column": 17 + "line": 21, + "column": 12 }, "end": { - "line": 2, - "column": 35 + "line": 21, + "column": 13 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 67, - "end": 406, + "value": "left", + "start": 479, + "end": 483, "loc": { "start": { - "line": 4, - "column": 0 + "line": 21, + "column": 13 }, "end": { - "line": 17, - "column": 3 + "line": 21, + "column": 17 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4435,17 +5367,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 408, - "end": 413, + "start": 483, + "end": 484, "loc": { "start": { - "line": 19, - "column": 0 + "line": 21, + "column": 17 }, "end": { - "line": 19, - "column": 5 + "line": 21, + "column": 18 } } }, @@ -4461,51 +5392,49 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 414, - "end": 426, + "value": "assert", + "start": 486, + "end": 492, "loc": { "start": { - "line": 19, - "column": 6 + "line": 22, + "column": 1 }, "end": { - "line": 19, - "column": 18 + "line": 22, + "column": 7 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 427, - "end": 428, + "start": 492, + "end": 493, "loc": { "start": { - "line": 19, - "column": 19 + "line": 22, + "column": 7 }, "end": { - "line": 19, - "column": 20 + "line": 22, + "column": 8 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4514,50 +5443,53 @@ "postfix": false, "binop": null }, - "start": 429, - "end": 430, + "value": "A", + "start": 493, + "end": 494, "loc": { "start": { - "line": 19, - "column": 21 + "line": 22, + "column": 8 }, "end": { - "line": 19, - "column": 22 + "line": 22, + "column": 9 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "value": "B", - "start": 430, - "end": 431, + "value": "instanceof", + "start": 495, + "end": 505, "loc": { "start": { - "line": 19, - "column": 22 + "line": 22, + "column": 10 }, "end": { - "line": 19, - "column": 23 + "line": 22, + "column": 20 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4565,100 +5497,103 @@ "postfix": false, "binop": null }, - "start": 431, - "end": 432, + "value": "Node", + "start": 506, + "end": 510, "loc": { "start": { - "line": 19, - "column": 23 + "line": 22, + "column": 21 }, "end": { - "line": 19, - "column": 24 + "line": 22, + "column": 25 } } }, { "type": { - "label": "=>", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 433, - "end": 435, + "start": 510, + "end": 511, "loc": { "start": { - "line": 19, + "line": 22, "column": 25 }, "end": { - "line": 19, - "column": 27 + "line": 22, + "column": 26 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 436, - "end": 437, + "start": 511, + "end": 512, "loc": { "start": { - "line": 19, - "column": 28 + "line": 22, + "column": 26 }, "end": { - "line": 19, - "column": 29 + "line": 22, + "column": 27 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 439, - "end": 445, + "value": "const", + "start": 514, + "end": 519, "loc": { "start": { - "line": 20, + "line": 23, "column": 1 }, "end": { - "line": 20, - "column": 7 + "line": 23, + "column": 6 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4667,104 +5602,104 @@ "postfix": false, "binop": null }, - "start": 445, - "end": 446, + "value": "a", + "start": 520, + "end": 521, "loc": { "start": { - "line": 20, + "line": 23, "column": 7 }, "end": { - "line": 20, + "line": 23, "column": 8 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "B", - "start": 446, - "end": 447, + "value": "=", + "start": 522, + "end": 523, "loc": { "start": { - "line": 20, - "column": 8 + "line": 23, + "column": 9 }, "end": { - "line": 20, - "column": 9 + "line": 23, + "column": 10 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, - "updateContext": null + "binop": null }, - "value": "instanceof", - "start": 448, - "end": 458, + "value": "A", + "start": 524, + "end": 525, "loc": { "start": { - "line": 20, - "column": 10 + "line": 23, + "column": 11 }, "end": { - "line": 20, - "column": 20 + "line": 23, + "column": 12 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Node", - "start": 459, - "end": 463, + "start": 525, + "end": 526, "loc": { "start": { - "line": 20, - "column": 21 + "line": 23, + "column": 12 }, "end": { - "line": 20, - "column": 25 + "line": 23, + "column": 13 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4772,16 +5707,17 @@ "postfix": false, "binop": null }, - "start": 463, - "end": 464, + "value": "left", + "start": 526, + "end": 530, "loc": { "start": { - "line": 20, - "column": 25 + "line": 23, + "column": 13 }, "end": { - "line": 20, - "column": 26 + "line": 23, + "column": 17 } } }, @@ -4798,16 +5734,16 @@ "binop": null, "updateContext": null }, - "start": 464, - "end": 465, + "start": 530, + "end": 531, "loc": { "start": { - "line": 20, - "column": 26 + "line": 23, + "column": 17 }, "end": { - "line": 20, - "column": 27 + "line": 23, + "column": 18 } } }, @@ -4826,15 +5762,15 @@ "updateContext": null }, "value": "const", - "start": 467, - "end": 472, + "start": 533, + "end": 538, "loc": { "start": { - "line": 21, + "line": 24, "column": 1 }, "end": { - "line": 21, + "line": 24, "column": 6 } } @@ -4851,16 +5787,16 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 473, - "end": 474, + "value": "b", + "start": 539, + "end": 540, "loc": { "start": { - "line": 21, + "line": 24, "column": 7 }, "end": { - "line": 21, + "line": 24, "column": 8 } } @@ -4879,15 +5815,15 @@ "updateContext": null }, "value": "=", - "start": 475, - "end": 476, + "start": 541, + "end": 542, "loc": { "start": { - "line": 21, + "line": 24, "column": 9 }, "end": { - "line": 21, + "line": 24, "column": 10 } } @@ -4904,16 +5840,16 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 477, - "end": 478, + "value": "A", + "start": 543, + "end": 544, "loc": { "start": { - "line": 21, + "line": 24, "column": 11 }, "end": { - "line": 21, + "line": 24, "column": 12 } } @@ -4931,15 +5867,15 @@ "binop": null, "updateContext": null }, - "start": 478, - "end": 479, + "start": 544, + "end": 545, "loc": { "start": { - "line": 21, + "line": 24, "column": 12 }, "end": { - "line": 21, + "line": 24, "column": 13 } } @@ -4956,17 +5892,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 479, - "end": 483, + "value": "right", + "start": 545, + "end": 550, "loc": { "start": { - "line": 21, + "line": 24, "column": 13 }, "end": { - "line": 21, - "column": 17 + "line": 24, + "column": 18 } } }, @@ -4983,67 +5919,44 @@ "binop": null, "updateContext": null }, - "start": 483, - "end": 484, + "start": 550, + "end": 551, "loc": { "start": { - "line": 21, - "column": 17 + "line": 24, + "column": 18 }, "end": { - "line": 21, - "column": 18 + "line": 24, + "column": 19 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "assert", - "start": 486, - "end": 492, + "value": "const", + "start": 553, + "end": 558, "loc": { "start": { - "line": 22, + "line": 25, "column": 1 }, "end": { - "line": 22, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 492, - "end": 493, - "loc": { - "start": { - "line": 22, - "column": 7 - }, - "end": { - "line": 22, - "column": 8 + "line": 25, + "column": 6 } } }, @@ -5059,79 +5972,52 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 493, - "end": 494, + "value": "c", + "start": 559, + "end": 560, "loc": { "start": { - "line": 22, - "column": 8 + "line": 25, + "column": 7 }, "end": { - "line": 22, - "column": 9 + "line": 25, + "column": 8 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 495, - "end": 505, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Node", - "start": 506, - "end": 510, + "value": "=", + "start": 561, + "end": 562, "loc": { "start": { - "line": 22, - "column": 21 + "line": 25, + "column": 9 }, "end": { - "line": 22, - "column": 25 + "line": 25, + "column": 10 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5139,23 +6025,24 @@ "postfix": false, "binop": null }, - "start": 510, - "end": 511, + "value": "B", + "start": 563, + "end": 564, "loc": { "start": { - "line": 22, - "column": 25 + "line": 25, + "column": 11 }, "end": { - "line": 22, - "column": 26 + "line": 25, + "column": 12 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5165,97 +6052,94 @@ "binop": null, "updateContext": null }, - "start": 511, - "end": 512, + "start": 564, + "end": 565, "loc": { "start": { - "line": 22, - "column": 26 + "line": 25, + "column": 12 }, "end": { - "line": 22, - "column": 27 + "line": 25, + "column": 13 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 514, - "end": 519, + "value": "right", + "start": 565, + "end": 570, "loc": { "start": { - "line": 23, - "column": 1 + "line": 25, + "column": 13 }, "end": { - "line": 23, - "column": 6 + "line": 25, + "column": 18 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "a", - "start": 520, - "end": 521, + "start": 570, + "end": 571, "loc": { "start": { - "line": 23, - "column": 7 + "line": 25, + "column": 18 }, "end": { - "line": 23, - "column": 8 + "line": 25, + "column": 19 } } }, { "type": { - "label": "=", + "label": "[", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 522, - "end": 523, + "start": 574, + "end": 575, "loc": { "start": { - "line": 23, - "column": 9 + "line": 27, + "column": 1 }, "end": { - "line": 23, - "column": 10 + "line": 27, + "column": 2 } } }, @@ -5272,16 +6156,16 @@ "binop": null }, "value": "A", - "start": 524, - "end": 525, + "start": 575, + "end": 576, "loc": { "start": { - "line": 23, - "column": 11 + "line": 27, + "column": 2 }, "end": { - "line": 23, - "column": 12 + "line": 27, + "column": 3 } } }, @@ -5298,16 +6182,16 @@ "binop": null, "updateContext": null }, - "start": 525, - "end": 526, + "start": 576, + "end": 577, "loc": { "start": { - "line": 23, - "column": 12 + "line": 27, + "column": 3 }, "end": { - "line": 23, - "column": 13 + "line": 27, + "column": 4 } } }, @@ -5323,23 +6207,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 526, - "end": 530, + "value": "key", + "start": 577, + "end": 580, "loc": { "start": { - "line": 23, - "column": 13 + "line": 27, + "column": 4 }, "end": { - "line": 23, - "column": 17 + "line": 27, + "column": 7 } } }, { "type": { - "label": ";", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5350,208 +6234,205 @@ "binop": null, "updateContext": null }, - "start": 530, - "end": 531, + "start": 580, + "end": 581, "loc": { "start": { - "line": 23, - "column": 17 + "line": 27, + "column": 7 }, "end": { - "line": 23, - "column": 18 + "line": 27, + "column": 8 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 533, - "end": 538, + "value": "B", + "start": 582, + "end": 583, "loc": { "start": { - "line": 24, - "column": 1 + "line": 27, + "column": 9 }, "end": { - "line": 24, - "column": 6 + "line": 27, + "column": 10 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "b", - "start": 539, - "end": 540, + "start": 583, + "end": 584, "loc": { "start": { - "line": 24, - "column": 7 + "line": 27, + "column": 10 }, "end": { - "line": 24, - "column": 8 + "line": 27, + "column": 11 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 541, - "end": 542, + "value": "key", + "start": 584, + "end": 587, "loc": { "start": { - "line": 24, - "column": 9 + "line": 27, + "column": 11 }, "end": { - "line": 24, - "column": 10 + "line": 27, + "column": 14 } } }, { "type": { - "label": "name", + "label": "]", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "A", - "start": 543, - "end": 544, + "start": 587, + "end": 588, "loc": { "start": { - "line": 24, - "column": 11 + "line": 27, + "column": 14 }, "end": { - "line": 24, - "column": 12 + "line": 27, + "column": 15 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 544, - "end": 545, + "value": "=", + "start": 589, + "end": 590, "loc": { "start": { - "line": 24, - "column": 12 + "line": 27, + "column": 16 }, "end": { - "line": 24, - "column": 13 + "line": 27, + "column": 17 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "[", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "right", - "start": 545, - "end": 550, + "start": 591, + "end": 592, "loc": { "start": { - "line": 24, - "column": 13 + "line": 27, + "column": 18 }, "end": { - "line": 24, - "column": 18 + "line": 27, + "column": 19 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 550, - "end": 551, + "value": "B", + "start": 592, + "end": 593, "loc": { "start": { - "line": 24, - "column": 18 + "line": 27, + "column": 19 }, "end": { - "line": 24, - "column": 19 + "line": 27, + "column": 20 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -5562,17 +6443,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 553, - "end": 558, + "start": 593, + "end": 594, "loc": { "start": { - "line": 25, - "column": 1 + "line": 27, + "column": 20 }, "end": { - "line": 25, - "column": 6 + "line": 27, + "column": 21 } } }, @@ -5588,44 +6468,43 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 559, - "end": 560, + "value": "key", + "start": 594, + "end": 597, "loc": { "start": { - "line": 25, - "column": 7 + "line": 27, + "column": 21 }, "end": { - "line": 25, - "column": 8 + "line": 27, + "column": 24 } } }, { "type": { - "label": "=", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 561, - "end": 562, + "start": 597, + "end": 598, "loc": { "start": { - "line": 25, - "column": 9 + "line": 27, + "column": 24 }, "end": { - "line": 25, - "column": 10 + "line": 27, + "column": 25 } } }, @@ -5641,17 +6520,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 563, - "end": 564, + "value": "A", + "start": 599, + "end": 600, "loc": { "start": { - "line": 25, - "column": 11 + "line": 27, + "column": 26 }, "end": { - "line": 25, - "column": 12 + "line": 27, + "column": 27 } } }, @@ -5668,16 +6547,16 @@ "binop": null, "updateContext": null }, - "start": 564, - "end": 565, + "start": 600, + "end": 601, "loc": { "start": { - "line": 25, - "column": 12 + "line": 27, + "column": 27 }, "end": { - "line": 25, - "column": 13 + "line": 27, + "column": 28 } } }, @@ -5693,17 +6572,43 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 565, - "end": 570, + "value": "key", + "start": 601, + "end": 604, "loc": { "start": { - "line": 25, - "column": 13 + "line": 27, + "column": 28 }, "end": { - "line": 25, - "column": 18 + "line": 27, + "column": 31 + } + } + }, + { + "type": { + "label": "]", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 604, + "end": 605, + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 32 } } }, @@ -5720,16 +6625,16 @@ "binop": null, "updateContext": null }, - "start": 570, - "end": 571, + "start": 605, + "end": 606, "loc": { "start": { - "line": 25, - "column": 18 + "line": 27, + "column": 32 }, "end": { - "line": 25, - "column": 19 + "line": 27, + "column": 33 } } }, @@ -5746,15 +6651,15 @@ "binop": null, "updateContext": null }, - "start": 574, - "end": 575, + "start": 608, + "end": 609, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 2 } } @@ -5772,15 +6677,15 @@ "binop": null }, "value": "A", - "start": 575, - "end": 576, + "start": 609, + "end": 610, "loc": { "start": { - "line": 27, + "line": 28, "column": 2 }, "end": { - "line": 27, + "line": 28, "column": 3 } } @@ -5798,15 +6703,15 @@ "binop": null, "updateContext": null }, - "start": 576, - "end": 577, + "start": 610, + "end": 611, "loc": { "start": { - "line": 27, + "line": 28, "column": 3 }, "end": { - "line": 27, + "line": 28, "column": 4 } } @@ -5823,17 +6728,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 577, - "end": 580, + "value": "_color", + "start": 611, + "end": 617, "loc": { "start": { - "line": 27, + "line": 28, "column": 4 }, "end": { - "line": 27, - "column": 7 + "line": 28, + "column": 10 } } }, @@ -5850,16 +6755,16 @@ "binop": null, "updateContext": null }, - "start": 580, - "end": 581, + "start": 617, + "end": 618, "loc": { "start": { - "line": 27, - "column": 7 + "line": 28, + "column": 10 }, "end": { - "line": 27, - "column": 8 + "line": 28, + "column": 11 } } }, @@ -5876,16 +6781,16 @@ "binop": null }, "value": "B", - "start": 582, - "end": 583, + "start": 619, + "end": 620, "loc": { "start": { - "line": 27, - "column": 9 + "line": 28, + "column": 12 }, "end": { - "line": 27, - "column": 10 + "line": 28, + "column": 13 } } }, @@ -5902,16 +6807,16 @@ "binop": null, "updateContext": null }, - "start": 583, - "end": 584, + "start": 620, + "end": 621, "loc": { "start": { - "line": 27, - "column": 10 + "line": 28, + "column": 13 }, "end": { - "line": 27, - "column": 11 + "line": 28, + "column": 14 } } }, @@ -5927,17 +6832,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 584, - "end": 587, + "value": "_color", + "start": 621, + "end": 627, "loc": { "start": { - "line": 27, - "column": 11 + "line": 28, + "column": 14 }, "end": { - "line": 27, - "column": 14 + "line": 28, + "column": 20 } } }, @@ -5954,16 +6859,16 @@ "binop": null, "updateContext": null }, - "start": 587, - "end": 588, + "start": 627, + "end": 628, "loc": { "start": { - "line": 27, - "column": 14 + "line": 28, + "column": 20 }, "end": { - "line": 27, - "column": 15 + "line": 28, + "column": 21 } } }, @@ -5981,16 +6886,16 @@ "updateContext": null }, "value": "=", - "start": 589, - "end": 590, + "start": 629, + "end": 630, "loc": { "start": { - "line": 27, - "column": 16 + "line": 28, + "column": 22 }, "end": { - "line": 27, - "column": 17 + "line": 28, + "column": 23 } } }, @@ -6007,16 +6912,16 @@ "binop": null, "updateContext": null }, - "start": 591, - "end": 592, + "start": 631, + "end": 632, "loc": { "start": { - "line": 27, - "column": 18 + "line": 28, + "column": 24 }, "end": { - "line": 27, - "column": 19 + "line": 28, + "column": 25 } } }, @@ -6033,16 +6938,16 @@ "binop": null }, "value": "B", - "start": 592, - "end": 593, + "start": 632, + "end": 633, "loc": { "start": { - "line": 27, - "column": 19 + "line": 28, + "column": 25 }, "end": { - "line": 27, - "column": 20 + "line": 28, + "column": 26 } } }, @@ -6059,16 +6964,16 @@ "binop": null, "updateContext": null }, - "start": 593, - "end": 594, + "start": 633, + "end": 634, "loc": { "start": { - "line": 27, - "column": 20 + "line": 28, + "column": 26 }, "end": { - "line": 27, - "column": 21 + "line": 28, + "column": 27 } } }, @@ -6084,17 +6989,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 594, - "end": 597, + "value": "_color", + "start": 634, + "end": 640, "loc": { "start": { - "line": 27, - "column": 21 + "line": 28, + "column": 27 }, "end": { - "line": 27, - "column": 24 + "line": 28, + "column": 33 } } }, @@ -6111,16 +7016,16 @@ "binop": null, "updateContext": null }, - "start": 597, - "end": 598, + "start": 640, + "end": 641, "loc": { "start": { - "line": 27, - "column": 24 + "line": 28, + "column": 33 }, "end": { - "line": 27, - "column": 25 + "line": 28, + "column": 34 } } }, @@ -6137,16 +7042,16 @@ "binop": null }, "value": "A", - "start": 599, - "end": 600, + "start": 642, + "end": 643, "loc": { "start": { - "line": 27, - "column": 26 + "line": 28, + "column": 35 }, "end": { - "line": 27, - "column": 27 + "line": 28, + "column": 36 } } }, @@ -6163,16 +7068,16 @@ "binop": null, "updateContext": null }, - "start": 600, - "end": 601, + "start": 643, + "end": 644, "loc": { "start": { - "line": 27, - "column": 27 + "line": 28, + "column": 36 }, "end": { - "line": 27, - "column": 28 + "line": 28, + "column": 37 } } }, @@ -6188,17 +7093,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 601, - "end": 604, + "value": "_color", + "start": 644, + "end": 650, "loc": { "start": { - "line": 27, - "column": 28 + "line": 28, + "column": 37 }, "end": { - "line": 27, - "column": 31 + "line": 28, + "column": 43 } } }, @@ -6215,16 +7120,16 @@ "binop": null, "updateContext": null }, - "start": 604, - "end": 605, + "start": 650, + "end": 651, "loc": { "start": { - "line": 27, - "column": 31 + "line": 28, + "column": 43 }, "end": { - "line": 27, - "column": 32 + "line": 28, + "column": 44 } } }, @@ -6241,42 +7146,16 @@ "binop": null, "updateContext": null }, - "start": 605, - "end": 606, - "loc": { - "start": { - "line": 27, - "column": 32 - }, - "end": { - "line": 27, - "column": 33 - } - } - }, - { - "type": { - "label": "[", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 608, - "end": 609, + "start": 651, + "end": 652, "loc": { "start": { "line": 28, - "column": 1 + "column": 44 }, "end": { "line": 28, - "column": 2 + "column": 45 } } }, @@ -6292,17 +7171,17 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 609, - "end": 610, + "value": "B", + "start": 655, + "end": 656, "loc": { "start": { - "line": 28, - "column": 2 + "line": 30, + "column": 1 }, "end": { - "line": 28, - "column": 3 + "line": 30, + "column": 2 } } }, @@ -6319,68 +7198,16 @@ "binop": null, "updateContext": null }, - "start": 610, - "end": 611, - "loc": { - "start": { - "line": 28, - "column": 3 - }, - "end": { - "line": 28, - "column": 4 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 611, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 4 - }, - "end": { - "line": 28, - "column": 10 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 617, - "end": 618, + "start": 656, + "end": 657, "loc": { "start": { - "line": 28, - "column": 10 + "line": 30, + "column": 2 }, "end": { - "line": 28, - "column": 11 + "line": 30, + "column": 3 } } }, @@ -6396,43 +7223,44 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 619, - "end": 620, + "value": "left", + "start": 657, + "end": 661, "loc": { "start": { - "line": 28, - "column": 12 + "line": 30, + "column": 3 }, "end": { - "line": 28, - "column": 13 + "line": 30, + "column": 7 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 620, - "end": 621, + "value": "=", + "start": 662, + "end": 663, "loc": { "start": { - "line": 28, - "column": 13 + "line": 30, + "column": 8 }, "end": { - "line": 28, - "column": 14 + "line": 30, + "column": 9 } } }, @@ -6448,24 +7276,24 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 621, - "end": 627, + "value": "a", + "start": 664, + "end": 665, "loc": { "start": { - "line": 28, - "column": 14 + "line": 30, + "column": 10 }, "end": { - "line": 28, - "column": 20 + "line": 30, + "column": 11 } } }, { "type": { - "label": "]", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6475,51 +7303,50 @@ "binop": null, "updateContext": null }, - "start": 627, - "end": 628, + "start": 665, + "end": 666, "loc": { "start": { - "line": 28, - "column": 20 + "line": 30, + "column": 11 }, "end": { - "line": 28, - "column": 21 + "line": 30, + "column": 12 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 629, - "end": 630, + "value": "B", + "start": 668, + "end": 669, "loc": { "start": { - "line": 28, - "column": 22 + "line": 31, + "column": 1 }, "end": { - "line": 28, - "column": 23 + "line": 31, + "column": 2 } } }, { "type": { - "label": "[", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6528,16 +7355,16 @@ "binop": null, "updateContext": null }, - "start": 631, - "end": 632, + "start": 669, + "end": 670, "loc": { "start": { - "line": 28, - "column": 24 + "line": 31, + "column": 2 }, "end": { - "line": 28, - "column": 25 + "line": 31, + "column": 3 } } }, @@ -6553,43 +7380,44 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 632, - "end": 633, + "value": "right", + "start": 670, + "end": 675, "loc": { "start": { - "line": 28, - "column": 25 + "line": 31, + "column": 3 }, "end": { - "line": 28, - "column": 26 + "line": 31, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 633, - "end": 634, + "value": "=", + "start": 676, + "end": 677, "loc": { "start": { - "line": 28, - "column": 26 + "line": 31, + "column": 9 }, "end": { - "line": 28, - "column": 27 + "line": 31, + "column": 10 } } }, @@ -6605,23 +7433,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 634, - "end": 640, + "value": "A", + "start": 678, + "end": 679, "loc": { "start": { - "line": 28, - "column": 27 + "line": 31, + "column": 11 }, "end": { - "line": 28, - "column": 33 + "line": 31, + "column": 12 } } }, { "type": { - "label": ",", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -6632,16 +7460,16 @@ "binop": null, "updateContext": null }, - "start": 640, - "end": 641, + "start": 679, + "end": 680, "loc": { "start": { - "line": 28, - "column": 33 + "line": 31, + "column": 12 }, "end": { - "line": 28, - "column": 34 + "line": 31, + "column": 13 } } }, @@ -6658,16 +7486,16 @@ "binop": null }, "value": "A", - "start": 642, - "end": 643, + "start": 683, + "end": 684, "loc": { "start": { - "line": 28, - "column": 35 + "line": 33, + "column": 1 }, "end": { - "line": 28, - "column": 36 + "line": 33, + "column": 2 } } }, @@ -6684,16 +7512,16 @@ "binop": null, "updateContext": null }, - "start": 643, - "end": 644, + "start": 684, + "end": 685, "loc": { "start": { - "line": 28, - "column": 36 + "line": 33, + "column": 2 }, "end": { - "line": 28, - "column": 37 + "line": 33, + "column": 3 } } }, @@ -6709,43 +7537,70 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 644, - "end": 650, + "value": "left", + "start": 685, + "end": 689, "loc": { "start": { - "line": 28, - "column": 37 + "line": 33, + "column": 3 }, "end": { - "line": 28, - "column": 43 + "line": 33, + "column": 7 } } }, { "type": { - "label": "]", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 650, - "end": 651, + "value": "=", + "start": 690, + "end": 691, "loc": { "start": { - "line": 28, - "column": 43 + "line": 33, + "column": 8 }, "end": { - "line": 28, - "column": 44 + "line": 33, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "b", + "start": 692, + "end": 693, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 11 } } }, @@ -6762,16 +7617,16 @@ "binop": null, "updateContext": null }, - "start": 651, - "end": 652, + "start": 693, + "end": 694, "loc": { "start": { - "line": 28, - "column": 44 + "line": 33, + "column": 11 }, "end": { - "line": 28, - "column": 45 + "line": 33, + "column": 12 } } }, @@ -6787,16 +7642,16 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 655, - "end": 656, + "value": "A", + "start": 696, + "end": 697, "loc": { "start": { - "line": 30, + "line": 34, "column": 1 }, "end": { - "line": 30, + "line": 34, "column": 2 } } @@ -6814,15 +7669,15 @@ "binop": null, "updateContext": null }, - "start": 656, - "end": 657, + "start": 697, + "end": 698, "loc": { "start": { - "line": 30, + "line": 34, "column": 2 }, "end": { - "line": 30, + "line": 34, "column": 3 } } @@ -6839,17 +7694,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 657, - "end": 661, + "value": "right", + "start": 698, + "end": 703, "loc": { "start": { - "line": 30, + "line": 34, "column": 3 }, "end": { - "line": 30, - "column": 7 + "line": 34, + "column": 8 } } }, @@ -6867,16 +7722,16 @@ "updateContext": null }, "value": "=", - "start": 662, - "end": 663, + "start": 704, + "end": 705, "loc": { "start": { - "line": 30, - "column": 8 + "line": 34, + "column": 9 }, "end": { - "line": 30, - "column": 9 + "line": 34, + "column": 10 } } }, @@ -6892,17 +7747,17 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 664, - "end": 665, + "value": "c", + "start": 706, + "end": 707, "loc": { "start": { - "line": 30, - "column": 10 + "line": 34, + "column": 11 }, "end": { - "line": 30, - "column": 11 + "line": 34, + "column": 12 } } }, @@ -6919,68 +7774,69 @@ "binop": null, "updateContext": null }, - "start": 665, - "end": 666, + "start": 707, + "end": 708, "loc": { "start": { - "line": 30, - "column": 11 + "line": 34, + "column": 12 }, "end": { - "line": 30, - "column": 12 + "line": 34, + "column": 13 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "B", - "start": 668, - "end": 669, + "value": "if", + "start": 711, + "end": 713, "loc": { "start": { - "line": 31, + "line": 36, "column": 1 }, "end": { - "line": 31, - "column": 2 + "line": 36, + "column": 3 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 669, - "end": 670, + "start": 714, + "end": 715, "loc": { "start": { - "line": 31, - "column": 2 + "line": 36, + "column": 4 }, "end": { - "line": 31, - "column": 3 + "line": 36, + "column": 5 } } }, @@ -6996,50 +7852,51 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 670, - "end": 675, + "value": "a", + "start": 715, + "end": 716, "loc": { "start": { - "line": 31, - "column": 3 + "line": 36, + "column": 5 }, "end": { - "line": 31, - "column": 8 + "line": 36, + "column": 6 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 676, - "end": 677, + "value": "!==", + "start": 717, + "end": 720, "loc": { "start": { - "line": 31, - "column": 9 + "line": 36, + "column": 7 }, "end": { - "line": 31, + "line": 36, "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7047,45 +7904,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "A", - "start": 678, - "end": 679, + "value": "null", + "start": 721, + "end": 725, "loc": { "start": { - "line": 31, + "line": 36, "column": 11 }, "end": { - "line": 31, - "column": 12 + "line": 36, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 679, - "end": 680, + "start": 725, + "end": 726, "loc": { "start": { - "line": 31, - "column": 12 + "line": 36, + "column": 15 }, "end": { - "line": 31, - "column": 13 + "line": 36, + "column": 16 } } }, @@ -7101,17 +7958,17 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 683, - "end": 684, + "value": "a", + "start": 727, + "end": 728, "loc": { "start": { - "line": 33, - "column": 1 + "line": 36, + "column": 17 }, "end": { - "line": 33, - "column": 2 + "line": 36, + "column": 18 } } }, @@ -7128,16 +7985,16 @@ "binop": null, "updateContext": null }, - "start": 684, - "end": 685, + "start": 728, + "end": 729, "loc": { "start": { - "line": 33, - "column": 2 + "line": 36, + "column": 18 }, "end": { - "line": 33, - "column": 3 + "line": 36, + "column": 19 } } }, @@ -7153,17 +8010,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 685, - "end": 689, + "value": "parent", + "start": 729, + "end": 735, "loc": { "start": { - "line": 33, - "column": 3 + "line": 36, + "column": 19 }, "end": { - "line": 33, - "column": 7 + "line": 36, + "column": 25 } } }, @@ -7181,16 +8038,16 @@ "updateContext": null }, "value": "=", - "start": 690, - "end": 691, + "start": 736, + "end": 737, "loc": { "start": { - "line": 33, - "column": 8 + "line": 36, + "column": 26 }, "end": { - "line": 33, - "column": 9 + "line": 36, + "column": 27 } } }, @@ -7206,17 +8063,17 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 692, - "end": 693, + "value": "B", + "start": 738, + "end": 739, "loc": { "start": { - "line": 33, - "column": 10 + "line": 36, + "column": 28 }, "end": { - "line": 33, - "column": 11 + "line": 36, + "column": 29 } } }, @@ -7233,68 +8090,69 @@ "binop": null, "updateContext": null }, - "start": 693, - "end": 694, + "start": 739, + "end": 740, "loc": { "start": { - "line": 33, - "column": 11 + "line": 36, + "column": 29 }, "end": { - "line": 33, - "column": 12 + "line": 36, + "column": 30 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "A", - "start": 696, - "end": 697, + "value": "if", + "start": 742, + "end": 744, "loc": { "start": { - "line": 34, + "line": 37, "column": 1 }, - "end": { - "line": 34, - "column": 2 + "end": { + "line": 37, + "column": 3 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 697, - "end": 698, + "start": 745, + "end": 746, "loc": { "start": { - "line": 34, - "column": 2 + "line": 37, + "column": 4 }, "end": { - "line": 34, - "column": 3 + "line": 37, + "column": 5 } } }, @@ -7310,50 +8168,51 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 698, - "end": 703, + "value": "b", + "start": 746, + "end": 747, "loc": { "start": { - "line": 34, - "column": 3 + "line": 37, + "column": 5 }, "end": { - "line": 34, - "column": 8 + "line": 37, + "column": 6 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 704, - "end": 705, + "value": "!==", + "start": 748, + "end": 751, "loc": { "start": { - "line": 34, - "column": 9 + "line": 37, + "column": 7 }, "end": { - "line": 34, + "line": 37, "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7361,45 +8220,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "c", - "start": 706, - "end": 707, + "value": "null", + "start": 752, + "end": 756, "loc": { "start": { - "line": 34, + "line": 37, "column": 11 }, "end": { - "line": 34, - "column": 12 + "line": 37, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 707, - "end": 708, + "start": 756, + "end": 757, "loc": { "start": { - "line": 34, - "column": 12 + "line": 37, + "column": 15 }, "end": { - "line": 34, - "column": 13 + "line": 37, + "column": 16 } } }, @@ -7415,17 +8274,17 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 711, - "end": 712, + "value": "b", + "start": 758, + "end": 759, "loc": { "start": { - "line": 36, - "column": 1 + "line": 37, + "column": 17 }, "end": { - "line": 36, - "column": 2 + "line": 37, + "column": 18 } } }, @@ -7442,16 +8301,16 @@ "binop": null, "updateContext": null }, - "start": 712, - "end": 713, + "start": 759, + "end": 760, "loc": { "start": { - "line": 36, - "column": 2 + "line": 37, + "column": 18 }, "end": { - "line": 36, - "column": 3 + "line": 37, + "column": 19 } } }, @@ -7468,16 +8327,16 @@ "binop": null }, "value": "parent", - "start": 713, - "end": 719, + "start": 760, + "end": 766, "loc": { "start": { - "line": 36, - "column": 3 + "line": 37, + "column": 19 }, "end": { - "line": 36, - "column": 9 + "line": 37, + "column": 25 } } }, @@ -7495,16 +8354,16 @@ "updateContext": null }, "value": "=", - "start": 720, - "end": 721, + "start": 767, + "end": 768, "loc": { "start": { - "line": 36, - "column": 10 + "line": 37, + "column": 26 }, "end": { - "line": 36, - "column": 11 + "line": 37, + "column": 27 } } }, @@ -7520,17 +8379,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 722, - "end": 723, + "value": "A", + "start": 769, + "end": 770, "loc": { "start": { - "line": 36, - "column": 12 + "line": 37, + "column": 28 }, "end": { - "line": 36, - "column": 13 + "line": 37, + "column": 29 } } }, @@ -7547,68 +8406,69 @@ "binop": null, "updateContext": null }, - "start": 723, - "end": 724, + "start": 770, + "end": 771, "loc": { "start": { - "line": 36, - "column": 13 + "line": 37, + "column": 29 }, "end": { - "line": 36, - "column": 14 + "line": 37, + "column": 30 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "b", - "start": 726, - "end": 727, + "value": "if", + "start": 773, + "end": 775, "loc": { "start": { - "line": 37, + "line": 38, "column": 1 }, "end": { - "line": 37, - "column": 2 + "line": 38, + "column": 3 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 727, - "end": 728, + "start": 776, + "end": 777, "loc": { "start": { - "line": 37, - "column": 2 + "line": 38, + "column": 4 }, "end": { - "line": 37, - "column": 3 + "line": 38, + "column": 5 } } }, @@ -7624,50 +8484,51 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 728, - "end": 734, + "value": "c", + "start": 777, + "end": 778, "loc": { "start": { - "line": 37, - "column": 3 + "line": 38, + "column": 5 }, "end": { - "line": 37, - "column": 9 + "line": 38, + "column": 6 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 735, - "end": 736, + "value": "!==", + "start": 779, + "end": 782, "loc": { "start": { - "line": 37, - "column": 10 + "line": 38, + "column": 7 }, "end": { - "line": 37, - "column": 11 + "line": 38, + "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7675,45 +8536,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "A", - "start": 737, - "end": 738, + "value": "null", + "start": 783, + "end": 787, "loc": { "start": { - "line": 37, - "column": 12 + "line": 38, + "column": 11 }, "end": { - "line": 37, - "column": 13 + "line": 38, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 738, - "end": 739, + "start": 787, + "end": 788, "loc": { "start": { - "line": 37, - "column": 13 + "line": 38, + "column": 15 }, "end": { - "line": 37, - "column": 14 + "line": 38, + "column": 16 } } }, @@ -7730,16 +8591,16 @@ "binop": null }, "value": "c", - "start": 741, - "end": 742, + "start": 789, + "end": 790, "loc": { "start": { "line": 38, - "column": 1 + "column": 17 }, "end": { "line": 38, - "column": 2 + "column": 18 } } }, @@ -7756,16 +8617,16 @@ "binop": null, "updateContext": null }, - "start": 742, - "end": 743, + "start": 790, + "end": 791, "loc": { "start": { "line": 38, - "column": 2 + "column": 18 }, "end": { "line": 38, - "column": 3 + "column": 19 } } }, @@ -7782,16 +8643,16 @@ "binop": null }, "value": "parent", - "start": 743, - "end": 749, + "start": 791, + "end": 797, "loc": { "start": { "line": 38, - "column": 3 + "column": 19 }, "end": { "line": 38, - "column": 9 + "column": 25 } } }, @@ -7809,16 +8670,16 @@ "updateContext": null }, "value": "=", - "start": 750, - "end": 751, + "start": 798, + "end": 799, "loc": { "start": { "line": 38, - "column": 10 + "column": 26 }, "end": { "line": 38, - "column": 11 + "column": 27 } } }, @@ -7835,16 +8696,16 @@ "binop": null }, "value": "A", - "start": 752, - "end": 753, + "start": 800, + "end": 801, "loc": { "start": { "line": 38, - "column": 12 + "column": 28 }, "end": { "line": 38, - "column": 13 + "column": 29 } } }, @@ -7861,16 +8722,16 @@ "binop": null, "updateContext": null }, - "start": 753, - "end": 754, + "start": 801, + "end": 802, "loc": { "start": { "line": 38, - "column": 13 + "column": 29 }, "end": { "line": 38, - "column": 14 + "column": 30 } } }, @@ -7886,8 +8747,8 @@ "postfix": false, "binop": null }, - "start": 755, - "end": 756, + "start": 803, + "end": 804, "loc": { "start": { "line": 39, @@ -7912,8 +8773,8 @@ "binop": null, "updateContext": null }, - "start": 756, - "end": 757, + "start": 804, + "end": 805, "loc": { "start": { "line": 39, @@ -7940,8 +8801,8 @@ "updateContext": null }, "value": "export", - "start": 759, - "end": 765, + "start": 807, + "end": 813, "loc": { "start": { "line": 41, @@ -7968,8 +8829,8 @@ "updateContext": null }, "value": "default", - "start": 766, - "end": 773, + "start": 814, + "end": 821, "loc": { "start": { "line": 41, @@ -7994,8 +8855,8 @@ "binop": null }, "value": "rotate_right", - "start": 774, - "end": 786, + "start": 822, + "end": 834, "loc": { "start": { "line": 41, @@ -8020,8 +8881,8 @@ "binop": null, "updateContext": null }, - "start": 786, - "end": 787, + "start": 834, + "end": 835, "loc": { "start": { "line": 41, @@ -8046,8 +8907,8 @@ "binop": null, "updateContext": null }, - "start": 788, - "end": 788, + "start": 836, + "end": 836, "loc": { "start": { "line": 42, diff --git a/ast/source/search/search.js.json b/ast/source/search/search.js.json index ef3731f..92beab9 100644 --- a/ast/source/search/search.js.json +++ b/ast/source/search/search.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 652, + "end": 594, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 33, + "line": 30, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 652, + "end": 594, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 33, + "line": 30, "column": 0 } }, @@ -187,14 +187,14 @@ { "type": "Identifier", "start": 316, - "end": 627, + "end": 569, "loc": { "start": { "line": 12, "column": 0 }, "end": { - "line": 30, + "line": 27, "column": 2 } }, @@ -202,14 +202,14 @@ { "type": "VariableDeclarator", "start": 322, - "end": 626, + "end": 568, "loc": { "start": { "line": 12, "column": 6 }, "end": { - "line": 30, + "line": 27, "column": 1 } }, @@ -234,14 +234,14 @@ "init": { "type": "ArrowFunctionExpression", "start": 331, - "end": 626, + "end": 568, "loc": { "start": { "line": 12, "column": 15 }, "end": { - "line": 30, + "line": 27, "column": 1 } }, @@ -305,14 +305,14 @@ "body": { "type": "BlockStatement", "start": 355, - "end": 626, + "end": 568, "loc": { "start": { "line": 12, "column": 39 }, "end": { - "line": 30, + "line": 27, "column": 1 } }, @@ -419,14 +419,14 @@ { "type": "WhileStatement", "start": 389, - "end": 624, + "end": 566, "loc": { "start": { "line": 14, "column": 1 }, "end": { - "line": 29, + "line": 26, "column": 2 } }, @@ -449,14 +449,14 @@ "body": { "type": "BlockStatement", "start": 402, - "end": 624, + "end": 566, "loc": { "start": { "line": 14, "column": 14 }, "end": { - "line": 29, + "line": 26, "column": 2 } }, @@ -732,9 +732,9 @@ "alternate": null }, { - "type": "VariableDeclaration", + "type": "ExpressionStatement", "start": 481, - "end": 526, + "end": 519, "loc": { "start": { "line": 21, @@ -742,217 +742,215 @@ }, "end": { "line": 21, - "column": 47 + "column": 40 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 487, - "end": 525, + "expression": { + "type": "AssignmentExpression", + "start": 481, + "end": 518, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 39 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 481, + "end": 485, "loc": { "start": { "line": 21, - "column": 8 + "column": 2 + }, + "end": { + "line": 21, + "column": 6 + }, + "identifierName": "root" + }, + "name": "root" + }, + "right": { + "type": "ConditionalExpression", + "start": 488, + "end": 518, + "loc": { + "start": { + "line": 21, + "column": 9 }, "end": { "line": 21, - "column": 46 + "column": 39 } }, - "id": { - "type": "Identifier", - "start": 487, - "end": 492, + "test": { + "type": "BinaryExpression", + "start": 488, + "end": 493, "loc": { "start": { "line": 21, - "column": 8 + "column": 9 }, "end": { "line": 21, - "column": 13 + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 488, + "end": 489, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 10 + }, + "identifierName": "d" }, - "identifierName": "child" + "name": "d" }, - "name": "child" + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 492, + "end": 493, + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } }, - "init": { - "type": "ConditionalExpression", - "start": 495, - "end": 525, + "consequent": { + "type": "MemberExpression", + "start": 496, + "end": 505, "loc": { "start": { "line": 21, - "column": 16 + "column": 17 }, "end": { "line": 21, - "column": 46 + "column": 26 } }, - "test": { - "type": "BinaryExpression", - "start": 495, + "object": { + "type": "Identifier", + "start": 496, "end": 500, "loc": { "start": { "line": 21, - "column": 16 + "column": 17 }, "end": { "line": 21, "column": 21 - } - }, - "left": { - "type": "Identifier", - "start": 495, - "end": 496, - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 17 - }, - "identifierName": "d" }, - "name": "d" + "identifierName": "root" }, - "operator": "<", - "right": { - "type": "NumericLiteral", - "start": 499, - "end": 500, - "loc": { - "start": { - "line": 21, - "column": 20 - }, - "end": { - "line": 21, - "column": 21 - } + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 501, + "end": 505, + "loc": { + "start": { + "line": 21, + "column": 22 }, - "extra": { - "rawValue": 0, - "raw": "0" + "end": { + "line": 21, + "column": 26 }, - "value": 0 + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "alternate": { + "type": "MemberExpression", + "start": 508, + "end": 518, + "loc": { + "start": { + "line": 21, + "column": 29 + }, + "end": { + "line": 21, + "column": 39 } }, - "consequent": { - "type": "MemberExpression", - "start": 503, + "object": { + "type": "Identifier", + "start": 508, "end": 512, "loc": { "start": { "line": 21, - "column": 24 + "column": 29 }, "end": { "line": 21, "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 503, - "end": 507, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 28 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 508, - "end": 512, - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 33 - }, - "identifierName": "left" }, - "name": "left" + "identifierName": "root" }, - "computed": false + "name": "root" }, - "alternate": { - "type": "MemberExpression", - "start": 515, - "end": 525, + "property": { + "type": "Identifier", + "start": 513, + "end": 518, "loc": { "start": { "line": 21, - "column": 36 + "column": 34 }, "end": { "line": 21, - "column": 46 - } - }, - "object": { - "type": "Identifier", - "start": 515, - "end": 519, - "loc": { - "start": { - "line": 21, - "column": 36 - }, - "end": { - "line": 21, - "column": 40 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 520, - "end": 525, - "loc": { - "start": { - "line": 21, - "column": 41 - }, - "end": { - "line": 21, - "column": 46 - }, - "identifierName": "right" + "column": 39 }, - "name": "right" + "identifierName": "right" }, - "computed": false - } + "name": "right" + }, + "computed": false } } - ], - "kind": "const" + } }, { "type": "IfStatement", - "start": 530, - "end": 571, + "start": 523, + "end": 563, "loc": { "start": { "line": 23, @@ -964,9 +962,9 @@ } }, "test": { - "type": "CallExpression", - "start": 534, - "end": 548, + "type": "BinaryExpression", + "start": 527, + "end": 540, "loc": { "start": { "line": 23, @@ -974,13 +972,13 @@ }, "end": { "line": 23, - "column": 20 + "column": 19 } }, - "callee": { - "type": "MemberExpression", - "start": 534, - "end": 546, + "left": { + "type": "Identifier", + "start": 527, + "end": 531, "loc": { "start": { "line": 23, @@ -988,55 +986,37 @@ }, "end": { "line": 23, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 534, - "end": 539, - "loc": { - "start": { - "line": 23, - "column": 6 - }, - "end": { - "line": 23, - "column": 11 - }, - "identifierName": "child" - }, - "name": "child" - }, - "property": { - "type": "Identifier", - "start": 540, - "end": 546, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 18 - }, - "identifierName": "isLeaf" + "column": 10 }, - "name": "isLeaf" + "identifierName": "root" }, - "computed": false + "name": "root" }, - "arguments": [] + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 536, + "end": 540, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 19 + } + } + } }, "consequent": { "type": "BlockStatement", - "start": 550, - "end": 571, + "start": 542, + "end": 563, "loc": { "start": { "line": 23, - "column": 22 + "column": 21 }, "end": { "line": 25, @@ -1046,8 +1026,8 @@ "body": [ { "type": "ReturnStatement", - "start": 555, - "end": 567, + "start": 547, + "end": 559, "loc": { "start": { "line": 24, @@ -1060,8 +1040,8 @@ }, "argument": { "type": "NullLiteral", - "start": 562, - "end": 566, + "start": 554, + "end": 558, "loc": { "start": { "line": 24, @@ -1078,170 +1058,6 @@ "directives": [] }, "alternate": null - }, - { - "type": "ExpressionStatement", - "start": 575, - "end": 605, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 32 - } - }, - "expression": { - "type": "CallExpression", - "start": 575, - "end": 604, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 575, - "end": 581, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 582, - "end": 603, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 30 - } - }, - "left": { - "type": "Identifier", - "start": 582, - "end": 587, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 14 - }, - "identifierName": "child" - }, - "name": "child" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 599, - "end": 603, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 30 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 608, - "end": 621, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 15 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 608, - "end": 620, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 14 - } - }, - "operator": "=", - "left": { - "type": "Identifier", - "start": 608, - "end": 612, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 6 - }, - "identifierName": "root" - }, - "name": "root" - }, - "right": { - "type": "Identifier", - "start": 615, - "end": 620, - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 14 - }, - "identifierName": "child" - }, - "name": "child" - } - } } ], "directives": [] @@ -1261,29 +1077,29 @@ }, { "type": "Identifier", - "start": 629, - "end": 651, + "start": 571, + "end": 593, "loc": { "start": { - "line": 32, + "line": 29, "column": 0 }, "end": { - "line": 32, + "line": 29, "column": 22 } }, "declaration": { "type": "Identifier", - "start": 644, - "end": 650, + "start": 586, + "end": 592, "loc": { "start": { - "line": 32, + "line": 29, "column": 15 }, "end": { - "line": 32, + "line": 29, "column": 21 }, "identifierName": "search" @@ -1296,29 +1112,29 @@ }, { "type": "ExportDefaultDeclaration", - "start": 629, - "end": 651, + "start": 571, + "end": 593, "loc": { "start": { - "line": 32, + "line": 29, "column": 0 }, "end": { - "line": 32, + "line": 29, "column": 22 } }, "declaration": { "type": "VariableDeclaration", "start": 316, - "end": 627, + "end": 569, "loc": { "start": { "line": 12, "column": 0 }, "end": { - "line": 30, + "line": 27, "column": 2 } }, @@ -1326,14 +1142,14 @@ { "type": "VariableDeclarator", "start": 322, - "end": 626, + "end": 568, "loc": { "start": { "line": 12, "column": 6 }, "end": { - "line": 30, + "line": 27, "column": 1 } }, @@ -1358,14 +1174,14 @@ "init": { "type": "ArrowFunctionExpression", "start": 331, - "end": 626, + "end": 568, "loc": { "start": { "line": 12, "column": 15 }, "end": { - "line": 30, + "line": 27, "column": 1 } }, @@ -1446,14 +1262,14 @@ "body": { "type": "BlockStatement", "start": 355, - "end": 626, + "end": 568, "loc": { "start": { "line": 12, "column": 39 }, "end": { - "line": 30, + "line": 27, "column": 1 } }, @@ -1560,14 +1376,14 @@ { "type": "WhileStatement", "start": 389, - "end": 624, + "end": 566, "loc": { "start": { "line": 14, "column": 1 }, "end": { - "line": 29, + "line": 26, "column": 2 } }, @@ -1590,14 +1406,14 @@ "body": { "type": "BlockStatement", "start": 402, - "end": 624, + "end": 566, "loc": { "start": { "line": 14, "column": 14 }, "end": { - "line": 29, + "line": 26, "column": 2 } }, @@ -1873,9 +1689,9 @@ "alternate": null }, { - "type": "VariableDeclaration", + "type": "ExpressionStatement", "start": 481, - "end": 526, + "end": 519, "loc": { "start": { "line": 21, @@ -1883,217 +1699,215 @@ }, "end": { "line": 21, - "column": 47 + "column": 40 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 487, - "end": 525, + "expression": { + "type": "AssignmentExpression", + "start": 481, + "end": 518, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 39 + } + }, + "operator": "=", + "left": { + "type": "Identifier", + "start": 481, + "end": 485, "loc": { "start": { "line": 21, - "column": 8 + "column": 2 + }, + "end": { + "line": 21, + "column": 6 + }, + "identifierName": "root" + }, + "name": "root" + }, + "right": { + "type": "ConditionalExpression", + "start": 488, + "end": 518, + "loc": { + "start": { + "line": 21, + "column": 9 }, "end": { "line": 21, - "column": 46 + "column": 39 } }, - "id": { - "type": "Identifier", - "start": 487, - "end": 492, + "test": { + "type": "BinaryExpression", + "start": 488, + "end": 493, "loc": { "start": { "line": 21, - "column": 8 + "column": 9 }, "end": { "line": 21, - "column": 13 + "column": 14 + } + }, + "left": { + "type": "Identifier", + "start": 488, + "end": 489, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 10 + }, + "identifierName": "d" }, - "identifierName": "child" + "name": "d" }, - "name": "child" + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 492, + "end": 493, + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 14 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } }, - "init": { - "type": "ConditionalExpression", - "start": 495, - "end": 525, + "consequent": { + "type": "MemberExpression", + "start": 496, + "end": 505, "loc": { "start": { "line": 21, - "column": 16 + "column": 17 }, "end": { "line": 21, - "column": 46 + "column": 26 } }, - "test": { - "type": "BinaryExpression", - "start": 495, + "object": { + "type": "Identifier", + "start": 496, "end": 500, "loc": { "start": { "line": 21, - "column": 16 + "column": 17 }, "end": { "line": 21, "column": 21 - } - }, - "left": { - "type": "Identifier", - "start": 495, - "end": 496, - "loc": { - "start": { - "line": 21, - "column": 16 - }, - "end": { - "line": 21, - "column": 17 - }, - "identifierName": "d" }, - "name": "d" + "identifierName": "root" }, - "operator": "<", - "right": { - "type": "NumericLiteral", - "start": 499, - "end": 500, - "loc": { - "start": { - "line": 21, - "column": 20 - }, - "end": { - "line": 21, - "column": 21 - } + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 501, + "end": 505, + "loc": { + "start": { + "line": 21, + "column": 22 }, - "extra": { - "rawValue": 0, - "raw": "0" + "end": { + "line": 21, + "column": 26 }, - "value": 0 + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "alternate": { + "type": "MemberExpression", + "start": 508, + "end": 518, + "loc": { + "start": { + "line": 21, + "column": 29 + }, + "end": { + "line": 21, + "column": 39 } }, - "consequent": { - "type": "MemberExpression", - "start": 503, + "object": { + "type": "Identifier", + "start": 508, "end": 512, "loc": { "start": { "line": 21, - "column": 24 + "column": 29 }, "end": { "line": 21, "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 503, - "end": 507, - "loc": { - "start": { - "line": 21, - "column": 24 - }, - "end": { - "line": 21, - "column": 28 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 508, - "end": 512, - "loc": { - "start": { - "line": 21, - "column": 29 - }, - "end": { - "line": 21, - "column": 33 - }, - "identifierName": "left" }, - "name": "left" + "identifierName": "root" }, - "computed": false + "name": "root" }, - "alternate": { - "type": "MemberExpression", - "start": 515, - "end": 525, + "property": { + "type": "Identifier", + "start": 513, + "end": 518, "loc": { "start": { "line": 21, - "column": 36 + "column": 34 }, "end": { "line": 21, - "column": 46 - } + "column": 39 + }, + "identifierName": "right" }, - "object": { - "type": "Identifier", - "start": 515, - "end": 519, - "loc": { - "start": { - "line": 21, - "column": 36 - }, - "end": { - "line": 21, - "column": 40 - }, - "identifierName": "root" - }, - "name": "root" - }, - "property": { - "type": "Identifier", - "start": 520, - "end": 525, - "loc": { - "start": { - "line": 21, - "column": 41 - }, - "end": { - "line": 21, - "column": 46 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } + "name": "right" + }, + "computed": false } } - ], - "kind": "const" + } }, { "type": "IfStatement", - "start": 530, - "end": 571, + "start": 523, + "end": 563, "loc": { "start": { "line": 23, @@ -2105,9 +1919,9 @@ } }, "test": { - "type": "CallExpression", - "start": 534, - "end": 548, + "type": "BinaryExpression", + "start": 527, + "end": 540, "loc": { "start": { "line": 23, @@ -2115,13 +1929,13 @@ }, "end": { "line": 23, - "column": 20 + "column": 19 } }, - "callee": { - "type": "MemberExpression", - "start": 534, - "end": 546, + "left": { + "type": "Identifier", + "start": 527, + "end": 531, "loc": { "start": { "line": 23, @@ -2129,55 +1943,37 @@ }, "end": { "line": 23, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 534, - "end": 539, - "loc": { - "start": { - "line": 23, - "column": 6 - }, - "end": { - "line": 23, - "column": 11 - }, - "identifierName": "child" - }, - "name": "child" - }, - "property": { - "type": "Identifier", - "start": 540, - "end": 546, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 18 - }, - "identifierName": "isLeaf" + "column": 10 }, - "name": "isLeaf" + "identifierName": "root" }, - "computed": false + "name": "root" }, - "arguments": [] + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 536, + "end": 540, + "loc": { + "start": { + "line": 23, + "column": 15 + }, + "end": { + "line": 23, + "column": 19 + } + } + } }, "consequent": { "type": "BlockStatement", - "start": 550, - "end": 571, + "start": 542, + "end": 563, "loc": { "start": { "line": 23, - "column": 22 + "column": 21 }, "end": { "line": 25, @@ -2187,524 +1983,76 @@ "body": [ { "type": "ReturnStatement", - "start": 555, - "end": 567, - "loc": { - "start": { - "line": 24, - "column": 3 - }, - "end": { - "line": 24, - "column": 15 - } - }, - "argument": { - "type": "NullLiteral", - "start": 562, - "end": 566, - "loc": { - "start": { - "line": 24, - "column": 10 - }, - "end": { - "line": 24, - "column": 14 - } - } - } - } - ], - "directives": [] - }, - "alternate": null - }, - { - "type": "ExpressionStatement", - "start": 575, - "end": 605, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 32 - } - }, - "expression": { - "type": "CallExpression", - "start": 575, - "end": 604, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 575, - "end": 581, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 582, - "end": 603, + "start": 547, + "end": 559, "loc": { "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 30 - } - }, - "left": { - "type": "Identifier", - "start": 582, - "end": 587, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 14 - }, - "identifierName": "child" - }, - "name": "child" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 599, - "end": 603, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 30 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 608, - "end": 621, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 15 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 608, - "end": 620, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 14 - } - }, - "operator": "=", - "left": { - "type": "Identifier", - "start": 608, - "end": 612, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 6 - }, - "identifierName": "root" - }, - "name": "root" - }, - "right": { - "type": "Identifier", - "start": 615, - "end": 620, - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 14 - }, - "identifierName": "child" - }, - "name": "child" - } - } - } - ], - "directives": [] - } - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", - "start": 67, - "end": 315, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 11, - "column": 3 - } - } - } - ], - "trailingComments": [] - } - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", - "start": 67, - "end": 315, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 11, - "column": 3 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 46, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 + "line": 24, + "column": 3 + }, + "end": { + "line": 24, + "column": 15 + } + }, + "argument": { + "type": "NullLiteral", + "start": 554, + "end": 558, + "loc": { + "start": { + "line": 24, + "column": 10 + }, + "end": { + "line": 24, + "column": 14 + } + } + } + } + ], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", + "start": 67, + "end": 315, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ], + "trailingComments": [] } } - }, + ], + "directives": [] + }, + "comments": [ { "type": "CommentBlock", "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", @@ -2720,13 +2068,15 @@ "column": 3 } } - }, + } + ], + "tokens": [ { "type": { - "label": "const", - "keyword": "const", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2735,17 +2085,17 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 316, - "end": 321, + "value": "import", + "start": 0, + "end": 6, "loc": { "start": { - "line": 12, + "line": 1, "column": 0 }, "end": { - "line": 12, - "column": 5 + "line": 1, + "column": 6 } } }, @@ -2761,51 +2111,24 @@ "postfix": false, "binop": null }, - "value": "search", - "start": 322, - "end": 328, + "value": "assert", + "start": 7, + "end": 13, "loc": { "start": { - "line": 12, - "column": 6 + "line": 1, + "column": 7 }, "end": { - "line": 12, - "column": 12 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 329, - "end": 330, - "loc": { - "start": { - "line": 12, + "line": 1, "column": 13 - }, - "end": { - "line": 12, - "column": 14 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2814,22 +2137,23 @@ "postfix": false, "binop": null }, - "start": 331, - "end": 332, + "value": "from", + "start": 14, + "end": 18, "loc": { "start": { - "line": 12, - "column": 15 + "line": 1, + "column": 14 }, "end": { - "line": 12, - "column": 16 + "line": 1, + "column": 18 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2837,25 +2161,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "compare", - "start": 332, - "end": 339, + "value": "assert", + "start": 19, + "end": 27, "loc": { "start": { - "line": 12, - "column": 16 + "line": 1, + "column": 19 }, "end": { - "line": 12, - "column": 23 + "line": 1, + "column": 27 } } }, { "type": { - "label": ",", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2866,22 +2191,23 @@ "binop": null, "updateContext": null }, - "start": 339, - "end": 340, + "start": 27, + "end": 28, "loc": { "start": { - "line": 12, - "column": 23 + "line": 1, + "column": 27 }, "end": { - "line": 12, - "column": 24 + "line": 1, + "column": 28 } } }, { "type": { - "label": "name", + "label": "import", + "keyword": "import", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2889,45 +2215,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "value": "root", - "start": 341, - "end": 345, - "loc": { - "start": { - "line": 12, - "column": 25 - }, - "end": { - "line": 12, - "column": 29 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, "binop": null, "updateContext": null }, - "start": 345, - "end": 346, + "value": "import", + "start": 29, + "end": 35, "loc": { "start": { - "line": 12, - "column": 29 + "line": 2, + "column": 0 }, "end": { - "line": 12, - "column": 30 + "line": 2, + "column": 6 } } }, @@ -2943,25 +2244,25 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 347, - "end": 350, + "value": "Node", + "start": 36, + "end": 40, "loc": { "start": { - "line": 12, - "column": 31 + "line": 2, + "column": 7 }, "end": { - "line": 12, - "column": 34 + "line": 2, + "column": 11 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2969,24 +2270,25 @@ "postfix": false, "binop": null }, - "start": 350, - "end": 351, + "value": "from", + "start": 41, + "end": 45, "loc": { "start": { - "line": 12, - "column": 34 + "line": 2, + "column": 12 }, "end": { - "line": 12, - "column": 35 + "line": 2, + "column": 16 } } }, { "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, + "label": "string", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2995,92 +2297,87 @@ "binop": null, "updateContext": null }, - "start": 352, - "end": 354, + "value": "../types/Node.js", + "start": 46, + "end": 64, "loc": { "start": { - "line": 12, - "column": 36 + "line": 2, + "column": 17 }, "end": { - "line": 12, - "column": 38 + "line": 2, + "column": 35 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 355, - "end": 356, + "start": 64, + "end": 65, "loc": { "start": { - "line": 12, - "column": 39 + "line": 2, + "column": 35 }, "end": { - "line": 12, - "column": 40 + "line": 2, + "column": 36 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 358, - "end": 364, + "type": "CommentBlock", + "value": "*\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n ", + "start": 67, + "end": 315, "loc": { "start": { - "line": 13, - "column": 1 + "line": 4, + "column": 0 }, "end": { - "line": 13, - "column": 7 + "line": 11, + "column": 3 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 364, - "end": 365, + "value": "const", + "start": 316, + "end": 321, "loc": { "start": { - "line": 13, - "column": 7 + "line": 12, + "column": 0 }, "end": { - "line": 13, - "column": 8 + "line": 12, + "column": 5 } } }, @@ -3096,52 +2393,51 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 365, - "end": 369, + "value": "search", + "start": 322, + "end": 328, "loc": { "start": { - "line": 13, - "column": 8 + "line": 12, + "column": 6 }, "end": { - "line": 13, + "line": 12, "column": 12 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 370, - "end": 380, + "value": "=", + "start": 329, + "end": 330, "loc": { "start": { - "line": 13, + "line": 12, "column": 13 }, "end": { - "line": 13, - "column": 23 + "line": 12, + "column": 14 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3150,25 +2446,24 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 381, - "end": 385, + "start": 331, + "end": 332, "loc": { "start": { - "line": 13, - "column": 24 + "line": 12, + "column": 15 }, "end": { - "line": 13, - "column": 28 + "line": 12, + "column": 16 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3176,22 +2471,23 @@ "postfix": false, "binop": null }, - "start": 385, - "end": 386, + "value": "compare", + "start": 332, + "end": 339, "loc": { "start": { - "line": 13, - "column": 28 + "line": 12, + "column": 16 }, "end": { - "line": 13, - "column": 29 + "line": 12, + "column": 23 } } }, { "type": { - "label": ";", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3202,76 +2498,74 @@ "binop": null, "updateContext": null }, - "start": 386, - "end": 387, + "start": 339, + "end": 340, "loc": { "start": { - "line": 13, - "column": 29 + "line": 12, + "column": 23 }, "end": { - "line": 13, - "column": 30 + "line": 12, + "column": 24 } } }, { "type": { - "label": "while", - "keyword": "while", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, - "isLoop": true, + "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "while", - "start": 389, - "end": 394, + "value": "root", + "start": 341, + "end": 345, "loc": { "start": { - "line": 14, - "column": 1 + "line": 12, + "column": 25 }, "end": { - "line": 14, - "column": 6 + "line": 12, + "column": 29 } } }, { "type": { - "label": "(", + "label": ",", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 395, - "end": 396, + "start": 345, + "end": 346, "loc": { "start": { - "line": 14, - "column": 7 + "line": 12, + "column": 29 }, "end": { - "line": 14, - "column": 8 + "line": 12, + "column": 30 } } }, { "type": { - "label": "true", - "keyword": "true", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3279,20 +2573,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "true", - "start": 396, - "end": 400, + "value": "key", + "start": 347, + "end": 350, "loc": { "start": { - "line": 14, - "column": 8 + "line": 12, + "column": 31 }, "end": { - "line": 14, - "column": 12 + "line": 12, + "column": 34 } } }, @@ -3308,69 +2601,67 @@ "postfix": false, "binop": null }, - "start": 400, - "end": 401, + "start": 350, + "end": 351, "loc": { "start": { - "line": 14, - "column": 12 + "line": 12, + "column": 34 }, "end": { - "line": 14, - "column": 13 + "line": 12, + "column": 35 } } }, { "type": { - "label": "{", + "label": "=>", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 402, - "end": 403, + "start": 352, + "end": 354, "loc": { "start": { - "line": 14, - "column": 14 + "line": 12, + "column": 36 }, "end": { - "line": 14, - "column": 15 + "line": 12, + "column": 38 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 406, - "end": 411, + "start": 355, + "end": 356, "loc": { "start": { - "line": 15, - "column": 2 + "line": 12, + "column": 39 }, "end": { - "line": 15, - "column": 7 + "line": 12, + "column": 40 } } }, @@ -3386,44 +2677,42 @@ "postfix": false, "binop": null }, - "value": "d", - "start": 412, - "end": 413, + "value": "assert", + "start": 358, + "end": 364, "loc": { "start": { - "line": 15, - "column": 8 + "line": 13, + "column": 1 }, "end": { - "line": 15, - "column": 9 + "line": 13, + "column": 7 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 414, - "end": 415, + "start": 364, + "end": 365, "loc": { "start": { - "line": 15, - "column": 10 + "line": 13, + "column": 7 }, "end": { - "line": 15, - "column": 11 + "line": 13, + "column": 8 } } }, @@ -3439,42 +2728,45 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 416, - "end": 423, + "value": "root", + "start": 365, + "end": 369, "loc": { "start": { - "line": 15, - "column": 12 + "line": 13, + "column": 8 }, "end": { - "line": 15, - "column": 19 + "line": 13, + "column": 12 } } }, { "type": { - "label": "(", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 423, - "end": 424, + "value": "instanceof", + "start": 370, + "end": 380, "loc": { "start": { - "line": 15, - "column": 19 + "line": 13, + "column": 13 }, "end": { - "line": 15, - "column": 20 + "line": 13, + "column": 23 } } }, @@ -3490,102 +2782,103 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 424, - "end": 427, + "value": "Node", + "start": 381, + "end": 385, "loc": { "start": { - "line": 15, - "column": 20 + "line": 13, + "column": 24 }, "end": { - "line": 15, - "column": 23 + "line": 13, + "column": 28 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 427, - "end": 428, + "start": 385, + "end": 386, "loc": { "start": { - "line": 15, - "column": 23 + "line": 13, + "column": 28 }, "end": { - "line": 15, - "column": 24 + "line": 13, + "column": 29 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "root", - "start": 429, - "end": 433, + "start": 386, + "end": 387, "loc": { "start": { - "line": 15, - "column": 25 + "line": 13, + "column": 29 }, "end": { - "line": 15, - "column": 29 + "line": 13, + "column": 30 } } }, { "type": { - "label": ".", + "label": "while", + "keyword": "while", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, - "isLoop": false, + "isLoop": true, "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 433, - "end": 434, + "value": "while", + "start": 389, + "end": 394, "loc": { "start": { - "line": 15, - "column": 29 + "line": 14, + "column": 1 }, "end": { - "line": 15, - "column": 30 + "line": 14, + "column": 6 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3594,121 +2887,122 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 434, - "end": 437, + "start": 395, + "end": 396, "loc": { "start": { - "line": 15, - "column": 30 + "line": 14, + "column": 7 }, "end": { - "line": 15, - "column": 33 + "line": 14, + "column": 8 } } }, { "type": { - "label": ")", + "label": "true", + "keyword": "true", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 437, - "end": 438, + "value": "true", + "start": 396, + "end": 400, "loc": { "start": { - "line": 15, - "column": 33 + "line": 14, + "column": 8 }, "end": { - "line": 15, - "column": 34 + "line": 14, + "column": 12 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 438, - "end": 439, + "start": 400, + "end": 401, "loc": { "start": { - "line": 15, - "column": 34 + "line": 14, + "column": 12 }, "end": { - "line": 15, - "column": 35 + "line": 14, + "column": 13 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 443, - "end": 445, + "start": 402, + "end": 403, "loc": { "start": { - "line": 17, - "column": 2 + "line": 14, + "column": 14 }, "end": { - "line": 17, - "column": 4 + "line": 14, + "column": 15 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 446, - "end": 447, + "value": "const", + "start": 406, + "end": 411, "loc": { "start": { - "line": 17, - "column": 5 + "line": 15, + "column": 2 }, "end": { - "line": 17, - "column": 6 + "line": 15, + "column": 7 } } }, @@ -3725,49 +3019,49 @@ "binop": null }, "value": "d", - "start": 447, - "end": 448, + "start": 412, + "end": 413, "loc": { "start": { - "line": 17, - "column": 6 + "line": 15, + "column": 8 }, "end": { - "line": 17, - "column": 7 + "line": 15, + "column": 9 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 449, - "end": 452, + "value": "=", + "start": 414, + "end": 415, "loc": { "start": { - "line": 17, - "column": 8 + "line": 15, + "column": 10 }, "end": { - "line": 17, + "line": 15, "column": 11 } } }, { "type": { - "label": "num", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3775,28 +3069,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": 0, - "start": 453, - "end": 454, + "value": "compare", + "start": 416, + "end": 423, "loc": { "start": { - "line": 17, + "line": 15, "column": 12 }, "end": { - "line": 17, - "column": 13 + "line": 15, + "column": 19 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3804,23 +3097,23 @@ "postfix": false, "binop": null }, - "start": 454, - "end": 455, + "start": 423, + "end": 424, "loc": { "start": { - "line": 17, - "column": 13 + "line": 15, + "column": 19 }, "end": { - "line": 17, - "column": 14 + "line": 15, + "column": 20 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3829,23 +3122,23 @@ "postfix": false, "binop": null }, - "start": 456, - "end": 457, + "value": "key", + "start": 424, + "end": 427, "loc": { "start": { - "line": 17, - "column": 15 + "line": 15, + "column": 20 }, "end": { - "line": 17, - "column": 16 + "line": 15, + "column": 23 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3856,17 +3149,16 @@ "binop": null, "updateContext": null }, - "value": "return", - "start": 461, - "end": 467, + "start": 427, + "end": 428, "loc": { "start": { - "line": 18, - "column": 3 + "line": 15, + "column": 23 }, "end": { - "line": 18, - "column": 9 + "line": 15, + "column": 24 } } }, @@ -3883,23 +3175,23 @@ "binop": null }, "value": "root", - "start": 468, - "end": 472, + "start": 429, + "end": 433, "loc": { "start": { - "line": 18, - "column": 10 + "line": 15, + "column": 25 }, "end": { - "line": 18, - "column": 14 + "line": 15, + "column": 29 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -3909,24 +3201,24 @@ "binop": null, "updateContext": null }, - "start": 472, - "end": 473, + "start": 433, + "end": 434, "loc": { "start": { - "line": 18, - "column": 14 + "line": 15, + "column": 29 }, "end": { - "line": 18, - "column": 15 + "line": 15, + "column": 30 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -3934,23 +3226,23 @@ "postfix": false, "binop": null }, - "start": 476, - "end": 477, + "value": "key", + "start": 434, + "end": 437, "loc": { "start": { - "line": 19, - "column": 2 + "line": 15, + "column": 30 }, "end": { - "line": 19, - "column": 3 + "line": 15, + "column": 33 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3958,73 +3250,97 @@ "isAssign": false, "prefix": false, "postfix": false, + "binop": null + }, + "start": 437, + "end": 438, + "loc": { + "start": { + "line": 15, + "column": 33 + }, + "end": { + "line": 15, + "column": 34 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, "binop": null, "updateContext": null }, - "value": "const", - "start": 481, - "end": 486, + "start": 438, + "end": 439, "loc": { "start": { - "line": 21, - "column": 2 + "line": 15, + "column": 34 }, "end": { - "line": 21, - "column": 7 + "line": 15, + "column": 35 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "child", - "start": 487, - "end": 492, + "value": "if", + "start": 443, + "end": 445, "loc": { "start": { - "line": 21, - "column": 8 + "line": 17, + "column": 2 }, "end": { - "line": 21, - "column": 13 + "line": 17, + "column": 4 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 493, - "end": 494, + "start": 446, + "end": 447, "loc": { "start": { - "line": 21, - "column": 14 + "line": 17, + "column": 5 }, "end": { - "line": 21, - "column": 15 + "line": 17, + "column": 6 } } }, @@ -4041,22 +3357,22 @@ "binop": null }, "value": "d", - "start": 495, - "end": 496, + "start": 447, + "end": 448, "loc": { "start": { - "line": 21, - "column": 16 + "line": 17, + "column": 6 }, "end": { - "line": 21, - "column": 17 + "line": 17, + "column": 7 } } }, { "type": { - "label": "", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4064,20 +3380,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": 6, "updateContext": null }, - "value": "<", - "start": 497, - "end": 498, + "value": "===", + "start": 449, + "end": 452, "loc": { "start": { - "line": 21, - "column": 18 + "line": 17, + "column": 8 }, "end": { - "line": 21, - "column": 19 + "line": 17, + "column": 11 } } }, @@ -4095,49 +3411,48 @@ "updateContext": null }, "value": 0, - "start": 499, - "end": 500, + "start": 453, + "end": 454, "loc": { "start": { - "line": 21, - "column": 20 + "line": 17, + "column": 12 }, "end": { - "line": 21, - "column": 21 + "line": 17, + "column": 13 } } }, { "type": { - "label": "?", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 501, - "end": 502, + "start": 454, + "end": 455, "loc": { "start": { - "line": 21, - "column": 22 + "line": 17, + "column": 13 }, "end": { - "line": 21, - "column": 23 + "line": 17, + "column": 14 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4146,24 +3461,24 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 503, - "end": 507, + "start": 456, + "end": 457, "loc": { "start": { - "line": 21, - "column": 24 + "line": 17, + "column": 15 }, "end": { - "line": 21, - "column": 28 + "line": 17, + "column": 16 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "return", + "keyword": "return", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4173,16 +3488,17 @@ "binop": null, "updateContext": null }, - "start": 507, - "end": 508, + "value": "return", + "start": 461, + "end": 467, "loc": { "start": { - "line": 21, - "column": 28 + "line": 18, + "column": 3 }, "end": { - "line": 21, - "column": 29 + "line": 18, + "column": 9 } } }, @@ -4198,23 +3514,23 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 508, - "end": 512, + "value": "root", + "start": 468, + "end": 472, "loc": { "start": { - "line": 21, - "column": 29 + "line": 18, + "column": 10 }, "end": { - "line": 21, - "column": 33 + "line": 18, + "column": 14 } } }, { "type": { - "label": ":", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4225,48 +3541,22 @@ "binop": null, "updateContext": null }, - "start": 513, - "end": 514, - "loc": { - "start": { - "line": 21, - "column": 34 - }, - "end": { - "line": 21, - "column": 35 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 515, - "end": 519, + "start": 472, + "end": 473, "loc": { "start": { - "line": 21, - "column": 36 + "line": 18, + "column": 14 }, "end": { - "line": 21, - "column": 40 + "line": 18, + "column": 15 } } }, { "type": { - "label": ".", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -4274,19 +3564,18 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 519, - "end": 520, + "start": 476, + "end": 477, "loc": { "start": { - "line": 21, - "column": 40 + "line": 19, + "column": 2 }, "end": { - "line": 21, - "column": 41 + "line": 19, + "column": 3 } } }, @@ -4302,102 +3591,103 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 520, - "end": 525, + "value": "root", + "start": 481, + "end": 485, "loc": { "start": { "line": 21, - "column": 41 + "column": 2 }, "end": { "line": 21, - "column": 46 + "column": 6 } } }, { "type": { - "label": ";", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 525, - "end": 526, + "value": "=", + "start": 486, + "end": 487, "loc": { "start": { "line": 21, - "column": 46 + "column": 7 }, "end": { "line": 21, - "column": 47 + "column": 8 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 530, - "end": 532, + "value": "d", + "start": 488, + "end": 489, "loc": { "start": { - "line": 23, - "column": 2 + "line": 21, + "column": 9 }, "end": { - "line": 23, - "column": 4 + "line": 21, + "column": 10 } } }, { "type": { - "label": "(", + "label": "", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 7, + "updateContext": null }, - "start": 533, - "end": 534, + "value": "<", + "start": 490, + "end": 491, "loc": { "start": { - "line": 23, - "column": 5 + "line": 21, + "column": 11 }, "end": { - "line": 23, - "column": 6 + "line": 21, + "column": 12 } } }, { "type": { - "label": "name", + "label": "num", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4405,26 +3695,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "child", - "start": 534, - "end": 539, + "value": 0, + "start": 492, + "end": 493, "loc": { "start": { - "line": 23, - "column": 6 + "line": 21, + "column": 13 }, "end": { - "line": 23, - "column": 11 + "line": 21, + "column": 14 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "?", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4434,16 +3725,16 @@ "binop": null, "updateContext": null }, - "start": 539, - "end": 540, + "start": 494, + "end": 495, "loc": { "start": { - "line": 23, - "column": 11 + "line": 21, + "column": 15 }, "end": { - "line": 23, - "column": 12 + "line": 21, + "column": 16 } } }, @@ -4459,50 +3750,51 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 540, - "end": 546, + "value": "root", + "start": 496, + "end": 500, "loc": { "start": { - "line": 23, - "column": 12 + "line": 21, + "column": 17 }, "end": { - "line": 23, - "column": 18 + "line": 21, + "column": 21 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 546, - "end": 547, + "start": 500, + "end": 501, "loc": { "start": { - "line": 23, - "column": 18 + "line": 21, + "column": 21 }, "end": { - "line": 23, - "column": 19 + "line": 21, + "column": 22 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4510,48 +3802,50 @@ "postfix": false, "binop": null }, - "start": 547, - "end": 548, + "value": "left", + "start": 501, + "end": 505, "loc": { "start": { - "line": 23, - "column": 19 + "line": 21, + "column": 22 }, "end": { - "line": 23, - "column": 20 + "line": 21, + "column": 26 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ":", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 548, - "end": 549, + "start": 506, + "end": 507, "loc": { "start": { - "line": 23, - "column": 20 + "line": 21, + "column": 27 }, "end": { - "line": 23, - "column": 21 + "line": 21, + "column": 28 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4560,24 +3854,24 @@ "postfix": false, "binop": null }, - "start": 550, - "end": 551, + "value": "root", + "start": 508, + "end": 512, "loc": { "start": { - "line": 23, - "column": 22 + "line": 21, + "column": 29 }, "end": { - "line": 23, - "column": 23 + "line": 21, + "column": 33 } } }, { "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -4587,24 +3881,22 @@ "binop": null, "updateContext": null }, - "value": "return", - "start": 555, - "end": 561, + "start": 512, + "end": 513, "loc": { "start": { - "line": 24, - "column": 3 + "line": 21, + "column": 33 }, "end": { - "line": 24, - "column": 9 + "line": 21, + "column": 34 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4612,20 +3904,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 562, - "end": 566, + "value": "right", + "start": 513, + "end": 518, "loc": { "start": { - "line": 24, - "column": 10 + "line": 21, + "column": 34 }, "end": { - "line": 24, - "column": 14 + "line": 21, + "column": 39 } } }, @@ -4642,22 +3933,23 @@ "binop": null, "updateContext": null }, - "start": 566, - "end": 567, + "start": 518, + "end": 519, "loc": { "start": { - "line": 24, - "column": 14 + "line": 21, + "column": 39 }, "end": { - "line": 24, - "column": 15 + "line": 21, + "column": 40 } } }, { "type": { - "label": "}", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -4665,25 +3957,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 570, - "end": 571, + "value": "if", + "start": 523, + "end": 525, "loc": { "start": { - "line": 25, + "line": 23, "column": 2 }, "end": { - "line": 25, - "column": 3 + "line": 23, + "column": 4 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4692,24 +3986,23 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 575, - "end": 581, + "start": 526, + "end": 527, "loc": { "start": { - "line": 27, - "column": 2 + "line": 23, + "column": 5 }, "end": { - "line": 27, - "column": 8 + "line": 23, + "column": 6 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -4718,78 +4011,80 @@ "postfix": false, "binop": null }, - "start": 581, - "end": 582, + "value": "root", + "start": 527, + "end": 531, "loc": { "start": { - "line": 27, - "column": 8 + "line": 23, + "column": 6 }, "end": { - "line": 27, - "column": 9 + "line": 23, + "column": 10 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "child", - "start": 582, - "end": 587, + "value": "===", + "start": 532, + "end": 535, "loc": { "start": { - "line": 27, - "column": 9 + "line": 23, + "column": 11 }, "end": { - "line": 27, + "line": 23, "column": 14 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 588, - "end": 598, + "value": "null", + "start": 536, + "end": 540, "loc": { "start": { - "line": 27, + "line": 23, "column": 15 }, "end": { - "line": 27, - "column": 25 + "line": 23, + "column": 19 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4797,25 +4092,24 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 599, - "end": 603, + "start": 540, + "end": 541, "loc": { "start": { - "line": 27, - "column": 26 + "line": 23, + "column": 19 }, "end": { - "line": 27, - "column": 30 + "line": 23, + "column": 20 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4823,22 +4117,23 @@ "postfix": false, "binop": null }, - "start": 603, - "end": 604, + "start": 542, + "end": 543, "loc": { "start": { - "line": 27, - "column": 30 + "line": 23, + "column": 21 }, "end": { - "line": 27, - "column": 31 + "line": 23, + "column": 22 } } }, { "type": { - "label": ";", + "label": "return", + "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4849,22 +4144,24 @@ "binop": null, "updateContext": null }, - "start": 604, - "end": 605, + "value": "return", + "start": 547, + "end": 553, "loc": { "start": { - "line": 27, - "column": 31 + "line": 24, + "column": 3 }, "end": { - "line": 27, - "column": 32 + "line": 24, + "column": 9 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4872,98 +4169,71 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "root", - "start": 608, - "end": 612, + "value": "null", + "start": 554, + "end": 558, "loc": { "start": { - "line": 28, - "column": 2 + "line": 24, + "column": 10 }, "end": { - "line": 28, - "column": 6 + "line": 24, + "column": 14 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 613, - "end": 614, + "start": 558, + "end": 559, "loc": { "start": { - "line": 28, - "column": 7 + "line": 24, + "column": 14 }, "end": { - "line": 28, - "column": 8 + "line": 24, + "column": 15 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "child", - "start": 615, - "end": 620, - "loc": { - "start": { - "line": 28, - "column": 9 - }, - "end": { - "line": 28, - "column": 14 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 620, - "end": 621, + "start": 562, + "end": 563, "loc": { "start": { - "line": 28, - "column": 14 + "line": 25, + "column": 2 }, "end": { - "line": 28, - "column": 15 + "line": 25, + "column": 3 } } }, @@ -4979,15 +4249,15 @@ "postfix": false, "binop": null }, - "start": 623, - "end": 624, + "start": 565, + "end": 566, "loc": { "start": { - "line": 29, + "line": 26, "column": 1 }, "end": { - "line": 29, + "line": 26, "column": 2 } } @@ -5004,15 +4274,15 @@ "postfix": false, "binop": null }, - "start": 625, - "end": 626, + "start": 567, + "end": 568, "loc": { "start": { - "line": 30, + "line": 27, "column": 0 }, "end": { - "line": 30, + "line": 27, "column": 1 } } @@ -5030,15 +4300,15 @@ "binop": null, "updateContext": null }, - "start": 626, - "end": 627, + "start": 568, + "end": 569, "loc": { "start": { - "line": 30, + "line": 27, "column": 1 }, "end": { - "line": 30, + "line": 27, "column": 2 } } @@ -5058,15 +4328,15 @@ "updateContext": null }, "value": "export", - "start": 629, - "end": 635, + "start": 571, + "end": 577, "loc": { "start": { - "line": 32, + "line": 29, "column": 0 }, "end": { - "line": 32, + "line": 29, "column": 6 } } @@ -5086,15 +4356,15 @@ "updateContext": null }, "value": "default", - "start": 636, - "end": 643, + "start": 578, + "end": 585, "loc": { "start": { - "line": 32, + "line": 29, "column": 7 }, "end": { - "line": 32, + "line": 29, "column": 14 } } @@ -5112,15 +4382,15 @@ "binop": null }, "value": "search", - "start": 644, - "end": 650, + "start": 586, + "end": 592, "loc": { "start": { - "line": 32, + "line": 29, "column": 15 }, "end": { - "line": 32, + "line": 29, "column": 21 } } @@ -5138,15 +4408,15 @@ "binop": null, "updateContext": null }, - "start": 650, - "end": 651, + "start": 592, + "end": 593, "loc": { "start": { - "line": 32, + "line": 29, "column": 21 }, "end": { - "line": 32, + "line": 29, "column": 22 } } @@ -5164,15 +4434,15 @@ "binop": null, "updateContext": null }, - "start": 652, - "end": 652, + "start": 594, + "end": 594, "loc": { "start": { - "line": 33, + "line": 30, "column": 0 }, "end": { - "line": 33, + "line": 30, "column": 0 } } diff --git a/ast/source/traversal/inordertraversal.js.json b/ast/source/traversal/inordertraversal.js.json index 48df69d..5061a6c 100644 --- a/ast/source/traversal/inordertraversal.js.json +++ b/ast/source/traversal/inordertraversal.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 876, + "end": 874, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 876, + "end": 874, "loc": { "start": { "line": 1, @@ -187,7 +187,7 @@ { "type": "ExportDefaultDeclaration", "start": 215, - "end": 875, + "end": 873, "loc": { "start": { "line": 10, @@ -201,7 +201,7 @@ "declaration": { "type": "FunctionDeclaration", "start": 230, - "end": 875, + "end": 873, "loc": { "start": { "line": 10, @@ -255,7 +255,7 @@ "body": { "type": "BlockStatement", "start": 263, - "end": 875, + "end": 873, "loc": { "start": { "line": 10, @@ -369,7 +369,7 @@ { "type": "IfStatement", "start": 297, - "end": 559, + "end": 558, "loc": { "start": { "line": 12, @@ -381,9 +381,9 @@ } }, "test": { - "type": "UnaryExpression", + "type": "BinaryExpression", "start": 301, - "end": 320, + "end": 319, "loc": { "start": { "line": 12, @@ -391,122 +391,84 @@ }, "end": { "line": 12, - "column": 24 + "column": 23 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 302, - "end": 320, + "left": { + "type": "MemberExpression", + "start": 301, + "end": 310, "loc": { "start": { "line": 12, - "column": 6 + "column": 5 }, "end": { "line": 12, - "column": 24 + "column": 14 } }, - "callee": { - "type": "MemberExpression", - "start": 302, - "end": 318, + "object": { + "type": "Identifier", + "start": 301, + "end": 305, "loc": { "start": { "line": 12, - "column": 6 + "column": 5 }, "end": { "line": 12, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 302, - "end": 311, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 302, - "end": 306, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 10 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 307, - "end": 311, - "loc": { - "start": { - "line": 12, - "column": 11 - }, - "end": { - "line": 12, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" + "column": 9 }, - "computed": false + "identifierName": "node" }, - "property": { - "type": "Identifier", - "start": 312, - "end": 318, - "loc": { - "start": { - "line": 12, - "column": 16 - }, - "end": { - "line": 12, - "column": 22 - }, - "identifierName": "isLeaf" + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 306, + "end": 310, + "loc": { + "start": { + "line": 12, + "column": 10 }, - "name": "isLeaf" + "end": { + "line": 12, + "column": 14 + }, + "identifierName": "left" }, - "computed": false + "name": "left" }, - "arguments": [] + "computed": false }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 315, + "end": 319, + "loc": { + "start": { + "line": 12, + "column": 19 + }, + "end": { + "line": 12, + "column": 23 + } + } } }, "consequent": { "type": "BlockStatement", - "start": 322, - "end": 559, + "start": 321, + "end": 558, "loc": { "start": { "line": 12, - "column": 26 + "column": 25 }, "end": { "line": 18, @@ -516,8 +478,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 484, - "end": 518, + "start": 483, + "end": 517, "loc": { "start": { "line": 16, @@ -530,8 +492,8 @@ }, "expression": { "type": "CallExpression", - "start": 484, - "end": 517, + "start": 483, + "end": 516, "loc": { "start": { "line": 16, @@ -544,8 +506,8 @@ }, "callee": { "type": "Identifier", - "start": 484, - "end": 490, + "start": 483, + "end": 489, "loc": { "start": { "line": 16, @@ -563,8 +525,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 491, - "end": 516, + "start": 490, + "end": 515, "loc": { "start": { "line": 16, @@ -577,8 +539,8 @@ }, "left": { "type": "MemberExpression", - "start": 491, - "end": 500, + "start": 490, + "end": 499, "loc": { "start": { "line": 16, @@ -591,8 +553,8 @@ }, "object": { "type": "Identifier", - "start": 491, - "end": 495, + "start": 490, + "end": 494, "loc": { "start": { "line": 16, @@ -608,8 +570,8 @@ }, "property": { "type": "Identifier", - "start": 496, - "end": 500, + "start": 495, + "end": 499, "loc": { "start": { "line": 16, @@ -628,8 +590,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 512, - "end": 516, + "start": 511, + "end": 515, "loc": { "start": { "line": 16, @@ -651,8 +613,8 @@ { "type": "CommentLine", "value": " Yield the nodes on the left recursively. Those nodes are all smaller", - "start": 326, - "end": 397, + "start": 325, + "end": 396, "loc": { "start": { "line": 13, @@ -667,8 +629,8 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 400, - "end": 464, + "start": 399, + "end": 463, "loc": { "start": { "line": 14, @@ -683,8 +645,8 @@ { "type": "CommentLine", "value": " properties.", - "start": 467, - "end": 481, + "start": 466, + "end": 480, "loc": { "start": { "line": 15, @@ -700,8 +662,8 @@ }, { "type": "ExpressionStatement", - "start": 521, - "end": 556, + "start": 520, + "end": 555, "loc": { "start": { "line": 17, @@ -714,8 +676,8 @@ }, "expression": { "type": "YieldExpression", - "start": 521, - "end": 555, + "start": 520, + "end": 554, "loc": { "start": { "line": 17, @@ -729,8 +691,8 @@ "delegate": true, "argument": { "type": "CallExpression", - "start": 528, - "end": 555, + "start": 527, + "end": 554, "loc": { "start": { "line": 17, @@ -743,8 +705,8 @@ }, "callee": { "type": "Identifier", - "start": 528, - "end": 544, + "start": 527, + "end": 543, "loc": { "start": { "line": 17, @@ -761,8 +723,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 545, - "end": 554, + "start": 544, + "end": 553, "loc": { "start": { "line": 17, @@ -775,8 +737,8 @@ }, "object": { "type": "Identifier", - "start": 545, - "end": 549, + "start": 544, + "end": 548, "loc": { "start": { "line": 17, @@ -792,8 +754,8 @@ }, "property": { "type": "Identifier", - "start": 550, - "end": 554, + "start": 549, + "end": 553, "loc": { "start": { "line": 17, @@ -822,8 +784,8 @@ { "type": "CommentLine", "value": " Yield the current node.", - "start": 562, - "end": 588, + "start": 561, + "end": 587, "loc": { "start": { "line": 20, @@ -839,8 +801,8 @@ }, { "type": "ExpressionStatement", - "start": 590, - "end": 605, + "start": 589, + "end": 604, "loc": { "start": { "line": 21, @@ -853,8 +815,8 @@ }, "expression": { "type": "YieldExpression", - "start": 590, - "end": 604, + "start": 589, + "end": 603, "loc": { "start": { "line": 21, @@ -868,8 +830,8 @@ "delegate": false, "argument": { "type": "MemberExpression", - "start": 596, - "end": 604, + "start": 595, + "end": 603, "loc": { "start": { "line": 21, @@ -882,8 +844,8 @@ }, "object": { "type": "Identifier", - "start": 596, - "end": 600, + "start": 595, + "end": 599, "loc": { "start": { "line": 21, @@ -900,8 +862,8 @@ }, "property": { "type": "Identifier", - "start": 601, - "end": 604, + "start": 600, + "end": 603, "loc": { "start": { "line": 21, @@ -924,8 +886,8 @@ { "type": "CommentLine", "value": " Yield the current node.", - "start": 562, - "end": 588, + "start": 561, + "end": 587, "loc": { "start": { "line": 20, @@ -941,8 +903,8 @@ }, { "type": "IfStatement", - "start": 608, - "end": 873, + "start": 607, + "end": 871, "loc": { "start": { "line": 23, @@ -954,9 +916,9 @@ } }, "test": { - "type": "UnaryExpression", - "start": 612, - "end": 632, + "type": "BinaryExpression", + "start": 611, + "end": 630, "loc": { "start": { "line": 23, @@ -964,122 +926,84 @@ }, "end": { "line": 23, - "column": 25 + "column": 24 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 613, - "end": 632, + "left": { + "type": "MemberExpression", + "start": 611, + "end": 621, "loc": { "start": { "line": 23, - "column": 6 + "column": 5 }, "end": { "line": 23, - "column": 25 + "column": 15 } }, - "callee": { - "type": "MemberExpression", - "start": 613, - "end": 630, + "object": { + "type": "Identifier", + "start": 611, + "end": 615, "loc": { "start": { "line": 23, - "column": 6 + "column": 5 }, "end": { "line": 23, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 613, - "end": 623, - "loc": { - "start": { - "line": 23, - "column": 6 - }, - "end": { - "line": 23, - "column": 16 - } + "column": 9 }, - "object": { - "type": "Identifier", - "start": 613, - "end": 617, - "loc": { - "start": { - "line": 23, - "column": 6 - }, - "end": { - "line": 23, - "column": 10 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 618, - "end": 623, - "loc": { - "start": { - "line": 23, - "column": 11 - }, - "end": { - "line": 23, - "column": 16 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false + "identifierName": "node" }, - "property": { - "type": "Identifier", - "start": 624, - "end": 630, - "loc": { - "start": { - "line": 23, - "column": 17 - }, - "end": { - "line": 23, - "column": 23 - }, - "identifierName": "isLeaf" + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 616, + "end": 621, + "loc": { + "start": { + "line": 23, + "column": 10 + }, + "end": { + "line": 23, + "column": 15 }, - "name": "isLeaf" + "identifierName": "right" }, - "computed": false + "name": "right" }, - "arguments": [] + "computed": false }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 626, + "end": 630, + "loc": { + "start": { + "line": 23, + "column": 20 + }, + "end": { + "line": 23, + "column": 24 + } + } } }, "consequent": { "type": "BlockStatement", - "start": 634, - "end": 873, + "start": 632, + "end": 871, "loc": { "start": { "line": 23, - "column": 27 + "column": 26 }, "end": { "line": 29, @@ -1089,8 +1013,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 796, - "end": 831, + "start": 794, + "end": 829, "loc": { "start": { "line": 27, @@ -1103,8 +1027,8 @@ }, "expression": { "type": "CallExpression", - "start": 796, - "end": 830, + "start": 794, + "end": 828, "loc": { "start": { "line": 27, @@ -1117,8 +1041,8 @@ }, "callee": { "type": "Identifier", - "start": 796, - "end": 802, + "start": 794, + "end": 800, "loc": { "start": { "line": 27, @@ -1136,8 +1060,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 803, - "end": 829, + "start": 801, + "end": 827, "loc": { "start": { "line": 27, @@ -1150,8 +1074,8 @@ }, "left": { "type": "MemberExpression", - "start": 803, - "end": 813, + "start": 801, + "end": 811, "loc": { "start": { "line": 27, @@ -1164,8 +1088,8 @@ }, "object": { "type": "Identifier", - "start": 803, - "end": 807, + "start": 801, + "end": 805, "loc": { "start": { "line": 27, @@ -1181,8 +1105,8 @@ }, "property": { "type": "Identifier", - "start": 808, - "end": 813, + "start": 806, + "end": 811, "loc": { "start": { "line": 27, @@ -1201,8 +1125,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 825, - "end": 829, + "start": 823, + "end": 827, "loc": { "start": { "line": 27, @@ -1224,8 +1148,8 @@ { "type": "CommentLine", "value": " Yield the nodes on the right recursively. Those nodes are all larger", - "start": 638, - "end": 709, + "start": 636, + "end": 707, "loc": { "start": { "line": 24, @@ -1240,8 +1164,8 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 712, - "end": 776, + "start": 710, + "end": 774, "loc": { "start": { "line": 25, @@ -1256,8 +1180,8 @@ { "type": "CommentLine", "value": " properties.", - "start": 779, - "end": 793, + "start": 777, + "end": 791, "loc": { "start": { "line": 26, @@ -1273,8 +1197,8 @@ }, { "type": "ExpressionStatement", - "start": 834, - "end": 870, + "start": 832, + "end": 868, "loc": { "start": { "line": 28, @@ -1287,8 +1211,8 @@ }, "expression": { "type": "YieldExpression", - "start": 834, - "end": 869, + "start": 832, + "end": 867, "loc": { "start": { "line": 28, @@ -1302,8 +1226,8 @@ "delegate": true, "argument": { "type": "CallExpression", - "start": 841, - "end": 869, + "start": 839, + "end": 867, "loc": { "start": { "line": 28, @@ -1316,8 +1240,8 @@ }, "callee": { "type": "Identifier", - "start": 841, - "end": 857, + "start": 839, + "end": 855, "loc": { "start": { "line": 28, @@ -1334,8 +1258,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 858, - "end": 868, + "start": 856, + "end": 866, "loc": { "start": { "line": 28, @@ -1348,8 +1272,8 @@ }, "object": { "type": "Identifier", - "start": 858, - "end": 862, + "start": 856, + "end": 860, "loc": { "start": { "line": 28, @@ -1365,8 +1289,8 @@ }, "property": { "type": "Identifier", - "start": 863, - "end": 868, + "start": 861, + "end": 866, "loc": { "start": { "line": 28, @@ -1456,8 +1380,8 @@ { "type": "CommentLine", "value": " Yield the nodes on the left recursively. Those nodes are all smaller", - "start": 326, - "end": 397, + "start": 325, + "end": 396, "loc": { "start": { "line": 13, @@ -1472,8 +1396,8 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 400, - "end": 464, + "start": 399, + "end": 463, "loc": { "start": { "line": 14, @@ -1488,8 +1412,8 @@ { "type": "CommentLine", "value": " properties.", - "start": 467, - "end": 481, + "start": 466, + "end": 480, "loc": { "start": { "line": 15, @@ -1504,8 +1428,8 @@ { "type": "CommentLine", "value": " Yield the current node.", - "start": 562, - "end": 588, + "start": 561, + "end": 587, "loc": { "start": { "line": 20, @@ -1520,8 +1444,8 @@ { "type": "CommentLine", "value": " Yield the nodes on the right recursively. Those nodes are all larger", - "start": 638, - "end": 709, + "start": 636, + "end": 707, "loc": { "start": { "line": 24, @@ -1536,8 +1460,8 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 712, - "end": 776, + "start": 710, + "end": 774, "loc": { "start": { "line": 25, @@ -1552,8 +1476,8 @@ { "type": "CommentLine", "value": " properties.", - "start": 779, - "end": 793, + "start": 777, + "end": 791, "loc": { "start": { "line": 26, @@ -2321,33 +2245,6 @@ } } }, - { - "type": { - "label": "prefix", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "!", - "start": 301, - "end": 302, - "loc": { - "start": { - "line": 12, - "column": 5 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, { "type": { "label": "name", @@ -2361,16 +2258,16 @@ "binop": null }, "value": "node", - "start": 302, - "end": 306, + "start": 301, + "end": 305, "loc": { "start": { "line": 12, - "column": 6 + "column": 5 }, "end": { "line": 12, - "column": 10 + "column": 9 } } }, @@ -2387,16 +2284,16 @@ "binop": null, "updateContext": null }, - "start": 306, - "end": 307, + "start": 305, + "end": 306, "loc": { "start": { "line": 12, - "column": 10 + "column": 9 }, "end": { "line": 12, - "column": 11 + "column": 10 } } }, @@ -2413,34 +2310,35 @@ "binop": null }, "value": "left", - "start": 307, - "end": 311, + "start": 306, + "end": 310, "loc": { "start": { "line": 12, - "column": 11 + "column": 10 }, "end": { "line": 12, - "column": 15 + "column": 14 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, + "value": "!==", "start": 311, - "end": 312, + "end": 314, "loc": { "start": { "line": 12, @@ -2448,13 +2346,14 @@ }, "end": { "line": 12, - "column": 16 + "column": 18 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2462,40 +2361,16 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "value": "isLeaf", - "start": 312, - "end": 318, - "loc": { - "start": { - "line": 12, - "column": 16 - }, - "end": { - "line": 12, - "column": 22 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 318, + "value": "null", + "start": 315, "end": 319, "loc": { "start": { "line": 12, - "column": 22 + "column": 19 }, "end": { "line": 12, @@ -2528,31 +2403,6 @@ } } }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 320, - "end": 321, - "loc": { - "start": { - "line": 12, - "column": 24 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, { "type": { "label": "{", @@ -2565,24 +2415,24 @@ "postfix": false, "binop": null }, - "start": 322, - "end": 323, + "start": 321, + "end": 322, "loc": { "start": { "line": 12, - "column": 26 + "column": 25 }, "end": { "line": 12, - "column": 27 + "column": 26 } } }, { "type": "CommentLine", "value": " Yield the nodes on the left recursively. Those nodes are all smaller", - "start": 326, - "end": 397, + "start": 325, + "end": 396, "loc": { "start": { "line": 13, @@ -2597,8 +2447,8 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 400, - "end": 464, + "start": 399, + "end": 463, "loc": { "start": { "line": 14, @@ -2613,8 +2463,8 @@ { "type": "CommentLine", "value": " properties.", - "start": 467, - "end": 481, + "start": 466, + "end": 480, "loc": { "start": { "line": 15, @@ -2639,8 +2489,8 @@ "binop": null }, "value": "assert", - "start": 484, - "end": 490, + "start": 483, + "end": 489, "loc": { "start": { "line": 16, @@ -2664,8 +2514,8 @@ "postfix": false, "binop": null }, - "start": 490, - "end": 491, + "start": 489, + "end": 490, "loc": { "start": { "line": 16, @@ -2690,8 +2540,8 @@ "binop": null }, "value": "node", - "start": 491, - "end": 495, + "start": 490, + "end": 494, "loc": { "start": { "line": 16, @@ -2716,8 +2566,8 @@ "binop": null, "updateContext": null }, - "start": 495, - "end": 496, + "start": 494, + "end": 495, "loc": { "start": { "line": 16, @@ -2742,8 +2592,8 @@ "binop": null }, "value": "left", - "start": 496, - "end": 500, + "start": 495, + "end": 499, "loc": { "start": { "line": 16, @@ -2770,8 +2620,8 @@ "updateContext": null }, "value": "instanceof", - "start": 501, - "end": 511, + "start": 500, + "end": 510, "loc": { "start": { "line": 16, @@ -2796,8 +2646,8 @@ "binop": null }, "value": "Node", - "start": 512, - "end": 516, + "start": 511, + "end": 515, "loc": { "start": { "line": 16, @@ -2821,8 +2671,8 @@ "postfix": false, "binop": null }, - "start": 516, - "end": 517, + "start": 515, + "end": 516, "loc": { "start": { "line": 16, @@ -2847,8 +2697,8 @@ "binop": null, "updateContext": null }, - "start": 517, - "end": 518, + "start": 516, + "end": 517, "loc": { "start": { "line": 16, @@ -2875,8 +2725,8 @@ "updateContext": null }, "value": "yield", - "start": 521, - "end": 526, + "start": 520, + "end": 525, "loc": { "start": { "line": 17, @@ -2902,8 +2752,8 @@ "updateContext": null }, "value": "*", - "start": 526, - "end": 527, + "start": 525, + "end": 526, "loc": { "start": { "line": 17, @@ -2928,8 +2778,8 @@ "binop": null }, "value": "inordertraversal", - "start": 528, - "end": 544, + "start": 527, + "end": 543, "loc": { "start": { "line": 17, @@ -2953,8 +2803,8 @@ "postfix": false, "binop": null }, - "start": 544, - "end": 545, + "start": 543, + "end": 544, "loc": { "start": { "line": 17, @@ -2979,8 +2829,8 @@ "binop": null }, "value": "node", - "start": 545, - "end": 549, + "start": 544, + "end": 548, "loc": { "start": { "line": 17, @@ -3005,8 +2855,8 @@ "binop": null, "updateContext": null }, - "start": 549, - "end": 550, + "start": 548, + "end": 549, "loc": { "start": { "line": 17, @@ -3031,8 +2881,8 @@ "binop": null }, "value": "left", - "start": 550, - "end": 554, + "start": 549, + "end": 553, "loc": { "start": { "line": 17, @@ -3056,8 +2906,8 @@ "postfix": false, "binop": null }, - "start": 554, - "end": 555, + "start": 553, + "end": 554, "loc": { "start": { "line": 17, @@ -3082,8 +2932,8 @@ "binop": null, "updateContext": null }, - "start": 555, - "end": 556, + "start": 554, + "end": 555, "loc": { "start": { "line": 17, @@ -3107,8 +2957,8 @@ "postfix": false, "binop": null }, - "start": 558, - "end": 559, + "start": 557, + "end": 558, "loc": { "start": { "line": 18, @@ -3123,8 +2973,8 @@ { "type": "CommentLine", "value": " Yield the current node.", - "start": 562, - "end": 588, + "start": 561, + "end": 587, "loc": { "start": { "line": 20, @@ -3151,8 +3001,8 @@ "updateContext": null }, "value": "yield", - "start": 590, - "end": 595, + "start": 589, + "end": 594, "loc": { "start": { "line": 21, @@ -3177,8 +3027,8 @@ "binop": null }, "value": "node", - "start": 596, - "end": 600, + "start": 595, + "end": 599, "loc": { "start": { "line": 21, @@ -3203,8 +3053,8 @@ "binop": null, "updateContext": null }, - "start": 600, - "end": 601, + "start": 599, + "end": 600, "loc": { "start": { "line": 21, @@ -3229,8 +3079,8 @@ "binop": null }, "value": "key", - "start": 601, - "end": 604, + "start": 600, + "end": 603, "loc": { "start": { "line": 21, @@ -3255,8 +3105,8 @@ "binop": null, "updateContext": null }, - "start": 604, - "end": 605, + "start": 603, + "end": 604, "loc": { "start": { "line": 21, @@ -3283,8 +3133,8 @@ "updateContext": null }, "value": "if", - "start": 608, - "end": 610, + "start": 607, + "end": 609, "loc": { "start": { "line": 23, @@ -3308,8 +3158,8 @@ "postfix": false, "binop": null }, - "start": 611, - "end": 612, + "start": 610, + "end": 611, "loc": { "start": { "line": 23, @@ -3321,33 +3171,6 @@ } } }, - { - "type": { - "label": "prefix", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "!", - "start": 612, - "end": 613, - "loc": { - "start": { - "line": 23, - "column": 5 - }, - "end": { - "line": 23, - "column": 6 - } - } - }, { "type": { "label": "name", @@ -3361,16 +3184,16 @@ "binop": null }, "value": "node", - "start": 613, - "end": 617, + "start": 611, + "end": 615, "loc": { "start": { "line": 23, - "column": 6 + "column": 5 }, "end": { "line": 23, - "column": 10 + "column": 9 } } }, @@ -3387,16 +3210,16 @@ "binop": null, "updateContext": null }, - "start": 617, - "end": 618, + "start": 615, + "end": 616, "loc": { "start": { "line": 23, - "column": 10 + "column": 9 }, "end": { "line": 23, - "column": 11 + "column": 10 } } }, @@ -3413,34 +3236,35 @@ "binop": null }, "value": "right", - "start": 618, - "end": 623, + "start": 616, + "end": 621, "loc": { "start": { "line": 23, - "column": 11 + "column": 10 }, "end": { "line": 23, - "column": 16 + "column": 15 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 623, - "end": 624, + "value": "!==", + "start": 622, + "end": 625, "loc": { "start": { "line": 23, @@ -3448,13 +3272,14 @@ }, "end": { "line": 23, - "column": 17 + "column": 19 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3462,40 +3287,16 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "isLeaf", - "start": 624, + "value": "null", + "start": 626, "end": 630, "loc": { "start": { "line": 23, - "column": 17 - }, - "end": { - "line": 23, - "column": 23 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 630, - "end": 631, - "loc": { - "start": { - "line": 23, - "column": 23 + "column": 20 }, "end": { "line": 23, @@ -3515,8 +3316,8 @@ "postfix": false, "binop": null }, - "start": 631, - "end": 632, + "start": 630, + "end": 631, "loc": { "start": { "line": 23, @@ -3528,31 +3329,6 @@ } } }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 632, - "end": 633, - "loc": { - "start": { - "line": 23, - "column": 25 - }, - "end": { - "line": 23, - "column": 26 - } - } - }, { "type": { "label": "{", @@ -3565,24 +3341,24 @@ "postfix": false, "binop": null }, - "start": 634, - "end": 635, + "start": 632, + "end": 633, "loc": { "start": { "line": 23, - "column": 27 + "column": 26 }, "end": { "line": 23, - "column": 28 + "column": 27 } } }, { "type": "CommentLine", "value": " Yield the nodes on the right recursively. Those nodes are all larger", - "start": 638, - "end": 709, + "start": 636, + "end": 707, "loc": { "start": { "line": 24, @@ -3597,8 +3373,8 @@ { "type": "CommentLine", "value": " than (or equal to) the current node by the binary search tree", - "start": 712, - "end": 776, + "start": 710, + "end": 774, "loc": { "start": { "line": 25, @@ -3613,8 +3389,8 @@ { "type": "CommentLine", "value": " properties.", - "start": 779, - "end": 793, + "start": 777, + "end": 791, "loc": { "start": { "line": 26, @@ -3639,8 +3415,8 @@ "binop": null }, "value": "assert", - "start": 796, - "end": 802, + "start": 794, + "end": 800, "loc": { "start": { "line": 27, @@ -3664,8 +3440,8 @@ "postfix": false, "binop": null }, - "start": 802, - "end": 803, + "start": 800, + "end": 801, "loc": { "start": { "line": 27, @@ -3690,8 +3466,8 @@ "binop": null }, "value": "node", - "start": 803, - "end": 807, + "start": 801, + "end": 805, "loc": { "start": { "line": 27, @@ -3716,8 +3492,8 @@ "binop": null, "updateContext": null }, - "start": 807, - "end": 808, + "start": 805, + "end": 806, "loc": { "start": { "line": 27, @@ -3742,8 +3518,8 @@ "binop": null }, "value": "right", - "start": 808, - "end": 813, + "start": 806, + "end": 811, "loc": { "start": { "line": 27, @@ -3770,8 +3546,8 @@ "updateContext": null }, "value": "instanceof", - "start": 814, - "end": 824, + "start": 812, + "end": 822, "loc": { "start": { "line": 27, @@ -3796,8 +3572,8 @@ "binop": null }, "value": "Node", - "start": 825, - "end": 829, + "start": 823, + "end": 827, "loc": { "start": { "line": 27, @@ -3821,8 +3597,8 @@ "postfix": false, "binop": null }, - "start": 829, - "end": 830, + "start": 827, + "end": 828, "loc": { "start": { "line": 27, @@ -3847,8 +3623,8 @@ "binop": null, "updateContext": null }, - "start": 830, - "end": 831, + "start": 828, + "end": 829, "loc": { "start": { "line": 27, @@ -3875,8 +3651,8 @@ "updateContext": null }, "value": "yield", - "start": 834, - "end": 839, + "start": 832, + "end": 837, "loc": { "start": { "line": 28, @@ -3902,8 +3678,8 @@ "updateContext": null }, "value": "*", - "start": 839, - "end": 840, + "start": 837, + "end": 838, "loc": { "start": { "line": 28, @@ -3928,8 +3704,8 @@ "binop": null }, "value": "inordertraversal", - "start": 841, - "end": 857, + "start": 839, + "end": 855, "loc": { "start": { "line": 28, @@ -3953,8 +3729,8 @@ "postfix": false, "binop": null }, - "start": 857, - "end": 858, + "start": 855, + "end": 856, "loc": { "start": { "line": 28, @@ -3979,8 +3755,8 @@ "binop": null }, "value": "node", - "start": 858, - "end": 862, + "start": 856, + "end": 860, "loc": { "start": { "line": 28, @@ -4005,8 +3781,8 @@ "binop": null, "updateContext": null }, - "start": 862, - "end": 863, + "start": 860, + "end": 861, "loc": { "start": { "line": 28, @@ -4031,8 +3807,8 @@ "binop": null }, "value": "right", - "start": 863, - "end": 868, + "start": 861, + "end": 866, "loc": { "start": { "line": 28, @@ -4056,8 +3832,8 @@ "postfix": false, "binop": null }, - "start": 868, - "end": 869, + "start": 866, + "end": 867, "loc": { "start": { "line": 28, @@ -4082,8 +3858,8 @@ "binop": null, "updateContext": null }, - "start": 869, - "end": 870, + "start": 867, + "end": 868, "loc": { "start": { "line": 28, @@ -4107,8 +3883,8 @@ "postfix": false, "binop": null }, - "start": 872, - "end": 873, + "start": 870, + "end": 871, "loc": { "start": { "line": 29, @@ -4132,8 +3908,8 @@ "postfix": false, "binop": null }, - "start": 874, - "end": 875, + "start": 872, + "end": 873, "loc": { "start": { "line": 30, @@ -4158,8 +3934,8 @@ "binop": null, "updateContext": null }, - "start": 876, - "end": 876, + "start": 874, + "end": 874, "loc": { "start": { "line": 31, diff --git a/ast/source/traversal/rangetraversal.js.json b/ast/source/traversal/rangetraversal.js.json index 0a4696a..7fe26d8 100644 --- a/ast/source/traversal/rangetraversal.js.json +++ b/ast/source/traversal/rangetraversal.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 1463, + "end": 1459, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 1463, + "end": 1459, "loc": { "start": { "line": 1, @@ -187,7 +187,7 @@ { "type": "ExportDefaultDeclaration", "start": 477, - "end": 1462, + "end": 1458, "loc": { "start": { "line": 14, @@ -201,7 +201,7 @@ "declaration": { "type": "FunctionDeclaration", "start": 492, - "end": 1462, + "end": 1458, "loc": { "start": { "line": 14, @@ -306,7 +306,7 @@ "body": { "type": "BlockStatement", "start": 545, - "end": 1462, + "end": 1458, "loc": { "start": { "line": 14, @@ -321,7 +321,7 @@ { "type": "IfStatement", "start": 548, - "end": 1460, + "end": 1456, "loc": { "start": { "line": 15, @@ -472,7 +472,7 @@ "consequent": { "type": "BlockStatement", "start": 581, - "end": 814, + "end": 813, "loc": { "start": { "line": 15, @@ -487,7 +487,7 @@ { "type": "IfStatement", "start": 681, - "end": 811, + "end": 810, "loc": { "start": { "line": 18, @@ -499,9 +499,9 @@ } }, "test": { - "type": "UnaryExpression", + "type": "BinaryExpression", "start": 685, - "end": 705, + "end": 704, "loc": { "start": { "line": 18, @@ -509,127 +509,87 @@ }, "end": { "line": 18, - "column": 26 + "column": 25 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 686, - "end": 705, + "left": { + "type": "MemberExpression", + "start": 685, + "end": 695, "loc": { "start": { "line": 18, - "column": 7 + "column": 6 }, "end": { "line": 18, - "column": 26 + "column": 16 } }, - "callee": { - "type": "MemberExpression", - "start": 686, - "end": 703, + "object": { + "type": "Identifier", + "start": 685, + "end": 689, "loc": { "start": { "line": 18, - "column": 7 + "column": 6 }, "end": { "line": 18, - "column": 24 - } - }, - "object": { - "type": "MemberExpression", - "start": 686, - "end": 696, - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 686, - "end": 690, - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 11 - }, - "identifierName": "root" - }, - "name": "root", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 691, - "end": 696, - "loc": { - "start": { - "line": 18, - "column": 12 - }, - "end": { - "line": 18, - "column": 17 - }, - "identifierName": "right" - }, - "name": "right" + "column": 10 }, - "computed": false, - "leadingComments": null + "identifierName": "root" }, - "property": { - "type": "Identifier", - "start": 697, - "end": 703, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - }, - "identifierName": "isLeaf" + "name": "root", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 690, + "end": 695, + "loc": { + "start": { + "line": 18, + "column": 11 }, - "name": "isLeaf" + "end": { + "line": 18, + "column": 16 + }, + "identifierName": "right" }, - "computed": false, - "leadingComments": null + "name": "right" }, - "arguments": [], + "computed": false, "leadingComments": null }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 700, + "end": 704, + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 25 + } + } }, "leadingComments": null }, "consequent": { "type": "BlockStatement", - "start": 707, - "end": 811, + "start": 706, + "end": 810, "loc": { "start": { "line": 18, - "column": 28 + "column": 27 }, "end": { "line": 21, @@ -639,8 +599,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 712, - "end": 747, + "start": 711, + "end": 746, "loc": { "start": { "line": 19, @@ -653,8 +613,8 @@ }, "expression": { "type": "CallExpression", - "start": 712, - "end": 746, + "start": 711, + "end": 745, "loc": { "start": { "line": 19, @@ -667,8 +627,8 @@ }, "callee": { "type": "Identifier", - "start": 712, - "end": 718, + "start": 711, + "end": 717, "loc": { "start": { "line": 19, @@ -685,8 +645,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 719, - "end": 745, + "start": 718, + "end": 744, "loc": { "start": { "line": 19, @@ -699,8 +659,8 @@ }, "left": { "type": "MemberExpression", - "start": 719, - "end": 729, + "start": 718, + "end": 728, "loc": { "start": { "line": 19, @@ -713,8 +673,8 @@ }, "object": { "type": "Identifier", - "start": 719, - "end": 723, + "start": 718, + "end": 722, "loc": { "start": { "line": 19, @@ -730,8 +690,8 @@ }, "property": { "type": "Identifier", - "start": 724, - "end": 729, + "start": 723, + "end": 728, "loc": { "start": { "line": 19, @@ -750,8 +710,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 741, - "end": 745, + "start": 740, + "end": 744, "loc": { "start": { "line": 19, @@ -771,8 +731,8 @@ }, { "type": "ExpressionStatement", - "start": 751, - "end": 807, + "start": 750, + "end": 806, "loc": { "start": { "line": 20, @@ -785,8 +745,8 @@ }, "expression": { "type": "YieldExpression", - "start": 751, - "end": 806, + "start": 750, + "end": 805, "loc": { "start": { "line": 20, @@ -800,8 +760,8 @@ "delegate": true, "argument": { "type": "CallExpression", - "start": 758, - "end": 806, + "start": 757, + "end": 805, "loc": { "start": { "line": 20, @@ -814,8 +774,8 @@ }, "callee": { "type": "Identifier", - "start": 758, - "end": 772, + "start": 757, + "end": 771, "loc": { "start": { "line": 20, @@ -832,8 +792,8 @@ "arguments": [ { "type": "Identifier", - "start": 773, - "end": 780, + "start": 772, + "end": 779, "loc": { "start": { "line": 20, @@ -849,8 +809,8 @@ }, { "type": "MemberExpression", - "start": 782, - "end": 792, + "start": 781, + "end": 791, "loc": { "start": { "line": 20, @@ -863,8 +823,8 @@ }, "object": { "type": "Identifier", - "start": 782, - "end": 786, + "start": 781, + "end": 785, "loc": { "start": { "line": 20, @@ -880,8 +840,8 @@ }, "property": { "type": "Identifier", - "start": 787, - "end": 792, + "start": 786, + "end": 791, "loc": { "start": { "line": 20, @@ -899,8 +859,8 @@ }, { "type": "Identifier", - "start": 794, - "end": 798, + "start": 793, + "end": 797, "loc": { "start": { "line": 20, @@ -916,8 +876,8 @@ }, { "type": "Identifier", - "start": 800, - "end": 805, + "start": 799, + "end": 804, "loc": { "start": { "line": 20, @@ -979,8 +939,8 @@ }, "alternate": { "type": "IfStatement", - "start": 820, - "end": 1460, + "start": 819, + "end": 1456, "loc": { "start": { "line": 22, @@ -993,8 +953,8 @@ }, "test": { "type": "BinaryExpression", - "start": 824, - "end": 853, + "start": 823, + "end": 852, "loc": { "start": { "line": 22, @@ -1007,8 +967,8 @@ }, "left": { "type": "CallExpression", - "start": 824, - "end": 848, + "start": 823, + "end": 847, "loc": { "start": { "line": 22, @@ -1021,8 +981,8 @@ }, "callee": { "type": "Identifier", - "start": 824, - "end": 831, + "start": 823, + "end": 830, "loc": { "start": { "line": 22, @@ -1039,8 +999,8 @@ "arguments": [ { "type": "MemberExpression", - "start": 832, - "end": 840, + "start": 831, + "end": 839, "loc": { "start": { "line": 22, @@ -1053,8 +1013,8 @@ }, "object": { "type": "Identifier", - "start": 832, - "end": 836, + "start": 831, + "end": 835, "loc": { "start": { "line": 22, @@ -1070,8 +1030,8 @@ }, "property": { "type": "Identifier", - "start": 837, - "end": 840, + "start": 836, + "end": 839, "loc": { "start": { "line": 22, @@ -1089,8 +1049,8 @@ }, { "type": "Identifier", - "start": 842, - "end": 847, + "start": 841, + "end": 846, "loc": { "start": { "line": 22, @@ -1109,8 +1069,8 @@ "operator": ">=", "right": { "type": "NumericLiteral", - "start": 852, - "end": 853, + "start": 851, + "end": 852, "loc": { "start": { "line": 22, @@ -1130,8 +1090,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 855, - "end": 1087, + "start": 854, + "end": 1085, "loc": { "start": { "line": 22, @@ -1145,8 +1105,8 @@ "body": [ { "type": "IfStatement", - "start": 957, - "end": 1084, + "start": 956, + "end": 1082, "loc": { "start": { "line": 25, @@ -1158,9 +1118,9 @@ } }, "test": { - "type": "UnaryExpression", - "start": 961, - "end": 980, + "type": "BinaryExpression", + "start": 960, + "end": 978, "loc": { "start": { "line": 25, @@ -1168,127 +1128,87 @@ }, "end": { "line": 25, - "column": 25 + "column": 24 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 962, - "end": 980, + "left": { + "type": "MemberExpression", + "start": 960, + "end": 969, "loc": { "start": { "line": 25, - "column": 7 + "column": 6 }, "end": { "line": 25, - "column": 25 + "column": 15 } }, - "callee": { - "type": "MemberExpression", - "start": 962, - "end": 978, + "object": { + "type": "Identifier", + "start": 960, + "end": 964, "loc": { "start": { "line": 25, - "column": 7 + "column": 6 }, "end": { "line": 25, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 962, - "end": 971, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 962, - "end": 966, - "loc": { - "start": { - "line": 25, - "column": 7 - }, - "end": { - "line": 25, - "column": 11 - }, - "identifierName": "root" - }, - "name": "root", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 967, - "end": 971, - "loc": { - "start": { - "line": 25, - "column": 12 - }, - "end": { - "line": 25, - "column": 16 - }, - "identifierName": "left" - }, - "name": "left" + "column": 10 }, - "computed": false, - "leadingComments": null + "identifierName": "root" }, - "property": { - "type": "Identifier", - "start": 972, - "end": 978, - "loc": { - "start": { - "line": 25, - "column": 17 - }, - "end": { - "line": 25, - "column": 23 - }, - "identifierName": "isLeaf" + "name": "root", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 965, + "end": 969, + "loc": { + "start": { + "line": 25, + "column": 11 }, - "name": "isLeaf" + "end": { + "line": 25, + "column": 15 + }, + "identifierName": "left" }, - "computed": false, - "leadingComments": null + "name": "left" }, - "arguments": [], + "computed": false, "leadingComments": null }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 974, + "end": 978, + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 24 + } + } }, "leadingComments": null }, "consequent": { "type": "BlockStatement", - "start": 982, - "end": 1084, + "start": 980, + "end": 1082, "loc": { "start": { "line": 25, - "column": 27 + "column": 26 }, "end": { "line": 28, @@ -1298,8 +1218,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 987, - "end": 1021, + "start": 985, + "end": 1019, "loc": { "start": { "line": 26, @@ -1312,8 +1232,8 @@ }, "expression": { "type": "CallExpression", - "start": 987, - "end": 1020, + "start": 985, + "end": 1018, "loc": { "start": { "line": 26, @@ -1326,8 +1246,8 @@ }, "callee": { "type": "Identifier", - "start": 987, - "end": 993, + "start": 985, + "end": 991, "loc": { "start": { "line": 26, @@ -1344,8 +1264,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 994, - "end": 1019, + "start": 992, + "end": 1017, "loc": { "start": { "line": 26, @@ -1358,8 +1278,8 @@ }, "left": { "type": "MemberExpression", - "start": 994, - "end": 1003, + "start": 992, + "end": 1001, "loc": { "start": { "line": 26, @@ -1372,8 +1292,8 @@ }, "object": { "type": "Identifier", - "start": 994, - "end": 998, + "start": 992, + "end": 996, "loc": { "start": { "line": 26, @@ -1389,8 +1309,8 @@ }, "property": { "type": "Identifier", - "start": 999, - "end": 1003, + "start": 997, + "end": 1001, "loc": { "start": { "line": 26, @@ -1409,8 +1329,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1015, - "end": 1019, + "start": 1013, + "end": 1017, "loc": { "start": { "line": 26, @@ -1430,8 +1350,8 @@ }, { "type": "ExpressionStatement", - "start": 1025, - "end": 1080, + "start": 1023, + "end": 1078, "loc": { "start": { "line": 27, @@ -1444,8 +1364,8 @@ }, "expression": { "type": "YieldExpression", - "start": 1025, - "end": 1079, + "start": 1023, + "end": 1077, "loc": { "start": { "line": 27, @@ -1459,8 +1379,8 @@ "delegate": true, "argument": { "type": "CallExpression", - "start": 1032, - "end": 1079, + "start": 1030, + "end": 1077, "loc": { "start": { "line": 27, @@ -1473,8 +1393,8 @@ }, "callee": { "type": "Identifier", - "start": 1032, - "end": 1046, + "start": 1030, + "end": 1044, "loc": { "start": { "line": 27, @@ -1491,8 +1411,8 @@ "arguments": [ { "type": "Identifier", - "start": 1047, - "end": 1054, + "start": 1045, + "end": 1052, "loc": { "start": { "line": 27, @@ -1508,8 +1428,8 @@ }, { "type": "MemberExpression", - "start": 1056, - "end": 1065, + "start": 1054, + "end": 1063, "loc": { "start": { "line": 27, @@ -1522,8 +1442,8 @@ }, "object": { "type": "Identifier", - "start": 1056, - "end": 1060, + "start": 1054, + "end": 1058, "loc": { "start": { "line": 27, @@ -1539,8 +1459,8 @@ }, "property": { "type": "Identifier", - "start": 1061, - "end": 1065, + "start": 1059, + "end": 1063, "loc": { "start": { "line": 27, @@ -1558,8 +1478,8 @@ }, { "type": "Identifier", - "start": 1067, - "end": 1071, + "start": 1065, + "end": 1069, "loc": { "start": { "line": 27, @@ -1575,8 +1495,8 @@ }, { "type": "Identifier", - "start": 1073, - "end": 1078, + "start": 1071, + "end": 1076, "loc": { "start": { "line": 27, @@ -1602,8 +1522,8 @@ { "type": "CommentLine", "value": " If the root lies to the right of the interval, we can discard the", - "start": 859, - "end": 927, + "start": 858, + "end": 926, "loc": { "start": { "line": 23, @@ -1618,8 +1538,8 @@ { "type": "CommentLine", "value": " entire right subtree.", - "start": 930, - "end": 954, + "start": 929, + "end": 953, "loc": { "start": { "line": 24, @@ -1638,8 +1558,8 @@ }, "alternate": { "type": "BlockStatement", - "start": 1093, - "end": 1460, + "start": 1091, + "end": 1456, "loc": { "start": { "line": 29, @@ -1653,8 +1573,8 @@ "body": [ { "type": "IfStatement", - "start": 1178, - "end": 1305, + "start": 1176, + "end": 1302, "loc": { "start": { "line": 32, @@ -1666,9 +1586,9 @@ } }, "test": { - "type": "UnaryExpression", - "start": 1182, - "end": 1201, + "type": "BinaryExpression", + "start": 1180, + "end": 1198, "loc": { "start": { "line": 32, @@ -1676,127 +1596,87 @@ }, "end": { "line": 32, - "column": 25 + "column": 24 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 1183, - "end": 1201, + "left": { + "type": "MemberExpression", + "start": 1180, + "end": 1189, "loc": { "start": { "line": 32, - "column": 7 + "column": 6 }, "end": { "line": 32, - "column": 25 + "column": 15 } }, - "callee": { - "type": "MemberExpression", - "start": 1183, - "end": 1199, + "object": { + "type": "Identifier", + "start": 1180, + "end": 1184, "loc": { "start": { "line": 32, - "column": 7 + "column": 6 }, "end": { "line": 32, - "column": 23 - } - }, - "object": { - "type": "MemberExpression", - "start": 1183, - "end": 1192, - "loc": { - "start": { - "line": 32, - "column": 7 - }, - "end": { - "line": 32, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 1183, - "end": 1187, - "loc": { - "start": { - "line": 32, - "column": 7 - }, - "end": { - "line": 32, - "column": 11 - }, - "identifierName": "root" - }, - "name": "root", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1188, - "end": 1192, - "loc": { - "start": { - "line": 32, - "column": 12 - }, - "end": { - "line": 32, - "column": 16 - }, - "identifierName": "left" - }, - "name": "left" + "column": 10 }, - "computed": false, - "leadingComments": null + "identifierName": "root" }, - "property": { - "type": "Identifier", - "start": 1193, - "end": 1199, - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 23 - }, - "identifierName": "isLeaf" + "name": "root", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1185, + "end": 1189, + "loc": { + "start": { + "line": 32, + "column": 11 }, - "name": "isLeaf" + "end": { + "line": 32, + "column": 15 + }, + "identifierName": "left" }, - "computed": false, - "leadingComments": null + "name": "left" }, - "arguments": [], + "computed": false, "leadingComments": null }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1194, + "end": 1198, + "loc": { + "start": { + "line": 32, + "column": 20 + }, + "end": { + "line": 32, + "column": 24 + } + } }, "leadingComments": null }, "consequent": { "type": "BlockStatement", - "start": 1203, - "end": 1305, + "start": 1200, + "end": 1302, "loc": { "start": { "line": 32, - "column": 27 + "column": 26 }, "end": { "line": 35, @@ -1806,8 +1686,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 1208, - "end": 1242, + "start": 1205, + "end": 1239, "loc": { "start": { "line": 33, @@ -1820,8 +1700,8 @@ }, "expression": { "type": "CallExpression", - "start": 1208, - "end": 1241, + "start": 1205, + "end": 1238, "loc": { "start": { "line": 33, @@ -1834,8 +1714,8 @@ }, "callee": { "type": "Identifier", - "start": 1208, - "end": 1214, + "start": 1205, + "end": 1211, "loc": { "start": { "line": 33, @@ -1852,8 +1732,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1215, - "end": 1240, + "start": 1212, + "end": 1237, "loc": { "start": { "line": 33, @@ -1866,8 +1746,8 @@ }, "left": { "type": "MemberExpression", - "start": 1215, - "end": 1224, + "start": 1212, + "end": 1221, "loc": { "start": { "line": 33, @@ -1880,8 +1760,8 @@ }, "object": { "type": "Identifier", - "start": 1215, - "end": 1219, + "start": 1212, + "end": 1216, "loc": { "start": { "line": 33, @@ -1897,8 +1777,8 @@ }, "property": { "type": "Identifier", - "start": 1220, - "end": 1224, + "start": 1217, + "end": 1221, "loc": { "start": { "line": 33, @@ -1917,8 +1797,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1236, - "end": 1240, + "start": 1233, + "end": 1237, "loc": { "start": { "line": 33, @@ -1938,8 +1818,8 @@ }, { "type": "ExpressionStatement", - "start": 1246, - "end": 1301, + "start": 1243, + "end": 1298, "loc": { "start": { "line": 34, @@ -1952,8 +1832,8 @@ }, "expression": { "type": "YieldExpression", - "start": 1246, - "end": 1300, + "start": 1243, + "end": 1297, "loc": { "start": { "line": 34, @@ -1967,8 +1847,8 @@ "delegate": true, "argument": { "type": "CallExpression", - "start": 1253, - "end": 1300, + "start": 1250, + "end": 1297, "loc": { "start": { "line": 34, @@ -1981,8 +1861,8 @@ }, "callee": { "type": "Identifier", - "start": 1253, - "end": 1267, + "start": 1250, + "end": 1264, "loc": { "start": { "line": 34, @@ -1999,8 +1879,8 @@ "arguments": [ { "type": "Identifier", - "start": 1268, - "end": 1275, + "start": 1265, + "end": 1272, "loc": { "start": { "line": 34, @@ -2016,8 +1896,8 @@ }, { "type": "MemberExpression", - "start": 1277, - "end": 1286, + "start": 1274, + "end": 1283, "loc": { "start": { "line": 34, @@ -2030,8 +1910,8 @@ }, "object": { "type": "Identifier", - "start": 1277, - "end": 1281, + "start": 1274, + "end": 1278, "loc": { "start": { "line": 34, @@ -2047,8 +1927,8 @@ }, "property": { "type": "Identifier", - "start": 1282, - "end": 1286, + "start": 1279, + "end": 1283, "loc": { "start": { "line": 34, @@ -2066,8 +1946,8 @@ }, { "type": "Identifier", - "start": 1288, - "end": 1292, + "start": 1285, + "end": 1289, "loc": { "start": { "line": 34, @@ -2083,8 +1963,8 @@ }, { "type": "Identifier", - "start": 1294, - "end": 1299, + "start": 1291, + "end": 1296, "loc": { "start": { "line": 34, @@ -2110,8 +1990,8 @@ { "type": "CommentLine", "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 1097, - "end": 1161, + "start": 1095, + "end": 1159, "loc": { "start": { "line": 30, @@ -2126,8 +2006,8 @@ { "type": "CommentLine", "value": " between.", - "start": 1164, - "end": 1175, + "start": 1162, + "end": 1173, "loc": { "start": { "line": 31, @@ -2143,8 +2023,8 @@ }, { "type": "ExpressionStatement", - "start": 1309, - "end": 1324, + "start": 1306, + "end": 1321, "loc": { "start": { "line": 37, @@ -2157,8 +2037,8 @@ }, "expression": { "type": "YieldExpression", - "start": 1309, - "end": 1323, + "start": 1306, + "end": 1320, "loc": { "start": { "line": 37, @@ -2172,8 +2052,8 @@ "delegate": false, "argument": { "type": "MemberExpression", - "start": 1315, - "end": 1323, + "start": 1312, + "end": 1320, "loc": { "start": { "line": 37, @@ -2186,8 +2066,8 @@ }, "object": { "type": "Identifier", - "start": 1315, - "end": 1319, + "start": 1312, + "end": 1316, "loc": { "start": { "line": 37, @@ -2203,8 +2083,8 @@ }, "property": { "type": "Identifier", - "start": 1320, - "end": 1323, + "start": 1317, + "end": 1320, "loc": { "start": { "line": 37, @@ -2224,8 +2104,8 @@ }, { "type": "IfStatement", - "start": 1327, - "end": 1457, + "start": 1324, + "end": 1453, "loc": { "start": { "line": 38, @@ -2237,9 +2117,9 @@ } }, "test": { - "type": "UnaryExpression", - "start": 1331, - "end": 1351, + "type": "BinaryExpression", + "start": 1328, + "end": 1347, "loc": { "start": { "line": 38, @@ -2247,122 +2127,84 @@ }, "end": { "line": 38, - "column": 26 + "column": 25 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 1332, - "end": 1351, + "left": { + "type": "MemberExpression", + "start": 1328, + "end": 1338, "loc": { "start": { "line": 38, - "column": 7 + "column": 6 }, "end": { "line": 38, - "column": 26 + "column": 16 } }, - "callee": { - "type": "MemberExpression", - "start": 1332, - "end": 1349, + "object": { + "type": "Identifier", + "start": 1328, + "end": 1332, "loc": { "start": { "line": 38, - "column": 7 + "column": 6 }, "end": { "line": 38, - "column": 24 - } - }, - "object": { - "type": "MemberExpression", - "start": 1332, - "end": 1342, - "loc": { - "start": { - "line": 38, - "column": 7 - }, - "end": { - "line": 38, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 1332, - "end": 1336, - "loc": { - "start": { - "line": 38, - "column": 7 - }, - "end": { - "line": 38, - "column": 11 - }, - "identifierName": "root" - }, - "name": "root" + "column": 10 }, - "property": { - "type": "Identifier", - "start": 1337, - "end": 1342, - "loc": { - "start": { - "line": 38, - "column": 12 - }, - "end": { - "line": 38, - "column": 17 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false + "identifierName": "root" }, - "property": { - "type": "Identifier", - "start": 1343, - "end": 1349, - "loc": { - "start": { - "line": 38, - "column": 18 - }, - "end": { - "line": 38, - "column": 24 - }, - "identifierName": "isLeaf" + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1333, + "end": 1338, + "loc": { + "start": { + "line": 38, + "column": 11 + }, + "end": { + "line": 38, + "column": 16 }, - "name": "isLeaf" + "identifierName": "right" }, - "computed": false + "name": "right" }, - "arguments": [] + "computed": false }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1343, + "end": 1347, + "loc": { + "start": { + "line": 38, + "column": 21 + }, + "end": { + "line": 38, + "column": 25 + } + } } }, "consequent": { "type": "BlockStatement", - "start": 1353, - "end": 1457, + "start": 1349, + "end": 1453, "loc": { "start": { "line": 38, - "column": 28 + "column": 27 }, "end": { "line": 41, @@ -2372,8 +2214,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 1358, - "end": 1393, + "start": 1354, + "end": 1389, "loc": { "start": { "line": 39, @@ -2386,8 +2228,8 @@ }, "expression": { "type": "CallExpression", - "start": 1358, - "end": 1392, + "start": 1354, + "end": 1388, "loc": { "start": { "line": 39, @@ -2400,8 +2242,8 @@ }, "callee": { "type": "Identifier", - "start": 1358, - "end": 1364, + "start": 1354, + "end": 1360, "loc": { "start": { "line": 39, @@ -2418,8 +2260,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1365, - "end": 1391, + "start": 1361, + "end": 1387, "loc": { "start": { "line": 39, @@ -2432,8 +2274,8 @@ }, "left": { "type": "MemberExpression", - "start": 1365, - "end": 1375, + "start": 1361, + "end": 1371, "loc": { "start": { "line": 39, @@ -2446,8 +2288,8 @@ }, "object": { "type": "Identifier", - "start": 1365, - "end": 1369, + "start": 1361, + "end": 1365, "loc": { "start": { "line": 39, @@ -2463,8 +2305,8 @@ }, "property": { "type": "Identifier", - "start": 1370, - "end": 1375, + "start": 1366, + "end": 1371, "loc": { "start": { "line": 39, @@ -2483,8 +2325,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1387, - "end": 1391, + "start": 1383, + "end": 1387, "loc": { "start": { "line": 39, @@ -2504,8 +2346,8 @@ }, { "type": "ExpressionStatement", - "start": 1397, - "end": 1453, + "start": 1393, + "end": 1449, "loc": { "start": { "line": 40, @@ -2518,8 +2360,8 @@ }, "expression": { "type": "YieldExpression", - "start": 1397, - "end": 1452, + "start": 1393, + "end": 1448, "loc": { "start": { "line": 40, @@ -2533,8 +2375,8 @@ "delegate": true, "argument": { "type": "CallExpression", - "start": 1404, - "end": 1452, + "start": 1400, + "end": 1448, "loc": { "start": { "line": 40, @@ -2547,8 +2389,8 @@ }, "callee": { "type": "Identifier", - "start": 1404, - "end": 1418, + "start": 1400, + "end": 1414, "loc": { "start": { "line": 40, @@ -2565,8 +2407,8 @@ "arguments": [ { "type": "Identifier", - "start": 1419, - "end": 1426, + "start": 1415, + "end": 1422, "loc": { "start": { "line": 40, @@ -2582,8 +2424,8 @@ }, { "type": "MemberExpression", - "start": 1428, - "end": 1438, + "start": 1424, + "end": 1434, "loc": { "start": { "line": 40, @@ -2596,8 +2438,8 @@ }, "object": { "type": "Identifier", - "start": 1428, - "end": 1432, + "start": 1424, + "end": 1428, "loc": { "start": { "line": 40, @@ -2613,8 +2455,8 @@ }, "property": { "type": "Identifier", - "start": 1433, - "end": 1438, + "start": 1429, + "end": 1434, "loc": { "start": { "line": 40, @@ -2632,8 +2474,8 @@ }, { "type": "Identifier", - "start": 1440, - "end": 1444, + "start": 1436, + "end": 1440, "loc": { "start": { "line": 40, @@ -2649,8 +2491,8 @@ }, { "type": "Identifier", - "start": 1446, - "end": 1451, + "start": 1442, + "end": 1447, "loc": { "start": { "line": 40, @@ -2775,8 +2617,8 @@ { "type": "CommentLine", "value": " If the root lies to the right of the interval, we can discard the", - "start": 859, - "end": 927, + "start": 858, + "end": 926, "loc": { "start": { "line": 23, @@ -2791,8 +2633,8 @@ { "type": "CommentLine", "value": " entire right subtree.", - "start": 930, - "end": 954, + "start": 929, + "end": 953, "loc": { "start": { "line": 24, @@ -2807,8 +2649,8 @@ { "type": "CommentLine", "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 1097, - "end": 1161, + "start": 1095, + "end": 1159, "loc": { "start": { "line": 30, @@ -2823,8 +2665,8 @@ { "type": "CommentLine", "value": " between.", - "start": 1164, - "end": 1175, + "start": 1162, + "end": 1173, "loc": { "start": { "line": 31, @@ -3963,20 +3805,19 @@ }, { "type": { - "label": "prefix", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": true, + "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "!", + "value": "root", "start": 685, - "end": 686, + "end": 689, "loc": { "start": { "line": 18, @@ -3984,33 +3825,7 @@ }, "end": { "line": 18, - "column": 7 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "root", - "start": 686, - "end": 690, - "loc": { - "start": { - "line": 18, - "column": 7 - }, - "end": { - "line": 18, - "column": 11 + "column": 10 } } }, @@ -4027,16 +3842,16 @@ "binop": null, "updateContext": null }, - "start": 690, - "end": 691, + "start": 689, + "end": 690, "loc": { "start": { "line": 18, - "column": 11 + "column": 10 }, "end": { "line": 18, - "column": 12 + "column": 11 } } }, @@ -4053,34 +3868,35 @@ "binop": null }, "value": "right", - "start": 691, - "end": 696, + "start": 690, + "end": 695, "loc": { "start": { "line": 18, - "column": 12 + "column": 11 }, "end": { "line": 18, - "column": 17 + "column": 16 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, + "value": "!==", "start": 696, - "end": 697, + "end": 699, "loc": { "start": { "line": 18, @@ -4088,13 +3904,14 @@ }, "end": { "line": 18, - "column": 18 + "column": 20 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -4102,40 +3919,16 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "value": "isLeaf", - "start": 697, - "end": 703, - "loc": { - "start": { - "line": 18, - "column": 18 - }, - "end": { - "line": 18, - "column": 24 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 703, + "value": "null", + "start": 700, "end": 704, "loc": { "start": { "line": 18, - "column": 24 + "column": 21 }, "end": { "line": 18, @@ -4168,31 +3961,6 @@ } } }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 705, - "end": 706, - "loc": { - "start": { - "line": 18, - "column": 26 - }, - "end": { - "line": 18, - "column": 27 - } - } - }, { "type": { "label": "{", @@ -4205,16 +3973,16 @@ "postfix": false, "binop": null }, - "start": 707, - "end": 708, + "start": 706, + "end": 707, "loc": { "start": { "line": 18, - "column": 28 + "column": 27 }, "end": { "line": 18, - "column": 29 + "column": 28 } } }, @@ -4231,8 +3999,8 @@ "binop": null }, "value": "assert", - "start": 712, - "end": 718, + "start": 711, + "end": 717, "loc": { "start": { "line": 19, @@ -4256,8 +4024,8 @@ "postfix": false, "binop": null }, - "start": 718, - "end": 719, + "start": 717, + "end": 718, "loc": { "start": { "line": 19, @@ -4282,8 +4050,8 @@ "binop": null }, "value": "root", - "start": 719, - "end": 723, + "start": 718, + "end": 722, "loc": { "start": { "line": 19, @@ -4308,8 +4076,8 @@ "binop": null, "updateContext": null }, - "start": 723, - "end": 724, + "start": 722, + "end": 723, "loc": { "start": { "line": 19, @@ -4334,8 +4102,8 @@ "binop": null }, "value": "right", - "start": 724, - "end": 729, + "start": 723, + "end": 728, "loc": { "start": { "line": 19, @@ -4362,8 +4130,8 @@ "updateContext": null }, "value": "instanceof", - "start": 730, - "end": 740, + "start": 729, + "end": 739, "loc": { "start": { "line": 19, @@ -4388,8 +4156,8 @@ "binop": null }, "value": "Node", - "start": 741, - "end": 745, + "start": 740, + "end": 744, "loc": { "start": { "line": 19, @@ -4413,8 +4181,8 @@ "postfix": false, "binop": null }, - "start": 745, - "end": 746, + "start": 744, + "end": 745, "loc": { "start": { "line": 19, @@ -4439,8 +4207,8 @@ "binop": null, "updateContext": null }, - "start": 746, - "end": 747, + "start": 745, + "end": 746, "loc": { "start": { "line": 19, @@ -4467,8 +4235,8 @@ "updateContext": null }, "value": "yield", - "start": 751, - "end": 756, + "start": 750, + "end": 755, "loc": { "start": { "line": 20, @@ -4494,8 +4262,8 @@ "updateContext": null }, "value": "*", - "start": 756, - "end": 757, + "start": 755, + "end": 756, "loc": { "start": { "line": 20, @@ -4520,8 +4288,8 @@ "binop": null }, "value": "rangetraversal", - "start": 758, - "end": 772, + "start": 757, + "end": 771, "loc": { "start": { "line": 20, @@ -4545,8 +4313,8 @@ "postfix": false, "binop": null }, - "start": 772, - "end": 773, + "start": 771, + "end": 772, "loc": { "start": { "line": 20, @@ -4571,8 +4339,8 @@ "binop": null }, "value": "compare", - "start": 773, - "end": 780, + "start": 772, + "end": 779, "loc": { "start": { "line": 20, @@ -4597,8 +4365,8 @@ "binop": null, "updateContext": null }, - "start": 780, - "end": 781, + "start": 779, + "end": 780, "loc": { "start": { "line": 20, @@ -4623,8 +4391,8 @@ "binop": null }, "value": "root", - "start": 782, - "end": 786, + "start": 781, + "end": 785, "loc": { "start": { "line": 20, @@ -4649,8 +4417,8 @@ "binop": null, "updateContext": null }, - "start": 786, - "end": 787, + "start": 785, + "end": 786, "loc": { "start": { "line": 20, @@ -4675,8 +4443,8 @@ "binop": null }, "value": "right", - "start": 787, - "end": 792, + "start": 786, + "end": 791, "loc": { "start": { "line": 20, @@ -4701,8 +4469,8 @@ "binop": null, "updateContext": null }, - "start": 792, - "end": 793, + "start": 791, + "end": 792, "loc": { "start": { "line": 20, @@ -4727,8 +4495,8 @@ "binop": null }, "value": "left", - "start": 794, - "end": 798, + "start": 793, + "end": 797, "loc": { "start": { "line": 20, @@ -4753,8 +4521,8 @@ "binop": null, "updateContext": null }, - "start": 798, - "end": 799, + "start": 797, + "end": 798, "loc": { "start": { "line": 20, @@ -4779,8 +4547,8 @@ "binop": null }, "value": "right", - "start": 800, - "end": 805, + "start": 799, + "end": 804, "loc": { "start": { "line": 20, @@ -4804,8 +4572,8 @@ "postfix": false, "binop": null }, - "start": 805, - "end": 806, + "start": 804, + "end": 805, "loc": { "start": { "line": 20, @@ -4830,8 +4598,8 @@ "binop": null, "updateContext": null }, - "start": 806, - "end": 807, + "start": 805, + "end": 806, "loc": { "start": { "line": 20, @@ -4855,8 +4623,8 @@ "postfix": false, "binop": null }, - "start": 810, - "end": 811, + "start": 809, + "end": 810, "loc": { "start": { "line": 21, @@ -4880,8 +4648,8 @@ "postfix": false, "binop": null }, - "start": 813, - "end": 814, + "start": 812, + "end": 813, "loc": { "start": { "line": 22, @@ -4908,8 +4676,8 @@ "updateContext": null }, "value": "else", - "start": 815, - "end": 819, + "start": 814, + "end": 818, "loc": { "start": { "line": 22, @@ -4936,8 +4704,8 @@ "updateContext": null }, "value": "if", - "start": 820, - "end": 822, + "start": 819, + "end": 821, "loc": { "start": { "line": 22, @@ -4961,8 +4729,8 @@ "postfix": false, "binop": null }, - "start": 823, - "end": 824, + "start": 822, + "end": 823, "loc": { "start": { "line": 22, @@ -4987,8 +4755,8 @@ "binop": null }, "value": "compare", - "start": 824, - "end": 831, + "start": 823, + "end": 830, "loc": { "start": { "line": 22, @@ -5012,8 +4780,8 @@ "postfix": false, "binop": null }, - "start": 831, - "end": 832, + "start": 830, + "end": 831, "loc": { "start": { "line": 22, @@ -5038,8 +4806,8 @@ "binop": null }, "value": "root", - "start": 832, - "end": 836, + "start": 831, + "end": 835, "loc": { "start": { "line": 22, @@ -5064,8 +4832,8 @@ "binop": null, "updateContext": null }, - "start": 836, - "end": 837, + "start": 835, + "end": 836, "loc": { "start": { "line": 22, @@ -5090,8 +4858,8 @@ "binop": null }, "value": "key", - "start": 837, - "end": 840, + "start": 836, + "end": 839, "loc": { "start": { "line": 22, @@ -5116,8 +4884,8 @@ "binop": null, "updateContext": null }, - "start": 840, - "end": 841, + "start": 839, + "end": 840, "loc": { "start": { "line": 22, @@ -5142,8 +4910,8 @@ "binop": null }, "value": "right", - "start": 842, - "end": 847, + "start": 841, + "end": 846, "loc": { "start": { "line": 22, @@ -5167,8 +4935,8 @@ "postfix": false, "binop": null }, - "start": 847, - "end": 848, + "start": 846, + "end": 847, "loc": { "start": { "line": 22, @@ -5194,8 +4962,8 @@ "updateContext": null }, "value": ">=", - "start": 849, - "end": 851, + "start": 848, + "end": 850, "loc": { "start": { "line": 22, @@ -5221,8 +4989,8 @@ "updateContext": null }, "value": 0, - "start": 852, - "end": 853, + "start": 851, + "end": 852, "loc": { "start": { "line": 22, @@ -5246,8 +5014,8 @@ "postfix": false, "binop": null }, - "start": 853, - "end": 854, + "start": 852, + "end": 853, "loc": { "start": { "line": 22, @@ -5271,8 +5039,8 @@ "postfix": false, "binop": null }, - "start": 855, - "end": 856, + "start": 854, + "end": 855, "loc": { "start": { "line": 22, @@ -5287,8 +5055,8 @@ { "type": "CommentLine", "value": " If the root lies to the right of the interval, we can discard the", - "start": 859, - "end": 927, + "start": 858, + "end": 926, "loc": { "start": { "line": 23, @@ -5303,8 +5071,8 @@ { "type": "CommentLine", "value": " entire right subtree.", - "start": 930, - "end": 954, + "start": 929, + "end": 953, "loc": { "start": { "line": 24, @@ -5331,8 +5099,8 @@ "updateContext": null }, "value": "if", - "start": 957, - "end": 959, + "start": 956, + "end": 958, "loc": { "start": { "line": 25, @@ -5356,8 +5124,8 @@ "postfix": false, "binop": null }, - "start": 960, - "end": 961, + "start": 959, + "end": 960, "loc": { "start": { "line": 25, @@ -5369,33 +5137,6 @@ } } }, - { - "type": { - "label": "prefix", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "!", - "start": 961, - "end": 962, - "loc": { - "start": { - "line": 25, - "column": 6 - }, - "end": { - "line": 25, - "column": 7 - } - } - }, { "type": { "label": "name", @@ -5409,16 +5150,16 @@ "binop": null }, "value": "root", - "start": 962, - "end": 966, + "start": 960, + "end": 964, "loc": { "start": { "line": 25, - "column": 7 + "column": 6 }, "end": { "line": 25, - "column": 11 + "column": 10 } } }, @@ -5435,16 +5176,16 @@ "binop": null, "updateContext": null }, - "start": 966, - "end": 967, + "start": 964, + "end": 965, "loc": { "start": { "line": 25, - "column": 11 + "column": 10 }, "end": { "line": 25, - "column": 12 + "column": 11 } } }, @@ -5461,34 +5202,35 @@ "binop": null }, "value": "left", - "start": 967, - "end": 971, + "start": 965, + "end": 969, "loc": { "start": { "line": 25, - "column": 12 + "column": 11 }, "end": { "line": 25, - "column": 16 + "column": 15 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 971, - "end": 972, + "value": "!==", + "start": 970, + "end": 973, "loc": { "start": { "line": 25, @@ -5496,13 +5238,14 @@ }, "end": { "line": 25, - "column": 17 + "column": 19 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5510,40 +5253,16 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "isLeaf", - "start": 972, + "value": "null", + "start": 974, "end": 978, "loc": { "start": { "line": 25, - "column": 17 - }, - "end": { - "line": 25, - "column": 23 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 978, - "end": 979, - "loc": { - "start": { - "line": 25, - "column": 23 + "column": 20 }, "end": { "line": 25, @@ -5563,8 +5282,8 @@ "postfix": false, "binop": null }, - "start": 979, - "end": 980, + "start": 978, + "end": 979, "loc": { "start": { "line": 25, @@ -5576,31 +5295,6 @@ } } }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 980, - "end": 981, - "loc": { - "start": { - "line": 25, - "column": 25 - }, - "end": { - "line": 25, - "column": 26 - } - } - }, { "type": { "label": "{", @@ -5613,16 +5307,16 @@ "postfix": false, "binop": null }, - "start": 982, - "end": 983, + "start": 980, + "end": 981, "loc": { "start": { "line": 25, - "column": 27 + "column": 26 }, "end": { "line": 25, - "column": 28 + "column": 27 } } }, @@ -5639,8 +5333,8 @@ "binop": null }, "value": "assert", - "start": 987, - "end": 993, + "start": 985, + "end": 991, "loc": { "start": { "line": 26, @@ -5664,8 +5358,8 @@ "postfix": false, "binop": null }, - "start": 993, - "end": 994, + "start": 991, + "end": 992, "loc": { "start": { "line": 26, @@ -5690,8 +5384,8 @@ "binop": null }, "value": "root", - "start": 994, - "end": 998, + "start": 992, + "end": 996, "loc": { "start": { "line": 26, @@ -5716,8 +5410,8 @@ "binop": null, "updateContext": null }, - "start": 998, - "end": 999, + "start": 996, + "end": 997, "loc": { "start": { "line": 26, @@ -5742,8 +5436,8 @@ "binop": null }, "value": "left", - "start": 999, - "end": 1003, + "start": 997, + "end": 1001, "loc": { "start": { "line": 26, @@ -5770,8 +5464,8 @@ "updateContext": null }, "value": "instanceof", - "start": 1004, - "end": 1014, + "start": 1002, + "end": 1012, "loc": { "start": { "line": 26, @@ -5796,8 +5490,8 @@ "binop": null }, "value": "Node", - "start": 1015, - "end": 1019, + "start": 1013, + "end": 1017, "loc": { "start": { "line": 26, @@ -5821,8 +5515,8 @@ "postfix": false, "binop": null }, - "start": 1019, - "end": 1020, + "start": 1017, + "end": 1018, "loc": { "start": { "line": 26, @@ -5847,8 +5541,8 @@ "binop": null, "updateContext": null }, - "start": 1020, - "end": 1021, + "start": 1018, + "end": 1019, "loc": { "start": { "line": 26, @@ -5875,8 +5569,8 @@ "updateContext": null }, "value": "yield", - "start": 1025, - "end": 1030, + "start": 1023, + "end": 1028, "loc": { "start": { "line": 27, @@ -5902,8 +5596,8 @@ "updateContext": null }, "value": "*", - "start": 1030, - "end": 1031, + "start": 1028, + "end": 1029, "loc": { "start": { "line": 27, @@ -5928,8 +5622,8 @@ "binop": null }, "value": "rangetraversal", - "start": 1032, - "end": 1046, + "start": 1030, + "end": 1044, "loc": { "start": { "line": 27, @@ -5953,8 +5647,8 @@ "postfix": false, "binop": null }, - "start": 1046, - "end": 1047, + "start": 1044, + "end": 1045, "loc": { "start": { "line": 27, @@ -5979,8 +5673,8 @@ "binop": null }, "value": "compare", - "start": 1047, - "end": 1054, + "start": 1045, + "end": 1052, "loc": { "start": { "line": 27, @@ -6005,8 +5699,8 @@ "binop": null, "updateContext": null }, - "start": 1054, - "end": 1055, + "start": 1052, + "end": 1053, "loc": { "start": { "line": 27, @@ -6031,8 +5725,8 @@ "binop": null }, "value": "root", - "start": 1056, - "end": 1060, + "start": 1054, + "end": 1058, "loc": { "start": { "line": 27, @@ -6057,8 +5751,8 @@ "binop": null, "updateContext": null }, - "start": 1060, - "end": 1061, + "start": 1058, + "end": 1059, "loc": { "start": { "line": 27, @@ -6083,8 +5777,8 @@ "binop": null }, "value": "left", - "start": 1061, - "end": 1065, + "start": 1059, + "end": 1063, "loc": { "start": { "line": 27, @@ -6109,8 +5803,8 @@ "binop": null, "updateContext": null }, - "start": 1065, - "end": 1066, + "start": 1063, + "end": 1064, "loc": { "start": { "line": 27, @@ -6135,8 +5829,8 @@ "binop": null }, "value": "left", - "start": 1067, - "end": 1071, + "start": 1065, + "end": 1069, "loc": { "start": { "line": 27, @@ -6161,8 +5855,8 @@ "binop": null, "updateContext": null }, - "start": 1071, - "end": 1072, + "start": 1069, + "end": 1070, "loc": { "start": { "line": 27, @@ -6187,8 +5881,8 @@ "binop": null }, "value": "right", - "start": 1073, - "end": 1078, + "start": 1071, + "end": 1076, "loc": { "start": { "line": 27, @@ -6212,8 +5906,8 @@ "postfix": false, "binop": null }, - "start": 1078, - "end": 1079, + "start": 1076, + "end": 1077, "loc": { "start": { "line": 27, @@ -6238,8 +5932,8 @@ "binop": null, "updateContext": null }, - "start": 1079, - "end": 1080, + "start": 1077, + "end": 1078, "loc": { "start": { "line": 27, @@ -6263,8 +5957,8 @@ "postfix": false, "binop": null }, - "start": 1083, - "end": 1084, + "start": 1081, + "end": 1082, "loc": { "start": { "line": 28, @@ -6288,8 +5982,8 @@ "postfix": false, "binop": null }, - "start": 1086, - "end": 1087, + "start": 1084, + "end": 1085, "loc": { "start": { "line": 29, @@ -6316,8 +6010,8 @@ "updateContext": null }, "value": "else", - "start": 1088, - "end": 1092, + "start": 1086, + "end": 1090, "loc": { "start": { "line": 29, @@ -6341,8 +6035,8 @@ "postfix": false, "binop": null }, - "start": 1093, - "end": 1094, + "start": 1091, + "end": 1092, "loc": { "start": { "line": 29, @@ -6357,8 +6051,8 @@ { "type": "CommentLine", "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 1097, - "end": 1161, + "start": 1095, + "end": 1159, "loc": { "start": { "line": 30, @@ -6373,8 +6067,8 @@ { "type": "CommentLine", "value": " between.", - "start": 1164, - "end": 1175, + "start": 1162, + "end": 1173, "loc": { "start": { "line": 31, @@ -6401,8 +6095,8 @@ "updateContext": null }, "value": "if", - "start": 1178, - "end": 1180, + "start": 1176, + "end": 1178, "loc": { "start": { "line": 32, @@ -6426,8 +6120,8 @@ "postfix": false, "binop": null }, - "start": 1181, - "end": 1182, + "start": 1179, + "end": 1180, "loc": { "start": { "line": 32, @@ -6439,33 +6133,6 @@ } } }, - { - "type": { - "label": "prefix", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "!", - "start": 1182, - "end": 1183, - "loc": { - "start": { - "line": 32, - "column": 6 - }, - "end": { - "line": 32, - "column": 7 - } - } - }, { "type": { "label": "name", @@ -6479,16 +6146,16 @@ "binop": null }, "value": "root", - "start": 1183, - "end": 1187, + "start": 1180, + "end": 1184, "loc": { "start": { "line": 32, - "column": 7 + "column": 6 }, "end": { "line": 32, - "column": 11 + "column": 10 } } }, @@ -6505,16 +6172,16 @@ "binop": null, "updateContext": null }, - "start": 1187, - "end": 1188, + "start": 1184, + "end": 1185, "loc": { "start": { "line": 32, - "column": 11 + "column": 10 }, "end": { "line": 32, - "column": 12 + "column": 11 } } }, @@ -6531,33 +6198,34 @@ "binop": null }, "value": "left", - "start": 1188, - "end": 1192, + "start": 1185, + "end": 1189, "loc": { "start": { "line": 32, - "column": 12 + "column": 11 }, "end": { "line": 32, - "column": 16 + "column": 15 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1192, + "value": "!==", + "start": 1190, "end": 1193, "loc": { "start": { @@ -6566,13 +6234,14 @@ }, "end": { "line": 32, - "column": 17 + "column": 19 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -6580,40 +6249,16 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "value": "isLeaf", - "start": 1193, - "end": 1199, - "loc": { - "start": { - "line": 32, - "column": 17 - }, - "end": { - "line": 32, - "column": 23 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1199, - "end": 1200, + "value": "null", + "start": 1194, + "end": 1198, "loc": { "start": { "line": 32, - "column": 23 + "column": 20 }, "end": { "line": 32, @@ -6633,8 +6278,8 @@ "postfix": false, "binop": null }, - "start": 1200, - "end": 1201, + "start": 1198, + "end": 1199, "loc": { "start": { "line": 32, @@ -6646,31 +6291,6 @@ } } }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1201, - "end": 1202, - "loc": { - "start": { - "line": 32, - "column": 25 - }, - "end": { - "line": 32, - "column": 26 - } - } - }, { "type": { "label": "{", @@ -6683,16 +6303,16 @@ "postfix": false, "binop": null }, - "start": 1203, - "end": 1204, + "start": 1200, + "end": 1201, "loc": { "start": { "line": 32, - "column": 27 + "column": 26 }, "end": { "line": 32, - "column": 28 + "column": 27 } } }, @@ -6709,8 +6329,8 @@ "binop": null }, "value": "assert", - "start": 1208, - "end": 1214, + "start": 1205, + "end": 1211, "loc": { "start": { "line": 33, @@ -6734,8 +6354,8 @@ "postfix": false, "binop": null }, - "start": 1214, - "end": 1215, + "start": 1211, + "end": 1212, "loc": { "start": { "line": 33, @@ -6760,8 +6380,8 @@ "binop": null }, "value": "root", - "start": 1215, - "end": 1219, + "start": 1212, + "end": 1216, "loc": { "start": { "line": 33, @@ -6786,8 +6406,8 @@ "binop": null, "updateContext": null }, - "start": 1219, - "end": 1220, + "start": 1216, + "end": 1217, "loc": { "start": { "line": 33, @@ -6812,8 +6432,8 @@ "binop": null }, "value": "left", - "start": 1220, - "end": 1224, + "start": 1217, + "end": 1221, "loc": { "start": { "line": 33, @@ -6840,8 +6460,8 @@ "updateContext": null }, "value": "instanceof", - "start": 1225, - "end": 1235, + "start": 1222, + "end": 1232, "loc": { "start": { "line": 33, @@ -6866,8 +6486,8 @@ "binop": null }, "value": "Node", - "start": 1236, - "end": 1240, + "start": 1233, + "end": 1237, "loc": { "start": { "line": 33, @@ -6891,8 +6511,8 @@ "postfix": false, "binop": null }, - "start": 1240, - "end": 1241, + "start": 1237, + "end": 1238, "loc": { "start": { "line": 33, @@ -6917,8 +6537,8 @@ "binop": null, "updateContext": null }, - "start": 1241, - "end": 1242, + "start": 1238, + "end": 1239, "loc": { "start": { "line": 33, @@ -6945,8 +6565,8 @@ "updateContext": null }, "value": "yield", - "start": 1246, - "end": 1251, + "start": 1243, + "end": 1248, "loc": { "start": { "line": 34, @@ -6972,8 +6592,8 @@ "updateContext": null }, "value": "*", - "start": 1251, - "end": 1252, + "start": 1248, + "end": 1249, "loc": { "start": { "line": 34, @@ -6998,8 +6618,8 @@ "binop": null }, "value": "rangetraversal", - "start": 1253, - "end": 1267, + "start": 1250, + "end": 1264, "loc": { "start": { "line": 34, @@ -7023,8 +6643,8 @@ "postfix": false, "binop": null }, - "start": 1267, - "end": 1268, + "start": 1264, + "end": 1265, "loc": { "start": { "line": 34, @@ -7049,8 +6669,8 @@ "binop": null }, "value": "compare", - "start": 1268, - "end": 1275, + "start": 1265, + "end": 1272, "loc": { "start": { "line": 34, @@ -7075,8 +6695,8 @@ "binop": null, "updateContext": null }, - "start": 1275, - "end": 1276, + "start": 1272, + "end": 1273, "loc": { "start": { "line": 34, @@ -7101,8 +6721,8 @@ "binop": null }, "value": "root", - "start": 1277, - "end": 1281, + "start": 1274, + "end": 1278, "loc": { "start": { "line": 34, @@ -7127,8 +6747,8 @@ "binop": null, "updateContext": null }, - "start": 1281, - "end": 1282, + "start": 1278, + "end": 1279, "loc": { "start": { "line": 34, @@ -7153,8 +6773,8 @@ "binop": null }, "value": "left", - "start": 1282, - "end": 1286, + "start": 1279, + "end": 1283, "loc": { "start": { "line": 34, @@ -7179,8 +6799,8 @@ "binop": null, "updateContext": null }, - "start": 1286, - "end": 1287, + "start": 1283, + "end": 1284, "loc": { "start": { "line": 34, @@ -7205,8 +6825,8 @@ "binop": null }, "value": "left", - "start": 1288, - "end": 1292, + "start": 1285, + "end": 1289, "loc": { "start": { "line": 34, @@ -7231,8 +6851,8 @@ "binop": null, "updateContext": null }, - "start": 1292, - "end": 1293, + "start": 1289, + "end": 1290, "loc": { "start": { "line": 34, @@ -7257,8 +6877,8 @@ "binop": null }, "value": "right", - "start": 1294, - "end": 1299, + "start": 1291, + "end": 1296, "loc": { "start": { "line": 34, @@ -7282,8 +6902,8 @@ "postfix": false, "binop": null }, - "start": 1299, - "end": 1300, + "start": 1296, + "end": 1297, "loc": { "start": { "line": 34, @@ -7308,8 +6928,8 @@ "binop": null, "updateContext": null }, - "start": 1300, - "end": 1301, + "start": 1297, + "end": 1298, "loc": { "start": { "line": 34, @@ -7333,8 +6953,8 @@ "postfix": false, "binop": null }, - "start": 1304, - "end": 1305, + "start": 1301, + "end": 1302, "loc": { "start": { "line": 35, @@ -7361,8 +6981,8 @@ "updateContext": null }, "value": "yield", - "start": 1309, - "end": 1314, + "start": 1306, + "end": 1311, "loc": { "start": { "line": 37, @@ -7387,8 +7007,8 @@ "binop": null }, "value": "root", - "start": 1315, - "end": 1319, + "start": 1312, + "end": 1316, "loc": { "start": { "line": 37, @@ -7413,8 +7033,8 @@ "binop": null, "updateContext": null }, - "start": 1319, - "end": 1320, + "start": 1316, + "end": 1317, "loc": { "start": { "line": 37, @@ -7439,8 +7059,8 @@ "binop": null }, "value": "key", - "start": 1320, - "end": 1323, + "start": 1317, + "end": 1320, "loc": { "start": { "line": 37, @@ -7465,8 +7085,8 @@ "binop": null, "updateContext": null }, - "start": 1323, - "end": 1324, + "start": 1320, + "end": 1321, "loc": { "start": { "line": 37, @@ -7493,8 +7113,8 @@ "updateContext": null }, "value": "if", - "start": 1327, - "end": 1329, + "start": 1324, + "end": 1326, "loc": { "start": { "line": 38, @@ -7518,8 +7138,8 @@ "postfix": false, "binop": null }, - "start": 1330, - "end": 1331, + "start": 1327, + "end": 1328, "loc": { "start": { "line": 38, @@ -7531,33 +7151,6 @@ } } }, - { - "type": { - "label": "prefix", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": true, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "!", - "start": 1331, - "end": 1332, - "loc": { - "start": { - "line": 38, - "column": 6 - }, - "end": { - "line": 38, - "column": 7 - } - } - }, { "type": { "label": "name", @@ -7571,16 +7164,16 @@ "binop": null }, "value": "root", - "start": 1332, - "end": 1336, + "start": 1328, + "end": 1332, "loc": { "start": { "line": 38, - "column": 7 + "column": 6 }, "end": { "line": 38, - "column": 11 + "column": 10 } } }, @@ -7597,16 +7190,16 @@ "binop": null, "updateContext": null }, - "start": 1336, - "end": 1337, + "start": 1332, + "end": 1333, "loc": { "start": { "line": 38, - "column": 11 + "column": 10 }, "end": { "line": 38, - "column": 12 + "column": 11 } } }, @@ -7623,34 +7216,35 @@ "binop": null }, "value": "right", - "start": 1337, - "end": 1342, + "start": 1333, + "end": 1338, "loc": { "start": { "line": 38, - "column": 12 + "column": 11 }, "end": { "line": 38, - "column": 17 + "column": 16 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1342, - "end": 1343, + "value": "!==", + "start": 1339, + "end": 1342, "loc": { "start": { "line": 38, @@ -7658,13 +7252,14 @@ }, "end": { "line": 38, - "column": 18 + "column": 20 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7672,40 +7267,16 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "isLeaf", + "value": "null", "start": 1343, - "end": 1349, - "loc": { - "start": { - "line": 38, - "column": 18 - }, - "end": { - "line": 38, - "column": 24 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1349, - "end": 1350, + "end": 1347, "loc": { "start": { "line": 38, - "column": 24 + "column": 21 }, "end": { "line": 38, @@ -7725,8 +7296,8 @@ "postfix": false, "binop": null }, - "start": 1350, - "end": 1351, + "start": 1347, + "end": 1348, "loc": { "start": { "line": 38, @@ -7738,31 +7309,6 @@ } } }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1351, - "end": 1352, - "loc": { - "start": { - "line": 38, - "column": 26 - }, - "end": { - "line": 38, - "column": 27 - } - } - }, { "type": { "label": "{", @@ -7775,16 +7321,16 @@ "postfix": false, "binop": null }, - "start": 1353, - "end": 1354, + "start": 1349, + "end": 1350, "loc": { "start": { "line": 38, - "column": 28 + "column": 27 }, "end": { "line": 38, - "column": 29 + "column": 28 } } }, @@ -7801,8 +7347,8 @@ "binop": null }, "value": "assert", - "start": 1358, - "end": 1364, + "start": 1354, + "end": 1360, "loc": { "start": { "line": 39, @@ -7826,8 +7372,8 @@ "postfix": false, "binop": null }, - "start": 1364, - "end": 1365, + "start": 1360, + "end": 1361, "loc": { "start": { "line": 39, @@ -7852,8 +7398,8 @@ "binop": null }, "value": "root", - "start": 1365, - "end": 1369, + "start": 1361, + "end": 1365, "loc": { "start": { "line": 39, @@ -7878,8 +7424,8 @@ "binop": null, "updateContext": null }, - "start": 1369, - "end": 1370, + "start": 1365, + "end": 1366, "loc": { "start": { "line": 39, @@ -7904,8 +7450,8 @@ "binop": null }, "value": "right", - "start": 1370, - "end": 1375, + "start": 1366, + "end": 1371, "loc": { "start": { "line": 39, @@ -7932,8 +7478,8 @@ "updateContext": null }, "value": "instanceof", - "start": 1376, - "end": 1386, + "start": 1372, + "end": 1382, "loc": { "start": { "line": 39, @@ -7958,8 +7504,8 @@ "binop": null }, "value": "Node", - "start": 1387, - "end": 1391, + "start": 1383, + "end": 1387, "loc": { "start": { "line": 39, @@ -7983,8 +7529,8 @@ "postfix": false, "binop": null }, - "start": 1391, - "end": 1392, + "start": 1387, + "end": 1388, "loc": { "start": { "line": 39, @@ -8009,8 +7555,8 @@ "binop": null, "updateContext": null }, - "start": 1392, - "end": 1393, + "start": 1388, + "end": 1389, "loc": { "start": { "line": 39, @@ -8037,8 +7583,8 @@ "updateContext": null }, "value": "yield", - "start": 1397, - "end": 1402, + "start": 1393, + "end": 1398, "loc": { "start": { "line": 40, @@ -8064,8 +7610,8 @@ "updateContext": null }, "value": "*", - "start": 1402, - "end": 1403, + "start": 1398, + "end": 1399, "loc": { "start": { "line": 40, @@ -8090,8 +7636,8 @@ "binop": null }, "value": "rangetraversal", - "start": 1404, - "end": 1418, + "start": 1400, + "end": 1414, "loc": { "start": { "line": 40, @@ -8115,8 +7661,8 @@ "postfix": false, "binop": null }, - "start": 1418, - "end": 1419, + "start": 1414, + "end": 1415, "loc": { "start": { "line": 40, @@ -8141,8 +7687,8 @@ "binop": null }, "value": "compare", - "start": 1419, - "end": 1426, + "start": 1415, + "end": 1422, "loc": { "start": { "line": 40, @@ -8167,8 +7713,8 @@ "binop": null, "updateContext": null }, - "start": 1426, - "end": 1427, + "start": 1422, + "end": 1423, "loc": { "start": { "line": 40, @@ -8193,8 +7739,8 @@ "binop": null }, "value": "root", - "start": 1428, - "end": 1432, + "start": 1424, + "end": 1428, "loc": { "start": { "line": 40, @@ -8219,8 +7765,8 @@ "binop": null, "updateContext": null }, - "start": 1432, - "end": 1433, + "start": 1428, + "end": 1429, "loc": { "start": { "line": 40, @@ -8245,8 +7791,8 @@ "binop": null }, "value": "right", - "start": 1433, - "end": 1438, + "start": 1429, + "end": 1434, "loc": { "start": { "line": 40, @@ -8271,8 +7817,8 @@ "binop": null, "updateContext": null }, - "start": 1438, - "end": 1439, + "start": 1434, + "end": 1435, "loc": { "start": { "line": 40, @@ -8297,8 +7843,8 @@ "binop": null }, "value": "left", - "start": 1440, - "end": 1444, + "start": 1436, + "end": 1440, "loc": { "start": { "line": 40, @@ -8323,8 +7869,8 @@ "binop": null, "updateContext": null }, - "start": 1444, - "end": 1445, + "start": 1440, + "end": 1441, "loc": { "start": { "line": 40, @@ -8349,8 +7895,8 @@ "binop": null }, "value": "right", - "start": 1446, - "end": 1451, + "start": 1442, + "end": 1447, "loc": { "start": { "line": 40, @@ -8374,8 +7920,8 @@ "postfix": false, "binop": null }, - "start": 1451, - "end": 1452, + "start": 1447, + "end": 1448, "loc": { "start": { "line": 40, @@ -8400,8 +7946,8 @@ "binop": null, "updateContext": null }, - "start": 1452, - "end": 1453, + "start": 1448, + "end": 1449, "loc": { "start": { "line": 40, @@ -8425,8 +7971,8 @@ "postfix": false, "binop": null }, - "start": 1456, - "end": 1457, + "start": 1452, + "end": 1453, "loc": { "start": { "line": 41, @@ -8450,8 +7996,8 @@ "postfix": false, "binop": null }, - "start": 1459, - "end": 1460, + "start": 1455, + "end": 1456, "loc": { "start": { "line": 42, @@ -8475,8 +8021,8 @@ "postfix": false, "binop": null }, - "start": 1461, - "end": 1462, + "start": 1457, + "end": 1458, "loc": { "start": { "line": 43, @@ -8501,8 +8047,8 @@ "binop": null, "updateContext": null }, - "start": 1463, - "end": 1463, + "start": 1459, + "end": 1459, "loc": { "start": { "line": 44, diff --git a/ast/source/types/Leaf.js.json b/ast/source/types/Leaf.js.json deleted file mode 100644 index 845740b..0000000 --- a/ast/source/types/Leaf.js.json +++ /dev/null @@ -1,2694 +0,0 @@ -{ - "type": "File", - "start": 0, - "end": 609, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 28, - "column": 0 - } - }, - "program": { - "type": "Program", - "start": 0, - "end": 609, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 28, - "column": 0 - } - }, - "sourceType": "module", - "body": [ - { - "type": "ImportDeclaration", - "start": 0, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - }, - "local": { - "type": "Identifier", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - }, - "identifierName": "assert" - }, - "name": "assert" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - }, - "extra": { - "rawValue": "assert", - "raw": "'assert'" - }, - "value": "assert" - } - }, - { - "type": "ImportDeclaration", - "start": 29, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 38 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - }, - "local": { - "type": "Identifier", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 47, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - }, - "extra": { - "rawValue": "../color/BLACK.js", - "raw": "'../color/BLACK.js'" - }, - "value": "../color/BLACK.js" - } - }, - { - "type": "ImportDeclaration", - "start": 68, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 29 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 75, - "end": 79, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 75, - "end": 79, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 85, - "end": 96, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 28 - } - }, - "extra": { - "rawValue": "./Node.js", - "raw": "'./Node.js'" - }, - "value": "./Node.js" - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", - "start": 99, - "end": 196, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - } - ] - }, - { - "type": "ExportDefaultDeclaration", - "start": 197, - "end": 405, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 17, - "column": 1 - } - }, - "declaration": { - "type": "FunctionDeclaration", - "start": 212, - "end": 405, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 17, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 221, - "end": 225, - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 28 - }, - "identifierName": "Leaf" - }, - "name": "Leaf", - "leadingComments": null - }, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 226, - "end": 232, - "loc": { - "start": { - "line": 11, - "column": 29 - }, - "end": { - "line": 11, - "column": 35 - }, - "identifierName": "parent" - }, - "name": "parent" - } - ], - "body": { - "type": "BlockStatement", - "start": 234, - "end": 405, - "loc": { - "start": { - "line": 11, - "column": 37 - }, - "end": { - "line": 17, - "column": 1 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 237, - "end": 268, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 32 - } - }, - "expression": { - "type": "CallExpression", - "start": 237, - "end": 267, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 237, - "end": 243, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 7 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 244, - "end": 266, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 30 - } - }, - "left": { - "type": "Identifier", - "start": 244, - "end": 250, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 14 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 262, - "end": 266, - "loc": { - "start": { - "line": 12, - "column": 26 - }, - "end": { - "line": 12, - "column": 30 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "* @constant {number} The color of the node. ", - "start": 270, - "end": 318, - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 49 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 320, - "end": 340, - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 21 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 320, - "end": 339, - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 20 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 320, - "end": 331, - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 12 - } - }, - "object": { - "type": "ThisExpression", - "start": 320, - "end": 324, - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 5 - } - }, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 325, - "end": 331, - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 12 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 334, - "end": 339, - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 14, - "column": 20 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "* @constant {number} The color of the node. ", - "start": 270, - "end": 318, - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 49 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "* @member {Node} The parent node. ", - "start": 342, - "end": 380, - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 39 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 382, - "end": 403, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 22 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 382, - "end": 402, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 21 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 382, - "end": 393, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 12 - } - }, - "object": { - "type": "ThisExpression", - "start": 382, - "end": 386, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 5 - } - }, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 387, - "end": 393, - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 12 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 396, - "end": 402, - "loc": { - "start": { - "line": 16, - "column": 15 - }, - "end": { - "line": 16, - "column": 21 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "* @member {Node} The parent node. ", - "start": 342, - "end": 380, - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 39 - } - } - } - ] - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", - "start": 99, - "end": 196, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 407, - "end": 553, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 24, - "column": 3 - } - } - } - ] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", - "start": 99, - "end": 196, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 407, - "end": 553, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 24, - "column": 3 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 554, - "end": 608, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 27, - "column": 2 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 554, - "end": 607, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 27, - "column": 1 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 554, - "end": 575, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 25, - "column": 21 - } - }, - "object": { - "type": "MemberExpression", - "start": 554, - "end": 568, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 25, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 554, - "end": 558, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 25, - "column": 4 - }, - "identifierName": "Leaf" - }, - "name": "Leaf", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 559, - "end": 568, - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 25, - "column": 14 - }, - "identifierName": "prototype" - }, - "name": "prototype" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 569, - "end": 575, - "loc": { - "start": { - "line": 25, - "column": 15 - }, - "end": { - "line": 25, - "column": 21 - }, - "identifierName": "isLeaf" - }, - "name": "isLeaf" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "FunctionExpression", - "start": 578, - "end": 607, - "loc": { - "start": { - "line": 25, - "column": 24 - }, - "end": { - "line": 27, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 569, - "end": 575, - "loc": { - "start": { - "line": 25, - "column": 15 - }, - "end": { - "line": 25, - "column": 21 - }, - "identifierName": "isLeaf" - }, - "name": "isLeaf" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 590, - "end": 607, - "loc": { - "start": { - "line": 25, - "column": 36 - }, - "end": { - "line": 27, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 593, - "end": 605, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 13 - } - }, - "argument": { - "type": "BooleanLiteral", - "start": 600, - "end": 604, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 12 - } - }, - "value": true - } - } - ], - "directives": [] - } - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 407, - "end": 553, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 24, - "column": 3 - } - } - } - ] - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", - "start": 99, - "end": 196, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - }, - { - "type": "CommentBlock", - "value": "* @constant {number} The color of the node. ", - "start": 270, - "end": 318, - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 49 - } - } - }, - { - "type": "CommentBlock", - "value": "* @member {Node} The parent node. ", - "start": 342, - "end": 380, - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 39 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 407, - "end": 553, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 24, - "column": 3 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 36, - "end": 41, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 42, - "end": 46, - "loc": { - "start": { - "line": 2, - "column": 13 - }, - "end": { - "line": 2, - "column": 17 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../color/BLACK.js", - "start": 47, - "end": 66, - "loc": { - "start": { - "line": 2, - "column": 18 - }, - "end": { - "line": 2, - "column": 37 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 66, - "end": 67, - "loc": { - "start": { - "line": 2, - "column": 37 - }, - "end": { - "line": 2, - "column": 38 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 68, - "end": 74, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 3, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 75, - "end": 79, - "loc": { - "start": { - "line": 3, - "column": 7 - }, - "end": { - "line": 3, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 80, - "end": 84, - "loc": { - "start": { - "line": 3, - "column": 12 - }, - "end": { - "line": 3, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./Node.js", - "start": 85, - "end": 96, - "loc": { - "start": { - "line": 3, - "column": 17 - }, - "end": { - "line": 3, - "column": 28 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 96, - "end": 97, - "loc": { - "start": { - "line": 3, - "column": 28 - }, - "end": { - "line": 3, - "column": 29 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n ", - "start": 99, - "end": 196, - "loc": { - "start": { - "line": 5, - "column": 0 - }, - "end": { - "line": 10, - "column": 3 - } - } - }, - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "export", - "start": 197, - "end": 203, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 11, - "column": 6 - } - } - }, - { - "type": { - "label": "default", - "keyword": "default", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "default", - "start": 204, - "end": 211, - "loc": { - "start": { - "line": 11, - "column": 7 - }, - "end": { - "line": 11, - "column": 14 - } - } - }, - { - "type": { - "label": "function", - "keyword": "function", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "function", - "start": 212, - "end": 220, - "loc": { - "start": { - "line": 11, - "column": 15 - }, - "end": { - "line": 11, - "column": 23 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 221, - "end": 225, - "loc": { - "start": { - "line": 11, - "column": 24 - }, - "end": { - "line": 11, - "column": 28 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 225, - "end": 226, - "loc": { - "start": { - "line": 11, - "column": 28 - }, - "end": { - "line": 11, - "column": 29 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 226, - "end": 232, - "loc": { - "start": { - "line": 11, - "column": 29 - }, - "end": { - "line": 11, - "column": 35 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 232, - "end": 233, - "loc": { - "start": { - "line": 11, - "column": 35 - }, - "end": { - "line": 11, - "column": 36 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 234, - "end": 235, - "loc": { - "start": { - "line": 11, - "column": 37 - }, - "end": { - "line": 11, - "column": 38 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 237, - "end": 243, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 243, - "end": 244, - "loc": { - "start": { - "line": 12, - "column": 7 - }, - "end": { - "line": 12, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 244, - "end": 250, - "loc": { - "start": { - "line": 12, - "column": 8 - }, - "end": { - "line": 12, - "column": 14 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 251, - "end": 261, - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 25 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 262, - "end": 266, - "loc": { - "start": { - "line": 12, - "column": 26 - }, - "end": { - "line": 12, - "column": 30 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 266, - "end": 267, - "loc": { - "start": { - "line": 12, - "column": 30 - }, - "end": { - "line": 12, - "column": 31 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 267, - "end": 268, - "loc": { - "start": { - "line": 12, - "column": 31 - }, - "end": { - "line": 12, - "column": 32 - } - } - }, - { - "type": "CommentBlock", - "value": "* @constant {number} The color of the node. ", - "start": 270, - "end": 318, - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 49 - } - } - }, - { - "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "this", - "start": 320, - "end": 324, - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 5 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 324, - "end": 325, - "loc": { - "start": { - "line": 14, - "column": 5 - }, - "end": { - "line": 14, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 325, - "end": 331, - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 12 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 332, - "end": 333, - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 334, - "end": 339, - "loc": { - "start": { - "line": 14, - "column": 15 - }, - "end": { - "line": 14, - "column": 20 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 339, - "end": 340, - "loc": { - "start": { - "line": 14, - "column": 20 - }, - "end": { - "line": 14, - "column": 21 - } - } - }, - { - "type": "CommentBlock", - "value": "* @member {Node} The parent node. ", - "start": 342, - "end": 380, - "loc": { - "start": { - "line": 15, - "column": 1 - }, - "end": { - "line": 15, - "column": 39 - } - } - }, - { - "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "this", - "start": 382, - "end": 386, - "loc": { - "start": { - "line": 16, - "column": 1 - }, - "end": { - "line": 16, - "column": 5 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 386, - "end": 387, - "loc": { - "start": { - "line": 16, - "column": 5 - }, - "end": { - "line": 16, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 387, - "end": 393, - "loc": { - "start": { - "line": 16, - "column": 6 - }, - "end": { - "line": 16, - "column": 12 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 394, - "end": 395, - "loc": { - "start": { - "line": 16, - "column": 13 - }, - "end": { - "line": 16, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "parent", - "start": 396, - "end": 402, - "loc": { - "start": { - "line": 16, - "column": 15 - }, - "end": { - "line": 16, - "column": 21 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 402, - "end": 403, - "loc": { - "start": { - "line": 16, - "column": 21 - }, - "end": { - "line": 16, - "column": 22 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 404, - "end": 405, - "loc": { - "start": { - "line": 17, - "column": 0 - }, - "end": { - "line": 17, - "column": 1 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n ", - "start": 407, - "end": 553, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 24, - "column": 3 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 554, - "end": 558, - "loc": { - "start": { - "line": 25, - "column": 0 - }, - "end": { - "line": 25, - "column": 4 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 558, - "end": 559, - "loc": { - "start": { - "line": 25, - "column": 4 - }, - "end": { - "line": 25, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "prototype", - "start": 559, - "end": 568, - "loc": { - "start": { - "line": 25, - "column": 5 - }, - "end": { - "line": 25, - "column": 14 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 568, - "end": 569, - "loc": { - "start": { - "line": 25, - "column": 14 - }, - "end": { - "line": 25, - "column": 15 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "isLeaf", - "start": 569, - "end": 575, - "loc": { - "start": { - "line": 25, - "column": 15 - }, - "end": { - "line": 25, - "column": 21 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 576, - "end": 577, - "loc": { - "start": { - "line": 25, - "column": 22 - }, - "end": { - "line": 25, - "column": 23 - } - } - }, - { - "type": { - "label": "function", - "keyword": "function", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "function", - "start": 578, - "end": 586, - "loc": { - "start": { - "line": 25, - "column": 24 - }, - "end": { - "line": 25, - "column": 32 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 587, - "end": 588, - "loc": { - "start": { - "line": 25, - "column": 33 - }, - "end": { - "line": 25, - "column": 34 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 588, - "end": 589, - "loc": { - "start": { - "line": 25, - "column": 34 - }, - "end": { - "line": 25, - "column": 35 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 590, - "end": 591, - "loc": { - "start": { - "line": 25, - "column": 36 - }, - "end": { - "line": 25, - "column": 37 - } - } - }, - { - "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "return", - "start": 593, - "end": 599, - "loc": { - "start": { - "line": 26, - "column": 1 - }, - "end": { - "line": 26, - "column": 7 - } - } - }, - { - "type": { - "label": "true", - "keyword": "true", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "true", - "start": 600, - "end": 604, - "loc": { - "start": { - "line": 26, - "column": 8 - }, - "end": { - "line": 26, - "column": 12 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 604, - "end": 605, - "loc": { - "start": { - "line": 26, - "column": 12 - }, - "end": { - "line": 26, - "column": 13 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 606, - "end": 607, - "loc": { - "start": { - "line": 27, - "column": 0 - }, - "end": { - "line": 27, - "column": 1 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 607, - "end": 608, - "loc": { - "start": { - "line": 27, - "column": 1 - }, - "end": { - "line": 27, - "column": 2 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 609, - "end": 609, - "loc": { - "start": { - "line": 28, - "column": 0 - }, - "end": { - "line": 28, - "column": 0 - } - } - } - ] -} \ No newline at end of file diff --git a/ast/source/types/Node.js.json b/ast/source/types/Node.js.json index b70b327..9be2e4f 100644 --- a/ast/source/types/Node.js.json +++ b/ast/source/types/Node.js.json @@ -1,159 +1,72 @@ { "type": "File", "start": 0, - "end": 790, + "end": 524, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 32, + "line": 20, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 790, + "end": 524, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 32, + "line": 20, "column": 0 } }, "sourceType": "module", "body": [ - { - "type": "ImportDeclaration", - "start": 0, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 29 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - }, - "local": { - "type": "Identifier", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 17, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 17 - }, - "end": { - "line": 1, - "column": 28 - } - }, - "extra": { - "rawValue": "./Leaf.js", - "raw": "'./Leaf.js'" - }, - "value": "./Leaf.js" - }, - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", - "start": 31, - "end": 196, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 9, - "column": 3 - } - } - } - ] - }, { "type": "ExportDefaultDeclaration", - "start": 197, - "end": 584, + "start": 166, + "end": 523, "loc": { "start": { - "line": 10, + "line": 8, "column": 0 }, "end": { - "line": 21, + "line": 19, "column": 1 } }, "declaration": { "type": "FunctionDeclaration", - "start": 212, - "end": 584, + "start": 181, + "end": 523, "loc": { "start": { - "line": 10, + "line": 8, "column": 15 }, "end": { - "line": 21, + "line": 19, "column": 1 } }, "id": { "type": "Identifier", - "start": 221, - "end": 225, + "start": 190, + "end": 194, "loc": { "start": { - "line": 10, + "line": 8, "column": 24 }, "end": { - "line": 10, + "line": 8, "column": 28 }, "identifierName": "Node" @@ -167,15 +80,15 @@ "params": [ { "type": "Identifier", - "start": 226, - "end": 231, + "start": 195, + "end": 200, "loc": { "start": { - "line": 10, + "line": 8, "column": 29 }, "end": { - "line": 10, + "line": 8, "column": 34 }, "identifierName": "color" @@ -184,15 +97,15 @@ }, { "type": "Identifier", - "start": 233, - "end": 236, + "start": 202, + "end": 205, "loc": { "start": { - "line": 10, + "line": 8, "column": 36 }, "end": { - "line": 10, + "line": 8, "column": 39 }, "identifierName": "key" @@ -202,73 +115,73 @@ ], "body": { "type": "BlockStatement", - "start": 238, - "end": 584, + "start": 207, + "end": 523, "loc": { "start": { - "line": 10, + "line": 8, "column": 41 }, "end": { - "line": 21, + "line": 19, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 289, - "end": 309, + "start": 258, + "end": 278, "loc": { "start": { - "line": 12, + "line": 10, "column": 1 }, "end": { - "line": 12, + "line": 10, "column": 21 } }, "expression": { "type": "AssignmentExpression", - "start": 289, - "end": 308, + "start": 258, + "end": 277, "loc": { "start": { - "line": 12, + "line": 10, "column": 1 }, "end": { - "line": 12, + "line": 10, "column": 20 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 289, - "end": 300, + "start": 258, + "end": 269, "loc": { "start": { - "line": 12, + "line": 10, "column": 1 }, "end": { - "line": 12, + "line": 10, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 289, - "end": 293, + "start": 258, + "end": 262, "loc": { "start": { - "line": 12, + "line": 10, "column": 1 }, "end": { - "line": 12, + "line": 10, "column": 5 } }, @@ -276,15 +189,15 @@ }, "property": { "type": "Identifier", - "start": 294, - "end": 300, + "start": 263, + "end": 269, "loc": { "start": { - "line": 12, + "line": 10, "column": 6 }, "end": { - "line": 12, + "line": 10, "column": 12 }, "identifierName": "_color" @@ -296,15 +209,15 @@ }, "right": { "type": "Identifier", - "start": 303, - "end": 308, + "start": 272, + "end": 277, "loc": { "start": { - "line": 12, + "line": 10, "column": 15 }, "end": { - "line": 12, + "line": 10, "column": 20 }, "identifierName": "color" @@ -317,15 +230,15 @@ { "type": "CommentBlock", "value": "* @member {number} The color of the node. ", - "start": 241, - "end": 287, + "start": 210, + "end": 256, "loc": { "start": { - "line": 11, + "line": 9, "column": 1 }, "end": { - "line": 11, + "line": 9, "column": 47 } } @@ -334,17 +247,17 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "* @member {Node|Leaf} The left child ", - "start": 311, - "end": 352, + "value": "* @member {Node} The left child ", + "start": 280, + "end": 316, "loc": { "start": { - "line": 13, + "line": 11, "column": 1 }, "end": { - "line": 13, - "column": 42 + "line": 11, + "column": 37 } } } @@ -352,58 +265,58 @@ }, { "type": "ExpressionStatement", - "start": 354, - "end": 381, + "start": 318, + "end": 335, "loc": { "start": { - "line": 14, + "line": 12, "column": 1 }, "end": { - "line": 14, - "column": 28 + "line": 12, + "column": 18 } }, "expression": { "type": "AssignmentExpression", - "start": 354, - "end": 380, + "start": 318, + "end": 334, "loc": { "start": { - "line": 14, + "line": 12, "column": 1 }, "end": { - "line": 14, - "column": 27 + "line": 12, + "column": 17 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 354, - "end": 363, + "start": 318, + "end": 327, "loc": { "start": { - "line": 14, + "line": 12, "column": 1 }, "end": { - "line": 14, + "line": 12, "column": 10 } }, "object": { "type": "ThisExpression", - "start": 354, - "end": 358, + "start": 318, + "end": 322, "loc": { "start": { - "line": 14, + "line": 12, "column": 1 }, "end": { - "line": 14, + "line": 12, "column": 5 } }, @@ -411,15 +324,15 @@ }, "property": { "type": "Identifier", - "start": 359, - "end": 363, + "start": 323, + "end": 327, "loc": { "start": { - "line": 14, + "line": 12, "column": 6 }, "end": { - "line": 14, + "line": 12, "column": 10 }, "identifierName": "left" @@ -430,70 +343,36 @@ "leadingComments": null }, "right": { - "type": "NewExpression", - "start": 366, - "end": 380, + "type": "NullLiteral", + "start": 330, + "end": 334, "loc": { "start": { - "line": 14, + "line": 12, "column": 13 }, "end": { - "line": 14, - "column": 27 - } - }, - "callee": { - "type": "Identifier", - "start": 370, - "end": 374, - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 21 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - }, - "arguments": [ - { - "type": "ThisExpression", - "start": 375, - "end": 379, - "loc": { - "start": { - "line": 14, - "column": 22 - }, - "end": { - "line": 14, - "column": 26 - } - } + "line": 12, + "column": 17 } - ] + } }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", - "value": "* @member {Node|Leaf} The left child ", - "start": 311, - "end": 352, + "value": "* @member {Node} The left child ", + "start": 280, + "end": 316, "loc": { "start": { - "line": 13, + "line": 11, "column": 1 }, "end": { - "line": 13, - "column": 42 + "line": 11, + "column": 37 } } } @@ -501,17 +380,17 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "* @member {Node|Leaf} The right child ", - "start": 383, - "end": 425, + "value": "* @member {Node} The right child ", + "start": 337, + "end": 374, "loc": { "start": { - "line": 15, + "line": 13, "column": 1 }, "end": { - "line": 15, - "column": 43 + "line": 13, + "column": 38 } } } @@ -519,58 +398,58 @@ }, { "type": "ExpressionStatement", - "start": 427, - "end": 455, + "start": 376, + "end": 394, "loc": { "start": { - "line": 16, + "line": 14, "column": 1 }, "end": { - "line": 16, - "column": 29 + "line": 14, + "column": 19 } }, "expression": { "type": "AssignmentExpression", - "start": 427, - "end": 454, + "start": 376, + "end": 393, "loc": { "start": { - "line": 16, + "line": 14, "column": 1 }, "end": { - "line": 16, - "column": 28 + "line": 14, + "column": 18 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 427, - "end": 437, + "start": 376, + "end": 386, "loc": { "start": { - "line": 16, + "line": 14, "column": 1 }, "end": { - "line": 16, + "line": 14, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 427, - "end": 431, + "start": 376, + "end": 380, "loc": { "start": { - "line": 16, + "line": 14, "column": 1 }, "end": { - "line": 16, + "line": 14, "column": 5 } }, @@ -578,15 +457,15 @@ }, "property": { "type": "Identifier", - "start": 432, - "end": 437, + "start": 381, + "end": 386, "loc": { "start": { - "line": 16, + "line": 14, "column": 6 }, "end": { - "line": 16, + "line": 14, "column": 11 }, "identifierName": "right" @@ -597,70 +476,36 @@ "leadingComments": null }, "right": { - "type": "NewExpression", - "start": 440, - "end": 454, + "type": "NullLiteral", + "start": 389, + "end": 393, "loc": { "start": { - "line": 16, + "line": 14, "column": 14 }, "end": { - "line": 16, - "column": 28 - } - }, - "callee": { - "type": "Identifier", - "start": 444, - "end": 448, - "loc": { - "start": { - "line": 16, - "column": 18 - }, - "end": { - "line": 16, - "column": 22 - }, - "identifierName": "Leaf" - }, - "name": "Leaf" - }, - "arguments": [ - { - "type": "ThisExpression", - "start": 449, - "end": 453, - "loc": { - "start": { - "line": 16, - "column": 23 - }, - "end": { - "line": 16, - "column": 27 - } - } + "line": 14, + "column": 18 } - ] + } }, "leadingComments": null }, "leadingComments": [ { "type": "CommentBlock", - "value": "* @member {Node|Leaf} The right child ", - "start": 383, - "end": 425, + "value": "* @member {Node} The right child ", + "start": 337, + "end": 374, "loc": { "start": { - "line": 15, + "line": 13, "column": 1 }, "end": { - "line": 15, - "column": 43 + "line": 13, + "column": 38 } } } @@ -669,15 +514,15 @@ { "type": "CommentBlock", "value": "* @member {Node} The parent node. ", - "start": 457, - "end": 495, + "start": 396, + "end": 434, "loc": { "start": { - "line": 17, + "line": 15, "column": 1 }, "end": { - "line": 17, + "line": 15, "column": 39 } } @@ -686,58 +531,58 @@ }, { "type": "ExpressionStatement", - "start": 497, - "end": 516, + "start": 436, + "end": 455, "loc": { "start": { - "line": 18, + "line": 16, "column": 1 }, "end": { - "line": 18, + "line": 16, "column": 20 } }, "expression": { "type": "AssignmentExpression", - "start": 497, - "end": 515, + "start": 436, + "end": 454, "loc": { "start": { - "line": 18, + "line": 16, "column": 1 }, "end": { - "line": 18, + "line": 16, "column": 19 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 497, - "end": 508, + "start": 436, + "end": 447, "loc": { "start": { - "line": 18, + "line": 16, "column": 1 }, "end": { - "line": 18, + "line": 16, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 497, - "end": 501, + "start": 436, + "end": 440, "loc": { "start": { - "line": 18, + "line": 16, "column": 1 }, "end": { - "line": 18, + "line": 16, "column": 5 } }, @@ -745,15 +590,15 @@ }, "property": { "type": "Identifier", - "start": 502, - "end": 508, + "start": 441, + "end": 447, "loc": { "start": { - "line": 18, + "line": 16, "column": 6 }, "end": { - "line": 18, + "line": 16, "column": 12 }, "identifierName": "parent" @@ -765,15 +610,15 @@ }, "right": { "type": "NullLiteral", - "start": 511, - "end": 515, + "start": 450, + "end": 454, "loc": { "start": { - "line": 18, + "line": 16, "column": 15 }, "end": { - "line": 18, + "line": 16, "column": 19 } } @@ -784,15 +629,15 @@ { "type": "CommentBlock", "value": "* @member {Node} The parent node. ", - "start": 457, - "end": 495, + "start": 396, + "end": 434, "loc": { "start": { - "line": 17, + "line": 15, "column": 1 }, "end": { - "line": 17, + "line": 15, "column": 39 } } @@ -802,15 +647,15 @@ { "type": "CommentBlock", "value": "* @member {any} The key held by this node. ", - "start": 518, - "end": 565, + "start": 457, + "end": 504, "loc": { "start": { - "line": 19, + "line": 17, "column": 1 }, "end": { - "line": 19, + "line": 17, "column": 48 } } @@ -819,58 +664,58 @@ }, { "type": "ExpressionStatement", - "start": 567, - "end": 582, + "start": 506, + "end": 521, "loc": { "start": { - "line": 20, + "line": 18, "column": 1 }, "end": { - "line": 20, + "line": 18, "column": 16 } }, "expression": { "type": "AssignmentExpression", - "start": 567, - "end": 581, + "start": 506, + "end": 520, "loc": { "start": { - "line": 20, + "line": 18, "column": 1 }, "end": { - "line": 20, + "line": 18, "column": 15 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 567, - "end": 575, + "start": 506, + "end": 514, "loc": { "start": { - "line": 20, + "line": 18, "column": 1 }, "end": { - "line": 20, + "line": 18, "column": 9 } }, "object": { "type": "ThisExpression", - "start": 567, - "end": 571, + "start": 506, + "end": 510, "loc": { "start": { - "line": 20, + "line": 18, "column": 1 }, "end": { - "line": 20, + "line": 18, "column": 5 } }, @@ -878,15 +723,15 @@ }, "property": { "type": "Identifier", - "start": 572, - "end": 575, + "start": 511, + "end": 514, "loc": { "start": { - "line": 20, + "line": 18, "column": 6 }, "end": { - "line": 20, + "line": 18, "column": 9 }, "identifierName": "key" @@ -898,15 +743,15 @@ }, "right": { "type": "Identifier", - "start": 578, - "end": 581, + "start": 517, + "end": 520, "loc": { "start": { - "line": 20, + "line": 18, "column": 12 }, "end": { - "line": 20, + "line": 18, "column": 15 }, "identifierName": "key" @@ -919,15 +764,15 @@ { "type": "CommentBlock", "value": "* @member {any} The key held by this node. ", - "start": 518, - "end": 565, + "start": 457, + "end": 504, "loc": { "start": { - "line": 19, + "line": 17, "column": 1 }, "end": { - "line": 19, + "line": 17, "column": 48 } } @@ -935,298 +780,41 @@ ] } ], - "directives": [], - "trailingComments": null + "directives": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", - "start": 31, - "end": 196, + "start": 0, + "end": 165, "loc": { "start": { - "line": 3, + "line": 1, "column": 0 }, "end": { - "line": 9, + "line": 7, "column": 3 } } } ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 586, - "end": 733, - "loc": { - "start": { - "line": 23, - "column": 0 - }, - "end": { - "line": 28, - "column": 3 - } - } - } - ] + "trailingComments": [] }, "leadingComments": [ { "type": "CommentBlock", "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", - "start": 31, - "end": 196, - "loc": { - "start": { - "line": 3, - "column": 0 - }, - "end": { - "line": 9, - "column": 3 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 586, - "end": 733, + "start": 0, + "end": 165, "loc": { "start": { - "line": 23, + "line": 1, "column": 0 }, "end": { - "line": 28, - "column": 3 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 734, - "end": 789, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 31, - "column": 2 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 734, - "end": 788, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 31, - "column": 1 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 734, - "end": 755, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 29, - "column": 21 - } - }, - "object": { - "type": "MemberExpression", - "start": 734, - "end": 748, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 29, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 734, - "end": 738, - "loc": { - "start": { - "line": 29, - "column": 0 - }, - "end": { - "line": 29, - "column": 4 - }, - "identifierName": "Node" - }, - "name": "Node", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 739, - "end": 748, - "loc": { - "start": { - "line": 29, - "column": 5 - }, - "end": { - "line": 29, - "column": 14 - }, - "identifierName": "prototype" - }, - "name": "prototype" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 749, - "end": 755, - "loc": { - "start": { - "line": 29, - "column": 15 - }, - "end": { - "line": 29, - "column": 21 - }, - "identifierName": "isLeaf" - }, - "name": "isLeaf" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "FunctionExpression", - "start": 758, - "end": 788, - "loc": { - "start": { - "line": 29, - "column": 24 - }, - "end": { - "line": 31, - "column": 1 - } - }, - "id": { - "type": "Identifier", - "start": 749, - "end": 755, - "loc": { - "start": { - "line": 29, - "column": 15 - }, - "end": { - "line": 29, - "column": 21 - }, - "identifierName": "isLeaf" - }, - "name": "isLeaf" - }, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 770, - "end": 788, - "loc": { - "start": { - "line": 29, - "column": 36 - }, - "end": { - "line": 31, - "column": 1 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 773, - "end": 786, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 14 - } - }, - "argument": { - "type": "BooleanLiteral", - "start": 780, - "end": 785, - "loc": { - "start": { - "line": 30, - "column": 8 - }, - "end": { - "line": 30, - "column": 13 - } - }, - "value": false - } - } - ], - "directives": [] - } - }, - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 586, - "end": 733, - "loc": { - "start": { - "line": 23, - "column": 0 - }, - "end": { - "line": 28, + "line": 7, "column": 3 } } @@ -1240,15 +828,15 @@ { "type": "CommentBlock", "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", - "start": 31, - "end": 196, + "start": 0, + "end": 165, "loc": { "start": { - "line": 3, + "line": 1, "column": 0 }, "end": { - "line": 9, + "line": 7, "column": 3 } } @@ -1256,63 +844,63 @@ { "type": "CommentBlock", "value": "* @member {number} The color of the node. ", - "start": 241, - "end": 287, + "start": 210, + "end": 256, "loc": { "start": { - "line": 11, + "line": 9, "column": 1 }, "end": { - "line": 11, + "line": 9, "column": 47 } } }, { "type": "CommentBlock", - "value": "* @member {Node|Leaf} The left child ", - "start": 311, - "end": 352, + "value": "* @member {Node} The left child ", + "start": 280, + "end": 316, "loc": { "start": { - "line": 13, + "line": 11, "column": 1 }, "end": { - "line": 13, - "column": 42 + "line": 11, + "column": 37 } } }, { "type": "CommentBlock", - "value": "* @member {Node|Leaf} The right child ", - "start": 383, - "end": 425, + "value": "* @member {Node} The right child ", + "start": 337, + "end": 374, "loc": { "start": { - "line": 15, + "line": 13, "column": 1 }, "end": { - "line": 15, - "column": 43 + "line": 13, + "column": 38 } } }, { "type": "CommentBlock", "value": "* @member {Node} The parent node. ", - "start": 457, - "end": 495, + "start": 396, + "end": 434, "loc": { "start": { - "line": 17, + "line": 15, "column": 1 }, "end": { - "line": 17, + "line": 15, "column": 39 } } @@ -1320,122 +908,43 @@ { "type": "CommentBlock", "value": "* @member {any} The key held by this node. ", - "start": 518, - "end": 565, + "start": 457, + "end": 504, "loc": { "start": { - "line": 19, + "line": 17, "column": 1 }, "end": { - "line": 19, + "line": 17, "column": 48 } } - }, - { - "type": "CommentBlock", - "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 586, - "end": 733, - "loc": { - "start": { - "line": 23, - "column": 0 - }, - "end": { - "line": 28, - "column": 3 - } - } } ], "tokens": [ { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", + "type": "CommentBlock", + "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", "start": 0, - "end": 6, + "end": 165, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 7, - "end": 11, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 12, - "end": 16, - "loc": { - "start": { - "line": 1, - "column": 12 - }, - "end": { - "line": 1, - "column": 16 + "line": 7, + "column": 3 } } }, { "type": { - "label": "string", + "label": "export", + "keyword": "export", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -1444,23 +953,24 @@ "binop": null, "updateContext": null }, - "value": "./Leaf.js", - "start": 17, - "end": 28, + "value": "export", + "start": 166, + "end": 172, "loc": { "start": { - "line": 1, - "column": 17 + "line": 8, + "column": 0 }, "end": { - "line": 1, - "column": 28 + "line": 8, + "column": 6 } } }, { "type": { - "label": ";", + "label": "default", + "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -1471,653 +981,51 @@ "binop": null, "updateContext": null }, - "start": 28, - "end": 29, - "loc": { - "start": { - "line": 1, - "column": 28 - }, - "end": { - "line": 1, - "column": 29 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n ", - "start": 31, - "end": 196, + "value": "default", + "start": 173, + "end": 180, "loc": { "start": { - "line": 3, - "column": 0 + "line": 8, + "column": 7 }, "end": { - "line": 9, - "column": 3 + "line": 8, + "column": 14 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "function", + "keyword": "function", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 197, - "end": 203, + "value": "function", + "start": 181, + "end": 189, "loc": { "start": { - "line": 10, - "column": 0 + "line": 8, + "column": 15 }, "end": { - "line": 10, - "column": 6 - } - } - }, - { - "type": { - "label": "default", - "keyword": "default", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "default", - "start": 204, - "end": 211, - "loc": { - "start": { - "line": 10, - "column": 7 - }, - "end": { - "line": 10, - "column": 14 - } - } - }, - { - "type": { - "label": "function", - "keyword": "function", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "function", - "start": 212, - "end": 220, - "loc": { - "start": { - "line": 10, - "column": 15 - }, - "end": { - "line": 10, - "column": 23 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 221, - "end": 225, - "loc": { - "start": { - "line": 10, - "column": 24 - }, - "end": { - "line": 10, - "column": 28 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 225, - "end": 226, - "loc": { - "start": { - "line": 10, - "column": 28 - }, - "end": { - "line": 10, - "column": 29 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "color", - "start": 226, - "end": 231, - "loc": { - "start": { - "line": 10, - "column": 29 - }, - "end": { - "line": 10, - "column": 34 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 231, - "end": 232, - "loc": { - "start": { - "line": 10, - "column": 34 - }, - "end": { - "line": 10, - "column": 35 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "key", - "start": 233, - "end": 236, - "loc": { - "start": { - "line": 10, - "column": 36 - }, - "end": { - "line": 10, - "column": 39 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 236, - "end": 237, - "loc": { - "start": { - "line": 10, - "column": 39 - }, - "end": { - "line": 10, - "column": 40 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 238, - "end": 239, - "loc": { - "start": { - "line": 10, - "column": 41 - }, - "end": { - "line": 10, - "column": 42 - } - } - }, - { - "type": "CommentBlock", - "value": "* @member {number} The color of the node. ", - "start": 241, - "end": 287, - "loc": { - "start": { - "line": 11, - "column": 1 - }, - "end": { - "line": 11, - "column": 47 - } - } - }, - { - "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "this", - "start": 289, - "end": 293, - "loc": { - "start": { - "line": 12, - "column": 1 - }, - "end": { - "line": 12, - "column": 5 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 293, - "end": 294, - "loc": { - "start": { - "line": 12, - "column": 5 - }, - "end": { - "line": 12, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "_color", - "start": 294, - "end": 300, - "loc": { - "start": { - "line": 12, - "column": 6 - }, - "end": { - "line": 12, - "column": 12 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 301, - "end": 302, - "loc": { - "start": { - "line": 12, - "column": 13 - }, - "end": { - "line": 12, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "color", - "start": 303, - "end": 308, - "loc": { - "start": { - "line": 12, - "column": 15 - }, - "end": { - "line": 12, - "column": 20 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 308, - "end": 309, - "loc": { - "start": { - "line": 12, - "column": 20 - }, - "end": { - "line": 12, - "column": 21 - } - } - }, - { - "type": "CommentBlock", - "value": "* @member {Node|Leaf} The left child ", - "start": 311, - "end": 352, - "loc": { - "start": { - "line": 13, - "column": 1 - }, - "end": { - "line": 13, - "column": 42 - } - } - }, - { - "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "this", - "start": 354, - "end": 358, - "loc": { - "start": { - "line": 14, - "column": 1 - }, - "end": { - "line": 14, - "column": 5 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 358, - "end": 359, - "loc": { - "start": { - "line": 14, - "column": 5 - }, - "end": { - "line": 14, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 359, - "end": 363, - "loc": { - "start": { - "line": 14, - "column": 6 - }, - "end": { - "line": 14, - "column": 10 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 364, - "end": 365, - "loc": { - "start": { - "line": 14, - "column": 11 - }, - "end": { - "line": 14, - "column": 12 - } - } - }, - { - "type": { - "label": "new", - "keyword": "new", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "new", - "start": 366, - "end": 369, - "loc": { - "start": { - "line": 14, - "column": 13 - }, - "end": { - "line": 14, - "column": 16 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Leaf", - "start": 370, - "end": 374, - "loc": { - "start": { - "line": 14, - "column": 17 - }, - "end": { - "line": 14, - "column": 21 + "line": 8, + "column": 23 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2126,52 +1034,50 @@ "postfix": false, "binop": null }, - "start": 374, - "end": 375, + "value": "Node", + "start": 190, + "end": 194, "loc": { "start": { - "line": 14, - "column": 21 + "line": 8, + "column": 24 }, "end": { - "line": 14, - "column": 22 + "line": 8, + "column": 28 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 375, - "end": 379, + "start": 194, + "end": 195, "loc": { "start": { - "line": 14, - "column": 22 + "line": 8, + "column": 28 }, "end": { - "line": 14, - "column": 26 + "line": 8, + "column": 29 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2179,22 +1085,23 @@ "postfix": false, "binop": null }, - "start": 379, - "end": 380, + "value": "color", + "start": 195, + "end": 200, "loc": { "start": { - "line": 14, - "column": 26 + "line": 8, + "column": 29 }, "end": { - "line": 14, - "column": 27 + "line": 8, + "column": 34 } } }, { "type": { - "label": ";", + "label": ",", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -2205,39 +1112,22 @@ "binop": null, "updateContext": null }, - "start": 380, - "end": 381, - "loc": { - "start": { - "line": 14, - "column": 27 - }, - "end": { - "line": 14, - "column": 28 - } - } - }, - { - "type": "CommentBlock", - "value": "* @member {Node|Leaf} The right child ", - "start": 383, - "end": 425, + "start": 200, + "end": 201, "loc": { "start": { - "line": 15, - "column": 1 + "line": 8, + "column": 34 }, "end": { - "line": 15, - "column": 43 + "line": 8, + "column": 35 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2245,26 +1135,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 427, - "end": 431, + "value": "key", + "start": 202, + "end": 205, "loc": { "start": { - "line": 16, - "column": 1 + "line": 8, + "column": 36 }, "end": { - "line": 16, - "column": 5 + "line": 8, + "column": 39 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -2272,26 +1161,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 431, - "end": 432, + "start": 205, + "end": 206, "loc": { "start": { - "line": 16, - "column": 5 + "line": 8, + "column": 39 }, "end": { - "line": 16, - "column": 6 + "line": 8, + "column": 40 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2300,52 +1188,40 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 432, - "end": 437, + "start": 207, + "end": 208, "loc": { "start": { - "line": 16, - "column": 6 + "line": 8, + "column": 41 }, "end": { - "line": 16, - "column": 11 + "line": 8, + "column": 42 } } }, { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 438, - "end": 439, + "type": "CommentBlock", + "value": "* @member {number} The color of the node. ", + "start": 210, + "end": 256, "loc": { "start": { - "line": 16, - "column": 12 + "line": 9, + "column": 1 }, "end": { - "line": 16, - "column": 13 + "line": 9, + "column": 47 } } }, { "type": { - "label": "new", - "keyword": "new", - "beforeExpr": true, + "label": "this", + "keyword": "this", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2355,50 +1231,50 @@ "binop": null, "updateContext": null }, - "value": "new", - "start": 440, - "end": 443, + "value": "this", + "start": 258, + "end": 262, "loc": { "start": { - "line": 16, - "column": 14 + "line": 10, + "column": 1 }, "end": { - "line": 16, - "column": 17 + "line": 10, + "column": 5 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Leaf", - "start": 444, - "end": 448, + "start": 262, + "end": 263, "loc": { "start": { - "line": 16, - "column": 18 + "line": 10, + "column": 5 }, "end": { - "line": 16, - "column": 22 + "line": 10, + "column": 6 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2407,52 +1283,52 @@ "postfix": false, "binop": null }, - "start": 448, - "end": 449, + "value": "_color", + "start": 263, + "end": 269, "loc": { "start": { - "line": 16, - "column": 22 + "line": 10, + "column": 6 }, "end": { - "line": 16, - "column": 23 + "line": 10, + "column": 12 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "this", - "start": 449, - "end": 453, + "value": "=", + "start": 270, + "end": 271, "loc": { "start": { - "line": 16, - "column": 23 + "line": 10, + "column": 13 }, "end": { - "line": 16, - "column": 27 + "line": 10, + "column": 14 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -2460,16 +1336,17 @@ "postfix": false, "binop": null }, - "start": 453, - "end": 454, + "value": "color", + "start": 272, + "end": 277, "loc": { "start": { - "line": 16, - "column": 27 + "line": 10, + "column": 15 }, "end": { - "line": 16, - "column": 28 + "line": 10, + "column": 20 } } }, @@ -2486,32 +1363,32 @@ "binop": null, "updateContext": null }, - "start": 454, - "end": 455, + "start": 277, + "end": 278, "loc": { "start": { - "line": 16, - "column": 28 + "line": 10, + "column": 20 }, "end": { - "line": 16, - "column": 29 + "line": 10, + "column": 21 } } }, { "type": "CommentBlock", - "value": "* @member {Node} The parent node. ", - "start": 457, - "end": 495, + "value": "* @member {Node} The left child ", + "start": 280, + "end": 316, "loc": { "start": { - "line": 17, + "line": 11, "column": 1 }, "end": { - "line": 17, - "column": 39 + "line": 11, + "column": 37 } } }, @@ -2530,15 +1407,15 @@ "updateContext": null }, "value": "this", - "start": 497, - "end": 501, + "start": 318, + "end": 322, "loc": { "start": { - "line": 18, + "line": 12, "column": 1 }, "end": { - "line": 18, + "line": 12, "column": 5 } } @@ -2556,15 +1433,15 @@ "binop": null, "updateContext": null }, - "start": 501, - "end": 502, + "start": 322, + "end": 323, "loc": { "start": { - "line": 18, + "line": 12, "column": 5 }, "end": { - "line": 18, + "line": 12, "column": 6 } } @@ -2581,17 +1458,17 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 502, - "end": 508, + "value": "left", + "start": 323, + "end": 327, "loc": { "start": { - "line": 18, + "line": 12, "column": 6 }, "end": { - "line": 18, - "column": 12 + "line": 12, + "column": 10 } } }, @@ -2609,16 +1486,16 @@ "updateContext": null }, "value": "=", - "start": 509, - "end": 510, + "start": 328, + "end": 329, "loc": { "start": { - "line": 18, - "column": 13 + "line": 12, + "column": 11 }, "end": { - "line": 18, - "column": 14 + "line": 12, + "column": 12 } } }, @@ -2637,16 +1514,16 @@ "updateContext": null }, "value": "null", - "start": 511, - "end": 515, + "start": 330, + "end": 334, "loc": { "start": { - "line": 18, - "column": 15 + "line": 12, + "column": 13 }, "end": { - "line": 18, - "column": 19 + "line": 12, + "column": 17 } } }, @@ -2663,32 +1540,32 @@ "binop": null, "updateContext": null }, - "start": 515, - "end": 516, + "start": 334, + "end": 335, "loc": { "start": { - "line": 18, - "column": 19 + "line": 12, + "column": 17 }, "end": { - "line": 18, - "column": 20 + "line": 12, + "column": 18 } } }, { "type": "CommentBlock", - "value": "* @member {any} The key held by this node. ", - "start": 518, - "end": 565, + "value": "* @member {Node} The right child ", + "start": 337, + "end": 374, "loc": { "start": { - "line": 19, + "line": 13, "column": 1 }, "end": { - "line": 19, - "column": 48 + "line": 13, + "column": 38 } } }, @@ -2707,15 +1584,15 @@ "updateContext": null }, "value": "this", - "start": 567, - "end": 571, + "start": 376, + "end": 380, "loc": { "start": { - "line": 20, + "line": 14, "column": 1 }, "end": { - "line": 20, + "line": 14, "column": 5 } } @@ -2733,15 +1610,15 @@ "binop": null, "updateContext": null }, - "start": 571, - "end": 572, + "start": 380, + "end": 381, "loc": { "start": { - "line": 20, + "line": 14, "column": 5 }, "end": { - "line": 20, + "line": 14, "column": 6 } } @@ -2758,17 +1635,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 572, - "end": 575, + "value": "right", + "start": 381, + "end": 386, "loc": { "start": { - "line": 20, + "line": 14, "column": 6 }, "end": { - "line": 20, - "column": 9 + "line": 14, + "column": 11 } } }, @@ -2786,22 +1663,23 @@ "updateContext": null }, "value": "=", - "start": 576, - "end": 577, + "start": 387, + "end": 388, "loc": { "start": { - "line": 20, - "column": 10 + "line": 14, + "column": 12 }, "end": { - "line": 20, - "column": 11 + "line": 14, + "column": 13 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2809,19 +1687,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "key", - "start": 578, - "end": 581, + "value": "null", + "start": 389, + "end": 393, "loc": { "start": { - "line": 20, - "column": 12 + "line": 14, + "column": 14 }, "end": { - "line": 20, - "column": 15 + "line": 14, + "column": 18 } } }, @@ -2838,63 +1717,39 @@ "binop": null, "updateContext": null }, - "start": 581, - "end": 582, - "loc": { - "start": { - "line": 20, - "column": 15 - }, - "end": { - "line": 20, - "column": 16 - } - } - }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 583, - "end": 584, + "start": 393, + "end": 394, "loc": { "start": { - "line": 21, - "column": 0 + "line": 14, + "column": 18 }, "end": { - "line": 21, - "column": 1 + "line": 14, + "column": 19 } } }, { "type": "CommentBlock", - "value": "*\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n ", - "start": 586, - "end": 733, + "value": "* @member {Node} The parent node. ", + "start": 396, + "end": 434, "loc": { "start": { - "line": 23, - "column": 0 + "line": 15, + "column": 1 }, "end": { - "line": 28, - "column": 3 + "line": 15, + "column": 39 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -2902,19 +1757,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Node", - "start": 734, - "end": 738, + "value": "this", + "start": 436, + "end": 440, "loc": { "start": { - "line": 29, - "column": 0 + "line": 16, + "column": 1 }, "end": { - "line": 29, - "column": 4 + "line": 16, + "column": 5 } } }, @@ -2931,16 +1787,16 @@ "binop": null, "updateContext": null }, - "start": 738, - "end": 739, + "start": 440, + "end": 441, "loc": { "start": { - "line": 29, - "column": 4 + "line": 16, + "column": 5 }, "end": { - "line": 29, - "column": 5 + "line": 16, + "column": 6 } } }, @@ -2956,49 +1812,51 @@ "postfix": false, "binop": null }, - "value": "prototype", - "start": 739, - "end": 748, + "value": "parent", + "start": 441, + "end": 447, "loc": { "start": { - "line": 29, - "column": 5 + "line": 16, + "column": 6 }, "end": { - "line": 29, - "column": 14 + "line": 16, + "column": 12 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 748, - "end": 749, + "value": "=", + "start": 448, + "end": 449, "loc": { "start": { - "line": 29, - "column": 14 + "line": 16, + "column": 13 }, "end": { - "line": 29, - "column": 15 + "line": 16, + "column": 14 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3006,104 +1864,96 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "isLeaf", - "start": 749, - "end": 755, + "value": "null", + "start": 450, + "end": 454, "loc": { "start": { - "line": 29, + "line": 16, "column": 15 }, "end": { - "line": 29, - "column": 21 + "line": 16, + "column": 19 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 756, - "end": 757, + "start": 454, + "end": 455, "loc": { "start": { - "line": 29, - "column": 22 + "line": 16, + "column": 19 }, "end": { - "line": 29, - "column": 23 + "line": 16, + "column": 20 } } }, { - "type": { - "label": "function", - "keyword": "function", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "function", - "start": 758, - "end": 766, + "type": "CommentBlock", + "value": "* @member {any} The key held by this node. ", + "start": 457, + "end": 504, "loc": { "start": { - "line": 29, - "column": 24 + "line": 17, + "column": 1 }, "end": { - "line": 29, - "column": 32 + "line": 17, + "column": 48 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "this", + "keyword": "this", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 767, - "end": 768, + "value": "this", + "start": 506, + "end": 510, "loc": { "start": { - "line": 29, - "column": 33 + "line": 18, + "column": 1 }, "end": { - "line": 29, - "column": 34 + "line": 18, + "column": 5 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -3111,25 +1961,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 768, - "end": 769, + "start": 510, + "end": 511, "loc": { "start": { - "line": 29, - "column": 34 + "line": 18, + "column": 5 }, "end": { - "line": 29, - "column": 35 + "line": 18, + "column": 6 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -3138,51 +1989,50 @@ "postfix": false, "binop": null }, - "start": 770, - "end": 771, + "value": "key", + "start": 511, + "end": 514, "loc": { "start": { - "line": 29, - "column": 36 + "line": 18, + "column": 6 }, "end": { - "line": 29, - "column": 37 + "line": 18, + "column": 9 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "return", - "start": 773, - "end": 779, + "value": "=", + "start": 515, + "end": 516, "loc": { "start": { - "line": 30, - "column": 1 + "line": 18, + "column": 10 }, "end": { - "line": 30, - "column": 7 + "line": 18, + "column": 11 } } }, { "type": { - "label": "false", - "keyword": "false", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3190,20 +2040,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "false", - "start": 780, - "end": 785, + "value": "key", + "start": 517, + "end": 520, "loc": { "start": { - "line": 30, - "column": 8 + "line": 18, + "column": 12 }, "end": { - "line": 30, - "column": 13 + "line": 18, + "column": 15 } } }, @@ -3220,16 +2069,16 @@ "binop": null, "updateContext": null }, - "start": 785, - "end": 786, + "start": 520, + "end": 521, "loc": { "start": { - "line": 30, - "column": 13 + "line": 18, + "column": 15 }, "end": { - "line": 30, - "column": 14 + "line": 18, + "column": 16 } } }, @@ -3245,42 +2094,16 @@ "postfix": false, "binop": null }, - "start": 787, - "end": 788, + "start": 522, + "end": 523, "loc": { "start": { - "line": 31, + "line": 19, "column": 0 }, "end": { - "line": 31, - "column": 1 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 788, - "end": 789, - "loc": { - "start": { - "line": 31, + "line": 19, "column": 1 - }, - "end": { - "line": 31, - "column": 2 } } }, @@ -3297,15 +2120,15 @@ "binop": null, "updateContext": null }, - "start": 790, - "end": 790, + "start": 524, + "end": 524, "loc": { "start": { - "line": 32, + "line": 20, "column": 0 }, "end": { - "line": 32, + "line": 20, "column": 0 } } diff --git a/ast/source/types/RedBlackTree.js.json b/ast/source/types/RedBlackTree.js.json index 716727b..dc2224d 100644 --- a/ast/source/types/RedBlackTree.js.json +++ b/ast/source/types/RedBlackTree.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 4957, + "end": 5065, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 193, + "line": 197, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 4957, + "end": 5065, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 193, + "line": 197, "column": 0 } }, @@ -484,9 +484,9 @@ "line": 7, "column": 19 }, - "identifierName": "insert_case2" + "identifierName": "insert_case1" }, - "name": "insert_case2" + "name": "insert_case1" } } ], @@ -505,10 +505,10 @@ } }, "extra": { - "rawValue": "../insertion/insert_case2.js", - "raw": "'../insertion/insert_case2.js'" + "rawValue": "../insertion/insert_case1.js", + "raw": "'../insertion/insert_case1.js'" }, - "value": "../insertion/insert_case2.js" + "value": "../insertion/insert_case1.js" } }, { @@ -583,7 +583,7 @@ { "type": "ImportDeclaration", "start": 351, - "end": 392, + "end": 412, "loc": { "start": { "line": 9, @@ -591,14 +591,14 @@ }, "end": { "line": 9, - "column": 41 + "column": 61 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 358, - "end": 364, + "end": 373, "loc": { "start": { "line": 9, @@ -606,13 +606,13 @@ }, "end": { "line": 9, - "column": 13 + "column": 22 } }, "local": { "type": "Identifier", "start": 358, - "end": 364, + "end": 373, "loc": { "start": { "line": 9, @@ -620,6 +620,75 @@ }, "end": { "line": 9, + "column": 22 + }, + "identifierName": "delete_no_child" + }, + "name": "delete_no_child" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 379, + "end": 411, + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 60 + } + }, + "extra": { + "rawValue": "../deletion/delete_no_child.js", + "raw": "'../deletion/delete_no_child.js'" + }, + "value": "../deletion/delete_no_child.js" + } + }, + { + "type": "ImportDeclaration", + "start": 413, + "end": 454, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 41 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, "column": 13 }, "identifierName": "search" @@ -630,15 +699,15 @@ ], "source": { "type": "StringLiteral", - "start": 370, - "end": 391, + "start": 432, + "end": 453, "loc": { "start": { - "line": 9, + "line": 10, "column": 19 }, "end": { - "line": 9, + "line": 10, "column": 40 } }, @@ -651,44 +720,44 @@ }, { "type": "ImportDeclaration", - "start": 393, - "end": 457, + "start": 455, + "end": 519, "loc": { "start": { - "line": 10, + "line": 11, "column": 0 }, "end": { - "line": 10, + "line": 11, "column": 64 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 400, - "end": 416, + "start": 462, + "end": 478, "loc": { "start": { - "line": 10, + "line": 11, "column": 7 }, "end": { - "line": 10, + "line": 11, "column": 23 } }, "local": { "type": "Identifier", - "start": 400, - "end": 416, + "start": 462, + "end": 478, "loc": { "start": { - "line": 10, + "line": 11, "column": 7 }, "end": { - "line": 10, + "line": 11, "column": 23 }, "identifierName": "inordertraversal" @@ -699,15 +768,15 @@ ], "source": { "type": "StringLiteral", - "start": 422, - "end": 456, + "start": 484, + "end": 518, "loc": { "start": { - "line": 10, + "line": 11, "column": 29 }, "end": { - "line": 10, + "line": 11, "column": 63 } }, @@ -720,44 +789,44 @@ }, { "type": "ImportDeclaration", - "start": 458, - "end": 518, + "start": 520, + "end": 580, "loc": { "start": { - "line": 11, + "line": 12, "column": 0 }, "end": { - "line": 11, + "line": 12, "column": 60 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 465, - "end": 479, + "start": 527, + "end": 541, "loc": { "start": { - "line": 11, + "line": 12, "column": 7 }, "end": { - "line": 11, + "line": 12, "column": 21 } }, "local": { "type": "Identifier", - "start": 465, - "end": 479, + "start": 527, + "end": 541, "loc": { "start": { - "line": 11, + "line": 12, "column": 7 }, "end": { - "line": 11, + "line": 12, "column": 21 }, "identifierName": "rangetraversal" @@ -768,15 +837,15 @@ ], "source": { "type": "StringLiteral", - "start": 485, - "end": 517, + "start": 547, + "end": 579, "loc": { "start": { - "line": 11, + "line": 12, "column": 27 }, "end": { - "line": 11, + "line": 12, "column": 59 } }, @@ -790,15 +859,15 @@ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 520, - "end": 569, + "start": 582, + "end": 631, "loc": { "start": { - "line": 13, + "line": 14, "column": 0 }, "end": { - "line": 16, + "line": 17, "column": 3 } } @@ -807,43 +876,43 @@ }, { "type": "ExportDefaultDeclaration", - "start": 570, - "end": 4956, + "start": 632, + "end": 5064, "loc": { "start": { - "line": 17, + "line": 18, "column": 0 }, "end": { - "line": 192, + "line": 196, "column": 1 } }, "declaration": { "type": "ClassDeclaration", - "start": 585, - "end": 4956, + "start": 647, + "end": 5064, "loc": { "start": { - "line": 17, + "line": 18, "column": 15 }, "end": { - "line": 192, + "line": 196, "column": 1 } }, "id": { "type": "Identifier", - "start": 591, - "end": 603, + "start": 653, + "end": 665, "loc": { "start": { - "line": 17, + "line": 18, "column": 21 }, "end": { - "line": 17, + "line": 18, "column": 33 }, "identifierName": "RedBlackTree" @@ -854,30 +923,30 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 604, - "end": 4956, + "start": 666, + "end": 5064, "loc": { "start": { - "line": 17, + "line": 18, "column": 34 }, "end": { - "line": 192, + "line": 196, "column": 1 } }, "body": [ { "type": "ClassMethod", - "start": 735, - "end": 919, + "start": 797, + "end": 1020, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 2 } }, @@ -885,15 +954,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 735, - "end": 746, + "start": 797, + "end": 808, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 12 }, "identifierName": "constructor" @@ -909,15 +978,15 @@ "params": [ { "type": "Identifier", - "start": 747, - "end": 754, + "start": 809, + "end": 816, "loc": { "start": { - "line": 23, + "line": 24, "column": 13 }, "end": { - "line": 23, + "line": 24, "column": 20 }, "identifierName": "compare" @@ -927,23 +996,23 @@ ], "body": { "type": "BlockStatement", - "start": 756, - "end": 919, + "start": 818, + "end": 1020, "loc": { "start": { - "line": 23, + "line": 24, "column": 22 }, "end": { - "line": 28, + "line": 30, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 827, - "end": 850, + "start": 822, + "end": 858, "loc": { "start": { "line": 25, @@ -951,13 +1020,13 @@ }, "end": { "line": 25, - "column": 25 + "column": 38 } }, "expression": { - "type": "AssignmentExpression", - "start": 827, - "end": 849, + "type": "CallExpression", + "start": 822, + "end": 857, "loc": { "start": { "line": 25, @@ -965,35 +1034,152 @@ }, "end": { "line": 25, + "column": 37 + } + }, + "callee": { + "type": "Identifier", + "start": 822, + "end": 828, + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 829, + "end": 856, + "loc": { + "start": { + "line": 25, + "column": 9 + }, + "end": { + "line": 25, + "column": 36 + } + }, + "left": { + "type": "Identifier", + "start": 829, + "end": 836, + "loc": { + "start": { + "line": 25, + "column": 9 + }, + "end": { + "line": 25, + "column": 16 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 848, + "end": 856, + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 36 + }, + "identifierName": "Function" + }, + "name": "Function" + } + } + ] + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "* @member {Function} The comparison function for node keys. ", + "start": 861, + "end": 925, + "loc": { + "start": { + "line": 26, + "column": 2 + }, + "end": { + "line": 26, + "column": 66 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 928, + "end": 951, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 928, + "end": 950, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 27, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 827, - "end": 839, + "start": 928, + "end": 940, "loc": { "start": { - "line": 25, + "line": 27, "column": 2 }, "end": { - "line": 25, + "line": 27, "column": 14 } }, "object": { "type": "ThisExpression", - "start": 827, - "end": 831, + "start": 928, + "end": 932, "loc": { "start": { - "line": 25, + "line": 27, "column": 2 }, "end": { - "line": 25, + "line": 27, "column": 6 } }, @@ -1001,15 +1187,15 @@ }, "property": { "type": "Identifier", - "start": 832, - "end": 839, + "start": 933, + "end": 940, "loc": { "start": { - "line": 25, + "line": 27, "column": 7 }, "end": { - "line": 25, + "line": 27, "column": 14 }, "identifierName": "compare" @@ -1021,15 +1207,15 @@ }, "right": { "type": "Identifier", - "start": 842, - "end": 849, + "start": 943, + "end": 950, "loc": { "start": { - "line": 25, + "line": 27, "column": 17 }, "end": { - "line": 25, + "line": 27, "column": 24 }, "identifierName": "compare" @@ -1042,15 +1228,15 @@ { "type": "CommentBlock", "value": "* @member {Function} The comparison function for node keys. ", - "start": 760, - "end": 824, + "start": 861, + "end": 925, "loc": { "start": { - "line": 24, + "line": 26, "column": 2 }, "end": { - "line": 24, + "line": 26, "column": 66 } } @@ -1060,15 +1246,15 @@ { "type": "CommentBlock", "value": "* @member {Node} The root of the tree. ", - "start": 853, - "end": 896, + "start": 954, + "end": 997, "loc": { "start": { - "line": 26, + "line": 28, "column": 2 }, "end": { - "line": 26, + "line": 28, "column": 45 } } @@ -1077,58 +1263,58 @@ }, { "type": "ExpressionStatement", - "start": 899, - "end": 916, + "start": 1000, + "end": 1017, "loc": { "start": { - "line": 27, + "line": 29, "column": 2 }, "end": { - "line": 27, + "line": 29, "column": 19 } }, "expression": { "type": "AssignmentExpression", - "start": 899, - "end": 915, + "start": 1000, + "end": 1016, "loc": { "start": { - "line": 27, + "line": 29, "column": 2 }, "end": { - "line": 27, + "line": 29, "column": 18 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 899, - "end": 908, + "start": 1000, + "end": 1009, "loc": { "start": { - "line": 27, + "line": 29, "column": 2 }, "end": { - "line": 27, + "line": 29, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 899, - "end": 903, + "start": 1000, + "end": 1004, "loc": { "start": { - "line": 27, + "line": 29, "column": 2 }, "end": { - "line": 27, + "line": 29, "column": 6 } }, @@ -1136,15 +1322,15 @@ }, "property": { "type": "Identifier", - "start": 904, - "end": 908, + "start": 1005, + "end": 1009, "loc": { "start": { - "line": 27, + "line": 29, "column": 7 }, "end": { - "line": 27, + "line": 29, "column": 11 }, "identifierName": "root" @@ -1156,15 +1342,15 @@ }, "right": { "type": "NullLiteral", - "start": 911, - "end": 915, + "start": 1012, + "end": 1016, "loc": { "start": { - "line": 27, + "line": 29, "column": 14 }, "end": { - "line": 27, + "line": 29, "column": 18 } } @@ -1175,15 +1361,15 @@ { "type": "CommentBlock", "value": "* @member {Node} The root of the tree. ", - "start": 853, - "end": 896, + "start": 954, + "end": 997, "loc": { "start": { - "line": 26, + "line": 28, "column": 2 }, "end": { - "line": 26, + "line": 28, "column": 45 } } @@ -1198,15 +1384,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", - "start": 607, - "end": 733, + "start": 669, + "end": 795, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 4 } } @@ -1216,15 +1402,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 922, - "end": 1026, + "start": 1023, + "end": 1127, "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 4 } } @@ -1233,15 +1419,15 @@ }, { "type": "ClassMethod", - "start": 1028, - "end": 1071, + "start": 1129, + "end": 1172, "loc": { "start": { - "line": 35, + "line": 37, "column": 1 }, "end": { - "line": 37, + "line": 39, "column": 2 } }, @@ -1249,15 +1435,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1028, - "end": 1035, + "start": 1129, + "end": 1136, "loc": { "start": { - "line": 35, + "line": 37, "column": 1 }, "end": { - "line": 35, + "line": 37, "column": 8 }, "identifierName": "isEmpty" @@ -1273,87 +1459,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 1038, - "end": 1071, + "start": 1139, + "end": 1172, "loc": { "start": { - "line": 35, + "line": 37, "column": 11 }, "end": { - "line": 37, + "line": 39, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 1042, - "end": 1068, + "start": 1143, + "end": 1169, "loc": { "start": { - "line": 36, + "line": 38, "column": 2 }, "end": { - "line": 36, + "line": 38, "column": 28 } }, "argument": { "type": "BinaryExpression", - "start": 1049, - "end": 1067, + "start": 1150, + "end": 1168, "loc": { "start": { - "line": 36, + "line": 38, "column": 9 }, "end": { - "line": 36, + "line": 38, "column": 27 } }, "left": { "type": "MemberExpression", - "start": 1049, - "end": 1058, + "start": 1150, + "end": 1159, "loc": { "start": { - "line": 36, + "line": 38, "column": 9 }, "end": { - "line": 36, + "line": 38, "column": 18 } }, "object": { "type": "ThisExpression", - "start": 1049, - "end": 1053, + "start": 1150, + "end": 1154, "loc": { "start": { - "line": 36, + "line": 38, "column": 9 }, "end": { - "line": 36, + "line": 38, "column": 13 } } }, "property": { "type": "Identifier", - "start": 1054, - "end": 1058, + "start": 1155, + "end": 1159, "loc": { "start": { - "line": 36, + "line": 38, "column": 14 }, "end": { - "line": 36, + "line": 38, "column": 18 }, "identifierName": "root" @@ -1365,15 +1551,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1063, - "end": 1067, + "start": 1164, + "end": 1168, "loc": { "start": { - "line": 36, + "line": 38, "column": 23 }, "end": { - "line": 36, + "line": 38, "column": 27 } } @@ -1388,15 +1574,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 922, - "end": 1026, + "start": 1023, + "end": 1127, "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 4 } } @@ -1406,15 +1592,15 @@ { "type": "CommentBlock", "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", - "start": 1074, - "end": 1153, + "start": 1175, + "end": 1254, "loc": { "start": { - "line": 39, + "line": 41, "column": 1 }, "end": { - "line": 43, + "line": 45, "column": 4 } } @@ -1423,15 +1609,15 @@ }, { "type": "ClassMethod", - "start": 1155, - "end": 1349, + "start": 1256, + "end": 1450, "loc": { "start": { - "line": 44, + "line": 46, "column": 1 }, "end": { - "line": 52, + "line": 54, "column": 2 } }, @@ -1439,15 +1625,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1155, - "end": 1158, + "start": 1256, + "end": 1259, "loc": { "start": { - "line": 44, + "line": 46, "column": 1 }, "end": { - "line": 44, + "line": 46, "column": 4 }, "identifierName": "add" @@ -1463,15 +1649,15 @@ "params": [ { "type": "Identifier", - "start": 1159, - "end": 1162, + "start": 1260, + "end": 1263, "loc": { "start": { - "line": 44, + "line": 46, "column": 5 }, "end": { - "line": 44, + "line": 46, "column": 8 }, "identifierName": "key" @@ -1481,87 +1667,87 @@ ], "body": { "type": "BlockStatement", - "start": 1164, - "end": 1349, + "start": 1265, + "end": 1450, "loc": { "start": { - "line": 44, + "line": 46, "column": 10 }, "end": { - "line": 52, + "line": 54, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 1168, - "end": 1346, + "start": 1269, + "end": 1447, "loc": { "start": { - "line": 45, + "line": 47, "column": 2 }, "end": { - "line": 51, + "line": 53, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 1172, - "end": 1190, + "start": 1273, + "end": 1291, "loc": { "start": { - "line": 45, + "line": 47, "column": 6 }, "end": { - "line": 45, + "line": 47, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 1172, - "end": 1181, + "start": 1273, + "end": 1282, "loc": { "start": { - "line": 45, + "line": 47, "column": 6 }, "end": { - "line": 45, + "line": 47, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 1172, - "end": 1176, + "start": 1273, + "end": 1277, "loc": { "start": { - "line": 45, + "line": 47, "column": 6 }, "end": { - "line": 45, + "line": 47, "column": 10 } } }, "property": { "type": "Identifier", - "start": 1177, - "end": 1181, + "start": 1278, + "end": 1282, "loc": { "start": { - "line": 45, + "line": 47, "column": 11 }, "end": { - "line": 45, + "line": 47, "column": 15 }, "identifierName": "root" @@ -1573,15 +1759,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1186, - "end": 1190, + "start": 1287, + "end": 1291, "loc": { "start": { - "line": 45, + "line": 47, "column": 20 }, "end": { - "line": 45, + "line": 47, "column": 24 } } @@ -1589,88 +1775,88 @@ }, "consequent": { "type": "BlockStatement", - "start": 1192, - "end": 1234, + "start": 1293, + "end": 1335, "loc": { "start": { - "line": 45, + "line": 47, "column": 26 }, "end": { - "line": 47, + "line": 49, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 1197, - "end": 1230, + "start": 1298, + "end": 1331, "loc": { "start": { - "line": 46, + "line": 48, "column": 3 }, "end": { - "line": 46, + "line": 48, "column": 36 } }, "expression": { "type": "AssignmentExpression", - "start": 1197, - "end": 1229, + "start": 1298, + "end": 1330, "loc": { "start": { - "line": 46, + "line": 48, "column": 3 }, "end": { - "line": 46, + "line": 48, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1197, - "end": 1206, + "start": 1298, + "end": 1307, "loc": { "start": { - "line": 46, + "line": 48, "column": 3 }, "end": { - "line": 46, + "line": 48, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 1197, - "end": 1201, + "start": 1298, + "end": 1302, "loc": { "start": { - "line": 46, + "line": 48, "column": 3 }, "end": { - "line": 46, + "line": 48, "column": 7 } } }, "property": { "type": "Identifier", - "start": 1202, - "end": 1206, + "start": 1303, + "end": 1307, "loc": { "start": { - "line": 46, + "line": 48, "column": 8 }, "end": { - "line": 46, + "line": 48, "column": 12 }, "identifierName": "root" @@ -1681,29 +1867,29 @@ }, "right": { "type": "NewExpression", - "start": 1209, - "end": 1229, + "start": 1310, + "end": 1330, "loc": { "start": { - "line": 46, + "line": 48, "column": 15 }, "end": { - "line": 46, + "line": 48, "column": 35 } }, "callee": { "type": "Identifier", - "start": 1213, - "end": 1217, + "start": 1314, + "end": 1318, "loc": { "start": { - "line": 46, + "line": 48, "column": 19 }, "end": { - "line": 46, + "line": 48, "column": 23 }, "identifierName": "Node" @@ -1713,15 +1899,15 @@ "arguments": [ { "type": "Identifier", - "start": 1218, - "end": 1223, + "start": 1319, + "end": 1324, "loc": { "start": { - "line": 46, + "line": 48, "column": 24 }, "end": { - "line": 46, + "line": 48, "column": 29 }, "identifierName": "BLACK" @@ -1730,15 +1916,15 @@ }, { "type": "Identifier", - "start": 1225, - "end": 1228, + "start": 1326, + "end": 1329, "loc": { "start": { - "line": 46, + "line": 48, "column": 31 }, "end": { - "line": 46, + "line": 48, "column": 34 }, "identifierName": "key" @@ -1754,59 +1940,59 @@ }, "alternate": { "type": "BlockStatement", - "start": 1240, - "end": 1346, + "start": 1341, + "end": 1447, "loc": { "start": { - "line": 47, + "line": 49, "column": 9 }, "end": { - "line": 51, + "line": 53, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 1245, - "end": 1277, + "start": 1346, + "end": 1378, "loc": { "start": { - "line": 48, + "line": 50, "column": 3 }, "end": { - "line": 48, + "line": 50, "column": 35 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 1251, - "end": 1276, + "start": 1352, + "end": 1377, "loc": { "start": { - "line": 48, + "line": 50, "column": 9 }, "end": { - "line": 48, + "line": 50, "column": 34 } }, "id": { "type": "Identifier", - "start": 1251, - "end": 1255, + "start": 1352, + "end": 1356, "loc": { "start": { - "line": 48, + "line": 50, "column": 9 }, "end": { - "line": 48, + "line": 50, "column": 13 }, "identifierName": "node" @@ -1815,29 +2001,29 @@ }, "init": { "type": "NewExpression", - "start": 1258, - "end": 1276, + "start": 1359, + "end": 1377, "loc": { "start": { - "line": 48, + "line": 50, "column": 16 }, "end": { - "line": 48, + "line": 50, "column": 34 } }, "callee": { "type": "Identifier", - "start": 1262, - "end": 1266, + "start": 1363, + "end": 1367, "loc": { "start": { - "line": 48, + "line": 50, "column": 20 }, "end": { - "line": 48, + "line": 50, "column": 24 }, "identifierName": "Node" @@ -1847,15 +2033,15 @@ "arguments": [ { "type": "Identifier", - "start": 1267, - "end": 1270, + "start": 1368, + "end": 1371, "loc": { "start": { - "line": 48, + "line": 50, "column": 25 }, "end": { - "line": 48, + "line": 50, "column": 28 }, "identifierName": "RED" @@ -1864,15 +2050,15 @@ }, { "type": "Identifier", - "start": 1272, - "end": 1275, + "start": 1373, + "end": 1376, "loc": { "start": { - "line": 48, + "line": 50, "column": 30 }, "end": { - "line": 48, + "line": 50, "column": 33 }, "identifierName": "key" @@ -1887,43 +2073,43 @@ }, { "type": "ExpressionStatement", - "start": 1281, - "end": 1319, + "start": 1382, + "end": 1420, "loc": { "start": { - "line": 49, + "line": 51, "column": 3 }, "end": { - "line": 49, + "line": 51, "column": 41 } }, "expression": { "type": "CallExpression", - "start": 1281, - "end": 1318, + "start": 1382, + "end": 1419, "loc": { "start": { - "line": 49, + "line": 51, "column": 3 }, "end": { - "line": 49, + "line": 51, "column": 40 } }, "callee": { "type": "Identifier", - "start": 1281, - "end": 1287, + "start": 1382, + "end": 1388, "loc": { "start": { - "line": 49, + "line": 51, "column": 3 }, "end": { - "line": 49, + "line": 51, "column": 9 }, "identifierName": "insert" @@ -1933,44 +2119,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 1288, - "end": 1300, + "start": 1389, + "end": 1401, "loc": { "start": { - "line": 49, + "line": 51, "column": 10 }, "end": { - "line": 49, + "line": 51, "column": 22 } }, "object": { "type": "ThisExpression", - "start": 1288, - "end": 1292, + "start": 1389, + "end": 1393, "loc": { "start": { - "line": 49, + "line": 51, "column": 10 }, "end": { - "line": 49, + "line": 51, "column": 14 } } }, "property": { "type": "Identifier", - "start": 1293, - "end": 1300, + "start": 1394, + "end": 1401, "loc": { "start": { - "line": 49, + "line": 51, "column": 15 }, "end": { - "line": 49, + "line": 51, "column": 22 }, "identifierName": "compare" @@ -1981,44 +2167,44 @@ }, { "type": "MemberExpression", - "start": 1302, - "end": 1311, + "start": 1403, + "end": 1412, "loc": { "start": { - "line": 49, + "line": 51, "column": 24 }, "end": { - "line": 49, + "line": 51, "column": 33 } }, "object": { "type": "ThisExpression", - "start": 1302, - "end": 1306, + "start": 1403, + "end": 1407, "loc": { "start": { - "line": 49, + "line": 51, "column": 24 }, "end": { - "line": 49, + "line": 51, "column": 28 } } }, "property": { "type": "Identifier", - "start": 1307, - "end": 1311, + "start": 1408, + "end": 1412, "loc": { "start": { - "line": 49, + "line": 51, "column": 29 }, "end": { - "line": 49, + "line": 51, "column": 33 }, "identifierName": "root" @@ -2029,15 +2215,15 @@ }, { "type": "Identifier", - "start": 1313, - "end": 1317, + "start": 1414, + "end": 1418, "loc": { "start": { - "line": 49, + "line": 51, "column": 35 }, "end": { - "line": 49, + "line": 51, "column": 39 }, "identifierName": "node" @@ -2049,61 +2235,61 @@ }, { "type": "ExpressionStatement", - "start": 1323, - "end": 1342, + "start": 1424, + "end": 1443, "loc": { "start": { - "line": 50, + "line": 52, "column": 3 }, "end": { - "line": 50, + "line": 52, "column": 22 } }, "expression": { "type": "CallExpression", - "start": 1323, - "end": 1341, + "start": 1424, + "end": 1442, "loc": { "start": { - "line": 50, + "line": 52, "column": 3 }, "end": { - "line": 50, + "line": 52, "column": 21 } }, "callee": { "type": "Identifier", - "start": 1323, - "end": 1335, + "start": 1424, + "end": 1436, "loc": { "start": { - "line": 50, + "line": 52, "column": 3 }, "end": { - "line": 50, + "line": 52, "column": 15 }, - "identifierName": "insert_case2" + "identifierName": "insert_case1" }, - "name": "insert_case2" + "name": "insert_case1" }, "arguments": [ { "type": "Identifier", - "start": 1336, - "end": 1340, + "start": 1437, + "end": 1441, "loc": { "start": { - "line": 50, + "line": 52, "column": 16 }, "end": { - "line": 50, + "line": 52, "column": 20 }, "identifierName": "node" @@ -2125,15 +2311,15 @@ { "type": "CommentBlock", "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", - "start": 1074, - "end": 1153, + "start": 1175, + "end": 1254, "loc": { "start": { - "line": 39, + "line": 41, "column": 1 }, "end": { - "line": 43, + "line": 45, "column": 4 } } @@ -2143,15 +2329,15 @@ { "type": "CommentBlock", "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1352, - "end": 1578, + "start": 1453, + "end": 1679, "loc": { "start": { - "line": 54, + "line": 56, "column": 1 }, "end": { - "line": 61, + "line": 63, "column": 4 } } @@ -2160,15 +2346,15 @@ }, { "type": "ClassMethod", - "start": 1580, - "end": 1683, + "start": 1681, + "end": 1784, "loc": { "start": { - "line": 62, + "line": 64, "column": 1 }, "end": { - "line": 65, + "line": 67, "column": 2 } }, @@ -2176,15 +2362,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1580, - "end": 1587, + "start": 1681, + "end": 1688, "loc": { "start": { - "line": 62, + "line": 64, "column": 1 }, "end": { - "line": 62, + "line": 64, "column": 8 }, "identifierName": "_search" @@ -2200,15 +2386,15 @@ "params": [ { "type": "Identifier", - "start": 1588, - "end": 1591, + "start": 1689, + "end": 1692, "loc": { "start": { - "line": 62, + "line": 64, "column": 9 }, "end": { - "line": 62, + "line": 64, "column": 12 }, "identifierName": "key" @@ -2218,87 +2404,87 @@ ], "body": { "type": "BlockStatement", - "start": 1593, - "end": 1683, + "start": 1694, + "end": 1784, "loc": { "start": { - "line": 62, + "line": 64, "column": 14 }, "end": { - "line": 65, + "line": 67, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 1597, - "end": 1633, + "start": 1698, + "end": 1734, "loc": { "start": { - "line": 63, + "line": 65, "column": 2 }, "end": { - "line": 63, + "line": 65, "column": 38 } }, "test": { "type": "BinaryExpression", - "start": 1601, - "end": 1619, + "start": 1702, + "end": 1720, "loc": { "start": { - "line": 63, + "line": 65, "column": 6 }, "end": { - "line": 63, + "line": 65, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 1601, - "end": 1610, + "start": 1702, + "end": 1711, "loc": { "start": { - "line": 63, + "line": 65, "column": 6 }, "end": { - "line": 63, + "line": 65, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 1601, - "end": 1605, + "start": 1702, + "end": 1706, "loc": { "start": { - "line": 63, + "line": 65, "column": 6 }, "end": { - "line": 63, + "line": 65, "column": 10 } } }, "property": { "type": "Identifier", - "start": 1606, - "end": 1610, + "start": 1707, + "end": 1711, "loc": { "start": { - "line": 63, + "line": 65, "column": 11 }, "end": { - "line": 63, + "line": 65, "column": 15 }, "identifierName": "root" @@ -2310,15 +2496,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1615, - "end": 1619, + "start": 1716, + "end": 1720, "loc": { "start": { - "line": 63, + "line": 65, "column": 20 }, "end": { - "line": 63, + "line": 65, "column": 24 } } @@ -2326,29 +2512,29 @@ }, "consequent": { "type": "ReturnStatement", - "start": 1621, - "end": 1633, + "start": 1722, + "end": 1734, "loc": { "start": { - "line": 63, + "line": 65, "column": 26 }, "end": { - "line": 63, + "line": 65, "column": 38 } }, "argument": { "type": "NullLiteral", - "start": 1628, - "end": 1632, + "start": 1729, + "end": 1733, "loc": { "start": { - "line": 63, + "line": 65, "column": 33 }, "end": { - "line": 63, + "line": 65, "column": 37 } } @@ -2358,43 +2544,43 @@ }, { "type": "ReturnStatement", - "start": 1636, - "end": 1680, + "start": 1737, + "end": 1781, "loc": { "start": { - "line": 64, + "line": 66, "column": 2 }, "end": { - "line": 64, + "line": 66, "column": 46 } }, "argument": { "type": "CallExpression", - "start": 1643, - "end": 1679, + "start": 1744, + "end": 1780, "loc": { "start": { - "line": 64, + "line": 66, "column": 9 }, "end": { - "line": 64, + "line": 66, "column": 45 } }, "callee": { "type": "Identifier", - "start": 1643, - "end": 1649, + "start": 1744, + "end": 1750, "loc": { "start": { - "line": 64, + "line": 66, "column": 9 }, "end": { - "line": 64, + "line": 66, "column": 15 }, "identifierName": "search" @@ -2404,44 +2590,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 1650, - "end": 1662, + "start": 1751, + "end": 1763, "loc": { "start": { - "line": 64, + "line": 66, "column": 16 }, "end": { - "line": 64, + "line": 66, "column": 28 } }, "object": { "type": "ThisExpression", - "start": 1650, - "end": 1654, + "start": 1751, + "end": 1755, "loc": { "start": { - "line": 64, + "line": 66, "column": 16 }, "end": { - "line": 64, + "line": 66, "column": 20 } } }, "property": { "type": "Identifier", - "start": 1655, - "end": 1662, + "start": 1756, + "end": 1763, "loc": { "start": { - "line": 64, + "line": 66, "column": 21 }, "end": { - "line": 64, + "line": 66, "column": 28 }, "identifierName": "compare" @@ -2452,44 +2638,44 @@ }, { "type": "MemberExpression", - "start": 1664, - "end": 1673, + "start": 1765, + "end": 1774, "loc": { "start": { - "line": 64, + "line": 66, "column": 30 }, "end": { - "line": 64, + "line": 66, "column": 39 } }, "object": { "type": "ThisExpression", - "start": 1664, - "end": 1668, + "start": 1765, + "end": 1769, "loc": { "start": { - "line": 64, + "line": 66, "column": 30 }, "end": { - "line": 64, + "line": 66, "column": 34 } } }, "property": { "type": "Identifier", - "start": 1669, - "end": 1673, + "start": 1770, + "end": 1774, "loc": { "start": { - "line": 64, + "line": 66, "column": 35 }, "end": { - "line": 64, + "line": 66, "column": 39 }, "identifierName": "root" @@ -2500,15 +2686,15 @@ }, { "type": "Identifier", - "start": 1675, - "end": 1678, + "start": 1776, + "end": 1779, "loc": { "start": { - "line": 64, + "line": 66, "column": 41 }, "end": { - "line": 64, + "line": 66, "column": 44 }, "identifierName": "key" @@ -2526,15 +2712,15 @@ { "type": "CommentBlock", "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1352, - "end": 1578, + "start": 1453, + "end": 1679, "loc": { "start": { - "line": 54, + "line": 56, "column": 1 }, "end": { - "line": 61, + "line": 63, "column": 4 } } @@ -2544,15 +2730,15 @@ { "type": "CommentBlock", "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", - "start": 1686, - "end": 1948, + "start": 1787, + "end": 2049, "loc": { "start": { - "line": 67, + "line": 69, "column": 1 }, "end": { - "line": 74, + "line": 76, "column": 4 } } @@ -2561,15 +2747,15 @@ }, { "type": "ClassMethod", - "start": 1950, - "end": 2039, + "start": 2051, + "end": 2140, "loc": { "start": { - "line": 75, + "line": 77, "column": 1 }, "end": { - "line": 78, + "line": 80, "column": 2 } }, @@ -2577,15 +2763,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1950, - "end": 1953, + "start": 2051, + "end": 2054, "loc": { "start": { - "line": 75, + "line": 77, "column": 1 }, "end": { - "line": 75, + "line": 77, "column": 4 }, "identifierName": "get" @@ -2601,15 +2787,15 @@ "params": [ { "type": "Identifier", - "start": 1954, - "end": 1957, + "start": 2055, + "end": 2058, "loc": { "start": { - "line": 75, + "line": 77, "column": 5 }, "end": { - "line": 75, + "line": 77, "column": 8 }, "identifierName": "key" @@ -2619,59 +2805,59 @@ ], "body": { "type": "BlockStatement", - "start": 1959, - "end": 2039, + "start": 2060, + "end": 2140, "loc": { "start": { - "line": 75, + "line": 77, "column": 10 }, "end": { - "line": 78, + "line": 80, "column": 2 } }, "body": [ { "type": "VariableDeclaration", - "start": 1963, - "end": 1994, + "start": 2064, + "end": 2095, "loc": { "start": { - "line": 76, + "line": 78, "column": 2 }, "end": { - "line": 76, + "line": 78, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 1969, - "end": 1993, + "start": 2070, + "end": 2094, "loc": { "start": { - "line": 76, + "line": 78, "column": 8 }, "end": { - "line": 76, + "line": 78, "column": 32 } }, "id": { "type": "Identifier", - "start": 1969, - "end": 1973, + "start": 2070, + "end": 2074, "loc": { "start": { - "line": 76, + "line": 78, "column": 8 }, "end": { - "line": 76, + "line": 78, "column": 12 }, "identifierName": "node" @@ -2680,58 +2866,58 @@ }, "init": { "type": "CallExpression", - "start": 1976, - "end": 1993, + "start": 2077, + "end": 2094, "loc": { "start": { - "line": 76, + "line": 78, "column": 15 }, "end": { - "line": 76, + "line": 78, "column": 32 } }, "callee": { "type": "MemberExpression", - "start": 1976, - "end": 1988, + "start": 2077, + "end": 2089, "loc": { "start": { - "line": 76, + "line": 78, "column": 15 }, "end": { - "line": 76, + "line": 78, "column": 27 } }, "object": { "type": "ThisExpression", - "start": 1976, - "end": 1980, + "start": 2077, + "end": 2081, "loc": { "start": { - "line": 76, + "line": 78, "column": 15 }, "end": { - "line": 76, + "line": 78, "column": 19 } } }, "property": { "type": "Identifier", - "start": 1981, - "end": 1988, + "start": 2082, + "end": 2089, "loc": { "start": { - "line": 76, + "line": 78, "column": 20 }, "end": { - "line": 76, + "line": 78, "column": 27 }, "identifierName": "_search" @@ -2743,15 +2929,15 @@ "arguments": [ { "type": "Identifier", - "start": 1989, - "end": 1992, + "start": 2090, + "end": 2093, "loc": { "start": { - "line": 76, + "line": 78, "column": 28 }, "end": { - "line": 76, + "line": 78, "column": 31 }, "identifierName": "key" @@ -2766,57 +2952,57 @@ }, { "type": "ReturnStatement", - "start": 1997, - "end": 2036, + "start": 2098, + "end": 2137, "loc": { "start": { - "line": 77, + "line": 79, "column": 2 }, "end": { - "line": 77, + "line": 79, "column": 41 } }, "argument": { "type": "ConditionalExpression", - "start": 2004, - "end": 2035, + "start": 2105, + "end": 2136, "loc": { "start": { - "line": 77, + "line": 79, "column": 9 }, "end": { - "line": 77, + "line": 79, "column": 40 } }, "test": { "type": "BinaryExpression", - "start": 2004, - "end": 2017, + "start": 2105, + "end": 2118, "loc": { "start": { - "line": 77, + "line": 79, "column": 9 }, "end": { - "line": 77, + "line": 79, "column": 22 } }, "left": { "type": "Identifier", - "start": 2004, - "end": 2008, + "start": 2105, + "end": 2109, "loc": { "start": { - "line": 77, + "line": 79, "column": 9 }, "end": { - "line": 77, + "line": 79, "column": 13 }, "identifierName": "node" @@ -2826,15 +3012,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 2013, - "end": 2017, + "start": 2114, + "end": 2118, "loc": { "start": { - "line": 77, + "line": 79, "column": 18 }, "end": { - "line": 77, + "line": 79, "column": 22 } } @@ -2842,44 +3028,44 @@ }, "consequent": { "type": "NullLiteral", - "start": 2020, - "end": 2024, + "start": 2121, + "end": 2125, "loc": { "start": { - "line": 77, + "line": 79, "column": 25 }, "end": { - "line": 77, + "line": 79, "column": 29 } } }, "alternate": { "type": "MemberExpression", - "start": 2027, - "end": 2035, + "start": 2128, + "end": 2136, "loc": { "start": { - "line": 77, + "line": 79, "column": 32 }, "end": { - "line": 77, + "line": 79, "column": 40 } }, "object": { "type": "Identifier", - "start": 2027, - "end": 2031, + "start": 2128, + "end": 2132, "loc": { "start": { - "line": 77, + "line": 79, "column": 32 }, "end": { - "line": 77, + "line": 79, "column": 36 }, "identifierName": "node" @@ -2888,15 +3074,15 @@ }, "property": { "type": "Identifier", - "start": 2032, - "end": 2035, + "start": 2133, + "end": 2136, "loc": { "start": { - "line": 77, + "line": 79, "column": 37 }, "end": { - "line": 77, + "line": 79, "column": 40 }, "identifierName": "key" @@ -2915,15 +3101,15 @@ { "type": "CommentBlock", "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", - "start": 1686, - "end": 1948, + "start": 1787, + "end": 2049, "loc": { "start": { - "line": 67, + "line": 69, "column": 1 }, "end": { - "line": 74, + "line": 76, "column": 4 } } @@ -2932,16 +3118,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t ", - "start": 2042, - "end": 2197, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", + "start": 2143, + "end": 2298, "loc": { "start": { - "line": 80, + "line": 82, "column": 1 }, "end": { - "line": 86, + "line": 88, "column": 4 } } @@ -2950,15 +3136,15 @@ }, { "type": "ClassMethod", - "start": 2199, - "end": 2249, + "start": 2300, + "end": 2350, "loc": { "start": { - "line": 87, + "line": 89, "column": 1 }, "end": { - "line": 89, + "line": 91, "column": 2 } }, @@ -2966,15 +3152,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 2199, - "end": 2202, + "start": 2300, + "end": 2303, "loc": { "start": { - "line": 87, + "line": 89, "column": 1 }, "end": { - "line": 87, + "line": 89, "column": 4 }, "identifierName": "has" @@ -2990,15 +3176,15 @@ "params": [ { "type": "Identifier", - "start": 2203, - "end": 2206, + "start": 2304, + "end": 2307, "loc": { "start": { - "line": 87, + "line": 89, "column": 5 }, "end": { - "line": 87, + "line": 89, "column": 8 }, "identifierName": "key" @@ -3008,101 +3194,101 @@ ], "body": { "type": "BlockStatement", - "start": 2208, - "end": 2249, + "start": 2309, + "end": 2350, "loc": { "start": { - "line": 87, + "line": 89, "column": 10 }, "end": { - "line": 89, + "line": 91, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 2212, - "end": 2246, + "start": 2313, + "end": 2347, "loc": { "start": { - "line": 88, + "line": 90, "column": 2 }, "end": { - "line": 88, + "line": 90, "column": 36 } }, "argument": { "type": "BinaryExpression", - "start": 2219, - "end": 2245, + "start": 2320, + "end": 2346, "loc": { "start": { - "line": 88, + "line": 90, "column": 9 }, "end": { - "line": 88, + "line": 90, "column": 35 } }, "left": { "type": "CallExpression", - "start": 2219, - "end": 2236, + "start": 2320, + "end": 2337, "loc": { "start": { - "line": 88, + "line": 90, "column": 9 }, "end": { - "line": 88, + "line": 90, "column": 26 } }, "callee": { "type": "MemberExpression", - "start": 2219, - "end": 2231, + "start": 2320, + "end": 2332, "loc": { "start": { - "line": 88, + "line": 90, "column": 9 }, "end": { - "line": 88, + "line": 90, "column": 21 } }, "object": { "type": "ThisExpression", - "start": 2219, - "end": 2223, + "start": 2320, + "end": 2324, "loc": { "start": { - "line": 88, + "line": 90, "column": 9 }, "end": { - "line": 88, + "line": 90, "column": 13 } } }, "property": { "type": "Identifier", - "start": 2224, - "end": 2231, + "start": 2325, + "end": 2332, "loc": { "start": { - "line": 88, + "line": 90, "column": 14 }, "end": { - "line": 88, + "line": 90, "column": 21 }, "identifierName": "_search" @@ -3114,15 +3300,15 @@ "arguments": [ { "type": "Identifier", - "start": 2232, - "end": 2235, + "start": 2333, + "end": 2336, "loc": { "start": { - "line": 88, + "line": 90, "column": 22 }, "end": { - "line": 88, + "line": 90, "column": 25 }, "identifierName": "key" @@ -3134,15 +3320,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 2241, - "end": 2245, + "start": 2342, + "end": 2346, "loc": { "start": { - "line": 88, + "line": 90, "column": 31 }, "end": { - "line": 88, + "line": 90, "column": 35 } } @@ -3156,16 +3342,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t ", - "start": 2042, - "end": 2197, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", + "start": 2143, + "end": 2298, "loc": { "start": { - "line": 80, + "line": 82, "column": 1 }, "end": { - "line": 86, + "line": 88, "column": 4 } } @@ -3175,15 +3361,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2252, - "end": 2357, + "start": 2353, + "end": 2458, "loc": { "start": { - "line": 91, + "line": 93, "column": 1 }, "end": { - "line": 95, + "line": 97, "column": 4 } } @@ -3192,15 +3378,15 @@ }, { "type": "ClassMethod", - "start": 2359, - "end": 3178, + "start": 2460, + "end": 3286, "loc": { "start": { - "line": 96, + "line": 98, "column": 1 }, "end": { - "line": 121, + "line": 125, "column": 2 } }, @@ -3208,15 +3394,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 2359, - "end": 2366, + "start": 2460, + "end": 2467, "loc": { "start": { - "line": 96, + "line": 98, "column": 1 }, "end": { - "line": 96, + "line": 98, "column": 8 }, "identifierName": "_delete" @@ -3232,15 +3418,15 @@ "params": [ { "type": "Identifier", - "start": 2367, - "end": 2371, + "start": 2468, + "end": 2472, "loc": { "start": { - "line": 96, + "line": 98, "column": 9 }, "end": { - "line": 96, + "line": 98, "column": 13 }, "identifierName": "node" @@ -3250,207 +3436,268 @@ ], "body": { "type": "BlockStatement", - "start": 2373, - "end": 3178, + "start": 2474, + "end": 3286, "loc": { "start": { - "line": 96, + "line": 98, "column": 15 }, "end": { - "line": 121, + "line": 125, "column": 2 } }, "body": [ { - "type": "IfStatement", - "start": 2377, - "end": 3175, + "type": "ExpressionStatement", + "start": 2478, + "end": 2507, "loc": { "start": { - "line": 97, + "line": 99, "column": 2 }, "end": { - "line": 120, - "column": 3 + "line": 99, + "column": 31 } }, - "test": { - "type": "UnaryExpression", - "start": 2381, - "end": 2400, + "expression": { + "type": "CallExpression", + "start": 2478, + "end": 2506, "loc": { "start": { - "line": 97, - "column": 6 + "line": 99, + "column": 2 }, "end": { - "line": 97, - "column": 25 + "line": 99, + "column": 30 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 2382, - "end": 2400, + "callee": { + "type": "Identifier", + "start": 2478, + "end": 2484, "loc": { "start": { - "line": 97, - "column": 7 + "line": 99, + "column": 2 }, "end": { - "line": 97, - "column": 25 - } + "line": 99, + "column": 8 + }, + "identifierName": "assert" }, - "callee": { - "type": "MemberExpression", - "start": 2382, - "end": 2398, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 2485, + "end": 2505, "loc": { "start": { - "line": 97, - "column": 7 + "line": 99, + "column": 9 }, "end": { - "line": 97, - "column": 23 + "line": 99, + "column": 29 } }, - "object": { - "type": "MemberExpression", - "start": 2382, - "end": 2391, + "left": { + "type": "Identifier", + "start": 2485, + "end": 2489, "loc": { "start": { - "line": 97, - "column": 7 + "line": 99, + "column": 9 }, "end": { - "line": 97, - "column": 16 - } - }, - "object": { - "type": "Identifier", - "start": 2382, - "end": 2386, - "loc": { - "start": { - "line": 97, - "column": 7 - }, - "end": { - "line": 97, - "column": 11 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 2387, - "end": 2391, - "loc": { - "start": { - "line": 97, - "column": 12 - }, - "end": { - "line": 97, - "column": 16 - }, - "identifierName": "left" + "line": 99, + "column": 13 }, - "name": "left" + "identifierName": "node" }, - "computed": false + "name": "node" }, - "property": { + "operator": "instanceof", + "right": { "type": "Identifier", - "start": 2392, - "end": 2398, + "start": 2501, + "end": 2505, "loc": { "start": { - "line": 97, - "column": 17 + "line": 99, + "column": 25 }, "end": { - "line": 97, - "column": 23 + "line": 99, + "column": 29 }, - "identifierName": "isLeaf" + "identifierName": "Node" }, - "name": "isLeaf" + "name": "Node" + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 2510, + "end": 3283, + "loc": { + "start": { + "line": 100, + "column": 2 + }, + "end": { + "line": 124, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 2514, + "end": 2532, + "loc": { + "start": { + "line": 100, + "column": 6 + }, + "end": { + "line": 100, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 2514, + "end": 2523, + "loc": { + "start": { + "line": 100, + "column": 6 }, - "computed": false + "end": { + "line": 100, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 2514, + "end": 2518, + "loc": { + "start": { + "line": 100, + "column": 6 + }, + "end": { + "line": 100, + "column": 10 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 2519, + "end": 2523, + "loc": { + "start": { + "line": 100, + "column": 11 + }, + "end": { + "line": 100, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" }, - "arguments": [] + "computed": false }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 2528, + "end": 2532, + "loc": { + "start": { + "line": 100, + "column": 20 + }, + "end": { + "line": 100, + "column": 24 + } + } } }, "consequent": { "type": "BlockStatement", - "start": 2402, - "end": 2675, + "start": 2534, + "end": 2882, "loc": { "start": { - "line": 97, - "column": 27 + "line": 100, + "column": 26 }, "end": { - "line": 105, + "line": 112, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 2455, - "end": 2486, + "start": 2587, + "end": 2618, "loc": { "start": { - "line": 99, + "line": 102, "column": 3 }, "end": { - "line": 99, + "line": 102, "column": 34 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 2461, - "end": 2485, + "start": 2593, + "end": 2617, "loc": { "start": { - "line": 99, + "line": 102, "column": 9 }, "end": { - "line": 99, + "line": 102, "column": 33 } }, "id": { "type": "Identifier", - "start": 2461, - "end": 2465, + "start": 2593, + "end": 2597, "loc": { "start": { - "line": 99, + "line": 102, "column": 9 }, "end": { - "line": 99, + "line": 102, "column": 13 }, "identifierName": "pred" @@ -3460,29 +3707,29 @@ }, "init": { "type": "CallExpression", - "start": 2468, - "end": 2485, + "start": 2600, + "end": 2617, "loc": { "start": { - "line": 99, + "line": 102, "column": 16 }, "end": { - "line": 99, + "line": 102, "column": 33 } }, "callee": { "type": "Identifier", - "start": 2468, - "end": 2479, + "start": 2600, + "end": 2611, "loc": { "start": { - "line": 99, + "line": 102, "column": 16 }, "end": { - "line": 99, + "line": 102, "column": 27 }, "identifierName": "predecessor" @@ -3492,15 +3739,15 @@ "arguments": [ { "type": "Identifier", - "start": 2480, - "end": 2484, + "start": 2612, + "end": 2616, "loc": { "start": { - "line": 99, + "line": 102, "column": 28 }, "end": { - "line": 99, + "line": 102, "column": 32 }, "identifierName": "node" @@ -3517,15 +3764,15 @@ { "type": "CommentLine", "value": " Replace node's key with predecessor's key", - "start": 2407, - "end": 2451, + "start": 2539, + "end": 2583, "loc": { "start": { - "line": 98, + "line": 101, "column": 3 }, "end": { - "line": 98, + "line": 101, "column": 47 } } @@ -3534,58 +3781,58 @@ }, { "type": "ExpressionStatement", - "start": 2490, - "end": 2510, + "start": 2622, + "end": 2642, "loc": { "start": { - "line": 100, + "line": 103, "column": 3 }, "end": { - "line": 100, + "line": 103, "column": 23 } }, "expression": { "type": "AssignmentExpression", - "start": 2490, - "end": 2509, + "start": 2622, + "end": 2641, "loc": { "start": { - "line": 100, + "line": 103, "column": 3 }, "end": { - "line": 100, + "line": 103, "column": 22 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 2490, - "end": 2498, + "start": 2622, + "end": 2630, "loc": { "start": { - "line": 100, + "line": 103, "column": 3 }, "end": { - "line": 100, + "line": 103, "column": 11 } }, "object": { "type": "Identifier", - "start": 2490, - "end": 2494, + "start": 2622, + "end": 2626, "loc": { "start": { - "line": 100, + "line": 103, "column": 3 }, "end": { - "line": 100, + "line": 103, "column": 7 }, "identifierName": "node" @@ -3594,15 +3841,15 @@ }, "property": { "type": "Identifier", - "start": 2495, - "end": 2498, + "start": 2627, + "end": 2630, "loc": { "start": { - "line": 100, + "line": 103, "column": 8 }, "end": { - "line": 100, + "line": 103, "column": 11 }, "identifierName": "key" @@ -3613,29 +3860,29 @@ }, "right": { "type": "MemberExpression", - "start": 2501, - "end": 2509, + "start": 2633, + "end": 2641, "loc": { "start": { - "line": 100, + "line": 103, "column": 14 }, "end": { - "line": 100, + "line": 103, "column": 22 } }, "object": { "type": "Identifier", - "start": 2501, - "end": 2505, + "start": 2633, + "end": 2637, "loc": { "start": { - "line": 100, + "line": 103, "column": 14 }, "end": { - "line": 100, + "line": 103, "column": 18 }, "identifierName": "pred" @@ -3644,15 +3891,15 @@ }, "property": { "type": "Identifier", - "start": 2506, - "end": 2509, + "start": 2638, + "end": 2641, "loc": { "start": { - "line": 100, + "line": 103, "column": 19 }, "end": { - "line": 100, + "line": 103, "column": 22 }, "identifierName": "key" @@ -3666,166 +3913,365 @@ { "type": "CommentLine", "value": " Delete predecessor node", - "start": 2514, - "end": 2540, + "start": 2646, + "end": 2672, "loc": { "start": { - "line": 101, + "line": 104, "column": 3 }, "end": { - "line": 101, + "line": 104, "column": 29 } } }, { "type": "CommentLine", - "value": " note: this node can only have one non-leaf child", - "start": 2544, - "end": 2595, + "value": " NOTE: this node can only have one non-leaf (left) child because", + "start": 2676, + "end": 2742, "loc": { "start": { - "line": 102, + "line": 105, "column": 3 }, "end": { - "line": 102, - "column": 54 + "line": 105, + "column": 69 } } }, { "type": "CommentLine", - "value": " because the tree is a red-black tree", - "start": 2599, - "end": 2644, + "value": " of red-black tree invariant.", + "start": 2746, + "end": 2777, "loc": { "start": { - "line": 103, + "line": 106, "column": 3 }, "end": { - "line": 103, - "column": 48 + "line": 106, + "column": 34 } } } ] }, { - "type": "ExpressionStatement", - "start": 2648, - "end": 2671, + "type": "IfStatement", + "start": 2781, + "end": 2878, "loc": { "start": { - "line": 104, + "line": 107, "column": 3 }, "end": { - "line": 104, - "column": 26 + "line": 111, + "column": 4 } }, - "expression": { - "type": "CallExpression", - "start": 2648, - "end": 2670, + "test": { + "type": "BinaryExpression", + "start": 2785, + "end": 2803, "loc": { "start": { - "line": 104, - "column": 3 + "line": 107, + "column": 7 }, "end": { - "line": 104, + "line": 107, "column": 25 } }, - "callee": { - "type": "Identifier", - "start": 2648, - "end": 2664, + "left": { + "type": "MemberExpression", + "start": 2785, + "end": 2794, "loc": { "start": { - "line": 104, - "column": 3 + "line": 107, + "column": 7 }, "end": { - "line": 104, - "column": 19 - }, - "identifierName": "delete_one_child" + "line": 107, + "column": 16 + } }, - "name": "delete_one_child", - "leadingComments": null - }, - "arguments": [ - { + "object": { "type": "Identifier", - "start": 2665, - "end": 2669, + "start": 2785, + "end": 2789, "loc": { "start": { - "line": 104, - "column": 20 + "line": 107, + "column": 7 }, "end": { - "line": 104, - "column": 24 + "line": 107, + "column": 11 }, "identifierName": "pred" }, - "name": "pred" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Delete predecessor node", - "start": 2514, - "end": 2540, + "name": "pred", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 2790, + "end": 2794, + "loc": { + "start": { + "line": 107, + "column": 12 + }, + "end": { + "line": 107, + "column": 16 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false, + "leadingComments": null + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 2799, + "end": 2803, "loc": { "start": { - "line": 101, - "column": 3 + "line": 107, + "column": 21 }, "end": { - "line": 101, - "column": 29 + "line": 107, + "column": 25 } } }, - { + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 2805, + "end": 2838, + "loc": { + "start": { + "line": 107, + "column": 27 + }, + "end": { + "line": 109, + "column": 4 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2811, + "end": 2833, + "loc": { + "start": { + "line": 108, + "column": 4 + }, + "end": { + "line": 108, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 2811, + "end": 2832, + "loc": { + "start": { + "line": 108, + "column": 4 + }, + "end": { + "line": 108, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 2811, + "end": 2826, + "loc": { + "start": { + "line": 108, + "column": 4 + }, + "end": { + "line": 108, + "column": 19 + }, + "identifierName": "delete_no_child" + }, + "name": "delete_no_child" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2827, + "end": 2831, + "loc": { + "start": { + "line": 108, + "column": 20 + }, + "end": { + "line": 108, + "column": 24 + }, + "identifierName": "pred" + }, + "name": "pred" + } + ] + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 2844, + "end": 2878, + "loc": { + "start": { + "line": 109, + "column": 10 + }, + "end": { + "line": 111, + "column": 4 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2850, + "end": 2873, + "loc": { + "start": { + "line": 110, + "column": 4 + }, + "end": { + "line": 110, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 2850, + "end": 2872, + "loc": { + "start": { + "line": 110, + "column": 4 + }, + "end": { + "line": 110, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 2850, + "end": 2866, + "loc": { + "start": { + "line": 110, + "column": 4 + }, + "end": { + "line": 110, + "column": 20 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child" + }, + "arguments": [ + { + "type": "Identifier", + "start": 2867, + "end": 2871, + "loc": { + "start": { + "line": 110, + "column": 21 + }, + "end": { + "line": 110, + "column": 25 + }, + "identifierName": "pred" + }, + "name": "pred" + } + ] + } + } + ], + "directives": [] + }, + "leadingComments": [ + { "type": "CommentLine", - "value": " note: this node can only have one non-leaf child", - "start": 2544, - "end": 2595, + "value": " Delete predecessor node", + "start": 2646, + "end": 2672, "loc": { "start": { - "line": 102, + "line": 104, "column": 3 }, "end": { - "line": 102, - "column": 54 + "line": 104, + "column": 29 } } }, { "type": "CommentLine", - "value": " because the tree is a red-black tree", - "start": 2599, - "end": 2644, + "value": " NOTE: this node can only have one non-leaf (left) child because", + "start": 2676, + "end": 2742, "loc": { "start": { - "line": 103, + "line": 105, "column": 3 }, "end": { - "line": 103, - "column": 48 + "line": 105, + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " of red-black tree invariant.", + "start": 2746, + "end": 2777, + "loc": { + "start": { + "line": 106, + "column": 3 + }, + "end": { + "line": 106, + "column": 34 } } } @@ -3836,192 +4282,154 @@ }, "alternate": { "type": "IfStatement", - "start": 2681, - "end": 3175, + "start": 2888, + "end": 3283, "loc": { "start": { - "line": 105, + "line": 112, "column": 9 }, "end": { - "line": 120, + "line": 124, "column": 3 } }, "test": { - "type": "UnaryExpression", - "start": 2685, - "end": 2705, + "type": "BinaryExpression", + "start": 2892, + "end": 2911, "loc": { "start": { - "line": 105, + "line": 112, "column": 13 }, "end": { - "line": 105, - "column": 33 + "line": 112, + "column": 32 } }, - "operator": "!", - "prefix": true, - "argument": { - "type": "CallExpression", - "start": 2686, - "end": 2705, + "left": { + "type": "MemberExpression", + "start": 2892, + "end": 2902, "loc": { "start": { - "line": 105, - "column": 14 + "line": 112, + "column": 13 }, "end": { - "line": 105, - "column": 33 + "line": 112, + "column": 23 } }, - "callee": { - "type": "MemberExpression", - "start": 2686, - "end": 2703, + "object": { + "type": "Identifier", + "start": 2892, + "end": 2896, "loc": { "start": { - "line": 105, - "column": 14 + "line": 112, + "column": 13 }, "end": { - "line": 105, - "column": 31 - } - }, - "object": { - "type": "MemberExpression", - "start": 2686, - "end": 2696, - "loc": { - "start": { - "line": 105, - "column": 14 - }, - "end": { - "line": 105, - "column": 24 - } - }, - "object": { - "type": "Identifier", - "start": 2686, - "end": 2690, - "loc": { - "start": { - "line": 105, - "column": 14 - }, - "end": { - "line": 105, - "column": 18 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 2691, - "end": 2696, - "loc": { - "start": { - "line": 105, - "column": 19 - }, - "end": { - "line": 105, - "column": 24 - }, - "identifierName": "right" - }, - "name": "right" + "line": 112, + "column": 17 }, - "computed": false + "identifierName": "node" }, - "property": { - "type": "Identifier", - "start": 2697, - "end": 2703, - "loc": { - "start": { - "line": 105, - "column": 25 - }, - "end": { - "line": 105, - "column": 31 - }, - "identifierName": "isLeaf" + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 2897, + "end": 2902, + "loc": { + "start": { + "line": 112, + "column": 18 + }, + "end": { + "line": 112, + "column": 23 }, - "name": "isLeaf" + "identifierName": "right" }, - "computed": false + "name": "right" }, - "arguments": [] + "computed": false }, - "extra": { - "parenthesizedArgument": false + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 2907, + "end": 2911, + "loc": { + "start": { + "line": 112, + "column": 28 + }, + "end": { + "line": 112, + "column": 32 + } + } } }, "consequent": { "type": "BlockStatement", - "start": 2707, - "end": 3081, + "start": 2913, + "end": 3190, "loc": { "start": { - "line": 105, - "column": 35 + "line": 112, + "column": 34 }, "end": { - "line": 116, + "line": 120, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 2837, - "end": 2861, + "start": 3084, + "end": 3108, "loc": { "start": { - "line": 109, + "line": 116, "column": 3 }, "end": { - "line": 109, + "line": 116, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 2843, - "end": 2860, + "start": 3090, + "end": 3107, "loc": { "start": { - "line": 109, + "line": 116, "column": 9 }, "end": { - "line": 109, + "line": 116, "column": 26 } }, "id": { "type": "Identifier", - "start": 2843, - "end": 2847, + "start": 3090, + "end": 3094, "loc": { "start": { - "line": 109, + "line": 116, "column": 9 }, "end": { - "line": 109, + "line": 116, "column": 13 }, "identifierName": "succ" @@ -4031,29 +4439,29 @@ }, "init": { "type": "MemberExpression", - "start": 2850, - "end": 2860, + "start": 3097, + "end": 3107, "loc": { "start": { - "line": 109, + "line": 116, "column": 16 }, "end": { - "line": 109, + "line": 116, "column": 26 } }, "object": { "type": "Identifier", - "start": 2850, - "end": 2854, + "start": 3097, + "end": 3101, "loc": { "start": { - "line": 109, + "line": 116, "column": 16 }, "end": { - "line": 109, + "line": 116, "column": 20 }, "identifierName": "node" @@ -4062,15 +4470,15 @@ }, "property": { "type": "Identifier", - "start": 2855, - "end": 2860, + "start": 3102, + "end": 3107, "loc": { "start": { - "line": 109, + "line": 116, "column": 21 }, "end": { - "line": 109, + "line": 116, "column": 26 }, "identifierName": "right" @@ -4087,48 +4495,48 @@ { "type": "CommentLine", "value": " Replace node's key with successor's key", - "start": 2712, - "end": 2754, + "start": 2918, + "end": 2960, "loc": { "start": { - "line": 106, + "line": 113, "column": 3 }, "end": { - "line": 106, + "line": 113, "column": 45 } } }, { "type": "CommentLine", - "value": " If there is no left child, then there can only be one right", - "start": 2758, - "end": 2820, + "value": " NOTE: Since there is no left child, then there can only be one", + "start": 2964, + "end": 3029, "loc": { "start": { - "line": 107, + "line": 114, "column": 3 }, "end": { - "line": 107, - "column": 65 + "line": 114, + "column": 68 } } }, { "type": "CommentLine", - "value": " child.", - "start": 2824, - "end": 2833, + "value": " right child by the red-black tree invariant.", + "start": 3033, + "end": 3080, "loc": { "start": { - "line": 108, + "line": 115, "column": 3 }, "end": { - "line": 108, - "column": 12 + "line": 115, + "column": 50 } } } @@ -4136,157 +4544,58 @@ }, { "type": "ExpressionStatement", - "start": 2865, - "end": 2894, + "start": 3112, + "end": 3132, "loc": { "start": { - "line": 110, + "line": 117, "column": 3 }, "end": { - "line": 110, - "column": 32 - } - }, - "expression": { - "type": "CallExpression", - "start": 2865, - "end": 2893, - "loc": { - "start": { - "line": 110, - "column": 3 - }, - "end": { - "line": 110, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 2865, - "end": 2871, - "loc": { - "start": { - "line": 110, - "column": 3 - }, - "end": { - "line": 110, - "column": 9 - }, - "identifierName": "assert" - }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 2872, - "end": 2892, - "loc": { - "start": { - "line": 110, - "column": 10 - }, - "end": { - "line": 110, - "column": 30 - } - }, - "left": { - "type": "Identifier", - "start": 2872, - "end": 2876, - "loc": { - "start": { - "line": 110, - "column": 10 - }, - "end": { - "line": 110, - "column": 14 - }, - "identifierName": "succ" - }, - "name": "succ" - }, - "operator": "instanceof", - "right": { - "type": "Identifier", - "start": 2888, - "end": 2892, - "loc": { - "start": { - "line": 110, - "column": 26 - }, - "end": { - "line": 110, - "column": 30 - }, - "identifierName": "Node" - }, - "name": "Node" - } - } - ] - } - }, - { - "type": "ExpressionStatement", - "start": 2898, - "end": 2918, - "loc": { - "start": { - "line": 111, - "column": 3 - }, - "end": { - "line": 111, + "line": 117, "column": 23 } }, "expression": { "type": "AssignmentExpression", - "start": 2898, - "end": 2917, + "start": 3112, + "end": 3131, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 22 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 2898, - "end": 2906, + "start": 3112, + "end": 3120, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 11 } }, "object": { "type": "Identifier", - "start": 2898, - "end": 2902, + "start": 3112, + "end": 3116, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 7 }, "identifierName": "node" @@ -4295,15 +4604,15 @@ }, "property": { "type": "Identifier", - "start": 2903, - "end": 2906, + "start": 3117, + "end": 3120, "loc": { "start": { - "line": 111, + "line": 117, "column": 8 }, "end": { - "line": 111, + "line": 117, "column": 11 }, "identifierName": "key" @@ -4314,29 +4623,29 @@ }, "right": { "type": "MemberExpression", - "start": 2909, - "end": 2917, + "start": 3123, + "end": 3131, "loc": { "start": { - "line": 111, + "line": 117, "column": 14 }, "end": { - "line": 111, + "line": 117, "column": 22 } }, "object": { "type": "Identifier", - "start": 2909, - "end": 2913, + "start": 3123, + "end": 3127, "loc": { "start": { - "line": 111, + "line": 117, "column": 14 }, "end": { - "line": 111, + "line": 117, "column": 18 }, "identifierName": "succ" @@ -4345,15 +4654,15 @@ }, "property": { "type": "Identifier", - "start": 2914, - "end": 2917, + "start": 3128, + "end": 3131, "loc": { "start": { - "line": 111, + "line": 117, "column": 19 }, "end": { - "line": 111, + "line": 117, "column": 22 }, "identifierName": "key" @@ -4367,112 +4676,80 @@ { "type": "CommentLine", "value": " Delete successor node", - "start": 2922, - "end": 2946, + "start": 3136, + "end": 3160, "loc": { "start": { - "line": 112, + "line": 118, "column": 3 }, "end": { - "line": 112, + "line": 118, "column": 27 } } - }, - { - "type": "CommentLine", - "value": " note: this node can only have one non-leaf child", - "start": 2950, - "end": 3001, - "loc": { - "start": { - "line": 113, - "column": 3 - }, - "end": { - "line": 113, - "column": 54 - } - } - }, - { - "type": "CommentLine", - "value": " because the tree is a red-black tree", - "start": 3005, - "end": 3050, - "loc": { - "start": { - "line": 114, - "column": 3 - }, - "end": { - "line": 114, - "column": 48 - } - } } ] }, { "type": "ExpressionStatement", - "start": 3054, - "end": 3077, + "start": 3164, + "end": 3186, "loc": { "start": { - "line": 115, + "line": 119, "column": 3 }, "end": { - "line": 115, - "column": 26 + "line": 119, + "column": 25 } }, "expression": { "type": "CallExpression", - "start": 3054, - "end": 3076, + "start": 3164, + "end": 3185, "loc": { "start": { - "line": 115, + "line": 119, "column": 3 }, "end": { - "line": 115, - "column": 25 + "line": 119, + "column": 24 } }, "callee": { "type": "Identifier", - "start": 3054, - "end": 3070, + "start": 3164, + "end": 3179, "loc": { "start": { - "line": 115, + "line": 119, "column": 3 }, "end": { - "line": 115, - "column": 19 + "line": 119, + "column": 18 }, - "identifierName": "delete_one_child" + "identifierName": "delete_no_child" }, - "name": "delete_one_child", + "name": "delete_no_child", "leadingComments": null }, "arguments": [ { "type": "Identifier", - "start": 3071, - "end": 3075, + "start": 3180, + "end": 3184, "loc": { "start": { - "line": 115, - "column": 20 + "line": 119, + "column": 19 }, "end": { - "line": 115, - "column": 24 + "line": 119, + "column": 23 }, "identifierName": "succ" }, @@ -4485,50 +4762,18 @@ { "type": "CommentLine", "value": " Delete successor node", - "start": 2922, - "end": 2946, + "start": 3136, + "end": 3160, "loc": { "start": { - "line": 112, + "line": 118, "column": 3 }, "end": { - "line": 112, + "line": 118, "column": 27 } } - }, - { - "type": "CommentLine", - "value": " note: this node can only have one non-leaf child", - "start": 2950, - "end": 3001, - "loc": { - "start": { - "line": 113, - "column": 3 - }, - "end": { - "line": 113, - "column": 54 - } - } - }, - { - "type": "CommentLine", - "value": " because the tree is a red-black tree", - "start": 3005, - "end": 3050, - "loc": { - "start": { - "line": 114, - "column": 3 - }, - "end": { - "line": 114, - "column": 48 - } - } } ] } @@ -4537,43 +4782,43 @@ }, "alternate": { "type": "IfStatement", - "start": 3087, - "end": 3175, + "start": 3196, + "end": 3283, "loc": { "start": { - "line": 116, + "line": 120, "column": 9 }, "end": { - "line": 120, + "line": 124, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 3091, - "end": 3109, + "start": 3200, + "end": 3218, "loc": { "start": { - "line": 116, + "line": 120, "column": 13 }, "end": { - "line": 116, + "line": 120, "column": 31 } }, "left": { "type": "Identifier", - "start": 3091, - "end": 3095, + "start": 3200, + "end": 3204, "loc": { "start": { - "line": 116, + "line": 120, "column": 13 }, "end": { - "line": 116, + "line": 120, "column": 17 }, "identifierName": "node" @@ -4583,44 +4828,44 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 3100, - "end": 3109, + "start": 3209, + "end": 3218, "loc": { "start": { - "line": 116, + "line": 120, "column": 22 }, "end": { - "line": 116, + "line": 120, "column": 31 } }, "object": { "type": "ThisExpression", - "start": 3100, - "end": 3104, + "start": 3209, + "end": 3213, "loc": { "start": { - "line": 116, + "line": 120, "column": 22 }, "end": { - "line": 116, + "line": 120, "column": 26 } } }, "property": { "type": "Identifier", - "start": 3105, - "end": 3109, + "start": 3214, + "end": 3218, "loc": { "start": { - "line": 116, + "line": 120, "column": 27 }, "end": { - "line": 116, + "line": 120, "column": 31 }, "identifierName": "root" @@ -4632,88 +4877,88 @@ }, "consequent": { "type": "BlockStatement", - "start": 3111, - "end": 3137, + "start": 3220, + "end": 3246, "loc": { "start": { - "line": 116, + "line": 120, "column": 33 }, "end": { - "line": 118, + "line": 122, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 3116, - "end": 3133, + "start": 3225, + "end": 3242, "loc": { "start": { - "line": 117, + "line": 121, "column": 3 }, "end": { - "line": 117, + "line": 121, "column": 20 } }, "expression": { "type": "AssignmentExpression", - "start": 3116, - "end": 3132, + "start": 3225, + "end": 3241, "loc": { "start": { - "line": 117, + "line": 121, "column": 3 }, "end": { - "line": 117, + "line": 121, "column": 19 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 3116, - "end": 3125, + "start": 3225, + "end": 3234, "loc": { "start": { - "line": 117, + "line": 121, "column": 3 }, "end": { - "line": 117, + "line": 121, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 3116, - "end": 3120, + "start": 3225, + "end": 3229, "loc": { "start": { - "line": 117, + "line": 121, "column": 3 }, "end": { - "line": 117, + "line": 121, "column": 7 } } }, "property": { "type": "Identifier", - "start": 3121, - "end": 3125, + "start": 3230, + "end": 3234, "loc": { "start": { - "line": 117, + "line": 121, "column": 8 }, "end": { - "line": 117, + "line": 121, "column": 12 }, "identifierName": "root" @@ -4724,15 +4969,15 @@ }, "right": { "type": "NullLiteral", - "start": 3128, - "end": 3132, + "start": 3237, + "end": 3241, "loc": { "start": { - "line": 117, + "line": 121, "column": 15 }, "end": { - "line": 117, + "line": 121, "column": 19 } } @@ -4744,77 +4989,77 @@ }, "alternate": { "type": "BlockStatement", - "start": 3143, - "end": 3175, + "start": 3252, + "end": 3283, "loc": { "start": { - "line": 118, + "line": 122, "column": 9 }, "end": { - "line": 120, + "line": 124, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 3148, - "end": 3171, + "start": 3257, + "end": 3279, "loc": { "start": { - "line": 119, + "line": 123, "column": 3 }, "end": { - "line": 119, - "column": 26 + "line": 123, + "column": 25 } }, "expression": { "type": "CallExpression", - "start": 3148, - "end": 3170, + "start": 3257, + "end": 3278, "loc": { "start": { - "line": 119, + "line": 123, "column": 3 }, "end": { - "line": 119, - "column": 25 + "line": 123, + "column": 24 } }, "callee": { "type": "Identifier", - "start": 3148, - "end": 3164, + "start": 3257, + "end": 3272, "loc": { "start": { - "line": 119, + "line": 123, "column": 3 }, "end": { - "line": 119, - "column": 19 + "line": 123, + "column": 18 }, - "identifierName": "delete_one_child" + "identifierName": "delete_no_child" }, - "name": "delete_one_child" + "name": "delete_no_child" }, "arguments": [ { "type": "Identifier", - "start": 3165, - "end": 3169, + "start": 3273, + "end": 3277, "loc": { "start": { - "line": 119, - "column": 20 + "line": 123, + "column": 19 }, "end": { - "line": 119, - "column": 24 + "line": 123, + "column": 23 }, "identifierName": "node" }, @@ -4837,15 +5082,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2252, - "end": 2357, + "start": 2353, + "end": 2458, "loc": { "start": { - "line": 91, + "line": 93, "column": 1 }, "end": { - "line": 95, + "line": 97, "column": 4 } } @@ -4854,16 +5099,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 3181, - "end": 3593, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 3289, + "end": 3701, "loc": { "start": { - "line": 123, + "line": 127, "column": 1 }, "end": { - "line": 131, + "line": 135, "column": 4 } } @@ -4872,15 +5117,15 @@ }, { "type": "ClassMethod", - "start": 3595, - "end": 3718, + "start": 3703, + "end": 3826, "loc": { "start": { - "line": 132, + "line": 136, "column": 1 }, "end": { - "line": 138, + "line": 142, "column": 2 } }, @@ -4888,15 +5133,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 3595, - "end": 3601, + "start": 3703, + "end": 3709, "loc": { "start": { - "line": 132, + "line": 136, "column": 1 }, "end": { - "line": 132, + "line": 136, "column": 7 }, "identifierName": "remove" @@ -4912,15 +5157,15 @@ "params": [ { "type": "Identifier", - "start": 3602, - "end": 3605, + "start": 3710, + "end": 3713, "loc": { "start": { - "line": 132, + "line": 136, "column": 8 }, "end": { - "line": 132, + "line": 136, "column": 11 }, "identifierName": "key" @@ -4930,59 +5175,59 @@ ], "body": { "type": "BlockStatement", - "start": 3607, - "end": 3718, + "start": 3715, + "end": 3826, "loc": { "start": { - "line": 132, + "line": 136, "column": 13 }, "end": { - "line": 138, + "line": 142, "column": 2 } }, "body": [ { "type": "VariableDeclaration", - "start": 3611, - "end": 3642, + "start": 3719, + "end": 3750, "loc": { "start": { - "line": 133, + "line": 137, "column": 2 }, "end": { - "line": 133, + "line": 137, "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 3617, - "end": 3641, + "start": 3725, + "end": 3749, "loc": { "start": { - "line": 133, + "line": 137, "column": 8 }, "end": { - "line": 133, + "line": 137, "column": 32 } }, "id": { "type": "Identifier", - "start": 3617, - "end": 3621, + "start": 3725, + "end": 3729, "loc": { "start": { - "line": 133, + "line": 137, "column": 8 }, "end": { - "line": 133, + "line": 137, "column": 12 }, "identifierName": "node" @@ -4991,58 +5236,58 @@ }, "init": { "type": "CallExpression", - "start": 3624, - "end": 3641, + "start": 3732, + "end": 3749, "loc": { "start": { - "line": 133, + "line": 137, "column": 15 }, "end": { - "line": 133, + "line": 137, "column": 32 } }, "callee": { "type": "MemberExpression", - "start": 3624, - "end": 3636, + "start": 3732, + "end": 3744, "loc": { "start": { - "line": 133, + "line": 137, "column": 15 }, "end": { - "line": 133, + "line": 137, "column": 27 } }, "object": { "type": "ThisExpression", - "start": 3624, - "end": 3628, + "start": 3732, + "end": 3736, "loc": { "start": { - "line": 133, + "line": 137, "column": 15 }, "end": { - "line": 133, + "line": 137, "column": 19 } } }, "property": { "type": "Identifier", - "start": 3629, - "end": 3636, + "start": 3737, + "end": 3744, "loc": { "start": { - "line": 133, + "line": 137, "column": 20 }, "end": { - "line": 133, + "line": 137, "column": 27 }, "identifierName": "_search" @@ -5054,15 +5299,15 @@ "arguments": [ { "type": "Identifier", - "start": 3637, - "end": 3640, + "start": 3745, + "end": 3748, "loc": { "start": { - "line": 133, + "line": 137, "column": 28 }, "end": { - "line": 133, + "line": 137, "column": 31 }, "identifierName": "key" @@ -5077,43 +5322,43 @@ }, { "type": "IfStatement", - "start": 3645, - "end": 3677, + "start": 3753, + "end": 3785, "loc": { "start": { - "line": 134, + "line": 138, "column": 2 }, "end": { - "line": 134, + "line": 138, "column": 34 } }, "test": { "type": "BinaryExpression", - "start": 3649, - "end": 3662, + "start": 3757, + "end": 3770, "loc": { "start": { - "line": 134, + "line": 138, "column": 6 }, "end": { - "line": 134, + "line": 138, "column": 19 } }, "left": { "type": "Identifier", - "start": 3649, - "end": 3653, + "start": 3757, + "end": 3761, "loc": { "start": { - "line": 134, + "line": 138, "column": 6 }, "end": { - "line": 134, + "line": 138, "column": 10 }, "identifierName": "node" @@ -5123,15 +5368,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 3658, - "end": 3662, + "start": 3766, + "end": 3770, "loc": { "start": { - "line": 134, + "line": 138, "column": 15 }, "end": { - "line": 134, + "line": 138, "column": 19 } } @@ -5139,29 +5384,29 @@ }, "consequent": { "type": "ReturnStatement", - "start": 3664, - "end": 3677, + "start": 3772, + "end": 3785, "loc": { "start": { - "line": 134, + "line": 138, "column": 21 }, "end": { - "line": 134, + "line": 138, "column": 34 } }, "argument": { "type": "BooleanLiteral", - "start": 3671, - "end": 3676, + "start": 3779, + "end": 3784, "loc": { "start": { - "line": 134, + "line": 138, "column": 28 }, "end": { - "line": 134, + "line": 138, "column": 33 } }, @@ -5172,72 +5417,72 @@ }, { "type": "ExpressionStatement", - "start": 3681, - "end": 3700, + "start": 3789, + "end": 3808, "loc": { "start": { - "line": 136, + "line": 140, "column": 2 }, "end": { - "line": 136, + "line": 140, "column": 21 } }, "expression": { "type": "CallExpression", - "start": 3681, - "end": 3699, + "start": 3789, + "end": 3807, "loc": { "start": { - "line": 136, + "line": 140, "column": 2 }, "end": { - "line": 136, + "line": 140, "column": 20 } }, "callee": { "type": "MemberExpression", - "start": 3681, - "end": 3693, + "start": 3789, + "end": 3801, "loc": { "start": { - "line": 136, + "line": 140, "column": 2 }, "end": { - "line": 136, + "line": 140, "column": 14 } }, "object": { "type": "ThisExpression", - "start": 3681, - "end": 3685, + "start": 3789, + "end": 3793, "loc": { "start": { - "line": 136, + "line": 140, "column": 2 }, "end": { - "line": 136, + "line": 140, "column": 6 } } }, "property": { "type": "Identifier", - "start": 3686, - "end": 3693, + "start": 3794, + "end": 3801, "loc": { "start": { - "line": 136, + "line": 140, "column": 7 }, "end": { - "line": 136, + "line": 140, "column": 14 }, "identifierName": "_delete" @@ -5249,15 +5494,15 @@ "arguments": [ { "type": "Identifier", - "start": 3694, - "end": 3698, + "start": 3802, + "end": 3806, "loc": { "start": { - "line": 136, + "line": 140, "column": 15 }, "end": { - "line": 136, + "line": 140, "column": 19 }, "identifierName": "node" @@ -5269,29 +5514,29 @@ }, { "type": "ReturnStatement", - "start": 3703, - "end": 3715, + "start": 3811, + "end": 3823, "loc": { "start": { - "line": 137, + "line": 141, "column": 2 }, "end": { - "line": 137, + "line": 141, "column": 14 } }, "argument": { "type": "BooleanLiteral", - "start": 3710, - "end": 3714, + "start": 3818, + "end": 3822, "loc": { "start": { - "line": 137, + "line": 141, "column": 9 }, "end": { - "line": 137, + "line": 141, "column": 13 } }, @@ -5305,16 +5550,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 3181, - "end": 3593, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 3289, + "end": 3701, "loc": { "start": { - "line": 123, + "line": 127, "column": 1 }, "end": { - "line": 131, + "line": 135, "column": 4 } } @@ -5324,15 +5569,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", - "start": 3721, - "end": 3978, + "start": 3829, + "end": 4086, "loc": { "start": { - "line": 140, + "line": 144, "column": 1 }, "end": { - "line": 146, + "line": 150, "column": 4 } } @@ -5341,15 +5586,15 @@ }, { "type": "ClassMethod", - "start": 3980, - "end": 4094, + "start": 4088, + "end": 4202, "loc": { "start": { - "line": 147, + "line": 151, "column": 1 }, "end": { - "line": 150, + "line": 154, "column": 2 } }, @@ -5358,15 +5603,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 3981, - "end": 3986, + "start": 4089, + "end": 4094, "loc": { "start": { - "line": 147, + "line": 151, "column": 2 }, "end": { - "line": 147, + "line": 151, "column": 7 }, "identifierName": "range" @@ -5381,15 +5626,15 @@ "params": [ { "type": "Identifier", - "start": 3987, - "end": 3991, + "start": 4095, + "end": 4099, "loc": { "start": { - "line": 147, + "line": 151, "column": 8 }, "end": { - "line": 147, + "line": 151, "column": 12 }, "identifierName": "left" @@ -5398,15 +5643,15 @@ }, { "type": "Identifier", - "start": 3993, - "end": 3998, + "start": 4101, + "end": 4106, "loc": { "start": { - "line": 147, + "line": 151, "column": 14 }, "end": { - "line": 147, + "line": 151, "column": 19 }, "identifierName": "right" @@ -5416,87 +5661,87 @@ ], "body": { "type": "BlockStatement", - "start": 4000, - "end": 4094, + "start": 4108, + "end": 4202, "loc": { "start": { - "line": 147, + "line": 151, "column": 21 }, "end": { - "line": 150, + "line": 154, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 4004, - "end": 4091, + "start": 4112, + "end": 4199, "loc": { "start": { - "line": 148, + "line": 152, "column": 2 }, "end": { - "line": 149, + "line": 153, "column": 63 } }, "test": { "type": "BinaryExpression", - "start": 4008, - "end": 4026, + "start": 4116, + "end": 4134, "loc": { "start": { - "line": 148, + "line": 152, "column": 6 }, "end": { - "line": 148, + "line": 152, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 4008, - "end": 4017, + "start": 4116, + "end": 4125, "loc": { "start": { - "line": 148, + "line": 152, "column": 6 }, "end": { - "line": 148, + "line": 152, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 4008, - "end": 4012, + "start": 4116, + "end": 4120, "loc": { "start": { - "line": 148, + "line": 152, "column": 6 }, "end": { - "line": 148, + "line": 152, "column": 10 } } }, "property": { "type": "Identifier", - "start": 4013, - "end": 4017, + "start": 4121, + "end": 4125, "loc": { "start": { - "line": 148, + "line": 152, "column": 11 }, "end": { - "line": 148, + "line": 152, "column": 15 }, "identifierName": "root" @@ -5508,15 +5753,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 4022, - "end": 4026, + "start": 4130, + "end": 4134, "loc": { "start": { - "line": 148, + "line": 152, "column": 20 }, "end": { - "line": 148, + "line": 152, "column": 24 } } @@ -5524,58 +5769,58 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 4031, - "end": 4091, + "start": 4139, + "end": 4199, "loc": { "start": { - "line": 149, + "line": 153, "column": 3 }, "end": { - "line": 149, + "line": 153, "column": 63 } }, "expression": { "type": "YieldExpression", - "start": 4031, - "end": 4090, + "start": 4139, + "end": 4198, "loc": { "start": { - "line": 149, + "line": 153, "column": 3 }, "end": { - "line": 149, + "line": 153, "column": 62 } }, "delegate": true, "argument": { "type": "CallExpression", - "start": 4038, - "end": 4090, + "start": 4146, + "end": 4198, "loc": { "start": { - "line": 149, + "line": 153, "column": 10 }, "end": { - "line": 149, + "line": 153, "column": 62 } }, "callee": { "type": "Identifier", - "start": 4038, - "end": 4052, + "start": 4146, + "end": 4160, "loc": { "start": { - "line": 149, + "line": 153, "column": 10 }, "end": { - "line": 149, + "line": 153, "column": 24 }, "identifierName": "rangetraversal" @@ -5585,44 +5830,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 4053, - "end": 4065, + "start": 4161, + "end": 4173, "loc": { "start": { - "line": 149, + "line": 153, "column": 25 }, "end": { - "line": 149, + "line": 153, "column": 37 } }, "object": { "type": "ThisExpression", - "start": 4053, - "end": 4057, + "start": 4161, + "end": 4165, "loc": { "start": { - "line": 149, + "line": 153, "column": 25 }, "end": { - "line": 149, + "line": 153, "column": 29 } } }, "property": { "type": "Identifier", - "start": 4058, - "end": 4065, + "start": 4166, + "end": 4173, "loc": { "start": { - "line": 149, + "line": 153, "column": 30 }, "end": { - "line": 149, + "line": 153, "column": 37 }, "identifierName": "compare" @@ -5633,44 +5878,44 @@ }, { "type": "MemberExpression", - "start": 4067, - "end": 4076, + "start": 4175, + "end": 4184, "loc": { "start": { - "line": 149, + "line": 153, "column": 39 }, "end": { - "line": 149, + "line": 153, "column": 48 } }, "object": { "type": "ThisExpression", - "start": 4067, - "end": 4071, + "start": 4175, + "end": 4179, "loc": { "start": { - "line": 149, + "line": 153, "column": 39 }, "end": { - "line": 149, + "line": 153, "column": 43 } } }, "property": { "type": "Identifier", - "start": 4072, - "end": 4076, + "start": 4180, + "end": 4184, "loc": { "start": { - "line": 149, + "line": 153, "column": 44 }, "end": { - "line": 149, + "line": 153, "column": 48 }, "identifierName": "root" @@ -5681,15 +5926,15 @@ }, { "type": "Identifier", - "start": 4078, - "end": 4082, + "start": 4186, + "end": 4190, "loc": { "start": { - "line": 149, + "line": 153, "column": 50 }, "end": { - "line": 149, + "line": 153, "column": 54 }, "identifierName": "left" @@ -5698,15 +5943,15 @@ }, { "type": "Identifier", - "start": 4084, - "end": 4089, + "start": 4192, + "end": 4197, "loc": { "start": { - "line": 149, + "line": 153, "column": 56 }, "end": { - "line": 149, + "line": 153, "column": 61 }, "identifierName": "right" @@ -5727,15 +5972,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", - "start": 3721, - "end": 3978, + "start": 3829, + "end": 4086, "loc": { "start": { - "line": 140, + "line": 144, "column": 1 }, "end": { - "line": 146, + "line": 150, "column": 4 } } @@ -5745,15 +5990,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", - "start": 4097, - "end": 4201, + "start": 4205, + "end": 4309, "loc": { "start": { - "line": 152, + "line": 156, "column": 1 }, "end": { - "line": 156, + "line": 160, "column": 4 } } @@ -5762,15 +6007,15 @@ }, { "type": "ClassMethod", - "start": 4203, - "end": 4278, + "start": 4311, + "end": 4386, "loc": { "start": { - "line": 157, + "line": 161, "column": 1 }, "end": { - "line": 159, + "line": 163, "column": 2 } }, @@ -5779,15 +6024,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 4204, - "end": 4209, + "start": 4312, + "end": 4317, "loc": { "start": { - "line": 157, + "line": 161, "column": 2 }, "end": { - "line": 157, + "line": 161, "column": 7 }, "identifierName": "items" @@ -5802,87 +6047,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 4212, - "end": 4278, + "start": 4320, + "end": 4386, "loc": { "start": { - "line": 157, + "line": 161, "column": 10 }, "end": { - "line": 159, + "line": 163, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 4216, - "end": 4275, + "start": 4324, + "end": 4383, "loc": { "start": { - "line": 158, + "line": 162, "column": 2 }, "end": { - "line": 158, + "line": 162, "column": 61 } }, "test": { "type": "BinaryExpression", - "start": 4220, - "end": 4238, + "start": 4328, + "end": 4346, "loc": { "start": { - "line": 158, + "line": 162, "column": 6 }, "end": { - "line": 158, + "line": 162, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 4220, - "end": 4229, + "start": 4328, + "end": 4337, "loc": { "start": { - "line": 158, + "line": 162, "column": 6 }, "end": { - "line": 158, + "line": 162, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 4220, - "end": 4224, + "start": 4328, + "end": 4332, "loc": { "start": { - "line": 158, + "line": 162, "column": 6 }, "end": { - "line": 158, + "line": 162, "column": 10 } } }, "property": { "type": "Identifier", - "start": 4225, - "end": 4229, + "start": 4333, + "end": 4337, "loc": { "start": { - "line": 158, + "line": 162, "column": 11 }, "end": { - "line": 158, + "line": 162, "column": 15 }, "identifierName": "root" @@ -5894,15 +6139,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 4234, - "end": 4238, + "start": 4342, + "end": 4346, "loc": { "start": { - "line": 158, + "line": 162, "column": 20 }, "end": { - "line": 158, + "line": 162, "column": 24 } } @@ -5910,58 +6155,58 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 4240, - "end": 4275, + "start": 4348, + "end": 4383, "loc": { "start": { - "line": 158, + "line": 162, "column": 26 }, "end": { - "line": 158, + "line": 162, "column": 61 } }, "expression": { "type": "YieldExpression", - "start": 4240, - "end": 4274, + "start": 4348, + "end": 4382, "loc": { "start": { - "line": 158, + "line": 162, "column": 26 }, "end": { - "line": 158, + "line": 162, "column": 60 } }, "delegate": true, "argument": { "type": "CallExpression", - "start": 4247, - "end": 4274, + "start": 4355, + "end": 4382, "loc": { "start": { - "line": 158, + "line": 162, "column": 33 }, "end": { - "line": 158, + "line": 162, "column": 60 } }, "callee": { "type": "Identifier", - "start": 4247, - "end": 4263, + "start": 4355, + "end": 4371, "loc": { "start": { - "line": 158, + "line": 162, "column": 33 }, "end": { - "line": 158, + "line": 162, "column": 49 }, "identifierName": "inordertraversal" @@ -5971,44 +6216,44 @@ "arguments": [ { "type": "MemberExpression", - "start": 4264, - "end": 4273, + "start": 4372, + "end": 4381, "loc": { "start": { - "line": 158, + "line": 162, "column": 50 }, "end": { - "line": 158, + "line": 162, "column": 59 } }, "object": { "type": "ThisExpression", - "start": 4264, - "end": 4268, + "start": 4372, + "end": 4376, "loc": { "start": { - "line": 158, + "line": 162, "column": 50 }, "end": { - "line": 158, + "line": 162, "column": 54 } } }, "property": { "type": "Identifier", - "start": 4269, - "end": 4273, + "start": 4377, + "end": 4381, "loc": { "start": { - "line": 158, + "line": 162, "column": 55 }, "end": { - "line": 158, + "line": 162, "column": 59 }, "identifierName": "root" @@ -6031,15 +6276,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", - "start": 4097, - "end": 4201, + "start": 4205, + "end": 4309, "loc": { "start": { - "line": 152, + "line": 156, "column": 1 }, "end": { - "line": 156, + "line": 160, "column": 4 } } @@ -6049,15 +6294,15 @@ { "type": "CommentBlock", "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 4281, - "end": 4329, + "start": 4389, + "end": 4437, "loc": { "start": { - "line": 161, + "line": 165, "column": 1 }, "end": { - "line": 163, + "line": 167, "column": 4 } } @@ -6066,15 +6311,15 @@ }, { "type": "ClassMethod", - "start": 4331, - "end": 4378, + "start": 4439, + "end": 4486, "loc": { "start": { - "line": 164, + "line": 168, "column": 1 }, "end": { - "line": 166, + "line": 170, "column": 2 } }, @@ -6082,29 +6327,29 @@ "computed": true, "key": { "type": "MemberExpression", - "start": 4332, - "end": 4347, + "start": 4440, + "end": 4455, "loc": { "start": { - "line": 164, + "line": 168, "column": 2 }, "end": { - "line": 164, + "line": 168, "column": 17 } }, "object": { "type": "Identifier", - "start": 4332, - "end": 4338, + "start": 4440, + "end": 4446, "loc": { "start": { - "line": 164, + "line": 168, "column": 2 }, "end": { - "line": 164, + "line": 168, "column": 8 }, "identifierName": "Symbol" @@ -6114,15 +6359,15 @@ }, "property": { "type": "Identifier", - "start": 4339, - "end": 4347, + "start": 4447, + "end": 4455, "loc": { "start": { - "line": 164, + "line": 168, "column": 9 }, "end": { - "line": 164, + "line": 168, "column": 17 }, "identifierName": "iterator" @@ -6140,87 +6385,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 4351, - "end": 4378, + "start": 4459, + "end": 4486, "loc": { "start": { - "line": 164, + "line": 168, "column": 21 }, "end": { - "line": 166, + "line": 170, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 4355, - "end": 4375, + "start": 4463, + "end": 4483, "loc": { "start": { - "line": 165, + "line": 169, "column": 2 }, "end": { - "line": 165, + "line": 169, "column": 22 } }, "argument": { "type": "CallExpression", - "start": 4362, - "end": 4374, + "start": 4470, + "end": 4482, "loc": { "start": { - "line": 165, + "line": 169, "column": 9 }, "end": { - "line": 165, + "line": 169, "column": 21 } }, "callee": { "type": "MemberExpression", - "start": 4362, - "end": 4372, + "start": 4470, + "end": 4480, "loc": { "start": { - "line": 165, + "line": 169, "column": 9 }, "end": { - "line": 165, + "line": 169, "column": 19 } }, "object": { "type": "ThisExpression", - "start": 4362, - "end": 4366, + "start": 4470, + "end": 4474, "loc": { "start": { - "line": 165, + "line": 169, "column": 9 }, "end": { - "line": 165, + "line": 169, "column": 13 } } }, "property": { "type": "Identifier", - "start": 4367, - "end": 4372, + "start": 4475, + "end": 4480, "loc": { "start": { - "line": 165, + "line": 169, "column": 14 }, "end": { - "line": 165, + "line": 169, "column": 19 }, "identifierName": "items" @@ -6240,15 +6485,15 @@ { "type": "CommentBlock", "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 4281, - "end": 4329, + "start": 4389, + "end": 4437, "loc": { "start": { - "line": 161, + "line": 165, "column": 1 }, "end": { - "line": 163, + "line": 167, "column": 4 } } @@ -6258,15 +6503,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4381, - "end": 4525, + "start": 4489, + "end": 4633, "loc": { "start": { - "line": 168, + "line": 172, "column": 1 }, "end": { - "line": 173, + "line": 177, "column": 4 } } @@ -6275,15 +6520,15 @@ }, { "type": "ClassMethod", - "start": 4527, - "end": 4589, + "start": 4635, + "end": 4697, "loc": { "start": { - "line": 174, + "line": 178, "column": 1 }, "end": { - "line": 176, + "line": 180, "column": 2 } }, @@ -6291,15 +6536,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 4534, - "end": 4539, + "start": 4642, + "end": 4647, "loc": { "start": { - "line": 174, + "line": 178, "column": 8 }, "end": { - "line": 174, + "line": 178, "column": 13 }, "identifierName": "empty" @@ -6314,15 +6559,15 @@ "params": [ { "type": "Identifier", - "start": 4540, - "end": 4547, + "start": 4648, + "end": 4655, "loc": { "start": { - "line": 174, + "line": 178, "column": 14 }, "end": { - "line": 174, + "line": 178, "column": 21 }, "identifierName": "compare" @@ -6332,58 +6577,58 @@ ], "body": { "type": "BlockStatement", - "start": 4549, - "end": 4589, + "start": 4657, + "end": 4697, "loc": { "start": { - "line": 174, + "line": 178, "column": 23 }, "end": { - "line": 176, + "line": 180, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 4553, - "end": 4586, + "start": 4661, + "end": 4694, "loc": { "start": { - "line": 175, + "line": 179, "column": 2 }, "end": { - "line": 175, + "line": 179, "column": 35 } }, "argument": { "type": "NewExpression", - "start": 4560, - "end": 4585, + "start": 4668, + "end": 4693, "loc": { "start": { - "line": 175, + "line": 179, "column": 9 }, "end": { - "line": 175, + "line": 179, "column": 34 } }, "callee": { "type": "Identifier", - "start": 4564, - "end": 4576, + "start": 4672, + "end": 4684, "loc": { "start": { - "line": 175, + "line": 179, "column": 13 }, "end": { - "line": 175, + "line": 179, "column": 25 }, "identifierName": "RedBlackTree" @@ -6393,15 +6638,15 @@ "arguments": [ { "type": "Identifier", - "start": 4577, - "end": 4584, + "start": 4685, + "end": 4692, "loc": { "start": { - "line": 175, + "line": 179, "column": 26 }, "end": { - "line": 175, + "line": 179, "column": 33 }, "identifierName": "compare" @@ -6419,15 +6664,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4381, - "end": 4525, + "start": 4489, + "end": 4633, "loc": { "start": { - "line": 168, + "line": 172, "column": 1 }, "end": { - "line": 173, + "line": 177, "column": 4 } } @@ -6437,15 +6682,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4592, - "end": 4805, + "start": 4700, + "end": 4913, "loc": { "start": { - "line": 178, + "line": 182, "column": 1 }, "end": { - "line": 184, + "line": 188, "column": 4 } } @@ -6454,15 +6699,15 @@ }, { "type": "ClassMethod", - "start": 4807, - "end": 4954, + "start": 4915, + "end": 5062, "loc": { "start": { - "line": 185, + "line": 189, "column": 1 }, "end": { - "line": 191, + "line": 195, "column": 2 } }, @@ -6470,15 +6715,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 4814, - "end": 4818, + "start": 4922, + "end": 4926, "loc": { "start": { - "line": 185, + "line": 189, "column": 8 }, "end": { - "line": 185, + "line": 189, "column": 12 }, "identifierName": "from" @@ -6493,15 +6738,15 @@ "params": [ { "type": "Identifier", - "start": 4819, - "end": 4826, + "start": 4927, + "end": 4934, "loc": { "start": { - "line": 185, + "line": 189, "column": 13 }, "end": { - "line": 185, + "line": 189, "column": 20 }, "identifierName": "compare" @@ -6510,15 +6755,15 @@ }, { "type": "Identifier", - "start": 4828, - "end": 4836, + "start": 4936, + "end": 4944, "loc": { "start": { - "line": 185, + "line": 189, "column": 22 }, "end": { - "line": 185, + "line": 189, "column": 30 }, "identifierName": "iterable" @@ -6528,59 +6773,59 @@ ], "body": { "type": "BlockStatement", - "start": 4838, - "end": 4954, + "start": 4946, + "end": 5062, "loc": { "start": { - "line": 185, + "line": 189, "column": 32 }, "end": { - "line": 191, + "line": 195, "column": 2 } }, "body": [ { "type": "VariableDeclaration", - "start": 4842, - "end": 4881, + "start": 4950, + "end": 4989, "loc": { "start": { - "line": 186, + "line": 190, "column": 2 }, "end": { - "line": 186, + "line": 190, "column": 41 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 4848, - "end": 4880, + "start": 4956, + "end": 4988, "loc": { "start": { - "line": 186, + "line": 190, "column": 8 }, "end": { - "line": 186, + "line": 190, "column": 40 } }, "id": { "type": "Identifier", - "start": 4848, - "end": 4852, + "start": 4956, + "end": 4960, "loc": { "start": { - "line": 186, + "line": 190, "column": 8 }, "end": { - "line": 186, + "line": 190, "column": 12 }, "identifierName": "tree" @@ -6589,29 +6834,29 @@ }, "init": { "type": "NewExpression", - "start": 4855, - "end": 4880, + "start": 4963, + "end": 4988, "loc": { "start": { - "line": 186, + "line": 190, "column": 15 }, "end": { - "line": 186, + "line": 190, "column": 40 } }, "callee": { "type": "Identifier", - "start": 4859, - "end": 4871, + "start": 4967, + "end": 4979, "loc": { "start": { - "line": 186, + "line": 190, "column": 19 }, "end": { - "line": 186, + "line": 190, "column": 31 }, "identifierName": "RedBlackTree" @@ -6621,15 +6866,15 @@ "arguments": [ { "type": "Identifier", - "start": 4872, - "end": 4879, + "start": 4980, + "end": 4987, "loc": { "start": { - "line": 186, + "line": 190, "column": 32 }, "end": { - "line": 186, + "line": 190, "column": 39 }, "identifierName": "compare" @@ -6644,58 +6889,58 @@ }, { "type": "ForOfStatement", - "start": 4885, - "end": 4935, + "start": 4993, + "end": 5043, "loc": { "start": { - "line": 188, + "line": 192, "column": 2 }, "end": { - "line": 188, + "line": 192, "column": 52 } }, "left": { "type": "VariableDeclaration", - "start": 4890, - "end": 4903, + "start": 4998, + "end": 5011, "loc": { "start": { - "line": 188, + "line": 192, "column": 7 }, "end": { - "line": 188, + "line": 192, "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 4896, - "end": 4903, + "start": 5004, + "end": 5011, "loc": { "start": { - "line": 188, + "line": 192, "column": 13 }, "end": { - "line": 188, + "line": 192, "column": 20 } }, "id": { "type": "Identifier", - "start": 4896, - "end": 4903, + "start": 5004, + "end": 5011, "loc": { "start": { - "line": 188, + "line": 192, "column": 13 }, "end": { - "line": 188, + "line": 192, "column": 20 }, "identifierName": "element" @@ -6709,15 +6954,15 @@ }, "right": { "type": "Identifier", - "start": 4907, - "end": 4915, + "start": 5015, + "end": 5023, "loc": { "start": { - "line": 188, + "line": 192, "column": 24 }, "end": { - "line": 188, + "line": 192, "column": 32 }, "identifierName": "iterable" @@ -6726,57 +6971,57 @@ }, "body": { "type": "ExpressionStatement", - "start": 4917, - "end": 4935, + "start": 5025, + "end": 5043, "loc": { "start": { - "line": 188, + "line": 192, "column": 34 }, "end": { - "line": 188, + "line": 192, "column": 52 } }, "expression": { "type": "CallExpression", - "start": 4917, - "end": 4934, + "start": 5025, + "end": 5042, "loc": { "start": { - "line": 188, + "line": 192, "column": 34 }, "end": { - "line": 188, + "line": 192, "column": 51 } }, "callee": { "type": "MemberExpression", - "start": 4917, - "end": 4925, + "start": 5025, + "end": 5033, "loc": { "start": { - "line": 188, + "line": 192, "column": 34 }, "end": { - "line": 188, + "line": 192, "column": 42 } }, "object": { "type": "Identifier", - "start": 4917, - "end": 4921, + "start": 5025, + "end": 5029, "loc": { "start": { - "line": 188, + "line": 192, "column": 34 }, "end": { - "line": 188, + "line": 192, "column": 38 }, "identifierName": "tree" @@ -6785,15 +7030,15 @@ }, "property": { "type": "Identifier", - "start": 4922, - "end": 4925, + "start": 5030, + "end": 5033, "loc": { "start": { - "line": 188, + "line": 192, "column": 39 }, "end": { - "line": 188, + "line": 192, "column": 42 }, "identifierName": "add" @@ -6805,15 +7050,15 @@ "arguments": [ { "type": "Identifier", - "start": 4926, - "end": 4933, + "start": 5034, + "end": 5041, "loc": { "start": { - "line": 188, + "line": 192, "column": 43 }, "end": { - "line": 188, + "line": 192, "column": 50 }, "identifierName": "element" @@ -6826,29 +7071,29 @@ }, { "type": "ReturnStatement", - "start": 4939, - "end": 4951, + "start": 5047, + "end": 5059, "loc": { "start": { - "line": 190, + "line": 194, "column": 2 }, "end": { - "line": 190, + "line": 194, "column": 14 } }, "argument": { "type": "Identifier", - "start": 4946, - "end": 4950, + "start": 5054, + "end": 5058, "loc": { "start": { - "line": 190, + "line": 194, "column": 9 }, "end": { - "line": 190, + "line": 194, "column": 13 }, "identifierName": "tree" @@ -6863,15 +7108,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4592, - "end": 4805, + "start": 4700, + "end": 4913, "loc": { "start": { - "line": 178, + "line": 182, "column": 1 }, "end": { - "line": 184, + "line": 188, "column": 4 } } @@ -6884,15 +7129,15 @@ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 520, - "end": 569, + "start": 582, + "end": 631, "loc": { "start": { - "line": 13, + "line": 14, "column": 0 }, "end": { - "line": 16, + "line": 17, "column": 3 } } @@ -6904,15 +7149,15 @@ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 520, - "end": 569, + "start": 582, + "end": 631, "loc": { "start": { - "line": 13, + "line": 14, "column": 0 }, "end": { - "line": 16, + "line": 17, "column": 3 } } @@ -6926,15 +7171,15 @@ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 520, - "end": 569, + "start": 582, + "end": 631, "loc": { "start": { - "line": 13, + "line": 14, "column": 0 }, "end": { - "line": 16, + "line": 17, "column": 3 } } @@ -6942,15 +7187,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", - "start": 607, - "end": 733, + "start": 669, + "end": 795, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 4 } } @@ -6958,15 +7203,15 @@ { "type": "CommentBlock", "value": "* @member {Function} The comparison function for node keys. ", - "start": 760, - "end": 824, + "start": 861, + "end": 925, "loc": { "start": { - "line": 24, + "line": 26, "column": 2 }, "end": { - "line": 24, + "line": 26, "column": 66 } } @@ -6974,15 +7219,15 @@ { "type": "CommentBlock", "value": "* @member {Node} The root of the tree. ", - "start": 853, - "end": 896, + "start": 954, + "end": 997, "loc": { "start": { - "line": 26, + "line": 28, "column": 2 }, "end": { - "line": 26, + "line": 28, "column": 45 } } @@ -6990,15 +7235,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 922, - "end": 1026, + "start": 1023, + "end": 1127, "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 4 } } @@ -7006,15 +7251,15 @@ { "type": "CommentBlock", "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", - "start": 1074, - "end": 1153, + "start": 1175, + "end": 1254, "loc": { "start": { - "line": 39, + "line": 41, "column": 1 }, "end": { - "line": 43, + "line": 45, "column": 4 } } @@ -7022,15 +7267,15 @@ { "type": "CommentBlock", "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1352, - "end": 1578, + "start": 1453, + "end": 1679, "loc": { "start": { - "line": 54, + "line": 56, "column": 1 }, "end": { - "line": 61, + "line": 63, "column": 4 } } @@ -7038,31 +7283,31 @@ { "type": "CommentBlock", "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", - "start": 1686, - "end": 1948, + "start": 1787, + "end": 2049, "loc": { "start": { - "line": 67, + "line": 69, "column": 1 }, "end": { - "line": 74, + "line": 76, "column": 4 } } }, { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t ", - "start": 2042, - "end": 2197, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", + "start": 2143, + "end": 2298, "loc": { "start": { - "line": 80, + "line": 82, "column": 1 }, "end": { - "line": 86, + "line": 88, "column": 4 } } @@ -7070,15 +7315,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2252, - "end": 2357, + "start": 2353, + "end": 2458, "loc": { "start": { - "line": 91, + "line": 93, "column": 1 }, "end": { - "line": 95, + "line": 97, "column": 4 } } @@ -7086,15 +7331,15 @@ { "type": "CommentLine", "value": " Replace node's key with predecessor's key", - "start": 2407, - "end": 2451, + "start": 2539, + "end": 2583, "loc": { "start": { - "line": 98, + "line": 101, "column": 3 }, "end": { - "line": 98, + "line": 101, "column": 47 } } @@ -7102,159 +7347,127 @@ { "type": "CommentLine", "value": " Delete predecessor node", - "start": 2514, - "end": 2540, + "start": 2646, + "end": 2672, "loc": { "start": { - "line": 101, + "line": 104, "column": 3 }, "end": { - "line": 101, + "line": 104, "column": 29 } } }, { "type": "CommentLine", - "value": " note: this node can only have one non-leaf child", - "start": 2544, - "end": 2595, + "value": " NOTE: this node can only have one non-leaf (left) child because", + "start": 2676, + "end": 2742, "loc": { "start": { - "line": 102, + "line": 105, "column": 3 }, "end": { - "line": 102, - "column": 54 + "line": 105, + "column": 69 } } }, { "type": "CommentLine", - "value": " because the tree is a red-black tree", - "start": 2599, - "end": 2644, + "value": " of red-black tree invariant.", + "start": 2746, + "end": 2777, "loc": { "start": { - "line": 103, + "line": 106, "column": 3 }, "end": { - "line": 103, - "column": 48 + "line": 106, + "column": 34 } } }, { "type": "CommentLine", "value": " Replace node's key with successor's key", - "start": 2712, - "end": 2754, + "start": 2918, + "end": 2960, "loc": { "start": { - "line": 106, + "line": 113, "column": 3 }, "end": { - "line": 106, + "line": 113, "column": 45 } } }, { "type": "CommentLine", - "value": " If there is no left child, then there can only be one right", - "start": 2758, - "end": 2820, + "value": " NOTE: Since there is no left child, then there can only be one", + "start": 2964, + "end": 3029, "loc": { "start": { - "line": 107, + "line": 114, "column": 3 }, "end": { - "line": 107, - "column": 65 + "line": 114, + "column": 68 } } }, { "type": "CommentLine", - "value": " child.", - "start": 2824, - "end": 2833, + "value": " right child by the red-black tree invariant.", + "start": 3033, + "end": 3080, "loc": { "start": { - "line": 108, + "line": 115, "column": 3 }, "end": { - "line": 108, - "column": 12 + "line": 115, + "column": 50 } } }, { "type": "CommentLine", "value": " Delete successor node", - "start": 2922, - "end": 2946, + "start": 3136, + "end": 3160, "loc": { "start": { - "line": 112, + "line": 118, "column": 3 }, "end": { - "line": 112, + "line": 118, "column": 27 } } }, - { - "type": "CommentLine", - "value": " note: this node can only have one non-leaf child", - "start": 2950, - "end": 3001, - "loc": { - "start": { - "line": 113, - "column": 3 - }, - "end": { - "line": 113, - "column": 54 - } - } - }, - { - "type": "CommentLine", - "value": " because the tree is a red-black tree", - "start": 3005, - "end": 3050, - "loc": { - "start": { - "line": 114, - "column": 3 - }, - "end": { - "line": 114, - "column": 48 - } - } - }, { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 3181, - "end": 3593, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 3289, + "end": 3701, "loc": { "start": { - "line": 123, + "line": 127, "column": 1 }, "end": { - "line": 131, + "line": 135, "column": 4 } } @@ -7262,15 +7475,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", - "start": 3721, - "end": 3978, + "start": 3829, + "end": 4086, "loc": { "start": { - "line": 140, + "line": 144, "column": 1 }, "end": { - "line": 146, + "line": 150, "column": 4 } } @@ -7278,15 +7491,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", - "start": 4097, - "end": 4201, + "start": 4205, + "end": 4309, "loc": { "start": { - "line": 152, + "line": 156, "column": 1 }, "end": { - "line": 156, + "line": 160, "column": 4 } } @@ -7294,15 +7507,15 @@ { "type": "CommentBlock", "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 4281, - "end": 4329, + "start": 4389, + "end": 4437, "loc": { "start": { - "line": 161, + "line": 165, "column": 1 }, "end": { - "line": 163, + "line": 167, "column": 4 } } @@ -7310,15 +7523,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4381, - "end": 4525, + "start": 4489, + "end": 4633, "loc": { "start": { - "line": 168, + "line": 172, "column": 1 }, "end": { - "line": 173, + "line": 177, "column": 4 } } @@ -7326,15 +7539,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4592, - "end": 4805, + "start": 4700, + "end": 4913, "loc": { "start": { - "line": 178, + "line": 182, "column": 1 }, "end": { - "line": 184, + "line": 188, "column": 4 } } @@ -8179,7 +8392,7 @@ "postfix": false, "binop": null }, - "value": "insert_case2", + "value": "insert_case1", "start": 237, "end": 249, "loc": { @@ -8232,7 +8445,7 @@ "binop": null, "updateContext": null }, - "value": "../insertion/insert_case2.js", + "value": "../insertion/insert_case1.js", "start": 255, "end": 285, "loc": { @@ -8420,15 +8633,148 @@ "updateContext": null }, "value": "import", - "start": 351, - "end": 357, + "start": 351, + "end": 357, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_no_child", + "start": 358, + "end": 373, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 374, + "end": 378, + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../deletion/delete_no_child.js", + "start": 379, + "end": 411, + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 60 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 411, + "end": 412, + "loc": { + "start": { + "line": 9, + "column": 60 + }, + "end": { + "line": 9, + "column": 61 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 413, + "end": 419, "loc": { "start": { - "line": 9, + "line": 10, "column": 0 }, "end": { - "line": 9, + "line": 10, "column": 6 } } @@ -8446,15 +8792,15 @@ "binop": null }, "value": "search", - "start": 358, - "end": 364, + "start": 420, + "end": 426, "loc": { "start": { - "line": 9, + "line": 10, "column": 7 }, "end": { - "line": 9, + "line": 10, "column": 13 } } @@ -8472,15 +8818,15 @@ "binop": null }, "value": "from", - "start": 365, - "end": 369, + "start": 427, + "end": 431, "loc": { "start": { - "line": 9, + "line": 10, "column": 14 }, "end": { - "line": 9, + "line": 10, "column": 18 } } @@ -8499,15 +8845,15 @@ "updateContext": null }, "value": "../search/search.js", - "start": 370, - "end": 391, + "start": 432, + "end": 453, "loc": { "start": { - "line": 9, + "line": 10, "column": 19 }, "end": { - "line": 9, + "line": 10, "column": 40 } } @@ -8525,15 +8871,15 @@ "binop": null, "updateContext": null }, - "start": 391, - "end": 392, + "start": 453, + "end": 454, "loc": { "start": { - "line": 9, + "line": 10, "column": 40 }, "end": { - "line": 9, + "line": 10, "column": 41 } } @@ -8553,15 +8899,15 @@ "updateContext": null }, "value": "import", - "start": 393, - "end": 399, + "start": 455, + "end": 461, "loc": { "start": { - "line": 10, + "line": 11, "column": 0 }, "end": { - "line": 10, + "line": 11, "column": 6 } } @@ -8579,15 +8925,15 @@ "binop": null }, "value": "inordertraversal", - "start": 400, - "end": 416, + "start": 462, + "end": 478, "loc": { "start": { - "line": 10, + "line": 11, "column": 7 }, "end": { - "line": 10, + "line": 11, "column": 23 } } @@ -8605,15 +8951,15 @@ "binop": null }, "value": "from", - "start": 417, - "end": 421, + "start": 479, + "end": 483, "loc": { "start": { - "line": 10, + "line": 11, "column": 24 }, "end": { - "line": 10, + "line": 11, "column": 28 } } @@ -8632,15 +8978,15 @@ "updateContext": null }, "value": "../traversal/inordertraversal.js", - "start": 422, - "end": 456, + "start": 484, + "end": 518, "loc": { "start": { - "line": 10, + "line": 11, "column": 29 }, "end": { - "line": 10, + "line": 11, "column": 63 } } @@ -8658,15 +9004,15 @@ "binop": null, "updateContext": null }, - "start": 456, - "end": 457, + "start": 518, + "end": 519, "loc": { "start": { - "line": 10, + "line": 11, "column": 63 }, "end": { - "line": 10, + "line": 11, "column": 64 } } @@ -8686,15 +9032,15 @@ "updateContext": null }, "value": "import", - "start": 458, - "end": 464, + "start": 520, + "end": 526, "loc": { "start": { - "line": 11, + "line": 12, "column": 0 }, "end": { - "line": 11, + "line": 12, "column": 6 } } @@ -8712,15 +9058,15 @@ "binop": null }, "value": "rangetraversal", - "start": 465, - "end": 479, + "start": 527, + "end": 541, "loc": { "start": { - "line": 11, + "line": 12, "column": 7 }, "end": { - "line": 11, + "line": 12, "column": 21 } } @@ -8738,15 +9084,15 @@ "binop": null }, "value": "from", - "start": 480, - "end": 484, + "start": 542, + "end": 546, "loc": { "start": { - "line": 11, + "line": 12, "column": 22 }, "end": { - "line": 11, + "line": 12, "column": 26 } } @@ -8765,15 +9111,15 @@ "updateContext": null }, "value": "../traversal/rangetraversal.js", - "start": 485, - "end": 517, + "start": 547, + "end": 579, "loc": { "start": { - "line": 11, + "line": 12, "column": 27 }, "end": { - "line": 11, + "line": 12, "column": 59 } } @@ -8791,15 +9137,15 @@ "binop": null, "updateContext": null }, - "start": 517, - "end": 518, + "start": 579, + "end": 580, "loc": { "start": { - "line": 11, + "line": 12, "column": 59 }, "end": { - "line": 11, + "line": 12, "column": 60 } } @@ -8807,15 +9153,15 @@ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 520, - "end": 569, + "start": 582, + "end": 631, "loc": { "start": { - "line": 13, + "line": 14, "column": 0 }, "end": { - "line": 16, + "line": 17, "column": 3 } } @@ -8835,15 +9181,15 @@ "updateContext": null }, "value": "export", - "start": 570, - "end": 576, + "start": 632, + "end": 638, "loc": { "start": { - "line": 17, + "line": 18, "column": 0 }, "end": { - "line": 17, + "line": 18, "column": 6 } } @@ -8863,15 +9209,15 @@ "updateContext": null }, "value": "default", - "start": 577, - "end": 584, + "start": 639, + "end": 646, "loc": { "start": { - "line": 17, + "line": 18, "column": 7 }, "end": { - "line": 17, + "line": 18, "column": 14 } } @@ -8891,15 +9237,15 @@ "updateContext": null }, "value": "class", - "start": 585, - "end": 590, + "start": 647, + "end": 652, "loc": { "start": { - "line": 17, + "line": 18, "column": 15 }, "end": { - "line": 17, + "line": 18, "column": 20 } } @@ -8917,15 +9263,15 @@ "binop": null }, "value": "RedBlackTree", - "start": 591, - "end": 603, + "start": 653, + "end": 665, "loc": { "start": { - "line": 17, + "line": 18, "column": 21 }, "end": { - "line": 17, + "line": 18, "column": 33 } } @@ -8942,15 +9288,15 @@ "postfix": false, "binop": null }, - "start": 604, - "end": 605, + "start": 666, + "end": 667, "loc": { "start": { - "line": 17, + "line": 18, "column": 34 }, "end": { - "line": 17, + "line": 18, "column": 35 } } @@ -8958,15 +9304,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", - "start": 607, - "end": 733, + "start": 669, + "end": 795, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 4 } } @@ -8984,15 +9330,15 @@ "binop": null }, "value": "constructor", - "start": 735, - "end": 746, + "start": 797, + "end": 808, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 12 } } @@ -9009,15 +9355,15 @@ "postfix": false, "binop": null }, - "start": 746, - "end": 747, + "start": 808, + "end": 809, "loc": { "start": { - "line": 23, + "line": 24, "column": 12 }, "end": { - "line": 23, + "line": 24, "column": 13 } } @@ -9035,16 +9381,197 @@ "binop": null }, "value": "compare", - "start": 747, - "end": 754, + "start": 809, + "end": 816, "loc": { "start": { - "line": 23, + "line": 24, "column": 13 }, "end": { - "line": 23, + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 816, + "end": 817, + "loc": { + "start": { + "line": 24, "column": 20 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 818, + "end": 819, + "loc": { + "start": { + "line": 24, + "column": 22 + }, + "end": { + "line": 24, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 822, + "end": 828, + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 828, + "end": 829, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 829, + "end": 836, + "loc": { + "start": { + "line": 25, + "column": 9 + }, + "end": { + "line": 25, + "column": 16 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 837, + "end": 847, + "loc": { + "start": { + "line": 25, + "column": 17 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Function", + "start": 848, + "end": 856, + "loc": { + "start": { + "line": 25, + "column": 28 + }, + "end": { + "line": 25, + "column": 36 } } }, @@ -9060,56 +9587,57 @@ "postfix": false, "binop": null }, - "start": 754, - "end": 755, + "start": 856, + "end": 857, "loc": { "start": { - "line": 23, - "column": 20 + "line": 25, + "column": 36 }, "end": { - "line": 23, - "column": 21 + "line": 25, + "column": 37 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 756, - "end": 757, + "start": 857, + "end": 858, "loc": { "start": { - "line": 23, - "column": 22 + "line": 25, + "column": 37 }, "end": { - "line": 23, - "column": 23 + "line": 25, + "column": 38 } } }, { "type": "CommentBlock", "value": "* @member {Function} The comparison function for node keys. ", - "start": 760, - "end": 824, + "start": 861, + "end": 925, "loc": { "start": { - "line": 24, + "line": 26, "column": 2 }, "end": { - "line": 24, + "line": 26, "column": 66 } } @@ -9129,15 +9657,15 @@ "updateContext": null }, "value": "this", - "start": 827, - "end": 831, + "start": 928, + "end": 932, "loc": { "start": { - "line": 25, + "line": 27, "column": 2 }, "end": { - "line": 25, + "line": 27, "column": 6 } } @@ -9155,15 +9683,15 @@ "binop": null, "updateContext": null }, - "start": 831, - "end": 832, + "start": 932, + "end": 933, "loc": { "start": { - "line": 25, + "line": 27, "column": 6 }, "end": { - "line": 25, + "line": 27, "column": 7 } } @@ -9181,15 +9709,15 @@ "binop": null }, "value": "compare", - "start": 832, - "end": 839, + "start": 933, + "end": 940, "loc": { "start": { - "line": 25, + "line": 27, "column": 7 }, "end": { - "line": 25, + "line": 27, "column": 14 } } @@ -9208,15 +9736,15 @@ "updateContext": null }, "value": "=", - "start": 840, - "end": 841, + "start": 941, + "end": 942, "loc": { "start": { - "line": 25, + "line": 27, "column": 15 }, "end": { - "line": 25, + "line": 27, "column": 16 } } @@ -9234,15 +9762,15 @@ "binop": null }, "value": "compare", - "start": 842, - "end": 849, + "start": 943, + "end": 950, "loc": { "start": { - "line": 25, + "line": 27, "column": 17 }, "end": { - "line": 25, + "line": 27, "column": 24 } } @@ -9260,15 +9788,15 @@ "binop": null, "updateContext": null }, - "start": 849, - "end": 850, + "start": 950, + "end": 951, "loc": { "start": { - "line": 25, + "line": 27, "column": 24 }, "end": { - "line": 25, + "line": 27, "column": 25 } } @@ -9276,15 +9804,15 @@ { "type": "CommentBlock", "value": "* @member {Node} The root of the tree. ", - "start": 853, - "end": 896, + "start": 954, + "end": 997, "loc": { "start": { - "line": 26, + "line": 28, "column": 2 }, "end": { - "line": 26, + "line": 28, "column": 45 } } @@ -9304,15 +9832,15 @@ "updateContext": null }, "value": "this", - "start": 899, - "end": 903, + "start": 1000, + "end": 1004, "loc": { "start": { - "line": 27, + "line": 29, "column": 2 }, "end": { - "line": 27, + "line": 29, "column": 6 } } @@ -9330,15 +9858,15 @@ "binop": null, "updateContext": null }, - "start": 903, - "end": 904, + "start": 1004, + "end": 1005, "loc": { "start": { - "line": 27, + "line": 29, "column": 6 }, "end": { - "line": 27, + "line": 29, "column": 7 } } @@ -9356,15 +9884,15 @@ "binop": null }, "value": "root", - "start": 904, - "end": 908, + "start": 1005, + "end": 1009, "loc": { "start": { - "line": 27, + "line": 29, "column": 7 }, "end": { - "line": 27, + "line": 29, "column": 11 } } @@ -9383,15 +9911,15 @@ "updateContext": null }, "value": "=", - "start": 909, - "end": 910, + "start": 1010, + "end": 1011, "loc": { "start": { - "line": 27, + "line": 29, "column": 12 }, "end": { - "line": 27, + "line": 29, "column": 13 } } @@ -9411,15 +9939,15 @@ "updateContext": null }, "value": "null", - "start": 911, - "end": 915, + "start": 1012, + "end": 1016, "loc": { "start": { - "line": 27, + "line": 29, "column": 14 }, "end": { - "line": 27, + "line": 29, "column": 18 } } @@ -9437,15 +9965,15 @@ "binop": null, "updateContext": null }, - "start": 915, - "end": 916, + "start": 1016, + "end": 1017, "loc": { "start": { - "line": 27, + "line": 29, "column": 18 }, "end": { - "line": 27, + "line": 29, "column": 19 } } @@ -9462,15 +9990,15 @@ "postfix": false, "binop": null }, - "start": 918, - "end": 919, + "start": 1019, + "end": 1020, "loc": { "start": { - "line": 28, + "line": 30, "column": 1 }, "end": { - "line": 28, + "line": 30, "column": 2 } } @@ -9478,15 +10006,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 922, - "end": 1026, + "start": 1023, + "end": 1127, "loc": { "start": { - "line": 30, + "line": 32, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 4 } } @@ -9504,15 +10032,15 @@ "binop": null }, "value": "isEmpty", - "start": 1028, - "end": 1035, + "start": 1129, + "end": 1136, "loc": { "start": { - "line": 35, + "line": 37, "column": 1 }, "end": { - "line": 35, + "line": 37, "column": 8 } } @@ -9529,15 +10057,15 @@ "postfix": false, "binop": null }, - "start": 1035, - "end": 1036, + "start": 1136, + "end": 1137, "loc": { "start": { - "line": 35, + "line": 37, "column": 8 }, "end": { - "line": 35, + "line": 37, "column": 9 } } @@ -9554,15 +10082,15 @@ "postfix": false, "binop": null }, - "start": 1036, - "end": 1037, + "start": 1137, + "end": 1138, "loc": { "start": { - "line": 35, + "line": 37, "column": 9 }, "end": { - "line": 35, + "line": 37, "column": 10 } } @@ -9579,15 +10107,15 @@ "postfix": false, "binop": null }, - "start": 1038, - "end": 1039, + "start": 1139, + "end": 1140, "loc": { "start": { - "line": 35, + "line": 37, "column": 11 }, "end": { - "line": 35, + "line": 37, "column": 12 } } @@ -9607,15 +10135,15 @@ "updateContext": null }, "value": "return", - "start": 1042, - "end": 1048, + "start": 1143, + "end": 1149, "loc": { "start": { - "line": 36, + "line": 38, "column": 2 }, "end": { - "line": 36, + "line": 38, "column": 8 } } @@ -9635,15 +10163,15 @@ "updateContext": null }, "value": "this", - "start": 1049, - "end": 1053, + "start": 1150, + "end": 1154, "loc": { "start": { - "line": 36, + "line": 38, "column": 9 }, "end": { - "line": 36, + "line": 38, "column": 13 } } @@ -9661,15 +10189,15 @@ "binop": null, "updateContext": null }, - "start": 1053, - "end": 1054, + "start": 1154, + "end": 1155, "loc": { "start": { - "line": 36, + "line": 38, "column": 13 }, "end": { - "line": 36, + "line": 38, "column": 14 } } @@ -9687,15 +10215,15 @@ "binop": null }, "value": "root", - "start": 1054, - "end": 1058, + "start": 1155, + "end": 1159, "loc": { "start": { - "line": 36, + "line": 38, "column": 14 }, "end": { - "line": 36, + "line": 38, "column": 18 } } @@ -9714,15 +10242,15 @@ "updateContext": null }, "value": "===", - "start": 1059, - "end": 1062, + "start": 1160, + "end": 1163, "loc": { "start": { - "line": 36, + "line": 38, "column": 19 }, "end": { - "line": 36, + "line": 38, "column": 22 } } @@ -9742,15 +10270,15 @@ "updateContext": null }, "value": "null", - "start": 1063, - "end": 1067, + "start": 1164, + "end": 1168, "loc": { "start": { - "line": 36, + "line": 38, "column": 23 }, "end": { - "line": 36, + "line": 38, "column": 27 } } @@ -9768,15 +10296,15 @@ "binop": null, "updateContext": null }, - "start": 1067, - "end": 1068, + "start": 1168, + "end": 1169, "loc": { "start": { - "line": 36, + "line": 38, "column": 27 }, "end": { - "line": 36, + "line": 38, "column": 28 } } @@ -9793,15 +10321,15 @@ "postfix": false, "binop": null }, - "start": 1070, - "end": 1071, + "start": 1171, + "end": 1172, "loc": { "start": { - "line": 37, + "line": 39, "column": 1 }, "end": { - "line": 37, + "line": 39, "column": 2 } } @@ -9809,15 +10337,15 @@ { "type": "CommentBlock", "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", - "start": 1074, - "end": 1153, + "start": 1175, + "end": 1254, "loc": { "start": { - "line": 39, + "line": 41, "column": 1 }, "end": { - "line": 43, + "line": 45, "column": 4 } } @@ -9835,15 +10363,15 @@ "binop": null }, "value": "add", - "start": 1155, - "end": 1158, + "start": 1256, + "end": 1259, "loc": { "start": { - "line": 44, + "line": 46, "column": 1 }, "end": { - "line": 44, + "line": 46, "column": 4 } } @@ -9860,15 +10388,15 @@ "postfix": false, "binop": null }, - "start": 1158, - "end": 1159, + "start": 1259, + "end": 1260, "loc": { "start": { - "line": 44, + "line": 46, "column": 4 }, "end": { - "line": 44, + "line": 46, "column": 5 } } @@ -9886,15 +10414,15 @@ "binop": null }, "value": "key", - "start": 1159, - "end": 1162, + "start": 1260, + "end": 1263, "loc": { "start": { - "line": 44, + "line": 46, "column": 5 }, "end": { - "line": 44, + "line": 46, "column": 8 } } @@ -9911,15 +10439,15 @@ "postfix": false, "binop": null }, - "start": 1162, - "end": 1163, + "start": 1263, + "end": 1264, "loc": { "start": { - "line": 44, + "line": 46, "column": 8 }, "end": { - "line": 44, + "line": 46, "column": 9 } } @@ -9936,15 +10464,15 @@ "postfix": false, "binop": null }, - "start": 1164, - "end": 1165, + "start": 1265, + "end": 1266, "loc": { "start": { - "line": 44, + "line": 46, "column": 10 }, "end": { - "line": 44, + "line": 46, "column": 11 } } @@ -9964,15 +10492,15 @@ "updateContext": null }, "value": "if", - "start": 1168, - "end": 1170, + "start": 1269, + "end": 1271, "loc": { "start": { - "line": 45, + "line": 47, "column": 2 }, "end": { - "line": 45, + "line": 47, "column": 4 } } @@ -9989,15 +10517,15 @@ "postfix": false, "binop": null }, - "start": 1171, - "end": 1172, + "start": 1272, + "end": 1273, "loc": { "start": { - "line": 45, + "line": 47, "column": 5 }, "end": { - "line": 45, + "line": 47, "column": 6 } } @@ -10017,15 +10545,15 @@ "updateContext": null }, "value": "this", - "start": 1172, - "end": 1176, + "start": 1273, + "end": 1277, "loc": { "start": { - "line": 45, + "line": 47, "column": 6 }, "end": { - "line": 45, + "line": 47, "column": 10 } } @@ -10043,15 +10571,15 @@ "binop": null, "updateContext": null }, - "start": 1176, - "end": 1177, + "start": 1277, + "end": 1278, "loc": { "start": { - "line": 45, + "line": 47, "column": 10 }, "end": { - "line": 45, + "line": 47, "column": 11 } } @@ -10069,15 +10597,15 @@ "binop": null }, "value": "root", - "start": 1177, - "end": 1181, + "start": 1278, + "end": 1282, "loc": { "start": { - "line": 45, + "line": 47, "column": 11 }, "end": { - "line": 45, + "line": 47, "column": 15 } } @@ -10096,15 +10624,15 @@ "updateContext": null }, "value": "===", - "start": 1182, - "end": 1185, + "start": 1283, + "end": 1286, "loc": { "start": { - "line": 45, + "line": 47, "column": 16 }, "end": { - "line": 45, + "line": 47, "column": 19 } } @@ -10124,15 +10652,15 @@ "updateContext": null }, "value": "null", - "start": 1186, - "end": 1190, + "start": 1287, + "end": 1291, "loc": { "start": { - "line": 45, + "line": 47, "column": 20 }, "end": { - "line": 45, + "line": 47, "column": 24 } } @@ -10149,15 +10677,15 @@ "postfix": false, "binop": null }, - "start": 1190, - "end": 1191, + "start": 1291, + "end": 1292, "loc": { "start": { - "line": 45, + "line": 47, "column": 24 }, "end": { - "line": 45, + "line": 47, "column": 25 } } @@ -10174,15 +10702,15 @@ "postfix": false, "binop": null }, - "start": 1192, - "end": 1193, + "start": 1293, + "end": 1294, "loc": { "start": { - "line": 45, + "line": 47, "column": 26 }, "end": { - "line": 45, + "line": 47, "column": 27 } } @@ -10202,15 +10730,15 @@ "updateContext": null }, "value": "this", - "start": 1197, - "end": 1201, + "start": 1298, + "end": 1302, "loc": { "start": { - "line": 46, + "line": 48, "column": 3 }, "end": { - "line": 46, + "line": 48, "column": 7 } } @@ -10228,15 +10756,15 @@ "binop": null, "updateContext": null }, - "start": 1201, - "end": 1202, + "start": 1302, + "end": 1303, "loc": { "start": { - "line": 46, + "line": 48, "column": 7 }, "end": { - "line": 46, + "line": 48, "column": 8 } } @@ -10254,15 +10782,15 @@ "binop": null }, "value": "root", - "start": 1202, - "end": 1206, + "start": 1303, + "end": 1307, "loc": { "start": { - "line": 46, + "line": 48, "column": 8 }, "end": { - "line": 46, + "line": 48, "column": 12 } } @@ -10281,15 +10809,15 @@ "updateContext": null }, "value": "=", - "start": 1207, - "end": 1208, + "start": 1308, + "end": 1309, "loc": { "start": { - "line": 46, + "line": 48, "column": 13 }, "end": { - "line": 46, + "line": 48, "column": 14 } } @@ -10309,15 +10837,15 @@ "updateContext": null }, "value": "new", - "start": 1209, - "end": 1212, + "start": 1310, + "end": 1313, "loc": { "start": { - "line": 46, + "line": 48, "column": 15 }, "end": { - "line": 46, + "line": 48, "column": 18 } } @@ -10335,15 +10863,15 @@ "binop": null }, "value": "Node", - "start": 1213, - "end": 1217, + "start": 1314, + "end": 1318, "loc": { "start": { - "line": 46, + "line": 48, "column": 19 }, "end": { - "line": 46, + "line": 48, "column": 23 } } @@ -10360,15 +10888,15 @@ "postfix": false, "binop": null }, - "start": 1217, - "end": 1218, + "start": 1318, + "end": 1319, "loc": { "start": { - "line": 46, + "line": 48, "column": 23 }, "end": { - "line": 46, + "line": 48, "column": 24 } } @@ -10386,15 +10914,15 @@ "binop": null }, "value": "BLACK", - "start": 1218, - "end": 1223, + "start": 1319, + "end": 1324, "loc": { "start": { - "line": 46, + "line": 48, "column": 24 }, "end": { - "line": 46, + "line": 48, "column": 29 } } @@ -10412,15 +10940,15 @@ "binop": null, "updateContext": null }, - "start": 1223, - "end": 1224, + "start": 1324, + "end": 1325, "loc": { "start": { - "line": 46, + "line": 48, "column": 29 }, "end": { - "line": 46, + "line": 48, "column": 30 } } @@ -10438,15 +10966,15 @@ "binop": null }, "value": "key", - "start": 1225, - "end": 1228, + "start": 1326, + "end": 1329, "loc": { "start": { - "line": 46, + "line": 48, "column": 31 }, "end": { - "line": 46, + "line": 48, "column": 34 } } @@ -10463,15 +10991,15 @@ "postfix": false, "binop": null }, - "start": 1228, - "end": 1229, + "start": 1329, + "end": 1330, "loc": { "start": { - "line": 46, + "line": 48, "column": 34 }, "end": { - "line": 46, + "line": 48, "column": 35 } } @@ -10489,15 +11017,15 @@ "binop": null, "updateContext": null }, - "start": 1229, - "end": 1230, + "start": 1330, + "end": 1331, "loc": { "start": { - "line": 46, + "line": 48, "column": 35 }, "end": { - "line": 46, + "line": 48, "column": 36 } } @@ -10514,15 +11042,15 @@ "postfix": false, "binop": null }, - "start": 1233, - "end": 1234, + "start": 1334, + "end": 1335, "loc": { "start": { - "line": 47, + "line": 49, "column": 2 }, "end": { - "line": 47, + "line": 49, "column": 3 } } @@ -10542,15 +11070,15 @@ "updateContext": null }, "value": "else", - "start": 1235, - "end": 1239, + "start": 1336, + "end": 1340, "loc": { "start": { - "line": 47, + "line": 49, "column": 4 }, "end": { - "line": 47, + "line": 49, "column": 8 } } @@ -10567,15 +11095,15 @@ "postfix": false, "binop": null }, - "start": 1240, - "end": 1241, + "start": 1341, + "end": 1342, "loc": { "start": { - "line": 47, + "line": 49, "column": 9 }, "end": { - "line": 47, + "line": 49, "column": 10 } } @@ -10595,15 +11123,15 @@ "updateContext": null }, "value": "const", - "start": 1245, - "end": 1250, + "start": 1346, + "end": 1351, "loc": { "start": { - "line": 48, + "line": 50, "column": 3 }, "end": { - "line": 48, + "line": 50, "column": 8 } } @@ -10621,15 +11149,15 @@ "binop": null }, "value": "node", - "start": 1251, - "end": 1255, + "start": 1352, + "end": 1356, "loc": { "start": { - "line": 48, + "line": 50, "column": 9 }, "end": { - "line": 48, + "line": 50, "column": 13 } } @@ -10648,15 +11176,15 @@ "updateContext": null }, "value": "=", - "start": 1256, - "end": 1257, + "start": 1357, + "end": 1358, "loc": { "start": { - "line": 48, + "line": 50, "column": 14 }, "end": { - "line": 48, + "line": 50, "column": 15 } } @@ -10676,15 +11204,15 @@ "updateContext": null }, "value": "new", - "start": 1258, - "end": 1261, + "start": 1359, + "end": 1362, "loc": { "start": { - "line": 48, + "line": 50, "column": 16 }, "end": { - "line": 48, + "line": 50, "column": 19 } } @@ -10702,15 +11230,15 @@ "binop": null }, "value": "Node", - "start": 1262, - "end": 1266, + "start": 1363, + "end": 1367, "loc": { "start": { - "line": 48, + "line": 50, "column": 20 }, "end": { - "line": 48, + "line": 50, "column": 24 } } @@ -10727,15 +11255,15 @@ "postfix": false, "binop": null }, - "start": 1266, - "end": 1267, + "start": 1367, + "end": 1368, "loc": { "start": { - "line": 48, + "line": 50, "column": 24 }, "end": { - "line": 48, + "line": 50, "column": 25 } } @@ -10753,15 +11281,15 @@ "binop": null }, "value": "RED", - "start": 1267, - "end": 1270, + "start": 1368, + "end": 1371, "loc": { "start": { - "line": 48, + "line": 50, "column": 25 }, "end": { - "line": 48, + "line": 50, "column": 28 } } @@ -10779,15 +11307,15 @@ "binop": null, "updateContext": null }, - "start": 1270, - "end": 1271, + "start": 1371, + "end": 1372, "loc": { "start": { - "line": 48, + "line": 50, "column": 28 }, "end": { - "line": 48, + "line": 50, "column": 29 } } @@ -10805,15 +11333,15 @@ "binop": null }, "value": "key", - "start": 1272, - "end": 1275, + "start": 1373, + "end": 1376, "loc": { "start": { - "line": 48, + "line": 50, "column": 30 }, "end": { - "line": 48, + "line": 50, "column": 33 } } @@ -10830,15 +11358,15 @@ "postfix": false, "binop": null }, - "start": 1275, - "end": 1276, + "start": 1376, + "end": 1377, "loc": { "start": { - "line": 48, + "line": 50, "column": 33 }, "end": { - "line": 48, + "line": 50, "column": 34 } } @@ -10856,15 +11384,15 @@ "binop": null, "updateContext": null }, - "start": 1276, - "end": 1277, + "start": 1377, + "end": 1378, "loc": { "start": { - "line": 48, + "line": 50, "column": 34 }, "end": { - "line": 48, + "line": 50, "column": 35 } } @@ -10882,15 +11410,15 @@ "binop": null }, "value": "insert", - "start": 1281, - "end": 1287, + "start": 1382, + "end": 1388, "loc": { "start": { - "line": 49, + "line": 51, "column": 3 }, "end": { - "line": 49, + "line": 51, "column": 9 } } @@ -10907,15 +11435,15 @@ "postfix": false, "binop": null }, - "start": 1287, - "end": 1288, + "start": 1388, + "end": 1389, "loc": { "start": { - "line": 49, + "line": 51, "column": 9 }, "end": { - "line": 49, + "line": 51, "column": 10 } } @@ -10935,15 +11463,15 @@ "updateContext": null }, "value": "this", - "start": 1288, - "end": 1292, + "start": 1389, + "end": 1393, "loc": { "start": { - "line": 49, + "line": 51, "column": 10 }, "end": { - "line": 49, + "line": 51, "column": 14 } } @@ -10961,15 +11489,15 @@ "binop": null, "updateContext": null }, - "start": 1292, - "end": 1293, + "start": 1393, + "end": 1394, "loc": { "start": { - "line": 49, + "line": 51, "column": 14 }, "end": { - "line": 49, + "line": 51, "column": 15 } } @@ -10987,15 +11515,15 @@ "binop": null }, "value": "compare", - "start": 1293, - "end": 1300, + "start": 1394, + "end": 1401, "loc": { "start": { - "line": 49, + "line": 51, "column": 15 }, "end": { - "line": 49, + "line": 51, "column": 22 } } @@ -11013,15 +11541,15 @@ "binop": null, "updateContext": null }, - "start": 1300, - "end": 1301, + "start": 1401, + "end": 1402, "loc": { "start": { - "line": 49, + "line": 51, "column": 22 }, "end": { - "line": 49, + "line": 51, "column": 23 } } @@ -11041,15 +11569,15 @@ "updateContext": null }, "value": "this", - "start": 1302, - "end": 1306, + "start": 1403, + "end": 1407, "loc": { "start": { - "line": 49, + "line": 51, "column": 24 }, "end": { - "line": 49, + "line": 51, "column": 28 } } @@ -11067,15 +11595,15 @@ "binop": null, "updateContext": null }, - "start": 1306, - "end": 1307, + "start": 1407, + "end": 1408, "loc": { "start": { - "line": 49, + "line": 51, "column": 28 }, "end": { - "line": 49, + "line": 51, "column": 29 } } @@ -11093,15 +11621,15 @@ "binop": null }, "value": "root", - "start": 1307, - "end": 1311, + "start": 1408, + "end": 1412, "loc": { "start": { - "line": 49, + "line": 51, "column": 29 }, "end": { - "line": 49, + "line": 51, "column": 33 } } @@ -11119,15 +11647,15 @@ "binop": null, "updateContext": null }, - "start": 1311, - "end": 1312, + "start": 1412, + "end": 1413, "loc": { "start": { - "line": 49, + "line": 51, "column": 33 }, "end": { - "line": 49, + "line": 51, "column": 34 } } @@ -11145,15 +11673,15 @@ "binop": null }, "value": "node", - "start": 1313, - "end": 1317, + "start": 1414, + "end": 1418, "loc": { "start": { - "line": 49, + "line": 51, "column": 35 }, "end": { - "line": 49, + "line": 51, "column": 39 } } @@ -11170,15 +11698,15 @@ "postfix": false, "binop": null }, - "start": 1317, - "end": 1318, + "start": 1418, + "end": 1419, "loc": { "start": { - "line": 49, + "line": 51, "column": 39 }, "end": { - "line": 49, + "line": 51, "column": 40 } } @@ -11196,15 +11724,15 @@ "binop": null, "updateContext": null }, - "start": 1318, - "end": 1319, + "start": 1419, + "end": 1420, "loc": { "start": { - "line": 49, + "line": 51, "column": 40 }, "end": { - "line": 49, + "line": 51, "column": 41 } } @@ -11221,16 +11749,16 @@ "postfix": false, "binop": null }, - "value": "insert_case2", - "start": 1323, - "end": 1335, + "value": "insert_case1", + "start": 1424, + "end": 1436, "loc": { "start": { - "line": 50, + "line": 52, "column": 3 }, "end": { - "line": 50, + "line": 52, "column": 15 } } @@ -11247,15 +11775,15 @@ "postfix": false, "binop": null }, - "start": 1335, - "end": 1336, + "start": 1436, + "end": 1437, "loc": { "start": { - "line": 50, + "line": 52, "column": 15 }, "end": { - "line": 50, + "line": 52, "column": 16 } } @@ -11273,15 +11801,15 @@ "binop": null }, "value": "node", - "start": 1336, - "end": 1340, + "start": 1437, + "end": 1441, "loc": { "start": { - "line": 50, + "line": 52, "column": 16 }, "end": { - "line": 50, + "line": 52, "column": 20 } } @@ -11298,15 +11826,15 @@ "postfix": false, "binop": null }, - "start": 1340, - "end": 1341, + "start": 1441, + "end": 1442, "loc": { "start": { - "line": 50, + "line": 52, "column": 20 }, "end": { - "line": 50, + "line": 52, "column": 21 } } @@ -11324,15 +11852,15 @@ "binop": null, "updateContext": null }, - "start": 1341, - "end": 1342, + "start": 1442, + "end": 1443, "loc": { "start": { - "line": 50, + "line": 52, "column": 21 }, "end": { - "line": 50, + "line": 52, "column": 22 } } @@ -11349,15 +11877,15 @@ "postfix": false, "binop": null }, - "start": 1345, - "end": 1346, + "start": 1446, + "end": 1447, "loc": { "start": { - "line": 51, + "line": 53, "column": 2 }, "end": { - "line": 51, + "line": 53, "column": 3 } } @@ -11374,15 +11902,15 @@ "postfix": false, "binop": null }, - "start": 1348, - "end": 1349, + "start": 1449, + "end": 1450, "loc": { "start": { - "line": 52, + "line": 54, "column": 1 }, "end": { - "line": 52, + "line": 54, "column": 2 } } @@ -11390,15 +11918,15 @@ { "type": "CommentBlock", "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1352, - "end": 1578, + "start": 1453, + "end": 1679, "loc": { "start": { - "line": 54, + "line": 56, "column": 1 }, "end": { - "line": 61, + "line": 63, "column": 4 } } @@ -11416,15 +11944,15 @@ "binop": null }, "value": "_search", - "start": 1580, - "end": 1587, + "start": 1681, + "end": 1688, "loc": { "start": { - "line": 62, + "line": 64, "column": 1 }, "end": { - "line": 62, + "line": 64, "column": 8 } } @@ -11441,15 +11969,15 @@ "postfix": false, "binop": null }, - "start": 1587, - "end": 1588, + "start": 1688, + "end": 1689, "loc": { "start": { - "line": 62, + "line": 64, "column": 8 }, "end": { - "line": 62, + "line": 64, "column": 9 } } @@ -11467,15 +11995,15 @@ "binop": null }, "value": "key", - "start": 1588, - "end": 1591, + "start": 1689, + "end": 1692, "loc": { "start": { - "line": 62, + "line": 64, "column": 9 }, "end": { - "line": 62, + "line": 64, "column": 12 } } @@ -11492,15 +12020,15 @@ "postfix": false, "binop": null }, - "start": 1591, - "end": 1592, + "start": 1692, + "end": 1693, "loc": { "start": { - "line": 62, + "line": 64, "column": 12 }, "end": { - "line": 62, + "line": 64, "column": 13 } } @@ -11517,15 +12045,15 @@ "postfix": false, "binop": null }, - "start": 1593, - "end": 1594, + "start": 1694, + "end": 1695, "loc": { "start": { - "line": 62, + "line": 64, "column": 14 }, "end": { - "line": 62, + "line": 64, "column": 15 } } @@ -11545,15 +12073,15 @@ "updateContext": null }, "value": "if", - "start": 1597, - "end": 1599, + "start": 1698, + "end": 1700, "loc": { "start": { - "line": 63, + "line": 65, "column": 2 }, "end": { - "line": 63, + "line": 65, "column": 4 } } @@ -11570,15 +12098,15 @@ "postfix": false, "binop": null }, - "start": 1600, - "end": 1601, + "start": 1701, + "end": 1702, "loc": { "start": { - "line": 63, + "line": 65, "column": 5 }, "end": { - "line": 63, + "line": 65, "column": 6 } } @@ -11598,15 +12126,15 @@ "updateContext": null }, "value": "this", - "start": 1601, - "end": 1605, + "start": 1702, + "end": 1706, "loc": { "start": { - "line": 63, + "line": 65, "column": 6 }, "end": { - "line": 63, + "line": 65, "column": 10 } } @@ -11624,15 +12152,15 @@ "binop": null, "updateContext": null }, - "start": 1605, - "end": 1606, + "start": 1706, + "end": 1707, "loc": { "start": { - "line": 63, + "line": 65, "column": 10 }, "end": { - "line": 63, + "line": 65, "column": 11 } } @@ -11650,15 +12178,15 @@ "binop": null }, "value": "root", - "start": 1606, - "end": 1610, + "start": 1707, + "end": 1711, "loc": { "start": { - "line": 63, + "line": 65, "column": 11 }, "end": { - "line": 63, + "line": 65, "column": 15 } } @@ -11677,15 +12205,15 @@ "updateContext": null }, "value": "===", - "start": 1611, - "end": 1614, + "start": 1712, + "end": 1715, "loc": { "start": { - "line": 63, + "line": 65, "column": 16 }, "end": { - "line": 63, + "line": 65, "column": 19 } } @@ -11705,15 +12233,15 @@ "updateContext": null }, "value": "null", - "start": 1615, - "end": 1619, + "start": 1716, + "end": 1720, "loc": { "start": { - "line": 63, + "line": 65, "column": 20 }, "end": { - "line": 63, + "line": 65, "column": 24 } } @@ -11730,15 +12258,15 @@ "postfix": false, "binop": null }, - "start": 1619, - "end": 1620, + "start": 1720, + "end": 1721, "loc": { "start": { - "line": 63, + "line": 65, "column": 24 }, "end": { - "line": 63, + "line": 65, "column": 25 } } @@ -11758,15 +12286,15 @@ "updateContext": null }, "value": "return", - "start": 1621, - "end": 1627, + "start": 1722, + "end": 1728, "loc": { "start": { - "line": 63, + "line": 65, "column": 26 }, "end": { - "line": 63, + "line": 65, "column": 32 } } @@ -11786,15 +12314,15 @@ "updateContext": null }, "value": "null", - "start": 1628, - "end": 1632, + "start": 1729, + "end": 1733, "loc": { "start": { - "line": 63, + "line": 65, "column": 33 }, "end": { - "line": 63, + "line": 65, "column": 37 } } @@ -11812,15 +12340,15 @@ "binop": null, "updateContext": null }, - "start": 1632, - "end": 1633, + "start": 1733, + "end": 1734, "loc": { "start": { - "line": 63, + "line": 65, "column": 37 }, "end": { - "line": 63, + "line": 65, "column": 38 } } @@ -11840,15 +12368,15 @@ "updateContext": null }, "value": "return", - "start": 1636, - "end": 1642, + "start": 1737, + "end": 1743, "loc": { "start": { - "line": 64, + "line": 66, "column": 2 }, "end": { - "line": 64, + "line": 66, "column": 8 } } @@ -11866,15 +12394,15 @@ "binop": null }, "value": "search", - "start": 1643, - "end": 1649, + "start": 1744, + "end": 1750, "loc": { "start": { - "line": 64, + "line": 66, "column": 9 }, "end": { - "line": 64, + "line": 66, "column": 15 } } @@ -11891,15 +12419,15 @@ "postfix": false, "binop": null }, - "start": 1649, - "end": 1650, + "start": 1750, + "end": 1751, "loc": { "start": { - "line": 64, + "line": 66, "column": 15 }, "end": { - "line": 64, + "line": 66, "column": 16 } } @@ -11919,15 +12447,15 @@ "updateContext": null }, "value": "this", - "start": 1650, - "end": 1654, + "start": 1751, + "end": 1755, "loc": { "start": { - "line": 64, + "line": 66, "column": 16 }, "end": { - "line": 64, + "line": 66, "column": 20 } } @@ -11945,15 +12473,15 @@ "binop": null, "updateContext": null }, - "start": 1654, - "end": 1655, + "start": 1755, + "end": 1756, "loc": { "start": { - "line": 64, + "line": 66, "column": 20 }, "end": { - "line": 64, + "line": 66, "column": 21 } } @@ -11971,15 +12499,15 @@ "binop": null }, "value": "compare", - "start": 1655, - "end": 1662, + "start": 1756, + "end": 1763, "loc": { "start": { - "line": 64, + "line": 66, "column": 21 }, "end": { - "line": 64, + "line": 66, "column": 28 } } @@ -11997,15 +12525,15 @@ "binop": null, "updateContext": null }, - "start": 1662, - "end": 1663, + "start": 1763, + "end": 1764, "loc": { "start": { - "line": 64, + "line": 66, "column": 28 }, "end": { - "line": 64, + "line": 66, "column": 29 } } @@ -12025,15 +12553,15 @@ "updateContext": null }, "value": "this", - "start": 1664, - "end": 1668, + "start": 1765, + "end": 1769, "loc": { "start": { - "line": 64, + "line": 66, "column": 30 }, "end": { - "line": 64, + "line": 66, "column": 34 } } @@ -12051,15 +12579,15 @@ "binop": null, "updateContext": null }, - "start": 1668, - "end": 1669, + "start": 1769, + "end": 1770, "loc": { "start": { - "line": 64, + "line": 66, "column": 34 }, "end": { - "line": 64, + "line": 66, "column": 35 } } @@ -12077,15 +12605,15 @@ "binop": null }, "value": "root", - "start": 1669, - "end": 1673, + "start": 1770, + "end": 1774, "loc": { "start": { - "line": 64, + "line": 66, "column": 35 }, "end": { - "line": 64, + "line": 66, "column": 39 } } @@ -12103,15 +12631,15 @@ "binop": null, "updateContext": null }, - "start": 1673, - "end": 1674, + "start": 1774, + "end": 1775, "loc": { "start": { - "line": 64, + "line": 66, "column": 39 }, "end": { - "line": 64, + "line": 66, "column": 40 } } @@ -12129,15 +12657,15 @@ "binop": null }, "value": "key", - "start": 1675, - "end": 1678, + "start": 1776, + "end": 1779, "loc": { "start": { - "line": 64, + "line": 66, "column": 41 }, "end": { - "line": 64, + "line": 66, "column": 44 } } @@ -12154,15 +12682,15 @@ "postfix": false, "binop": null }, - "start": 1678, - "end": 1679, + "start": 1779, + "end": 1780, "loc": { "start": { - "line": 64, + "line": 66, "column": 44 }, "end": { - "line": 64, + "line": 66, "column": 45 } } @@ -12180,15 +12708,15 @@ "binop": null, "updateContext": null }, - "start": 1679, - "end": 1680, + "start": 1780, + "end": 1781, "loc": { "start": { - "line": 64, + "line": 66, "column": 45 }, "end": { - "line": 64, + "line": 66, "column": 46 } } @@ -12205,15 +12733,15 @@ "postfix": false, "binop": null }, - "start": 1682, - "end": 1683, + "start": 1783, + "end": 1784, "loc": { "start": { - "line": 65, + "line": 67, "column": 1 }, "end": { - "line": 65, + "line": 67, "column": 2 } } @@ -12221,15 +12749,15 @@ { "type": "CommentBlock", "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", - "start": 1686, - "end": 1948, + "start": 1787, + "end": 2049, "loc": { "start": { - "line": 67, + "line": 69, "column": 1 }, "end": { - "line": 74, + "line": 76, "column": 4 } } @@ -12247,15 +12775,15 @@ "binop": null }, "value": "get", - "start": 1950, - "end": 1953, + "start": 2051, + "end": 2054, "loc": { "start": { - "line": 75, + "line": 77, "column": 1 }, "end": { - "line": 75, + "line": 77, "column": 4 } } @@ -12272,15 +12800,15 @@ "postfix": false, "binop": null }, - "start": 1953, - "end": 1954, + "start": 2054, + "end": 2055, "loc": { "start": { - "line": 75, + "line": 77, "column": 4 }, "end": { - "line": 75, + "line": 77, "column": 5 } } @@ -12298,15 +12826,15 @@ "binop": null }, "value": "key", - "start": 1954, - "end": 1957, + "start": 2055, + "end": 2058, "loc": { "start": { - "line": 75, + "line": 77, "column": 5 }, "end": { - "line": 75, + "line": 77, "column": 8 } } @@ -12323,15 +12851,15 @@ "postfix": false, "binop": null }, - "start": 1957, - "end": 1958, + "start": 2058, + "end": 2059, "loc": { "start": { - "line": 75, + "line": 77, "column": 8 }, "end": { - "line": 75, + "line": 77, "column": 9 } } @@ -12348,15 +12876,15 @@ "postfix": false, "binop": null }, - "start": 1959, - "end": 1960, + "start": 2060, + "end": 2061, "loc": { "start": { - "line": 75, + "line": 77, "column": 10 }, "end": { - "line": 75, + "line": 77, "column": 11 } } @@ -12376,15 +12904,15 @@ "updateContext": null }, "value": "const", - "start": 1963, - "end": 1968, + "start": 2064, + "end": 2069, "loc": { "start": { - "line": 76, + "line": 78, "column": 2 }, "end": { - "line": 76, + "line": 78, "column": 7 } } @@ -12402,15 +12930,15 @@ "binop": null }, "value": "node", - "start": 1969, - "end": 1973, + "start": 2070, + "end": 2074, "loc": { "start": { - "line": 76, + "line": 78, "column": 8 }, "end": { - "line": 76, + "line": 78, "column": 12 } } @@ -12429,15 +12957,15 @@ "updateContext": null }, "value": "=", - "start": 1974, - "end": 1975, + "start": 2075, + "end": 2076, "loc": { "start": { - "line": 76, + "line": 78, "column": 13 }, "end": { - "line": 76, + "line": 78, "column": 14 } } @@ -12457,15 +12985,15 @@ "updateContext": null }, "value": "this", - "start": 1976, - "end": 1980, + "start": 2077, + "end": 2081, "loc": { "start": { - "line": 76, + "line": 78, "column": 15 }, "end": { - "line": 76, + "line": 78, "column": 19 } } @@ -12483,15 +13011,15 @@ "binop": null, "updateContext": null }, - "start": 1980, - "end": 1981, + "start": 2081, + "end": 2082, "loc": { "start": { - "line": 76, + "line": 78, "column": 19 }, "end": { - "line": 76, + "line": 78, "column": 20 } } @@ -12509,15 +13037,15 @@ "binop": null }, "value": "_search", - "start": 1981, - "end": 1988, + "start": 2082, + "end": 2089, "loc": { "start": { - "line": 76, + "line": 78, "column": 20 }, "end": { - "line": 76, + "line": 78, "column": 27 } } @@ -12534,15 +13062,15 @@ "postfix": false, "binop": null }, - "start": 1988, - "end": 1989, + "start": 2089, + "end": 2090, "loc": { "start": { - "line": 76, + "line": 78, "column": 27 }, "end": { - "line": 76, + "line": 78, "column": 28 } } @@ -12560,15 +13088,15 @@ "binop": null }, "value": "key", - "start": 1989, - "end": 1992, + "start": 2090, + "end": 2093, "loc": { "start": { - "line": 76, + "line": 78, "column": 28 }, "end": { - "line": 76, + "line": 78, "column": 31 } } @@ -12585,15 +13113,15 @@ "postfix": false, "binop": null }, - "start": 1992, - "end": 1993, + "start": 2093, + "end": 2094, "loc": { "start": { - "line": 76, + "line": 78, "column": 31 }, "end": { - "line": 76, + "line": 78, "column": 32 } } @@ -12611,15 +13139,15 @@ "binop": null, "updateContext": null }, - "start": 1993, - "end": 1994, + "start": 2094, + "end": 2095, "loc": { "start": { - "line": 76, + "line": 78, "column": 32 }, "end": { - "line": 76, + "line": 78, "column": 33 } } @@ -12639,15 +13167,15 @@ "updateContext": null }, "value": "return", - "start": 1997, - "end": 2003, + "start": 2098, + "end": 2104, "loc": { "start": { - "line": 77, + "line": 79, "column": 2 }, "end": { - "line": 77, + "line": 79, "column": 8 } } @@ -12665,15 +13193,15 @@ "binop": null }, "value": "node", - "start": 2004, - "end": 2008, + "start": 2105, + "end": 2109, "loc": { "start": { - "line": 77, + "line": 79, "column": 9 }, "end": { - "line": 77, + "line": 79, "column": 13 } } @@ -12692,15 +13220,15 @@ "updateContext": null }, "value": "===", - "start": 2009, - "end": 2012, + "start": 2110, + "end": 2113, "loc": { "start": { - "line": 77, + "line": 79, "column": 14 }, "end": { - "line": 77, + "line": 79, "column": 17 } } @@ -12720,15 +13248,15 @@ "updateContext": null }, "value": "null", - "start": 2013, - "end": 2017, + "start": 2114, + "end": 2118, "loc": { "start": { - "line": 77, + "line": 79, "column": 18 }, "end": { - "line": 77, + "line": 79, "column": 22 } } @@ -12746,15 +13274,15 @@ "binop": null, "updateContext": null }, - "start": 2018, - "end": 2019, + "start": 2119, + "end": 2120, "loc": { "start": { - "line": 77, + "line": 79, "column": 23 }, "end": { - "line": 77, + "line": 79, "column": 24 } } @@ -12774,15 +13302,15 @@ "updateContext": null }, "value": "null", - "start": 2020, - "end": 2024, + "start": 2121, + "end": 2125, "loc": { "start": { - "line": 77, + "line": 79, "column": 25 }, "end": { - "line": 77, + "line": 79, "column": 29 } } @@ -12800,15 +13328,15 @@ "binop": null, "updateContext": null }, - "start": 2025, - "end": 2026, + "start": 2126, + "end": 2127, "loc": { "start": { - "line": 77, + "line": 79, "column": 30 }, "end": { - "line": 77, + "line": 79, "column": 31 } } @@ -12826,15 +13354,15 @@ "binop": null }, "value": "node", - "start": 2027, - "end": 2031, + "start": 2128, + "end": 2132, "loc": { "start": { - "line": 77, + "line": 79, "column": 32 }, "end": { - "line": 77, + "line": 79, "column": 36 } } @@ -12852,15 +13380,15 @@ "binop": null, "updateContext": null }, - "start": 2031, - "end": 2032, + "start": 2132, + "end": 2133, "loc": { "start": { - "line": 77, + "line": 79, "column": 36 }, "end": { - "line": 77, + "line": 79, "column": 37 } } @@ -12878,15 +13406,15 @@ "binop": null }, "value": "key", - "start": 2032, - "end": 2035, + "start": 2133, + "end": 2136, "loc": { "start": { - "line": 77, + "line": 79, "column": 37 }, "end": { - "line": 77, + "line": 79, "column": 40 } } @@ -12904,15 +13432,15 @@ "binop": null, "updateContext": null }, - "start": 2035, - "end": 2036, + "start": 2136, + "end": 2137, "loc": { "start": { - "line": 77, + "line": 79, "column": 40 }, "end": { - "line": 77, + "line": 79, "column": 41 } } @@ -12929,31 +13457,31 @@ "postfix": false, "binop": null }, - "start": 2038, - "end": 2039, + "start": 2139, + "end": 2140, "loc": { "start": { - "line": 78, + "line": 80, "column": 1 }, "end": { - "line": 78, + "line": 80, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t ", - "start": 2042, - "end": 2197, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", + "start": 2143, + "end": 2298, "loc": { "start": { - "line": 80, + "line": 82, "column": 1 }, "end": { - "line": 86, + "line": 88, "column": 4 } } @@ -12971,15 +13499,15 @@ "binop": null }, "value": "has", - "start": 2199, - "end": 2202, + "start": 2300, + "end": 2303, "loc": { "start": { - "line": 87, + "line": 89, "column": 1 }, "end": { - "line": 87, + "line": 89, "column": 4 } } @@ -12996,15 +13524,15 @@ "postfix": false, "binop": null }, - "start": 2202, - "end": 2203, + "start": 2303, + "end": 2304, "loc": { "start": { - "line": 87, + "line": 89, "column": 4 }, "end": { - "line": 87, + "line": 89, "column": 5 } } @@ -13022,15 +13550,15 @@ "binop": null }, "value": "key", - "start": 2203, - "end": 2206, + "start": 2304, + "end": 2307, "loc": { "start": { - "line": 87, + "line": 89, "column": 5 }, "end": { - "line": 87, + "line": 89, "column": 8 } } @@ -13047,15 +13575,15 @@ "postfix": false, "binop": null }, - "start": 2206, - "end": 2207, + "start": 2307, + "end": 2308, "loc": { "start": { - "line": 87, + "line": 89, "column": 8 }, "end": { - "line": 87, + "line": 89, "column": 9 } } @@ -13072,15 +13600,15 @@ "postfix": false, "binop": null }, - "start": 2208, - "end": 2209, + "start": 2309, + "end": 2310, "loc": { "start": { - "line": 87, + "line": 89, "column": 10 }, "end": { - "line": 87, + "line": 89, "column": 11 } } @@ -13100,15 +13628,15 @@ "updateContext": null }, "value": "return", - "start": 2212, - "end": 2218, + "start": 2313, + "end": 2319, "loc": { "start": { - "line": 88, + "line": 90, "column": 2 }, "end": { - "line": 88, + "line": 90, "column": 8 } } @@ -13128,15 +13656,15 @@ "updateContext": null }, "value": "this", - "start": 2219, - "end": 2223, + "start": 2320, + "end": 2324, "loc": { "start": { - "line": 88, + "line": 90, "column": 9 }, "end": { - "line": 88, + "line": 90, "column": 13 } } @@ -13154,15 +13682,15 @@ "binop": null, "updateContext": null }, - "start": 2223, - "end": 2224, + "start": 2324, + "end": 2325, "loc": { "start": { - "line": 88, + "line": 90, "column": 13 }, "end": { - "line": 88, + "line": 90, "column": 14 } } @@ -13180,15 +13708,15 @@ "binop": null }, "value": "_search", - "start": 2224, - "end": 2231, + "start": 2325, + "end": 2332, "loc": { "start": { - "line": 88, + "line": 90, "column": 14 }, "end": { - "line": 88, + "line": 90, "column": 21 } } @@ -13205,15 +13733,15 @@ "postfix": false, "binop": null }, - "start": 2231, - "end": 2232, + "start": 2332, + "end": 2333, "loc": { "start": { - "line": 88, + "line": 90, "column": 21 }, "end": { - "line": 88, + "line": 90, "column": 22 } } @@ -13231,15 +13759,15 @@ "binop": null }, "value": "key", - "start": 2232, - "end": 2235, + "start": 2333, + "end": 2336, "loc": { "start": { - "line": 88, + "line": 90, "column": 22 }, "end": { - "line": 88, + "line": 90, "column": 25 } } @@ -13256,15 +13784,15 @@ "postfix": false, "binop": null }, - "start": 2235, - "end": 2236, + "start": 2336, + "end": 2337, "loc": { "start": { - "line": 88, + "line": 90, "column": 25 }, "end": { - "line": 88, + "line": 90, "column": 26 } } @@ -13283,15 +13811,15 @@ "updateContext": null }, "value": "!==", - "start": 2237, - "end": 2240, + "start": 2338, + "end": 2341, "loc": { "start": { - "line": 88, + "line": 90, "column": 27 }, "end": { - "line": 88, + "line": 90, "column": 30 } } @@ -13311,15 +13839,15 @@ "updateContext": null }, "value": "null", - "start": 2241, - "end": 2245, + "start": 2342, + "end": 2346, "loc": { "start": { - "line": 88, + "line": 90, "column": 31 }, "end": { - "line": 88, + "line": 90, "column": 35 } } @@ -13337,15 +13865,15 @@ "binop": null, "updateContext": null }, - "start": 2245, - "end": 2246, + "start": 2346, + "end": 2347, "loc": { "start": { - "line": 88, + "line": 90, "column": 35 }, "end": { - "line": 88, + "line": 90, "column": 36 } } @@ -13362,15 +13890,15 @@ "postfix": false, "binop": null }, - "start": 2248, - "end": 2249, + "start": 2349, + "end": 2350, "loc": { "start": { - "line": 89, + "line": 91, "column": 1 }, "end": { - "line": 89, + "line": 91, "column": 2 } } @@ -13378,15 +13906,15 @@ { "type": "CommentBlock", "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2252, - "end": 2357, + "start": 2353, + "end": 2458, "loc": { "start": { - "line": 91, + "line": 93, "column": 1 }, "end": { - "line": 95, + "line": 97, "column": 4 } } @@ -13404,15 +13932,15 @@ "binop": null }, "value": "_delete", - "start": 2359, - "end": 2366, + "start": 2460, + "end": 2467, "loc": { "start": { - "line": 96, + "line": 98, "column": 1 }, "end": { - "line": 96, + "line": 98, "column": 8 } } @@ -13429,15 +13957,15 @@ "postfix": false, "binop": null }, - "start": 2366, - "end": 2367, + "start": 2467, + "end": 2468, "loc": { "start": { - "line": 96, + "line": 98, "column": 8 }, "end": { - "line": 96, + "line": 98, "column": 9 } } @@ -13455,15 +13983,15 @@ "binop": null }, "value": "node", - "start": 2367, - "end": 2371, + "start": 2468, + "end": 2472, "loc": { "start": { - "line": 96, + "line": 98, "column": 9 }, "end": { - "line": 96, + "line": 98, "column": 13 } } @@ -13480,15 +14008,15 @@ "postfix": false, "binop": null }, - "start": 2371, - "end": 2372, + "start": 2472, + "end": 2473, "loc": { "start": { - "line": 96, + "line": 98, "column": 13 }, "end": { - "line": 96, + "line": 98, "column": 14 } } @@ -13505,44 +14033,42 @@ "postfix": false, "binop": null }, - "start": 2373, - "end": 2374, + "start": 2474, + "end": 2475, "loc": { "start": { - "line": 96, + "line": 98, "column": 15 }, "end": { - "line": 96, + "line": 98, "column": 16 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 2377, - "end": 2379, + "value": "assert", + "start": 2478, + "end": 2484, "loc": { "start": { - "line": 97, + "line": 99, "column": 2 }, "end": { - "line": 97, - "column": 4 + "line": 99, + "column": 8 } } }, @@ -13558,43 +14084,70 @@ "postfix": false, "binop": null }, - "start": 2380, - "end": 2381, + "start": 2484, + "end": 2485, "loc": { "start": { - "line": 97, - "column": 5 + "line": 99, + "column": 8 }, "end": { - "line": 97, - "column": 6 + "line": 99, + "column": 9 } } }, { "type": { - "label": "prefix", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": true, + "prefix": false, "postfix": false, - "binop": null, + "binop": null + }, + "value": "node", + "start": 2485, + "end": 2489, + "loc": { + "start": { + "line": 99, + "column": 9 + }, + "end": { + "line": 99, + "column": 13 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, "updateContext": null }, - "value": "!", - "start": 2381, - "end": 2382, + "value": "instanceof", + "start": 2490, + "end": 2500, "loc": { "start": { - "line": 97, - "column": 6 + "line": 99, + "column": 14 }, "end": { - "line": 97, - "column": 7 + "line": 99, + "column": 24 } } }, @@ -13610,23 +14163,75 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 2382, - "end": 2386, + "value": "Node", + "start": 2501, + "end": 2505, "loc": { "start": { - "line": 97, - "column": 7 + "line": 99, + "column": 25 }, "end": { - "line": 97, - "column": 11 + "line": 99, + "column": 29 } } }, { "type": { - "label": ".", + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2505, + "end": 2506, + "loc": { + "start": { + "line": 99, + "column": 29 + }, + "end": { + "line": 99, + "column": 30 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2506, + "end": 2507, + "loc": { + "start": { + "line": 99, + "column": 30 + }, + "end": { + "line": 99, + "column": 31 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -13637,16 +14242,42 @@ "binop": null, "updateContext": null }, - "start": 2386, - "end": 2387, + "value": "if", + "start": 2510, + "end": 2512, "loc": { "start": { - "line": 97, - "column": 11 + "line": 100, + "column": 2 }, "end": { - "line": 97, - "column": 12 + "line": 100, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2513, + "end": 2514, + "loc": { + "start": { + "line": 100, + "column": 5 + }, + "end": { + "line": 100, + "column": 6 } } }, @@ -13662,17 +14293,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 2387, - "end": 2391, + "value": "node", + "start": 2514, + "end": 2518, "loc": { "start": { - "line": 97, - "column": 12 + "line": 100, + "column": 6 }, "end": { - "line": 97, - "column": 16 + "line": 100, + "column": 10 } } }, @@ -13689,16 +14320,16 @@ "binop": null, "updateContext": null }, - "start": 2391, - "end": 2392, + "start": 2518, + "end": 2519, "loc": { "start": { - "line": 97, - "column": 16 + "line": 100, + "column": 10 }, "end": { - "line": 97, - "column": 17 + "line": 100, + "column": 11 } } }, @@ -13714,67 +14345,72 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 2392, - "end": 2398, + "value": "left", + "start": 2519, + "end": 2523, "loc": { "start": { - "line": 97, - "column": 17 + "line": 100, + "column": 11 }, "end": { - "line": 97, - "column": 23 + "line": 100, + "column": 15 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 2398, - "end": 2399, + "value": "!==", + "start": 2524, + "end": 2527, "loc": { "start": { - "line": 97, - "column": 23 + "line": 100, + "column": 16 }, "end": { - "line": 97, - "column": 24 + "line": 100, + "column": 19 } } }, { "type": { - "label": ")", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2399, - "end": 2400, + "value": "null", + "start": 2528, + "end": 2532, "loc": { "start": { - "line": 97, - "column": 24 + "line": 100, + "column": 20 }, "end": { - "line": 97, - "column": 25 + "line": 100, + "column": 24 } } }, @@ -13790,16 +14426,16 @@ "postfix": false, "binop": null }, - "start": 2400, - "end": 2401, + "start": 2532, + "end": 2533, "loc": { "start": { - "line": 97, - "column": 25 + "line": 100, + "column": 24 }, "end": { - "line": 97, - "column": 26 + "line": 100, + "column": 25 } } }, @@ -13815,31 +14451,31 @@ "postfix": false, "binop": null }, - "start": 2402, - "end": 2403, + "start": 2534, + "end": 2535, "loc": { "start": { - "line": 97, - "column": 27 + "line": 100, + "column": 26 }, "end": { - "line": 97, - "column": 28 + "line": 100, + "column": 27 } } }, { "type": "CommentLine", "value": " Replace node's key with predecessor's key", - "start": 2407, - "end": 2451, + "start": 2539, + "end": 2583, "loc": { "start": { - "line": 98, + "line": 101, "column": 3 }, "end": { - "line": 98, + "line": 101, "column": 47 } } @@ -13859,15 +14495,15 @@ "updateContext": null }, "value": "const", - "start": 2455, - "end": 2460, + "start": 2587, + "end": 2592, "loc": { "start": { - "line": 99, + "line": 102, "column": 3 }, "end": { - "line": 99, + "line": 102, "column": 8 } } @@ -13885,15 +14521,15 @@ "binop": null }, "value": "pred", - "start": 2461, - "end": 2465, + "start": 2593, + "end": 2597, "loc": { "start": { - "line": 99, + "line": 102, "column": 9 }, "end": { - "line": 99, + "line": 102, "column": 13 } } @@ -13912,15 +14548,15 @@ "updateContext": null }, "value": "=", - "start": 2466, - "end": 2467, + "start": 2598, + "end": 2599, "loc": { "start": { - "line": 99, + "line": 102, "column": 14 }, "end": { - "line": 99, + "line": 102, "column": 15 } } @@ -13938,15 +14574,15 @@ "binop": null }, "value": "predecessor", - "start": 2468, - "end": 2479, + "start": 2600, + "end": 2611, "loc": { "start": { - "line": 99, + "line": 102, "column": 16 }, "end": { - "line": 99, + "line": 102, "column": 27 } } @@ -13963,15 +14599,15 @@ "postfix": false, "binop": null }, - "start": 2479, - "end": 2480, + "start": 2611, + "end": 2612, "loc": { "start": { - "line": 99, + "line": 102, "column": 27 }, "end": { - "line": 99, + "line": 102, "column": 28 } } @@ -13989,15 +14625,15 @@ "binop": null }, "value": "node", - "start": 2480, - "end": 2484, + "start": 2612, + "end": 2616, "loc": { "start": { - "line": 99, + "line": 102, "column": 28 }, "end": { - "line": 99, + "line": 102, "column": 32 } } @@ -14014,23 +14650,180 @@ "postfix": false, "binop": null }, - "start": 2484, - "end": 2485, + "start": 2616, + "end": 2617, "loc": { "start": { - "line": 99, + "line": 102, "column": 32 }, "end": { - "line": 99, + "line": 102, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2617, + "end": 2618, + "loc": { + "start": { + "line": 102, "column": 33 + }, + "end": { + "line": 102, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 2622, + "end": 2626, + "loc": { + "start": { + "line": 103, + "column": 3 + }, + "end": { + "line": 103, + "column": 7 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2626, + "end": 2627, + "loc": { + "start": { + "line": 103, + "column": 7 + }, + "end": { + "line": 103, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 2627, + "end": 2630, + "loc": { + "start": { + "line": 103, + "column": 8 + }, + "end": { + "line": 103, + "column": 11 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 2631, + "end": 2632, + "loc": { + "start": { + "line": 103, + "column": 12 + }, + "end": { + "line": 103, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "pred", + "start": 2633, + "end": 2637, + "loc": { + "start": { + "line": 103, + "column": 14 + }, + "end": { + "line": 103, + "column": 18 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -14040,16 +14833,16 @@ "binop": null, "updateContext": null }, - "start": 2485, - "end": 2486, + "start": 2637, + "end": 2638, "loc": { "start": { - "line": 99, - "column": 33 + "line": 103, + "column": 18 }, "end": { - "line": 99, - "column": 34 + "line": 103, + "column": 19 } } }, @@ -14065,24 +14858,24 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 2490, - "end": 2494, + "value": "key", + "start": 2638, + "end": 2641, "loc": { "start": { - "line": 100, - "column": 3 + "line": 103, + "column": 19 }, "end": { - "line": 100, - "column": 7 + "line": 103, + "column": 22 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -14092,69 +14885,117 @@ "binop": null, "updateContext": null }, - "start": 2494, - "end": 2495, + "start": 2641, + "end": 2642, "loc": { "start": { - "line": 100, - "column": 7 + "line": 103, + "column": 22 }, "end": { - "line": 100, - "column": 8 + "line": 103, + "column": 23 + } + } + }, + { + "type": "CommentLine", + "value": " Delete predecessor node", + "start": 2646, + "end": 2672, + "loc": { + "start": { + "line": 104, + "column": 3 + }, + "end": { + "line": 104, + "column": 29 + } + } + }, + { + "type": "CommentLine", + "value": " NOTE: this node can only have one non-leaf (left) child because", + "start": 2676, + "end": 2742, + "loc": { + "start": { + "line": 105, + "column": 3 + }, + "end": { + "line": 105, + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " of red-black tree invariant.", + "start": 2746, + "end": 2777, + "loc": { + "start": { + "line": 106, + "column": 3 + }, + "end": { + "line": 106, + "column": 34 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "key", - "start": 2495, - "end": 2498, + "value": "if", + "start": 2781, + "end": 2783, "loc": { "start": { - "line": 100, - "column": 8 + "line": 107, + "column": 3 }, "end": { - "line": 100, - "column": 11 + "line": 107, + "column": 5 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 2499, - "end": 2500, + "start": 2784, + "end": 2785, "loc": { "start": { - "line": 100, - "column": 12 + "line": 107, + "column": 6 }, "end": { - "line": 100, - "column": 13 + "line": 107, + "column": 7 } } }, @@ -14171,16 +15012,16 @@ "binop": null }, "value": "pred", - "start": 2501, - "end": 2505, + "start": 2785, + "end": 2789, "loc": { "start": { - "line": 100, - "column": 14 + "line": 107, + "column": 7 }, "end": { - "line": 100, - "column": 18 + "line": 107, + "column": 11 } } }, @@ -14197,16 +15038,16 @@ "binop": null, "updateContext": null }, - "start": 2505, - "end": 2506, + "start": 2789, + "end": 2790, "loc": { "start": { - "line": 100, - "column": 18 + "line": 107, + "column": 11 }, "end": { - "line": 100, - "column": 19 + "line": 107, + "column": 12 } } }, @@ -14222,23 +15063,23 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 2506, - "end": 2509, + "value": "left", + "start": 2790, + "end": 2794, "loc": { "start": { - "line": 100, - "column": 19 + "line": 107, + "column": 12 }, "end": { - "line": 100, - "column": 22 + "line": 107, + "column": 16 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -14246,67 +15087,98 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 2509, - "end": 2510, + "value": "===", + "start": 2795, + "end": 2798, "loc": { "start": { - "line": 100, - "column": 22 + "line": 107, + "column": 17 }, "end": { - "line": 100, - "column": 23 + "line": 107, + "column": 20 } } }, { - "type": "CommentLine", - "value": " Delete predecessor node", - "start": 2514, - "end": 2540, + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 2799, + "end": 2803, "loc": { "start": { - "line": 101, - "column": 3 + "line": 107, + "column": 21 }, "end": { - "line": 101, - "column": 29 + "line": 107, + "column": 25 } } }, { - "type": "CommentLine", - "value": " note: this node can only have one non-leaf child", - "start": 2544, - "end": 2595, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2803, + "end": 2804, "loc": { "start": { - "line": 102, - "column": 3 + "line": 107, + "column": 25 }, "end": { - "line": 102, - "column": 54 + "line": 107, + "column": 26 } } }, { - "type": "CommentLine", - "value": " because the tree is a red-black tree", - "start": 2599, - "end": 2644, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2805, + "end": 2806, "loc": { "start": { - "line": 103, - "column": 3 + "line": 107, + "column": 27 }, "end": { - "line": 103, - "column": 48 + "line": 107, + "column": 28 } } }, @@ -14322,16 +15194,16 @@ "postfix": false, "binop": null }, - "value": "delete_one_child", - "start": 2648, - "end": 2664, + "value": "delete_no_child", + "start": 2811, + "end": 2826, "loc": { "start": { - "line": 104, - "column": 3 + "line": 108, + "column": 4 }, "end": { - "line": 104, + "line": 108, "column": 19 } } @@ -14348,15 +15220,15 @@ "postfix": false, "binop": null }, - "start": 2664, - "end": 2665, + "start": 2826, + "end": 2827, "loc": { "start": { - "line": 104, + "line": 108, "column": 19 }, "end": { - "line": 104, + "line": 108, "column": 20 } } @@ -14374,15 +15246,15 @@ "binop": null }, "value": "pred", - "start": 2665, - "end": 2669, + "start": 2827, + "end": 2831, "loc": { "start": { - "line": 104, + "line": 108, "column": 20 }, "end": { - "line": 104, + "line": 108, "column": 24 } } @@ -14399,15 +15271,15 @@ "postfix": false, "binop": null }, - "start": 2669, - "end": 2670, + "start": 2831, + "end": 2832, "loc": { "start": { - "line": 104, + "line": 108, "column": 24 }, "end": { - "line": 104, + "line": 108, "column": 25 } } @@ -14425,15 +15297,15 @@ "binop": null, "updateContext": null }, - "start": 2670, - "end": 2671, + "start": 2832, + "end": 2833, "loc": { "start": { - "line": 104, + "line": 108, "column": 25 }, "end": { - "line": 104, + "line": 108, "column": 26 } } @@ -14450,16 +15322,16 @@ "postfix": false, "binop": null }, - "start": 2674, - "end": 2675, + "start": 2837, + "end": 2838, "loc": { "start": { - "line": 105, - "column": 2 + "line": 109, + "column": 3 }, "end": { - "line": 105, - "column": 3 + "line": 109, + "column": 4 } } }, @@ -14478,51 +15350,48 @@ "updateContext": null }, "value": "else", - "start": 2676, - "end": 2680, + "start": 2839, + "end": 2843, "loc": { "start": { - "line": 105, - "column": 4 + "line": 109, + "column": 5 }, "end": { - "line": 105, - "column": 8 + "line": 109, + "column": 9 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 2681, - "end": 2683, + "start": 2844, + "end": 2845, "loc": { "start": { - "line": 105, - "column": 9 + "line": 109, + "column": 10 }, "end": { - "line": 105, + "line": 109, "column": 11 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -14531,43 +15400,42 @@ "postfix": false, "binop": null }, - "start": 2684, - "end": 2685, + "value": "delete_one_child", + "start": 2850, + "end": 2866, "loc": { "start": { - "line": 105, - "column": 12 + "line": 110, + "column": 4 }, "end": { - "line": 105, - "column": 13 + "line": 110, + "column": 20 } } }, { "type": { - "label": "prefix", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, - "prefix": true, + "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "!", - "start": 2685, - "end": 2686, + "start": 2866, + "end": 2867, "loc": { "start": { - "line": 105, - "column": 13 + "line": 110, + "column": 20 }, "end": { - "line": 105, - "column": 14 + "line": 110, + "column": 21 } } }, @@ -14583,23 +15451,23 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 2686, - "end": 2690, + "value": "pred", + "start": 2867, + "end": 2871, "loc": { "start": { - "line": 105, - "column": 14 + "line": 110, + "column": 21 }, "end": { - "line": 105, - "column": 18 + "line": 110, + "column": 25 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14607,51 +15475,50 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2690, - "end": 2691, + "start": 2871, + "end": 2872, "loc": { "start": { - "line": 105, - "column": 18 + "line": 110, + "column": 25 }, "end": { - "line": 105, - "column": 19 + "line": 110, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "right", - "start": 2691, - "end": 2696, + "start": 2872, + "end": 2873, "loc": { "start": { - "line": 105, - "column": 19 + "line": 110, + "column": 26 }, "end": { - "line": 105, - "column": 24 + "line": 110, + "column": 27 } } }, { "type": { - "label": ".", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14659,27 +15526,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2696, - "end": 2697, + "start": 2877, + "end": 2878, "loc": { "start": { - "line": 105, - "column": 24 + "line": 111, + "column": 3 }, "end": { - "line": 105, - "column": 25 + "line": 111, + "column": 4 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14687,48 +15553,51 @@ "postfix": false, "binop": null }, - "value": "isLeaf", - "start": 2697, - "end": 2703, + "start": 2881, + "end": 2882, "loc": { "start": { - "line": 105, - "column": 25 + "line": 112, + "column": 2 }, "end": { - "line": 105, - "column": 31 + "line": 112, + "column": 3 } } }, { "type": { - "label": "(", + "label": "else", + "keyword": "else", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2703, - "end": 2704, + "value": "else", + "start": 2883, + "end": 2887, "loc": { "start": { - "line": 105, - "column": 31 + "line": 112, + "column": 4 }, "end": { - "line": 105, - "column": 32 + "line": 112, + "column": 8 } } }, { "type": { - "label": ")", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14736,26 +15605,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2704, - "end": 2705, + "value": "if", + "start": 2888, + "end": 2890, "loc": { "start": { - "line": 105, - "column": 32 + "line": 112, + "column": 9 }, "end": { - "line": 105, - "column": 33 + "line": 112, + "column": 11 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14763,23 +15634,23 @@ "postfix": false, "binop": null }, - "start": 2705, - "end": 2706, + "start": 2891, + "end": 2892, "loc": { "start": { - "line": 105, - "column": 33 + "line": 112, + "column": 12 }, "end": { - "line": 105, - "column": 34 + "line": 112, + "column": 13 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -14788,71 +15659,23 @@ "postfix": false, "binop": null }, - "start": 2707, - "end": 2708, - "loc": { - "start": { - "line": 105, - "column": 35 - }, - "end": { - "line": 105, - "column": 36 - } - } - }, - { - "type": "CommentLine", - "value": " Replace node's key with successor's key", - "start": 2712, - "end": 2754, - "loc": { - "start": { - "line": 106, - "column": 3 - }, - "end": { - "line": 106, - "column": 45 - } - } - }, - { - "type": "CommentLine", - "value": " If there is no left child, then there can only be one right", - "start": 2758, - "end": 2820, - "loc": { - "start": { - "line": 107, - "column": 3 - }, - "end": { - "line": 107, - "column": 65 - } - } - }, - { - "type": "CommentLine", - "value": " child.", - "start": 2824, - "end": 2833, + "value": "node", + "start": 2892, + "end": 2896, "loc": { "start": { - "line": 108, - "column": 3 + "line": 112, + "column": 13 }, "end": { - "line": 108, - "column": 12 + "line": 112, + "column": 17 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14863,17 +15686,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 2837, - "end": 2842, + "start": 2896, + "end": 2897, "loc": { "start": { - "line": 109, - "column": 3 + "line": 112, + "column": 17 }, "end": { - "line": 109, - "column": 8 + "line": 112, + "column": 18 } } }, @@ -14889,50 +15711,51 @@ "postfix": false, "binop": null }, - "value": "succ", - "start": 2843, - "end": 2847, + "value": "right", + "start": 2897, + "end": 2902, "loc": { "start": { - "line": 109, - "column": 9 + "line": 112, + "column": 18 }, "end": { - "line": 109, - "column": 13 + "line": 112, + "column": 23 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 2848, - "end": 2849, + "value": "!==", + "start": 2903, + "end": 2906, "loc": { "start": { - "line": 109, - "column": 14 + "line": 112, + "column": 24 }, "end": { - "line": 109, - "column": 15 + "line": 112, + "column": 27 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -14940,25 +15763,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 2850, - "end": 2854, + "value": "null", + "start": 2907, + "end": 2911, "loc": { "start": { - "line": 109, - "column": 16 + "line": 112, + "column": 28 }, "end": { - "line": 109, - "column": 20 + "line": 112, + "column": 32 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14966,26 +15790,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2854, - "end": 2855, + "start": 2911, + "end": 2912, "loc": { "start": { - "line": 109, - "column": 20 + "line": 112, + "column": 32 }, "end": { - "line": 109, - "column": 21 + "line": 112, + "column": 33 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -14994,24 +15817,72 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 2855, - "end": 2860, + "start": 2913, + "end": 2914, "loc": { "start": { - "line": 109, - "column": 21 + "line": 112, + "column": 34 }, "end": { - "line": 109, - "column": 26 + "line": 112, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " Replace node's key with successor's key", + "start": 2918, + "end": 2960, + "loc": { + "start": { + "line": 113, + "column": 3 + }, + "end": { + "line": 113, + "column": 45 + } + } + }, + { + "type": "CommentLine", + "value": " NOTE: Since there is no left child, then there can only be one", + "start": 2964, + "end": 3029, + "loc": { + "start": { + "line": 114, + "column": 3 + }, + "end": { + "line": 114, + "column": 68 + } + } + }, + { + "type": "CommentLine", + "value": " right child by the red-black tree invariant.", + "start": 3033, + "end": 3080, + "loc": { + "start": { + "line": 115, + "column": 3 + }, + "end": { + "line": 115, + "column": 50 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -15021,16 +15892,17 @@ "binop": null, "updateContext": null }, - "start": 2860, - "end": 2861, + "value": "const", + "start": 3084, + "end": 3089, "loc": { "start": { - "line": 109, - "column": 26 + "line": 116, + "column": 3 }, "end": { - "line": 109, - "column": 27 + "line": 116, + "column": 8 } } }, @@ -15046,42 +15918,44 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 2865, - "end": 2871, + "value": "succ", + "start": 3090, + "end": 3094, "loc": { "start": { - "line": 110, - "column": 3 + "line": 116, + "column": 9 }, "end": { - "line": 110, - "column": 9 + "line": 116, + "column": 13 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2871, - "end": 2872, + "value": "=", + "start": 3095, + "end": 3096, "loc": { "start": { - "line": 110, - "column": 9 + "line": 116, + "column": 14 }, "end": { - "line": 110, - "column": 10 + "line": 116, + "column": 15 } } }, @@ -15097,45 +15971,43 @@ "postfix": false, "binop": null }, - "value": "succ", - "start": 2872, - "end": 2876, + "value": "node", + "start": 3097, + "end": 3101, "loc": { "start": { - "line": 110, - "column": 10 + "line": 116, + "column": 16 }, "end": { - "line": 110, - "column": 14 + "line": 116, + "column": 20 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 2877, - "end": 2887, + "start": 3101, + "end": 3102, "loc": { "start": { - "line": 110, - "column": 15 + "line": 116, + "column": 20 }, "end": { - "line": 110, - "column": 25 + "line": 116, + "column": 21 } } }, @@ -15151,42 +16023,17 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 2888, - "end": 2892, - "loc": { - "start": { - "line": 110, - "column": 26 - }, - "end": { - "line": 110, - "column": 30 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 2892, - "end": 2893, + "value": "right", + "start": 3102, + "end": 3107, "loc": { "start": { - "line": 110, - "column": 30 + "line": 116, + "column": 21 }, "end": { - "line": 110, - "column": 31 + "line": 116, + "column": 26 } } }, @@ -15203,16 +16050,16 @@ "binop": null, "updateContext": null }, - "start": 2893, - "end": 2894, + "start": 3107, + "end": 3108, "loc": { "start": { - "line": 110, - "column": 31 + "line": 116, + "column": 26 }, "end": { - "line": 110, - "column": 32 + "line": 116, + "column": 27 } } }, @@ -15229,15 +16076,15 @@ "binop": null }, "value": "node", - "start": 2898, - "end": 2902, + "start": 3112, + "end": 3116, "loc": { "start": { - "line": 111, + "line": 117, "column": 3 }, "end": { - "line": 111, + "line": 117, "column": 7 } } @@ -15255,15 +16102,15 @@ "binop": null, "updateContext": null }, - "start": 2902, - "end": 2903, + "start": 3116, + "end": 3117, "loc": { "start": { - "line": 111, + "line": 117, "column": 7 }, "end": { - "line": 111, + "line": 117, "column": 8 } } @@ -15281,15 +16128,15 @@ "binop": null }, "value": "key", - "start": 2903, - "end": 2906, + "start": 3117, + "end": 3120, "loc": { "start": { - "line": 111, + "line": 117, "column": 8 }, "end": { - "line": 111, + "line": 117, "column": 11 } } @@ -15308,15 +16155,15 @@ "updateContext": null }, "value": "=", - "start": 2907, - "end": 2908, + "start": 3121, + "end": 3122, "loc": { "start": { - "line": 111, + "line": 117, "column": 12 }, "end": { - "line": 111, + "line": 117, "column": 13 } } @@ -15334,15 +16181,15 @@ "binop": null }, "value": "succ", - "start": 2909, - "end": 2913, + "start": 3123, + "end": 3127, "loc": { "start": { - "line": 111, + "line": 117, "column": 14 }, "end": { - "line": 111, + "line": 117, "column": 18 } } @@ -15360,15 +16207,15 @@ "binop": null, "updateContext": null }, - "start": 2913, - "end": 2914, + "start": 3127, + "end": 3128, "loc": { "start": { - "line": 111, + "line": 117, "column": 18 }, "end": { - "line": 111, + "line": 117, "column": 19 } } @@ -15386,15 +16233,15 @@ "binop": null }, "value": "key", - "start": 2914, - "end": 2917, + "start": 3128, + "end": 3131, "loc": { "start": { - "line": 111, + "line": 117, "column": 19 }, "end": { - "line": 111, + "line": 117, "column": 22 } } @@ -15412,15 +16259,15 @@ "binop": null, "updateContext": null }, - "start": 2917, - "end": 2918, + "start": 3131, + "end": 3132, "loc": { "start": { - "line": 111, + "line": 117, "column": 22 }, "end": { - "line": 111, + "line": 117, "column": 23 } } @@ -15428,51 +16275,19 @@ { "type": "CommentLine", "value": " Delete successor node", - "start": 2922, - "end": 2946, + "start": 3136, + "end": 3160, "loc": { "start": { - "line": 112, + "line": 118, "column": 3 }, "end": { - "line": 112, + "line": 118, "column": 27 } } }, - { - "type": "CommentLine", - "value": " note: this node can only have one non-leaf child", - "start": 2950, - "end": 3001, - "loc": { - "start": { - "line": 113, - "column": 3 - }, - "end": { - "line": 113, - "column": 54 - } - } - }, - { - "type": "CommentLine", - "value": " because the tree is a red-black tree", - "start": 3005, - "end": 3050, - "loc": { - "start": { - "line": 114, - "column": 3 - }, - "end": { - "line": 114, - "column": 48 - } - } - }, { "type": { "label": "name", @@ -15485,17 +16300,17 @@ "postfix": false, "binop": null }, - "value": "delete_one_child", - "start": 3054, - "end": 3070, + "value": "delete_no_child", + "start": 3164, + "end": 3179, "loc": { "start": { - "line": 115, + "line": 119, "column": 3 }, "end": { - "line": 115, - "column": 19 + "line": 119, + "column": 18 } } }, @@ -15511,16 +16326,16 @@ "postfix": false, "binop": null }, - "start": 3070, - "end": 3071, + "start": 3179, + "end": 3180, "loc": { "start": { - "line": 115, - "column": 19 + "line": 119, + "column": 18 }, "end": { - "line": 115, - "column": 20 + "line": 119, + "column": 19 } } }, @@ -15537,16 +16352,16 @@ "binop": null }, "value": "succ", - "start": 3071, - "end": 3075, + "start": 3180, + "end": 3184, "loc": { "start": { - "line": 115, - "column": 20 + "line": 119, + "column": 19 }, "end": { - "line": 115, - "column": 24 + "line": 119, + "column": 23 } } }, @@ -15562,16 +16377,16 @@ "postfix": false, "binop": null }, - "start": 3075, - "end": 3076, + "start": 3184, + "end": 3185, "loc": { "start": { - "line": 115, - "column": 24 + "line": 119, + "column": 23 }, "end": { - "line": 115, - "column": 25 + "line": 119, + "column": 24 } } }, @@ -15588,16 +16403,16 @@ "binop": null, "updateContext": null }, - "start": 3076, - "end": 3077, + "start": 3185, + "end": 3186, "loc": { "start": { - "line": 115, - "column": 25 + "line": 119, + "column": 24 }, "end": { - "line": 115, - "column": 26 + "line": 119, + "column": 25 } } }, @@ -15613,15 +16428,15 @@ "postfix": false, "binop": null }, - "start": 3080, - "end": 3081, + "start": 3189, + "end": 3190, "loc": { "start": { - "line": 116, + "line": 120, "column": 2 }, "end": { - "line": 116, + "line": 120, "column": 3 } } @@ -15641,15 +16456,15 @@ "updateContext": null }, "value": "else", - "start": 3082, - "end": 3086, + "start": 3191, + "end": 3195, "loc": { "start": { - "line": 116, + "line": 120, "column": 4 }, "end": { - "line": 116, + "line": 120, "column": 8 } } @@ -15669,15 +16484,15 @@ "updateContext": null }, "value": "if", - "start": 3087, - "end": 3089, + "start": 3196, + "end": 3198, "loc": { "start": { - "line": 116, + "line": 120, "column": 9 }, "end": { - "line": 116, + "line": 120, "column": 11 } } @@ -15694,15 +16509,15 @@ "postfix": false, "binop": null }, - "start": 3090, - "end": 3091, + "start": 3199, + "end": 3200, "loc": { "start": { - "line": 116, + "line": 120, "column": 12 }, "end": { - "line": 116, + "line": 120, "column": 13 } } @@ -15720,15 +16535,15 @@ "binop": null }, "value": "node", - "start": 3091, - "end": 3095, + "start": 3200, + "end": 3204, "loc": { "start": { - "line": 116, + "line": 120, "column": 13 }, "end": { - "line": 116, + "line": 120, "column": 17 } } @@ -15747,15 +16562,15 @@ "updateContext": null }, "value": "===", - "start": 3096, - "end": 3099, + "start": 3205, + "end": 3208, "loc": { "start": { - "line": 116, + "line": 120, "column": 18 }, "end": { - "line": 116, + "line": 120, "column": 21 } } @@ -15775,15 +16590,15 @@ "updateContext": null }, "value": "this", - "start": 3100, - "end": 3104, + "start": 3209, + "end": 3213, "loc": { "start": { - "line": 116, + "line": 120, "column": 22 }, "end": { - "line": 116, + "line": 120, "column": 26 } } @@ -15801,15 +16616,15 @@ "binop": null, "updateContext": null }, - "start": 3104, - "end": 3105, + "start": 3213, + "end": 3214, "loc": { "start": { - "line": 116, + "line": 120, "column": 26 }, "end": { - "line": 116, + "line": 120, "column": 27 } } @@ -15827,15 +16642,15 @@ "binop": null }, "value": "root", - "start": 3105, - "end": 3109, + "start": 3214, + "end": 3218, "loc": { "start": { - "line": 116, + "line": 120, "column": 27 }, "end": { - "line": 116, + "line": 120, "column": 31 } } @@ -15852,15 +16667,15 @@ "postfix": false, "binop": null }, - "start": 3109, - "end": 3110, + "start": 3218, + "end": 3219, "loc": { "start": { - "line": 116, + "line": 120, "column": 31 }, "end": { - "line": 116, + "line": 120, "column": 32 } } @@ -15877,15 +16692,15 @@ "postfix": false, "binop": null }, - "start": 3111, - "end": 3112, + "start": 3220, + "end": 3221, "loc": { "start": { - "line": 116, + "line": 120, "column": 33 }, "end": { - "line": 116, + "line": 120, "column": 34 } } @@ -15905,15 +16720,15 @@ "updateContext": null }, "value": "this", - "start": 3116, - "end": 3120, + "start": 3225, + "end": 3229, "loc": { "start": { - "line": 117, + "line": 121, "column": 3 }, "end": { - "line": 117, + "line": 121, "column": 7 } } @@ -15931,15 +16746,15 @@ "binop": null, "updateContext": null }, - "start": 3120, - "end": 3121, + "start": 3229, + "end": 3230, "loc": { "start": { - "line": 117, + "line": 121, "column": 7 }, "end": { - "line": 117, + "line": 121, "column": 8 } } @@ -15957,15 +16772,15 @@ "binop": null }, "value": "root", - "start": 3121, - "end": 3125, + "start": 3230, + "end": 3234, "loc": { "start": { - "line": 117, + "line": 121, "column": 8 }, "end": { - "line": 117, + "line": 121, "column": 12 } } @@ -15984,15 +16799,15 @@ "updateContext": null }, "value": "=", - "start": 3126, - "end": 3127, + "start": 3235, + "end": 3236, "loc": { "start": { - "line": 117, + "line": 121, "column": 13 }, "end": { - "line": 117, + "line": 121, "column": 14 } } @@ -16012,15 +16827,15 @@ "updateContext": null }, "value": "null", - "start": 3128, - "end": 3132, + "start": 3237, + "end": 3241, "loc": { "start": { - "line": 117, + "line": 121, "column": 15 }, "end": { - "line": 117, + "line": 121, "column": 19 } } @@ -16038,15 +16853,15 @@ "binop": null, "updateContext": null }, - "start": 3132, - "end": 3133, + "start": 3241, + "end": 3242, "loc": { "start": { - "line": 117, + "line": 121, "column": 19 }, "end": { - "line": 117, + "line": 121, "column": 20 } } @@ -16063,15 +16878,15 @@ "postfix": false, "binop": null }, - "start": 3136, - "end": 3137, + "start": 3245, + "end": 3246, "loc": { "start": { - "line": 118, + "line": 122, "column": 2 }, "end": { - "line": 118, + "line": 122, "column": 3 } } @@ -16091,15 +16906,15 @@ "updateContext": null }, "value": "else", - "start": 3138, - "end": 3142, + "start": 3247, + "end": 3251, "loc": { "start": { - "line": 118, + "line": 122, "column": 4 }, "end": { - "line": 118, + "line": 122, "column": 8 } } @@ -16116,15 +16931,15 @@ "postfix": false, "binop": null }, - "start": 3143, - "end": 3144, + "start": 3252, + "end": 3253, "loc": { "start": { - "line": 118, + "line": 122, "column": 9 }, "end": { - "line": 118, + "line": 122, "column": 10 } } @@ -16141,17 +16956,17 @@ "postfix": false, "binop": null }, - "value": "delete_one_child", - "start": 3148, - "end": 3164, + "value": "delete_no_child", + "start": 3257, + "end": 3272, "loc": { "start": { - "line": 119, + "line": 123, "column": 3 }, "end": { - "line": 119, - "column": 19 + "line": 123, + "column": 18 } } }, @@ -16167,16 +16982,16 @@ "postfix": false, "binop": null }, - "start": 3164, - "end": 3165, + "start": 3272, + "end": 3273, "loc": { "start": { - "line": 119, - "column": 19 + "line": 123, + "column": 18 }, "end": { - "line": 119, - "column": 20 + "line": 123, + "column": 19 } } }, @@ -16193,16 +17008,16 @@ "binop": null }, "value": "node", - "start": 3165, - "end": 3169, + "start": 3273, + "end": 3277, "loc": { "start": { - "line": 119, - "column": 20 + "line": 123, + "column": 19 }, "end": { - "line": 119, - "column": 24 + "line": 123, + "column": 23 } } }, @@ -16218,16 +17033,16 @@ "postfix": false, "binop": null }, - "start": 3169, - "end": 3170, + "start": 3277, + "end": 3278, "loc": { "start": { - "line": 119, - "column": 24 + "line": 123, + "column": 23 }, "end": { - "line": 119, - "column": 25 + "line": 123, + "column": 24 } } }, @@ -16244,16 +17059,16 @@ "binop": null, "updateContext": null }, - "start": 3170, - "end": 3171, + "start": 3278, + "end": 3279, "loc": { "start": { - "line": 119, - "column": 25 + "line": 123, + "column": 24 }, "end": { - "line": 119, - "column": 26 + "line": 123, + "column": 25 } } }, @@ -16269,15 +17084,15 @@ "postfix": false, "binop": null }, - "start": 3174, - "end": 3175, + "start": 3282, + "end": 3283, "loc": { "start": { - "line": 120, + "line": 124, "column": 2 }, "end": { - "line": 120, + "line": 124, "column": 3 } } @@ -16294,31 +17109,31 @@ "postfix": false, "binop": null }, - "start": 3177, - "end": 3178, + "start": 3285, + "end": 3286, "loc": { "start": { - "line": 121, + "line": 125, "column": 1 }, "end": { - "line": 121, + "line": 125, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 3181, - "end": 3593, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 3289, + "end": 3701, "loc": { "start": { - "line": 123, + "line": 127, "column": 1 }, "end": { - "line": 131, + "line": 135, "column": 4 } } @@ -16336,15 +17151,15 @@ "binop": null }, "value": "remove", - "start": 3595, - "end": 3601, + "start": 3703, + "end": 3709, "loc": { "start": { - "line": 132, + "line": 136, "column": 1 }, "end": { - "line": 132, + "line": 136, "column": 7 } } @@ -16361,15 +17176,15 @@ "postfix": false, "binop": null }, - "start": 3601, - "end": 3602, + "start": 3709, + "end": 3710, "loc": { "start": { - "line": 132, + "line": 136, "column": 7 }, "end": { - "line": 132, + "line": 136, "column": 8 } } @@ -16387,15 +17202,15 @@ "binop": null }, "value": "key", - "start": 3602, - "end": 3605, + "start": 3710, + "end": 3713, "loc": { "start": { - "line": 132, + "line": 136, "column": 8 }, "end": { - "line": 132, + "line": 136, "column": 11 } } @@ -16412,15 +17227,15 @@ "postfix": false, "binop": null }, - "start": 3605, - "end": 3606, + "start": 3713, + "end": 3714, "loc": { "start": { - "line": 132, + "line": 136, "column": 11 }, "end": { - "line": 132, + "line": 136, "column": 12 } } @@ -16437,15 +17252,15 @@ "postfix": false, "binop": null }, - "start": 3607, - "end": 3608, + "start": 3715, + "end": 3716, "loc": { "start": { - "line": 132, + "line": 136, "column": 13 }, "end": { - "line": 132, + "line": 136, "column": 14 } } @@ -16465,15 +17280,15 @@ "updateContext": null }, "value": "const", - "start": 3611, - "end": 3616, + "start": 3719, + "end": 3724, "loc": { "start": { - "line": 133, + "line": 137, "column": 2 }, "end": { - "line": 133, + "line": 137, "column": 7 } } @@ -16491,15 +17306,15 @@ "binop": null }, "value": "node", - "start": 3617, - "end": 3621, + "start": 3725, + "end": 3729, "loc": { "start": { - "line": 133, + "line": 137, "column": 8 }, "end": { - "line": 133, + "line": 137, "column": 12 } } @@ -16518,15 +17333,15 @@ "updateContext": null }, "value": "=", - "start": 3622, - "end": 3623, + "start": 3730, + "end": 3731, "loc": { "start": { - "line": 133, + "line": 137, "column": 13 }, "end": { - "line": 133, + "line": 137, "column": 14 } } @@ -16546,15 +17361,15 @@ "updateContext": null }, "value": "this", - "start": 3624, - "end": 3628, + "start": 3732, + "end": 3736, "loc": { "start": { - "line": 133, + "line": 137, "column": 15 }, "end": { - "line": 133, + "line": 137, "column": 19 } } @@ -16572,15 +17387,15 @@ "binop": null, "updateContext": null }, - "start": 3628, - "end": 3629, + "start": 3736, + "end": 3737, "loc": { "start": { - "line": 133, + "line": 137, "column": 19 }, "end": { - "line": 133, + "line": 137, "column": 20 } } @@ -16598,15 +17413,15 @@ "binop": null }, "value": "_search", - "start": 3629, - "end": 3636, + "start": 3737, + "end": 3744, "loc": { "start": { - "line": 133, + "line": 137, "column": 20 }, "end": { - "line": 133, + "line": 137, "column": 27 } } @@ -16623,15 +17438,15 @@ "postfix": false, "binop": null }, - "start": 3636, - "end": 3637, + "start": 3744, + "end": 3745, "loc": { "start": { - "line": 133, + "line": 137, "column": 27 }, "end": { - "line": 133, + "line": 137, "column": 28 } } @@ -16649,15 +17464,15 @@ "binop": null }, "value": "key", - "start": 3637, - "end": 3640, + "start": 3745, + "end": 3748, "loc": { "start": { - "line": 133, + "line": 137, "column": 28 }, "end": { - "line": 133, + "line": 137, "column": 31 } } @@ -16674,15 +17489,15 @@ "postfix": false, "binop": null }, - "start": 3640, - "end": 3641, + "start": 3748, + "end": 3749, "loc": { "start": { - "line": 133, + "line": 137, "column": 31 }, "end": { - "line": 133, + "line": 137, "column": 32 } } @@ -16700,15 +17515,15 @@ "binop": null, "updateContext": null }, - "start": 3641, - "end": 3642, + "start": 3749, + "end": 3750, "loc": { "start": { - "line": 133, + "line": 137, "column": 32 }, "end": { - "line": 133, + "line": 137, "column": 33 } } @@ -16728,15 +17543,15 @@ "updateContext": null }, "value": "if", - "start": 3645, - "end": 3647, + "start": 3753, + "end": 3755, "loc": { "start": { - "line": 134, + "line": 138, "column": 2 }, "end": { - "line": 134, + "line": 138, "column": 4 } } @@ -16753,15 +17568,15 @@ "postfix": false, "binop": null }, - "start": 3648, - "end": 3649, + "start": 3756, + "end": 3757, "loc": { "start": { - "line": 134, + "line": 138, "column": 5 }, "end": { - "line": 134, + "line": 138, "column": 6 } } @@ -16779,15 +17594,15 @@ "binop": null }, "value": "node", - "start": 3649, - "end": 3653, + "start": 3757, + "end": 3761, "loc": { "start": { - "line": 134, + "line": 138, "column": 6 }, "end": { - "line": 134, + "line": 138, "column": 10 } } @@ -16806,15 +17621,15 @@ "updateContext": null }, "value": "===", - "start": 3654, - "end": 3657, + "start": 3762, + "end": 3765, "loc": { "start": { - "line": 134, + "line": 138, "column": 11 }, "end": { - "line": 134, + "line": 138, "column": 14 } } @@ -16834,15 +17649,15 @@ "updateContext": null }, "value": "null", - "start": 3658, - "end": 3662, + "start": 3766, + "end": 3770, "loc": { "start": { - "line": 134, + "line": 138, "column": 15 }, "end": { - "line": 134, + "line": 138, "column": 19 } } @@ -16859,15 +17674,15 @@ "postfix": false, "binop": null }, - "start": 3662, - "end": 3663, + "start": 3770, + "end": 3771, "loc": { "start": { - "line": 134, + "line": 138, "column": 19 }, "end": { - "line": 134, + "line": 138, "column": 20 } } @@ -16887,15 +17702,15 @@ "updateContext": null }, "value": "return", - "start": 3664, - "end": 3670, + "start": 3772, + "end": 3778, "loc": { "start": { - "line": 134, + "line": 138, "column": 21 }, "end": { - "line": 134, + "line": 138, "column": 27 } } @@ -16915,15 +17730,15 @@ "updateContext": null }, "value": "false", - "start": 3671, - "end": 3676, + "start": 3779, + "end": 3784, "loc": { "start": { - "line": 134, + "line": 138, "column": 28 }, "end": { - "line": 134, + "line": 138, "column": 33 } } @@ -16941,15 +17756,15 @@ "binop": null, "updateContext": null }, - "start": 3676, - "end": 3677, + "start": 3784, + "end": 3785, "loc": { "start": { - "line": 134, + "line": 138, "column": 33 }, "end": { - "line": 134, + "line": 138, "column": 34 } } @@ -16969,15 +17784,15 @@ "updateContext": null }, "value": "this", - "start": 3681, - "end": 3685, + "start": 3789, + "end": 3793, "loc": { "start": { - "line": 136, + "line": 140, "column": 2 }, "end": { - "line": 136, + "line": 140, "column": 6 } } @@ -16995,15 +17810,15 @@ "binop": null, "updateContext": null }, - "start": 3685, - "end": 3686, + "start": 3793, + "end": 3794, "loc": { "start": { - "line": 136, + "line": 140, "column": 6 }, "end": { - "line": 136, + "line": 140, "column": 7 } } @@ -17021,15 +17836,15 @@ "binop": null }, "value": "_delete", - "start": 3686, - "end": 3693, + "start": 3794, + "end": 3801, "loc": { "start": { - "line": 136, + "line": 140, "column": 7 }, "end": { - "line": 136, + "line": 140, "column": 14 } } @@ -17046,15 +17861,15 @@ "postfix": false, "binop": null }, - "start": 3693, - "end": 3694, + "start": 3801, + "end": 3802, "loc": { "start": { - "line": 136, + "line": 140, "column": 14 }, "end": { - "line": 136, + "line": 140, "column": 15 } } @@ -17072,15 +17887,15 @@ "binop": null }, "value": "node", - "start": 3694, - "end": 3698, + "start": 3802, + "end": 3806, "loc": { "start": { - "line": 136, + "line": 140, "column": 15 }, "end": { - "line": 136, + "line": 140, "column": 19 } } @@ -17097,15 +17912,15 @@ "postfix": false, "binop": null }, - "start": 3698, - "end": 3699, + "start": 3806, + "end": 3807, "loc": { "start": { - "line": 136, + "line": 140, "column": 19 }, "end": { - "line": 136, + "line": 140, "column": 20 } } @@ -17123,15 +17938,15 @@ "binop": null, "updateContext": null }, - "start": 3699, - "end": 3700, + "start": 3807, + "end": 3808, "loc": { "start": { - "line": 136, + "line": 140, "column": 20 }, "end": { - "line": 136, + "line": 140, "column": 21 } } @@ -17151,15 +17966,15 @@ "updateContext": null }, "value": "return", - "start": 3703, - "end": 3709, + "start": 3811, + "end": 3817, "loc": { "start": { - "line": 137, + "line": 141, "column": 2 }, "end": { - "line": 137, + "line": 141, "column": 8 } } @@ -17179,15 +17994,15 @@ "updateContext": null }, "value": "true", - "start": 3710, - "end": 3714, + "start": 3818, + "end": 3822, "loc": { "start": { - "line": 137, + "line": 141, "column": 9 }, "end": { - "line": 137, + "line": 141, "column": 13 } } @@ -17205,15 +18020,15 @@ "binop": null, "updateContext": null }, - "start": 3714, - "end": 3715, + "start": 3822, + "end": 3823, "loc": { "start": { - "line": 137, + "line": 141, "column": 13 }, "end": { - "line": 137, + "line": 141, "column": 14 } } @@ -17230,15 +18045,15 @@ "postfix": false, "binop": null }, - "start": 3717, - "end": 3718, + "start": 3825, + "end": 3826, "loc": { "start": { - "line": 138, + "line": 142, "column": 1 }, "end": { - "line": 138, + "line": 142, "column": 2 } } @@ -17246,15 +18061,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", - "start": 3721, - "end": 3978, + "start": 3829, + "end": 4086, "loc": { "start": { - "line": 140, + "line": 144, "column": 1 }, "end": { - "line": 146, + "line": 150, "column": 4 } } @@ -17273,15 +18088,15 @@ "updateContext": null }, "value": "*", - "start": 3980, - "end": 3981, + "start": 4088, + "end": 4089, "loc": { "start": { - "line": 147, + "line": 151, "column": 1 }, "end": { - "line": 147, + "line": 151, "column": 2 } } @@ -17299,15 +18114,15 @@ "binop": null }, "value": "range", - "start": 3981, - "end": 3986, + "start": 4089, + "end": 4094, "loc": { "start": { - "line": 147, + "line": 151, "column": 2 }, "end": { - "line": 147, + "line": 151, "column": 7 } } @@ -17324,15 +18139,15 @@ "postfix": false, "binop": null }, - "start": 3986, - "end": 3987, + "start": 4094, + "end": 4095, "loc": { "start": { - "line": 147, + "line": 151, "column": 7 }, "end": { - "line": 147, + "line": 151, "column": 8 } } @@ -17350,15 +18165,15 @@ "binop": null }, "value": "left", - "start": 3987, - "end": 3991, + "start": 4095, + "end": 4099, "loc": { "start": { - "line": 147, + "line": 151, "column": 8 }, "end": { - "line": 147, + "line": 151, "column": 12 } } @@ -17376,15 +18191,15 @@ "binop": null, "updateContext": null }, - "start": 3991, - "end": 3992, + "start": 4099, + "end": 4100, "loc": { "start": { - "line": 147, + "line": 151, "column": 12 }, "end": { - "line": 147, + "line": 151, "column": 13 } } @@ -17402,15 +18217,15 @@ "binop": null }, "value": "right", - "start": 3993, - "end": 3998, + "start": 4101, + "end": 4106, "loc": { "start": { - "line": 147, + "line": 151, "column": 14 }, "end": { - "line": 147, + "line": 151, "column": 19 } } @@ -17427,15 +18242,15 @@ "postfix": false, "binop": null }, - "start": 3998, - "end": 3999, + "start": 4106, + "end": 4107, "loc": { "start": { - "line": 147, + "line": 151, "column": 19 }, "end": { - "line": 147, + "line": 151, "column": 20 } } @@ -17452,15 +18267,15 @@ "postfix": false, "binop": null }, - "start": 4000, - "end": 4001, + "start": 4108, + "end": 4109, "loc": { "start": { - "line": 147, + "line": 151, "column": 21 }, "end": { - "line": 147, + "line": 151, "column": 22 } } @@ -17480,15 +18295,15 @@ "updateContext": null }, "value": "if", - "start": 4004, - "end": 4006, + "start": 4112, + "end": 4114, "loc": { "start": { - "line": 148, + "line": 152, "column": 2 }, "end": { - "line": 148, + "line": 152, "column": 4 } } @@ -17505,15 +18320,15 @@ "postfix": false, "binop": null }, - "start": 4007, - "end": 4008, + "start": 4115, + "end": 4116, "loc": { "start": { - "line": 148, + "line": 152, "column": 5 }, "end": { - "line": 148, + "line": 152, "column": 6 } } @@ -17533,15 +18348,15 @@ "updateContext": null }, "value": "this", - "start": 4008, - "end": 4012, + "start": 4116, + "end": 4120, "loc": { "start": { - "line": 148, + "line": 152, "column": 6 }, "end": { - "line": 148, + "line": 152, "column": 10 } } @@ -17559,15 +18374,15 @@ "binop": null, "updateContext": null }, - "start": 4012, - "end": 4013, + "start": 4120, + "end": 4121, "loc": { "start": { - "line": 148, + "line": 152, "column": 10 }, "end": { - "line": 148, + "line": 152, "column": 11 } } @@ -17585,15 +18400,15 @@ "binop": null }, "value": "root", - "start": 4013, - "end": 4017, + "start": 4121, + "end": 4125, "loc": { "start": { - "line": 148, + "line": 152, "column": 11 }, "end": { - "line": 148, + "line": 152, "column": 15 } } @@ -17612,15 +18427,15 @@ "updateContext": null }, "value": "!==", - "start": 4018, - "end": 4021, + "start": 4126, + "end": 4129, "loc": { "start": { - "line": 148, + "line": 152, "column": 16 }, "end": { - "line": 148, + "line": 152, "column": 19 } } @@ -17640,15 +18455,15 @@ "updateContext": null }, "value": "null", - "start": 4022, - "end": 4026, + "start": 4130, + "end": 4134, "loc": { "start": { - "line": 148, + "line": 152, "column": 20 }, "end": { - "line": 148, + "line": 152, "column": 24 } } @@ -17665,15 +18480,15 @@ "postfix": false, "binop": null }, - "start": 4026, - "end": 4027, + "start": 4134, + "end": 4135, "loc": { "start": { - "line": 148, + "line": 152, "column": 24 }, "end": { - "line": 148, + "line": 152, "column": 25 } } @@ -17693,15 +18508,15 @@ "updateContext": null }, "value": "yield", - "start": 4031, - "end": 4036, + "start": 4139, + "end": 4144, "loc": { "start": { - "line": 149, + "line": 153, "column": 3 }, "end": { - "line": 149, + "line": 153, "column": 8 } } @@ -17720,15 +18535,15 @@ "updateContext": null }, "value": "*", - "start": 4036, - "end": 4037, + "start": 4144, + "end": 4145, "loc": { "start": { - "line": 149, + "line": 153, "column": 8 }, "end": { - "line": 149, + "line": 153, "column": 9 } } @@ -17746,15 +18561,15 @@ "binop": null }, "value": "rangetraversal", - "start": 4038, - "end": 4052, + "start": 4146, + "end": 4160, "loc": { "start": { - "line": 149, + "line": 153, "column": 10 }, "end": { - "line": 149, + "line": 153, "column": 24 } } @@ -17771,15 +18586,15 @@ "postfix": false, "binop": null }, - "start": 4052, - "end": 4053, + "start": 4160, + "end": 4161, "loc": { "start": { - "line": 149, + "line": 153, "column": 24 }, "end": { - "line": 149, + "line": 153, "column": 25 } } @@ -17799,15 +18614,15 @@ "updateContext": null }, "value": "this", - "start": 4053, - "end": 4057, + "start": 4161, + "end": 4165, "loc": { "start": { - "line": 149, + "line": 153, "column": 25 }, "end": { - "line": 149, + "line": 153, "column": 29 } } @@ -17825,15 +18640,15 @@ "binop": null, "updateContext": null }, - "start": 4057, - "end": 4058, + "start": 4165, + "end": 4166, "loc": { "start": { - "line": 149, + "line": 153, "column": 29 }, "end": { - "line": 149, + "line": 153, "column": 30 } } @@ -17851,15 +18666,15 @@ "binop": null }, "value": "compare", - "start": 4058, - "end": 4065, + "start": 4166, + "end": 4173, "loc": { "start": { - "line": 149, + "line": 153, "column": 30 }, "end": { - "line": 149, + "line": 153, "column": 37 } } @@ -17877,15 +18692,15 @@ "binop": null, "updateContext": null }, - "start": 4065, - "end": 4066, + "start": 4173, + "end": 4174, "loc": { "start": { - "line": 149, + "line": 153, "column": 37 }, "end": { - "line": 149, + "line": 153, "column": 38 } } @@ -17905,15 +18720,15 @@ "updateContext": null }, "value": "this", - "start": 4067, - "end": 4071, + "start": 4175, + "end": 4179, "loc": { "start": { - "line": 149, + "line": 153, "column": 39 }, "end": { - "line": 149, + "line": 153, "column": 43 } } @@ -17931,15 +18746,15 @@ "binop": null, "updateContext": null }, - "start": 4071, - "end": 4072, + "start": 4179, + "end": 4180, "loc": { "start": { - "line": 149, + "line": 153, "column": 43 }, "end": { - "line": 149, + "line": 153, "column": 44 } } @@ -17957,15 +18772,15 @@ "binop": null }, "value": "root", - "start": 4072, - "end": 4076, + "start": 4180, + "end": 4184, "loc": { "start": { - "line": 149, + "line": 153, "column": 44 }, "end": { - "line": 149, + "line": 153, "column": 48 } } @@ -17983,15 +18798,15 @@ "binop": null, "updateContext": null }, - "start": 4076, - "end": 4077, + "start": 4184, + "end": 4185, "loc": { "start": { - "line": 149, + "line": 153, "column": 48 }, "end": { - "line": 149, + "line": 153, "column": 49 } } @@ -18009,15 +18824,15 @@ "binop": null }, "value": "left", - "start": 4078, - "end": 4082, + "start": 4186, + "end": 4190, "loc": { "start": { - "line": 149, + "line": 153, "column": 50 }, "end": { - "line": 149, + "line": 153, "column": 54 } } @@ -18035,15 +18850,15 @@ "binop": null, "updateContext": null }, - "start": 4082, - "end": 4083, + "start": 4190, + "end": 4191, "loc": { "start": { - "line": 149, + "line": 153, "column": 54 }, "end": { - "line": 149, + "line": 153, "column": 55 } } @@ -18061,15 +18876,15 @@ "binop": null }, "value": "right", - "start": 4084, - "end": 4089, + "start": 4192, + "end": 4197, "loc": { "start": { - "line": 149, + "line": 153, "column": 56 }, "end": { - "line": 149, + "line": 153, "column": 61 } } @@ -18086,15 +18901,15 @@ "postfix": false, "binop": null }, - "start": 4089, - "end": 4090, + "start": 4197, + "end": 4198, "loc": { "start": { - "line": 149, + "line": 153, "column": 61 }, "end": { - "line": 149, + "line": 153, "column": 62 } } @@ -18112,15 +18927,15 @@ "binop": null, "updateContext": null }, - "start": 4090, - "end": 4091, + "start": 4198, + "end": 4199, "loc": { "start": { - "line": 149, + "line": 153, "column": 62 }, "end": { - "line": 149, + "line": 153, "column": 63 } } @@ -18137,15 +18952,15 @@ "postfix": false, "binop": null }, - "start": 4093, - "end": 4094, + "start": 4201, + "end": 4202, "loc": { "start": { - "line": 150, + "line": 154, "column": 1 }, "end": { - "line": 150, + "line": 154, "column": 2 } } @@ -18153,15 +18968,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", - "start": 4097, - "end": 4201, + "start": 4205, + "end": 4309, "loc": { "start": { - "line": 152, + "line": 156, "column": 1 }, "end": { - "line": 156, + "line": 160, "column": 4 } } @@ -18180,15 +18995,15 @@ "updateContext": null }, "value": "*", - "start": 4203, - "end": 4204, + "start": 4311, + "end": 4312, "loc": { "start": { - "line": 157, + "line": 161, "column": 1 }, "end": { - "line": 157, + "line": 161, "column": 2 } } @@ -18206,15 +19021,15 @@ "binop": null }, "value": "items", - "start": 4204, - "end": 4209, + "start": 4312, + "end": 4317, "loc": { "start": { - "line": 157, + "line": 161, "column": 2 }, "end": { - "line": 157, + "line": 161, "column": 7 } } @@ -18231,15 +19046,15 @@ "postfix": false, "binop": null }, - "start": 4209, - "end": 4210, + "start": 4317, + "end": 4318, "loc": { "start": { - "line": 157, + "line": 161, "column": 7 }, "end": { - "line": 157, + "line": 161, "column": 8 } } @@ -18256,15 +19071,15 @@ "postfix": false, "binop": null }, - "start": 4210, - "end": 4211, + "start": 4318, + "end": 4319, "loc": { "start": { - "line": 157, + "line": 161, "column": 8 }, "end": { - "line": 157, + "line": 161, "column": 9 } } @@ -18281,15 +19096,15 @@ "postfix": false, "binop": null }, - "start": 4212, - "end": 4213, + "start": 4320, + "end": 4321, "loc": { "start": { - "line": 157, + "line": 161, "column": 10 }, "end": { - "line": 157, + "line": 161, "column": 11 } } @@ -18309,15 +19124,15 @@ "updateContext": null }, "value": "if", - "start": 4216, - "end": 4218, + "start": 4324, + "end": 4326, "loc": { "start": { - "line": 158, + "line": 162, "column": 2 }, "end": { - "line": 158, + "line": 162, "column": 4 } } @@ -18334,15 +19149,15 @@ "postfix": false, "binop": null }, - "start": 4219, - "end": 4220, + "start": 4327, + "end": 4328, "loc": { "start": { - "line": 158, + "line": 162, "column": 5 }, "end": { - "line": 158, + "line": 162, "column": 6 } } @@ -18362,15 +19177,15 @@ "updateContext": null }, "value": "this", - "start": 4220, - "end": 4224, + "start": 4328, + "end": 4332, "loc": { "start": { - "line": 158, + "line": 162, "column": 6 }, "end": { - "line": 158, + "line": 162, "column": 10 } } @@ -18388,15 +19203,15 @@ "binop": null, "updateContext": null }, - "start": 4224, - "end": 4225, + "start": 4332, + "end": 4333, "loc": { "start": { - "line": 158, + "line": 162, "column": 10 }, "end": { - "line": 158, + "line": 162, "column": 11 } } @@ -18414,15 +19229,15 @@ "binop": null }, "value": "root", - "start": 4225, - "end": 4229, + "start": 4333, + "end": 4337, "loc": { "start": { - "line": 158, + "line": 162, "column": 11 }, "end": { - "line": 158, + "line": 162, "column": 15 } } @@ -18441,15 +19256,15 @@ "updateContext": null }, "value": "!==", - "start": 4230, - "end": 4233, + "start": 4338, + "end": 4341, "loc": { "start": { - "line": 158, + "line": 162, "column": 16 }, "end": { - "line": 158, + "line": 162, "column": 19 } } @@ -18469,15 +19284,15 @@ "updateContext": null }, "value": "null", - "start": 4234, - "end": 4238, + "start": 4342, + "end": 4346, "loc": { "start": { - "line": 158, + "line": 162, "column": 20 }, "end": { - "line": 158, + "line": 162, "column": 24 } } @@ -18494,15 +19309,15 @@ "postfix": false, "binop": null }, - "start": 4238, - "end": 4239, + "start": 4346, + "end": 4347, "loc": { "start": { - "line": 158, + "line": 162, "column": 24 }, "end": { - "line": 158, + "line": 162, "column": 25 } } @@ -18522,15 +19337,15 @@ "updateContext": null }, "value": "yield", - "start": 4240, - "end": 4245, + "start": 4348, + "end": 4353, "loc": { "start": { - "line": 158, + "line": 162, "column": 26 }, "end": { - "line": 158, + "line": 162, "column": 31 } } @@ -18549,15 +19364,15 @@ "updateContext": null }, "value": "*", - "start": 4245, - "end": 4246, + "start": 4353, + "end": 4354, "loc": { "start": { - "line": 158, + "line": 162, "column": 31 }, "end": { - "line": 158, + "line": 162, "column": 32 } } @@ -18575,15 +19390,15 @@ "binop": null }, "value": "inordertraversal", - "start": 4247, - "end": 4263, + "start": 4355, + "end": 4371, "loc": { "start": { - "line": 158, + "line": 162, "column": 33 }, "end": { - "line": 158, + "line": 162, "column": 49 } } @@ -18600,15 +19415,15 @@ "postfix": false, "binop": null }, - "start": 4263, - "end": 4264, + "start": 4371, + "end": 4372, "loc": { "start": { - "line": 158, + "line": 162, "column": 49 }, "end": { - "line": 158, + "line": 162, "column": 50 } } @@ -18628,15 +19443,15 @@ "updateContext": null }, "value": "this", - "start": 4264, - "end": 4268, + "start": 4372, + "end": 4376, "loc": { "start": { - "line": 158, + "line": 162, "column": 50 }, "end": { - "line": 158, + "line": 162, "column": 54 } } @@ -18654,15 +19469,15 @@ "binop": null, "updateContext": null }, - "start": 4268, - "end": 4269, + "start": 4376, + "end": 4377, "loc": { "start": { - "line": 158, + "line": 162, "column": 54 }, "end": { - "line": 158, + "line": 162, "column": 55 } } @@ -18680,15 +19495,15 @@ "binop": null }, "value": "root", - "start": 4269, - "end": 4273, + "start": 4377, + "end": 4381, "loc": { "start": { - "line": 158, + "line": 162, "column": 55 }, "end": { - "line": 158, + "line": 162, "column": 59 } } @@ -18705,15 +19520,15 @@ "postfix": false, "binop": null }, - "start": 4273, - "end": 4274, + "start": 4381, + "end": 4382, "loc": { "start": { - "line": 158, + "line": 162, "column": 59 }, "end": { - "line": 158, + "line": 162, "column": 60 } } @@ -18731,15 +19546,15 @@ "binop": null, "updateContext": null }, - "start": 4274, - "end": 4275, + "start": 4382, + "end": 4383, "loc": { "start": { - "line": 158, + "line": 162, "column": 60 }, "end": { - "line": 158, + "line": 162, "column": 61 } } @@ -18756,15 +19571,15 @@ "postfix": false, "binop": null }, - "start": 4277, - "end": 4278, + "start": 4385, + "end": 4386, "loc": { "start": { - "line": 159, + "line": 163, "column": 1 }, "end": { - "line": 159, + "line": 163, "column": 2 } } @@ -18772,15 +19587,15 @@ { "type": "CommentBlock", "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 4281, - "end": 4329, + "start": 4389, + "end": 4437, "loc": { "start": { - "line": 161, + "line": 165, "column": 1 }, "end": { - "line": 163, + "line": 167, "column": 4 } } @@ -18798,15 +19613,15 @@ "binop": null, "updateContext": null }, - "start": 4331, - "end": 4332, + "start": 4439, + "end": 4440, "loc": { "start": { - "line": 164, + "line": 168, "column": 1 }, "end": { - "line": 164, + "line": 168, "column": 2 } } @@ -18824,15 +19639,15 @@ "binop": null }, "value": "Symbol", - "start": 4332, - "end": 4338, + "start": 4440, + "end": 4446, "loc": { "start": { - "line": 164, + "line": 168, "column": 2 }, "end": { - "line": 164, + "line": 168, "column": 8 } } @@ -18850,15 +19665,15 @@ "binop": null, "updateContext": null }, - "start": 4338, - "end": 4339, + "start": 4446, + "end": 4447, "loc": { "start": { - "line": 164, + "line": 168, "column": 8 }, "end": { - "line": 164, + "line": 168, "column": 9 } } @@ -18876,15 +19691,15 @@ "binop": null }, "value": "iterator", - "start": 4339, - "end": 4347, + "start": 4447, + "end": 4455, "loc": { "start": { - "line": 164, + "line": 168, "column": 9 }, "end": { - "line": 164, + "line": 168, "column": 17 } } @@ -18902,15 +19717,15 @@ "binop": null, "updateContext": null }, - "start": 4347, - "end": 4348, + "start": 4455, + "end": 4456, "loc": { "start": { - "line": 164, + "line": 168, "column": 17 }, "end": { - "line": 164, + "line": 168, "column": 18 } } @@ -18927,15 +19742,15 @@ "postfix": false, "binop": null }, - "start": 4348, - "end": 4349, + "start": 4456, + "end": 4457, "loc": { "start": { - "line": 164, + "line": 168, "column": 18 }, "end": { - "line": 164, + "line": 168, "column": 19 } } @@ -18952,15 +19767,15 @@ "postfix": false, "binop": null }, - "start": 4349, - "end": 4350, + "start": 4457, + "end": 4458, "loc": { "start": { - "line": 164, + "line": 168, "column": 19 }, "end": { - "line": 164, + "line": 168, "column": 20 } } @@ -18977,15 +19792,15 @@ "postfix": false, "binop": null }, - "start": 4351, - "end": 4352, + "start": 4459, + "end": 4460, "loc": { "start": { - "line": 164, + "line": 168, "column": 21 }, "end": { - "line": 164, + "line": 168, "column": 22 } } @@ -19005,15 +19820,15 @@ "updateContext": null }, "value": "return", - "start": 4355, - "end": 4361, + "start": 4463, + "end": 4469, "loc": { "start": { - "line": 165, + "line": 169, "column": 2 }, "end": { - "line": 165, + "line": 169, "column": 8 } } @@ -19033,15 +19848,15 @@ "updateContext": null }, "value": "this", - "start": 4362, - "end": 4366, + "start": 4470, + "end": 4474, "loc": { "start": { - "line": 165, + "line": 169, "column": 9 }, "end": { - "line": 165, + "line": 169, "column": 13 } } @@ -19059,15 +19874,15 @@ "binop": null, "updateContext": null }, - "start": 4366, - "end": 4367, + "start": 4474, + "end": 4475, "loc": { "start": { - "line": 165, + "line": 169, "column": 13 }, "end": { - "line": 165, + "line": 169, "column": 14 } } @@ -19085,15 +19900,15 @@ "binop": null }, "value": "items", - "start": 4367, - "end": 4372, + "start": 4475, + "end": 4480, "loc": { "start": { - "line": 165, + "line": 169, "column": 14 }, "end": { - "line": 165, + "line": 169, "column": 19 } } @@ -19110,15 +19925,15 @@ "postfix": false, "binop": null }, - "start": 4372, - "end": 4373, + "start": 4480, + "end": 4481, "loc": { "start": { - "line": 165, + "line": 169, "column": 19 }, "end": { - "line": 165, + "line": 169, "column": 20 } } @@ -19135,15 +19950,15 @@ "postfix": false, "binop": null }, - "start": 4373, - "end": 4374, + "start": 4481, + "end": 4482, "loc": { "start": { - "line": 165, + "line": 169, "column": 20 }, "end": { - "line": 165, + "line": 169, "column": 21 } } @@ -19161,15 +19976,15 @@ "binop": null, "updateContext": null }, - "start": 4374, - "end": 4375, + "start": 4482, + "end": 4483, "loc": { "start": { - "line": 165, + "line": 169, "column": 21 }, "end": { - "line": 165, + "line": 169, "column": 22 } } @@ -19186,15 +20001,15 @@ "postfix": false, "binop": null }, - "start": 4377, - "end": 4378, + "start": 4485, + "end": 4486, "loc": { "start": { - "line": 166, + "line": 170, "column": 1 }, "end": { - "line": 166, + "line": 170, "column": 2 } } @@ -19202,15 +20017,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4381, - "end": 4525, + "start": 4489, + "end": 4633, "loc": { "start": { - "line": 168, + "line": 172, "column": 1 }, "end": { - "line": 173, + "line": 177, "column": 4 } } @@ -19228,15 +20043,15 @@ "binop": null }, "value": "static", - "start": 4527, - "end": 4533, + "start": 4635, + "end": 4641, "loc": { "start": { - "line": 174, + "line": 178, "column": 1 }, "end": { - "line": 174, + "line": 178, "column": 7 } } @@ -19254,15 +20069,15 @@ "binop": null }, "value": "empty", - "start": 4534, - "end": 4539, + "start": 4642, + "end": 4647, "loc": { "start": { - "line": 174, + "line": 178, "column": 8 }, "end": { - "line": 174, + "line": 178, "column": 13 } } @@ -19279,15 +20094,15 @@ "postfix": false, "binop": null }, - "start": 4539, - "end": 4540, + "start": 4647, + "end": 4648, "loc": { "start": { - "line": 174, + "line": 178, "column": 13 }, "end": { - "line": 174, + "line": 178, "column": 14 } } @@ -19305,15 +20120,15 @@ "binop": null }, "value": "compare", - "start": 4540, - "end": 4547, + "start": 4648, + "end": 4655, "loc": { "start": { - "line": 174, + "line": 178, "column": 14 }, "end": { - "line": 174, + "line": 178, "column": 21 } } @@ -19330,15 +20145,15 @@ "postfix": false, "binop": null }, - "start": 4547, - "end": 4548, + "start": 4655, + "end": 4656, "loc": { "start": { - "line": 174, + "line": 178, "column": 21 }, "end": { - "line": 174, + "line": 178, "column": 22 } } @@ -19355,15 +20170,15 @@ "postfix": false, "binop": null }, - "start": 4549, - "end": 4550, + "start": 4657, + "end": 4658, "loc": { "start": { - "line": 174, + "line": 178, "column": 23 }, "end": { - "line": 174, + "line": 178, "column": 24 } } @@ -19383,15 +20198,15 @@ "updateContext": null }, "value": "return", - "start": 4553, - "end": 4559, + "start": 4661, + "end": 4667, "loc": { "start": { - "line": 175, + "line": 179, "column": 2 }, "end": { - "line": 175, + "line": 179, "column": 8 } } @@ -19411,15 +20226,15 @@ "updateContext": null }, "value": "new", - "start": 4560, - "end": 4563, + "start": 4668, + "end": 4671, "loc": { "start": { - "line": 175, + "line": 179, "column": 9 }, "end": { - "line": 175, + "line": 179, "column": 12 } } @@ -19437,15 +20252,15 @@ "binop": null }, "value": "RedBlackTree", - "start": 4564, - "end": 4576, + "start": 4672, + "end": 4684, "loc": { "start": { - "line": 175, + "line": 179, "column": 13 }, "end": { - "line": 175, + "line": 179, "column": 25 } } @@ -19462,15 +20277,15 @@ "postfix": false, "binop": null }, - "start": 4576, - "end": 4577, + "start": 4684, + "end": 4685, "loc": { "start": { - "line": 175, + "line": 179, "column": 25 }, "end": { - "line": 175, + "line": 179, "column": 26 } } @@ -19488,15 +20303,15 @@ "binop": null }, "value": "compare", - "start": 4577, - "end": 4584, + "start": 4685, + "end": 4692, "loc": { "start": { - "line": 175, + "line": 179, "column": 26 }, "end": { - "line": 175, + "line": 179, "column": 33 } } @@ -19513,15 +20328,15 @@ "postfix": false, "binop": null }, - "start": 4584, - "end": 4585, + "start": 4692, + "end": 4693, "loc": { "start": { - "line": 175, + "line": 179, "column": 33 }, "end": { - "line": 175, + "line": 179, "column": 34 } } @@ -19539,15 +20354,15 @@ "binop": null, "updateContext": null }, - "start": 4585, - "end": 4586, + "start": 4693, + "end": 4694, "loc": { "start": { - "line": 175, + "line": 179, "column": 34 }, "end": { - "line": 175, + "line": 179, "column": 35 } } @@ -19564,15 +20379,15 @@ "postfix": false, "binop": null }, - "start": 4588, - "end": 4589, + "start": 4696, + "end": 4697, "loc": { "start": { - "line": 176, + "line": 180, "column": 1 }, "end": { - "line": 176, + "line": 180, "column": 2 } } @@ -19580,15 +20395,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4592, - "end": 4805, + "start": 4700, + "end": 4913, "loc": { "start": { - "line": 178, + "line": 182, "column": 1 }, "end": { - "line": 184, + "line": 188, "column": 4 } } @@ -19606,15 +20421,15 @@ "binop": null }, "value": "static", - "start": 4807, - "end": 4813, + "start": 4915, + "end": 4921, "loc": { "start": { - "line": 185, + "line": 189, "column": 1 }, "end": { - "line": 185, + "line": 189, "column": 7 } } @@ -19632,15 +20447,15 @@ "binop": null }, "value": "from", - "start": 4814, - "end": 4818, + "start": 4922, + "end": 4926, "loc": { "start": { - "line": 185, + "line": 189, "column": 8 }, "end": { - "line": 185, + "line": 189, "column": 12 } } @@ -19657,15 +20472,15 @@ "postfix": false, "binop": null }, - "start": 4818, - "end": 4819, + "start": 4926, + "end": 4927, "loc": { "start": { - "line": 185, + "line": 189, "column": 12 }, "end": { - "line": 185, + "line": 189, "column": 13 } } @@ -19683,15 +20498,15 @@ "binop": null }, "value": "compare", - "start": 4819, - "end": 4826, + "start": 4927, + "end": 4934, "loc": { "start": { - "line": 185, + "line": 189, "column": 13 }, "end": { - "line": 185, + "line": 189, "column": 20 } } @@ -19709,15 +20524,15 @@ "binop": null, "updateContext": null }, - "start": 4826, - "end": 4827, + "start": 4934, + "end": 4935, "loc": { "start": { - "line": 185, + "line": 189, "column": 20 }, "end": { - "line": 185, + "line": 189, "column": 21 } } @@ -19735,15 +20550,15 @@ "binop": null }, "value": "iterable", - "start": 4828, - "end": 4836, + "start": 4936, + "end": 4944, "loc": { "start": { - "line": 185, + "line": 189, "column": 22 }, "end": { - "line": 185, + "line": 189, "column": 30 } } @@ -19760,15 +20575,15 @@ "postfix": false, "binop": null }, - "start": 4836, - "end": 4837, + "start": 4944, + "end": 4945, "loc": { "start": { - "line": 185, + "line": 189, "column": 30 }, "end": { - "line": 185, + "line": 189, "column": 31 } } @@ -19785,15 +20600,15 @@ "postfix": false, "binop": null }, - "start": 4838, - "end": 4839, + "start": 4946, + "end": 4947, "loc": { "start": { - "line": 185, + "line": 189, "column": 32 }, "end": { - "line": 185, + "line": 189, "column": 33 } } @@ -19813,15 +20628,15 @@ "updateContext": null }, "value": "const", - "start": 4842, - "end": 4847, + "start": 4950, + "end": 4955, "loc": { "start": { - "line": 186, + "line": 190, "column": 2 }, "end": { - "line": 186, + "line": 190, "column": 7 } } @@ -19839,15 +20654,15 @@ "binop": null }, "value": "tree", - "start": 4848, - "end": 4852, + "start": 4956, + "end": 4960, "loc": { "start": { - "line": 186, + "line": 190, "column": 8 }, "end": { - "line": 186, + "line": 190, "column": 12 } } @@ -19866,15 +20681,15 @@ "updateContext": null }, "value": "=", - "start": 4853, - "end": 4854, + "start": 4961, + "end": 4962, "loc": { "start": { - "line": 186, + "line": 190, "column": 13 }, "end": { - "line": 186, + "line": 190, "column": 14 } } @@ -19894,15 +20709,15 @@ "updateContext": null }, "value": "new", - "start": 4855, - "end": 4858, + "start": 4963, + "end": 4966, "loc": { "start": { - "line": 186, + "line": 190, "column": 15 }, "end": { - "line": 186, + "line": 190, "column": 18 } } @@ -19920,15 +20735,15 @@ "binop": null }, "value": "RedBlackTree", - "start": 4859, - "end": 4871, + "start": 4967, + "end": 4979, "loc": { "start": { - "line": 186, + "line": 190, "column": 19 }, "end": { - "line": 186, + "line": 190, "column": 31 } } @@ -19945,15 +20760,15 @@ "postfix": false, "binop": null }, - "start": 4871, - "end": 4872, + "start": 4979, + "end": 4980, "loc": { "start": { - "line": 186, + "line": 190, "column": 31 }, "end": { - "line": 186, + "line": 190, "column": 32 } } @@ -19971,15 +20786,15 @@ "binop": null }, "value": "compare", - "start": 4872, - "end": 4879, + "start": 4980, + "end": 4987, "loc": { "start": { - "line": 186, + "line": 190, "column": 32 }, "end": { - "line": 186, + "line": 190, "column": 39 } } @@ -19996,15 +20811,15 @@ "postfix": false, "binop": null }, - "start": 4879, - "end": 4880, + "start": 4987, + "end": 4988, "loc": { "start": { - "line": 186, + "line": 190, "column": 39 }, "end": { - "line": 186, + "line": 190, "column": 40 } } @@ -20022,15 +20837,15 @@ "binop": null, "updateContext": null }, - "start": 4880, - "end": 4881, + "start": 4988, + "end": 4989, "loc": { "start": { - "line": 186, + "line": 190, "column": 40 }, "end": { - "line": 186, + "line": 190, "column": 41 } } @@ -20050,15 +20865,15 @@ "updateContext": null }, "value": "for", - "start": 4885, - "end": 4888, + "start": 4993, + "end": 4996, "loc": { "start": { - "line": 188, + "line": 192, "column": 2 }, "end": { - "line": 188, + "line": 192, "column": 5 } } @@ -20075,15 +20890,15 @@ "postfix": false, "binop": null }, - "start": 4889, - "end": 4890, + "start": 4997, + "end": 4998, "loc": { "start": { - "line": 188, + "line": 192, "column": 6 }, "end": { - "line": 188, + "line": 192, "column": 7 } } @@ -20103,15 +20918,15 @@ "updateContext": null }, "value": "const", - "start": 4890, - "end": 4895, + "start": 4998, + "end": 5003, "loc": { "start": { - "line": 188, + "line": 192, "column": 7 }, "end": { - "line": 188, + "line": 192, "column": 12 } } @@ -20129,15 +20944,15 @@ "binop": null }, "value": "element", - "start": 4896, - "end": 4903, + "start": 5004, + "end": 5011, "loc": { "start": { - "line": 188, + "line": 192, "column": 13 }, "end": { - "line": 188, + "line": 192, "column": 20 } } @@ -20155,15 +20970,15 @@ "binop": null }, "value": "of", - "start": 4904, - "end": 4906, + "start": 5012, + "end": 5014, "loc": { "start": { - "line": 188, + "line": 192, "column": 21 }, "end": { - "line": 188, + "line": 192, "column": 23 } } @@ -20181,15 +20996,15 @@ "binop": null }, "value": "iterable", - "start": 4907, - "end": 4915, + "start": 5015, + "end": 5023, "loc": { "start": { - "line": 188, + "line": 192, "column": 24 }, "end": { - "line": 188, + "line": 192, "column": 32 } } @@ -20206,15 +21021,15 @@ "postfix": false, "binop": null }, - "start": 4915, - "end": 4916, + "start": 5023, + "end": 5024, "loc": { "start": { - "line": 188, + "line": 192, "column": 32 }, "end": { - "line": 188, + "line": 192, "column": 33 } } @@ -20232,15 +21047,15 @@ "binop": null }, "value": "tree", - "start": 4917, - "end": 4921, + "start": 5025, + "end": 5029, "loc": { "start": { - "line": 188, + "line": 192, "column": 34 }, "end": { - "line": 188, + "line": 192, "column": 38 } } @@ -20258,15 +21073,15 @@ "binop": null, "updateContext": null }, - "start": 4921, - "end": 4922, + "start": 5029, + "end": 5030, "loc": { "start": { - "line": 188, + "line": 192, "column": 38 }, "end": { - "line": 188, + "line": 192, "column": 39 } } @@ -20284,15 +21099,15 @@ "binop": null }, "value": "add", - "start": 4922, - "end": 4925, + "start": 5030, + "end": 5033, "loc": { "start": { - "line": 188, + "line": 192, "column": 39 }, "end": { - "line": 188, + "line": 192, "column": 42 } } @@ -20309,15 +21124,15 @@ "postfix": false, "binop": null }, - "start": 4925, - "end": 4926, + "start": 5033, + "end": 5034, "loc": { "start": { - "line": 188, + "line": 192, "column": 42 }, "end": { - "line": 188, + "line": 192, "column": 43 } } @@ -20335,15 +21150,15 @@ "binop": null }, "value": "element", - "start": 4926, - "end": 4933, + "start": 5034, + "end": 5041, "loc": { "start": { - "line": 188, + "line": 192, "column": 43 }, "end": { - "line": 188, + "line": 192, "column": 50 } } @@ -20360,15 +21175,15 @@ "postfix": false, "binop": null }, - "start": 4933, - "end": 4934, + "start": 5041, + "end": 5042, "loc": { "start": { - "line": 188, + "line": 192, "column": 50 }, "end": { - "line": 188, + "line": 192, "column": 51 } } @@ -20386,15 +21201,15 @@ "binop": null, "updateContext": null }, - "start": 4934, - "end": 4935, + "start": 5042, + "end": 5043, "loc": { "start": { - "line": 188, + "line": 192, "column": 51 }, "end": { - "line": 188, + "line": 192, "column": 52 } } @@ -20414,15 +21229,15 @@ "updateContext": null }, "value": "return", - "start": 4939, - "end": 4945, + "start": 5047, + "end": 5053, "loc": { "start": { - "line": 190, + "line": 194, "column": 2 }, "end": { - "line": 190, + "line": 194, "column": 8 } } @@ -20440,15 +21255,15 @@ "binop": null }, "value": "tree", - "start": 4946, - "end": 4950, + "start": 5054, + "end": 5058, "loc": { "start": { - "line": 190, + "line": 194, "column": 9 }, "end": { - "line": 190, + "line": 194, "column": 13 } } @@ -20466,15 +21281,15 @@ "binop": null, "updateContext": null }, - "start": 4950, - "end": 4951, + "start": 5058, + "end": 5059, "loc": { "start": { - "line": 190, + "line": 194, "column": 13 }, "end": { - "line": 190, + "line": 194, "column": 14 } } @@ -20491,15 +21306,15 @@ "postfix": false, "binop": null }, - "start": 4953, - "end": 4954, + "start": 5061, + "end": 5062, "loc": { "start": { - "line": 191, + "line": 195, "column": 1 }, "end": { - "line": 191, + "line": 195, "column": 2 } } @@ -20516,15 +21331,15 @@ "postfix": false, "binop": null }, - "start": 4955, - "end": 4956, + "start": 5063, + "end": 5064, "loc": { "start": { - "line": 192, + "line": 196, "column": 0 }, "end": { - "line": 192, + "line": 196, "column": 1 } } @@ -20542,15 +21357,15 @@ "binop": null, "updateContext": null }, - "start": 4957, - "end": 4957, + "start": 5065, + "end": 5065, "loc": { "start": { - "line": 193, + "line": 197, "column": 0 }, "end": { - "line": 193, + "line": 197, "column": 0 } } diff --git a/class/src/types/RedBlackTree.js~RedBlackTree.html b/class/src/types/RedBlackTree.js~RedBlackTree.html index 91001bf..8524e71 100644 --- a/class/src/types/RedBlackTree.js~RedBlackTree.html +++ b/class/src/types/RedBlackTree.js~RedBlackTree.html @@ -34,44 +34,43 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • - + public class - | source + | source
    @@ -374,7 +373,7 @@

    RedBlackTree

    - has(key: any): Boolean + has(key: any): boolean

    @@ -492,7 +491,7 @@

    RedBlackTree

    - remove(key: any): Boolean + remove(key: any): boolean

    @@ -594,7 +593,7 @@

    - source + source

    @@ -667,7 +666,7 @@

    - source + source

    @@ -750,7 +749,7 @@

    - source + source

    @@ -814,7 +813,7 @@

    - source + source

    @@ -857,7 +856,7 @@

    - source + source

    @@ -903,7 +902,7 @@

    - source + source

    @@ -959,7 +958,7 @@

    - source + source

    @@ -1020,7 +1019,7 @@

    - source + source

    @@ -1091,11 +1090,11 @@

    - has(key: any): Boolean + has(key: any): boolean - source + source

    @@ -1133,7 +1132,7 @@

    Return:

    - + @@ -1169,7 +1168,7 @@

    - source + source

    @@ -1226,7 +1225,7 @@

    - source + source

    @@ -1282,7 +1281,7 @@

    - source + source

    @@ -1359,11 +1358,11 @@

    - remove(key: any): Boolean + remove(key: any): boolean - source + source

    @@ -1403,7 +1402,7 @@

    Return:

    Booleanboolean
    - + @@ -1442,7 +1441,7 @@

    - source + source

    @@ -1503,7 +1502,7 @@ diff --git a/coverage.json b/coverage.json index 1ee82e5..56d3c37 100644 --- a/coverage.json +++ b/coverage.json @@ -1,7 +1,7 @@ { "coverage": "100%", - "expectCount": 48, - "actualCount": 48, + "expectCount": 45, + "actualCount": 45, "files": { "src/api/empty.js": { "expectCount": 1, @@ -28,37 +28,37 @@ "actualCount": 1, "undocumentLines": [] }, - "src/deletion/delete_case1.js": { + "src/deletion/delete_case0.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/deletion/delete_case2.js": { + "src/deletion/delete_case1.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/deletion/delete_case3.js": { + "src/deletion/delete_case2.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/deletion/delete_case4.js": { + "src/deletion/delete_case5.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/deletion/delete_case5.js": { + "src/deletion/delete_no_child.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/deletion/delete_case6.js": { + "src/deletion/delete_one_child.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/deletion/delete_one_child.js": { + "src/deletion/prune.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] @@ -93,27 +93,27 @@ "actualCount": 1, "undocumentLines": [] }, - "src/insertion/insert_case1.js": { + "src/insertion/insert_case0.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/insertion/insert_case2.js": { + "src/insertion/insert_case1.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/insertion/insert_case3.js": { + "src/insertion/insert_case2.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/insertion/insert_case4.js": { + "src/insertion/insert_case3.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/insertion/insert_case5.js": { + "src/insertion/insert_case4.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] @@ -143,14 +143,9 @@ "actualCount": 1, "undocumentLines": [] }, - "src/types/Leaf.js": { - "expectCount": 2, - "actualCount": 2, - "undocumentLines": [] - }, "src/types/Node.js": { - "expectCount": 2, - "actualCount": 2, + "expectCount": 1, + "actualCount": 1, "undocumentLines": [] }, "src/types/RedBlackTree.js": { diff --git a/file/src/api/empty.js.html b/file/src/api/empty.js.html index 9866297..566c4e0 100644 --- a/file/src/api/empty.js.html +++ b/file/src/api/empty.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • diff --git a/file/src/api/from.js.html b/file/src/api/from.js.html index 73c4dbe..e1fc5ba 100644 --- a/file/src/api/from.js.html +++ b/file/src/api/from.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • diff --git a/file/src/color/BLACK.js.html b/file/src/color/BLACK.js.html index c225c1d..52fc01c 100644 --- a/file/src/color/BLACK.js.html +++ b/file/src/color/BLACK.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • diff --git a/file/src/color/RED.js.html b/file/src/color/RED.js.html index 4be9f0e..c5ed52a 100644 --- a/file/src/color/RED.js.html +++ b/file/src/color/RED.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • diff --git a/file/src/debug/_debug.js.html b/file/src/debug/_debug.js.html index 1021384..03d352d 100644 --- a/file/src/debug/_debug.js.html +++ b/file/src/debug/_debug.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -67,7 +66,6 @@

    src/debug/_debug.js

    import assert from 'assert';
     import Node from '../types/Node.js';
    -import Leaf from '../types/Leaf.js';
     import BLACK from '../color/BLACK.js';
     
     /**
    @@ -81,15 +79,11 @@
     	 * Recursively constructs a prettyprint string for the red-black tree rooted at
     	 * <code>root</code>.
     	 *
    -	 * @param {Node|Leaf} root - The root of the tree.
    +	 * @param {Node} root - The root of the tree.
     	 * @returns {string}
     	 */
     	const debug = (root) => {
    -		assert(root instanceof Node || root instanceof Leaf);
    -		if (root.isLeaf()) {
    -			assert(root instanceof Leaf);
    -			return black('L');
    -		}
    +		if (root === null) return black('L');
     
     		assert(root instanceof Node);
     
    diff --git a/file/src/types/Leaf.js.html b/file/src/deletion/delete_case0.js.html
    similarity index 87%
    rename from file/src/types/Leaf.js.html
    rename to file/src/deletion/delete_case0.js.html
    index a0501c8..bb5e8d6 100644
    --- a/file/src/types/Leaf.js.html
    +++ b/file/src/deletion/delete_case0.js.html
    @@ -3,7 +3,7 @@
     
       
       
    -  src/types/Leaf.js | @aureooms/js-red-black-tree
    +  src/deletion/delete_case0.js | @aureooms/js-red-black-tree
       
       
       
    @@ -34,64 +34,59 @@
     
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • -

    src/types/Leaf.js

    +

    src/deletion/delete_case0.js

    import assert from 'assert';
     import BLACK from '../color/BLACK.js';
    -import Node from './Node.js';
    +import Node from '../types/Node.js';
    +import delete_case1 from './delete_case1.js';
     
     /**
    - * A black leaf node.
    + * Preconditions:
    + *   - n is black
    + *   - all root-leaf paths going through n have a black height of b - 1
    + *   - all other root-leaf paths have a black height of b
      *
    - * @class
    - * @param {Node} parent - The parent node in the tree.
    + * @param {Node} n - The input node.
      */
    -export default function Leaf(parent) {
    -	assert(parent instanceof Node);
    -	/** @constant {number} The color of the node. */
    -	this._color = BLACK;
    -	/** @member {Node} The parent node. */
    -	this.parent = parent;
    -}
    -
    -/**
    - * Returns <code>true</code> if the <code>Leaf</code> object is a leaf. This
    - * always returns <code>true</code>.
    - *
    - * @returns {Boolean}
    - */
    -Leaf.prototype.isLeaf = function () {
    -	return true;
    +const delete_case0 = (n) => {
    +	assert(n instanceof Node);
    +	assert(n._color === BLACK);
    +	// If n is the root, there is nothing to do:
    +	//   - all paths go through n, and
    +	//   - n is black.
    +	if (n.parent !== null) delete_case1(n);
     };
    +
    +export default delete_case0;
     
    diff --git a/file/src/deletion/delete_case1.js.html b/file/src/deletion/delete_case1.js.html index b023d88..6c78ebf 100644 --- a/file/src/deletion/delete_case1.js.html +++ b/file/src/deletion/delete_case1.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -67,25 +66,53 @@

    src/deletion/delete_case1.js

    import assert from 'assert';
     import BLACK from '../color/BLACK.js';
    +import RED from '../color/RED.js';
     import Node from '../types/Node.js';
    -import Leaf from '../types/Leaf.js';
    +import rotate_left from '../rotate/rotate_left.js';
    +import rotate_right from '../rotate/rotate_right.js';
    +import sibling from '../family/sibling.js';
    +
     import delete_case2 from './delete_case2.js';
    +import delete_case3 from './delete_case3.js';
     
     /**
      * Preconditions:
      *   - n is black
      *   - all root-leaf paths going through n have a black height of b - 1
      *   - all other root-leaf paths have a black height of b
    + *   - n is not the root
      *
    - * @param {Node|Leaf} n - The input node.
    + * @param {Node} n - The input node.
      */
     const delete_case1 = (n) => {
    -	assert(n instanceof Node || n instanceof Leaf);
    +	assert(n instanceof Node);
     	assert(n._color === BLACK);
    -	// If n is the root, there is nothing to do:
    -	//   - all paths go through n, and
    -	//   - n is black.
    -	if (n.parent !== null) delete_case2(n);
    +	assert(n.parent !== null);
    +
    +	const s = sibling(n);
    +	assert(s instanceof Node);
    +
    +	if (s._color === BLACK) {
    +		// If n's sibling is BLACK, go to case 2.
    +		delete_case2(n);
    +	} else {
    +		/**
    +		 * Otherwise, prepare for and go to case 3.
    +		 *
    +		 *           B                       B
    +		 *         /   \                  /     \
    +		 *      >B       R               R       B
    +		 *      / \     / \     -->    /   \    / \
    +		 *     -   -  B     B        >B     B  =   =
    +		 *           / \   / \       / \   / \
    +		 *          =   = =   =     -   - =   =
    +		 */
    +		n.parent._color = RED;
    +		s._color = BLACK;
    +		if (n === n.parent.left) rotate_left(n.parent);
    +		else rotate_right(n.parent);
    +		delete_case3(n);
    +	}
     };
     
     export default delete_case1;
    diff --git a/file/src/deletion/delete_case2.js.html b/file/src/deletion/delete_case2.js.html
    index 0d6554c..a92235c 100644
    --- a/file/src/deletion/delete_case2.js.html
    +++ b/file/src/deletion/delete_case2.js.html
    @@ -34,31 +34,30 @@
     
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -69,13 +68,10 @@ import BLACK from '../color/BLACK.js'; import RED from '../color/RED.js'; import Node from '../types/Node.js'; -import Leaf from '../types/Leaf.js'; -import rotate_left from '../rotate/rotate_left.js'; -import rotate_right from '../rotate/rotate_right.js'; import sibling from '../family/sibling.js'; +import delete_case0 from './delete_case0.js'; import delete_case3 from './delete_case3.js'; -import delete_case4 from './delete_case4.js'; /** * Preconditions: @@ -83,33 +79,38 @@ * - all root-leaf paths going through n have a black height of b - 1 * - all other root-leaf paths have a black height of b * - n is not the root + * - n's sibling is black * - * @param {Node|Leaf} n - The input node. + * @param {Node} n - The input node. */ const delete_case2 = (n) => { - assert(n instanceof Node || n instanceof Leaf); + assert(n instanceof Node); assert(n._color === BLACK); assert(n.parent !== null); - const s = sibling(n); + assert(s instanceof Node); + assert(s._color === BLACK); /** - * If n's sibling is red, prepare for and go to case 4. + * If n's parent is black and n's sibling's children are black, then + * repaint n's sibling red. Now all root-leaf paths going through n's + * parent have a black height of b - 1. We recurse thus on n's parent. * - * B B + * B >B * / \ / \ - * >B R R B - * / \ / \ --> / \ / \ - * - - B B >B B = = - * / \ / \ / \ / \ - * = = = = - - = = + * >B B B R + * / \ / \ --> / \ / \ + * - - B B - - B B + * / \ / \ / \ / \ + * - - - - - - - - */ - if (s._color === RED) { - n.parent._color = RED; - s._color = BLACK; - if (n === n.parent.left) rotate_left(n.parent); - else rotate_right(n.parent); - delete_case4(n); + if ( + n.parent._color === BLACK && + (s.left === null || s.left._color === BLACK) && + (s.right === null || s.right._color === BLACK) + ) { + s._color = RED; + delete_case0(n.parent); } // Otherwise, go to case 3. diff --git a/file/src/deletion/delete_case5.js.html b/file/src/deletion/delete_case5.js.html index 5b8a6fb..679c416 100644 --- a/file/src/deletion/delete_case5.js.html +++ b/file/src/deletion/delete_case5.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -69,13 +68,10 @@ import BLACK from '../color/BLACK.js'; import RED from '../color/RED.js'; import Node from '../types/Node.js'; -import Leaf from '../types/Leaf.js'; import rotate_left from '../rotate/rotate_left.js'; import rotate_right from '../rotate/rotate_right.js'; import sibling from '../family/sibling.js'; -import delete_case6 from './delete_case6.js'; - /** * Preconditions: * - n is black @@ -83,56 +79,52 @@ * - all other root-leaf paths have a black height of b * - n is not the root * - n's sibling is black - * - at least one of n's sibling's children is red + * - if n is a left child, the right child of n's sibling is red + * - if n is a right child, the left child of n's sibling is red * - * @param {Node|Leaf} n - The input node. + * @param {Node} n - The input node. */ const delete_case5 = (n) => { - assert(n instanceof Node || n instanceof Leaf); + assert(n instanceof Node); assert(n._color === BLACK); assert(n.parent !== null); const s = sibling(n); assert(s instanceof Node); assert(s._color === BLACK); - assert(s.left._color === RED || s.right._color === RED); - - // The following statements just force the red n's sibling child to be on - // the left of the left of the parent, or right of the right, so case 6 - // will rotate correctly. /** - * ? ? - * / \ / \ - * >B B >B B - * / \ / \ --> / \ / \ - * - - R B - - = R - * / \ / \ / \ - * = = - - = B - * / \ - * - - + * Increment the black height of all root-leaf paths going through n by + * rotating at n's parent. This decrements the black height of all + * root-leaft paths going through n's sibling's right child. + * We can repaint n's sibling's right child in black to fix this. + * We are done. + * + * ? ? + * / \ / \ + * >B B B B + * / \ / \ / \ / \ + * - - = R --> >B = = B + * / \ / \ / \ + * = B - - - - + * / \ + * - - */ - if (n === n.parent.left && s.right._color === BLACK) { - s._color = RED; - s.left._color = BLACK; - rotate_right(s); - } else if (n === n.parent.right && s.left._color === BLACK) { - /** - * ? ? - * / \ / \ - * B >B B >B - * / \ / \ --> / \ / \ - * B R - - R = - - - * / \ / \ / \ - * - - = = B = - * / \ - * - - - */ - s._color = RED; + + s._color = n.parent._color; + n.parent._color = BLACK; + + if (n === n.parent.left) { + assert(s.right._color === RED); s.right._color = BLACK; - rotate_left(s); + rotate_left(n.parent); } - delete_case6(n); + // Symmetric case + else { + assert(s.left._color === RED); + s.left._color = BLACK; + rotate_right(n.parent); + } }; export default delete_case5; diff --git a/file/src/deletion/delete_case6.js.html b/file/src/deletion/delete_case6.js.html deleted file mode 100644 index 3a3c12a..0000000 --- a/file/src/deletion/delete_case6.js.html +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - src/deletion/delete_case6.js | @aureooms/js-red-black-tree - - - - - - - -
    - Home - Manual - Reference - Source - - -
    - - - -

    src/deletion/delete_case6.js

    -
    import assert from 'assert';
    -import BLACK from '../color/BLACK.js';
    -import RED from '../color/RED.js';
    -import Node from '../types/Node.js';
    -import Leaf from '../types/Leaf.js';
    -import rotate_left from '../rotate/rotate_left.js';
    -import rotate_right from '../rotate/rotate_right.js';
    -import sibling from '../family/sibling.js';
    -
    -/**
    - * Preconditions:
    - *   - n is black
    - *   - all root-leaf paths going through n have a black height of b - 1
    - *   - all other root-leaf paths have a black height of b
    - *   - n is not the root
    - *   - n's sibling is black
    - *   - if n is a left child, the right child of n's sibling is red
    - *   - if n is a right child, the left child of n's sibling is red
    - *
    - * @param {Node|Leaf} n - The input node.
    - */
    -const delete_case6 = (n) => {
    -	assert(n instanceof Node || n instanceof Leaf);
    -	assert(n._color === BLACK);
    -	assert(n.parent !== null);
    -	const s = sibling(n);
    -	assert(s instanceof Node);
    -	assert(s._color === BLACK);
    -
    -	/**
    -	 * Increment the black height of all root-leaf paths going through n by
    -	 * rotating at n's parent. This decrements the black height of all
    -	 * root-leaft paths going through n's sibling's right child.
    -	 * We can repaint n's sibling's right child in black to fix this.
    -	 * We are done.
    -	 *
    -	 *           ?                          ?
    -	 *        /     \                     /   \
    -	 *      >B        B                 B       B
    -	 *      / \      / \               / \     / \
    -	 *     -   -   =     R     -->   >B   =   =   B
    -	 *                  / \          / \         / \
    -	 *                 =   B        -   -       -   -
    -	 *                    / \
    -	 *                   -   -
    -	 */
    -
    -	s._color = n.parent._color;
    -	n.parent._color = BLACK;
    -
    -	if (n === n.parent.left) {
    -		assert(s.right._color === RED);
    -		s.right._color = BLACK;
    -		rotate_left(n.parent);
    -	}
    -
    -	// Symmetric case
    -	else {
    -		assert(s.left._color === RED);
    -		s.left._color = BLACK;
    -		rotate_right(n.parent);
    -	}
    -};
    -
    -export default delete_case6;
    -
    - -
    - - - - - - - - - - - - diff --git a/file/src/deletion/delete_case3.js.html b/file/src/deletion/delete_no_child.js.html similarity index 80% rename from file/src/deletion/delete_case3.js.html rename to file/src/deletion/delete_no_child.js.html index 9b63320..603a392 100644 --- a/file/src/deletion/delete_case3.js.html +++ b/file/src/deletion/delete_no_child.js.html @@ -3,7 +3,7 @@ - src/deletion/delete_case3.js | @aureooms/js-red-black-tree + src/deletion/delete_no_child.js | @aureooms/js-red-black-tree @@ -34,92 +34,84 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • -

    src/deletion/delete_case3.js

    +

    src/deletion/delete_no_child.js

    import assert from 'assert';
     import BLACK from '../color/BLACK.js';
     import RED from '../color/RED.js';
     import Node from '../types/Node.js';
    -import Leaf from '../types/Leaf.js';
    -import sibling from '../family/sibling.js';
     
    +import replace_node from './replace_node.js';
     import delete_case1 from './delete_case1.js';
    -import delete_case4 from './delete_case4.js';
    +
    +import prune from './prune.js';
     
     /**
    - * Preconditions:
    - *   - n is black
    - *   - all root-leaf paths going through n have a black height of b - 1
    - *   - all other root-leaf paths have a black height of b
    + * Delete a node <code>n</code> that has no non-leaf child.
    + *
    + * Precondition:
    + *   - n has no non-leaf child.
      *   - n is not the root
    - *   - n's sibling is black
      *
    - * @param {Node|Leaf} n - The input node.
    + * @param {Node} n - The node to delete.
      */
    -const delete_case3 = (n) => {
    -	assert(n instanceof Node || n instanceof Leaf);
    -	assert(n._color === BLACK);
    +const delete_no_child = (n) => {
    +	assert(n instanceof Node);
     	assert(n.parent !== null);
    -	const s = sibling(n);
    -	assert(s instanceof Node);
    -	assert(s._color === BLACK);
    +	assert(n.left === null);
    +	assert(n.right === null);
     
    -	/**
    -	 * If n's parent is black and n's sibling's children are black, then
    -	 * repaint n's sibling red. Now all root-leaft paths going through n's
    -	 * parent have a black height of b - 1. We recurse thus on n's parent.
    -	 *
    -	 *           B                      >B
    -	 *         /   \                  /     \
    -	 *      >B       B               B       R
    -	 *      / \     / \     -->    /   \    / \
    -	 *     -   -  B     B         -     - B     B
    -	 *           / \   / \               / \   / \
    -	 *          -   - -   -             -   - -   -
    -	 */
    -	if (
    -		n.parent._color === BLACK &&
    -		s.left._color === BLACK &&
    -		s.right._color === BLACK
    -	) {
    -		s._color = RED;
    -		delete_case1(n.parent);
    +	if (n._color !== BLACK) {
    +		assert(n._color === RED);
    +		prune(n);
    +		return;
     	}
     
    -	// Otherwise, go to case 4.
    -	else delete_case4(n);
    +	// Mock leaf since there is no left child
    +	// We use key = n.key to avoid mixing types, but this property is never
    +	// accessed.
    +	const leaf = new Node(BLACK, n.key);
    +
    +	// Replace n with the mocked leaf
    +	replace_node(n, leaf);
    +
    +	// If n is black, deleting it reduces the black-height of every path going
    +	// through it by 1. The leaf is black, so there are more things to fix.
    +	delete_case1(leaf);
    +
    +	// Delete mocked leaf
    +	prune(leaf);
     };
     
    -export default delete_case3;
    +export default delete_no_child;
     
    diff --git a/file/src/deletion/delete_one_child.js.html b/file/src/deletion/delete_one_child.js.html index 5207615..ebd449b 100644 --- a/file/src/deletion/delete_one_child.js.html +++ b/file/src/deletion/delete_one_child.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -69,50 +68,39 @@ import BLACK from '../color/BLACK.js'; import RED from '../color/RED.js'; import Node from '../types/Node.js'; -import Leaf from '../types/Leaf.js'; import replace_node from './replace_node.js'; -import delete_case1 from './delete_case1.js'; /** - * Delete a node <code>n</code> that has at most a single non-leaf child. + * Delete a node <code>n</code> with one non-leaf left child and one leaf right + * child. * * Precondition: - * - n has at most one non-leaf child. - * - if n has a non-leaf child, then it is its left child. + * - n has exactly one non-leaf child. + * - n is not the root + * - n's only non-leaf child is n's left child. * - hence, n's right child is a leaf + * - hence, n's left child is RED + * - hence, n is BLACK * * @param {Node} n - The node to delete. */ const delete_one_child = (n) => { assert(n instanceof Node); - // Precondition: n's right child is a leaf. - // The right child of n is always a LEAF because either n is a subtree - // predecessor or it is the only child of its parent by the red-black tree - // properties - assert(n.right instanceof Leaf); + assert(n._color === BLACK); + assert(n.parent !== null); + assert(n.left instanceof Node); + assert(n.left._color === RED); + assert(n.right === null); const child = n.left; - - // Replace n with its left child - replace_node(n, child); - // If n is black, deleting it reduces the black-height of every path going // through it by 1. - if (n._color === BLACK) { - // We can easily fix this when its left child is an - // internal red node: change the color of the left child to black and - // replace n with it. - if (child._color === RED) child._color = BLACK; - // Otherwise, there are more things to fix. - else { - delete_case1(child); - } - } else { - // If n is red then its child can only be black. Replacing n with its - // child suffices. This is a NO-OP. - assert(child._color === BLACK); - } + // We can easily fix this when its only child is an + // internal RED node: change the color of the child to black and + // replace n with it. + replace_node(n, child); + child._color = BLACK; }; export default delete_one_child; diff --git a/file/src/deletion/delete_case4.js.html b/file/src/deletion/prune.js.html similarity index 76% rename from file/src/deletion/delete_case4.js.html rename to file/src/deletion/prune.js.html index 8a81a82..009ab5d 100644 --- a/file/src/deletion/delete_case4.js.html +++ b/file/src/deletion/prune.js.html @@ -3,7 +3,7 @@ - src/deletion/delete_case4.js | @aureooms/js-red-black-tree + src/deletion/prune.js | @aureooms/js-red-black-tree @@ -34,97 +34,53 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • -

    src/deletion/delete_case4.js

    +

    src/deletion/prune.js

    import assert from 'assert';
    -import BLACK from '../color/BLACK.js';
    -import RED from '../color/RED.js';
     import Node from '../types/Node.js';
    -import Leaf from '../types/Leaf.js';
    -import sibling from '../family/sibling.js';
    -
    -import delete_case5 from './delete_case5.js';
     
     /**
    - * Preconditions:
    - *   - n is black
    - *   - all root-leaf paths going through n have a black height of b - 1
    - *   - all other root-leaf paths have a black height of b
    - *   - n is not the root
    - *   - n's sibling is black
    - *   - n's parent and n's sibling's children cannot all be black
    + * Prune subtree rooted at input node.
      *
    - * @param {Node|Leaf} n - The input node.
    + * @param {Node} root - The root of the subtree to prune.
      */
    -const delete_case4 = (n) => {
    -	assert(n instanceof Node || n instanceof Leaf);
    -	assert(n._color === BLACK);
    -	assert(n.parent !== null);
    -	const s = sibling(n);
    -	assert(s instanceof Node);
    -	assert(s._color === BLACK);
    -	assert(
    -		n.parent._color === RED || s.left._color === RED || s.right._color === RED,
    -	);
    -
    -	/**
    -	 * If n's parent is red and n's sibling's children are black, then swap n's
    -	 * parent and n's sibling color. All root-leaf paths going through n have
    -	 * now a black height of b. All other root-leaf paths have their black
    -	 * height unchanged. Red-black properties are respected. We are done.
    -	 *
    -	 *           R                       B
    -	 *         /   \                  /     \
    -	 *      >B       B              >B        R
    -	 *      / \     / \     -->     / \      / \
    -	 *     -   -  B     B          -   -   B     B
    -	 *           / \   / \                / \   / \
    -	 *          -   - -   -              -   - -   -
    -	 */
    -	if (
    -		// The parent color test is always true when coming from case 2
    -		n.parent._color === RED &&
    -		s.left._color === BLACK &&
    -		s.right._color === BLACK
    -	) {
    -		s._color = RED;
    -		n.parent._color = BLACK;
    -	}
    +const prune = (root) => {
    +	assert(root instanceof Node);
    +	assert(root.parent !== null);
     
    -	// Otherwise, go to case 5.
    -	else delete_case5(n);
    +	if (root === root.parent.left) root.parent.left = null;
    +	else root.parent.right = null;
     };
     
    -export default delete_case4;
    +export default prune;
     
    diff --git a/file/src/deletion/replace_node.js.html b/file/src/deletion/replace_node.js.html index f239aa9..4c669bc 100644 --- a/file/src/deletion/replace_node.js.html +++ b/file/src/deletion/replace_node.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -67,18 +66,17 @@

    src/deletion/replace_node.js

    import assert from 'assert';
     import Node from '../types/Node.js';
    -import Leaf from '../types/Leaf.js';
     
     /**
      * Replaces node <code>A</code> by node <code>B</code>.
      *
      * @param {Node} A - The node to replace.
    - * @param {Node|Leaf} B - The replacement node.
    + * @param {Node} B - The replacement node.
      */
     const replace_node = (A, B) => {
     	assert(A instanceof Node);
    -	assert(B instanceof Node || B instanceof Leaf);
    -	// We never apply delete_one_child on the root
    +	assert(B instanceof Node);
    +	// We never apply delete_one_child or delete_no_child on the root
     	assert(A.parent !== null);
     
     	if (A === A.parent.left) A.parent.left = B;
    diff --git a/file/src/family/grandparent.js.html b/file/src/family/grandparent.js.html
    index f0df1c8..690adc9 100644
    --- a/file/src/family/grandparent.js.html
    +++ b/file/src/family/grandparent.js.html
    @@ -34,31 +34,30 @@
     
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • diff --git a/file/src/family/predecessor.js.html b/file/src/family/predecessor.js.html index c475006..ebdbca2 100644 --- a/file/src/family/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -79,7 +78,7 @@ assert(node.left instanceof Node); let pred = node.left; - while (!pred.right.isLeaf()) { + while (pred.right !== null) { assert(pred.right instanceof Node); pred = pred.right; } diff --git a/file/src/family/sibling.js.html b/file/src/family/sibling.js.html index 895c948..f928e29 100644 --- a/file/src/family/sibling.js.html +++ b/file/src/family/sibling.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -67,17 +66,16 @@

    src/family/sibling.js

    import assert from 'assert';
     import Node from '../types/Node.js';
    -import Leaf from '../types/Leaf.js';
     
     /**
      * Computes the sibling of the input node.
      *
    - * @param {Node|Leaf} node - The input node.
    - * @returns {Node|Leaf}
    + * @param {Node} node - The input node.
    + * @returns {Node}
      */
     const sibling = (node) => {
    -	assert(node instanceof Node || node instanceof Leaf);
    -	// We only use this function when node HAS a sibling.
    +	assert(node instanceof Node);
    +	// We only use this function when node HAS a non-leaf sibling.
     	assert(node.parent !== null);
     
     	return node === node.parent.left ? node.parent.right : node.parent.left;
    diff --git a/file/src/family/uncle.js.html b/file/src/family/uncle.js.html
    index 3948a71..107945b 100644
    --- a/file/src/family/uncle.js.html
    +++ b/file/src/family/uncle.js.html
    @@ -34,31 +34,30 @@
     
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -67,7 +66,6 @@

    src/family/uncle.js

    import assert from 'assert';
     import Node from '../types/Node.js';
    -import Leaf from '../types/Leaf.js';
     import grandparent from './grandparent.js';
     
     /**
    @@ -75,15 +73,13 @@
      * exist.
      *
      * @param {Node} node - The input node.
    - * @returns {Node|Leaf}
    + * @returns {Node}
      */
     const uncle = (node) => {
     	assert(node instanceof Node);
     	const g = grandparent(node);
     	assert(g !== null);
    -	const u = node.parent === g.left ? g.right : g.left;
    -	assert(u instanceof Node || u instanceof Leaf);
    -	return u;
    +	return node.parent === g.left ? g.right : g.left;
     };
     
     export default uncle;
    diff --git a/file/src/index.js.html b/file/src/index.js.html
    index 36833ed..2057149 100644
    --- a/file/src/index.js.html
    +++ b/file/src/index.js.html
    @@ -34,31 +34,30 @@
     
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -70,30 +69,31 @@ export {default as BLACK} from './color/BLACK.js'; export {default as RED} from './color/RED.js'; export {default as _debug} from './debug/_debug.js'; +export {default as delete_case0} from './deletion/delete_case0.js'; export {default as delete_case1} from './deletion/delete_case1.js'; export {default as delete_case2} from './deletion/delete_case2.js'; export {default as delete_case3} from './deletion/delete_case3.js'; export {default as delete_case4} from './deletion/delete_case4.js'; export {default as delete_case5} from './deletion/delete_case5.js'; -export {default as delete_case6} from './deletion/delete_case6.js'; +export {default as delete_no_child} from './deletion/delete_no_child.js'; export {default as delete_one_child} from './deletion/delete_one_child.js'; +export {default as prune} from './deletion/prune.js'; export {default as replace_node} from './deletion/replace_node.js'; export {default as grandparent} from './family/grandparent.js'; export {default as predecessor} from './family/predecessor.js'; export {default as sibling} from './family/sibling.js'; export {default as uncle} from './family/uncle.js'; export {default as insert} from './insertion/insert.js'; +export {default as insert_case0} from './insertion/insert_case0.js'; export {default as insert_case1} from './insertion/insert_case1.js'; export {default as insert_case2} from './insertion/insert_case2.js'; export {default as insert_case3} from './insertion/insert_case3.js'; export {default as insert_case4} from './insertion/insert_case4.js'; -export {default as insert_case5} from './insertion/insert_case5.js'; export {default as rotate_left} from './rotate/rotate_left.js'; export {default as rotate_right} from './rotate/rotate_right.js'; export {default as search} from './search/search.js'; export {default as inordertraversal} from './traversal/inordertraversal.js'; export {default as rangetraversal} from './traversal/rangetraversal.js'; -export {default as Leaf} from './types/Leaf.js'; export {default as Node} from './types/Node.js'; export {default as RedBlackTree} from './types/RedBlackTree.js'; diff --git a/file/src/insertion/insert.js.html b/file/src/insertion/insert.js.html index f79ca35..a5bacc8 100644 --- a/file/src/insertion/insert.js.html +++ b/file/src/insertion/insert.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -77,7 +76,7 @@ * search tree. * For our red-black tree, all that is left to do is fix the red-black tree * properties in case they have been violated by this insertion. This is fixed - * by {@link insert_case1}. + * by {@link insert_case0}. * * @param {Function} compare - The comparison function to use. * @param {Node} A - The root of the tree. @@ -89,7 +88,7 @@ if (compare(B.key, A.key) < 0) { const node = A.left; - if (node.isLeaf()) { + if (node === null) { A.left = B; break; } @@ -99,7 +98,7 @@ } else { const node = A.right; - if (node.isLeaf()) { + if (node === null) { A.right = B; break; } diff --git a/file/src/insertion/insert_case5.js.html b/file/src/insertion/insert_case0.js.html similarity index 78% rename from file/src/insertion/insert_case5.js.html rename to file/src/insertion/insert_case0.js.html index a73c39a..9ad78c3 100644 --- a/file/src/insertion/insert_case5.js.html +++ b/file/src/insertion/insert_case0.js.html @@ -3,7 +3,7 @@ - src/insertion/insert_case5.js | @aureooms/js-red-black-tree + src/insertion/insert_case0.js | @aureooms/js-red-black-tree @@ -34,107 +34,66 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • -

    src/insertion/insert_case5.js

    +

    src/insertion/insert_case0.js

    import assert from 'assert';
     import Node from '../types/Node.js';
     import BLACK from '../color/BLACK.js';
     import RED from '../color/RED.js';
    -import rotate_left from '../rotate/rotate_left.js';
    -import rotate_right from '../rotate/rotate_right.js';
    -import grandparent from '../family/grandparent.js';
    +import insert_case1 from './insert_case1.js';
     
     /**
      * Preconditions:
      *   - n is red.
      *   - n's children are BLACK
    - *   - n is not the root of the tree.
    - *   - n's parent is red.
    - *   - n's uncle is black.
    - *   - the path from n to its grandparent makes a left-left or right-right.
      *
      * @param {Node} n - The input node.
      */
    -const insert_case5 = (n) => {
    +const insert_case0 = (n) => {
     	assert(n instanceof Node);
     	assert(n._color === RED);
     	assert(n.left._color === BLACK);
     	assert(n.right._color === BLACK);
    -	assert(n.parent !== null);
    -	assert(n.parent._color === RED);
    -	const g = grandparent(n);
    -
    -	// Repaint n's parent black, n's grandparent red
    -	n.parent._color = BLACK;
    -	g._color = RED;
    -
    -	if (n === n.parent.left) {
    -		/**
    -		 * If the path from g to n makes a left-left, {@link rotate_right} at g.
    -		 * We are done.
    -		 *
    -		 *             R                     B
    -		 *           /   \                 /   \
    -		 *         B       B            >R       R
    -		 *        / \     / \   -->     / \     / \
    -		 *      >R   =   -   -         =   =   =   B
    -		 *      / \                               / \
    -		 *     =   =                             -   -
    -		 */
    -		assert(g.left instanceof Node);
    -		assert(n === g.left.left);
    -		assert(g.right._color === BLACK);
    -		rotate_right(g);
    -	} else {
    -		/**
    -		 * If the path from g to n makes a right-right, {@link rotate_left} at g.
    -		 * We are done.
    -		 *
    -		 *             R                     B
    -		 *           /   \                 /   \
    -		 *         B       B             R      >R
    -		 *        / \     / \   -->     / \     / \
    -		 *       -   -   =  >R         B   =   =   =
    -		 *                  / \       / \
    -		 *                 =   =     -   -
    -		 */
    -		assert(g.right instanceof Node);
    -		assert(n === g.right.right);
    -		assert(g.left._color === BLACK);
    -		rotate_left(g);
    -	}
    +	/**
    +	 * If n is the root of the tree, paint it black and we are done.
    +	 *
    +	 *      >R
    +	 *      / \
    +	 *     -   -
    +	 */
    +	if (n.parent === null) n._color = BLACK;
    +	else insert_case1(n);
     };
     
    -export default insert_case5;
    +export default insert_case0;
     
    diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html index 3f6e7a5..b8fbafa 100644 --- a/file/src/insertion/insert_case1.js.html +++ b/file/src/insertion/insert_case1.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -75,23 +74,29 @@ * Preconditions: * - n is red. * - n's children are BLACK + * - n is not the root of the tree. * * @param {Node} n - The input node. */ const insert_case1 = (n) => { assert(n instanceof Node); assert(n._color === RED); - assert(n.left._color === BLACK); - assert(n.right._color === BLACK); + assert(n.left === null || n.left._color === BLACK); + assert(n.right === null || n.right._color === BLACK); + assert(n.parent !== null); + /** - * If n is the root of the tree, paint it black and we are done. + * If the parent of n is black then we have nothing to do. * - * >R + * B + * / \ + * >R - * / \ * - - */ - if (n.parent === null) n._color = BLACK; - else insert_case2(n); + if (n.parent._color === BLACK) return; + + insert_case2(n); }; export default insert_case1; diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index 85c86b7..17c9d53 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -69,6 +68,9 @@ import Node from '../types/Node.js'; import BLACK from '../color/BLACK.js'; import RED from '../color/RED.js'; +import uncle from '../family/uncle.js'; +import grandparent from '../family/grandparent.js'; +import insert_case0 from './insert_case0.js'; import insert_case3 from './insert_case3.js'; /** @@ -76,28 +78,41 @@ * - n is red. * - n's children are BLACK * - n is not the root of the tree. + * - n's parent is red. * * @param {Node} n - The input node. */ const insert_case2 = (n) => { assert(n instanceof Node); assert(n._color === RED); - assert(n.left._color === BLACK); - assert(n.right._color === BLACK); + assert(n.left === null || n.left._color === BLACK); + assert(n.right === null || n.right._color === BLACK); assert(n.parent !== null); + assert(n.parent._color === RED); + const u = uncle(n); /** - * If the parent of n is black then we have nothing to do. + * If n has a non-leaf uncle and this uncle is red then we simply + * repaint the parent and the uncle of n in black, the grandparent of + * n in red, then call insert_case0 on n's grandparent. * - * B - * / \ - * >R - - * / \ - * - - + * B >R + * / \ / \ + * R R B B + * / \ / \ --> / \ / \ + * >R - - - R - - - + * / \ / \ + * - - - - */ - if (n.parent._color === BLACK) return; - insert_case3(n); + if (u !== null && u._color !== BLACK) { + assert(u._color === RED); + n.parent._color = BLACK; + u._color = BLACK; + const g = grandparent(n); + g._color = RED; + insert_case0(g); + } else insert_case3(n); }; export default insert_case2; diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index b465a49..425d0a6 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -69,9 +68,9 @@ import Node from '../types/Node.js'; import BLACK from '../color/BLACK.js'; import RED from '../color/RED.js'; -import uncle from '../family/uncle.js'; +import rotate_left from '../rotate/rotate_left.js'; +import rotate_right from '../rotate/rotate_right.js'; import grandparent from '../family/grandparent.js'; -import insert_case1 from './insert_case1.js'; import insert_case4 from './insert_case4.js'; /** @@ -80,39 +79,80 @@ * - n's children are BLACK * - n is not the root of the tree. * - n's parent is red. + * - n's uncle is black. + * + * Here we fix the input subtree to pass the preconditions of {@link insert_case4}. * * @param {Node} n - The input node. */ const insert_case3 = (n) => { assert(n instanceof Node); assert(n._color === RED); - assert(n.left._color === BLACK); - assert(n.right._color === BLACK); + assert(n.left === null || n.left._color === BLACK); + assert(n.right === null || n.right._color === BLACK); assert(n.parent !== null); assert(n.parent._color === RED); - const u = uncle(n); + const g = grandparent(n); /** - * If n has a non-leaf uncle and this uncle is red then we simply - * repaint the parent and the uncle of n in black, the grandparent of - * n in red, then call insert_case1 on n's grandparent. + * If the path from g to n makes a left-right, change it to a left-left + * with {@link rotate_left}. Then call {@link insert_case4} on the old + * parent of n. * - * B >R + * B B * / \ / \ - * R R B B + * R B R B * / \ / \ --> / \ / \ - * >R - - - R - - - - * / \ / \ - * - - - - + * = >R - - >R = - - + * / \ / \ + * = = = = */ - if (u._color === RED) { - n.parent._color = BLACK; - u._color = BLACK; - const g = grandparent(n); - g._color = RED; - insert_case1(g); - } else insert_case4(n); + if (n === n.parent.right && n.parent === g.left) { + rotate_left(n.parent); + + /** + * Rotate_left can be the below because of already having *g = grandparent(n) + * + * saved_p=g.left, *saved_left_n=n.left; + * g.left=n; + * n.left=saved_p; + * saved_p.right=saved_left_n; + * + * and modify the parent's nodes properly + */ + + // n = n.left; /!\ need to fix rotate, so that we can safely reference a node + } else if (n === n.parent.left && n.parent === g.right) { + /** + * If the path from g to n makes a right-left, change it to a right-right + * with {@link rotate_right}. Then call {@link insert_case4} on the old + * parent of n. + * + * B B + * / \ / \ + * B R B R + * / \ / \ --> / \ / \ + * - - >R = - - = >R + * / \ / \ + * = = = = + */ + rotate_right(n.parent); + + /** + * Rotate_right can be the below to take advantage of already having *g = grandparent(n) + * + * saved_p=g.right, *saved_right_n=n.right; + * g.right=n; + * n.right=saved_p; + * saved_p.left=saved_right_n; + * + */ + + // n = n.right ; + } + + insert_case4(n); }; export default insert_case3; diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index e724df1..64cf24f 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -72,7 +71,6 @@ import rotate_left from '../rotate/rotate_left.js'; import rotate_right from '../rotate/rotate_right.js'; import grandparent from '../family/grandparent.js'; -import insert_case5 from './insert_case5.js'; /** * Preconditions: @@ -81,79 +79,58 @@ * - n is not the root of the tree. * - n's parent is red. * - n's uncle is black. - * - * Here we fix the input subtree to pass the preconditions of {@link insert_case5}. + * - the path from n to its grandparent makes a left-left or right-right. * * @param {Node} n - The input node. */ const insert_case4 = (n) => { assert(n instanceof Node); assert(n._color === RED); - assert(n.left._color === BLACK); - assert(n.right._color === BLACK); + assert(n.left === null || n.left._color === BLACK); + assert(n.right === null || n.right._color === BLACK); assert(n.parent !== null); assert(n.parent._color === RED); const g = grandparent(n); - /** - * If the path from g to n makes a left-right, change it to a left-left - * with {@link rotate_left}. Then call {@link insert_case5} on the old - * parent of n. - * - * B B - * / \ / \ - * R B R B - * / \ / \ --> / \ / \ - * = >R - - >R = - - - * / \ / \ - * = = = = - */ - - if (n === n.parent.right && n.parent === g.left) { - rotate_left(n.parent); - - /** - * Rotate_left can be the below because of already having *g = grandparent(n) - * - * saved_p=g.left, *saved_left_n=n.left; - * g.left=n; - * n.left=saved_p; - * saved_p.right=saved_left_n; - * - * and modify the parent's nodes properly - */ + // Repaint n's parent black, n's grandparent red + n.parent._color = BLACK; + g._color = RED; - // n = n.left; /!\ need to fix rotate, so that we can safely reference a node - } else if (n === n.parent.left && n.parent === g.right) { + if (n === n.parent.left) { /** - * If the path from g to n makes a right-left, change it to a right-right - * with {@link rotate_right}. Then call {@link insert_case5} on the old - * parent of n. + * If the path from g to n makes a left-left, {@link rotate_right} at g. + * We are done. * - * B B + * R B * / \ / \ - * B R B R + * B B >R R * / \ / \ --> / \ / \ - * - - >R = - - = >R - * / \ / \ - * = = = = + * >R = - - = = = B + * / \ / \ + * = = - - */ - rotate_right(n.parent); - + assert(g.left instanceof Node); + assert(n === g.left.left); + assert(g.right === null || g.right._color === BLACK); + rotate_right(g); + } else { /** - * Rotate_right can be the below to take advantage of already having *g = grandparent(n) - * - * saved_p=g.right, *saved_right_n=n.right; - * g.right=n; - * n.right=saved_p; - * saved_p.left=saved_right_n; + * If the path from g to n makes a right-right, {@link rotate_left} at g. + * We are done. * + * R B + * / \ / \ + * B B R >R + * / \ / \ --> / \ / \ + * - - = >R B = = = + * / \ / \ + * = = - - */ - - // n = n.right ; + assert(g.right instanceof Node); + assert(n === g.right.right); + assert(g.left === null || g.left._color === BLACK); + rotate_left(g); } - - insert_case5(n); }; export default insert_case4; diff --git a/file/src/rotate/rotate_left.js.html b/file/src/rotate/rotate_left.js.html index a31777a..d23d751 100644 --- a/file/src/rotate/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -100,9 +99,9 @@ B.left = a; B.right = b; - a.parent = B; - b.parent = B; - c.parent = A; + if (a !== null) a.parent = B; + if (b !== null) b.parent = B; + if (c !== null) c.parent = A; }; export default rotate_left; diff --git a/file/src/rotate/rotate_right.js.html b/file/src/rotate/rotate_right.js.html index cad90f8..dee5245 100644 --- a/file/src/rotate/rotate_right.js.html +++ b/file/src/rotate/rotate_right.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -100,9 +99,9 @@ A.left = b; A.right = c; - a.parent = B; - b.parent = A; - c.parent = A; + if (a !== null) a.parent = B; + if (b !== null) b.parent = A; + if (c !== null) c.parent = A; }; export default rotate_right; diff --git a/file/src/search/search.js.html b/file/src/search/search.js.html index 8204eeb..db18ff6 100644 --- a/file/src/search/search.js.html +++ b/file/src/search/search.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -85,14 +84,11 @@ return root; } - const child = d < 0 ? root.left : root.right; + root = d < 0 ? root.left : root.right; - if (child.isLeaf()) { + if (root === null) { return null; } - - assert(child instanceof Node); - root = child; } }; diff --git a/file/src/traversal/inordertraversal.js.html b/file/src/traversal/inordertraversal.js.html index 1014801..a4f40db 100644 --- a/file/src/traversal/inordertraversal.js.html +++ b/file/src/traversal/inordertraversal.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -76,7 +75,7 @@ */ export default function* inordertraversal(node) { assert(node instanceof Node); - if (!node.left.isLeaf()) { + if (node.left !== null) { // Yield the nodes on the left recursively. Those nodes are all smaller // than (or equal to) the current node by the binary search tree // properties. @@ -87,7 +86,7 @@ // Yield the current node. yield node.key; - if (!node.right.isLeaf()) { + if (node.right !== null) { // Yield the nodes on the right recursively. Those nodes are all larger // than (or equal to) the current node by the binary search tree // properties. diff --git a/file/src/traversal/rangetraversal.js.html b/file/src/traversal/rangetraversal.js.html index 740d703..e14f942 100644 --- a/file/src/traversal/rangetraversal.js.html +++ b/file/src/traversal/rangetraversal.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -82,27 +81,27 @@ if (compare(root.key, left) < 0) { // If the root lies to the left of the interval, we can discard the // entire left subtree. - if (!root.right.isLeaf()) { + if (root.right !== null) { assert(root.right instanceof Node); yield* rangetraversal(compare, root.right, left, right); } } else if (compare(root.key, right) >= 0) { // If the root lies to the right of the interval, we can discard the // entire right subtree. - if (!root.left.isLeaf()) { + if (root.left !== null) { assert(root.left instanceof Node); yield* rangetraversal(compare, root.left, left, right); } } else { // Otherwise just recurse on both subtrees and yield the root in // between. - if (!root.left.isLeaf()) { + if (root.left !== null) { assert(root.left instanceof Node); yield* rangetraversal(compare, root.left, left, right); } yield root.key; - if (!root.right.isLeaf()) { + if (root.right !== null) { assert(root.right instanceof Node); yield* rangetraversal(compare, root.right, left, right); } diff --git a/file/src/types/Node.js.html b/file/src/types/Node.js.html index fc7b394..4f6ba1e 100644 --- a/file/src/types/Node.js.html +++ b/file/src/types/Node.js.html @@ -34,40 +34,37 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • src/types/Node.js

    -
    import Leaf from './Leaf.js';
    -
    -/**
    +
    /**
      * An internal node. This node can be red or black.
      *
      * @class
    @@ -77,25 +74,15 @@
     export default function Node(color, key) {
     	/** @member {number} The color of the node. */
     	this._color = color;
    -	/** @member {Node|Leaf} The left child */
    -	this.left = new Leaf(this);
    -	/** @member {Node|Leaf} The right child */
    -	this.right = new Leaf(this);
    +	/** @member {Node} The left child */
    +	this.left = null;
    +	/** @member {Node} The right child */
    +	this.right = null;
     	/** @member {Node} The parent node. */
     	this.parent = null;
     	/** @member {any} The key held by this node. */
     	this.key = key;
     }
    -
    -/**
    - * Returns <code>true</code> if the <code>Node</code> object is a leaf. This
    - * always returns <code>false</code>.
    - *
    - * @returns {Boolean}
    - */
    -Node.prototype.isLeaf = function () {
    -	return false;
    -};
     
    diff --git a/file/src/types/RedBlackTree.js.html b/file/src/types/RedBlackTree.js.html index 776d75a..b083e46 100644 --- a/file/src/types/RedBlackTree.js.html +++ b/file/src/types/RedBlackTree.js.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -71,8 +70,9 @@ import RED from '../color/RED.js'; import predecessor from '../family/predecessor.js'; import insert from '../insertion/insert.js'; -import insert_case2 from '../insertion/insert_case2.js'; +import insert_case1 from '../insertion/insert_case1.js'; import delete_one_child from '../deletion/delete_one_child.js'; +import delete_no_child from '../deletion/delete_no_child.js'; import search from '../search/search.js'; import inordertraversal from '../traversal/inordertraversal.js'; import rangetraversal from '../traversal/rangetraversal.js'; @@ -88,6 +88,7 @@ * @param {Function} compare - The comparison function for node keys. */ constructor(compare) { + assert(compare instanceof Function); /** @member {Function} The comparison function for node keys. */ this.compare = compare; /** @member {Node} The root of the tree. */ @@ -114,7 +115,7 @@ } else { const node = new Node(RED, key); insert(this.compare, this.root, node); - insert_case2(node); + insert_case1(node); } } @@ -149,7 +150,7 @@ * key. * * @param {any} key - The input key. - * @returns {Boolean} + * @returns {boolean} */ has(key) { return this._search(key) !== null; @@ -161,29 +162,31 @@ * @param {Node} node - The input node to delete. */ _delete(node) { - if (!node.left.isLeaf()) { + assert(node instanceof Node); + if (node.left !== null) { // Replace node's key with predecessor's key const pred = predecessor(node); node.key = pred.key; // Delete predecessor node - // note: this node can only have one non-leaf child - // because the tree is a red-black tree - delete_one_child(pred); - } else if (!node.right.isLeaf()) { + // NOTE: this node can only have one non-leaf (left) child because + // of red-black tree invariant. + if (pred.left === null) { + delete_no_child(pred); + } else { + delete_one_child(pred); + } + } else if (node.right !== null) { // Replace node's key with successor's key - // If there is no left child, then there can only be one right - // child. + // NOTE: Since there is no left child, then there can only be one + // right child by the red-black tree invariant. const succ = node.right; - assert(succ instanceof Node); node.key = succ.key; // Delete successor node - // note: this node can only have one non-leaf child - // because the tree is a red-black tree - delete_one_child(succ); + delete_no_child(succ); } else if (node === this.root) { this.root = null; } else { - delete_one_child(node); + delete_no_child(node); } } @@ -194,7 +197,7 @@ * then return <code>true</code>. Return <code>false</code> otherwise. * * @param {any} key - The input key. - * @returns {Boolean} - Whether the key existed in the tree before removal. + * @returns {boolean} - Whether the key existed in the tree before removal. */ remove(key) { const node = this._search(key); diff --git a/function/index.html b/function/index.html index 6acd50e..4016ee2 100644 --- a/function/index.html +++ b/function/index.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • @@ -75,35 +74,6 @@ - - -
    - - - - @@ -320,22 +283,14 @@ - delete_case6(n: Node | Leaf) + delete_one_child(n: Node)

    -

    Preconditions:

    -
      -
    • n is black
    • -
    • all root-leaf paths going through n have a black height of b - 1
    • -
    • all other root-leaf paths have a black height of b
    • -
    • n is not the root
    • -
    • n's sibling is black
    • -
    • if n is a left child, the right child of n's sibling is red
    • -
    • if n is a right child, the left child of n's sibling is red
    • -
    +

    Delete a node n with one non-leaf left child and one leaf right +child.

    @@ -358,13 +313,13 @@ - delete_one_child(n: Node) + grandparent(node: Node): Node

    -

    Delete a node n that has at most a single non-leaf child.

    +

    Computes the grandparent (parent of parent) of the input node.

    @@ -386,14 +341,14 @@

    - - grandparent(node: Node): Node + * + inordertraversal(node: Node): IterableIterator

    -

    Computes the grandparent (parent of parent) of the input node.

    +

    Traverses the tree rooted at node in order.

    @@ -415,14 +370,15 @@

    - * - inordertraversal(node: Node): IterableIterator + + insert(compare: Function, A: Node, B: Node): Node

    -

    Traverses the tree rooted at node in order.

    +

    Walks the tree rooted at A down the only path that satisfies +the following property: if at a node C we make a left (resp.

    @@ -445,14 +401,16 @@ - insert(compare: Function, A: Node, B: Node): Node + insert_case0(n: Node)

    -

    Walks the tree rooted at A down the only path that satisfies -the following property: if at a node C we make a left (resp.

    +

    Preconditions:

    +
      +
    • n is red.
    • +
    @@ -603,16 +561,14 @@ - insert_case5(n: Node) + predecessor(node: Node): Node

    -

    Preconditions:

    -
      -
    • n is red.
    • -
    +

    Computes the predecessor of the input node, in the subtree rooted at the +input node, when this predecessor is guaranteed to exist.

    @@ -635,14 +591,13 @@ - predecessor(node: Node): Node + prune(root: Node)

    -

    Computes the predecessor of the input node, in the subtree rooted at the -input node, when this predecessor is guaranteed to exist.

    +

    Prune subtree rooted at input node.

    @@ -695,7 +650,7 @@ - replace_node(A: Node, B: Node | Leaf) + replace_node(A: Node, B: Node)

    @@ -811,7 +766,7 @@ - sibling(node: Node | Leaf): Node | Leaf + sibling(node: Node): Node

    @@ -840,7 +795,7 @@ - uncle(node: Node): Node | Leaf + uncle(node: Node): Node

    @@ -896,67 +851,6 @@

    Static Public

    -
    -

    - public - - - - - - Leaf(parent: Node) - - - - source - -

    - - - - -

    A black leaf node.

    -
    - - - -
    -

    Params:

    -
    Booleanboolean

    Whether the key existed in the tree before removal.

    -
    -

    - - - - Leaf(parent: Node) -

    -
    -
    - - -

    A black leaf node.

    -
    -
    -
    - - -
    - public - - - @@ -141,7 +111,7 @@ - delete_case1(n: Node | Leaf) + delete_case0(n: Node)

    @@ -175,7 +145,7 @@ - delete_case2(n: Node | Leaf) + delete_case1(n: Node)

    @@ -210,7 +180,7 @@ - delete_case3(n: Node | Leaf) + delete_case2(n: Node)

    @@ -246,7 +216,7 @@ - delete_case4(n: Node | Leaf) + delete_case5(n: Node)

    @@ -259,7 +229,8 @@
  • all other root-leaf paths have a black height of b
  • n is not the root
  • n's sibling is black
  • -
  • n's parent and n's sibling's children cannot all be black
  • +
  • if n is a left child, the right child of n's sibling is red
  • +
  • if n is a right child, the left child of n's sibling is red
  • @@ -283,21 +254,13 @@ - delete_case5(n: Node | Leaf) + delete_no_child(n: Node)

    -

    Preconditions:

    -
      -
    • n is black
    • -
    • all root-leaf paths going through n have a black height of b - 1
    • -
    • all other root-leaf paths have a black height of b
    • -
    • n is not the root
    • -
    • n's sibling is black
    • -
    • at least one of n's sibling's children is red
    • -
    +

    Delete a node n that has no non-leaf child.

    - - - - - - - - - - - - -
    NameTypeAttributeDescription
    parentNode

    The parent node in the tree.

    -
    -
    -
    - - - - - - - - - - - - - - - - - -

    public @@ -969,11 +863,11 @@

    - source + source

    - +

    An internal node. This node can be red or black.

    @@ -1026,22 +920,22 @@

    Params:

    -

    +

    public - delete_case1(n: Node | Leaf) + delete_case0(n: Node) - source + source

    - +

    Preconditions:

    @@ -1064,74 +958,7 @@

    Params:

    n - Node | Leaf - -

    The input node.

    - - - - -
    -
    - - - - - - - - - - - - - - - - - -
    -
    -

    - public - - - - - - delete_case2(n: Node | Leaf) - - - - source - -

    - - - - -

    Preconditions:

    -
      -
    • n is black
    • -
    • all root-leaf paths going through n have a black height of b - 1
    • -
    • all other root-leaf paths have a black height of b
    • -
    • n is not the root
    • -
    -
    - - - -
    -

    Params:

    - - - - - - - - - + @@ -1159,22 +986,22 @@

    Params:

    -

    +

    public - delete_case3(n: Node | Leaf) + delete_case1(n: Node) - source + source

    - +

    Preconditions:

    @@ -1183,7 +1010,6 @@

  • all root-leaf paths going through n have a black height of b - 1
  • all other root-leaf paths have a black height of b
  • n is not the root
  • -
  • n's sibling is black
  • @@ -1199,7 +1025,7 @@

    Params:

    - + @@ -1227,22 +1053,22 @@

    Params:

    -

    +

    public - delete_case4(n: Node | Leaf) + delete_case2(n: Node) - source + source

    - +

    Preconditions:

    @@ -1252,7 +1078,6 @@

  • all other root-leaf paths have a black height of b
  • n is not the root
  • n's sibling is black
  • -
  • n's parent and n's sibling's children cannot all be black
  • @@ -1268,7 +1093,7 @@

    Params:

    - + @@ -1303,15 +1128,15 @@

    - delete_case5(n: Node | Leaf) + delete_case5(n: Node) - source + source

    - +

    Preconditions:

    @@ -1321,7 +1146,8 @@

  • all other root-leaf paths have a black height of b
  • n is not the root
  • n's sibling is black
  • -
  • at least one of n's sibling's children is red
  • +
  • if n is a left child, the right child of n's sibling is red
  • +
  • if n is a right child, the left child of n's sibling is red
  • @@ -1337,7 +1163,7 @@

    Params:

    - + @@ -1365,33 +1191,29 @@

    Params:

    -

    +

    public - delete_case6(n: Node | Leaf) + delete_no_child(n: Node) - source + source

    - + -

    Preconditions:

    +

    Delete a node n that has no non-leaf child.

    +

    Precondition:

      -
    • n is black
    • -
    • all root-leaf paths going through n have a black height of b - 1
    • -
    • all other root-leaf paths have a black height of b
    • +
    • n has no non-leaf child.
    • n is not the root
    • -
    • n's sibling is black
    • -
    • if n is a left child, the right child of n's sibling is red
    • -
    • if n is a right child, the left child of n's sibling is red
    @@ -1407,9 +1229,9 @@

    Params:

    - + - @@ -1446,19 +1268,23 @@

    - source + source

    - + -

    Delete a node n that has at most a single non-leaf child.

    +

    Delete a node n with one non-leaf left child and one leaf right +child.

    Precondition:

      -
    • n has at most one non-leaf child.
    • -
    • if n has a non-leaf child, then it is its left child.
    • +
    • n has exactly one non-leaf child.
    • +
    • n is not the root
    • +
    • n's only non-leaf child is n's left child.
    • hence, n's right child is a leaf
    • +
    • hence, n's left child is RED
    • +
    • hence, n is BLACK
    @@ -1674,7 +1500,7 @@

    search tree. For our red-black tree, all that is left to do is fix the red-black tree properties in case they have been violated by this insertion. This is fixed -by insert_case1.

    +by insert_case0.

    @@ -1744,22 +1570,22 @@

    Return:

    -

    +

    public - insert_case1(n: Node) + insert_case0(n: Node) - source + source

    - +

    Preconditions:

    @@ -1809,22 +1635,22 @@

    Params:

    -

    +

    public - insert_case2(n: Node) + insert_case1(n: Node) - source + source

    - +

    Preconditions:

    @@ -1875,22 +1701,22 @@

    Params:

    -

    +

    public - insert_case3(n: Node) + insert_case2(n: Node) - source + source

    - +

    Preconditions:

    @@ -1942,22 +1768,22 @@

    Params:

    -

    +

    public - insert_case4(n: Node) + insert_case3(n: Node) - source + source

    - +

    Preconditions:

    @@ -1968,7 +1794,7 @@

  • n's parent is red.
  • n's uncle is black.
  • -

    Here we fix the input subtree to pass the preconditions of insert_case5.

    +

    Here we fix the input subtree to pass the preconditions of insert_case4.

    @@ -2011,22 +1837,22 @@

    Params:

    -

    +

    public - insert_case5(n: Node) + insert_case4(n: Node) - source + source

    - +

    Preconditions:

    @@ -2152,6 +1978,67 @@

    Return:

    +
    +
    +

    + public + + + + + + prune(root: Node) + + + + source + +

    + + + + +

    Prune subtree rooted at input node.

    +
    + + + +
    +

    Params:

    +
    NameTypeAttributeDescription
    nNode | LeafNode

    The input node.

    nNode | LeafNode

    The input node.

    nNode | LeafNode

    The input node.

    nNode | LeafNode

    The input node.

    nNode | LeafNode

    The input node.

    +

    The node to delete.

    + + + + + + + + + + + + +
    NameTypeAttributeDescription
    rootNode

    The root of the subtree to prune.

    +
    +
    +
    + + + + + + + + + + + + + + + + +

    @@ -2256,15 +2143,15 @@

    - replace_node(A: Node, B: Node | Leaf) + replace_node(A: Node, B: Node) - source + source

    - +

    Replaces node A by node B.

    @@ -2289,7 +2176,7 @@

    Params:

    B - Node | Leaf + Node

    The replacement node.

    @@ -2545,15 +2432,15 @@

    - sibling(node: Node | Leaf): Node | Leaf + sibling(node: Node): Node - source + source

    - +

    Computes the sibling of the input node.

    @@ -2571,7 +2458,7 @@

    Params:

    node - Node | Leaf + Node

    The input node.

    @@ -2586,7 +2473,7 @@

    Return:

    - + @@ -2618,15 +2505,15 @@

    - uncle(node: Node): Node | Leaf + uncle(node: Node): Node - source + source

    - +

    Computes the uncle of the input node when the grandparent is guaranteed to @@ -2660,7 +2547,7 @@

    Return:

    Node | LeafNode
    - + @@ -2698,11 +2585,11 @@

    - source + source

    - + @@ -264,7 +263,7 @@

    deletion

    F - delete_case1(n: Node | Leaf) + delete_case0(n: Node)

    @@ -298,7 +297,7 @@

    deletion

    F - delete_case2(n: Node | Leaf) + delete_case1(n: Node)

    @@ -333,7 +332,7 @@

    deletion

    F - delete_case3(n: Node | Leaf) + delete_case2(n: Node)

    @@ -369,7 +368,7 @@

    deletion

    F - delete_case4(n: Node | Leaf) + delete_case5(n: Node)

    @@ -382,7 +381,8 @@

    deletion

  • all other root-leaf paths have a black height of b
  • n is not the root
  • n's sibling is black
  • -
  • n's parent and n's sibling's children cannot all be black
  • +
  • if n is a left child, the right child of n's sibling is red
  • +
  • if n is a right child, the left child of n's sibling is red
  • @@ -406,21 +406,13 @@

    deletion

    F - delete_case5(n: Node | Leaf) + delete_no_child(n: Node)

    -

    Preconditions:

    -
      -
    • n is black
    • -
    • all root-leaf paths going through n have a black height of b - 1
    • -
    • all other root-leaf paths have a black height of b
    • -
    • n is not the root
    • -
    • n's sibling is black
    • -
    • at least one of n's sibling's children is red
    • -
    +

    Delete a node n that has no non-leaf child.

    @@ -443,22 +435,14 @@

    deletion

    F - delete_case6(n: Node | Leaf) + delete_one_child(n: Node)

    -

    Preconditions:

    -
      -
    • n is black
    • -
    • all root-leaf paths going through n have a black height of b - 1
    • -
    • all other root-leaf paths have a black height of b
    • -
    • n is not the root
    • -
    • n's sibling is black
    • -
    • if n is a left child, the right child of n's sibling is red
    • -
    • if n is a right child, the left child of n's sibling is red
    • -
    +

    Delete a node n with one non-leaf left child and one leaf right +child.

    @@ -481,13 +465,13 @@

    deletion

    F - delete_one_child(n: Node) + prune(root: Node)

    -

    Delete a node n that has at most a single non-leaf child.

    +

    Prune subtree rooted at input node.

    @@ -510,7 +494,7 @@

    deletion

    F - replace_node(A: Node, B: Node | Leaf) + replace_node(A: Node, B: Node)

    @@ -608,7 +592,7 @@

    family

    F - sibling(node: Node | Leaf): Node | Leaf + sibling(node: Node): Node

    @@ -637,7 +621,7 @@

    family

    F - uncle(node: Node): Node | Leaf + uncle(node: Node): Node

    @@ -707,7 +691,7 @@

    insertion

    F - insert_case1(n: Node) + insert_case0(n: Node)

    @@ -739,7 +723,7 @@

    insertion

    F - insert_case2(n: Node) + insert_case1(n: Node)

    @@ -771,7 +755,7 @@

    insertion

    F - insert_case3(n: Node) + insert_case2(n: Node)

    @@ -803,7 +787,7 @@

    insertion

    F - insert_case4(n: Node) + insert_case3(n: Node)

    @@ -835,7 +819,7 @@

    insertion

    F - insert_case5(n: Node) + insert_case4(n: Node)

    @@ -1074,35 +1058,6 @@

    types

    - - -
    - - - - @@ -508,15 +513,9 @@

    RedBlackTree

    - -
    Node | LeafNode
    -
    -

    - F - - - Leaf(parent: Node) -

    -
    -
    - - -

    A black leaf node.

    -
    -
    -
    - - -
    - public - - - diff --git a/index.html b/index.html index 967f8af..c59a64c 100644 --- a/index.html +++ b/index.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • diff --git a/index.json b/index.json index bc64ee5..178fefe 100644 --- a/index.json +++ b/index.json @@ -699,7 +699,7 @@ "__docId__": 56, "kind": "file", "name": "src/debug/_debug.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport BLACK from '../color/BLACK.js';\n\n/**\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n */\nconst _debug = ({red, black}) => {\n\t/**\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node|Leaf} root - The root of the tree.\n\t * @returns {string}\n\t */\n\tconst debug = (root) => {\n\t\tassert(root instanceof Node || root instanceof Leaf);\n\t\tif (root.isLeaf()) {\n\t\t\tassert(root instanceof Leaf);\n\t\t\treturn black('L');\n\t\t}\n\n\t\tassert(root instanceof Node);\n\n\t\tconst repr = root._color === BLACK ? black(root.key) : red(root.key);\n\n\t\treturn `(${debug(root.left)}, ${repr}, ${debug(root.right)})`;\n\t};\n\n\treturn debug;\n};\n\nexport default _debug;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\n\n/**\n * Builds a debug function from color handlers.\n *\n * @param {Object} colors The colors to use.\n * @returns {Function} The debug function.\n */\nconst _debug = ({red, black}) => {\n\t/**\n\t * Recursively constructs a prettyprint string for the red-black tree rooted at\n\t * root.\n\t *\n\t * @param {Node} root - The root of the tree.\n\t * @returns {string}\n\t */\n\tconst debug = (root) => {\n\t\tif (root === null) return black('L');\n\n\t\tassert(root instanceof Node);\n\n\t\tconst repr = root._color === BLACK ? black(root.key) : red(root.key);\n\n\t\treturn `(${debug(root.left)}, ${repr}, ${debug(root.right)})`;\n\t};\n\n\treturn debug;\n};\n\nexport default _debug;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/debug/_debug.js", "access": "public", @@ -720,7 +720,7 @@ "importPath": "@aureooms/js-red-black-tree/src/debug/_debug.js", "importStyle": "_debug", "description": "Builds a debug function from color handlers.", - "lineNumber": 12, + "lineNumber": 11, "unknown": [ { "tagName": "@returns", @@ -751,10 +751,10 @@ { "__docId__": 58, "kind": "file", - "name": "src/deletion/delete_case1.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport delete_case2 from './delete_case2.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case1 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\t// If n is the root, there is nothing to do:\n\t// - all paths go through n, and\n\t// - n is black.\n\tif (n.parent !== null) delete_case2(n);\n};\n\nexport default delete_case1;\n", + "name": "src/deletion/delete_case0.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport Node from '../types/Node.js';\nimport delete_case1 from './delete_case1.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n */\nconst delete_case0 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\t// If n is the root, there is nothing to do:\n\t// - all paths go through n, and\n\t// - n is black.\n\tif (n.parent !== null) delete_case1(n);\n};\n\nexport default delete_case0;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case1.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case0.js", "access": "public", "description": null, "lineNumber": 1 @@ -762,24 +762,23 @@ { "__docId__": 59, "kind": "function", - "name": "delete_case1", - "memberof": "src/deletion/delete_case1.js", + "name": "delete_case0", + "memberof": "src/deletion/delete_case0.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case1.js~delete_case1", + "longname": "src/deletion/delete_case0.js~delete_case0", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case1.js", - "importStyle": "delete_case1", + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case0.js", + "importStyle": "delete_case0", "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b", - "lineNumber": 15, + "lineNumber": 14, "params": [ { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "optional": false, @@ -792,10 +791,10 @@ { "__docId__": 60, "kind": "file", - "name": "src/deletion/delete_case2.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case3 from './delete_case3.js';\nimport delete_case4 from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case2 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\n\tconst s = sibling(n);\n\n\t/**\n\t * If n's sibling is red, prepare for and go to case 4.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t */\n\tif (s._color === RED) {\n\t\tn.parent._color = RED;\n\t\ts._color = BLACK;\n\t\tif (n === n.parent.left) rotate_left(n.parent);\n\t\telse rotate_right(n.parent);\n\t\tdelete_case4(n);\n\t}\n\n\t// Otherwise, go to case 3.\n\telse delete_case3(n);\n};\n\nexport default delete_case2;\n", + "name": "src/deletion/delete_case1.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case2 from './delete_case2.js';\nimport delete_case3 from './delete_case3.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n */\nconst delete_case1 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\n\tif (s._color === BLACK) {\n\t\t// If n's sibling is BLACK, go to case 2.\n\t\tdelete_case2(n);\n\t} else {\n\t\t/**\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t */\n\t\tn.parent._color = RED;\n\t\ts._color = BLACK;\n\t\tif (n === n.parent.left) rotate_left(n.parent);\n\t\telse rotate_right(n.parent);\n\t\tdelete_case3(n);\n\t}\n};\n\nexport default delete_case1;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case2.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case1.js", "access": "public", "description": null, "lineNumber": 1 @@ -803,24 +802,23 @@ { "__docId__": 61, "kind": "function", - "name": "delete_case2", - "memberof": "src/deletion/delete_case2.js", + "name": "delete_case1", + "memberof": "src/deletion/delete_case1.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case2.js~delete_case2", + "longname": "src/deletion/delete_case1.js~delete_case1", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case2.js", - "importStyle": "delete_case2", + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case1.js", + "importStyle": "delete_case1", "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root", - "lineNumber": 22, + "lineNumber": 21, "params": [ { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "optional": false, @@ -833,10 +831,10 @@ { "__docId__": 62, "kind": "file", - "name": "src/deletion/delete_case3.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case1 from './delete_case1.js';\nimport delete_case4 from './delete_case4.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case3 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaft paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\tn.parent._color === BLACK &&\n\t\ts.left._color === BLACK &&\n\t\ts.right._color === BLACK\n\t) {\n\t\ts._color = RED;\n\t\tdelete_case1(n.parent);\n\t}\n\n\t// Otherwise, go to case 4.\n\telse delete_case4(n);\n};\n\nexport default delete_case3;\n", + "name": "src/deletion/delete_case2.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case0 from './delete_case0.js';\nimport delete_case3 from './delete_case3.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n */\nconst delete_case2 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\tn.parent._color === BLACK &&\n\t\t(s.left === null || s.left._color === BLACK) &&\n\t\t(s.right === null || s.right._color === BLACK)\n\t) {\n\t\ts._color = RED;\n\t\tdelete_case0(n.parent);\n\t}\n\n\t// Otherwise, go to case 3.\n\telse delete_case3(n);\n};\n\nexport default delete_case2;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case3.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case2.js", "access": "public", "description": null, "lineNumber": 1 @@ -844,24 +842,23 @@ { "__docId__": 63, "kind": "function", - "name": "delete_case3", - "memberof": "src/deletion/delete_case3.js", + "name": "delete_case2", + "memberof": "src/deletion/delete_case2.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case3.js~delete_case3", + "longname": "src/deletion/delete_case2.js~delete_case2", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case3.js", - "importStyle": "delete_case3", + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case2.js", + "importStyle": "delete_case2", "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black", - "lineNumber": 21, + "lineNumber": 20, "params": [ { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "optional": false, @@ -874,10 +871,10 @@ { "__docId__": 64, "kind": "file", - "name": "src/deletion/delete_case4.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case5 from './delete_case5.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - n's parent and n's sibling's children cannot all be black\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case4 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\tassert(\n\t\tn.parent._color === RED || s.left._color === RED || s.right._color === RED,\n\t);\n\n\t/**\n\t * If n's parent is red and n's sibling's children are black, then swap n's\n\t * parent and n's sibling color. All root-leaf paths going through n have\n\t * now a black height of b. All other root-leaf paths have their black\n\t * height unchanged. Red-black properties are respected. We are done.\n\t *\n\t * R B\n\t * / \\ / \\\n\t * >B B >B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\t// The parent color test is always true when coming from case 2\n\t\tn.parent._color === RED &&\n\t\ts.left._color === BLACK &&\n\t\ts.right._color === BLACK\n\t) {\n\t\ts._color = RED;\n\t\tn.parent._color = BLACK;\n\t}\n\n\t// Otherwise, go to case 5.\n\telse delete_case5(n);\n};\n\nexport default delete_case4;\n", + "name": "src/deletion/delete_case5.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n */\nconst delete_case5 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n\ts._color = n.parent._color;\n\tn.parent._color = BLACK;\n\n\tif (n === n.parent.left) {\n\t\tassert(s.right._color === RED);\n\t\ts.right._color = BLACK;\n\t\trotate_left(n.parent);\n\t}\n\n\t// Symmetric case\n\telse {\n\t\tassert(s.left._color === RED);\n\t\ts.left._color = BLACK;\n\t\trotate_right(n.parent);\n\t}\n};\n\nexport default delete_case5;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case4.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case5.js", "access": "public", "description": null, "lineNumber": 1 @@ -885,24 +882,23 @@ { "__docId__": 65, "kind": "function", - "name": "delete_case4", - "memberof": "src/deletion/delete_case4.js", + "name": "delete_case5", + "memberof": "src/deletion/delete_case5.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case4.js~delete_case4", + "longname": "src/deletion/delete_case5.js~delete_case5", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case4.js", - "importStyle": "delete_case4", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - n's parent and n's sibling's children cannot all be black", + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case5.js", + "importStyle": "delete_case5", + "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - if n is a left child, the right child of n's sibling is red\n - if n is a right child, the left child of n's sibling is red", "lineNumber": 21, "params": [ { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "optional": false, @@ -915,10 +911,10 @@ { "__docId__": 66, "kind": "file", - "name": "src/deletion/delete_case5.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case6 from './delete_case6.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - at least one of n's sibling's children is red\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case5 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\tassert(s.left._color === RED || s.right._color === RED);\n\n\t// The following statements just force the red n's sibling child to be on\n\t// the left of the left of the parent, or right of the right, so case 6\n\t// will rotate correctly.\n\n\t/**\n\t * ? ?\n\t * / \\ / \\\n\t * >B B >B B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - R B - - = R\n\t * / \\ / \\ / \\\n\t * = = - - = B\n\t * / \\\n\t * - -\n\t */\n\tif (n === n.parent.left && s.right._color === BLACK) {\n\t\ts._color = RED;\n\t\ts.left._color = BLACK;\n\t\trotate_right(s);\n\t} else if (n === n.parent.right && s.left._color === BLACK) {\n\t\t/**\n\t\t * ? ?\n\t\t * / \\ / \\\n\t\t * B >B B >B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * B R - - R = - -\n\t\t * / \\ / \\ / \\\n\t\t * - - = = B =\n\t\t * / \\\n\t\t * - -\n\t\t */\n\t\ts._color = RED;\n\t\ts.right._color = BLACK;\n\t\trotate_left(s);\n\t}\n\n\tdelete_case6(n);\n};\n\nexport default delete_case5;\n", + "name": "src/deletion/delete_no_child.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\n\nimport replace_node from './replace_node.js';\nimport delete_case1 from './delete_case1.js';\n\nimport prune from './prune.js';\n\n/**\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n */\nconst delete_no_child = (n) => {\n\tassert(n instanceof Node);\n\tassert(n.parent !== null);\n\tassert(n.left === null);\n\tassert(n.right === null);\n\n\tif (n._color !== BLACK) {\n\t\tassert(n._color === RED);\n\t\tprune(n);\n\t\treturn;\n\t}\n\n\t// Mock leaf since there is no left child\n\t// We use key = n.key to avoid mixing types, but this property is never\n\t// accessed.\n\tconst leaf = new Node(BLACK, n.key);\n\n\t// Replace n with the mocked leaf\n\treplace_node(n, leaf);\n\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1. The leaf is black, so there are more things to fix.\n\tdelete_case1(leaf);\n\n\t// Delete mocked leaf\n\tprune(leaf);\n};\n\nexport default delete_no_child;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case5.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_no_child.js", "access": "public", "description": null, "lineNumber": 1 @@ -926,29 +922,28 @@ { "__docId__": 67, "kind": "function", - "name": "delete_case5", - "memberof": "src/deletion/delete_case5.js", + "name": "delete_no_child", + "memberof": "src/deletion/delete_no_child.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case5.js~delete_case5", + "longname": "src/deletion/delete_no_child.js~delete_no_child", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case5.js", - "importStyle": "delete_case5", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - at least one of n's sibling's children is red", - "lineNumber": 23, + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_no_child.js", + "importStyle": "delete_no_child", + "description": "Delete a node n that has no non-leaf child.\n\nPrecondition:\n - n has no non-leaf child.\n - n is not the root", + "lineNumber": 20, "params": [ { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "optional": false, "name": "n", - "description": "The input node." + "description": "The node to delete." } ], "return": null @@ -956,10 +951,10 @@ { "__docId__": 68, "kind": "file", - "name": "src/deletion/delete_case6.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node|Leaf} n - The input node.\n */\nconst delete_case6 = (n) => {\n\tassert(n instanceof Node || n instanceof Leaf);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n\ts._color = n.parent._color;\n\tn.parent._color = BLACK;\n\n\tif (n === n.parent.left) {\n\t\tassert(s.right._color === RED);\n\t\ts.right._color = BLACK;\n\t\trotate_left(n.parent);\n\t}\n\n\t// Symmetric case\n\telse {\n\t\tassert(s.left._color === RED);\n\t\ts.left._color = BLACK;\n\t\trotate_right(n.parent);\n\t}\n};\n\nexport default delete_case6;\n", + "name": "src/deletion/delete_one_child.js", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\n\nimport replace_node from './replace_node.js';\n\n/**\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n */\nconst delete_one_child = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.left instanceof Node);\n\tassert(n.left._color === RED);\n\tassert(n.right === null);\n\n\tconst child = n.left;\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1.\n\t// We can easily fix this when its only child is an\n\t// internal RED node: change the color of the child to black and\n\t// replace n with it.\n\treplace_node(n, child);\n\tchild._color = BLACK;\n};\n\nexport default delete_one_child;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case6.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_one_child.js", "access": "public", "description": null, "lineNumber": 1 @@ -967,29 +962,28 @@ { "__docId__": 69, "kind": "function", - "name": "delete_case6", - "memberof": "src/deletion/delete_case6.js", + "name": "delete_one_child", + "memberof": "src/deletion/delete_one_child.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_case6.js~delete_case6", + "longname": "src/deletion/delete_one_child.js~delete_one_child", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case6.js", - "importStyle": "delete_case6", - "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - if n is a left child, the right child of n's sibling is red\n - if n is a right child, the left child of n's sibling is red", + "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_one_child.js", + "importStyle": "delete_one_child", + "description": "Delete a node n with one non-leaf left child and one leaf right\nchild.\n\nPrecondition:\n - n has exactly one non-leaf child.\n - n is not the root\n - n's only non-leaf child is n's left child.\n - hence, n's right child is a leaf\n - hence, n's left child is RED\n - hence, n is BLACK", "lineNumber": 22, "params": [ { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "optional": false, "name": "n", - "description": "The input node." + "description": "The node to delete." } ], "return": null @@ -997,10 +991,10 @@ { "__docId__": 70, "kind": "file", - "name": "src/deletion/delete_one_child.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\n\nimport replace_node from './replace_node.js';\nimport delete_case1 from './delete_case1.js';\n\n/**\n * Delete a node n that has at most a single non-leaf child.\n *\n * Precondition:\n * - n has at most one non-leaf child.\n * - if n has a non-leaf child, then it is its left child.\n * - hence, n's right child is a leaf\n *\n * @param {Node} n - The node to delete.\n */\nconst delete_one_child = (n) => {\n\tassert(n instanceof Node);\n\t// Precondition: n's right child is a leaf.\n\t// The right child of n is always a LEAF because either n is a subtree\n\t// predecessor or it is the only child of its parent by the red-black tree\n\t// properties\n\tassert(n.right instanceof Leaf);\n\n\tconst child = n.left;\n\n\t// Replace n with its left child\n\treplace_node(n, child);\n\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1.\n\tif (n._color === BLACK) {\n\t\t// We can easily fix this when its left child is an\n\t\t// internal red node: change the color of the left child to black and\n\t\t// replace n with it.\n\t\tif (child._color === RED) child._color = BLACK;\n\t\t// Otherwise, there are more things to fix.\n\t\telse {\n\t\t\tdelete_case1(child);\n\t\t}\n\t} else {\n\t\t// If n is red then its child can only be black. Replacing n with its\n\t\t// child suffices. This is a NO-OP.\n\t\tassert(child._color === BLACK);\n\t}\n};\n\nexport default delete_one_child;\n", + "name": "src/deletion/prune.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Prune subtree rooted at input node.\n *\n * @param {Node} root - The root of the subtree to prune.\n */\nconst prune = (root) => {\n\tassert(root instanceof Node);\n\tassert(root.parent !== null);\n\n\tif (root === root.parent.left) root.parent.left = null;\n\telse root.parent.right = null;\n};\n\nexport default prune;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_one_child.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/prune.js", "access": "public", "description": null, "lineNumber": 1 @@ -1008,18 +1002,18 @@ { "__docId__": 71, "kind": "function", - "name": "delete_one_child", - "memberof": "src/deletion/delete_one_child.js", + "name": "prune", + "memberof": "src/deletion/prune.js", "generator": false, "async": false, "static": true, - "longname": "src/deletion/delete_one_child.js~delete_one_child", + "longname": "src/deletion/prune.js~prune", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_one_child.js", - "importStyle": "delete_one_child", - "description": "Delete a node n that has at most a single non-leaf child.\n\nPrecondition:\n - n has at most one non-leaf child.\n - if n has a non-leaf child, then it is its left child.\n - hence, n's right child is a leaf", - "lineNumber": 20, + "importPath": "@aureooms/js-red-black-tree/src/deletion/prune.js", + "importStyle": "prune", + "description": "Prune subtree rooted at input node.", + "lineNumber": 9, "params": [ { "nullable": null, @@ -1028,8 +1022,8 @@ ], "spread": false, "optional": false, - "name": "n", - "description": "The node to delete." + "name": "root", + "description": "The root of the subtree to prune." } ], "return": null @@ -1038,7 +1032,7 @@ "__docId__": 72, "kind": "file", "name": "src/deletion/replace_node.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\n\n/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node|Leaf} B - The replacement node.\n */\nconst replace_node = (A, B) => {\n\tassert(A instanceof Node);\n\tassert(B instanceof Node || B instanceof Leaf);\n\t// We never apply delete_one_child on the root\n\tassert(A.parent !== null);\n\n\tif (A === A.parent.left) A.parent.left = B;\n\telse A.parent.right = B;\n\n\tB.parent = A.parent;\n};\n\nexport default replace_node;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n */\nconst replace_node = (A, B) => {\n\tassert(A instanceof Node);\n\tassert(B instanceof Node);\n\t// We never apply delete_one_child or delete_no_child on the root\n\tassert(A.parent !== null);\n\n\tif (A === A.parent.left) A.parent.left = B;\n\telse A.parent.right = B;\n\n\tB.parent = A.parent;\n};\n\nexport default replace_node;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/replace_node.js", "access": "public", @@ -1059,7 +1053,7 @@ "importPath": "@aureooms/js-red-black-tree/src/deletion/replace_node.js", "importStyle": "replace_node", "description": "Replaces node A by node B.", - "lineNumber": 11, + "lineNumber": 10, "params": [ { "nullable": null, @@ -1074,8 +1068,7 @@ { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "optional": false, @@ -1142,7 +1135,7 @@ "__docId__": 76, "kind": "file", "name": "src/family/predecessor.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nconst predecessor = (node) => {\n\tassert(node.left instanceof Node);\n\tlet pred = node.left;\n\n\twhile (!pred.right.isLeaf()) {\n\t\tassert(pred.right instanceof Node);\n\t\tpred = pred.right;\n\t}\n\n\treturn pred;\n};\n\nexport default predecessor;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Computes the predecessor of the input node, in the subtree rooted at the\n * input node, when this predecessor is guaranteed to exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nconst predecessor = (node) => {\n\tassert(node.left instanceof Node);\n\tlet pred = node.left;\n\n\twhile (pred.right !== null) {\n\t\tassert(pred.right instanceof Node);\n\t\tpred = pred.right;\n\t}\n\n\treturn pred;\n};\n\nexport default predecessor;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/predecessor.js", "access": "public", @@ -1195,7 +1188,7 @@ "__docId__": 78, "kind": "file", "name": "src/family/sibling.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\n\n/**\n * Computes the sibling of the input node.\n *\n * @param {Node|Leaf} node - The input node.\n * @returns {Node|Leaf}\n */\nconst sibling = (node) => {\n\tassert(node instanceof Node || node instanceof Leaf);\n\t// We only use this function when node HAS a sibling.\n\tassert(node.parent !== null);\n\n\treturn node === node.parent.left ? node.parent.right : node.parent.left;\n};\n\nexport default sibling;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Computes the sibling of the input node.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nconst sibling = (node) => {\n\tassert(node instanceof Node);\n\t// We only use this function when node HAS a non-leaf sibling.\n\tassert(node.parent !== null);\n\n\treturn node === node.parent.left ? node.parent.right : node.parent.left;\n};\n\nexport default sibling;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/sibling.js", "access": "public", @@ -1216,19 +1209,18 @@ "importPath": "@aureooms/js-red-black-tree/src/family/sibling.js", "importStyle": "sibling", "description": "Computes the sibling of the input node.", - "lineNumber": 11, + "lineNumber": 10, "unknown": [ { "tagName": "@returns", - "tagValue": "{Node|Leaf}" + "tagValue": "{Node}" } ], "params": [ { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "optional": false, @@ -1239,8 +1231,7 @@ "return": { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "description": "" @@ -1250,7 +1241,7 @@ "__docId__": 80, "kind": "file", "name": "src/family/uncle.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport Leaf from '../types/Leaf.js';\nimport grandparent from './grandparent.js';\n\n/**\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node|Leaf}\n */\nconst uncle = (node) => {\n\tassert(node instanceof Node);\n\tconst g = grandparent(node);\n\tassert(g !== null);\n\tconst u = node.parent === g.left ? g.right : g.left;\n\tassert(u instanceof Node || u instanceof Leaf);\n\treturn u;\n};\n\nexport default uncle;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport grandparent from './grandparent.js';\n\n/**\n * Computes the uncle of the input node when the grandparent is guaranteed to\n * exist.\n *\n * @param {Node} node - The input node.\n * @returns {Node}\n */\nconst uncle = (node) => {\n\tassert(node instanceof Node);\n\tconst g = grandparent(node);\n\tassert(g !== null);\n\treturn node.parent === g.left ? g.right : g.left;\n};\n\nexport default uncle;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/family/uncle.js", "access": "public", @@ -1271,11 +1262,11 @@ "importPath": "@aureooms/js-red-black-tree/src/family/uncle.js", "importStyle": "uncle", "description": "Computes the uncle of the input node when the grandparent is guaranteed to\nexist.", - "lineNumber": 13, + "lineNumber": 12, "unknown": [ { "tagName": "@returns", - "tagValue": "{Node|Leaf}" + "tagValue": "{Node}" } ], "params": [ @@ -1293,8 +1284,7 @@ "return": { "nullable": null, "types": [ - "Node", - "Leaf" + "Node" ], "spread": false, "description": "" @@ -1304,7 +1294,7 @@ "__docId__": 82, "kind": "file", "name": "src/index.js", - "content": "export {default as empty} from './api/empty.js';\nexport {default as from} from './api/from.js';\nexport {default as BLACK} from './color/BLACK.js';\nexport {default as RED} from './color/RED.js';\nexport {default as _debug} from './debug/_debug.js';\nexport {default as delete_case1} from './deletion/delete_case1.js';\nexport {default as delete_case2} from './deletion/delete_case2.js';\nexport {default as delete_case3} from './deletion/delete_case3.js';\nexport {default as delete_case4} from './deletion/delete_case4.js';\nexport {default as delete_case5} from './deletion/delete_case5.js';\nexport {default as delete_case6} from './deletion/delete_case6.js';\nexport {default as delete_one_child} from './deletion/delete_one_child.js';\nexport {default as replace_node} from './deletion/replace_node.js';\nexport {default as grandparent} from './family/grandparent.js';\nexport {default as predecessor} from './family/predecessor.js';\nexport {default as sibling} from './family/sibling.js';\nexport {default as uncle} from './family/uncle.js';\nexport {default as insert} from './insertion/insert.js';\nexport {default as insert_case1} from './insertion/insert_case1.js';\nexport {default as insert_case2} from './insertion/insert_case2.js';\nexport {default as insert_case3} from './insertion/insert_case3.js';\nexport {default as insert_case4} from './insertion/insert_case4.js';\nexport {default as insert_case5} from './insertion/insert_case5.js';\nexport {default as rotate_left} from './rotate/rotate_left.js';\nexport {default as rotate_right} from './rotate/rotate_right.js';\nexport {default as search} from './search/search.js';\nexport {default as inordertraversal} from './traversal/inordertraversal.js';\nexport {default as rangetraversal} from './traversal/rangetraversal.js';\nexport {default as Leaf} from './types/Leaf.js';\nexport {default as Node} from './types/Node.js';\nexport {default as RedBlackTree} from './types/RedBlackTree.js';\n", + "content": "export {default as empty} from './api/empty.js';\nexport {default as from} from './api/from.js';\nexport {default as BLACK} from './color/BLACK.js';\nexport {default as RED} from './color/RED.js';\nexport {default as _debug} from './debug/_debug.js';\nexport {default as delete_case0} from './deletion/delete_case0.js';\nexport {default as delete_case1} from './deletion/delete_case1.js';\nexport {default as delete_case2} from './deletion/delete_case2.js';\nexport {default as delete_case3} from './deletion/delete_case3.js';\nexport {default as delete_case4} from './deletion/delete_case4.js';\nexport {default as delete_case5} from './deletion/delete_case5.js';\nexport {default as delete_no_child} from './deletion/delete_no_child.js';\nexport {default as delete_one_child} from './deletion/delete_one_child.js';\nexport {default as prune} from './deletion/prune.js';\nexport {default as replace_node} from './deletion/replace_node.js';\nexport {default as grandparent} from './family/grandparent.js';\nexport {default as predecessor} from './family/predecessor.js';\nexport {default as sibling} from './family/sibling.js';\nexport {default as uncle} from './family/uncle.js';\nexport {default as insert} from './insertion/insert.js';\nexport {default as insert_case0} from './insertion/insert_case0.js';\nexport {default as insert_case1} from './insertion/insert_case1.js';\nexport {default as insert_case2} from './insertion/insert_case2.js';\nexport {default as insert_case3} from './insertion/insert_case3.js';\nexport {default as insert_case4} from './insertion/insert_case4.js';\nexport {default as rotate_left} from './rotate/rotate_left.js';\nexport {default as rotate_right} from './rotate/rotate_right.js';\nexport {default as search} from './search/search.js';\nexport {default as inordertraversal} from './traversal/inordertraversal.js';\nexport {default as rangetraversal} from './traversal/rangetraversal.js';\nexport {default as Node} from './types/Node.js';\nexport {default as RedBlackTree} from './types/RedBlackTree.js';\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/index.js", "access": "public", @@ -1315,7 +1305,7 @@ "__docId__": 83, "kind": "file", "name": "src/insertion/insert.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case1}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n */\nconst insert = (compare, A, B) => {\n\twhile (true) {\n\t\tif (compare(B.key, A.key) < 0) {\n\t\t\tconst node = A.left;\n\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tassert(node instanceof Node);\n\t\t\tA = node;\n\t\t} else {\n\t\t\tconst node = A.right;\n\n\t\t\tif (node.isLeaf()) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tassert(node instanceof Node);\n\t\t\tA = node;\n\t\t}\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n};\n\nexport default insert;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Walks the tree rooted at A down the only path that satisfies\n * the following property: if at a node C we make a left (resp.\n * right), then B < C (resp. B >= C). Once we hit the\n * end of the path, we can add node B at this position. By the\n * property of the path, the tree rooted at A is still a binary\n * search tree.\n * For our red-black tree, all that is left to do is fix the red-black tree\n * properties in case they have been violated by this insertion. This is fixed\n * by {@link insert_case0}.\n *\n * @param {Function} compare - The comparison function to use.\n * @param {Node} A - The root of the tree.\n * @param {Node} B - The node to insert.\n * @returns {Node} B - The node that has been inserted.\n */\nconst insert = (compare, A, B) => {\n\twhile (true) {\n\t\tif (compare(B.key, A.key) < 0) {\n\t\t\tconst node = A.left;\n\n\t\t\tif (node === null) {\n\t\t\t\tA.left = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tassert(node instanceof Node);\n\t\t\tA = node;\n\t\t} else {\n\t\t\tconst node = A.right;\n\n\t\t\tif (node === null) {\n\t\t\t\tA.right = B;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tassert(node instanceof Node);\n\t\t\tA = node;\n\t\t}\n\t}\n\n\tB.parent = A;\n\n\treturn B;\n};\n\nexport default insert;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert.js", "access": "public", @@ -1335,7 +1325,7 @@ "export": true, "importPath": "@aureooms/js-red-black-tree/src/insertion/insert.js", "importStyle": "insert", - "description": "Walks the tree rooted at A down the only path that satisfies\nthe following property: if at a node C we make a left (resp.\nright), then B < C (resp. B >= C). Once we hit the\nend of the path, we can add node B at this position. By the\nproperty of the path, the tree rooted at A is still a binary\nsearch tree.\nFor our red-black tree, all that is left to do is fix the red-black tree\nproperties in case they have been violated by this insertion. This is fixed\nby {@link insert_case1}.", + "description": "Walks the tree rooted at A down the only path that satisfies\nthe following property: if at a node C we make a left (resp.\nright), then B < C (resp. B >= C). Once we hit the\nend of the path, we can add node B at this position. By the\nproperty of the path, the tree rooted at A is still a binary\nsearch tree.\nFor our red-black tree, all that is left to do is fix the red-black tree\nproperties in case they have been violated by this insertion. This is fixed\nby {@link insert_case0}.", "lineNumber": 20, "unknown": [ { @@ -1387,10 +1377,10 @@ { "__docId__": 85, "kind": "file", - "name": "src/insertion/insert_case1.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case2 from './insert_case2.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n */\nconst insert_case1 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent === null) n._color = BLACK;\n\telse insert_case2(n);\n};\n\nexport default insert_case1;\n", + "name": "src/insertion/insert_case0.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case1 from './insert_case1.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n */\nconst insert_case0 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent === null) n._color = BLACK;\n\telse insert_case1(n);\n};\n\nexport default insert_case0;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case1.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case0.js", "access": "public", "description": null, "lineNumber": 1 @@ -1398,16 +1388,16 @@ { "__docId__": 86, "kind": "function", - "name": "insert_case1", - "memberof": "src/insertion/insert_case1.js", + "name": "insert_case0", + "memberof": "src/insertion/insert_case0.js", "generator": false, "async": false, "static": true, - "longname": "src/insertion/insert_case1.js~insert_case1", + "longname": "src/insertion/insert_case0.js~insert_case0", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case1.js", - "importStyle": "insert_case1", + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case0.js", + "importStyle": "insert_case0", "description": "Preconditions:\n - n is red.\n - n's children are BLACK", "lineNumber": 14, "params": [ @@ -1427,10 +1417,10 @@ { "__docId__": 87, "kind": "file", - "name": "src/insertion/insert_case2.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case3 from './insert_case3.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case2 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\tassert(n.parent !== null);\n\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent._color === BLACK) return;\n\n\tinsert_case3(n);\n};\n\nexport default insert_case2;\n", + "name": "src/insertion/insert_case1.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case2 from './insert_case2.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case1 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent._color === BLACK) return;\n\n\tinsert_case2(n);\n};\n\nexport default insert_case1;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case2.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case1.js", "access": "public", "description": null, "lineNumber": 1 @@ -1438,16 +1428,16 @@ { "__docId__": 88, "kind": "function", - "name": "insert_case2", - "memberof": "src/insertion/insert_case2.js", + "name": "insert_case1", + "memberof": "src/insertion/insert_case1.js", "generator": false, "async": false, "static": true, - "longname": "src/insertion/insert_case2.js~insert_case2", + "longname": "src/insertion/insert_case1.js~insert_case1", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case2.js", - "importStyle": "insert_case2", + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case1.js", + "importStyle": "insert_case1", "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.", "lineNumber": 15, "params": [ @@ -1467,10 +1457,10 @@ { "__docId__": 89, "kind": "file", - "name": "src/insertion/insert_case3.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport uncle from '../family/uncle.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case1 from './insert_case1.js';\nimport insert_case4 from './insert_case4.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case3 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst u = uncle(n);\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case1 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\tif (u._color === RED) {\n\t\tn.parent._color = BLACK;\n\t\tu._color = BLACK;\n\t\tconst g = grandparent(n);\n\t\tg._color = RED;\n\t\tinsert_case1(g);\n\t} else insert_case4(n);\n};\n\nexport default insert_case3;\n", + "name": "src/insertion/insert_case2.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport uncle from '../family/uncle.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case0 from './insert_case0.js';\nimport insert_case3 from './insert_case3.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case2 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst u = uncle(n);\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\tif (u !== null && u._color !== BLACK) {\n\t\tassert(u._color === RED);\n\t\tn.parent._color = BLACK;\n\t\tu._color = BLACK;\n\t\tconst g = grandparent(n);\n\t\tg._color = RED;\n\t\tinsert_case0(g);\n\t} else insert_case3(n);\n};\n\nexport default insert_case2;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case3.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case2.js", "access": "public", "description": null, "lineNumber": 1 @@ -1478,16 +1468,16 @@ { "__docId__": 90, "kind": "function", - "name": "insert_case3", - "memberof": "src/insertion/insert_case3.js", + "name": "insert_case2", + "memberof": "src/insertion/insert_case2.js", "generator": false, "async": false, "static": true, - "longname": "src/insertion/insert_case3.js~insert_case3", + "longname": "src/insertion/insert_case2.js~insert_case2", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case3.js", - "importStyle": "insert_case3", + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case2.js", + "importStyle": "insert_case2", "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.", "lineNumber": 19, "params": [ @@ -1507,10 +1497,10 @@ { "__docId__": 91, "kind": "file", - "name": "src/insertion/insert_case4.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case5 from './insert_case5.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case5}.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case4 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t/**\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case5} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\tif (n === n.parent.right && n.parent === g.left) {\n\t\trotate_left(n.parent);\n\n\t\t/**\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\t} else if (n === n.parent.left && n.parent === g.right) {\n\t\t/**\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case5} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_right(n.parent);\n\n\t\t/**\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t}\n\n\tinsert_case5(n);\n};\n\nexport default insert_case4;\n", + "name": "src/insertion/insert_case3.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case4 from './insert_case4.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case3 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t/**\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\tif (n === n.parent.right && n.parent === g.left) {\n\t\trotate_left(n.parent);\n\n\t\t/**\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\t} else if (n === n.parent.left && n.parent === g.right) {\n\t\t/**\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_right(n.parent);\n\n\t\t/**\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t}\n\n\tinsert_case4(n);\n};\n\nexport default insert_case3;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case4.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case3.js", "access": "public", "description": null, "lineNumber": 1 @@ -1518,17 +1508,17 @@ { "__docId__": 92, "kind": "function", - "name": "insert_case4", - "memberof": "src/insertion/insert_case4.js", + "name": "insert_case3", + "memberof": "src/insertion/insert_case3.js", "generator": false, "async": false, "static": true, - "longname": "src/insertion/insert_case4.js~insert_case4", + "longname": "src/insertion/insert_case3.js~insert_case3", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case4.js", - "importStyle": "insert_case4", - "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n\nHere we fix the input subtree to pass the preconditions of {@link insert_case5}.", + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case3.js", + "importStyle": "insert_case3", + "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n\nHere we fix the input subtree to pass the preconditions of {@link insert_case4}.", "lineNumber": 22, "params": [ { @@ -1547,10 +1537,10 @@ { "__docId__": 93, "kind": "file", - "name": "src/insertion/insert_case5.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case5 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t// Repaint n's parent black, n's grandparent red\n\tn.parent._color = BLACK;\n\tg._color = RED;\n\n\tif (n === n.parent.left) {\n\t\t/**\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.left instanceof Node);\n\t\tassert(n === g.left.left);\n\t\tassert(g.right._color === BLACK);\n\t\trotate_right(g);\n\t} else {\n\t\t/**\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.right instanceof Node);\n\t\tassert(n === g.right.right);\n\t\tassert(g.left._color === BLACK);\n\t\trotate_left(g);\n\t}\n};\n\nexport default insert_case5;\n", + "name": "src/insertion/insert_case4.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case4 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t// Repaint n's parent black, n's grandparent red\n\tn.parent._color = BLACK;\n\tg._color = RED;\n\n\tif (n === n.parent.left) {\n\t\t/**\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.left instanceof Node);\n\t\tassert(n === g.left.left);\n\t\tassert(g.right === null || g.right._color === BLACK);\n\t\trotate_right(g);\n\t} else {\n\t\t/**\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.right instanceof Node);\n\t\tassert(n === g.right.right);\n\t\tassert(g.left === null || g.left._color === BLACK);\n\t\trotate_left(g);\n\t}\n};\n\nexport default insert_case4;\n", "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case5.js", + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case4.js", "access": "public", "description": null, "lineNumber": 1 @@ -1558,16 +1548,16 @@ { "__docId__": 94, "kind": "function", - "name": "insert_case5", - "memberof": "src/insertion/insert_case5.js", + "name": "insert_case4", + "memberof": "src/insertion/insert_case4.js", "generator": false, "async": false, "static": true, - "longname": "src/insertion/insert_case5.js~insert_case5", + "longname": "src/insertion/insert_case4.js~insert_case4", "access": "public", "export": true, - "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case5.js", - "importStyle": "insert_case5", + "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case4.js", + "importStyle": "insert_case4", "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n - the path from n to its grandparent makes a left-left or right-right.", "lineNumber": 20, "params": [ @@ -1588,7 +1578,7 @@ "__docId__": 95, "kind": "file", "name": "src/rotate/rotate_left.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nconst rotate_left = (A) => {\n\tassert(A instanceof Node);\n\tconst B = A.right;\n\tassert(B instanceof Node);\n\tconst a = A.left;\n\tconst b = B.left;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tA.left = B;\n\tA.right = c;\n\n\tB.left = a;\n\tB.right = b;\n\n\ta.parent = B;\n\tb.parent = B;\n\tc.parent = A;\n};\n\nexport default rotate_left;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nconst rotate_left = (A) => {\n\tassert(A instanceof Node);\n\tconst B = A.right;\n\tassert(B instanceof Node);\n\tconst a = A.left;\n\tconst b = B.left;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tA.left = B;\n\tA.right = c;\n\n\tB.left = a;\n\tB.right = b;\n\n\tif (a !== null) a.parent = B;\n\tif (b !== null) b.parent = B;\n\tif (c !== null) c.parent = A;\n};\n\nexport default rotate_left;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_left.js", "access": "public", @@ -1628,7 +1618,7 @@ "__docId__": 97, "kind": "file", "name": "src/rotate/rotate_right.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nconst rotate_right = (B) => {\n\tassert(B instanceof Node);\n\tconst A = B.left;\n\tassert(A instanceof Node);\n\tconst a = A.left;\n\tconst b = A.right;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tB.left = a;\n\tB.right = A;\n\n\tA.left = b;\n\tA.right = c;\n\n\ta.parent = B;\n\tb.parent = A;\n\tc.parent = A;\n};\n\nexport default rotate_right;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nconst rotate_right = (B) => {\n\tassert(B instanceof Node);\n\tconst A = B.left;\n\tassert(A instanceof Node);\n\tconst a = A.left;\n\tconst b = A.right;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tB.left = a;\n\tB.right = A;\n\n\tA.left = b;\n\tA.right = c;\n\n\tif (a !== null) a.parent = B;\n\tif (b !== null) b.parent = A;\n\tif (c !== null) c.parent = A;\n};\n\nexport default rotate_right;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_right.js", "access": "public", @@ -1668,7 +1658,7 @@ "__docId__": 99, "kind": "file", "name": "src/search/search.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n */\nconst search = (compare, root, key) => {\n\tassert(root instanceof Node);\n\twhile (true) {\n\t\tconst d = compare(key, root.key);\n\n\t\tif (d === 0) {\n\t\t\treturn root;\n\t\t}\n\n\t\tconst child = d < 0 ? root.left : root.right;\n\n\t\tif (child.isLeaf()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tassert(child instanceof Node);\n\t\troot = child;\n\t}\n};\n\nexport default search;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Search for the first node whose key equals key.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree to scan.\n * @param {any} key - The key to search for.\n * @returns {Node}\n */\nconst search = (compare, root, key) => {\n\tassert(root instanceof Node);\n\twhile (true) {\n\t\tconst d = compare(key, root.key);\n\n\t\tif (d === 0) {\n\t\t\treturn root;\n\t\t}\n\n\t\troot = d < 0 ? root.left : root.right;\n\n\t\tif (root === null) {\n\t\t\treturn null;\n\t\t}\n\t}\n};\n\nexport default search;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/search/search.js", "access": "public", @@ -1741,7 +1731,7 @@ "__docId__": 101, "kind": "file", "name": "src/traversal/inordertraversal.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n */\nexport default function* inordertraversal(node) {\n\tassert(node instanceof Node);\n\tif (!node.left.isLeaf()) {\n\t\t// Yield the nodes on the left recursively. Those nodes are all smaller\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tassert(node.left instanceof Node);\n\t\tyield* inordertraversal(node.left);\n\t}\n\n\t// Yield the current node.\n\tyield node.key;\n\n\tif (!node.right.isLeaf()) {\n\t\t// Yield the nodes on the right recursively. Those nodes are all larger\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tassert(node.right instanceof Node);\n\t\tyield* inordertraversal(node.right);\n\t}\n}\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n */\nexport default function* inordertraversal(node) {\n\tassert(node instanceof Node);\n\tif (node.left !== null) {\n\t\t// Yield the nodes on the left recursively. Those nodes are all smaller\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tassert(node.left instanceof Node);\n\t\tyield* inordertraversal(node.left);\n\t}\n\n\t// Yield the current node.\n\tyield node.key;\n\n\tif (node.right !== null) {\n\t\t// Yield the nodes on the right recursively. Those nodes are all larger\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tassert(node.right instanceof Node);\n\t\tyield* inordertraversal(node.right);\n\t}\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/inordertraversal.js", "access": "public", @@ -1794,7 +1784,7 @@ "__docId__": 103, "kind": "file", "name": "src/traversal/rangetraversal.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n */\nexport default function* rangetraversal(compare, root, left, right) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (!root.right.isLeaf()) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t} else if (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (!root.left.isLeaf()) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\t} else {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif (!root.left.isLeaf()) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\n\t\tyield root.key;\n\t\tif (!root.right.isLeaf()) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t}\n}\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n */\nexport default function* rangetraversal(compare, root, left, right) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t} else if (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\t} else {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\n\t\tyield root.key;\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t}\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/rangetraversal.js", "access": "public", @@ -1876,86 +1866,8 @@ { "__docId__": 105, "kind": "file", - "name": "src/types/Leaf.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport Node from './Node.js';\n\n/**\n * A black leaf node.\n *\n * @class\n * @param {Node} parent - The parent node in the tree.\n */\nexport default function Leaf(parent) {\n\tassert(parent instanceof Node);\n\t/** @constant {number} The color of the node. */\n\tthis._color = BLACK;\n\t/** @member {Node} The parent node. */\n\tthis.parent = parent;\n}\n\n/**\n * Returns true if the Leaf object is a leaf. This\n * always returns true.\n *\n * @returns {Boolean}\n */\nLeaf.prototype.isLeaf = function () {\n\treturn true;\n};\n", - "static": true, - "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/types/Leaf.js", - "access": "public", - "description": null, - "lineNumber": 1 - }, - { - "__docId__": 106, - "kind": "function", - "name": "Leaf", - "memberof": "src/types/Leaf.js", - "generator": false, - "async": false, - "static": true, - "longname": "src/types/Leaf.js~Leaf", - "access": "public", - "export": true, - "importPath": "@aureooms/js-red-black-tree/src/types/Leaf.js", - "importStyle": "Leaf", - "description": "A black leaf node.", - "lineNumber": 11, - "unknown": [ - { - "tagName": "@class", - "tagValue": "" - } - ], - "params": [ - { - "nullable": null, - "types": [ - "Node" - ], - "spread": false, - "optional": false, - "name": "parent", - "description": "The parent node in the tree." - } - ], - "return": null - }, - { - "__docId__": 107, - "kind": "function", - "name": "isLeaf", - "memberof": "src/types/Leaf.js", - "generator": false, - "async": false, - "static": true, - "longname": "src/types/Leaf.js~isLeaf", - "access": "public", - "export": false, - "importPath": "@aureooms/js-red-black-tree/src/types/Leaf.js", - "importStyle": null, - "description": "Returns true if the Leaf object is a leaf. This\nalways returns true.", - "lineNumber": 25, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Boolean}" - } - ], - "return": { - "nullable": null, - "types": [ - "Boolean" - ], - "spread": false, - "description": "" - }, - "params": [], - "ignore": true - }, - { - "__docId__": 108, - "kind": "file", "name": "src/types/Node.js", - "content": "import Leaf from './Leaf.js';\n\n/**\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n */\nexport default function Node(color, key) {\n\t/** @member {number} The color of the node. */\n\tthis._color = color;\n\t/** @member {Node|Leaf} The left child */\n\tthis.left = new Leaf(this);\n\t/** @member {Node|Leaf} The right child */\n\tthis.right = new Leaf(this);\n\t/** @member {Node} The parent node. */\n\tthis.parent = null;\n\t/** @member {any} The key held by this node. */\n\tthis.key = key;\n}\n\n/**\n * Returns true if the Node object is a leaf. This\n * always returns false.\n *\n * @returns {Boolean}\n */\nNode.prototype.isLeaf = function () {\n\treturn false;\n};\n", + "content": "/**\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n */\nexport default function Node(color, key) {\n\t/** @member {number} The color of the node. */\n\tthis._color = color;\n\t/** @member {Node} The left child */\n\tthis.left = null;\n\t/** @member {Node} The right child */\n\tthis.right = null;\n\t/** @member {Node} The parent node. */\n\tthis.parent = null;\n\t/** @member {any} The key held by this node. */\n\tthis.key = key;\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/types/Node.js", "access": "public", @@ -1963,7 +1875,7 @@ "lineNumber": 1 }, { - "__docId__": 109, + "__docId__": 106, "kind": "function", "name": "Node", "memberof": "src/types/Node.js", @@ -1976,7 +1888,7 @@ "importPath": "@aureooms/js-red-black-tree/src/types/Node.js", "importStyle": "Node", "description": "An internal node. This node can be red or black.", - "lineNumber": 10, + "lineNumber": 8, "unknown": [ { "tagName": "@class", @@ -2008,42 +1920,10 @@ "return": null }, { - "__docId__": 110, - "kind": "function", - "name": "isLeaf", - "memberof": "src/types/Node.js", - "generator": false, - "async": false, - "static": true, - "longname": "src/types/Node.js~isLeaf", - "access": "public", - "export": false, - "importPath": "@aureooms/js-red-black-tree/src/types/Node.js", - "importStyle": null, - "description": "Returns true if the Node object is a leaf. This\nalways returns false.", - "lineNumber": 29, - "unknown": [ - { - "tagName": "@returns", - "tagValue": "{Boolean}" - } - ], - "return": { - "nullable": null, - "types": [ - "Boolean" - ], - "spread": false, - "description": "" - }, - "params": [], - "ignore": true - }, - { - "__docId__": 111, + "__docId__": 107, "kind": "file", "name": "src/types/RedBlackTree.js", - "content": "import assert from 'assert';\nimport Node from './Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport predecessor from '../family/predecessor.js';\nimport insert from '../insertion/insert.js';\nimport insert_case2 from '../insertion/insert_case2.js';\nimport delete_one_child from '../deletion/delete_one_child.js';\nimport search from '../search/search.js';\nimport inordertraversal from '../traversal/inordertraversal.js';\nimport rangetraversal from '../traversal/rangetraversal.js';\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport default class RedBlackTree {\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t */\n\tconstructor(compare) {\n\t\t/** @member {Function} The comparison function for node keys. */\n\t\tthis.compare = compare;\n\t\t/** @member {Node} The root of the tree. */\n\t\tthis.root = null;\n\t}\n\n\t/**\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t */\n\tisEmpty() {\n\t\treturn this.root === null;\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t */\n\tadd(key) {\n\t\tif (this.root === null) {\n\t\t\tthis.root = new Node(BLACK, key);\n\t\t} else {\n\t\t\tconst node = new Node(RED, key);\n\t\t\tinsert(this.compare, this.root, node);\n\t\t\tinsert_case2(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search(key) {\n\t\tif (this.root === null) return null;\n\t\treturn search(this.compare, this.root, key);\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t */\n\tget(key) {\n\t\tconst node = this._search(key);\n\t\treturn node === null ? null : node.key;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean}\n\t */\n\thas(key) {\n\t\treturn this._search(key) !== null;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\t_delete(node) {\n\t\tif (!node.left.isLeaf()) {\n\t\t\t// Replace node's key with predecessor's key\n\t\t\tconst pred = predecessor(node);\n\t\t\tnode.key = pred.key;\n\t\t\t// Delete predecessor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(pred);\n\t\t} else if (!node.right.isLeaf()) {\n\t\t\t// Replace node's key with successor's key\n\t\t\t// If there is no left child, then there can only be one right\n\t\t\t// child.\n\t\t\tconst succ = node.right;\n\t\t\tassert(succ instanceof Node);\n\t\t\tnode.key = succ.key;\n\t\t\t// Delete successor node\n\t\t\t// note: this node can only have one non-leaf child\n\t\t\t// because the tree is a red-black tree\n\t\t\tdelete_one_child(succ);\n\t\t} else if (node === this.root) {\n\t\t\tthis.root = null;\n\t\t} else {\n\t\t\tdelete_one_child(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove(key) {\n\t\tconst node = this._search(key);\n\t\tif (node === null) return false;\n\n\t\tthis._delete(node);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t */\n\t*range(left, right) {\n\t\tif (this.root !== null)\n\t\t\tyield* rangetraversal(this.compare, this.root, left, right);\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t */\n\t*items() {\n\t\tif (this.root !== null) yield* inordertraversal(this.root);\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator]() {\n\t\treturn this.items();\n\t}\n\n\t/**\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic empty(compare) {\n\t\treturn new RedBlackTree(compare);\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from(compare, iterable) {\n\t\tconst tree = new RedBlackTree(compare);\n\n\t\tfor (const element of iterable) tree.add(element);\n\n\t\treturn tree;\n\t}\n}\n", + "content": "import assert from 'assert';\nimport Node from './Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport predecessor from '../family/predecessor.js';\nimport insert from '../insertion/insert.js';\nimport insert_case1 from '../insertion/insert_case1.js';\nimport delete_one_child from '../deletion/delete_one_child.js';\nimport delete_no_child from '../deletion/delete_no_child.js';\nimport search from '../search/search.js';\nimport inordertraversal from '../traversal/inordertraversal.js';\nimport rangetraversal from '../traversal/rangetraversal.js';\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport default class RedBlackTree {\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t */\n\tconstructor(compare) {\n\t\tassert(compare instanceof Function);\n\t\t/** @member {Function} The comparison function for node keys. */\n\t\tthis.compare = compare;\n\t\t/** @member {Node} The root of the tree. */\n\t\tthis.root = null;\n\t}\n\n\t/**\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t */\n\tisEmpty() {\n\t\treturn this.root === null;\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t */\n\tadd(key) {\n\t\tif (this.root === null) {\n\t\t\tthis.root = new Node(BLACK, key);\n\t\t} else {\n\t\t\tconst node = new Node(RED, key);\n\t\t\tinsert(this.compare, this.root, node);\n\t\t\tinsert_case1(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search(key) {\n\t\tif (this.root === null) return null;\n\t\treturn search(this.compare, this.root, key);\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t */\n\tget(key) {\n\t\tconst node = this._search(key);\n\t\treturn node === null ? null : node.key;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t */\n\thas(key) {\n\t\treturn this._search(key) !== null;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\t_delete(node) {\n\t\tassert(node instanceof Node);\n\t\tif (node.left !== null) {\n\t\t\t// Replace node's key with predecessor's key\n\t\t\tconst pred = predecessor(node);\n\t\t\tnode.key = pred.key;\n\t\t\t// Delete predecessor node\n\t\t\t// NOTE: this node can only have one non-leaf (left) child because\n\t\t\t// of red-black tree invariant.\n\t\t\tif (pred.left === null) {\n\t\t\t\tdelete_no_child(pred);\n\t\t\t} else {\n\t\t\t\tdelete_one_child(pred);\n\t\t\t}\n\t\t} else if (node.right !== null) {\n\t\t\t// Replace node's key with successor's key\n\t\t\t// NOTE: Since there is no left child, then there can only be one\n\t\t\t// right child by the red-black tree invariant.\n\t\t\tconst succ = node.right;\n\t\t\tnode.key = succ.key;\n\t\t\t// Delete successor node\n\t\t\tdelete_no_child(succ);\n\t\t} else if (node === this.root) {\n\t\t\tthis.root = null;\n\t\t} else {\n\t\t\tdelete_no_child(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove(key) {\n\t\tconst node = this._search(key);\n\t\tif (node === null) return false;\n\n\t\tthis._delete(node);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t */\n\t*range(left, right) {\n\t\tif (this.root !== null)\n\t\t\tyield* rangetraversal(this.compare, this.root, left, right);\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t */\n\t*items() {\n\t\tif (this.root !== null) yield* inordertraversal(this.root);\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator]() {\n\t\treturn this.items();\n\t}\n\n\t/**\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic empty(compare) {\n\t\treturn new RedBlackTree(compare);\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from(compare, iterable) {\n\t\tconst tree = new RedBlackTree(compare);\n\n\t\tfor (const element of iterable) tree.add(element);\n\n\t\treturn tree;\n\t}\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/types/RedBlackTree.js", "access": "public", @@ -2051,7 +1931,7 @@ "lineNumber": 1 }, { - "__docId__": 112, + "__docId__": 108, "kind": "class", "name": "RedBlackTree", "memberof": "src/types/RedBlackTree.js", @@ -2062,11 +1942,11 @@ "importPath": "@aureooms/js-red-black-tree/src/types/RedBlackTree.js", "importStyle": "RedBlackTree", "description": "A RedBlackTree with key-only nodes.", - "lineNumber": 17, + "lineNumber": 18, "interface": false }, { - "__docId__": 113, + "__docId__": 109, "kind": "constructor", "name": "constructor", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2076,7 +1956,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#constructor", "access": "public", "description": "Constructs a new empty red-black tree.", - "lineNumber": 23, + "lineNumber": 24, "params": [ { "nullable": null, @@ -2091,7 +1971,7 @@ ] }, { - "__docId__": 114, + "__docId__": 110, "kind": "member", "name": "compare", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2099,7 +1979,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#compare", "access": "public", "description": null, - "lineNumber": 25, + "lineNumber": 27, "type": { "types": [ "*" @@ -2107,7 +1987,7 @@ } }, { - "__docId__": 115, + "__docId__": 111, "kind": "member", "name": "root", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2115,7 +1995,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#root", "access": "public", "description": null, - "lineNumber": 27, + "lineNumber": 29, "type": { "types": [ "*" @@ -2123,7 +2003,7 @@ } }, { - "__docId__": 116, + "__docId__": 112, "kind": "method", "name": "isEmpty", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2133,7 +2013,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#isEmpty", "access": "public", "description": "Tells whether the tree is empty.", - "lineNumber": 35, + "lineNumber": 37, "unknown": [ { "tagName": "@returns", @@ -2151,7 +2031,7 @@ "params": [] }, { - "__docId__": 117, + "__docId__": 113, "kind": "method", "name": "add", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2161,7 +2041,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#add", "access": "public", "description": "Adds a key to the tree.", - "lineNumber": 44, + "lineNumber": 46, "params": [ { "nullable": null, @@ -2177,7 +2057,7 @@ "return": null }, { - "__docId__": 119, + "__docId__": 115, "kind": "method", "name": "_search", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2187,7 +2067,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#_search", "access": "private", "description": "Search for the input key in the tree.\nReturns the first node whose key equals the input key.\nIf no such node exists, returns null.", - "lineNumber": 62, + "lineNumber": 64, "unknown": [ { "tagName": "@returns", @@ -2216,7 +2096,7 @@ } }, { - "__docId__": 120, + "__docId__": 116, "kind": "method", "name": "get", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2226,7 +2106,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#get", "access": "public", "description": "Search for the input key in the tree. Returns the first node key found\nin this way (with {@link RedBlackTree#_search}. If no such key exists\nin the tree, returns null.", - "lineNumber": 75, + "lineNumber": 77, "unknown": [ { "tagName": "@returns", @@ -2255,7 +2135,7 @@ } }, { - "__docId__": 121, + "__docId__": 117, "kind": "method", "name": "has", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2265,11 +2145,11 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#has", "access": "public", "description": "Returns true if and only if the tree contains the input\nkey.", - "lineNumber": 87, + "lineNumber": 89, "unknown": [ { "tagName": "@returns", - "tagValue": "{Boolean}" + "tagValue": "{boolean}" } ], "params": [ @@ -2287,14 +2167,14 @@ "return": { "nullable": null, "types": [ - "Boolean" + "boolean" ], "spread": false, "description": "" } }, { - "__docId__": 122, + "__docId__": 118, "kind": "method", "name": "_delete", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2304,7 +2184,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#_delete", "access": "private", "description": "Deletes the input node from the tree.", - "lineNumber": 96, + "lineNumber": 98, "params": [ { "nullable": null, @@ -2320,7 +2200,7 @@ "return": null }, { - "__docId__": 124, + "__docId__": 120, "kind": "method", "name": "remove", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2330,11 +2210,11 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#remove", "access": "public", "description": "Search for the first node of the tree whose key equals the input key\n(with {@link RedBlackTree#_search}), then delete that node\n(with {@link RedBlackTree#_delete}). If such a node is found and deleted\nthen return true. Return false otherwise.", - "lineNumber": 132, + "lineNumber": 136, "unknown": [ { "tagName": "@returns", - "tagValue": "{Boolean} - Whether the key existed in the tree before removal." + "tagValue": "{boolean} - Whether the key existed in the tree before removal." } ], "params": [ @@ -2352,14 +2232,14 @@ "return": { "nullable": null, "types": [ - "Boolean" + "boolean" ], "spread": false, "description": "Whether the key existed in the tree before removal." } }, { - "__docId__": 125, + "__docId__": 121, "kind": "method", "name": "range", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2369,7 +2249,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#range", "access": "public", "description": "Returns an in order iterator over the keys of the tree that lie in the\ninterval [left, right[.", - "lineNumber": 147, + "lineNumber": 151, "unknown": [ { "tagName": "@returns", @@ -2408,7 +2288,7 @@ } }, { - "__docId__": 126, + "__docId__": 122, "kind": "method", "name": "items", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2418,7 +2298,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#items", "access": "public", "description": "Returns an in order iterator over the keys of the tree.", - "lineNumber": 157, + "lineNumber": 161, "unknown": [ { "tagName": "@returns", @@ -2436,7 +2316,7 @@ "params": [] }, { - "__docId__": 127, + "__docId__": 123, "kind": "method", "name": "[Symbol.iterator]", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2446,7 +2326,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "access": "public", "description": "Same as {@link RedBlackTree#items}.", - "lineNumber": 164, + "lineNumber": 168, "params": [], "return": { "types": [ @@ -2455,7 +2335,7 @@ } }, { - "__docId__": 128, + "__docId__": 124, "kind": "method", "name": "empty", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2465,7 +2345,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree.empty", "access": "public", "description": "Constructs an empty red-black tree.", - "lineNumber": 174, + "lineNumber": 178, "unknown": [ { "tagName": "@returns", @@ -2494,7 +2374,7 @@ } }, { - "__docId__": 129, + "__docId__": 125, "kind": "method", "name": "from", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2504,7 +2384,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree.from", "access": "public", "description": "Constructs a red-black tree from an input iterable.", - "lineNumber": 185, + "lineNumber": 189, "unknown": [ { "tagName": "@returns", @@ -2552,7 +2432,7 @@ }, { "kind": "packageJSON", - "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"7.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"esmodule\": \"dist/index.modern.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"c8 --all --src src --reporter=lcov npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.14\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.14\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.6.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"5.2.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"test\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ],\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"development\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"production\": {\n \"plugins\": [\n \"babel-plugin-unassert\",\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", + "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"8.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"esmodule\": \"dist/index.modern.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.14\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.14\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.7.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"6.0.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ]\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"debug\",\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"test\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ]\n },\n \"cover\": {\n \"sourceMaps\": \"inline\",\n \"presets\": [\n \"babel-preset-power-assert\"\n ]\n },\n \"development\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"production\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"plugins\": [\n \"babel-plugin-unassert\"\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/package.json", "name": "package.json", "static": true, diff --git a/script/search_index.js b/script/search_index.js index acd5c96..b8b8af5 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -5,12 +5,6 @@ window.esdocSearchIndex = [ "BLACK @aureooms/js-red-black-tree/src/color/BLACK.js", "variable" ], - [ - "@aureooms/js-red-black-tree/src/types/leaf.js~leaf", - "function/index.html#static-function-Leaf", - "Leaf @aureooms/js-red-black-tree/src/types/Leaf.js", - "function" - ], [ "@aureooms/js-red-black-tree/src/types/node.js~node", "function/index.html#static-function-Node", @@ -35,6 +29,12 @@ window.esdocSearchIndex = [ "_debug @aureooms/js-red-black-tree/src/debug/_debug.js", "function" ], + [ + "@aureooms/js-red-black-tree/src/deletion/delete_case0.js~delete_case0", + "function/index.html#static-function-delete_case0", + "delete_case0 @aureooms/js-red-black-tree/src/deletion/delete_case0.js", + "function" + ], [ "@aureooms/js-red-black-tree/src/deletion/delete_case1.js~delete_case1", "function/index.html#static-function-delete_case1", @@ -47,18 +47,6 @@ window.esdocSearchIndex = [ "delete_case2 @aureooms/js-red-black-tree/src/deletion/delete_case2.js", "function" ], - [ - "@aureooms/js-red-black-tree/src/deletion/delete_case3.js~delete_case3", - "function/index.html#static-function-delete_case3", - "delete_case3 @aureooms/js-red-black-tree/src/deletion/delete_case3.js", - "function" - ], - [ - "@aureooms/js-red-black-tree/src/deletion/delete_case4.js~delete_case4", - "function/index.html#static-function-delete_case4", - "delete_case4 @aureooms/js-red-black-tree/src/deletion/delete_case4.js", - "function" - ], [ "@aureooms/js-red-black-tree/src/deletion/delete_case5.js~delete_case5", "function/index.html#static-function-delete_case5", @@ -66,9 +54,9 @@ window.esdocSearchIndex = [ "function" ], [ - "@aureooms/js-red-black-tree/src/deletion/delete_case6.js~delete_case6", - "function/index.html#static-function-delete_case6", - "delete_case6 @aureooms/js-red-black-tree/src/deletion/delete_case6.js", + "@aureooms/js-red-black-tree/src/deletion/delete_no_child.js~delete_no_child", + "function/index.html#static-function-delete_no_child", + "delete_no_child @aureooms/js-red-black-tree/src/deletion/delete_no_child.js", "function" ], [ @@ -107,6 +95,12 @@ window.esdocSearchIndex = [ "insert @aureooms/js-red-black-tree/src/insertion/insert.js", "function" ], + [ + "@aureooms/js-red-black-tree/src/insertion/insert_case0.js~insert_case0", + "function/index.html#static-function-insert_case0", + "insert_case0 @aureooms/js-red-black-tree/src/insertion/insert_case0.js", + "function" + ], [ "@aureooms/js-red-black-tree/src/insertion/insert_case1.js~insert_case1", "function/index.html#static-function-insert_case1", @@ -131,18 +125,18 @@ window.esdocSearchIndex = [ "insert_case4 @aureooms/js-red-black-tree/src/insertion/insert_case4.js", "function" ], - [ - "@aureooms/js-red-black-tree/src/insertion/insert_case5.js~insert_case5", - "function/index.html#static-function-insert_case5", - "insert_case5 @aureooms/js-red-black-tree/src/insertion/insert_case5.js", - "function" - ], [ "@aureooms/js-red-black-tree/src/family/predecessor.js~predecessor", "function/index.html#static-function-predecessor", "predecessor @aureooms/js-red-black-tree/src/family/predecessor.js", "function" ], + [ + "@aureooms/js-red-black-tree/src/deletion/prune.js~prune", + "function/index.html#static-function-prune", + "prune @aureooms/js-red-black-tree/src/deletion/prune.js", + "function" + ], [ "@aureooms/js-red-black-tree/src/traversal/rangetraversal.js~rangetraversal", "function/index.html#static-function-rangetraversal", @@ -497,6 +491,12 @@ window.esdocSearchIndex = [ "src/debug/_debug.js", "file" ], + [ + "src/deletion/delete_case0.js", + "file/src/deletion/delete_case0.js.html", + "src/deletion/delete_case0.js", + "file" + ], [ "src/deletion/delete_case1.js", "file/src/deletion/delete_case1.js.html", @@ -509,18 +509,6 @@ window.esdocSearchIndex = [ "src/deletion/delete_case2.js", "file" ], - [ - "src/deletion/delete_case3.js", - "file/src/deletion/delete_case3.js.html", - "src/deletion/delete_case3.js", - "file" - ], - [ - "src/deletion/delete_case4.js", - "file/src/deletion/delete_case4.js.html", - "src/deletion/delete_case4.js", - "file" - ], [ "src/deletion/delete_case5.js", "file/src/deletion/delete_case5.js.html", @@ -528,9 +516,9 @@ window.esdocSearchIndex = [ "file" ], [ - "src/deletion/delete_case6.js", - "file/src/deletion/delete_case6.js.html", - "src/deletion/delete_case6.js", + "src/deletion/delete_no_child.js", + "file/src/deletion/delete_no_child.js.html", + "src/deletion/delete_no_child.js", "file" ], [ @@ -539,6 +527,12 @@ window.esdocSearchIndex = [ "src/deletion/delete_one_child.js", "file" ], + [ + "src/deletion/prune.js", + "file/src/deletion/prune.js.html", + "src/deletion/prune.js", + "file" + ], [ "src/deletion/replace_node.js", "file/src/deletion/replace_node.js.html", @@ -581,6 +575,12 @@ window.esdocSearchIndex = [ "src/insertion/insert.js", "file" ], + [ + "src/insertion/insert_case0.js", + "file/src/insertion/insert_case0.js.html", + "src/insertion/insert_case0.js", + "file" + ], [ "src/insertion/insert_case1.js", "file/src/insertion/insert_case1.js.html", @@ -605,12 +605,6 @@ window.esdocSearchIndex = [ "src/insertion/insert_case4.js", "file" ], - [ - "src/insertion/insert_case5.js", - "file/src/insertion/insert_case5.js.html", - "src/insertion/insert_case5.js", - "file" - ], [ "src/rotate/rotate_left.js", "file/src/rotate/rotate_left.js.html", @@ -641,12 +635,6 @@ window.esdocSearchIndex = [ "src/traversal/rangetraversal.js", "file" ], - [ - "src/types/leaf.js", - "file/src/types/Leaf.js.html", - "src/types/Leaf.js", - "file" - ], [ "src/types/node.js", "file/src/types/Node.js.html", diff --git a/source.html b/source.html index ae44f61..20ed42a 100644 --- a/source.html +++ b/source.html @@ -34,37 +34,36 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • -

    Source 48/48

    +

    Source 45/45

    @@ -85,7 +84,7 @@ - + @@ -93,7 +92,7 @@ - + @@ -101,7 +100,7 @@ - + @@ -109,79 +108,79 @@ - + - - - + + + - - + + - - - + + + - - + + - + - - - - - - - - - + - - + + - - - + + + - - - + + + - - + + - - - + + + - - - + + + + + + + + + + + - - - + + + @@ -189,39 +188,39 @@ - + - + - + - - - + + + - - - + + + - - - + + + @@ -229,111 +228,103 @@ - + - - + + - + + + + + + + + + - - - + + + - - - + + + - - - - - - - - - + - + - + - + - + - + - - - + + + - + - + - + - - - - - - - - - + - - - - + + + + - - - + + +
    100 %1/1 176 byte 82021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/api/from.js100 %1/1 171 byte 82021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/color/BLACK.js100 %1/1 70 byte 52021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/color/RED.js100 %1/1 64 byte 52021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/debug/_debug.js _debug 100 %1/1901 byte372021-03-03 09:14:35 (UTC)761 byte322021-03-04 16:44:23 (UTC)
    src/deletion/delete_case1.jsdelete_case1src/deletion/delete_case0.jsdelete_case0 100 %1/1692 byte242021-03-03 09:14:35 (UTC)629 byte232021-03-04 16:44:23 (UTC)
    src/deletion/delete_case2.jsdelete_case2src/deletion/delete_case1.jsdelete_case1 100 %1/11455 byte1441 byte 522021-03-03 09:14:35 (UTC)
    src/deletion/delete_case3.jsdelete_case3100 %1/11579 byte552021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/deletion/delete_case4.jsdelete_case4src/deletion/delete_case2.jsdelete_case2 100 %1/11840 byte602021-03-03 09:14:35 (UTC)1558 byte542021-03-04 16:44:23 (UTC)
    src/deletion/delete_case5.js delete_case5 100 %1/12259 byte712021-03-03 09:14:35 (UTC)1898 byte642021-03-04 16:44:23 (UTC)
    src/deletion/delete_case6.jsdelete_case6src/deletion/delete_no_child.jsdelete_no_child 100 %1/11961 byte652021-03-03 09:14:35 (UTC)1153 byte482021-03-04 16:44:23 (UTC)
    src/deletion/delete_one_child.js delete_one_child 100 %1/11555 byte512021-03-03 09:14:35 (UTC)1126 byte402021-03-04 16:44:23 (UTC)
    src/deletion/prune.jsprune100 %1/1379 byte172021-03-04 16:44:23 (UTC)
    src/deletion/replace_node.js replace_node 100 %1/1575 byte232021-03-03 09:14:35 (UTC)531 byte222021-03-04 16:44:23 (UTC)
    src/family/grandparent.js100 %1/1 454 byte 182021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/family/predecessor.js predecessor 100 %1/1507 byte506 byte 232021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/family/sibling.js sibling 100 %1/1499 byte192021-03-03 09:14:35 (UTC)437 byte182021-03-04 16:44:23 (UTC)
    src/family/uncle.js uncle 100 %1/1559 byte222021-03-03 09:14:35 (UTC)454 byte192021-03-04 16:44:23 (UTC)
    src/index.js - -1934 byte312021-03-03 09:14:35 (UTC)2013 byte322021-03-04 16:44:23 (UTC)
    src/insertion/insert.js100 %1/1 1285 byte 502021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/insertion/insert_case1.jsinsert_case1src/insertion/insert_case0.jsinsert_case0 100 %1/1 671 byte 302021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/insertion/insert_case1.jsinsert_case1100 %1/1798 byte362021-03-04 16:44:23 (UTC)
    src/insertion/insert_case2.js insert_case2 100 %1/1759 byte362021-03-03 09:14:35 (UTC)1516 byte522021-03-04 16:44:23 (UTC)
    src/insertion/insert_case3.js insert_case3 100 %1/11433 byte512021-03-03 09:14:35 (UTC)2698 byte922021-03-04 16:44:23 (UTC)
    src/insertion/insert_case4.js insert_case4 100 %1/12659 byte922021-03-03 09:14:35 (UTC)
    src/insertion/insert_case5.jsinsert_case5100 %1/12063 byte2141 byte 702021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/rotate/rotate_left.js rotate_left 100 %1/1777 byte825 byte 412021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/rotate/rotate_right.js rotate_right 100 %1/1788 byte836 byte 412021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/search/search.js search 100 %1/1652 byte322021-03-03 09:14:35 (UTC)594 byte292021-03-04 16:44:23 (UTC)
    src/traversal/inordertraversal.js inordertraversal 100 %1/1876 byte874 byte 302021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/traversal/rangetraversal.js rangetraversal 100 %1/11463 byte1459 byte 432021-03-03 09:14:35 (UTC)
    src/types/Leaf.jsLeaf100 %2/2609 byte272021-03-03 09:14:35 (UTC)2021-03-04 16:44:23 (UTC)
    src/types/Node.js Node100 %2/2790 byte312021-03-03 09:14:35 (UTC)100 %1/1524 byte192021-03-04 16:44:23 (UTC)
    src/types/RedBlackTree.js RedBlackTree 100 %16/164957 byte1922021-03-03 09:14:35 (UTC)5065 byte1962021-03-04 16:44:23 (UTC)
    diff --git a/variable/index.html b/variable/index.html index b5c79e4..e60dba1 100644 --- a/variable/index.html +++ b/variable/index.html @@ -34,31 +34,30 @@
  • colorVBLACK
  • VRED
  • debugF_debug
  • -
  • deletionFdelete_case1
  • +
  • deletionFdelete_case0
  • +
  • Fdelete_case1
  • Fdelete_case2
  • -
  • Fdelete_case3
  • -
  • Fdelete_case4
  • Fdelete_case5
  • -
  • Fdelete_case6
  • +
  • Fdelete_no_child
  • Fdelete_one_child
  • +
  • Fprune
  • Freplace_node
  • familyFgrandparent
  • Fpredecessor
  • Fsibling
  • Funcle
  • insertionFinsert
  • +
  • Finsert_case0
  • Finsert_case1
  • Finsert_case2
  • Finsert_case3
  • Finsert_case4
  • -
  • Finsert_case5
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • traversalFinordertraversal
  • Frangetraversal
  • typesCRedBlackTree
  • -
  • FLeaf
  • FNode
  • From 44395419217f788217f1877292825c2eb6811b3c Mon Sep 17 00:00:00 2001 From: aureooms Date: Tue, 6 Apr 2021 08:25:01 +0000 Subject: [PATCH 24/26] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20au?= =?UTF-8?q?reooms/js-red-black-tree@252f052df1334738334ec06660008c01b2f9f8?= =?UTF-8?q?60=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ast/source/deletion/delete_case0.js.json | 1410 +- ast/source/deletion/delete_case1.js.json | 4870 +-- ast/source/deletion/delete_case2.js.json | 3188 +- ast/source/deletion/delete_case5.js.json | 4806 +-- ast/source/deletion/delete_no_child.js.json | 3150 +- ast/source/deletion/delete_one_child.js.json | 2372 +- ast/source/deletion/replace_node.js.json | 592 +- ast/source/index.js.json | 4822 ++- ast/source/insertion/insert_case0.js.json | 2238 +- ast/source/insertion/insert_case1.js.json | 2508 +- ast/source/insertion/insert_case2.js.json | 3706 +- ast/source/insertion/insert_case3.js.json | 4557 +-- ast/source/insertion/insert_case4.js.json | 4902 +-- ast/source/rotate/rotate_left.js.json | 7721 ++--- ast/source/rotate/rotate_right.js.json | 7013 ++-- ast/source/swap/swap_color.js.json | 3245 ++ ast/source/swap/swap_left.js.json | 8837 +++++ ast/source/swap/swap_non_adjacent.js.json | 11779 +++++++ .../traversal/leftOpenRangeTraversal.js.json | 5866 ++++ ast/source/traversal/rangetraversal.js.json | 3446 +- .../traversal/rightOpenRangeTraversal.js.json | 5866 ++++ ast/source/types/RedBlackTree.js.json | 27987 +++++++++++----- .../types/RedBlackTree.js~RedBlackTree.html | 92 +- coverage.json | 29 +- file/src/api/empty.js.html | 5 + file/src/api/from.js.html | 5 + file/src/color/BLACK.js.html | 5 + file/src/color/RED.js.html | 5 + file/src/debug/_debug.js.html | 5 + file/src/deletion/delete_case0.js.html | 8 +- file/src/deletion/delete_case1.js.html | 42 +- file/src/deletion/delete_case2.js.html | 10 +- file/src/deletion/delete_case5.js.html | 21 +- file/src/deletion/delete_no_child.js.html | 24 +- file/src/deletion/delete_one_child.js.html | 15 + file/src/deletion/prune.js.html | 5 + file/src/deletion/replace_node.js.html | 7 +- file/src/family/grandparent.js.html | 5 + file/src/family/predecessor.js.html | 5 + file/src/family/sibling.js.html | 5 + file/src/family/uncle.js.html | 5 + file/src/index.js.html | 10 + file/src/insertion/insert.js.html | 5 + file/src/insertion/insert_case0.js.html | 14 +- file/src/insertion/insert_case1.js.html | 10 +- file/src/insertion/insert_case2.js.html | 12 +- file/src/insertion/insert_case3.js.html | 55 +- file/src/insertion/insert_case4.js.html | 8 + file/src/rotate/rotate_left.js.html | 35 +- file/src/rotate/rotate_right.js.html | 35 +- file/src/search/search.js.html | 5 + file/src/swap/swap_color.js.html | 110 + file/src/swap/swap_left.js.html | 141 + file/src/swap/swap_non_adjacent.js.html | 145 + file/src/traversal/inordertraversal.js.html | 5 + .../traversal/leftOpenRangeTraversal.js.html | 124 + file/src/traversal/rangetraversal.js.html | 11 +- .../traversal/rightOpenRangeTraversal.js.html | 124 + file/src/types/Node.js.html | 5 + file/src/types/RedBlackTree.js.html | 115 +- function/index.html | 845 +- identifiers.html | 199 +- index.html | 5 + index.json | 542 +- script/search_index.js | 72 +- source.html | 171 +- variable/index.html | 5 + 67 files changed, 87470 insertions(+), 40517 deletions(-) create mode 100644 ast/source/swap/swap_color.js.json create mode 100644 ast/source/swap/swap_left.js.json create mode 100644 ast/source/swap/swap_non_adjacent.js.json create mode 100644 ast/source/traversal/leftOpenRangeTraversal.js.json create mode 100644 ast/source/traversal/rightOpenRangeTraversal.js.json create mode 100644 file/src/swap/swap_color.js.html create mode 100644 file/src/swap/swap_left.js.html create mode 100644 file/src/swap/swap_non_adjacent.js.html create mode 100644 file/src/traversal/leftOpenRangeTraversal.js.html create mode 100644 file/src/traversal/rightOpenRangeTraversal.js.html diff --git a/ast/source/deletion/delete_case0.js.json b/ast/source/deletion/delete_case0.js.json index d211781..c2596f5 100644 --- a/ast/source/deletion/delete_case0.js.json +++ b/ast/source/deletion/delete_case0.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 629, + "end": 689, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 25, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 629, + "end": 689, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 24, + "line": 25, "column": 0 } }, @@ -306,16 +306,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 152, - "end": 365, + "end": 417, "loc": { "start": { "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -324,44 +324,44 @@ }, { "type": "Identifier", - "start": 366, - "end": 598, + "start": 418, + "end": 658, "loc": { "start": { - "line": 14, + "line": 15, "column": 0 }, "end": { - "line": 21, + "line": 22, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 372, - "end": 597, + "start": 424, + "end": 657, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 1 } }, "id": { "type": "Identifier", - "start": 372, - "end": 384, + "start": 424, + "end": 436, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "delete_case0" @@ -371,15 +371,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 387, - "end": 597, + "start": 439, + "end": 657, "loc": { "start": { - "line": 14, + "line": 15, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 1 } }, @@ -390,15 +390,15 @@ "params": [ { "type": "Identifier", - "start": 388, - "end": 389, + "start": 440, + "end": 441, "loc": { "start": { - "line": 14, + "line": 15, "column": 22 }, "end": { - "line": 14, + "line": 15, "column": 23 }, "identifierName": "n" @@ -408,58 +408,58 @@ ], "body": { "type": "BlockStatement", - "start": 394, - "end": 597, + "start": 446, + "end": 657, "loc": { "start": { - "line": 14, + "line": 15, "column": 28 }, "end": { - "line": 21, + "line": 22, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 397, - "end": 423, + "start": 449, + "end": 475, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 397, - "end": 422, + "start": 449, + "end": 474, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 26 } }, "callee": { "type": "Identifier", - "start": 397, - "end": 403, + "start": 449, + "end": 455, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 7 }, "identifierName": "assert" @@ -469,29 +469,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 404, - "end": 421, + "start": 456, + "end": 473, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 25 } }, "left": { "type": "Identifier", - "start": 404, - "end": 405, + "start": 456, + "end": 457, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 9 }, "identifierName": "n" @@ -501,15 +501,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 417, - "end": 421, + "start": 469, + "end": 473, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 25 }, "identifierName": "Node" @@ -522,43 +522,43 @@ }, { "type": "ExpressionStatement", - "start": 425, - "end": 452, + "start": 477, + "end": 504, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 425, - "end": 451, + "start": 477, + "end": 503, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 27 } }, "callee": { "type": "Identifier", - "start": 425, - "end": 431, + "start": 477, + "end": 483, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 }, "identifierName": "assert" @@ -568,43 +568,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 432, - "end": 450, + "start": 484, + "end": 502, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 432, - "end": 440, + "start": 484, + "end": 492, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 16 } }, "object": { "type": "Identifier", - "start": 432, - "end": 433, + "start": 484, + "end": 485, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 }, "identifierName": "n" @@ -613,15 +613,15 @@ }, "property": { "type": "Identifier", - "start": 434, - "end": 440, + "start": 486, + "end": 492, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 16 }, "identifierName": "_color" @@ -633,15 +633,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 445, - "end": 450, + "start": 497, + "end": 502, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 26 }, "identifierName": "BLACK" @@ -655,15 +655,15 @@ { "type": "CommentLine", "value": " If n is the root, there is nothing to do:", - "start": 454, - "end": 498, + "start": 506, + "end": 550, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 45 } } @@ -671,15 +671,15 @@ { "type": "CommentLine", "value": " - all paths go through n, and", - "start": 500, - "end": 534, + "start": 552, + "end": 586, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 35 } } @@ -687,15 +687,15 @@ { "type": "CommentLine", "value": " - n is black.", - "start": 536, - "end": 554, + "start": 588, + "end": 606, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 19 } } @@ -703,143 +703,160 @@ ] }, { - "type": "IfStatement", - "start": 556, - "end": 595, + "type": "ReturnStatement", + "start": 608, + "end": 655, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, - "column": 40 + "line": 21, + "column": 48 } }, - "test": { - "type": "BinaryExpression", - "start": 560, - "end": 577, + "argument": { + "type": "ConditionalExpression", + "start": 615, + "end": 654, "loc": { "start": { - "line": 20, - "column": 5 + "line": 21, + "column": 8 }, "end": { - "line": 20, - "column": 22 + "line": 21, + "column": 47 } }, - "left": { - "type": "MemberExpression", - "start": 560, - "end": 568, + "test": { + "type": "BinaryExpression", + "start": 615, + "end": 632, "loc": { "start": { - "line": 20, - "column": 5 + "line": 21, + "column": 8 }, "end": { - "line": 20, - "column": 13 + "line": 21, + "column": 25 } }, - "object": { - "type": "Identifier", - "start": 560, - "end": 561, + "left": { + "type": "MemberExpression", + "start": 615, + "end": 623, "loc": { "start": { - "line": 20, - "column": 5 + "line": 21, + "column": 8 }, "end": { - "line": 20, - "column": 6 + "line": 21, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 615, + "end": 616, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 617, + "end": 623, + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" }, - "name": "n", + "computed": false, "leadingComments": null }, - "property": { - "type": "Identifier", - "start": 562, - "end": 568, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 628, + "end": 632, "loc": { "start": { - "line": 20, - "column": 7 + "line": 21, + "column": 21 }, "end": { - "line": 20, - "column": 13 - }, - "identifierName": "parent" - }, - "name": "parent" + "line": 21, + "column": 25 + } + } }, - "computed": false, "leadingComments": null }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 573, - "end": 577, + "consequent": { + "type": "Identifier", + "start": 635, + "end": 636, "loc": { "start": { - "line": 20, - "column": 18 + "line": 21, + "column": 28 }, "end": { - "line": 20, - "column": 22 - } - } - }, - "leadingComments": null - }, - "consequent": { - "type": "ExpressionStatement", - "start": 579, - "end": 595, - "loc": { - "start": { - "line": 20, - "column": 24 + "line": 21, + "column": 29 + }, + "identifierName": "n" }, - "end": { - "line": 20, - "column": 40 - } + "name": "n" }, - "expression": { + "alternate": { "type": "CallExpression", - "start": 579, - "end": 594, + "start": 639, + "end": 654, "loc": { "start": { - "line": 20, - "column": 24 + "line": 21, + "column": 32 }, "end": { - "line": 20, - "column": 39 + "line": 21, + "column": 47 } }, "callee": { "type": "Identifier", - "start": 579, - "end": 591, + "start": 639, + "end": 651, "loc": { "start": { - "line": 20, - "column": 24 + "line": 21, + "column": 32 }, "end": { - "line": 20, - "column": 36 + "line": 21, + "column": 44 }, "identifierName": "delete_case1" }, @@ -848,38 +865,38 @@ "arguments": [ { "type": "Identifier", - "start": 592, - "end": 593, + "start": 652, + "end": 653, "loc": { "start": { - "line": 20, - "column": 37 + "line": 21, + "column": 45 }, "end": { - "line": 20, - "column": 38 + "line": 21, + "column": 46 }, "identifierName": "n" }, "name": "n" } ] - } + }, + "leadingComments": null }, - "alternate": null, "leadingComments": [ { "type": "CommentLine", "value": " If n is the root, there is nothing to do:", - "start": 454, - "end": 498, + "start": 506, + "end": 550, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 45 } } @@ -887,15 +904,15 @@ { "type": "CommentLine", "value": " - all paths go through n, and", - "start": 500, - "end": 534, + "start": 552, + "end": 586, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 35 } } @@ -903,15 +920,15 @@ { "type": "CommentLine", "value": " - n is black.", - "start": 536, - "end": 554, + "start": 588, + "end": 606, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 19 } } @@ -932,29 +949,29 @@ }, { "type": "Identifier", - "start": 600, - "end": 628, + "start": 660, + "end": 688, "loc": { "start": { - "line": 23, + "line": 24, "column": 0 }, "end": { - "line": 23, + "line": 24, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 615, - "end": 627, + "start": 675, + "end": 687, "loc": { "start": { - "line": 23, + "line": 24, "column": 15 }, "end": { - "line": 23, + "line": 24, "column": 27 }, "identifierName": "delete_case0" @@ -967,58 +984,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 600, - "end": 628, + "start": 660, + "end": 688, "loc": { "start": { - "line": 23, + "line": 24, "column": 0 }, "end": { - "line": 23, + "line": 24, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 366, - "end": 598, + "start": 418, + "end": 658, "loc": { "start": { - "line": 14, + "line": 15, "column": 0 }, "end": { - "line": 21, + "line": 22, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 372, - "end": 597, + "start": 424, + "end": 657, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 1 } }, "id": { "type": "Identifier", - "start": 372, - "end": 384, + "start": 424, + "end": 436, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "delete_case0" @@ -1028,29 +1045,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 387, - "end": 597, + "start": 439, + "end": 657, "loc": { "start": { - "line": 14, + "line": 15, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 1 } }, "id": { "type": "Identifier", - "start": 372, - "end": 384, + "start": 424, + "end": 436, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "delete_case0" @@ -1064,15 +1081,15 @@ "params": [ { "type": "Identifier", - "start": 388, - "end": 389, + "start": 440, + "end": 441, "loc": { "start": { - "line": 14, + "line": 15, "column": 22 }, "end": { - "line": 14, + "line": 15, "column": 23 }, "identifierName": "n" @@ -1082,58 +1099,58 @@ ], "body": { "type": "BlockStatement", - "start": 394, - "end": 597, + "start": 446, + "end": 657, "loc": { "start": { - "line": 14, + "line": 15, "column": 28 }, "end": { - "line": 21, + "line": 22, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 397, - "end": 423, + "start": 449, + "end": 475, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 397, - "end": 422, + "start": 449, + "end": 474, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 26 } }, "callee": { "type": "Identifier", - "start": 397, - "end": 403, + "start": 449, + "end": 455, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 7 }, "identifierName": "assert" @@ -1143,29 +1160,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 404, - "end": 421, + "start": 456, + "end": 473, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 25 } }, "left": { "type": "Identifier", - "start": 404, - "end": 405, + "start": 456, + "end": 457, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 9 }, "identifierName": "n" @@ -1175,15 +1192,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 417, - "end": 421, + "start": 469, + "end": 473, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 25 }, "identifierName": "Node" @@ -1196,43 +1213,43 @@ }, { "type": "ExpressionStatement", - "start": 425, - "end": 452, + "start": 477, + "end": 504, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 425, - "end": 451, + "start": 477, + "end": 503, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 27 } }, "callee": { "type": "Identifier", - "start": 425, - "end": 431, + "start": 477, + "end": 483, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 }, "identifierName": "assert" @@ -1242,43 +1259,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 432, - "end": 450, + "start": 484, + "end": 502, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 432, - "end": 440, + "start": 484, + "end": 492, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 16 } }, "object": { "type": "Identifier", - "start": 432, - "end": 433, + "start": 484, + "end": 485, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 }, "identifierName": "n" @@ -1287,15 +1304,15 @@ }, "property": { "type": "Identifier", - "start": 434, - "end": 440, + "start": 486, + "end": 492, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 16 }, "identifierName": "_color" @@ -1307,15 +1324,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 445, - "end": 450, + "start": 497, + "end": 502, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 26 }, "identifierName": "BLACK" @@ -1329,15 +1346,15 @@ { "type": "CommentLine", "value": " If n is the root, there is nothing to do:", - "start": 454, - "end": 498, + "start": 506, + "end": 550, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 45 } } @@ -1345,15 +1362,15 @@ { "type": "CommentLine", "value": " - all paths go through n, and", - "start": 500, - "end": 534, + "start": 552, + "end": 586, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 35 } } @@ -1361,15 +1378,15 @@ { "type": "CommentLine", "value": " - n is black.", - "start": 536, - "end": 554, + "start": 588, + "end": 606, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 19 } } @@ -1377,143 +1394,160 @@ ] }, { - "type": "IfStatement", - "start": 556, - "end": 595, + "type": "ReturnStatement", + "start": 608, + "end": 655, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, - "column": 40 + "line": 21, + "column": 48 } }, - "test": { - "type": "BinaryExpression", - "start": 560, - "end": 577, + "argument": { + "type": "ConditionalExpression", + "start": 615, + "end": 654, "loc": { "start": { - "line": 20, - "column": 5 + "line": 21, + "column": 8 }, "end": { - "line": 20, - "column": 22 + "line": 21, + "column": 47 } }, - "left": { - "type": "MemberExpression", - "start": 560, - "end": 568, + "test": { + "type": "BinaryExpression", + "start": 615, + "end": 632, "loc": { "start": { - "line": 20, - "column": 5 + "line": 21, + "column": 8 }, "end": { - "line": 20, - "column": 13 + "line": 21, + "column": 25 } }, - "object": { - "type": "Identifier", - "start": 560, - "end": 561, + "left": { + "type": "MemberExpression", + "start": 615, + "end": 623, "loc": { "start": { - "line": 20, - "column": 5 + "line": 21, + "column": 8 }, "end": { - "line": 20, - "column": 6 + "line": 21, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 615, + "end": 616, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n", + "leadingComments": null }, - "name": "n", + "property": { + "type": "Identifier", + "start": 617, + "end": 623, + "loc": { + "start": { + "line": 21, + "column": 10 + }, + "end": { + "line": 21, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, "leadingComments": null }, - "property": { - "type": "Identifier", - "start": 562, - "end": 568, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 628, + "end": 632, "loc": { "start": { - "line": 20, - "column": 7 + "line": 21, + "column": 21 }, "end": { - "line": 20, - "column": 13 - }, - "identifierName": "parent" - }, - "name": "parent" + "line": 21, + "column": 25 + } + } }, - "computed": false, "leadingComments": null }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 573, - "end": 577, + "consequent": { + "type": "Identifier", + "start": 635, + "end": 636, "loc": { "start": { - "line": 20, - "column": 18 + "line": 21, + "column": 28 }, "end": { - "line": 20, - "column": 22 - } - } - }, - "leadingComments": null - }, - "consequent": { - "type": "ExpressionStatement", - "start": 579, - "end": 595, - "loc": { - "start": { - "line": 20, - "column": 24 + "line": 21, + "column": 29 + }, + "identifierName": "n" }, - "end": { - "line": 20, - "column": 40 - } + "name": "n" }, - "expression": { + "alternate": { "type": "CallExpression", - "start": 579, - "end": 594, + "start": 639, + "end": 654, "loc": { "start": { - "line": 20, - "column": 24 + "line": 21, + "column": 32 }, "end": { - "line": 20, - "column": 39 + "line": 21, + "column": 47 } }, "callee": { "type": "Identifier", - "start": 579, - "end": 591, + "start": 639, + "end": 651, "loc": { "start": { - "line": 20, - "column": 24 + "line": 21, + "column": 32 }, "end": { - "line": 20, - "column": 36 + "line": 21, + "column": 44 }, "identifierName": "delete_case1" }, @@ -1522,38 +1556,38 @@ "arguments": [ { "type": "Identifier", - "start": 592, - "end": 593, + "start": 652, + "end": 653, "loc": { "start": { - "line": 20, - "column": 37 + "line": 21, + "column": 45 }, "end": { - "line": 20, - "column": 38 + "line": 21, + "column": 46 }, "identifierName": "n" }, "name": "n" } ] - } - }, - "alternate": null, + }, + "leadingComments": null + }, "leadingComments": [ { "type": "CommentLine", "value": " If n is the root, there is nothing to do:", - "start": 454, - "end": 498, + "start": 506, + "end": 550, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 45 } } @@ -1561,15 +1595,15 @@ { "type": "CommentLine", "value": " - all paths go through n, and", - "start": 500, - "end": 534, + "start": 552, + "end": 586, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 35 } } @@ -1577,15 +1611,15 @@ { "type": "CommentLine", "value": " - n is black.", - "start": 536, - "end": 554, + "start": 588, + "end": 606, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 19 } } @@ -1603,16 +1637,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 152, - "end": 365, + "end": 417, "loc": { "start": { "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -1627,16 +1661,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 152, - "end": 365, + "end": 417, "loc": { "start": { "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -1644,15 +1678,15 @@ { "type": "CommentLine", "value": " If n is the root, there is nothing to do:", - "start": 454, - "end": 498, + "start": 506, + "end": 550, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 45 } } @@ -1660,15 +1694,15 @@ { "type": "CommentLine", "value": " - all paths go through n, and", - "start": 500, - "end": 534, + "start": 552, + "end": 586, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 35 } } @@ -1676,15 +1710,15 @@ { "type": "CommentLine", "value": " - n is black.", - "start": 536, - "end": 554, + "start": 588, + "end": 606, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 19 } } @@ -2225,16 +2259,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 152, - "end": 365, + "end": 417, "loc": { "start": { "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -2254,15 +2288,15 @@ "updateContext": null }, "value": "const", - "start": 366, - "end": 371, + "start": 418, + "end": 423, "loc": { "start": { - "line": 14, + "line": 15, "column": 0 }, "end": { - "line": 14, + "line": 15, "column": 5 } } @@ -2280,15 +2314,15 @@ "binop": null }, "value": "delete_case0", - "start": 372, - "end": 384, + "start": 424, + "end": 436, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 } } @@ -2307,15 +2341,15 @@ "updateContext": null }, "value": "=", - "start": 385, - "end": 386, + "start": 437, + "end": 438, "loc": { "start": { - "line": 14, + "line": 15, "column": 19 }, "end": { - "line": 14, + "line": 15, "column": 20 } } @@ -2332,15 +2366,15 @@ "postfix": false, "binop": null }, - "start": 387, - "end": 388, + "start": 439, + "end": 440, "loc": { "start": { - "line": 14, + "line": 15, "column": 21 }, "end": { - "line": 14, + "line": 15, "column": 22 } } @@ -2358,15 +2392,15 @@ "binop": null }, "value": "n", - "start": 388, - "end": 389, + "start": 440, + "end": 441, "loc": { "start": { - "line": 14, + "line": 15, "column": 22 }, "end": { - "line": 14, + "line": 15, "column": 23 } } @@ -2383,15 +2417,15 @@ "postfix": false, "binop": null }, - "start": 389, - "end": 390, + "start": 441, + "end": 442, "loc": { "start": { - "line": 14, + "line": 15, "column": 23 }, "end": { - "line": 14, + "line": 15, "column": 24 } } @@ -2409,15 +2443,15 @@ "binop": null, "updateContext": null }, - "start": 391, - "end": 393, + "start": 443, + "end": 445, "loc": { "start": { - "line": 14, + "line": 15, "column": 25 }, "end": { - "line": 14, + "line": 15, "column": 27 } } @@ -2434,15 +2468,15 @@ "postfix": false, "binop": null }, - "start": 394, - "end": 395, + "start": 446, + "end": 447, "loc": { "start": { - "line": 14, + "line": 15, "column": 28 }, "end": { - "line": 14, + "line": 15, "column": 29 } } @@ -2460,15 +2494,15 @@ "binop": null }, "value": "assert", - "start": 397, - "end": 403, + "start": 449, + "end": 455, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 7 } } @@ -2485,15 +2519,15 @@ "postfix": false, "binop": null }, - "start": 403, - "end": 404, + "start": 455, + "end": 456, "loc": { "start": { - "line": 15, + "line": 16, "column": 7 }, "end": { - "line": 15, + "line": 16, "column": 8 } } @@ -2511,15 +2545,15 @@ "binop": null }, "value": "n", - "start": 404, - "end": 405, + "start": 456, + "end": 457, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 9 } } @@ -2539,15 +2573,15 @@ "updateContext": null }, "value": "instanceof", - "start": 406, - "end": 416, + "start": 458, + "end": 468, "loc": { "start": { - "line": 15, + "line": 16, "column": 10 }, "end": { - "line": 15, + "line": 16, "column": 20 } } @@ -2565,15 +2599,15 @@ "binop": null }, "value": "Node", - "start": 417, - "end": 421, + "start": 469, + "end": 473, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 25 } } @@ -2590,15 +2624,15 @@ "postfix": false, "binop": null }, - "start": 421, - "end": 422, + "start": 473, + "end": 474, "loc": { "start": { - "line": 15, + "line": 16, "column": 25 }, "end": { - "line": 15, + "line": 16, "column": 26 } } @@ -2616,15 +2650,15 @@ "binop": null, "updateContext": null }, - "start": 422, - "end": 423, + "start": 474, + "end": 475, "loc": { "start": { - "line": 15, + "line": 16, "column": 26 }, "end": { - "line": 15, + "line": 16, "column": 27 } } @@ -2642,15 +2676,15 @@ "binop": null }, "value": "assert", - "start": 425, - "end": 431, + "start": 477, + "end": 483, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 } } @@ -2667,15 +2701,15 @@ "postfix": false, "binop": null }, - "start": 431, - "end": 432, + "start": 483, + "end": 484, "loc": { "start": { - "line": 16, + "line": 17, "column": 7 }, "end": { - "line": 16, + "line": 17, "column": 8 } } @@ -2693,15 +2727,15 @@ "binop": null }, "value": "n", - "start": 432, - "end": 433, + "start": 484, + "end": 485, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 } } @@ -2719,15 +2753,15 @@ "binop": null, "updateContext": null }, - "start": 433, - "end": 434, + "start": 485, + "end": 486, "loc": { "start": { - "line": 16, + "line": 17, "column": 9 }, "end": { - "line": 16, + "line": 17, "column": 10 } } @@ -2745,15 +2779,15 @@ "binop": null }, "value": "_color", - "start": 434, - "end": 440, + "start": 486, + "end": 492, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 16 } } @@ -2772,15 +2806,15 @@ "updateContext": null }, "value": "===", - "start": 441, - "end": 444, + "start": 493, + "end": 496, "loc": { "start": { - "line": 16, + "line": 17, "column": 17 }, "end": { - "line": 16, + "line": 17, "column": 20 } } @@ -2798,15 +2832,15 @@ "binop": null }, "value": "BLACK", - "start": 445, - "end": 450, + "start": 497, + "end": 502, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 26 } } @@ -2823,15 +2857,15 @@ "postfix": false, "binop": null }, - "start": 450, - "end": 451, + "start": 502, + "end": 503, "loc": { "start": { - "line": 16, + "line": 17, "column": 26 }, "end": { - "line": 16, + "line": 17, "column": 27 } } @@ -2849,15 +2883,15 @@ "binop": null, "updateContext": null }, - "start": 451, - "end": 452, + "start": 503, + "end": 504, "loc": { "start": { - "line": 16, + "line": 17, "column": 27 }, "end": { - "line": 16, + "line": 17, "column": 28 } } @@ -2865,15 +2899,15 @@ { "type": "CommentLine", "value": " If n is the root, there is nothing to do:", - "start": 454, - "end": 498, + "start": 506, + "end": 550, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 45 } } @@ -2881,15 +2915,15 @@ { "type": "CommentLine", "value": " - all paths go through n, and", - "start": 500, - "end": 534, + "start": 552, + "end": 586, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 35 } } @@ -2897,24 +2931,24 @@ { "type": "CommentLine", "value": " - n is black.", - "start": 536, - "end": 554, + "start": 588, + "end": 606, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 19 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, + "label": "return", + "keyword": "return", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -2924,24 +2958,24 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 556, - "end": 558, + "value": "return", + "start": 608, + "end": 614, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, - "column": 3 + "line": 21, + "column": 7 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -2950,16 +2984,43 @@ "postfix": false, "binop": null }, - "start": 559, - "end": 560, + "value": "n", + "start": 615, + "end": 616, + "loc": { + "start": { + "line": 21, + "column": 8 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 616, + "end": 617, "loc": { "start": { - "line": 20, - "column": 4 + "line": 21, + "column": 9 }, "end": { - "line": 20, - "column": 5 + "line": 21, + "column": 10 } } }, @@ -2975,49 +3036,51 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 560, - "end": 561, + "value": "parent", + "start": 617, + "end": 623, "loc": { "start": { - "line": 20, - "column": 5 + "line": 21, + "column": 10 }, "end": { - "line": 20, - "column": 6 + "line": 21, + "column": 16 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 561, - "end": 562, + "value": "===", + "start": 624, + "end": 627, "loc": { "start": { - "line": 20, - "column": 6 + "line": 21, + "column": 17 }, "end": { - "line": 20, - "column": 7 + "line": 21, + "column": 20 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3025,25 +3088,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "parent", - "start": 562, - "end": 568, + "value": "null", + "start": 628, + "end": 632, "loc": { "start": { - "line": 20, - "column": 7 + "line": 21, + "column": 21 }, "end": { - "line": 20, - "column": 13 + "line": 21, + "column": 25 } } }, { "type": { - "label": "==/!=", + "label": "?", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -3051,27 +3115,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "!==", - "start": 569, - "end": 572, + "start": 633, + "end": 634, "loc": { "start": { - "line": 20, - "column": 14 + "line": 21, + "column": 26 }, "end": { - "line": 20, - "column": 17 + "line": 21, + "column": 27 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -3079,45 +3141,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 573, - "end": 577, + "value": "n", + "start": 635, + "end": 636, "loc": { "start": { - "line": 20, - "column": 18 + "line": 21, + "column": 28 }, "end": { - "line": 20, - "column": 22 + "line": 21, + "column": 29 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ":", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 577, - "end": 578, + "start": 637, + "end": 638, "loc": { "start": { - "line": 20, - "column": 22 + "line": 21, + "column": 30 }, "end": { - "line": 20, - "column": 23 + "line": 21, + "column": 31 } } }, @@ -3134,16 +3196,16 @@ "binop": null }, "value": "delete_case1", - "start": 579, - "end": 591, + "start": 639, + "end": 651, "loc": { "start": { - "line": 20, - "column": 24 + "line": 21, + "column": 32 }, "end": { - "line": 20, - "column": 36 + "line": 21, + "column": 44 } } }, @@ -3159,16 +3221,16 @@ "postfix": false, "binop": null }, - "start": 591, - "end": 592, + "start": 651, + "end": 652, "loc": { "start": { - "line": 20, - "column": 36 + "line": 21, + "column": 44 }, "end": { - "line": 20, - "column": 37 + "line": 21, + "column": 45 } } }, @@ -3185,16 +3247,16 @@ "binop": null }, "value": "n", - "start": 592, - "end": 593, + "start": 652, + "end": 653, "loc": { "start": { - "line": 20, - "column": 37 + "line": 21, + "column": 45 }, "end": { - "line": 20, - "column": 38 + "line": 21, + "column": 46 } } }, @@ -3210,16 +3272,16 @@ "postfix": false, "binop": null }, - "start": 593, - "end": 594, + "start": 653, + "end": 654, "loc": { "start": { - "line": 20, - "column": 38 + "line": 21, + "column": 46 }, "end": { - "line": 20, - "column": 39 + "line": 21, + "column": 47 } } }, @@ -3236,16 +3298,16 @@ "binop": null, "updateContext": null }, - "start": 594, - "end": 595, + "start": 654, + "end": 655, "loc": { "start": { - "line": 20, - "column": 39 + "line": 21, + "column": 47 }, "end": { - "line": 20, - "column": 40 + "line": 21, + "column": 48 } } }, @@ -3261,15 +3323,15 @@ "postfix": false, "binop": null }, - "start": 596, - "end": 597, + "start": 656, + "end": 657, "loc": { "start": { - "line": 21, + "line": 22, "column": 0 }, "end": { - "line": 21, + "line": 22, "column": 1 } } @@ -3287,15 +3349,15 @@ "binop": null, "updateContext": null }, - "start": 597, - "end": 598, + "start": 657, + "end": 658, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 2 } } @@ -3315,15 +3377,15 @@ "updateContext": null }, "value": "export", - "start": 600, - "end": 606, + "start": 660, + "end": 666, "loc": { "start": { - "line": 23, + "line": 24, "column": 0 }, "end": { - "line": 23, + "line": 24, "column": 6 } } @@ -3343,15 +3405,15 @@ "updateContext": null }, "value": "default", - "start": 607, - "end": 614, + "start": 667, + "end": 674, "loc": { "start": { - "line": 23, + "line": 24, "column": 7 }, "end": { - "line": 23, + "line": 24, "column": 14 } } @@ -3369,15 +3431,15 @@ "binop": null }, "value": "delete_case0", - "start": 615, - "end": 627, + "start": 675, + "end": 687, "loc": { "start": { - "line": 23, + "line": 24, "column": 15 }, "end": { - "line": 23, + "line": 24, "column": 27 } } @@ -3395,15 +3457,15 @@ "binop": null, "updateContext": null }, - "start": 627, - "end": 628, + "start": 687, + "end": 688, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 28 } } @@ -3421,15 +3483,15 @@ "binop": null, "updateContext": null }, - "start": 629, - "end": 629, + "start": 689, + "end": 689, "loc": { "start": { - "line": 24, + "line": 25, "column": 0 }, "end": { - "line": 24, + "line": 25, "column": 0 } } diff --git a/ast/source/deletion/delete_case1.js.json b/ast/source/deletion/delete_case1.js.json index 34925d3..309876e 100644 --- a/ast/source/deletion/delete_case1.js.json +++ b/ast/source/deletion/delete_case1.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1441, + "end": 1489, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 53, + "line": 54, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1441, + "end": 1489, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 53, + "line": 54, "column": 0 } }, @@ -651,16 +651,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 384, - "end": 622, + "end": 674, "loc": { "start": { "line": 12, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 3 } } @@ -669,44 +669,44 @@ }, { "type": "Identifier", - "start": 623, - "end": 1410, + "start": 675, + "end": 1458, "loc": { "start": { - "line": 21, + "line": 22, "column": 0 }, "end": { - "line": 50, + "line": 51, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 629, - "end": 1409, + "start": 681, + "end": 1457, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 50, + "line": 51, "column": 1 } }, "id": { "type": "Identifier", - "start": 629, - "end": 641, + "start": 681, + "end": 693, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 18 }, "identifierName": "delete_case1" @@ -716,15 +716,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 644, - "end": 1409, + "start": 696, + "end": 1457, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 50, + "line": 51, "column": 1 } }, @@ -735,15 +735,15 @@ "params": [ { "type": "Identifier", - "start": 645, - "end": 646, + "start": 697, + "end": 698, "loc": { "start": { - "line": 21, + "line": 22, "column": 22 }, "end": { - "line": 21, + "line": 22, "column": 23 }, "identifierName": "n" @@ -753,58 +753,58 @@ ], "body": { "type": "BlockStatement", - "start": 651, - "end": 1409, + "start": 703, + "end": 1457, "loc": { "start": { - "line": 21, + "line": 22, "column": 28 }, "end": { - "line": 50, + "line": 51, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 654, - "end": 680, + "start": 706, + "end": 732, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 654, - "end": 679, + "start": 706, + "end": 731, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 654, - "end": 660, + "start": 706, + "end": 712, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -814,29 +814,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 661, - "end": 678, + "start": 713, + "end": 730, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 661, - "end": 662, + "start": 713, + "end": 714, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -846,15 +846,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 674, - "end": 678, + "start": 726, + "end": 730, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -867,43 +867,43 @@ }, { "type": "ExpressionStatement", - "start": 682, - "end": 709, + "start": 734, + "end": 761, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 682, - "end": 708, + "start": 734, + "end": 760, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 27 } }, "callee": { "type": "Identifier", - "start": 682, - "end": 688, + "start": 734, + "end": 740, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -913,43 +913,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 689, - "end": 707, + "start": 741, + "end": 759, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 689, - "end": 697, + "start": 741, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 689, - "end": 690, + "start": 741, + "end": 742, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -958,15 +958,15 @@ }, "property": { "type": "Identifier", - "start": 691, - "end": 697, + "start": 743, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 }, "identifierName": "_color" @@ -978,15 +978,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 702, - "end": 707, + "start": 754, + "end": 759, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 26 }, "identifierName": "BLACK" @@ -999,43 +999,43 @@ }, { "type": "ExpressionStatement", - "start": 711, - "end": 737, + "start": 763, + "end": 789, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 711, - "end": 736, + "start": 763, + "end": 788, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 26 } }, "callee": { "type": "Identifier", - "start": 711, - "end": 717, + "start": 763, + "end": 769, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -1045,43 +1045,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 718, - "end": 735, + "start": 770, + "end": 787, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 718, - "end": 726, + "start": 770, + "end": 778, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 16 } }, "object": { "type": "Identifier", - "start": 718, - "end": 719, + "start": 770, + "end": 771, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 }, "identifierName": "n" @@ -1090,15 +1090,15 @@ }, "property": { "type": "Identifier", - "start": 720, - "end": 726, + "start": 772, + "end": 778, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 }, "identifierName": "parent" @@ -1110,15 +1110,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 731, - "end": 735, + "start": 783, + "end": 787, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -1129,44 +1129,44 @@ }, { "type": "VariableDeclaration", - "start": 740, - "end": 761, + "start": 792, + "end": 813, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 746, - "end": 760, + "start": 798, + "end": 812, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 21 } }, "id": { "type": "Identifier", - "start": 746, - "end": 747, + "start": 798, + "end": 799, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 }, "identifierName": "s" @@ -1175,29 +1175,29 @@ }, "init": { "type": "CallExpression", - "start": 750, - "end": 760, + "start": 802, + "end": 812, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 21 } }, "callee": { "type": "Identifier", - "start": 750, - "end": 757, + "start": 802, + "end": 809, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 18 }, "identifierName": "sibling" @@ -1207,15 +1207,15 @@ "arguments": [ { "type": "Identifier", - "start": 758, - "end": 759, + "start": 810, + "end": 811, "loc": { "start": { - "line": 26, + "line": 27, "column": 19 }, "end": { - "line": 26, + "line": 27, "column": 20 }, "identifierName": "n" @@ -1230,43 +1230,43 @@ }, { "type": "ExpressionStatement", - "start": 763, - "end": 789, + "start": 815, + "end": 841, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 763, - "end": 788, + "start": 815, + "end": 840, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 26 } }, "callee": { "type": "Identifier", - "start": 763, - "end": 769, + "start": 815, + "end": 821, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 7 }, "identifierName": "assert" @@ -1276,29 +1276,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 770, - "end": 787, + "start": 822, + "end": 839, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 25 } }, "left": { "type": "Identifier", - "start": 770, - "end": 771, + "start": 822, + "end": 823, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 9 }, "identifierName": "s" @@ -1308,15 +1308,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 783, - "end": 787, + "start": 835, + "end": 839, "loc": { "start": { - "line": 27, + "line": 28, "column": 21 }, "end": { - "line": 27, + "line": 28, "column": 25 }, "identifierName": "Node" @@ -1329,57 +1329,57 @@ }, { "type": "IfStatement", - "start": 792, - "end": 1407, + "start": 844, + "end": 942, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 49, + "line": 33, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 796, - "end": 814, + "start": 848, + "end": 866, "loc": { "start": { - "line": 29, + "line": 30, "column": 5 }, "end": { - "line": 29, + "line": 30, "column": 23 } }, "left": { "type": "MemberExpression", - "start": 796, - "end": 804, + "start": 848, + "end": 856, "loc": { "start": { - "line": 29, + "line": 30, "column": 5 }, "end": { - "line": 29, + "line": 30, "column": 13 } }, "object": { "type": "Identifier", - "start": 796, - "end": 797, + "start": 848, + "end": 849, "loc": { "start": { - "line": 29, + "line": 30, "column": 5 }, "end": { - "line": 29, + "line": 30, "column": 6 }, "identifierName": "s" @@ -1388,15 +1388,15 @@ }, "property": { "type": "Identifier", - "start": 798, - "end": 804, + "start": 850, + "end": 856, "loc": { "start": { - "line": 29, + "line": 30, "column": 7 }, "end": { - "line": 29, + "line": 30, "column": 13 }, "identifierName": "_color" @@ -1408,15 +1408,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 809, - "end": 814, + "start": 861, + "end": 866, "loc": { "start": { - "line": 29, + "line": 30, "column": 18 }, "end": { - "line": 29, + "line": 30, "column": 23 }, "identifierName": "BLACK" @@ -1426,59 +1426,59 @@ }, "consequent": { "type": "BlockStatement", - "start": 816, - "end": 883, + "start": 868, + "end": 942, "loc": { "start": { - "line": 29, + "line": 30, "column": 25 }, "end": { - "line": 32, + "line": 33, "column": 2 } }, "body": [ { - "type": "ExpressionStatement", - "start": 864, - "end": 880, + "type": "ReturnStatement", + "start": 916, + "end": 939, "loc": { "start": { - "line": 31, + "line": 32, "column": 2 }, "end": { - "line": 31, - "column": 18 + "line": 32, + "column": 25 } }, - "expression": { + "argument": { "type": "CallExpression", - "start": 864, - "end": 879, + "start": 923, + "end": 938, "loc": { "start": { - "line": 31, - "column": 2 + "line": 32, + "column": 9 }, "end": { - "line": 31, - "column": 17 + "line": 32, + "column": 24 } }, "callee": { "type": "Identifier", - "start": 864, - "end": 876, + "start": 923, + "end": 935, "loc": { "start": { - "line": 31, - "column": 2 + "line": 32, + "column": 9 }, "end": { - "line": 31, - "column": 14 + "line": 32, + "column": 21 }, "identifierName": "delete_case2" }, @@ -1488,16 +1488,16 @@ "arguments": [ { "type": "Identifier", - "start": 877, - "end": 878, + "start": 936, + "end": 937, "loc": { "start": { - "line": 31, - "column": 15 + "line": 32, + "column": 22 }, "end": { - "line": 31, - "column": 16 + "line": 32, + "column": 23 }, "identifierName": "n" }, @@ -1510,15 +1510,15 @@ { "type": "CommentLine", "value": " If n's sibling is BLACK, go to case 2.", - "start": 820, - "end": 861, + "start": 872, + "end": 913, "loc": { "start": { - "line": 30, + "line": 31, "column": 2 }, "end": { - "line": 30, + "line": 31, "column": 43 } } @@ -1526,671 +1526,706 @@ ] } ], - "directives": [] + "directives": [], + "trailingComments": null }, - "alternate": { - "type": "BlockStatement", - "start": 889, - "end": 1407, + "alternate": null, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Otherwise, prepare for and go to case 3.\n\t *\n\t * B *B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 945, + "end": 1301, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1303, + "end": 1325, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 23 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1303, + "end": 1324, "loc": { "start": { - "line": 32, - "column": 8 + "line": 46, + "column": 1 }, "end": { - "line": 49, - "column": 2 + "line": 46, + "column": 22 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1262, - "end": 1284, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1303, + "end": 1318, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 16 + } + }, + "object": { + "type": "MemberExpression", + "start": 1303, + "end": 1311, "loc": { "start": { - "line": 44, - "column": 2 + "line": 46, + "column": 1 }, "end": { - "line": 44, - "column": 24 + "line": 46, + "column": 9 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1262, - "end": 1283, + "object": { + "type": "Identifier", + "start": 1303, + "end": 1304, "loc": { "start": { - "line": 44, - "column": 2 + "line": 46, + "column": 1 }, "end": { - "line": 44, - "column": 23 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1262, - "end": 1277, - "loc": { - "start": { - "line": 44, - "column": 2 - }, - "end": { - "line": 44, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1262, - "end": 1270, - "loc": { - "start": { - "line": 44, - "column": 2 - }, - "end": { - "line": 44, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1262, - "end": 1263, - "loc": { - "start": { - "line": 44, - "column": 2 - }, - "end": { - "line": 44, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1264, - "end": 1270, - "loc": { - "start": { - "line": 44, - "column": 4 - }, - "end": { - "line": 44, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1271, - "end": 1277, - "loc": { - "start": { - "line": 44, - "column": 11 - }, - "end": { - "line": 44, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 1280, - "end": 1283, - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 23 - }, - "identifierName": "RED" + "line": 46, + "column": 2 }, - "name": "RED" + "identifierName": "n" }, + "name": "n", "leadingComments": null }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t ", - "start": 893, - "end": 1259, - "loc": { - "start": { - "line": 33, - "column": 2 - }, - "end": { - "line": 43, - "column": 5 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1287, - "end": 1304, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 19 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1287, - "end": 1303, + "property": { + "type": "Identifier", + "start": 1305, + "end": 1311, "loc": { "start": { - "line": 45, - "column": 2 + "line": 46, + "column": 3 }, "end": { - "line": 45, - "column": 18 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1287, - "end": 1295, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1287, - "end": 1288, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1289, - "end": 1295, - "loc": { - "start": { - "line": 45, - "column": 4 - }, - "end": { - "line": 45, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" + "line": 46, + "column": 9 }, - "computed": false + "identifierName": "parent" }, - "right": { - "type": "Identifier", - "start": 1298, - "end": 1303, - "loc": { - "start": { - "line": 45, - "column": 13 - }, - "end": { - "line": 45, - "column": 18 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } + "name": "parent" + }, + "computed": false, + "leadingComments": null }, - { - "type": "IfStatement", - "start": 1307, - "end": 1385, + "property": { + "type": "Identifier", + "start": 1312, + "end": 1318, "loc": { "start": { "line": 46, + "column": 10 + }, + "end": { + "line": 46, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 1321, + "end": 1324, + "loc": { + "start": { + "line": 46, + "column": 19 + }, + "end": { + "line": 46, + "column": 22 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Otherwise, prepare for and go to case 3.\n\t *\n\t * B *B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 945, + "end": 1301, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1327, + "end": 1344, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 18 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1327, + "end": 1343, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 17 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1327, + "end": 1335, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1327, + "end": 1328, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, "column": 2 }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1329, + "end": 1335, + "loc": { + "start": { + "line": 47, + "column": 3 + }, "end": { "line": 47, - "column": 30 + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1338, + "end": 1343, + "loc": { + "start": { + "line": 47, + "column": 12 + }, + "end": { + "line": 47, + "column": 17 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1346, + "end": 1423, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 49, + "column": 29 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1350, + "end": 1369, + "loc": { + "start": { + "line": 48, + "column": 5 + }, + "end": { + "line": 48, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 1350, + "end": 1351, + "loc": { + "start": { + "line": 48, + "column": 5 + }, + "end": { + "line": 48, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1356, + "end": 1369, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 24 + } + }, + "object": { + "type": "MemberExpression", + "start": 1356, + "end": 1364, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 19 } }, - "test": { - "type": "BinaryExpression", - "start": 1311, - "end": 1330, + "object": { + "type": "Identifier", + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 46, - "column": 6 + "line": 48, + "column": 11 }, "end": { - "line": 46, - "column": 25 - } - }, - "left": { - "type": "Identifier", - "start": 1311, - "end": 1312, - "loc": { - "start": { - "line": 46, - "column": 6 - }, - "end": { - "line": 46, - "column": 7 - }, - "identifierName": "n" + "line": 48, + "column": 12 }, - "name": "n" + "identifierName": "n" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1317, - "end": 1330, - "loc": { - "start": { - "line": 46, - "column": 12 - }, - "end": { - "line": 46, - "column": 25 - } - }, - "object": { - "type": "MemberExpression", - "start": 1317, - "end": 1325, - "loc": { - "start": { - "line": 46, - "column": 12 - }, - "end": { - "line": 46, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 1317, - "end": 1318, - "loc": { - "start": { - "line": 46, - "column": 12 - }, - "end": { - "line": 46, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1319, - "end": 1325, - "loc": { - "start": { - "line": 46, - "column": 14 - }, - "end": { - "line": 46, - "column": 20 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 1358, + "end": 1364, + "loc": { + "start": { + "line": 48, + "column": 13 }, - "property": { - "type": "Identifier", - "start": 1326, - "end": 1330, - "loc": { - "start": { - "line": 46, - "column": 21 - }, - "end": { - "line": 46, - "column": 25 - }, - "identifierName": "left" - }, - "name": "left" + "end": { + "line": 48, + "column": 19 }, - "computed": false - } + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1365, + "end": 1369, + "loc": { + "start": { + "line": 48, + "column": 20 + }, + "end": { + "line": 48, + "column": 24 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1371, + "end": 1393, + "loc": { + "start": { + "line": 48, + "column": 26 + }, + "end": { + "line": 48, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 1371, + "end": 1392, + "loc": { + "start": { + "line": 48, + "column": 26 + }, + "end": { + "line": 48, + "column": 47 + } + }, + "callee": { + "type": "Identifier", + "start": 1371, + "end": 1382, + "loc": { + "start": { + "line": 48, + "column": 26 + }, + "end": { + "line": 48, + "column": 37 + }, + "identifierName": "rotate_left" }, - "consequent": { - "type": "ExpressionStatement", - "start": 1332, - "end": 1354, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1383, + "end": 1391, "loc": { "start": { - "line": 46, - "column": 27 + "line": 48, + "column": 38 }, "end": { - "line": 46, - "column": 49 + "line": 48, + "column": 46 } }, - "expression": { - "type": "CallExpression", - "start": 1332, - "end": 1353, + "object": { + "type": "Identifier", + "start": 1383, + "end": 1384, "loc": { "start": { - "line": 46, - "column": 27 + "line": 48, + "column": 38 }, "end": { - "line": 46, - "column": 48 - } - }, - "callee": { - "type": "Identifier", - "start": 1332, - "end": 1343, - "loc": { - "start": { - "line": 46, - "column": 27 - }, - "end": { - "line": 46, - "column": 38 - }, - "identifierName": "rotate_left" + "line": 48, + "column": 39 }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1344, - "end": 1352, - "loc": { - "start": { - "line": 46, - "column": 39 - }, - "end": { - "line": 46, - "column": 47 - } - }, - "object": { - "type": "Identifier", - "start": 1344, - "end": 1345, - "loc": { - "start": { - "line": 46, - "column": 39 - }, - "end": { - "line": 46, - "column": 40 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1346, - "end": 1352, - "loc": { - "start": { - "line": 46, - "column": 41 - }, - "end": { - "line": 46, - "column": 47 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } - }, - "alternate": { - "type": "ExpressionStatement", - "start": 1362, - "end": 1385, - "loc": { - "start": { - "line": 47, - "column": 7 + "identifierName": "n" }, - "end": { - "line": 47, - "column": 30 - } + "name": "n" }, - "expression": { - "type": "CallExpression", - "start": 1362, - "end": 1384, + "property": { + "type": "Identifier", + "start": 1385, + "end": 1391, "loc": { "start": { - "line": 47, - "column": 7 + "line": 48, + "column": 40 }, "end": { - "line": 47, - "column": 29 - } - }, - "callee": { - "type": "Identifier", - "start": 1362, - "end": 1374, - "loc": { - "start": { - "line": 47, - "column": 7 - }, - "end": { - "line": 47, - "column": 19 - }, - "identifierName": "rotate_right" + "line": 48, + "column": 46 }, - "name": "rotate_right" + "identifierName": "parent" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1375, - "end": 1383, - "loc": { - "start": { - "line": 47, - "column": 20 - }, - "end": { - "line": 47, - "column": 28 - } - }, - "object": { - "type": "Identifier", - "start": 1375, - "end": 1376, - "loc": { - "start": { - "line": 47, - "column": 20 - }, - "end": { - "line": 47, - "column": 21 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1377, - "end": 1383, - "loc": { - "start": { - "line": 47, - "column": 22 - }, - "end": { - "line": 47, - "column": 28 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } + "name": "parent" + }, + "computed": false } + ] + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1400, + "end": 1423, + "loc": { + "start": { + "line": 49, + "column": 6 }, - { - "type": "ExpressionStatement", - "start": 1388, - "end": 1404, + "end": { + "line": 49, + "column": 29 + } + }, + "expression": { + "type": "CallExpression", + "start": 1400, + "end": 1422, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 28 + } + }, + "callee": { + "type": "Identifier", + "start": 1400, + "end": 1412, "loc": { "start": { - "line": 48, - "column": 2 + "line": 49, + "column": 6 }, "end": { - "line": 48, + "line": 49, "column": 18 - } + }, + "identifierName": "rotate_right" }, - "expression": { - "type": "CallExpression", - "start": 1388, - "end": 1403, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1413, + "end": 1421, "loc": { "start": { - "line": 48, - "column": 2 + "line": 49, + "column": 19 }, "end": { - "line": 48, - "column": 17 + "line": 49, + "column": 27 } }, - "callee": { + "object": { "type": "Identifier", - "start": 1388, - "end": 1400, + "start": 1413, + "end": 1414, "loc": { "start": { - "line": 48, - "column": 2 + "line": 49, + "column": 19 }, "end": { - "line": 48, - "column": 14 + "line": 49, + "column": 20 }, - "identifierName": "delete_case3" + "identifierName": "n" }, - "name": "delete_case3" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 1401, - "end": 1402, - "loc": { - "start": { - "line": 48, - "column": 15 - }, - "end": { - "line": 48, - "column": 16 - }, - "identifierName": "n" + "property": { + "type": "Identifier", + "start": 1415, + "end": 1421, + "loc": { + "start": { + "line": 49, + "column": 21 }, - "name": "n" - } - ] + "end": { + "line": 49, + "column": 27 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } + ] + } + } + }, + { + "type": "ReturnStatement", + "start": 1425, + "end": 1455, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 31 + } + }, + "argument": { + "type": "MemberExpression", + "start": 1432, + "end": 1454, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 50, + "column": 30 } - ], - "directives": [] + }, + "object": { + "type": "CallExpression", + "start": 1432, + "end": 1447, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 50, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1432, + "end": 1444, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 50, + "column": 20 + }, + "identifierName": "delete_case3" + }, + "name": "delete_case3" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1445, + "end": 1446, + "loc": { + "start": { + "line": 50, + "column": 21 + }, + "end": { + "line": 50, + "column": 22 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + }, + "property": { + "type": "Identifier", + "start": 1448, + "end": 1454, + "loc": { + "start": { + "line": 50, + "column": 24 + }, + "end": { + "line": 50, + "column": 30 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } } ], @@ -2207,29 +2242,29 @@ }, { "type": "Identifier", - "start": 1412, - "end": 1440, + "start": 1460, + "end": 1488, "loc": { "start": { - "line": 52, + "line": 53, "column": 0 }, "end": { - "line": 52, + "line": 53, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 1427, - "end": 1439, + "start": 1475, + "end": 1487, "loc": { "start": { - "line": 52, + "line": 53, "column": 15 }, "end": { - "line": 52, + "line": 53, "column": 27 }, "identifierName": "delete_case1" @@ -2242,58 +2277,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1412, - "end": 1440, + "start": 1460, + "end": 1488, "loc": { "start": { - "line": 52, + "line": 53, "column": 0 }, "end": { - "line": 52, + "line": 53, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 623, - "end": 1410, + "start": 675, + "end": 1458, "loc": { "start": { - "line": 21, + "line": 22, "column": 0 }, "end": { - "line": 50, + "line": 51, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 629, - "end": 1409, + "start": 681, + "end": 1457, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 50, + "line": 51, "column": 1 } }, "id": { "type": "Identifier", - "start": 629, - "end": 641, + "start": 681, + "end": 693, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 18 }, "identifierName": "delete_case1" @@ -2303,29 +2338,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 644, - "end": 1409, + "start": 696, + "end": 1457, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 50, + "line": 51, "column": 1 } }, "id": { "type": "Identifier", - "start": 629, - "end": 641, + "start": 681, + "end": 693, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 18 }, "identifierName": "delete_case1" @@ -2339,15 +2374,15 @@ "params": [ { "type": "Identifier", - "start": 645, - "end": 646, + "start": 697, + "end": 698, "loc": { "start": { - "line": 21, + "line": 22, "column": 22 }, "end": { - "line": 21, + "line": 22, "column": 23 }, "identifierName": "n" @@ -2357,58 +2392,58 @@ ], "body": { "type": "BlockStatement", - "start": 651, - "end": 1409, + "start": 703, + "end": 1457, "loc": { "start": { - "line": 21, + "line": 22, "column": 28 }, "end": { - "line": 50, + "line": 51, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 654, - "end": 680, + "start": 706, + "end": 732, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 654, - "end": 679, + "start": 706, + "end": 731, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 654, - "end": 660, + "start": 706, + "end": 712, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -2418,29 +2453,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 661, - "end": 678, + "start": 713, + "end": 730, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 661, - "end": 662, + "start": 713, + "end": 714, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -2450,15 +2485,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 674, - "end": 678, + "start": 726, + "end": 730, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -2471,43 +2506,43 @@ }, { "type": "ExpressionStatement", - "start": 682, - "end": 709, + "start": 734, + "end": 761, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 682, - "end": 708, + "start": 734, + "end": 760, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 27 } }, "callee": { "type": "Identifier", - "start": 682, - "end": 688, + "start": 734, + "end": 740, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -2517,43 +2552,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 689, - "end": 707, + "start": 741, + "end": 759, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 689, - "end": 697, + "start": 741, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 689, - "end": 690, + "start": 741, + "end": 742, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -2562,15 +2597,15 @@ }, "property": { "type": "Identifier", - "start": 691, - "end": 697, + "start": 743, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 }, "identifierName": "_color" @@ -2582,15 +2617,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 702, - "end": 707, + "start": 754, + "end": 759, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 26 }, "identifierName": "BLACK" @@ -2603,43 +2638,43 @@ }, { "type": "ExpressionStatement", - "start": 711, - "end": 737, + "start": 763, + "end": 789, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 711, - "end": 736, + "start": 763, + "end": 788, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 26 } }, "callee": { "type": "Identifier", - "start": 711, - "end": 717, + "start": 763, + "end": 769, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -2649,43 +2684,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 718, - "end": 735, + "start": 770, + "end": 787, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 718, - "end": 726, + "start": 770, + "end": 778, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 16 } }, "object": { "type": "Identifier", - "start": 718, - "end": 719, + "start": 770, + "end": 771, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 }, "identifierName": "n" @@ -2694,15 +2729,15 @@ }, "property": { "type": "Identifier", - "start": 720, - "end": 726, + "start": 772, + "end": 778, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 }, "identifierName": "parent" @@ -2714,15 +2749,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 731, - "end": 735, + "start": 783, + "end": 787, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -2733,44 +2768,44 @@ }, { "type": "VariableDeclaration", - "start": 740, - "end": 761, + "start": 792, + "end": 813, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 746, - "end": 760, + "start": 798, + "end": 812, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 21 } }, "id": { "type": "Identifier", - "start": 746, - "end": 747, + "start": 798, + "end": 799, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 }, "identifierName": "s" @@ -2779,212 +2814,588 @@ }, "init": { "type": "CallExpression", - "start": 750, - "end": 760, + "start": 802, + "end": 812, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 21 } }, "callee": { "type": "Identifier", - "start": 750, - "end": 757, + "start": 802, + "end": 809, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "sibling" + }, + "name": "sibling" + }, + "arguments": [ + { + "type": "Identifier", + "start": 810, + "end": 811, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 815, + "end": 841, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 815, + "end": 840, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 815, + "end": 821, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 822, + "end": 839, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 822, + "end": 823, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 835, + "end": 839, + "loc": { + "start": { + "line": 28, + "column": 21 + }, + "end": { + "line": 28, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 844, + "end": 942, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 33, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 848, + "end": 866, + "loc": { + "start": { + "line": 30, + "column": 5 + }, + "end": { + "line": 30, + "column": 23 + } + }, + "left": { + "type": "MemberExpression", + "start": 848, + "end": 856, + "loc": { + "start": { + "line": 30, + "column": 5 + }, + "end": { + "line": 30, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 848, + "end": 849, + "loc": { + "start": { + "line": 30, + "column": 5 + }, + "end": { + "line": 30, + "column": 6 + }, + "identifierName": "s" + }, + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 850, + "end": 856, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 13 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 861, + "end": 866, + "loc": { + "start": { + "line": 30, + "column": 18 + }, + "end": { + "line": 30, + "column": 23 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + }, + "consequent": { + "type": "BlockStatement", + "start": 868, + "end": 942, + "loc": { + "start": { + "line": 30, + "column": 25 + }, + "end": { + "line": 33, + "column": 2 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 916, + "end": 939, + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 25 + } + }, + "argument": { + "type": "CallExpression", + "start": 923, + "end": 938, "loc": { "start": { - "line": 26, - "column": 11 + "line": 32, + "column": 9 }, "end": { - "line": 26, - "column": 18 - }, - "identifierName": "sibling" + "line": 32, + "column": 24 + } }, - "name": "sibling" - }, - "arguments": [ - { + "callee": { "type": "Identifier", - "start": 758, - "end": 759, + "start": 923, + "end": 935, "loc": { "start": { - "line": 26, - "column": 19 + "line": 32, + "column": 9 }, "end": { - "line": 26, - "column": 20 + "line": 32, + "column": 21 }, - "identifierName": "n" + "identifierName": "delete_case2" }, - "name": "n" + "name": "delete_case2", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 936, + "end": 937, + "loc": { + "start": { + "line": 32, + "column": 22 + }, + "end": { + "line": 32, + "column": 23 + }, + "identifierName": "n" + }, + "name": "n" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If n's sibling is BLACK, go to case 2.", + "start": 872, + "end": 913, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 43 + } + } } ] } + ], + "directives": [], + "trailingComments": null + }, + "alternate": null, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Otherwise, prepare for and go to case 3.\n\t *\n\t * B *B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 945, + "end": 1301, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 + } + } } - ], - "kind": "const" + ] }, { "type": "ExpressionStatement", - "start": 763, - "end": 789, + "start": 1303, + "end": 1325, "loc": { "start": { - "line": 27, + "line": 46, "column": 1 }, "end": { - "line": 27, - "column": 27 + "line": 46, + "column": 23 } }, "expression": { - "type": "CallExpression", - "start": 763, - "end": 788, + "type": "AssignmentExpression", + "start": 1303, + "end": 1324, "loc": { "start": { - "line": 27, + "line": 46, "column": 1 }, "end": { - "line": 27, - "column": 26 + "line": 46, + "column": 22 } }, - "callee": { - "type": "Identifier", - "start": 763, - "end": 769, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1303, + "end": 1318, "loc": { "start": { - "line": 27, + "line": 46, "column": 1 }, "end": { - "line": 27, - "column": 7 - }, - "identifierName": "assert" + "line": 46, + "column": 16 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 770, - "end": 787, + "object": { + "type": "MemberExpression", + "start": 1303, + "end": 1311, "loc": { "start": { - "line": 27, - "column": 8 + "line": 46, + "column": 1 }, "end": { - "line": 27, - "column": 25 + "line": 46, + "column": 9 } }, - "left": { + "object": { "type": "Identifier", - "start": 770, - "end": 771, + "start": 1303, + "end": 1304, "loc": { "start": { - "line": 27, - "column": 8 + "line": 46, + "column": 1 }, "end": { - "line": 27, - "column": 9 + "line": 46, + "column": 2 }, - "identifierName": "s" + "identifierName": "n" }, - "name": "s" + "name": "n", + "leadingComments": null }, - "operator": "instanceof", - "right": { + "property": { "type": "Identifier", - "start": 783, - "end": 787, + "start": 1305, + "end": 1311, "loc": { "start": { - "line": 27, - "column": 21 + "line": 46, + "column": 3 }, "end": { - "line": 27, - "column": 25 + "line": 46, + "column": 9 }, - "identifierName": "Node" + "identifierName": "parent" }, - "name": "Node" + "name": "parent" + }, + "computed": false, + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 1312, + "end": 1318, + "loc": { + "start": { + "line": 46, + "column": 10 + }, + "end": { + "line": 46, + "column": 16 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false, + "leadingComments": null + }, + "right": { + "type": "Identifier", + "start": 1321, + "end": 1324, + "loc": { + "start": { + "line": 46, + "column": 19 + }, + "end": { + "line": 46, + "column": 22 + }, + "identifierName": "RED" + }, + "name": "RED" + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Otherwise, prepare for and go to case 3.\n\t *\n\t * B *B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 945, + "end": 1301, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 45, + "column": 4 } } - ] - } + } + ] }, { - "type": "IfStatement", - "start": 792, - "end": 1407, + "type": "ExpressionStatement", + "start": 1327, + "end": 1344, "loc": { "start": { - "line": 29, + "line": 47, "column": 1 }, "end": { - "line": 49, - "column": 2 + "line": 47, + "column": 18 } }, - "test": { - "type": "BinaryExpression", - "start": 796, - "end": 814, + "expression": { + "type": "AssignmentExpression", + "start": 1327, + "end": 1343, "loc": { "start": { - "line": 29, - "column": 5 + "line": 47, + "column": 1 }, "end": { - "line": 29, - "column": 23 + "line": 47, + "column": 17 } }, + "operator": "=", "left": { "type": "MemberExpression", - "start": 796, - "end": 804, + "start": 1327, + "end": 1335, "loc": { "start": { - "line": 29, - "column": 5 + "line": 47, + "column": 1 }, "end": { - "line": 29, - "column": 13 + "line": 47, + "column": 9 } }, "object": { "type": "Identifier", - "start": 796, - "end": 797, + "start": 1327, + "end": 1328, "loc": { "start": { - "line": 29, - "column": 5 + "line": 47, + "column": 1 }, "end": { - "line": 29, - "column": 6 + "line": 47, + "column": 2 }, "identifierName": "s" }, @@ -2992,809 +3403,468 @@ }, "property": { "type": "Identifier", - "start": 798, - "end": 804, + "start": 1329, + "end": 1335, "loc": { "start": { - "line": 29, - "column": 7 + "line": 47, + "column": 3 }, "end": { - "line": 29, - "column": 13 + "line": 47, + "column": 9 }, "identifierName": "_color" }, - "name": "_color" + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1338, + "end": 1343, + "loc": { + "start": { + "line": 47, + "column": 12 + }, + "end": { + "line": 47, + "column": 17 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "IfStatement", + "start": 1346, + "end": 1423, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 49, + "column": 29 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1350, + "end": 1369, + "loc": { + "start": { + "line": 48, + "column": 5 + }, + "end": { + "line": 48, + "column": 24 + } + }, + "left": { + "type": "Identifier", + "start": 1350, + "end": 1351, + "loc": { + "start": { + "line": 48, + "column": 5 + }, + "end": { + "line": 48, + "column": 6 + }, + "identifierName": "n" }, - "computed": false + "name": "n" }, "operator": "===", "right": { - "type": "Identifier", - "start": 809, - "end": 814, + "type": "MemberExpression", + "start": 1356, + "end": 1369, "loc": { "start": { - "line": 29, - "column": 18 + "line": 48, + "column": 11 }, "end": { - "line": 29, - "column": 23 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - }, - "consequent": { - "type": "BlockStatement", - "start": 816, - "end": 883, - "loc": { - "start": { - "line": 29, - "column": 25 + "line": 48, + "column": 24 + } }, - "end": { - "line": 32, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 864, - "end": 880, + "object": { + "type": "MemberExpression", + "start": 1356, + "end": 1364, "loc": { "start": { - "line": 31, - "column": 2 + "line": 48, + "column": 11 }, "end": { - "line": 31, - "column": 18 + "line": 48, + "column": 19 } }, - "expression": { - "type": "CallExpression", - "start": 864, - "end": 879, + "object": { + "type": "Identifier", + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 31, - "column": 2 + "line": 48, + "column": 11 }, "end": { - "line": 31, - "column": 17 - } - }, - "callee": { - "type": "Identifier", - "start": 864, - "end": 876, - "loc": { - "start": { - "line": 31, - "column": 2 - }, - "end": { - "line": 31, - "column": 14 - }, - "identifierName": "delete_case2" + "line": 48, + "column": 12 }, - "name": "delete_case2", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 877, - "end": 878, - "loc": { - "start": { - "line": 31, - "column": 15 - }, - "end": { - "line": 31, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n's sibling is BLACK, go to case 2.", - "start": 820, - "end": 861, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 30, - "column": 43 - } - } - } - ] - } - ], - "directives": [] - }, - "alternate": { - "type": "BlockStatement", - "start": 889, - "end": 1407, - "loc": { - "start": { - "line": 32, - "column": 8 - }, - "end": { - "line": 49, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1262, - "end": 1284, - "loc": { - "start": { - "line": 44, - "column": 2 + "identifierName": "n" }, - "end": { - "line": 44, - "column": 24 - } + "name": "n" }, - "expression": { - "type": "AssignmentExpression", - "start": 1262, - "end": 1283, + "property": { + "type": "Identifier", + "start": 1358, + "end": 1364, "loc": { "start": { - "line": 44, - "column": 2 + "line": 48, + "column": 13 }, "end": { - "line": 44, - "column": 23 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1262, - "end": 1277, - "loc": { - "start": { - "line": 44, - "column": 2 - }, - "end": { - "line": 44, - "column": 17 - } - }, - "object": { - "type": "MemberExpression", - "start": 1262, - "end": 1270, - "loc": { - "start": { - "line": 44, - "column": 2 - }, - "end": { - "line": 44, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1262, - "end": 1263, - "loc": { - "start": { - "line": 44, - "column": 2 - }, - "end": { - "line": 44, - "column": 3 - }, - "identifierName": "n" - }, - "name": "n", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1264, - "end": 1270, - "loc": { - "start": { - "line": 44, - "column": 4 - }, - "end": { - "line": 44, - "column": 10 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false, - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 1271, - "end": 1277, - "loc": { - "start": { - "line": 44, - "column": 11 - }, - "end": { - "line": 44, - "column": 17 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false, - "leadingComments": null - }, - "right": { - "type": "Identifier", - "start": 1280, - "end": 1283, - "loc": { - "start": { - "line": 44, - "column": 20 - }, - "end": { - "line": 44, - "column": 23 - }, - "identifierName": "RED" + "line": 48, + "column": 19 }, - "name": "RED" + "identifierName": "parent" }, - "leadingComments": null + "name": "parent" }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t ", - "start": 893, - "end": 1259, - "loc": { - "start": { - "line": 33, - "column": 2 - }, - "end": { - "line": 43, - "column": 5 - } - } - } - ] + "computed": false }, - { - "type": "ExpressionStatement", - "start": 1287, - "end": 1304, + "property": { + "type": "Identifier", + "start": 1365, + "end": 1369, "loc": { "start": { - "line": 45, - "column": 2 + "line": 48, + "column": 20 }, "end": { - "line": 45, - "column": 19 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1287, - "end": 1303, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 18 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 1287, - "end": 1295, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 1287, - "end": 1288, - "loc": { - "start": { - "line": 45, - "column": 2 - }, - "end": { - "line": 45, - "column": 3 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1289, - "end": 1295, - "loc": { - "start": { - "line": 45, - "column": 4 - }, - "end": { - "line": 45, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 48, + "column": 24 }, - "right": { - "type": "Identifier", - "start": 1298, - "end": 1303, - "loc": { - "start": { - "line": 45, - "column": 13 - }, - "end": { - "line": 45, - "column": 18 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1371, + "end": 1393, + "loc": { + "start": { + "line": 48, + "column": 26 + }, + "end": { + "line": 48, + "column": 48 + } + }, + "expression": { + "type": "CallExpression", + "start": 1371, + "end": 1392, + "loc": { + "start": { + "line": 48, + "column": 26 + }, + "end": { + "line": 48, + "column": 47 } }, - { - "type": "IfStatement", - "start": 1307, - "end": 1385, + "callee": { + "type": "Identifier", + "start": 1371, + "end": 1382, "loc": { "start": { - "line": 46, - "column": 2 + "line": 48, + "column": 26 + }, + "end": { + "line": 48, + "column": 37 }, - "end": { - "line": 47, - "column": 30 - } + "identifierName": "rotate_left" }, - "test": { - "type": "BinaryExpression", - "start": 1311, - "end": 1330, + "name": "rotate_left" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1383, + "end": 1391, "loc": { "start": { - "line": 46, - "column": 6 + "line": 48, + "column": 38 }, "end": { - "line": 46, - "column": 25 + "line": 48, + "column": 46 } }, - "left": { + "object": { "type": "Identifier", - "start": 1311, - "end": 1312, + "start": 1383, + "end": 1384, "loc": { "start": { - "line": 46, - "column": 6 + "line": 48, + "column": 38 }, "end": { - "line": 46, - "column": 7 + "line": 48, + "column": 39 }, "identifierName": "n" }, "name": "n" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1317, - "end": 1330, + "property": { + "type": "Identifier", + "start": 1385, + "end": 1391, "loc": { "start": { - "line": 46, - "column": 12 + "line": 48, + "column": 40 }, "end": { - "line": 46, - "column": 25 - } - }, - "object": { - "type": "MemberExpression", - "start": 1317, - "end": 1325, - "loc": { - "start": { - "line": 46, - "column": 12 - }, - "end": { - "line": 46, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 1317, - "end": 1318, - "loc": { - "start": { - "line": 46, - "column": 12 - }, - "end": { - "line": 46, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1319, - "end": 1325, - "loc": { - "start": { - "line": 46, - "column": 14 - }, - "end": { - "line": 46, - "column": 20 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1326, - "end": 1330, - "loc": { - "start": { - "line": 46, - "column": 21 - }, - "end": { - "line": 46, - "column": 25 - }, - "identifierName": "left" + "line": 48, + "column": 46 }, - "name": "left" + "identifierName": "parent" }, - "computed": false - } + "name": "parent" + }, + "computed": false + } + ] + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1400, + "end": 1423, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 29 + } + }, + "expression": { + "type": "CallExpression", + "start": 1400, + "end": 1422, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 28 + } + }, + "callee": { + "type": "Identifier", + "start": 1400, + "end": 1412, + "loc": { + "start": { + "line": 49, + "column": 6 + }, + "end": { + "line": 49, + "column": 18 + }, + "identifierName": "rotate_right" }, - "consequent": { - "type": "ExpressionStatement", - "start": 1332, - "end": 1354, + "name": "rotate_right" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1413, + "end": 1421, "loc": { "start": { - "line": 46, - "column": 27 + "line": 49, + "column": 19 }, "end": { - "line": 46, - "column": 49 + "line": 49, + "column": 27 } }, - "expression": { - "type": "CallExpression", - "start": 1332, - "end": 1353, + "object": { + "type": "Identifier", + "start": 1413, + "end": 1414, "loc": { "start": { - "line": 46, - "column": 27 + "line": 49, + "column": 19 }, "end": { - "line": 46, - "column": 48 - } - }, - "callee": { - "type": "Identifier", - "start": 1332, - "end": 1343, - "loc": { - "start": { - "line": 46, - "column": 27 - }, - "end": { - "line": 46, - "column": 38 - }, - "identifierName": "rotate_left" + "line": 49, + "column": 20 }, - "name": "rotate_left" - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1344, - "end": 1352, - "loc": { - "start": { - "line": 46, - "column": 39 - }, - "end": { - "line": 46, - "column": 47 - } - }, - "object": { - "type": "Identifier", - "start": 1344, - "end": 1345, - "loc": { - "start": { - "line": 46, - "column": 39 - }, - "end": { - "line": 46, - "column": 40 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1346, - "end": 1352, - "loc": { - "start": { - "line": 46, - "column": 41 - }, - "end": { - "line": 46, - "column": 47 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } - }, - "alternate": { - "type": "ExpressionStatement", - "start": 1362, - "end": 1385, - "loc": { - "start": { - "line": 47, - "column": 7 + "identifierName": "n" }, - "end": { - "line": 47, - "column": 30 - } + "name": "n" }, - "expression": { - "type": "CallExpression", - "start": 1362, - "end": 1384, + "property": { + "type": "Identifier", + "start": 1415, + "end": 1421, "loc": { "start": { - "line": 47, - "column": 7 + "line": 49, + "column": 21 }, "end": { - "line": 47, - "column": 29 - } - }, - "callee": { - "type": "Identifier", - "start": 1362, - "end": 1374, - "loc": { - "start": { - "line": 47, - "column": 7 - }, - "end": { - "line": 47, - "column": 19 - }, - "identifierName": "rotate_right" + "line": 49, + "column": 27 }, - "name": "rotate_right" + "identifierName": "parent" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1375, - "end": 1383, - "loc": { - "start": { - "line": 47, - "column": 20 - }, - "end": { - "line": 47, - "column": 28 - } - }, - "object": { - "type": "Identifier", - "start": 1375, - "end": 1376, - "loc": { - "start": { - "line": 47, - "column": 20 - }, - "end": { - "line": 47, - "column": 21 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1377, - "end": 1383, - "loc": { - "start": { - "line": 47, - "column": 22 - }, - "end": { - "line": 47, - "column": 28 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } + "name": "parent" + }, + "computed": false } + ] + } + } + }, + { + "type": "ReturnStatement", + "start": 1425, + "end": 1455, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 31 + } + }, + "argument": { + "type": "MemberExpression", + "start": 1432, + "end": 1454, + "loc": { + "start": { + "line": 50, + "column": 8 }, - { - "type": "ExpressionStatement", - "start": 1388, - "end": 1404, + "end": { + "line": 50, + "column": 30 + } + }, + "object": { + "type": "CallExpression", + "start": 1432, + "end": 1447, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 50, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1432, + "end": 1444, "loc": { "start": { - "line": 48, - "column": 2 + "line": 50, + "column": 8 }, "end": { - "line": 48, - "column": 18 - } + "line": 50, + "column": 20 + }, + "identifierName": "delete_case3" }, - "expression": { - "type": "CallExpression", - "start": 1388, - "end": 1403, + "name": "delete_case3" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1445, + "end": 1446, "loc": { "start": { - "line": 48, - "column": 2 + "line": 50, + "column": 21 }, "end": { - "line": 48, - "column": 17 - } - }, - "callee": { - "type": "Identifier", - "start": 1388, - "end": 1400, - "loc": { - "start": { - "line": 48, - "column": 2 - }, - "end": { - "line": 48, - "column": 14 - }, - "identifierName": "delete_case3" + "line": 50, + "column": 22 }, - "name": "delete_case3" + "identifierName": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 1401, - "end": 1402, - "loc": { - "start": { - "line": 48, - "column": 15 - }, - "end": { - "line": 48, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - } - ] + "name": "n" } - } - ], - "directives": [] + ] + }, + "property": { + "type": "Identifier", + "start": 1448, + "end": 1454, + "loc": { + "start": { + "line": 50, + "column": 24 + }, + "end": { + "line": 50, + "column": 30 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } } ], @@ -3808,16 +3878,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 384, - "end": 622, + "end": 674, "loc": { "start": { "line": 12, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 3 } } @@ -3832,16 +3902,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 384, - "end": 622, + "end": 674, "loc": { "start": { "line": 12, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 3 } } @@ -3849,32 +3919,32 @@ { "type": "CommentLine", "value": " If n's sibling is BLACK, go to case 2.", - "start": 820, - "end": 861, + "start": 872, + "end": 913, "loc": { "start": { - "line": 30, + "line": 31, "column": 2 }, "end": { - "line": 30, + "line": 31, "column": 43 } } }, { "type": "CommentBlock", - "value": "*\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t ", - "start": 893, - "end": 1259, + "value": "*\n\t * Otherwise, prepare for and go to case 3.\n\t *\n\t * B *B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 945, + "end": 1301, "loc": { "start": { - "line": 33, - "column": 2 + "line": 35, + "column": 1 }, "end": { - "line": 43, - "column": 5 + "line": 45, + "column": 4 } } } @@ -5079,16 +5149,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 384, - "end": 622, + "end": 674, "loc": { "start": { "line": 12, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 3 } } @@ -5108,15 +5178,15 @@ "updateContext": null }, "value": "const", - "start": 623, - "end": 628, + "start": 675, + "end": 680, "loc": { "start": { - "line": 21, + "line": 22, "column": 0 }, "end": { - "line": 21, + "line": 22, "column": 5 } } @@ -5134,15 +5204,15 @@ "binop": null }, "value": "delete_case1", - "start": 629, - "end": 641, + "start": 681, + "end": 693, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 18 } } @@ -5161,15 +5231,15 @@ "updateContext": null }, "value": "=", - "start": 642, - "end": 643, + "start": 694, + "end": 695, "loc": { "start": { - "line": 21, + "line": 22, "column": 19 }, "end": { - "line": 21, + "line": 22, "column": 20 } } @@ -5186,15 +5256,15 @@ "postfix": false, "binop": null }, - "start": 644, - "end": 645, + "start": 696, + "end": 697, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 22 } } @@ -5212,15 +5282,15 @@ "binop": null }, "value": "n", - "start": 645, - "end": 646, + "start": 697, + "end": 698, "loc": { "start": { - "line": 21, + "line": 22, "column": 22 }, "end": { - "line": 21, + "line": 22, "column": 23 } } @@ -5237,15 +5307,15 @@ "postfix": false, "binop": null }, - "start": 646, - "end": 647, + "start": 698, + "end": 699, "loc": { "start": { - "line": 21, + "line": 22, "column": 23 }, "end": { - "line": 21, + "line": 22, "column": 24 } } @@ -5263,15 +5333,15 @@ "binop": null, "updateContext": null }, - "start": 648, - "end": 650, + "start": 700, + "end": 702, "loc": { "start": { - "line": 21, + "line": 22, "column": 25 }, "end": { - "line": 21, + "line": 22, "column": 27 } } @@ -5288,15 +5358,15 @@ "postfix": false, "binop": null }, - "start": 651, - "end": 652, + "start": 703, + "end": 704, "loc": { "start": { - "line": 21, + "line": 22, "column": 28 }, "end": { - "line": 21, + "line": 22, "column": 29 } } @@ -5314,15 +5384,15 @@ "binop": null }, "value": "assert", - "start": 654, - "end": 660, + "start": 706, + "end": 712, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 } } @@ -5339,15 +5409,15 @@ "postfix": false, "binop": null }, - "start": 660, - "end": 661, + "start": 712, + "end": 713, "loc": { "start": { - "line": 22, + "line": 23, "column": 7 }, "end": { - "line": 22, + "line": 23, "column": 8 } } @@ -5365,15 +5435,15 @@ "binop": null }, "value": "n", - "start": 661, - "end": 662, + "start": 713, + "end": 714, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 } } @@ -5393,15 +5463,15 @@ "updateContext": null }, "value": "instanceof", - "start": 663, - "end": 673, + "start": 715, + "end": 725, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 20 } } @@ -5419,15 +5489,15 @@ "binop": null }, "value": "Node", - "start": 674, - "end": 678, + "start": 726, + "end": 730, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 } } @@ -5444,15 +5514,15 @@ "postfix": false, "binop": null }, - "start": 678, - "end": 679, + "start": 730, + "end": 731, "loc": { "start": { - "line": 22, + "line": 23, "column": 25 }, "end": { - "line": 22, + "line": 23, "column": 26 } } @@ -5470,15 +5540,15 @@ "binop": null, "updateContext": null }, - "start": 679, - "end": 680, + "start": 731, + "end": 732, "loc": { "start": { - "line": 22, + "line": 23, "column": 26 }, "end": { - "line": 22, + "line": 23, "column": 27 } } @@ -5496,15 +5566,15 @@ "binop": null }, "value": "assert", - "start": 682, - "end": 688, + "start": 734, + "end": 740, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 } } @@ -5521,15 +5591,15 @@ "postfix": false, "binop": null }, - "start": 688, - "end": 689, + "start": 740, + "end": 741, "loc": { "start": { - "line": 23, + "line": 24, "column": 7 }, "end": { - "line": 23, + "line": 24, "column": 8 } } @@ -5547,15 +5617,15 @@ "binop": null }, "value": "n", - "start": 689, - "end": 690, + "start": 741, + "end": 742, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 } } @@ -5573,15 +5643,15 @@ "binop": null, "updateContext": null }, - "start": 690, - "end": 691, + "start": 742, + "end": 743, "loc": { "start": { - "line": 23, + "line": 24, "column": 9 }, "end": { - "line": 23, + "line": 24, "column": 10 } } @@ -5599,15 +5669,15 @@ "binop": null }, "value": "_color", - "start": 691, - "end": 697, + "start": 743, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 } } @@ -5626,15 +5696,15 @@ "updateContext": null }, "value": "===", - "start": 698, - "end": 701, + "start": 750, + "end": 753, "loc": { "start": { - "line": 23, + "line": 24, "column": 17 }, "end": { - "line": 23, + "line": 24, "column": 20 } } @@ -5652,15 +5722,15 @@ "binop": null }, "value": "BLACK", - "start": 702, - "end": 707, + "start": 754, + "end": 759, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 26 } } @@ -5677,15 +5747,15 @@ "postfix": false, "binop": null }, - "start": 707, - "end": 708, + "start": 759, + "end": 760, "loc": { "start": { - "line": 23, + "line": 24, "column": 26 }, "end": { - "line": 23, + "line": 24, "column": 27 } } @@ -5703,15 +5773,15 @@ "binop": null, "updateContext": null }, - "start": 708, - "end": 709, + "start": 760, + "end": 761, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 28 } } @@ -5729,15 +5799,15 @@ "binop": null }, "value": "assert", - "start": 711, - "end": 717, + "start": 763, + "end": 769, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 } } @@ -5754,15 +5824,15 @@ "postfix": false, "binop": null }, - "start": 717, - "end": 718, + "start": 769, + "end": 770, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 8 } } @@ -5780,15 +5850,15 @@ "binop": null }, "value": "n", - "start": 718, - "end": 719, + "start": 770, + "end": 771, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 } } @@ -5806,15 +5876,15 @@ "binop": null, "updateContext": null }, - "start": 719, - "end": 720, + "start": 771, + "end": 772, "loc": { "start": { - "line": 24, + "line": 25, "column": 9 }, "end": { - "line": 24, + "line": 25, "column": 10 } } @@ -5832,15 +5902,15 @@ "binop": null }, "value": "parent", - "start": 720, - "end": 726, + "start": 772, + "end": 778, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 } } @@ -5859,15 +5929,15 @@ "updateContext": null }, "value": "!==", - "start": 727, - "end": 730, + "start": 779, + "end": 782, "loc": { "start": { - "line": 24, + "line": 25, "column": 17 }, "end": { - "line": 24, + "line": 25, "column": 20 } } @@ -5887,15 +5957,15 @@ "updateContext": null }, "value": "null", - "start": 731, - "end": 735, + "start": 783, + "end": 787, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -5912,15 +5982,15 @@ "postfix": false, "binop": null }, - "start": 735, - "end": 736, + "start": 787, + "end": 788, "loc": { "start": { - "line": 24, + "line": 25, "column": 25 }, "end": { - "line": 24, + "line": 25, "column": 26 } } @@ -5938,15 +6008,15 @@ "binop": null, "updateContext": null }, - "start": 736, - "end": 737, + "start": 788, + "end": 789, "loc": { "start": { - "line": 24, + "line": 25, "column": 26 }, "end": { - "line": 24, + "line": 25, "column": 27 } } @@ -5966,15 +6036,15 @@ "updateContext": null }, "value": "const", - "start": 740, - "end": 745, + "start": 792, + "end": 797, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 6 } } @@ -5992,15 +6062,15 @@ "binop": null }, "value": "s", - "start": 746, - "end": 747, + "start": 798, + "end": 799, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 } } @@ -6019,15 +6089,15 @@ "updateContext": null }, "value": "=", - "start": 748, - "end": 749, + "start": 800, + "end": 801, "loc": { "start": { - "line": 26, + "line": 27, "column": 9 }, "end": { - "line": 26, + "line": 27, "column": 10 } } @@ -6045,15 +6115,15 @@ "binop": null }, "value": "sibling", - "start": 750, - "end": 757, + "start": 802, + "end": 809, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 18 } } @@ -6070,15 +6140,15 @@ "postfix": false, "binop": null }, - "start": 757, - "end": 758, + "start": 809, + "end": 810, "loc": { "start": { - "line": 26, + "line": 27, "column": 18 }, "end": { - "line": 26, + "line": 27, "column": 19 } } @@ -6096,15 +6166,15 @@ "binop": null }, "value": "n", - "start": 758, - "end": 759, + "start": 810, + "end": 811, "loc": { "start": { - "line": 26, + "line": 27, "column": 19 }, "end": { - "line": 26, + "line": 27, "column": 20 } } @@ -6121,15 +6191,15 @@ "postfix": false, "binop": null }, - "start": 759, - "end": 760, + "start": 811, + "end": 812, "loc": { "start": { - "line": 26, + "line": 27, "column": 20 }, "end": { - "line": 26, + "line": 27, "column": 21 } } @@ -6147,15 +6217,15 @@ "binop": null, "updateContext": null }, - "start": 760, - "end": 761, + "start": 812, + "end": 813, "loc": { "start": { - "line": 26, + "line": 27, "column": 21 }, "end": { - "line": 26, + "line": 27, "column": 22 } } @@ -6173,15 +6243,15 @@ "binop": null }, "value": "assert", - "start": 763, - "end": 769, + "start": 815, + "end": 821, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 7 } } @@ -6198,15 +6268,15 @@ "postfix": false, "binop": null }, - "start": 769, - "end": 770, + "start": 821, + "end": 822, "loc": { "start": { - "line": 27, + "line": 28, "column": 7 }, "end": { - "line": 27, + "line": 28, "column": 8 } } @@ -6224,15 +6294,15 @@ "binop": null }, "value": "s", - "start": 770, - "end": 771, + "start": 822, + "end": 823, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 9 } } @@ -6252,15 +6322,15 @@ "updateContext": null }, "value": "instanceof", - "start": 772, - "end": 782, + "start": 824, + "end": 834, "loc": { "start": { - "line": 27, + "line": 28, "column": 10 }, "end": { - "line": 27, + "line": 28, "column": 20 } } @@ -6278,15 +6348,15 @@ "binop": null }, "value": "Node", - "start": 783, - "end": 787, + "start": 835, + "end": 839, "loc": { "start": { - "line": 27, + "line": 28, "column": 21 }, "end": { - "line": 27, + "line": 28, "column": 25 } } @@ -6303,15 +6373,15 @@ "postfix": false, "binop": null }, - "start": 787, - "end": 788, + "start": 839, + "end": 840, "loc": { "start": { - "line": 27, + "line": 28, "column": 25 }, "end": { - "line": 27, + "line": 28, "column": 26 } } @@ -6329,15 +6399,15 @@ "binop": null, "updateContext": null }, - "start": 788, - "end": 789, + "start": 840, + "end": 841, "loc": { "start": { - "line": 27, + "line": 28, "column": 26 }, "end": { - "line": 27, + "line": 28, "column": 27 } } @@ -6357,15 +6427,15 @@ "updateContext": null }, "value": "if", - "start": 792, - "end": 794, + "start": 844, + "end": 846, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 30, "column": 3 } } @@ -6382,15 +6452,15 @@ "postfix": false, "binop": null }, - "start": 795, - "end": 796, + "start": 847, + "end": 848, "loc": { "start": { - "line": 29, + "line": 30, "column": 4 }, "end": { - "line": 29, + "line": 30, "column": 5 } } @@ -6408,15 +6478,15 @@ "binop": null }, "value": "s", - "start": 796, - "end": 797, + "start": 848, + "end": 849, "loc": { "start": { - "line": 29, + "line": 30, "column": 5 }, "end": { - "line": 29, + "line": 30, "column": 6 } } @@ -6434,15 +6504,15 @@ "binop": null, "updateContext": null }, - "start": 797, - "end": 798, + "start": 849, + "end": 850, "loc": { "start": { - "line": 29, + "line": 30, "column": 6 }, "end": { - "line": 29, + "line": 30, "column": 7 } } @@ -6460,15 +6530,15 @@ "binop": null }, "value": "_color", - "start": 798, - "end": 804, + "start": 850, + "end": 856, "loc": { "start": { - "line": 29, + "line": 30, "column": 7 }, "end": { - "line": 29, + "line": 30, "column": 13 } } @@ -6487,15 +6557,15 @@ "updateContext": null }, "value": "===", - "start": 805, - "end": 808, + "start": 857, + "end": 860, "loc": { "start": { - "line": 29, + "line": 30, "column": 14 }, "end": { - "line": 29, + "line": 30, "column": 17 } } @@ -6513,15 +6583,15 @@ "binop": null }, "value": "BLACK", - "start": 809, - "end": 814, + "start": 861, + "end": 866, "loc": { "start": { - "line": 29, + "line": 30, "column": 18 }, "end": { - "line": 29, + "line": 30, "column": 23 } } @@ -6538,15 +6608,15 @@ "postfix": false, "binop": null }, - "start": 814, - "end": 815, + "start": 866, + "end": 867, "loc": { "start": { - "line": 29, + "line": 30, "column": 23 }, "end": { - "line": 29, + "line": 30, "column": 24 } } @@ -6563,15 +6633,15 @@ "postfix": false, "binop": null }, - "start": 816, - "end": 817, + "start": 868, + "end": 869, "loc": { "start": { - "line": 29, + "line": 30, "column": 25 }, "end": { - "line": 29, + "line": 30, "column": 26 } } @@ -6579,34 +6649,8 @@ { "type": "CommentLine", "value": " If n's sibling is BLACK, go to case 2.", - "start": 820, - "end": 861, - "loc": { - "start": { - "line": 30, - "column": 2 - }, - "end": { - "line": 30, - "column": 43 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_case2", - "start": 864, - "end": 876, + "start": 872, + "end": 913, "loc": { "start": { "line": 31, @@ -6614,32 +6658,35 @@ }, "end": { "line": 31, - "column": 14 + "column": 43 } } }, { "type": { - "label": "(", + "label": "return", + "keyword": "return", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 876, - "end": 877, + "value": "return", + "start": 916, + "end": 922, "loc": { "start": { - "line": 31, - "column": 14 + "line": 32, + "column": 2 }, "end": { - "line": 31, - "column": 15 + "line": 32, + "column": 8 } } }, @@ -6655,25 +6702,25 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 877, - "end": 878, + "value": "delete_case2", + "start": 923, + "end": 935, "loc": { "start": { - "line": 31, - "column": 15 + "line": 32, + "column": 9 }, "end": { - "line": 31, - "column": 16 + "line": 32, + "column": 21 } } }, { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6681,48 +6728,48 @@ "postfix": false, "binop": null }, - "start": 878, - "end": 879, + "start": 935, + "end": 936, "loc": { "start": { - "line": 31, - "column": 16 + "line": 32, + "column": 21 }, "end": { - "line": 31, - "column": 17 + "line": 32, + "column": 22 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 879, - "end": 880, + "value": "n", + "start": 936, + "end": 937, "loc": { "start": { - "line": 31, - "column": 17 + "line": 32, + "column": 22 }, "end": { - "line": 31, - "column": 18 + "line": 32, + "column": 23 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6732,23 +6779,22 @@ "postfix": false, "binop": null }, - "start": 882, - "end": 883, + "start": 937, + "end": 938, "loc": { "start": { "line": 32, - "column": 1 + "column": 23 }, "end": { "line": 32, - "column": 2 + "column": 24 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -6759,25 +6805,24 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 884, - "end": 888, + "start": 938, + "end": 939, "loc": { "start": { "line": 32, - "column": 3 + "column": 24 }, "end": { "line": 32, - "column": 7 + "column": 25 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6785,32 +6830,32 @@ "postfix": false, "binop": null }, - "start": 889, - "end": 890, + "start": 941, + "end": 942, "loc": { "start": { - "line": 32, - "column": 8 + "line": 33, + "column": 1 }, "end": { - "line": 32, - "column": 9 + "line": 33, + "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t ", - "start": 893, - "end": 1259, + "value": "*\n\t * Otherwise, prepare for and go to case 3.\n\t *\n\t * B *B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t ", + "start": 945, + "end": 1301, "loc": { "start": { - "line": 33, - "column": 2 + "line": 35, + "column": 1 }, "end": { - "line": 43, - "column": 5 + "line": 45, + "column": 4 } } }, @@ -6827,16 +6872,16 @@ "binop": null }, "value": "n", - "start": 1262, - "end": 1263, + "start": 1303, + "end": 1304, "loc": { "start": { - "line": 44, - "column": 2 + "line": 46, + "column": 1 }, "end": { - "line": 44, - "column": 3 + "line": 46, + "column": 2 } } }, @@ -6853,16 +6898,16 @@ "binop": null, "updateContext": null }, - "start": 1263, - "end": 1264, + "start": 1304, + "end": 1305, "loc": { "start": { - "line": 44, - "column": 3 + "line": 46, + "column": 2 }, "end": { - "line": 44, - "column": 4 + "line": 46, + "column": 3 } } }, @@ -6879,16 +6924,16 @@ "binop": null }, "value": "parent", - "start": 1264, - "end": 1270, + "start": 1305, + "end": 1311, "loc": { "start": { - "line": 44, - "column": 4 + "line": 46, + "column": 3 }, "end": { - "line": 44, - "column": 10 + "line": 46, + "column": 9 } } }, @@ -6905,16 +6950,16 @@ "binop": null, "updateContext": null }, - "start": 1270, - "end": 1271, + "start": 1311, + "end": 1312, "loc": { "start": { - "line": 44, - "column": 10 + "line": 46, + "column": 9 }, "end": { - "line": 44, - "column": 11 + "line": 46, + "column": 10 } } }, @@ -6931,16 +6976,16 @@ "binop": null }, "value": "_color", - "start": 1271, - "end": 1277, + "start": 1312, + "end": 1318, "loc": { "start": { - "line": 44, - "column": 11 + "line": 46, + "column": 10 }, "end": { - "line": 44, - "column": 17 + "line": 46, + "column": 16 } } }, @@ -6958,16 +7003,16 @@ "updateContext": null }, "value": "=", - "start": 1278, - "end": 1279, + "start": 1319, + "end": 1320, "loc": { "start": { - "line": 44, - "column": 18 + "line": 46, + "column": 17 }, "end": { - "line": 44, - "column": 19 + "line": 46, + "column": 18 } } }, @@ -6984,16 +7029,16 @@ "binop": null }, "value": "RED", - "start": 1280, - "end": 1283, + "start": 1321, + "end": 1324, "loc": { "start": { - "line": 44, - "column": 20 + "line": 46, + "column": 19 }, "end": { - "line": 44, - "column": 23 + "line": 46, + "column": 22 } } }, @@ -7010,16 +7055,16 @@ "binop": null, "updateContext": null }, - "start": 1283, - "end": 1284, + "start": 1324, + "end": 1325, "loc": { "start": { - "line": 44, - "column": 23 + "line": 46, + "column": 22 }, "end": { - "line": 44, - "column": 24 + "line": 46, + "column": 23 } } }, @@ -7036,16 +7081,16 @@ "binop": null }, "value": "s", - "start": 1287, - "end": 1288, + "start": 1327, + "end": 1328, "loc": { "start": { - "line": 45, - "column": 2 + "line": 47, + "column": 1 }, "end": { - "line": 45, - "column": 3 + "line": 47, + "column": 2 } } }, @@ -7062,16 +7107,16 @@ "binop": null, "updateContext": null }, - "start": 1288, - "end": 1289, + "start": 1328, + "end": 1329, "loc": { "start": { - "line": 45, - "column": 3 + "line": 47, + "column": 2 }, "end": { - "line": 45, - "column": 4 + "line": 47, + "column": 3 } } }, @@ -7088,16 +7133,16 @@ "binop": null }, "value": "_color", - "start": 1289, - "end": 1295, + "start": 1329, + "end": 1335, "loc": { "start": { - "line": 45, - "column": 4 + "line": 47, + "column": 3 }, "end": { - "line": 45, - "column": 10 + "line": 47, + "column": 9 } } }, @@ -7115,16 +7160,16 @@ "updateContext": null }, "value": "=", - "start": 1296, - "end": 1297, + "start": 1336, + "end": 1337, "loc": { "start": { - "line": 45, - "column": 11 + "line": 47, + "column": 10 }, "end": { - "line": 45, - "column": 12 + "line": 47, + "column": 11 } } }, @@ -7141,16 +7186,16 @@ "binop": null }, "value": "BLACK", - "start": 1298, - "end": 1303, + "start": 1338, + "end": 1343, "loc": { "start": { - "line": 45, - "column": 13 + "line": 47, + "column": 12 }, "end": { - "line": 45, - "column": 18 + "line": 47, + "column": 17 } } }, @@ -7167,16 +7212,16 @@ "binop": null, "updateContext": null }, - "start": 1303, - "end": 1304, + "start": 1343, + "end": 1344, "loc": { "start": { - "line": 45, - "column": 18 + "line": 47, + "column": 17 }, "end": { - "line": 45, - "column": 19 + "line": 47, + "column": 18 } } }, @@ -7195,16 +7240,16 @@ "updateContext": null }, "value": "if", - "start": 1307, - "end": 1309, + "start": 1346, + "end": 1348, "loc": { "start": { - "line": 46, - "column": 2 + "line": 48, + "column": 1 }, "end": { - "line": 46, - "column": 4 + "line": 48, + "column": 3 } } }, @@ -7220,16 +7265,16 @@ "postfix": false, "binop": null }, - "start": 1310, - "end": 1311, + "start": 1349, + "end": 1350, "loc": { "start": { - "line": 46, - "column": 5 + "line": 48, + "column": 4 }, "end": { - "line": 46, - "column": 6 + "line": 48, + "column": 5 } } }, @@ -7246,16 +7291,16 @@ "binop": null }, "value": "n", - "start": 1311, - "end": 1312, + "start": 1350, + "end": 1351, "loc": { "start": { - "line": 46, - "column": 6 + "line": 48, + "column": 5 }, "end": { - "line": 46, - "column": 7 + "line": 48, + "column": 6 } } }, @@ -7273,16 +7318,16 @@ "updateContext": null }, "value": "===", - "start": 1313, - "end": 1316, + "start": 1352, + "end": 1355, "loc": { "start": { - "line": 46, - "column": 8 + "line": 48, + "column": 7 }, "end": { - "line": 46, - "column": 11 + "line": 48, + "column": 10 } } }, @@ -7299,16 +7344,16 @@ "binop": null }, "value": "n", - "start": 1317, - "end": 1318, + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 46, - "column": 12 + "line": 48, + "column": 11 }, "end": { - "line": 46, - "column": 13 + "line": 48, + "column": 12 } } }, @@ -7325,16 +7370,16 @@ "binop": null, "updateContext": null }, - "start": 1318, - "end": 1319, + "start": 1357, + "end": 1358, "loc": { "start": { - "line": 46, - "column": 13 + "line": 48, + "column": 12 }, "end": { - "line": 46, - "column": 14 + "line": 48, + "column": 13 } } }, @@ -7351,16 +7396,16 @@ "binop": null }, "value": "parent", - "start": 1319, - "end": 1325, + "start": 1358, + "end": 1364, "loc": { "start": { - "line": 46, - "column": 14 + "line": 48, + "column": 13 }, "end": { - "line": 46, - "column": 20 + "line": 48, + "column": 19 } } }, @@ -7377,16 +7422,16 @@ "binop": null, "updateContext": null }, - "start": 1325, - "end": 1326, + "start": 1364, + "end": 1365, "loc": { "start": { - "line": 46, - "column": 20 + "line": 48, + "column": 19 }, "end": { - "line": 46, - "column": 21 + "line": 48, + "column": 20 } } }, @@ -7403,16 +7448,16 @@ "binop": null }, "value": "left", - "start": 1326, - "end": 1330, + "start": 1365, + "end": 1369, "loc": { "start": { - "line": 46, - "column": 21 + "line": 48, + "column": 20 }, "end": { - "line": 46, - "column": 25 + "line": 48, + "column": 24 } } }, @@ -7428,16 +7473,16 @@ "postfix": false, "binop": null }, - "start": 1330, - "end": 1331, + "start": 1369, + "end": 1370, "loc": { "start": { - "line": 46, - "column": 25 + "line": 48, + "column": 24 }, "end": { - "line": 46, - "column": 26 + "line": 48, + "column": 25 } } }, @@ -7454,16 +7499,16 @@ "binop": null }, "value": "rotate_left", - "start": 1332, - "end": 1343, + "start": 1371, + "end": 1382, "loc": { "start": { - "line": 46, - "column": 27 + "line": 48, + "column": 26 }, "end": { - "line": 46, - "column": 38 + "line": 48, + "column": 37 } } }, @@ -7479,16 +7524,16 @@ "postfix": false, "binop": null }, - "start": 1343, - "end": 1344, + "start": 1382, + "end": 1383, "loc": { "start": { - "line": 46, - "column": 38 + "line": 48, + "column": 37 }, "end": { - "line": 46, - "column": 39 + "line": 48, + "column": 38 } } }, @@ -7505,16 +7550,16 @@ "binop": null }, "value": "n", - "start": 1344, - "end": 1345, + "start": 1383, + "end": 1384, "loc": { "start": { - "line": 46, - "column": 39 + "line": 48, + "column": 38 }, "end": { - "line": 46, - "column": 40 + "line": 48, + "column": 39 } } }, @@ -7531,16 +7576,16 @@ "binop": null, "updateContext": null }, - "start": 1345, - "end": 1346, + "start": 1384, + "end": 1385, "loc": { "start": { - "line": 46, - "column": 40 + "line": 48, + "column": 39 }, "end": { - "line": 46, - "column": 41 + "line": 48, + "column": 40 } } }, @@ -7557,16 +7602,16 @@ "binop": null }, "value": "parent", - "start": 1346, - "end": 1352, + "start": 1385, + "end": 1391, "loc": { "start": { - "line": 46, - "column": 41 + "line": 48, + "column": 40 }, "end": { - "line": 46, - "column": 47 + "line": 48, + "column": 46 } } }, @@ -7582,16 +7627,16 @@ "postfix": false, "binop": null }, - "start": 1352, - "end": 1353, + "start": 1391, + "end": 1392, "loc": { "start": { - "line": 46, - "column": 47 + "line": 48, + "column": 46 }, "end": { - "line": 46, - "column": 48 + "line": 48, + "column": 47 } } }, @@ -7608,16 +7653,16 @@ "binop": null, "updateContext": null }, - "start": 1353, - "end": 1354, + "start": 1392, + "end": 1393, "loc": { "start": { - "line": 46, - "column": 48 + "line": 48, + "column": 47 }, "end": { - "line": 46, - "column": 49 + "line": 48, + "column": 48 } } }, @@ -7636,16 +7681,16 @@ "updateContext": null }, "value": "else", - "start": 1357, - "end": 1361, + "start": 1395, + "end": 1399, "loc": { "start": { - "line": 47, - "column": 2 + "line": 49, + "column": 1 }, "end": { - "line": 47, - "column": 6 + "line": 49, + "column": 5 } } }, @@ -7662,16 +7707,16 @@ "binop": null }, "value": "rotate_right", - "start": 1362, - "end": 1374, + "start": 1400, + "end": 1412, "loc": { "start": { - "line": 47, - "column": 7 + "line": 49, + "column": 6 }, "end": { - "line": 47, - "column": 19 + "line": 49, + "column": 18 } } }, @@ -7687,16 +7732,16 @@ "postfix": false, "binop": null }, - "start": 1374, - "end": 1375, + "start": 1412, + "end": 1413, "loc": { "start": { - "line": 47, - "column": 19 + "line": 49, + "column": 18 }, "end": { - "line": 47, - "column": 20 + "line": 49, + "column": 19 } } }, @@ -7713,16 +7758,16 @@ "binop": null }, "value": "n", - "start": 1375, - "end": 1376, + "start": 1413, + "end": 1414, "loc": { "start": { - "line": 47, - "column": 20 + "line": 49, + "column": 19 }, "end": { - "line": 47, - "column": 21 + "line": 49, + "column": 20 } } }, @@ -7739,16 +7784,16 @@ "binop": null, "updateContext": null }, - "start": 1376, - "end": 1377, + "start": 1414, + "end": 1415, "loc": { "start": { - "line": 47, - "column": 21 + "line": 49, + "column": 20 }, "end": { - "line": 47, - "column": 22 + "line": 49, + "column": 21 } } }, @@ -7765,16 +7810,16 @@ "binop": null }, "value": "parent", - "start": 1377, - "end": 1383, + "start": 1415, + "end": 1421, "loc": { "start": { - "line": 47, - "column": 22 + "line": 49, + "column": 21 }, "end": { - "line": 47, - "column": 28 + "line": 49, + "column": 27 } } }, @@ -7790,16 +7835,16 @@ "postfix": false, "binop": null }, - "start": 1383, - "end": 1384, + "start": 1421, + "end": 1422, "loc": { "start": { - "line": 47, - "column": 28 + "line": 49, + "column": 27 }, "end": { - "line": 47, - "column": 29 + "line": 49, + "column": 28 } } }, @@ -7816,16 +7861,44 @@ "binop": null, "updateContext": null }, - "start": 1384, - "end": 1385, + "start": 1422, + "end": 1423, "loc": { "start": { - "line": 47, + "line": 49, + "column": 28 + }, + "end": { + "line": 49, "column": 29 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 1425, + "end": 1431, + "loc": { + "start": { + "line": 50, + "column": 1 }, "end": { - "line": 47, - "column": 30 + "line": 50, + "column": 7 } } }, @@ -7842,16 +7915,16 @@ "binop": null }, "value": "delete_case3", - "start": 1388, - "end": 1400, + "start": 1432, + "end": 1444, "loc": { "start": { - "line": 48, - "column": 2 + "line": 50, + "column": 8 }, "end": { - "line": 48, - "column": 14 + "line": 50, + "column": 20 } } }, @@ -7867,16 +7940,16 @@ "postfix": false, "binop": null }, - "start": 1400, - "end": 1401, + "start": 1444, + "end": 1445, "loc": { "start": { - "line": 48, - "column": 14 + "line": 50, + "column": 20 }, "end": { - "line": 48, - "column": 15 + "line": 50, + "column": 21 } } }, @@ -7893,16 +7966,16 @@ "binop": null }, "value": "n", - "start": 1401, - "end": 1402, + "start": 1445, + "end": 1446, "loc": { "start": { - "line": 48, - "column": 15 + "line": 50, + "column": 21 }, "end": { - "line": 48, - "column": 16 + "line": 50, + "column": 22 } } }, @@ -7918,23 +7991,23 @@ "postfix": false, "binop": null }, - "start": 1402, - "end": 1403, + "start": 1446, + "end": 1447, "loc": { "start": { - "line": 48, - "column": 16 + "line": 50, + "column": 22 }, "end": { - "line": 48, - "column": 17 + "line": 50, + "column": 23 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -7944,24 +8017,24 @@ "binop": null, "updateContext": null }, - "start": 1403, - "end": 1404, + "start": 1447, + "end": 1448, "loc": { "start": { - "line": 48, - "column": 17 + "line": 50, + "column": 23 }, "end": { - "line": 48, - "column": 18 + "line": 50, + "column": 24 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7969,16 +8042,43 @@ "postfix": false, "binop": null }, - "start": 1406, - "end": 1407, + "value": "parent", + "start": 1448, + "end": 1454, "loc": { "start": { - "line": 49, - "column": 1 + "line": 50, + "column": 24 }, "end": { - "line": 49, - "column": 2 + "line": 50, + "column": 30 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1454, + "end": 1455, + "loc": { + "start": { + "line": 50, + "column": 30 + }, + "end": { + "line": 50, + "column": 31 } } }, @@ -7994,15 +8094,15 @@ "postfix": false, "binop": null }, - "start": 1408, - "end": 1409, + "start": 1456, + "end": 1457, "loc": { "start": { - "line": 50, + "line": 51, "column": 0 }, "end": { - "line": 50, + "line": 51, "column": 1 } } @@ -8020,15 +8120,15 @@ "binop": null, "updateContext": null }, - "start": 1409, - "end": 1410, + "start": 1457, + "end": 1458, "loc": { "start": { - "line": 50, + "line": 51, "column": 1 }, "end": { - "line": 50, + "line": 51, "column": 2 } } @@ -8048,15 +8148,15 @@ "updateContext": null }, "value": "export", - "start": 1412, - "end": 1418, + "start": 1460, + "end": 1466, "loc": { "start": { - "line": 52, + "line": 53, "column": 0 }, "end": { - "line": 52, + "line": 53, "column": 6 } } @@ -8076,15 +8176,15 @@ "updateContext": null }, "value": "default", - "start": 1419, - "end": 1426, + "start": 1467, + "end": 1474, "loc": { "start": { - "line": 52, + "line": 53, "column": 7 }, "end": { - "line": 52, + "line": 53, "column": 14 } } @@ -8102,15 +8202,15 @@ "binop": null }, "value": "delete_case1", - "start": 1427, - "end": 1439, + "start": 1475, + "end": 1487, "loc": { "start": { - "line": 52, + "line": 53, "column": 15 }, "end": { - "line": 52, + "line": 53, "column": 27 } } @@ -8128,15 +8228,15 @@ "binop": null, "updateContext": null }, - "start": 1439, - "end": 1440, + "start": 1487, + "end": 1488, "loc": { "start": { - "line": 52, + "line": 53, "column": 27 }, "end": { - "line": 52, + "line": 53, "column": 28 } } @@ -8154,15 +8254,15 @@ "binop": null, "updateContext": null }, - "start": 1441, - "end": 1441, + "start": 1489, + "end": 1489, "loc": { "start": { - "line": 53, + "line": 54, "column": 0 }, "end": { - "line": 53, + "line": 54, "column": 0 } } diff --git a/ast/source/deletion/delete_case2.js.json b/ast/source/deletion/delete_case2.js.json index d645e11..53f8dd4 100644 --- a/ast/source/deletion/delete_case2.js.json +++ b/ast/source/deletion/delete_case2.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1558, + "end": 1619, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 55, + "line": 56, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1558, + "end": 1619, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 55, + "line": 56, "column": 0 } }, @@ -513,16 +513,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 278, - "end": 544, + "end": 596, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 3 } } @@ -531,44 +531,44 @@ }, { "type": "Identifier", - "start": 545, - "end": 1527, + "start": 597, + "end": 1588, "loc": { "start": { - "line": 20, + "line": 21, "column": 0 }, "end": { - "line": 52, + "line": 53, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 551, - "end": 1526, + "start": 603, + "end": 1587, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 52, + "line": 53, "column": 1 } }, "id": { "type": "Identifier", - "start": 551, - "end": 563, + "start": 603, + "end": 615, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 20, + "line": 21, "column": 18 }, "identifierName": "delete_case2" @@ -578,15 +578,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 566, - "end": 1526, + "start": 618, + "end": 1587, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 52, + "line": 53, "column": 1 } }, @@ -597,15 +597,15 @@ "params": [ { "type": "Identifier", - "start": 567, - "end": 568, + "start": 619, + "end": 620, "loc": { "start": { - "line": 20, + "line": 21, "column": 22 }, "end": { - "line": 20, + "line": 21, "column": 23 }, "identifierName": "n" @@ -615,58 +615,58 @@ ], "body": { "type": "BlockStatement", - "start": 573, - "end": 1526, + "start": 625, + "end": 1587, "loc": { "start": { - "line": 20, + "line": 21, "column": 28 }, "end": { - "line": 52, + "line": 53, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 576, - "end": 602, + "start": 628, + "end": 654, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 576, - "end": 601, + "start": 628, + "end": 653, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 26 } }, "callee": { "type": "Identifier", - "start": 576, - "end": 582, + "start": 628, + "end": 634, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -676,29 +676,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 583, - "end": 600, + "start": 635, + "end": 652, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 25 } }, "left": { "type": "Identifier", - "start": 583, - "end": 584, + "start": 635, + "end": 636, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 }, "identifierName": "n" @@ -708,15 +708,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 596, - "end": 600, + "start": 648, + "end": 652, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 25 }, "identifierName": "Node" @@ -729,43 +729,43 @@ }, { "type": "ExpressionStatement", - "start": 604, - "end": 631, + "start": 656, + "end": 683, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 604, - "end": 630, + "start": 656, + "end": 682, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "callee": { "type": "Identifier", - "start": 604, - "end": 610, + "start": 656, + "end": 662, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -775,43 +775,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 611, - "end": 629, + "start": 663, + "end": 681, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 611, - "end": 619, + "start": 663, + "end": 671, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 611, - "end": 612, + "start": 663, + "end": 664, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -820,15 +820,15 @@ }, "property": { "type": "Identifier", - "start": 613, - "end": 619, + "start": 665, + "end": 671, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 16 }, "identifierName": "_color" @@ -840,15 +840,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 624, - "end": 629, + "start": 676, + "end": 681, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 26 }, "identifierName": "BLACK" @@ -861,43 +861,43 @@ }, { "type": "ExpressionStatement", - "start": 633, - "end": 659, + "start": 685, + "end": 711, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 633, - "end": 658, + "start": 685, + "end": 710, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 26 } }, "callee": { "type": "Identifier", - "start": 633, - "end": 639, + "start": 685, + "end": 691, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -907,43 +907,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 640, - "end": 657, + "start": 692, + "end": 709, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 640, - "end": 648, + "start": 692, + "end": 700, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 640, - "end": 641, + "start": 692, + "end": 693, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -952,15 +952,15 @@ }, "property": { "type": "Identifier", - "start": 642, - "end": 648, + "start": 694, + "end": 700, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 }, "identifierName": "parent" @@ -972,15 +972,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 653, - "end": 657, + "start": 705, + "end": 709, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 25 } } @@ -991,44 +991,44 @@ }, { "type": "VariableDeclaration", - "start": 661, - "end": 682, + "start": 713, + "end": 734, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 667, - "end": 681, + "start": 719, + "end": 733, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 21 } }, "id": { "type": "Identifier", - "start": 667, - "end": 668, + "start": 719, + "end": 720, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 8 }, "identifierName": "s" @@ -1037,29 +1037,29 @@ }, "init": { "type": "CallExpression", - "start": 671, - "end": 681, + "start": 723, + "end": 733, "loc": { "start": { - "line": 24, + "line": 25, "column": 11 }, "end": { - "line": 24, + "line": 25, "column": 21 } }, "callee": { "type": "Identifier", - "start": 671, - "end": 678, + "start": 723, + "end": 730, "loc": { "start": { - "line": 24, + "line": 25, "column": 11 }, "end": { - "line": 24, + "line": 25, "column": 18 }, "identifierName": "sibling" @@ -1069,15 +1069,15 @@ "arguments": [ { "type": "Identifier", - "start": 679, - "end": 680, + "start": 731, + "end": 732, "loc": { "start": { - "line": 24, + "line": 25, "column": 19 }, "end": { - "line": 24, + "line": 25, "column": 20 }, "identifierName": "n" @@ -1092,43 +1092,43 @@ }, { "type": "ExpressionStatement", - "start": 684, - "end": 710, + "start": 736, + "end": 762, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 684, - "end": 709, + "start": 736, + "end": 761, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 26 } }, "callee": { "type": "Identifier", - "start": 684, - "end": 690, + "start": 736, + "end": 742, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -1138,29 +1138,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 691, - "end": 708, + "start": 743, + "end": 760, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 25 } }, "left": { "type": "Identifier", - "start": 691, - "end": 692, + "start": 743, + "end": 744, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 }, "identifierName": "s" @@ -1170,15 +1170,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 704, - "end": 708, + "start": 756, + "end": 760, "loc": { "start": { - "line": 25, + "line": 26, "column": 21 }, "end": { - "line": 25, + "line": 26, "column": 25 }, "identifierName": "Node" @@ -1191,43 +1191,43 @@ }, { "type": "ExpressionStatement", - "start": 712, - "end": 739, + "start": 764, + "end": 791, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 712, - "end": 738, + "start": 764, + "end": 790, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 27 } }, "callee": { "type": "Identifier", - "start": 712, - "end": 718, + "start": 764, + "end": 770, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -1237,43 +1237,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 719, - "end": 737, + "start": 771, + "end": 789, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 719, - "end": 727, + "start": 771, + "end": 779, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 16 } }, "object": { "type": "Identifier", - "start": 719, - "end": 720, + "start": 771, + "end": 772, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 }, "identifierName": "s" @@ -1282,15 +1282,15 @@ }, "property": { "type": "Identifier", - "start": 721, - "end": 727, + "start": 773, + "end": 779, "loc": { "start": { - "line": 26, + "line": 27, "column": 10 }, "end": { - "line": 26, + "line": 27, "column": 16 }, "identifierName": "_color" @@ -1302,15 +1302,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 732, - "end": 737, + "start": 784, + "end": 789, "loc": { "start": { - "line": 26, + "line": 27, "column": 21 }, "end": { - "line": 26, + "line": 27, "column": 26 }, "identifierName": "BLACK" @@ -1324,15 +1324,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 742, - "end": 1283, + "start": 794, + "end": 1335, "loc": { "start": { - "line": 28, + "line": 29, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 4 } } @@ -1341,99 +1341,99 @@ }, { "type": "IfStatement", - "start": 1285, - "end": 1524, + "start": 1337, + "end": 1530, "loc": { "start": { - "line": 41, + "line": 42, "column": 1 }, "end": { - "line": 51, - "column": 22 + "line": 49, + "column": 2 } }, "test": { "type": "LogicalExpression", - "start": 1292, - "end": 1419, + "start": 1344, + "end": 1471, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 48 } }, "left": { "type": "LogicalExpression", - "start": 1292, - "end": 1367, + "start": 1344, + "end": 1419, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 46 } }, "left": { "type": "BinaryExpression", - "start": 1292, - "end": 1317, + "start": 1344, + "end": 1369, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 27 } }, "left": { "type": "MemberExpression", - "start": 1292, - "end": 1307, + "start": 1344, + "end": 1359, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 17 } }, "object": { "type": "MemberExpression", - "start": 1292, - "end": 1300, + "start": 1344, + "end": 1352, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 10 } }, "object": { "type": "Identifier", - "start": 1292, - "end": 1293, + "start": 1344, + "end": 1345, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 3 }, "identifierName": "n" @@ -1443,15 +1443,15 @@ }, "property": { "type": "Identifier", - "start": 1294, - "end": 1300, + "start": 1346, + "end": 1352, "loc": { "start": { - "line": 42, + "line": 43, "column": 4 }, "end": { - "line": 42, + "line": 43, "column": 10 }, "identifierName": "parent" @@ -1463,15 +1463,15 @@ }, "property": { "type": "Identifier", - "start": 1301, - "end": 1307, + "start": 1353, + "end": 1359, "loc": { "start": { - "line": 42, + "line": 43, "column": 11 }, "end": { - "line": 42, + "line": 43, "column": 17 }, "identifierName": "_color" @@ -1484,15 +1484,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1312, - "end": 1317, + "start": 1364, + "end": 1369, "loc": { "start": { - "line": 42, + "line": 43, "column": 22 }, "end": { - "line": 42, + "line": 43, "column": 27 }, "identifierName": "BLACK" @@ -1504,57 +1504,57 @@ "operator": "&&", "right": { "type": "LogicalExpression", - "start": 1324, - "end": 1366, + "start": 1376, + "end": 1418, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 45 } }, "left": { "type": "BinaryExpression", - "start": 1324, - "end": 1339, + "start": 1376, + "end": 1391, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 18 } }, "left": { "type": "MemberExpression", - "start": 1324, - "end": 1330, + "start": 1376, + "end": 1382, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 9 } }, "object": { "type": "Identifier", - "start": 1324, - "end": 1325, + "start": 1376, + "end": 1377, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 4 }, "identifierName": "s" @@ -1563,15 +1563,15 @@ }, "property": { "type": "Identifier", - "start": 1326, - "end": 1330, + "start": 1378, + "end": 1382, "loc": { "start": { - "line": 43, + "line": 44, "column": 5 }, "end": { - "line": 43, + "line": 44, "column": 9 }, "identifierName": "left" @@ -1583,15 +1583,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1335, - "end": 1339, + "start": 1387, + "end": 1391, "loc": { "start": { - "line": 43, + "line": 44, "column": 14 }, "end": { - "line": 43, + "line": 44, "column": 18 } } @@ -1600,57 +1600,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 1343, - "end": 1366, + "start": 1395, + "end": 1418, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 45 } }, "left": { "type": "MemberExpression", - "start": 1343, - "end": 1356, + "start": 1395, + "end": 1408, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 35 } }, "object": { "type": "MemberExpression", - "start": 1343, - "end": 1349, + "start": 1395, + "end": 1401, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 28 } }, "object": { "type": "Identifier", - "start": 1343, - "end": 1344, + "start": 1395, + "end": 1396, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 23 }, "identifierName": "s" @@ -1659,15 +1659,15 @@ }, "property": { "type": "Identifier", - "start": 1345, - "end": 1349, + "start": 1397, + "end": 1401, "loc": { "start": { - "line": 43, + "line": 44, "column": 24 }, "end": { - "line": 43, + "line": 44, "column": 28 }, "identifierName": "left" @@ -1678,15 +1678,15 @@ }, "property": { "type": "Identifier", - "start": 1350, - "end": 1356, + "start": 1402, + "end": 1408, "loc": { "start": { - "line": 43, + "line": 44, "column": 29 }, "end": { - "line": 43, + "line": 44, "column": 35 }, "identifierName": "_color" @@ -1698,15 +1698,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1361, - "end": 1366, + "start": 1413, + "end": 1418, "loc": { "start": { - "line": 43, + "line": 44, "column": 40 }, "end": { - "line": 43, + "line": 44, "column": 45 }, "identifierName": "BLACK" @@ -1716,7 +1716,7 @@ }, "extra": { "parenthesized": true, - "parenStart": 1323 + "parenStart": 1375 } }, "leadingComments": null @@ -1724,57 +1724,57 @@ "operator": "&&", "right": { "type": "LogicalExpression", - "start": 1374, - "end": 1418, + "start": 1426, + "end": 1470, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 47 } }, "left": { "type": "BinaryExpression", - "start": 1374, - "end": 1390, + "start": 1426, + "end": 1442, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 19 } }, "left": { "type": "MemberExpression", - "start": 1374, - "end": 1381, + "start": 1426, + "end": 1433, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 10 } }, "object": { "type": "Identifier", - "start": 1374, - "end": 1375, + "start": 1426, + "end": 1427, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 4 }, "identifierName": "s" @@ -1783,15 +1783,15 @@ }, "property": { "type": "Identifier", - "start": 1376, - "end": 1381, + "start": 1428, + "end": 1433, "loc": { "start": { - "line": 44, + "line": 45, "column": 5 }, "end": { - "line": 44, + "line": 45, "column": 10 }, "identifierName": "right" @@ -1803,15 +1803,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1386, - "end": 1390, + "start": 1438, + "end": 1442, "loc": { "start": { - "line": 44, + "line": 45, "column": 15 }, "end": { - "line": 44, + "line": 45, "column": 19 } } @@ -1820,57 +1820,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 1394, - "end": 1418, + "start": 1446, + "end": 1470, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 47 } }, "left": { "type": "MemberExpression", - "start": 1394, - "end": 1408, + "start": 1446, + "end": 1460, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 37 } }, "object": { "type": "MemberExpression", - "start": 1394, - "end": 1401, + "start": 1446, + "end": 1453, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 30 } }, "object": { "type": "Identifier", - "start": 1394, - "end": 1395, + "start": 1446, + "end": 1447, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 24 }, "identifierName": "s" @@ -1879,15 +1879,15 @@ }, "property": { "type": "Identifier", - "start": 1396, - "end": 1401, + "start": 1448, + "end": 1453, "loc": { "start": { - "line": 44, + "line": 45, "column": 25 }, "end": { - "line": 44, + "line": 45, "column": 30 }, "identifierName": "right" @@ -1898,15 +1898,15 @@ }, "property": { "type": "Identifier", - "start": 1402, - "end": 1408, + "start": 1454, + "end": 1460, "loc": { "start": { - "line": 44, + "line": 45, "column": 31 }, "end": { - "line": 44, + "line": 45, "column": 37 }, "identifierName": "_color" @@ -1918,15 +1918,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1413, - "end": 1418, + "start": 1465, + "end": 1470, "loc": { "start": { - "line": 44, + "line": 45, "column": 42 }, "end": { - "line": 44, + "line": 45, "column": 47 }, "identifierName": "BLACK" @@ -1936,80 +1936,80 @@ }, "extra": { "parenthesized": true, - "parenStart": 1373 + "parenStart": 1425 } }, "leadingComments": null }, "consequent": { "type": "BlockStatement", - "start": 1423, - "end": 1471, + "start": 1475, + "end": 1530, "loc": { "start": { - "line": 45, + "line": 46, "column": 3 }, "end": { - "line": 48, + "line": 49, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1427, - "end": 1442, + "start": 1479, + "end": 1494, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 17 } }, "expression": { "type": "AssignmentExpression", - "start": 1427, - "end": 1441, + "start": 1479, + "end": 1493, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 16 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1427, - "end": 1435, + "start": 1479, + "end": 1487, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 10 } }, "object": { "type": "Identifier", - "start": 1427, - "end": 1428, + "start": 1479, + "end": 1480, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 3 }, "identifierName": "s" @@ -2018,15 +2018,15 @@ }, "property": { "type": "Identifier", - "start": 1429, - "end": 1435, + "start": 1481, + "end": 1487, "loc": { "start": { - "line": 46, + "line": 47, "column": 4 }, "end": { - "line": 46, + "line": 47, "column": 10 }, "identifierName": "_color" @@ -2037,15 +2037,15 @@ }, "right": { "type": "Identifier", - "start": 1438, - "end": 1441, + "start": 1490, + "end": 1493, "loc": { "start": { - "line": 46, + "line": 47, "column": 13 }, "end": { - "line": 46, + "line": 47, "column": 16 }, "identifierName": "RED" @@ -2055,45 +2055,45 @@ } }, { - "type": "ExpressionStatement", - "start": 1445, - "end": 1468, + "type": "ReturnStatement", + "start": 1497, + "end": 1527, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, - "column": 25 + "line": 48, + "column": 32 } }, - "expression": { + "argument": { "type": "CallExpression", - "start": 1445, - "end": 1467, + "start": 1504, + "end": 1526, "loc": { "start": { - "line": 47, - "column": 2 + "line": 48, + "column": 9 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 31 } }, "callee": { "type": "Identifier", - "start": 1445, - "end": 1457, + "start": 1504, + "end": 1516, "loc": { "start": { - "line": 47, - "column": 2 + "line": 48, + "column": 9 }, "end": { - "line": 47, - "column": 14 + "line": 48, + "column": 21 }, "identifierName": "delete_case0" }, @@ -2102,30 +2102,30 @@ "arguments": [ { "type": "MemberExpression", - "start": 1458, - "end": 1466, + "start": 1517, + "end": 1525, "loc": { "start": { - "line": 47, - "column": 15 + "line": 48, + "column": 22 }, "end": { - "line": 47, - "column": 23 + "line": 48, + "column": 30 } }, "object": { "type": "Identifier", - "start": 1458, - "end": 1459, + "start": 1517, + "end": 1518, "loc": { "start": { - "line": 47, - "column": 15 + "line": 48, + "column": 22 }, "end": { - "line": 47, - "column": 16 + "line": 48, + "column": 23 }, "identifierName": "n" }, @@ -2133,16 +2133,16 @@ }, "property": { "type": "Identifier", - "start": 1460, - "end": 1466, + "start": 1519, + "end": 1525, "loc": { "start": { - "line": 47, - "column": 17 + "line": 48, + "column": 24 }, "end": { - "line": 47, - "column": 23 + "line": 48, + "column": 30 }, "identifierName": "parent" }, @@ -2155,125 +2155,127 @@ } ], "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 3.", - "start": 1474, - "end": 1501, - "loc": { - "start": { - "line": 50, - "column": 1 - }, - "end": { - "line": 50, - "column": 28 - } + "trailingComments": null + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 794, + "end": 1335, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 41, + "column": 4 } } - ] + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1533, + "end": 1560, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 28 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 1562, + "end": 1585, + "loc": { + "start": { + "line": 52, + "column": 1 + }, + "end": { + "line": 52, + "column": 24 + } }, - "alternate": { - "type": "ExpressionStatement", - "start": 1508, - "end": 1524, + "argument": { + "type": "CallExpression", + "start": 1569, + "end": 1584, "loc": { "start": { - "line": 51, - "column": 6 + "line": 52, + "column": 8 }, "end": { - "line": 51, - "column": 22 + "line": 52, + "column": 23 } }, - "expression": { - "type": "CallExpression", - "start": 1508, - "end": 1523, + "callee": { + "type": "Identifier", + "start": 1569, + "end": 1581, "loc": { "start": { - "line": 51, - "column": 6 + "line": 52, + "column": 8 }, "end": { - "line": 51, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 1508, - "end": 1520, - "loc": { - "start": { - "line": 51, - "column": 6 - }, - "end": { - "line": 51, - "column": 18 - }, - "identifierName": "delete_case3" + "line": 52, + "column": 20 }, - "name": "delete_case3", - "leadingComments": null + "identifierName": "delete_case3" }, - "arguments": [ - { - "type": "Identifier", - "start": 1521, - "end": 1522, - "loc": { - "start": { - "line": 51, - "column": 19 - }, - "end": { - "line": 51, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ], + "name": "delete_case3", "leadingComments": null }, - "leadingComments": [ + "arguments": [ { - "type": "CommentLine", - "value": " Otherwise, go to case 3.", - "start": 1474, - "end": 1501, + "type": "Identifier", + "start": 1582, + "end": 1583, "loc": { "start": { - "line": 50, - "column": 1 + "line": 52, + "column": 21 }, "end": { - "line": 50, - "column": 28 - } - } + "line": 52, + "column": 22 + }, + "identifierName": "n" + }, + "name": "n" } - ] + ], + "leadingComments": null }, "leadingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 742, - "end": 1283, + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1533, + "end": 1560, "loc": { "start": { - "line": 28, + "line": 51, "column": 1 }, "end": { - "line": 40, - "column": 4 + "line": 51, + "column": 28 } } } @@ -2293,29 +2295,29 @@ }, { "type": "Identifier", - "start": 1529, - "end": 1557, + "start": 1590, + "end": 1618, "loc": { "start": { - "line": 54, + "line": 55, "column": 0 }, "end": { - "line": 54, + "line": 55, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 1544, - "end": 1556, + "start": 1605, + "end": 1617, "loc": { "start": { - "line": 54, + "line": 55, "column": 15 }, "end": { - "line": 54, + "line": 55, "column": 27 }, "identifierName": "delete_case2" @@ -2328,58 +2330,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1529, - "end": 1557, + "start": 1590, + "end": 1618, "loc": { "start": { - "line": 54, + "line": 55, "column": 0 }, "end": { - "line": 54, + "line": 55, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 545, - "end": 1527, + "start": 597, + "end": 1588, "loc": { "start": { - "line": 20, + "line": 21, "column": 0 }, "end": { - "line": 52, + "line": 53, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 551, - "end": 1526, + "start": 603, + "end": 1587, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 52, + "line": 53, "column": 1 } }, "id": { "type": "Identifier", - "start": 551, - "end": 563, + "start": 603, + "end": 615, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 20, + "line": 21, "column": 18 }, "identifierName": "delete_case2" @@ -2389,29 +2391,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 566, - "end": 1526, + "start": 618, + "end": 1587, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 52, + "line": 53, "column": 1 } }, "id": { "type": "Identifier", - "start": 551, - "end": 563, + "start": 603, + "end": 615, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 20, + "line": 21, "column": 18 }, "identifierName": "delete_case2" @@ -2425,15 +2427,15 @@ "params": [ { "type": "Identifier", - "start": 567, - "end": 568, + "start": 619, + "end": 620, "loc": { "start": { - "line": 20, + "line": 21, "column": 22 }, "end": { - "line": 20, + "line": 21, "column": 23 }, "identifierName": "n" @@ -2443,58 +2445,58 @@ ], "body": { "type": "BlockStatement", - "start": 573, - "end": 1526, + "start": 625, + "end": 1587, "loc": { "start": { - "line": 20, + "line": 21, "column": 28 }, "end": { - "line": 52, + "line": 53, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 576, - "end": 602, + "start": 628, + "end": 654, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 576, - "end": 601, + "start": 628, + "end": 653, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 26 } }, "callee": { "type": "Identifier", - "start": 576, - "end": 582, + "start": 628, + "end": 634, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -2504,29 +2506,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 583, - "end": 600, + "start": 635, + "end": 652, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 25 } }, "left": { "type": "Identifier", - "start": 583, - "end": 584, + "start": 635, + "end": 636, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 }, "identifierName": "n" @@ -2536,15 +2538,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 596, - "end": 600, + "start": 648, + "end": 652, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 25 }, "identifierName": "Node" @@ -2557,43 +2559,43 @@ }, { "type": "ExpressionStatement", - "start": 604, - "end": 631, + "start": 656, + "end": 683, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 604, - "end": 630, + "start": 656, + "end": 682, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "callee": { "type": "Identifier", - "start": 604, - "end": 610, + "start": 656, + "end": 662, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -2603,43 +2605,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 611, - "end": 629, + "start": 663, + "end": 681, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 611, - "end": 619, + "start": 663, + "end": 671, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 611, - "end": 612, + "start": 663, + "end": 664, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -2648,15 +2650,15 @@ }, "property": { "type": "Identifier", - "start": 613, - "end": 619, + "start": 665, + "end": 671, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 16 }, "identifierName": "_color" @@ -2668,15 +2670,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 624, - "end": 629, + "start": 676, + "end": 681, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 26 }, "identifierName": "BLACK" @@ -2689,43 +2691,43 @@ }, { "type": "ExpressionStatement", - "start": 633, - "end": 659, + "start": 685, + "end": 711, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 633, - "end": 658, + "start": 685, + "end": 710, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 26 } }, "callee": { "type": "Identifier", - "start": 633, - "end": 639, + "start": 685, + "end": 691, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -2735,43 +2737,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 640, - "end": 657, + "start": 692, + "end": 709, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 640, - "end": 648, + "start": 692, + "end": 700, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 640, - "end": 641, + "start": 692, + "end": 693, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -2780,15 +2782,15 @@ }, "property": { "type": "Identifier", - "start": 642, - "end": 648, + "start": 694, + "end": 700, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 }, "identifierName": "parent" @@ -2800,15 +2802,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 653, - "end": 657, + "start": 705, + "end": 709, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 25 } } @@ -2819,44 +2821,44 @@ }, { "type": "VariableDeclaration", - "start": 661, - "end": 682, + "start": 713, + "end": 734, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 667, - "end": 681, + "start": 719, + "end": 733, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 21 } }, "id": { "type": "Identifier", - "start": 667, - "end": 668, + "start": 719, + "end": 720, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 8 }, "identifierName": "s" @@ -2865,29 +2867,29 @@ }, "init": { "type": "CallExpression", - "start": 671, - "end": 681, + "start": 723, + "end": 733, "loc": { "start": { - "line": 24, + "line": 25, "column": 11 }, "end": { - "line": 24, + "line": 25, "column": 21 } }, "callee": { "type": "Identifier", - "start": 671, - "end": 678, + "start": 723, + "end": 730, "loc": { "start": { - "line": 24, + "line": 25, "column": 11 }, "end": { - "line": 24, + "line": 25, "column": 18 }, "identifierName": "sibling" @@ -2897,15 +2899,15 @@ "arguments": [ { "type": "Identifier", - "start": 679, - "end": 680, + "start": 731, + "end": 732, "loc": { "start": { - "line": 24, + "line": 25, "column": 19 }, "end": { - "line": 24, + "line": 25, "column": 20 }, "identifierName": "n" @@ -2920,43 +2922,43 @@ }, { "type": "ExpressionStatement", - "start": 684, - "end": 710, + "start": 736, + "end": 762, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 684, - "end": 709, + "start": 736, + "end": 761, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 26 } }, "callee": { "type": "Identifier", - "start": 684, - "end": 690, + "start": 736, + "end": 742, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -2966,29 +2968,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 691, - "end": 708, + "start": 743, + "end": 760, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 25 } }, "left": { "type": "Identifier", - "start": 691, - "end": 692, + "start": 743, + "end": 744, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 }, "identifierName": "s" @@ -2998,15 +3000,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 704, - "end": 708, + "start": 756, + "end": 760, "loc": { "start": { - "line": 25, + "line": 26, "column": 21 }, "end": { - "line": 25, + "line": 26, "column": 25 }, "identifierName": "Node" @@ -3019,43 +3021,43 @@ }, { "type": "ExpressionStatement", - "start": 712, - "end": 739, + "start": 764, + "end": 791, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 712, - "end": 738, + "start": 764, + "end": 790, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 27 } }, "callee": { "type": "Identifier", - "start": 712, - "end": 718, + "start": 764, + "end": 770, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -3065,43 +3067,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 719, - "end": 737, + "start": 771, + "end": 789, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 719, - "end": 727, + "start": 771, + "end": 779, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 16 } }, "object": { "type": "Identifier", - "start": 719, - "end": 720, + "start": 771, + "end": 772, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 }, "identifierName": "s" @@ -3110,15 +3112,15 @@ }, "property": { "type": "Identifier", - "start": 721, - "end": 727, + "start": 773, + "end": 779, "loc": { "start": { - "line": 26, + "line": 27, "column": 10 }, "end": { - "line": 26, + "line": 27, "column": 16 }, "identifierName": "_color" @@ -3130,15 +3132,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 732, - "end": 737, + "start": 784, + "end": 789, "loc": { "start": { - "line": 26, + "line": 27, "column": 21 }, "end": { - "line": 26, + "line": 27, "column": 26 }, "identifierName": "BLACK" @@ -3152,15 +3154,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 742, - "end": 1283, + "start": 794, + "end": 1335, "loc": { "start": { - "line": 28, + "line": 29, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 4 } } @@ -3169,99 +3171,99 @@ }, { "type": "IfStatement", - "start": 1285, - "end": 1524, + "start": 1337, + "end": 1530, "loc": { "start": { - "line": 41, + "line": 42, "column": 1 }, "end": { - "line": 51, - "column": 22 + "line": 49, + "column": 2 } }, "test": { "type": "LogicalExpression", - "start": 1292, - "end": 1419, + "start": 1344, + "end": 1471, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 48 } }, "left": { "type": "LogicalExpression", - "start": 1292, - "end": 1367, + "start": 1344, + "end": 1419, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 46 } }, "left": { "type": "BinaryExpression", - "start": 1292, - "end": 1317, + "start": 1344, + "end": 1369, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 27 } }, "left": { "type": "MemberExpression", - "start": 1292, - "end": 1307, + "start": 1344, + "end": 1359, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 17 } }, "object": { "type": "MemberExpression", - "start": 1292, - "end": 1300, + "start": 1344, + "end": 1352, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 10 } }, "object": { "type": "Identifier", - "start": 1292, - "end": 1293, + "start": 1344, + "end": 1345, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 3 }, "identifierName": "n" @@ -3271,15 +3273,15 @@ }, "property": { "type": "Identifier", - "start": 1294, - "end": 1300, + "start": 1346, + "end": 1352, "loc": { "start": { - "line": 42, + "line": 43, "column": 4 }, "end": { - "line": 42, + "line": 43, "column": 10 }, "identifierName": "parent" @@ -3291,15 +3293,15 @@ }, "property": { "type": "Identifier", - "start": 1301, - "end": 1307, + "start": 1353, + "end": 1359, "loc": { "start": { - "line": 42, + "line": 43, "column": 11 }, "end": { - "line": 42, + "line": 43, "column": 17 }, "identifierName": "_color" @@ -3312,15 +3314,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1312, - "end": 1317, + "start": 1364, + "end": 1369, "loc": { "start": { - "line": 42, + "line": 43, "column": 22 }, "end": { - "line": 42, + "line": 43, "column": 27 }, "identifierName": "BLACK" @@ -3332,57 +3334,57 @@ "operator": "&&", "right": { "type": "LogicalExpression", - "start": 1324, - "end": 1366, + "start": 1376, + "end": 1418, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 45 } }, "left": { "type": "BinaryExpression", - "start": 1324, - "end": 1339, + "start": 1376, + "end": 1391, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 18 } }, "left": { "type": "MemberExpression", - "start": 1324, - "end": 1330, + "start": 1376, + "end": 1382, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 9 } }, "object": { "type": "Identifier", - "start": 1324, - "end": 1325, + "start": 1376, + "end": 1377, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 4 }, "identifierName": "s" @@ -3391,15 +3393,15 @@ }, "property": { "type": "Identifier", - "start": 1326, - "end": 1330, + "start": 1378, + "end": 1382, "loc": { "start": { - "line": 43, + "line": 44, "column": 5 }, "end": { - "line": 43, + "line": 44, "column": 9 }, "identifierName": "left" @@ -3411,15 +3413,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1335, - "end": 1339, + "start": 1387, + "end": 1391, "loc": { "start": { - "line": 43, + "line": 44, "column": 14 }, "end": { - "line": 43, + "line": 44, "column": 18 } } @@ -3428,57 +3430,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 1343, - "end": 1366, + "start": 1395, + "end": 1418, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 45 } }, "left": { "type": "MemberExpression", - "start": 1343, - "end": 1356, + "start": 1395, + "end": 1408, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 35 } }, "object": { "type": "MemberExpression", - "start": 1343, - "end": 1349, + "start": 1395, + "end": 1401, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 28 } }, "object": { "type": "Identifier", - "start": 1343, - "end": 1344, + "start": 1395, + "end": 1396, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 23 }, "identifierName": "s" @@ -3487,15 +3489,15 @@ }, "property": { "type": "Identifier", - "start": 1345, - "end": 1349, + "start": 1397, + "end": 1401, "loc": { "start": { - "line": 43, + "line": 44, "column": 24 }, "end": { - "line": 43, + "line": 44, "column": 28 }, "identifierName": "left" @@ -3506,15 +3508,15 @@ }, "property": { "type": "Identifier", - "start": 1350, - "end": 1356, + "start": 1402, + "end": 1408, "loc": { "start": { - "line": 43, + "line": 44, "column": 29 }, "end": { - "line": 43, + "line": 44, "column": 35 }, "identifierName": "_color" @@ -3526,15 +3528,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1361, - "end": 1366, + "start": 1413, + "end": 1418, "loc": { "start": { - "line": 43, + "line": 44, "column": 40 }, "end": { - "line": 43, + "line": 44, "column": 45 }, "identifierName": "BLACK" @@ -3544,7 +3546,7 @@ }, "extra": { "parenthesized": true, - "parenStart": 1323 + "parenStart": 1375 } }, "leadingComments": null @@ -3552,57 +3554,57 @@ "operator": "&&", "right": { "type": "LogicalExpression", - "start": 1374, - "end": 1418, + "start": 1426, + "end": 1470, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 47 } }, "left": { "type": "BinaryExpression", - "start": 1374, - "end": 1390, + "start": 1426, + "end": 1442, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 19 } }, "left": { "type": "MemberExpression", - "start": 1374, - "end": 1381, + "start": 1426, + "end": 1433, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 10 } }, "object": { "type": "Identifier", - "start": 1374, - "end": 1375, + "start": 1426, + "end": 1427, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 4 }, "identifierName": "s" @@ -3611,15 +3613,15 @@ }, "property": { "type": "Identifier", - "start": 1376, - "end": 1381, + "start": 1428, + "end": 1433, "loc": { "start": { - "line": 44, + "line": 45, "column": 5 }, "end": { - "line": 44, + "line": 45, "column": 10 }, "identifierName": "right" @@ -3631,15 +3633,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1386, - "end": 1390, + "start": 1438, + "end": 1442, "loc": { "start": { - "line": 44, + "line": 45, "column": 15 }, "end": { - "line": 44, + "line": 45, "column": 19 } } @@ -3648,57 +3650,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 1394, - "end": 1418, + "start": 1446, + "end": 1470, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 47 } }, "left": { "type": "MemberExpression", - "start": 1394, - "end": 1408, + "start": 1446, + "end": 1460, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 37 } }, "object": { "type": "MemberExpression", - "start": 1394, - "end": 1401, + "start": 1446, + "end": 1453, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 30 } }, "object": { "type": "Identifier", - "start": 1394, - "end": 1395, + "start": 1446, + "end": 1447, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 24 }, "identifierName": "s" @@ -3707,15 +3709,15 @@ }, "property": { "type": "Identifier", - "start": 1396, - "end": 1401, + "start": 1448, + "end": 1453, "loc": { "start": { - "line": 44, + "line": 45, "column": 25 }, "end": { - "line": 44, + "line": 45, "column": 30 }, "identifierName": "right" @@ -3726,15 +3728,15 @@ }, "property": { "type": "Identifier", - "start": 1402, - "end": 1408, + "start": 1454, + "end": 1460, "loc": { "start": { - "line": 44, + "line": 45, "column": 31 }, "end": { - "line": 44, + "line": 45, "column": 37 }, "identifierName": "_color" @@ -3746,15 +3748,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1413, - "end": 1418, + "start": 1465, + "end": 1470, "loc": { "start": { - "line": 44, + "line": 45, "column": 42 }, "end": { - "line": 44, + "line": 45, "column": 47 }, "identifierName": "BLACK" @@ -3764,80 +3766,80 @@ }, "extra": { "parenthesized": true, - "parenStart": 1373 + "parenStart": 1425 } }, "leadingComments": null }, "consequent": { "type": "BlockStatement", - "start": 1423, - "end": 1471, + "start": 1475, + "end": 1530, "loc": { "start": { - "line": 45, + "line": 46, "column": 3 }, "end": { - "line": 48, + "line": 49, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1427, - "end": 1442, + "start": 1479, + "end": 1494, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 17 } }, "expression": { "type": "AssignmentExpression", - "start": 1427, - "end": 1441, + "start": 1479, + "end": 1493, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 16 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1427, - "end": 1435, + "start": 1479, + "end": 1487, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 10 } }, "object": { "type": "Identifier", - "start": 1427, - "end": 1428, + "start": 1479, + "end": 1480, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 3 }, "identifierName": "s" @@ -3846,15 +3848,15 @@ }, "property": { "type": "Identifier", - "start": 1429, - "end": 1435, + "start": 1481, + "end": 1487, "loc": { "start": { - "line": 46, + "line": 47, "column": 4 }, "end": { - "line": 46, + "line": 47, "column": 10 }, "identifierName": "_color" @@ -3865,15 +3867,15 @@ }, "right": { "type": "Identifier", - "start": 1438, - "end": 1441, + "start": 1490, + "end": 1493, "loc": { "start": { - "line": 46, + "line": 47, "column": 13 }, "end": { - "line": 46, + "line": 47, "column": 16 }, "identifierName": "RED" @@ -3883,45 +3885,45 @@ } }, { - "type": "ExpressionStatement", - "start": 1445, - "end": 1468, + "type": "ReturnStatement", + "start": 1497, + "end": 1527, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, - "column": 25 + "line": 48, + "column": 32 } }, - "expression": { + "argument": { "type": "CallExpression", - "start": 1445, - "end": 1467, + "start": 1504, + "end": 1526, "loc": { "start": { - "line": 47, - "column": 2 + "line": 48, + "column": 9 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 31 } }, "callee": { "type": "Identifier", - "start": 1445, - "end": 1457, + "start": 1504, + "end": 1516, "loc": { "start": { - "line": 47, - "column": 2 + "line": 48, + "column": 9 }, "end": { - "line": 47, - "column": 14 + "line": 48, + "column": 21 }, "identifierName": "delete_case0" }, @@ -3930,30 +3932,30 @@ "arguments": [ { "type": "MemberExpression", - "start": 1458, - "end": 1466, + "start": 1517, + "end": 1525, "loc": { "start": { - "line": 47, - "column": 15 + "line": 48, + "column": 22 }, "end": { - "line": 47, - "column": 23 + "line": 48, + "column": 30 } }, "object": { "type": "Identifier", - "start": 1458, - "end": 1459, + "start": 1517, + "end": 1518, "loc": { "start": { - "line": 47, - "column": 15 + "line": 48, + "column": 22 }, "end": { - "line": 47, - "column": 16 + "line": 48, + "column": 23 }, "identifierName": "n" }, @@ -3961,16 +3963,16 @@ }, "property": { "type": "Identifier", - "start": 1460, - "end": 1466, + "start": 1519, + "end": 1525, "loc": { "start": { - "line": 47, - "column": 17 + "line": 48, + "column": 24 }, "end": { - "line": 47, - "column": 23 + "line": 48, + "column": 30 }, "identifierName": "parent" }, @@ -3981,127 +3983,129 @@ ] } } - ], - "directives": [], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Otherwise, go to case 3.", - "start": 1474, - "end": 1501, - "loc": { - "start": { - "line": 50, - "column": 1 - }, - "end": { - "line": 50, - "column": 28 - } + ], + "directives": [], + "trailingComments": null + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", + "start": 794, + "end": 1335, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 41, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1533, + "end": 1560, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 28 } } - ] + } + ] + }, + { + "type": "ReturnStatement", + "start": 1562, + "end": 1585, + "loc": { + "start": { + "line": 52, + "column": 1 + }, + "end": { + "line": 52, + "column": 24 + } }, - "alternate": { - "type": "ExpressionStatement", - "start": 1508, - "end": 1524, + "argument": { + "type": "CallExpression", + "start": 1569, + "end": 1584, "loc": { "start": { - "line": 51, - "column": 6 + "line": 52, + "column": 8 }, "end": { - "line": 51, - "column": 22 + "line": 52, + "column": 23 } }, - "expression": { - "type": "CallExpression", - "start": 1508, - "end": 1523, + "callee": { + "type": "Identifier", + "start": 1569, + "end": 1581, "loc": { "start": { - "line": 51, - "column": 6 + "line": 52, + "column": 8 }, "end": { - "line": 51, - "column": 21 - } - }, - "callee": { - "type": "Identifier", - "start": 1508, - "end": 1520, - "loc": { - "start": { - "line": 51, - "column": 6 - }, - "end": { - "line": 51, - "column": 18 - }, - "identifierName": "delete_case3" + "line": 52, + "column": 20 }, - "name": "delete_case3", - "leadingComments": null + "identifierName": "delete_case3" }, - "arguments": [ - { - "type": "Identifier", - "start": 1521, - "end": 1522, - "loc": { - "start": { - "line": 51, - "column": 19 - }, - "end": { - "line": 51, - "column": 20 - }, - "identifierName": "n" - }, - "name": "n" - } - ], + "name": "delete_case3", "leadingComments": null }, - "leadingComments": [ + "arguments": [ { - "type": "CommentLine", - "value": " Otherwise, go to case 3.", - "start": 1474, - "end": 1501, + "type": "Identifier", + "start": 1582, + "end": 1583, "loc": { "start": { - "line": 50, - "column": 1 + "line": 52, + "column": 21 }, "end": { - "line": 50, - "column": 28 - } - } + "line": 52, + "column": 22 + }, + "identifierName": "n" + }, + "name": "n" } - ] + ], + "leadingComments": null }, "leadingComments": [ { - "type": "CommentBlock", - "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 742, - "end": 1283, + "type": "CommentLine", + "value": " Otherwise, go to case 3.", + "start": 1533, + "end": 1560, "loc": { "start": { - "line": 28, + "line": 51, "column": 1 }, "end": { - "line": 40, - "column": 4 + "line": 51, + "column": 28 } } } @@ -4118,16 +4122,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 278, - "end": 544, + "end": 596, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 3 } } @@ -4142,16 +4146,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 278, - "end": 544, + "end": 596, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 3 } } @@ -4159,15 +4163,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 742, - "end": 1283, + "start": 794, + "end": 1335, "loc": { "start": { - "line": 28, + "line": 29, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 4 } } @@ -4175,15 +4179,15 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1474, - "end": 1501, + "start": 1533, + "end": 1560, "loc": { "start": { - "line": 50, + "line": 51, "column": 1 }, "end": { - "line": 50, + "line": 51, "column": 28 } } @@ -5123,16 +5127,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 278, - "end": 544, + "end": 596, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 3 } } @@ -5152,15 +5156,15 @@ "updateContext": null }, "value": "const", - "start": 545, - "end": 550, + "start": 597, + "end": 602, "loc": { "start": { - "line": 20, + "line": 21, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 5 } } @@ -5178,15 +5182,15 @@ "binop": null }, "value": "delete_case2", - "start": 551, - "end": 563, + "start": 603, + "end": 615, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 20, + "line": 21, "column": 18 } } @@ -5205,15 +5209,15 @@ "updateContext": null }, "value": "=", - "start": 564, - "end": 565, + "start": 616, + "end": 617, "loc": { "start": { - "line": 20, + "line": 21, "column": 19 }, "end": { - "line": 20, + "line": 21, "column": 20 } } @@ -5230,15 +5234,15 @@ "postfix": false, "binop": null }, - "start": 566, - "end": 567, + "start": 618, + "end": 619, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 22 } } @@ -5256,15 +5260,15 @@ "binop": null }, "value": "n", - "start": 567, - "end": 568, + "start": 619, + "end": 620, "loc": { "start": { - "line": 20, + "line": 21, "column": 22 }, "end": { - "line": 20, + "line": 21, "column": 23 } } @@ -5281,15 +5285,15 @@ "postfix": false, "binop": null }, - "start": 568, - "end": 569, + "start": 620, + "end": 621, "loc": { "start": { - "line": 20, + "line": 21, "column": 23 }, "end": { - "line": 20, + "line": 21, "column": 24 } } @@ -5307,15 +5311,15 @@ "binop": null, "updateContext": null }, - "start": 570, - "end": 572, + "start": 622, + "end": 624, "loc": { "start": { - "line": 20, + "line": 21, "column": 25 }, "end": { - "line": 20, + "line": 21, "column": 27 } } @@ -5332,15 +5336,15 @@ "postfix": false, "binop": null }, - "start": 573, - "end": 574, + "start": 625, + "end": 626, "loc": { "start": { - "line": 20, + "line": 21, "column": 28 }, "end": { - "line": 20, + "line": 21, "column": 29 } } @@ -5358,15 +5362,15 @@ "binop": null }, "value": "assert", - "start": 576, - "end": 582, + "start": 628, + "end": 634, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 } } @@ -5383,15 +5387,15 @@ "postfix": false, "binop": null }, - "start": 582, - "end": 583, + "start": 634, + "end": 635, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 8 } } @@ -5409,15 +5413,15 @@ "binop": null }, "value": "n", - "start": 583, - "end": 584, + "start": 635, + "end": 636, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 } } @@ -5437,15 +5441,15 @@ "updateContext": null }, "value": "instanceof", - "start": 585, - "end": 595, + "start": 637, + "end": 647, "loc": { "start": { - "line": 21, + "line": 22, "column": 10 }, "end": { - "line": 21, + "line": 22, "column": 20 } } @@ -5463,15 +5467,15 @@ "binop": null }, "value": "Node", - "start": 596, - "end": 600, + "start": 648, + "end": 652, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 25 } } @@ -5488,15 +5492,15 @@ "postfix": false, "binop": null }, - "start": 600, - "end": 601, + "start": 652, + "end": 653, "loc": { "start": { - "line": 21, + "line": 22, "column": 25 }, "end": { - "line": 21, + "line": 22, "column": 26 } } @@ -5514,15 +5518,15 @@ "binop": null, "updateContext": null }, - "start": 601, - "end": 602, + "start": 653, + "end": 654, "loc": { "start": { - "line": 21, + "line": 22, "column": 26 }, "end": { - "line": 21, + "line": 22, "column": 27 } } @@ -5540,15 +5544,15 @@ "binop": null }, "value": "assert", - "start": 604, - "end": 610, + "start": 656, + "end": 662, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 } } @@ -5565,15 +5569,15 @@ "postfix": false, "binop": null }, - "start": 610, - "end": 611, + "start": 662, + "end": 663, "loc": { "start": { - "line": 22, + "line": 23, "column": 7 }, "end": { - "line": 22, + "line": 23, "column": 8 } } @@ -5591,15 +5595,15 @@ "binop": null }, "value": "n", - "start": 611, - "end": 612, + "start": 663, + "end": 664, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 } } @@ -5617,15 +5621,15 @@ "binop": null, "updateContext": null }, - "start": 612, - "end": 613, + "start": 664, + "end": 665, "loc": { "start": { - "line": 22, + "line": 23, "column": 9 }, "end": { - "line": 22, + "line": 23, "column": 10 } } @@ -5643,15 +5647,15 @@ "binop": null }, "value": "_color", - "start": 613, - "end": 619, + "start": 665, + "end": 671, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 16 } } @@ -5670,15 +5674,15 @@ "updateContext": null }, "value": "===", - "start": 620, - "end": 623, + "start": 672, + "end": 675, "loc": { "start": { - "line": 22, + "line": 23, "column": 17 }, "end": { - "line": 22, + "line": 23, "column": 20 } } @@ -5696,15 +5700,15 @@ "binop": null }, "value": "BLACK", - "start": 624, - "end": 629, + "start": 676, + "end": 681, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 26 } } @@ -5721,15 +5725,15 @@ "postfix": false, "binop": null }, - "start": 629, - "end": 630, + "start": 681, + "end": 682, "loc": { "start": { - "line": 22, + "line": 23, "column": 26 }, "end": { - "line": 22, + "line": 23, "column": 27 } } @@ -5747,15 +5751,15 @@ "binop": null, "updateContext": null }, - "start": 630, - "end": 631, + "start": 682, + "end": 683, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 28 } } @@ -5773,15 +5777,15 @@ "binop": null }, "value": "assert", - "start": 633, - "end": 639, + "start": 685, + "end": 691, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 } } @@ -5798,15 +5802,15 @@ "postfix": false, "binop": null }, - "start": 639, - "end": 640, + "start": 691, + "end": 692, "loc": { "start": { - "line": 23, + "line": 24, "column": 7 }, "end": { - "line": 23, + "line": 24, "column": 8 } } @@ -5824,15 +5828,15 @@ "binop": null }, "value": "n", - "start": 640, - "end": 641, + "start": 692, + "end": 693, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 } } @@ -5850,15 +5854,15 @@ "binop": null, "updateContext": null }, - "start": 641, - "end": 642, + "start": 693, + "end": 694, "loc": { "start": { - "line": 23, + "line": 24, "column": 9 }, "end": { - "line": 23, + "line": 24, "column": 10 } } @@ -5876,15 +5880,15 @@ "binop": null }, "value": "parent", - "start": 642, - "end": 648, + "start": 694, + "end": 700, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 } } @@ -5903,15 +5907,15 @@ "updateContext": null }, "value": "!==", - "start": 649, - "end": 652, + "start": 701, + "end": 704, "loc": { "start": { - "line": 23, + "line": 24, "column": 17 }, "end": { - "line": 23, + "line": 24, "column": 20 } } @@ -5931,15 +5935,15 @@ "updateContext": null }, "value": "null", - "start": 653, - "end": 657, + "start": 705, + "end": 709, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 25 } } @@ -5956,15 +5960,15 @@ "postfix": false, "binop": null }, - "start": 657, - "end": 658, + "start": 709, + "end": 710, "loc": { "start": { - "line": 23, + "line": 24, "column": 25 }, "end": { - "line": 23, + "line": 24, "column": 26 } } @@ -5982,15 +5986,15 @@ "binop": null, "updateContext": null }, - "start": 658, - "end": 659, + "start": 710, + "end": 711, "loc": { "start": { - "line": 23, + "line": 24, "column": 26 }, "end": { - "line": 23, + "line": 24, "column": 27 } } @@ -6010,15 +6014,15 @@ "updateContext": null }, "value": "const", - "start": 661, - "end": 666, + "start": 713, + "end": 718, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 6 } } @@ -6036,15 +6040,15 @@ "binop": null }, "value": "s", - "start": 667, - "end": 668, + "start": 719, + "end": 720, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 8 } } @@ -6063,15 +6067,15 @@ "updateContext": null }, "value": "=", - "start": 669, - "end": 670, + "start": 721, + "end": 722, "loc": { "start": { - "line": 24, + "line": 25, "column": 9 }, "end": { - "line": 24, + "line": 25, "column": 10 } } @@ -6089,15 +6093,15 @@ "binop": null }, "value": "sibling", - "start": 671, - "end": 678, + "start": 723, + "end": 730, "loc": { "start": { - "line": 24, + "line": 25, "column": 11 }, "end": { - "line": 24, + "line": 25, "column": 18 } } @@ -6114,15 +6118,15 @@ "postfix": false, "binop": null }, - "start": 678, - "end": 679, + "start": 730, + "end": 731, "loc": { "start": { - "line": 24, + "line": 25, "column": 18 }, "end": { - "line": 24, + "line": 25, "column": 19 } } @@ -6140,15 +6144,15 @@ "binop": null }, "value": "n", - "start": 679, - "end": 680, + "start": 731, + "end": 732, "loc": { "start": { - "line": 24, + "line": 25, "column": 19 }, "end": { - "line": 24, + "line": 25, "column": 20 } } @@ -6165,15 +6169,15 @@ "postfix": false, "binop": null }, - "start": 680, - "end": 681, + "start": 732, + "end": 733, "loc": { "start": { - "line": 24, + "line": 25, "column": 20 }, "end": { - "line": 24, + "line": 25, "column": 21 } } @@ -6191,15 +6195,15 @@ "binop": null, "updateContext": null }, - "start": 681, - "end": 682, + "start": 733, + "end": 734, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 22 } } @@ -6217,15 +6221,15 @@ "binop": null }, "value": "assert", - "start": 684, - "end": 690, + "start": 736, + "end": 742, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 } } @@ -6242,15 +6246,15 @@ "postfix": false, "binop": null }, - "start": 690, - "end": 691, + "start": 742, + "end": 743, "loc": { "start": { - "line": 25, + "line": 26, "column": 7 }, "end": { - "line": 25, + "line": 26, "column": 8 } } @@ -6268,15 +6272,15 @@ "binop": null }, "value": "s", - "start": 691, - "end": 692, + "start": 743, + "end": 744, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 } } @@ -6296,15 +6300,15 @@ "updateContext": null }, "value": "instanceof", - "start": 693, - "end": 703, + "start": 745, + "end": 755, "loc": { "start": { - "line": 25, + "line": 26, "column": 10 }, "end": { - "line": 25, + "line": 26, "column": 20 } } @@ -6322,15 +6326,15 @@ "binop": null }, "value": "Node", - "start": 704, - "end": 708, + "start": 756, + "end": 760, "loc": { "start": { - "line": 25, + "line": 26, "column": 21 }, "end": { - "line": 25, + "line": 26, "column": 25 } } @@ -6347,15 +6351,15 @@ "postfix": false, "binop": null }, - "start": 708, - "end": 709, + "start": 760, + "end": 761, "loc": { "start": { - "line": 25, + "line": 26, "column": 25 }, "end": { - "line": 25, + "line": 26, "column": 26 } } @@ -6373,15 +6377,15 @@ "binop": null, "updateContext": null }, - "start": 709, - "end": 710, + "start": 761, + "end": 762, "loc": { "start": { - "line": 25, + "line": 26, "column": 26 }, "end": { - "line": 25, + "line": 26, "column": 27 } } @@ -6399,15 +6403,15 @@ "binop": null }, "value": "assert", - "start": 712, - "end": 718, + "start": 764, + "end": 770, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 } } @@ -6424,15 +6428,15 @@ "postfix": false, "binop": null }, - "start": 718, - "end": 719, + "start": 770, + "end": 771, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 } } @@ -6450,15 +6454,15 @@ "binop": null }, "value": "s", - "start": 719, - "end": 720, + "start": 771, + "end": 772, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 } } @@ -6476,15 +6480,15 @@ "binop": null, "updateContext": null }, - "start": 720, - "end": 721, + "start": 772, + "end": 773, "loc": { "start": { - "line": 26, + "line": 27, "column": 9 }, "end": { - "line": 26, + "line": 27, "column": 10 } } @@ -6502,15 +6506,15 @@ "binop": null }, "value": "_color", - "start": 721, - "end": 727, + "start": 773, + "end": 779, "loc": { "start": { - "line": 26, + "line": 27, "column": 10 }, "end": { - "line": 26, + "line": 27, "column": 16 } } @@ -6529,15 +6533,15 @@ "updateContext": null }, "value": "===", - "start": 728, - "end": 731, + "start": 780, + "end": 783, "loc": { "start": { - "line": 26, + "line": 27, "column": 17 }, "end": { - "line": 26, + "line": 27, "column": 20 } } @@ -6555,15 +6559,15 @@ "binop": null }, "value": "BLACK", - "start": 732, - "end": 737, + "start": 784, + "end": 789, "loc": { "start": { - "line": 26, + "line": 27, "column": 21 }, "end": { - "line": 26, + "line": 27, "column": 26 } } @@ -6580,15 +6584,15 @@ "postfix": false, "binop": null }, - "start": 737, - "end": 738, + "start": 789, + "end": 790, "loc": { "start": { - "line": 26, + "line": 27, "column": 26 }, "end": { - "line": 26, + "line": 27, "column": 27 } } @@ -6606,15 +6610,15 @@ "binop": null, "updateContext": null }, - "start": 738, - "end": 739, + "start": 790, + "end": 791, "loc": { "start": { - "line": 26, + "line": 27, "column": 27 }, "end": { - "line": 26, + "line": 27, "column": 28 } } @@ -6622,15 +6626,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t ", - "start": 742, - "end": 1283, + "start": 794, + "end": 1335, "loc": { "start": { - "line": 28, + "line": 29, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 4 } } @@ -6650,15 +6654,15 @@ "updateContext": null }, "value": "if", - "start": 1285, - "end": 1287, + "start": 1337, + "end": 1339, "loc": { "start": { - "line": 41, + "line": 42, "column": 1 }, "end": { - "line": 41, + "line": 42, "column": 3 } } @@ -6675,15 +6679,15 @@ "postfix": false, "binop": null }, - "start": 1288, - "end": 1289, + "start": 1340, + "end": 1341, "loc": { "start": { - "line": 41, + "line": 42, "column": 4 }, "end": { - "line": 41, + "line": 42, "column": 5 } } @@ -6701,15 +6705,15 @@ "binop": null }, "value": "n", - "start": 1292, - "end": 1293, + "start": 1344, + "end": 1345, "loc": { "start": { - "line": 42, + "line": 43, "column": 2 }, "end": { - "line": 42, + "line": 43, "column": 3 } } @@ -6727,15 +6731,15 @@ "binop": null, "updateContext": null }, - "start": 1293, - "end": 1294, + "start": 1345, + "end": 1346, "loc": { "start": { - "line": 42, + "line": 43, "column": 3 }, "end": { - "line": 42, + "line": 43, "column": 4 } } @@ -6753,15 +6757,15 @@ "binop": null }, "value": "parent", - "start": 1294, - "end": 1300, + "start": 1346, + "end": 1352, "loc": { "start": { - "line": 42, + "line": 43, "column": 4 }, "end": { - "line": 42, + "line": 43, "column": 10 } } @@ -6779,15 +6783,15 @@ "binop": null, "updateContext": null }, - "start": 1300, - "end": 1301, + "start": 1352, + "end": 1353, "loc": { "start": { - "line": 42, + "line": 43, "column": 10 }, "end": { - "line": 42, + "line": 43, "column": 11 } } @@ -6805,15 +6809,15 @@ "binop": null }, "value": "_color", - "start": 1301, - "end": 1307, + "start": 1353, + "end": 1359, "loc": { "start": { - "line": 42, + "line": 43, "column": 11 }, "end": { - "line": 42, + "line": 43, "column": 17 } } @@ -6832,15 +6836,15 @@ "updateContext": null }, "value": "===", - "start": 1308, - "end": 1311, + "start": 1360, + "end": 1363, "loc": { "start": { - "line": 42, + "line": 43, "column": 18 }, "end": { - "line": 42, + "line": 43, "column": 21 } } @@ -6858,15 +6862,15 @@ "binop": null }, "value": "BLACK", - "start": 1312, - "end": 1317, + "start": 1364, + "end": 1369, "loc": { "start": { - "line": 42, + "line": 43, "column": 22 }, "end": { - "line": 42, + "line": 43, "column": 27 } } @@ -6885,15 +6889,15 @@ "updateContext": null }, "value": "&&", - "start": 1318, - "end": 1320, + "start": 1370, + "end": 1372, "loc": { "start": { - "line": 42, + "line": 43, "column": 28 }, "end": { - "line": 42, + "line": 43, "column": 30 } } @@ -6910,15 +6914,15 @@ "postfix": false, "binop": null }, - "start": 1323, - "end": 1324, + "start": 1375, + "end": 1376, "loc": { "start": { - "line": 43, + "line": 44, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 3 } } @@ -6936,15 +6940,15 @@ "binop": null }, "value": "s", - "start": 1324, - "end": 1325, + "start": 1376, + "end": 1377, "loc": { "start": { - "line": 43, + "line": 44, "column": 3 }, "end": { - "line": 43, + "line": 44, "column": 4 } } @@ -6962,15 +6966,15 @@ "binop": null, "updateContext": null }, - "start": 1325, - "end": 1326, + "start": 1377, + "end": 1378, "loc": { "start": { - "line": 43, + "line": 44, "column": 4 }, "end": { - "line": 43, + "line": 44, "column": 5 } } @@ -6988,15 +6992,15 @@ "binop": null }, "value": "left", - "start": 1326, - "end": 1330, + "start": 1378, + "end": 1382, "loc": { "start": { - "line": 43, + "line": 44, "column": 5 }, "end": { - "line": 43, + "line": 44, "column": 9 } } @@ -7015,15 +7019,15 @@ "updateContext": null }, "value": "===", - "start": 1331, - "end": 1334, + "start": 1383, + "end": 1386, "loc": { "start": { - "line": 43, + "line": 44, "column": 10 }, "end": { - "line": 43, + "line": 44, "column": 13 } } @@ -7043,15 +7047,15 @@ "updateContext": null }, "value": "null", - "start": 1335, - "end": 1339, + "start": 1387, + "end": 1391, "loc": { "start": { - "line": 43, + "line": 44, "column": 14 }, "end": { - "line": 43, + "line": 44, "column": 18 } } @@ -7070,15 +7074,15 @@ "updateContext": null }, "value": "||", - "start": 1340, - "end": 1342, + "start": 1392, + "end": 1394, "loc": { "start": { - "line": 43, + "line": 44, "column": 19 }, "end": { - "line": 43, + "line": 44, "column": 21 } } @@ -7096,15 +7100,15 @@ "binop": null }, "value": "s", - "start": 1343, - "end": 1344, + "start": 1395, + "end": 1396, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 23 } } @@ -7122,15 +7126,15 @@ "binop": null, "updateContext": null }, - "start": 1344, - "end": 1345, + "start": 1396, + "end": 1397, "loc": { "start": { - "line": 43, + "line": 44, "column": 23 }, "end": { - "line": 43, + "line": 44, "column": 24 } } @@ -7148,15 +7152,15 @@ "binop": null }, "value": "left", - "start": 1345, - "end": 1349, + "start": 1397, + "end": 1401, "loc": { "start": { - "line": 43, + "line": 44, "column": 24 }, "end": { - "line": 43, + "line": 44, "column": 28 } } @@ -7174,15 +7178,15 @@ "binop": null, "updateContext": null }, - "start": 1349, - "end": 1350, + "start": 1401, + "end": 1402, "loc": { "start": { - "line": 43, + "line": 44, "column": 28 }, "end": { - "line": 43, + "line": 44, "column": 29 } } @@ -7200,15 +7204,15 @@ "binop": null }, "value": "_color", - "start": 1350, - "end": 1356, + "start": 1402, + "end": 1408, "loc": { "start": { - "line": 43, + "line": 44, "column": 29 }, "end": { - "line": 43, + "line": 44, "column": 35 } } @@ -7227,15 +7231,15 @@ "updateContext": null }, "value": "===", - "start": 1357, - "end": 1360, + "start": 1409, + "end": 1412, "loc": { "start": { - "line": 43, + "line": 44, "column": 36 }, "end": { - "line": 43, + "line": 44, "column": 39 } } @@ -7253,15 +7257,15 @@ "binop": null }, "value": "BLACK", - "start": 1361, - "end": 1366, + "start": 1413, + "end": 1418, "loc": { "start": { - "line": 43, + "line": 44, "column": 40 }, "end": { - "line": 43, + "line": 44, "column": 45 } } @@ -7278,15 +7282,15 @@ "postfix": false, "binop": null }, - "start": 1366, - "end": 1367, + "start": 1418, + "end": 1419, "loc": { "start": { - "line": 43, + "line": 44, "column": 45 }, "end": { - "line": 43, + "line": 44, "column": 46 } } @@ -7305,15 +7309,15 @@ "updateContext": null }, "value": "&&", - "start": 1368, - "end": 1370, + "start": 1420, + "end": 1422, "loc": { "start": { - "line": 43, + "line": 44, "column": 47 }, "end": { - "line": 43, + "line": 44, "column": 49 } } @@ -7330,15 +7334,15 @@ "postfix": false, "binop": null }, - "start": 1373, - "end": 1374, + "start": 1425, + "end": 1426, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 3 } } @@ -7356,15 +7360,15 @@ "binop": null }, "value": "s", - "start": 1374, - "end": 1375, + "start": 1426, + "end": 1427, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 4 } } @@ -7382,15 +7386,15 @@ "binop": null, "updateContext": null }, - "start": 1375, - "end": 1376, + "start": 1427, + "end": 1428, "loc": { "start": { - "line": 44, + "line": 45, "column": 4 }, "end": { - "line": 44, + "line": 45, "column": 5 } } @@ -7408,15 +7412,15 @@ "binop": null }, "value": "right", - "start": 1376, - "end": 1381, + "start": 1428, + "end": 1433, "loc": { "start": { - "line": 44, + "line": 45, "column": 5 }, "end": { - "line": 44, + "line": 45, "column": 10 } } @@ -7435,15 +7439,15 @@ "updateContext": null }, "value": "===", - "start": 1382, - "end": 1385, + "start": 1434, + "end": 1437, "loc": { "start": { - "line": 44, + "line": 45, "column": 11 }, "end": { - "line": 44, + "line": 45, "column": 14 } } @@ -7463,15 +7467,15 @@ "updateContext": null }, "value": "null", - "start": 1386, - "end": 1390, + "start": 1438, + "end": 1442, "loc": { "start": { - "line": 44, + "line": 45, "column": 15 }, "end": { - "line": 44, + "line": 45, "column": 19 } } @@ -7490,15 +7494,15 @@ "updateContext": null }, "value": "||", - "start": 1391, - "end": 1393, + "start": 1443, + "end": 1445, "loc": { "start": { - "line": 44, + "line": 45, "column": 20 }, "end": { - "line": 44, + "line": 45, "column": 22 } } @@ -7516,15 +7520,15 @@ "binop": null }, "value": "s", - "start": 1394, - "end": 1395, + "start": 1446, + "end": 1447, "loc": { "start": { - "line": 44, + "line": 45, "column": 23 }, "end": { - "line": 44, + "line": 45, "column": 24 } } @@ -7542,15 +7546,15 @@ "binop": null, "updateContext": null }, - "start": 1395, - "end": 1396, + "start": 1447, + "end": 1448, "loc": { "start": { - "line": 44, + "line": 45, "column": 24 }, "end": { - "line": 44, + "line": 45, "column": 25 } } @@ -7568,15 +7572,15 @@ "binop": null }, "value": "right", - "start": 1396, - "end": 1401, + "start": 1448, + "end": 1453, "loc": { "start": { - "line": 44, + "line": 45, "column": 25 }, "end": { - "line": 44, + "line": 45, "column": 30 } } @@ -7594,15 +7598,15 @@ "binop": null, "updateContext": null }, - "start": 1401, - "end": 1402, + "start": 1453, + "end": 1454, "loc": { "start": { - "line": 44, + "line": 45, "column": 30 }, "end": { - "line": 44, + "line": 45, "column": 31 } } @@ -7620,15 +7624,15 @@ "binop": null }, "value": "_color", - "start": 1402, - "end": 1408, + "start": 1454, + "end": 1460, "loc": { "start": { - "line": 44, + "line": 45, "column": 31 }, "end": { - "line": 44, + "line": 45, "column": 37 } } @@ -7647,15 +7651,15 @@ "updateContext": null }, "value": "===", - "start": 1409, - "end": 1412, + "start": 1461, + "end": 1464, "loc": { "start": { - "line": 44, + "line": 45, "column": 38 }, "end": { - "line": 44, + "line": 45, "column": 41 } } @@ -7673,15 +7677,15 @@ "binop": null }, "value": "BLACK", - "start": 1413, - "end": 1418, + "start": 1465, + "end": 1470, "loc": { "start": { - "line": 44, + "line": 45, "column": 42 }, "end": { - "line": 44, + "line": 45, "column": 47 } } @@ -7698,15 +7702,15 @@ "postfix": false, "binop": null }, - "start": 1418, - "end": 1419, + "start": 1470, + "end": 1471, "loc": { "start": { - "line": 44, + "line": 45, "column": 47 }, "end": { - "line": 44, + "line": 45, "column": 48 } } @@ -7723,15 +7727,15 @@ "postfix": false, "binop": null }, - "start": 1421, - "end": 1422, + "start": 1473, + "end": 1474, "loc": { "start": { - "line": 45, + "line": 46, "column": 1 }, "end": { - "line": 45, + "line": 46, "column": 2 } } @@ -7748,15 +7752,15 @@ "postfix": false, "binop": null }, - "start": 1423, - "end": 1424, + "start": 1475, + "end": 1476, "loc": { "start": { - "line": 45, + "line": 46, "column": 3 }, "end": { - "line": 45, + "line": 46, "column": 4 } } @@ -7774,15 +7778,15 @@ "binop": null }, "value": "s", - "start": 1427, - "end": 1428, + "start": 1479, + "end": 1480, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 3 } } @@ -7800,15 +7804,15 @@ "binop": null, "updateContext": null }, - "start": 1428, - "end": 1429, + "start": 1480, + "end": 1481, "loc": { "start": { - "line": 46, + "line": 47, "column": 3 }, "end": { - "line": 46, + "line": 47, "column": 4 } } @@ -7826,15 +7830,15 @@ "binop": null }, "value": "_color", - "start": 1429, - "end": 1435, + "start": 1481, + "end": 1487, "loc": { "start": { - "line": 46, + "line": 47, "column": 4 }, "end": { - "line": 46, + "line": 47, "column": 10 } } @@ -7853,15 +7857,15 @@ "updateContext": null }, "value": "=", - "start": 1436, - "end": 1437, + "start": 1488, + "end": 1489, "loc": { "start": { - "line": 46, + "line": 47, "column": 11 }, "end": { - "line": 46, + "line": 47, "column": 12 } } @@ -7879,15 +7883,15 @@ "binop": null }, "value": "RED", - "start": 1438, - "end": 1441, + "start": 1490, + "end": 1493, "loc": { "start": { - "line": 46, + "line": 47, "column": 13 }, "end": { - "line": 46, + "line": 47, "column": 16 } } @@ -7905,19 +7909,47 @@ "binop": null, "updateContext": null }, - "start": 1441, - "end": 1442, + "start": 1493, + "end": 1494, "loc": { "start": { - "line": 46, + "line": 47, "column": 16 }, "end": { - "line": 46, + "line": 47, "column": 17 } } }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 1497, + "end": 1503, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 8 + } + } + }, { "type": { "label": "name", @@ -7931,16 +7963,16 @@ "binop": null }, "value": "delete_case0", - "start": 1445, - "end": 1457, + "start": 1504, + "end": 1516, "loc": { "start": { - "line": 47, - "column": 2 + "line": 48, + "column": 9 }, "end": { - "line": 47, - "column": 14 + "line": 48, + "column": 21 } } }, @@ -7956,16 +7988,16 @@ "postfix": false, "binop": null }, - "start": 1457, - "end": 1458, + "start": 1516, + "end": 1517, "loc": { "start": { - "line": 47, - "column": 14 + "line": 48, + "column": 21 }, "end": { - "line": 47, - "column": 15 + "line": 48, + "column": 22 } } }, @@ -7982,16 +8014,16 @@ "binop": null }, "value": "n", - "start": 1458, - "end": 1459, + "start": 1517, + "end": 1518, "loc": { "start": { - "line": 47, - "column": 15 + "line": 48, + "column": 22 }, "end": { - "line": 47, - "column": 16 + "line": 48, + "column": 23 } } }, @@ -8008,16 +8040,16 @@ "binop": null, "updateContext": null }, - "start": 1459, - "end": 1460, + "start": 1518, + "end": 1519, "loc": { "start": { - "line": 47, - "column": 16 + "line": 48, + "column": 23 }, "end": { - "line": 47, - "column": 17 + "line": 48, + "column": 24 } } }, @@ -8034,16 +8066,16 @@ "binop": null }, "value": "parent", - "start": 1460, - "end": 1466, + "start": 1519, + "end": 1525, "loc": { "start": { - "line": 47, - "column": 17 + "line": 48, + "column": 24 }, "end": { - "line": 47, - "column": 23 + "line": 48, + "column": 30 } } }, @@ -8059,16 +8091,16 @@ "postfix": false, "binop": null }, - "start": 1466, - "end": 1467, + "start": 1525, + "end": 1526, "loc": { "start": { - "line": 47, - "column": 23 + "line": 48, + "column": 30 }, "end": { - "line": 47, - "column": 24 + "line": 48, + "column": 31 } } }, @@ -8085,16 +8117,16 @@ "binop": null, "updateContext": null }, - "start": 1467, - "end": 1468, + "start": 1526, + "end": 1527, "loc": { "start": { - "line": 47, - "column": 24 + "line": 48, + "column": 31 }, "end": { - "line": 47, - "column": 25 + "line": 48, + "column": 32 } } }, @@ -8110,15 +8142,15 @@ "postfix": false, "binop": null }, - "start": 1470, - "end": 1471, + "start": 1529, + "end": 1530, "loc": { "start": { - "line": 48, + "line": 49, "column": 1 }, "end": { - "line": 48, + "line": 49, "column": 2 } } @@ -8126,23 +8158,23 @@ { "type": "CommentLine", "value": " Otherwise, go to case 3.", - "start": 1474, - "end": 1501, + "start": 1533, + "end": 1560, "loc": { "start": { - "line": 50, + "line": 51, "column": 1 }, "end": { - "line": 50, + "line": 51, "column": 28 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": "return", + "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8153,17 +8185,17 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1503, - "end": 1507, + "value": "return", + "start": 1562, + "end": 1568, "loc": { "start": { - "line": 51, + "line": 52, "column": 1 }, "end": { - "line": 51, - "column": 5 + "line": 52, + "column": 7 } } }, @@ -8180,16 +8212,16 @@ "binop": null }, "value": "delete_case3", - "start": 1508, - "end": 1520, + "start": 1569, + "end": 1581, "loc": { "start": { - "line": 51, - "column": 6 + "line": 52, + "column": 8 }, "end": { - "line": 51, - "column": 18 + "line": 52, + "column": 20 } } }, @@ -8205,16 +8237,16 @@ "postfix": false, "binop": null }, - "start": 1520, - "end": 1521, + "start": 1581, + "end": 1582, "loc": { "start": { - "line": 51, - "column": 18 + "line": 52, + "column": 20 }, "end": { - "line": 51, - "column": 19 + "line": 52, + "column": 21 } } }, @@ -8231,16 +8263,16 @@ "binop": null }, "value": "n", - "start": 1521, - "end": 1522, + "start": 1582, + "end": 1583, "loc": { "start": { - "line": 51, - "column": 19 + "line": 52, + "column": 21 }, "end": { - "line": 51, - "column": 20 + "line": 52, + "column": 22 } } }, @@ -8256,16 +8288,16 @@ "postfix": false, "binop": null }, - "start": 1522, - "end": 1523, + "start": 1583, + "end": 1584, "loc": { "start": { - "line": 51, - "column": 20 + "line": 52, + "column": 22 }, "end": { - "line": 51, - "column": 21 + "line": 52, + "column": 23 } } }, @@ -8282,16 +8314,16 @@ "binop": null, "updateContext": null }, - "start": 1523, - "end": 1524, + "start": 1584, + "end": 1585, "loc": { "start": { - "line": 51, - "column": 21 + "line": 52, + "column": 23 }, "end": { - "line": 51, - "column": 22 + "line": 52, + "column": 24 } } }, @@ -8307,15 +8339,15 @@ "postfix": false, "binop": null }, - "start": 1525, - "end": 1526, + "start": 1586, + "end": 1587, "loc": { "start": { - "line": 52, + "line": 53, "column": 0 }, "end": { - "line": 52, + "line": 53, "column": 1 } } @@ -8333,15 +8365,15 @@ "binop": null, "updateContext": null }, - "start": 1526, - "end": 1527, + "start": 1587, + "end": 1588, "loc": { "start": { - "line": 52, + "line": 53, "column": 1 }, "end": { - "line": 52, + "line": 53, "column": 2 } } @@ -8361,15 +8393,15 @@ "updateContext": null }, "value": "export", - "start": 1529, - "end": 1535, + "start": 1590, + "end": 1596, "loc": { "start": { - "line": 54, + "line": 55, "column": 0 }, "end": { - "line": 54, + "line": 55, "column": 6 } } @@ -8389,15 +8421,15 @@ "updateContext": null }, "value": "default", - "start": 1536, - "end": 1543, + "start": 1597, + "end": 1604, "loc": { "start": { - "line": 54, + "line": 55, "column": 7 }, "end": { - "line": 54, + "line": 55, "column": 14 } } @@ -8415,15 +8447,15 @@ "binop": null }, "value": "delete_case2", - "start": 1544, - "end": 1556, + "start": 1605, + "end": 1617, "loc": { "start": { - "line": 54, + "line": 55, "column": 15 }, "end": { - "line": 54, + "line": 55, "column": 27 } } @@ -8441,15 +8473,15 @@ "binop": null, "updateContext": null }, - "start": 1556, - "end": 1557, + "start": 1617, + "end": 1618, "loc": { "start": { - "line": 54, + "line": 55, "column": 27 }, "end": { - "line": 54, + "line": 55, "column": 28 } } @@ -8467,15 +8499,15 @@ "binop": null, "updateContext": null }, - "start": 1558, - "end": 1558, + "start": 1619, + "end": 1619, "loc": { "start": { - "line": 55, + "line": 56, "column": 0 }, "end": { - "line": 55, + "line": 56, "column": 0 } } diff --git a/ast/source/deletion/delete_case5.js.json b/ast/source/deletion/delete_case5.js.json index 2e9f926..dfcb7a6 100644 --- a/ast/source/deletion/delete_case5.js.json +++ b/ast/source/deletion/delete_case5.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1898, + "end": 2067, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 65, + "line": 69, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1898, + "end": 2067, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 65, + "line": 69, "column": 0 } }, @@ -513,16 +513,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 291, - "end": 691, + "end": 743, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 3 } } @@ -531,44 +531,44 @@ }, { "type": "Identifier", - "start": 692, - "end": 1867, + "start": 744, + "end": 2036, "loc": { "start": { - "line": 21, + "line": 22, "column": 0 }, "end": { - "line": 62, + "line": 66, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 698, - "end": 1866, + "start": 750, + "end": 2035, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 62, + "line": 66, "column": 1 } }, "id": { "type": "Identifier", - "start": 698, - "end": 710, + "start": 750, + "end": 762, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 18 }, "identifierName": "delete_case5" @@ -578,15 +578,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 713, - "end": 1866, + "start": 765, + "end": 2035, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 62, + "line": 66, "column": 1 } }, @@ -597,15 +597,15 @@ "params": [ { "type": "Identifier", - "start": 714, - "end": 715, + "start": 766, + "end": 767, "loc": { "start": { - "line": 21, + "line": 22, "column": 22 }, "end": { - "line": 21, + "line": 22, "column": 23 }, "identifierName": "n" @@ -615,58 +615,58 @@ ], "body": { "type": "BlockStatement", - "start": 720, - "end": 1866, + "start": 772, + "end": 2035, "loc": { "start": { - "line": 21, + "line": 22, "column": 28 }, "end": { - "line": 62, + "line": 66, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 723, - "end": 749, + "start": 775, + "end": 801, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 723, - "end": 748, + "start": 775, + "end": 800, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 723, - "end": 729, + "start": 775, + "end": 781, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -676,29 +676,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 730, - "end": 747, + "start": 782, + "end": 799, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 730, - "end": 731, + "start": 782, + "end": 783, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -708,15 +708,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 743, - "end": 747, + "start": 795, + "end": 799, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -729,43 +729,43 @@ }, { "type": "ExpressionStatement", - "start": 751, - "end": 778, + "start": 803, + "end": 830, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 751, - "end": 777, + "start": 803, + "end": 829, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 27 } }, "callee": { "type": "Identifier", - "start": 751, - "end": 757, + "start": 803, + "end": 809, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -775,43 +775,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 758, - "end": 776, + "start": 810, + "end": 828, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 758, - "end": 766, + "start": 810, + "end": 818, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 758, - "end": 759, + "start": 810, + "end": 811, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -820,15 +820,15 @@ }, "property": { "type": "Identifier", - "start": 760, - "end": 766, + "start": 812, + "end": 818, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 }, "identifierName": "_color" @@ -840,15 +840,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 771, - "end": 776, + "start": 823, + "end": 828, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 26 }, "identifierName": "BLACK" @@ -861,43 +861,43 @@ }, { "type": "ExpressionStatement", - "start": 780, - "end": 806, + "start": 832, + "end": 858, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 780, - "end": 805, + "start": 832, + "end": 857, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 26 } }, "callee": { "type": "Identifier", - "start": 780, - "end": 786, + "start": 832, + "end": 838, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -907,43 +907,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 787, - "end": 804, + "start": 839, + "end": 856, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 787, - "end": 795, + "start": 839, + "end": 847, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 16 } }, "object": { "type": "Identifier", - "start": 787, - "end": 788, + "start": 839, + "end": 840, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 }, "identifierName": "n" @@ -952,15 +952,15 @@ }, "property": { "type": "Identifier", - "start": 789, - "end": 795, + "start": 841, + "end": 847, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 }, "identifierName": "parent" @@ -972,15 +972,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 800, - "end": 804, + "start": 852, + "end": 856, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -991,44 +991,44 @@ }, { "type": "VariableDeclaration", - "start": 808, - "end": 829, + "start": 860, + "end": 881, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 814, - "end": 828, + "start": 866, + "end": 880, "loc": { "start": { - "line": 25, + "line": 26, "column": 7 }, "end": { - "line": 25, + "line": 26, "column": 21 } }, "id": { "type": "Identifier", - "start": 814, - "end": 815, + "start": 866, + "end": 867, "loc": { "start": { - "line": 25, + "line": 26, "column": 7 }, "end": { - "line": 25, + "line": 26, "column": 8 }, "identifierName": "s" @@ -1037,29 +1037,29 @@ }, "init": { "type": "CallExpression", - "start": 818, - "end": 828, + "start": 870, + "end": 880, "loc": { "start": { - "line": 25, + "line": 26, "column": 11 }, "end": { - "line": 25, + "line": 26, "column": 21 } }, "callee": { "type": "Identifier", - "start": 818, - "end": 825, + "start": 870, + "end": 877, "loc": { "start": { - "line": 25, + "line": 26, "column": 11 }, "end": { - "line": 25, + "line": 26, "column": 18 }, "identifierName": "sibling" @@ -1069,15 +1069,15 @@ "arguments": [ { "type": "Identifier", - "start": 826, - "end": 827, + "start": 878, + "end": 879, "loc": { "start": { - "line": 25, + "line": 26, "column": 19 }, "end": { - "line": 25, + "line": 26, "column": 20 }, "identifierName": "n" @@ -1092,43 +1092,43 @@ }, { "type": "ExpressionStatement", - "start": 831, - "end": 857, + "start": 883, + "end": 909, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 831, - "end": 856, + "start": 883, + "end": 908, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 26 } }, "callee": { "type": "Identifier", - "start": 831, - "end": 837, + "start": 883, + "end": 889, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -1138,29 +1138,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 838, - "end": 855, + "start": 890, + "end": 907, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 25 } }, "left": { "type": "Identifier", - "start": 838, - "end": 839, + "start": 890, + "end": 891, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 }, "identifierName": "s" @@ -1170,15 +1170,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 851, - "end": 855, + "start": 903, + "end": 907, "loc": { "start": { - "line": 26, + "line": 27, "column": 21 }, "end": { - "line": 26, + "line": 27, "column": 25 }, "identifierName": "Node" @@ -1191,43 +1191,43 @@ }, { "type": "ExpressionStatement", - "start": 859, - "end": 886, + "start": 911, + "end": 938, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 859, - "end": 885, + "start": 911, + "end": 937, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 27 } }, "callee": { "type": "Identifier", - "start": 859, - "end": 865, + "start": 911, + "end": 917, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 7 }, "identifierName": "assert" @@ -1237,43 +1237,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 866, - "end": 884, + "start": 918, + "end": 936, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 866, - "end": 874, + "start": 918, + "end": 926, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 16 } }, "object": { "type": "Identifier", - "start": 866, - "end": 867, + "start": 918, + "end": 919, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 9 }, "identifierName": "s" @@ -1282,15 +1282,15 @@ }, "property": { "type": "Identifier", - "start": 868, - "end": 874, + "start": 920, + "end": 926, "loc": { "start": { - "line": 27, + "line": 28, "column": 10 }, "end": { - "line": 27, + "line": 28, "column": 16 }, "identifierName": "_color" @@ -1302,15 +1302,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 879, - "end": 884, + "start": 931, + "end": 936, "loc": { "start": { - "line": 27, + "line": 28, "column": 21 }, "end": { - "line": 27, + "line": 28, "column": 26 }, "identifierName": "BLACK" @@ -1323,76 +1323,92 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 889, - "end": 1576, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * swapping the colors of n's parent and n's sibling and\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaf paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 941, + "end": 1685, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 45, + "line": 47, "column": 4 } } + }, + { + "type": "CommentLine", + "value": " Swap the color of the parent and the sibling.", + "start": 1688, + "end": 1736, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 49 + } + } } ] }, { "type": "ExpressionStatement", - "start": 1579, - "end": 1606, + "start": 1738, + "end": 1765, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 28 } }, "expression": { "type": "AssignmentExpression", - "start": 1579, - "end": 1605, + "start": 1738, + "end": 1764, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 27 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1579, - "end": 1587, + "start": 1738, + "end": 1746, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 9 } }, "object": { "type": "Identifier", - "start": 1579, - "end": 1580, + "start": 1738, + "end": 1739, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 2 }, "identifierName": "s" @@ -1402,15 +1418,15 @@ }, "property": { "type": "Identifier", - "start": 1581, - "end": 1587, + "start": 1740, + "end": 1746, "loc": { "start": { - "line": 47, + "line": 50, "column": 3 }, "end": { - "line": 47, + "line": 50, "column": 9 }, "identifierName": "_color" @@ -1422,43 +1438,43 @@ }, "right": { "type": "MemberExpression", - "start": 1590, - "end": 1605, + "start": 1749, + "end": 1764, "loc": { "start": { - "line": 47, + "line": 50, "column": 12 }, "end": { - "line": 47, + "line": 50, "column": 27 } }, "object": { "type": "MemberExpression", - "start": 1590, - "end": 1598, + "start": 1749, + "end": 1757, "loc": { "start": { - "line": 47, + "line": 50, "column": 12 }, "end": { - "line": 47, + "line": 50, "column": 20 } }, "object": { "type": "Identifier", - "start": 1590, - "end": 1591, + "start": 1749, + "end": 1750, "loc": { "start": { - "line": 47, + "line": 50, "column": 12 }, "end": { - "line": 47, + "line": 50, "column": 13 }, "identifierName": "n" @@ -1467,15 +1483,15 @@ }, "property": { "type": "Identifier", - "start": 1592, - "end": 1598, + "start": 1751, + "end": 1757, "loc": { "start": { - "line": 47, + "line": 50, "column": 14 }, "end": { - "line": 47, + "line": 50, "column": 20 }, "identifierName": "parent" @@ -1486,15 +1502,15 @@ }, "property": { "type": "Identifier", - "start": 1599, - "end": 1605, + "start": 1758, + "end": 1764, "loc": { "start": { - "line": 47, + "line": 50, "column": 21 }, "end": { - "line": 47, + "line": 50, "column": 27 }, "identifierName": "_color" @@ -1508,90 +1524,106 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 889, - "end": 1576, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * swapping the colors of n's parent and n's sibling and\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaf paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 941, + "end": 1685, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 45, + "line": 47, "column": 4 } } + }, + { + "type": "CommentLine", + "value": " Swap the color of the parent and the sibling.", + "start": 1688, + "end": 1736, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 49 + } + } } ] }, { "type": "ExpressionStatement", - "start": 1608, - "end": 1632, + "start": 1767, + "end": 1791, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 1608, - "end": 1631, + "start": 1767, + "end": 1790, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1608, - "end": 1623, + "start": 1767, + "end": 1782, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 16 } }, "object": { "type": "MemberExpression", - "start": 1608, - "end": 1616, + "start": 1767, + "end": 1775, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 9 } }, "object": { "type": "Identifier", - "start": 1608, - "end": 1609, + "start": 1767, + "end": 1768, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 2 }, "identifierName": "n" @@ -1600,15 +1632,15 @@ }, "property": { "type": "Identifier", - "start": 1610, - "end": 1616, + "start": 1769, + "end": 1775, "loc": { "start": { - "line": 48, + "line": 51, "column": 3 }, "end": { - "line": 48, + "line": 51, "column": 9 }, "identifierName": "parent" @@ -1619,15 +1651,15 @@ }, "property": { "type": "Identifier", - "start": 1617, - "end": 1623, + "start": 1776, + "end": 1782, "loc": { "start": { - "line": 48, + "line": 51, "column": 10 }, "end": { - "line": 48, + "line": 51, "column": 16 }, "identifierName": "_color" @@ -1638,15 +1670,15 @@ }, "right": { "type": "Identifier", - "start": 1626, - "end": 1631, + "start": 1785, + "end": 1790, "loc": { "start": { - "line": 48, + "line": 51, "column": 19 }, "end": { - "line": 48, + "line": 51, "column": 24 }, "identifierName": "BLACK" @@ -1657,43 +1689,43 @@ }, { "type": "IfStatement", - "start": 1635, - "end": 1864, + "start": 1794, + "end": 1920, "loc": { "start": { - "line": 50, + "line": 53, "column": 1 }, "end": { - "line": 61, + "line": 58, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 1639, - "end": 1658, + "start": 1798, + "end": 1817, "loc": { "start": { - "line": 50, + "line": 53, "column": 5 }, "end": { - "line": 50, + "line": 53, "column": 24 } }, "left": { "type": "Identifier", - "start": 1639, - "end": 1640, + "start": 1798, + "end": 1799, "loc": { "start": { - "line": 50, + "line": 53, "column": 5 }, "end": { - "line": 50, + "line": 53, "column": 6 }, "identifierName": "n" @@ -1703,43 +1735,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 1645, - "end": 1658, + "start": 1804, + "end": 1817, "loc": { "start": { - "line": 50, + "line": 53, "column": 11 }, "end": { - "line": 50, + "line": 53, "column": 24 } }, "object": { "type": "MemberExpression", - "start": 1645, - "end": 1653, + "start": 1804, + "end": 1812, "loc": { "start": { - "line": 50, + "line": 53, "column": 11 }, "end": { - "line": 50, + "line": 53, "column": 19 } }, "object": { "type": "Identifier", - "start": 1645, - "end": 1646, + "start": 1804, + "end": 1805, "loc": { "start": { - "line": 50, + "line": 53, "column": 11 }, "end": { - "line": 50, + "line": 53, "column": 12 }, "identifierName": "n" @@ -1748,15 +1780,15 @@ }, "property": { "type": "Identifier", - "start": 1647, - "end": 1653, + "start": 1806, + "end": 1812, "loc": { "start": { - "line": 50, + "line": 53, "column": 13 }, "end": { - "line": 50, + "line": 53, "column": 19 }, "identifierName": "parent" @@ -1767,15 +1799,15 @@ }, "property": { "type": "Identifier", - "start": 1654, - "end": 1658, + "start": 1813, + "end": 1817, "loc": { "start": { - "line": 50, + "line": 53, "column": 20 }, "end": { - "line": 50, + "line": 53, "column": 24 }, "identifierName": "left" @@ -1787,58 +1819,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 1660, - "end": 1749, + "start": 1819, + "end": 1920, "loc": { "start": { - "line": 50, + "line": 53, "column": 26 }, "end": { - "line": 54, + "line": 58, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1664, - "end": 1695, + "start": 1823, + "end": 1854, "loc": { "start": { - "line": 51, + "line": 54, "column": 2 }, "end": { - "line": 51, + "line": 54, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 1664, - "end": 1694, + "start": 1823, + "end": 1853, "loc": { "start": { - "line": 51, + "line": 54, "column": 2 }, "end": { - "line": 51, + "line": 54, "column": 32 } }, "callee": { "type": "Identifier", - "start": 1664, - "end": 1670, + "start": 1823, + "end": 1829, "loc": { "start": { - "line": 51, + "line": 54, "column": 2 }, "end": { - "line": 51, + "line": 54, "column": 8 }, "identifierName": "assert" @@ -1848,57 +1880,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1671, - "end": 1693, + "start": 1830, + "end": 1852, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 1671, - "end": 1685, + "start": 1830, + "end": 1844, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 1671, - "end": 1678, + "start": 1830, + "end": 1837, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 16 } }, "object": { "type": "Identifier", - "start": 1671, - "end": 1672, + "start": 1830, + "end": 1831, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 10 }, "identifierName": "s" @@ -1907,15 +1939,15 @@ }, "property": { "type": "Identifier", - "start": 1673, - "end": 1678, + "start": 1832, + "end": 1837, "loc": { "start": { - "line": 51, + "line": 54, "column": 11 }, "end": { - "line": 51, + "line": 54, "column": 16 }, "identifierName": "right" @@ -1926,15 +1958,15 @@ }, "property": { "type": "Identifier", - "start": 1679, - "end": 1685, + "start": 1838, + "end": 1844, "loc": { "start": { - "line": 51, + "line": 54, "column": 17 }, "end": { - "line": 51, + "line": 54, "column": 23 }, "identifierName": "_color" @@ -1946,15 +1978,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1690, - "end": 1693, + "start": 1849, + "end": 1852, "loc": { "start": { - "line": 51, + "line": 54, "column": 28 }, "end": { - "line": 51, + "line": 54, "column": 31 }, "identifierName": "RED" @@ -1967,72 +1999,72 @@ }, { "type": "ExpressionStatement", - "start": 1698, - "end": 1721, + "start": 1857, + "end": 1880, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 1698, - "end": 1720, + "start": 1857, + "end": 1879, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1698, - "end": 1712, + "start": 1857, + "end": 1871, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 16 } }, "object": { "type": "MemberExpression", - "start": 1698, - "end": 1705, + "start": 1857, + "end": 1864, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 9 } }, "object": { "type": "Identifier", - "start": 1698, - "end": 1699, + "start": 1857, + "end": 1858, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 3 }, "identifierName": "s" @@ -2041,15 +2073,15 @@ }, "property": { "type": "Identifier", - "start": 1700, - "end": 1705, + "start": 1859, + "end": 1864, "loc": { "start": { - "line": 52, + "line": 55, "column": 4 }, "end": { - "line": 52, + "line": 55, "column": 9 }, "identifierName": "right" @@ -2060,15 +2092,15 @@ }, "property": { "type": "Identifier", - "start": 1706, - "end": 1712, + "start": 1865, + "end": 1871, "loc": { "start": { - "line": 52, + "line": 55, "column": 10 }, "end": { - "line": 52, + "line": 55, "column": 16 }, "identifierName": "_color" @@ -2079,15 +2111,15 @@ }, "right": { "type": "Identifier", - "start": 1715, - "end": 1720, + "start": 1874, + "end": 1879, "loc": { "start": { - "line": 52, + "line": 55, "column": 19 }, "end": { - "line": 52, + "line": 55, "column": 24 }, "identifierName": "BLACK" @@ -2098,43 +2130,43 @@ }, { "type": "ExpressionStatement", - "start": 1724, - "end": 1746, + "start": 1883, + "end": 1905, "loc": { "start": { - "line": 53, + "line": 56, "column": 2 }, "end": { - "line": 53, + "line": 56, "column": 24 } }, "expression": { "type": "CallExpression", - "start": 1724, - "end": 1745, + "start": 1883, + "end": 1904, "loc": { "start": { - "line": 53, + "line": 56, "column": 2 }, "end": { - "line": 53, + "line": 56, "column": 23 } }, "callee": { "type": "Identifier", - "start": 1724, - "end": 1735, + "start": 1883, + "end": 1894, "loc": { "start": { - "line": 53, + "line": 56, "column": 2 }, "end": { - "line": 53, + "line": 56, "column": 13 }, "identifierName": "rotate_left" @@ -2144,29 +2176,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 1736, - "end": 1744, + "start": 1895, + "end": 1903, "loc": { "start": { - "line": 53, + "line": 56, "column": 14 }, "end": { - "line": 53, + "line": 56, "column": 22 } }, "object": { "type": "Identifier", - "start": 1736, - "end": 1737, + "start": 1895, + "end": 1896, "loc": { "start": { - "line": 53, + "line": 56, "column": 14 }, "end": { - "line": 53, + "line": 56, "column": 15 }, "identifierName": "n" @@ -2175,15 +2207,15 @@ }, "property": { "type": "Identifier", - "start": 1738, - "end": 1744, + "start": 1897, + "end": 1903, "loc": { "start": { - "line": 53, + "line": 56, "column": 16 }, "end": { - "line": 53, + "line": 56, "column": 22 }, "identifierName": "parent" @@ -2194,462 +2226,509 @@ } ] } - } - ], - "directives": [], - "trailingComments": [ + }, { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1752, - "end": 1769, + "type": "ReturnStatement", + "start": 1908, + "end": 1917, "loc": { "start": { - "line": 56, - "column": 1 + "line": 57, + "column": 2 }, "end": { - "line": 56, - "column": 18 + "line": 57, + "column": 11 } + }, + "argument": { + "type": "Identifier", + "start": 1915, + "end": 1916, + "loc": { + "start": { + "line": 57, + "column": 9 + }, + "end": { + "line": 57, + "column": 10 + }, + "identifierName": "s" + }, + "name": "s" } } - ] + ], + "directives": [], + "trailingComments": null }, - "alternate": { - "type": "BlockStatement", - "start": 1776, - "end": 1864, + "alternate": null, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1923, + "end": 1940, + "loc": { + "start": { + "line": 60, + "column": 1 + }, + "end": { + "line": 60, + "column": 18 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1943, + "end": 1973, + "loc": { + "start": { + "line": 62, + "column": 1 + }, + "end": { + "line": 62, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 1943, + "end": 1972, "loc": { "start": { - "line": 57, - "column": 6 + "line": 62, + "column": 1 }, "end": { - "line": 61, - "column": 2 + "line": 62, + "column": 30 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1780, - "end": 1810, - "loc": { - "start": { - "line": 58, - "column": 2 - }, - "end": { - "line": 58, - "column": 32 - } + "callee": { + "type": "Identifier", + "start": 1943, + "end": 1949, + "loc": { + "start": { + "line": 62, + "column": 1 }, - "expression": { - "type": "CallExpression", - "start": 1780, - "end": 1809, - "loc": { - "start": { - "line": 58, - "column": 2 - }, - "end": { - "line": 58, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 1780, - "end": 1786, - "loc": { - "start": { - "line": 58, - "column": 2 - }, - "end": { - "line": 58, - "column": 8 - }, - "identifierName": "assert" - }, - "name": "assert", - "leadingComments": null - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1787, - "end": 1808, - "loc": { - "start": { - "line": 58, - "column": 9 - }, - "end": { - "line": 58, - "column": 30 - } - }, - "left": { - "type": "MemberExpression", - "start": 1787, - "end": 1800, - "loc": { - "start": { - "line": 58, - "column": 9 - }, - "end": { - "line": 58, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 1787, - "end": 1793, - "loc": { - "start": { - "line": 58, - "column": 9 - }, - "end": { - "line": 58, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 1787, - "end": 1788, - "loc": { - "start": { - "line": 58, - "column": 9 - }, - "end": { - "line": 58, - "column": 10 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1789, - "end": 1793, - "loc": { - "start": { - "line": 58, - "column": 11 - }, - "end": { - "line": 58, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1794, - "end": 1800, - "loc": { - "start": { - "line": 58, - "column": 16 - }, - "end": { - "line": 58, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1805, - "end": 1808, - "loc": { - "start": { - "line": 58, - "column": 27 - }, - "end": { - "line": 58, - "column": 30 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ], - "leadingComments": null + "end": { + "line": 62, + "column": 7 }, - "leadingComments": null + "identifierName": "assert" }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ { - "type": "ExpressionStatement", - "start": 1813, - "end": 1835, + "type": "BinaryExpression", + "start": 1950, + "end": 1971, "loc": { "start": { - "line": 59, - "column": 2 + "line": 62, + "column": 8 }, "end": { - "line": 59, - "column": 24 + "line": 62, + "column": 29 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1813, - "end": 1834, + "left": { + "type": "MemberExpression", + "start": 1950, + "end": 1963, "loc": { "start": { - "line": 59, - "column": 2 + "line": 62, + "column": 8 }, "end": { - "line": 59, - "column": 23 + "line": 62, + "column": 21 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 1813, - "end": 1826, + "start": 1950, + "end": 1956, "loc": { "start": { - "line": 59, - "column": 2 + "line": 62, + "column": 8 }, "end": { - "line": 59, - "column": 15 + "line": 62, + "column": 14 } }, "object": { - "type": "MemberExpression", - "start": 1813, - "end": 1819, + "type": "Identifier", + "start": 1950, + "end": 1951, "loc": { "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, + "line": 62, "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1813, - "end": 1814, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 3 - }, - "identifierName": "s" }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1815, - "end": 1819, - "loc": { - "start": { - "line": 59, - "column": 4 - }, - "end": { - "line": 59, - "column": 8 - }, - "identifierName": "left" + "end": { + "line": 62, + "column": 9 }, - "name": "left" + "identifierName": "s" }, - "computed": false + "name": "s" }, "property": { "type": "Identifier", - "start": 1820, - "end": 1826, + "start": 1952, + "end": 1956, "loc": { "start": { - "line": 59, - "column": 9 + "line": 62, + "column": 10 }, "end": { - "line": 59, - "column": 15 + "line": 62, + "column": 14 }, - "identifierName": "_color" + "identifierName": "left" }, - "name": "_color" + "name": "left" }, "computed": false }, - "right": { + "property": { "type": "Identifier", - "start": 1829, - "end": 1834, + "start": 1957, + "end": 1963, "loc": { "start": { - "line": 59, - "column": 18 + "line": 62, + "column": 15 }, "end": { - "line": 59, - "column": 23 + "line": 62, + "column": 21 }, - "identifierName": "BLACK" + "identifierName": "_color" }, - "name": "BLACK" - } + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1968, + "end": 1971, + "loc": { + "start": { + "line": 62, + "column": 26 + }, + "end": { + "line": 62, + "column": 29 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1923, + "end": 1940, + "loc": { + "start": { + "line": 60, + "column": 1 + }, + "end": { + "line": 60, + "column": 18 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1975, + "end": 1997, + "loc": { + "start": { + "line": 63, + "column": 1 + }, + "end": { + "line": 63, + "column": 23 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1975, + "end": 1996, + "loc": { + "start": { + "line": 63, + "column": 1 + }, + "end": { + "line": 63, + "column": 22 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1975, + "end": 1988, + "loc": { + "start": { + "line": 63, + "column": 1 + }, + "end": { + "line": 63, + "column": 14 } }, - { - "type": "ExpressionStatement", - "start": 1838, - "end": 1861, + "object": { + "type": "MemberExpression", + "start": 1975, + "end": 1981, "loc": { "start": { - "line": 60, - "column": 2 + "line": 63, + "column": 1 }, "end": { - "line": 60, - "column": 25 + "line": 63, + "column": 7 } }, - "expression": { - "type": "CallExpression", - "start": 1838, - "end": 1860, + "object": { + "type": "Identifier", + "start": 1975, + "end": 1976, "loc": { "start": { - "line": 60, - "column": 2 + "line": 63, + "column": 1 }, "end": { - "line": 60, - "column": 24 - } + "line": 63, + "column": 2 + }, + "identifierName": "s" }, - "callee": { - "type": "Identifier", - "start": 1838, - "end": 1850, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 14 - }, - "identifierName": "rotate_right" + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1977, + "end": 1981, + "loc": { + "start": { + "line": 63, + "column": 3 }, - "name": "rotate_right" + "end": { + "line": 63, + "column": 7 + }, + "identifierName": "left" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1851, - "end": 1859, - "loc": { - "start": { - "line": 60, - "column": 15 - }, - "end": { - "line": 60, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1851, - "end": 1852, - "loc": { - "start": { - "line": 60, - "column": 15 - }, - "end": { - "line": 60, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1853, - "end": 1859, - "loc": { - "start": { - "line": 60, - "column": 17 - }, - "end": { - "line": 60, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1982, + "end": 1988, + "loc": { + "start": { + "line": 63, + "column": 8 + }, + "end": { + "line": 63, + "column": 14 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1991, + "end": 1996, + "loc": { + "start": { + "line": 63, + "column": 17 + }, + "end": { + "line": 63, + "column": 22 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1999, + "end": 2022, + "loc": { + "start": { + "line": 64, + "column": 1 + }, + "end": { + "line": 64, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1999, + "end": 2021, + "loc": { + "start": { + "line": 64, + "column": 1 + }, + "end": { + "line": 64, + "column": 23 } - ], - "directives": [], - "leadingComments": [ + }, + "callee": { + "type": "Identifier", + "start": 1999, + "end": 2011, + "loc": { + "start": { + "line": 64, + "column": 1 + }, + "end": { + "line": 64, + "column": 13 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1752, - "end": 1769, + "type": "MemberExpression", + "start": 2012, + "end": 2020, "loc": { "start": { - "line": 56, - "column": 1 + "line": 64, + "column": 14 }, "end": { - "line": 56, - "column": 18 + "line": 64, + "column": 22 } - } + }, + "object": { + "type": "Identifier", + "start": 2012, + "end": 2013, + "loc": { + "start": { + "line": 64, + "column": 14 + }, + "end": { + "line": 64, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 2014, + "end": 2020, + "loc": { + "start": { + "line": 64, + "column": 16 + }, + "end": { + "line": 64, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } ] } + }, + { + "type": "ReturnStatement", + "start": 2024, + "end": 2033, + "loc": { + "start": { + "line": 65, + "column": 1 + }, + "end": { + "line": 65, + "column": 10 + } + }, + "argument": { + "type": "Identifier", + "start": 2031, + "end": 2032, + "loc": { + "start": { + "line": 65, + "column": 8 + }, + "end": { + "line": 65, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + } } ], "directives": [] @@ -2665,29 +2744,29 @@ }, { "type": "Identifier", - "start": 1869, - "end": 1897, + "start": 2038, + "end": 2066, "loc": { "start": { - "line": 64, + "line": 68, "column": 0 }, "end": { - "line": 64, + "line": 68, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 1884, - "end": 1896, + "start": 2053, + "end": 2065, "loc": { "start": { - "line": 64, + "line": 68, "column": 15 }, "end": { - "line": 64, + "line": 68, "column": 27 }, "identifierName": "delete_case5" @@ -2700,58 +2779,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1869, - "end": 1897, + "start": 2038, + "end": 2066, "loc": { "start": { - "line": 64, + "line": 68, "column": 0 }, "end": { - "line": 64, + "line": 68, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 692, - "end": 1867, + "start": 744, + "end": 2036, "loc": { "start": { - "line": 21, + "line": 22, "column": 0 }, "end": { - "line": 62, + "line": 66, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 698, - "end": 1866, + "start": 750, + "end": 2035, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 62, + "line": 66, "column": 1 } }, "id": { "type": "Identifier", - "start": 698, - "end": 710, + "start": 750, + "end": 762, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 18 }, "identifierName": "delete_case5" @@ -2761,29 +2840,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 713, - "end": 1866, + "start": 765, + "end": 2035, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 62, + "line": 66, "column": 1 } }, "id": { "type": "Identifier", - "start": 698, - "end": 710, + "start": 750, + "end": 762, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 18 }, "identifierName": "delete_case5" @@ -2797,15 +2876,15 @@ "params": [ { "type": "Identifier", - "start": 714, - "end": 715, + "start": 766, + "end": 767, "loc": { "start": { - "line": 21, + "line": 22, "column": 22 }, "end": { - "line": 21, + "line": 22, "column": 23 }, "identifierName": "n" @@ -2815,58 +2894,58 @@ ], "body": { "type": "BlockStatement", - "start": 720, - "end": 1866, + "start": 772, + "end": 2035, "loc": { "start": { - "line": 21, + "line": 22, "column": 28 }, "end": { - "line": 62, + "line": 66, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 723, - "end": 749, + "start": 775, + "end": 801, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 723, - "end": 748, + "start": 775, + "end": 800, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 723, - "end": 729, + "start": 775, + "end": 781, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -2876,29 +2955,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 730, - "end": 747, + "start": 782, + "end": 799, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 730, - "end": 731, + "start": 782, + "end": 783, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -2908,15 +2987,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 743, - "end": 747, + "start": 795, + "end": 799, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -2929,43 +3008,43 @@ }, { "type": "ExpressionStatement", - "start": 751, - "end": 778, + "start": 803, + "end": 830, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 751, - "end": 777, + "start": 803, + "end": 829, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 27 } }, "callee": { "type": "Identifier", - "start": 751, - "end": 757, + "start": 803, + "end": 809, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -2975,43 +3054,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 758, - "end": 776, + "start": 810, + "end": 828, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 758, - "end": 766, + "start": 810, + "end": 818, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 16 } }, "object": { "type": "Identifier", - "start": 758, - "end": 759, + "start": 810, + "end": 811, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -3020,15 +3099,15 @@ }, "property": { "type": "Identifier", - "start": 760, - "end": 766, + "start": 812, + "end": 818, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 }, "identifierName": "_color" @@ -3040,15 +3119,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 771, - "end": 776, + "start": 823, + "end": 828, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 26 }, "identifierName": "BLACK" @@ -3061,43 +3140,43 @@ }, { "type": "ExpressionStatement", - "start": 780, - "end": 806, + "start": 832, + "end": 858, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 780, - "end": 805, + "start": 832, + "end": 857, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 26 } }, "callee": { "type": "Identifier", - "start": 780, - "end": 786, + "start": 832, + "end": 838, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -3107,43 +3186,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 787, - "end": 804, + "start": 839, + "end": 856, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 787, - "end": 795, + "start": 839, + "end": 847, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 16 } }, "object": { "type": "Identifier", - "start": 787, - "end": 788, + "start": 839, + "end": 840, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 }, "identifierName": "n" @@ -3152,15 +3231,15 @@ }, "property": { "type": "Identifier", - "start": 789, - "end": 795, + "start": 841, + "end": 847, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 }, "identifierName": "parent" @@ -3172,15 +3251,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 800, - "end": 804, + "start": 852, + "end": 856, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -3191,44 +3270,44 @@ }, { "type": "VariableDeclaration", - "start": 808, - "end": 829, + "start": 860, + "end": 881, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 814, - "end": 828, + "start": 866, + "end": 880, "loc": { "start": { - "line": 25, + "line": 26, "column": 7 }, "end": { - "line": 25, + "line": 26, "column": 21 } }, "id": { "type": "Identifier", - "start": 814, - "end": 815, + "start": 866, + "end": 867, "loc": { "start": { - "line": 25, + "line": 26, "column": 7 }, "end": { - "line": 25, + "line": 26, "column": 8 }, "identifierName": "s" @@ -3237,29 +3316,29 @@ }, "init": { "type": "CallExpression", - "start": 818, - "end": 828, + "start": 870, + "end": 880, "loc": { "start": { - "line": 25, + "line": 26, "column": 11 }, "end": { - "line": 25, + "line": 26, "column": 21 } }, "callee": { "type": "Identifier", - "start": 818, - "end": 825, + "start": 870, + "end": 877, "loc": { "start": { - "line": 25, + "line": 26, "column": 11 }, "end": { - "line": 25, + "line": 26, "column": 18 }, "identifierName": "sibling" @@ -3269,15 +3348,15 @@ "arguments": [ { "type": "Identifier", - "start": 826, - "end": 827, + "start": 878, + "end": 879, "loc": { "start": { - "line": 25, + "line": 26, "column": 19 }, "end": { - "line": 25, + "line": 26, "column": 20 }, "identifierName": "n" @@ -3292,43 +3371,43 @@ }, { "type": "ExpressionStatement", - "start": 831, - "end": 857, + "start": 883, + "end": 909, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 831, - "end": 856, + "start": 883, + "end": 908, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 26 } }, "callee": { "type": "Identifier", - "start": 831, - "end": 837, + "start": 883, + "end": 889, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -3338,29 +3417,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 838, - "end": 855, + "start": 890, + "end": 907, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 25 } }, "left": { "type": "Identifier", - "start": 838, - "end": 839, + "start": 890, + "end": 891, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 }, "identifierName": "s" @@ -3370,15 +3449,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 851, - "end": 855, + "start": 903, + "end": 907, "loc": { "start": { - "line": 26, + "line": 27, "column": 21 }, "end": { - "line": 26, + "line": 27, "column": 25 }, "identifierName": "Node" @@ -3391,43 +3470,43 @@ }, { "type": "ExpressionStatement", - "start": 859, - "end": 886, + "start": 911, + "end": 938, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 859, - "end": 885, + "start": 911, + "end": 937, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 27 } }, "callee": { "type": "Identifier", - "start": 859, - "end": 865, + "start": 911, + "end": 917, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 7 }, "identifierName": "assert" @@ -3437,43 +3516,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 866, - "end": 884, + "start": 918, + "end": 936, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 866, - "end": 874, + "start": 918, + "end": 926, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 16 } }, "object": { "type": "Identifier", - "start": 866, - "end": 867, + "start": 918, + "end": 919, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 9 }, "identifierName": "s" @@ -3482,15 +3561,15 @@ }, "property": { "type": "Identifier", - "start": 868, - "end": 874, + "start": 920, + "end": 926, "loc": { "start": { - "line": 27, + "line": 28, "column": 10 }, "end": { - "line": 27, + "line": 28, "column": 16 }, "identifierName": "_color" @@ -3502,15 +3581,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 879, - "end": 884, + "start": 931, + "end": 936, "loc": { "start": { - "line": 27, + "line": 28, "column": 21 }, "end": { - "line": 27, + "line": 28, "column": 26 }, "identifierName": "BLACK" @@ -3523,76 +3602,92 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 889, - "end": 1576, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * swapping the colors of n's parent and n's sibling and\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaf paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 941, + "end": 1685, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 45, + "line": 47, "column": 4 } } + }, + { + "type": "CommentLine", + "value": " Swap the color of the parent and the sibling.", + "start": 1688, + "end": 1736, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 49 + } + } } ] }, { "type": "ExpressionStatement", - "start": 1579, - "end": 1606, + "start": 1738, + "end": 1765, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 28 } }, "expression": { "type": "AssignmentExpression", - "start": 1579, - "end": 1605, + "start": 1738, + "end": 1764, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 27 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1579, - "end": 1587, + "start": 1738, + "end": 1746, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 9 } }, "object": { "type": "Identifier", - "start": 1579, - "end": 1580, + "start": 1738, + "end": 1739, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 2 }, "identifierName": "s" @@ -3602,15 +3697,15 @@ }, "property": { "type": "Identifier", - "start": 1581, - "end": 1587, + "start": 1740, + "end": 1746, "loc": { "start": { - "line": 47, + "line": 50, "column": 3 }, "end": { - "line": 47, + "line": 50, "column": 9 }, "identifierName": "_color" @@ -3622,43 +3717,43 @@ }, "right": { "type": "MemberExpression", - "start": 1590, - "end": 1605, + "start": 1749, + "end": 1764, "loc": { "start": { - "line": 47, + "line": 50, "column": 12 }, "end": { - "line": 47, + "line": 50, "column": 27 } }, "object": { "type": "MemberExpression", - "start": 1590, - "end": 1598, + "start": 1749, + "end": 1757, "loc": { "start": { - "line": 47, + "line": 50, "column": 12 }, "end": { - "line": 47, + "line": 50, "column": 20 } }, "object": { "type": "Identifier", - "start": 1590, - "end": 1591, + "start": 1749, + "end": 1750, "loc": { "start": { - "line": 47, + "line": 50, "column": 12 }, "end": { - "line": 47, + "line": 50, "column": 13 }, "identifierName": "n" @@ -3667,15 +3762,15 @@ }, "property": { "type": "Identifier", - "start": 1592, - "end": 1598, + "start": 1751, + "end": 1757, "loc": { "start": { - "line": 47, + "line": 50, "column": 14 }, "end": { - "line": 47, + "line": 50, "column": 20 }, "identifierName": "parent" @@ -3686,15 +3781,15 @@ }, "property": { "type": "Identifier", - "start": 1599, - "end": 1605, + "start": 1758, + "end": 1764, "loc": { "start": { - "line": 47, + "line": 50, "column": 21 }, "end": { - "line": 47, + "line": 50, "column": 27 }, "identifierName": "_color" @@ -3708,90 +3803,106 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 889, - "end": 1576, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * swapping the colors of n's parent and n's sibling and\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaf paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 941, + "end": 1685, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 45, + "line": 47, "column": 4 } } + }, + { + "type": "CommentLine", + "value": " Swap the color of the parent and the sibling.", + "start": 1688, + "end": 1736, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 49 + } + } } ] }, { "type": "ExpressionStatement", - "start": 1608, - "end": 1632, + "start": 1767, + "end": 1791, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 1608, - "end": 1631, + "start": 1767, + "end": 1790, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1608, - "end": 1623, + "start": 1767, + "end": 1782, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 16 } }, "object": { "type": "MemberExpression", - "start": 1608, - "end": 1616, + "start": 1767, + "end": 1775, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 9 } }, "object": { "type": "Identifier", - "start": 1608, - "end": 1609, + "start": 1767, + "end": 1768, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 2 }, "identifierName": "n" @@ -3800,15 +3911,15 @@ }, "property": { "type": "Identifier", - "start": 1610, - "end": 1616, + "start": 1769, + "end": 1775, "loc": { "start": { - "line": 48, + "line": 51, "column": 3 }, "end": { - "line": 48, + "line": 51, "column": 9 }, "identifierName": "parent" @@ -3819,15 +3930,15 @@ }, "property": { "type": "Identifier", - "start": 1617, - "end": 1623, + "start": 1776, + "end": 1782, "loc": { "start": { - "line": 48, + "line": 51, "column": 10 }, "end": { - "line": 48, + "line": 51, "column": 16 }, "identifierName": "_color" @@ -3838,15 +3949,15 @@ }, "right": { "type": "Identifier", - "start": 1626, - "end": 1631, + "start": 1785, + "end": 1790, "loc": { "start": { - "line": 48, + "line": 51, "column": 19 }, "end": { - "line": 48, + "line": 51, "column": 24 }, "identifierName": "BLACK" @@ -3857,43 +3968,43 @@ }, { "type": "IfStatement", - "start": 1635, - "end": 1864, + "start": 1794, + "end": 1920, "loc": { "start": { - "line": 50, + "line": 53, "column": 1 }, "end": { - "line": 61, + "line": 58, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 1639, - "end": 1658, + "start": 1798, + "end": 1817, "loc": { "start": { - "line": 50, + "line": 53, "column": 5 }, "end": { - "line": 50, + "line": 53, "column": 24 } }, "left": { "type": "Identifier", - "start": 1639, - "end": 1640, + "start": 1798, + "end": 1799, "loc": { "start": { - "line": 50, + "line": 53, "column": 5 }, "end": { - "line": 50, + "line": 53, "column": 6 }, "identifierName": "n" @@ -3903,43 +4014,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 1645, - "end": 1658, + "start": 1804, + "end": 1817, "loc": { "start": { - "line": 50, + "line": 53, "column": 11 }, "end": { - "line": 50, + "line": 53, "column": 24 } }, "object": { "type": "MemberExpression", - "start": 1645, - "end": 1653, + "start": 1804, + "end": 1812, "loc": { "start": { - "line": 50, + "line": 53, "column": 11 }, "end": { - "line": 50, + "line": 53, "column": 19 } }, "object": { "type": "Identifier", - "start": 1645, - "end": 1646, + "start": 1804, + "end": 1805, "loc": { "start": { - "line": 50, + "line": 53, "column": 11 }, "end": { - "line": 50, + "line": 53, "column": 12 }, "identifierName": "n" @@ -3948,15 +4059,15 @@ }, "property": { "type": "Identifier", - "start": 1647, - "end": 1653, + "start": 1806, + "end": 1812, "loc": { "start": { - "line": 50, + "line": 53, "column": 13 }, "end": { - "line": 50, + "line": 53, "column": 19 }, "identifierName": "parent" @@ -3967,15 +4078,15 @@ }, "property": { "type": "Identifier", - "start": 1654, - "end": 1658, + "start": 1813, + "end": 1817, "loc": { "start": { - "line": 50, + "line": 53, "column": 20 }, "end": { - "line": 50, + "line": 53, "column": 24 }, "identifierName": "left" @@ -3987,58 +4098,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 1660, - "end": 1749, + "start": 1819, + "end": 1920, "loc": { "start": { - "line": 50, + "line": 53, "column": 26 }, "end": { - "line": 54, + "line": 58, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1664, - "end": 1695, + "start": 1823, + "end": 1854, "loc": { "start": { - "line": 51, + "line": 54, "column": 2 }, "end": { - "line": 51, + "line": 54, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 1664, - "end": 1694, + "start": 1823, + "end": 1853, "loc": { "start": { - "line": 51, + "line": 54, "column": 2 }, "end": { - "line": 51, + "line": 54, "column": 32 } }, "callee": { "type": "Identifier", - "start": 1664, - "end": 1670, + "start": 1823, + "end": 1829, "loc": { "start": { - "line": 51, + "line": 54, "column": 2 }, "end": { - "line": 51, + "line": 54, "column": 8 }, "identifierName": "assert" @@ -4048,57 +4159,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1671, - "end": 1693, + "start": 1830, + "end": 1852, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 1671, - "end": 1685, + "start": 1830, + "end": 1844, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 1671, - "end": 1678, + "start": 1830, + "end": 1837, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 16 } }, "object": { "type": "Identifier", - "start": 1671, - "end": 1672, + "start": 1830, + "end": 1831, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 10 }, "identifierName": "s" @@ -4107,15 +4218,15 @@ }, "property": { "type": "Identifier", - "start": 1673, - "end": 1678, + "start": 1832, + "end": 1837, "loc": { "start": { - "line": 51, + "line": 54, "column": 11 }, "end": { - "line": 51, + "line": 54, "column": 16 }, "identifierName": "right" @@ -4126,15 +4237,15 @@ }, "property": { "type": "Identifier", - "start": 1679, - "end": 1685, + "start": 1838, + "end": 1844, "loc": { "start": { - "line": 51, + "line": 54, "column": 17 }, "end": { - "line": 51, + "line": 54, "column": 23 }, "identifierName": "_color" @@ -4146,15 +4257,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1690, - "end": 1693, + "start": 1849, + "end": 1852, "loc": { "start": { - "line": 51, + "line": 54, "column": 28 }, "end": { - "line": 51, + "line": 54, "column": 31 }, "identifierName": "RED" @@ -4167,72 +4278,72 @@ }, { "type": "ExpressionStatement", - "start": 1698, - "end": 1721, + "start": 1857, + "end": 1880, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 1698, - "end": 1720, + "start": 1857, + "end": 1879, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1698, - "end": 1712, + "start": 1857, + "end": 1871, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 16 } }, "object": { "type": "MemberExpression", - "start": 1698, - "end": 1705, + "start": 1857, + "end": 1864, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 9 } }, "object": { "type": "Identifier", - "start": 1698, - "end": 1699, + "start": 1857, + "end": 1858, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 3 }, "identifierName": "s" @@ -4241,15 +4352,15 @@ }, "property": { "type": "Identifier", - "start": 1700, - "end": 1705, + "start": 1859, + "end": 1864, "loc": { "start": { - "line": 52, + "line": 55, "column": 4 }, "end": { - "line": 52, + "line": 55, "column": 9 }, "identifierName": "right" @@ -4260,15 +4371,15 @@ }, "property": { "type": "Identifier", - "start": 1706, - "end": 1712, + "start": 1865, + "end": 1871, "loc": { "start": { - "line": 52, + "line": 55, "column": 10 }, "end": { - "line": 52, + "line": 55, "column": 16 }, "identifierName": "_color" @@ -4279,15 +4390,15 @@ }, "right": { "type": "Identifier", - "start": 1715, - "end": 1720, + "start": 1874, + "end": 1879, "loc": { "start": { - "line": 52, + "line": 55, "column": 19 }, "end": { - "line": 52, + "line": 55, "column": 24 }, "identifierName": "BLACK" @@ -4298,43 +4409,43 @@ }, { "type": "ExpressionStatement", - "start": 1724, - "end": 1746, + "start": 1883, + "end": 1905, "loc": { "start": { - "line": 53, + "line": 56, "column": 2 }, "end": { - "line": 53, + "line": 56, "column": 24 } }, "expression": { "type": "CallExpression", - "start": 1724, - "end": 1745, + "start": 1883, + "end": 1904, "loc": { "start": { - "line": 53, + "line": 56, "column": 2 }, "end": { - "line": 53, + "line": 56, "column": 23 } }, "callee": { "type": "Identifier", - "start": 1724, - "end": 1735, + "start": 1883, + "end": 1894, "loc": { "start": { - "line": 53, + "line": 56, "column": 2 }, "end": { - "line": 53, + "line": 56, "column": 13 }, "identifierName": "rotate_left" @@ -4344,29 +4455,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 1736, - "end": 1744, + "start": 1895, + "end": 1903, "loc": { "start": { - "line": 53, + "line": 56, "column": 14 }, "end": { - "line": 53, + "line": 56, "column": 22 } }, "object": { "type": "Identifier", - "start": 1736, - "end": 1737, + "start": 1895, + "end": 1896, "loc": { "start": { - "line": 53, + "line": 56, "column": 14 }, "end": { - "line": 53, + "line": 56, "column": 15 }, "identifierName": "n" @@ -4375,15 +4486,15 @@ }, "property": { "type": "Identifier", - "start": 1738, - "end": 1744, + "start": 1897, + "end": 1903, "loc": { "start": { - "line": 53, + "line": 56, "column": 16 }, "end": { - "line": 53, + "line": 56, "column": 22 }, "identifierName": "parent" @@ -4394,462 +4505,509 @@ } ] } - } - ], - "directives": [], - "trailingComments": [ + }, { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1752, - "end": 1769, + "type": "ReturnStatement", + "start": 1908, + "end": 1917, "loc": { "start": { - "line": 56, - "column": 1 + "line": 57, + "column": 2 }, "end": { - "line": 56, - "column": 18 - } - } - } - ] - }, - "alternate": { - "type": "BlockStatement", - "start": 1776, - "end": 1864, - "loc": { - "start": { - "line": 57, - "column": 6 - }, - "end": { - "line": 61, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 1780, - "end": 1810, - "loc": { - "start": { - "line": 58, - "column": 2 - }, - "end": { - "line": 58, - "column": 32 + "line": 57, + "column": 11 } }, - "expression": { - "type": "CallExpression", - "start": 1780, - "end": 1809, + "argument": { + "type": "Identifier", + "start": 1915, + "end": 1916, "loc": { "start": { - "line": 58, - "column": 2 + "line": 57, + "column": 9 }, "end": { - "line": 58, - "column": 31 - } - }, - "callee": { - "type": "Identifier", - "start": 1780, - "end": 1786, - "loc": { - "start": { - "line": 58, - "column": 2 - }, - "end": { - "line": 58, - "column": 8 - }, - "identifierName": "assert" + "line": 57, + "column": 10 }, - "name": "assert", - "leadingComments": null + "identifierName": "s" }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 1787, - "end": 1808, - "loc": { - "start": { - "line": 58, - "column": 9 - }, - "end": { - "line": 58, - "column": 30 - } - }, - "left": { - "type": "MemberExpression", - "start": 1787, - "end": 1800, - "loc": { - "start": { - "line": 58, - "column": 9 - }, - "end": { - "line": 58, - "column": 22 - } - }, - "object": { - "type": "MemberExpression", - "start": 1787, - "end": 1793, - "loc": { - "start": { - "line": 58, - "column": 9 - }, - "end": { - "line": 58, - "column": 15 - } - }, - "object": { - "type": "Identifier", - "start": 1787, - "end": 1788, - "loc": { - "start": { - "line": 58, - "column": 9 - }, - "end": { - "line": 58, - "column": 10 - }, - "identifierName": "s" - }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1789, - "end": 1793, - "loc": { - "start": { - "line": 58, - "column": 11 - }, - "end": { - "line": 58, - "column": 15 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1794, - "end": 1800, - "loc": { - "start": { - "line": 58, - "column": 16 - }, - "end": { - "line": 58, - "column": 22 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "Identifier", - "start": 1805, - "end": 1808, - "loc": { - "start": { - "line": 58, - "column": 27 - }, - "end": { - "line": 58, - "column": 30 - }, - "identifierName": "RED" - }, - "name": "RED" - } - } - ], - "leadingComments": null + "name": "s" + } + } + ], + "directives": [], + "trailingComments": null + }, + "alternate": null, + "trailingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1923, + "end": 1940, + "loc": { + "start": { + "line": 60, + "column": 1 }, - "leadingComments": null + "end": { + "line": 60, + "column": 18 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1943, + "end": 1973, + "loc": { + "start": { + "line": 62, + "column": 1 + }, + "end": { + "line": 62, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 1943, + "end": 1972, + "loc": { + "start": { + "line": 62, + "column": 1 }, + "end": { + "line": 62, + "column": 30 + } + }, + "callee": { + "type": "Identifier", + "start": 1943, + "end": 1949, + "loc": { + "start": { + "line": 62, + "column": 1 + }, + "end": { + "line": 62, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert", + "leadingComments": null + }, + "arguments": [ { - "type": "ExpressionStatement", - "start": 1813, - "end": 1835, + "type": "BinaryExpression", + "start": 1950, + "end": 1971, "loc": { "start": { - "line": 59, - "column": 2 + "line": 62, + "column": 8 }, "end": { - "line": 59, - "column": 24 + "line": 62, + "column": 29 } }, - "expression": { - "type": "AssignmentExpression", - "start": 1813, - "end": 1834, + "left": { + "type": "MemberExpression", + "start": 1950, + "end": 1963, "loc": { "start": { - "line": 59, - "column": 2 + "line": 62, + "column": 8 }, "end": { - "line": 59, - "column": 23 + "line": 62, + "column": 21 } }, - "operator": "=", - "left": { + "object": { "type": "MemberExpression", - "start": 1813, - "end": 1826, + "start": 1950, + "end": 1956, "loc": { "start": { - "line": 59, - "column": 2 + "line": 62, + "column": 8 }, "end": { - "line": 59, - "column": 15 + "line": 62, + "column": 14 } }, "object": { - "type": "MemberExpression", - "start": 1813, - "end": 1819, + "type": "Identifier", + "start": 1950, + "end": 1951, "loc": { "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, + "line": 62, "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 1813, - "end": 1814, - "loc": { - "start": { - "line": 59, - "column": 2 - }, - "end": { - "line": 59, - "column": 3 - }, - "identifierName": "s" }, - "name": "s" - }, - "property": { - "type": "Identifier", - "start": 1815, - "end": 1819, - "loc": { - "start": { - "line": 59, - "column": 4 - }, - "end": { - "line": 59, - "column": 8 - }, - "identifierName": "left" + "end": { + "line": 62, + "column": 9 }, - "name": "left" + "identifierName": "s" }, - "computed": false + "name": "s" }, "property": { "type": "Identifier", - "start": 1820, - "end": 1826, + "start": 1952, + "end": 1956, "loc": { "start": { - "line": 59, - "column": 9 + "line": 62, + "column": 10 }, "end": { - "line": 59, - "column": 15 + "line": 62, + "column": 14 }, - "identifierName": "_color" + "identifierName": "left" }, - "name": "_color" + "name": "left" }, "computed": false }, - "right": { + "property": { "type": "Identifier", - "start": 1829, - "end": 1834, + "start": 1957, + "end": 1963, "loc": { "start": { - "line": 59, - "column": 18 + "line": 62, + "column": 15 }, "end": { - "line": 59, - "column": 23 + "line": 62, + "column": 21 }, - "identifierName": "BLACK" + "identifierName": "_color" }, - "name": "BLACK" - } + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 1968, + "end": 1971, + "loc": { + "start": { + "line": 62, + "column": 26 + }, + "end": { + "line": 62, + "column": 29 + }, + "identifierName": "RED" + }, + "name": "RED" + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1923, + "end": 1940, + "loc": { + "start": { + "line": 60, + "column": 1 + }, + "end": { + "line": 60, + "column": 18 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1975, + "end": 1997, + "loc": { + "start": { + "line": 63, + "column": 1 + }, + "end": { + "line": 63, + "column": 23 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1975, + "end": 1996, + "loc": { + "start": { + "line": 63, + "column": 1 + }, + "end": { + "line": 63, + "column": 22 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1975, + "end": 1988, + "loc": { + "start": { + "line": 63, + "column": 1 + }, + "end": { + "line": 63, + "column": 14 } }, - { - "type": "ExpressionStatement", - "start": 1838, - "end": 1861, + "object": { + "type": "MemberExpression", + "start": 1975, + "end": 1981, "loc": { "start": { - "line": 60, - "column": 2 + "line": 63, + "column": 1 }, "end": { - "line": 60, - "column": 25 + "line": 63, + "column": 7 } }, - "expression": { - "type": "CallExpression", - "start": 1838, - "end": 1860, + "object": { + "type": "Identifier", + "start": 1975, + "end": 1976, "loc": { "start": { - "line": 60, - "column": 2 + "line": 63, + "column": 1 }, "end": { - "line": 60, - "column": 24 - } + "line": 63, + "column": 2 + }, + "identifierName": "s" }, - "callee": { - "type": "Identifier", - "start": 1838, - "end": 1850, - "loc": { - "start": { - "line": 60, - "column": 2 - }, - "end": { - "line": 60, - "column": 14 - }, - "identifierName": "rotate_right" + "name": "s" + }, + "property": { + "type": "Identifier", + "start": 1977, + "end": 1981, + "loc": { + "start": { + "line": 63, + "column": 3 + }, + "end": { + "line": 63, + "column": 7 }, - "name": "rotate_right" + "identifierName": "left" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1851, - "end": 1859, - "loc": { - "start": { - "line": 60, - "column": 15 - }, - "end": { - "line": 60, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 1851, - "end": 1852, - "loc": { - "start": { - "line": 60, - "column": 15 - }, - "end": { - "line": 60, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1853, - "end": 1859, - "loc": { - "start": { - "line": 60, - "column": 17 - }, - "end": { - "line": 60, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ] - } + "name": "left" + }, + "computed": false + }, + "property": { + "type": "Identifier", + "start": 1982, + "end": 1988, + "loc": { + "start": { + "line": 63, + "column": 8 + }, + "end": { + "line": 63, + "column": 14 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1991, + "end": 1996, + "loc": { + "start": { + "line": 63, + "column": 17 + }, + "end": { + "line": 63, + "column": 22 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1999, + "end": 2022, + "loc": { + "start": { + "line": 64, + "column": 1 + }, + "end": { + "line": 64, + "column": 24 + } + }, + "expression": { + "type": "CallExpression", + "start": 1999, + "end": 2021, + "loc": { + "start": { + "line": 64, + "column": 1 + }, + "end": { + "line": 64, + "column": 23 } - ], - "directives": [], - "leadingComments": [ + }, + "callee": { + "type": "Identifier", + "start": 1999, + "end": 2011, + "loc": { + "start": { + "line": 64, + "column": 1 + }, + "end": { + "line": 64, + "column": 13 + }, + "identifierName": "rotate_right" + }, + "name": "rotate_right" + }, + "arguments": [ { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1752, - "end": 1769, + "type": "MemberExpression", + "start": 2012, + "end": 2020, "loc": { "start": { - "line": 56, - "column": 1 + "line": 64, + "column": 14 }, "end": { - "line": 56, - "column": 18 + "line": 64, + "column": 22 } - } + }, + "object": { + "type": "Identifier", + "start": 2012, + "end": 2013, + "loc": { + "start": { + "line": 64, + "column": 14 + }, + "end": { + "line": 64, + "column": 15 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 2014, + "end": 2020, + "loc": { + "start": { + "line": 64, + "column": 16 + }, + "end": { + "line": 64, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } ] } + }, + { + "type": "ReturnStatement", + "start": 2024, + "end": 2033, + "loc": { + "start": { + "line": 65, + "column": 1 + }, + "end": { + "line": 65, + "column": 10 + } + }, + "argument": { + "type": "Identifier", + "start": 2031, + "end": 2032, + "loc": { + "start": { + "line": 65, + "column": 8 + }, + "end": { + "line": 65, + "column": 9 + }, + "identifierName": "s" + }, + "name": "s" + } } ], "directives": [] @@ -4862,16 +5020,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 291, - "end": 691, + "end": 743, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 3 } } @@ -4886,48 +5044,64 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 291, - "end": 691, + "end": 743, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 3 } } }, { "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 889, - "end": 1576, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * swapping the colors of n's parent and n's sibling and\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaf paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 941, + "end": 1685, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 45, + "line": 47, "column": 4 } } }, + { + "type": "CommentLine", + "value": " Swap the color of the parent and the sibling.", + "start": 1688, + "end": 1736, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 49 + } + } + }, { "type": "CommentLine", "value": " Symmetric case", - "start": 1752, - "end": 1769, + "start": 1923, + "end": 1940, "loc": { "start": { - "line": 56, + "line": 60, "column": 1 }, "end": { - "line": 56, + "line": 60, "column": 18 } } @@ -5867,16 +6041,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 291, - "end": 691, + "end": 743, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 3 } } @@ -5896,15 +6070,15 @@ "updateContext": null }, "value": "const", - "start": 692, - "end": 697, + "start": 744, + "end": 749, "loc": { "start": { - "line": 21, + "line": 22, "column": 0 }, "end": { - "line": 21, + "line": 22, "column": 5 } } @@ -5922,15 +6096,15 @@ "binop": null }, "value": "delete_case5", - "start": 698, - "end": 710, + "start": 750, + "end": 762, "loc": { "start": { - "line": 21, + "line": 22, "column": 6 }, "end": { - "line": 21, + "line": 22, "column": 18 } } @@ -5949,15 +6123,15 @@ "updateContext": null }, "value": "=", - "start": 711, - "end": 712, + "start": 763, + "end": 764, "loc": { "start": { - "line": 21, + "line": 22, "column": 19 }, "end": { - "line": 21, + "line": 22, "column": 20 } } @@ -5974,15 +6148,15 @@ "postfix": false, "binop": null }, - "start": 713, - "end": 714, + "start": 765, + "end": 766, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 22 } } @@ -6000,15 +6174,15 @@ "binop": null }, "value": "n", - "start": 714, - "end": 715, + "start": 766, + "end": 767, "loc": { "start": { - "line": 21, + "line": 22, "column": 22 }, "end": { - "line": 21, + "line": 22, "column": 23 } } @@ -6025,15 +6199,15 @@ "postfix": false, "binop": null }, - "start": 715, - "end": 716, + "start": 767, + "end": 768, "loc": { "start": { - "line": 21, + "line": 22, "column": 23 }, "end": { - "line": 21, + "line": 22, "column": 24 } } @@ -6051,15 +6225,15 @@ "binop": null, "updateContext": null }, - "start": 717, - "end": 719, + "start": 769, + "end": 771, "loc": { "start": { - "line": 21, + "line": 22, "column": 25 }, "end": { - "line": 21, + "line": 22, "column": 27 } } @@ -6076,15 +6250,15 @@ "postfix": false, "binop": null }, - "start": 720, - "end": 721, + "start": 772, + "end": 773, "loc": { "start": { - "line": 21, + "line": 22, "column": 28 }, "end": { - "line": 21, + "line": 22, "column": 29 } } @@ -6102,15 +6276,15 @@ "binop": null }, "value": "assert", - "start": 723, - "end": 729, + "start": 775, + "end": 781, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 } } @@ -6127,15 +6301,15 @@ "postfix": false, "binop": null }, - "start": 729, - "end": 730, + "start": 781, + "end": 782, "loc": { "start": { - "line": 22, + "line": 23, "column": 7 }, "end": { - "line": 22, + "line": 23, "column": 8 } } @@ -6153,15 +6327,15 @@ "binop": null }, "value": "n", - "start": 730, - "end": 731, + "start": 782, + "end": 783, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 } } @@ -6181,15 +6355,15 @@ "updateContext": null }, "value": "instanceof", - "start": 732, - "end": 742, + "start": 784, + "end": 794, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 20 } } @@ -6207,15 +6381,15 @@ "binop": null }, "value": "Node", - "start": 743, - "end": 747, + "start": 795, + "end": 799, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 } } @@ -6232,15 +6406,15 @@ "postfix": false, "binop": null }, - "start": 747, - "end": 748, + "start": 799, + "end": 800, "loc": { "start": { - "line": 22, + "line": 23, "column": 25 }, "end": { - "line": 22, + "line": 23, "column": 26 } } @@ -6258,15 +6432,15 @@ "binop": null, "updateContext": null }, - "start": 748, - "end": 749, + "start": 800, + "end": 801, "loc": { "start": { - "line": 22, + "line": 23, "column": 26 }, "end": { - "line": 22, + "line": 23, "column": 27 } } @@ -6284,15 +6458,15 @@ "binop": null }, "value": "assert", - "start": 751, - "end": 757, + "start": 803, + "end": 809, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 } } @@ -6309,15 +6483,15 @@ "postfix": false, "binop": null }, - "start": 757, - "end": 758, + "start": 809, + "end": 810, "loc": { "start": { - "line": 23, + "line": 24, "column": 7 }, "end": { - "line": 23, + "line": 24, "column": 8 } } @@ -6335,15 +6509,15 @@ "binop": null }, "value": "n", - "start": 758, - "end": 759, + "start": 810, + "end": 811, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 } } @@ -6361,15 +6535,15 @@ "binop": null, "updateContext": null }, - "start": 759, - "end": 760, + "start": 811, + "end": 812, "loc": { "start": { - "line": 23, + "line": 24, "column": 9 }, "end": { - "line": 23, + "line": 24, "column": 10 } } @@ -6387,15 +6561,15 @@ "binop": null }, "value": "_color", - "start": 760, - "end": 766, + "start": 812, + "end": 818, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 16 } } @@ -6414,15 +6588,15 @@ "updateContext": null }, "value": "===", - "start": 767, - "end": 770, + "start": 819, + "end": 822, "loc": { "start": { - "line": 23, + "line": 24, "column": 17 }, "end": { - "line": 23, + "line": 24, "column": 20 } } @@ -6440,15 +6614,15 @@ "binop": null }, "value": "BLACK", - "start": 771, - "end": 776, + "start": 823, + "end": 828, "loc": { "start": { - "line": 23, + "line": 24, "column": 21 }, "end": { - "line": 23, + "line": 24, "column": 26 } } @@ -6465,15 +6639,15 @@ "postfix": false, "binop": null }, - "start": 776, - "end": 777, + "start": 828, + "end": 829, "loc": { "start": { - "line": 23, + "line": 24, "column": 26 }, "end": { - "line": 23, + "line": 24, "column": 27 } } @@ -6491,15 +6665,15 @@ "binop": null, "updateContext": null }, - "start": 777, - "end": 778, + "start": 829, + "end": 830, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 28 } } @@ -6517,15 +6691,15 @@ "binop": null }, "value": "assert", - "start": 780, - "end": 786, + "start": 832, + "end": 838, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 } } @@ -6542,15 +6716,15 @@ "postfix": false, "binop": null }, - "start": 786, - "end": 787, + "start": 838, + "end": 839, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 8 } } @@ -6568,15 +6742,15 @@ "binop": null }, "value": "n", - "start": 787, - "end": 788, + "start": 839, + "end": 840, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 } } @@ -6594,15 +6768,15 @@ "binop": null, "updateContext": null }, - "start": 788, - "end": 789, + "start": 840, + "end": 841, "loc": { "start": { - "line": 24, + "line": 25, "column": 9 }, "end": { - "line": 24, + "line": 25, "column": 10 } } @@ -6620,15 +6794,15 @@ "binop": null }, "value": "parent", - "start": 789, - "end": 795, + "start": 841, + "end": 847, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 } } @@ -6647,15 +6821,15 @@ "updateContext": null }, "value": "!==", - "start": 796, - "end": 799, + "start": 848, + "end": 851, "loc": { "start": { - "line": 24, + "line": 25, "column": 17 }, "end": { - "line": 24, + "line": 25, "column": 20 } } @@ -6675,15 +6849,15 @@ "updateContext": null }, "value": "null", - "start": 800, - "end": 804, + "start": 852, + "end": 856, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -6700,15 +6874,15 @@ "postfix": false, "binop": null }, - "start": 804, - "end": 805, + "start": 856, + "end": 857, "loc": { "start": { - "line": 24, + "line": 25, "column": 25 }, "end": { - "line": 24, + "line": 25, "column": 26 } } @@ -6726,15 +6900,15 @@ "binop": null, "updateContext": null }, - "start": 805, - "end": 806, + "start": 857, + "end": 858, "loc": { "start": { - "line": 24, + "line": 25, "column": 26 }, "end": { - "line": 24, + "line": 25, "column": 27 } } @@ -6754,15 +6928,15 @@ "updateContext": null }, "value": "const", - "start": 808, - "end": 813, + "start": 860, + "end": 865, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 6 } } @@ -6780,15 +6954,15 @@ "binop": null }, "value": "s", - "start": 814, - "end": 815, + "start": 866, + "end": 867, "loc": { "start": { - "line": 25, + "line": 26, "column": 7 }, "end": { - "line": 25, + "line": 26, "column": 8 } } @@ -6807,15 +6981,15 @@ "updateContext": null }, "value": "=", - "start": 816, - "end": 817, + "start": 868, + "end": 869, "loc": { "start": { - "line": 25, + "line": 26, "column": 9 }, "end": { - "line": 25, + "line": 26, "column": 10 } } @@ -6833,15 +7007,15 @@ "binop": null }, "value": "sibling", - "start": 818, - "end": 825, + "start": 870, + "end": 877, "loc": { "start": { - "line": 25, + "line": 26, "column": 11 }, "end": { - "line": 25, + "line": 26, "column": 18 } } @@ -6858,15 +7032,15 @@ "postfix": false, "binop": null }, - "start": 825, - "end": 826, + "start": 877, + "end": 878, "loc": { "start": { - "line": 25, + "line": 26, "column": 18 }, "end": { - "line": 25, + "line": 26, "column": 19 } } @@ -6884,15 +7058,15 @@ "binop": null }, "value": "n", - "start": 826, - "end": 827, + "start": 878, + "end": 879, "loc": { "start": { - "line": 25, + "line": 26, "column": 19 }, "end": { - "line": 25, + "line": 26, "column": 20 } } @@ -6909,15 +7083,15 @@ "postfix": false, "binop": null }, - "start": 827, - "end": 828, + "start": 879, + "end": 880, "loc": { "start": { - "line": 25, + "line": 26, "column": 20 }, "end": { - "line": 25, + "line": 26, "column": 21 } } @@ -6935,15 +7109,15 @@ "binop": null, "updateContext": null }, - "start": 828, - "end": 829, + "start": 880, + "end": 881, "loc": { "start": { - "line": 25, + "line": 26, "column": 21 }, "end": { - "line": 25, + "line": 26, "column": 22 } } @@ -6961,15 +7135,15 @@ "binop": null }, "value": "assert", - "start": 831, - "end": 837, + "start": 883, + "end": 889, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 } } @@ -6986,15 +7160,15 @@ "postfix": false, "binop": null }, - "start": 837, - "end": 838, + "start": 889, + "end": 890, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 } } @@ -7012,15 +7186,15 @@ "binop": null }, "value": "s", - "start": 838, - "end": 839, + "start": 890, + "end": 891, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 } } @@ -7040,15 +7214,15 @@ "updateContext": null }, "value": "instanceof", - "start": 840, - "end": 850, + "start": 892, + "end": 902, "loc": { "start": { - "line": 26, + "line": 27, "column": 10 }, "end": { - "line": 26, + "line": 27, "column": 20 } } @@ -7066,15 +7240,15 @@ "binop": null }, "value": "Node", - "start": 851, - "end": 855, + "start": 903, + "end": 907, "loc": { "start": { - "line": 26, + "line": 27, "column": 21 }, "end": { - "line": 26, + "line": 27, "column": 25 } } @@ -7091,15 +7265,15 @@ "postfix": false, "binop": null }, - "start": 855, - "end": 856, + "start": 907, + "end": 908, "loc": { "start": { - "line": 26, + "line": 27, "column": 25 }, "end": { - "line": 26, + "line": 27, "column": 26 } } @@ -7117,15 +7291,15 @@ "binop": null, "updateContext": null }, - "start": 856, - "end": 857, + "start": 908, + "end": 909, "loc": { "start": { - "line": 26, + "line": 27, "column": 26 }, "end": { - "line": 26, + "line": 27, "column": 27 } } @@ -7143,15 +7317,15 @@ "binop": null }, "value": "assert", - "start": 859, - "end": 865, + "start": 911, + "end": 917, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 7 } } @@ -7168,15 +7342,15 @@ "postfix": false, "binop": null }, - "start": 865, - "end": 866, + "start": 917, + "end": 918, "loc": { "start": { - "line": 27, + "line": 28, "column": 7 }, "end": { - "line": 27, + "line": 28, "column": 8 } } @@ -7194,15 +7368,15 @@ "binop": null }, "value": "s", - "start": 866, - "end": 867, + "start": 918, + "end": 919, "loc": { "start": { - "line": 27, + "line": 28, "column": 8 }, "end": { - "line": 27, + "line": 28, "column": 9 } } @@ -7220,15 +7394,15 @@ "binop": null, "updateContext": null }, - "start": 867, - "end": 868, + "start": 919, + "end": 920, "loc": { "start": { - "line": 27, + "line": 28, "column": 9 }, "end": { - "line": 27, + "line": 28, "column": 10 } } @@ -7246,15 +7420,15 @@ "binop": null }, "value": "_color", - "start": 868, - "end": 874, + "start": 920, + "end": 926, "loc": { "start": { - "line": 27, + "line": 28, "column": 10 }, "end": { - "line": 27, + "line": 28, "column": 16 } } @@ -7273,15 +7447,15 @@ "updateContext": null }, "value": "===", - "start": 875, - "end": 878, + "start": 927, + "end": 930, "loc": { "start": { - "line": 27, + "line": 28, "column": 17 }, "end": { - "line": 27, + "line": 28, "column": 20 } } @@ -7299,15 +7473,15 @@ "binop": null }, "value": "BLACK", - "start": 879, - "end": 884, + "start": 931, + "end": 936, "loc": { "start": { - "line": 27, + "line": 28, "column": 21 }, "end": { - "line": 27, + "line": 28, "column": 26 } } @@ -7324,15 +7498,15 @@ "postfix": false, "binop": null }, - "start": 884, - "end": 885, + "start": 936, + "end": 937, "loc": { "start": { - "line": 27, + "line": 28, "column": 26 }, "end": { - "line": 27, + "line": 28, "column": 27 } } @@ -7350,35 +7524,51 @@ "binop": null, "updateContext": null }, - "start": 885, - "end": 886, + "start": 937, + "end": 938, "loc": { "start": { - "line": 27, + "line": 28, "column": 27 }, "end": { - "line": 27, + "line": 28, "column": 28 } } }, { "type": "CommentBlock", - "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", - "start": 889, - "end": 1576, + "value": "*\n\t * Increment the black height of all root-leaf paths going through n by\n\t * swapping the colors of n's parent and n's sibling and\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaf paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t ", + "start": 941, + "end": 1685, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 45, + "line": 47, "column": 4 } } }, + { + "type": "CommentLine", + "value": " Swap the color of the parent and the sibling.", + "start": 1688, + "end": 1736, + "loc": { + "start": { + "line": 49, + "column": 1 + }, + "end": { + "line": 49, + "column": 49 + } + } + }, { "type": { "label": "name", @@ -7392,15 +7582,15 @@ "binop": null }, "value": "s", - "start": 1579, - "end": 1580, + "start": 1738, + "end": 1739, "loc": { "start": { - "line": 47, + "line": 50, "column": 1 }, "end": { - "line": 47, + "line": 50, "column": 2 } } @@ -7418,15 +7608,15 @@ "binop": null, "updateContext": null }, - "start": 1580, - "end": 1581, + "start": 1739, + "end": 1740, "loc": { "start": { - "line": 47, + "line": 50, "column": 2 }, "end": { - "line": 47, + "line": 50, "column": 3 } } @@ -7444,15 +7634,15 @@ "binop": null }, "value": "_color", - "start": 1581, - "end": 1587, + "start": 1740, + "end": 1746, "loc": { "start": { - "line": 47, + "line": 50, "column": 3 }, "end": { - "line": 47, + "line": 50, "column": 9 } } @@ -7471,15 +7661,15 @@ "updateContext": null }, "value": "=", - "start": 1588, - "end": 1589, + "start": 1747, + "end": 1748, "loc": { "start": { - "line": 47, + "line": 50, "column": 10 }, "end": { - "line": 47, + "line": 50, "column": 11 } } @@ -7497,15 +7687,15 @@ "binop": null }, "value": "n", - "start": 1590, - "end": 1591, + "start": 1749, + "end": 1750, "loc": { "start": { - "line": 47, + "line": 50, "column": 12 }, "end": { - "line": 47, + "line": 50, "column": 13 } } @@ -7523,15 +7713,15 @@ "binop": null, "updateContext": null }, - "start": 1591, - "end": 1592, + "start": 1750, + "end": 1751, "loc": { "start": { - "line": 47, + "line": 50, "column": 13 }, "end": { - "line": 47, + "line": 50, "column": 14 } } @@ -7549,15 +7739,15 @@ "binop": null }, "value": "parent", - "start": 1592, - "end": 1598, + "start": 1751, + "end": 1757, "loc": { "start": { - "line": 47, + "line": 50, "column": 14 }, "end": { - "line": 47, + "line": 50, "column": 20 } } @@ -7575,15 +7765,15 @@ "binop": null, "updateContext": null }, - "start": 1598, - "end": 1599, + "start": 1757, + "end": 1758, "loc": { "start": { - "line": 47, + "line": 50, "column": 20 }, "end": { - "line": 47, + "line": 50, "column": 21 } } @@ -7601,15 +7791,15 @@ "binop": null }, "value": "_color", - "start": 1599, - "end": 1605, + "start": 1758, + "end": 1764, "loc": { "start": { - "line": 47, + "line": 50, "column": 21 }, "end": { - "line": 47, + "line": 50, "column": 27 } } @@ -7627,15 +7817,15 @@ "binop": null, "updateContext": null }, - "start": 1605, - "end": 1606, + "start": 1764, + "end": 1765, "loc": { "start": { - "line": 47, + "line": 50, "column": 27 }, "end": { - "line": 47, + "line": 50, "column": 28 } } @@ -7653,15 +7843,15 @@ "binop": null }, "value": "n", - "start": 1608, - "end": 1609, + "start": 1767, + "end": 1768, "loc": { "start": { - "line": 48, + "line": 51, "column": 1 }, "end": { - "line": 48, + "line": 51, "column": 2 } } @@ -7679,15 +7869,15 @@ "binop": null, "updateContext": null }, - "start": 1609, - "end": 1610, + "start": 1768, + "end": 1769, "loc": { "start": { - "line": 48, + "line": 51, "column": 2 }, "end": { - "line": 48, + "line": 51, "column": 3 } } @@ -7705,15 +7895,15 @@ "binop": null }, "value": "parent", - "start": 1610, - "end": 1616, + "start": 1769, + "end": 1775, "loc": { "start": { - "line": 48, + "line": 51, "column": 3 }, "end": { - "line": 48, + "line": 51, "column": 9 } } @@ -7731,15 +7921,15 @@ "binop": null, "updateContext": null }, - "start": 1616, - "end": 1617, + "start": 1775, + "end": 1776, "loc": { "start": { - "line": 48, + "line": 51, "column": 9 }, "end": { - "line": 48, + "line": 51, "column": 10 } } @@ -7757,15 +7947,15 @@ "binop": null }, "value": "_color", - "start": 1617, - "end": 1623, + "start": 1776, + "end": 1782, "loc": { "start": { - "line": 48, + "line": 51, "column": 10 }, "end": { - "line": 48, + "line": 51, "column": 16 } } @@ -7784,15 +7974,15 @@ "updateContext": null }, "value": "=", - "start": 1624, - "end": 1625, + "start": 1783, + "end": 1784, "loc": { "start": { - "line": 48, + "line": 51, "column": 17 }, "end": { - "line": 48, + "line": 51, "column": 18 } } @@ -7810,15 +8000,15 @@ "binop": null }, "value": "BLACK", - "start": 1626, - "end": 1631, + "start": 1785, + "end": 1790, "loc": { "start": { - "line": 48, + "line": 51, "column": 19 }, "end": { - "line": 48, + "line": 51, "column": 24 } } @@ -7836,15 +8026,15 @@ "binop": null, "updateContext": null }, - "start": 1631, - "end": 1632, + "start": 1790, + "end": 1791, "loc": { "start": { - "line": 48, + "line": 51, "column": 24 }, "end": { - "line": 48, + "line": 51, "column": 25 } } @@ -7864,15 +8054,15 @@ "updateContext": null }, "value": "if", - "start": 1635, - "end": 1637, + "start": 1794, + "end": 1796, "loc": { "start": { - "line": 50, + "line": 53, "column": 1 }, "end": { - "line": 50, + "line": 53, "column": 3 } } @@ -7889,15 +8079,15 @@ "postfix": false, "binop": null }, - "start": 1638, - "end": 1639, + "start": 1797, + "end": 1798, "loc": { "start": { - "line": 50, + "line": 53, "column": 4 }, "end": { - "line": 50, + "line": 53, "column": 5 } } @@ -7915,15 +8105,15 @@ "binop": null }, "value": "n", - "start": 1639, - "end": 1640, + "start": 1798, + "end": 1799, "loc": { "start": { - "line": 50, + "line": 53, "column": 5 }, "end": { - "line": 50, + "line": 53, "column": 6 } } @@ -7942,15 +8132,15 @@ "updateContext": null }, "value": "===", - "start": 1641, - "end": 1644, + "start": 1800, + "end": 1803, "loc": { "start": { - "line": 50, + "line": 53, "column": 7 }, "end": { - "line": 50, + "line": 53, "column": 10 } } @@ -7968,15 +8158,15 @@ "binop": null }, "value": "n", - "start": 1645, - "end": 1646, + "start": 1804, + "end": 1805, "loc": { "start": { - "line": 50, + "line": 53, "column": 11 }, "end": { - "line": 50, + "line": 53, "column": 12 } } @@ -7994,15 +8184,15 @@ "binop": null, "updateContext": null }, - "start": 1646, - "end": 1647, + "start": 1805, + "end": 1806, "loc": { "start": { - "line": 50, + "line": 53, "column": 12 }, "end": { - "line": 50, + "line": 53, "column": 13 } } @@ -8020,15 +8210,15 @@ "binop": null }, "value": "parent", - "start": 1647, - "end": 1653, + "start": 1806, + "end": 1812, "loc": { "start": { - "line": 50, + "line": 53, "column": 13 }, "end": { - "line": 50, + "line": 53, "column": 19 } } @@ -8046,15 +8236,15 @@ "binop": null, "updateContext": null }, - "start": 1653, - "end": 1654, + "start": 1812, + "end": 1813, "loc": { "start": { - "line": 50, + "line": 53, "column": 19 }, "end": { - "line": 50, + "line": 53, "column": 20 } } @@ -8072,15 +8262,15 @@ "binop": null }, "value": "left", - "start": 1654, - "end": 1658, + "start": 1813, + "end": 1817, "loc": { "start": { - "line": 50, + "line": 53, "column": 20 }, "end": { - "line": 50, + "line": 53, "column": 24 } } @@ -8097,15 +8287,15 @@ "postfix": false, "binop": null }, - "start": 1658, - "end": 1659, + "start": 1817, + "end": 1818, "loc": { "start": { - "line": 50, + "line": 53, "column": 24 }, "end": { - "line": 50, + "line": 53, "column": 25 } } @@ -8122,15 +8312,15 @@ "postfix": false, "binop": null }, - "start": 1660, - "end": 1661, + "start": 1819, + "end": 1820, "loc": { "start": { - "line": 50, + "line": 53, "column": 26 }, "end": { - "line": 50, + "line": 53, "column": 27 } } @@ -8148,15 +8338,15 @@ "binop": null }, "value": "assert", - "start": 1664, - "end": 1670, + "start": 1823, + "end": 1829, "loc": { "start": { - "line": 51, + "line": 54, "column": 2 }, "end": { - "line": 51, + "line": 54, "column": 8 } } @@ -8173,15 +8363,15 @@ "postfix": false, "binop": null }, - "start": 1670, - "end": 1671, + "start": 1829, + "end": 1830, "loc": { "start": { - "line": 51, + "line": 54, "column": 8 }, "end": { - "line": 51, + "line": 54, "column": 9 } } @@ -8199,15 +8389,15 @@ "binop": null }, "value": "s", - "start": 1671, - "end": 1672, + "start": 1830, + "end": 1831, "loc": { "start": { - "line": 51, + "line": 54, "column": 9 }, "end": { - "line": 51, + "line": 54, "column": 10 } } @@ -8225,15 +8415,15 @@ "binop": null, "updateContext": null }, - "start": 1672, - "end": 1673, + "start": 1831, + "end": 1832, "loc": { "start": { - "line": 51, + "line": 54, "column": 10 }, "end": { - "line": 51, + "line": 54, "column": 11 } } @@ -8251,15 +8441,15 @@ "binop": null }, "value": "right", - "start": 1673, - "end": 1678, + "start": 1832, + "end": 1837, "loc": { "start": { - "line": 51, + "line": 54, "column": 11 }, "end": { - "line": 51, + "line": 54, "column": 16 } } @@ -8277,15 +8467,15 @@ "binop": null, "updateContext": null }, - "start": 1678, - "end": 1679, + "start": 1837, + "end": 1838, "loc": { "start": { - "line": 51, + "line": 54, "column": 16 }, "end": { - "line": 51, + "line": 54, "column": 17 } } @@ -8303,15 +8493,15 @@ "binop": null }, "value": "_color", - "start": 1679, - "end": 1685, + "start": 1838, + "end": 1844, "loc": { "start": { - "line": 51, + "line": 54, "column": 17 }, "end": { - "line": 51, + "line": 54, "column": 23 } } @@ -8330,15 +8520,15 @@ "updateContext": null }, "value": "===", - "start": 1686, - "end": 1689, + "start": 1845, + "end": 1848, "loc": { "start": { - "line": 51, + "line": 54, "column": 24 }, "end": { - "line": 51, + "line": 54, "column": 27 } } @@ -8356,15 +8546,15 @@ "binop": null }, "value": "RED", - "start": 1690, - "end": 1693, + "start": 1849, + "end": 1852, "loc": { "start": { - "line": 51, + "line": 54, "column": 28 }, "end": { - "line": 51, + "line": 54, "column": 31 } } @@ -8381,15 +8571,15 @@ "postfix": false, "binop": null }, - "start": 1693, - "end": 1694, + "start": 1852, + "end": 1853, "loc": { "start": { - "line": 51, + "line": 54, "column": 31 }, "end": { - "line": 51, + "line": 54, "column": 32 } } @@ -8407,15 +8597,15 @@ "binop": null, "updateContext": null }, - "start": 1694, - "end": 1695, + "start": 1853, + "end": 1854, "loc": { "start": { - "line": 51, + "line": 54, "column": 32 }, "end": { - "line": 51, + "line": 54, "column": 33 } } @@ -8433,15 +8623,15 @@ "binop": null }, "value": "s", - "start": 1698, - "end": 1699, + "start": 1857, + "end": 1858, "loc": { "start": { - "line": 52, + "line": 55, "column": 2 }, "end": { - "line": 52, + "line": 55, "column": 3 } } @@ -8459,15 +8649,15 @@ "binop": null, "updateContext": null }, - "start": 1699, - "end": 1700, + "start": 1858, + "end": 1859, "loc": { "start": { - "line": 52, + "line": 55, "column": 3 }, "end": { - "line": 52, + "line": 55, "column": 4 } } @@ -8485,15 +8675,15 @@ "binop": null }, "value": "right", - "start": 1700, - "end": 1705, + "start": 1859, + "end": 1864, "loc": { "start": { - "line": 52, + "line": 55, "column": 4 }, "end": { - "line": 52, + "line": 55, "column": 9 } } @@ -8511,15 +8701,15 @@ "binop": null, "updateContext": null }, - "start": 1705, - "end": 1706, + "start": 1864, + "end": 1865, "loc": { "start": { - "line": 52, + "line": 55, "column": 9 }, "end": { - "line": 52, + "line": 55, "column": 10 } } @@ -8537,15 +8727,15 @@ "binop": null }, "value": "_color", - "start": 1706, - "end": 1712, + "start": 1865, + "end": 1871, "loc": { "start": { - "line": 52, + "line": 55, "column": 10 }, "end": { - "line": 52, + "line": 55, "column": 16 } } @@ -8564,15 +8754,15 @@ "updateContext": null }, "value": "=", - "start": 1713, - "end": 1714, + "start": 1872, + "end": 1873, "loc": { "start": { - "line": 52, + "line": 55, "column": 17 }, "end": { - "line": 52, + "line": 55, "column": 18 } } @@ -8590,15 +8780,15 @@ "binop": null }, "value": "BLACK", - "start": 1715, - "end": 1720, + "start": 1874, + "end": 1879, "loc": { "start": { - "line": 52, + "line": 55, "column": 19 }, "end": { - "line": 52, + "line": 55, "column": 24 } } @@ -8616,15 +8806,15 @@ "binop": null, "updateContext": null }, - "start": 1720, - "end": 1721, + "start": 1879, + "end": 1880, "loc": { "start": { - "line": 52, + "line": 55, "column": 24 }, "end": { - "line": 52, + "line": 55, "column": 25 } } @@ -8642,15 +8832,15 @@ "binop": null }, "value": "rotate_left", - "start": 1724, - "end": 1735, + "start": 1883, + "end": 1894, "loc": { "start": { - "line": 53, + "line": 56, "column": 2 }, "end": { - "line": 53, + "line": 56, "column": 13 } } @@ -8667,15 +8857,15 @@ "postfix": false, "binop": null }, - "start": 1735, - "end": 1736, + "start": 1894, + "end": 1895, "loc": { "start": { - "line": 53, + "line": 56, "column": 13 }, "end": { - "line": 53, + "line": 56, "column": 14 } } @@ -8693,15 +8883,15 @@ "binop": null }, "value": "n", - "start": 1736, - "end": 1737, + "start": 1895, + "end": 1896, "loc": { "start": { - "line": 53, + "line": 56, "column": 14 }, "end": { - "line": 53, + "line": 56, "column": 15 } } @@ -8719,15 +8909,15 @@ "binop": null, "updateContext": null }, - "start": 1737, - "end": 1738, + "start": 1896, + "end": 1897, "loc": { "start": { - "line": 53, + "line": 56, "column": 15 }, "end": { - "line": 53, + "line": 56, "column": 16 } } @@ -8745,15 +8935,15 @@ "binop": null }, "value": "parent", - "start": 1738, - "end": 1744, + "start": 1897, + "end": 1903, "loc": { "start": { - "line": 53, + "line": 56, "column": 16 }, "end": { - "line": 53, + "line": 56, "column": 22 } } @@ -8770,15 +8960,15 @@ "postfix": false, "binop": null }, - "start": 1744, - "end": 1745, + "start": 1903, + "end": 1904, "loc": { "start": { - "line": 53, + "line": 56, "column": 22 }, "end": { - "line": 53, + "line": 56, "column": 23 } } @@ -8796,64 +8986,76 @@ "binop": null, "updateContext": null }, - "start": 1745, - "end": 1746, + "start": 1904, + "end": 1905, "loc": { "start": { - "line": 53, + "line": 56, "column": 23 }, "end": { - "line": 53, + "line": 56, "column": 24 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "return", + "keyword": "return", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1748, - "end": 1749, + "value": "return", + "start": 1908, + "end": 1914, "loc": { "start": { - "line": 54, - "column": 1 + "line": 57, + "column": 2 }, "end": { - "line": 54, - "column": 2 + "line": 57, + "column": 8 } } }, { - "type": "CommentLine", - "value": " Symmetric case", - "start": 1752, - "end": 1769, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "s", + "start": 1915, + "end": 1916, "loc": { "start": { - "line": 56, - "column": 1 + "line": 57, + "column": 9 }, "end": { - "line": 56, - "column": 18 + "line": 57, + "column": 10 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8864,25 +9066,24 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1771, - "end": 1775, + "start": 1916, + "end": 1917, "loc": { "start": { "line": 57, - "column": 1 + "column": 10 }, "end": { "line": 57, - "column": 5 + "column": 11 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8890,16 +9091,32 @@ "postfix": false, "binop": null }, - "start": 1776, - "end": 1777, + "start": 1919, + "end": 1920, "loc": { "start": { - "line": 57, - "column": 6 + "line": 58, + "column": 1 }, "end": { - "line": 57, - "column": 7 + "line": 58, + "column": 2 + } + } + }, + { + "type": "CommentLine", + "value": " Symmetric case", + "start": 1923, + "end": 1940, + "loc": { + "start": { + "line": 60, + "column": 1 + }, + "end": { + "line": 60, + "column": 18 } } }, @@ -8916,16 +9133,16 @@ "binop": null }, "value": "assert", - "start": 1780, - "end": 1786, + "start": 1943, + "end": 1949, "loc": { "start": { - "line": 58, - "column": 2 + "line": 62, + "column": 1 }, "end": { - "line": 58, - "column": 8 + "line": 62, + "column": 7 } } }, @@ -8941,16 +9158,16 @@ "postfix": false, "binop": null }, - "start": 1786, - "end": 1787, + "start": 1949, + "end": 1950, "loc": { "start": { - "line": 58, - "column": 8 + "line": 62, + "column": 7 }, "end": { - "line": 58, - "column": 9 + "line": 62, + "column": 8 } } }, @@ -8967,16 +9184,16 @@ "binop": null }, "value": "s", - "start": 1787, - "end": 1788, + "start": 1950, + "end": 1951, "loc": { "start": { - "line": 58, - "column": 9 + "line": 62, + "column": 8 }, "end": { - "line": 58, - "column": 10 + "line": 62, + "column": 9 } } }, @@ -8993,16 +9210,16 @@ "binop": null, "updateContext": null }, - "start": 1788, - "end": 1789, + "start": 1951, + "end": 1952, "loc": { "start": { - "line": 58, - "column": 10 + "line": 62, + "column": 9 }, "end": { - "line": 58, - "column": 11 + "line": 62, + "column": 10 } } }, @@ -9019,16 +9236,16 @@ "binop": null }, "value": "left", - "start": 1789, - "end": 1793, + "start": 1952, + "end": 1956, "loc": { "start": { - "line": 58, - "column": 11 + "line": 62, + "column": 10 }, "end": { - "line": 58, - "column": 15 + "line": 62, + "column": 14 } } }, @@ -9045,16 +9262,16 @@ "binop": null, "updateContext": null }, - "start": 1793, - "end": 1794, + "start": 1956, + "end": 1957, "loc": { "start": { - "line": 58, - "column": 15 + "line": 62, + "column": 14 }, "end": { - "line": 58, - "column": 16 + "line": 62, + "column": 15 } } }, @@ -9071,16 +9288,16 @@ "binop": null }, "value": "_color", - "start": 1794, - "end": 1800, + "start": 1957, + "end": 1963, "loc": { "start": { - "line": 58, - "column": 16 + "line": 62, + "column": 15 }, "end": { - "line": 58, - "column": 22 + "line": 62, + "column": 21 } } }, @@ -9098,16 +9315,16 @@ "updateContext": null }, "value": "===", - "start": 1801, - "end": 1804, + "start": 1964, + "end": 1967, "loc": { "start": { - "line": 58, - "column": 23 + "line": 62, + "column": 22 }, "end": { - "line": 58, - "column": 26 + "line": 62, + "column": 25 } } }, @@ -9124,16 +9341,16 @@ "binop": null }, "value": "RED", - "start": 1805, - "end": 1808, + "start": 1968, + "end": 1971, "loc": { "start": { - "line": 58, - "column": 27 + "line": 62, + "column": 26 }, "end": { - "line": 58, - "column": 30 + "line": 62, + "column": 29 } } }, @@ -9149,16 +9366,16 @@ "postfix": false, "binop": null }, - "start": 1808, - "end": 1809, + "start": 1971, + "end": 1972, "loc": { "start": { - "line": 58, - "column": 30 + "line": 62, + "column": 29 }, "end": { - "line": 58, - "column": 31 + "line": 62, + "column": 30 } } }, @@ -9175,16 +9392,16 @@ "binop": null, "updateContext": null }, - "start": 1809, - "end": 1810, + "start": 1972, + "end": 1973, "loc": { "start": { - "line": 58, - "column": 31 + "line": 62, + "column": 30 }, "end": { - "line": 58, - "column": 32 + "line": 62, + "column": 31 } } }, @@ -9201,16 +9418,16 @@ "binop": null }, "value": "s", - "start": 1813, - "end": 1814, + "start": 1975, + "end": 1976, "loc": { "start": { - "line": 59, - "column": 2 + "line": 63, + "column": 1 }, "end": { - "line": 59, - "column": 3 + "line": 63, + "column": 2 } } }, @@ -9227,16 +9444,16 @@ "binop": null, "updateContext": null }, - "start": 1814, - "end": 1815, + "start": 1976, + "end": 1977, "loc": { "start": { - "line": 59, - "column": 3 + "line": 63, + "column": 2 }, "end": { - "line": 59, - "column": 4 + "line": 63, + "column": 3 } } }, @@ -9253,16 +9470,16 @@ "binop": null }, "value": "left", - "start": 1815, - "end": 1819, + "start": 1977, + "end": 1981, "loc": { "start": { - "line": 59, - "column": 4 + "line": 63, + "column": 3 }, "end": { - "line": 59, - "column": 8 + "line": 63, + "column": 7 } } }, @@ -9279,16 +9496,16 @@ "binop": null, "updateContext": null }, - "start": 1819, - "end": 1820, + "start": 1981, + "end": 1982, "loc": { "start": { - "line": 59, - "column": 8 + "line": 63, + "column": 7 }, "end": { - "line": 59, - "column": 9 + "line": 63, + "column": 8 } } }, @@ -9305,16 +9522,16 @@ "binop": null }, "value": "_color", - "start": 1820, - "end": 1826, + "start": 1982, + "end": 1988, "loc": { "start": { - "line": 59, - "column": 9 + "line": 63, + "column": 8 }, "end": { - "line": 59, - "column": 15 + "line": 63, + "column": 14 } } }, @@ -9332,16 +9549,16 @@ "updateContext": null }, "value": "=", - "start": 1827, - "end": 1828, + "start": 1989, + "end": 1990, "loc": { "start": { - "line": 59, - "column": 16 + "line": 63, + "column": 15 }, "end": { - "line": 59, - "column": 17 + "line": 63, + "column": 16 } } }, @@ -9358,16 +9575,16 @@ "binop": null }, "value": "BLACK", - "start": 1829, - "end": 1834, + "start": 1991, + "end": 1996, "loc": { "start": { - "line": 59, - "column": 18 + "line": 63, + "column": 17 }, "end": { - "line": 59, - "column": 23 + "line": 63, + "column": 22 } } }, @@ -9384,16 +9601,16 @@ "binop": null, "updateContext": null }, - "start": 1834, - "end": 1835, + "start": 1996, + "end": 1997, "loc": { "start": { - "line": 59, - "column": 23 + "line": 63, + "column": 22 }, "end": { - "line": 59, - "column": 24 + "line": 63, + "column": 23 } } }, @@ -9410,16 +9627,16 @@ "binop": null }, "value": "rotate_right", - "start": 1838, - "end": 1850, + "start": 1999, + "end": 2011, "loc": { "start": { - "line": 60, - "column": 2 + "line": 64, + "column": 1 }, "end": { - "line": 60, - "column": 14 + "line": 64, + "column": 13 } } }, @@ -9435,16 +9652,16 @@ "postfix": false, "binop": null }, - "start": 1850, - "end": 1851, + "start": 2011, + "end": 2012, "loc": { "start": { - "line": 60, - "column": 14 + "line": 64, + "column": 13 }, "end": { - "line": 60, - "column": 15 + "line": 64, + "column": 14 } } }, @@ -9461,16 +9678,16 @@ "binop": null }, "value": "n", - "start": 1851, - "end": 1852, + "start": 2012, + "end": 2013, "loc": { "start": { - "line": 60, - "column": 15 + "line": 64, + "column": 14 }, "end": { - "line": 60, - "column": 16 + "line": 64, + "column": 15 } } }, @@ -9487,16 +9704,16 @@ "binop": null, "updateContext": null }, - "start": 1852, - "end": 1853, + "start": 2013, + "end": 2014, "loc": { "start": { - "line": 60, - "column": 16 + "line": 64, + "column": 15 }, "end": { - "line": 60, - "column": 17 + "line": 64, + "column": 16 } } }, @@ -9513,16 +9730,16 @@ "binop": null }, "value": "parent", - "start": 1853, - "end": 1859, + "start": 2014, + "end": 2020, "loc": { "start": { - "line": 60, - "column": 17 + "line": 64, + "column": 16 }, "end": { - "line": 60, - "column": 23 + "line": 64, + "column": 22 } } }, @@ -9538,16 +9755,16 @@ "postfix": false, "binop": null }, - "start": 1859, - "end": 1860, + "start": 2020, + "end": 2021, "loc": { "start": { - "line": 60, - "column": 23 + "line": 64, + "column": 22 }, "end": { - "line": 60, - "column": 24 + "line": 64, + "column": 23 } } }, @@ -9564,24 +9781,52 @@ "binop": null, "updateContext": null }, - "start": 1860, - "end": 1861, + "start": 2021, + "end": 2022, "loc": { "start": { - "line": 60, + "line": 64, + "column": 23 + }, + "end": { + "line": 64, "column": 24 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 2024, + "end": 2030, + "loc": { + "start": { + "line": 65, + "column": 1 }, "end": { - "line": 60, - "column": 25 + "line": 65, + "column": 7 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -9589,16 +9834,43 @@ "postfix": false, "binop": null }, - "start": 1863, - "end": 1864, + "value": "s", + "start": 2031, + "end": 2032, "loc": { "start": { - "line": 61, - "column": 1 + "line": 65, + "column": 8 }, "end": { - "line": 61, - "column": 2 + "line": 65, + "column": 9 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2032, + "end": 2033, + "loc": { + "start": { + "line": 65, + "column": 9 + }, + "end": { + "line": 65, + "column": 10 } } }, @@ -9614,15 +9886,15 @@ "postfix": false, "binop": null }, - "start": 1865, - "end": 1866, + "start": 2034, + "end": 2035, "loc": { "start": { - "line": 62, + "line": 66, "column": 0 }, "end": { - "line": 62, + "line": 66, "column": 1 } } @@ -9640,15 +9912,15 @@ "binop": null, "updateContext": null }, - "start": 1866, - "end": 1867, + "start": 2035, + "end": 2036, "loc": { "start": { - "line": 62, + "line": 66, "column": 1 }, "end": { - "line": 62, + "line": 66, "column": 2 } } @@ -9668,15 +9940,15 @@ "updateContext": null }, "value": "export", - "start": 1869, - "end": 1875, + "start": 2038, + "end": 2044, "loc": { "start": { - "line": 64, + "line": 68, "column": 0 }, "end": { - "line": 64, + "line": 68, "column": 6 } } @@ -9696,15 +9968,15 @@ "updateContext": null }, "value": "default", - "start": 1876, - "end": 1883, + "start": 2045, + "end": 2052, "loc": { "start": { - "line": 64, + "line": 68, "column": 7 }, "end": { - "line": 64, + "line": 68, "column": 14 } } @@ -9722,15 +9994,15 @@ "binop": null }, "value": "delete_case5", - "start": 1884, - "end": 1896, + "start": 2053, + "end": 2065, "loc": { "start": { - "line": 64, + "line": 68, "column": 15 }, "end": { - "line": 64, + "line": 68, "column": 27 } } @@ -9748,15 +10020,15 @@ "binop": null, "updateContext": null }, - "start": 1896, - "end": 1897, + "start": 2065, + "end": 2066, "loc": { "start": { - "line": 64, + "line": 68, "column": 27 }, "end": { - "line": 64, + "line": 68, "column": 28 } } @@ -9774,15 +10046,15 @@ "binop": null, "updateContext": null }, - "start": 1898, - "end": 1898, + "start": 2067, + "end": 2067, "loc": { "start": { - "line": 65, + "line": 69, "column": 0 }, "end": { - "line": 65, + "line": 69, "column": 0 } } diff --git a/ast/source/deletion/delete_no_child.js.json b/ast/source/deletion/delete_no_child.js.json index f56bf9a..76f32bc 100644 --- a/ast/source/deletion/delete_no_child.js.json +++ b/ast/source/deletion/delete_no_child.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1153, + "end": 1061, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 49, + "line": 44, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1153, + "end": 1061, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 49, + "line": 44, "column": 0 } }, @@ -346,9 +346,9 @@ "line": 6, "column": 19 }, - "identifierName": "replace_node" + "identifierName": "delete_case1" }, - "name": "replace_node" + "name": "delete_case1" } } ], @@ -366,75 +366,6 @@ "column": 44 } }, - "extra": { - "rawValue": "./replace_node.js", - "raw": "'./replace_node.js'" - }, - "value": "./replace_node.js" - } - }, - { - "type": "ImportDeclaration", - "start": 187, - "end": 232, - "loc": { - "start": { - "line": 7, - "column": 0 - }, - "end": { - "line": 7, - "column": 45 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 194, - "end": 206, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 194, - "end": 206, - "loc": { - "start": { - "line": 7, - "column": 7 - }, - "end": { - "line": 7, - "column": 19 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 212, - "end": 231, - "loc": { - "start": { - "line": 7, - "column": 25 - }, - "end": { - "line": 7, - "column": 44 - } - }, "extra": { "rawValue": "./delete_case1.js", "raw": "'./delete_case1.js'" @@ -444,44 +375,44 @@ }, { "type": "ImportDeclaration", - "start": 234, - "end": 265, + "start": 188, + "end": 219, "loc": { "start": { - "line": 9, + "line": 8, "column": 0 }, "end": { - "line": 9, + "line": 8, "column": 31 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", - "start": 241, - "end": 246, + "start": 195, + "end": 200, "loc": { "start": { - "line": 9, + "line": 8, "column": 7 }, "end": { - "line": 9, + "line": 8, "column": 12 } }, "local": { "type": "Identifier", - "start": 241, - "end": 246, + "start": 195, + "end": 200, "loc": { "start": { - "line": 9, + "line": 8, "column": 7 }, "end": { - "line": 9, + "line": 8, "column": 12 }, "identifierName": "prune" @@ -492,15 +423,15 @@ ], "source": { "type": "StringLiteral", - "start": 252, - "end": 264, + "start": 206, + "end": 218, "loc": { "start": { - "line": 9, + "line": 8, "column": 18 }, "end": { - "line": 9, + "line": 8, "column": 30 } }, @@ -513,12 +444,12 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n ", - "start": 267, - "end": 455, + "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n * @return {Node} The root of the modified subtree.\n ", + "start": 221, + "end": 461, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { @@ -531,37 +462,37 @@ }, { "type": "Identifier", - "start": 456, - "end": 1119, + "start": 462, + "end": 1027, "loc": { "start": { "line": 20, "column": 0 }, "end": { - "line": 46, + "line": 41, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 462, - "end": 1118, + "start": 468, + "end": 1026, "loc": { "start": { "line": 20, "column": 6 }, "end": { - "line": 46, + "line": 41, "column": 1 } }, "id": { "type": "Identifier", - "start": 462, - "end": 477, + "start": 468, + "end": 483, "loc": { "start": { "line": 20, @@ -578,15 +509,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 480, - "end": 1118, + "start": 486, + "end": 1026, "loc": { "start": { "line": 20, "column": 24 }, "end": { - "line": 46, + "line": 41, "column": 1 } }, @@ -597,8 +528,8 @@ "params": [ { "type": "Identifier", - "start": 481, - "end": 482, + "start": 487, + "end": 488, "loc": { "start": { "line": 20, @@ -615,23 +546,23 @@ ], "body": { "type": "BlockStatement", - "start": 487, - "end": 1118, + "start": 493, + "end": 1026, "loc": { "start": { "line": 20, "column": 31 }, "end": { - "line": 46, + "line": 41, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 490, - "end": 516, + "start": 496, + "end": 522, "loc": { "start": { "line": 21, @@ -644,8 +575,8 @@ }, "expression": { "type": "CallExpression", - "start": 490, - "end": 515, + "start": 496, + "end": 521, "loc": { "start": { "line": 21, @@ -658,8 +589,8 @@ }, "callee": { "type": "Identifier", - "start": 490, - "end": 496, + "start": 496, + "end": 502, "loc": { "start": { "line": 21, @@ -676,8 +607,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 497, - "end": 514, + "start": 503, + "end": 520, "loc": { "start": { "line": 21, @@ -690,8 +621,8 @@ }, "left": { "type": "Identifier", - "start": 497, - "end": 498, + "start": 503, + "end": 504, "loc": { "start": { "line": 21, @@ -708,8 +639,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 510, - "end": 514, + "start": 516, + "end": 520, "loc": { "start": { "line": 21, @@ -729,8 +660,8 @@ }, { "type": "ExpressionStatement", - "start": 518, - "end": 544, + "start": 524, + "end": 550, "loc": { "start": { "line": 22, @@ -743,8 +674,8 @@ }, "expression": { "type": "CallExpression", - "start": 518, - "end": 543, + "start": 524, + "end": 549, "loc": { "start": { "line": 22, @@ -757,8 +688,8 @@ }, "callee": { "type": "Identifier", - "start": 518, - "end": 524, + "start": 524, + "end": 530, "loc": { "start": { "line": 22, @@ -775,8 +706,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 525, - "end": 542, + "start": 531, + "end": 548, "loc": { "start": { "line": 22, @@ -789,8 +720,8 @@ }, "left": { "type": "MemberExpression", - "start": 525, - "end": 533, + "start": 531, + "end": 539, "loc": { "start": { "line": 22, @@ -803,8 +734,8 @@ }, "object": { "type": "Identifier", - "start": 525, - "end": 526, + "start": 531, + "end": 532, "loc": { "start": { "line": 22, @@ -820,8 +751,8 @@ }, "property": { "type": "Identifier", - "start": 527, - "end": 533, + "start": 533, + "end": 539, "loc": { "start": { "line": 22, @@ -840,8 +771,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 538, - "end": 542, + "start": 544, + "end": 548, "loc": { "start": { "line": 22, @@ -859,8 +790,8 @@ }, { "type": "ExpressionStatement", - "start": 546, - "end": 570, + "start": 552, + "end": 576, "loc": { "start": { "line": 23, @@ -873,8 +804,8 @@ }, "expression": { "type": "CallExpression", - "start": 546, - "end": 569, + "start": 552, + "end": 575, "loc": { "start": { "line": 23, @@ -887,8 +818,8 @@ }, "callee": { "type": "Identifier", - "start": 546, - "end": 552, + "start": 552, + "end": 558, "loc": { "start": { "line": 23, @@ -905,8 +836,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 553, - "end": 568, + "start": 559, + "end": 574, "loc": { "start": { "line": 23, @@ -919,8 +850,8 @@ }, "left": { "type": "MemberExpression", - "start": 553, - "end": 559, + "start": 559, + "end": 565, "loc": { "start": { "line": 23, @@ -933,8 +864,8 @@ }, "object": { "type": "Identifier", - "start": 553, - "end": 554, + "start": 559, + "end": 560, "loc": { "start": { "line": 23, @@ -950,8 +881,8 @@ }, "property": { "type": "Identifier", - "start": 555, - "end": 559, + "start": 561, + "end": 565, "loc": { "start": { "line": 23, @@ -970,8 +901,8 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 564, - "end": 568, + "start": 570, + "end": 574, "loc": { "start": { "line": 23, @@ -989,8 +920,8 @@ }, { "type": "ExpressionStatement", - "start": 572, - "end": 597, + "start": 578, + "end": 603, "loc": { "start": { "line": 24, @@ -1003,8 +934,8 @@ }, "expression": { "type": "CallExpression", - "start": 572, - "end": 596, + "start": 578, + "end": 602, "loc": { "start": { "line": 24, @@ -1017,8 +948,8 @@ }, "callee": { "type": "Identifier", - "start": 572, - "end": 578, + "start": 578, + "end": 584, "loc": { "start": { "line": 24, @@ -1035,8 +966,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 579, - "end": 595, + "start": 585, + "end": 601, "loc": { "start": { "line": 24, @@ -1049,8 +980,8 @@ }, "left": { "type": "MemberExpression", - "start": 579, - "end": 586, + "start": 585, + "end": 592, "loc": { "start": { "line": 24, @@ -1063,8 +994,8 @@ }, "object": { "type": "Identifier", - "start": 579, - "end": 580, + "start": 585, + "end": 586, "loc": { "start": { "line": 24, @@ -1080,8 +1011,8 @@ }, "property": { "type": "Identifier", - "start": 581, - "end": 586, + "start": 587, + "end": 592, "loc": { "start": { "line": 24, @@ -1100,8 +1031,8 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 591, - "end": 595, + "start": 597, + "end": 601, "loc": { "start": { "line": 24, @@ -1119,8 +1050,8 @@ }, { "type": "IfStatement", - "start": 600, - "end": 678, + "start": 606, + "end": 693, "loc": { "start": { "line": 26, @@ -1133,8 +1064,8 @@ }, "test": { "type": "BinaryExpression", - "start": 604, - "end": 622, + "start": 610, + "end": 628, "loc": { "start": { "line": 26, @@ -1147,8 +1078,8 @@ }, "left": { "type": "MemberExpression", - "start": 604, - "end": 612, + "start": 610, + "end": 618, "loc": { "start": { "line": 26, @@ -1161,8 +1092,8 @@ }, "object": { "type": "Identifier", - "start": 604, - "end": 605, + "start": 610, + "end": 611, "loc": { "start": { "line": 26, @@ -1178,8 +1109,8 @@ }, "property": { "type": "Identifier", - "start": 606, - "end": 612, + "start": 612, + "end": 618, "loc": { "start": { "line": 26, @@ -1198,8 +1129,8 @@ "operator": "!==", "right": { "type": "Identifier", - "start": 617, - "end": 622, + "start": 623, + "end": 628, "loc": { "start": { "line": 26, @@ -1216,8 +1147,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 624, - "end": 678, + "start": 630, + "end": 693, "loc": { "start": { "line": 26, @@ -1231,8 +1162,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 628, - "end": 653, + "start": 634, + "end": 659, "loc": { "start": { "line": 27, @@ -1245,8 +1176,8 @@ }, "expression": { "type": "CallExpression", - "start": 628, - "end": 652, + "start": 634, + "end": 658, "loc": { "start": { "line": 27, @@ -1259,8 +1190,8 @@ }, "callee": { "type": "Identifier", - "start": 628, - "end": 634, + "start": 634, + "end": 640, "loc": { "start": { "line": 27, @@ -1277,8 +1208,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 635, - "end": 651, + "start": 641, + "end": 657, "loc": { "start": { "line": 27, @@ -1291,8 +1222,8 @@ }, "left": { "type": "MemberExpression", - "start": 635, - "end": 643, + "start": 641, + "end": 649, "loc": { "start": { "line": 27, @@ -1305,8 +1236,8 @@ }, "object": { "type": "Identifier", - "start": 635, - "end": 636, + "start": 641, + "end": 642, "loc": { "start": { "line": 27, @@ -1322,8 +1253,8 @@ }, "property": { "type": "Identifier", - "start": 637, - "end": 643, + "start": 643, + "end": 649, "loc": { "start": { "line": 27, @@ -1342,8 +1273,8 @@ "operator": "===", "right": { "type": "Identifier", - "start": 648, - "end": 651, + "start": 654, + "end": 657, "loc": { "start": { "line": 27, @@ -1363,8 +1294,8 @@ }, { "type": "ExpressionStatement", - "start": 656, - "end": 665, + "start": 662, + "end": 671, "loc": { "start": { "line": 28, @@ -1377,8 +1308,8 @@ }, "expression": { "type": "CallExpression", - "start": 656, - "end": 664, + "start": 662, + "end": 670, "loc": { "start": { "line": 28, @@ -1391,8 +1322,8 @@ }, "callee": { "type": "Identifier", - "start": 656, - "end": 661, + "start": 662, + "end": 667, "loc": { "start": { "line": 28, @@ -1409,8 +1340,8 @@ "arguments": [ { "type": "Identifier", - "start": 662, - "end": 663, + "start": 668, + "end": 669, "loc": { "start": { "line": 28, @@ -1429,8 +1360,8 @@ }, { "type": "ReturnStatement", - "start": 668, - "end": 675, + "start": 674, + "end": 690, "loc": { "start": { "line": 29, @@ -1438,10 +1369,59 @@ }, "end": { "line": 29, - "column": 9 + "column": 18 } }, - "argument": null + "argument": { + "type": "MemberExpression", + "start": 681, + "end": 689, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 681, + "end": 682, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 683, + "end": 689, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 17 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } } ], "directives": [], @@ -1451,9 +1431,9 @@ "trailingComments": [ { "type": "CommentLine", - "value": " Mock leaf since there is no left child", - "start": 681, - "end": 722, + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 696, + "end": 770, "loc": { "start": { "line": 32, @@ -1461,15 +1441,15 @@ }, "end": { "line": 32, - "column": 42 + "column": 75 } } }, { "type": "CommentLine", - "value": " We use key = n.key to avoid mixing types, but this property is never", - "start": 724, - "end": 795, + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 772, + "end": 843, "loc": { "start": { "line": 33, @@ -1483,9 +1463,9 @@ }, { "type": "CommentLine", - "value": " accessed.", - "start": 797, - "end": 809, + "value": " NOTE We temporarily keep n in the tree to mock a leaf, since n does not", + "start": 845, + "end": 919, "loc": { "start": { "line": 34, @@ -1493,7 +1473,23 @@ }, "end": { "line": 34, - "column": 13 + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " have children.", + "start": 921, + "end": 938, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 18 } } } @@ -1501,149 +1497,99 @@ }, { "type": "VariableDeclaration", - "start": 811, - "end": 847, + "start": 940, + "end": 972, "loc": { "start": { - "line": 35, + "line": 36, "column": 1 }, "end": { - "line": 35, - "column": 37 + "line": 36, + "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 817, - "end": 846, + "start": 946, + "end": 971, "loc": { "start": { - "line": 35, + "line": 36, "column": 7 }, "end": { - "line": 35, - "column": 36 + "line": 36, + "column": 32 } }, "id": { "type": "Identifier", - "start": 817, - "end": 821, + "start": 946, + "end": 953, "loc": { "start": { - "line": 35, + "line": 36, "column": 7 }, "end": { - "line": 35, - "column": 11 + "line": 36, + "column": 14 }, - "identifierName": "leaf" + "identifierName": "subtree" }, - "name": "leaf", + "name": "subtree", "leadingComments": null }, "init": { - "type": "NewExpression", - "start": 824, - "end": 846, + "type": "CallExpression", + "start": 956, + "end": 971, "loc": { "start": { - "line": 35, - "column": 14 + "line": 36, + "column": 17 }, "end": { - "line": 35, - "column": 36 + "line": 36, + "column": 32 } }, "callee": { "type": "Identifier", - "start": 828, - "end": 832, + "start": 956, + "end": 968, "loc": { "start": { - "line": 35, - "column": 18 + "line": 36, + "column": 17 }, "end": { - "line": 35, - "column": 22 + "line": 36, + "column": 29 }, - "identifierName": "Node" + "identifierName": "delete_case1" }, - "name": "Node" + "name": "delete_case1" }, "arguments": [ { "type": "Identifier", - "start": 833, - "end": 838, - "loc": { - "start": { - "line": 35, - "column": 23 - }, - "end": { - "line": 35, - "column": 28 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - { - "type": "MemberExpression", - "start": 840, - "end": 845, + "start": 969, + "end": 970, "loc": { "start": { - "line": 35, + "line": 36, "column": 30 }, "end": { - "line": 35, - "column": 35 - } - }, - "object": { - "type": "Identifier", - "start": 840, - "end": 841, - "loc": { - "start": { - "line": 35, - "column": 30 - }, - "end": { - "line": 35, - "column": 31 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 842, - "end": 845, - "loc": { - "start": { - "line": 35, - "column": 32 - }, - "end": { - "line": 35, - "column": 35 - }, - "identifierName": "key" + "line": 36, + "column": 31 }, - "name": "key" + "identifierName": "n" }, - "computed": false + "name": "n" } ] }, @@ -1654,9 +1600,9 @@ "leadingComments": [ { "type": "CommentLine", - "value": " Mock leaf since there is no left child", - "start": 681, - "end": 722, + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 696, + "end": 770, "loc": { "start": { "line": 32, @@ -1664,15 +1610,15 @@ }, "end": { "line": 32, - "column": 42 + "column": 75 } } }, { "type": "CommentLine", - "value": " We use key = n.key to avoid mixing types, but this property is never", - "start": 724, - "end": 795, + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 772, + "end": 843, "loc": { "start": { "line": 33, @@ -1686,9 +1632,9 @@ }, { "type": "CommentLine", - "value": " accessed.", - "start": 797, - "end": 809, + "value": " NOTE We temporarily keep n in the tree to mock a leaf, since n does not", + "start": 845, + "end": 919, "loc": { "start": { "line": 34, @@ -1696,7 +1642,23 @@ }, "end": { "line": 34, - "column": 13 + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " have children.", + "start": 921, + "end": 938, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 18 } } } @@ -1704,17 +1666,17 @@ "trailingComments": [ { "type": "CommentLine", - "value": " Replace n with the mocked leaf", - "start": 850, - "end": 883, + "value": " Delete mocked leaf", + "start": 975, + "end": 996, "loc": { "start": { - "line": 37, + "line": 38, "column": 1 }, "end": { - "line": 37, - "column": 34 + "line": 38, + "column": 22 } } } @@ -1722,84 +1684,67 @@ }, { "type": "ExpressionStatement", - "start": 885, - "end": 907, + "start": 998, + "end": 1007, "loc": { "start": { - "line": 38, + "line": 39, "column": 1 }, "end": { - "line": 38, - "column": 23 + "line": 39, + "column": 10 } }, "expression": { "type": "CallExpression", - "start": 885, - "end": 906, + "start": 998, + "end": 1006, "loc": { "start": { - "line": 38, + "line": 39, "column": 1 }, "end": { - "line": 38, - "column": 22 + "line": 39, + "column": 9 } }, "callee": { "type": "Identifier", - "start": 885, - "end": 897, + "start": 998, + "end": 1003, "loc": { "start": { - "line": 38, + "line": 39, "column": 1 }, "end": { - "line": 38, - "column": 13 + "line": 39, + "column": 6 }, - "identifierName": "replace_node" + "identifierName": "prune" }, - "name": "replace_node", + "name": "prune", "leadingComments": null }, "arguments": [ { "type": "Identifier", - "start": 898, - "end": 899, + "start": 1004, + "end": 1005, "loc": { "start": { - "line": 38, - "column": 14 + "line": 39, + "column": 7 }, "end": { - "line": 38, - "column": 15 + "line": 39, + "column": 8 }, "identifierName": "n" }, "name": "n" - }, - { - "type": "Identifier", - "start": 901, - "end": 905, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 21 - }, - "identifierName": "leaf" - }, - "name": "leaf" } ], "leadingComments": null @@ -1807,261 +1752,53 @@ "leadingComments": [ { "type": "CommentLine", - "value": " Replace n with the mocked leaf", - "start": 850, - "end": 883, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 34 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 910, - "end": 984, - "loc": { - "start": { - "line": 40, - "column": 1 - }, - "end": { - "line": 40, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " through it by 1. The leaf is black, so there are more things to fix.", - "start": 986, - "end": 1057, + "value": " Delete mocked leaf", + "start": 975, + "end": 996, "loc": { "start": { - "line": 41, + "line": 38, "column": 1 }, "end": { - "line": 41, - "column": 72 + "line": 38, + "column": 22 } } } ] }, { - "type": "ExpressionStatement", - "start": 1059, - "end": 1078, + "type": "ReturnStatement", + "start": 1009, + "end": 1024, "loc": { "start": { - "line": 42, + "line": 40, "column": 1 }, "end": { - "line": 42, - "column": 20 + "line": 40, + "column": 16 } }, - "expression": { - "type": "CallExpression", - "start": 1059, - "end": 1077, + "argument": { + "type": "Identifier", + "start": 1016, + "end": 1023, "loc": { "start": { - "line": 42, - "column": 1 + "line": 40, + "column": 8 }, "end": { - "line": 42, - "column": 19 - } - }, - "callee": { - "type": "Identifier", - "start": 1059, - "end": 1071, - "loc": { - "start": { - "line": 42, - "column": 1 - }, - "end": { - "line": 42, - "column": 13 - }, - "identifierName": "delete_case1" + "line": 40, + "column": 15 }, - "name": "delete_case1", - "leadingComments": null + "identifierName": "subtree" }, - "arguments": [ - { - "type": "Identifier", - "start": 1072, - "end": 1076, - "loc": { - "start": { - "line": 42, - "column": 14 - }, - "end": { - "line": 42, - "column": 18 - }, - "identifierName": "leaf" - }, - "name": "leaf" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 910, - "end": 984, - "loc": { - "start": { - "line": 40, - "column": 1 - }, - "end": { - "line": 40, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " through it by 1. The leaf is black, so there are more things to fix.", - "start": 986, - "end": 1057, - "loc": { - "start": { - "line": 41, - "column": 1 - }, - "end": { - "line": 41, - "column": 72 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " Delete mocked leaf", - "start": 1081, - "end": 1102, - "loc": { - "start": { - "line": 44, - "column": 1 - }, - "end": { - "line": 44, - "column": 22 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1104, - "end": 1116, - "loc": { - "start": { - "line": 45, - "column": 1 - }, - "end": { - "line": 45, - "column": 13 - } - }, - "expression": { - "type": "CallExpression", - "start": 1104, - "end": 1115, - "loc": { - "start": { - "line": 45, - "column": 1 - }, - "end": { - "line": 45, - "column": 12 - } - }, - "callee": { - "type": "Identifier", - "start": 1104, - "end": 1109, - "loc": { - "start": { - "line": 45, - "column": 1 - }, - "end": { - "line": 45, - "column": 6 - }, - "identifierName": "prune" - }, - "name": "prune", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1110, - "end": 1114, - "loc": { - "start": { - "line": 45, - "column": 7 - }, - "end": { - "line": 45, - "column": 11 - }, - "identifierName": "leaf" - }, - "name": "leaf" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Delete mocked leaf", - "start": 1081, - "end": 1102, - "loc": { - "start": { - "line": 44, - "column": 1 - }, - "end": { - "line": 44, - "column": 22 - } - } - } - ] + "name": "subtree" + } } ], "directives": [] @@ -2077,29 +1814,29 @@ }, { "type": "Identifier", - "start": 1121, - "end": 1152, + "start": 1029, + "end": 1060, "loc": { "start": { - "line": 48, + "line": 43, "column": 0 }, "end": { - "line": 48, + "line": 43, "column": 31 } }, "declaration": { "type": "Identifier", - "start": 1136, - "end": 1151, + "start": 1044, + "end": 1059, "loc": { "start": { - "line": 48, + "line": 43, "column": 15 }, "end": { - "line": 48, + "line": 43, "column": 30 }, "identifierName": "delete_no_child" @@ -2112,51 +1849,51 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1121, - "end": 1152, + "start": 1029, + "end": 1060, "loc": { "start": { - "line": 48, + "line": 43, "column": 0 }, "end": { - "line": 48, + "line": 43, "column": 31 } }, "declaration": { "type": "VariableDeclaration", - "start": 456, - "end": 1119, + "start": 462, + "end": 1027, "loc": { "start": { "line": 20, "column": 0 }, "end": { - "line": 46, + "line": 41, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 462, - "end": 1118, + "start": 468, + "end": 1026, "loc": { "start": { "line": 20, "column": 6 }, "end": { - "line": 46, + "line": 41, "column": 1 } }, "id": { "type": "Identifier", - "start": 462, - "end": 477, + "start": 468, + "end": 483, "loc": { "start": { "line": 20, @@ -2173,22 +1910,22 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 480, - "end": 1118, + "start": 486, + "end": 1026, "loc": { "start": { "line": 20, "column": 24 }, "end": { - "line": 46, + "line": 41, "column": 1 } }, "id": { "type": "Identifier", - "start": 462, - "end": 477, + "start": 468, + "end": 483, "loc": { "start": { "line": 20, @@ -2209,8 +1946,8 @@ "params": [ { "type": "Identifier", - "start": 481, - "end": 482, + "start": 487, + "end": 488, "loc": { "start": { "line": 20, @@ -2227,23 +1964,23 @@ ], "body": { "type": "BlockStatement", - "start": 487, - "end": 1118, + "start": 493, + "end": 1026, "loc": { "start": { "line": 20, "column": 31 }, "end": { - "line": 46, + "line": 41, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 490, - "end": 516, + "start": 496, + "end": 522, "loc": { "start": { "line": 21, @@ -2256,8 +1993,8 @@ }, "expression": { "type": "CallExpression", - "start": 490, - "end": 515, + "start": 496, + "end": 521, "loc": { "start": { "line": 21, @@ -2270,8 +2007,8 @@ }, "callee": { "type": "Identifier", - "start": 490, - "end": 496, + "start": 496, + "end": 502, "loc": { "start": { "line": 21, @@ -2288,8 +2025,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 497, - "end": 514, + "start": 503, + "end": 520, "loc": { "start": { "line": 21, @@ -2302,8 +2039,8 @@ }, "left": { "type": "Identifier", - "start": 497, - "end": 498, + "start": 503, + "end": 504, "loc": { "start": { "line": 21, @@ -2320,8 +2057,8 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 510, - "end": 514, + "start": 516, + "end": 520, "loc": { "start": { "line": 21, @@ -2341,8 +2078,8 @@ }, { "type": "ExpressionStatement", - "start": 518, - "end": 544, + "start": 524, + "end": 550, "loc": { "start": { "line": 22, @@ -2355,8 +2092,8 @@ }, "expression": { "type": "CallExpression", - "start": 518, - "end": 543, + "start": 524, + "end": 549, "loc": { "start": { "line": 22, @@ -2369,8 +2106,8 @@ }, "callee": { "type": "Identifier", - "start": 518, - "end": 524, + "start": 524, + "end": 530, "loc": { "start": { "line": 22, @@ -2387,8 +2124,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 525, - "end": 542, + "start": 531, + "end": 548, "loc": { "start": { "line": 22, @@ -2401,8 +2138,8 @@ }, "left": { "type": "MemberExpression", - "start": 525, - "end": 533, + "start": 531, + "end": 539, "loc": { "start": { "line": 22, @@ -2415,8 +2152,8 @@ }, "object": { "type": "Identifier", - "start": 525, - "end": 526, + "start": 531, + "end": 532, "loc": { "start": { "line": 22, @@ -2432,8 +2169,8 @@ }, "property": { "type": "Identifier", - "start": 527, - "end": 533, + "start": 533, + "end": 539, "loc": { "start": { "line": 22, @@ -2452,8 +2189,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 538, - "end": 542, + "start": 544, + "end": 548, "loc": { "start": { "line": 22, @@ -2471,8 +2208,8 @@ }, { "type": "ExpressionStatement", - "start": 546, - "end": 570, + "start": 552, + "end": 576, "loc": { "start": { "line": 23, @@ -2485,8 +2222,8 @@ }, "expression": { "type": "CallExpression", - "start": 546, - "end": 569, + "start": 552, + "end": 575, "loc": { "start": { "line": 23, @@ -2499,8 +2236,8 @@ }, "callee": { "type": "Identifier", - "start": 546, - "end": 552, + "start": 552, + "end": 558, "loc": { "start": { "line": 23, @@ -2517,8 +2254,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 553, - "end": 568, + "start": 559, + "end": 574, "loc": { "start": { "line": 23, @@ -2531,8 +2268,8 @@ }, "left": { "type": "MemberExpression", - "start": 553, - "end": 559, + "start": 559, + "end": 565, "loc": { "start": { "line": 23, @@ -2545,8 +2282,8 @@ }, "object": { "type": "Identifier", - "start": 553, - "end": 554, + "start": 559, + "end": 560, "loc": { "start": { "line": 23, @@ -2562,8 +2299,8 @@ }, "property": { "type": "Identifier", - "start": 555, - "end": 559, + "start": 561, + "end": 565, "loc": { "start": { "line": 23, @@ -2582,8 +2319,8 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 564, - "end": 568, + "start": 570, + "end": 574, "loc": { "start": { "line": 23, @@ -2601,8 +2338,8 @@ }, { "type": "ExpressionStatement", - "start": 572, - "end": 597, + "start": 578, + "end": 603, "loc": { "start": { "line": 24, @@ -2615,8 +2352,8 @@ }, "expression": { "type": "CallExpression", - "start": 572, - "end": 596, + "start": 578, + "end": 602, "loc": { "start": { "line": 24, @@ -2629,8 +2366,8 @@ }, "callee": { "type": "Identifier", - "start": 572, - "end": 578, + "start": 578, + "end": 584, "loc": { "start": { "line": 24, @@ -2647,8 +2384,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 579, - "end": 595, + "start": 585, + "end": 601, "loc": { "start": { "line": 24, @@ -2661,8 +2398,8 @@ }, "left": { "type": "MemberExpression", - "start": 579, - "end": 586, + "start": 585, + "end": 592, "loc": { "start": { "line": 24, @@ -2675,8 +2412,8 @@ }, "object": { "type": "Identifier", - "start": 579, - "end": 580, + "start": 585, + "end": 586, "loc": { "start": { "line": 24, @@ -2692,8 +2429,8 @@ }, "property": { "type": "Identifier", - "start": 581, - "end": 586, + "start": 587, + "end": 592, "loc": { "start": { "line": 24, @@ -2712,8 +2449,8 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 591, - "end": 595, + "start": 597, + "end": 601, "loc": { "start": { "line": 24, @@ -2731,8 +2468,8 @@ }, { "type": "IfStatement", - "start": 600, - "end": 678, + "start": 606, + "end": 693, "loc": { "start": { "line": 26, @@ -2745,8 +2482,8 @@ }, "test": { "type": "BinaryExpression", - "start": 604, - "end": 622, + "start": 610, + "end": 628, "loc": { "start": { "line": 26, @@ -2759,8 +2496,8 @@ }, "left": { "type": "MemberExpression", - "start": 604, - "end": 612, + "start": 610, + "end": 618, "loc": { "start": { "line": 26, @@ -2773,8 +2510,8 @@ }, "object": { "type": "Identifier", - "start": 604, - "end": 605, + "start": 610, + "end": 611, "loc": { "start": { "line": 26, @@ -2790,8 +2527,8 @@ }, "property": { "type": "Identifier", - "start": 606, - "end": 612, + "start": 612, + "end": 618, "loc": { "start": { "line": 26, @@ -2810,8 +2547,8 @@ "operator": "!==", "right": { "type": "Identifier", - "start": 617, - "end": 622, + "start": 623, + "end": 628, "loc": { "start": { "line": 26, @@ -2828,8 +2565,8 @@ }, "consequent": { "type": "BlockStatement", - "start": 624, - "end": 678, + "start": 630, + "end": 693, "loc": { "start": { "line": 26, @@ -2843,8 +2580,8 @@ "body": [ { "type": "ExpressionStatement", - "start": 628, - "end": 653, + "start": 634, + "end": 659, "loc": { "start": { "line": 27, @@ -2857,8 +2594,8 @@ }, "expression": { "type": "CallExpression", - "start": 628, - "end": 652, + "start": 634, + "end": 658, "loc": { "start": { "line": 27, @@ -2871,8 +2608,8 @@ }, "callee": { "type": "Identifier", - "start": 628, - "end": 634, + "start": 634, + "end": 640, "loc": { "start": { "line": 27, @@ -2889,8 +2626,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 635, - "end": 651, + "start": 641, + "end": 657, "loc": { "start": { "line": 27, @@ -2903,8 +2640,8 @@ }, "left": { "type": "MemberExpression", - "start": 635, - "end": 643, + "start": 641, + "end": 649, "loc": { "start": { "line": 27, @@ -2917,8 +2654,8 @@ }, "object": { "type": "Identifier", - "start": 635, - "end": 636, + "start": 641, + "end": 642, "loc": { "start": { "line": 27, @@ -2934,8 +2671,8 @@ }, "property": { "type": "Identifier", - "start": 637, - "end": 643, + "start": 643, + "end": 649, "loc": { "start": { "line": 27, @@ -2954,8 +2691,8 @@ "operator": "===", "right": { "type": "Identifier", - "start": 648, - "end": 651, + "start": 654, + "end": 657, "loc": { "start": { "line": 27, @@ -2975,8 +2712,8 @@ }, { "type": "ExpressionStatement", - "start": 656, - "end": 665, + "start": 662, + "end": 671, "loc": { "start": { "line": 28, @@ -2989,8 +2726,8 @@ }, "expression": { "type": "CallExpression", - "start": 656, - "end": 664, + "start": 662, + "end": 670, "loc": { "start": { "line": 28, @@ -3003,8 +2740,8 @@ }, "callee": { "type": "Identifier", - "start": 656, - "end": 661, + "start": 662, + "end": 667, "loc": { "start": { "line": 28, @@ -3021,8 +2758,8 @@ "arguments": [ { "type": "Identifier", - "start": 662, - "end": 663, + "start": 668, + "end": 669, "loc": { "start": { "line": 28, @@ -3041,8 +2778,8 @@ }, { "type": "ReturnStatement", - "start": 668, - "end": 675, + "start": 674, + "end": 690, "loc": { "start": { "line": 29, @@ -3050,10 +2787,59 @@ }, "end": { "line": 29, - "column": 9 + "column": 18 } }, - "argument": null + "argument": { + "type": "MemberExpression", + "start": 681, + "end": 689, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 681, + "end": 682, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 683, + "end": 689, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 17 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } } ], "directives": [], @@ -3063,9 +2849,9 @@ "trailingComments": [ { "type": "CommentLine", - "value": " Mock leaf since there is no left child", - "start": 681, - "end": 722, + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 696, + "end": 770, "loc": { "start": { "line": 32, @@ -3073,15 +2859,15 @@ }, "end": { "line": 32, - "column": 42 + "column": 75 } } }, { "type": "CommentLine", - "value": " We use key = n.key to avoid mixing types, but this property is never", - "start": 724, - "end": 795, + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 772, + "end": 843, "loc": { "start": { "line": 33, @@ -3095,9 +2881,9 @@ }, { "type": "CommentLine", - "value": " accessed.", - "start": 797, - "end": 809, + "value": " NOTE We temporarily keep n in the tree to mock a leaf, since n does not", + "start": 845, + "end": 919, "loc": { "start": { "line": 34, @@ -3105,7 +2891,23 @@ }, "end": { "line": 34, - "column": 13 + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " have children.", + "start": 921, + "end": 938, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 18 } } } @@ -3113,149 +2915,99 @@ }, { "type": "VariableDeclaration", - "start": 811, - "end": 847, + "start": 940, + "end": 972, "loc": { "start": { - "line": 35, + "line": 36, "column": 1 }, "end": { - "line": 35, - "column": 37 + "line": 36, + "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 817, - "end": 846, + "start": 946, + "end": 971, "loc": { "start": { - "line": 35, + "line": 36, "column": 7 }, "end": { - "line": 35, - "column": 36 + "line": 36, + "column": 32 } }, "id": { "type": "Identifier", - "start": 817, - "end": 821, + "start": 946, + "end": 953, "loc": { "start": { - "line": 35, + "line": 36, "column": 7 }, "end": { - "line": 35, - "column": 11 + "line": 36, + "column": 14 }, - "identifierName": "leaf" + "identifierName": "subtree" }, - "name": "leaf", + "name": "subtree", "leadingComments": null }, "init": { - "type": "NewExpression", - "start": 824, - "end": 846, + "type": "CallExpression", + "start": 956, + "end": 971, "loc": { "start": { - "line": 35, - "column": 14 + "line": 36, + "column": 17 }, "end": { - "line": 35, - "column": 36 + "line": 36, + "column": 32 } }, "callee": { "type": "Identifier", - "start": 828, - "end": 832, + "start": 956, + "end": 968, "loc": { "start": { - "line": 35, - "column": 18 + "line": 36, + "column": 17 }, "end": { - "line": 35, - "column": 22 + "line": 36, + "column": 29 }, - "identifierName": "Node" + "identifierName": "delete_case1" }, - "name": "Node" + "name": "delete_case1" }, "arguments": [ { "type": "Identifier", - "start": 833, - "end": 838, - "loc": { - "start": { - "line": 35, - "column": 23 - }, - "end": { - "line": 35, - "column": 28 - }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - { - "type": "MemberExpression", - "start": 840, - "end": 845, + "start": 969, + "end": 970, "loc": { "start": { - "line": 35, + "line": 36, "column": 30 }, "end": { - "line": 35, - "column": 35 - } - }, - "object": { - "type": "Identifier", - "start": 840, - "end": 841, - "loc": { - "start": { - "line": 35, - "column": 30 - }, - "end": { - "line": 35, - "column": 31 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 842, - "end": 845, - "loc": { - "start": { - "line": 35, - "column": 32 - }, - "end": { - "line": 35, - "column": 35 - }, - "identifierName": "key" + "line": 36, + "column": 31 }, - "name": "key" + "identifierName": "n" }, - "computed": false + "name": "n" } ] }, @@ -3266,9 +3018,9 @@ "leadingComments": [ { "type": "CommentLine", - "value": " Mock leaf since there is no left child", - "start": 681, - "end": 722, + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 696, + "end": 770, "loc": { "start": { "line": 32, @@ -3276,15 +3028,15 @@ }, "end": { "line": 32, - "column": 42 + "column": 75 } } }, { "type": "CommentLine", - "value": " We use key = n.key to avoid mixing types, but this property is never", - "start": 724, - "end": 795, + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 772, + "end": 843, "loc": { "start": { "line": 33, @@ -3298,9 +3050,9 @@ }, { "type": "CommentLine", - "value": " accessed.", - "start": 797, - "end": 809, + "value": " NOTE We temporarily keep n in the tree to mock a leaf, since n does not", + "start": 845, + "end": 919, "loc": { "start": { "line": 34, @@ -3308,7 +3060,23 @@ }, "end": { "line": 34, - "column": 13 + "column": 75 + } + } + }, + { + "type": "CommentLine", + "value": " have children.", + "start": 921, + "end": 938, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 18 } } } @@ -3316,17 +3084,17 @@ "trailingComments": [ { "type": "CommentLine", - "value": " Replace n with the mocked leaf", - "start": 850, - "end": 883, + "value": " Delete mocked leaf", + "start": 975, + "end": 996, "loc": { "start": { - "line": 37, + "line": 38, "column": 1 }, "end": { - "line": 37, - "column": 34 + "line": 38, + "column": 22 } } } @@ -3334,255 +3102,84 @@ }, { "type": "ExpressionStatement", - "start": 885, - "end": 907, + "start": 998, + "end": 1007, "loc": { "start": { - "line": 38, + "line": 39, "column": 1 }, "end": { - "line": 38, - "column": 23 + "line": 39, + "column": 10 } }, "expression": { "type": "CallExpression", - "start": 885, - "end": 906, + "start": 998, + "end": 1006, "loc": { "start": { - "line": 38, + "line": 39, "column": 1 }, "end": { - "line": 38, - "column": 22 + "line": 39, + "column": 9 } }, "callee": { "type": "Identifier", - "start": 885, - "end": 897, + "start": 998, + "end": 1003, "loc": { "start": { - "line": 38, + "line": 39, "column": 1 }, "end": { - "line": 38, - "column": 13 + "line": 39, + "column": 6 }, - "identifierName": "replace_node" + "identifierName": "prune" }, - "name": "replace_node", + "name": "prune", "leadingComments": null }, "arguments": [ { "type": "Identifier", - "start": 898, - "end": 899, + "start": 1004, + "end": 1005, "loc": { "start": { - "line": 38, - "column": 14 + "line": 39, + "column": 7 }, "end": { - "line": 38, - "column": 15 + "line": 39, + "column": 8 }, "identifierName": "n" }, "name": "n" - }, - { - "type": "Identifier", - "start": 901, - "end": 905, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 21 - }, - "identifierName": "leaf" - }, - "name": "leaf" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Replace n with the mocked leaf", - "start": 850, - "end": 883, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 34 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 910, - "end": 984, - "loc": { - "start": { - "line": 40, - "column": 1 - }, - "end": { - "line": 40, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " through it by 1. The leaf is black, so there are more things to fix.", - "start": 986, - "end": 1057, - "loc": { - "start": { - "line": 41, - "column": 1 - }, - "end": { - "line": 41, - "column": 72 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1059, - "end": 1078, - "loc": { - "start": { - "line": 42, - "column": 1 - }, - "end": { - "line": 42, - "column": 20 - } - }, - "expression": { - "type": "CallExpression", - "start": 1059, - "end": 1077, - "loc": { - "start": { - "line": 42, - "column": 1 - }, - "end": { - "line": 42, - "column": 19 - } - }, - "callee": { - "type": "Identifier", - "start": 1059, - "end": 1071, - "loc": { - "start": { - "line": 42, - "column": 1 - }, - "end": { - "line": 42, - "column": 13 - }, - "identifierName": "delete_case1" - }, - "name": "delete_case1", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 1072, - "end": 1076, - "loc": { - "start": { - "line": 42, - "column": 14 - }, - "end": { - "line": 42, - "column": 18 - }, - "identifierName": "leaf" - }, - "name": "leaf" } ], "leadingComments": null }, "leadingComments": [ - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 910, - "end": 984, - "loc": { - "start": { - "line": 40, - "column": 1 - }, - "end": { - "line": 40, - "column": 75 - } - } - }, - { - "type": "CommentLine", - "value": " through it by 1. The leaf is black, so there are more things to fix.", - "start": 986, - "end": 1057, - "loc": { - "start": { - "line": 41, - "column": 1 - }, - "end": { - "line": 41, - "column": 72 - } - } - } - ], - "trailingComments": [ { "type": "CommentLine", "value": " Delete mocked leaf", - "start": 1081, - "end": 1102, + "start": 975, + "end": 996, "loc": { "start": { - "line": 44, + "line": 38, "column": 1 }, "end": { - "line": 44, + "line": 38, "column": 22 } } @@ -3590,90 +3187,36 @@ ] }, { - "type": "ExpressionStatement", - "start": 1104, - "end": 1116, + "type": "ReturnStatement", + "start": 1009, + "end": 1024, "loc": { "start": { - "line": 45, + "line": 40, "column": 1 }, "end": { - "line": 45, - "column": 13 + "line": 40, + "column": 16 } }, - "expression": { - "type": "CallExpression", - "start": 1104, - "end": 1115, + "argument": { + "type": "Identifier", + "start": 1016, + "end": 1023, "loc": { "start": { - "line": 45, - "column": 1 + "line": 40, + "column": 8 }, "end": { - "line": 45, - "column": 12 - } - }, - "callee": { - "type": "Identifier", - "start": 1104, - "end": 1109, - "loc": { - "start": { - "line": 45, - "column": 1 - }, - "end": { - "line": 45, - "column": 6 - }, - "identifierName": "prune" + "line": 40, + "column": 15 }, - "name": "prune", - "leadingComments": null + "identifierName": "subtree" }, - "arguments": [ - { - "type": "Identifier", - "start": 1110, - "end": 1114, - "loc": { - "start": { - "line": 45, - "column": 7 - }, - "end": { - "line": 45, - "column": 11 - }, - "identifierName": "leaf" - }, - "name": "leaf" - } - ], - "leadingComments": null - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Delete mocked leaf", - "start": 1081, - "end": 1102, - "loc": { - "start": { - "line": 44, - "column": 1 - }, - "end": { - "line": 44, - "column": 22 - } - } - } - ] + "name": "subtree" + } } ], "directives": [] @@ -3686,12 +3229,12 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n ", - "start": 267, - "end": 455, + "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n * @return {Node} The root of the modified subtree.\n ", + "start": 221, + "end": 461, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { @@ -3710,12 +3253,12 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n ", - "start": 267, - "end": 455, + "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n * @return {Node} The root of the modified subtree.\n ", + "start": 221, + "end": 461, "loc": { "start": { - "line": 11, + "line": 10, "column": 0 }, "end": { @@ -3726,9 +3269,9 @@ }, { "type": "CommentLine", - "value": " Mock leaf since there is no left child", - "start": 681, - "end": 722, + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 696, + "end": 770, "loc": { "start": { "line": 32, @@ -3736,15 +3279,15 @@ }, "end": { "line": 32, - "column": 42 + "column": 75 } } }, { "type": "CommentLine", - "value": " We use key = n.key to avoid mixing types, but this property is never", - "start": 724, - "end": 795, + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 772, + "end": 843, "loc": { "start": { "line": 33, @@ -3758,9 +3301,9 @@ }, { "type": "CommentLine", - "value": " accessed.", - "start": 797, - "end": 809, + "value": " NOTE We temporarily keep n in the tree to mock a leaf, since n does not", + "start": 845, + "end": 919, "loc": { "start": { "line": 34, @@ -3768,70 +3311,38 @@ }, "end": { "line": 34, - "column": 13 - } - } - }, - { - "type": "CommentLine", - "value": " Replace n with the mocked leaf", - "start": 850, - "end": 883, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 34 - } - } - }, - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 910, - "end": 984, - "loc": { - "start": { - "line": 40, - "column": 1 - }, - "end": { - "line": 40, "column": 75 } } }, { "type": "CommentLine", - "value": " through it by 1. The leaf is black, so there are more things to fix.", - "start": 986, - "end": 1057, + "value": " have children.", + "start": 921, + "end": 938, "loc": { "start": { - "line": 41, + "line": 35, "column": 1 }, "end": { - "line": 41, - "column": 72 + "line": 35, + "column": 18 } } }, { "type": "CommentLine", "value": " Delete mocked leaf", - "start": 1081, - "end": 1102, + "start": 975, + "end": 996, "loc": { "start": { - "line": 44, + "line": 38, "column": 1 }, "end": { - "line": 44, + "line": 38, "column": 22 } } @@ -4410,7 +3921,7 @@ "postfix": false, "binop": null }, - "value": "replace_node", + "value": "delete_case1", "start": 148, "end": 160, "loc": { @@ -4463,7 +3974,7 @@ "binop": null, "updateContext": null }, - "value": "./replace_node.js", + "value": "./delete_case1.js", "start": 166, "end": 185, "loc": { @@ -4518,15 +4029,15 @@ "updateContext": null }, "value": "import", - "start": 187, - "end": 193, + "start": 188, + "end": 194, "loc": { "start": { - "line": 7, + "line": 8, "column": 0 }, "end": { - "line": 7, + "line": 8, "column": 6 } } @@ -4543,17 +4054,17 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 194, - "end": 206, + "value": "prune", + "start": 195, + "end": 200, "loc": { "start": { - "line": 7, + "line": 8, "column": 7 }, "end": { - "line": 7, - "column": 19 + "line": 8, + "column": 12 } } }, @@ -4570,16 +4081,16 @@ "binop": null }, "value": "from", - "start": 207, - "end": 211, + "start": 201, + "end": 205, "loc": { "start": { - "line": 7, - "column": 20 + "line": 8, + "column": 13 }, "end": { - "line": 7, - "column": 24 + "line": 8, + "column": 17 } } }, @@ -4596,17 +4107,17 @@ "binop": null, "updateContext": null }, - "value": "./delete_case1.js", - "start": 212, - "end": 231, + "value": "./prune.js", + "start": 206, + "end": 218, "loc": { "start": { - "line": 7, - "column": 25 + "line": 8, + "column": 18 }, "end": { - "line": 7, - "column": 44 + "line": 8, + "column": 30 } } }, @@ -4623,174 +4134,41 @@ "binop": null, "updateContext": null }, - "start": 231, - "end": 232, + "start": 218, + "end": 219, "loc": { "start": { - "line": 7, - "column": 44 + "line": 8, + "column": 30 }, "end": { - "line": 7, - "column": 45 + "line": 8, + "column": 31 } } }, { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 234, - "end": 240, + "type": "CommentBlock", + "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n * @return {Node} The root of the modified subtree.\n ", + "start": 221, + "end": 461, "loc": { "start": { - "line": 9, + "line": 10, "column": 0 }, "end": { - "line": 9, - "column": 6 + "line": 19, + "column": 3 } } }, { "type": { - "label": "name", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "prune", - "start": 241, - "end": 246, - "loc": { - "start": { - "line": 9, - "column": 7 - }, - "end": { - "line": 9, - "column": 12 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 247, - "end": 251, - "loc": { - "start": { - "line": 9, - "column": 13 - }, - "end": { - "line": 9, - "column": 17 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "./prune.js", - "start": 252, - "end": 264, - "loc": { - "start": { - "line": 9, - "column": 18 - }, - "end": { - "line": 9, - "column": 30 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 264, - "end": 265, - "loc": { - "start": { - "line": 9, - "column": 30 - }, - "end": { - "line": 9, - "column": 31 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n ", - "start": 267, - "end": 455, - "loc": { - "start": { - "line": 11, - "column": 0 - }, - "end": { - "line": 19, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -4800,8 +4178,8 @@ "updateContext": null }, "value": "const", - "start": 456, - "end": 461, + "start": 462, + "end": 467, "loc": { "start": { "line": 20, @@ -4826,8 +4204,8 @@ "binop": null }, "value": "delete_no_child", - "start": 462, - "end": 477, + "start": 468, + "end": 483, "loc": { "start": { "line": 20, @@ -4853,8 +4231,8 @@ "updateContext": null }, "value": "=", - "start": 478, - "end": 479, + "start": 484, + "end": 485, "loc": { "start": { "line": 20, @@ -4878,8 +4256,8 @@ "postfix": false, "binop": null }, - "start": 480, - "end": 481, + "start": 486, + "end": 487, "loc": { "start": { "line": 20, @@ -4904,8 +4282,8 @@ "binop": null }, "value": "n", - "start": 481, - "end": 482, + "start": 487, + "end": 488, "loc": { "start": { "line": 20, @@ -4929,8 +4307,8 @@ "postfix": false, "binop": null }, - "start": 482, - "end": 483, + "start": 488, + "end": 489, "loc": { "start": { "line": 20, @@ -4955,8 +4333,8 @@ "binop": null, "updateContext": null }, - "start": 484, - "end": 486, + "start": 490, + "end": 492, "loc": { "start": { "line": 20, @@ -4980,8 +4358,8 @@ "postfix": false, "binop": null }, - "start": 487, - "end": 488, + "start": 493, + "end": 494, "loc": { "start": { "line": 20, @@ -5006,8 +4384,8 @@ "binop": null }, "value": "assert", - "start": 490, - "end": 496, + "start": 496, + "end": 502, "loc": { "start": { "line": 21, @@ -5031,8 +4409,8 @@ "postfix": false, "binop": null }, - "start": 496, - "end": 497, + "start": 502, + "end": 503, "loc": { "start": { "line": 21, @@ -5057,8 +4435,8 @@ "binop": null }, "value": "n", - "start": 497, - "end": 498, + "start": 503, + "end": 504, "loc": { "start": { "line": 21, @@ -5085,8 +4463,8 @@ "updateContext": null }, "value": "instanceof", - "start": 499, - "end": 509, + "start": 505, + "end": 515, "loc": { "start": { "line": 21, @@ -5111,8 +4489,8 @@ "binop": null }, "value": "Node", - "start": 510, - "end": 514, + "start": 516, + "end": 520, "loc": { "start": { "line": 21, @@ -5136,8 +4514,8 @@ "postfix": false, "binop": null }, - "start": 514, - "end": 515, + "start": 520, + "end": 521, "loc": { "start": { "line": 21, @@ -5162,8 +4540,8 @@ "binop": null, "updateContext": null }, - "start": 515, - "end": 516, + "start": 521, + "end": 522, "loc": { "start": { "line": 21, @@ -5188,8 +4566,8 @@ "binop": null }, "value": "assert", - "start": 518, - "end": 524, + "start": 524, + "end": 530, "loc": { "start": { "line": 22, @@ -5213,8 +4591,8 @@ "postfix": false, "binop": null }, - "start": 524, - "end": 525, + "start": 530, + "end": 531, "loc": { "start": { "line": 22, @@ -5239,8 +4617,8 @@ "binop": null }, "value": "n", - "start": 525, - "end": 526, + "start": 531, + "end": 532, "loc": { "start": { "line": 22, @@ -5265,8 +4643,8 @@ "binop": null, "updateContext": null }, - "start": 526, - "end": 527, + "start": 532, + "end": 533, "loc": { "start": { "line": 22, @@ -5291,8 +4669,8 @@ "binop": null }, "value": "parent", - "start": 527, - "end": 533, + "start": 533, + "end": 539, "loc": { "start": { "line": 22, @@ -5318,8 +4696,8 @@ "updateContext": null }, "value": "!==", - "start": 534, - "end": 537, + "start": 540, + "end": 543, "loc": { "start": { "line": 22, @@ -5346,8 +4724,8 @@ "updateContext": null }, "value": "null", - "start": 538, - "end": 542, + "start": 544, + "end": 548, "loc": { "start": { "line": 22, @@ -5371,8 +4749,8 @@ "postfix": false, "binop": null }, - "start": 542, - "end": 543, + "start": 548, + "end": 549, "loc": { "start": { "line": 22, @@ -5397,8 +4775,8 @@ "binop": null, "updateContext": null }, - "start": 543, - "end": 544, + "start": 549, + "end": 550, "loc": { "start": { "line": 22, @@ -5423,8 +4801,8 @@ "binop": null }, "value": "assert", - "start": 546, - "end": 552, + "start": 552, + "end": 558, "loc": { "start": { "line": 23, @@ -5448,8 +4826,8 @@ "postfix": false, "binop": null }, - "start": 552, - "end": 553, + "start": 558, + "end": 559, "loc": { "start": { "line": 23, @@ -5474,8 +4852,8 @@ "binop": null }, "value": "n", - "start": 553, - "end": 554, + "start": 559, + "end": 560, "loc": { "start": { "line": 23, @@ -5500,8 +4878,8 @@ "binop": null, "updateContext": null }, - "start": 554, - "end": 555, + "start": 560, + "end": 561, "loc": { "start": { "line": 23, @@ -5526,8 +4904,8 @@ "binop": null }, "value": "left", - "start": 555, - "end": 559, + "start": 561, + "end": 565, "loc": { "start": { "line": 23, @@ -5553,8 +4931,8 @@ "updateContext": null }, "value": "===", - "start": 560, - "end": 563, + "start": 566, + "end": 569, "loc": { "start": { "line": 23, @@ -5581,8 +4959,8 @@ "updateContext": null }, "value": "null", - "start": 564, - "end": 568, + "start": 570, + "end": 574, "loc": { "start": { "line": 23, @@ -5606,8 +4984,8 @@ "postfix": false, "binop": null }, - "start": 568, - "end": 569, + "start": 574, + "end": 575, "loc": { "start": { "line": 23, @@ -5632,8 +5010,8 @@ "binop": null, "updateContext": null }, - "start": 569, - "end": 570, + "start": 575, + "end": 576, "loc": { "start": { "line": 23, @@ -5658,8 +5036,8 @@ "binop": null }, "value": "assert", - "start": 572, - "end": 578, + "start": 578, + "end": 584, "loc": { "start": { "line": 24, @@ -5683,8 +5061,8 @@ "postfix": false, "binop": null }, - "start": 578, - "end": 579, + "start": 584, + "end": 585, "loc": { "start": { "line": 24, @@ -5709,8 +5087,8 @@ "binop": null }, "value": "n", - "start": 579, - "end": 580, + "start": 585, + "end": 586, "loc": { "start": { "line": 24, @@ -5735,8 +5113,8 @@ "binop": null, "updateContext": null }, - "start": 580, - "end": 581, + "start": 586, + "end": 587, "loc": { "start": { "line": 24, @@ -5761,8 +5139,8 @@ "binop": null }, "value": "right", - "start": 581, - "end": 586, + "start": 587, + "end": 592, "loc": { "start": { "line": 24, @@ -5788,8 +5166,8 @@ "updateContext": null }, "value": "===", - "start": 587, - "end": 590, + "start": 593, + "end": 596, "loc": { "start": { "line": 24, @@ -5816,8 +5194,8 @@ "updateContext": null }, "value": "null", - "start": 591, - "end": 595, + "start": 597, + "end": 601, "loc": { "start": { "line": 24, @@ -5841,8 +5219,8 @@ "postfix": false, "binop": null }, - "start": 595, - "end": 596, + "start": 601, + "end": 602, "loc": { "start": { "line": 24, @@ -5867,8 +5245,8 @@ "binop": null, "updateContext": null }, - "start": 596, - "end": 597, + "start": 602, + "end": 603, "loc": { "start": { "line": 24, @@ -5895,8 +5273,8 @@ "updateContext": null }, "value": "if", - "start": 600, - "end": 602, + "start": 606, + "end": 608, "loc": { "start": { "line": 26, @@ -5920,8 +5298,8 @@ "postfix": false, "binop": null }, - "start": 603, - "end": 604, + "start": 609, + "end": 610, "loc": { "start": { "line": 26, @@ -5946,8 +5324,8 @@ "binop": null }, "value": "n", - "start": 604, - "end": 605, + "start": 610, + "end": 611, "loc": { "start": { "line": 26, @@ -5972,8 +5350,8 @@ "binop": null, "updateContext": null }, - "start": 605, - "end": 606, + "start": 611, + "end": 612, "loc": { "start": { "line": 26, @@ -5998,8 +5376,8 @@ "binop": null }, "value": "_color", - "start": 606, - "end": 612, + "start": 612, + "end": 618, "loc": { "start": { "line": 26, @@ -6025,8 +5403,8 @@ "updateContext": null }, "value": "!==", - "start": 613, - "end": 616, + "start": 619, + "end": 622, "loc": { "start": { "line": 26, @@ -6051,8 +5429,8 @@ "binop": null }, "value": "BLACK", - "start": 617, - "end": 622, + "start": 623, + "end": 628, "loc": { "start": { "line": 26, @@ -6076,8 +5454,8 @@ "postfix": false, "binop": null }, - "start": 622, - "end": 623, + "start": 628, + "end": 629, "loc": { "start": { "line": 26, @@ -6101,8 +5479,8 @@ "postfix": false, "binop": null }, - "start": 624, - "end": 625, + "start": 630, + "end": 631, "loc": { "start": { "line": 26, @@ -6127,8 +5505,8 @@ "binop": null }, "value": "assert", - "start": 628, - "end": 634, + "start": 634, + "end": 640, "loc": { "start": { "line": 27, @@ -6152,8 +5530,8 @@ "postfix": false, "binop": null }, - "start": 634, - "end": 635, + "start": 640, + "end": 641, "loc": { "start": { "line": 27, @@ -6178,8 +5556,8 @@ "binop": null }, "value": "n", - "start": 635, - "end": 636, + "start": 641, + "end": 642, "loc": { "start": { "line": 27, @@ -6204,8 +5582,8 @@ "binop": null, "updateContext": null }, - "start": 636, - "end": 637, + "start": 642, + "end": 643, "loc": { "start": { "line": 27, @@ -6230,8 +5608,8 @@ "binop": null }, "value": "_color", - "start": 637, - "end": 643, + "start": 643, + "end": 649, "loc": { "start": { "line": 27, @@ -6257,8 +5635,8 @@ "updateContext": null }, "value": "===", - "start": 644, - "end": 647, + "start": 650, + "end": 653, "loc": { "start": { "line": 27, @@ -6283,8 +5661,8 @@ "binop": null }, "value": "RED", - "start": 648, - "end": 651, + "start": 654, + "end": 657, "loc": { "start": { "line": 27, @@ -6308,8 +5686,8 @@ "postfix": false, "binop": null }, - "start": 651, - "end": 652, + "start": 657, + "end": 658, "loc": { "start": { "line": 27, @@ -6334,8 +5712,8 @@ "binop": null, "updateContext": null }, - "start": 652, - "end": 653, + "start": 658, + "end": 659, "loc": { "start": { "line": 27, @@ -6360,8 +5738,8 @@ "binop": null }, "value": "prune", - "start": 656, - "end": 661, + "start": 662, + "end": 667, "loc": { "start": { "line": 28, @@ -6385,8 +5763,8 @@ "postfix": false, "binop": null }, - "start": 661, - "end": 662, + "start": 667, + "end": 668, "loc": { "start": { "line": 28, @@ -6411,8 +5789,8 @@ "binop": null }, "value": "n", - "start": 662, - "end": 663, + "start": 668, + "end": 669, "loc": { "start": { "line": 28, @@ -6436,8 +5814,8 @@ "postfix": false, "binop": null }, - "start": 663, - "end": 664, + "start": 669, + "end": 670, "loc": { "start": { "line": 28, @@ -6462,8 +5840,8 @@ "binop": null, "updateContext": null }, - "start": 664, - "end": 665, + "start": 670, + "end": 671, "loc": { "start": { "line": 28, @@ -6490,8 +5868,8 @@ "updateContext": null }, "value": "return", - "start": 668, - "end": 674, + "start": 674, + "end": 680, "loc": { "start": { "line": 29, @@ -6503,6 +5881,84 @@ } } }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 681, + "end": 682, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 682, + "end": 683, + "loc": { + "start": { + "line": 29, + "column": 10 + }, + "end": { + "line": 29, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 683, + "end": 689, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 17 + } + } + }, { "type": { "label": ";", @@ -6516,16 +5972,16 @@ "binop": null, "updateContext": null }, - "start": 674, - "end": 675, + "start": 689, + "end": 690, "loc": { "start": { "line": 29, - "column": 8 + "column": 17 }, "end": { "line": 29, - "column": 9 + "column": 18 } } }, @@ -6541,8 +5997,8 @@ "postfix": false, "binop": null }, - "start": 677, - "end": 678, + "start": 692, + "end": 693, "loc": { "start": { "line": 30, @@ -6556,9 +6012,9 @@ }, { "type": "CommentLine", - "value": " Mock leaf since there is no left child", - "start": 681, - "end": 722, + "value": " If n is black, deleting it reduces the black-height of every path going", + "start": 696, + "end": 770, "loc": { "start": { "line": 32, @@ -6566,15 +6022,15 @@ }, "end": { "line": 32, - "column": 42 + "column": 75 } } }, { "type": "CommentLine", - "value": " We use key = n.key to avoid mixing types, but this property is never", - "start": 724, - "end": 795, + "value": " through it by 1. The leaf is black, so there are more things to fix.", + "start": 772, + "end": 843, "loc": { "start": { "line": 33, @@ -6588,9 +6044,9 @@ }, { "type": "CommentLine", - "value": " accessed.", - "start": 797, - "end": 809, + "value": " NOTE We temporarily keep n in the tree to mock a leaf, since n does not", + "start": 845, + "end": 919, "loc": { "start": { "line": 34, @@ -6598,251 +6054,30 @@ }, "end": { "line": 34, - "column": 13 + "column": 75 } } }, { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 811, - "end": 816, + "type": "CommentLine", + "value": " have children.", + "start": 921, + "end": 938, "loc": { "start": { "line": 35, "column": 1 }, "end": { - "line": 35, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "leaf", - "start": 817, - "end": 821, - "loc": { - "start": { - "line": 35, - "column": 7 - }, - "end": { - "line": 35, - "column": 11 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 822, - "end": 823, - "loc": { - "start": { - "line": 35, - "column": 12 - }, - "end": { - "line": 35, - "column": 13 - } - } - }, - { - "type": { - "label": "new", - "keyword": "new", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "new", - "start": 824, - "end": 827, - "loc": { - "start": { - "line": 35, - "column": 14 - }, - "end": { - "line": 35, - "column": 17 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 828, - "end": 832, - "loc": { - "start": { "line": 35, "column": 18 - }, - "end": { - "line": 35, - "column": 22 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 832, - "end": 833, - "loc": { - "start": { - "line": 35, - "column": 22 - }, - "end": { - "line": 35, - "column": 23 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "BLACK", - "start": 833, - "end": 838, - "loc": { - "start": { - "line": 35, - "column": 23 - }, - "end": { - "line": 35, - "column": 28 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 838, - "end": 839, - "loc": { - "start": { - "line": 35, - "column": 28 - }, - "end": { - "line": 35, - "column": 29 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "n", - "start": 840, - "end": 841, - "loc": { - "start": { - "line": 35, - "column": 30 - }, - "end": { - "line": 35, - "column": 31 - } - } - }, - { - "type": { - "label": ".", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6853,16 +6088,17 @@ "binop": null, "updateContext": null }, - "start": 841, - "end": 842, + "value": "const", + "start": 940, + "end": 945, "loc": { "start": { - "line": 35, - "column": 31 + "line": 36, + "column": 1 }, "end": { - "line": 35, - "column": 32 + "line": 36, + "column": 6 } } }, @@ -6878,84 +6114,44 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 842, - "end": 845, + "value": "subtree", + "start": 946, + "end": 953, "loc": { "start": { - "line": 35, - "column": 32 - }, - "end": { - "line": 35, - "column": 35 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 845, - "end": 846, - "loc": { - "start": { - "line": 35, - "column": 35 + "line": 36, + "column": 7 }, "end": { - "line": 35, - "column": 36 + "line": 36, + "column": 14 } } }, { "type": { - "label": ";", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 846, - "end": 847, - "loc": { - "start": { - "line": 35, - "column": 36 - }, - "end": { - "line": 35, - "column": 37 - } - } - }, - { - "type": "CommentLine", - "value": " Replace n with the mocked leaf", - "start": 850, - "end": 883, + "value": "=", + "start": 954, + "end": 955, "loc": { "start": { - "line": 37, - "column": 1 + "line": 36, + "column": 15 }, "end": { - "line": 37, - "column": 34 + "line": 36, + "column": 16 } } }, @@ -6971,17 +6167,17 @@ "postfix": false, "binop": null }, - "value": "replace_node", - "start": 885, - "end": 897, + "value": "delete_case1", + "start": 956, + "end": 968, "loc": { "start": { - "line": 38, - "column": 1 + "line": 36, + "column": 17 }, "end": { - "line": 38, - "column": 13 + "line": 36, + "column": 29 } } }, @@ -6997,16 +6193,16 @@ "postfix": false, "binop": null }, - "start": 897, - "end": 898, + "start": 968, + "end": 969, "loc": { "start": { - "line": 38, - "column": 13 + "line": 36, + "column": 29 }, "end": { - "line": 38, - "column": 14 + "line": 36, + "column": 30 } } }, @@ -7023,68 +6219,16 @@ "binop": null }, "value": "n", - "start": 898, - "end": 899, - "loc": { - "start": { - "line": 38, - "column": 14 - }, - "end": { - "line": 38, - "column": 15 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 899, - "end": 900, + "start": 969, + "end": 970, "loc": { "start": { - "line": 38, - "column": 15 - }, - "end": { - "line": 38, - "column": 16 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "leaf", - "start": 901, - "end": 905, - "loc": { - "start": { - "line": 38, - "column": 17 + "line": 36, + "column": 30 }, "end": { - "line": 38, - "column": 21 + "line": 36, + "column": 31 } } }, @@ -7100,16 +6244,16 @@ "postfix": false, "binop": null }, - "start": 905, - "end": 906, + "start": 970, + "end": 971, "loc": { "start": { - "line": 38, - "column": 21 + "line": 36, + "column": 31 }, "end": { - "line": 38, - "column": 22 + "line": 36, + "column": 32 } } }, @@ -7126,48 +6270,32 @@ "binop": null, "updateContext": null }, - "start": 906, - "end": 907, + "start": 971, + "end": 972, "loc": { "start": { - "line": 38, - "column": 22 - }, - "end": { - "line": 38, - "column": 23 - } - } - }, - { - "type": "CommentLine", - "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 910, - "end": 984, - "loc": { - "start": { - "line": 40, - "column": 1 + "line": 36, + "column": 32 }, "end": { - "line": 40, - "column": 75 + "line": 36, + "column": 33 } } }, { "type": "CommentLine", - "value": " through it by 1. The leaf is black, so there are more things to fix.", - "start": 986, - "end": 1057, + "value": " Delete mocked leaf", + "start": 975, + "end": 996, "loc": { "start": { - "line": 41, + "line": 38, "column": 1 }, "end": { - "line": 41, - "column": 72 + "line": 38, + "column": 22 } } }, @@ -7183,17 +6311,17 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 1059, - "end": 1071, + "value": "prune", + "start": 998, + "end": 1003, "loc": { "start": { - "line": 42, + "line": 39, "column": 1 }, "end": { - "line": 42, - "column": 13 + "line": 39, + "column": 6 } } }, @@ -7209,16 +6337,16 @@ "postfix": false, "binop": null }, - "start": 1071, - "end": 1072, + "start": 1003, + "end": 1004, "loc": { "start": { - "line": 42, - "column": 13 + "line": 39, + "column": 6 }, "end": { - "line": 42, - "column": 14 + "line": 39, + "column": 7 } } }, @@ -7234,17 +6362,17 @@ "postfix": false, "binop": null }, - "value": "leaf", - "start": 1072, - "end": 1076, + "value": "n", + "start": 1004, + "end": 1005, "loc": { "start": { - "line": 42, - "column": 14 + "line": 39, + "column": 7 }, "end": { - "line": 42, - "column": 18 + "line": 39, + "column": 8 } } }, @@ -7260,16 +6388,16 @@ "postfix": false, "binop": null }, - "start": 1076, - "end": 1077, + "start": 1005, + "end": 1006, "loc": { "start": { - "line": 42, - "column": 18 + "line": 39, + "column": 8 }, "end": { - "line": 42, - "column": 19 + "line": 39, + "column": 9 } } }, @@ -7286,82 +6414,43 @@ "binop": null, "updateContext": null }, - "start": 1077, - "end": 1078, - "loc": { - "start": { - "line": 42, - "column": 19 - }, - "end": { - "line": 42, - "column": 20 - } - } - }, - { - "type": "CommentLine", - "value": " Delete mocked leaf", - "start": 1081, - "end": 1102, - "loc": { - "start": { - "line": 44, - "column": 1 - }, - "end": { - "line": 44, - "column": 22 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "prune", - "start": 1104, - "end": 1109, + "start": 1006, + "end": 1007, "loc": { "start": { - "line": 45, - "column": 1 + "line": 39, + "column": 9 }, "end": { - "line": 45, - "column": 6 + "line": 39, + "column": 10 } } }, { "type": { - "label": "(", + "label": "return", + "keyword": "return", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1109, - "end": 1110, + "value": "return", + "start": 1009, + "end": 1015, "loc": { "start": { - "line": 45, - "column": 6 + "line": 40, + "column": 1 }, "end": { - "line": 45, + "line": 40, "column": 7 } } @@ -7378,42 +6467,17 @@ "postfix": false, "binop": null }, - "value": "leaf", - "start": 1110, - "end": 1114, - "loc": { - "start": { - "line": 45, - "column": 7 - }, - "end": { - "line": 45, - "column": 11 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1114, - "end": 1115, + "value": "subtree", + "start": 1016, + "end": 1023, "loc": { "start": { - "line": 45, - "column": 11 + "line": 40, + "column": 8 }, "end": { - "line": 45, - "column": 12 + "line": 40, + "column": 15 } } }, @@ -7430,16 +6494,16 @@ "binop": null, "updateContext": null }, - "start": 1115, - "end": 1116, + "start": 1023, + "end": 1024, "loc": { "start": { - "line": 45, - "column": 12 + "line": 40, + "column": 15 }, "end": { - "line": 45, - "column": 13 + "line": 40, + "column": 16 } } }, @@ -7455,15 +6519,15 @@ "postfix": false, "binop": null }, - "start": 1117, - "end": 1118, + "start": 1025, + "end": 1026, "loc": { "start": { - "line": 46, + "line": 41, "column": 0 }, "end": { - "line": 46, + "line": 41, "column": 1 } } @@ -7481,15 +6545,15 @@ "binop": null, "updateContext": null }, - "start": 1118, - "end": 1119, + "start": 1026, + "end": 1027, "loc": { "start": { - "line": 46, + "line": 41, "column": 1 }, "end": { - "line": 46, + "line": 41, "column": 2 } } @@ -7509,15 +6573,15 @@ "updateContext": null }, "value": "export", - "start": 1121, - "end": 1127, + "start": 1029, + "end": 1035, "loc": { "start": { - "line": 48, + "line": 43, "column": 0 }, "end": { - "line": 48, + "line": 43, "column": 6 } } @@ -7537,15 +6601,15 @@ "updateContext": null }, "value": "default", - "start": 1128, - "end": 1135, + "start": 1036, + "end": 1043, "loc": { "start": { - "line": 48, + "line": 43, "column": 7 }, "end": { - "line": 48, + "line": 43, "column": 14 } } @@ -7563,15 +6627,15 @@ "binop": null }, "value": "delete_no_child", - "start": 1136, - "end": 1151, + "start": 1044, + "end": 1059, "loc": { "start": { - "line": 48, + "line": 43, "column": 15 }, "end": { - "line": 48, + "line": 43, "column": 30 } } @@ -7589,15 +6653,15 @@ "binop": null, "updateContext": null }, - "start": 1151, - "end": 1152, + "start": 1059, + "end": 1060, "loc": { "start": { - "line": 48, + "line": 43, "column": 30 }, "end": { - "line": 48, + "line": 43, "column": 31 } } @@ -7615,15 +6679,15 @@ "binop": null, "updateContext": null }, - "start": 1153, - "end": 1153, + "start": 1061, + "end": 1061, "loc": { "start": { - "line": 49, + "line": 44, "column": 0 }, "end": { - "line": 49, + "line": 44, "column": 0 } } diff --git a/ast/source/deletion/delete_one_child.js.json b/ast/source/deletion/delete_one_child.js.json index 7884b97..5cfa91f 100644 --- a/ast/source/deletion/delete_one_child.js.json +++ b/ast/source/deletion/delete_one_child.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1126, + "end": 1332, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 41, + "line": 51, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1126, + "end": 1332, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 41, + "line": 51, "column": 0 } }, @@ -375,16 +375,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", + "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * p\n * |\n * n (BLACK)\n * / \\\n * RED -\n * / \\\n * - -\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", "start": 188, - "end": 566, + "end": 656, "loc": { "start": { "line": 8, "column": 0 }, "end": { - "line": 21, + "line": 29, "column": 3 } } @@ -393,44 +393,44 @@ }, { "type": "Identifier", - "start": 567, - "end": 1091, + "start": 657, + "end": 1297, "loc": { "start": { - "line": 22, + "line": 30, "column": 0 }, "end": { - "line": 38, + "line": 48, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 573, - "end": 1090, + "start": 663, + "end": 1296, "loc": { "start": { - "line": 22, + "line": 30, "column": 6 }, "end": { - "line": 38, + "line": 48, "column": 1 } }, "id": { "type": "Identifier", - "start": 573, - "end": 589, + "start": 663, + "end": 679, "loc": { "start": { - "line": 22, + "line": 30, "column": 6 }, "end": { - "line": 22, + "line": 30, "column": 22 }, "identifierName": "delete_one_child" @@ -440,15 +440,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 592, - "end": 1090, + "start": 682, + "end": 1296, "loc": { "start": { - "line": 22, + "line": 30, "column": 25 }, "end": { - "line": 38, + "line": 48, "column": 1 } }, @@ -459,15 +459,15 @@ "params": [ { "type": "Identifier", - "start": 593, - "end": 594, + "start": 683, + "end": 684, "loc": { "start": { - "line": 22, + "line": 30, "column": 26 }, "end": { - "line": 22, + "line": 30, "column": 27 }, "identifierName": "n" @@ -477,58 +477,58 @@ ], "body": { "type": "BlockStatement", - "start": 599, - "end": 1090, + "start": 689, + "end": 1296, "loc": { "start": { - "line": 22, + "line": 30, "column": 32 }, "end": { - "line": 38, + "line": 48, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 602, - "end": 628, + "start": 692, + "end": 718, "loc": { "start": { - "line": 23, + "line": 31, "column": 1 }, "end": { - "line": 23, + "line": 31, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 602, - "end": 627, + "start": 692, + "end": 717, "loc": { "start": { - "line": 23, + "line": 31, "column": 1 }, "end": { - "line": 23, + "line": 31, "column": 26 } }, "callee": { "type": "Identifier", - "start": 602, - "end": 608, + "start": 692, + "end": 698, "loc": { "start": { - "line": 23, + "line": 31, "column": 1 }, "end": { - "line": 23, + "line": 31, "column": 7 }, "identifierName": "assert" @@ -538,29 +538,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 609, - "end": 626, + "start": 699, + "end": 716, "loc": { "start": { - "line": 23, + "line": 31, "column": 8 }, "end": { - "line": 23, + "line": 31, "column": 25 } }, "left": { "type": "Identifier", - "start": 609, - "end": 610, + "start": 699, + "end": 700, "loc": { "start": { - "line": 23, + "line": 31, "column": 8 }, "end": { - "line": 23, + "line": 31, "column": 9 }, "identifierName": "n" @@ -570,15 +570,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 622, - "end": 626, + "start": 712, + "end": 716, "loc": { "start": { - "line": 23, + "line": 31, "column": 21 }, "end": { - "line": 23, + "line": 31, "column": 25 }, "identifierName": "Node" @@ -591,43 +591,43 @@ }, { "type": "ExpressionStatement", - "start": 630, - "end": 657, + "start": 720, + "end": 747, "loc": { "start": { - "line": 24, + "line": 32, "column": 1 }, "end": { - "line": 24, + "line": 32, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 630, - "end": 656, + "start": 720, + "end": 746, "loc": { "start": { - "line": 24, + "line": 32, "column": 1 }, "end": { - "line": 24, + "line": 32, "column": 27 } }, "callee": { "type": "Identifier", - "start": 630, - "end": 636, + "start": 720, + "end": 726, "loc": { "start": { - "line": 24, + "line": 32, "column": 1 }, "end": { - "line": 24, + "line": 32, "column": 7 }, "identifierName": "assert" @@ -637,43 +637,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 637, - "end": 655, + "start": 727, + "end": 745, "loc": { "start": { - "line": 24, + "line": 32, "column": 8 }, "end": { - "line": 24, + "line": 32, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 637, - "end": 645, + "start": 727, + "end": 735, "loc": { "start": { - "line": 24, + "line": 32, "column": 8 }, "end": { - "line": 24, + "line": 32, "column": 16 } }, "object": { "type": "Identifier", - "start": 637, - "end": 638, + "start": 727, + "end": 728, "loc": { "start": { - "line": 24, + "line": 32, "column": 8 }, "end": { - "line": 24, + "line": 32, "column": 9 }, "identifierName": "n" @@ -682,15 +682,15 @@ }, "property": { "type": "Identifier", - "start": 639, - "end": 645, + "start": 729, + "end": 735, "loc": { "start": { - "line": 24, + "line": 32, "column": 10 }, "end": { - "line": 24, + "line": 32, "column": 16 }, "identifierName": "_color" @@ -702,15 +702,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 650, - "end": 655, + "start": 740, + "end": 745, "loc": { "start": { - "line": 24, + "line": 32, "column": 21 }, "end": { - "line": 24, + "line": 32, "column": 26 }, "identifierName": "BLACK" @@ -723,43 +723,43 @@ }, { "type": "ExpressionStatement", - "start": 659, - "end": 685, + "start": 749, + "end": 775, "loc": { "start": { - "line": 25, + "line": 33, "column": 1 }, "end": { - "line": 25, + "line": 33, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 659, - "end": 684, + "start": 749, + "end": 774, "loc": { "start": { - "line": 25, + "line": 33, "column": 1 }, "end": { - "line": 25, + "line": 33, "column": 26 } }, "callee": { "type": "Identifier", - "start": 659, - "end": 665, + "start": 749, + "end": 755, "loc": { "start": { - "line": 25, + "line": 33, "column": 1 }, "end": { - "line": 25, + "line": 33, "column": 7 }, "identifierName": "assert" @@ -769,43 +769,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 666, - "end": 683, + "start": 756, + "end": 773, "loc": { "start": { - "line": 25, + "line": 33, "column": 8 }, "end": { - "line": 25, + "line": 33, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 666, - "end": 674, + "start": 756, + "end": 764, "loc": { "start": { - "line": 25, + "line": 33, "column": 8 }, "end": { - "line": 25, + "line": 33, "column": 16 } }, "object": { "type": "Identifier", - "start": 666, - "end": 667, + "start": 756, + "end": 757, "loc": { "start": { - "line": 25, + "line": 33, "column": 8 }, "end": { - "line": 25, + "line": 33, "column": 9 }, "identifierName": "n" @@ -814,15 +814,15 @@ }, "property": { "type": "Identifier", - "start": 668, - "end": 674, + "start": 758, + "end": 764, "loc": { "start": { - "line": 25, + "line": 33, "column": 10 }, "end": { - "line": 25, + "line": 33, "column": 16 }, "identifierName": "parent" @@ -834,15 +834,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 679, - "end": 683, + "start": 769, + "end": 773, "loc": { "start": { - "line": 25, + "line": 33, "column": 21 }, "end": { - "line": 25, + "line": 33, "column": 25 } } @@ -853,43 +853,43 @@ }, { "type": "ExpressionStatement", - "start": 687, - "end": 718, + "start": 777, + "end": 808, "loc": { "start": { - "line": 26, + "line": 34, "column": 1 }, "end": { - "line": 26, + "line": 34, "column": 32 } }, "expression": { "type": "CallExpression", - "start": 687, - "end": 717, + "start": 777, + "end": 807, "loc": { "start": { - "line": 26, + "line": 34, "column": 1 }, "end": { - "line": 26, + "line": 34, "column": 31 } }, "callee": { "type": "Identifier", - "start": 687, - "end": 693, + "start": 777, + "end": 783, "loc": { "start": { - "line": 26, + "line": 34, "column": 1 }, "end": { - "line": 26, + "line": 34, "column": 7 }, "identifierName": "assert" @@ -899,43 +899,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 694, - "end": 716, + "start": 784, + "end": 806, "loc": { "start": { - "line": 26, + "line": 34, "column": 8 }, "end": { - "line": 26, + "line": 34, "column": 30 } }, "left": { "type": "MemberExpression", - "start": 694, - "end": 700, + "start": 784, + "end": 790, "loc": { "start": { - "line": 26, + "line": 34, "column": 8 }, "end": { - "line": 26, + "line": 34, "column": 14 } }, "object": { "type": "Identifier", - "start": 694, - "end": 695, + "start": 784, + "end": 785, "loc": { "start": { - "line": 26, + "line": 34, "column": 8 }, "end": { - "line": 26, + "line": 34, "column": 9 }, "identifierName": "n" @@ -944,15 +944,15 @@ }, "property": { "type": "Identifier", - "start": 696, - "end": 700, + "start": 786, + "end": 790, "loc": { "start": { - "line": 26, + "line": 34, "column": 10 }, "end": { - "line": 26, + "line": 34, "column": 14 }, "identifierName": "left" @@ -964,15 +964,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 712, - "end": 716, + "start": 802, + "end": 806, "loc": { "start": { - "line": 26, + "line": 34, "column": 26 }, "end": { - "line": 26, + "line": 34, "column": 30 }, "identifierName": "Node" @@ -985,43 +985,43 @@ }, { "type": "ExpressionStatement", - "start": 720, - "end": 750, + "start": 810, + "end": 840, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, + "line": 35, "column": 31 } }, "expression": { "type": "CallExpression", - "start": 720, - "end": 749, + "start": 810, + "end": 839, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, + "line": 35, "column": 30 } }, "callee": { "type": "Identifier", - "start": 720, - "end": 726, + "start": 810, + "end": 816, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, + "line": 35, "column": 7 }, "identifierName": "assert" @@ -1031,57 +1031,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 727, - "end": 748, + "start": 817, + "end": 838, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 29 } }, "left": { "type": "MemberExpression", - "start": 727, - "end": 740, + "start": 817, + "end": 830, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 21 } }, "object": { "type": "MemberExpression", - "start": 727, - "end": 733, + "start": 817, + "end": 823, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 14 } }, "object": { "type": "Identifier", - "start": 727, - "end": 728, + "start": 817, + "end": 818, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 9 }, "identifierName": "n" @@ -1090,15 +1090,15 @@ }, "property": { "type": "Identifier", - "start": 729, - "end": 733, + "start": 819, + "end": 823, "loc": { "start": { - "line": 27, + "line": 35, "column": 10 }, "end": { - "line": 27, + "line": 35, "column": 14 }, "identifierName": "left" @@ -1109,15 +1109,15 @@ }, "property": { "type": "Identifier", - "start": 734, - "end": 740, + "start": 824, + "end": 830, "loc": { "start": { - "line": 27, + "line": 35, "column": 15 }, "end": { - "line": 27, + "line": 35, "column": 21 }, "identifierName": "_color" @@ -1129,15 +1129,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 745, - "end": 748, + "start": 835, + "end": 838, "loc": { "start": { - "line": 27, + "line": 35, "column": 26 }, "end": { - "line": 27, + "line": 35, "column": 29 }, "identifierName": "RED" @@ -1150,43 +1150,43 @@ }, { "type": "ExpressionStatement", - "start": 752, - "end": 777, + "start": 842, + "end": 867, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, + "line": 36, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 752, - "end": 776, + "start": 842, + "end": 866, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, + "line": 36, "column": 25 } }, "callee": { "type": "Identifier", - "start": 752, - "end": 758, + "start": 842, + "end": 848, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, + "line": 36, "column": 7 }, "identifierName": "assert" @@ -1196,43 +1196,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 759, - "end": 775, + "start": 849, + "end": 865, "loc": { "start": { - "line": 28, + "line": 36, "column": 8 }, "end": { - "line": 28, + "line": 36, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 759, - "end": 766, + "start": 849, + "end": 856, "loc": { "start": { - "line": 28, + "line": 36, "column": 8 }, "end": { - "line": 28, + "line": 36, "column": 15 } }, "object": { "type": "Identifier", - "start": 759, - "end": 760, + "start": 849, + "end": 850, "loc": { "start": { - "line": 28, + "line": 36, "column": 8 }, "end": { - "line": 28, + "line": 36, "column": 9 }, "identifierName": "n" @@ -1241,15 +1241,15 @@ }, "property": { "type": "Identifier", - "start": 761, - "end": 766, + "start": 851, + "end": 856, "loc": { "start": { - "line": 28, + "line": 36, "column": 10 }, "end": { - "line": 28, + "line": 36, "column": 15 }, "identifierName": "right" @@ -1261,15 +1261,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 771, - "end": 775, + "start": 861, + "end": 865, "loc": { "start": { - "line": 28, + "line": 36, "column": 20 }, "end": { - "line": 28, + "line": 36, "column": 24 } } @@ -1280,44 +1280,44 @@ }, { "type": "VariableDeclaration", - "start": 780, - "end": 801, + "start": 870, + "end": 891, "loc": { "start": { - "line": 30, + "line": 38, "column": 1 }, "end": { - "line": 30, + "line": 38, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 786, - "end": 800, + "start": 876, + "end": 890, "loc": { "start": { - "line": 30, + "line": 38, "column": 7 }, "end": { - "line": 30, + "line": 38, "column": 21 } }, "id": { "type": "Identifier", - "start": 786, - "end": 791, + "start": 876, + "end": 881, "loc": { "start": { - "line": 30, + "line": 38, "column": 7 }, "end": { - "line": 30, + "line": 38, "column": 12 }, "identifierName": "child" @@ -1326,29 +1326,29 @@ }, "init": { "type": "MemberExpression", - "start": 794, - "end": 800, + "start": 884, + "end": 890, "loc": { "start": { - "line": 30, + "line": 38, "column": 15 }, "end": { - "line": 30, + "line": 38, "column": 21 } }, "object": { "type": "Identifier", - "start": 794, - "end": 795, + "start": 884, + "end": 885, "loc": { "start": { - "line": 30, + "line": 38, "column": 15 }, "end": { - "line": 30, + "line": 38, "column": 16 }, "identifierName": "n" @@ -1357,15 +1357,15 @@ }, "property": { "type": "Identifier", - "start": 796, - "end": 800, + "start": 886, + "end": 890, "loc": { "start": { - "line": 30, + "line": 38, "column": 17 }, "end": { - "line": 30, + "line": 38, "column": 21 }, "identifierName": "left" @@ -1381,15 +1381,15 @@ { "type": "CommentLine", "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 803, - "end": 877, + "start": 893, + "end": 967, "loc": { "start": { - "line": 31, + "line": 39, "column": 1 }, "end": { - "line": 31, + "line": 39, "column": 75 } } @@ -1397,15 +1397,15 @@ { "type": "CommentLine", "value": " through it by 1.", - "start": 879, - "end": 898, + "start": 969, + "end": 988, "loc": { "start": { - "line": 32, + "line": 40, "column": 1 }, "end": { - "line": 32, + "line": 40, "column": 20 } } @@ -1413,15 +1413,15 @@ { "type": "CommentLine", "value": " We can easily fix this when its only child is an", - "start": 900, - "end": 951, + "start": 990, + "end": 1041, "loc": { "start": { - "line": 33, + "line": 41, "column": 1 }, "end": { - "line": 33, + "line": 41, "column": 52 } } @@ -1429,15 +1429,15 @@ { "type": "CommentLine", "value": " internal RED node: change the color of the child to black and", - "start": 953, - "end": 1017, + "start": 1043, + "end": 1107, "loc": { "start": { - "line": 34, + "line": 42, "column": 1 }, "end": { - "line": 34, + "line": 42, "column": 65 } } @@ -1445,60 +1445,92 @@ { "type": "CommentLine", "value": " replace n with it.", - "start": 1019, - "end": 1040, + "start": 1109, + "end": 1130, "loc": { "start": { - "line": 35, + "line": 43, "column": 1 }, "end": { - "line": 35, + "line": 43, "column": 22 } } + }, + { + "type": "CommentLine", + "value": " TODO we could know n's direction depending whether swap_left or", + "start": 1132, + "end": 1198, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 67 + } + } + }, + { + "type": "CommentLine", + "value": " swap_non_adjacent has been called upstream.", + "start": 1200, + "end": 1246, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 47 + } + } } ] }, { "type": "ExpressionStatement", - "start": 1042, - "end": 1065, + "start": 1248, + "end": 1271, "loc": { "start": { - "line": 36, + "line": 46, "column": 1 }, "end": { - "line": 36, + "line": 46, "column": 24 } }, "expression": { "type": "CallExpression", - "start": 1042, - "end": 1064, + "start": 1248, + "end": 1270, "loc": { "start": { - "line": 36, + "line": 46, "column": 1 }, "end": { - "line": 36, + "line": 46, "column": 23 } }, "callee": { "type": "Identifier", - "start": 1042, - "end": 1054, + "start": 1248, + "end": 1260, "loc": { "start": { - "line": 36, + "line": 46, "column": 1 }, "end": { - "line": 36, + "line": 46, "column": 13 }, "identifierName": "replace_node" @@ -1509,15 +1541,15 @@ "arguments": [ { "type": "Identifier", - "start": 1055, - "end": 1056, + "start": 1261, + "end": 1262, "loc": { "start": { - "line": 36, + "line": 46, "column": 14 }, "end": { - "line": 36, + "line": 46, "column": 15 }, "identifierName": "n" @@ -1526,15 +1558,15 @@ }, { "type": "Identifier", - "start": 1058, - "end": 1063, + "start": 1264, + "end": 1269, "loc": { "start": { - "line": 36, + "line": 46, "column": 17 }, "end": { - "line": 36, + "line": 46, "column": 22 }, "identifierName": "child" @@ -1548,15 +1580,15 @@ { "type": "CommentLine", "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 803, - "end": 877, + "start": 893, + "end": 967, "loc": { "start": { - "line": 31, + "line": 39, "column": 1 }, "end": { - "line": 31, + "line": 39, "column": 75 } } @@ -1564,15 +1596,15 @@ { "type": "CommentLine", "value": " through it by 1.", - "start": 879, - "end": 898, + "start": 969, + "end": 988, "loc": { "start": { - "line": 32, + "line": 40, "column": 1 }, "end": { - "line": 32, + "line": 40, "column": 20 } } @@ -1580,15 +1612,15 @@ { "type": "CommentLine", "value": " We can easily fix this when its only child is an", - "start": 900, - "end": 951, + "start": 990, + "end": 1041, "loc": { "start": { - "line": 33, + "line": 41, "column": 1 }, "end": { - "line": 33, + "line": 41, "column": 52 } } @@ -1596,15 +1628,15 @@ { "type": "CommentLine", "value": " internal RED node: change the color of the child to black and", - "start": 953, - "end": 1017, + "start": 1043, + "end": 1107, "loc": { "start": { - "line": 34, + "line": 42, "column": 1 }, "end": { - "line": 34, + "line": 42, "column": 65 } } @@ -1612,75 +1644,107 @@ { "type": "CommentLine", "value": " replace n with it.", - "start": 1019, - "end": 1040, + "start": 1109, + "end": 1130, "loc": { "start": { - "line": 35, + "line": 43, "column": 1 }, "end": { - "line": 35, + "line": 43, "column": 22 } } + }, + { + "type": "CommentLine", + "value": " TODO we could know n's direction depending whether swap_left or", + "start": 1132, + "end": 1198, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 67 + } + } + }, + { + "type": "CommentLine", + "value": " swap_non_adjacent has been called upstream.", + "start": 1200, + "end": 1246, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 47 + } + } } ] }, { "type": "ExpressionStatement", - "start": 1067, - "end": 1088, + "start": 1273, + "end": 1294, "loc": { "start": { - "line": 37, + "line": 47, "column": 1 }, "end": { - "line": 37, + "line": 47, "column": 22 } }, "expression": { "type": "AssignmentExpression", - "start": 1067, - "end": 1087, + "start": 1273, + "end": 1293, "loc": { "start": { - "line": 37, + "line": 47, "column": 1 }, "end": { - "line": 37, + "line": 47, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1067, - "end": 1079, + "start": 1273, + "end": 1285, "loc": { "start": { - "line": 37, + "line": 47, "column": 1 }, "end": { - "line": 37, + "line": 47, "column": 13 } }, "object": { "type": "Identifier", - "start": 1067, - "end": 1072, + "start": 1273, + "end": 1278, "loc": { "start": { - "line": 37, + "line": 47, "column": 1 }, "end": { - "line": 37, + "line": 47, "column": 6 }, "identifierName": "child" @@ -1689,15 +1753,15 @@ }, "property": { "type": "Identifier", - "start": 1073, - "end": 1079, + "start": 1279, + "end": 1285, "loc": { "start": { - "line": 37, + "line": 47, "column": 7 }, "end": { - "line": 37, + "line": 47, "column": 13 }, "identifierName": "_color" @@ -1708,15 +1772,15 @@ }, "right": { "type": "Identifier", - "start": 1082, - "end": 1087, + "start": 1288, + "end": 1293, "loc": { "start": { - "line": 37, + "line": 47, "column": 16 }, "end": { - "line": 37, + "line": 47, "column": 21 }, "identifierName": "BLACK" @@ -1739,29 +1803,29 @@ }, { "type": "Identifier", - "start": 1093, - "end": 1125, + "start": 1299, + "end": 1331, "loc": { "start": { - "line": 40, + "line": 50, "column": 0 }, "end": { - "line": 40, + "line": 50, "column": 32 } }, "declaration": { "type": "Identifier", - "start": 1108, - "end": 1124, + "start": 1314, + "end": 1330, "loc": { "start": { - "line": 40, + "line": 50, "column": 15 }, "end": { - "line": 40, + "line": 50, "column": 31 }, "identifierName": "delete_one_child" @@ -1774,58 +1838,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1093, - "end": 1125, + "start": 1299, + "end": 1331, "loc": { "start": { - "line": 40, + "line": 50, "column": 0 }, "end": { - "line": 40, + "line": 50, "column": 32 } }, "declaration": { "type": "VariableDeclaration", - "start": 567, - "end": 1091, + "start": 657, + "end": 1297, "loc": { "start": { - "line": 22, + "line": 30, "column": 0 }, "end": { - "line": 38, + "line": 48, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 573, - "end": 1090, + "start": 663, + "end": 1296, "loc": { "start": { - "line": 22, + "line": 30, "column": 6 }, "end": { - "line": 38, + "line": 48, "column": 1 } }, "id": { "type": "Identifier", - "start": 573, - "end": 589, + "start": 663, + "end": 679, "loc": { "start": { - "line": 22, + "line": 30, "column": 6 }, "end": { - "line": 22, + "line": 30, "column": 22 }, "identifierName": "delete_one_child" @@ -1835,29 +1899,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 592, - "end": 1090, + "start": 682, + "end": 1296, "loc": { "start": { - "line": 22, + "line": 30, "column": 25 }, "end": { - "line": 38, + "line": 48, "column": 1 } }, "id": { "type": "Identifier", - "start": 573, - "end": 589, + "start": 663, + "end": 679, "loc": { "start": { - "line": 22, + "line": 30, "column": 6 }, "end": { - "line": 22, + "line": 30, "column": 22 }, "identifierName": "delete_one_child" @@ -1871,15 +1935,15 @@ "params": [ { "type": "Identifier", - "start": 593, - "end": 594, + "start": 683, + "end": 684, "loc": { "start": { - "line": 22, + "line": 30, "column": 26 }, "end": { - "line": 22, + "line": 30, "column": 27 }, "identifierName": "n" @@ -1889,58 +1953,58 @@ ], "body": { "type": "BlockStatement", - "start": 599, - "end": 1090, + "start": 689, + "end": 1296, "loc": { "start": { - "line": 22, + "line": 30, "column": 32 }, "end": { - "line": 38, + "line": 48, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 602, - "end": 628, + "start": 692, + "end": 718, "loc": { "start": { - "line": 23, + "line": 31, "column": 1 }, "end": { - "line": 23, + "line": 31, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 602, - "end": 627, + "start": 692, + "end": 717, "loc": { "start": { - "line": 23, + "line": 31, "column": 1 }, "end": { - "line": 23, + "line": 31, "column": 26 } }, "callee": { "type": "Identifier", - "start": 602, - "end": 608, + "start": 692, + "end": 698, "loc": { "start": { - "line": 23, + "line": 31, "column": 1 }, "end": { - "line": 23, + "line": 31, "column": 7 }, "identifierName": "assert" @@ -1950,29 +2014,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 609, - "end": 626, + "start": 699, + "end": 716, "loc": { "start": { - "line": 23, + "line": 31, "column": 8 }, "end": { - "line": 23, + "line": 31, "column": 25 } }, "left": { "type": "Identifier", - "start": 609, - "end": 610, + "start": 699, + "end": 700, "loc": { "start": { - "line": 23, + "line": 31, "column": 8 }, "end": { - "line": 23, + "line": 31, "column": 9 }, "identifierName": "n" @@ -1982,15 +2046,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 622, - "end": 626, + "start": 712, + "end": 716, "loc": { "start": { - "line": 23, + "line": 31, "column": 21 }, "end": { - "line": 23, + "line": 31, "column": 25 }, "identifierName": "Node" @@ -2003,43 +2067,43 @@ }, { "type": "ExpressionStatement", - "start": 630, - "end": 657, + "start": 720, + "end": 747, "loc": { "start": { - "line": 24, + "line": 32, "column": 1 }, "end": { - "line": 24, + "line": 32, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 630, - "end": 656, + "start": 720, + "end": 746, "loc": { "start": { - "line": 24, + "line": 32, "column": 1 }, "end": { - "line": 24, + "line": 32, "column": 27 } }, "callee": { "type": "Identifier", - "start": 630, - "end": 636, + "start": 720, + "end": 726, "loc": { "start": { - "line": 24, + "line": 32, "column": 1 }, "end": { - "line": 24, + "line": 32, "column": 7 }, "identifierName": "assert" @@ -2049,43 +2113,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 637, - "end": 655, + "start": 727, + "end": 745, "loc": { "start": { - "line": 24, + "line": 32, "column": 8 }, "end": { - "line": 24, + "line": 32, "column": 26 } }, "left": { "type": "MemberExpression", - "start": 637, - "end": 645, + "start": 727, + "end": 735, "loc": { "start": { - "line": 24, + "line": 32, "column": 8 }, "end": { - "line": 24, + "line": 32, "column": 16 } }, "object": { "type": "Identifier", - "start": 637, - "end": 638, + "start": 727, + "end": 728, "loc": { "start": { - "line": 24, + "line": 32, "column": 8 }, "end": { - "line": 24, + "line": 32, "column": 9 }, "identifierName": "n" @@ -2094,15 +2158,15 @@ }, "property": { "type": "Identifier", - "start": 639, - "end": 645, + "start": 729, + "end": 735, "loc": { "start": { - "line": 24, + "line": 32, "column": 10 }, "end": { - "line": 24, + "line": 32, "column": 16 }, "identifierName": "_color" @@ -2114,15 +2178,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 650, - "end": 655, + "start": 740, + "end": 745, "loc": { "start": { - "line": 24, + "line": 32, "column": 21 }, "end": { - "line": 24, + "line": 32, "column": 26 }, "identifierName": "BLACK" @@ -2135,43 +2199,43 @@ }, { "type": "ExpressionStatement", - "start": 659, - "end": 685, + "start": 749, + "end": 775, "loc": { "start": { - "line": 25, + "line": 33, "column": 1 }, "end": { - "line": 25, + "line": 33, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 659, - "end": 684, + "start": 749, + "end": 774, "loc": { "start": { - "line": 25, + "line": 33, "column": 1 }, "end": { - "line": 25, + "line": 33, "column": 26 } }, "callee": { "type": "Identifier", - "start": 659, - "end": 665, + "start": 749, + "end": 755, "loc": { "start": { - "line": 25, + "line": 33, "column": 1 }, "end": { - "line": 25, + "line": 33, "column": 7 }, "identifierName": "assert" @@ -2181,43 +2245,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 666, - "end": 683, + "start": 756, + "end": 773, "loc": { "start": { - "line": 25, + "line": 33, "column": 8 }, "end": { - "line": 25, + "line": 33, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 666, - "end": 674, + "start": 756, + "end": 764, "loc": { "start": { - "line": 25, + "line": 33, "column": 8 }, "end": { - "line": 25, + "line": 33, "column": 16 } }, "object": { "type": "Identifier", - "start": 666, - "end": 667, + "start": 756, + "end": 757, "loc": { "start": { - "line": 25, + "line": 33, "column": 8 }, "end": { - "line": 25, + "line": 33, "column": 9 }, "identifierName": "n" @@ -2226,15 +2290,15 @@ }, "property": { "type": "Identifier", - "start": 668, - "end": 674, + "start": 758, + "end": 764, "loc": { "start": { - "line": 25, + "line": 33, "column": 10 }, "end": { - "line": 25, + "line": 33, "column": 16 }, "identifierName": "parent" @@ -2246,15 +2310,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 679, - "end": 683, + "start": 769, + "end": 773, "loc": { "start": { - "line": 25, + "line": 33, "column": 21 }, "end": { - "line": 25, + "line": 33, "column": 25 } } @@ -2265,43 +2329,43 @@ }, { "type": "ExpressionStatement", - "start": 687, - "end": 718, + "start": 777, + "end": 808, "loc": { "start": { - "line": 26, + "line": 34, "column": 1 }, "end": { - "line": 26, + "line": 34, "column": 32 } }, "expression": { "type": "CallExpression", - "start": 687, - "end": 717, + "start": 777, + "end": 807, "loc": { "start": { - "line": 26, + "line": 34, "column": 1 }, "end": { - "line": 26, + "line": 34, "column": 31 } }, "callee": { "type": "Identifier", - "start": 687, - "end": 693, + "start": 777, + "end": 783, "loc": { "start": { - "line": 26, + "line": 34, "column": 1 }, "end": { - "line": 26, + "line": 34, "column": 7 }, "identifierName": "assert" @@ -2311,43 +2375,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 694, - "end": 716, + "start": 784, + "end": 806, "loc": { "start": { - "line": 26, + "line": 34, "column": 8 }, "end": { - "line": 26, + "line": 34, "column": 30 } }, "left": { "type": "MemberExpression", - "start": 694, - "end": 700, + "start": 784, + "end": 790, "loc": { "start": { - "line": 26, + "line": 34, "column": 8 }, "end": { - "line": 26, + "line": 34, "column": 14 } }, "object": { "type": "Identifier", - "start": 694, - "end": 695, + "start": 784, + "end": 785, "loc": { "start": { - "line": 26, + "line": 34, "column": 8 }, "end": { - "line": 26, + "line": 34, "column": 9 }, "identifierName": "n" @@ -2356,15 +2420,15 @@ }, "property": { "type": "Identifier", - "start": 696, - "end": 700, + "start": 786, + "end": 790, "loc": { "start": { - "line": 26, + "line": 34, "column": 10 }, "end": { - "line": 26, + "line": 34, "column": 14 }, "identifierName": "left" @@ -2376,15 +2440,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 712, - "end": 716, + "start": 802, + "end": 806, "loc": { "start": { - "line": 26, + "line": 34, "column": 26 }, "end": { - "line": 26, + "line": 34, "column": 30 }, "identifierName": "Node" @@ -2397,43 +2461,43 @@ }, { "type": "ExpressionStatement", - "start": 720, - "end": 750, + "start": 810, + "end": 840, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, + "line": 35, "column": 31 } }, "expression": { "type": "CallExpression", - "start": 720, - "end": 749, + "start": 810, + "end": 839, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, + "line": 35, "column": 30 } }, "callee": { "type": "Identifier", - "start": 720, - "end": 726, + "start": 810, + "end": 816, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, + "line": 35, "column": 7 }, "identifierName": "assert" @@ -2443,57 +2507,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 727, - "end": 748, + "start": 817, + "end": 838, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 29 } }, "left": { "type": "MemberExpression", - "start": 727, - "end": 740, + "start": 817, + "end": 830, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 21 } }, "object": { "type": "MemberExpression", - "start": 727, - "end": 733, + "start": 817, + "end": 823, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 14 } }, "object": { "type": "Identifier", - "start": 727, - "end": 728, + "start": 817, + "end": 818, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 9 }, "identifierName": "n" @@ -2502,15 +2566,15 @@ }, "property": { "type": "Identifier", - "start": 729, - "end": 733, + "start": 819, + "end": 823, "loc": { "start": { - "line": 27, + "line": 35, "column": 10 }, "end": { - "line": 27, + "line": 35, "column": 14 }, "identifierName": "left" @@ -2521,15 +2585,15 @@ }, "property": { "type": "Identifier", - "start": 734, - "end": 740, + "start": 824, + "end": 830, "loc": { "start": { - "line": 27, + "line": 35, "column": 15 }, "end": { - "line": 27, + "line": 35, "column": 21 }, "identifierName": "_color" @@ -2541,15 +2605,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 745, - "end": 748, + "start": 835, + "end": 838, "loc": { "start": { - "line": 27, + "line": 35, "column": 26 }, "end": { - "line": 27, + "line": 35, "column": 29 }, "identifierName": "RED" @@ -2562,43 +2626,43 @@ }, { "type": "ExpressionStatement", - "start": 752, - "end": 777, + "start": 842, + "end": 867, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, + "line": 36, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 752, - "end": 776, + "start": 842, + "end": 866, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, + "line": 36, "column": 25 } }, "callee": { "type": "Identifier", - "start": 752, - "end": 758, + "start": 842, + "end": 848, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, + "line": 36, "column": 7 }, "identifierName": "assert" @@ -2608,43 +2672,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 759, - "end": 775, + "start": 849, + "end": 865, "loc": { "start": { - "line": 28, + "line": 36, "column": 8 }, "end": { - "line": 28, + "line": 36, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 759, - "end": 766, + "start": 849, + "end": 856, "loc": { "start": { - "line": 28, + "line": 36, "column": 8 }, "end": { - "line": 28, + "line": 36, "column": 15 } }, "object": { "type": "Identifier", - "start": 759, - "end": 760, + "start": 849, + "end": 850, "loc": { "start": { - "line": 28, + "line": 36, "column": 8 }, "end": { - "line": 28, + "line": 36, "column": 9 }, "identifierName": "n" @@ -2653,15 +2717,15 @@ }, "property": { "type": "Identifier", - "start": 761, - "end": 766, + "start": 851, + "end": 856, "loc": { "start": { - "line": 28, + "line": 36, "column": 10 }, "end": { - "line": 28, + "line": 36, "column": 15 }, "identifierName": "right" @@ -2673,15 +2737,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 771, - "end": 775, + "start": 861, + "end": 865, "loc": { "start": { - "line": 28, + "line": 36, "column": 20 }, "end": { - "line": 28, + "line": 36, "column": 24 } } @@ -2692,44 +2756,44 @@ }, { "type": "VariableDeclaration", - "start": 780, - "end": 801, + "start": 870, + "end": 891, "loc": { "start": { - "line": 30, + "line": 38, "column": 1 }, "end": { - "line": 30, + "line": 38, "column": 22 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 786, - "end": 800, + "start": 876, + "end": 890, "loc": { "start": { - "line": 30, + "line": 38, "column": 7 }, "end": { - "line": 30, + "line": 38, "column": 21 } }, "id": { "type": "Identifier", - "start": 786, - "end": 791, + "start": 876, + "end": 881, "loc": { "start": { - "line": 30, + "line": 38, "column": 7 }, "end": { - "line": 30, + "line": 38, "column": 12 }, "identifierName": "child" @@ -2738,29 +2802,29 @@ }, "init": { "type": "MemberExpression", - "start": 794, - "end": 800, + "start": 884, + "end": 890, "loc": { "start": { - "line": 30, + "line": 38, "column": 15 }, "end": { - "line": 30, + "line": 38, "column": 21 } }, "object": { "type": "Identifier", - "start": 794, - "end": 795, + "start": 884, + "end": 885, "loc": { "start": { - "line": 30, + "line": 38, "column": 15 }, "end": { - "line": 30, + "line": 38, "column": 16 }, "identifierName": "n" @@ -2769,15 +2833,15 @@ }, "property": { "type": "Identifier", - "start": 796, - "end": 800, + "start": 886, + "end": 890, "loc": { "start": { - "line": 30, + "line": 38, "column": 17 }, "end": { - "line": 30, + "line": 38, "column": 21 }, "identifierName": "left" @@ -2793,15 +2857,15 @@ { "type": "CommentLine", "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 803, - "end": 877, + "start": 893, + "end": 967, "loc": { "start": { - "line": 31, + "line": 39, "column": 1 }, "end": { - "line": 31, + "line": 39, "column": 75 } } @@ -2809,15 +2873,15 @@ { "type": "CommentLine", "value": " through it by 1.", - "start": 879, - "end": 898, + "start": 969, + "end": 988, "loc": { "start": { - "line": 32, + "line": 40, "column": 1 }, "end": { - "line": 32, + "line": 40, "column": 20 } } @@ -2825,15 +2889,15 @@ { "type": "CommentLine", "value": " We can easily fix this when its only child is an", - "start": 900, - "end": 951, + "start": 990, + "end": 1041, "loc": { "start": { - "line": 33, + "line": 41, "column": 1 }, "end": { - "line": 33, + "line": 41, "column": 52 } } @@ -2841,15 +2905,15 @@ { "type": "CommentLine", "value": " internal RED node: change the color of the child to black and", - "start": 953, - "end": 1017, + "start": 1043, + "end": 1107, "loc": { "start": { - "line": 34, + "line": 42, "column": 1 }, "end": { - "line": 34, + "line": 42, "column": 65 } } @@ -2857,60 +2921,92 @@ { "type": "CommentLine", "value": " replace n with it.", - "start": 1019, - "end": 1040, + "start": 1109, + "end": 1130, "loc": { "start": { - "line": 35, + "line": 43, "column": 1 }, "end": { - "line": 35, + "line": 43, "column": 22 } } + }, + { + "type": "CommentLine", + "value": " TODO we could know n's direction depending whether swap_left or", + "start": 1132, + "end": 1198, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 67 + } + } + }, + { + "type": "CommentLine", + "value": " swap_non_adjacent has been called upstream.", + "start": 1200, + "end": 1246, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 47 + } + } } ] }, { "type": "ExpressionStatement", - "start": 1042, - "end": 1065, + "start": 1248, + "end": 1271, "loc": { "start": { - "line": 36, + "line": 46, "column": 1 }, "end": { - "line": 36, + "line": 46, "column": 24 } }, "expression": { "type": "CallExpression", - "start": 1042, - "end": 1064, + "start": 1248, + "end": 1270, "loc": { "start": { - "line": 36, + "line": 46, "column": 1 }, "end": { - "line": 36, + "line": 46, "column": 23 } }, "callee": { "type": "Identifier", - "start": 1042, - "end": 1054, + "start": 1248, + "end": 1260, "loc": { "start": { - "line": 36, + "line": 46, "column": 1 }, "end": { - "line": 36, + "line": 46, "column": 13 }, "identifierName": "replace_node" @@ -2921,15 +3017,15 @@ "arguments": [ { "type": "Identifier", - "start": 1055, - "end": 1056, + "start": 1261, + "end": 1262, "loc": { "start": { - "line": 36, + "line": 46, "column": 14 }, "end": { - "line": 36, + "line": 46, "column": 15 }, "identifierName": "n" @@ -2938,15 +3034,15 @@ }, { "type": "Identifier", - "start": 1058, - "end": 1063, + "start": 1264, + "end": 1269, "loc": { "start": { - "line": 36, + "line": 46, "column": 17 }, "end": { - "line": 36, + "line": 46, "column": 22 }, "identifierName": "child" @@ -2960,15 +3056,15 @@ { "type": "CommentLine", "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 803, - "end": 877, + "start": 893, + "end": 967, "loc": { "start": { - "line": 31, + "line": 39, "column": 1 }, "end": { - "line": 31, + "line": 39, "column": 75 } } @@ -2976,15 +3072,15 @@ { "type": "CommentLine", "value": " through it by 1.", - "start": 879, - "end": 898, + "start": 969, + "end": 988, "loc": { "start": { - "line": 32, + "line": 40, "column": 1 }, "end": { - "line": 32, + "line": 40, "column": 20 } } @@ -2992,15 +3088,15 @@ { "type": "CommentLine", "value": " We can easily fix this when its only child is an", - "start": 900, - "end": 951, + "start": 990, + "end": 1041, "loc": { "start": { - "line": 33, + "line": 41, "column": 1 }, "end": { - "line": 33, + "line": 41, "column": 52 } } @@ -3008,15 +3104,15 @@ { "type": "CommentLine", "value": " internal RED node: change the color of the child to black and", - "start": 953, - "end": 1017, + "start": 1043, + "end": 1107, "loc": { "start": { - "line": 34, + "line": 42, "column": 1 }, "end": { - "line": 34, + "line": 42, "column": 65 } } @@ -3024,75 +3120,107 @@ { "type": "CommentLine", "value": " replace n with it.", - "start": 1019, - "end": 1040, + "start": 1109, + "end": 1130, "loc": { "start": { - "line": 35, + "line": 43, "column": 1 }, "end": { - "line": 35, + "line": 43, "column": 22 } } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 1067, - "end": 1088, - "loc": { - "start": { - "line": 37, - "column": 1 }, - "end": { - "line": 37, - "column": 22 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 1067, - "end": 1087, + { + "type": "CommentLine", + "value": " TODO we could know n's direction depending whether swap_left or", + "start": 1132, + "end": 1198, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 67 + } + } + }, + { + "type": "CommentLine", + "value": " swap_non_adjacent has been called upstream.", + "start": 1200, + "end": 1246, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 47 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1273, + "end": 1294, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1273, + "end": 1293, "loc": { "start": { - "line": 37, + "line": 47, "column": 1 }, "end": { - "line": 37, + "line": 47, "column": 21 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1067, - "end": 1079, + "start": 1273, + "end": 1285, "loc": { "start": { - "line": 37, + "line": 47, "column": 1 }, "end": { - "line": 37, + "line": 47, "column": 13 } }, "object": { "type": "Identifier", - "start": 1067, - "end": 1072, + "start": 1273, + "end": 1278, "loc": { "start": { - "line": 37, + "line": 47, "column": 1 }, "end": { - "line": 37, + "line": 47, "column": 6 }, "identifierName": "child" @@ -3101,15 +3229,15 @@ }, "property": { "type": "Identifier", - "start": 1073, - "end": 1079, + "start": 1279, + "end": 1285, "loc": { "start": { - "line": 37, + "line": 47, "column": 7 }, "end": { - "line": 37, + "line": 47, "column": 13 }, "identifierName": "_color" @@ -3120,15 +3248,15 @@ }, "right": { "type": "Identifier", - "start": 1082, - "end": 1087, + "start": 1288, + "end": 1293, "loc": { "start": { - "line": 37, + "line": 47, "column": 16 }, "end": { - "line": 37, + "line": 47, "column": 21 }, "identifierName": "BLACK" @@ -3148,16 +3276,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", + "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * p\n * |\n * n (BLACK)\n * / \\\n * RED -\n * / \\\n * - -\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", "start": 188, - "end": 566, + "end": 656, "loc": { "start": { "line": 8, "column": 0 }, "end": { - "line": 21, + "line": 29, "column": 3 } } @@ -3172,16 +3300,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", + "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * p\n * |\n * n (BLACK)\n * / \\\n * RED -\n * / \\\n * - -\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", "start": 188, - "end": 566, + "end": 656, "loc": { "start": { "line": 8, "column": 0 }, "end": { - "line": 21, + "line": 29, "column": 3 } } @@ -3189,15 +3317,15 @@ { "type": "CommentLine", "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 803, - "end": 877, + "start": 893, + "end": 967, "loc": { "start": { - "line": 31, + "line": 39, "column": 1 }, "end": { - "line": 31, + "line": 39, "column": 75 } } @@ -3205,15 +3333,15 @@ { "type": "CommentLine", "value": " through it by 1.", - "start": 879, - "end": 898, + "start": 969, + "end": 988, "loc": { "start": { - "line": 32, + "line": 40, "column": 1 }, "end": { - "line": 32, + "line": 40, "column": 20 } } @@ -3221,15 +3349,15 @@ { "type": "CommentLine", "value": " We can easily fix this when its only child is an", - "start": 900, - "end": 951, + "start": 990, + "end": 1041, "loc": { "start": { - "line": 33, + "line": 41, "column": 1 }, "end": { - "line": 33, + "line": 41, "column": 52 } } @@ -3237,15 +3365,15 @@ { "type": "CommentLine", "value": " internal RED node: change the color of the child to black and", - "start": 953, - "end": 1017, + "start": 1043, + "end": 1107, "loc": { "start": { - "line": 34, + "line": 42, "column": 1 }, "end": { - "line": 34, + "line": 42, "column": 65 } } @@ -3253,18 +3381,50 @@ { "type": "CommentLine", "value": " replace n with it.", - "start": 1019, - "end": 1040, + "start": 1109, + "end": 1130, "loc": { "start": { - "line": 35, + "line": 43, "column": 1 }, "end": { - "line": 35, + "line": 43, "column": 22 } } + }, + { + "type": "CommentLine", + "value": " TODO we could know n's direction depending whether swap_left or", + "start": 1132, + "end": 1198, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 67 + } + } + }, + { + "type": "CommentLine", + "value": " swap_non_adjacent has been called upstream.", + "start": 1200, + "end": 1246, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 47 + } + } } ], "tokens": [ @@ -3935,16 +4095,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", + "value": "*\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * p\n * |\n * n (BLACK)\n * / \\\n * RED -\n * / \\\n * - -\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n ", "start": 188, - "end": 566, + "end": 656, "loc": { "start": { "line": 8, "column": 0 }, "end": { - "line": 21, + "line": 29, "column": 3 } } @@ -3964,15 +4124,15 @@ "updateContext": null }, "value": "const", - "start": 567, - "end": 572, + "start": 657, + "end": 662, "loc": { "start": { - "line": 22, + "line": 30, "column": 0 }, "end": { - "line": 22, + "line": 30, "column": 5 } } @@ -3990,15 +4150,15 @@ "binop": null }, "value": "delete_one_child", - "start": 573, - "end": 589, + "start": 663, + "end": 679, "loc": { "start": { - "line": 22, + "line": 30, "column": 6 }, "end": { - "line": 22, + "line": 30, "column": 22 } } @@ -4017,15 +4177,15 @@ "updateContext": null }, "value": "=", - "start": 590, - "end": 591, + "start": 680, + "end": 681, "loc": { "start": { - "line": 22, + "line": 30, "column": 23 }, "end": { - "line": 22, + "line": 30, "column": 24 } } @@ -4042,15 +4202,15 @@ "postfix": false, "binop": null }, - "start": 592, - "end": 593, + "start": 682, + "end": 683, "loc": { "start": { - "line": 22, + "line": 30, "column": 25 }, "end": { - "line": 22, + "line": 30, "column": 26 } } @@ -4068,15 +4228,15 @@ "binop": null }, "value": "n", - "start": 593, - "end": 594, + "start": 683, + "end": 684, "loc": { "start": { - "line": 22, + "line": 30, "column": 26 }, "end": { - "line": 22, + "line": 30, "column": 27 } } @@ -4093,15 +4253,15 @@ "postfix": false, "binop": null }, - "start": 594, - "end": 595, + "start": 684, + "end": 685, "loc": { "start": { - "line": 22, + "line": 30, "column": 27 }, "end": { - "line": 22, + "line": 30, "column": 28 } } @@ -4119,15 +4279,15 @@ "binop": null, "updateContext": null }, - "start": 596, - "end": 598, + "start": 686, + "end": 688, "loc": { "start": { - "line": 22, + "line": 30, "column": 29 }, "end": { - "line": 22, + "line": 30, "column": 31 } } @@ -4144,15 +4304,15 @@ "postfix": false, "binop": null }, - "start": 599, - "end": 600, + "start": 689, + "end": 690, "loc": { "start": { - "line": 22, + "line": 30, "column": 32 }, "end": { - "line": 22, + "line": 30, "column": 33 } } @@ -4170,15 +4330,15 @@ "binop": null }, "value": "assert", - "start": 602, - "end": 608, + "start": 692, + "end": 698, "loc": { "start": { - "line": 23, + "line": 31, "column": 1 }, "end": { - "line": 23, + "line": 31, "column": 7 } } @@ -4195,15 +4355,15 @@ "postfix": false, "binop": null }, - "start": 608, - "end": 609, + "start": 698, + "end": 699, "loc": { "start": { - "line": 23, + "line": 31, "column": 7 }, "end": { - "line": 23, + "line": 31, "column": 8 } } @@ -4221,15 +4381,15 @@ "binop": null }, "value": "n", - "start": 609, - "end": 610, + "start": 699, + "end": 700, "loc": { "start": { - "line": 23, + "line": 31, "column": 8 }, "end": { - "line": 23, + "line": 31, "column": 9 } } @@ -4249,15 +4409,15 @@ "updateContext": null }, "value": "instanceof", - "start": 611, - "end": 621, + "start": 701, + "end": 711, "loc": { "start": { - "line": 23, + "line": 31, "column": 10 }, "end": { - "line": 23, + "line": 31, "column": 20 } } @@ -4275,15 +4435,15 @@ "binop": null }, "value": "Node", - "start": 622, - "end": 626, + "start": 712, + "end": 716, "loc": { "start": { - "line": 23, + "line": 31, "column": 21 }, "end": { - "line": 23, + "line": 31, "column": 25 } } @@ -4300,15 +4460,15 @@ "postfix": false, "binop": null }, - "start": 626, - "end": 627, + "start": 716, + "end": 717, "loc": { "start": { - "line": 23, + "line": 31, "column": 25 }, "end": { - "line": 23, + "line": 31, "column": 26 } } @@ -4326,15 +4486,15 @@ "binop": null, "updateContext": null }, - "start": 627, - "end": 628, + "start": 717, + "end": 718, "loc": { "start": { - "line": 23, + "line": 31, "column": 26 }, "end": { - "line": 23, + "line": 31, "column": 27 } } @@ -4352,15 +4512,15 @@ "binop": null }, "value": "assert", - "start": 630, - "end": 636, + "start": 720, + "end": 726, "loc": { "start": { - "line": 24, + "line": 32, "column": 1 }, "end": { - "line": 24, + "line": 32, "column": 7 } } @@ -4377,15 +4537,15 @@ "postfix": false, "binop": null }, - "start": 636, - "end": 637, + "start": 726, + "end": 727, "loc": { "start": { - "line": 24, + "line": 32, "column": 7 }, "end": { - "line": 24, + "line": 32, "column": 8 } } @@ -4403,15 +4563,15 @@ "binop": null }, "value": "n", - "start": 637, - "end": 638, + "start": 727, + "end": 728, "loc": { "start": { - "line": 24, + "line": 32, "column": 8 }, "end": { - "line": 24, + "line": 32, "column": 9 } } @@ -4429,15 +4589,15 @@ "binop": null, "updateContext": null }, - "start": 638, - "end": 639, + "start": 728, + "end": 729, "loc": { "start": { - "line": 24, + "line": 32, "column": 9 }, "end": { - "line": 24, + "line": 32, "column": 10 } } @@ -4455,15 +4615,15 @@ "binop": null }, "value": "_color", - "start": 639, - "end": 645, + "start": 729, + "end": 735, "loc": { "start": { - "line": 24, + "line": 32, "column": 10 }, "end": { - "line": 24, + "line": 32, "column": 16 } } @@ -4482,15 +4642,15 @@ "updateContext": null }, "value": "===", - "start": 646, - "end": 649, + "start": 736, + "end": 739, "loc": { "start": { - "line": 24, + "line": 32, "column": 17 }, "end": { - "line": 24, + "line": 32, "column": 20 } } @@ -4508,15 +4668,15 @@ "binop": null }, "value": "BLACK", - "start": 650, - "end": 655, + "start": 740, + "end": 745, "loc": { "start": { - "line": 24, + "line": 32, "column": 21 }, "end": { - "line": 24, + "line": 32, "column": 26 } } @@ -4533,15 +4693,15 @@ "postfix": false, "binop": null }, - "start": 655, - "end": 656, + "start": 745, + "end": 746, "loc": { "start": { - "line": 24, + "line": 32, "column": 26 }, "end": { - "line": 24, + "line": 32, "column": 27 } } @@ -4559,15 +4719,15 @@ "binop": null, "updateContext": null }, - "start": 656, - "end": 657, + "start": 746, + "end": 747, "loc": { "start": { - "line": 24, + "line": 32, "column": 27 }, "end": { - "line": 24, + "line": 32, "column": 28 } } @@ -4585,15 +4745,15 @@ "binop": null }, "value": "assert", - "start": 659, - "end": 665, + "start": 749, + "end": 755, "loc": { "start": { - "line": 25, + "line": 33, "column": 1 }, "end": { - "line": 25, + "line": 33, "column": 7 } } @@ -4610,15 +4770,15 @@ "postfix": false, "binop": null }, - "start": 665, - "end": 666, + "start": 755, + "end": 756, "loc": { "start": { - "line": 25, + "line": 33, "column": 7 }, "end": { - "line": 25, + "line": 33, "column": 8 } } @@ -4636,15 +4796,15 @@ "binop": null }, "value": "n", - "start": 666, - "end": 667, + "start": 756, + "end": 757, "loc": { "start": { - "line": 25, + "line": 33, "column": 8 }, "end": { - "line": 25, + "line": 33, "column": 9 } } @@ -4662,15 +4822,15 @@ "binop": null, "updateContext": null }, - "start": 667, - "end": 668, + "start": 757, + "end": 758, "loc": { "start": { - "line": 25, + "line": 33, "column": 9 }, "end": { - "line": 25, + "line": 33, "column": 10 } } @@ -4688,15 +4848,15 @@ "binop": null }, "value": "parent", - "start": 668, - "end": 674, + "start": 758, + "end": 764, "loc": { "start": { - "line": 25, + "line": 33, "column": 10 }, "end": { - "line": 25, + "line": 33, "column": 16 } } @@ -4715,15 +4875,15 @@ "updateContext": null }, "value": "!==", - "start": 675, - "end": 678, + "start": 765, + "end": 768, "loc": { "start": { - "line": 25, + "line": 33, "column": 17 }, "end": { - "line": 25, + "line": 33, "column": 20 } } @@ -4743,15 +4903,15 @@ "updateContext": null }, "value": "null", - "start": 679, - "end": 683, + "start": 769, + "end": 773, "loc": { "start": { - "line": 25, + "line": 33, "column": 21 }, "end": { - "line": 25, + "line": 33, "column": 25 } } @@ -4768,15 +4928,15 @@ "postfix": false, "binop": null }, - "start": 683, - "end": 684, + "start": 773, + "end": 774, "loc": { "start": { - "line": 25, + "line": 33, "column": 25 }, "end": { - "line": 25, + "line": 33, "column": 26 } } @@ -4794,15 +4954,15 @@ "binop": null, "updateContext": null }, - "start": 684, - "end": 685, + "start": 774, + "end": 775, "loc": { "start": { - "line": 25, + "line": 33, "column": 26 }, "end": { - "line": 25, + "line": 33, "column": 27 } } @@ -4820,15 +4980,15 @@ "binop": null }, "value": "assert", - "start": 687, - "end": 693, + "start": 777, + "end": 783, "loc": { "start": { - "line": 26, + "line": 34, "column": 1 }, "end": { - "line": 26, + "line": 34, "column": 7 } } @@ -4845,15 +5005,15 @@ "postfix": false, "binop": null }, - "start": 693, - "end": 694, + "start": 783, + "end": 784, "loc": { "start": { - "line": 26, + "line": 34, "column": 7 }, "end": { - "line": 26, + "line": 34, "column": 8 } } @@ -4871,15 +5031,15 @@ "binop": null }, "value": "n", - "start": 694, - "end": 695, + "start": 784, + "end": 785, "loc": { "start": { - "line": 26, + "line": 34, "column": 8 }, "end": { - "line": 26, + "line": 34, "column": 9 } } @@ -4897,15 +5057,15 @@ "binop": null, "updateContext": null }, - "start": 695, - "end": 696, + "start": 785, + "end": 786, "loc": { "start": { - "line": 26, + "line": 34, "column": 9 }, "end": { - "line": 26, + "line": 34, "column": 10 } } @@ -4923,15 +5083,15 @@ "binop": null }, "value": "left", - "start": 696, - "end": 700, + "start": 786, + "end": 790, "loc": { "start": { - "line": 26, + "line": 34, "column": 10 }, "end": { - "line": 26, + "line": 34, "column": 14 } } @@ -4951,15 +5111,15 @@ "updateContext": null }, "value": "instanceof", - "start": 701, - "end": 711, + "start": 791, + "end": 801, "loc": { "start": { - "line": 26, + "line": 34, "column": 15 }, "end": { - "line": 26, + "line": 34, "column": 25 } } @@ -4977,15 +5137,15 @@ "binop": null }, "value": "Node", - "start": 712, - "end": 716, + "start": 802, + "end": 806, "loc": { "start": { - "line": 26, + "line": 34, "column": 26 }, "end": { - "line": 26, + "line": 34, "column": 30 } } @@ -5002,15 +5162,15 @@ "postfix": false, "binop": null }, - "start": 716, - "end": 717, + "start": 806, + "end": 807, "loc": { "start": { - "line": 26, + "line": 34, "column": 30 }, "end": { - "line": 26, + "line": 34, "column": 31 } } @@ -5028,15 +5188,15 @@ "binop": null, "updateContext": null }, - "start": 717, - "end": 718, + "start": 807, + "end": 808, "loc": { "start": { - "line": 26, + "line": 34, "column": 31 }, "end": { - "line": 26, + "line": 34, "column": 32 } } @@ -5054,15 +5214,15 @@ "binop": null }, "value": "assert", - "start": 720, - "end": 726, + "start": 810, + "end": 816, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, + "line": 35, "column": 7 } } @@ -5079,15 +5239,15 @@ "postfix": false, "binop": null }, - "start": 726, - "end": 727, + "start": 816, + "end": 817, "loc": { "start": { - "line": 27, + "line": 35, "column": 7 }, "end": { - "line": 27, + "line": 35, "column": 8 } } @@ -5105,15 +5265,15 @@ "binop": null }, "value": "n", - "start": 727, - "end": 728, + "start": 817, + "end": 818, "loc": { "start": { - "line": 27, + "line": 35, "column": 8 }, "end": { - "line": 27, + "line": 35, "column": 9 } } @@ -5131,15 +5291,15 @@ "binop": null, "updateContext": null }, - "start": 728, - "end": 729, + "start": 818, + "end": 819, "loc": { "start": { - "line": 27, + "line": 35, "column": 9 }, "end": { - "line": 27, + "line": 35, "column": 10 } } @@ -5157,15 +5317,15 @@ "binop": null }, "value": "left", - "start": 729, - "end": 733, + "start": 819, + "end": 823, "loc": { "start": { - "line": 27, + "line": 35, "column": 10 }, "end": { - "line": 27, + "line": 35, "column": 14 } } @@ -5183,15 +5343,15 @@ "binop": null, "updateContext": null }, - "start": 733, - "end": 734, + "start": 823, + "end": 824, "loc": { "start": { - "line": 27, + "line": 35, "column": 14 }, "end": { - "line": 27, + "line": 35, "column": 15 } } @@ -5209,15 +5369,15 @@ "binop": null }, "value": "_color", - "start": 734, - "end": 740, + "start": 824, + "end": 830, "loc": { "start": { - "line": 27, + "line": 35, "column": 15 }, "end": { - "line": 27, + "line": 35, "column": 21 } } @@ -5236,15 +5396,15 @@ "updateContext": null }, "value": "===", - "start": 741, - "end": 744, + "start": 831, + "end": 834, "loc": { "start": { - "line": 27, + "line": 35, "column": 22 }, "end": { - "line": 27, + "line": 35, "column": 25 } } @@ -5262,15 +5422,15 @@ "binop": null }, "value": "RED", - "start": 745, - "end": 748, + "start": 835, + "end": 838, "loc": { "start": { - "line": 27, + "line": 35, "column": 26 }, "end": { - "line": 27, + "line": 35, "column": 29 } } @@ -5287,15 +5447,15 @@ "postfix": false, "binop": null }, - "start": 748, - "end": 749, + "start": 838, + "end": 839, "loc": { "start": { - "line": 27, + "line": 35, "column": 29 }, "end": { - "line": 27, + "line": 35, "column": 30 } } @@ -5313,15 +5473,15 @@ "binop": null, "updateContext": null }, - "start": 749, - "end": 750, + "start": 839, + "end": 840, "loc": { "start": { - "line": 27, + "line": 35, "column": 30 }, "end": { - "line": 27, + "line": 35, "column": 31 } } @@ -5339,15 +5499,15 @@ "binop": null }, "value": "assert", - "start": 752, - "end": 758, + "start": 842, + "end": 848, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, + "line": 36, "column": 7 } } @@ -5364,15 +5524,15 @@ "postfix": false, "binop": null }, - "start": 758, - "end": 759, + "start": 848, + "end": 849, "loc": { "start": { - "line": 28, + "line": 36, "column": 7 }, "end": { - "line": 28, + "line": 36, "column": 8 } } @@ -5390,15 +5550,15 @@ "binop": null }, "value": "n", - "start": 759, - "end": 760, + "start": 849, + "end": 850, "loc": { "start": { - "line": 28, + "line": 36, "column": 8 }, "end": { - "line": 28, + "line": 36, "column": 9 } } @@ -5416,15 +5576,15 @@ "binop": null, "updateContext": null }, - "start": 760, - "end": 761, + "start": 850, + "end": 851, "loc": { "start": { - "line": 28, + "line": 36, "column": 9 }, "end": { - "line": 28, + "line": 36, "column": 10 } } @@ -5442,15 +5602,15 @@ "binop": null }, "value": "right", - "start": 761, - "end": 766, + "start": 851, + "end": 856, "loc": { "start": { - "line": 28, + "line": 36, "column": 10 }, "end": { - "line": 28, + "line": 36, "column": 15 } } @@ -5469,15 +5629,15 @@ "updateContext": null }, "value": "===", - "start": 767, - "end": 770, + "start": 857, + "end": 860, "loc": { "start": { - "line": 28, + "line": 36, "column": 16 }, "end": { - "line": 28, + "line": 36, "column": 19 } } @@ -5497,15 +5657,15 @@ "updateContext": null }, "value": "null", - "start": 771, - "end": 775, + "start": 861, + "end": 865, "loc": { "start": { - "line": 28, + "line": 36, "column": 20 }, "end": { - "line": 28, + "line": 36, "column": 24 } } @@ -5522,15 +5682,15 @@ "postfix": false, "binop": null }, - "start": 775, - "end": 776, + "start": 865, + "end": 866, "loc": { "start": { - "line": 28, + "line": 36, "column": 24 }, "end": { - "line": 28, + "line": 36, "column": 25 } } @@ -5548,15 +5708,15 @@ "binop": null, "updateContext": null }, - "start": 776, - "end": 777, + "start": 866, + "end": 867, "loc": { "start": { - "line": 28, + "line": 36, "column": 25 }, "end": { - "line": 28, + "line": 36, "column": 26 } } @@ -5576,15 +5736,15 @@ "updateContext": null }, "value": "const", - "start": 780, - "end": 785, + "start": 870, + "end": 875, "loc": { "start": { - "line": 30, + "line": 38, "column": 1 }, "end": { - "line": 30, + "line": 38, "column": 6 } } @@ -5602,15 +5762,15 @@ "binop": null }, "value": "child", - "start": 786, - "end": 791, + "start": 876, + "end": 881, "loc": { "start": { - "line": 30, + "line": 38, "column": 7 }, "end": { - "line": 30, + "line": 38, "column": 12 } } @@ -5629,15 +5789,15 @@ "updateContext": null }, "value": "=", - "start": 792, - "end": 793, + "start": 882, + "end": 883, "loc": { "start": { - "line": 30, + "line": 38, "column": 13 }, "end": { - "line": 30, + "line": 38, "column": 14 } } @@ -5655,15 +5815,15 @@ "binop": null }, "value": "n", - "start": 794, - "end": 795, + "start": 884, + "end": 885, "loc": { "start": { - "line": 30, + "line": 38, "column": 15 }, "end": { - "line": 30, + "line": 38, "column": 16 } } @@ -5681,15 +5841,15 @@ "binop": null, "updateContext": null }, - "start": 795, - "end": 796, + "start": 885, + "end": 886, "loc": { "start": { - "line": 30, + "line": 38, "column": 16 }, "end": { - "line": 30, + "line": 38, "column": 17 } } @@ -5707,15 +5867,15 @@ "binop": null }, "value": "left", - "start": 796, - "end": 800, + "start": 886, + "end": 890, "loc": { "start": { - "line": 30, + "line": 38, "column": 17 }, "end": { - "line": 30, + "line": 38, "column": 21 } } @@ -5733,15 +5893,15 @@ "binop": null, "updateContext": null }, - "start": 800, - "end": 801, + "start": 890, + "end": 891, "loc": { "start": { - "line": 30, + "line": 38, "column": 21 }, "end": { - "line": 30, + "line": 38, "column": 22 } } @@ -5749,15 +5909,15 @@ { "type": "CommentLine", "value": " If n is black, deleting it reduces the black-height of every path going", - "start": 803, - "end": 877, + "start": 893, + "end": 967, "loc": { "start": { - "line": 31, + "line": 39, "column": 1 }, "end": { - "line": 31, + "line": 39, "column": 75 } } @@ -5765,15 +5925,15 @@ { "type": "CommentLine", "value": " through it by 1.", - "start": 879, - "end": 898, + "start": 969, + "end": 988, "loc": { "start": { - "line": 32, + "line": 40, "column": 1 }, "end": { - "line": 32, + "line": 40, "column": 20 } } @@ -5781,15 +5941,15 @@ { "type": "CommentLine", "value": " We can easily fix this when its only child is an", - "start": 900, - "end": 951, + "start": 990, + "end": 1041, "loc": { "start": { - "line": 33, + "line": 41, "column": 1 }, "end": { - "line": 33, + "line": 41, "column": 52 } } @@ -5797,15 +5957,15 @@ { "type": "CommentLine", "value": " internal RED node: change the color of the child to black and", - "start": 953, - "end": 1017, + "start": 1043, + "end": 1107, "loc": { "start": { - "line": 34, + "line": 42, "column": 1 }, "end": { - "line": 34, + "line": 42, "column": 65 } } @@ -5813,19 +5973,51 @@ { "type": "CommentLine", "value": " replace n with it.", - "start": 1019, - "end": 1040, + "start": 1109, + "end": 1130, "loc": { "start": { - "line": 35, + "line": 43, "column": 1 }, "end": { - "line": 35, + "line": 43, "column": 22 } } }, + { + "type": "CommentLine", + "value": " TODO we could know n's direction depending whether swap_left or", + "start": 1132, + "end": 1198, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 67 + } + } + }, + { + "type": "CommentLine", + "value": " swap_non_adjacent has been called upstream.", + "start": 1200, + "end": 1246, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 47 + } + } + }, { "type": { "label": "name", @@ -5839,15 +6031,15 @@ "binop": null }, "value": "replace_node", - "start": 1042, - "end": 1054, + "start": 1248, + "end": 1260, "loc": { "start": { - "line": 36, + "line": 46, "column": 1 }, "end": { - "line": 36, + "line": 46, "column": 13 } } @@ -5864,15 +6056,15 @@ "postfix": false, "binop": null }, - "start": 1054, - "end": 1055, + "start": 1260, + "end": 1261, "loc": { "start": { - "line": 36, + "line": 46, "column": 13 }, "end": { - "line": 36, + "line": 46, "column": 14 } } @@ -5890,15 +6082,15 @@ "binop": null }, "value": "n", - "start": 1055, - "end": 1056, + "start": 1261, + "end": 1262, "loc": { "start": { - "line": 36, + "line": 46, "column": 14 }, "end": { - "line": 36, + "line": 46, "column": 15 } } @@ -5916,15 +6108,15 @@ "binop": null, "updateContext": null }, - "start": 1056, - "end": 1057, + "start": 1262, + "end": 1263, "loc": { "start": { - "line": 36, + "line": 46, "column": 15 }, "end": { - "line": 36, + "line": 46, "column": 16 } } @@ -5942,15 +6134,15 @@ "binop": null }, "value": "child", - "start": 1058, - "end": 1063, + "start": 1264, + "end": 1269, "loc": { "start": { - "line": 36, + "line": 46, "column": 17 }, "end": { - "line": 36, + "line": 46, "column": 22 } } @@ -5967,15 +6159,15 @@ "postfix": false, "binop": null }, - "start": 1063, - "end": 1064, + "start": 1269, + "end": 1270, "loc": { "start": { - "line": 36, + "line": 46, "column": 22 }, "end": { - "line": 36, + "line": 46, "column": 23 } } @@ -5993,15 +6185,15 @@ "binop": null, "updateContext": null }, - "start": 1064, - "end": 1065, + "start": 1270, + "end": 1271, "loc": { "start": { - "line": 36, + "line": 46, "column": 23 }, "end": { - "line": 36, + "line": 46, "column": 24 } } @@ -6019,15 +6211,15 @@ "binop": null }, "value": "child", - "start": 1067, - "end": 1072, + "start": 1273, + "end": 1278, "loc": { "start": { - "line": 37, + "line": 47, "column": 1 }, "end": { - "line": 37, + "line": 47, "column": 6 } } @@ -6045,15 +6237,15 @@ "binop": null, "updateContext": null }, - "start": 1072, - "end": 1073, + "start": 1278, + "end": 1279, "loc": { "start": { - "line": 37, + "line": 47, "column": 6 }, "end": { - "line": 37, + "line": 47, "column": 7 } } @@ -6071,15 +6263,15 @@ "binop": null }, "value": "_color", - "start": 1073, - "end": 1079, + "start": 1279, + "end": 1285, "loc": { "start": { - "line": 37, + "line": 47, "column": 7 }, "end": { - "line": 37, + "line": 47, "column": 13 } } @@ -6098,15 +6290,15 @@ "updateContext": null }, "value": "=", - "start": 1080, - "end": 1081, + "start": 1286, + "end": 1287, "loc": { "start": { - "line": 37, + "line": 47, "column": 14 }, "end": { - "line": 37, + "line": 47, "column": 15 } } @@ -6124,15 +6316,15 @@ "binop": null }, "value": "BLACK", - "start": 1082, - "end": 1087, + "start": 1288, + "end": 1293, "loc": { "start": { - "line": 37, + "line": 47, "column": 16 }, "end": { - "line": 37, + "line": 47, "column": 21 } } @@ -6150,15 +6342,15 @@ "binop": null, "updateContext": null }, - "start": 1087, - "end": 1088, + "start": 1293, + "end": 1294, "loc": { "start": { - "line": 37, + "line": 47, "column": 21 }, "end": { - "line": 37, + "line": 47, "column": 22 } } @@ -6175,15 +6367,15 @@ "postfix": false, "binop": null }, - "start": 1089, - "end": 1090, + "start": 1295, + "end": 1296, "loc": { "start": { - "line": 38, + "line": 48, "column": 0 }, "end": { - "line": 38, + "line": 48, "column": 1 } } @@ -6201,15 +6393,15 @@ "binop": null, "updateContext": null }, - "start": 1090, - "end": 1091, + "start": 1296, + "end": 1297, "loc": { "start": { - "line": 38, + "line": 48, "column": 1 }, "end": { - "line": 38, + "line": 48, "column": 2 } } @@ -6229,15 +6421,15 @@ "updateContext": null }, "value": "export", - "start": 1093, - "end": 1099, + "start": 1299, + "end": 1305, "loc": { "start": { - "line": 40, + "line": 50, "column": 0 }, "end": { - "line": 40, + "line": 50, "column": 6 } } @@ -6257,15 +6449,15 @@ "updateContext": null }, "value": "default", - "start": 1100, - "end": 1107, + "start": 1306, + "end": 1313, "loc": { "start": { - "line": 40, + "line": 50, "column": 7 }, "end": { - "line": 40, + "line": 50, "column": 14 } } @@ -6283,15 +6475,15 @@ "binop": null }, "value": "delete_one_child", - "start": 1108, - "end": 1124, + "start": 1314, + "end": 1330, "loc": { "start": { - "line": 40, + "line": 50, "column": 15 }, "end": { - "line": 40, + "line": 50, "column": 31 } } @@ -6309,15 +6501,15 @@ "binop": null, "updateContext": null }, - "start": 1124, - "end": 1125, + "start": 1330, + "end": 1331, "loc": { "start": { - "line": 40, + "line": 50, "column": 31 }, "end": { - "line": 40, + "line": 50, "column": 32 } } @@ -6335,15 +6527,15 @@ "binop": null, "updateContext": null }, - "start": 1126, - "end": 1126, + "start": 1332, + "end": 1332, "loc": { "start": { - "line": 41, + "line": 51, "column": 0 }, "end": { - "line": 41, + "line": 51, "column": 0 } } diff --git a/ast/source/deletion/replace_node.js.json b/ast/source/deletion/replace_node.js.json index e153514..b574e54 100644 --- a/ast/source/deletion/replace_node.js.json +++ b/ast/source/deletion/replace_node.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 531, + "end": 508, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 531, + "end": 508, "loc": { "start": { "line": 1, @@ -187,7 +187,7 @@ { "type": "Identifier", "start": 219, - "end": 500, + "end": 477, "loc": { "start": { "line": 10, @@ -202,7 +202,7 @@ { "type": "VariableDeclarator", "start": 225, - "end": 499, + "end": 476, "loc": { "start": { "line": 10, @@ -234,7 +234,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 240, - "end": 499, + "end": 476, "loc": { "start": { "line": 10, @@ -288,7 +288,7 @@ "body": { "type": "BlockStatement", "start": 250, - "end": 499, + "end": 476, "loc": { "start": { "line": 10, @@ -500,9 +500,9 @@ "trailingComments": [ { "type": "CommentLine", - "value": " We never apply delete_one_child or delete_no_child on the root", + "value": " We never apply replace_node on the root", "start": 309, - "end": 374, + "end": 351, "loc": { "start": { "line": 13, @@ -510,7 +510,7 @@ }, "end": { "line": 13, - "column": 66 + "column": 43 } } } @@ -518,8 +518,8 @@ }, { "type": "ExpressionStatement", - "start": 376, - "end": 402, + "start": 353, + "end": 379, "loc": { "start": { "line": 14, @@ -532,8 +532,8 @@ }, "expression": { "type": "CallExpression", - "start": 376, - "end": 401, + "start": 353, + "end": 378, "loc": { "start": { "line": 14, @@ -546,8 +546,8 @@ }, "callee": { "type": "Identifier", - "start": 376, - "end": 382, + "start": 353, + "end": 359, "loc": { "start": { "line": 14, @@ -565,8 +565,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 383, - "end": 400, + "start": 360, + "end": 377, "loc": { "start": { "line": 14, @@ -579,8 +579,8 @@ }, "left": { "type": "MemberExpression", - "start": 383, - "end": 391, + "start": 360, + "end": 368, "loc": { "start": { "line": 14, @@ -593,8 +593,8 @@ }, "object": { "type": "Identifier", - "start": 383, - "end": 384, + "start": 360, + "end": 361, "loc": { "start": { "line": 14, @@ -610,8 +610,8 @@ }, "property": { "type": "Identifier", - "start": 385, - "end": 391, + "start": 362, + "end": 368, "loc": { "start": { "line": 14, @@ -630,8 +630,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 396, - "end": 400, + "start": 373, + "end": 377, "loc": { "start": { "line": 14, @@ -650,9 +650,9 @@ "leadingComments": [ { "type": "CommentLine", - "value": " We never apply delete_one_child or delete_no_child on the root", + "value": " We never apply replace_node on the root", "start": 309, - "end": 374, + "end": 351, "loc": { "start": { "line": 13, @@ -660,7 +660,7 @@ }, "end": { "line": 13, - "column": 66 + "column": 43 } } } @@ -668,8 +668,8 @@ }, { "type": "IfStatement", - "start": 405, - "end": 474, + "start": 382, + "end": 451, "loc": { "start": { "line": 16, @@ -682,8 +682,8 @@ }, "test": { "type": "BinaryExpression", - "start": 409, - "end": 428, + "start": 386, + "end": 405, "loc": { "start": { "line": 16, @@ -696,8 +696,8 @@ }, "left": { "type": "Identifier", - "start": 409, - "end": 410, + "start": 386, + "end": 387, "loc": { "start": { "line": 16, @@ -714,8 +714,8 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 415, - "end": 428, + "start": 392, + "end": 405, "loc": { "start": { "line": 16, @@ -728,8 +728,8 @@ }, "object": { "type": "MemberExpression", - "start": 415, - "end": 423, + "start": 392, + "end": 400, "loc": { "start": { "line": 16, @@ -742,8 +742,8 @@ }, "object": { "type": "Identifier", - "start": 415, - "end": 416, + "start": 392, + "end": 393, "loc": { "start": { "line": 16, @@ -759,8 +759,8 @@ }, "property": { "type": "Identifier", - "start": 417, - "end": 423, + "start": 394, + "end": 400, "loc": { "start": { "line": 16, @@ -778,8 +778,8 @@ }, "property": { "type": "Identifier", - "start": 424, - "end": 428, + "start": 401, + "end": 405, "loc": { "start": { "line": 16, @@ -798,8 +798,8 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 430, - "end": 448, + "start": 407, + "end": 425, "loc": { "start": { "line": 16, @@ -812,8 +812,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 430, - "end": 447, + "start": 407, + "end": 424, "loc": { "start": { "line": 16, @@ -827,8 +827,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 430, - "end": 443, + "start": 407, + "end": 420, "loc": { "start": { "line": 16, @@ -841,8 +841,8 @@ }, "object": { "type": "MemberExpression", - "start": 430, - "end": 438, + "start": 407, + "end": 415, "loc": { "start": { "line": 16, @@ -855,8 +855,8 @@ }, "object": { "type": "Identifier", - "start": 430, - "end": 431, + "start": 407, + "end": 408, "loc": { "start": { "line": 16, @@ -872,8 +872,8 @@ }, "property": { "type": "Identifier", - "start": 432, - "end": 438, + "start": 409, + "end": 415, "loc": { "start": { "line": 16, @@ -891,8 +891,8 @@ }, "property": { "type": "Identifier", - "start": 439, - "end": 443, + "start": 416, + "end": 420, "loc": { "start": { "line": 16, @@ -910,8 +910,8 @@ }, "right": { "type": "Identifier", - "start": 446, - "end": 447, + "start": 423, + "end": 424, "loc": { "start": { "line": 16, @@ -929,8 +929,8 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 455, - "end": 474, + "start": 432, + "end": 451, "loc": { "start": { "line": 17, @@ -943,8 +943,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 455, - "end": 473, + "start": 432, + "end": 450, "loc": { "start": { "line": 17, @@ -958,8 +958,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 455, - "end": 469, + "start": 432, + "end": 446, "loc": { "start": { "line": 17, @@ -972,8 +972,8 @@ }, "object": { "type": "MemberExpression", - "start": 455, - "end": 463, + "start": 432, + "end": 440, "loc": { "start": { "line": 17, @@ -986,8 +986,8 @@ }, "object": { "type": "Identifier", - "start": 455, - "end": 456, + "start": 432, + "end": 433, "loc": { "start": { "line": 17, @@ -1003,8 +1003,8 @@ }, "property": { "type": "Identifier", - "start": 457, - "end": 463, + "start": 434, + "end": 440, "loc": { "start": { "line": 17, @@ -1022,8 +1022,8 @@ }, "property": { "type": "Identifier", - "start": 464, - "end": 469, + "start": 441, + "end": 446, "loc": { "start": { "line": 17, @@ -1041,8 +1041,8 @@ }, "right": { "type": "Identifier", - "start": 472, - "end": 473, + "start": 449, + "end": 450, "loc": { "start": { "line": 17, @@ -1061,8 +1061,8 @@ }, { "type": "ExpressionStatement", - "start": 477, - "end": 497, + "start": 454, + "end": 474, "loc": { "start": { "line": 19, @@ -1075,8 +1075,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 477, - "end": 496, + "start": 454, + "end": 473, "loc": { "start": { "line": 19, @@ -1090,8 +1090,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 477, - "end": 485, + "start": 454, + "end": 462, "loc": { "start": { "line": 19, @@ -1104,8 +1104,8 @@ }, "object": { "type": "Identifier", - "start": 477, - "end": 478, + "start": 454, + "end": 455, "loc": { "start": { "line": 19, @@ -1121,8 +1121,8 @@ }, "property": { "type": "Identifier", - "start": 479, - "end": 485, + "start": 456, + "end": 462, "loc": { "start": { "line": 19, @@ -1140,8 +1140,8 @@ }, "right": { "type": "MemberExpression", - "start": 488, - "end": 496, + "start": 465, + "end": 473, "loc": { "start": { "line": 19, @@ -1154,8 +1154,8 @@ }, "object": { "type": "Identifier", - "start": 488, - "end": 489, + "start": 465, + "end": 466, "loc": { "start": { "line": 19, @@ -1171,8 +1171,8 @@ }, "property": { "type": "Identifier", - "start": 490, - "end": 496, + "start": 467, + "end": 473, "loc": { "start": { "line": 19, @@ -1204,8 +1204,8 @@ }, { "type": "Identifier", - "start": 502, - "end": 530, + "start": 479, + "end": 507, "loc": { "start": { "line": 22, @@ -1218,8 +1218,8 @@ }, "declaration": { "type": "Identifier", - "start": 517, - "end": 529, + "start": 494, + "end": 506, "loc": { "start": { "line": 22, @@ -1239,8 +1239,8 @@ }, { "type": "ExportDefaultDeclaration", - "start": 502, - "end": 530, + "start": 479, + "end": 507, "loc": { "start": { "line": 22, @@ -1254,7 +1254,7 @@ "declaration": { "type": "VariableDeclaration", "start": 219, - "end": 500, + "end": 477, "loc": { "start": { "line": 10, @@ -1269,7 +1269,7 @@ { "type": "VariableDeclarator", "start": 225, - "end": 499, + "end": 476, "loc": { "start": { "line": 10, @@ -1301,7 +1301,7 @@ "init": { "type": "ArrowFunctionExpression", "start": 240, - "end": 499, + "end": 476, "loc": { "start": { "line": 10, @@ -1372,7 +1372,7 @@ "body": { "type": "BlockStatement", "start": 250, - "end": 499, + "end": 476, "loc": { "start": { "line": 10, @@ -1584,9 +1584,9 @@ "trailingComments": [ { "type": "CommentLine", - "value": " We never apply delete_one_child or delete_no_child on the root", + "value": " We never apply replace_node on the root", "start": 309, - "end": 374, + "end": 351, "loc": { "start": { "line": 13, @@ -1594,7 +1594,7 @@ }, "end": { "line": 13, - "column": 66 + "column": 43 } } } @@ -1602,8 +1602,8 @@ }, { "type": "ExpressionStatement", - "start": 376, - "end": 402, + "start": 353, + "end": 379, "loc": { "start": { "line": 14, @@ -1616,8 +1616,8 @@ }, "expression": { "type": "CallExpression", - "start": 376, - "end": 401, + "start": 353, + "end": 378, "loc": { "start": { "line": 14, @@ -1630,8 +1630,8 @@ }, "callee": { "type": "Identifier", - "start": 376, - "end": 382, + "start": 353, + "end": 359, "loc": { "start": { "line": 14, @@ -1649,8 +1649,8 @@ "arguments": [ { "type": "BinaryExpression", - "start": 383, - "end": 400, + "start": 360, + "end": 377, "loc": { "start": { "line": 14, @@ -1663,8 +1663,8 @@ }, "left": { "type": "MemberExpression", - "start": 383, - "end": 391, + "start": 360, + "end": 368, "loc": { "start": { "line": 14, @@ -1677,8 +1677,8 @@ }, "object": { "type": "Identifier", - "start": 383, - "end": 384, + "start": 360, + "end": 361, "loc": { "start": { "line": 14, @@ -1694,8 +1694,8 @@ }, "property": { "type": "Identifier", - "start": 385, - "end": 391, + "start": 362, + "end": 368, "loc": { "start": { "line": 14, @@ -1714,8 +1714,8 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 396, - "end": 400, + "start": 373, + "end": 377, "loc": { "start": { "line": 14, @@ -1734,9 +1734,9 @@ "leadingComments": [ { "type": "CommentLine", - "value": " We never apply delete_one_child or delete_no_child on the root", + "value": " We never apply replace_node on the root", "start": 309, - "end": 374, + "end": 351, "loc": { "start": { "line": 13, @@ -1744,7 +1744,7 @@ }, "end": { "line": 13, - "column": 66 + "column": 43 } } } @@ -1752,8 +1752,8 @@ }, { "type": "IfStatement", - "start": 405, - "end": 474, + "start": 382, + "end": 451, "loc": { "start": { "line": 16, @@ -1766,8 +1766,8 @@ }, "test": { "type": "BinaryExpression", - "start": 409, - "end": 428, + "start": 386, + "end": 405, "loc": { "start": { "line": 16, @@ -1780,8 +1780,8 @@ }, "left": { "type": "Identifier", - "start": 409, - "end": 410, + "start": 386, + "end": 387, "loc": { "start": { "line": 16, @@ -1798,8 +1798,8 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 415, - "end": 428, + "start": 392, + "end": 405, "loc": { "start": { "line": 16, @@ -1812,8 +1812,8 @@ }, "object": { "type": "MemberExpression", - "start": 415, - "end": 423, + "start": 392, + "end": 400, "loc": { "start": { "line": 16, @@ -1826,8 +1826,8 @@ }, "object": { "type": "Identifier", - "start": 415, - "end": 416, + "start": 392, + "end": 393, "loc": { "start": { "line": 16, @@ -1843,8 +1843,8 @@ }, "property": { "type": "Identifier", - "start": 417, - "end": 423, + "start": 394, + "end": 400, "loc": { "start": { "line": 16, @@ -1862,8 +1862,8 @@ }, "property": { "type": "Identifier", - "start": 424, - "end": 428, + "start": 401, + "end": 405, "loc": { "start": { "line": 16, @@ -1882,8 +1882,8 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 430, - "end": 448, + "start": 407, + "end": 425, "loc": { "start": { "line": 16, @@ -1896,8 +1896,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 430, - "end": 447, + "start": 407, + "end": 424, "loc": { "start": { "line": 16, @@ -1911,8 +1911,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 430, - "end": 443, + "start": 407, + "end": 420, "loc": { "start": { "line": 16, @@ -1925,8 +1925,8 @@ }, "object": { "type": "MemberExpression", - "start": 430, - "end": 438, + "start": 407, + "end": 415, "loc": { "start": { "line": 16, @@ -1939,8 +1939,8 @@ }, "object": { "type": "Identifier", - "start": 430, - "end": 431, + "start": 407, + "end": 408, "loc": { "start": { "line": 16, @@ -1956,8 +1956,8 @@ }, "property": { "type": "Identifier", - "start": 432, - "end": 438, + "start": 409, + "end": 415, "loc": { "start": { "line": 16, @@ -1975,8 +1975,8 @@ }, "property": { "type": "Identifier", - "start": 439, - "end": 443, + "start": 416, + "end": 420, "loc": { "start": { "line": 16, @@ -1994,8 +1994,8 @@ }, "right": { "type": "Identifier", - "start": 446, - "end": 447, + "start": 423, + "end": 424, "loc": { "start": { "line": 16, @@ -2013,8 +2013,8 @@ }, "alternate": { "type": "ExpressionStatement", - "start": 455, - "end": 474, + "start": 432, + "end": 451, "loc": { "start": { "line": 17, @@ -2027,8 +2027,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 455, - "end": 473, + "start": 432, + "end": 450, "loc": { "start": { "line": 17, @@ -2042,8 +2042,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 455, - "end": 469, + "start": 432, + "end": 446, "loc": { "start": { "line": 17, @@ -2056,8 +2056,8 @@ }, "object": { "type": "MemberExpression", - "start": 455, - "end": 463, + "start": 432, + "end": 440, "loc": { "start": { "line": 17, @@ -2070,8 +2070,8 @@ }, "object": { "type": "Identifier", - "start": 455, - "end": 456, + "start": 432, + "end": 433, "loc": { "start": { "line": 17, @@ -2087,8 +2087,8 @@ }, "property": { "type": "Identifier", - "start": 457, - "end": 463, + "start": 434, + "end": 440, "loc": { "start": { "line": 17, @@ -2106,8 +2106,8 @@ }, "property": { "type": "Identifier", - "start": 464, - "end": 469, + "start": 441, + "end": 446, "loc": { "start": { "line": 17, @@ -2125,8 +2125,8 @@ }, "right": { "type": "Identifier", - "start": 472, - "end": 473, + "start": 449, + "end": 450, "loc": { "start": { "line": 17, @@ -2145,8 +2145,8 @@ }, { "type": "ExpressionStatement", - "start": 477, - "end": 497, + "start": 454, + "end": 474, "loc": { "start": { "line": 19, @@ -2159,8 +2159,8 @@ }, "expression": { "type": "AssignmentExpression", - "start": 477, - "end": 496, + "start": 454, + "end": 473, "loc": { "start": { "line": 19, @@ -2174,8 +2174,8 @@ "operator": "=", "left": { "type": "MemberExpression", - "start": 477, - "end": 485, + "start": 454, + "end": 462, "loc": { "start": { "line": 19, @@ -2188,8 +2188,8 @@ }, "object": { "type": "Identifier", - "start": 477, - "end": 478, + "start": 454, + "end": 455, "loc": { "start": { "line": 19, @@ -2205,8 +2205,8 @@ }, "property": { "type": "Identifier", - "start": 479, - "end": 485, + "start": 456, + "end": 462, "loc": { "start": { "line": 19, @@ -2224,8 +2224,8 @@ }, "right": { "type": "MemberExpression", - "start": 488, - "end": 496, + "start": 465, + "end": 473, "loc": { "start": { "line": 19, @@ -2238,8 +2238,8 @@ }, "object": { "type": "Identifier", - "start": 488, - "end": 489, + "start": 465, + "end": 466, "loc": { "start": { "line": 19, @@ -2255,8 +2255,8 @@ }, "property": { "type": "Identifier", - "start": 490, - "end": 496, + "start": 467, + "end": 473, "loc": { "start": { "line": 19, @@ -2325,9 +2325,9 @@ }, { "type": "CommentLine", - "value": " We never apply delete_one_child or delete_no_child on the root", + "value": " We never apply replace_node on the root", "start": 309, - "end": 374, + "end": 351, "loc": { "start": { "line": 13, @@ -2335,7 +2335,7 @@ }, "end": { "line": 13, - "column": 66 + "column": 43 } } } @@ -3249,9 +3249,9 @@ }, { "type": "CommentLine", - "value": " We never apply delete_one_child or delete_no_child on the root", + "value": " We never apply replace_node on the root", "start": 309, - "end": 374, + "end": 351, "loc": { "start": { "line": 13, @@ -3259,7 +3259,7 @@ }, "end": { "line": 13, - "column": 66 + "column": 43 } } }, @@ -3276,8 +3276,8 @@ "binop": null }, "value": "assert", - "start": 376, - "end": 382, + "start": 353, + "end": 359, "loc": { "start": { "line": 14, @@ -3301,8 +3301,8 @@ "postfix": false, "binop": null }, - "start": 382, - "end": 383, + "start": 359, + "end": 360, "loc": { "start": { "line": 14, @@ -3327,8 +3327,8 @@ "binop": null }, "value": "A", - "start": 383, - "end": 384, + "start": 360, + "end": 361, "loc": { "start": { "line": 14, @@ -3353,8 +3353,8 @@ "binop": null, "updateContext": null }, - "start": 384, - "end": 385, + "start": 361, + "end": 362, "loc": { "start": { "line": 14, @@ -3379,8 +3379,8 @@ "binop": null }, "value": "parent", - "start": 385, - "end": 391, + "start": 362, + "end": 368, "loc": { "start": { "line": 14, @@ -3406,8 +3406,8 @@ "updateContext": null }, "value": "!==", - "start": 392, - "end": 395, + "start": 369, + "end": 372, "loc": { "start": { "line": 14, @@ -3434,8 +3434,8 @@ "updateContext": null }, "value": "null", - "start": 396, - "end": 400, + "start": 373, + "end": 377, "loc": { "start": { "line": 14, @@ -3459,8 +3459,8 @@ "postfix": false, "binop": null }, - "start": 400, - "end": 401, + "start": 377, + "end": 378, "loc": { "start": { "line": 14, @@ -3485,8 +3485,8 @@ "binop": null, "updateContext": null }, - "start": 401, - "end": 402, + "start": 378, + "end": 379, "loc": { "start": { "line": 14, @@ -3513,8 +3513,8 @@ "updateContext": null }, "value": "if", - "start": 405, - "end": 407, + "start": 382, + "end": 384, "loc": { "start": { "line": 16, @@ -3538,8 +3538,8 @@ "postfix": false, "binop": null }, - "start": 408, - "end": 409, + "start": 385, + "end": 386, "loc": { "start": { "line": 16, @@ -3564,8 +3564,8 @@ "binop": null }, "value": "A", - "start": 409, - "end": 410, + "start": 386, + "end": 387, "loc": { "start": { "line": 16, @@ -3591,8 +3591,8 @@ "updateContext": null }, "value": "===", - "start": 411, - "end": 414, + "start": 388, + "end": 391, "loc": { "start": { "line": 16, @@ -3617,8 +3617,8 @@ "binop": null }, "value": "A", - "start": 415, - "end": 416, + "start": 392, + "end": 393, "loc": { "start": { "line": 16, @@ -3643,8 +3643,8 @@ "binop": null, "updateContext": null }, - "start": 416, - "end": 417, + "start": 393, + "end": 394, "loc": { "start": { "line": 16, @@ -3669,8 +3669,8 @@ "binop": null }, "value": "parent", - "start": 417, - "end": 423, + "start": 394, + "end": 400, "loc": { "start": { "line": 16, @@ -3695,8 +3695,8 @@ "binop": null, "updateContext": null }, - "start": 423, - "end": 424, + "start": 400, + "end": 401, "loc": { "start": { "line": 16, @@ -3721,8 +3721,8 @@ "binop": null }, "value": "left", - "start": 424, - "end": 428, + "start": 401, + "end": 405, "loc": { "start": { "line": 16, @@ -3746,8 +3746,8 @@ "postfix": false, "binop": null }, - "start": 428, - "end": 429, + "start": 405, + "end": 406, "loc": { "start": { "line": 16, @@ -3772,8 +3772,8 @@ "binop": null }, "value": "A", - "start": 430, - "end": 431, + "start": 407, + "end": 408, "loc": { "start": { "line": 16, @@ -3798,8 +3798,8 @@ "binop": null, "updateContext": null }, - "start": 431, - "end": 432, + "start": 408, + "end": 409, "loc": { "start": { "line": 16, @@ -3824,8 +3824,8 @@ "binop": null }, "value": "parent", - "start": 432, - "end": 438, + "start": 409, + "end": 415, "loc": { "start": { "line": 16, @@ -3850,8 +3850,8 @@ "binop": null, "updateContext": null }, - "start": 438, - "end": 439, + "start": 415, + "end": 416, "loc": { "start": { "line": 16, @@ -3876,8 +3876,8 @@ "binop": null }, "value": "left", - "start": 439, - "end": 443, + "start": 416, + "end": 420, "loc": { "start": { "line": 16, @@ -3903,8 +3903,8 @@ "updateContext": null }, "value": "=", - "start": 444, - "end": 445, + "start": 421, + "end": 422, "loc": { "start": { "line": 16, @@ -3929,8 +3929,8 @@ "binop": null }, "value": "B", - "start": 446, - "end": 447, + "start": 423, + "end": 424, "loc": { "start": { "line": 16, @@ -3955,8 +3955,8 @@ "binop": null, "updateContext": null }, - "start": 447, - "end": 448, + "start": 424, + "end": 425, "loc": { "start": { "line": 16, @@ -3983,8 +3983,8 @@ "updateContext": null }, "value": "else", - "start": 450, - "end": 454, + "start": 427, + "end": 431, "loc": { "start": { "line": 17, @@ -4009,8 +4009,8 @@ "binop": null }, "value": "A", - "start": 455, - "end": 456, + "start": 432, + "end": 433, "loc": { "start": { "line": 17, @@ -4035,8 +4035,8 @@ "binop": null, "updateContext": null }, - "start": 456, - "end": 457, + "start": 433, + "end": 434, "loc": { "start": { "line": 17, @@ -4061,8 +4061,8 @@ "binop": null }, "value": "parent", - "start": 457, - "end": 463, + "start": 434, + "end": 440, "loc": { "start": { "line": 17, @@ -4087,8 +4087,8 @@ "binop": null, "updateContext": null }, - "start": 463, - "end": 464, + "start": 440, + "end": 441, "loc": { "start": { "line": 17, @@ -4113,8 +4113,8 @@ "binop": null }, "value": "right", - "start": 464, - "end": 469, + "start": 441, + "end": 446, "loc": { "start": { "line": 17, @@ -4140,8 +4140,8 @@ "updateContext": null }, "value": "=", - "start": 470, - "end": 471, + "start": 447, + "end": 448, "loc": { "start": { "line": 17, @@ -4166,8 +4166,8 @@ "binop": null }, "value": "B", - "start": 472, - "end": 473, + "start": 449, + "end": 450, "loc": { "start": { "line": 17, @@ -4192,8 +4192,8 @@ "binop": null, "updateContext": null }, - "start": 473, - "end": 474, + "start": 450, + "end": 451, "loc": { "start": { "line": 17, @@ -4218,8 +4218,8 @@ "binop": null }, "value": "B", - "start": 477, - "end": 478, + "start": 454, + "end": 455, "loc": { "start": { "line": 19, @@ -4244,8 +4244,8 @@ "binop": null, "updateContext": null }, - "start": 478, - "end": 479, + "start": 455, + "end": 456, "loc": { "start": { "line": 19, @@ -4270,8 +4270,8 @@ "binop": null }, "value": "parent", - "start": 479, - "end": 485, + "start": 456, + "end": 462, "loc": { "start": { "line": 19, @@ -4297,8 +4297,8 @@ "updateContext": null }, "value": "=", - "start": 486, - "end": 487, + "start": 463, + "end": 464, "loc": { "start": { "line": 19, @@ -4323,8 +4323,8 @@ "binop": null }, "value": "A", - "start": 488, - "end": 489, + "start": 465, + "end": 466, "loc": { "start": { "line": 19, @@ -4349,8 +4349,8 @@ "binop": null, "updateContext": null }, - "start": 489, - "end": 490, + "start": 466, + "end": 467, "loc": { "start": { "line": 19, @@ -4375,8 +4375,8 @@ "binop": null }, "value": "parent", - "start": 490, - "end": 496, + "start": 467, + "end": 473, "loc": { "start": { "line": 19, @@ -4401,8 +4401,8 @@ "binop": null, "updateContext": null }, - "start": 496, - "end": 497, + "start": 473, + "end": 474, "loc": { "start": { "line": 19, @@ -4426,8 +4426,8 @@ "postfix": false, "binop": null }, - "start": 498, - "end": 499, + "start": 475, + "end": 476, "loc": { "start": { "line": 20, @@ -4452,8 +4452,8 @@ "binop": null, "updateContext": null }, - "start": 499, - "end": 500, + "start": 476, + "end": 477, "loc": { "start": { "line": 20, @@ -4480,8 +4480,8 @@ "updateContext": null }, "value": "export", - "start": 502, - "end": 508, + "start": 479, + "end": 485, "loc": { "start": { "line": 22, @@ -4508,8 +4508,8 @@ "updateContext": null }, "value": "default", - "start": 509, - "end": 516, + "start": 486, + "end": 493, "loc": { "start": { "line": 22, @@ -4534,8 +4534,8 @@ "binop": null }, "value": "replace_node", - "start": 517, - "end": 529, + "start": 494, + "end": 506, "loc": { "start": { "line": 22, @@ -4560,8 +4560,8 @@ "binop": null, "updateContext": null }, - "start": 529, - "end": 530, + "start": 506, + "end": 507, "loc": { "start": { "line": 22, @@ -4586,8 +4586,8 @@ "binop": null, "updateContext": null }, - "start": 531, - "end": 531, + "start": 508, + "end": 508, "loc": { "start": { "line": 23, diff --git a/ast/source/index.js.json b/ast/source/index.js.json index 80f8312..e49bd92 100644 --- a/ast/source/index.js.json +++ b/ast/source/index.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 2013, + "end": 2385, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 33, + "line": 38, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 2013, + "end": 2385, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 33, + "line": 38, "column": 0 } }, @@ -2467,7 +2467,7 @@ { "type": "ExportNamedDeclaration", "start": 1749, - "end": 1825, + "end": 1808, "loc": { "start": { "line": 29, @@ -2475,7 +2475,7 @@ }, "end": { "line": 29, - "column": 76 + "column": 59 } }, "declaration": null, @@ -2483,7 +2483,7 @@ { "type": "ExportSpecifier", "start": 1757, - "end": 1784, + "end": 1778, "loc": { "start": { "line": 29, @@ -2491,7 +2491,7 @@ }, "end": { "line": 29, - "column": 35 + "column": 29 } }, "local": { @@ -2514,7 +2514,7 @@ "exported": { "type": "Identifier", "start": 1768, - "end": 1784, + "end": 1778, "loc": { "start": { "line": 29, @@ -2522,39 +2522,39 @@ }, "end": { "line": 29, - "column": 35 + "column": 29 }, - "identifierName": "inordertraversal" + "identifierName": "swap_color" }, - "name": "inordertraversal" + "name": "swap_color" } } ], "source": { "type": "StringLiteral", - "start": 1791, - "end": 1824, + "start": 1785, + "end": 1807, "loc": { "start": { "line": 29, - "column": 42 + "column": 36 }, "end": { "line": 29, - "column": 75 + "column": 58 } }, "extra": { - "rawValue": "./traversal/inordertraversal.js", - "raw": "'./traversal/inordertraversal.js'" + "rawValue": "./swap/swap_color.js", + "raw": "'./swap/swap_color.js'" }, - "value": "./traversal/inordertraversal.js" + "value": "./swap/swap_color.js" } }, { "type": "ExportNamedDeclaration", - "start": 1826, - "end": 1898, + "start": 1809, + "end": 1866, "loc": { "start": { "line": 30, @@ -2562,15 +2562,15 @@ }, "end": { "line": 30, - "column": 72 + "column": 57 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1834, - "end": 1859, + "start": 1817, + "end": 1837, "loc": { "start": { "line": 30, @@ -2578,13 +2578,13 @@ }, "end": { "line": 30, - "column": 33 + "column": 28 } }, "local": { "type": "Identifier", - "start": 1834, - "end": 1841, + "start": 1817, + "end": 1824, "loc": { "start": { "line": 30, @@ -2600,8 +2600,8 @@ }, "exported": { "type": "Identifier", - "start": 1845, - "end": 1859, + "start": 1828, + "end": 1837, "loc": { "start": { "line": 30, @@ -2609,39 +2609,39 @@ }, "end": { "line": 30, - "column": 33 + "column": 28 }, - "identifierName": "rangetraversal" + "identifierName": "swap_left" }, - "name": "rangetraversal" + "name": "swap_left" } } ], "source": { "type": "StringLiteral", - "start": 1866, - "end": 1897, + "start": 1844, + "end": 1865, "loc": { "start": { "line": 30, - "column": 40 + "column": 35 }, "end": { "line": 30, - "column": 71 + "column": 56 } }, "extra": { - "rawValue": "./traversal/rangetraversal.js", - "raw": "'./traversal/rangetraversal.js'" + "rawValue": "./swap/swap_left.js", + "raw": "'./swap/swap_left.js'" }, - "value": "./traversal/rangetraversal.js" + "value": "./swap/swap_left.js" } }, { "type": "ExportNamedDeclaration", - "start": 1899, - "end": 1947, + "start": 1867, + "end": 1940, "loc": { "start": { "line": 31, @@ -2649,15 +2649,15 @@ }, "end": { "line": 31, - "column": 48 + "column": 73 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1907, - "end": 1922, + "start": 1875, + "end": 1903, "loc": { "start": { "line": 31, @@ -2665,13 +2665,13 @@ }, "end": { "line": 31, - "column": 23 + "column": 36 } }, "local": { "type": "Identifier", - "start": 1907, - "end": 1914, + "start": 1875, + "end": 1882, "loc": { "start": { "line": 31, @@ -2687,8 +2687,8 @@ }, "exported": { "type": "Identifier", - "start": 1918, - "end": 1922, + "start": 1886, + "end": 1903, "loc": { "start": { "line": 31, @@ -2696,39 +2696,39 @@ }, "end": { "line": 31, - "column": 23 + "column": 36 }, - "identifierName": "Node" + "identifierName": "swap_non_adjacent" }, - "name": "Node" + "name": "swap_non_adjacent" } } ], "source": { "type": "StringLiteral", - "start": 1929, - "end": 1946, + "start": 1910, + "end": 1939, "loc": { "start": { "line": 31, - "column": 30 + "column": 43 }, "end": { "line": 31, - "column": 47 + "column": 72 } }, "extra": { - "rawValue": "./types/Node.js", - "raw": "'./types/Node.js'" + "rawValue": "./swap/swap_non_adjacent.js", + "raw": "'./swap/swap_non_adjacent.js'" }, - "value": "./types/Node.js" + "value": "./swap/swap_non_adjacent.js" } }, { "type": "ExportNamedDeclaration", - "start": 1948, - "end": 2012, + "start": 1941, + "end": 2017, "loc": { "start": { "line": 32, @@ -2736,15 +2736,15 @@ }, "end": { "line": 32, - "column": 64 + "column": 76 } }, "declaration": null, "specifiers": [ { "type": "ExportSpecifier", - "start": 1956, - "end": 1979, + "start": 1949, + "end": 1976, "loc": { "start": { "line": 32, @@ -2752,13 +2752,13 @@ }, "end": { "line": 32, - "column": 31 + "column": 35 } }, "local": { "type": "Identifier", - "start": 1956, - "end": 1963, + "start": 1949, + "end": 1956, "loc": { "start": { "line": 32, @@ -2774,8 +2774,8 @@ }, "exported": { "type": "Identifier", - "start": 1967, - "end": 1979, + "start": 1960, + "end": 1976, "loc": { "start": { "line": 32, @@ -2783,120 +2783,1740 @@ }, "end": { "line": 32, - "column": 31 + "column": 35 }, - "identifierName": "RedBlackTree" + "identifierName": "inordertraversal" }, - "name": "RedBlackTree" + "name": "inordertraversal" } } ], "source": { "type": "StringLiteral", - "start": 1986, - "end": 2011, + "start": 1983, + "end": 2016, "loc": { "start": { "line": 32, - "column": 38 + "column": 42 }, "end": { "line": 32, - "column": 63 + "column": 75 } }, "extra": { - "rawValue": "./types/RedBlackTree.js", - "raw": "'./types/RedBlackTree.js'" + "rawValue": "./traversal/inordertraversal.js", + "raw": "'./traversal/inordertraversal.js'" }, - "value": "./types/RedBlackTree.js" + "value": "./traversal/inordertraversal.js" } - } - ], - "directives": [] - }, - "comments": [], - "tokens": [ - { - "type": { - "label": "export", - "keyword": "export", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null }, - "value": "export", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 + { + "type": "ExportNamedDeclaration", + "start": 2018, + "end": 2106, + "loc": { + "start": { + "line": 33, + "column": 0 + }, + "end": { + "line": 33, + "column": 88 + } }, - "end": { - "line": 1, - "column": 6 + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 2026, + "end": 2059, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 41 + } + }, + "local": { + "type": "Identifier", + "start": 2026, + "end": 2033, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 2037, + "end": 2059, + "loc": { + "start": { + "line": 33, + "column": 19 + }, + "end": { + "line": 33, + "column": 41 + }, + "identifierName": "leftOpenRangeTraversal" + }, + "name": "leftOpenRangeTraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 2066, + "end": 2105, + "loc": { + "start": { + "line": 33, + "column": 48 + }, + "end": { + "line": 33, + "column": 87 + } + }, + "extra": { + "rawValue": "./traversal/leftOpenRangeTraversal.js", + "raw": "'./traversal/leftOpenRangeTraversal.js'" + }, + "value": "./traversal/leftOpenRangeTraversal.js" } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null }, - "start": 7, - "end": 8, - "loc": { - "start": { - "line": 1, - "column": 7 + { + "type": "ExportNamedDeclaration", + "start": 2107, + "end": 2179, + "loc": { + "start": { + "line": 34, + "column": 0 + }, + "end": { + "line": 34, + "column": 72 + } }, - "end": { - "line": 1, - "column": 8 + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 2115, + "end": 2140, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 33 + } + }, + "local": { + "type": "Identifier", + "start": 2115, + "end": 2122, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 2126, + "end": 2140, + "loc": { + "start": { + "line": 34, + "column": 19 + }, + "end": { + "line": 34, + "column": 33 + }, + "identifierName": "rangetraversal" + }, + "name": "rangetraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 2147, + "end": 2178, + "loc": { + "start": { + "line": 34, + "column": 40 + }, + "end": { + "line": 34, + "column": 71 + } + }, + "extra": { + "rawValue": "./traversal/rangetraversal.js", + "raw": "'./traversal/rangetraversal.js'" + }, + "value": "./traversal/rangetraversal.js" } - } - }, - { - "type": { - "label": "default", - "keyword": "default", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null }, - "value": "default", - "start": 8, - "end": 15, - "loc": { - "start": { - "line": 1, - "column": 8 + { + "type": "ExportNamedDeclaration", + "start": 2180, + "end": 2270, + "loc": { + "start": { + "line": 35, + "column": 0 + }, + "end": { + "line": 35, + "column": 90 + } }, - "end": { - "line": 1, - "column": 15 - } - } + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 2188, + "end": 2222, + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 42 + } + }, + "local": { + "type": "Identifier", + "start": 2188, + "end": 2195, + "loc": { + "start": { + "line": 35, + "column": 8 + }, + "end": { + "line": 35, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 2199, + "end": 2222, + "loc": { + "start": { + "line": 35, + "column": 19 + }, + "end": { + "line": 35, + "column": 42 + }, + "identifierName": "rightOpenRangeTraversal" + }, + "name": "rightOpenRangeTraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 2229, + "end": 2269, + "loc": { + "start": { + "line": 35, + "column": 49 + }, + "end": { + "line": 35, + "column": 89 + } + }, + "extra": { + "rawValue": "./traversal/rightOpenRangeTraversal.js", + "raw": "'./traversal/rightOpenRangeTraversal.js'" + }, + "value": "./traversal/rightOpenRangeTraversal.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 2271, + "end": 2319, + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 48 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 2279, + "end": 2294, + "loc": { + "start": { + "line": 36, + "column": 8 + }, + "end": { + "line": 36, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 2279, + "end": 2286, + "loc": { + "start": { + "line": 36, + "column": 8 + }, + "end": { + "line": 36, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 2290, + "end": 2294, + "loc": { + "start": { + "line": 36, + "column": 19 + }, + "end": { + "line": 36, + "column": 23 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 2301, + "end": 2318, + "loc": { + "start": { + "line": 36, + "column": 30 + }, + "end": { + "line": 36, + "column": 47 + } + }, + "extra": { + "rawValue": "./types/Node.js", + "raw": "'./types/Node.js'" + }, + "value": "./types/Node.js" + } + }, + { + "type": "ExportNamedDeclaration", + "start": 2320, + "end": 2384, + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 64 + } + }, + "declaration": null, + "specifiers": [ + { + "type": "ExportSpecifier", + "start": 2328, + "end": 2351, + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 31 + } + }, + "local": { + "type": "Identifier", + "start": 2328, + "end": 2335, + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 15 + }, + "identifierName": "default" + }, + "name": "default" + }, + "exported": { + "type": "Identifier", + "start": 2339, + "end": 2351, + "loc": { + "start": { + "line": 37, + "column": 19 + }, + "end": { + "line": 37, + "column": 31 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 2358, + "end": 2383, + "loc": { + "start": { + "line": 37, + "column": 38 + }, + "end": { + "line": 37, + "column": 63 + } + }, + "extra": { + "rawValue": "./types/RedBlackTree.js", + "raw": "'./types/RedBlackTree.js'" + }, + "value": "./types/RedBlackTree.js" + } + } + ], + "directives": [] + }, + "comments": [], + "tokens": [ + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 7, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 8, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 16, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 16 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "empty", + "start": 19, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 24 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 24, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 24 + }, + "end": { + "line": 1, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 26, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 26 + }, + "end": { + "line": 1, + "column": 30 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./api/empty.js", + "start": 31, + "end": 47, + "loc": { + "start": { + "line": 1, + "column": 31 + }, + "end": { + "line": 1, + "column": 47 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 47, + "end": 48, + "loc": { + "start": { + "line": 1, + "column": 47 + }, + "end": { + "line": 1, + "column": 48 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 49, + "end": 55, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 56, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 57, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 65, + "end": 67, + "loc": { + "start": { + "line": 2, + "column": 16 + }, + "end": { + "line": 2, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 68, + "end": 72, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 23 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 72, + "end": 73, + "loc": { + "start": { + "line": 2, + "column": 23 + }, + "end": { + "line": 2, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 74, + "end": 78, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./api/from.js", + "start": 79, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 30 + }, + "end": { + "line": 2, + "column": 45 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 94, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 45 + }, + "end": { + "line": 2, + "column": 46 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 96, + "end": 102, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 103, + "end": 104, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 104, + "end": 111, + "loc": { + "start": { + "line": 3, + "column": 8 + }, + "end": { + "line": 3, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 112, + "end": 114, + "loc": { + "start": { + "line": 3, + "column": 16 + }, + "end": { + "line": 3, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 115, + "end": 120, + "loc": { + "start": { + "line": 3, + "column": 19 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 120, + "end": 121, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 122, + "end": 126, + "loc": { + "start": { + "line": 3, + "column": 26 + }, + "end": { + "line": 3, + "column": 30 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./color/BLACK.js", + "start": 127, + "end": 145, + "loc": { + "start": { + "line": 3, + "column": 31 + }, + "end": { + "line": 3, + "column": 49 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 145, + "end": 146, + "loc": { + "start": { + "line": 3, + "column": 49 + }, + "end": { + "line": 3, + "column": 50 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 147, + "end": 153, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 154, + "end": 155, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 155, + "end": 162, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 163, + "end": 165, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 166, + "end": 169, + "loc": { + "start": { + "line": 4, + "column": 19 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 169, + "end": 170, + "loc": { + "start": { + "line": 4, + "column": 22 + }, + "end": { + "line": 4, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 171, + "end": 175, + "loc": { + "start": { + "line": 4, + "column": 24 + }, + "end": { + "line": 4, + "column": 28 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./color/RED.js", + "start": 176, + "end": 192, + "loc": { + "start": { + "line": 4, + "column": 29 + }, + "end": { + "line": 4, + "column": 45 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 192, + "end": 193, + "loc": { + "start": { + "line": 4, + "column": 45 + }, + "end": { + "line": 4, + "column": 46 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 194, + "end": 200, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 201, + "end": 202, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 202, + "end": 209, + "loc": { + "start": { + "line": 5, + "column": 8 + }, + "end": { + "line": 5, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "as", + "start": 210, + "end": 212, + "loc": { + "start": { + "line": 5, + "column": 16 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_debug", + "start": 213, + "end": 219, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 25 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 219, + "end": 220, + "loc": { + "start": { + "line": 5, + "column": 25 + }, + "end": { + "line": 5, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 221, + "end": 225, + "loc": { + "start": { + "line": 5, + "column": 27 + }, + "end": { + "line": 5, + "column": 31 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./debug/_debug.js", + "start": 226, + "end": 245, + "loc": { + "start": { + "line": 5, + "column": 32 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 245, + "end": 246, + "loc": { + "start": { + "line": 5, + "column": 51 + }, + "end": { + "line": 5, + "column": 52 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 247, + "end": 253, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 254, + "end": 255, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 8 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 255, + "end": 262, + "loc": { + "start": { + "line": 6, + "column": 8 + }, + "end": { + "line": 6, + "column": 15 + } + } }, { "type": { @@ -2911,15 +4531,15 @@ "binop": null }, "value": "as", - "start": 16, - "end": 18, + "start": 263, + "end": 265, "loc": { "start": { - "line": 1, + "line": 6, "column": 16 }, "end": { - "line": 1, + "line": 6, "column": 18 } } @@ -2936,17 +4556,17 @@ "postfix": false, "binop": null }, - "value": "empty", - "start": 19, - "end": 24, + "value": "delete_case0", + "start": 266, + "end": 278, "loc": { "start": { - "line": 1, + "line": 6, "column": 19 }, "end": { - "line": 1, - "column": 24 + "line": 6, + "column": 31 } } }, @@ -2962,16 +4582,16 @@ "postfix": false, "binop": null }, - "start": 24, - "end": 25, + "start": 278, + "end": 279, "loc": { "start": { - "line": 1, - "column": 24 + "line": 6, + "column": 31 }, "end": { - "line": 1, - "column": 25 + "line": 6, + "column": 32 } } }, @@ -2988,16 +4608,16 @@ "binop": null }, "value": "from", - "start": 26, - "end": 30, + "start": 280, + "end": 284, "loc": { "start": { - "line": 1, - "column": 26 + "line": 6, + "column": 33 }, "end": { - "line": 1, - "column": 30 + "line": 6, + "column": 37 } } }, @@ -3014,17 +4634,17 @@ "binop": null, "updateContext": null }, - "value": "./api/empty.js", - "start": 31, - "end": 47, + "value": "./deletion/delete_case0.js", + "start": 285, + "end": 313, "loc": { "start": { - "line": 1, - "column": 31 + "line": 6, + "column": 38 }, "end": { - "line": 1, - "column": 47 + "line": 6, + "column": 66 } } }, @@ -3041,16 +4661,16 @@ "binop": null, "updateContext": null }, - "start": 47, - "end": 48, + "start": 313, + "end": 314, "loc": { "start": { - "line": 1, - "column": 47 + "line": 6, + "column": 66 }, "end": { - "line": 1, - "column": 48 + "line": 6, + "column": 67 } } }, @@ -3069,15 +4689,15 @@ "updateContext": null }, "value": "export", - "start": 49, - "end": 55, + "start": 315, + "end": 321, "loc": { "start": { - "line": 2, + "line": 7, "column": 0 }, "end": { - "line": 2, + "line": 7, "column": 6 } } @@ -3094,15 +4714,15 @@ "postfix": false, "binop": null }, - "start": 56, - "end": 57, + "start": 322, + "end": 323, "loc": { "start": { - "line": 2, + "line": 7, "column": 7 }, "end": { - "line": 2, + "line": 7, "column": 8 } } @@ -3122,15 +4742,15 @@ "updateContext": null }, "value": "default", - "start": 57, - "end": 64, + "start": 323, + "end": 330, "loc": { "start": { - "line": 2, + "line": 7, "column": 8 }, "end": { - "line": 2, + "line": 7, "column": 15 } } @@ -3148,15 +4768,15 @@ "binop": null }, "value": "as", - "start": 65, - "end": 67, + "start": 331, + "end": 333, "loc": { "start": { - "line": 2, + "line": 7, "column": 16 }, "end": { - "line": 2, + "line": 7, "column": 18 } } @@ -3173,17 +4793,17 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 68, - "end": 72, + "value": "delete_case1", + "start": 334, + "end": 346, "loc": { "start": { - "line": 2, + "line": 7, "column": 19 }, "end": { - "line": 2, - "column": 23 + "line": 7, + "column": 31 } } }, @@ -3199,16 +4819,16 @@ "postfix": false, "binop": null }, - "start": 72, - "end": 73, + "start": 346, + "end": 347, "loc": { "start": { - "line": 2, - "column": 23 + "line": 7, + "column": 31 }, "end": { - "line": 2, - "column": 24 + "line": 7, + "column": 32 } } }, @@ -3225,16 +4845,16 @@ "binop": null }, "value": "from", - "start": 74, - "end": 78, + "start": 348, + "end": 352, "loc": { "start": { - "line": 2, - "column": 25 + "line": 7, + "column": 33 }, "end": { - "line": 2, - "column": 29 + "line": 7, + "column": 37 } } }, @@ -3251,17 +4871,17 @@ "binop": null, "updateContext": null }, - "value": "./api/from.js", - "start": 79, - "end": 94, + "value": "./deletion/delete_case1.js", + "start": 353, + "end": 381, "loc": { "start": { - "line": 2, - "column": 30 + "line": 7, + "column": 38 }, "end": { - "line": 2, - "column": 45 + "line": 7, + "column": 66 } } }, @@ -3278,16 +4898,16 @@ "binop": null, "updateContext": null }, - "start": 94, - "end": 95, + "start": 381, + "end": 382, "loc": { "start": { - "line": 2, - "column": 45 + "line": 7, + "column": 66 }, "end": { - "line": 2, - "column": 46 + "line": 7, + "column": 67 } } }, @@ -3306,15 +4926,15 @@ "updateContext": null }, "value": "export", - "start": 96, - "end": 102, + "start": 383, + "end": 389, "loc": { "start": { - "line": 3, + "line": 8, "column": 0 }, "end": { - "line": 3, + "line": 8, "column": 6 } } @@ -3331,15 +4951,15 @@ "postfix": false, "binop": null }, - "start": 103, - "end": 104, + "start": 390, + "end": 391, "loc": { "start": { - "line": 3, + "line": 8, "column": 7 }, "end": { - "line": 3, + "line": 8, "column": 8 } } @@ -3359,15 +4979,15 @@ "updateContext": null }, "value": "default", - "start": 104, - "end": 111, + "start": 391, + "end": 398, "loc": { "start": { - "line": 3, + "line": 8, "column": 8 }, "end": { - "line": 3, + "line": 8, "column": 15 } } @@ -3385,15 +5005,15 @@ "binop": null }, "value": "as", - "start": 112, - "end": 114, + "start": 399, + "end": 401, "loc": { "start": { - "line": 3, + "line": 8, "column": 16 }, "end": { - "line": 3, + "line": 8, "column": 18 } } @@ -3410,17 +5030,17 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 115, - "end": 120, + "value": "delete_case2", + "start": 402, + "end": 414, "loc": { "start": { - "line": 3, + "line": 8, "column": 19 }, "end": { - "line": 3, - "column": 24 + "line": 8, + "column": 31 } } }, @@ -3436,16 +5056,16 @@ "postfix": false, "binop": null }, - "start": 120, - "end": 121, + "start": 414, + "end": 415, "loc": { "start": { - "line": 3, - "column": 24 + "line": 8, + "column": 31 }, "end": { - "line": 3, - "column": 25 + "line": 8, + "column": 32 } } }, @@ -3462,16 +5082,16 @@ "binop": null }, "value": "from", - "start": 122, - "end": 126, + "start": 416, + "end": 420, "loc": { "start": { - "line": 3, - "column": 26 + "line": 8, + "column": 33 }, "end": { - "line": 3, - "column": 30 + "line": 8, + "column": 37 } } }, @@ -3488,17 +5108,17 @@ "binop": null, "updateContext": null }, - "value": "./color/BLACK.js", - "start": 127, - "end": 145, + "value": "./deletion/delete_case2.js", + "start": 421, + "end": 449, "loc": { "start": { - "line": 3, - "column": 31 + "line": 8, + "column": 38 }, "end": { - "line": 3, - "column": 49 + "line": 8, + "column": 66 } } }, @@ -3515,16 +5135,16 @@ "binop": null, "updateContext": null }, - "start": 145, - "end": 146, + "start": 449, + "end": 450, "loc": { "start": { - "line": 3, - "column": 49 + "line": 8, + "column": 66 }, "end": { - "line": 3, - "column": 50 + "line": 8, + "column": 67 } } }, @@ -3543,15 +5163,15 @@ "updateContext": null }, "value": "export", - "start": 147, - "end": 153, + "start": 451, + "end": 457, "loc": { "start": { - "line": 4, + "line": 9, "column": 0 }, "end": { - "line": 4, + "line": 9, "column": 6 } } @@ -3568,15 +5188,15 @@ "postfix": false, "binop": null }, - "start": 154, - "end": 155, + "start": 458, + "end": 459, "loc": { "start": { - "line": 4, + "line": 9, "column": 7 }, "end": { - "line": 4, + "line": 9, "column": 8 } } @@ -3596,15 +5216,15 @@ "updateContext": null }, "value": "default", - "start": 155, - "end": 162, + "start": 459, + "end": 466, "loc": { "start": { - "line": 4, + "line": 9, "column": 8 }, "end": { - "line": 4, + "line": 9, "column": 15 } } @@ -3622,15 +5242,15 @@ "binop": null }, "value": "as", - "start": 163, - "end": 165, + "start": 467, + "end": 469, "loc": { "start": { - "line": 4, + "line": 9, "column": 16 }, "end": { - "line": 4, + "line": 9, "column": 18 } } @@ -3647,17 +5267,17 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 166, - "end": 169, + "value": "delete_case3", + "start": 470, + "end": 482, "loc": { "start": { - "line": 4, + "line": 9, "column": 19 }, "end": { - "line": 4, - "column": 22 + "line": 9, + "column": 31 } } }, @@ -3673,16 +5293,16 @@ "postfix": false, "binop": null }, - "start": 169, - "end": 170, + "start": 482, + "end": 483, "loc": { "start": { - "line": 4, - "column": 22 + "line": 9, + "column": 31 }, "end": { - "line": 4, - "column": 23 + "line": 9, + "column": 32 } } }, @@ -3699,16 +5319,16 @@ "binop": null }, "value": "from", - "start": 171, - "end": 175, + "start": 484, + "end": 488, "loc": { "start": { - "line": 4, - "column": 24 + "line": 9, + "column": 33 }, "end": { - "line": 4, - "column": 28 + "line": 9, + "column": 37 } } }, @@ -3725,17 +5345,17 @@ "binop": null, "updateContext": null }, - "value": "./color/RED.js", - "start": 176, - "end": 192, + "value": "./deletion/delete_case3.js", + "start": 489, + "end": 517, "loc": { "start": { - "line": 4, - "column": 29 + "line": 9, + "column": 38 }, "end": { - "line": 4, - "column": 45 + "line": 9, + "column": 66 } } }, @@ -3752,16 +5372,16 @@ "binop": null, "updateContext": null }, - "start": 192, - "end": 193, + "start": 517, + "end": 518, "loc": { "start": { - "line": 4, - "column": 45 + "line": 9, + "column": 66 }, "end": { - "line": 4, - "column": 46 + "line": 9, + "column": 67 } } }, @@ -3780,15 +5400,15 @@ "updateContext": null }, "value": "export", - "start": 194, - "end": 200, + "start": 519, + "end": 525, "loc": { "start": { - "line": 5, + "line": 10, "column": 0 }, "end": { - "line": 5, + "line": 10, "column": 6 } } @@ -3805,15 +5425,15 @@ "postfix": false, "binop": null }, - "start": 201, - "end": 202, + "start": 526, + "end": 527, "loc": { "start": { - "line": 5, + "line": 10, "column": 7 }, "end": { - "line": 5, + "line": 10, "column": 8 } } @@ -3833,15 +5453,15 @@ "updateContext": null }, "value": "default", - "start": 202, - "end": 209, + "start": 527, + "end": 534, "loc": { "start": { - "line": 5, + "line": 10, "column": 8 }, "end": { - "line": 5, + "line": 10, "column": 15 } } @@ -3859,15 +5479,15 @@ "binop": null }, "value": "as", - "start": 210, - "end": 212, + "start": 535, + "end": 537, "loc": { "start": { - "line": 5, + "line": 10, "column": 16 }, "end": { - "line": 5, + "line": 10, "column": 18 } } @@ -3884,17 +5504,17 @@ "postfix": false, "binop": null }, - "value": "_debug", - "start": 213, - "end": 219, + "value": "delete_case4", + "start": 538, + "end": 550, "loc": { "start": { - "line": 5, + "line": 10, "column": 19 }, "end": { - "line": 5, - "column": 25 + "line": 10, + "column": 31 } } }, @@ -3910,16 +5530,16 @@ "postfix": false, "binop": null }, - "start": 219, - "end": 220, + "start": 550, + "end": 551, "loc": { "start": { - "line": 5, - "column": 25 + "line": 10, + "column": 31 }, "end": { - "line": 5, - "column": 26 + "line": 10, + "column": 32 } } }, @@ -3936,16 +5556,16 @@ "binop": null }, "value": "from", - "start": 221, - "end": 225, + "start": 552, + "end": 556, "loc": { "start": { - "line": 5, - "column": 27 + "line": 10, + "column": 33 }, "end": { - "line": 5, - "column": 31 + "line": 10, + "column": 37 } } }, @@ -3962,17 +5582,17 @@ "binop": null, "updateContext": null }, - "value": "./debug/_debug.js", - "start": 226, - "end": 245, + "value": "./deletion/delete_case4.js", + "start": 557, + "end": 585, "loc": { "start": { - "line": 5, - "column": 32 + "line": 10, + "column": 38 }, "end": { - "line": 5, - "column": 51 + "line": 10, + "column": 66 } } }, @@ -3989,16 +5609,16 @@ "binop": null, "updateContext": null }, - "start": 245, - "end": 246, + "start": 585, + "end": 586, "loc": { "start": { - "line": 5, - "column": 51 + "line": 10, + "column": 66 }, "end": { - "line": 5, - "column": 52 + "line": 10, + "column": 67 } } }, @@ -4017,15 +5637,15 @@ "updateContext": null }, "value": "export", - "start": 247, - "end": 253, + "start": 587, + "end": 593, "loc": { "start": { - "line": 6, + "line": 11, "column": 0 }, "end": { - "line": 6, + "line": 11, "column": 6 } } @@ -4042,15 +5662,15 @@ "postfix": false, "binop": null }, - "start": 254, - "end": 255, + "start": 594, + "end": 595, "loc": { "start": { - "line": 6, + "line": 11, "column": 7 }, "end": { - "line": 6, + "line": 11, "column": 8 } } @@ -4070,15 +5690,15 @@ "updateContext": null }, "value": "default", - "start": 255, - "end": 262, + "start": 595, + "end": 602, "loc": { "start": { - "line": 6, + "line": 11, "column": 8 }, "end": { - "line": 6, + "line": 11, "column": 15 } } @@ -4096,15 +5716,15 @@ "binop": null }, "value": "as", - "start": 263, - "end": 265, + "start": 603, + "end": 605, "loc": { "start": { - "line": 6, + "line": 11, "column": 16 }, "end": { - "line": 6, + "line": 11, "column": 18 } } @@ -4121,16 +5741,16 @@ "postfix": false, "binop": null }, - "value": "delete_case0", - "start": 266, - "end": 278, + "value": "delete_case5", + "start": 606, + "end": 618, "loc": { "start": { - "line": 6, + "line": 11, "column": 19 }, "end": { - "line": 6, + "line": 11, "column": 31 } } @@ -4147,15 +5767,15 @@ "postfix": false, "binop": null }, - "start": 278, - "end": 279, + "start": 618, + "end": 619, "loc": { "start": { - "line": 6, + "line": 11, "column": 31 }, "end": { - "line": 6, + "line": 11, "column": 32 } } @@ -4173,15 +5793,15 @@ "binop": null }, "value": "from", - "start": 280, - "end": 284, + "start": 620, + "end": 624, "loc": { "start": { - "line": 6, + "line": 11, "column": 33 }, "end": { - "line": 6, + "line": 11, "column": 37 } } @@ -4199,16 +5819,16 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case0.js", - "start": 285, - "end": 313, + "value": "./deletion/delete_case5.js", + "start": 625, + "end": 653, "loc": { "start": { - "line": 6, + "line": 11, "column": 38 }, "end": { - "line": 6, + "line": 11, "column": 66 } } @@ -4226,15 +5846,15 @@ "binop": null, "updateContext": null }, - "start": 313, - "end": 314, + "start": 653, + "end": 654, "loc": { "start": { - "line": 6, + "line": 11, "column": 66 }, "end": { - "line": 6, + "line": 11, "column": 67 } } @@ -4254,15 +5874,15 @@ "updateContext": null }, "value": "export", - "start": 315, - "end": 321, + "start": 655, + "end": 661, "loc": { "start": { - "line": 7, + "line": 12, "column": 0 }, "end": { - "line": 7, + "line": 12, "column": 6 } } @@ -4279,15 +5899,15 @@ "postfix": false, "binop": null }, - "start": 322, - "end": 323, + "start": 662, + "end": 663, "loc": { "start": { - "line": 7, + "line": 12, "column": 7 }, "end": { - "line": 7, + "line": 12, "column": 8 } } @@ -4307,15 +5927,15 @@ "updateContext": null }, "value": "default", - "start": 323, - "end": 330, + "start": 663, + "end": 670, "loc": { "start": { - "line": 7, + "line": 12, "column": 8 }, "end": { - "line": 7, + "line": 12, "column": 15 } } @@ -4333,15 +5953,15 @@ "binop": null }, "value": "as", - "start": 331, - "end": 333, + "start": 671, + "end": 673, "loc": { "start": { - "line": 7, + "line": 12, "column": 16 }, "end": { - "line": 7, + "line": 12, "column": 18 } } @@ -4358,17 +5978,17 @@ "postfix": false, "binop": null }, - "value": "delete_case1", - "start": 334, - "end": 346, + "value": "delete_no_child", + "start": 674, + "end": 689, "loc": { "start": { - "line": 7, + "line": 12, "column": 19 }, "end": { - "line": 7, - "column": 31 + "line": 12, + "column": 34 } } }, @@ -4384,16 +6004,16 @@ "postfix": false, "binop": null }, - "start": 346, - "end": 347, + "start": 689, + "end": 690, "loc": { "start": { - "line": 7, - "column": 31 + "line": 12, + "column": 34 }, "end": { - "line": 7, - "column": 32 + "line": 12, + "column": 35 } } }, @@ -4410,16 +6030,16 @@ "binop": null }, "value": "from", - "start": 348, - "end": 352, + "start": 691, + "end": 695, "loc": { "start": { - "line": 7, - "column": 33 + "line": 12, + "column": 36 }, "end": { - "line": 7, - "column": 37 + "line": 12, + "column": 40 } } }, @@ -4436,17 +6056,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case1.js", - "start": 353, - "end": 381, + "value": "./deletion/delete_no_child.js", + "start": 696, + "end": 727, "loc": { "start": { - "line": 7, - "column": 38 + "line": 12, + "column": 41 }, "end": { - "line": 7, - "column": 66 + "line": 12, + "column": 72 } } }, @@ -4463,16 +6083,16 @@ "binop": null, "updateContext": null }, - "start": 381, - "end": 382, + "start": 727, + "end": 728, "loc": { "start": { - "line": 7, - "column": 66 + "line": 12, + "column": 72 }, "end": { - "line": 7, - "column": 67 + "line": 12, + "column": 73 } } }, @@ -4491,15 +6111,15 @@ "updateContext": null }, "value": "export", - "start": 383, - "end": 389, + "start": 729, + "end": 735, "loc": { "start": { - "line": 8, + "line": 13, "column": 0 }, "end": { - "line": 8, + "line": 13, "column": 6 } } @@ -4516,15 +6136,15 @@ "postfix": false, "binop": null }, - "start": 390, - "end": 391, + "start": 736, + "end": 737, "loc": { "start": { - "line": 8, + "line": 13, "column": 7 }, "end": { - "line": 8, + "line": 13, "column": 8 } } @@ -4544,15 +6164,15 @@ "updateContext": null }, "value": "default", - "start": 391, - "end": 398, + "start": 737, + "end": 744, "loc": { "start": { - "line": 8, + "line": 13, "column": 8 }, "end": { - "line": 8, + "line": 13, "column": 15 } } @@ -4570,15 +6190,15 @@ "binop": null }, "value": "as", - "start": 399, - "end": 401, + "start": 745, + "end": 747, "loc": { "start": { - "line": 8, + "line": 13, "column": 16 }, "end": { - "line": 8, + "line": 13, "column": 18 } } @@ -4595,17 +6215,17 @@ "postfix": false, "binop": null }, - "value": "delete_case2", - "start": 402, - "end": 414, + "value": "delete_one_child", + "start": 748, + "end": 764, "loc": { "start": { - "line": 8, + "line": 13, "column": 19 }, "end": { - "line": 8, - "column": 31 + "line": 13, + "column": 35 } } }, @@ -4621,16 +6241,16 @@ "postfix": false, "binop": null }, - "start": 414, - "end": 415, + "start": 764, + "end": 765, "loc": { "start": { - "line": 8, - "column": 31 + "line": 13, + "column": 35 }, "end": { - "line": 8, - "column": 32 + "line": 13, + "column": 36 } } }, @@ -4647,16 +6267,16 @@ "binop": null }, "value": "from", - "start": 416, - "end": 420, + "start": 766, + "end": 770, "loc": { "start": { - "line": 8, - "column": 33 + "line": 13, + "column": 37 }, "end": { - "line": 8, - "column": 37 + "line": 13, + "column": 41 } } }, @@ -4673,17 +6293,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case2.js", - "start": 421, - "end": 449, + "value": "./deletion/delete_one_child.js", + "start": 771, + "end": 803, "loc": { "start": { - "line": 8, - "column": 38 + "line": 13, + "column": 42 }, "end": { - "line": 8, - "column": 66 + "line": 13, + "column": 74 } } }, @@ -4700,16 +6320,16 @@ "binop": null, "updateContext": null }, - "start": 449, - "end": 450, + "start": 803, + "end": 804, "loc": { "start": { - "line": 8, - "column": 66 + "line": 13, + "column": 74 }, "end": { - "line": 8, - "column": 67 + "line": 13, + "column": 75 } } }, @@ -4728,15 +6348,15 @@ "updateContext": null }, "value": "export", - "start": 451, - "end": 457, + "start": 805, + "end": 811, "loc": { "start": { - "line": 9, + "line": 14, "column": 0 }, "end": { - "line": 9, + "line": 14, "column": 6 } } @@ -4753,15 +6373,15 @@ "postfix": false, "binop": null }, - "start": 458, - "end": 459, + "start": 812, + "end": 813, "loc": { "start": { - "line": 9, + "line": 14, "column": 7 }, "end": { - "line": 9, + "line": 14, "column": 8 } } @@ -4781,15 +6401,15 @@ "updateContext": null }, "value": "default", - "start": 459, - "end": 466, + "start": 813, + "end": 820, "loc": { "start": { - "line": 9, + "line": 14, "column": 8 }, "end": { - "line": 9, + "line": 14, "column": 15 } } @@ -4807,15 +6427,15 @@ "binop": null }, "value": "as", - "start": 467, - "end": 469, + "start": 821, + "end": 823, "loc": { "start": { - "line": 9, + "line": 14, "column": 16 }, "end": { - "line": 9, + "line": 14, "column": 18 } } @@ -4832,17 +6452,17 @@ "postfix": false, "binop": null }, - "value": "delete_case3", - "start": 470, - "end": 482, + "value": "prune", + "start": 824, + "end": 829, "loc": { "start": { - "line": 9, + "line": 14, "column": 19 }, "end": { - "line": 9, - "column": 31 + "line": 14, + "column": 24 } } }, @@ -4858,16 +6478,16 @@ "postfix": false, "binop": null }, - "start": 482, - "end": 483, + "start": 829, + "end": 830, "loc": { "start": { - "line": 9, - "column": 31 + "line": 14, + "column": 24 }, "end": { - "line": 9, - "column": 32 + "line": 14, + "column": 25 } } }, @@ -4884,16 +6504,16 @@ "binop": null }, "value": "from", - "start": 484, - "end": 488, + "start": 831, + "end": 835, "loc": { "start": { - "line": 9, - "column": 33 + "line": 14, + "column": 26 }, "end": { - "line": 9, - "column": 37 + "line": 14, + "column": 30 } } }, @@ -4910,17 +6530,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case3.js", - "start": 489, - "end": 517, + "value": "./deletion/prune.js", + "start": 836, + "end": 857, "loc": { "start": { - "line": 9, - "column": 38 + "line": 14, + "column": 31 }, "end": { - "line": 9, - "column": 66 + "line": 14, + "column": 52 } } }, @@ -4937,16 +6557,16 @@ "binop": null, "updateContext": null }, - "start": 517, - "end": 518, + "start": 857, + "end": 858, "loc": { "start": { - "line": 9, - "column": 66 + "line": 14, + "column": 52 }, "end": { - "line": 9, - "column": 67 + "line": 14, + "column": 53 } } }, @@ -4965,15 +6585,15 @@ "updateContext": null }, "value": "export", - "start": 519, - "end": 525, + "start": 859, + "end": 865, "loc": { "start": { - "line": 10, + "line": 15, "column": 0 }, "end": { - "line": 10, + "line": 15, "column": 6 } } @@ -4990,15 +6610,15 @@ "postfix": false, "binop": null }, - "start": 526, - "end": 527, + "start": 866, + "end": 867, "loc": { "start": { - "line": 10, + "line": 15, "column": 7 }, "end": { - "line": 10, + "line": 15, "column": 8 } } @@ -5018,15 +6638,15 @@ "updateContext": null }, "value": "default", - "start": 527, - "end": 534, + "start": 867, + "end": 874, "loc": { "start": { - "line": 10, + "line": 15, "column": 8 }, "end": { - "line": 10, + "line": 15, "column": 15 } } @@ -5044,15 +6664,15 @@ "binop": null }, "value": "as", - "start": 535, - "end": 537, + "start": 875, + "end": 877, "loc": { "start": { - "line": 10, + "line": 15, "column": 16 }, "end": { - "line": 10, + "line": 15, "column": 18 } } @@ -5069,16 +6689,16 @@ "postfix": false, "binop": null }, - "value": "delete_case4", - "start": 538, - "end": 550, + "value": "replace_node", + "start": 878, + "end": 890, "loc": { "start": { - "line": 10, + "line": 15, "column": 19 }, "end": { - "line": 10, + "line": 15, "column": 31 } } @@ -5095,15 +6715,15 @@ "postfix": false, "binop": null }, - "start": 550, - "end": 551, + "start": 890, + "end": 891, "loc": { "start": { - "line": 10, + "line": 15, "column": 31 }, "end": { - "line": 10, + "line": 15, "column": 32 } } @@ -5121,15 +6741,15 @@ "binop": null }, "value": "from", - "start": 552, - "end": 556, + "start": 892, + "end": 896, "loc": { "start": { - "line": 10, + "line": 15, "column": 33 }, "end": { - "line": 10, + "line": 15, "column": 37 } } @@ -5147,16 +6767,16 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case4.js", - "start": 557, - "end": 585, + "value": "./deletion/replace_node.js", + "start": 897, + "end": 925, "loc": { "start": { - "line": 10, + "line": 15, "column": 38 }, "end": { - "line": 10, + "line": 15, "column": 66 } } @@ -5174,15 +6794,15 @@ "binop": null, "updateContext": null }, - "start": 585, - "end": 586, + "start": 925, + "end": 926, "loc": { "start": { - "line": 10, + "line": 15, "column": 66 }, "end": { - "line": 10, + "line": 15, "column": 67 } } @@ -5202,15 +6822,15 @@ "updateContext": null }, "value": "export", - "start": 587, - "end": 593, + "start": 927, + "end": 933, "loc": { "start": { - "line": 11, + "line": 16, "column": 0 }, "end": { - "line": 11, + "line": 16, "column": 6 } } @@ -5227,15 +6847,15 @@ "postfix": false, "binop": null }, - "start": 594, - "end": 595, + "start": 934, + "end": 935, "loc": { "start": { - "line": 11, + "line": 16, "column": 7 }, "end": { - "line": 11, + "line": 16, "column": 8 } } @@ -5255,15 +6875,15 @@ "updateContext": null }, "value": "default", - "start": 595, - "end": 602, + "start": 935, + "end": 942, "loc": { "start": { - "line": 11, + "line": 16, "column": 8 }, "end": { - "line": 11, + "line": 16, "column": 15 } } @@ -5281,15 +6901,15 @@ "binop": null }, "value": "as", - "start": 603, - "end": 605, + "start": 943, + "end": 945, "loc": { "start": { - "line": 11, + "line": 16, "column": 16 }, "end": { - "line": 11, + "line": 16, "column": 18 } } @@ -5306,17 +6926,17 @@ "postfix": false, "binop": null }, - "value": "delete_case5", - "start": 606, - "end": 618, + "value": "grandparent", + "start": 946, + "end": 957, "loc": { "start": { - "line": 11, + "line": 16, "column": 19 }, "end": { - "line": 11, - "column": 31 + "line": 16, + "column": 30 } } }, @@ -5332,16 +6952,16 @@ "postfix": false, "binop": null }, - "start": 618, - "end": 619, + "start": 957, + "end": 958, "loc": { "start": { - "line": 11, - "column": 31 + "line": 16, + "column": 30 }, "end": { - "line": 11, - "column": 32 + "line": 16, + "column": 31 } } }, @@ -5358,16 +6978,16 @@ "binop": null }, "value": "from", - "start": 620, - "end": 624, + "start": 959, + "end": 963, "loc": { "start": { - "line": 11, - "column": 33 + "line": 16, + "column": 32 }, "end": { - "line": 11, - "column": 37 + "line": 16, + "column": 36 } } }, @@ -5384,17 +7004,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_case5.js", - "start": 625, - "end": 653, + "value": "./family/grandparent.js", + "start": 964, + "end": 989, "loc": { "start": { - "line": 11, - "column": 38 + "line": 16, + "column": 37 }, "end": { - "line": 11, - "column": 66 + "line": 16, + "column": 62 } } }, @@ -5411,16 +7031,16 @@ "binop": null, "updateContext": null }, - "start": 653, - "end": 654, + "start": 989, + "end": 990, "loc": { "start": { - "line": 11, - "column": 66 + "line": 16, + "column": 62 }, "end": { - "line": 11, - "column": 67 + "line": 16, + "column": 63 } } }, @@ -5439,15 +7059,15 @@ "updateContext": null }, "value": "export", - "start": 655, - "end": 661, + "start": 991, + "end": 997, "loc": { "start": { - "line": 12, + "line": 17, "column": 0 }, "end": { - "line": 12, + "line": 17, "column": 6 } } @@ -5464,15 +7084,15 @@ "postfix": false, "binop": null }, - "start": 662, - "end": 663, + "start": 998, + "end": 999, "loc": { "start": { - "line": 12, + "line": 17, "column": 7 }, "end": { - "line": 12, + "line": 17, "column": 8 } } @@ -5492,15 +7112,15 @@ "updateContext": null }, "value": "default", - "start": 663, - "end": 670, + "start": 999, + "end": 1006, "loc": { "start": { - "line": 12, + "line": 17, "column": 8 }, "end": { - "line": 12, + "line": 17, "column": 15 } } @@ -5518,15 +7138,15 @@ "binop": null }, "value": "as", - "start": 671, - "end": 673, + "start": 1007, + "end": 1009, "loc": { "start": { - "line": 12, + "line": 17, "column": 16 }, "end": { - "line": 12, + "line": 17, "column": 18 } } @@ -5543,17 +7163,17 @@ "postfix": false, "binop": null }, - "value": "delete_no_child", - "start": 674, - "end": 689, + "value": "predecessor", + "start": 1010, + "end": 1021, "loc": { "start": { - "line": 12, + "line": 17, "column": 19 }, "end": { - "line": 12, - "column": 34 + "line": 17, + "column": 30 } } }, @@ -5569,16 +7189,16 @@ "postfix": false, "binop": null }, - "start": 689, - "end": 690, + "start": 1021, + "end": 1022, "loc": { "start": { - "line": 12, - "column": 34 + "line": 17, + "column": 30 }, "end": { - "line": 12, - "column": 35 + "line": 17, + "column": 31 } } }, @@ -5595,16 +7215,16 @@ "binop": null }, "value": "from", - "start": 691, - "end": 695, + "start": 1023, + "end": 1027, "loc": { "start": { - "line": 12, - "column": 36 + "line": 17, + "column": 32 }, "end": { - "line": 12, - "column": 40 + "line": 17, + "column": 36 } } }, @@ -5621,17 +7241,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_no_child.js", - "start": 696, - "end": 727, + "value": "./family/predecessor.js", + "start": 1028, + "end": 1053, "loc": { "start": { - "line": 12, - "column": 41 + "line": 17, + "column": 37 }, "end": { - "line": 12, - "column": 72 + "line": 17, + "column": 62 } } }, @@ -5648,16 +7268,16 @@ "binop": null, "updateContext": null }, - "start": 727, - "end": 728, + "start": 1053, + "end": 1054, "loc": { "start": { - "line": 12, - "column": 72 + "line": 17, + "column": 62 }, "end": { - "line": 12, - "column": 73 + "line": 17, + "column": 63 } } }, @@ -5676,15 +7296,15 @@ "updateContext": null }, "value": "export", - "start": 729, - "end": 735, + "start": 1055, + "end": 1061, "loc": { "start": { - "line": 13, + "line": 18, "column": 0 }, "end": { - "line": 13, + "line": 18, "column": 6 } } @@ -5701,15 +7321,15 @@ "postfix": false, "binop": null }, - "start": 736, - "end": 737, + "start": 1062, + "end": 1063, "loc": { "start": { - "line": 13, + "line": 18, "column": 7 }, "end": { - "line": 13, + "line": 18, "column": 8 } } @@ -5729,15 +7349,15 @@ "updateContext": null }, "value": "default", - "start": 737, - "end": 744, + "start": 1063, + "end": 1070, "loc": { "start": { - "line": 13, + "line": 18, "column": 8 }, "end": { - "line": 13, + "line": 18, "column": 15 } } @@ -5755,15 +7375,15 @@ "binop": null }, "value": "as", - "start": 745, - "end": 747, + "start": 1071, + "end": 1073, "loc": { "start": { - "line": 13, + "line": 18, "column": 16 }, "end": { - "line": 13, + "line": 18, "column": 18 } } @@ -5780,17 +7400,17 @@ "postfix": false, "binop": null }, - "value": "delete_one_child", - "start": 748, - "end": 764, + "value": "sibling", + "start": 1074, + "end": 1081, "loc": { "start": { - "line": 13, + "line": 18, "column": 19 }, "end": { - "line": 13, - "column": 35 + "line": 18, + "column": 26 } } }, @@ -5806,16 +7426,16 @@ "postfix": false, "binop": null }, - "start": 764, - "end": 765, + "start": 1081, + "end": 1082, "loc": { "start": { - "line": 13, - "column": 35 + "line": 18, + "column": 26 }, "end": { - "line": 13, - "column": 36 + "line": 18, + "column": 27 } } }, @@ -5832,16 +7452,16 @@ "binop": null }, "value": "from", - "start": 766, - "end": 770, + "start": 1083, + "end": 1087, "loc": { "start": { - "line": 13, - "column": 37 + "line": 18, + "column": 28 }, "end": { - "line": 13, - "column": 41 + "line": 18, + "column": 32 } } }, @@ -5858,17 +7478,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/delete_one_child.js", - "start": 771, - "end": 803, + "value": "./family/sibling.js", + "start": 1088, + "end": 1109, "loc": { "start": { - "line": 13, - "column": 42 + "line": 18, + "column": 33 }, "end": { - "line": 13, - "column": 74 + "line": 18, + "column": 54 } } }, @@ -5885,16 +7505,16 @@ "binop": null, "updateContext": null }, - "start": 803, - "end": 804, + "start": 1109, + "end": 1110, "loc": { "start": { - "line": 13, - "column": 74 + "line": 18, + "column": 54 }, "end": { - "line": 13, - "column": 75 + "line": 18, + "column": 55 } } }, @@ -5913,15 +7533,15 @@ "updateContext": null }, "value": "export", - "start": 805, - "end": 811, + "start": 1111, + "end": 1117, "loc": { "start": { - "line": 14, + "line": 19, "column": 0 }, "end": { - "line": 14, + "line": 19, "column": 6 } } @@ -5938,15 +7558,15 @@ "postfix": false, "binop": null }, - "start": 812, - "end": 813, + "start": 1118, + "end": 1119, "loc": { "start": { - "line": 14, + "line": 19, "column": 7 }, "end": { - "line": 14, + "line": 19, "column": 8 } } @@ -5966,15 +7586,15 @@ "updateContext": null }, "value": "default", - "start": 813, - "end": 820, + "start": 1119, + "end": 1126, "loc": { "start": { - "line": 14, + "line": 19, "column": 8 }, "end": { - "line": 14, + "line": 19, "column": 15 } } @@ -5992,15 +7612,15 @@ "binop": null }, "value": "as", - "start": 821, - "end": 823, + "start": 1127, + "end": 1129, "loc": { "start": { - "line": 14, + "line": 19, "column": 16 }, "end": { - "line": 14, + "line": 19, "column": 18 } } @@ -6017,16 +7637,16 @@ "postfix": false, "binop": null }, - "value": "prune", - "start": 824, - "end": 829, + "value": "uncle", + "start": 1130, + "end": 1135, "loc": { "start": { - "line": 14, + "line": 19, "column": 19 }, "end": { - "line": 14, + "line": 19, "column": 24 } } @@ -6043,15 +7663,15 @@ "postfix": false, "binop": null }, - "start": 829, - "end": 830, + "start": 1135, + "end": 1136, "loc": { "start": { - "line": 14, + "line": 19, "column": 24 }, "end": { - "line": 14, + "line": 19, "column": 25 } } @@ -6069,15 +7689,15 @@ "binop": null }, "value": "from", - "start": 831, - "end": 835, + "start": 1137, + "end": 1141, "loc": { "start": { - "line": 14, + "line": 19, "column": 26 }, "end": { - "line": 14, + "line": 19, "column": 30 } } @@ -6095,17 +7715,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/prune.js", - "start": 836, - "end": 857, + "value": "./family/uncle.js", + "start": 1142, + "end": 1161, "loc": { "start": { - "line": 14, + "line": 19, "column": 31 }, "end": { - "line": 14, - "column": 52 + "line": 19, + "column": 50 } } }, @@ -6122,16 +7742,16 @@ "binop": null, "updateContext": null }, - "start": 857, - "end": 858, + "start": 1161, + "end": 1162, "loc": { "start": { - "line": 14, - "column": 52 + "line": 19, + "column": 50 }, "end": { - "line": 14, - "column": 53 + "line": 19, + "column": 51 } } }, @@ -6150,15 +7770,15 @@ "updateContext": null }, "value": "export", - "start": 859, - "end": 865, + "start": 1163, + "end": 1169, "loc": { "start": { - "line": 15, + "line": 20, "column": 0 }, "end": { - "line": 15, + "line": 20, "column": 6 } } @@ -6175,15 +7795,15 @@ "postfix": false, "binop": null }, - "start": 866, - "end": 867, + "start": 1170, + "end": 1171, "loc": { "start": { - "line": 15, + "line": 20, "column": 7 }, "end": { - "line": 15, + "line": 20, "column": 8 } } @@ -6203,15 +7823,15 @@ "updateContext": null }, "value": "default", - "start": 867, - "end": 874, + "start": 1171, + "end": 1178, "loc": { "start": { - "line": 15, + "line": 20, "column": 8 }, "end": { - "line": 15, + "line": 20, "column": 15 } } @@ -6229,15 +7849,15 @@ "binop": null }, "value": "as", - "start": 875, - "end": 877, + "start": 1179, + "end": 1181, "loc": { "start": { - "line": 15, + "line": 20, "column": 16 }, "end": { - "line": 15, + "line": 20, "column": 18 } } @@ -6254,17 +7874,17 @@ "postfix": false, "binop": null }, - "value": "replace_node", - "start": 878, - "end": 890, + "value": "insert", + "start": 1182, + "end": 1188, "loc": { "start": { - "line": 15, + "line": 20, "column": 19 }, "end": { - "line": 15, - "column": 31 + "line": 20, + "column": 25 } } }, @@ -6280,16 +7900,16 @@ "postfix": false, "binop": null }, - "start": 890, - "end": 891, + "start": 1188, + "end": 1189, "loc": { "start": { - "line": 15, - "column": 31 + "line": 20, + "column": 25 }, "end": { - "line": 15, - "column": 32 + "line": 20, + "column": 26 } } }, @@ -6306,16 +7926,16 @@ "binop": null }, "value": "from", - "start": 892, - "end": 896, + "start": 1190, + "end": 1194, "loc": { "start": { - "line": 15, - "column": 33 + "line": 20, + "column": 27 }, "end": { - "line": 15, - "column": 37 + "line": 20, + "column": 31 } } }, @@ -6332,17 +7952,17 @@ "binop": null, "updateContext": null }, - "value": "./deletion/replace_node.js", - "start": 897, - "end": 925, + "value": "./insertion/insert.js", + "start": 1195, + "end": 1218, "loc": { "start": { - "line": 15, - "column": 38 + "line": 20, + "column": 32 }, "end": { - "line": 15, - "column": 66 + "line": 20, + "column": 55 } } }, @@ -6359,16 +7979,16 @@ "binop": null, "updateContext": null }, - "start": 925, - "end": 926, + "start": 1218, + "end": 1219, "loc": { "start": { - "line": 15, - "column": 66 + "line": 20, + "column": 55 }, "end": { - "line": 15, - "column": 67 + "line": 20, + "column": 56 } } }, @@ -6387,15 +8007,15 @@ "updateContext": null }, "value": "export", - "start": 927, - "end": 933, + "start": 1220, + "end": 1226, "loc": { "start": { - "line": 16, + "line": 21, "column": 0 }, "end": { - "line": 16, + "line": 21, "column": 6 } } @@ -6412,15 +8032,15 @@ "postfix": false, "binop": null }, - "start": 934, - "end": 935, + "start": 1227, + "end": 1228, "loc": { "start": { - "line": 16, + "line": 21, "column": 7 }, "end": { - "line": 16, + "line": 21, "column": 8 } } @@ -6440,15 +8060,15 @@ "updateContext": null }, "value": "default", - "start": 935, - "end": 942, + "start": 1228, + "end": 1235, "loc": { "start": { - "line": 16, + "line": 21, "column": 8 }, "end": { - "line": 16, + "line": 21, "column": 15 } } @@ -6466,15 +8086,15 @@ "binop": null }, "value": "as", - "start": 943, - "end": 945, + "start": 1236, + "end": 1238, "loc": { "start": { - "line": 16, + "line": 21, "column": 16 }, "end": { - "line": 16, + "line": 21, "column": 18 } } @@ -6491,17 +8111,17 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 946, - "end": 957, + "value": "insert_case0", + "start": 1239, + "end": 1251, "loc": { "start": { - "line": 16, + "line": 21, "column": 19 }, "end": { - "line": 16, - "column": 30 + "line": 21, + "column": 31 } } }, @@ -6517,16 +8137,16 @@ "postfix": false, "binop": null }, - "start": 957, - "end": 958, + "start": 1251, + "end": 1252, "loc": { "start": { - "line": 16, - "column": 30 + "line": 21, + "column": 31 }, "end": { - "line": 16, - "column": 31 + "line": 21, + "column": 32 } } }, @@ -6543,16 +8163,16 @@ "binop": null }, "value": "from", - "start": 959, - "end": 963, + "start": 1253, + "end": 1257, "loc": { "start": { - "line": 16, - "column": 32 + "line": 21, + "column": 33 }, "end": { - "line": 16, - "column": 36 + "line": 21, + "column": 37 } } }, @@ -6569,17 +8189,17 @@ "binop": null, "updateContext": null }, - "value": "./family/grandparent.js", - "start": 964, - "end": 989, + "value": "./insertion/insert_case0.js", + "start": 1258, + "end": 1287, "loc": { "start": { - "line": 16, - "column": 37 + "line": 21, + "column": 38 }, "end": { - "line": 16, - "column": 62 + "line": 21, + "column": 67 } } }, @@ -6596,16 +8216,16 @@ "binop": null, "updateContext": null }, - "start": 989, - "end": 990, + "start": 1287, + "end": 1288, "loc": { "start": { - "line": 16, - "column": 62 + "line": 21, + "column": 67 }, "end": { - "line": 16, - "column": 63 + "line": 21, + "column": 68 } } }, @@ -6624,15 +8244,15 @@ "updateContext": null }, "value": "export", - "start": 991, - "end": 997, + "start": 1289, + "end": 1295, "loc": { "start": { - "line": 17, + "line": 22, "column": 0 }, "end": { - "line": 17, + "line": 22, "column": 6 } } @@ -6649,15 +8269,15 @@ "postfix": false, "binop": null }, - "start": 998, - "end": 999, + "start": 1296, + "end": 1297, "loc": { "start": { - "line": 17, + "line": 22, "column": 7 }, "end": { - "line": 17, + "line": 22, "column": 8 } } @@ -6677,15 +8297,15 @@ "updateContext": null }, "value": "default", - "start": 999, - "end": 1006, + "start": 1297, + "end": 1304, "loc": { "start": { - "line": 17, + "line": 22, "column": 8 }, "end": { - "line": 17, + "line": 22, "column": 15 } } @@ -6703,15 +8323,15 @@ "binop": null }, "value": "as", - "start": 1007, - "end": 1009, + "start": 1305, + "end": 1307, "loc": { "start": { - "line": 17, + "line": 22, "column": 16 }, "end": { - "line": 17, + "line": 22, "column": 18 } } @@ -6728,17 +8348,17 @@ "postfix": false, "binop": null }, - "value": "predecessor", - "start": 1010, - "end": 1021, + "value": "insert_case1", + "start": 1308, + "end": 1320, "loc": { "start": { - "line": 17, + "line": 22, "column": 19 }, "end": { - "line": 17, - "column": 30 + "line": 22, + "column": 31 } } }, @@ -6754,16 +8374,16 @@ "postfix": false, "binop": null }, - "start": 1021, - "end": 1022, + "start": 1320, + "end": 1321, "loc": { "start": { - "line": 17, - "column": 30 + "line": 22, + "column": 31 }, "end": { - "line": 17, - "column": 31 + "line": 22, + "column": 32 } } }, @@ -6780,16 +8400,16 @@ "binop": null }, "value": "from", - "start": 1023, - "end": 1027, + "start": 1322, + "end": 1326, "loc": { "start": { - "line": 17, - "column": 32 + "line": 22, + "column": 33 }, "end": { - "line": 17, - "column": 36 + "line": 22, + "column": 37 } } }, @@ -6806,17 +8426,17 @@ "binop": null, "updateContext": null }, - "value": "./family/predecessor.js", - "start": 1028, - "end": 1053, + "value": "./insertion/insert_case1.js", + "start": 1327, + "end": 1356, "loc": { "start": { - "line": 17, - "column": 37 + "line": 22, + "column": 38 }, "end": { - "line": 17, - "column": 62 + "line": 22, + "column": 67 } } }, @@ -6833,16 +8453,16 @@ "binop": null, "updateContext": null }, - "start": 1053, - "end": 1054, + "start": 1356, + "end": 1357, "loc": { "start": { - "line": 17, - "column": 62 + "line": 22, + "column": 67 }, "end": { - "line": 17, - "column": 63 + "line": 22, + "column": 68 } } }, @@ -6861,15 +8481,15 @@ "updateContext": null }, "value": "export", - "start": 1055, - "end": 1061, + "start": 1358, + "end": 1364, "loc": { "start": { - "line": 18, + "line": 23, "column": 0 }, "end": { - "line": 18, + "line": 23, "column": 6 } } @@ -6886,15 +8506,15 @@ "postfix": false, "binop": null }, - "start": 1062, - "end": 1063, + "start": 1365, + "end": 1366, "loc": { "start": { - "line": 18, + "line": 23, "column": 7 }, "end": { - "line": 18, + "line": 23, "column": 8 } } @@ -6914,15 +8534,15 @@ "updateContext": null }, "value": "default", - "start": 1063, - "end": 1070, + "start": 1366, + "end": 1373, "loc": { "start": { - "line": 18, + "line": 23, "column": 8 }, "end": { - "line": 18, + "line": 23, "column": 15 } } @@ -6940,15 +8560,15 @@ "binop": null }, "value": "as", - "start": 1071, - "end": 1073, + "start": 1374, + "end": 1376, "loc": { "start": { - "line": 18, + "line": 23, "column": 16 }, "end": { - "line": 18, + "line": 23, "column": 18 } } @@ -6965,17 +8585,17 @@ "postfix": false, "binop": null }, - "value": "sibling", - "start": 1074, - "end": 1081, + "value": "insert_case2", + "start": 1377, + "end": 1389, "loc": { "start": { - "line": 18, + "line": 23, "column": 19 }, "end": { - "line": 18, - "column": 26 + "line": 23, + "column": 31 } } }, @@ -6991,16 +8611,16 @@ "postfix": false, "binop": null }, - "start": 1081, - "end": 1082, + "start": 1389, + "end": 1390, "loc": { "start": { - "line": 18, - "column": 26 + "line": 23, + "column": 31 }, "end": { - "line": 18, - "column": 27 + "line": 23, + "column": 32 } } }, @@ -7017,16 +8637,16 @@ "binop": null }, "value": "from", - "start": 1083, - "end": 1087, + "start": 1391, + "end": 1395, "loc": { "start": { - "line": 18, - "column": 28 + "line": 23, + "column": 33 }, "end": { - "line": 18, - "column": 32 + "line": 23, + "column": 37 } } }, @@ -7043,17 +8663,17 @@ "binop": null, "updateContext": null }, - "value": "./family/sibling.js", - "start": 1088, - "end": 1109, + "value": "./insertion/insert_case2.js", + "start": 1396, + "end": 1425, "loc": { "start": { - "line": 18, - "column": 33 + "line": 23, + "column": 38 }, "end": { - "line": 18, - "column": 54 + "line": 23, + "column": 67 } } }, @@ -7070,16 +8690,16 @@ "binop": null, "updateContext": null }, - "start": 1109, - "end": 1110, + "start": 1425, + "end": 1426, "loc": { "start": { - "line": 18, - "column": 54 + "line": 23, + "column": 67 }, "end": { - "line": 18, - "column": 55 + "line": 23, + "column": 68 } } }, @@ -7098,15 +8718,15 @@ "updateContext": null }, "value": "export", - "start": 1111, - "end": 1117, + "start": 1427, + "end": 1433, "loc": { "start": { - "line": 19, + "line": 24, "column": 0 }, "end": { - "line": 19, + "line": 24, "column": 6 } } @@ -7123,15 +8743,15 @@ "postfix": false, "binop": null }, - "start": 1118, - "end": 1119, + "start": 1434, + "end": 1435, "loc": { "start": { - "line": 19, + "line": 24, "column": 7 }, "end": { - "line": 19, + "line": 24, "column": 8 } } @@ -7151,15 +8771,15 @@ "updateContext": null }, "value": "default", - "start": 1119, - "end": 1126, + "start": 1435, + "end": 1442, "loc": { "start": { - "line": 19, + "line": 24, "column": 8 }, "end": { - "line": 19, + "line": 24, "column": 15 } } @@ -7177,15 +8797,15 @@ "binop": null }, "value": "as", - "start": 1127, - "end": 1129, + "start": 1443, + "end": 1445, "loc": { "start": { - "line": 19, + "line": 24, "column": 16 }, "end": { - "line": 19, + "line": 24, "column": 18 } } @@ -7202,17 +8822,17 @@ "postfix": false, "binop": null }, - "value": "uncle", - "start": 1130, - "end": 1135, + "value": "insert_case3", + "start": 1446, + "end": 1458, "loc": { "start": { - "line": 19, + "line": 24, "column": 19 }, "end": { - "line": 19, - "column": 24 + "line": 24, + "column": 31 } } }, @@ -7228,16 +8848,16 @@ "postfix": false, "binop": null }, - "start": 1135, - "end": 1136, + "start": 1458, + "end": 1459, "loc": { "start": { - "line": 19, - "column": 24 + "line": 24, + "column": 31 }, "end": { - "line": 19, - "column": 25 + "line": 24, + "column": 32 } } }, @@ -7254,16 +8874,16 @@ "binop": null }, "value": "from", - "start": 1137, - "end": 1141, + "start": 1460, + "end": 1464, "loc": { "start": { - "line": 19, - "column": 26 + "line": 24, + "column": 33 }, "end": { - "line": 19, - "column": 30 + "line": 24, + "column": 37 } } }, @@ -7280,17 +8900,17 @@ "binop": null, "updateContext": null }, - "value": "./family/uncle.js", - "start": 1142, - "end": 1161, + "value": "./insertion/insert_case3.js", + "start": 1465, + "end": 1494, "loc": { "start": { - "line": 19, - "column": 31 + "line": 24, + "column": 38 }, "end": { - "line": 19, - "column": 50 + "line": 24, + "column": 67 } } }, @@ -7307,16 +8927,16 @@ "binop": null, "updateContext": null }, - "start": 1161, - "end": 1162, + "start": 1494, + "end": 1495, "loc": { "start": { - "line": 19, - "column": 50 + "line": 24, + "column": 67 }, "end": { - "line": 19, - "column": 51 + "line": 24, + "column": 68 } } }, @@ -7335,15 +8955,15 @@ "updateContext": null }, "value": "export", - "start": 1163, - "end": 1169, + "start": 1496, + "end": 1502, "loc": { "start": { - "line": 20, + "line": 25, "column": 0 }, "end": { - "line": 20, + "line": 25, "column": 6 } } @@ -7360,15 +8980,15 @@ "postfix": false, "binop": null }, - "start": 1170, - "end": 1171, + "start": 1503, + "end": 1504, "loc": { "start": { - "line": 20, + "line": 25, "column": 7 }, "end": { - "line": 20, + "line": 25, "column": 8 } } @@ -7388,15 +9008,15 @@ "updateContext": null }, "value": "default", - "start": 1171, - "end": 1178, + "start": 1504, + "end": 1511, "loc": { "start": { - "line": 20, + "line": 25, "column": 8 }, "end": { - "line": 20, + "line": 25, "column": 15 } } @@ -7414,15 +9034,15 @@ "binop": null }, "value": "as", - "start": 1179, - "end": 1181, + "start": 1512, + "end": 1514, "loc": { "start": { - "line": 20, + "line": 25, "column": 16 }, "end": { - "line": 20, + "line": 25, "column": 18 } } @@ -7439,17 +9059,17 @@ "postfix": false, "binop": null }, - "value": "insert", - "start": 1182, - "end": 1188, + "value": "insert_case4", + "start": 1515, + "end": 1527, "loc": { "start": { - "line": 20, + "line": 25, "column": 19 }, "end": { - "line": 20, - "column": 25 + "line": 25, + "column": 31 } } }, @@ -7465,16 +9085,16 @@ "postfix": false, "binop": null }, - "start": 1188, - "end": 1189, + "start": 1527, + "end": 1528, "loc": { "start": { - "line": 20, - "column": 25 + "line": 25, + "column": 31 }, "end": { - "line": 20, - "column": 26 + "line": 25, + "column": 32 } } }, @@ -7491,16 +9111,16 @@ "binop": null }, "value": "from", - "start": 1190, - "end": 1194, + "start": 1529, + "end": 1533, "loc": { "start": { - "line": 20, - "column": 27 + "line": 25, + "column": 33 }, "end": { - "line": 20, - "column": 31 + "line": 25, + "column": 37 } } }, @@ -7517,17 +9137,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert.js", - "start": 1195, - "end": 1218, + "value": "./insertion/insert_case4.js", + "start": 1534, + "end": 1563, "loc": { "start": { - "line": 20, - "column": 32 + "line": 25, + "column": 38 }, "end": { - "line": 20, - "column": 55 + "line": 25, + "column": 67 } } }, @@ -7544,16 +9164,16 @@ "binop": null, "updateContext": null }, - "start": 1218, - "end": 1219, + "start": 1563, + "end": 1564, "loc": { "start": { - "line": 20, - "column": 55 + "line": 25, + "column": 67 }, "end": { - "line": 20, - "column": 56 + "line": 25, + "column": 68 } } }, @@ -7572,15 +9192,15 @@ "updateContext": null }, "value": "export", - "start": 1220, - "end": 1226, + "start": 1565, + "end": 1571, "loc": { "start": { - "line": 21, + "line": 26, "column": 0 }, "end": { - "line": 21, + "line": 26, "column": 6 } } @@ -7597,15 +9217,15 @@ "postfix": false, "binop": null }, - "start": 1227, - "end": 1228, + "start": 1572, + "end": 1573, "loc": { "start": { - "line": 21, + "line": 26, "column": 7 }, "end": { - "line": 21, + "line": 26, "column": 8 } } @@ -7625,15 +9245,15 @@ "updateContext": null }, "value": "default", - "start": 1228, - "end": 1235, + "start": 1573, + "end": 1580, "loc": { "start": { - "line": 21, + "line": 26, "column": 8 }, "end": { - "line": 21, + "line": 26, "column": 15 } } @@ -7651,15 +9271,15 @@ "binop": null }, "value": "as", - "start": 1236, - "end": 1238, + "start": 1581, + "end": 1583, "loc": { "start": { - "line": 21, + "line": 26, "column": 16 }, "end": { - "line": 21, + "line": 26, "column": 18 } } @@ -7676,17 +9296,17 @@ "postfix": false, "binop": null }, - "value": "insert_case0", - "start": 1239, - "end": 1251, + "value": "rotate_left", + "start": 1584, + "end": 1595, "loc": { "start": { - "line": 21, + "line": 26, "column": 19 }, "end": { - "line": 21, - "column": 31 + "line": 26, + "column": 30 } } }, @@ -7702,16 +9322,16 @@ "postfix": false, "binop": null }, - "start": 1251, - "end": 1252, + "start": 1595, + "end": 1596, "loc": { "start": { - "line": 21, - "column": 31 + "line": 26, + "column": 30 }, "end": { - "line": 21, - "column": 32 + "line": 26, + "column": 31 } } }, @@ -7728,16 +9348,16 @@ "binop": null }, "value": "from", - "start": 1253, - "end": 1257, + "start": 1597, + "end": 1601, "loc": { "start": { - "line": 21, - "column": 33 + "line": 26, + "column": 32 }, "end": { - "line": 21, - "column": 37 + "line": 26, + "column": 36 } } }, @@ -7754,17 +9374,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case0.js", - "start": 1258, - "end": 1287, + "value": "./rotate/rotate_left.js", + "start": 1602, + "end": 1627, "loc": { "start": { - "line": 21, - "column": 38 + "line": 26, + "column": 37 }, "end": { - "line": 21, - "column": 67 + "line": 26, + "column": 62 } } }, @@ -7781,16 +9401,16 @@ "binop": null, "updateContext": null }, - "start": 1287, - "end": 1288, + "start": 1627, + "end": 1628, "loc": { "start": { - "line": 21, - "column": 67 + "line": 26, + "column": 62 }, "end": { - "line": 21, - "column": 68 + "line": 26, + "column": 63 } } }, @@ -7809,15 +9429,15 @@ "updateContext": null }, "value": "export", - "start": 1289, - "end": 1295, + "start": 1629, + "end": 1635, "loc": { "start": { - "line": 22, + "line": 27, "column": 0 }, "end": { - "line": 22, + "line": 27, "column": 6 } } @@ -7834,15 +9454,15 @@ "postfix": false, "binop": null }, - "start": 1296, - "end": 1297, + "start": 1636, + "end": 1637, "loc": { "start": { - "line": 22, + "line": 27, "column": 7 }, "end": { - "line": 22, + "line": 27, "column": 8 } } @@ -7862,15 +9482,15 @@ "updateContext": null }, "value": "default", - "start": 1297, - "end": 1304, + "start": 1637, + "end": 1644, "loc": { "start": { - "line": 22, + "line": 27, "column": 8 }, "end": { - "line": 22, + "line": 27, "column": 15 } } @@ -7888,15 +9508,15 @@ "binop": null }, "value": "as", - "start": 1305, - "end": 1307, + "start": 1645, + "end": 1647, "loc": { "start": { - "line": 22, + "line": 27, "column": 16 }, "end": { - "line": 22, + "line": 27, "column": 18 } } @@ -7913,16 +9533,16 @@ "postfix": false, "binop": null }, - "value": "insert_case1", - "start": 1308, - "end": 1320, + "value": "rotate_right", + "start": 1648, + "end": 1660, "loc": { "start": { - "line": 22, + "line": 27, "column": 19 }, "end": { - "line": 22, + "line": 27, "column": 31 } } @@ -7939,15 +9559,15 @@ "postfix": false, "binop": null }, - "start": 1320, - "end": 1321, + "start": 1660, + "end": 1661, "loc": { "start": { - "line": 22, + "line": 27, "column": 31 }, "end": { - "line": 22, + "line": 27, "column": 32 } } @@ -7965,15 +9585,15 @@ "binop": null }, "value": "from", - "start": 1322, - "end": 1326, + "start": 1662, + "end": 1666, "loc": { "start": { - "line": 22, + "line": 27, "column": 33 }, "end": { - "line": 22, + "line": 27, "column": 37 } } @@ -7991,17 +9611,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case1.js", - "start": 1327, - "end": 1356, + "value": "./rotate/rotate_right.js", + "start": 1667, + "end": 1693, "loc": { "start": { - "line": 22, + "line": 27, "column": 38 }, "end": { - "line": 22, - "column": 67 + "line": 27, + "column": 64 } } }, @@ -8018,16 +9638,16 @@ "binop": null, "updateContext": null }, - "start": 1356, - "end": 1357, + "start": 1693, + "end": 1694, "loc": { "start": { - "line": 22, - "column": 67 + "line": 27, + "column": 64 }, "end": { - "line": 22, - "column": 68 + "line": 27, + "column": 65 } } }, @@ -8046,15 +9666,15 @@ "updateContext": null }, "value": "export", - "start": 1358, - "end": 1364, + "start": 1695, + "end": 1701, "loc": { "start": { - "line": 23, + "line": 28, "column": 0 }, "end": { - "line": 23, + "line": 28, "column": 6 } } @@ -8071,15 +9691,15 @@ "postfix": false, "binop": null }, - "start": 1365, - "end": 1366, + "start": 1702, + "end": 1703, "loc": { "start": { - "line": 23, + "line": 28, "column": 7 }, "end": { - "line": 23, + "line": 28, "column": 8 } } @@ -8099,15 +9719,15 @@ "updateContext": null }, "value": "default", - "start": 1366, - "end": 1373, + "start": 1703, + "end": 1710, "loc": { "start": { - "line": 23, + "line": 28, "column": 8 }, "end": { - "line": 23, + "line": 28, "column": 15 } } @@ -8125,15 +9745,15 @@ "binop": null }, "value": "as", - "start": 1374, - "end": 1376, + "start": 1711, + "end": 1713, "loc": { "start": { - "line": 23, + "line": 28, "column": 16 }, "end": { - "line": 23, + "line": 28, "column": 18 } } @@ -8150,17 +9770,17 @@ "postfix": false, "binop": null }, - "value": "insert_case2", - "start": 1377, - "end": 1389, + "value": "search", + "start": 1714, + "end": 1720, "loc": { "start": { - "line": 23, + "line": 28, "column": 19 }, "end": { - "line": 23, - "column": 31 + "line": 28, + "column": 25 } } }, @@ -8176,16 +9796,16 @@ "postfix": false, "binop": null }, - "start": 1389, - "end": 1390, + "start": 1720, + "end": 1721, "loc": { "start": { - "line": 23, - "column": 31 + "line": 28, + "column": 25 }, "end": { - "line": 23, - "column": 32 + "line": 28, + "column": 26 } } }, @@ -8202,16 +9822,16 @@ "binop": null }, "value": "from", - "start": 1391, - "end": 1395, + "start": 1722, + "end": 1726, "loc": { "start": { - "line": 23, - "column": 33 + "line": 28, + "column": 27 }, "end": { - "line": 23, - "column": 37 + "line": 28, + "column": 31 } } }, @@ -8228,17 +9848,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case2.js", - "start": 1396, - "end": 1425, + "value": "./search/search.js", + "start": 1727, + "end": 1747, "loc": { "start": { - "line": 23, - "column": 38 + "line": 28, + "column": 32 }, "end": { - "line": 23, - "column": 67 + "line": 28, + "column": 52 } } }, @@ -8255,16 +9875,16 @@ "binop": null, "updateContext": null }, - "start": 1425, - "end": 1426, + "start": 1747, + "end": 1748, "loc": { "start": { - "line": 23, - "column": 67 + "line": 28, + "column": 52 }, "end": { - "line": 23, - "column": 68 + "line": 28, + "column": 53 } } }, @@ -8283,15 +9903,15 @@ "updateContext": null }, "value": "export", - "start": 1427, - "end": 1433, + "start": 1749, + "end": 1755, "loc": { "start": { - "line": 24, + "line": 29, "column": 0 }, "end": { - "line": 24, + "line": 29, "column": 6 } } @@ -8308,15 +9928,15 @@ "postfix": false, "binop": null }, - "start": 1434, - "end": 1435, + "start": 1756, + "end": 1757, "loc": { "start": { - "line": 24, + "line": 29, "column": 7 }, "end": { - "line": 24, + "line": 29, "column": 8 } } @@ -8336,15 +9956,15 @@ "updateContext": null }, "value": "default", - "start": 1435, - "end": 1442, + "start": 1757, + "end": 1764, "loc": { "start": { - "line": 24, + "line": 29, "column": 8 }, "end": { - "line": 24, + "line": 29, "column": 15 } } @@ -8362,15 +9982,15 @@ "binop": null }, "value": "as", - "start": 1443, - "end": 1445, + "start": 1765, + "end": 1767, "loc": { "start": { - "line": 24, + "line": 29, "column": 16 }, "end": { - "line": 24, + "line": 29, "column": 18 } } @@ -8387,17 +10007,17 @@ "postfix": false, "binop": null }, - "value": "insert_case3", - "start": 1446, - "end": 1458, + "value": "swap_color", + "start": 1768, + "end": 1778, "loc": { "start": { - "line": 24, + "line": 29, "column": 19 }, "end": { - "line": 24, - "column": 31 + "line": 29, + "column": 29 } } }, @@ -8413,16 +10033,16 @@ "postfix": false, "binop": null }, - "start": 1458, - "end": 1459, + "start": 1778, + "end": 1779, "loc": { "start": { - "line": 24, - "column": 31 + "line": 29, + "column": 29 }, "end": { - "line": 24, - "column": 32 + "line": 29, + "column": 30 } } }, @@ -8439,16 +10059,16 @@ "binop": null }, "value": "from", - "start": 1460, - "end": 1464, + "start": 1780, + "end": 1784, "loc": { "start": { - "line": 24, - "column": 33 + "line": 29, + "column": 31 }, "end": { - "line": 24, - "column": 37 + "line": 29, + "column": 35 } } }, @@ -8465,17 +10085,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case3.js", - "start": 1465, - "end": 1494, + "value": "./swap/swap_color.js", + "start": 1785, + "end": 1807, "loc": { "start": { - "line": 24, - "column": 38 + "line": 29, + "column": 36 }, "end": { - "line": 24, - "column": 67 + "line": 29, + "column": 58 } } }, @@ -8492,16 +10112,16 @@ "binop": null, "updateContext": null }, - "start": 1494, - "end": 1495, + "start": 1807, + "end": 1808, "loc": { "start": { - "line": 24, - "column": 67 + "line": 29, + "column": 58 }, "end": { - "line": 24, - "column": 68 + "line": 29, + "column": 59 } } }, @@ -8520,15 +10140,15 @@ "updateContext": null }, "value": "export", - "start": 1496, - "end": 1502, + "start": 1809, + "end": 1815, "loc": { "start": { - "line": 25, + "line": 30, "column": 0 }, "end": { - "line": 25, + "line": 30, "column": 6 } } @@ -8545,15 +10165,15 @@ "postfix": false, "binop": null }, - "start": 1503, - "end": 1504, + "start": 1816, + "end": 1817, "loc": { "start": { - "line": 25, + "line": 30, "column": 7 }, "end": { - "line": 25, + "line": 30, "column": 8 } } @@ -8573,15 +10193,15 @@ "updateContext": null }, "value": "default", - "start": 1504, - "end": 1511, + "start": 1817, + "end": 1824, "loc": { "start": { - "line": 25, + "line": 30, "column": 8 }, "end": { - "line": 25, + "line": 30, "column": 15 } } @@ -8599,15 +10219,15 @@ "binop": null }, "value": "as", - "start": 1512, - "end": 1514, + "start": 1825, + "end": 1827, "loc": { "start": { - "line": 25, + "line": 30, "column": 16 }, "end": { - "line": 25, + "line": 30, "column": 18 } } @@ -8624,17 +10244,17 @@ "postfix": false, "binop": null }, - "value": "insert_case4", - "start": 1515, - "end": 1527, + "value": "swap_left", + "start": 1828, + "end": 1837, "loc": { "start": { - "line": 25, + "line": 30, "column": 19 }, "end": { - "line": 25, - "column": 31 + "line": 30, + "column": 28 } } }, @@ -8650,16 +10270,16 @@ "postfix": false, "binop": null }, - "start": 1527, - "end": 1528, + "start": 1837, + "end": 1838, "loc": { "start": { - "line": 25, - "column": 31 + "line": 30, + "column": 28 }, "end": { - "line": 25, - "column": 32 + "line": 30, + "column": 29 } } }, @@ -8676,16 +10296,16 @@ "binop": null }, "value": "from", - "start": 1529, - "end": 1533, + "start": 1839, + "end": 1843, "loc": { "start": { - "line": 25, - "column": 33 + "line": 30, + "column": 30 }, "end": { - "line": 25, - "column": 37 + "line": 30, + "column": 34 } } }, @@ -8702,17 +10322,17 @@ "binop": null, "updateContext": null }, - "value": "./insertion/insert_case4.js", - "start": 1534, - "end": 1563, + "value": "./swap/swap_left.js", + "start": 1844, + "end": 1865, "loc": { "start": { - "line": 25, - "column": 38 + "line": 30, + "column": 35 }, "end": { - "line": 25, - "column": 67 + "line": 30, + "column": 56 } } }, @@ -8729,16 +10349,16 @@ "binop": null, "updateContext": null }, - "start": 1563, - "end": 1564, + "start": 1865, + "end": 1866, "loc": { "start": { - "line": 25, - "column": 67 + "line": 30, + "column": 56 }, "end": { - "line": 25, - "column": 68 + "line": 30, + "column": 57 } } }, @@ -8757,15 +10377,15 @@ "updateContext": null }, "value": "export", - "start": 1565, - "end": 1571, + "start": 1867, + "end": 1873, "loc": { "start": { - "line": 26, + "line": 31, "column": 0 }, "end": { - "line": 26, + "line": 31, "column": 6 } } @@ -8782,15 +10402,15 @@ "postfix": false, "binop": null }, - "start": 1572, - "end": 1573, + "start": 1874, + "end": 1875, "loc": { "start": { - "line": 26, + "line": 31, "column": 7 }, "end": { - "line": 26, + "line": 31, "column": 8 } } @@ -8810,15 +10430,15 @@ "updateContext": null }, "value": "default", - "start": 1573, - "end": 1580, + "start": 1875, + "end": 1882, "loc": { "start": { - "line": 26, + "line": 31, "column": 8 }, "end": { - "line": 26, + "line": 31, "column": 15 } } @@ -8836,15 +10456,15 @@ "binop": null }, "value": "as", - "start": 1581, - "end": 1583, + "start": 1883, + "end": 1885, "loc": { "start": { - "line": 26, + "line": 31, "column": 16 }, "end": { - "line": 26, + "line": 31, "column": 18 } } @@ -8861,17 +10481,17 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 1584, - "end": 1595, + "value": "swap_non_adjacent", + "start": 1886, + "end": 1903, "loc": { "start": { - "line": 26, + "line": 31, "column": 19 }, "end": { - "line": 26, - "column": 30 + "line": 31, + "column": 36 } } }, @@ -8887,16 +10507,16 @@ "postfix": false, "binop": null }, - "start": 1595, - "end": 1596, + "start": 1903, + "end": 1904, "loc": { "start": { - "line": 26, - "column": 30 + "line": 31, + "column": 36 }, "end": { - "line": 26, - "column": 31 + "line": 31, + "column": 37 } } }, @@ -8913,16 +10533,16 @@ "binop": null }, "value": "from", - "start": 1597, - "end": 1601, + "start": 1905, + "end": 1909, "loc": { "start": { - "line": 26, - "column": 32 + "line": 31, + "column": 38 }, "end": { - "line": 26, - "column": 36 + "line": 31, + "column": 42 } } }, @@ -8939,17 +10559,17 @@ "binop": null, "updateContext": null }, - "value": "./rotate/rotate_left.js", - "start": 1602, - "end": 1627, + "value": "./swap/swap_non_adjacent.js", + "start": 1910, + "end": 1939, "loc": { "start": { - "line": 26, - "column": 37 + "line": 31, + "column": 43 }, "end": { - "line": 26, - "column": 62 + "line": 31, + "column": 72 } } }, @@ -8966,16 +10586,16 @@ "binop": null, "updateContext": null }, - "start": 1627, - "end": 1628, + "start": 1939, + "end": 1940, "loc": { "start": { - "line": 26, - "column": 62 + "line": 31, + "column": 72 }, "end": { - "line": 26, - "column": 63 + "line": 31, + "column": 73 } } }, @@ -8994,15 +10614,15 @@ "updateContext": null }, "value": "export", - "start": 1629, - "end": 1635, + "start": 1941, + "end": 1947, "loc": { "start": { - "line": 27, + "line": 32, "column": 0 }, "end": { - "line": 27, + "line": 32, "column": 6 } } @@ -9019,15 +10639,15 @@ "postfix": false, "binop": null }, - "start": 1636, - "end": 1637, + "start": 1948, + "end": 1949, "loc": { "start": { - "line": 27, + "line": 32, "column": 7 }, "end": { - "line": 27, + "line": 32, "column": 8 } } @@ -9047,15 +10667,15 @@ "updateContext": null }, "value": "default", - "start": 1637, - "end": 1644, + "start": 1949, + "end": 1956, "loc": { "start": { - "line": 27, + "line": 32, "column": 8 }, "end": { - "line": 27, + "line": 32, "column": 15 } } @@ -9073,15 +10693,15 @@ "binop": null }, "value": "as", - "start": 1645, - "end": 1647, + "start": 1957, + "end": 1959, "loc": { "start": { - "line": 27, + "line": 32, "column": 16 }, "end": { - "line": 27, + "line": 32, "column": 18 } } @@ -9098,17 +10718,17 @@ "postfix": false, "binop": null }, - "value": "rotate_right", - "start": 1648, - "end": 1660, + "value": "inordertraversal", + "start": 1960, + "end": 1976, "loc": { "start": { - "line": 27, + "line": 32, "column": 19 }, "end": { - "line": 27, - "column": 31 + "line": 32, + "column": 35 } } }, @@ -9124,16 +10744,16 @@ "postfix": false, "binop": null }, - "start": 1660, - "end": 1661, + "start": 1976, + "end": 1977, "loc": { "start": { - "line": 27, - "column": 31 + "line": 32, + "column": 35 }, "end": { - "line": 27, - "column": 32 + "line": 32, + "column": 36 } } }, @@ -9150,16 +10770,16 @@ "binop": null }, "value": "from", - "start": 1662, - "end": 1666, + "start": 1978, + "end": 1982, "loc": { "start": { - "line": 27, - "column": 33 + "line": 32, + "column": 37 }, "end": { - "line": 27, - "column": 37 + "line": 32, + "column": 41 } } }, @@ -9176,17 +10796,17 @@ "binop": null, "updateContext": null }, - "value": "./rotate/rotate_right.js", - "start": 1667, - "end": 1693, + "value": "./traversal/inordertraversal.js", + "start": 1983, + "end": 2016, "loc": { "start": { - "line": 27, - "column": 38 + "line": 32, + "column": 42 }, "end": { - "line": 27, - "column": 64 + "line": 32, + "column": 75 } } }, @@ -9203,16 +10823,16 @@ "binop": null, "updateContext": null }, - "start": 1693, - "end": 1694, + "start": 2016, + "end": 2017, "loc": { "start": { - "line": 27, - "column": 64 + "line": 32, + "column": 75 }, "end": { - "line": 27, - "column": 65 + "line": 32, + "column": 76 } } }, @@ -9231,15 +10851,15 @@ "updateContext": null }, "value": "export", - "start": 1695, - "end": 1701, + "start": 2018, + "end": 2024, "loc": { "start": { - "line": 28, + "line": 33, "column": 0 }, "end": { - "line": 28, + "line": 33, "column": 6 } } @@ -9256,15 +10876,15 @@ "postfix": false, "binop": null }, - "start": 1702, - "end": 1703, + "start": 2025, + "end": 2026, "loc": { "start": { - "line": 28, + "line": 33, "column": 7 }, "end": { - "line": 28, + "line": 33, "column": 8 } } @@ -9284,15 +10904,15 @@ "updateContext": null }, "value": "default", - "start": 1703, - "end": 1710, + "start": 2026, + "end": 2033, "loc": { "start": { - "line": 28, + "line": 33, "column": 8 }, "end": { - "line": 28, + "line": 33, "column": 15 } } @@ -9310,15 +10930,15 @@ "binop": null }, "value": "as", - "start": 1711, - "end": 1713, + "start": 2034, + "end": 2036, "loc": { "start": { - "line": 28, + "line": 33, "column": 16 }, "end": { - "line": 28, + "line": 33, "column": 18 } } @@ -9335,17 +10955,17 @@ "postfix": false, "binop": null }, - "value": "search", - "start": 1714, - "end": 1720, + "value": "leftOpenRangeTraversal", + "start": 2037, + "end": 2059, "loc": { "start": { - "line": 28, + "line": 33, "column": 19 }, "end": { - "line": 28, - "column": 25 + "line": 33, + "column": 41 } } }, @@ -9361,16 +10981,16 @@ "postfix": false, "binop": null }, - "start": 1720, - "end": 1721, + "start": 2059, + "end": 2060, "loc": { "start": { - "line": 28, - "column": 25 + "line": 33, + "column": 41 }, "end": { - "line": 28, - "column": 26 + "line": 33, + "column": 42 } } }, @@ -9387,16 +11007,16 @@ "binop": null }, "value": "from", - "start": 1722, - "end": 1726, + "start": 2061, + "end": 2065, "loc": { "start": { - "line": 28, - "column": 27 + "line": 33, + "column": 43 }, "end": { - "line": 28, - "column": 31 + "line": 33, + "column": 47 } } }, @@ -9413,17 +11033,17 @@ "binop": null, "updateContext": null }, - "value": "./search/search.js", - "start": 1727, - "end": 1747, + "value": "./traversal/leftOpenRangeTraversal.js", + "start": 2066, + "end": 2105, "loc": { "start": { - "line": 28, - "column": 32 + "line": 33, + "column": 48 }, "end": { - "line": 28, - "column": 52 + "line": 33, + "column": 87 } } }, @@ -9440,16 +11060,16 @@ "binop": null, "updateContext": null }, - "start": 1747, - "end": 1748, + "start": 2105, + "end": 2106, "loc": { "start": { - "line": 28, - "column": 52 + "line": 33, + "column": 87 }, "end": { - "line": 28, - "column": 53 + "line": 33, + "column": 88 } } }, @@ -9468,15 +11088,15 @@ "updateContext": null }, "value": "export", - "start": 1749, - "end": 1755, + "start": 2107, + "end": 2113, "loc": { "start": { - "line": 29, + "line": 34, "column": 0 }, "end": { - "line": 29, + "line": 34, "column": 6 } } @@ -9493,15 +11113,15 @@ "postfix": false, "binop": null }, - "start": 1756, - "end": 1757, + "start": 2114, + "end": 2115, "loc": { "start": { - "line": 29, + "line": 34, "column": 7 }, "end": { - "line": 29, + "line": 34, "column": 8 } } @@ -9521,15 +11141,15 @@ "updateContext": null }, "value": "default", - "start": 1757, - "end": 1764, + "start": 2115, + "end": 2122, "loc": { "start": { - "line": 29, + "line": 34, "column": 8 }, "end": { - "line": 29, + "line": 34, "column": 15 } } @@ -9547,15 +11167,15 @@ "binop": null }, "value": "as", - "start": 1765, - "end": 1767, + "start": 2123, + "end": 2125, "loc": { "start": { - "line": 29, + "line": 34, "column": 16 }, "end": { - "line": 29, + "line": 34, "column": 18 } } @@ -9572,17 +11192,17 @@ "postfix": false, "binop": null }, - "value": "inordertraversal", - "start": 1768, - "end": 1784, + "value": "rangetraversal", + "start": 2126, + "end": 2140, "loc": { "start": { - "line": 29, + "line": 34, "column": 19 }, "end": { - "line": 29, - "column": 35 + "line": 34, + "column": 33 } } }, @@ -9598,16 +11218,16 @@ "postfix": false, "binop": null }, - "start": 1784, - "end": 1785, + "start": 2140, + "end": 2141, "loc": { "start": { - "line": 29, - "column": 35 + "line": 34, + "column": 33 }, "end": { - "line": 29, - "column": 36 + "line": 34, + "column": 34 } } }, @@ -9624,16 +11244,16 @@ "binop": null }, "value": "from", - "start": 1786, - "end": 1790, + "start": 2142, + "end": 2146, "loc": { "start": { - "line": 29, - "column": 37 + "line": 34, + "column": 35 }, "end": { - "line": 29, - "column": 41 + "line": 34, + "column": 39 } } }, @@ -9650,17 +11270,17 @@ "binop": null, "updateContext": null }, - "value": "./traversal/inordertraversal.js", - "start": 1791, - "end": 1824, + "value": "./traversal/rangetraversal.js", + "start": 2147, + "end": 2178, "loc": { "start": { - "line": 29, - "column": 42 + "line": 34, + "column": 40 }, "end": { - "line": 29, - "column": 75 + "line": 34, + "column": 71 } } }, @@ -9677,16 +11297,16 @@ "binop": null, "updateContext": null }, - "start": 1824, - "end": 1825, + "start": 2178, + "end": 2179, "loc": { "start": { - "line": 29, - "column": 75 + "line": 34, + "column": 71 }, "end": { - "line": 29, - "column": 76 + "line": 34, + "column": 72 } } }, @@ -9705,15 +11325,15 @@ "updateContext": null }, "value": "export", - "start": 1826, - "end": 1832, + "start": 2180, + "end": 2186, "loc": { "start": { - "line": 30, + "line": 35, "column": 0 }, "end": { - "line": 30, + "line": 35, "column": 6 } } @@ -9730,15 +11350,15 @@ "postfix": false, "binop": null }, - "start": 1833, - "end": 1834, + "start": 2187, + "end": 2188, "loc": { "start": { - "line": 30, + "line": 35, "column": 7 }, "end": { - "line": 30, + "line": 35, "column": 8 } } @@ -9758,15 +11378,15 @@ "updateContext": null }, "value": "default", - "start": 1834, - "end": 1841, + "start": 2188, + "end": 2195, "loc": { "start": { - "line": 30, + "line": 35, "column": 8 }, "end": { - "line": 30, + "line": 35, "column": 15 } } @@ -9784,15 +11404,15 @@ "binop": null }, "value": "as", - "start": 1842, - "end": 1844, + "start": 2196, + "end": 2198, "loc": { "start": { - "line": 30, + "line": 35, "column": 16 }, "end": { - "line": 30, + "line": 35, "column": 18 } } @@ -9809,17 +11429,17 @@ "postfix": false, "binop": null }, - "value": "rangetraversal", - "start": 1845, - "end": 1859, + "value": "rightOpenRangeTraversal", + "start": 2199, + "end": 2222, "loc": { "start": { - "line": 30, + "line": 35, "column": 19 }, "end": { - "line": 30, - "column": 33 + "line": 35, + "column": 42 } } }, @@ -9835,16 +11455,16 @@ "postfix": false, "binop": null }, - "start": 1859, - "end": 1860, + "start": 2222, + "end": 2223, "loc": { "start": { - "line": 30, - "column": 33 + "line": 35, + "column": 42 }, "end": { - "line": 30, - "column": 34 + "line": 35, + "column": 43 } } }, @@ -9861,16 +11481,16 @@ "binop": null }, "value": "from", - "start": 1861, - "end": 1865, + "start": 2224, + "end": 2228, "loc": { "start": { - "line": 30, - "column": 35 + "line": 35, + "column": 44 }, "end": { - "line": 30, - "column": 39 + "line": 35, + "column": 48 } } }, @@ -9887,17 +11507,17 @@ "binop": null, "updateContext": null }, - "value": "./traversal/rangetraversal.js", - "start": 1866, - "end": 1897, + "value": "./traversal/rightOpenRangeTraversal.js", + "start": 2229, + "end": 2269, "loc": { "start": { - "line": 30, - "column": 40 + "line": 35, + "column": 49 }, "end": { - "line": 30, - "column": 71 + "line": 35, + "column": 89 } } }, @@ -9914,16 +11534,16 @@ "binop": null, "updateContext": null }, - "start": 1897, - "end": 1898, + "start": 2269, + "end": 2270, "loc": { "start": { - "line": 30, - "column": 71 + "line": 35, + "column": 89 }, "end": { - "line": 30, - "column": 72 + "line": 35, + "column": 90 } } }, @@ -9942,15 +11562,15 @@ "updateContext": null }, "value": "export", - "start": 1899, - "end": 1905, + "start": 2271, + "end": 2277, "loc": { "start": { - "line": 31, + "line": 36, "column": 0 }, "end": { - "line": 31, + "line": 36, "column": 6 } } @@ -9967,15 +11587,15 @@ "postfix": false, "binop": null }, - "start": 1906, - "end": 1907, + "start": 2278, + "end": 2279, "loc": { "start": { - "line": 31, + "line": 36, "column": 7 }, "end": { - "line": 31, + "line": 36, "column": 8 } } @@ -9995,15 +11615,15 @@ "updateContext": null }, "value": "default", - "start": 1907, - "end": 1914, + "start": 2279, + "end": 2286, "loc": { "start": { - "line": 31, + "line": 36, "column": 8 }, "end": { - "line": 31, + "line": 36, "column": 15 } } @@ -10021,15 +11641,15 @@ "binop": null }, "value": "as", - "start": 1915, - "end": 1917, + "start": 2287, + "end": 2289, "loc": { "start": { - "line": 31, + "line": 36, "column": 16 }, "end": { - "line": 31, + "line": 36, "column": 18 } } @@ -10047,15 +11667,15 @@ "binop": null }, "value": "Node", - "start": 1918, - "end": 1922, + "start": 2290, + "end": 2294, "loc": { "start": { - "line": 31, + "line": 36, "column": 19 }, "end": { - "line": 31, + "line": 36, "column": 23 } } @@ -10072,15 +11692,15 @@ "postfix": false, "binop": null }, - "start": 1922, - "end": 1923, + "start": 2294, + "end": 2295, "loc": { "start": { - "line": 31, + "line": 36, "column": 23 }, "end": { - "line": 31, + "line": 36, "column": 24 } } @@ -10098,15 +11718,15 @@ "binop": null }, "value": "from", - "start": 1924, - "end": 1928, + "start": 2296, + "end": 2300, "loc": { "start": { - "line": 31, + "line": 36, "column": 25 }, "end": { - "line": 31, + "line": 36, "column": 29 } } @@ -10125,15 +11745,15 @@ "updateContext": null }, "value": "./types/Node.js", - "start": 1929, - "end": 1946, + "start": 2301, + "end": 2318, "loc": { "start": { - "line": 31, + "line": 36, "column": 30 }, "end": { - "line": 31, + "line": 36, "column": 47 } } @@ -10151,15 +11771,15 @@ "binop": null, "updateContext": null }, - "start": 1946, - "end": 1947, + "start": 2318, + "end": 2319, "loc": { "start": { - "line": 31, + "line": 36, "column": 47 }, "end": { - "line": 31, + "line": 36, "column": 48 } } @@ -10179,15 +11799,15 @@ "updateContext": null }, "value": "export", - "start": 1948, - "end": 1954, + "start": 2320, + "end": 2326, "loc": { "start": { - "line": 32, + "line": 37, "column": 0 }, "end": { - "line": 32, + "line": 37, "column": 6 } } @@ -10204,15 +11824,15 @@ "postfix": false, "binop": null }, - "start": 1955, - "end": 1956, + "start": 2327, + "end": 2328, "loc": { "start": { - "line": 32, + "line": 37, "column": 7 }, "end": { - "line": 32, + "line": 37, "column": 8 } } @@ -10232,15 +11852,15 @@ "updateContext": null }, "value": "default", - "start": 1956, - "end": 1963, + "start": 2328, + "end": 2335, "loc": { "start": { - "line": 32, + "line": 37, "column": 8 }, "end": { - "line": 32, + "line": 37, "column": 15 } } @@ -10258,15 +11878,15 @@ "binop": null }, "value": "as", - "start": 1964, - "end": 1966, + "start": 2336, + "end": 2338, "loc": { "start": { - "line": 32, + "line": 37, "column": 16 }, "end": { - "line": 32, + "line": 37, "column": 18 } } @@ -10284,15 +11904,15 @@ "binop": null }, "value": "RedBlackTree", - "start": 1967, - "end": 1979, + "start": 2339, + "end": 2351, "loc": { "start": { - "line": 32, + "line": 37, "column": 19 }, "end": { - "line": 32, + "line": 37, "column": 31 } } @@ -10309,15 +11929,15 @@ "postfix": false, "binop": null }, - "start": 1979, - "end": 1980, + "start": 2351, + "end": 2352, "loc": { "start": { - "line": 32, + "line": 37, "column": 31 }, "end": { - "line": 32, + "line": 37, "column": 32 } } @@ -10335,15 +11955,15 @@ "binop": null }, "value": "from", - "start": 1981, - "end": 1985, + "start": 2353, + "end": 2357, "loc": { "start": { - "line": 32, + "line": 37, "column": 33 }, "end": { - "line": 32, + "line": 37, "column": 37 } } @@ -10362,15 +11982,15 @@ "updateContext": null }, "value": "./types/RedBlackTree.js", - "start": 1986, - "end": 2011, + "start": 2358, + "end": 2383, "loc": { "start": { - "line": 32, + "line": 37, "column": 38 }, "end": { - "line": 32, + "line": 37, "column": 63 } } @@ -10388,15 +12008,15 @@ "binop": null, "updateContext": null }, - "start": 2011, - "end": 2012, + "start": 2383, + "end": 2384, "loc": { "start": { - "line": 32, + "line": 37, "column": 63 }, "end": { - "line": 32, + "line": 37, "column": 64 } } @@ -10414,15 +12034,15 @@ "binop": null, "updateContext": null }, - "start": 2013, - "end": 2013, + "start": 2385, + "end": 2385, "loc": { "start": { - "line": 33, + "line": 38, "column": 0 }, "end": { - "line": 33, + "line": 38, "column": 0 } } diff --git a/ast/source/insertion/insert_case0.js.json b/ast/source/insertion/insert_case0.js.json index 5926303..28555b1 100644 --- a/ast/source/insertion/insert_case0.js.json +++ b/ast/source/insertion/insert_case0.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 671, + "end": 745, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 31, + "line": 36, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 671, + "end": 745, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 31, + "line": 36, "column": 0 } }, @@ -375,16 +375,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 187, - "end": 299, + "end": 351, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -393,44 +393,44 @@ }, { "type": "Identifier", - "start": 300, - "end": 640, + "start": 352, + "end": 714, "loc": { "start": { - "line": 14, + "line": 15, "column": 0 }, "end": { - "line": 28, + "line": 33, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 306, - "end": 639, + "start": 358, + "end": 713, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 28, + "line": 33, "column": 1 } }, "id": { "type": "Identifier", - "start": 306, - "end": 318, + "start": 358, + "end": 370, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "insert_case0" @@ -440,15 +440,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 321, - "end": 639, + "start": 373, + "end": 713, "loc": { "start": { - "line": 14, + "line": 15, "column": 21 }, "end": { - "line": 28, + "line": 33, "column": 1 } }, @@ -459,15 +459,15 @@ "params": [ { "type": "Identifier", - "start": 322, - "end": 323, + "start": 374, + "end": 375, "loc": { "start": { - "line": 14, + "line": 15, "column": 22 }, "end": { - "line": 14, + "line": 15, "column": 23 }, "identifierName": "n" @@ -477,58 +477,58 @@ ], "body": { "type": "BlockStatement", - "start": 328, - "end": 639, + "start": 380, + "end": 713, "loc": { "start": { - "line": 14, + "line": 15, "column": 28 }, "end": { - "line": 28, + "line": 33, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 331, - "end": 357, + "start": 383, + "end": 409, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 331, - "end": 356, + "start": 383, + "end": 408, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 26 } }, "callee": { "type": "Identifier", - "start": 331, - "end": 337, + "start": 383, + "end": 389, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 7 }, "identifierName": "assert" @@ -538,29 +538,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 338, - "end": 355, + "start": 390, + "end": 407, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 25 } }, "left": { "type": "Identifier", - "start": 338, - "end": 339, + "start": 390, + "end": 391, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 9 }, "identifierName": "n" @@ -570,15 +570,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 351, - "end": 355, + "start": 403, + "end": 407, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 25 }, "identifierName": "Node" @@ -591,43 +591,43 @@ }, { "type": "ExpressionStatement", - "start": 359, - "end": 384, + "start": 411, + "end": 436, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 359, - "end": 383, + "start": 411, + "end": 435, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 25 } }, "callee": { "type": "Identifier", - "start": 359, - "end": 365, + "start": 411, + "end": 417, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 }, "identifierName": "assert" @@ -637,43 +637,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 366, - "end": 382, + "start": 418, + "end": 434, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 366, - "end": 374, + "start": 418, + "end": 426, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 16 } }, "object": { "type": "Identifier", - "start": 366, - "end": 367, + "start": 418, + "end": 419, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 }, "identifierName": "n" @@ -682,15 +682,15 @@ }, "property": { "type": "Identifier", - "start": 368, - "end": 374, + "start": 420, + "end": 426, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 16 }, "identifierName": "_color" @@ -702,15 +702,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 379, - "end": 382, + "start": 431, + "end": 434, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 24 }, "identifierName": "RED" @@ -723,43 +723,43 @@ }, { "type": "ExpressionStatement", - "start": 386, - "end": 418, + "start": 438, + "end": 470, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 386, - "end": 417, + "start": 438, + "end": 469, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 32 } }, "callee": { "type": "Identifier", - "start": 386, - "end": 392, + "start": 438, + "end": 444, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 7 }, "identifierName": "assert" @@ -769,57 +769,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 393, - "end": 416, + "start": 445, + "end": 468, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 393, - "end": 406, + "start": 445, + "end": 458, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 21 } }, "object": { "type": "MemberExpression", - "start": 393, - "end": 399, + "start": 445, + "end": 451, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 14 } }, "object": { "type": "Identifier", - "start": 393, - "end": 394, + "start": 445, + "end": 446, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 9 }, "identifierName": "n" @@ -828,15 +828,15 @@ }, "property": { "type": "Identifier", - "start": 395, - "end": 399, + "start": 447, + "end": 451, "loc": { "start": { - "line": 17, + "line": 18, "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 14 }, "identifierName": "left" @@ -847,15 +847,15 @@ }, "property": { "type": "Identifier", - "start": 400, - "end": 406, + "start": 452, + "end": 458, "loc": { "start": { - "line": 17, + "line": 18, "column": 15 }, "end": { - "line": 17, + "line": 18, "column": 21 }, "identifierName": "_color" @@ -867,15 +867,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 411, - "end": 416, + "start": 463, + "end": 468, "loc": { "start": { - "line": 17, + "line": 18, "column": 26 }, "end": { - "line": 17, + "line": 18, "column": 31 }, "identifierName": "BLACK" @@ -888,43 +888,43 @@ }, { "type": "ExpressionStatement", - "start": 420, - "end": 453, + "start": 472, + "end": 505, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 34 } }, "expression": { "type": "CallExpression", - "start": 420, - "end": 452, + "start": 472, + "end": 504, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 33 } }, "callee": { "type": "Identifier", - "start": 420, - "end": 426, + "start": 472, + "end": 478, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 7 }, "identifierName": "assert" @@ -934,57 +934,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 427, - "end": 451, + "start": 479, + "end": 503, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 32 } }, "left": { "type": "MemberExpression", - "start": 427, - "end": 441, + "start": 479, + "end": 493, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 22 } }, "object": { "type": "MemberExpression", - "start": 427, - "end": 434, + "start": 479, + "end": 486, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 15 } }, "object": { "type": "Identifier", - "start": 427, - "end": 428, + "start": 479, + "end": 480, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 9 }, "identifierName": "n" @@ -993,15 +993,15 @@ }, "property": { "type": "Identifier", - "start": 429, - "end": 434, + "start": 481, + "end": 486, "loc": { "start": { - "line": 18, + "line": 19, "column": 10 }, "end": { - "line": 18, + "line": 19, "column": 15 }, "identifierName": "right" @@ -1012,15 +1012,15 @@ }, "property": { "type": "Identifier", - "start": 435, - "end": 441, + "start": 487, + "end": 493, "loc": { "start": { - "line": 18, + "line": 19, "column": 16 }, "end": { - "line": 18, + "line": 19, "column": 22 }, "identifierName": "_color" @@ -1032,15 +1032,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 446, - "end": 451, + "start": 498, + "end": 503, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 32 }, "identifierName": "BLACK" @@ -1054,15 +1054,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "start": 507, + "end": 624, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 4 } } @@ -1071,57 +1071,57 @@ }, { "type": "IfStatement", - "start": 574, - "end": 637, + "start": 626, + "end": 685, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 27, - "column": 22 + "line": 30, + "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 578, - "end": 595, + "start": 630, + "end": 647, "loc": { "start": { - "line": 26, + "line": 27, "column": 5 }, "end": { - "line": 26, + "line": 27, "column": 22 } }, "left": { "type": "MemberExpression", - "start": 578, - "end": 586, + "start": 630, + "end": 638, "loc": { "start": { - "line": 26, + "line": 27, "column": 5 }, "end": { - "line": 26, + "line": 27, "column": 13 } }, "object": { "type": "Identifier", - "start": 578, - "end": 579, + "start": 630, + "end": 631, "loc": { "start": { - "line": 26, + "line": 27, "column": 5 }, "end": { - "line": 26, + "line": 27, "column": 6 }, "identifierName": "n" @@ -1131,15 +1131,15 @@ }, "property": { "type": "Identifier", - "start": 580, - "end": 586, + "start": 632, + "end": 638, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 13 }, "identifierName": "parent" @@ -1152,15 +1152,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 591, - "end": 595, + "start": 643, + "end": 647, "loc": { "start": { - "line": 26, + "line": 27, "column": 18 }, "end": { - "line": 26, + "line": 27, "column": 22 } } @@ -1168,187 +1168,238 @@ "leadingComments": null }, "consequent": { - "type": "ExpressionStatement", - "start": 597, - "end": 614, + "type": "BlockStatement", + "start": 649, + "end": 685, "loc": { "start": { - "line": 26, + "line": 27, "column": 24 }, "end": { - "line": 26, - "column": 41 + "line": 30, + "column": 2 } }, - "expression": { - "type": "AssignmentExpression", - "start": 597, - "end": 613, - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 40 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 597, - "end": 605, + "body": [ + { + "type": "ExpressionStatement", + "start": 653, + "end": 670, "loc": { "start": { - "line": 26, - "column": 24 + "line": 28, + "column": 2 }, "end": { - "line": 26, - "column": 32 + "line": 28, + "column": 19 } }, - "object": { - "type": "Identifier", - "start": 597, - "end": 598, + "expression": { + "type": "AssignmentExpression", + "start": 653, + "end": 669, "loc": { "start": { - "line": 26, - "column": 24 + "line": 28, + "column": 2 }, "end": { - "line": 26, - "column": 25 - }, - "identifierName": "n" + "line": 28, + "column": 18 + } }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 599, - "end": 605, - "loc": { - "start": { - "line": 26, - "column": 26 + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 653, + "end": 661, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 10 + } }, - "end": { - "line": 26, - "column": 32 + "object": { + "type": "Identifier", + "start": 653, + "end": 654, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 655, + "end": 661, + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" }, - "identifierName": "_color" + "computed": false }, - "name": "_color" - }, - "computed": false + "right": { + "type": "Identifier", + "start": 664, + "end": 669, + "loc": { + "start": { + "line": 28, + "column": 13 + }, + "end": { + "line": 28, + "column": 18 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } }, - "right": { - "type": "Identifier", - "start": 608, - "end": 613, + { + "type": "ReturnStatement", + "start": 673, + "end": 682, "loc": { "start": { - "line": 26, - "column": 35 + "line": 29, + "column": 2 }, "end": { - "line": 26, - "column": 40 - }, - "identifierName": "BLACK" + "line": 29, + "column": 11 + } }, - "name": "BLACK" + "argument": { + "type": "Identifier", + "start": 680, + "end": 681, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + }, + "identifierName": "n" + }, + "name": "n" + } } - } + ], + "directives": [] }, - "alternate": { - "type": "ExpressionStatement", - "start": 621, - "end": 637, - "loc": { - "start": { - "line": 27, - "column": 6 - }, - "end": { - "line": 27, - "column": 22 - } - }, - "expression": { - "type": "CallExpression", - "start": 621, - "end": 636, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", + "start": 507, + "end": 624, "loc": { "start": { - "line": 27, - "column": 6 + "line": 20, + "column": 1 }, "end": { - "line": 27, - "column": 21 + "line": 26, + "column": 4 } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 688, + "end": 711, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 24 + } + }, + "argument": { + "type": "CallExpression", + "start": 695, + "end": 710, + "loc": { + "start": { + "line": 32, + "column": 8 }, - "callee": { + "end": { + "line": 32, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 695, + "end": 707, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 20 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + }, + "arguments": [ + { "type": "Identifier", - "start": 621, - "end": 633, + "start": 708, + "end": 709, "loc": { "start": { - "line": 27, - "column": 6 + "line": 32, + "column": 21 }, "end": { - "line": 27, - "column": 18 - }, - "identifierName": "insert_case1" - }, - "name": "insert_case1" - }, - "arguments": [ - { - "type": "Identifier", - "start": 634, - "end": 635, - "loc": { - "start": { - "line": 27, - "column": 19 - }, - "end": { - "line": 27, - "column": 20 - }, - "identifierName": "n" + "line": 32, + "column": 22 }, - "name": "n" - } - ] - } - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, - "loc": { - "start": { - "line": 19, - "column": 1 + "identifierName": "n" }, - "end": { - "line": 25, - "column": 4 - } + "name": "n" } - } - ] + ] + } } ], "directives": [] @@ -1364,29 +1415,29 @@ }, { "type": "Identifier", - "start": 642, - "end": 670, + "start": 716, + "end": 744, "loc": { "start": { - "line": 30, + "line": 35, "column": 0 }, "end": { - "line": 30, + "line": 35, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 657, - "end": 669, + "start": 731, + "end": 743, "loc": { "start": { - "line": 30, + "line": 35, "column": 15 }, "end": { - "line": 30, + "line": 35, "column": 27 }, "identifierName": "insert_case0" @@ -1399,58 +1450,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 642, - "end": 670, + "start": 716, + "end": 744, "loc": { "start": { - "line": 30, + "line": 35, "column": 0 }, "end": { - "line": 30, + "line": 35, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 300, - "end": 640, + "start": 352, + "end": 714, "loc": { "start": { - "line": 14, + "line": 15, "column": 0 }, "end": { - "line": 28, + "line": 33, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 306, - "end": 639, + "start": 358, + "end": 713, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 28, + "line": 33, "column": 1 } }, "id": { "type": "Identifier", - "start": 306, - "end": 318, + "start": 358, + "end": 370, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "insert_case0" @@ -1460,29 +1511,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 321, - "end": 639, + "start": 373, + "end": 713, "loc": { "start": { - "line": 14, + "line": 15, "column": 21 }, "end": { - "line": 28, + "line": 33, "column": 1 } }, "id": { "type": "Identifier", - "start": 306, - "end": 318, + "start": 358, + "end": 370, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 }, "identifierName": "insert_case0" @@ -1496,15 +1547,15 @@ "params": [ { "type": "Identifier", - "start": 322, - "end": 323, + "start": 374, + "end": 375, "loc": { "start": { - "line": 14, + "line": 15, "column": 22 }, "end": { - "line": 14, + "line": 15, "column": 23 }, "identifierName": "n" @@ -1514,58 +1565,58 @@ ], "body": { "type": "BlockStatement", - "start": 328, - "end": 639, + "start": 380, + "end": 713, "loc": { "start": { - "line": 14, + "line": 15, "column": 28 }, "end": { - "line": 28, + "line": 33, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 331, - "end": 357, + "start": 383, + "end": 409, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 331, - "end": 356, + "start": 383, + "end": 408, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 26 } }, "callee": { "type": "Identifier", - "start": 331, - "end": 337, + "start": 383, + "end": 389, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 7 }, "identifierName": "assert" @@ -1575,29 +1626,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 338, - "end": 355, + "start": 390, + "end": 407, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 25 } }, "left": { "type": "Identifier", - "start": 338, - "end": 339, + "start": 390, + "end": 391, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 9 }, "identifierName": "n" @@ -1607,15 +1658,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 351, - "end": 355, + "start": 403, + "end": 407, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 25 }, "identifierName": "Node" @@ -1628,43 +1679,43 @@ }, { "type": "ExpressionStatement", - "start": 359, - "end": 384, + "start": 411, + "end": 436, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 359, - "end": 383, + "start": 411, + "end": 435, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 25 } }, "callee": { "type": "Identifier", - "start": 359, - "end": 365, + "start": 411, + "end": 417, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 }, "identifierName": "assert" @@ -1674,43 +1725,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 366, - "end": 382, + "start": 418, + "end": 434, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 366, - "end": 374, + "start": 418, + "end": 426, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 16 } }, "object": { "type": "Identifier", - "start": 366, - "end": 367, + "start": 418, + "end": 419, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 }, "identifierName": "n" @@ -1719,15 +1770,15 @@ }, "property": { "type": "Identifier", - "start": 368, - "end": 374, + "start": 420, + "end": 426, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 16 }, "identifierName": "_color" @@ -1739,15 +1790,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 379, - "end": 382, + "start": 431, + "end": 434, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 24 }, "identifierName": "RED" @@ -1760,43 +1811,43 @@ }, { "type": "ExpressionStatement", - "start": 386, - "end": 418, + "start": 438, + "end": 470, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 386, - "end": 417, + "start": 438, + "end": 469, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 32 } }, "callee": { "type": "Identifier", - "start": 386, - "end": 392, + "start": 438, + "end": 444, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 7 }, "identifierName": "assert" @@ -1806,57 +1857,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 393, - "end": 416, + "start": 445, + "end": 468, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 393, - "end": 406, + "start": 445, + "end": 458, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 21 } }, "object": { "type": "MemberExpression", - "start": 393, - "end": 399, + "start": 445, + "end": 451, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 14 } }, "object": { "type": "Identifier", - "start": 393, - "end": 394, + "start": 445, + "end": 446, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 9 }, "identifierName": "n" @@ -1865,15 +1916,15 @@ }, "property": { "type": "Identifier", - "start": 395, - "end": 399, + "start": 447, + "end": 451, "loc": { "start": { - "line": 17, + "line": 18, "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 14 }, "identifierName": "left" @@ -1884,15 +1935,15 @@ }, "property": { "type": "Identifier", - "start": 400, - "end": 406, + "start": 452, + "end": 458, "loc": { "start": { - "line": 17, + "line": 18, "column": 15 }, "end": { - "line": 17, + "line": 18, "column": 21 }, "identifierName": "_color" @@ -1904,15 +1955,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 411, - "end": 416, + "start": 463, + "end": 468, "loc": { "start": { - "line": 17, + "line": 18, "column": 26 }, "end": { - "line": 17, + "line": 18, "column": 31 }, "identifierName": "BLACK" @@ -1925,43 +1976,43 @@ }, { "type": "ExpressionStatement", - "start": 420, - "end": 453, + "start": 472, + "end": 505, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 34 } }, "expression": { "type": "CallExpression", - "start": 420, - "end": 452, + "start": 472, + "end": 504, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 33 } }, "callee": { "type": "Identifier", - "start": 420, - "end": 426, + "start": 472, + "end": 478, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 7 }, "identifierName": "assert" @@ -1971,57 +2022,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 427, - "end": 451, + "start": 479, + "end": 503, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 32 } }, "left": { "type": "MemberExpression", - "start": 427, - "end": 441, + "start": 479, + "end": 493, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 22 } }, "object": { "type": "MemberExpression", - "start": 427, - "end": 434, + "start": 479, + "end": 486, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 15 } }, "object": { "type": "Identifier", - "start": 427, - "end": 428, + "start": 479, + "end": 480, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 9 }, "identifierName": "n" @@ -2030,15 +2081,15 @@ }, "property": { "type": "Identifier", - "start": 429, - "end": 434, + "start": 481, + "end": 486, "loc": { "start": { - "line": 18, + "line": 19, "column": 10 }, "end": { - "line": 18, + "line": 19, "column": 15 }, "identifierName": "right" @@ -2049,15 +2100,15 @@ }, "property": { "type": "Identifier", - "start": 435, - "end": 441, + "start": 487, + "end": 493, "loc": { "start": { - "line": 18, + "line": 19, "column": 16 }, "end": { - "line": 18, + "line": 19, "column": 22 }, "identifierName": "_color" @@ -2069,15 +2120,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 446, - "end": 451, + "start": 498, + "end": 503, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 32 }, "identifierName": "BLACK" @@ -2091,15 +2142,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "start": 507, + "end": 624, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 4 } } @@ -2108,57 +2159,57 @@ }, { "type": "IfStatement", - "start": 574, - "end": 637, + "start": 626, + "end": 685, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 27, - "column": 22 + "line": 30, + "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 578, - "end": 595, + "start": 630, + "end": 647, "loc": { "start": { - "line": 26, + "line": 27, "column": 5 }, "end": { - "line": 26, + "line": 27, "column": 22 } }, "left": { "type": "MemberExpression", - "start": 578, - "end": 586, + "start": 630, + "end": 638, "loc": { "start": { - "line": 26, + "line": 27, "column": 5 }, "end": { - "line": 26, + "line": 27, "column": 13 } }, "object": { "type": "Identifier", - "start": 578, - "end": 579, + "start": 630, + "end": 631, "loc": { "start": { - "line": 26, + "line": 27, "column": 5 }, "end": { - "line": 26, + "line": 27, "column": 6 }, "identifierName": "n" @@ -2168,15 +2219,15 @@ }, "property": { "type": "Identifier", - "start": 580, - "end": 586, + "start": 632, + "end": 638, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 13 }, "identifierName": "parent" @@ -2189,15 +2240,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 591, - "end": 595, + "start": 643, + "end": 647, "loc": { "start": { - "line": 26, + "line": 27, "column": 18 }, "end": { - "line": 26, + "line": 27, "column": 22 } } @@ -2205,187 +2256,238 @@ "leadingComments": null }, "consequent": { - "type": "ExpressionStatement", - "start": 597, - "end": 614, + "type": "BlockStatement", + "start": 649, + "end": 685, "loc": { "start": { - "line": 26, + "line": 27, "column": 24 }, "end": { - "line": 26, - "column": 41 + "line": 30, + "column": 2 } }, - "expression": { - "type": "AssignmentExpression", - "start": 597, - "end": 613, - "loc": { - "start": { - "line": 26, - "column": 24 - }, - "end": { - "line": 26, - "column": 40 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 597, - "end": 605, + "body": [ + { + "type": "ExpressionStatement", + "start": 653, + "end": 670, "loc": { "start": { - "line": 26, - "column": 24 + "line": 28, + "column": 2 }, "end": { - "line": 26, - "column": 32 + "line": 28, + "column": 19 } }, - "object": { - "type": "Identifier", - "start": 597, - "end": 598, + "expression": { + "type": "AssignmentExpression", + "start": 653, + "end": 669, "loc": { "start": { - "line": 26, - "column": 24 + "line": 28, + "column": 2 }, "end": { - "line": 26, - "column": 25 - }, - "identifierName": "n" + "line": 28, + "column": 18 + } }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 599, - "end": 605, - "loc": { - "start": { - "line": 26, - "column": 26 - }, - "end": { - "line": 26, - "column": 32 + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 653, + "end": 661, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 10 + } }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 608, - "end": 613, - "loc": { - "start": { - "line": 26, - "column": 35 - }, - "end": { - "line": 26, - "column": 40 + "object": { + "type": "Identifier", + "start": 653, + "end": 654, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 655, + "end": 661, + "loc": { + "start": { + "line": 28, + "column": 4 + }, + "end": { + "line": 28, + "column": 10 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false }, - "identifierName": "BLACK" - }, - "name": "BLACK" - } - } - }, - "alternate": { - "type": "ExpressionStatement", - "start": 621, - "end": 637, - "loc": { - "start": { - "line": 27, - "column": 6 - }, - "end": { - "line": 27, - "column": 22 - } - }, - "expression": { - "type": "CallExpression", - "start": 621, - "end": 636, - "loc": { - "start": { - "line": 27, - "column": 6 - }, - "end": { - "line": 27, - "column": 21 + "right": { + "type": "Identifier", + "start": 664, + "end": 669, + "loc": { + "start": { + "line": 28, + "column": 13 + }, + "end": { + "line": 28, + "column": 18 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } } }, - "callee": { - "type": "Identifier", - "start": 621, - "end": 633, + { + "type": "ReturnStatement", + "start": 673, + "end": 682, "loc": { "start": { - "line": 27, - "column": 6 + "line": 29, + "column": 2 }, "end": { - "line": 27, - "column": 18 - }, - "identifierName": "insert_case1" + "line": 29, + "column": 11 + } }, - "name": "insert_case1" - }, - "arguments": [ - { + "argument": { "type": "Identifier", - "start": 634, - "end": 635, + "start": 680, + "end": 681, "loc": { "start": { - "line": 27, - "column": 19 + "line": 29, + "column": 9 }, "end": { - "line": 27, - "column": 20 + "line": 29, + "column": 10 }, "identifierName": "n" }, "name": "n" } - ] - } + } + ], + "directives": [] }, + "alternate": null, "leadingComments": [ { "type": "CommentBlock", "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "start": 507, + "end": 624, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 4 } } } ] + }, + { + "type": "ReturnStatement", + "start": 688, + "end": 711, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 24 + } + }, + "argument": { + "type": "CallExpression", + "start": 695, + "end": 710, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 695, + "end": 707, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 20 + }, + "identifierName": "insert_case1" + }, + "name": "insert_case1" + }, + "arguments": [ + { + "type": "Identifier", + "start": 708, + "end": 709, + "loc": { + "start": { + "line": 32, + "column": 21 + }, + "end": { + "line": 32, + "column": 22 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + } } ], "directives": [] @@ -2398,16 +2500,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 187, - "end": 299, + "end": 351, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -2422,16 +2524,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 187, - "end": 299, + "end": 351, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -2439,15 +2541,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "start": 507, + "end": 624, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 4 } } @@ -3121,16 +3223,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 187, - "end": 299, + "end": 351, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 13, + "line": 14, "column": 3 } } @@ -3150,15 +3252,15 @@ "updateContext": null }, "value": "const", - "start": 300, - "end": 305, + "start": 352, + "end": 357, "loc": { "start": { - "line": 14, + "line": 15, "column": 0 }, "end": { - "line": 14, + "line": 15, "column": 5 } } @@ -3176,15 +3278,15 @@ "binop": null }, "value": "insert_case0", - "start": 306, - "end": 318, + "start": 358, + "end": 370, "loc": { "start": { - "line": 14, + "line": 15, "column": 6 }, "end": { - "line": 14, + "line": 15, "column": 18 } } @@ -3203,15 +3305,15 @@ "updateContext": null }, "value": "=", - "start": 319, - "end": 320, + "start": 371, + "end": 372, "loc": { "start": { - "line": 14, + "line": 15, "column": 19 }, "end": { - "line": 14, + "line": 15, "column": 20 } } @@ -3228,15 +3330,15 @@ "postfix": false, "binop": null }, - "start": 321, - "end": 322, + "start": 373, + "end": 374, "loc": { "start": { - "line": 14, + "line": 15, "column": 21 }, "end": { - "line": 14, + "line": 15, "column": 22 } } @@ -3254,15 +3356,15 @@ "binop": null }, "value": "n", - "start": 322, - "end": 323, + "start": 374, + "end": 375, "loc": { "start": { - "line": 14, + "line": 15, "column": 22 }, "end": { - "line": 14, + "line": 15, "column": 23 } } @@ -3279,15 +3381,15 @@ "postfix": false, "binop": null }, - "start": 323, - "end": 324, + "start": 375, + "end": 376, "loc": { "start": { - "line": 14, + "line": 15, "column": 23 }, "end": { - "line": 14, + "line": 15, "column": 24 } } @@ -3305,15 +3407,15 @@ "binop": null, "updateContext": null }, - "start": 325, - "end": 327, + "start": 377, + "end": 379, "loc": { "start": { - "line": 14, + "line": 15, "column": 25 }, "end": { - "line": 14, + "line": 15, "column": 27 } } @@ -3330,15 +3432,15 @@ "postfix": false, "binop": null }, - "start": 328, - "end": 329, + "start": 380, + "end": 381, "loc": { "start": { - "line": 14, + "line": 15, "column": 28 }, "end": { - "line": 14, + "line": 15, "column": 29 } } @@ -3356,15 +3458,15 @@ "binop": null }, "value": "assert", - "start": 331, - "end": 337, + "start": 383, + "end": 389, "loc": { "start": { - "line": 15, + "line": 16, "column": 1 }, "end": { - "line": 15, + "line": 16, "column": 7 } } @@ -3381,15 +3483,15 @@ "postfix": false, "binop": null }, - "start": 337, - "end": 338, + "start": 389, + "end": 390, "loc": { "start": { - "line": 15, + "line": 16, "column": 7 }, "end": { - "line": 15, + "line": 16, "column": 8 } } @@ -3407,15 +3509,15 @@ "binop": null }, "value": "n", - "start": 338, - "end": 339, + "start": 390, + "end": 391, "loc": { "start": { - "line": 15, + "line": 16, "column": 8 }, "end": { - "line": 15, + "line": 16, "column": 9 } } @@ -3435,15 +3537,15 @@ "updateContext": null }, "value": "instanceof", - "start": 340, - "end": 350, + "start": 392, + "end": 402, "loc": { "start": { - "line": 15, + "line": 16, "column": 10 }, "end": { - "line": 15, + "line": 16, "column": 20 } } @@ -3461,15 +3563,15 @@ "binop": null }, "value": "Node", - "start": 351, - "end": 355, + "start": 403, + "end": 407, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 25 } } @@ -3486,15 +3588,15 @@ "postfix": false, "binop": null }, - "start": 355, - "end": 356, + "start": 407, + "end": 408, "loc": { "start": { - "line": 15, + "line": 16, "column": 25 }, "end": { - "line": 15, + "line": 16, "column": 26 } } @@ -3512,15 +3614,15 @@ "binop": null, "updateContext": null }, - "start": 356, - "end": 357, + "start": 408, + "end": 409, "loc": { "start": { - "line": 15, + "line": 16, "column": 26 }, "end": { - "line": 15, + "line": 16, "column": 27 } } @@ -3538,15 +3640,15 @@ "binop": null }, "value": "assert", - "start": 359, - "end": 365, + "start": 411, + "end": 417, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 } } @@ -3563,15 +3665,15 @@ "postfix": false, "binop": null }, - "start": 365, - "end": 366, + "start": 417, + "end": 418, "loc": { "start": { - "line": 16, + "line": 17, "column": 7 }, "end": { - "line": 16, + "line": 17, "column": 8 } } @@ -3589,15 +3691,15 @@ "binop": null }, "value": "n", - "start": 366, - "end": 367, + "start": 418, + "end": 419, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 } } @@ -3615,15 +3717,15 @@ "binop": null, "updateContext": null }, - "start": 367, - "end": 368, + "start": 419, + "end": 420, "loc": { "start": { - "line": 16, + "line": 17, "column": 9 }, "end": { - "line": 16, + "line": 17, "column": 10 } } @@ -3641,15 +3743,15 @@ "binop": null }, "value": "_color", - "start": 368, - "end": 374, + "start": 420, + "end": 426, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 16 } } @@ -3668,15 +3770,15 @@ "updateContext": null }, "value": "===", - "start": 375, - "end": 378, + "start": 427, + "end": 430, "loc": { "start": { - "line": 16, + "line": 17, "column": 17 }, "end": { - "line": 16, + "line": 17, "column": 20 } } @@ -3694,15 +3796,15 @@ "binop": null }, "value": "RED", - "start": 379, - "end": 382, + "start": 431, + "end": 434, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 24 } } @@ -3719,15 +3821,15 @@ "postfix": false, "binop": null }, - "start": 382, - "end": 383, + "start": 434, + "end": 435, "loc": { "start": { - "line": 16, + "line": 17, "column": 24 }, "end": { - "line": 16, + "line": 17, "column": 25 } } @@ -3745,15 +3847,15 @@ "binop": null, "updateContext": null }, - "start": 383, - "end": 384, + "start": 435, + "end": 436, "loc": { "start": { - "line": 16, + "line": 17, "column": 25 }, "end": { - "line": 16, + "line": 17, "column": 26 } } @@ -3771,15 +3873,15 @@ "binop": null }, "value": "assert", - "start": 386, - "end": 392, + "start": 438, + "end": 444, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 7 } } @@ -3796,15 +3898,15 @@ "postfix": false, "binop": null }, - "start": 392, - "end": 393, + "start": 444, + "end": 445, "loc": { "start": { - "line": 17, + "line": 18, "column": 7 }, "end": { - "line": 17, + "line": 18, "column": 8 } } @@ -3822,15 +3924,15 @@ "binop": null }, "value": "n", - "start": 393, - "end": 394, + "start": 445, + "end": 446, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 9 } } @@ -3848,15 +3950,15 @@ "binop": null, "updateContext": null }, - "start": 394, - "end": 395, + "start": 446, + "end": 447, "loc": { "start": { - "line": 17, + "line": 18, "column": 9 }, "end": { - "line": 17, + "line": 18, "column": 10 } } @@ -3874,15 +3976,15 @@ "binop": null }, "value": "left", - "start": 395, - "end": 399, + "start": 447, + "end": 451, "loc": { "start": { - "line": 17, + "line": 18, "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 14 } } @@ -3900,15 +4002,15 @@ "binop": null, "updateContext": null }, - "start": 399, - "end": 400, + "start": 451, + "end": 452, "loc": { "start": { - "line": 17, + "line": 18, "column": 14 }, "end": { - "line": 17, + "line": 18, "column": 15 } } @@ -3926,15 +4028,15 @@ "binop": null }, "value": "_color", - "start": 400, - "end": 406, + "start": 452, + "end": 458, "loc": { "start": { - "line": 17, + "line": 18, "column": 15 }, "end": { - "line": 17, + "line": 18, "column": 21 } } @@ -3953,15 +4055,15 @@ "updateContext": null }, "value": "===", - "start": 407, - "end": 410, + "start": 459, + "end": 462, "loc": { "start": { - "line": 17, + "line": 18, "column": 22 }, "end": { - "line": 17, + "line": 18, "column": 25 } } @@ -3979,15 +4081,15 @@ "binop": null }, "value": "BLACK", - "start": 411, - "end": 416, + "start": 463, + "end": 468, "loc": { "start": { - "line": 17, + "line": 18, "column": 26 }, "end": { - "line": 17, + "line": 18, "column": 31 } } @@ -4004,15 +4106,15 @@ "postfix": false, "binop": null }, - "start": 416, - "end": 417, + "start": 468, + "end": 469, "loc": { "start": { - "line": 17, + "line": 18, "column": 31 }, "end": { - "line": 17, + "line": 18, "column": 32 } } @@ -4030,15 +4132,15 @@ "binop": null, "updateContext": null }, - "start": 417, - "end": 418, + "start": 469, + "end": 470, "loc": { "start": { - "line": 17, + "line": 18, "column": 32 }, "end": { - "line": 17, + "line": 18, "column": 33 } } @@ -4056,15 +4158,15 @@ "binop": null }, "value": "assert", - "start": 420, - "end": 426, + "start": 472, + "end": 478, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 7 } } @@ -4081,15 +4183,15 @@ "postfix": false, "binop": null }, - "start": 426, - "end": 427, + "start": 478, + "end": 479, "loc": { "start": { - "line": 18, + "line": 19, "column": 7 }, "end": { - "line": 18, + "line": 19, "column": 8 } } @@ -4107,15 +4209,15 @@ "binop": null }, "value": "n", - "start": 427, - "end": 428, + "start": 479, + "end": 480, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 9 } } @@ -4133,15 +4235,15 @@ "binop": null, "updateContext": null }, - "start": 428, - "end": 429, + "start": 480, + "end": 481, "loc": { "start": { - "line": 18, + "line": 19, "column": 9 }, "end": { - "line": 18, + "line": 19, "column": 10 } } @@ -4159,15 +4261,15 @@ "binop": null }, "value": "right", - "start": 429, - "end": 434, + "start": 481, + "end": 486, "loc": { "start": { - "line": 18, + "line": 19, "column": 10 }, "end": { - "line": 18, + "line": 19, "column": 15 } } @@ -4185,15 +4287,15 @@ "binop": null, "updateContext": null }, - "start": 434, - "end": 435, + "start": 486, + "end": 487, "loc": { "start": { - "line": 18, + "line": 19, "column": 15 }, "end": { - "line": 18, + "line": 19, "column": 16 } } @@ -4211,15 +4313,15 @@ "binop": null }, "value": "_color", - "start": 435, - "end": 441, + "start": 487, + "end": 493, "loc": { "start": { - "line": 18, + "line": 19, "column": 16 }, "end": { - "line": 18, + "line": 19, "column": 22 } } @@ -4238,15 +4340,15 @@ "updateContext": null }, "value": "===", - "start": 442, - "end": 445, + "start": 494, + "end": 497, "loc": { "start": { - "line": 18, + "line": 19, "column": 23 }, "end": { - "line": 18, + "line": 19, "column": 26 } } @@ -4264,15 +4366,15 @@ "binop": null }, "value": "BLACK", - "start": 446, - "end": 451, + "start": 498, + "end": 503, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 32 } } @@ -4289,15 +4391,15 @@ "postfix": false, "binop": null }, - "start": 451, - "end": 452, + "start": 503, + "end": 504, "loc": { "start": { - "line": 18, + "line": 19, "column": 32 }, "end": { - "line": 18, + "line": 19, "column": 33 } } @@ -4315,15 +4417,15 @@ "binop": null, "updateContext": null }, - "start": 452, - "end": 453, + "start": 504, + "end": 505, "loc": { "start": { - "line": 18, + "line": 19, "column": 33 }, "end": { - "line": 18, + "line": 19, "column": 34 } } @@ -4331,15 +4433,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t ", - "start": 455, - "end": 572, + "start": 507, + "end": 624, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 4 } } @@ -4359,15 +4461,15 @@ "updateContext": null }, "value": "if", - "start": 574, - "end": 576, + "start": 626, + "end": 628, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 3 } } @@ -4384,15 +4486,15 @@ "postfix": false, "binop": null }, - "start": 577, - "end": 578, + "start": 629, + "end": 630, "loc": { "start": { - "line": 26, + "line": 27, "column": 4 }, "end": { - "line": 26, + "line": 27, "column": 5 } } @@ -4410,15 +4512,15 @@ "binop": null }, "value": "n", - "start": 578, - "end": 579, + "start": 630, + "end": 631, "loc": { "start": { - "line": 26, + "line": 27, "column": 5 }, "end": { - "line": 26, + "line": 27, "column": 6 } } @@ -4436,15 +4538,15 @@ "binop": null, "updateContext": null }, - "start": 579, - "end": 580, + "start": 631, + "end": 632, "loc": { "start": { - "line": 26, + "line": 27, "column": 6 }, "end": { - "line": 26, + "line": 27, "column": 7 } } @@ -4462,15 +4564,15 @@ "binop": null }, "value": "parent", - "start": 580, - "end": 586, + "start": 632, + "end": 638, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 13 } } @@ -4489,15 +4591,15 @@ "updateContext": null }, "value": "===", - "start": 587, - "end": 590, + "start": 639, + "end": 642, "loc": { "start": { - "line": 26, + "line": 27, "column": 14 }, "end": { - "line": 26, + "line": 27, "column": 17 } } @@ -4517,15 +4619,15 @@ "updateContext": null }, "value": "null", - "start": 591, - "end": 595, + "start": 643, + "end": 647, "loc": { "start": { - "line": 26, + "line": 27, "column": 18 }, "end": { - "line": 26, + "line": 27, "column": 22 } } @@ -4542,19 +4644,44 @@ "postfix": false, "binop": null }, - "start": 595, - "end": 596, + "start": 647, + "end": 648, "loc": { "start": { - "line": 26, + "line": 27, "column": 22 }, "end": { - "line": 26, + "line": 27, "column": 23 } } }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 649, + "end": 650, + "loc": { + "start": { + "line": 27, + "column": 24 + }, + "end": { + "line": 27, + "column": 25 + } + } + }, { "type": { "label": "name", @@ -4568,16 +4695,16 @@ "binop": null }, "value": "n", - "start": 597, - "end": 598, + "start": 653, + "end": 654, "loc": { "start": { - "line": 26, - "column": 24 + "line": 28, + "column": 2 }, "end": { - "line": 26, - "column": 25 + "line": 28, + "column": 3 } } }, @@ -4594,16 +4721,16 @@ "binop": null, "updateContext": null }, - "start": 598, - "end": 599, + "start": 654, + "end": 655, "loc": { "start": { - "line": 26, - "column": 25 + "line": 28, + "column": 3 }, "end": { - "line": 26, - "column": 26 + "line": 28, + "column": 4 } } }, @@ -4620,16 +4747,16 @@ "binop": null }, "value": "_color", - "start": 599, - "end": 605, + "start": 655, + "end": 661, "loc": { "start": { - "line": 26, - "column": 26 + "line": 28, + "column": 4 }, "end": { - "line": 26, - "column": 32 + "line": 28, + "column": 10 } } }, @@ -4647,16 +4774,16 @@ "updateContext": null }, "value": "=", - "start": 606, - "end": 607, + "start": 662, + "end": 663, "loc": { "start": { - "line": 26, - "column": 33 + "line": 28, + "column": 11 }, "end": { - "line": 26, - "column": 34 + "line": 28, + "column": 12 } } }, @@ -4673,16 +4800,16 @@ "binop": null }, "value": "BLACK", - "start": 608, - "end": 613, + "start": 664, + "end": 669, "loc": { "start": { - "line": 26, - "column": 35 + "line": 28, + "column": 13 }, "end": { - "line": 26, - "column": 40 + "line": 28, + "column": 18 } } }, @@ -4699,23 +4826,23 @@ "binop": null, "updateContext": null }, - "start": 613, - "end": 614, + "start": 669, + "end": 670, "loc": { "start": { - "line": 26, - "column": 40 + "line": 28, + "column": 18 }, "end": { - "line": 26, - "column": 41 + "line": 28, + "column": 19 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": "return", + "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -4726,17 +4853,122 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 616, - "end": 620, + "value": "return", + "start": 673, + "end": 679, "loc": { "start": { - "line": 27, + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 680, + "end": 681, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 681, + "end": 682, + "loc": { + "start": { + "line": 29, + "column": 10 + }, + "end": { + "line": 29, + "column": 11 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 684, + "end": 685, + "loc": { + "start": { + "line": 30, "column": 1 }, "end": { - "line": 27, - "column": 5 + "line": 30, + "column": 2 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 688, + "end": 694, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 7 } } }, @@ -4753,16 +4985,16 @@ "binop": null }, "value": "insert_case1", - "start": 621, - "end": 633, + "start": 695, + "end": 707, "loc": { "start": { - "line": 27, - "column": 6 + "line": 32, + "column": 8 }, "end": { - "line": 27, - "column": 18 + "line": 32, + "column": 20 } } }, @@ -4778,16 +5010,16 @@ "postfix": false, "binop": null }, - "start": 633, - "end": 634, + "start": 707, + "end": 708, "loc": { "start": { - "line": 27, - "column": 18 + "line": 32, + "column": 20 }, "end": { - "line": 27, - "column": 19 + "line": 32, + "column": 21 } } }, @@ -4804,16 +5036,16 @@ "binop": null }, "value": "n", - "start": 634, - "end": 635, + "start": 708, + "end": 709, "loc": { "start": { - "line": 27, - "column": 19 + "line": 32, + "column": 21 }, "end": { - "line": 27, - "column": 20 + "line": 32, + "column": 22 } } }, @@ -4829,16 +5061,16 @@ "postfix": false, "binop": null }, - "start": 635, - "end": 636, + "start": 709, + "end": 710, "loc": { "start": { - "line": 27, - "column": 20 + "line": 32, + "column": 22 }, "end": { - "line": 27, - "column": 21 + "line": 32, + "column": 23 } } }, @@ -4855,16 +5087,16 @@ "binop": null, "updateContext": null }, - "start": 636, - "end": 637, + "start": 710, + "end": 711, "loc": { "start": { - "line": 27, - "column": 21 + "line": 32, + "column": 23 }, "end": { - "line": 27, - "column": 22 + "line": 32, + "column": 24 } } }, @@ -4880,15 +5112,15 @@ "postfix": false, "binop": null }, - "start": 638, - "end": 639, + "start": 712, + "end": 713, "loc": { "start": { - "line": 28, + "line": 33, "column": 0 }, "end": { - "line": 28, + "line": 33, "column": 1 } } @@ -4906,15 +5138,15 @@ "binop": null, "updateContext": null }, - "start": 639, - "end": 640, + "start": 713, + "end": 714, "loc": { "start": { - "line": 28, + "line": 33, "column": 1 }, "end": { - "line": 28, + "line": 33, "column": 2 } } @@ -4934,15 +5166,15 @@ "updateContext": null }, "value": "export", - "start": 642, - "end": 648, + "start": 716, + "end": 722, "loc": { "start": { - "line": 30, + "line": 35, "column": 0 }, "end": { - "line": 30, + "line": 35, "column": 6 } } @@ -4962,15 +5194,15 @@ "updateContext": null }, "value": "default", - "start": 649, - "end": 656, + "start": 723, + "end": 730, "loc": { "start": { - "line": 30, + "line": 35, "column": 7 }, "end": { - "line": 30, + "line": 35, "column": 14 } } @@ -4988,15 +5220,15 @@ "binop": null }, "value": "insert_case0", - "start": 657, - "end": 669, + "start": 731, + "end": 743, "loc": { "start": { - "line": 30, + "line": 35, "column": 15 }, "end": { - "line": 30, + "line": 35, "column": 27 } } @@ -5014,15 +5246,15 @@ "binop": null, "updateContext": null }, - "start": 669, - "end": 670, + "start": 743, + "end": 744, "loc": { "start": { - "line": 30, + "line": 35, "column": 27 }, "end": { - "line": 30, + "line": 35, "column": 28 } } @@ -5040,15 +5272,15 @@ "binop": null, "updateContext": null }, - "start": 671, - "end": 671, + "start": 745, + "end": 745, "loc": { "start": { - "line": 31, + "line": 36, "column": 0 }, "end": { - "line": 31, + "line": 36, "column": 0 } } diff --git a/ast/source/insertion/insert_case1.js.json b/ast/source/insertion/insert_case1.js.json index da0db38..274a9bd 100644 --- a/ast/source/insertion/insert_case1.js.json +++ b/ast/source/insertion/insert_case1.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 798, + "end": 848, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 37, + "line": 36, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 798, + "end": 848, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 37, + "line": 36, "column": 0 } }, @@ -375,16 +375,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 187, - "end": 337, + "end": 389, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 14, + "line": 15, "column": 3 } } @@ -393,44 +393,44 @@ }, { "type": "Identifier", - "start": 338, - "end": 767, + "start": 390, + "end": 817, "loc": { "start": { - "line": 15, + "line": 16, "column": 0 }, "end": { - "line": 34, + "line": 33, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 344, - "end": 766, + "start": 396, + "end": 816, "loc": { "start": { - "line": 15, + "line": 16, "column": 6 }, "end": { - "line": 34, + "line": 33, "column": 1 } }, "id": { "type": "Identifier", - "start": 344, - "end": 356, + "start": 396, + "end": 408, "loc": { "start": { - "line": 15, + "line": 16, "column": 6 }, "end": { - "line": 15, + "line": 16, "column": 18 }, "identifierName": "insert_case1" @@ -440,15 +440,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 359, - "end": 766, + "start": 411, + "end": 816, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 34, + "line": 33, "column": 1 } }, @@ -459,15 +459,15 @@ "params": [ { "type": "Identifier", - "start": 360, - "end": 361, + "start": 412, + "end": 413, "loc": { "start": { - "line": 15, + "line": 16, "column": 22 }, "end": { - "line": 15, + "line": 16, "column": 23 }, "identifierName": "n" @@ -477,58 +477,58 @@ ], "body": { "type": "BlockStatement", - "start": 366, - "end": 766, + "start": 418, + "end": 816, "loc": { "start": { - "line": 15, + "line": 16, "column": 28 }, "end": { - "line": 34, + "line": 33, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 369, - "end": 395, + "start": 421, + "end": 447, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 369, - "end": 394, + "start": 421, + "end": 446, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 26 } }, "callee": { "type": "Identifier", - "start": 369, - "end": 375, + "start": 421, + "end": 427, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 }, "identifierName": "assert" @@ -538,29 +538,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 376, - "end": 393, + "start": 428, + "end": 445, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 25 } }, "left": { "type": "Identifier", - "start": 376, - "end": 377, + "start": 428, + "end": 429, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 }, "identifierName": "n" @@ -570,15 +570,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 389, - "end": 393, + "start": 441, + "end": 445, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 25 }, "identifierName": "Node" @@ -591,43 +591,43 @@ }, { "type": "ExpressionStatement", - "start": 397, - "end": 422, + "start": 449, + "end": 474, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 397, - "end": 421, + "start": 449, + "end": 473, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 25 } }, "callee": { "type": "Identifier", - "start": 397, - "end": 403, + "start": 449, + "end": 455, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 7 }, "identifierName": "assert" @@ -637,43 +637,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 404, - "end": 420, + "start": 456, + "end": 472, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 404, - "end": 412, + "start": 456, + "end": 464, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 16 } }, "object": { "type": "Identifier", - "start": 404, - "end": 405, + "start": 456, + "end": 457, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 9 }, "identifierName": "n" @@ -682,15 +682,15 @@ }, "property": { "type": "Identifier", - "start": 406, - "end": 412, + "start": 458, + "end": 464, "loc": { "start": { - "line": 17, + "line": 18, "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 16 }, "identifierName": "_color" @@ -702,15 +702,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 417, - "end": 420, + "start": 469, + "end": 472, "loc": { "start": { - "line": 17, + "line": 18, "column": 21 }, "end": { - "line": 17, + "line": 18, "column": 24 }, "identifierName": "RED" @@ -723,43 +723,43 @@ }, { "type": "ExpressionStatement", - "start": 424, - "end": 475, + "start": 476, + "end": 527, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 52 } }, "expression": { "type": "CallExpression", - "start": 424, - "end": 474, + "start": 476, + "end": 526, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 51 } }, "callee": { "type": "Identifier", - "start": 424, - "end": 430, + "start": 476, + "end": 482, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 7 }, "identifierName": "assert" @@ -769,57 +769,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 431, - "end": 473, + "start": 483, + "end": 525, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 50 } }, "left": { "type": "BinaryExpression", - "start": 431, - "end": 446, + "start": 483, + "end": 498, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 23 } }, "left": { "type": "MemberExpression", - "start": 431, - "end": 437, + "start": 483, + "end": 489, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 14 } }, "object": { "type": "Identifier", - "start": 431, - "end": 432, + "start": 483, + "end": 484, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 9 }, "identifierName": "n" @@ -828,15 +828,15 @@ }, "property": { "type": "Identifier", - "start": 433, - "end": 437, + "start": 485, + "end": 489, "loc": { "start": { - "line": 18, + "line": 19, "column": 10 }, "end": { - "line": 18, + "line": 19, "column": 14 }, "identifierName": "left" @@ -848,15 +848,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 442, - "end": 446, + "start": 494, + "end": 498, "loc": { "start": { - "line": 18, + "line": 19, "column": 19 }, "end": { - "line": 18, + "line": 19, "column": 23 } } @@ -865,57 +865,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 450, - "end": 473, + "start": 502, + "end": 525, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 50 } }, "left": { "type": "MemberExpression", - "start": 450, - "end": 463, + "start": 502, + "end": 515, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 40 } }, "object": { "type": "MemberExpression", - "start": 450, - "end": 456, + "start": 502, + "end": 508, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 33 } }, "object": { "type": "Identifier", - "start": 450, - "end": 451, + "start": 502, + "end": 503, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 28 }, "identifierName": "n" @@ -924,15 +924,15 @@ }, "property": { "type": "Identifier", - "start": 452, - "end": 456, + "start": 504, + "end": 508, "loc": { "start": { - "line": 18, + "line": 19, "column": 29 }, "end": { - "line": 18, + "line": 19, "column": 33 }, "identifierName": "left" @@ -943,15 +943,15 @@ }, "property": { "type": "Identifier", - "start": 457, - "end": 463, + "start": 509, + "end": 515, "loc": { "start": { - "line": 18, + "line": 19, "column": 34 }, "end": { - "line": 18, + "line": 19, "column": 40 }, "identifierName": "_color" @@ -963,15 +963,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 468, - "end": 473, + "start": 520, + "end": 525, "loc": { "start": { - "line": 18, + "line": 19, "column": 45 }, "end": { - "line": 18, + "line": 19, "column": 50 }, "identifierName": "BLACK" @@ -985,43 +985,43 @@ }, { "type": "ExpressionStatement", - "start": 477, - "end": 530, + "start": 529, + "end": 582, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 54 } }, "expression": { "type": "CallExpression", - "start": 477, - "end": 529, + "start": 529, + "end": 581, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 53 } }, "callee": { "type": "Identifier", - "start": 477, - "end": 483, + "start": 529, + "end": 535, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 7 }, "identifierName": "assert" @@ -1031,57 +1031,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 484, - "end": 528, + "start": 536, + "end": 580, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 52 } }, "left": { "type": "BinaryExpression", - "start": 484, - "end": 500, + "start": 536, + "end": 552, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 484, - "end": 491, + "start": 536, + "end": 543, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 15 } }, "object": { "type": "Identifier", - "start": 484, - "end": 485, + "start": 536, + "end": 537, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 9 }, "identifierName": "n" @@ -1090,15 +1090,15 @@ }, "property": { "type": "Identifier", - "start": 486, - "end": 491, + "start": 538, + "end": 543, "loc": { "start": { - "line": 19, + "line": 20, "column": 10 }, "end": { - "line": 19, + "line": 20, "column": 15 }, "identifierName": "right" @@ -1110,15 +1110,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 496, - "end": 500, + "start": 548, + "end": 552, "loc": { "start": { - "line": 19, + "line": 20, "column": 20 }, "end": { - "line": 19, + "line": 20, "column": 24 } } @@ -1127,57 +1127,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 504, - "end": 528, + "start": 556, + "end": 580, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 52 } }, "left": { "type": "MemberExpression", - "start": 504, - "end": 518, + "start": 556, + "end": 570, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 42 } }, "object": { "type": "MemberExpression", - "start": 504, - "end": 511, + "start": 556, + "end": 563, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 35 } }, "object": { "type": "Identifier", - "start": 504, - "end": 505, + "start": 556, + "end": 557, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 29 }, "identifierName": "n" @@ -1186,15 +1186,15 @@ }, "property": { "type": "Identifier", - "start": 506, - "end": 511, + "start": 558, + "end": 563, "loc": { "start": { - "line": 19, + "line": 20, "column": 30 }, "end": { - "line": 19, + "line": 20, "column": 35 }, "identifierName": "right" @@ -1205,15 +1205,15 @@ }, "property": { "type": "Identifier", - "start": 512, - "end": 518, + "start": 564, + "end": 570, "loc": { "start": { - "line": 19, + "line": 20, "column": 36 }, "end": { - "line": 19, + "line": 20, "column": 42 }, "identifierName": "_color" @@ -1225,15 +1225,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 523, - "end": 528, + "start": 575, + "end": 580, "loc": { "start": { - "line": 19, + "line": 20, "column": 47 }, "end": { - "line": 19, + "line": 20, "column": 52 }, "identifierName": "BLACK" @@ -1247,43 +1247,43 @@ }, { "type": "ExpressionStatement", - "start": 532, - "end": 558, + "start": 584, + "end": 610, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 532, - "end": 557, + "start": 584, + "end": 609, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 532, - "end": 538, + "start": 584, + "end": 590, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -1293,43 +1293,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 539, - "end": 556, + "start": 591, + "end": 608, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 539, - "end": 547, + "start": 591, + "end": 599, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 16 } }, "object": { "type": "Identifier", - "start": 539, - "end": 540, + "start": 591, + "end": 592, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 }, "identifierName": "n" @@ -1338,15 +1338,15 @@ }, "property": { "type": "Identifier", - "start": 541, - "end": 547, + "start": 593, + "end": 599, "loc": { "start": { - "line": 20, + "line": 21, "column": 10 }, "end": { - "line": 20, + "line": 21, "column": 16 }, "identifierName": "parent" @@ -1358,15 +1358,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 552, - "end": 556, + "start": 604, + "end": 608, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 } } @@ -1378,15 +1378,15 @@ { "type": "CommentBlock", "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 561, - "end": 705, + "start": 613, + "end": 757, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 4 } } @@ -1394,240 +1394,241 @@ ] }, { - "type": "IfStatement", - "start": 707, - "end": 745, + "type": "ReturnStatement", + "start": 759, + "end": 814, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, - "column": 39 + "line": 32, + "column": 56 } }, - "test": { - "type": "BinaryExpression", - "start": 711, - "end": 736, + "argument": { + "type": "ConditionalExpression", + "start": 766, + "end": 813, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 30 + "line": 32, + "column": 55 } }, - "left": { - "type": "MemberExpression", - "start": 711, - "end": 726, + "test": { + "type": "BinaryExpression", + "start": 766, + "end": 791, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 20 + "line": 32, + "column": 33 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 711, - "end": 719, + "start": 766, + "end": 781, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 13 + "line": 32, + "column": 23 } }, "object": { - "type": "Identifier", - "start": 711, - "end": 712, + "type": "MemberExpression", + "start": 766, + "end": 774, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 6 + "line": 32, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 766, + "end": 767, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 768, + "end": 774, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" }, - "name": "n", + "computed": false, "leadingComments": null }, "property": { "type": "Identifier", - "start": 713, - "end": 719, + "start": 775, + "end": 781, "loc": { "start": { - "line": 31, - "column": 7 + "line": 32, + "column": 17 }, "end": { - "line": 31, - "column": 13 + "line": 32, + "column": 23 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false, "leadingComments": null }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 720, - "end": 726, + "start": 786, + "end": 791, "loc": { "start": { - "line": 31, - "column": 14 + "line": 32, + "column": 28 }, "end": { - "line": 31, - "column": 20 + "line": 32, + "column": 33 }, - "identifierName": "_color" + "identifierName": "BLACK" }, - "name": "_color" + "name": "BLACK" }, - "computed": false, "leadingComments": null }, - "operator": "===", - "right": { + "consequent": { "type": "Identifier", - "start": 731, - "end": 736, + "start": 794, + "end": 795, "loc": { "start": { - "line": 31, - "column": 25 + "line": 32, + "column": 36 }, "end": { - "line": 31, - "column": 30 + "line": 32, + "column": 37 }, - "identifierName": "BLACK" + "identifierName": "n" }, - "name": "BLACK" + "name": "n" }, - "leadingComments": null - }, - "consequent": { - "type": "ReturnStatement", - "start": 738, - "end": 745, - "loc": { - "start": { - "line": 31, - "column": 32 + "alternate": { + "type": "CallExpression", + "start": 798, + "end": 813, + "loc": { + "start": { + "line": 32, + "column": 40 + }, + "end": { + "line": 32, + "column": 55 + } }, - "end": { - "line": 31, - "column": 39 - } + "callee": { + "type": "Identifier", + "start": 798, + "end": 810, + "loc": { + "start": { + "line": 32, + "column": 40 + }, + "end": { + "line": 32, + "column": 52 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2" + }, + "arguments": [ + { + "type": "Identifier", + "start": 811, + "end": 812, + "loc": { + "start": { + "line": 32, + "column": 53 + }, + "end": { + "line": 32, + "column": 54 + }, + "identifierName": "n" + }, + "name": "n" + } + ] }, - "argument": null + "leadingComments": null }, - "alternate": null, "leadingComments": [ { "type": "CommentBlock", "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 561, - "end": 705, + "start": 613, + "end": 757, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 4 } } } ] - }, - { - "type": "ExpressionStatement", - "start": 748, - "end": 764, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 748, - "end": 763, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 16 - } - }, - "callee": { - "type": "Identifier", - "start": 748, - "end": 760, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 13 - }, - "identifierName": "insert_case2" - }, - "name": "insert_case2" - }, - "arguments": [ - { - "type": "Identifier", - "start": 761, - "end": 762, - "loc": { - "start": { - "line": 33, - "column": 14 - }, - "end": { - "line": 33, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" - } - ] - } } ], "directives": [] @@ -1643,29 +1644,29 @@ }, { "type": "Identifier", - "start": 769, - "end": 797, + "start": 819, + "end": 847, "loc": { "start": { - "line": 36, + "line": 35, "column": 0 }, "end": { - "line": 36, + "line": 35, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 784, - "end": 796, + "start": 834, + "end": 846, "loc": { "start": { - "line": 36, + "line": 35, "column": 15 }, "end": { - "line": 36, + "line": 35, "column": 27 }, "identifierName": "insert_case1" @@ -1678,58 +1679,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 769, - "end": 797, + "start": 819, + "end": 847, "loc": { "start": { - "line": 36, + "line": 35, "column": 0 }, "end": { - "line": 36, + "line": 35, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 338, - "end": 767, + "start": 390, + "end": 817, "loc": { "start": { - "line": 15, + "line": 16, "column": 0 }, "end": { - "line": 34, + "line": 33, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 344, - "end": 766, + "start": 396, + "end": 816, "loc": { "start": { - "line": 15, + "line": 16, "column": 6 }, "end": { - "line": 34, + "line": 33, "column": 1 } }, "id": { "type": "Identifier", - "start": 344, - "end": 356, + "start": 396, + "end": 408, "loc": { "start": { - "line": 15, + "line": 16, "column": 6 }, "end": { - "line": 15, + "line": 16, "column": 18 }, "identifierName": "insert_case1" @@ -1739,29 +1740,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 359, - "end": 766, + "start": 411, + "end": 816, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 34, + "line": 33, "column": 1 } }, "id": { "type": "Identifier", - "start": 344, - "end": 356, + "start": 396, + "end": 408, "loc": { "start": { - "line": 15, + "line": 16, "column": 6 }, "end": { - "line": 15, + "line": 16, "column": 18 }, "identifierName": "insert_case1" @@ -1775,15 +1776,15 @@ "params": [ { "type": "Identifier", - "start": 360, - "end": 361, + "start": 412, + "end": 413, "loc": { "start": { - "line": 15, + "line": 16, "column": 22 }, "end": { - "line": 15, + "line": 16, "column": 23 }, "identifierName": "n" @@ -1793,58 +1794,58 @@ ], "body": { "type": "BlockStatement", - "start": 366, - "end": 766, + "start": 418, + "end": 816, "loc": { "start": { - "line": 15, + "line": 16, "column": 28 }, "end": { - "line": 34, + "line": 33, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 369, - "end": 395, + "start": 421, + "end": 447, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 369, - "end": 394, + "start": 421, + "end": 446, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 26 } }, "callee": { "type": "Identifier", - "start": 369, - "end": 375, + "start": 421, + "end": 427, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 }, "identifierName": "assert" @@ -1854,29 +1855,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 376, - "end": 393, + "start": 428, + "end": 445, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 25 } }, "left": { "type": "Identifier", - "start": 376, - "end": 377, + "start": 428, + "end": 429, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 }, "identifierName": "n" @@ -1886,15 +1887,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 389, - "end": 393, + "start": 441, + "end": 445, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 25 }, "identifierName": "Node" @@ -1907,43 +1908,43 @@ }, { "type": "ExpressionStatement", - "start": 397, - "end": 422, + "start": 449, + "end": 474, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 397, - "end": 421, + "start": 449, + "end": 473, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 25 } }, "callee": { "type": "Identifier", - "start": 397, - "end": 403, + "start": 449, + "end": 455, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 7 }, "identifierName": "assert" @@ -1953,43 +1954,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 404, - "end": 420, + "start": 456, + "end": 472, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 404, - "end": 412, + "start": 456, + "end": 464, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 16 } }, "object": { "type": "Identifier", - "start": 404, - "end": 405, + "start": 456, + "end": 457, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 9 }, "identifierName": "n" @@ -1998,15 +1999,15 @@ }, "property": { "type": "Identifier", - "start": 406, - "end": 412, + "start": 458, + "end": 464, "loc": { "start": { - "line": 17, + "line": 18, "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 16 }, "identifierName": "_color" @@ -2018,15 +2019,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 417, - "end": 420, + "start": 469, + "end": 472, "loc": { "start": { - "line": 17, + "line": 18, "column": 21 }, "end": { - "line": 17, + "line": 18, "column": 24 }, "identifierName": "RED" @@ -2039,43 +2040,43 @@ }, { "type": "ExpressionStatement", - "start": 424, - "end": 475, + "start": 476, + "end": 527, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 52 } }, "expression": { "type": "CallExpression", - "start": 424, - "end": 474, + "start": 476, + "end": 526, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 51 } }, "callee": { "type": "Identifier", - "start": 424, - "end": 430, + "start": 476, + "end": 482, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 7 }, "identifierName": "assert" @@ -2085,57 +2086,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 431, - "end": 473, + "start": 483, + "end": 525, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 50 } }, "left": { "type": "BinaryExpression", - "start": 431, - "end": 446, + "start": 483, + "end": 498, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 23 } }, "left": { "type": "MemberExpression", - "start": 431, - "end": 437, + "start": 483, + "end": 489, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 14 } }, "object": { "type": "Identifier", - "start": 431, - "end": 432, + "start": 483, + "end": 484, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 9 }, "identifierName": "n" @@ -2144,15 +2145,15 @@ }, "property": { "type": "Identifier", - "start": 433, - "end": 437, + "start": 485, + "end": 489, "loc": { "start": { - "line": 18, + "line": 19, "column": 10 }, "end": { - "line": 18, + "line": 19, "column": 14 }, "identifierName": "left" @@ -2164,15 +2165,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 442, - "end": 446, + "start": 494, + "end": 498, "loc": { "start": { - "line": 18, + "line": 19, "column": 19 }, "end": { - "line": 18, + "line": 19, "column": 23 } } @@ -2181,57 +2182,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 450, - "end": 473, + "start": 502, + "end": 525, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 50 } }, "left": { "type": "MemberExpression", - "start": 450, - "end": 463, + "start": 502, + "end": 515, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 40 } }, "object": { "type": "MemberExpression", - "start": 450, - "end": 456, + "start": 502, + "end": 508, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 33 } }, "object": { "type": "Identifier", - "start": 450, - "end": 451, + "start": 502, + "end": 503, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 28 }, "identifierName": "n" @@ -2240,15 +2241,15 @@ }, "property": { "type": "Identifier", - "start": 452, - "end": 456, + "start": 504, + "end": 508, "loc": { "start": { - "line": 18, + "line": 19, "column": 29 }, "end": { - "line": 18, + "line": 19, "column": 33 }, "identifierName": "left" @@ -2259,15 +2260,15 @@ }, "property": { "type": "Identifier", - "start": 457, - "end": 463, + "start": 509, + "end": 515, "loc": { "start": { - "line": 18, + "line": 19, "column": 34 }, "end": { - "line": 18, + "line": 19, "column": 40 }, "identifierName": "_color" @@ -2279,15 +2280,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 468, - "end": 473, + "start": 520, + "end": 525, "loc": { "start": { - "line": 18, + "line": 19, "column": 45 }, "end": { - "line": 18, + "line": 19, "column": 50 }, "identifierName": "BLACK" @@ -2301,43 +2302,43 @@ }, { "type": "ExpressionStatement", - "start": 477, - "end": 530, + "start": 529, + "end": 582, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 54 } }, "expression": { "type": "CallExpression", - "start": 477, - "end": 529, + "start": 529, + "end": 581, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 53 } }, "callee": { "type": "Identifier", - "start": 477, - "end": 483, + "start": 529, + "end": 535, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 7 }, "identifierName": "assert" @@ -2347,57 +2348,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 484, - "end": 528, + "start": 536, + "end": 580, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 52 } }, "left": { "type": "BinaryExpression", - "start": 484, - "end": 500, + "start": 536, + "end": 552, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 484, - "end": 491, + "start": 536, + "end": 543, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 15 } }, "object": { "type": "Identifier", - "start": 484, - "end": 485, + "start": 536, + "end": 537, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 9 }, "identifierName": "n" @@ -2406,15 +2407,15 @@ }, "property": { "type": "Identifier", - "start": 486, - "end": 491, + "start": 538, + "end": 543, "loc": { "start": { - "line": 19, + "line": 20, "column": 10 }, "end": { - "line": 19, + "line": 20, "column": 15 }, "identifierName": "right" @@ -2426,15 +2427,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 496, - "end": 500, + "start": 548, + "end": 552, "loc": { "start": { - "line": 19, + "line": 20, "column": 20 }, "end": { - "line": 19, + "line": 20, "column": 24 } } @@ -2443,57 +2444,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 504, - "end": 528, + "start": 556, + "end": 580, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 52 } }, "left": { "type": "MemberExpression", - "start": 504, - "end": 518, + "start": 556, + "end": 570, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 42 } }, "object": { "type": "MemberExpression", - "start": 504, - "end": 511, + "start": 556, + "end": 563, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 35 } }, "object": { "type": "Identifier", - "start": 504, - "end": 505, + "start": 556, + "end": 557, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 29 }, "identifierName": "n" @@ -2502,15 +2503,15 @@ }, "property": { "type": "Identifier", - "start": 506, - "end": 511, + "start": 558, + "end": 563, "loc": { "start": { - "line": 19, + "line": 20, "column": 30 }, "end": { - "line": 19, + "line": 20, "column": 35 }, "identifierName": "right" @@ -2521,15 +2522,15 @@ }, "property": { "type": "Identifier", - "start": 512, - "end": 518, + "start": 564, + "end": 570, "loc": { "start": { - "line": 19, + "line": 20, "column": 36 }, "end": { - "line": 19, + "line": 20, "column": 42 }, "identifierName": "_color" @@ -2541,15 +2542,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 523, - "end": 528, + "start": 575, + "end": 580, "loc": { "start": { - "line": 19, + "line": 20, "column": 47 }, "end": { - "line": 19, + "line": 20, "column": 52 }, "identifierName": "BLACK" @@ -2563,43 +2564,43 @@ }, { "type": "ExpressionStatement", - "start": 532, - "end": 558, + "start": 584, + "end": 610, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 532, - "end": 557, + "start": 584, + "end": 609, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 532, - "end": 538, + "start": 584, + "end": 590, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -2609,43 +2610,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 539, - "end": 556, + "start": 591, + "end": 608, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 539, - "end": 547, + "start": 591, + "end": 599, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 16 } }, "object": { "type": "Identifier", - "start": 539, - "end": 540, + "start": 591, + "end": 592, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 }, "identifierName": "n" @@ -2654,15 +2655,15 @@ }, "property": { "type": "Identifier", - "start": 541, - "end": 547, + "start": 593, + "end": 599, "loc": { "start": { - "line": 20, + "line": 21, "column": 10 }, "end": { - "line": 20, + "line": 21, "column": 16 }, "identifierName": "parent" @@ -2674,15 +2675,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 552, - "end": 556, + "start": 604, + "end": 608, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 } } @@ -2694,15 +2695,15 @@ { "type": "CommentBlock", "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 561, - "end": 705, + "start": 613, + "end": 757, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 4 } } @@ -2710,240 +2711,241 @@ ] }, { - "type": "IfStatement", - "start": 707, - "end": 745, + "type": "ReturnStatement", + "start": 759, + "end": 814, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, - "column": 39 + "line": 32, + "column": 56 } }, - "test": { - "type": "BinaryExpression", - "start": 711, - "end": 736, + "argument": { + "type": "ConditionalExpression", + "start": 766, + "end": 813, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 30 + "line": 32, + "column": 55 } }, - "left": { - "type": "MemberExpression", - "start": 711, - "end": 726, + "test": { + "type": "BinaryExpression", + "start": 766, + "end": 791, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 20 + "line": 32, + "column": 33 } }, - "object": { + "left": { "type": "MemberExpression", - "start": 711, - "end": 719, + "start": 766, + "end": 781, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 13 + "line": 32, + "column": 23 } }, "object": { - "type": "Identifier", - "start": 711, - "end": 712, + "type": "MemberExpression", + "start": 766, + "end": 774, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 6 + "line": 32, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 766, + "end": 767, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 9 + }, + "identifierName": "n" }, - "identifierName": "n" + "name": "n", + "leadingComments": null }, - "name": "n", + "property": { + "type": "Identifier", + "start": 768, + "end": 774, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false, "leadingComments": null }, "property": { "type": "Identifier", - "start": 713, - "end": 719, + "start": 775, + "end": 781, "loc": { "start": { - "line": 31, - "column": 7 + "line": 32, + "column": 17 }, "end": { - "line": 31, - "column": 13 + "line": 32, + "column": 23 }, - "identifierName": "parent" + "identifierName": "_color" }, - "name": "parent" + "name": "_color" }, "computed": false, "leadingComments": null }, - "property": { + "operator": "===", + "right": { "type": "Identifier", - "start": 720, - "end": 726, + "start": 786, + "end": 791, "loc": { "start": { - "line": 31, - "column": 14 + "line": 32, + "column": 28 }, "end": { - "line": 31, - "column": 20 + "line": 32, + "column": 33 }, - "identifierName": "_color" + "identifierName": "BLACK" }, - "name": "_color" + "name": "BLACK" }, - "computed": false, "leadingComments": null }, - "operator": "===", - "right": { + "consequent": { "type": "Identifier", - "start": 731, - "end": 736, + "start": 794, + "end": 795, "loc": { "start": { - "line": 31, - "column": 25 + "line": 32, + "column": 36 }, "end": { - "line": 31, - "column": 30 + "line": 32, + "column": 37 }, - "identifierName": "BLACK" - }, - "name": "BLACK" - }, - "leadingComments": null - }, - "consequent": { - "type": "ReturnStatement", - "start": 738, - "end": 745, - "loc": { - "start": { - "line": 31, - "column": 32 - }, - "end": { - "line": 31, - "column": 39 - } - }, - "argument": null - }, - "alternate": null, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 561, - "end": 705, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 30, - "column": 4 - } - } - } - ] - }, - { - "type": "ExpressionStatement", - "start": 748, - "end": 764, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 17 - } - }, - "expression": { - "type": "CallExpression", - "start": 748, - "end": 763, - "loc": { - "start": { - "line": 33, - "column": 1 + "identifierName": "n" }, - "end": { - "line": 33, - "column": 16 - } + "name": "n" }, - "callee": { - "type": "Identifier", - "start": 748, - "end": 760, + "alternate": { + "type": "CallExpression", + "start": 798, + "end": 813, "loc": { "start": { - "line": 33, - "column": 1 + "line": 32, + "column": 40 }, - "end": { - "line": 33, - "column": 13 - }, - "identifierName": "insert_case2" + "end": { + "line": 32, + "column": 55 + } }, - "name": "insert_case2" - }, - "arguments": [ - { + "callee": { "type": "Identifier", - "start": 761, - "end": 762, + "start": 798, + "end": 810, "loc": { "start": { - "line": 33, - "column": 14 + "line": 32, + "column": 40 }, "end": { - "line": 33, - "column": 15 + "line": 32, + "column": 52 }, - "identifierName": "n" + "identifierName": "insert_case2" }, - "name": "n" + "name": "insert_case2" + }, + "arguments": [ + { + "type": "Identifier", + "start": 811, + "end": 812, + "loc": { + "start": { + "line": 32, + "column": 53 + }, + "end": { + "line": 32, + "column": 54 + }, + "identifierName": "n" + }, + "name": "n" + } + ] + }, + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", + "start": 613, + "end": 757, + "loc": { + "start": { + "line": 23, + "column": 1 + }, + "end": { + "line": 31, + "column": 4 + } } - ] - } + } + ] } ], "directives": [] @@ -2956,16 +2958,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 187, - "end": 337, + "end": 389, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 14, + "line": 15, "column": 3 } } @@ -2980,16 +2982,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 187, - "end": 337, + "end": 389, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 14, + "line": 15, "column": 3 } } @@ -2997,15 +2999,15 @@ { "type": "CommentBlock", "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 561, - "end": 705, + "start": 613, + "end": 757, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 4 } } @@ -3679,16 +3681,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 187, - "end": 337, + "end": 389, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 14, + "line": 15, "column": 3 } } @@ -3708,15 +3710,15 @@ "updateContext": null }, "value": "const", - "start": 338, - "end": 343, + "start": 390, + "end": 395, "loc": { "start": { - "line": 15, + "line": 16, "column": 0 }, "end": { - "line": 15, + "line": 16, "column": 5 } } @@ -3734,15 +3736,15 @@ "binop": null }, "value": "insert_case1", - "start": 344, - "end": 356, + "start": 396, + "end": 408, "loc": { "start": { - "line": 15, + "line": 16, "column": 6 }, "end": { - "line": 15, + "line": 16, "column": 18 } } @@ -3761,15 +3763,15 @@ "updateContext": null }, "value": "=", - "start": 357, - "end": 358, + "start": 409, + "end": 410, "loc": { "start": { - "line": 15, + "line": 16, "column": 19 }, "end": { - "line": 15, + "line": 16, "column": 20 } } @@ -3786,15 +3788,15 @@ "postfix": false, "binop": null }, - "start": 359, - "end": 360, + "start": 411, + "end": 412, "loc": { "start": { - "line": 15, + "line": 16, "column": 21 }, "end": { - "line": 15, + "line": 16, "column": 22 } } @@ -3812,15 +3814,15 @@ "binop": null }, "value": "n", - "start": 360, - "end": 361, + "start": 412, + "end": 413, "loc": { "start": { - "line": 15, + "line": 16, "column": 22 }, "end": { - "line": 15, + "line": 16, "column": 23 } } @@ -3837,15 +3839,15 @@ "postfix": false, "binop": null }, - "start": 361, - "end": 362, + "start": 413, + "end": 414, "loc": { "start": { - "line": 15, + "line": 16, "column": 23 }, "end": { - "line": 15, + "line": 16, "column": 24 } } @@ -3863,15 +3865,15 @@ "binop": null, "updateContext": null }, - "start": 363, - "end": 365, + "start": 415, + "end": 417, "loc": { "start": { - "line": 15, + "line": 16, "column": 25 }, "end": { - "line": 15, + "line": 16, "column": 27 } } @@ -3888,15 +3890,15 @@ "postfix": false, "binop": null }, - "start": 366, - "end": 367, + "start": 418, + "end": 419, "loc": { "start": { - "line": 15, + "line": 16, "column": 28 }, "end": { - "line": 15, + "line": 16, "column": 29 } } @@ -3914,15 +3916,15 @@ "binop": null }, "value": "assert", - "start": 369, - "end": 375, + "start": 421, + "end": 427, "loc": { "start": { - "line": 16, + "line": 17, "column": 1 }, "end": { - "line": 16, + "line": 17, "column": 7 } } @@ -3939,15 +3941,15 @@ "postfix": false, "binop": null }, - "start": 375, - "end": 376, + "start": 427, + "end": 428, "loc": { "start": { - "line": 16, + "line": 17, "column": 7 }, "end": { - "line": 16, + "line": 17, "column": 8 } } @@ -3965,15 +3967,15 @@ "binop": null }, "value": "n", - "start": 376, - "end": 377, + "start": 428, + "end": 429, "loc": { "start": { - "line": 16, + "line": 17, "column": 8 }, "end": { - "line": 16, + "line": 17, "column": 9 } } @@ -3993,15 +3995,15 @@ "updateContext": null }, "value": "instanceof", - "start": 378, - "end": 388, + "start": 430, + "end": 440, "loc": { "start": { - "line": 16, + "line": 17, "column": 10 }, "end": { - "line": 16, + "line": 17, "column": 20 } } @@ -4019,15 +4021,15 @@ "binop": null }, "value": "Node", - "start": 389, - "end": 393, + "start": 441, + "end": 445, "loc": { "start": { - "line": 16, + "line": 17, "column": 21 }, "end": { - "line": 16, + "line": 17, "column": 25 } } @@ -4044,15 +4046,15 @@ "postfix": false, "binop": null }, - "start": 393, - "end": 394, + "start": 445, + "end": 446, "loc": { "start": { - "line": 16, + "line": 17, "column": 25 }, "end": { - "line": 16, + "line": 17, "column": 26 } } @@ -4070,15 +4072,15 @@ "binop": null, "updateContext": null }, - "start": 394, - "end": 395, + "start": 446, + "end": 447, "loc": { "start": { - "line": 16, + "line": 17, "column": 26 }, "end": { - "line": 16, + "line": 17, "column": 27 } } @@ -4096,15 +4098,15 @@ "binop": null }, "value": "assert", - "start": 397, - "end": 403, + "start": 449, + "end": 455, "loc": { "start": { - "line": 17, + "line": 18, "column": 1 }, "end": { - "line": 17, + "line": 18, "column": 7 } } @@ -4121,15 +4123,15 @@ "postfix": false, "binop": null }, - "start": 403, - "end": 404, + "start": 455, + "end": 456, "loc": { "start": { - "line": 17, + "line": 18, "column": 7 }, "end": { - "line": 17, + "line": 18, "column": 8 } } @@ -4147,15 +4149,15 @@ "binop": null }, "value": "n", - "start": 404, - "end": 405, + "start": 456, + "end": 457, "loc": { "start": { - "line": 17, + "line": 18, "column": 8 }, "end": { - "line": 17, + "line": 18, "column": 9 } } @@ -4173,15 +4175,15 @@ "binop": null, "updateContext": null }, - "start": 405, - "end": 406, + "start": 457, + "end": 458, "loc": { "start": { - "line": 17, + "line": 18, "column": 9 }, "end": { - "line": 17, + "line": 18, "column": 10 } } @@ -4199,15 +4201,15 @@ "binop": null }, "value": "_color", - "start": 406, - "end": 412, + "start": 458, + "end": 464, "loc": { "start": { - "line": 17, + "line": 18, "column": 10 }, "end": { - "line": 17, + "line": 18, "column": 16 } } @@ -4226,15 +4228,15 @@ "updateContext": null }, "value": "===", - "start": 413, - "end": 416, + "start": 465, + "end": 468, "loc": { "start": { - "line": 17, + "line": 18, "column": 17 }, "end": { - "line": 17, + "line": 18, "column": 20 } } @@ -4252,15 +4254,15 @@ "binop": null }, "value": "RED", - "start": 417, - "end": 420, + "start": 469, + "end": 472, "loc": { "start": { - "line": 17, + "line": 18, "column": 21 }, "end": { - "line": 17, + "line": 18, "column": 24 } } @@ -4277,15 +4279,15 @@ "postfix": false, "binop": null }, - "start": 420, - "end": 421, + "start": 472, + "end": 473, "loc": { "start": { - "line": 17, + "line": 18, "column": 24 }, "end": { - "line": 17, + "line": 18, "column": 25 } } @@ -4303,15 +4305,15 @@ "binop": null, "updateContext": null }, - "start": 421, - "end": 422, + "start": 473, + "end": 474, "loc": { "start": { - "line": 17, + "line": 18, "column": 25 }, "end": { - "line": 17, + "line": 18, "column": 26 } } @@ -4329,15 +4331,15 @@ "binop": null }, "value": "assert", - "start": 424, - "end": 430, + "start": 476, + "end": 482, "loc": { "start": { - "line": 18, + "line": 19, "column": 1 }, "end": { - "line": 18, + "line": 19, "column": 7 } } @@ -4354,15 +4356,15 @@ "postfix": false, "binop": null }, - "start": 430, - "end": 431, + "start": 482, + "end": 483, "loc": { "start": { - "line": 18, + "line": 19, "column": 7 }, "end": { - "line": 18, + "line": 19, "column": 8 } } @@ -4380,15 +4382,15 @@ "binop": null }, "value": "n", - "start": 431, - "end": 432, + "start": 483, + "end": 484, "loc": { "start": { - "line": 18, + "line": 19, "column": 8 }, "end": { - "line": 18, + "line": 19, "column": 9 } } @@ -4406,15 +4408,15 @@ "binop": null, "updateContext": null }, - "start": 432, - "end": 433, + "start": 484, + "end": 485, "loc": { "start": { - "line": 18, + "line": 19, "column": 9 }, "end": { - "line": 18, + "line": 19, "column": 10 } } @@ -4432,15 +4434,15 @@ "binop": null }, "value": "left", - "start": 433, - "end": 437, + "start": 485, + "end": 489, "loc": { "start": { - "line": 18, + "line": 19, "column": 10 }, "end": { - "line": 18, + "line": 19, "column": 14 } } @@ -4459,15 +4461,15 @@ "updateContext": null }, "value": "===", - "start": 438, - "end": 441, + "start": 490, + "end": 493, "loc": { "start": { - "line": 18, + "line": 19, "column": 15 }, "end": { - "line": 18, + "line": 19, "column": 18 } } @@ -4487,15 +4489,15 @@ "updateContext": null }, "value": "null", - "start": 442, - "end": 446, + "start": 494, + "end": 498, "loc": { "start": { - "line": 18, + "line": 19, "column": 19 }, "end": { - "line": 18, + "line": 19, "column": 23 } } @@ -4514,15 +4516,15 @@ "updateContext": null }, "value": "||", - "start": 447, - "end": 449, + "start": 499, + "end": 501, "loc": { "start": { - "line": 18, + "line": 19, "column": 24 }, "end": { - "line": 18, + "line": 19, "column": 26 } } @@ -4540,15 +4542,15 @@ "binop": null }, "value": "n", - "start": 450, - "end": 451, + "start": 502, + "end": 503, "loc": { "start": { - "line": 18, + "line": 19, "column": 27 }, "end": { - "line": 18, + "line": 19, "column": 28 } } @@ -4566,15 +4568,15 @@ "binop": null, "updateContext": null }, - "start": 451, - "end": 452, + "start": 503, + "end": 504, "loc": { "start": { - "line": 18, + "line": 19, "column": 28 }, "end": { - "line": 18, + "line": 19, "column": 29 } } @@ -4592,15 +4594,15 @@ "binop": null }, "value": "left", - "start": 452, - "end": 456, + "start": 504, + "end": 508, "loc": { "start": { - "line": 18, + "line": 19, "column": 29 }, "end": { - "line": 18, + "line": 19, "column": 33 } } @@ -4618,15 +4620,15 @@ "binop": null, "updateContext": null }, - "start": 456, - "end": 457, + "start": 508, + "end": 509, "loc": { "start": { - "line": 18, + "line": 19, "column": 33 }, "end": { - "line": 18, + "line": 19, "column": 34 } } @@ -4644,15 +4646,15 @@ "binop": null }, "value": "_color", - "start": 457, - "end": 463, + "start": 509, + "end": 515, "loc": { "start": { - "line": 18, + "line": 19, "column": 34 }, "end": { - "line": 18, + "line": 19, "column": 40 } } @@ -4671,15 +4673,15 @@ "updateContext": null }, "value": "===", - "start": 464, - "end": 467, + "start": 516, + "end": 519, "loc": { "start": { - "line": 18, + "line": 19, "column": 41 }, "end": { - "line": 18, + "line": 19, "column": 44 } } @@ -4697,15 +4699,15 @@ "binop": null }, "value": "BLACK", - "start": 468, - "end": 473, + "start": 520, + "end": 525, "loc": { "start": { - "line": 18, + "line": 19, "column": 45 }, "end": { - "line": 18, + "line": 19, "column": 50 } } @@ -4722,15 +4724,15 @@ "postfix": false, "binop": null }, - "start": 473, - "end": 474, + "start": 525, + "end": 526, "loc": { "start": { - "line": 18, + "line": 19, "column": 50 }, "end": { - "line": 18, + "line": 19, "column": 51 } } @@ -4748,15 +4750,15 @@ "binop": null, "updateContext": null }, - "start": 474, - "end": 475, + "start": 526, + "end": 527, "loc": { "start": { - "line": 18, + "line": 19, "column": 51 }, "end": { - "line": 18, + "line": 19, "column": 52 } } @@ -4774,15 +4776,15 @@ "binop": null }, "value": "assert", - "start": 477, - "end": 483, + "start": 529, + "end": 535, "loc": { "start": { - "line": 19, + "line": 20, "column": 1 }, "end": { - "line": 19, + "line": 20, "column": 7 } } @@ -4799,15 +4801,15 @@ "postfix": false, "binop": null }, - "start": 483, - "end": 484, + "start": 535, + "end": 536, "loc": { "start": { - "line": 19, + "line": 20, "column": 7 }, "end": { - "line": 19, + "line": 20, "column": 8 } } @@ -4825,15 +4827,15 @@ "binop": null }, "value": "n", - "start": 484, - "end": 485, + "start": 536, + "end": 537, "loc": { "start": { - "line": 19, + "line": 20, "column": 8 }, "end": { - "line": 19, + "line": 20, "column": 9 } } @@ -4851,15 +4853,15 @@ "binop": null, "updateContext": null }, - "start": 485, - "end": 486, + "start": 537, + "end": 538, "loc": { "start": { - "line": 19, + "line": 20, "column": 9 }, "end": { - "line": 19, + "line": 20, "column": 10 } } @@ -4877,15 +4879,15 @@ "binop": null }, "value": "right", - "start": 486, - "end": 491, + "start": 538, + "end": 543, "loc": { "start": { - "line": 19, + "line": 20, "column": 10 }, "end": { - "line": 19, + "line": 20, "column": 15 } } @@ -4904,15 +4906,15 @@ "updateContext": null }, "value": "===", - "start": 492, - "end": 495, + "start": 544, + "end": 547, "loc": { "start": { - "line": 19, + "line": 20, "column": 16 }, "end": { - "line": 19, + "line": 20, "column": 19 } } @@ -4932,15 +4934,15 @@ "updateContext": null }, "value": "null", - "start": 496, - "end": 500, + "start": 548, + "end": 552, "loc": { "start": { - "line": 19, + "line": 20, "column": 20 }, "end": { - "line": 19, + "line": 20, "column": 24 } } @@ -4959,15 +4961,15 @@ "updateContext": null }, "value": "||", - "start": 501, - "end": 503, + "start": 553, + "end": 555, "loc": { "start": { - "line": 19, + "line": 20, "column": 25 }, "end": { - "line": 19, + "line": 20, "column": 27 } } @@ -4985,15 +4987,15 @@ "binop": null }, "value": "n", - "start": 504, - "end": 505, + "start": 556, + "end": 557, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 29 } } @@ -5011,15 +5013,15 @@ "binop": null, "updateContext": null }, - "start": 505, - "end": 506, + "start": 557, + "end": 558, "loc": { "start": { - "line": 19, + "line": 20, "column": 29 }, "end": { - "line": 19, + "line": 20, "column": 30 } } @@ -5037,15 +5039,15 @@ "binop": null }, "value": "right", - "start": 506, - "end": 511, + "start": 558, + "end": 563, "loc": { "start": { - "line": 19, + "line": 20, "column": 30 }, "end": { - "line": 19, + "line": 20, "column": 35 } } @@ -5063,15 +5065,15 @@ "binop": null, "updateContext": null }, - "start": 511, - "end": 512, + "start": 563, + "end": 564, "loc": { "start": { - "line": 19, + "line": 20, "column": 35 }, "end": { - "line": 19, + "line": 20, "column": 36 } } @@ -5089,15 +5091,15 @@ "binop": null }, "value": "_color", - "start": 512, - "end": 518, + "start": 564, + "end": 570, "loc": { "start": { - "line": 19, + "line": 20, "column": 36 }, "end": { - "line": 19, + "line": 20, "column": 42 } } @@ -5116,15 +5118,15 @@ "updateContext": null }, "value": "===", - "start": 519, - "end": 522, + "start": 571, + "end": 574, "loc": { "start": { - "line": 19, + "line": 20, "column": 43 }, "end": { - "line": 19, + "line": 20, "column": 46 } } @@ -5142,15 +5144,15 @@ "binop": null }, "value": "BLACK", - "start": 523, - "end": 528, + "start": 575, + "end": 580, "loc": { "start": { - "line": 19, + "line": 20, "column": 47 }, "end": { - "line": 19, + "line": 20, "column": 52 } } @@ -5167,15 +5169,15 @@ "postfix": false, "binop": null }, - "start": 528, - "end": 529, + "start": 580, + "end": 581, "loc": { "start": { - "line": 19, + "line": 20, "column": 52 }, "end": { - "line": 19, + "line": 20, "column": 53 } } @@ -5193,15 +5195,15 @@ "binop": null, "updateContext": null }, - "start": 529, - "end": 530, + "start": 581, + "end": 582, "loc": { "start": { - "line": 19, + "line": 20, "column": 53 }, "end": { - "line": 19, + "line": 20, "column": 54 } } @@ -5219,15 +5221,15 @@ "binop": null }, "value": "assert", - "start": 532, - "end": 538, + "start": 584, + "end": 590, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 } } @@ -5244,15 +5246,15 @@ "postfix": false, "binop": null }, - "start": 538, - "end": 539, + "start": 590, + "end": 591, "loc": { "start": { - "line": 20, + "line": 21, "column": 7 }, "end": { - "line": 20, + "line": 21, "column": 8 } } @@ -5270,15 +5272,15 @@ "binop": null }, "value": "n", - "start": 539, - "end": 540, + "start": 591, + "end": 592, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 } } @@ -5296,15 +5298,15 @@ "binop": null, "updateContext": null }, - "start": 540, - "end": 541, + "start": 592, + "end": 593, "loc": { "start": { - "line": 20, + "line": 21, "column": 9 }, "end": { - "line": 20, + "line": 21, "column": 10 } } @@ -5322,15 +5324,15 @@ "binop": null }, "value": "parent", - "start": 541, - "end": 547, + "start": 593, + "end": 599, "loc": { "start": { - "line": 20, + "line": 21, "column": 10 }, "end": { - "line": 20, + "line": 21, "column": 16 } } @@ -5349,15 +5351,15 @@ "updateContext": null }, "value": "!==", - "start": 548, - "end": 551, + "start": 600, + "end": 603, "loc": { "start": { - "line": 20, + "line": 21, "column": 17 }, "end": { - "line": 20, + "line": 21, "column": 20 } } @@ -5377,15 +5379,15 @@ "updateContext": null }, "value": "null", - "start": 552, - "end": 556, + "start": 604, + "end": 608, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 } } @@ -5402,15 +5404,15 @@ "postfix": false, "binop": null }, - "start": 556, - "end": 557, + "start": 608, + "end": 609, "loc": { "start": { - "line": 20, + "line": 21, "column": 25 }, "end": { - "line": 20, + "line": 21, "column": 26 } } @@ -5428,15 +5430,15 @@ "binop": null, "updateContext": null }, - "start": 557, - "end": 558, + "start": 609, + "end": 610, "loc": { "start": { - "line": 20, + "line": 21, "column": 26 }, "end": { - "line": 20, + "line": 21, "column": 27 } } @@ -5444,24 +5446,24 @@ { "type": "CommentBlock", "value": "*\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t ", - "start": 561, - "end": 705, + "start": 613, + "end": 757, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 4 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, + "label": "return", + "keyword": "return", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -5471,42 +5473,17 @@ "binop": null, "updateContext": null }, - "value": "if", - "start": 707, - "end": 709, + "value": "return", + "start": 759, + "end": 765, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, - "column": 3 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 710, - "end": 711, - "loc": { - "start": { - "line": 31, - "column": 4 - }, - "end": { - "line": 31, - "column": 5 + "line": 32, + "column": 7 } } }, @@ -5523,16 +5500,16 @@ "binop": null }, "value": "n", - "start": 711, - "end": 712, + "start": 766, + "end": 767, "loc": { "start": { - "line": 31, - "column": 5 + "line": 32, + "column": 8 }, "end": { - "line": 31, - "column": 6 + "line": 32, + "column": 9 } } }, @@ -5549,16 +5526,16 @@ "binop": null, "updateContext": null }, - "start": 712, - "end": 713, + "start": 767, + "end": 768, "loc": { "start": { - "line": 31, - "column": 6 + "line": 32, + "column": 9 }, "end": { - "line": 31, - "column": 7 + "line": 32, + "column": 10 } } }, @@ -5575,16 +5552,16 @@ "binop": null }, "value": "parent", - "start": 713, - "end": 719, + "start": 768, + "end": 774, "loc": { "start": { - "line": 31, - "column": 7 + "line": 32, + "column": 10 }, "end": { - "line": 31, - "column": 13 + "line": 32, + "column": 16 } } }, @@ -5601,16 +5578,16 @@ "binop": null, "updateContext": null }, - "start": 719, - "end": 720, + "start": 774, + "end": 775, "loc": { "start": { - "line": 31, - "column": 13 + "line": 32, + "column": 16 }, "end": { - "line": 31, - "column": 14 + "line": 32, + "column": 17 } } }, @@ -5627,16 +5604,16 @@ "binop": null }, "value": "_color", - "start": 720, - "end": 726, + "start": 775, + "end": 781, "loc": { "start": { - "line": 31, - "column": 14 + "line": 32, + "column": 17 }, "end": { - "line": 31, - "column": 20 + "line": 32, + "column": 23 } } }, @@ -5654,16 +5631,16 @@ "updateContext": null }, "value": "===", - "start": 727, - "end": 730, + "start": 782, + "end": 785, "loc": { "start": { - "line": 31, - "column": 21 + "line": 32, + "column": 24 }, "end": { - "line": 31, - "column": 24 + "line": 32, + "column": 27 } } }, @@ -5680,75 +5657,74 @@ "binop": null }, "value": "BLACK", - "start": 731, - "end": 736, + "start": 786, + "end": 791, "loc": { "start": { - "line": 31, - "column": 25 + "line": 32, + "column": 28 }, "end": { - "line": 31, - "column": 30 + "line": 32, + "column": 33 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "?", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 736, - "end": 737, + "start": 792, + "end": 793, "loc": { "start": { - "line": 31, - "column": 30 + "line": 32, + "column": 34 }, "end": { - "line": 31, - "column": 31 + "line": 32, + "column": 35 } } }, { "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "return", - "start": 738, - "end": 744, + "value": "n", + "start": 794, + "end": 795, "loc": { "start": { - "line": 31, - "column": 32 + "line": 32, + "column": 36 }, "end": { - "line": 31, - "column": 38 + "line": 32, + "column": 37 } } }, { "type": { - "label": ";", + "label": ":", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -5759,15 +5735,15 @@ "binop": null, "updateContext": null }, - "start": 744, - "end": 745, + "start": 796, + "end": 797, "loc": { "start": { - "line": 31, + "line": 32, "column": 38 }, "end": { - "line": 31, + "line": 32, "column": 39 } } @@ -5785,16 +5761,16 @@ "binop": null }, "value": "insert_case2", - "start": 748, - "end": 760, + "start": 798, + "end": 810, "loc": { "start": { - "line": 33, - "column": 1 + "line": 32, + "column": 40 }, "end": { - "line": 33, - "column": 13 + "line": 32, + "column": 52 } } }, @@ -5810,16 +5786,16 @@ "postfix": false, "binop": null }, - "start": 760, - "end": 761, + "start": 810, + "end": 811, "loc": { "start": { - "line": 33, - "column": 13 + "line": 32, + "column": 52 }, "end": { - "line": 33, - "column": 14 + "line": 32, + "column": 53 } } }, @@ -5836,16 +5812,16 @@ "binop": null }, "value": "n", - "start": 761, - "end": 762, + "start": 811, + "end": 812, "loc": { "start": { - "line": 33, - "column": 14 + "line": 32, + "column": 53 }, "end": { - "line": 33, - "column": 15 + "line": 32, + "column": 54 } } }, @@ -5861,16 +5837,16 @@ "postfix": false, "binop": null }, - "start": 762, - "end": 763, + "start": 812, + "end": 813, "loc": { "start": { - "line": 33, - "column": 15 + "line": 32, + "column": 54 }, "end": { - "line": 33, - "column": 16 + "line": 32, + "column": 55 } } }, @@ -5887,16 +5863,16 @@ "binop": null, "updateContext": null }, - "start": 763, - "end": 764, + "start": 813, + "end": 814, "loc": { "start": { - "line": 33, - "column": 16 + "line": 32, + "column": 55 }, "end": { - "line": 33, - "column": 17 + "line": 32, + "column": 56 } } }, @@ -5912,15 +5888,15 @@ "postfix": false, "binop": null }, - "start": 765, - "end": 766, + "start": 815, + "end": 816, "loc": { "start": { - "line": 34, + "line": 33, "column": 0 }, "end": { - "line": 34, + "line": 33, "column": 1 } } @@ -5938,15 +5914,15 @@ "binop": null, "updateContext": null }, - "start": 766, - "end": 767, + "start": 816, + "end": 817, "loc": { "start": { - "line": 34, + "line": 33, "column": 1 }, "end": { - "line": 34, + "line": 33, "column": 2 } } @@ -5966,15 +5942,15 @@ "updateContext": null }, "value": "export", - "start": 769, - "end": 775, + "start": 819, + "end": 825, "loc": { "start": { - "line": 36, + "line": 35, "column": 0 }, "end": { - "line": 36, + "line": 35, "column": 6 } } @@ -5994,15 +5970,15 @@ "updateContext": null }, "value": "default", - "start": 776, - "end": 783, + "start": 826, + "end": 833, "loc": { "start": { - "line": 36, + "line": 35, "column": 7 }, "end": { - "line": 36, + "line": 35, "column": 14 } } @@ -6020,15 +5996,15 @@ "binop": null }, "value": "insert_case1", - "start": 784, - "end": 796, + "start": 834, + "end": 846, "loc": { "start": { - "line": 36, + "line": 35, "column": 15 }, "end": { - "line": 36, + "line": 35, "column": 27 } } @@ -6046,15 +6022,15 @@ "binop": null, "updateContext": null }, - "start": 796, - "end": 797, + "start": 846, + "end": 847, "loc": { "start": { - "line": 36, + "line": 35, "column": 27 }, "end": { - "line": 36, + "line": 35, "column": 28 } } @@ -6072,15 +6048,15 @@ "binop": null, "updateContext": null }, - "start": 798, - "end": 798, + "start": 848, + "end": 848, "loc": { "start": { - "line": 37, + "line": 36, "column": 0 }, "end": { - "line": 37, + "line": 36, "column": 0 } } diff --git a/ast/source/insertion/insert_case2.js.json b/ast/source/insertion/insert_case2.js.json index a54ebd0..28e09bd 100644 --- a/ast/source/insertion/insert_case2.js.json +++ b/ast/source/insertion/insert_case2.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1516, + "end": 1579, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 53, + "line": 56, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1516, + "end": 1579, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 53, + "line": 56, "column": 0 } }, @@ -582,16 +582,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 325, - "end": 501, + "end": 553, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 18, + "line": 19, "column": 3 } } @@ -600,44 +600,44 @@ }, { "type": "Identifier", - "start": 502, - "end": 1485, + "start": 554, + "end": 1548, "loc": { "start": { - "line": 19, + "line": 20, "column": 0 }, "end": { - "line": 50, + "line": 53, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 508, - "end": 1484, + "start": 560, + "end": 1547, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 50, + "line": 53, "column": 1 } }, "id": { "type": "Identifier", - "start": 508, - "end": 520, + "start": 560, + "end": 572, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 18 }, "identifierName": "insert_case2" @@ -647,15 +647,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 523, - "end": 1484, + "start": 575, + "end": 1547, "loc": { "start": { - "line": 19, + "line": 20, "column": 21 }, "end": { - "line": 50, + "line": 53, "column": 1 } }, @@ -666,15 +666,15 @@ "params": [ { "type": "Identifier", - "start": 524, - "end": 525, + "start": 576, + "end": 577, "loc": { "start": { - "line": 19, + "line": 20, "column": 22 }, "end": { - "line": 19, + "line": 20, "column": 23 }, "identifierName": "n" @@ -684,58 +684,58 @@ ], "body": { "type": "BlockStatement", - "start": 530, - "end": 1484, + "start": 582, + "end": 1547, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 50, + "line": 53, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 533, - "end": 559, + "start": 585, + "end": 611, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 533, - "end": 558, + "start": 585, + "end": 610, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 533, - "end": 539, + "start": 585, + "end": 591, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -745,29 +745,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 540, - "end": 557, + "start": 592, + "end": 609, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 25 } }, "left": { "type": "Identifier", - "start": 540, - "end": 541, + "start": 592, + "end": 593, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 }, "identifierName": "n" @@ -777,15 +777,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 553, - "end": 557, + "start": 605, + "end": 609, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 }, "identifierName": "Node" @@ -798,43 +798,43 @@ }, { "type": "ExpressionStatement", - "start": 561, - "end": 586, + "start": 613, + "end": 638, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 561, - "end": 585, + "start": 613, + "end": 637, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 25 } }, "callee": { "type": "Identifier", - "start": 561, - "end": 567, + "start": 613, + "end": 619, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -844,43 +844,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 568, - "end": 584, + "start": 620, + "end": 636, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 568, - "end": 576, + "start": 620, + "end": 628, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 16 } }, "object": { "type": "Identifier", - "start": 568, - "end": 569, + "start": 620, + "end": 621, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 }, "identifierName": "n" @@ -889,15 +889,15 @@ }, "property": { "type": "Identifier", - "start": 570, - "end": 576, + "start": 622, + "end": 628, "loc": { "start": { - "line": 21, + "line": 22, "column": 10 }, "end": { - "line": 21, + "line": 22, "column": 16 }, "identifierName": "_color" @@ -909,15 +909,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 581, - "end": 584, + "start": 633, + "end": 636, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 24 }, "identifierName": "RED" @@ -930,43 +930,43 @@ }, { "type": "ExpressionStatement", - "start": 588, - "end": 639, + "start": 640, + "end": 691, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 52 } }, "expression": { "type": "CallExpression", - "start": 588, - "end": 638, + "start": 640, + "end": 690, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 51 } }, "callee": { "type": "Identifier", - "start": 588, - "end": 594, + "start": 640, + "end": 646, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -976,57 +976,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 595, - "end": 637, + "start": 647, + "end": 689, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 50 } }, "left": { "type": "BinaryExpression", - "start": 595, - "end": 610, + "start": 647, + "end": 662, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 23 } }, "left": { "type": "MemberExpression", - "start": 595, - "end": 601, + "start": 647, + "end": 653, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 14 } }, "object": { "type": "Identifier", - "start": 595, - "end": 596, + "start": 647, + "end": 648, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -1035,15 +1035,15 @@ }, "property": { "type": "Identifier", - "start": 597, - "end": 601, + "start": 649, + "end": 653, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 14 }, "identifierName": "left" @@ -1055,15 +1055,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 606, - "end": 610, + "start": 658, + "end": 662, "loc": { "start": { - "line": 22, + "line": 23, "column": 19 }, "end": { - "line": 22, + "line": 23, "column": 23 } } @@ -1072,57 +1072,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 614, - "end": 637, + "start": 666, + "end": 689, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 50 } }, "left": { "type": "MemberExpression", - "start": 614, - "end": 627, + "start": 666, + "end": 679, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 40 } }, "object": { "type": "MemberExpression", - "start": 614, - "end": 620, + "start": 666, + "end": 672, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 33 } }, "object": { "type": "Identifier", - "start": 614, - "end": 615, + "start": 666, + "end": 667, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 28 }, "identifierName": "n" @@ -1131,15 +1131,15 @@ }, "property": { "type": "Identifier", - "start": 616, - "end": 620, + "start": 668, + "end": 672, "loc": { "start": { - "line": 22, + "line": 23, "column": 29 }, "end": { - "line": 22, + "line": 23, "column": 33 }, "identifierName": "left" @@ -1150,15 +1150,15 @@ }, "property": { "type": "Identifier", - "start": 621, - "end": 627, + "start": 673, + "end": 679, "loc": { "start": { - "line": 22, + "line": 23, "column": 34 }, "end": { - "line": 22, + "line": 23, "column": 40 }, "identifierName": "_color" @@ -1170,15 +1170,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 632, - "end": 637, + "start": 684, + "end": 689, "loc": { "start": { - "line": 22, + "line": 23, "column": 45 }, "end": { - "line": 22, + "line": 23, "column": 50 }, "identifierName": "BLACK" @@ -1192,43 +1192,43 @@ }, { "type": "ExpressionStatement", - "start": 641, - "end": 694, + "start": 693, + "end": 746, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 54 } }, "expression": { "type": "CallExpression", - "start": 641, - "end": 693, + "start": 693, + "end": 745, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 53 } }, "callee": { "type": "Identifier", - "start": 641, - "end": 647, + "start": 693, + "end": 699, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -1238,57 +1238,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 648, - "end": 692, + "start": 700, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 52 } }, "left": { "type": "BinaryExpression", - "start": 648, - "end": 664, + "start": 700, + "end": 716, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 648, - "end": 655, + "start": 700, + "end": 707, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 15 } }, "object": { "type": "Identifier", - "start": 648, - "end": 649, + "start": 700, + "end": 701, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -1297,15 +1297,15 @@ }, "property": { "type": "Identifier", - "start": 650, - "end": 655, + "start": 702, + "end": 707, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 15 }, "identifierName": "right" @@ -1317,15 +1317,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 660, - "end": 664, + "start": 712, + "end": 716, "loc": { "start": { - "line": 23, + "line": 24, "column": 20 }, "end": { - "line": 23, + "line": 24, "column": 24 } } @@ -1334,57 +1334,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 668, - "end": 692, + "start": 720, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 52 } }, "left": { "type": "MemberExpression", - "start": 668, - "end": 682, + "start": 720, + "end": 734, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 42 } }, "object": { "type": "MemberExpression", - "start": 668, - "end": 675, + "start": 720, + "end": 727, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 35 } }, "object": { "type": "Identifier", - "start": 668, - "end": 669, + "start": 720, + "end": 721, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 29 }, "identifierName": "n" @@ -1393,15 +1393,15 @@ }, "property": { "type": "Identifier", - "start": 670, - "end": 675, + "start": 722, + "end": 727, "loc": { "start": { - "line": 23, + "line": 24, "column": 30 }, "end": { - "line": 23, + "line": 24, "column": 35 }, "identifierName": "right" @@ -1412,15 +1412,15 @@ }, "property": { "type": "Identifier", - "start": 676, - "end": 682, + "start": 728, + "end": 734, "loc": { "start": { - "line": 23, + "line": 24, "column": 36 }, "end": { - "line": 23, + "line": 24, "column": 42 }, "identifierName": "_color" @@ -1432,15 +1432,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 687, - "end": 692, + "start": 739, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 47 }, "end": { - "line": 23, + "line": 24, "column": 52 }, "identifierName": "BLACK" @@ -1454,43 +1454,43 @@ }, { "type": "ExpressionStatement", - "start": 696, - "end": 722, + "start": 748, + "end": 774, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 696, - "end": 721, + "start": 748, + "end": 773, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 26 } }, "callee": { "type": "Identifier", - "start": 696, - "end": 702, + "start": 748, + "end": 754, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -1500,43 +1500,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 703, - "end": 720, + "start": 755, + "end": 772, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 703, - "end": 711, + "start": 755, + "end": 763, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 16 } }, "object": { "type": "Identifier", - "start": 703, - "end": 704, + "start": 755, + "end": 756, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 }, "identifierName": "n" @@ -1545,15 +1545,15 @@ }, "property": { "type": "Identifier", - "start": 705, - "end": 711, + "start": 757, + "end": 763, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 }, "identifierName": "parent" @@ -1565,15 +1565,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 716, - "end": 720, + "start": 768, + "end": 772, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -1584,43 +1584,43 @@ }, { "type": "ExpressionStatement", - "start": 724, - "end": 756, + "start": 776, + "end": 808, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 724, - "end": 755, + "start": 776, + "end": 807, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 32 } }, "callee": { "type": "Identifier", - "start": 724, - "end": 730, + "start": 776, + "end": 782, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -1630,57 +1630,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 731, - "end": 754, + "start": 783, + "end": 806, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 731, - "end": 746, + "start": 783, + "end": 798, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 731, - "end": 739, + "start": 783, + "end": 791, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 16 } }, "object": { "type": "Identifier", - "start": 731, - "end": 732, + "start": 783, + "end": 784, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 }, "identifierName": "n" @@ -1689,15 +1689,15 @@ }, "property": { "type": "Identifier", - "start": 733, - "end": 739, + "start": 785, + "end": 791, "loc": { "start": { - "line": 25, + "line": 26, "column": 10 }, "end": { - "line": 25, + "line": 26, "column": 16 }, "identifierName": "parent" @@ -1708,15 +1708,15 @@ }, "property": { "type": "Identifier", - "start": 740, - "end": 746, + "start": 792, + "end": 798, "loc": { "start": { - "line": 25, + "line": 26, "column": 17 }, "end": { - "line": 25, + "line": 26, "column": 23 }, "identifierName": "_color" @@ -1728,15 +1728,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 751, - "end": 754, + "start": 803, + "end": 806, "loc": { "start": { - "line": 25, + "line": 26, "column": 28 }, "end": { - "line": 25, + "line": 26, "column": 31 }, "identifierName": "RED" @@ -1749,44 +1749,44 @@ }, { "type": "VariableDeclaration", - "start": 758, - "end": 777, + "start": 810, + "end": 829, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 764, - "end": 776, + "start": 816, + "end": 828, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 19 } }, "id": { "type": "Identifier", - "start": 764, - "end": 765, + "start": 816, + "end": 817, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 }, "identifierName": "u" @@ -1795,29 +1795,29 @@ }, "init": { "type": "CallExpression", - "start": 768, - "end": 776, + "start": 820, + "end": 828, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 19 } }, "callee": { "type": "Identifier", - "start": 768, - "end": 773, + "start": 820, + "end": 825, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 16 }, "identifierName": "uncle" @@ -1827,15 +1827,15 @@ "arguments": [ { "type": "Identifier", - "start": 774, - "end": 775, + "start": 826, + "end": 827, "loc": { "start": { - "line": 26, + "line": 27, "column": 17 }, "end": { - "line": 26, + "line": 27, "column": 18 }, "identifierName": "n" @@ -1851,15 +1851,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 780, - "end": 1275, + "start": 832, + "end": 1327, "loc": { "start": { - "line": 28, + "line": 29, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 4 } } @@ -1868,57 +1868,57 @@ }, { "type": "IfStatement", - "start": 1278, - "end": 1482, + "start": 1330, + "end": 1519, "loc": { "start": { - "line": 42, + "line": 43, "column": 1 }, "end": { - "line": 49, - "column": 24 + "line": 50, + "column": 2 } }, "test": { "type": "LogicalExpression", - "start": 1282, - "end": 1314, + "start": 1334, + "end": 1366, "loc": { "start": { - "line": 42, + "line": 43, "column": 5 }, "end": { - "line": 42, + "line": 43, "column": 37 } }, "left": { "type": "BinaryExpression", - "start": 1282, - "end": 1292, + "start": 1334, + "end": 1344, "loc": { "start": { - "line": 42, + "line": 43, "column": 5 }, "end": { - "line": 42, + "line": 43, "column": 15 } }, "left": { "type": "Identifier", - "start": 1282, - "end": 1283, + "start": 1334, + "end": 1335, "loc": { "start": { - "line": 42, + "line": 43, "column": 5 }, "end": { - "line": 42, + "line": 43, "column": 6 }, "identifierName": "u" @@ -1929,15 +1929,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 1288, - "end": 1292, + "start": 1340, + "end": 1344, "loc": { "start": { - "line": 42, + "line": 43, "column": 11 }, "end": { - "line": 42, + "line": 43, "column": 15 } } @@ -1947,43 +1947,43 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 1296, - "end": 1314, + "start": 1348, + "end": 1366, "loc": { "start": { - "line": 42, + "line": 43, "column": 19 }, "end": { - "line": 42, + "line": 43, "column": 37 } }, "left": { "type": "MemberExpression", - "start": 1296, - "end": 1304, + "start": 1348, + "end": 1356, "loc": { "start": { - "line": 42, + "line": 43, "column": 19 }, "end": { - "line": 42, + "line": 43, "column": 27 } }, "object": { "type": "Identifier", - "start": 1296, - "end": 1297, + "start": 1348, + "end": 1349, "loc": { "start": { - "line": 42, + "line": 43, "column": 19 }, "end": { - "line": 42, + "line": 43, "column": 20 }, "identifierName": "u" @@ -1992,15 +1992,15 @@ }, "property": { "type": "Identifier", - "start": 1298, - "end": 1304, + "start": 1350, + "end": 1356, "loc": { "start": { - "line": 42, + "line": 43, "column": 21 }, "end": { - "line": 42, + "line": 43, "column": 27 }, "identifierName": "_color" @@ -2012,15 +2012,15 @@ "operator": "!==", "right": { "type": "Identifier", - "start": 1309, - "end": 1314, + "start": 1361, + "end": 1366, "loc": { "start": { - "line": 42, + "line": 43, "column": 32 }, "end": { - "line": 42, + "line": 43, "column": 37 }, "identifierName": "BLACK" @@ -2032,58 +2032,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 1316, - "end": 1460, + "start": 1368, + "end": 1519, "loc": { "start": { - "line": 42, + "line": 43, "column": 39 }, "end": { - "line": 49, + "line": 50, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1320, - "end": 1345, + "start": 1372, + "end": 1397, "loc": { "start": { - "line": 43, + "line": 44, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 1320, - "end": 1344, + "start": 1372, + "end": 1396, "loc": { "start": { - "line": 43, + "line": 44, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 26 } }, "callee": { "type": "Identifier", - "start": 1320, - "end": 1326, + "start": 1372, + "end": 1378, "loc": { "start": { - "line": 43, + "line": 44, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 8 }, "identifierName": "assert" @@ -2093,43 +2093,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1327, - "end": 1343, + "start": 1379, + "end": 1395, "loc": { "start": { - "line": 43, + "line": 44, "column": 9 }, "end": { - "line": 43, + "line": 44, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 1327, - "end": 1335, + "start": 1379, + "end": 1387, "loc": { "start": { - "line": 43, + "line": 44, "column": 9 }, "end": { - "line": 43, + "line": 44, "column": 17 } }, "object": { "type": "Identifier", - "start": 1327, - "end": 1328, + "start": 1379, + "end": 1380, "loc": { "start": { - "line": 43, + "line": 44, "column": 9 }, "end": { - "line": 43, + "line": 44, "column": 10 }, "identifierName": "u" @@ -2138,15 +2138,15 @@ }, "property": { "type": "Identifier", - "start": 1329, - "end": 1335, + "start": 1381, + "end": 1387, "loc": { "start": { - "line": 43, + "line": 44, "column": 11 }, "end": { - "line": 43, + "line": 44, "column": 17 }, "identifierName": "_color" @@ -2158,15 +2158,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1340, - "end": 1343, + "start": 1392, + "end": 1395, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 25 }, "identifierName": "RED" @@ -2179,72 +2179,72 @@ }, { "type": "ExpressionStatement", - "start": 1348, - "end": 1372, + "start": 1400, + "end": 1424, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 26 } }, "expression": { "type": "AssignmentExpression", - "start": 1348, - "end": 1371, + "start": 1400, + "end": 1423, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1348, - "end": 1363, + "start": 1400, + "end": 1415, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 17 } }, "object": { "type": "MemberExpression", - "start": 1348, - "end": 1356, + "start": 1400, + "end": 1408, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 10 } }, "object": { "type": "Identifier", - "start": 1348, - "end": 1349, + "start": 1400, + "end": 1401, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 3 }, "identifierName": "n" @@ -2253,15 +2253,15 @@ }, "property": { "type": "Identifier", - "start": 1350, - "end": 1356, + "start": 1402, + "end": 1408, "loc": { "start": { - "line": 44, + "line": 45, "column": 4 }, "end": { - "line": 44, + "line": 45, "column": 10 }, "identifierName": "parent" @@ -2272,15 +2272,15 @@ }, "property": { "type": "Identifier", - "start": 1357, - "end": 1363, + "start": 1409, + "end": 1415, "loc": { "start": { - "line": 44, + "line": 45, "column": 11 }, "end": { - "line": 44, + "line": 45, "column": 17 }, "identifierName": "_color" @@ -2291,15 +2291,15 @@ }, "right": { "type": "Identifier", - "start": 1366, - "end": 1371, + "start": 1418, + "end": 1423, "loc": { "start": { - "line": 44, + "line": 45, "column": 20 }, "end": { - "line": 44, + "line": 45, "column": 25 }, "identifierName": "BLACK" @@ -2310,58 +2310,58 @@ }, { "type": "ExpressionStatement", - "start": 1375, - "end": 1392, + "start": 1427, + "end": 1444, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 19 } }, "expression": { "type": "AssignmentExpression", - "start": 1375, - "end": 1391, + "start": 1427, + "end": 1443, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 18 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1375, - "end": 1383, + "start": 1427, + "end": 1435, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 10 } }, "object": { "type": "Identifier", - "start": 1375, - "end": 1376, + "start": 1427, + "end": 1428, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 3 }, "identifierName": "u" @@ -2370,15 +2370,15 @@ }, "property": { "type": "Identifier", - "start": 1377, - "end": 1383, + "start": 1429, + "end": 1435, "loc": { "start": { - "line": 45, + "line": 46, "column": 4 }, "end": { - "line": 45, + "line": 46, "column": 10 }, "identifierName": "_color" @@ -2389,15 +2389,15 @@ }, "right": { "type": "Identifier", - "start": 1386, - "end": 1391, + "start": 1438, + "end": 1443, "loc": { "start": { - "line": 45, + "line": 46, "column": 13 }, "end": { - "line": 45, + "line": 46, "column": 18 }, "identifierName": "BLACK" @@ -2408,44 +2408,44 @@ }, { "type": "VariableDeclaration", - "start": 1395, - "end": 1420, + "start": 1447, + "end": 1472, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 1401, - "end": 1419, + "start": 1453, + "end": 1471, "loc": { "start": { - "line": 46, + "line": 47, "column": 8 }, "end": { - "line": 46, + "line": 47, "column": 26 } }, "id": { "type": "Identifier", - "start": 1401, - "end": 1402, + "start": 1453, + "end": 1454, "loc": { "start": { - "line": 46, + "line": 47, "column": 8 }, "end": { - "line": 46, + "line": 47, "column": 9 }, "identifierName": "g" @@ -2454,29 +2454,29 @@ }, "init": { "type": "CallExpression", - "start": 1405, - "end": 1419, + "start": 1457, + "end": 1471, "loc": { "start": { - "line": 46, + "line": 47, "column": 12 }, "end": { - "line": 46, + "line": 47, "column": 26 } }, "callee": { "type": "Identifier", - "start": 1405, - "end": 1416, + "start": 1457, + "end": 1468, "loc": { "start": { - "line": 46, + "line": 47, "column": 12 }, "end": { - "line": 46, + "line": 47, "column": 23 }, "identifierName": "grandparent" @@ -2486,15 +2486,15 @@ "arguments": [ { "type": "Identifier", - "start": 1417, - "end": 1418, + "start": 1469, + "end": 1470, "loc": { "start": { - "line": 46, + "line": 47, "column": 24 }, "end": { - "line": 46, + "line": 47, "column": 25 }, "identifierName": "n" @@ -2509,58 +2509,58 @@ }, { "type": "ExpressionStatement", - "start": 1423, - "end": 1438, + "start": 1475, + "end": 1490, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 17 } }, "expression": { "type": "AssignmentExpression", - "start": 1423, - "end": 1437, + "start": 1475, + "end": 1489, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 16 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1423, - "end": 1431, + "start": 1475, + "end": 1483, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 10 } }, "object": { "type": "Identifier", - "start": 1423, - "end": 1424, + "start": 1475, + "end": 1476, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 3 }, "identifierName": "g" @@ -2569,15 +2569,15 @@ }, "property": { "type": "Identifier", - "start": 1425, - "end": 1431, + "start": 1477, + "end": 1483, "loc": { "start": { - "line": 47, + "line": 48, "column": 4 }, "end": { - "line": 47, + "line": 48, "column": 10 }, "identifierName": "_color" @@ -2588,15 +2588,15 @@ }, "right": { "type": "Identifier", - "start": 1434, - "end": 1437, + "start": 1486, + "end": 1489, "loc": { "start": { - "line": 47, + "line": 48, "column": 13 }, "end": { - "line": 47, + "line": 48, "column": 16 }, "identifierName": "RED" @@ -2606,45 +2606,45 @@ } }, { - "type": "ExpressionStatement", - "start": 1441, - "end": 1457, + "type": "ReturnStatement", + "start": 1493, + "end": 1516, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, - "column": 18 + "line": 49, + "column": 25 } }, - "expression": { + "argument": { "type": "CallExpression", - "start": 1441, - "end": 1456, + "start": 1500, + "end": 1515, "loc": { "start": { - "line": 48, - "column": 2 + "line": 49, + "column": 9 }, "end": { - "line": 48, - "column": 17 + "line": 49, + "column": 24 } }, "callee": { "type": "Identifier", - "start": 1441, - "end": 1453, + "start": 1500, + "end": 1512, "loc": { "start": { - "line": 48, - "column": 2 + "line": 49, + "column": 9 }, "end": { - "line": 48, - "column": 14 + "line": 49, + "column": 21 }, "identifierName": "insert_case0" }, @@ -2653,16 +2653,16 @@ "arguments": [ { "type": "Identifier", - "start": 1454, - "end": 1455, + "start": 1513, + "end": 1514, "loc": { "start": { - "line": 48, - "column": 15 + "line": 49, + "column": 22 }, "end": { - "line": 48, - "column": 16 + "line": 49, + "column": 23 }, "identifierName": "g" }, @@ -2674,90 +2674,91 @@ ], "directives": [] }, - "alternate": { - "type": "ExpressionStatement", - "start": 1466, - "end": 1482, - "loc": { - "start": { - "line": 49, - "column": 8 - }, - "end": { - "line": 49, - "column": 24 - } - }, - "expression": { - "type": "CallExpression", - "start": 1466, - "end": 1481, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 832, + "end": 1327, "loc": { "start": { - "line": 49, - "column": 8 + "line": 29, + "column": 1 }, "end": { - "line": 49, - "column": 23 - } - }, - "callee": { - "type": "Identifier", - "start": 1466, - "end": 1478, - "loc": { - "start": { - "line": 49, - "column": 8 - }, - "end": { - "line": 49, - "column": 20 - }, - "identifierName": "insert_case3" - }, - "name": "insert_case3" - }, - "arguments": [ - { - "type": "Identifier", - "start": 1479, - "end": 1480, - "loc": { - "start": { - "line": 49, - "column": 21 - }, - "end": { - "line": 49, - "column": 22 - }, - "identifierName": "n" - }, - "name": "n" + "line": 41, + "column": 4 } - ] + } } - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 780, - "end": 1275, + ] + }, + { + "type": "ReturnStatement", + "start": 1522, + "end": 1545, + "loc": { + "start": { + "line": 52, + "column": 1 + }, + "end": { + "line": 52, + "column": 24 + } + }, + "argument": { + "type": "CallExpression", + "start": 1529, + "end": 1544, + "loc": { + "start": { + "line": 52, + "column": 8 + }, + "end": { + "line": 52, + "column": 23 + } + }, + "callee": { + "type": "Identifier", + "start": 1529, + "end": 1541, "loc": { "start": { - "line": 28, - "column": 1 + "line": 52, + "column": 8 }, "end": { - "line": 40, - "column": 4 - } + "line": 52, + "column": 20 + }, + "identifierName": "insert_case3" + }, + "name": "insert_case3" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1542, + "end": 1543, + "loc": { + "start": { + "line": 52, + "column": 21 + }, + "end": { + "line": 52, + "column": 22 + }, + "identifierName": "n" + }, + "name": "n" } - } - ] + ] + } } ], "directives": [] @@ -2773,29 +2774,29 @@ }, { "type": "Identifier", - "start": 1487, - "end": 1515, + "start": 1550, + "end": 1578, "loc": { "start": { - "line": 52, + "line": 55, "column": 0 }, "end": { - "line": 52, + "line": 55, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 1502, - "end": 1514, + "start": 1565, + "end": 1577, "loc": { "start": { - "line": 52, + "line": 55, "column": 15 }, "end": { - "line": 52, + "line": 55, "column": 27 }, "identifierName": "insert_case2" @@ -2808,58 +2809,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 1487, - "end": 1515, + "start": 1550, + "end": 1578, "loc": { "start": { - "line": 52, + "line": 55, "column": 0 }, "end": { - "line": 52, + "line": 55, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 502, - "end": 1485, + "start": 554, + "end": 1548, "loc": { "start": { - "line": 19, + "line": 20, "column": 0 }, "end": { - "line": 50, + "line": 53, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 508, - "end": 1484, + "start": 560, + "end": 1547, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 50, + "line": 53, "column": 1 } }, "id": { "type": "Identifier", - "start": 508, - "end": 520, + "start": 560, + "end": 572, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 18 }, "identifierName": "insert_case2" @@ -2869,29 +2870,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 523, - "end": 1484, + "start": 575, + "end": 1547, "loc": { "start": { - "line": 19, + "line": 20, "column": 21 }, "end": { - "line": 50, + "line": 53, "column": 1 } }, "id": { "type": "Identifier", - "start": 508, - "end": 520, + "start": 560, + "end": 572, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 18 }, "identifierName": "insert_case2" @@ -2905,15 +2906,15 @@ "params": [ { "type": "Identifier", - "start": 524, - "end": 525, + "start": 576, + "end": 577, "loc": { "start": { - "line": 19, + "line": 20, "column": 22 }, "end": { - "line": 19, + "line": 20, "column": 23 }, "identifierName": "n" @@ -2923,58 +2924,58 @@ ], "body": { "type": "BlockStatement", - "start": 530, - "end": 1484, + "start": 582, + "end": 1547, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 50, + "line": 53, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 533, - "end": 559, + "start": 585, + "end": 611, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 533, - "end": 558, + "start": 585, + "end": 610, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 533, - "end": 539, + "start": 585, + "end": 591, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -2984,29 +2985,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 540, - "end": 557, + "start": 592, + "end": 609, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 25 } }, "left": { "type": "Identifier", - "start": 540, - "end": 541, + "start": 592, + "end": 593, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 }, "identifierName": "n" @@ -3016,15 +3017,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 553, - "end": 557, + "start": 605, + "end": 609, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 }, "identifierName": "Node" @@ -3037,43 +3038,43 @@ }, { "type": "ExpressionStatement", - "start": 561, - "end": 586, + "start": 613, + "end": 638, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 561, - "end": 585, + "start": 613, + "end": 637, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 25 } }, "callee": { "type": "Identifier", - "start": 561, - "end": 567, + "start": 613, + "end": 619, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -3083,43 +3084,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 568, - "end": 584, + "start": 620, + "end": 636, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 568, - "end": 576, + "start": 620, + "end": 628, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 16 } }, "object": { "type": "Identifier", - "start": 568, - "end": 569, + "start": 620, + "end": 621, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 }, "identifierName": "n" @@ -3128,15 +3129,15 @@ }, "property": { "type": "Identifier", - "start": 570, - "end": 576, + "start": 622, + "end": 628, "loc": { "start": { - "line": 21, + "line": 22, "column": 10 }, "end": { - "line": 21, + "line": 22, "column": 16 }, "identifierName": "_color" @@ -3148,15 +3149,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 581, - "end": 584, + "start": 633, + "end": 636, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 24 }, "identifierName": "RED" @@ -3169,43 +3170,43 @@ }, { "type": "ExpressionStatement", - "start": 588, - "end": 639, + "start": 640, + "end": 691, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 52 } }, "expression": { "type": "CallExpression", - "start": 588, - "end": 638, + "start": 640, + "end": 690, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 51 } }, "callee": { "type": "Identifier", - "start": 588, - "end": 594, + "start": 640, + "end": 646, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -3215,57 +3216,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 595, - "end": 637, + "start": 647, + "end": 689, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 50 } }, "left": { "type": "BinaryExpression", - "start": 595, - "end": 610, + "start": 647, + "end": 662, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 23 } }, "left": { "type": "MemberExpression", - "start": 595, - "end": 601, + "start": 647, + "end": 653, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 14 } }, "object": { "type": "Identifier", - "start": 595, - "end": 596, + "start": 647, + "end": 648, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -3274,15 +3275,15 @@ }, "property": { "type": "Identifier", - "start": 597, - "end": 601, + "start": 649, + "end": 653, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 14 }, "identifierName": "left" @@ -3294,15 +3295,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 606, - "end": 610, + "start": 658, + "end": 662, "loc": { "start": { - "line": 22, + "line": 23, "column": 19 }, "end": { - "line": 22, + "line": 23, "column": 23 } } @@ -3311,57 +3312,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 614, - "end": 637, + "start": 666, + "end": 689, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 50 } }, "left": { "type": "MemberExpression", - "start": 614, - "end": 627, + "start": 666, + "end": 679, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 40 } }, "object": { "type": "MemberExpression", - "start": 614, - "end": 620, + "start": 666, + "end": 672, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 33 } }, "object": { "type": "Identifier", - "start": 614, - "end": 615, + "start": 666, + "end": 667, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 28 }, "identifierName": "n" @@ -3370,15 +3371,15 @@ }, "property": { "type": "Identifier", - "start": 616, - "end": 620, + "start": 668, + "end": 672, "loc": { "start": { - "line": 22, + "line": 23, "column": 29 }, "end": { - "line": 22, + "line": 23, "column": 33 }, "identifierName": "left" @@ -3389,15 +3390,15 @@ }, "property": { "type": "Identifier", - "start": 621, - "end": 627, + "start": 673, + "end": 679, "loc": { "start": { - "line": 22, + "line": 23, "column": 34 }, "end": { - "line": 22, + "line": 23, "column": 40 }, "identifierName": "_color" @@ -3409,15 +3410,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 632, - "end": 637, + "start": 684, + "end": 689, "loc": { "start": { - "line": 22, + "line": 23, "column": 45 }, "end": { - "line": 22, + "line": 23, "column": 50 }, "identifierName": "BLACK" @@ -3431,43 +3432,43 @@ }, { "type": "ExpressionStatement", - "start": 641, - "end": 694, + "start": 693, + "end": 746, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 54 } }, "expression": { "type": "CallExpression", - "start": 641, - "end": 693, + "start": 693, + "end": 745, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 53 } }, "callee": { "type": "Identifier", - "start": 641, - "end": 647, + "start": 693, + "end": 699, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -3477,57 +3478,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 648, - "end": 692, + "start": 700, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 52 } }, "left": { "type": "BinaryExpression", - "start": 648, - "end": 664, + "start": 700, + "end": 716, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 648, - "end": 655, + "start": 700, + "end": 707, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 15 } }, "object": { "type": "Identifier", - "start": 648, - "end": 649, + "start": 700, + "end": 701, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -3536,15 +3537,15 @@ }, "property": { "type": "Identifier", - "start": 650, - "end": 655, + "start": 702, + "end": 707, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 15 }, "identifierName": "right" @@ -3556,15 +3557,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 660, - "end": 664, + "start": 712, + "end": 716, "loc": { "start": { - "line": 23, + "line": 24, "column": 20 }, "end": { - "line": 23, + "line": 24, "column": 24 } } @@ -3573,57 +3574,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 668, - "end": 692, + "start": 720, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 52 } }, "left": { "type": "MemberExpression", - "start": 668, - "end": 682, + "start": 720, + "end": 734, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 42 } }, "object": { "type": "MemberExpression", - "start": 668, - "end": 675, + "start": 720, + "end": 727, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 35 } }, "object": { "type": "Identifier", - "start": 668, - "end": 669, + "start": 720, + "end": 721, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 29 }, "identifierName": "n" @@ -3632,15 +3633,15 @@ }, "property": { "type": "Identifier", - "start": 670, - "end": 675, + "start": 722, + "end": 727, "loc": { "start": { - "line": 23, + "line": 24, "column": 30 }, "end": { - "line": 23, + "line": 24, "column": 35 }, "identifierName": "right" @@ -3651,15 +3652,15 @@ }, "property": { "type": "Identifier", - "start": 676, - "end": 682, + "start": 728, + "end": 734, "loc": { "start": { - "line": 23, + "line": 24, "column": 36 }, "end": { - "line": 23, + "line": 24, "column": 42 }, "identifierName": "_color" @@ -3671,15 +3672,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 687, - "end": 692, + "start": 739, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 47 }, "end": { - "line": 23, + "line": 24, "column": 52 }, "identifierName": "BLACK" @@ -3693,43 +3694,43 @@ }, { "type": "ExpressionStatement", - "start": 696, - "end": 722, + "start": 748, + "end": 774, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 696, - "end": 721, + "start": 748, + "end": 773, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 26 } }, "callee": { "type": "Identifier", - "start": 696, - "end": 702, + "start": 748, + "end": 754, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -3739,43 +3740,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 703, - "end": 720, + "start": 755, + "end": 772, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 703, - "end": 711, + "start": 755, + "end": 763, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 16 } }, "object": { "type": "Identifier", - "start": 703, - "end": 704, + "start": 755, + "end": 756, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 }, "identifierName": "n" @@ -3784,15 +3785,15 @@ }, "property": { "type": "Identifier", - "start": 705, - "end": 711, + "start": 757, + "end": 763, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 }, "identifierName": "parent" @@ -3804,15 +3805,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 716, - "end": 720, + "start": 768, + "end": 772, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -3823,43 +3824,43 @@ }, { "type": "ExpressionStatement", - "start": 724, - "end": 756, + "start": 776, + "end": 808, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 724, - "end": 755, + "start": 776, + "end": 807, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 32 } }, "callee": { "type": "Identifier", - "start": 724, - "end": 730, + "start": 776, + "end": 782, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -3869,57 +3870,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 731, - "end": 754, + "start": 783, + "end": 806, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 731, - "end": 746, + "start": 783, + "end": 798, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 731, - "end": 739, + "start": 783, + "end": 791, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 16 } }, "object": { "type": "Identifier", - "start": 731, - "end": 732, + "start": 783, + "end": 784, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 }, "identifierName": "n" @@ -3928,15 +3929,15 @@ }, "property": { "type": "Identifier", - "start": 733, - "end": 739, + "start": 785, + "end": 791, "loc": { "start": { - "line": 25, + "line": 26, "column": 10 }, "end": { - "line": 25, + "line": 26, "column": 16 }, "identifierName": "parent" @@ -3947,15 +3948,15 @@ }, "property": { "type": "Identifier", - "start": 740, - "end": 746, + "start": 792, + "end": 798, "loc": { "start": { - "line": 25, + "line": 26, "column": 17 }, "end": { - "line": 25, + "line": 26, "column": 23 }, "identifierName": "_color" @@ -3967,15 +3968,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 751, - "end": 754, + "start": 803, + "end": 806, "loc": { "start": { - "line": 25, + "line": 26, "column": 28 }, "end": { - "line": 25, + "line": 26, "column": 31 }, "identifierName": "RED" @@ -3988,44 +3989,44 @@ }, { "type": "VariableDeclaration", - "start": 758, - "end": 777, + "start": 810, + "end": 829, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 764, - "end": 776, + "start": 816, + "end": 828, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 19 } }, "id": { "type": "Identifier", - "start": 764, - "end": 765, + "start": 816, + "end": 817, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 }, "identifierName": "u" @@ -4034,29 +4035,29 @@ }, "init": { "type": "CallExpression", - "start": 768, - "end": 776, + "start": 820, + "end": 828, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 19 } }, "callee": { "type": "Identifier", - "start": 768, - "end": 773, + "start": 820, + "end": 825, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 16 }, "identifierName": "uncle" @@ -4066,15 +4067,15 @@ "arguments": [ { "type": "Identifier", - "start": 774, - "end": 775, + "start": 826, + "end": 827, "loc": { "start": { - "line": 26, + "line": 27, "column": 17 }, "end": { - "line": 26, + "line": 27, "column": 18 }, "identifierName": "n" @@ -4090,15 +4091,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 780, - "end": 1275, + "start": 832, + "end": 1327, "loc": { "start": { - "line": 28, + "line": 29, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 4 } } @@ -4107,57 +4108,57 @@ }, { "type": "IfStatement", - "start": 1278, - "end": 1482, + "start": 1330, + "end": 1519, "loc": { "start": { - "line": 42, + "line": 43, "column": 1 }, "end": { - "line": 49, - "column": 24 + "line": 50, + "column": 2 } }, "test": { "type": "LogicalExpression", - "start": 1282, - "end": 1314, + "start": 1334, + "end": 1366, "loc": { "start": { - "line": 42, + "line": 43, "column": 5 }, "end": { - "line": 42, + "line": 43, "column": 37 } }, "left": { "type": "BinaryExpression", - "start": 1282, - "end": 1292, + "start": 1334, + "end": 1344, "loc": { "start": { - "line": 42, + "line": 43, "column": 5 }, "end": { - "line": 42, + "line": 43, "column": 15 } }, "left": { "type": "Identifier", - "start": 1282, - "end": 1283, + "start": 1334, + "end": 1335, "loc": { "start": { - "line": 42, + "line": 43, "column": 5 }, "end": { - "line": 42, + "line": 43, "column": 6 }, "identifierName": "u" @@ -4168,15 +4169,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 1288, - "end": 1292, + "start": 1340, + "end": 1344, "loc": { "start": { - "line": 42, + "line": 43, "column": 11 }, "end": { - "line": 42, + "line": 43, "column": 15 } } @@ -4186,43 +4187,43 @@ "operator": "&&", "right": { "type": "BinaryExpression", - "start": 1296, - "end": 1314, + "start": 1348, + "end": 1366, "loc": { "start": { - "line": 42, + "line": 43, "column": 19 }, "end": { - "line": 42, + "line": 43, "column": 37 } }, "left": { "type": "MemberExpression", - "start": 1296, - "end": 1304, + "start": 1348, + "end": 1356, "loc": { "start": { - "line": 42, + "line": 43, "column": 19 }, "end": { - "line": 42, + "line": 43, "column": 27 } }, "object": { "type": "Identifier", - "start": 1296, - "end": 1297, + "start": 1348, + "end": 1349, "loc": { "start": { - "line": 42, + "line": 43, "column": 19 }, "end": { - "line": 42, + "line": 43, "column": 20 }, "identifierName": "u" @@ -4231,15 +4232,15 @@ }, "property": { "type": "Identifier", - "start": 1298, - "end": 1304, + "start": 1350, + "end": 1356, "loc": { "start": { - "line": 42, + "line": 43, "column": 21 }, "end": { - "line": 42, + "line": 43, "column": 27 }, "identifierName": "_color" @@ -4251,15 +4252,15 @@ "operator": "!==", "right": { "type": "Identifier", - "start": 1309, - "end": 1314, + "start": 1361, + "end": 1366, "loc": { "start": { - "line": 42, + "line": 43, "column": 32 }, "end": { - "line": 42, + "line": 43, "column": 37 }, "identifierName": "BLACK" @@ -4271,58 +4272,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 1316, - "end": 1460, + "start": 1368, + "end": 1519, "loc": { "start": { - "line": 42, + "line": 43, "column": 39 }, "end": { - "line": 49, + "line": 50, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1320, - "end": 1345, + "start": 1372, + "end": 1397, "loc": { "start": { - "line": 43, + "line": 44, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 1320, - "end": 1344, + "start": 1372, + "end": 1396, "loc": { "start": { - "line": 43, + "line": 44, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 26 } }, "callee": { "type": "Identifier", - "start": 1320, - "end": 1326, + "start": 1372, + "end": 1378, "loc": { "start": { - "line": 43, + "line": 44, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 8 }, "identifierName": "assert" @@ -4332,43 +4333,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1327, - "end": 1343, + "start": 1379, + "end": 1395, "loc": { "start": { - "line": 43, + "line": 44, "column": 9 }, "end": { - "line": 43, + "line": 44, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 1327, - "end": 1335, + "start": 1379, + "end": 1387, "loc": { "start": { - "line": 43, + "line": 44, "column": 9 }, "end": { - "line": 43, + "line": 44, "column": 17 } }, "object": { "type": "Identifier", - "start": 1327, - "end": 1328, + "start": 1379, + "end": 1380, "loc": { "start": { - "line": 43, + "line": 44, "column": 9 }, "end": { - "line": 43, + "line": 44, "column": 10 }, "identifierName": "u" @@ -4377,15 +4378,15 @@ }, "property": { "type": "Identifier", - "start": 1329, - "end": 1335, + "start": 1381, + "end": 1387, "loc": { "start": { - "line": 43, + "line": 44, "column": 11 }, "end": { - "line": 43, + "line": 44, "column": 17 }, "identifierName": "_color" @@ -4397,15 +4398,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1340, - "end": 1343, + "start": 1392, + "end": 1395, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 25 }, "identifierName": "RED" @@ -4418,72 +4419,72 @@ }, { "type": "ExpressionStatement", - "start": 1348, - "end": 1372, + "start": 1400, + "end": 1424, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 26 } }, "expression": { "type": "AssignmentExpression", - "start": 1348, - "end": 1371, + "start": 1400, + "end": 1423, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 25 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1348, - "end": 1363, + "start": 1400, + "end": 1415, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 17 } }, "object": { "type": "MemberExpression", - "start": 1348, - "end": 1356, + "start": 1400, + "end": 1408, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 10 } }, "object": { "type": "Identifier", - "start": 1348, - "end": 1349, + "start": 1400, + "end": 1401, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 3 }, "identifierName": "n" @@ -4492,15 +4493,15 @@ }, "property": { "type": "Identifier", - "start": 1350, - "end": 1356, + "start": 1402, + "end": 1408, "loc": { "start": { - "line": 44, + "line": 45, "column": 4 }, "end": { - "line": 44, + "line": 45, "column": 10 }, "identifierName": "parent" @@ -4511,15 +4512,15 @@ }, "property": { "type": "Identifier", - "start": 1357, - "end": 1363, + "start": 1409, + "end": 1415, "loc": { "start": { - "line": 44, + "line": 45, "column": 11 }, "end": { - "line": 44, + "line": 45, "column": 17 }, "identifierName": "_color" @@ -4530,15 +4531,15 @@ }, "right": { "type": "Identifier", - "start": 1366, - "end": 1371, + "start": 1418, + "end": 1423, "loc": { "start": { - "line": 44, + "line": 45, "column": 20 }, "end": { - "line": 44, + "line": 45, "column": 25 }, "identifierName": "BLACK" @@ -4549,58 +4550,58 @@ }, { "type": "ExpressionStatement", - "start": 1375, - "end": 1392, + "start": 1427, + "end": 1444, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 19 } }, "expression": { "type": "AssignmentExpression", - "start": 1375, - "end": 1391, + "start": 1427, + "end": 1443, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 18 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1375, - "end": 1383, + "start": 1427, + "end": 1435, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 10 } }, "object": { "type": "Identifier", - "start": 1375, - "end": 1376, + "start": 1427, + "end": 1428, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 3 }, "identifierName": "u" @@ -4609,15 +4610,15 @@ }, "property": { "type": "Identifier", - "start": 1377, - "end": 1383, + "start": 1429, + "end": 1435, "loc": { "start": { - "line": 45, + "line": 46, "column": 4 }, "end": { - "line": 45, + "line": 46, "column": 10 }, "identifierName": "_color" @@ -4628,15 +4629,15 @@ }, "right": { "type": "Identifier", - "start": 1386, - "end": 1391, + "start": 1438, + "end": 1443, "loc": { "start": { - "line": 45, + "line": 46, "column": 13 }, "end": { - "line": 45, + "line": 46, "column": 18 }, "identifierName": "BLACK" @@ -4647,44 +4648,44 @@ }, { "type": "VariableDeclaration", - "start": 1395, - "end": 1420, + "start": 1447, + "end": 1472, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 27 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 1401, - "end": 1419, + "start": 1453, + "end": 1471, "loc": { "start": { - "line": 46, + "line": 47, "column": 8 }, "end": { - "line": 46, + "line": 47, "column": 26 } }, "id": { "type": "Identifier", - "start": 1401, - "end": 1402, + "start": 1453, + "end": 1454, "loc": { "start": { - "line": 46, + "line": 47, "column": 8 }, "end": { - "line": 46, + "line": 47, "column": 9 }, "identifierName": "g" @@ -4693,29 +4694,29 @@ }, "init": { "type": "CallExpression", - "start": 1405, - "end": 1419, + "start": 1457, + "end": 1471, "loc": { "start": { - "line": 46, + "line": 47, "column": 12 }, "end": { - "line": 46, + "line": 47, "column": 26 } }, "callee": { "type": "Identifier", - "start": 1405, - "end": 1416, + "start": 1457, + "end": 1468, "loc": { "start": { - "line": 46, + "line": 47, "column": 12 }, "end": { - "line": 46, + "line": 47, "column": 23 }, "identifierName": "grandparent" @@ -4725,15 +4726,15 @@ "arguments": [ { "type": "Identifier", - "start": 1417, - "end": 1418, + "start": 1469, + "end": 1470, "loc": { "start": { - "line": 46, + "line": 47, "column": 24 }, "end": { - "line": 46, + "line": 47, "column": 25 }, "identifierName": "n" @@ -4748,58 +4749,58 @@ }, { "type": "ExpressionStatement", - "start": 1423, - "end": 1438, + "start": 1475, + "end": 1490, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 17 } }, "expression": { "type": "AssignmentExpression", - "start": 1423, - "end": 1437, + "start": 1475, + "end": 1489, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 16 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1423, - "end": 1431, + "start": 1475, + "end": 1483, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 10 } }, "object": { "type": "Identifier", - "start": 1423, - "end": 1424, + "start": 1475, + "end": 1476, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 3 }, "identifierName": "g" @@ -4808,15 +4809,15 @@ }, "property": { "type": "Identifier", - "start": 1425, - "end": 1431, + "start": 1477, + "end": 1483, "loc": { "start": { - "line": 47, + "line": 48, "column": 4 }, "end": { - "line": 47, + "line": 48, "column": 10 }, "identifierName": "_color" @@ -4827,15 +4828,15 @@ }, "right": { "type": "Identifier", - "start": 1434, - "end": 1437, + "start": 1486, + "end": 1489, "loc": { "start": { - "line": 47, + "line": 48, "column": 13 }, "end": { - "line": 47, + "line": 48, "column": 16 }, "identifierName": "RED" @@ -4845,45 +4846,45 @@ } }, { - "type": "ExpressionStatement", - "start": 1441, - "end": 1457, + "type": "ReturnStatement", + "start": 1493, + "end": 1516, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, - "column": 18 + "line": 49, + "column": 25 } }, - "expression": { + "argument": { "type": "CallExpression", - "start": 1441, - "end": 1456, + "start": 1500, + "end": 1515, "loc": { "start": { - "line": 48, - "column": 2 + "line": 49, + "column": 9 }, "end": { - "line": 48, - "column": 17 + "line": 49, + "column": 24 } }, "callee": { "type": "Identifier", - "start": 1441, - "end": 1453, + "start": 1500, + "end": 1512, "loc": { "start": { - "line": 48, - "column": 2 + "line": 49, + "column": 9 }, "end": { - "line": 48, - "column": 14 + "line": 49, + "column": 21 }, "identifierName": "insert_case0" }, @@ -4892,16 +4893,16 @@ "arguments": [ { "type": "Identifier", - "start": 1454, - "end": 1455, + "start": 1513, + "end": 1514, "loc": { "start": { - "line": 48, - "column": 15 + "line": 49, + "column": 22 }, "end": { - "line": 48, - "column": 16 + "line": 49, + "column": 23 }, "identifierName": "g" }, @@ -4913,90 +4914,91 @@ ], "directives": [] }, - "alternate": { - "type": "ExpressionStatement", - "start": 1466, - "end": 1482, + "alternate": null, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", + "start": 832, + "end": 1327, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 41, + "column": 4 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 1522, + "end": 1545, + "loc": { + "start": { + "line": 52, + "column": 1 + }, + "end": { + "line": 52, + "column": 24 + } + }, + "argument": { + "type": "CallExpression", + "start": 1529, + "end": 1544, "loc": { "start": { - "line": 49, + "line": 52, "column": 8 }, "end": { - "line": 49, - "column": 24 + "line": 52, + "column": 23 } }, - "expression": { - "type": "CallExpression", - "start": 1466, - "end": 1481, + "callee": { + "type": "Identifier", + "start": 1529, + "end": 1541, "loc": { "start": { - "line": 49, + "line": 52, "column": 8 }, "end": { - "line": 49, - "column": 23 - } + "line": 52, + "column": 20 + }, + "identifierName": "insert_case3" }, - "callee": { + "name": "insert_case3" + }, + "arguments": [ + { "type": "Identifier", - "start": 1466, - "end": 1478, + "start": 1542, + "end": 1543, "loc": { "start": { - "line": 49, - "column": 8 + "line": 52, + "column": 21 }, "end": { - "line": 49, - "column": 20 - }, - "identifierName": "insert_case3" - }, - "name": "insert_case3" - }, - "arguments": [ - { - "type": "Identifier", - "start": 1479, - "end": 1480, - "loc": { - "start": { - "line": 49, - "column": 21 - }, - "end": { - "line": 49, - "column": 22 - }, - "identifierName": "n" + "line": 52, + "column": 22 }, - "name": "n" - } - ] - } - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 780, - "end": 1275, - "loc": { - "start": { - "line": 28, - "column": 1 + "identifierName": "n" }, - "end": { - "line": 40, - "column": 4 - } + "name": "n" } - } - ] + ] + } } ], "directives": [] @@ -5009,16 +5011,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 325, - "end": 501, + "end": 553, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 18, + "line": 19, "column": 3 } } @@ -5033,16 +5035,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 325, - "end": 501, + "end": 553, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 18, + "line": 19, "column": 3 } } @@ -5050,15 +5052,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 780, - "end": 1275, + "start": 832, + "end": 1327, "loc": { "start": { - "line": 28, + "line": 29, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 4 } } @@ -6131,16 +6133,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 325, - "end": 501, + "end": 553, "loc": { "start": { "line": 10, "column": 0 }, "end": { - "line": 18, + "line": 19, "column": 3 } } @@ -6160,15 +6162,15 @@ "updateContext": null }, "value": "const", - "start": 502, - "end": 507, + "start": 554, + "end": 559, "loc": { "start": { - "line": 19, + "line": 20, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 5 } } @@ -6186,15 +6188,15 @@ "binop": null }, "value": "insert_case2", - "start": 508, - "end": 520, + "start": 560, + "end": 572, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 18 } } @@ -6213,15 +6215,15 @@ "updateContext": null }, "value": "=", - "start": 521, - "end": 522, + "start": 573, + "end": 574, "loc": { "start": { - "line": 19, + "line": 20, "column": 19 }, "end": { - "line": 19, + "line": 20, "column": 20 } } @@ -6238,15 +6240,15 @@ "postfix": false, "binop": null }, - "start": 523, - "end": 524, + "start": 575, + "end": 576, "loc": { "start": { - "line": 19, + "line": 20, "column": 21 }, "end": { - "line": 19, + "line": 20, "column": 22 } } @@ -6264,15 +6266,15 @@ "binop": null }, "value": "n", - "start": 524, - "end": 525, + "start": 576, + "end": 577, "loc": { "start": { - "line": 19, + "line": 20, "column": 22 }, "end": { - "line": 19, + "line": 20, "column": 23 } } @@ -6289,15 +6291,15 @@ "postfix": false, "binop": null }, - "start": 525, - "end": 526, + "start": 577, + "end": 578, "loc": { "start": { - "line": 19, + "line": 20, "column": 23 }, "end": { - "line": 19, + "line": 20, "column": 24 } } @@ -6315,15 +6317,15 @@ "binop": null, "updateContext": null }, - "start": 527, - "end": 529, + "start": 579, + "end": 581, "loc": { "start": { - "line": 19, + "line": 20, "column": 25 }, "end": { - "line": 19, + "line": 20, "column": 27 } } @@ -6340,15 +6342,15 @@ "postfix": false, "binop": null }, - "start": 530, - "end": 531, + "start": 582, + "end": 583, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { - "line": 19, + "line": 20, "column": 29 } } @@ -6366,15 +6368,15 @@ "binop": null }, "value": "assert", - "start": 533, - "end": 539, + "start": 585, + "end": 591, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 } } @@ -6391,15 +6393,15 @@ "postfix": false, "binop": null }, - "start": 539, - "end": 540, + "start": 591, + "end": 592, "loc": { "start": { - "line": 20, + "line": 21, "column": 7 }, "end": { - "line": 20, + "line": 21, "column": 8 } } @@ -6417,15 +6419,15 @@ "binop": null }, "value": "n", - "start": 540, - "end": 541, + "start": 592, + "end": 593, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 } } @@ -6445,15 +6447,15 @@ "updateContext": null }, "value": "instanceof", - "start": 542, - "end": 552, + "start": 594, + "end": 604, "loc": { "start": { - "line": 20, + "line": 21, "column": 10 }, "end": { - "line": 20, + "line": 21, "column": 20 } } @@ -6471,15 +6473,15 @@ "binop": null }, "value": "Node", - "start": 553, - "end": 557, + "start": 605, + "end": 609, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 } } @@ -6496,15 +6498,15 @@ "postfix": false, "binop": null }, - "start": 557, - "end": 558, + "start": 609, + "end": 610, "loc": { "start": { - "line": 20, + "line": 21, "column": 25 }, "end": { - "line": 20, + "line": 21, "column": 26 } } @@ -6522,15 +6524,15 @@ "binop": null, "updateContext": null }, - "start": 558, - "end": 559, + "start": 610, + "end": 611, "loc": { "start": { - "line": 20, + "line": 21, "column": 26 }, "end": { - "line": 20, + "line": 21, "column": 27 } } @@ -6548,15 +6550,15 @@ "binop": null }, "value": "assert", - "start": 561, - "end": 567, + "start": 613, + "end": 619, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 } } @@ -6573,15 +6575,15 @@ "postfix": false, "binop": null }, - "start": 567, - "end": 568, + "start": 619, + "end": 620, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 8 } } @@ -6599,15 +6601,15 @@ "binop": null }, "value": "n", - "start": 568, - "end": 569, + "start": 620, + "end": 621, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 } } @@ -6625,15 +6627,15 @@ "binop": null, "updateContext": null }, - "start": 569, - "end": 570, + "start": 621, + "end": 622, "loc": { "start": { - "line": 21, + "line": 22, "column": 9 }, "end": { - "line": 21, + "line": 22, "column": 10 } } @@ -6651,15 +6653,15 @@ "binop": null }, "value": "_color", - "start": 570, - "end": 576, + "start": 622, + "end": 628, "loc": { "start": { - "line": 21, + "line": 22, "column": 10 }, "end": { - "line": 21, + "line": 22, "column": 16 } } @@ -6678,15 +6680,15 @@ "updateContext": null }, "value": "===", - "start": 577, - "end": 580, + "start": 629, + "end": 632, "loc": { "start": { - "line": 21, + "line": 22, "column": 17 }, "end": { - "line": 21, + "line": 22, "column": 20 } } @@ -6704,15 +6706,15 @@ "binop": null }, "value": "RED", - "start": 581, - "end": 584, + "start": 633, + "end": 636, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 24 } } @@ -6729,15 +6731,15 @@ "postfix": false, "binop": null }, - "start": 584, - "end": 585, + "start": 636, + "end": 637, "loc": { "start": { - "line": 21, + "line": 22, "column": 24 }, "end": { - "line": 21, + "line": 22, "column": 25 } } @@ -6755,15 +6757,15 @@ "binop": null, "updateContext": null }, - "start": 585, - "end": 586, + "start": 637, + "end": 638, "loc": { "start": { - "line": 21, + "line": 22, "column": 25 }, "end": { - "line": 21, + "line": 22, "column": 26 } } @@ -6781,15 +6783,15 @@ "binop": null }, "value": "assert", - "start": 588, - "end": 594, + "start": 640, + "end": 646, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 } } @@ -6806,15 +6808,15 @@ "postfix": false, "binop": null }, - "start": 594, - "end": 595, + "start": 646, + "end": 647, "loc": { "start": { - "line": 22, + "line": 23, "column": 7 }, "end": { - "line": 22, + "line": 23, "column": 8 } } @@ -6832,15 +6834,15 @@ "binop": null }, "value": "n", - "start": 595, - "end": 596, + "start": 647, + "end": 648, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 } } @@ -6858,15 +6860,15 @@ "binop": null, "updateContext": null }, - "start": 596, - "end": 597, + "start": 648, + "end": 649, "loc": { "start": { - "line": 22, + "line": 23, "column": 9 }, "end": { - "line": 22, + "line": 23, "column": 10 } } @@ -6884,15 +6886,15 @@ "binop": null }, "value": "left", - "start": 597, - "end": 601, + "start": 649, + "end": 653, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 14 } } @@ -6911,15 +6913,15 @@ "updateContext": null }, "value": "===", - "start": 602, - "end": 605, + "start": 654, + "end": 657, "loc": { "start": { - "line": 22, + "line": 23, "column": 15 }, "end": { - "line": 22, + "line": 23, "column": 18 } } @@ -6939,15 +6941,15 @@ "updateContext": null }, "value": "null", - "start": 606, - "end": 610, + "start": 658, + "end": 662, "loc": { "start": { - "line": 22, + "line": 23, "column": 19 }, "end": { - "line": 22, + "line": 23, "column": 23 } } @@ -6966,15 +6968,15 @@ "updateContext": null }, "value": "||", - "start": 611, - "end": 613, + "start": 663, + "end": 665, "loc": { "start": { - "line": 22, + "line": 23, "column": 24 }, "end": { - "line": 22, + "line": 23, "column": 26 } } @@ -6992,15 +6994,15 @@ "binop": null }, "value": "n", - "start": 614, - "end": 615, + "start": 666, + "end": 667, "loc": { "start": { - "line": 22, + "line": 23, "column": 27 }, "end": { - "line": 22, + "line": 23, "column": 28 } } @@ -7018,15 +7020,15 @@ "binop": null, "updateContext": null }, - "start": 615, - "end": 616, + "start": 667, + "end": 668, "loc": { "start": { - "line": 22, + "line": 23, "column": 28 }, "end": { - "line": 22, + "line": 23, "column": 29 } } @@ -7044,15 +7046,15 @@ "binop": null }, "value": "left", - "start": 616, - "end": 620, + "start": 668, + "end": 672, "loc": { "start": { - "line": 22, + "line": 23, "column": 29 }, "end": { - "line": 22, + "line": 23, "column": 33 } } @@ -7070,15 +7072,15 @@ "binop": null, "updateContext": null }, - "start": 620, - "end": 621, + "start": 672, + "end": 673, "loc": { "start": { - "line": 22, + "line": 23, "column": 33 }, "end": { - "line": 22, + "line": 23, "column": 34 } } @@ -7096,15 +7098,15 @@ "binop": null }, "value": "_color", - "start": 621, - "end": 627, + "start": 673, + "end": 679, "loc": { "start": { - "line": 22, + "line": 23, "column": 34 }, "end": { - "line": 22, + "line": 23, "column": 40 } } @@ -7123,15 +7125,15 @@ "updateContext": null }, "value": "===", - "start": 628, - "end": 631, + "start": 680, + "end": 683, "loc": { "start": { - "line": 22, + "line": 23, "column": 41 }, "end": { - "line": 22, + "line": 23, "column": 44 } } @@ -7149,15 +7151,15 @@ "binop": null }, "value": "BLACK", - "start": 632, - "end": 637, + "start": 684, + "end": 689, "loc": { "start": { - "line": 22, + "line": 23, "column": 45 }, "end": { - "line": 22, + "line": 23, "column": 50 } } @@ -7174,15 +7176,15 @@ "postfix": false, "binop": null }, - "start": 637, - "end": 638, + "start": 689, + "end": 690, "loc": { "start": { - "line": 22, + "line": 23, "column": 50 }, "end": { - "line": 22, + "line": 23, "column": 51 } } @@ -7200,15 +7202,15 @@ "binop": null, "updateContext": null }, - "start": 638, - "end": 639, + "start": 690, + "end": 691, "loc": { "start": { - "line": 22, + "line": 23, "column": 51 }, "end": { - "line": 22, + "line": 23, "column": 52 } } @@ -7226,15 +7228,15 @@ "binop": null }, "value": "assert", - "start": 641, - "end": 647, + "start": 693, + "end": 699, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 } } @@ -7251,15 +7253,15 @@ "postfix": false, "binop": null }, - "start": 647, - "end": 648, + "start": 699, + "end": 700, "loc": { "start": { - "line": 23, + "line": 24, "column": 7 }, "end": { - "line": 23, + "line": 24, "column": 8 } } @@ -7277,15 +7279,15 @@ "binop": null }, "value": "n", - "start": 648, - "end": 649, + "start": 700, + "end": 701, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 } } @@ -7303,15 +7305,15 @@ "binop": null, "updateContext": null }, - "start": 649, - "end": 650, + "start": 701, + "end": 702, "loc": { "start": { - "line": 23, + "line": 24, "column": 9 }, "end": { - "line": 23, + "line": 24, "column": 10 } } @@ -7329,15 +7331,15 @@ "binop": null }, "value": "right", - "start": 650, - "end": 655, + "start": 702, + "end": 707, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 15 } } @@ -7356,15 +7358,15 @@ "updateContext": null }, "value": "===", - "start": 656, - "end": 659, + "start": 708, + "end": 711, "loc": { "start": { - "line": 23, + "line": 24, "column": 16 }, "end": { - "line": 23, + "line": 24, "column": 19 } } @@ -7384,15 +7386,15 @@ "updateContext": null }, "value": "null", - "start": 660, - "end": 664, + "start": 712, + "end": 716, "loc": { "start": { - "line": 23, + "line": 24, "column": 20 }, "end": { - "line": 23, + "line": 24, "column": 24 } } @@ -7411,15 +7413,15 @@ "updateContext": null }, "value": "||", - "start": 665, - "end": 667, + "start": 717, + "end": 719, "loc": { "start": { - "line": 23, + "line": 24, "column": 25 }, "end": { - "line": 23, + "line": 24, "column": 27 } } @@ -7437,15 +7439,15 @@ "binop": null }, "value": "n", - "start": 668, - "end": 669, + "start": 720, + "end": 721, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 29 } } @@ -7463,15 +7465,15 @@ "binop": null, "updateContext": null }, - "start": 669, - "end": 670, + "start": 721, + "end": 722, "loc": { "start": { - "line": 23, + "line": 24, "column": 29 }, "end": { - "line": 23, + "line": 24, "column": 30 } } @@ -7489,15 +7491,15 @@ "binop": null }, "value": "right", - "start": 670, - "end": 675, + "start": 722, + "end": 727, "loc": { "start": { - "line": 23, + "line": 24, "column": 30 }, "end": { - "line": 23, + "line": 24, "column": 35 } } @@ -7515,15 +7517,15 @@ "binop": null, "updateContext": null }, - "start": 675, - "end": 676, + "start": 727, + "end": 728, "loc": { "start": { - "line": 23, + "line": 24, "column": 35 }, "end": { - "line": 23, + "line": 24, "column": 36 } } @@ -7541,15 +7543,15 @@ "binop": null }, "value": "_color", - "start": 676, - "end": 682, + "start": 728, + "end": 734, "loc": { "start": { - "line": 23, + "line": 24, "column": 36 }, "end": { - "line": 23, + "line": 24, "column": 42 } } @@ -7568,15 +7570,15 @@ "updateContext": null }, "value": "===", - "start": 683, - "end": 686, + "start": 735, + "end": 738, "loc": { "start": { - "line": 23, + "line": 24, "column": 43 }, "end": { - "line": 23, + "line": 24, "column": 46 } } @@ -7594,15 +7596,15 @@ "binop": null }, "value": "BLACK", - "start": 687, - "end": 692, + "start": 739, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 47 }, "end": { - "line": 23, + "line": 24, "column": 52 } } @@ -7619,15 +7621,15 @@ "postfix": false, "binop": null }, - "start": 692, - "end": 693, + "start": 744, + "end": 745, "loc": { "start": { - "line": 23, + "line": 24, "column": 52 }, "end": { - "line": 23, + "line": 24, "column": 53 } } @@ -7645,15 +7647,15 @@ "binop": null, "updateContext": null }, - "start": 693, - "end": 694, + "start": 745, + "end": 746, "loc": { "start": { - "line": 23, + "line": 24, "column": 53 }, "end": { - "line": 23, + "line": 24, "column": 54 } } @@ -7671,15 +7673,15 @@ "binop": null }, "value": "assert", - "start": 696, - "end": 702, + "start": 748, + "end": 754, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 } } @@ -7696,15 +7698,15 @@ "postfix": false, "binop": null }, - "start": 702, - "end": 703, + "start": 754, + "end": 755, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 8 } } @@ -7722,15 +7724,15 @@ "binop": null }, "value": "n", - "start": 703, - "end": 704, + "start": 755, + "end": 756, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 } } @@ -7748,15 +7750,15 @@ "binop": null, "updateContext": null }, - "start": 704, - "end": 705, + "start": 756, + "end": 757, "loc": { "start": { - "line": 24, + "line": 25, "column": 9 }, "end": { - "line": 24, + "line": 25, "column": 10 } } @@ -7774,15 +7776,15 @@ "binop": null }, "value": "parent", - "start": 705, - "end": 711, + "start": 757, + "end": 763, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 16 } } @@ -7801,15 +7803,15 @@ "updateContext": null }, "value": "!==", - "start": 712, - "end": 715, + "start": 764, + "end": 767, "loc": { "start": { - "line": 24, + "line": 25, "column": 17 }, "end": { - "line": 24, + "line": 25, "column": 20 } } @@ -7829,15 +7831,15 @@ "updateContext": null }, "value": "null", - "start": 716, - "end": 720, + "start": 768, + "end": 772, "loc": { "start": { - "line": 24, + "line": 25, "column": 21 }, "end": { - "line": 24, + "line": 25, "column": 25 } } @@ -7854,15 +7856,15 @@ "postfix": false, "binop": null }, - "start": 720, - "end": 721, + "start": 772, + "end": 773, "loc": { "start": { - "line": 24, + "line": 25, "column": 25 }, "end": { - "line": 24, + "line": 25, "column": 26 } } @@ -7880,15 +7882,15 @@ "binop": null, "updateContext": null }, - "start": 721, - "end": 722, + "start": 773, + "end": 774, "loc": { "start": { - "line": 24, + "line": 25, "column": 26 }, "end": { - "line": 24, + "line": 25, "column": 27 } } @@ -7906,15 +7908,15 @@ "binop": null }, "value": "assert", - "start": 724, - "end": 730, + "start": 776, + "end": 782, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 } } @@ -7931,15 +7933,15 @@ "postfix": false, "binop": null }, - "start": 730, - "end": 731, + "start": 782, + "end": 783, "loc": { "start": { - "line": 25, + "line": 26, "column": 7 }, "end": { - "line": 25, + "line": 26, "column": 8 } } @@ -7957,15 +7959,15 @@ "binop": null }, "value": "n", - "start": 731, - "end": 732, + "start": 783, + "end": 784, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 } } @@ -7983,15 +7985,15 @@ "binop": null, "updateContext": null }, - "start": 732, - "end": 733, + "start": 784, + "end": 785, "loc": { "start": { - "line": 25, + "line": 26, "column": 9 }, "end": { - "line": 25, + "line": 26, "column": 10 } } @@ -8009,15 +8011,15 @@ "binop": null }, "value": "parent", - "start": 733, - "end": 739, + "start": 785, + "end": 791, "loc": { "start": { - "line": 25, + "line": 26, "column": 10 }, "end": { - "line": 25, + "line": 26, "column": 16 } } @@ -8035,15 +8037,15 @@ "binop": null, "updateContext": null }, - "start": 739, - "end": 740, + "start": 791, + "end": 792, "loc": { "start": { - "line": 25, + "line": 26, "column": 16 }, "end": { - "line": 25, + "line": 26, "column": 17 } } @@ -8061,15 +8063,15 @@ "binop": null }, "value": "_color", - "start": 740, - "end": 746, + "start": 792, + "end": 798, "loc": { "start": { - "line": 25, + "line": 26, "column": 17 }, "end": { - "line": 25, + "line": 26, "column": 23 } } @@ -8088,15 +8090,15 @@ "updateContext": null }, "value": "===", - "start": 747, - "end": 750, + "start": 799, + "end": 802, "loc": { "start": { - "line": 25, + "line": 26, "column": 24 }, "end": { - "line": 25, + "line": 26, "column": 27 } } @@ -8114,15 +8116,15 @@ "binop": null }, "value": "RED", - "start": 751, - "end": 754, + "start": 803, + "end": 806, "loc": { "start": { - "line": 25, + "line": 26, "column": 28 }, "end": { - "line": 25, + "line": 26, "column": 31 } } @@ -8139,15 +8141,15 @@ "postfix": false, "binop": null }, - "start": 754, - "end": 755, + "start": 806, + "end": 807, "loc": { "start": { - "line": 25, + "line": 26, "column": 31 }, "end": { - "line": 25, + "line": 26, "column": 32 } } @@ -8165,15 +8167,15 @@ "binop": null, "updateContext": null }, - "start": 755, - "end": 756, + "start": 807, + "end": 808, "loc": { "start": { - "line": 25, + "line": 26, "column": 32 }, "end": { - "line": 25, + "line": 26, "column": 33 } } @@ -8193,15 +8195,15 @@ "updateContext": null }, "value": "const", - "start": 758, - "end": 763, + "start": 810, + "end": 815, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 6 } } @@ -8219,15 +8221,15 @@ "binop": null }, "value": "u", - "start": 764, - "end": 765, + "start": 816, + "end": 817, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 } } @@ -8246,15 +8248,15 @@ "updateContext": null }, "value": "=", - "start": 766, - "end": 767, + "start": 818, + "end": 819, "loc": { "start": { - "line": 26, + "line": 27, "column": 9 }, "end": { - "line": 26, + "line": 27, "column": 10 } } @@ -8272,15 +8274,15 @@ "binop": null }, "value": "uncle", - "start": 768, - "end": 773, + "start": 820, + "end": 825, "loc": { "start": { - "line": 26, + "line": 27, "column": 11 }, "end": { - "line": 26, + "line": 27, "column": 16 } } @@ -8297,15 +8299,15 @@ "postfix": false, "binop": null }, - "start": 773, - "end": 774, + "start": 825, + "end": 826, "loc": { "start": { - "line": 26, + "line": 27, "column": 16 }, "end": { - "line": 26, + "line": 27, "column": 17 } } @@ -8323,15 +8325,15 @@ "binop": null }, "value": "n", - "start": 774, - "end": 775, + "start": 826, + "end": 827, "loc": { "start": { - "line": 26, + "line": 27, "column": 17 }, "end": { - "line": 26, + "line": 27, "column": 18 } } @@ -8348,15 +8350,15 @@ "postfix": false, "binop": null }, - "start": 775, - "end": 776, + "start": 827, + "end": 828, "loc": { "start": { - "line": 26, + "line": 27, "column": 18 }, "end": { - "line": 26, + "line": 27, "column": 19 } } @@ -8374,15 +8376,15 @@ "binop": null, "updateContext": null }, - "start": 776, - "end": 777, + "start": 828, + "end": 829, "loc": { "start": { - "line": 26, + "line": 27, "column": 19 }, "end": { - "line": 26, + "line": 27, "column": 20 } } @@ -8390,15 +8392,15 @@ { "type": "CommentBlock", "value": "*\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t ", - "start": 780, - "end": 1275, + "start": 832, + "end": 1327, "loc": { "start": { - "line": 28, + "line": 29, "column": 1 }, "end": { - "line": 40, + "line": 41, "column": 4 } } @@ -8418,15 +8420,15 @@ "updateContext": null }, "value": "if", - "start": 1278, - "end": 1280, + "start": 1330, + "end": 1332, "loc": { "start": { - "line": 42, + "line": 43, "column": 1 }, "end": { - "line": 42, + "line": 43, "column": 3 } } @@ -8443,15 +8445,15 @@ "postfix": false, "binop": null }, - "start": 1281, - "end": 1282, + "start": 1333, + "end": 1334, "loc": { "start": { - "line": 42, + "line": 43, "column": 4 }, "end": { - "line": 42, + "line": 43, "column": 5 } } @@ -8469,15 +8471,15 @@ "binop": null }, "value": "u", - "start": 1282, - "end": 1283, + "start": 1334, + "end": 1335, "loc": { "start": { - "line": 42, + "line": 43, "column": 5 }, "end": { - "line": 42, + "line": 43, "column": 6 } } @@ -8496,15 +8498,15 @@ "updateContext": null }, "value": "!==", - "start": 1284, - "end": 1287, + "start": 1336, + "end": 1339, "loc": { "start": { - "line": 42, + "line": 43, "column": 7 }, "end": { - "line": 42, + "line": 43, "column": 10 } } @@ -8524,15 +8526,15 @@ "updateContext": null }, "value": "null", - "start": 1288, - "end": 1292, + "start": 1340, + "end": 1344, "loc": { "start": { - "line": 42, + "line": 43, "column": 11 }, "end": { - "line": 42, + "line": 43, "column": 15 } } @@ -8551,15 +8553,15 @@ "updateContext": null }, "value": "&&", - "start": 1293, - "end": 1295, + "start": 1345, + "end": 1347, "loc": { "start": { - "line": 42, + "line": 43, "column": 16 }, "end": { - "line": 42, + "line": 43, "column": 18 } } @@ -8577,15 +8579,15 @@ "binop": null }, "value": "u", - "start": 1296, - "end": 1297, + "start": 1348, + "end": 1349, "loc": { "start": { - "line": 42, + "line": 43, "column": 19 }, "end": { - "line": 42, + "line": 43, "column": 20 } } @@ -8603,15 +8605,15 @@ "binop": null, "updateContext": null }, - "start": 1297, - "end": 1298, + "start": 1349, + "end": 1350, "loc": { "start": { - "line": 42, + "line": 43, "column": 20 }, "end": { - "line": 42, + "line": 43, "column": 21 } } @@ -8629,15 +8631,15 @@ "binop": null }, "value": "_color", - "start": 1298, - "end": 1304, + "start": 1350, + "end": 1356, "loc": { "start": { - "line": 42, + "line": 43, "column": 21 }, "end": { - "line": 42, + "line": 43, "column": 27 } } @@ -8656,15 +8658,15 @@ "updateContext": null }, "value": "!==", - "start": 1305, - "end": 1308, + "start": 1357, + "end": 1360, "loc": { "start": { - "line": 42, + "line": 43, "column": 28 }, "end": { - "line": 42, + "line": 43, "column": 31 } } @@ -8682,15 +8684,15 @@ "binop": null }, "value": "BLACK", - "start": 1309, - "end": 1314, + "start": 1361, + "end": 1366, "loc": { "start": { - "line": 42, + "line": 43, "column": 32 }, "end": { - "line": 42, + "line": 43, "column": 37 } } @@ -8707,15 +8709,15 @@ "postfix": false, "binop": null }, - "start": 1314, - "end": 1315, + "start": 1366, + "end": 1367, "loc": { "start": { - "line": 42, + "line": 43, "column": 37 }, "end": { - "line": 42, + "line": 43, "column": 38 } } @@ -8732,15 +8734,15 @@ "postfix": false, "binop": null }, - "start": 1316, - "end": 1317, + "start": 1368, + "end": 1369, "loc": { "start": { - "line": 42, + "line": 43, "column": 39 }, "end": { - "line": 42, + "line": 43, "column": 40 } } @@ -8758,15 +8760,15 @@ "binop": null }, "value": "assert", - "start": 1320, - "end": 1326, + "start": 1372, + "end": 1378, "loc": { "start": { - "line": 43, + "line": 44, "column": 2 }, "end": { - "line": 43, + "line": 44, "column": 8 } } @@ -8783,15 +8785,15 @@ "postfix": false, "binop": null }, - "start": 1326, - "end": 1327, + "start": 1378, + "end": 1379, "loc": { "start": { - "line": 43, + "line": 44, "column": 8 }, "end": { - "line": 43, + "line": 44, "column": 9 } } @@ -8809,15 +8811,15 @@ "binop": null }, "value": "u", - "start": 1327, - "end": 1328, + "start": 1379, + "end": 1380, "loc": { "start": { - "line": 43, + "line": 44, "column": 9 }, "end": { - "line": 43, + "line": 44, "column": 10 } } @@ -8835,15 +8837,15 @@ "binop": null, "updateContext": null }, - "start": 1328, - "end": 1329, + "start": 1380, + "end": 1381, "loc": { "start": { - "line": 43, + "line": 44, "column": 10 }, "end": { - "line": 43, + "line": 44, "column": 11 } } @@ -8861,15 +8863,15 @@ "binop": null }, "value": "_color", - "start": 1329, - "end": 1335, + "start": 1381, + "end": 1387, "loc": { "start": { - "line": 43, + "line": 44, "column": 11 }, "end": { - "line": 43, + "line": 44, "column": 17 } } @@ -8888,15 +8890,15 @@ "updateContext": null }, "value": "===", - "start": 1336, - "end": 1339, + "start": 1388, + "end": 1391, "loc": { "start": { - "line": 43, + "line": 44, "column": 18 }, "end": { - "line": 43, + "line": 44, "column": 21 } } @@ -8914,15 +8916,15 @@ "binop": null }, "value": "RED", - "start": 1340, - "end": 1343, + "start": 1392, + "end": 1395, "loc": { "start": { - "line": 43, + "line": 44, "column": 22 }, "end": { - "line": 43, + "line": 44, "column": 25 } } @@ -8939,15 +8941,15 @@ "postfix": false, "binop": null }, - "start": 1343, - "end": 1344, + "start": 1395, + "end": 1396, "loc": { "start": { - "line": 43, + "line": 44, "column": 25 }, "end": { - "line": 43, + "line": 44, "column": 26 } } @@ -8965,15 +8967,15 @@ "binop": null, "updateContext": null }, - "start": 1344, - "end": 1345, + "start": 1396, + "end": 1397, "loc": { "start": { - "line": 43, + "line": 44, "column": 26 }, "end": { - "line": 43, + "line": 44, "column": 27 } } @@ -8991,15 +8993,15 @@ "binop": null }, "value": "n", - "start": 1348, - "end": 1349, + "start": 1400, + "end": 1401, "loc": { "start": { - "line": 44, + "line": 45, "column": 2 }, "end": { - "line": 44, + "line": 45, "column": 3 } } @@ -9017,15 +9019,15 @@ "binop": null, "updateContext": null }, - "start": 1349, - "end": 1350, + "start": 1401, + "end": 1402, "loc": { "start": { - "line": 44, + "line": 45, "column": 3 }, "end": { - "line": 44, + "line": 45, "column": 4 } } @@ -9043,15 +9045,15 @@ "binop": null }, "value": "parent", - "start": 1350, - "end": 1356, + "start": 1402, + "end": 1408, "loc": { "start": { - "line": 44, + "line": 45, "column": 4 }, "end": { - "line": 44, + "line": 45, "column": 10 } } @@ -9069,15 +9071,15 @@ "binop": null, "updateContext": null }, - "start": 1356, - "end": 1357, + "start": 1408, + "end": 1409, "loc": { "start": { - "line": 44, + "line": 45, "column": 10 }, "end": { - "line": 44, + "line": 45, "column": 11 } } @@ -9095,15 +9097,15 @@ "binop": null }, "value": "_color", - "start": 1357, - "end": 1363, + "start": 1409, + "end": 1415, "loc": { "start": { - "line": 44, + "line": 45, "column": 11 }, "end": { - "line": 44, + "line": 45, "column": 17 } } @@ -9122,15 +9124,15 @@ "updateContext": null }, "value": "=", - "start": 1364, - "end": 1365, + "start": 1416, + "end": 1417, "loc": { "start": { - "line": 44, + "line": 45, "column": 18 }, "end": { - "line": 44, + "line": 45, "column": 19 } } @@ -9148,15 +9150,15 @@ "binop": null }, "value": "BLACK", - "start": 1366, - "end": 1371, + "start": 1418, + "end": 1423, "loc": { "start": { - "line": 44, + "line": 45, "column": 20 }, "end": { - "line": 44, + "line": 45, "column": 25 } } @@ -9174,15 +9176,15 @@ "binop": null, "updateContext": null }, - "start": 1371, - "end": 1372, + "start": 1423, + "end": 1424, "loc": { "start": { - "line": 44, + "line": 45, "column": 25 }, "end": { - "line": 44, + "line": 45, "column": 26 } } @@ -9200,15 +9202,15 @@ "binop": null }, "value": "u", - "start": 1375, - "end": 1376, + "start": 1427, + "end": 1428, "loc": { "start": { - "line": 45, + "line": 46, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 3 } } @@ -9226,15 +9228,15 @@ "binop": null, "updateContext": null }, - "start": 1376, - "end": 1377, + "start": 1428, + "end": 1429, "loc": { "start": { - "line": 45, + "line": 46, "column": 3 }, "end": { - "line": 45, + "line": 46, "column": 4 } } @@ -9252,15 +9254,15 @@ "binop": null }, "value": "_color", - "start": 1377, - "end": 1383, + "start": 1429, + "end": 1435, "loc": { "start": { - "line": 45, + "line": 46, "column": 4 }, "end": { - "line": 45, + "line": 46, "column": 10 } } @@ -9279,15 +9281,15 @@ "updateContext": null }, "value": "=", - "start": 1384, - "end": 1385, + "start": 1436, + "end": 1437, "loc": { "start": { - "line": 45, + "line": 46, "column": 11 }, "end": { - "line": 45, + "line": 46, "column": 12 } } @@ -9305,15 +9307,15 @@ "binop": null }, "value": "BLACK", - "start": 1386, - "end": 1391, + "start": 1438, + "end": 1443, "loc": { "start": { - "line": 45, + "line": 46, "column": 13 }, "end": { - "line": 45, + "line": 46, "column": 18 } } @@ -9331,15 +9333,15 @@ "binop": null, "updateContext": null }, - "start": 1391, - "end": 1392, + "start": 1443, + "end": 1444, "loc": { "start": { - "line": 45, + "line": 46, "column": 18 }, "end": { - "line": 45, + "line": 46, "column": 19 } } @@ -9359,15 +9361,15 @@ "updateContext": null }, "value": "const", - "start": 1395, - "end": 1400, + "start": 1447, + "end": 1452, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 7 } } @@ -9385,15 +9387,15 @@ "binop": null }, "value": "g", - "start": 1401, - "end": 1402, + "start": 1453, + "end": 1454, "loc": { "start": { - "line": 46, + "line": 47, "column": 8 }, "end": { - "line": 46, + "line": 47, "column": 9 } } @@ -9412,15 +9414,15 @@ "updateContext": null }, "value": "=", - "start": 1403, - "end": 1404, + "start": 1455, + "end": 1456, "loc": { "start": { - "line": 46, + "line": 47, "column": 10 }, "end": { - "line": 46, + "line": 47, "column": 11 } } @@ -9438,15 +9440,15 @@ "binop": null }, "value": "grandparent", - "start": 1405, - "end": 1416, + "start": 1457, + "end": 1468, "loc": { "start": { - "line": 46, + "line": 47, "column": 12 }, "end": { - "line": 46, + "line": 47, "column": 23 } } @@ -9463,15 +9465,15 @@ "postfix": false, "binop": null }, - "start": 1416, - "end": 1417, + "start": 1468, + "end": 1469, "loc": { "start": { - "line": 46, + "line": 47, "column": 23 }, "end": { - "line": 46, + "line": 47, "column": 24 } } @@ -9489,15 +9491,15 @@ "binop": null }, "value": "n", - "start": 1417, - "end": 1418, + "start": 1469, + "end": 1470, "loc": { "start": { - "line": 46, + "line": 47, "column": 24 }, "end": { - "line": 46, + "line": 47, "column": 25 } } @@ -9514,15 +9516,15 @@ "postfix": false, "binop": null }, - "start": 1418, - "end": 1419, + "start": 1470, + "end": 1471, "loc": { "start": { - "line": 46, + "line": 47, "column": 25 }, "end": { - "line": 46, + "line": 47, "column": 26 } } @@ -9540,15 +9542,15 @@ "binop": null, "updateContext": null }, - "start": 1419, - "end": 1420, + "start": 1471, + "end": 1472, "loc": { "start": { - "line": 46, + "line": 47, "column": 26 }, "end": { - "line": 46, + "line": 47, "column": 27 } } @@ -9566,15 +9568,15 @@ "binop": null }, "value": "g", - "start": 1423, - "end": 1424, + "start": 1475, + "end": 1476, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 3 } } @@ -9592,15 +9594,15 @@ "binop": null, "updateContext": null }, - "start": 1424, - "end": 1425, + "start": 1476, + "end": 1477, "loc": { "start": { - "line": 47, + "line": 48, "column": 3 }, "end": { - "line": 47, + "line": 48, "column": 4 } } @@ -9618,15 +9620,15 @@ "binop": null }, "value": "_color", - "start": 1425, - "end": 1431, + "start": 1477, + "end": 1483, "loc": { "start": { - "line": 47, + "line": 48, "column": 4 }, "end": { - "line": 47, + "line": 48, "column": 10 } } @@ -9645,15 +9647,15 @@ "updateContext": null }, "value": "=", - "start": 1432, - "end": 1433, + "start": 1484, + "end": 1485, "loc": { "start": { - "line": 47, + "line": 48, "column": 11 }, "end": { - "line": 47, + "line": 48, "column": 12 } } @@ -9671,15 +9673,15 @@ "binop": null }, "value": "RED", - "start": 1434, - "end": 1437, + "start": 1486, + "end": 1489, "loc": { "start": { - "line": 47, + "line": 48, "column": 13 }, "end": { - "line": 47, + "line": 48, "column": 16 } } @@ -9697,19 +9699,47 @@ "binop": null, "updateContext": null }, - "start": 1437, - "end": 1438, + "start": 1489, + "end": 1490, "loc": { "start": { - "line": 47, + "line": 48, "column": 16 }, "end": { - "line": 47, + "line": 48, "column": 17 } } }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 1493, + "end": 1499, + "loc": { + "start": { + "line": 49, + "column": 2 + }, + "end": { + "line": 49, + "column": 8 + } + } + }, { "type": { "label": "name", @@ -9723,16 +9753,16 @@ "binop": null }, "value": "insert_case0", - "start": 1441, - "end": 1453, + "start": 1500, + "end": 1512, "loc": { "start": { - "line": 48, - "column": 2 + "line": 49, + "column": 9 }, "end": { - "line": 48, - "column": 14 + "line": 49, + "column": 21 } } }, @@ -9748,16 +9778,16 @@ "postfix": false, "binop": null }, - "start": 1453, - "end": 1454, + "start": 1512, + "end": 1513, "loc": { "start": { - "line": 48, - "column": 14 + "line": 49, + "column": 21 }, "end": { - "line": 48, - "column": 15 + "line": 49, + "column": 22 } } }, @@ -9774,16 +9804,16 @@ "binop": null }, "value": "g", - "start": 1454, - "end": 1455, + "start": 1513, + "end": 1514, "loc": { "start": { - "line": 48, - "column": 15 + "line": 49, + "column": 22 }, "end": { - "line": 48, - "column": 16 + "line": 49, + "column": 23 } } }, @@ -9799,16 +9829,16 @@ "postfix": false, "binop": null }, - "start": 1455, - "end": 1456, + "start": 1514, + "end": 1515, "loc": { "start": { - "line": 48, - "column": 16 + "line": 49, + "column": 23 }, "end": { - "line": 48, - "column": 17 + "line": 49, + "column": 24 } } }, @@ -9825,16 +9855,16 @@ "binop": null, "updateContext": null }, - "start": 1456, - "end": 1457, + "start": 1515, + "end": 1516, "loc": { "start": { - "line": 48, - "column": 17 + "line": 49, + "column": 24 }, "end": { - "line": 48, - "column": 18 + "line": 49, + "column": 25 } } }, @@ -9850,23 +9880,23 @@ "postfix": false, "binop": null }, - "start": 1459, - "end": 1460, + "start": 1518, + "end": 1519, "loc": { "start": { - "line": 49, + "line": 50, "column": 1 }, "end": { - "line": 49, + "line": 50, "column": 2 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": "return", + "keyword": "return", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -9877,16 +9907,16 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1461, - "end": 1465, + "value": "return", + "start": 1522, + "end": 1528, "loc": { "start": { - "line": 49, - "column": 3 + "line": 52, + "column": 1 }, "end": { - "line": 49, + "line": 52, "column": 7 } } @@ -9904,15 +9934,15 @@ "binop": null }, "value": "insert_case3", - "start": 1466, - "end": 1478, + "start": 1529, + "end": 1541, "loc": { "start": { - "line": 49, + "line": 52, "column": 8 }, "end": { - "line": 49, + "line": 52, "column": 20 } } @@ -9929,15 +9959,15 @@ "postfix": false, "binop": null }, - "start": 1478, - "end": 1479, + "start": 1541, + "end": 1542, "loc": { "start": { - "line": 49, + "line": 52, "column": 20 }, "end": { - "line": 49, + "line": 52, "column": 21 } } @@ -9955,15 +9985,15 @@ "binop": null }, "value": "n", - "start": 1479, - "end": 1480, + "start": 1542, + "end": 1543, "loc": { "start": { - "line": 49, + "line": 52, "column": 21 }, "end": { - "line": 49, + "line": 52, "column": 22 } } @@ -9980,15 +10010,15 @@ "postfix": false, "binop": null }, - "start": 1480, - "end": 1481, + "start": 1543, + "end": 1544, "loc": { "start": { - "line": 49, + "line": 52, "column": 22 }, "end": { - "line": 49, + "line": 52, "column": 23 } } @@ -10006,15 +10036,15 @@ "binop": null, "updateContext": null }, - "start": 1481, - "end": 1482, + "start": 1544, + "end": 1545, "loc": { "start": { - "line": 49, + "line": 52, "column": 23 }, "end": { - "line": 49, + "line": 52, "column": 24 } } @@ -10031,15 +10061,15 @@ "postfix": false, "binop": null }, - "start": 1483, - "end": 1484, + "start": 1546, + "end": 1547, "loc": { "start": { - "line": 50, + "line": 53, "column": 0 }, "end": { - "line": 50, + "line": 53, "column": 1 } } @@ -10057,15 +10087,15 @@ "binop": null, "updateContext": null }, - "start": 1484, - "end": 1485, + "start": 1547, + "end": 1548, "loc": { "start": { - "line": 50, + "line": 53, "column": 1 }, "end": { - "line": 50, + "line": 53, "column": 2 } } @@ -10085,15 +10115,15 @@ "updateContext": null }, "value": "export", - "start": 1487, - "end": 1493, + "start": 1550, + "end": 1556, "loc": { "start": { - "line": 52, + "line": 55, "column": 0 }, "end": { - "line": 52, + "line": 55, "column": 6 } } @@ -10113,15 +10143,15 @@ "updateContext": null }, "value": "default", - "start": 1494, - "end": 1501, + "start": 1557, + "end": 1564, "loc": { "start": { - "line": 52, + "line": 55, "column": 7 }, "end": { - "line": 52, + "line": 55, "column": 14 } } @@ -10139,15 +10169,15 @@ "binop": null }, "value": "insert_case2", - "start": 1502, - "end": 1514, + "start": 1565, + "end": 1577, "loc": { "start": { - "line": 52, + "line": 55, "column": 15 }, "end": { - "line": 52, + "line": 55, "column": 27 } } @@ -10165,15 +10195,15 @@ "binop": null, "updateContext": null }, - "start": 1514, - "end": 1515, + "start": 1577, + "end": 1578, "loc": { "start": { - "line": 52, + "line": 55, "column": 27 }, "end": { - "line": 52, + "line": 55, "column": 28 } } @@ -10191,15 +10221,15 @@ "binop": null, "updateContext": null }, - "start": 1516, - "end": 1516, + "start": 1579, + "end": 1579, "loc": { "start": { - "line": 53, + "line": 56, "column": 0 }, "end": { - "line": 53, + "line": 56, "column": 0 } } diff --git a/ast/source/insertion/insert_case3.js.json b/ast/source/insertion/insert_case3.js.json index b0eb83c..c040baf 100644 --- a/ast/source/insertion/insert_case3.js.json +++ b/ast/source/insertion/insert_case3.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 2698, + "end": 2739, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 93, + "line": 97, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 2698, + "end": 2739, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 93, + "line": 97, "column": 0 } }, @@ -445,7 +445,7 @@ { "type": "ImportDeclaration", "start": 246, - "end": 297, + "end": 291, "loc": { "start": { "line": 7, @@ -453,14 +453,14 @@ }, "end": { "line": 7, - "column": 51 + "column": 45 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 253, - "end": 264, + "end": 265, "loc": { "start": { "line": 7, @@ -468,13 +468,13 @@ }, "end": { "line": 7, - "column": 18 + "column": 19 } }, "local": { "type": "Identifier", "start": 253, - "end": 264, + "end": 265, "loc": { "start": { "line": 7, @@ -482,75 +482,6 @@ }, "end": { "line": 7, - "column": 18 - }, - "identifierName": "grandparent" - }, - "name": "grandparent" - } - } - ], - "source": { - "type": "StringLiteral", - "start": 270, - "end": 296, - "loc": { - "start": { - "line": 7, - "column": 24 - }, - "end": { - "line": 7, - "column": 50 - } - }, - "extra": { - "rawValue": "../family/grandparent.js", - "raw": "'../family/grandparent.js'" - }, - "value": "../family/grandparent.js" - } - }, - { - "type": "ImportDeclaration", - "start": 298, - "end": 343, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 45 - } - }, - "specifiers": [ - { - "type": "ImportDefaultSpecifier", - "start": 305, - "end": 317, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 19 - } - }, - "local": { - "type": "Identifier", - "start": 305, - "end": 317, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, "column": 19 }, "identifierName": "insert_case4" @@ -561,15 +492,15 @@ ], "source": { "type": "StringLiteral", - "start": 323, - "end": 342, + "start": 271, + "end": 290, "loc": { "start": { - "line": 8, + "line": 7, "column": 25 }, "end": { - "line": 8, + "line": 7, "column": 44 } }, @@ -582,12 +513,12 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n ", - "start": 345, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", + "start": 293, "end": 635, "loc": { "start": { - "line": 10, + "line": 9, "column": 0 }, "end": { @@ -601,14 +532,14 @@ { "type": "Identifier", "start": 636, - "end": 2667, + "end": 2708, "loc": { "start": { "line": 22, "column": 0 }, "end": { - "line": 90, + "line": 94, "column": 2 } }, @@ -616,14 +547,14 @@ { "type": "VariableDeclarator", "start": 642, - "end": 2666, + "end": 2707, "loc": { "start": { "line": 22, "column": 6 }, "end": { - "line": 90, + "line": 94, "column": 1 } }, @@ -648,14 +579,14 @@ "init": { "type": "ArrowFunctionExpression", "start": 657, - "end": 2666, + "end": 2707, "loc": { "start": { "line": 22, "column": 21 }, "end": { - "line": 90, + "line": 94, "column": 1 } }, @@ -685,14 +616,14 @@ "body": { "type": "BlockStatement", "start": 664, - "end": 2666, + "end": 2707, "loc": { "start": { "line": 22, "column": 28 }, "end": { - "line": 90, + "line": 94, "column": 1 } }, @@ -1750,7 +1681,7 @@ { "type": "VariableDeclaration", "start": 892, - "end": 917, + "end": 911, "loc": { "start": { "line": 29, @@ -1758,14 +1689,14 @@ }, "end": { "line": 29, - "column": 26 + "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", "start": 898, - "end": 916, + "end": 910, "loc": { "start": { "line": 29, @@ -1773,7 +1704,7 @@ }, "end": { "line": 29, - "column": 25 + "column": 19 } }, "id": { @@ -1789,14 +1720,14 @@ "line": 29, "column": 8 }, - "identifierName": "g" + "identifierName": "p" }, - "name": "g" + "name": "p" }, "init": { - "type": "CallExpression", + "type": "MemberExpression", "start": 902, - "end": 916, + "end": 910, "loc": { "start": { "line": 29, @@ -1804,13 +1735,13 @@ }, "end": { "line": 29, - "column": 25 + "column": 19 } }, - "callee": { + "object": { "type": "Identifier", "start": 902, - "end": 913, + "end": 903, "loc": { "start": { "line": 29, @@ -1818,292 +1749,305 @@ }, "end": { "line": 29, - "column": 22 + "column": 12 }, - "identifierName": "grandparent" + "identifierName": "n" }, - "name": "grandparent" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 914, - "end": 915, - "loc": { - "start": { - "line": 29, - "column": 23 - }, - "end": { - "line": 29, - "column": 24 - }, - "identifierName": "n" + "property": { + "type": "Identifier", + "start": 904, + "end": 910, + "loc": { + "start": { + "line": 29, + "column": 13 }, - "name": "n" - } - ] + "end": { + "line": 29, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } } ], - "kind": "const", - "trailingComments": [ + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 913, + "end": 932, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 20 + } + }, + "declarations": [ { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 920, - "end": 1382, + "type": "VariableDeclarator", + "start": 919, + "end": 931, "loc": { "start": { - "line": 31, - "column": 1 + "line": 30, + "column": 7 }, "end": { - "line": 43, - "column": 4 + "line": 30, + "column": 19 } + }, + "id": { + "type": "Identifier", + "start": 919, + "end": 920, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 8 + }, + "identifierName": "g" + }, + "name": "g" + }, + "init": { + "type": "MemberExpression", + "start": 923, + "end": 931, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 923, + "end": 924, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 12 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 925, + "end": 931, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false } } - ] + ], + "kind": "const" }, { "type": "IfStatement", - "start": 1385, - "end": 2645, + "start": 935, + "end": 1836, "loc": { "start": { - "line": 45, + "line": 32, "column": 1 }, "end": { - "line": 87, + "line": 61, "column": 2 } }, "test": { "type": "LogicalExpression", - "start": 1389, - "end": 1432, + "start": 939, + "end": 968, "loc": { "start": { - "line": 45, + "line": 32, "column": 5 }, "end": { - "line": 45, - "column": 48 + "line": 32, + "column": 34 } }, "left": { "type": "BinaryExpression", - "start": 1389, - "end": 1409, + "start": 939, + "end": 952, "loc": { "start": { - "line": 45, + "line": 32, "column": 5 }, "end": { - "line": 45, - "column": 25 + "line": 32, + "column": 18 } }, "left": { "type": "Identifier", - "start": 1389, - "end": 1390, + "start": 939, + "end": 940, "loc": { "start": { - "line": 45, + "line": 32, "column": 5 }, "end": { - "line": 45, + "line": 32, "column": 6 }, "identifierName": "n" }, - "name": "n", - "leadingComments": null + "name": "n" }, "operator": "===", "right": { "type": "MemberExpression", - "start": 1395, - "end": 1409, + "start": 945, + "end": 952, "loc": { "start": { - "line": 45, + "line": 32, "column": 11 }, "end": { - "line": 45, - "column": 25 + "line": 32, + "column": 18 } }, "object": { - "type": "MemberExpression", - "start": 1395, - "end": 1403, + "type": "Identifier", + "start": 945, + "end": 946, "loc": { "start": { - "line": 45, + "line": 32, "column": 11 }, "end": { - "line": 45, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 1395, - "end": 1396, - "loc": { - "start": { - "line": 45, - "column": 11 - }, - "end": { - "line": 45, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1397, - "end": 1403, - "loc": { - "start": { - "line": 45, - "column": 13 - }, - "end": { - "line": 45, - "column": 19 - }, - "identifierName": "parent" + "line": 32, + "column": 12 }, - "name": "parent" + "identifierName": "p" }, - "computed": false + "name": "p" }, "property": { "type": "Identifier", - "start": 1404, - "end": 1409, + "start": 947, + "end": 952, "loc": { "start": { - "line": 45, - "column": 20 + "line": 32, + "column": 13 }, "end": { - "line": 45, - "column": 25 + "line": 32, + "column": 18 }, "identifierName": "right" }, "name": "right" }, "computed": false - }, - "leadingComments": null + } }, "operator": "&&", "right": { "type": "BinaryExpression", - "start": 1413, - "end": 1432, + "start": 956, + "end": 968, "loc": { "start": { - "line": 45, - "column": 29 + "line": 32, + "column": 22 }, "end": { - "line": 45, - "column": 48 + "line": 32, + "column": 34 } }, "left": { - "type": "MemberExpression", - "start": 1413, - "end": 1421, + "type": "Identifier", + "start": 956, + "end": 957, "loc": { "start": { - "line": 45, - "column": 29 + "line": 32, + "column": 22 }, "end": { - "line": 45, - "column": 37 - } - }, - "object": { - "type": "Identifier", - "start": 1413, - "end": 1414, - "loc": { - "start": { - "line": 45, - "column": 29 - }, - "end": { - "line": 45, - "column": 30 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1415, - "end": 1421, - "loc": { - "start": { - "line": 45, - "column": 31 - }, - "end": { - "line": 45, - "column": 37 - }, - "identifierName": "parent" + "line": 32, + "column": 23 }, - "name": "parent" + "identifierName": "p" }, - "computed": false + "name": "p" }, "operator": "===", "right": { "type": "MemberExpression", - "start": 1426, - "end": 1432, + "start": 962, + "end": 968, "loc": { "start": { - "line": 45, - "column": 42 + "line": 32, + "column": 28 }, "end": { - "line": 45, - "column": 48 + "line": 32, + "column": 34 } }, "object": { "type": "Identifier", - "start": 1426, - "end": 1427, + "start": 962, + "end": 963, "loc": { "start": { - "line": 45, - "column": 42 + "line": 32, + "column": 28 }, "end": { - "line": 45, - "column": 43 + "line": 32, + "column": 29 }, "identifierName": "g" }, @@ -2111,16 +2055,16 @@ }, "property": { "type": "Identifier", - "start": 1428, - "end": 1432, + "start": 964, + "end": 968, "loc": { "start": { - "line": 45, - "column": 44 + "line": 32, + "column": 30 }, "end": { - "line": 45, - "column": 48 + "line": 32, + "column": 34 }, "identifierName": "left" }, @@ -2128,28 +2072,27 @@ }, "computed": false } - }, - "leadingComments": null + } }, "consequent": { "type": "BlockStatement", - "start": 1434, - "end": 1804, + "start": 970, + "end": 1836, "loc": { "start": { - "line": 45, - "column": 50 + "line": 32, + "column": 36 }, "end": { - "line": 60, + "line": 61, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1438, - "end": 1460, + "start": 1451, + "end": 1466, "loc": { "start": { "line": 46, @@ -2157,13 +2100,13 @@ }, "end": { "line": 46, - "column": 24 + "column": 17 } }, "expression": { "type": "CallExpression", - "start": 1438, - "end": 1459, + "start": 1451, + "end": 1465, "loc": { "start": { "line": 46, @@ -2171,13 +2114,13 @@ }, "end": { "line": 46, - "column": 23 + "column": 16 } }, "callee": { "type": "Identifier", - "start": 1438, - "end": 1449, + "start": 1451, + "end": 1462, "loc": { "start": { "line": 46, @@ -2189,13 +2132,14 @@ }, "identifierName": "rotate_left" }, - "name": "rotate_left" + "name": "rotate_left", + "leadingComments": null }, "arguments": [ { - "type": "MemberExpression", - "start": 1450, - "end": 1458, + "type": "Identifier", + "start": 1463, + "end": 1464, "loc": { "start": { "line": 46, @@ -2203,53 +2147,39 @@ }, "end": { "line": 46, - "column": 22 - } + "column": 15 + }, + "identifierName": "p" }, - "object": { - "type": "Identifier", - "start": 1450, - "end": 1451, - "loc": { - "start": { - "line": 46, - "column": 14 - }, - "end": { - "line": 46, - "column": 15 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1452, - "end": 1458, - "loc": { - "start": { - "line": 46, - "column": 16 - }, - "end": { - "line": 46, - "column": 22 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false + "name": "p" } - ] + ], + "leadingComments": null }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-right, change it to a left-left\n\t\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * R B >R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * = >R - - R = - -\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 974, + "end": 1448, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 45, + "column": 5 + } + } + } + ], "trailingComments": [ { "type": "CommentBlock", "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1464, - "end": 1720, + "start": 1470, + "end": 1726, "loc": { "start": { "line": 48, @@ -2264,8 +2194,8 @@ { "type": "CommentLine", "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1724, - "end": 1801, + "start": 1730, + "end": 1807, "loc": { "start": { "line": 59, @@ -2278,504 +2208,592 @@ } } ] - } - ], - "directives": [] - }, - "alternate": { - "type": "IfStatement", - "start": 1810, - "end": 2645, - "loc": { - "start": { - "line": 60, - "column": 8 - }, - "end": { - "line": 87, - "column": 2 - } - }, - "test": { - "type": "LogicalExpression", - "start": 1814, - "end": 1857, - "loc": { - "start": { - "line": 60, - "column": 12 - }, - "end": { - "line": 60, - "column": 55 - } }, - "left": { - "type": "BinaryExpression", - "start": 1814, + { + "type": "ReturnStatement", + "start": 1810, "end": 1833, "loc": { "start": { "line": 60, - "column": 12 + "column": 2 }, "end": { "line": 60, - "column": 31 + "column": 25 } }, - "left": { - "type": "Identifier", - "start": 1814, - "end": 1815, - "loc": { - "start": { - "line": 60, - "column": 12 - }, - "end": { - "line": 60, - "column": 13 - }, - "identifierName": "n" - }, - "name": "n" - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1820, - "end": 1833, + "argument": { + "type": "CallExpression", + "start": 1817, + "end": 1832, "loc": { "start": { "line": 60, - "column": 18 + "column": 9 }, "end": { "line": 60, - "column": 31 + "column": 24 } }, - "object": { - "type": "MemberExpression", - "start": 1820, - "end": 1828, + "callee": { + "type": "Identifier", + "start": 1817, + "end": 1829, "loc": { "start": { "line": 60, - "column": 18 + "column": 9 }, "end": { "line": 60, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 1820, - "end": 1821, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 19 - }, - "identifierName": "n" + "column": 21 }, - "name": "n" + "identifierName": "insert_case4" }, - "property": { + "name": "insert_case4", + "leadingComments": null + }, + "arguments": [ + { "type": "Identifier", - "start": 1822, - "end": 1828, + "start": 1830, + "end": 1831, "loc": { "start": { "line": 60, - "column": 20 + "column": 22 }, "end": { "line": 60, - "column": 26 + "column": 23 }, - "identifierName": "parent" + "identifierName": "p" }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1829, - "end": 1833, + "name": "p" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1470, + "end": 1726, "loc": { "start": { - "line": 60, - "column": 27 + "line": 48, + "column": 2 }, "end": { - "line": 60, - "column": 31 - }, - "identifierName": "left" - }, - "name": "left" + "line": 57, + "column": 5 + } + } }, - "computed": false + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1730, + "end": 1807, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 79 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "IfStatement", + "start": 1839, + "end": 2679, + "loc": { + "start": { + "line": 63, + "column": 1 + }, + "end": { + "line": 91, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1843, + "end": 1872, + "loc": { + "start": { + "line": 63, + "column": 5 + }, + "end": { + "line": 63, + "column": 34 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1843, + "end": 1855, + "loc": { + "start": { + "line": 63, + "column": 5 + }, + "end": { + "line": 63, + "column": 17 } }, - "operator": "&&", + "left": { + "type": "Identifier", + "start": 1843, + "end": 1844, + "loc": { + "start": { + "line": 63, + "column": 5 + }, + "end": { + "line": 63, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", "right": { - "type": "BinaryExpression", - "start": 1837, - "end": 1857, + "type": "MemberExpression", + "start": 1849, + "end": 1855, "loc": { "start": { - "line": 60, - "column": 35 + "line": 63, + "column": 11 }, "end": { - "line": 60, - "column": 55 + "line": 63, + "column": 17 } }, - "left": { - "type": "MemberExpression", - "start": 1837, - "end": 1845, + "object": { + "type": "Identifier", + "start": 1849, + "end": 1850, "loc": { "start": { - "line": 60, - "column": 35 + "line": 63, + "column": 11 }, "end": { - "line": 60, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 1837, - "end": 1838, - "loc": { - "start": { - "line": 60, - "column": 35 - }, - "end": { - "line": 60, - "column": 36 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1839, - "end": 1845, - "loc": { - "start": { - "line": 60, - "column": 37 - }, - "end": { - "line": 60, - "column": 43 - }, - "identifierName": "parent" + "line": 63, + "column": 12 }, - "name": "parent" + "identifierName": "p" }, - "computed": false + "name": "p" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1850, - "end": 1857, + "property": { + "type": "Identifier", + "start": 1851, + "end": 1855, "loc": { "start": { - "line": 60, - "column": 48 + "line": 63, + "column": 13 }, "end": { - "line": 60, - "column": 55 - } - }, - "object": { - "type": "Identifier", - "start": 1850, - "end": 1851, - "loc": { - "start": { - "line": 60, - "column": 48 - }, - "end": { - "line": 60, - "column": 49 - }, - "identifierName": "g" - }, - "name": "g" - }, - "property": { - "type": "Identifier", - "start": 1852, - "end": 1857, - "loc": { - "start": { - "line": 60, - "column": 50 - }, - "end": { - "line": 60, - "column": 55 - }, - "identifierName": "right" + "line": 63, + "column": 17 }, - "name": "right" + "identifierName": "left" }, - "computed": false - } + "name": "left" + }, + "computed": false } }, - "consequent": { - "type": "BlockStatement", + "operator": "&&", + "right": { + "type": "BinaryExpression", "start": 1859, - "end": 2645, + "end": 1872, "loc": { "start": { - "line": 60, - "column": 57 + "line": 63, + "column": 21 }, "end": { - "line": 87, - "column": 2 + "line": 63, + "column": 34 } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 2367, - "end": 2390, + "left": { + "type": "Identifier", + "start": 1859, + "end": 1860, + "loc": { + "start": { + "line": 63, + "column": 21 + }, + "end": { + "line": 63, + "column": 22 + }, + "identifierName": "p" + }, + "name": "p" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1865, + "end": 1872, + "loc": { + "start": { + "line": 63, + "column": 27 + }, + "end": { + "line": 63, + "column": 34 + } + }, + "object": { + "type": "Identifier", + "start": 1865, + "end": 1866, + "loc": { + "start": { + "line": 63, + "column": 27 + }, + "end": { + "line": 63, + "column": 28 + }, + "identifierName": "g" + }, + "name": "g" + }, + "property": { + "type": "Identifier", + "start": 1867, + "end": 1872, "loc": { "start": { - "line": 74, + "line": 63, + "column": 29 + }, + "end": { + "line": 63, + "column": 34 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1874, + "end": 2679, + "loc": { + "start": { + "line": 63, + "column": 36 + }, + "end": { + "line": 91, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2382, + "end": 2398, + "loc": { + "start": { + "line": 77, + "column": 2 + }, + "end": { + "line": 77, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 2382, + "end": 2397, + "loc": { + "start": { + "line": 77, "column": 2 }, "end": { - "line": 74, - "column": 25 + "line": 77, + "column": 17 } }, - "expression": { - "type": "CallExpression", - "start": 2367, - "end": 2389, + "callee": { + "type": "Identifier", + "start": 2382, + "end": 2394, "loc": { "start": { - "line": 74, + "line": 77, "column": 2 }, "end": { - "line": 74, - "column": 24 - } + "line": 77, + "column": 14 + }, + "identifierName": "rotate_right" }, - "callee": { + "name": "rotate_right", + "leadingComments": null + }, + "arguments": [ + { "type": "Identifier", - "start": 2367, - "end": 2379, + "start": 2395, + "end": 2396, "loc": { "start": { - "line": 74, - "column": 2 + "line": 77, + "column": 15 }, "end": { - "line": 74, - "column": 14 + "line": 77, + "column": 16 }, - "identifierName": "rotate_right" + "identifierName": "p" }, - "name": "rotate_right", - "leadingComments": null - }, - "arguments": [ - { - "type": "MemberExpression", - "start": 2380, - "end": 2388, - "loc": { - "start": { - "line": 74, - "column": 15 - }, - "end": { - "line": 74, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 2380, - "end": 2381, - "loc": { - "start": { - "line": 74, - "column": 15 - }, - "end": { - "line": 74, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 2382, - "end": 2388, - "loc": { - "start": { - "line": 74, - "column": 17 - }, - "end": { - "line": 74, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false + "name": "p" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1878, + "end": 2379, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 76, + "column": 5 } - ], + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2402, + "end": 2630, + "loc": { + "start": { + "line": 79, + "column": 2 + }, + "end": { + "line": 87, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2634, + "end": 2650, + "loc": { + "start": { + "line": 89, + "column": 2 + }, + "end": { + "line": 89, + "column": 18 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 2653, + "end": 2676, + "loc": { + "start": { + "line": 90, + "column": 2 + }, + "end": { + "line": 90, + "column": 25 + } + }, + "argument": { + "type": "CallExpression", + "start": 2660, + "end": 2675, + "loc": { + "start": { + "line": 90, + "column": 9 + }, + "end": { + "line": 90, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 2660, + "end": 2672, + "loc": { + "start": { + "line": 90, + "column": 9 + }, + "end": { + "line": 90, + "column": 21 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4", "leadingComments": null }, - "leadingComments": [ + "arguments": [ { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1863, - "end": 2364, + "type": "Identifier", + "start": 2673, + "end": 2674, "loc": { "start": { - "line": 61, - "column": 2 + "line": 90, + "column": 22 }, "end": { - "line": 73, - "column": 5 - } - } + "line": 90, + "column": 23 + }, + "identifierName": "p" + }, + "name": "p" } ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 2394, - "end": 2622, - "loc": { - "start": { - "line": 76, - "column": 2 - }, - "end": { - "line": 84, - "column": 5 - } + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2402, + "end": 2630, + "loc": { + "start": { + "line": 79, + "column": 2 + }, + "end": { + "line": 87, + "column": 5 } - }, - { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2626, - "end": 2642, - "loc": { - "start": { - "line": 86, - "column": 2 - }, - "end": { - "line": 86, - "column": 18 - } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2634, + "end": 2650, + "loc": { + "start": { + "line": 89, + "column": 2 + }, + "end": { + "line": 89, + "column": 18 } } - ] - } - ], - "directives": [] - }, - "alternate": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 920, - "end": 1382, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 43, - "column": 4 - } + } + ] } - } - ] + ], + "directives": [] + }, + "alternate": null }, { - "type": "ExpressionStatement", - "start": 2648, - "end": 2664, + "type": "ReturnStatement", + "start": 2682, + "end": 2705, "loc": { "start": { - "line": 89, + "line": 93, "column": 1 }, "end": { - "line": 89, - "column": 17 + "line": 93, + "column": 24 } }, - "expression": { + "argument": { "type": "CallExpression", - "start": 2648, - "end": 2663, + "start": 2689, + "end": 2704, "loc": { "start": { - "line": 89, - "column": 1 + "line": 93, + "column": 8 }, "end": { - "line": 89, - "column": 16 + "line": 93, + "column": 23 } }, "callee": { "type": "Identifier", - "start": 2648, - "end": 2660, + "start": 2689, + "end": 2701, "loc": { "start": { - "line": 89, - "column": 1 + "line": 93, + "column": 8 }, "end": { - "line": 89, - "column": 13 + "line": 93, + "column": 20 }, "identifierName": "insert_case4" }, @@ -2784,16 +2802,16 @@ "arguments": [ { "type": "Identifier", - "start": 2661, - "end": 2662, + "start": 2702, + "end": 2703, "loc": { "start": { - "line": 89, - "column": 14 + "line": 93, + "column": 21 }, "end": { - "line": 89, - "column": 15 + "line": 93, + "column": 22 }, "identifierName": "n" }, @@ -2816,29 +2834,29 @@ }, { "type": "Identifier", - "start": 2669, - "end": 2697, + "start": 2710, + "end": 2738, "loc": { "start": { - "line": 92, + "line": 96, "column": 0 }, "end": { - "line": 92, + "line": 96, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 2684, - "end": 2696, + "start": 2725, + "end": 2737, "loc": { "start": { - "line": 92, + "line": 96, "column": 15 }, "end": { - "line": 92, + "line": 96, "column": 27 }, "identifierName": "insert_case3" @@ -2851,29 +2869,29 @@ }, { "type": "ExportDefaultDeclaration", - "start": 2669, - "end": 2697, + "start": 2710, + "end": 2738, "loc": { "start": { - "line": 92, + "line": 96, "column": 0 }, "end": { - "line": 92, + "line": 96, "column": 28 } }, "declaration": { "type": "VariableDeclaration", "start": 636, - "end": 2667, + "end": 2708, "loc": { "start": { "line": 22, "column": 0 }, "end": { - "line": 90, + "line": 94, "column": 2 } }, @@ -2881,14 +2899,14 @@ { "type": "VariableDeclarator", "start": 642, - "end": 2666, + "end": 2707, "loc": { "start": { "line": 22, "column": 6 }, "end": { - "line": 90, + "line": 94, "column": 1 } }, @@ -2913,14 +2931,14 @@ "init": { "type": "ArrowFunctionExpression", "start": 657, - "end": 2666, + "end": 2707, "loc": { "start": { "line": 22, "column": 21 }, "end": { - "line": 90, + "line": 94, "column": 1 } }, @@ -2967,14 +2985,14 @@ "body": { "type": "BlockStatement", "start": 664, - "end": 2666, + "end": 2707, "loc": { "start": { "line": 22, "column": 28 }, "end": { - "line": 90, + "line": 94, "column": 1 } }, @@ -4032,7 +4050,7 @@ { "type": "VariableDeclaration", "start": 892, - "end": 917, + "end": 911, "loc": { "start": { "line": 29, @@ -4040,14 +4058,14 @@ }, "end": { "line": 29, - "column": 26 + "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", "start": 898, - "end": 916, + "end": 910, "loc": { "start": { "line": 29, @@ -4055,7 +4073,7 @@ }, "end": { "line": 29, - "column": 25 + "column": 19 } }, "id": { @@ -4071,14 +4089,14 @@ "line": 29, "column": 8 }, - "identifierName": "g" + "identifierName": "p" }, - "name": "g" + "name": "p" }, "init": { - "type": "CallExpression", + "type": "MemberExpression", "start": 902, - "end": 916, + "end": 910, "loc": { "start": { "line": 29, @@ -4086,13 +4104,13 @@ }, "end": { "line": 29, - "column": 25 + "column": 19 } }, - "callee": { + "object": { "type": "Identifier", "start": 902, - "end": 913, + "end": 903, "loc": { "start": { "line": 29, @@ -4100,292 +4118,305 @@ }, "end": { "line": 29, - "column": 22 + "column": 12 }, - "identifierName": "grandparent" + "identifierName": "n" }, - "name": "grandparent" + "name": "n" }, - "arguments": [ - { - "type": "Identifier", - "start": 914, - "end": 915, - "loc": { - "start": { - "line": 29, - "column": 23 - }, - "end": { - "line": 29, - "column": 24 - }, - "identifierName": "n" + "property": { + "type": "Identifier", + "start": 904, + "end": 910, + "loc": { + "start": { + "line": 29, + "column": 13 }, - "name": "n" - } - ] - } - } - ], - "kind": "const", - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 920, - "end": 1382, - "loc": { - "start": { - "line": 31, - "column": 1 + "end": { + "line": 29, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" }, - "end": { - "line": 43, - "column": 4 - } + "computed": false } } - ] + ], + "kind": "const" }, { - "type": "IfStatement", - "start": 1385, - "end": 2645, + "type": "VariableDeclaration", + "start": 913, + "end": 932, "loc": { "start": { - "line": 45, + "line": 30, "column": 1 }, "end": { - "line": 87, - "column": 2 + "line": 30, + "column": 20 } }, - "test": { - "type": "LogicalExpression", - "start": 1389, - "end": 1432, - "loc": { - "start": { - "line": 45, - "column": 5 - }, - "end": { - "line": 45, - "column": 48 - } - }, - "left": { - "type": "BinaryExpression", - "start": 1389, - "end": 1409, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 919, + "end": 931, "loc": { "start": { - "line": 45, - "column": 5 + "line": 30, + "column": 7 }, "end": { - "line": 45, - "column": 25 + "line": 30, + "column": 19 } }, - "left": { + "id": { "type": "Identifier", - "start": 1389, - "end": 1390, + "start": 919, + "end": 920, "loc": { "start": { - "line": 45, - "column": 5 + "line": 30, + "column": 7 }, "end": { - "line": 45, - "column": 6 + "line": 30, + "column": 8 }, - "identifierName": "n" + "identifierName": "g" }, - "name": "n", - "leadingComments": null + "name": "g" }, - "operator": "===", - "right": { + "init": { "type": "MemberExpression", - "start": 1395, - "end": 1409, + "start": 923, + "end": 931, "loc": { "start": { - "line": 45, + "line": 30, "column": 11 }, "end": { - "line": 45, - "column": 25 + "line": 30, + "column": 19 } }, "object": { - "type": "MemberExpression", - "start": 1395, - "end": 1403, + "type": "Identifier", + "start": 923, + "end": 924, "loc": { "start": { - "line": 45, + "line": 30, "column": 11 }, "end": { - "line": 45, - "column": 19 - } - }, - "object": { - "type": "Identifier", - "start": 1395, - "end": 1396, - "loc": { - "start": { - "line": 45, - "column": 11 - }, - "end": { - "line": 45, - "column": 12 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1397, - "end": 1403, - "loc": { - "start": { - "line": 45, - "column": 13 - }, - "end": { - "line": 45, - "column": 19 - }, - "identifierName": "parent" + "line": 30, + "column": 12 }, - "name": "parent" + "identifierName": "p" }, - "computed": false + "name": "p" }, "property": { "type": "Identifier", - "start": 1404, - "end": 1409, + "start": 925, + "end": 931, "loc": { "start": { - "line": 45, - "column": 20 + "line": 30, + "column": 13 }, "end": { - "line": 45, - "column": 25 + "line": 30, + "column": 19 }, - "identifierName": "right" + "identifierName": "parent" }, - "name": "right" + "name": "parent" }, "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 935, + "end": 1836, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 61, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 939, + "end": 968, + "loc": { + "start": { + "line": 32, + "column": 5 }, - "leadingComments": null + "end": { + "line": 32, + "column": 34 + } }, - "operator": "&&", - "right": { + "left": { "type": "BinaryExpression", - "start": 1413, - "end": 1432, + "start": 939, + "end": 952, "loc": { "start": { - "line": 45, - "column": 29 + "line": 32, + "column": 5 }, "end": { - "line": 45, - "column": 48 + "line": 32, + "column": 18 } }, "left": { + "type": "Identifier", + "start": 939, + "end": 940, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { "type": "MemberExpression", - "start": 1413, - "end": 1421, + "start": 945, + "end": 952, "loc": { "start": { - "line": 45, - "column": 29 + "line": 32, + "column": 11 }, "end": { - "line": 45, - "column": 37 + "line": 32, + "column": 18 } }, "object": { "type": "Identifier", - "start": 1413, - "end": 1414, + "start": 945, + "end": 946, "loc": { "start": { - "line": 45, - "column": 29 + "line": 32, + "column": 11 }, "end": { - "line": 45, - "column": 30 + "line": 32, + "column": 12 }, - "identifierName": "n" + "identifierName": "p" }, - "name": "n" + "name": "p" }, "property": { "type": "Identifier", - "start": 1415, - "end": 1421, + "start": 947, + "end": 952, "loc": { "start": { - "line": 45, - "column": 31 + "line": 32, + "column": 13 }, "end": { - "line": 45, - "column": 37 + "line": 32, + "column": 18 }, - "identifierName": "parent" + "identifierName": "right" }, - "name": "parent" + "name": "right" }, "computed": false + } + }, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 956, + "end": 968, + "loc": { + "start": { + "line": 32, + "column": 22 + }, + "end": { + "line": 32, + "column": 34 + } + }, + "left": { + "type": "Identifier", + "start": 956, + "end": 957, + "loc": { + "start": { + "line": 32, + "column": 22 + }, + "end": { + "line": 32, + "column": 23 + }, + "identifierName": "p" + }, + "name": "p" }, "operator": "===", "right": { "type": "MemberExpression", - "start": 1426, - "end": 1432, + "start": 962, + "end": 968, "loc": { "start": { - "line": 45, - "column": 42 + "line": 32, + "column": 28 }, "end": { - "line": 45, - "column": 48 + "line": 32, + "column": 34 } }, "object": { "type": "Identifier", - "start": 1426, - "end": 1427, + "start": 962, + "end": 963, "loc": { "start": { - "line": 45, - "column": 42 + "line": 32, + "column": 28 }, "end": { - "line": 45, - "column": 43 + "line": 32, + "column": 29 }, "identifierName": "g" }, @@ -4393,16 +4424,16 @@ }, "property": { "type": "Identifier", - "start": 1428, - "end": 1432, + "start": 964, + "end": 968, "loc": { "start": { - "line": 45, - "column": 44 + "line": 32, + "column": 30 }, "end": { - "line": 45, - "column": 48 + "line": 32, + "column": 34 }, "identifierName": "left" }, @@ -4410,28 +4441,27 @@ }, "computed": false } - }, - "leadingComments": null + } }, "consequent": { "type": "BlockStatement", - "start": 1434, - "end": 1804, + "start": 970, + "end": 1836, "loc": { "start": { - "line": 45, - "column": 50 + "line": 32, + "column": 36 }, "end": { - "line": 60, + "line": 61, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1438, - "end": 1460, + "start": 1451, + "end": 1466, "loc": { "start": { "line": 46, @@ -4439,13 +4469,13 @@ }, "end": { "line": 46, - "column": 24 + "column": 17 } }, "expression": { "type": "CallExpression", - "start": 1438, - "end": 1459, + "start": 1451, + "end": 1465, "loc": { "start": { "line": 46, @@ -4453,13 +4483,13 @@ }, "end": { "line": 46, - "column": 23 + "column": 16 } }, "callee": { "type": "Identifier", - "start": 1438, - "end": 1449, + "start": 1451, + "end": 1462, "loc": { "start": { "line": 46, @@ -4471,13 +4501,14 @@ }, "identifierName": "rotate_left" }, - "name": "rotate_left" + "name": "rotate_left", + "leadingComments": null }, "arguments": [ { - "type": "MemberExpression", - "start": 1450, - "end": 1458, + "type": "Identifier", + "start": 1463, + "end": 1464, "loc": { "start": { "line": 46, @@ -4485,53 +4516,141 @@ }, "end": { "line": 46, - "column": 22 - } - }, - "object": { - "type": "Identifier", - "start": 1450, - "end": 1451, - "loc": { - "start": { - "line": 46, - "column": 14 - }, - "end": { - "line": 46, - "column": 15 - }, - "identifierName": "n" + "column": 15 }, - "name": "n" + "identifierName": "p" }, - "property": { - "type": "Identifier", - "start": 1452, - "end": 1458, - "loc": { - "start": { - "line": 46, - "column": 16 - }, - "end": { - "line": 46, - "column": 22 - }, - "identifierName": "parent" + "name": "p" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-right, change it to a left-left\n\t\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * R B >R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * = >R - - R = - -\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 974, + "end": 1448, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 45, + "column": 5 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1470, + "end": 1726, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 57, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1730, + "end": 1807, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 79 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 1810, + "end": 1833, + "loc": { + "start": { + "line": 60, + "column": 2 + }, + "end": { + "line": 60, + "column": 25 + } + }, + "argument": { + "type": "CallExpression", + "start": 1817, + "end": 1832, + "loc": { + "start": { + "line": 60, + "column": 9 + }, + "end": { + "line": 60, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 1817, + "end": 1829, + "loc": { + "start": { + "line": 60, + "column": 9 + }, + "end": { + "line": 60, + "column": 21 + }, + "identifierName": "insert_case4" + }, + "name": "insert_case4", + "leadingComments": null + }, + "arguments": [ + { + "type": "Identifier", + "start": 1830, + "end": 1831, + "loc": { + "start": { + "line": 60, + "column": 22 + }, + "end": { + "line": 60, + "column": 23 }, - "name": "parent" + "identifierName": "p" }, - "computed": false + "name": "p" } - ] + ], + "leadingComments": null }, - "trailingComments": [ + "leadingComments": [ { "type": "CommentBlock", "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1464, - "end": 1720, + "start": 1470, + "end": 1726, "loc": { "start": { "line": 48, @@ -4546,8 +4665,8 @@ { "type": "CommentLine", "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1724, - "end": 1801, + "start": 1730, + "end": 1807, "loc": { "start": { "line": 59, @@ -4564,500 +4683,486 @@ ], "directives": [] }, - "alternate": { - "type": "IfStatement", - "start": 1810, - "end": 2645, + "alternate": null + }, + { + "type": "IfStatement", + "start": 1839, + "end": 2679, + "loc": { + "start": { + "line": 63, + "column": 1 + }, + "end": { + "line": 91, + "column": 2 + } + }, + "test": { + "type": "LogicalExpression", + "start": 1843, + "end": 1872, "loc": { "start": { - "line": 60, - "column": 8 + "line": 63, + "column": 5 }, "end": { - "line": 87, - "column": 2 + "line": 63, + "column": 34 + } + }, + "left": { + "type": "BinaryExpression", + "start": 1843, + "end": 1855, + "loc": { + "start": { + "line": 63, + "column": 5 + }, + "end": { + "line": 63, + "column": 17 + } + }, + "left": { + "type": "Identifier", + "start": 1843, + "end": 1844, + "loc": { + "start": { + "line": 63, + "column": 5 + }, + "end": { + "line": 63, + "column": 6 + }, + "identifierName": "n" + }, + "name": "n" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1849, + "end": 1855, + "loc": { + "start": { + "line": 63, + "column": 11 + }, + "end": { + "line": 63, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 1849, + "end": 1850, + "loc": { + "start": { + "line": 63, + "column": 11 + }, + "end": { + "line": 63, + "column": 12 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 1851, + "end": 1855, + "loc": { + "start": { + "line": 63, + "column": 13 + }, + "end": { + "line": 63, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false } }, - "test": { - "type": "LogicalExpression", - "start": 1814, - "end": 1857, + "operator": "&&", + "right": { + "type": "BinaryExpression", + "start": 1859, + "end": 1872, "loc": { "start": { - "line": 60, - "column": 12 + "line": 63, + "column": 21 }, "end": { - "line": 60, - "column": 55 + "line": 63, + "column": 34 } }, "left": { - "type": "BinaryExpression", - "start": 1814, - "end": 1833, + "type": "Identifier", + "start": 1859, + "end": 1860, "loc": { "start": { - "line": 60, - "column": 12 + "line": 63, + "column": 21 }, "end": { - "line": 60, - "column": 31 + "line": 63, + "column": 22 + }, + "identifierName": "p" + }, + "name": "p" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1865, + "end": 1872, + "loc": { + "start": { + "line": 63, + "column": 27 + }, + "end": { + "line": 63, + "column": 34 } }, - "left": { + "object": { "type": "Identifier", - "start": 1814, - "end": 1815, + "start": 1865, + "end": 1866, "loc": { "start": { - "line": 60, - "column": 12 + "line": 63, + "column": 27 }, "end": { - "line": 60, - "column": 13 + "line": 63, + "column": 28 }, - "identifierName": "n" + "identifierName": "g" }, - "name": "n" + "name": "g" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1820, - "end": 1833, + "property": { + "type": "Identifier", + "start": 1867, + "end": 1872, "loc": { "start": { - "line": 60, - "column": 18 + "line": 63, + "column": 29 }, "end": { - "line": 60, - "column": 31 - } - }, - "object": { - "type": "MemberExpression", - "start": 1820, - "end": 1828, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 26 - } - }, - "object": { - "type": "Identifier", - "start": 1820, - "end": 1821, - "loc": { - "start": { - "line": 60, - "column": 18 - }, - "end": { - "line": 60, - "column": 19 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 1822, - "end": 1828, - "loc": { - "start": { - "line": 60, - "column": 20 - }, - "end": { - "line": 60, - "column": 26 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "property": { - "type": "Identifier", - "start": 1829, - "end": 1833, - "loc": { - "start": { - "line": 60, - "column": 27 - }, - "end": { - "line": 60, - "column": 31 - }, - "identifierName": "left" + "line": 63, + "column": 34 }, - "name": "left" + "identifierName": "right" }, - "computed": false - } + "name": "right" + }, + "computed": false + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1874, + "end": 2679, + "loc": { + "start": { + "line": 63, + "column": 36 }, - "operator": "&&", - "right": { - "type": "BinaryExpression", - "start": 1837, - "end": 1857, + "end": { + "line": 91, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2382, + "end": 2398, "loc": { "start": { - "line": 60, - "column": 35 + "line": 77, + "column": 2 }, "end": { - "line": 60, - "column": 55 + "line": 77, + "column": 18 } }, - "left": { - "type": "MemberExpression", - "start": 1837, - "end": 1845, + "expression": { + "type": "CallExpression", + "start": 2382, + "end": 2397, "loc": { "start": { - "line": 60, - "column": 35 + "line": 77, + "column": 2 }, "end": { - "line": 60, - "column": 43 + "line": 77, + "column": 17 } }, - "object": { + "callee": { "type": "Identifier", - "start": 1837, - "end": 1838, + "start": 2382, + "end": 2394, "loc": { "start": { - "line": 60, - "column": 35 + "line": 77, + "column": 2 }, "end": { - "line": 60, - "column": 36 + "line": 77, + "column": 14 }, - "identifierName": "n" + "identifierName": "rotate_right" }, - "name": "n" + "name": "rotate_right", + "leadingComments": null }, - "property": { - "type": "Identifier", - "start": 1839, - "end": 1845, + "arguments": [ + { + "type": "Identifier", + "start": 2395, + "end": 2396, + "loc": { + "start": { + "line": 77, + "column": 15 + }, + "end": { + "line": 77, + "column": 16 + }, + "identifierName": "p" + }, + "name": "p" + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1878, + "end": 2379, "loc": { "start": { - "line": 60, - "column": 37 + "line": 64, + "column": 2 }, "end": { - "line": 60, - "column": 43 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 1850, - "end": 1857, - "loc": { - "start": { - "line": 60, - "column": 48 - }, - "end": { - "line": 60, - "column": 55 + "line": 76, + "column": 5 + } } - }, - "object": { - "type": "Identifier", - "start": 1850, - "end": 1851, + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2402, + "end": 2630, "loc": { "start": { - "line": 60, - "column": 48 + "line": 79, + "column": 2 }, "end": { - "line": 60, - "column": 49 - }, - "identifierName": "g" - }, - "name": "g" + "line": 87, + "column": 5 + } + } }, - "property": { - "type": "Identifier", - "start": 1852, - "end": 1857, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2634, + "end": 2650, "loc": { "start": { - "line": 60, - "column": 50 + "line": 89, + "column": 2 }, "end": { - "line": 60, - "column": 55 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } - } - }, - "consequent": { - "type": "BlockStatement", - "start": 1859, - "end": 2645, - "loc": { - "start": { - "line": 60, - "column": 57 + "line": 89, + "column": 18 + } + } + } + ] + }, + { + "type": "ReturnStatement", + "start": 2653, + "end": 2676, + "loc": { + "start": { + "line": 90, + "column": 2 + }, + "end": { + "line": 90, + "column": 25 + } }, - "end": { - "line": 87, - "column": 2 - } - }, - "body": [ - { - "type": "ExpressionStatement", - "start": 2367, - "end": 2390, + "argument": { + "type": "CallExpression", + "start": 2660, + "end": 2675, "loc": { "start": { - "line": 74, - "column": 2 + "line": 90, + "column": 9 }, "end": { - "line": 74, - "column": 25 + "line": 90, + "column": 24 } }, - "expression": { - "type": "CallExpression", - "start": 2367, - "end": 2389, + "callee": { + "type": "Identifier", + "start": 2660, + "end": 2672, "loc": { "start": { - "line": 74, - "column": 2 + "line": 90, + "column": 9 }, "end": { - "line": 74, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 2367, - "end": 2379, - "loc": { - "start": { - "line": 74, - "column": 2 - }, - "end": { - "line": 74, - "column": 14 - }, - "identifierName": "rotate_right" + "line": 90, + "column": 21 }, - "name": "rotate_right", - "leadingComments": null + "identifierName": "insert_case4" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 2380, - "end": 2388, - "loc": { - "start": { - "line": 74, - "column": 15 - }, - "end": { - "line": 74, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 2380, - "end": 2381, - "loc": { - "start": { - "line": 74, - "column": 15 - }, - "end": { - "line": 74, - "column": 16 - }, - "identifierName": "n" - }, - "name": "n" - }, - "property": { - "type": "Identifier", - "start": 2382, - "end": 2388, - "loc": { - "start": { - "line": 74, - "column": 17 - }, - "end": { - "line": 74, - "column": 23 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - } - ], + "name": "insert_case4", "leadingComments": null }, - "leadingComments": [ + "arguments": [ { - "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1863, - "end": 2364, + "type": "Identifier", + "start": 2673, + "end": 2674, "loc": { "start": { - "line": 61, - "column": 2 + "line": 90, + "column": 22 }, "end": { - "line": 73, - "column": 5 - } - } + "line": 90, + "column": 23 + }, + "identifierName": "p" + }, + "name": "p" } ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 2394, - "end": 2622, - "loc": { - "start": { - "line": 76, - "column": 2 - }, - "end": { - "line": 84, - "column": 5 - } + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2402, + "end": 2630, + "loc": { + "start": { + "line": 79, + "column": 2 + }, + "end": { + "line": 87, + "column": 5 } - }, - { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2626, - "end": 2642, - "loc": { - "start": { - "line": 86, - "column": 2 - }, - "end": { - "line": 86, - "column": 18 - } + } + }, + { + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2634, + "end": 2650, + "loc": { + "start": { + "line": 89, + "column": 2 + }, + "end": { + "line": 89, + "column": 18 } } - ] - } - ], - "directives": [] - }, - "alternate": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 920, - "end": 1382, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 43, - "column": 4 - } + } + ] } - } - ] + ], + "directives": [] + }, + "alternate": null }, { - "type": "ExpressionStatement", - "start": 2648, - "end": 2664, + "type": "ReturnStatement", + "start": 2682, + "end": 2705, "loc": { "start": { - "line": 89, + "line": 93, "column": 1 }, "end": { - "line": 89, - "column": 17 + "line": 93, + "column": 24 } }, - "expression": { + "argument": { "type": "CallExpression", - "start": 2648, - "end": 2663, + "start": 2689, + "end": 2704, "loc": { "start": { - "line": 89, - "column": 1 + "line": 93, + "column": 8 }, "end": { - "line": 89, - "column": 16 + "line": 93, + "column": 23 } }, "callee": { "type": "Identifier", - "start": 2648, - "end": 2660, + "start": 2689, + "end": 2701, "loc": { "start": { - "line": 89, - "column": 1 + "line": 93, + "column": 8 }, "end": { - "line": 89, - "column": 13 + "line": 93, + "column": 20 }, "identifierName": "insert_case4" }, @@ -5066,16 +5171,16 @@ "arguments": [ { "type": "Identifier", - "start": 2661, - "end": 2662, + "start": 2702, + "end": 2703, "loc": { "start": { - "line": 89, - "column": 14 + "line": 93, + "column": 21 }, "end": { - "line": 89, - "column": 15 + "line": 93, + "column": 22 }, "identifierName": "n" }, @@ -5095,12 +5200,12 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n ", - "start": 345, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", + "start": 293, "end": 635, "loc": { "start": { - "line": 10, + "line": 9, "column": 0 }, "end": { @@ -5119,12 +5224,12 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n ", - "start": 345, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", + "start": 293, "end": 635, "loc": { "start": { - "line": 10, + "line": 9, "column": 0 }, "end": { @@ -5135,25 +5240,25 @@ }, { "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 920, - "end": 1382, + "value": "*\n\t\t * If the path from g to n makes a left-right, change it to a left-left\n\t\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * R B >R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * = >R - - R = - -\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 974, + "end": 1448, "loc": { "start": { - "line": 31, - "column": 1 + "line": 33, + "column": 2 }, "end": { - "line": 43, - "column": 4 + "line": 45, + "column": 5 } } }, { "type": "CommentBlock", "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1464, - "end": 1720, + "start": 1470, + "end": 1726, "loc": { "start": { "line": 48, @@ -5168,8 +5273,8 @@ { "type": "CommentLine", "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1724, - "end": 1801, + "start": 1730, + "end": 1807, "loc": { "start": { "line": 59, @@ -5183,16 +5288,16 @@ }, { "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1863, - "end": 2364, + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1878, + "end": 2379, "loc": { "start": { - "line": 61, + "line": 64, "column": 2 }, "end": { - "line": 73, + "line": 76, "column": 5 } } @@ -5200,15 +5305,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 2394, - "end": 2622, + "start": 2402, + "end": 2630, "loc": { "start": { - "line": 76, + "line": 79, "column": 2 }, "end": { - "line": 84, + "line": 87, "column": 5 } } @@ -5216,15 +5321,15 @@ { "type": "CommentLine", "value": " n = n.right ;", - "start": 2626, - "end": 2642, + "start": 2634, + "end": 2650, "loc": { "start": { - "line": 86, + "line": 89, "column": 2 }, "end": { - "line": 86, + "line": 89, "column": 18 } } @@ -5803,150 +5908,17 @@ "postfix": false, "binop": null }, - "value": "rotate_left", - "start": 147, - "end": 158, - "loc": { - "start": { - "line": 5, - "column": 7 - }, - "end": { - "line": 5, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 159, - "end": 163, - "loc": { - "start": { - "line": 5, - "column": 19 - }, - "end": { - "line": 5, - "column": 23 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../rotate/rotate_left.js", - "start": 164, - "end": 190, - "loc": { - "start": { - "line": 5, - "column": 24 - }, - "end": { - "line": 5, - "column": 50 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 190, - "end": 191, - "loc": { - "start": { - "line": 5, - "column": 50 - }, - "end": { - "line": 5, - "column": 51 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 192, - "end": 198, - "loc": { - "start": { - "line": 6, - "column": 0 - }, - "end": { - "line": 6, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_right", - "start": 199, - "end": 211, + "value": "rotate_left", + "start": 147, + "end": 158, "loc": { "start": { - "line": 6, + "line": 5, "column": 7 }, "end": { - "line": 6, - "column": 19 + "line": 5, + "column": 18 } } }, @@ -5963,16 +5935,16 @@ "binop": null }, "value": "from", - "start": 212, - "end": 216, + "start": 159, + "end": 163, "loc": { "start": { - "line": 6, - "column": 20 + "line": 5, + "column": 19 }, "end": { - "line": 6, - "column": 24 + "line": 5, + "column": 23 } } }, @@ -5989,17 +5961,17 @@ "binop": null, "updateContext": null }, - "value": "../rotate/rotate_right.js", - "start": 217, - "end": 244, + "value": "../rotate/rotate_left.js", + "start": 164, + "end": 190, "loc": { "start": { - "line": 6, - "column": 25 + "line": 5, + "column": 24 }, "end": { - "line": 6, - "column": 52 + "line": 5, + "column": 50 } } }, @@ -6016,16 +5988,16 @@ "binop": null, "updateContext": null }, - "start": 244, - "end": 245, + "start": 190, + "end": 191, "loc": { "start": { - "line": 6, - "column": 52 + "line": 5, + "column": 50 }, "end": { - "line": 6, - "column": 53 + "line": 5, + "column": 51 } } }, @@ -6044,15 +6016,15 @@ "updateContext": null }, "value": "import", - "start": 246, - "end": 252, + "start": 192, + "end": 198, "loc": { "start": { - "line": 7, + "line": 6, "column": 0 }, "end": { - "line": 7, + "line": 6, "column": 6 } } @@ -6069,17 +6041,17 @@ "postfix": false, "binop": null }, - "value": "grandparent", - "start": 253, - "end": 264, + "value": "rotate_right", + "start": 199, + "end": 211, "loc": { "start": { - "line": 7, + "line": 6, "column": 7 }, "end": { - "line": 7, - "column": 18 + "line": 6, + "column": 19 } } }, @@ -6096,16 +6068,16 @@ "binop": null }, "value": "from", - "start": 265, - "end": 269, + "start": 212, + "end": 216, "loc": { "start": { - "line": 7, - "column": 19 + "line": 6, + "column": 20 }, "end": { - "line": 7, - "column": 23 + "line": 6, + "column": 24 } } }, @@ -6122,17 +6094,17 @@ "binop": null, "updateContext": null }, - "value": "../family/grandparent.js", - "start": 270, - "end": 296, + "value": "../rotate/rotate_right.js", + "start": 217, + "end": 244, "loc": { "start": { - "line": 7, - "column": 24 + "line": 6, + "column": 25 }, "end": { - "line": 7, - "column": 50 + "line": 6, + "column": 52 } } }, @@ -6149,16 +6121,16 @@ "binop": null, "updateContext": null }, - "start": 296, - "end": 297, + "start": 244, + "end": 245, "loc": { "start": { - "line": 7, - "column": 50 + "line": 6, + "column": 52 }, "end": { - "line": 7, - "column": 51 + "line": 6, + "column": 53 } } }, @@ -6177,15 +6149,15 @@ "updateContext": null }, "value": "import", - "start": 298, - "end": 304, + "start": 246, + "end": 252, "loc": { "start": { - "line": 8, + "line": 7, "column": 0 }, "end": { - "line": 8, + "line": 7, "column": 6 } } @@ -6203,15 +6175,15 @@ "binop": null }, "value": "insert_case4", - "start": 305, - "end": 317, + "start": 253, + "end": 265, "loc": { "start": { - "line": 8, + "line": 7, "column": 7 }, "end": { - "line": 8, + "line": 7, "column": 19 } } @@ -6229,15 +6201,15 @@ "binop": null }, "value": "from", - "start": 318, - "end": 322, + "start": 266, + "end": 270, "loc": { "start": { - "line": 8, + "line": 7, "column": 20 }, "end": { - "line": 8, + "line": 7, "column": 24 } } @@ -6256,15 +6228,15 @@ "updateContext": null }, "value": "./insert_case4.js", - "start": 323, - "end": 342, + "start": 271, + "end": 290, "loc": { "start": { - "line": 8, + "line": 7, "column": 25 }, "end": { - "line": 8, + "line": 7, "column": 44 } } @@ -6282,27 +6254,27 @@ "binop": null, "updateContext": null }, - "start": 342, - "end": 343, + "start": 290, + "end": 291, "loc": { "start": { - "line": 8, + "line": 7, "column": 44 }, "end": { - "line": 8, + "line": 7, "column": 45 } } }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n ", - "start": 345, + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", + "start": 293, "end": 635, "loc": { "start": { - "line": 10, + "line": 9, "column": 0 }, "end": { @@ -8384,7 +8356,7 @@ "postfix": false, "binop": null }, - "value": "g", + "value": "p", "start": 898, "end": 899, "loc": { @@ -8437,24 +8409,183 @@ "postfix": false, "binop": null }, - "value": "grandparent", + "value": "n", "start": 902, - "end": 913, + "end": 903, "loc": { "start": { "line": 29, "column": 11 }, "end": { - "line": 29, - "column": 22 + "line": 29, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 903, + "end": 904, + "loc": { + "start": { + "line": 29, + "column": 12 + }, + "end": { + "line": 29, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 904, + "end": 910, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 19 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 910, + "end": 911, + "loc": { + "start": { + "line": 29, + "column": 19 + }, + "end": { + "line": 29, + "column": 20 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 913, + "end": 918, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "g", + "start": 919, + "end": 920, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 921, + "end": 922, + "loc": { + "start": { + "line": 30, + "column": 9 + }, + "end": { + "line": 30, + "column": 10 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -8463,50 +8594,51 @@ "postfix": false, "binop": null }, - "start": 913, - "end": 914, + "value": "p", + "start": 923, + "end": 924, "loc": { "start": { - "line": 29, - "column": 22 + "line": 30, + "column": 11 }, "end": { - "line": 29, - "column": 23 + "line": 30, + "column": 12 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "n", - "start": 914, - "end": 915, + "start": 924, + "end": 925, "loc": { "start": { - "line": 29, - "column": 23 + "line": 30, + "column": 12 }, "end": { - "line": 29, - "column": 24 + "line": 30, + "column": 13 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8514,16 +8646,17 @@ "postfix": false, "binop": null }, - "start": 915, - "end": 916, + "value": "parent", + "start": 925, + "end": 931, "loc": { "start": { - "line": 29, - "column": 24 + "line": 30, + "column": 13 }, "end": { - "line": 29, - "column": 25 + "line": 30, + "column": 19 } } }, @@ -8540,32 +8673,16 @@ "binop": null, "updateContext": null }, - "start": 916, - "end": 917, - "loc": { - "start": { - "line": 29, - "column": 25 - }, - "end": { - "line": 29, - "column": 26 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t ", - "start": 920, - "end": 1382, + "start": 931, + "end": 932, "loc": { "start": { - "line": 31, - "column": 1 + "line": 30, + "column": 19 }, "end": { - "line": 43, - "column": 4 + "line": 30, + "column": 20 } } }, @@ -8584,15 +8701,15 @@ "updateContext": null }, "value": "if", - "start": 1385, - "end": 1387, + "start": 935, + "end": 937, "loc": { "start": { - "line": 45, + "line": 32, "column": 1 }, "end": { - "line": 45, + "line": 32, "column": 3 } } @@ -8609,15 +8726,15 @@ "postfix": false, "binop": null }, - "start": 1388, - "end": 1389, + "start": 938, + "end": 939, "loc": { "start": { - "line": 45, + "line": 32, "column": 4 }, "end": { - "line": 45, + "line": 32, "column": 5 } } @@ -8635,15 +8752,15 @@ "binop": null }, "value": "n", - "start": 1389, - "end": 1390, + "start": 939, + "end": 940, "loc": { "start": { - "line": 45, + "line": 32, "column": 5 }, "end": { - "line": 45, + "line": 32, "column": 6 } } @@ -8662,15 +8779,15 @@ "updateContext": null }, "value": "===", - "start": 1391, - "end": 1394, + "start": 941, + "end": 944, "loc": { "start": { - "line": 45, + "line": 32, "column": 7 }, "end": { - "line": 45, + "line": 32, "column": 10 } } @@ -8687,16 +8804,16 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1395, - "end": 1396, + "value": "p", + "start": 945, + "end": 946, "loc": { "start": { - "line": 45, + "line": 32, "column": 11 }, "end": { - "line": 45, + "line": 32, "column": 12 } } @@ -8714,15 +8831,15 @@ "binop": null, "updateContext": null }, - "start": 1396, - "end": 1397, + "start": 946, + "end": 947, "loc": { "start": { - "line": 45, + "line": 32, "column": 12 }, "end": { - "line": 45, + "line": 32, "column": 13 } } @@ -8739,43 +8856,44 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1397, - "end": 1403, + "value": "right", + "start": 947, + "end": 952, "loc": { "start": { - "line": 45, + "line": 32, "column": 13 }, "end": { - "line": 45, - "column": 19 + "line": 32, + "column": 18 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "&&", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 2, "updateContext": null }, - "start": 1403, - "end": 1404, + "value": "&&", + "start": 953, + "end": 955, "loc": { "start": { - "line": 45, + "line": 32, "column": 19 }, "end": { - "line": 45, - "column": 20 + "line": 32, + "column": 21 } } }, @@ -8791,23 +8909,23 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1404, - "end": 1409, + "value": "p", + "start": 956, + "end": 957, "loc": { "start": { - "line": 45, - "column": 20 + "line": 32, + "column": 22 }, "end": { - "line": 45, - "column": 25 + "line": 32, + "column": 23 } } }, { "type": { - "label": "&&", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8815,20 +8933,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 2, + "binop": 6, "updateContext": null }, - "value": "&&", - "start": 1410, - "end": 1412, + "value": "===", + "start": 958, + "end": 961, "loc": { "start": { - "line": 45, - "column": 26 + "line": 32, + "column": 24 }, "end": { - "line": 45, - "column": 28 + "line": 32, + "column": 27 } } }, @@ -8844,17 +8962,17 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1413, - "end": 1414, + "value": "g", + "start": 962, + "end": 963, "loc": { "start": { - "line": 45, - "column": 29 + "line": 32, + "column": 28 }, "end": { - "line": 45, - "column": 30 + "line": 32, + "column": 29 } } }, @@ -8871,16 +8989,16 @@ "binop": null, "updateContext": null }, - "start": 1414, - "end": 1415, + "start": 963, + "end": 964, "loc": { "start": { - "line": 45, - "column": 30 + "line": 32, + "column": 29 }, "end": { - "line": 45, - "column": 31 + "line": 32, + "column": 30 } } }, @@ -8896,51 +9014,49 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1415, - "end": 1421, + "value": "left", + "start": 964, + "end": 968, "loc": { "start": { - "line": 45, - "column": 31 + "line": 32, + "column": 30 }, "end": { - "line": 45, - "column": 37 + "line": 32, + "column": 34 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 1422, - "end": 1425, + "start": 968, + "end": 969, "loc": { "start": { - "line": 45, - "column": 38 + "line": 32, + "column": 34 }, "end": { - "line": 45, - "column": 41 + "line": 32, + "column": 35 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -8949,50 +9065,65 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 1426, - "end": 1427, + "start": 970, + "end": 971, "loc": { "start": { - "line": 45, - "column": 42 + "line": 32, + "column": 36 + }, + "end": { + "line": 32, + "column": 37 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a left-right, change it to a left-left\n\t\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * R B >R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * = >R - - R = - -\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 974, + "end": 1448, + "loc": { + "start": { + "line": 33, + "column": 2 }, "end": { "line": 45, - "column": 43 + "column": 5 } } }, { "type": { - "label": ".", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1427, - "end": 1428, + "value": "rotate_left", + "start": 1451, + "end": 1462, "loc": { "start": { - "line": 45, - "column": 43 + "line": 46, + "column": 2 }, "end": { - "line": 45, - "column": 44 + "line": 46, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -9001,25 +9132,24 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1428, - "end": 1432, + "start": 1462, + "end": 1463, "loc": { "start": { - "line": 45, - "column": 44 + "line": 46, + "column": 13 }, "end": { - "line": 45, - "column": 48 + "line": 46, + "column": 14 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -9027,24 +9157,25 @@ "postfix": false, "binop": null }, - "start": 1432, - "end": 1433, + "value": "p", + "start": 1463, + "end": 1464, "loc": { "start": { - "line": 45, - "column": 48 + "line": 46, + "column": 14 }, "end": { - "line": 45, - "column": 49 + "line": 46, + "column": 15 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -9052,67 +9183,102 @@ "postfix": false, "binop": null }, - "start": 1434, - "end": 1435, + "start": 1464, + "end": 1465, "loc": { "start": { - "line": 45, - "column": 50 + "line": 46, + "column": 15 }, "end": { - "line": 45, - "column": 51 + "line": 46, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "rotate_left", - "start": 1438, - "end": 1449, + "start": 1465, + "end": 1466, "loc": { "start": { "line": 46, - "column": 2 + "column": 16 }, "end": { "line": 46, - "column": 13 + "column": 17 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", + "start": 1470, + "end": 1726, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 57, + "column": 5 + } + } + }, + { + "type": "CommentLine", + "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", + "start": 1730, + "end": 1807, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 79 } } }, { "type": { - "label": "(", + "label": "return", + "keyword": "return", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1449, - "end": 1450, + "value": "return", + "start": 1810, + "end": 1816, "loc": { "start": { - "line": 46, - "column": 13 + "line": 60, + "column": 2 }, "end": { - "line": 46, - "column": 14 + "line": 60, + "column": 8 } } }, @@ -9128,43 +9294,42 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1450, - "end": 1451, + "value": "insert_case4", + "start": 1817, + "end": 1829, "loc": { "start": { - "line": 46, - "column": 14 + "line": 60, + "column": 9 }, "end": { - "line": 46, - "column": 15 + "line": 60, + "column": 21 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1451, - "end": 1452, + "start": 1829, + "end": 1830, "loc": { "start": { - "line": 46, - "column": 15 + "line": 60, + "column": 21 }, "end": { - "line": 46, - "column": 16 + "line": 60, + "column": 22 } } }, @@ -9180,17 +9345,17 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1452, - "end": 1458, + "value": "p", + "start": 1830, + "end": 1831, "loc": { "start": { - "line": 46, - "column": 16 + "line": 60, + "column": 22 }, "end": { - "line": 46, - "column": 22 + "line": 60, + "column": 23 } } }, @@ -9206,16 +9371,16 @@ "postfix": false, "binop": null }, - "start": 1458, - "end": 1459, + "start": 1831, + "end": 1832, "loc": { "start": { - "line": 46, - "column": 22 + "line": 60, + "column": 23 }, "end": { - "line": 46, - "column": 23 + "line": 60, + "column": 24 } } }, @@ -9232,54 +9397,48 @@ "binop": null, "updateContext": null }, - "start": 1459, - "end": 1460, + "start": 1832, + "end": 1833, "loc": { "start": { - "line": 46, - "column": 23 - }, - "end": { - "line": 46, + "line": 60, "column": 24 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t ", - "start": 1464, - "end": 1720, - "loc": { - "start": { - "line": 48, - "column": 2 }, "end": { - "line": 57, - "column": 5 + "line": 60, + "column": 25 } } }, { - "type": "CommentLine", - "value": " n = n.left; /!\\ need to fix rotate, so that we can safely reference a node", - "start": 1724, - "end": 1801, + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1835, + "end": 1836, "loc": { "start": { - "line": 59, - "column": 2 + "line": 61, + "column": 1 }, "end": { - "line": 59, - "column": 79 + "line": 61, + "column": 2 } } }, { "type": { - "label": "}", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -9287,99 +9446,98 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1803, - "end": 1804, + "value": "if", + "start": 1839, + "end": 1841, "loc": { "start": { - "line": 60, + "line": 63, "column": 1 }, "end": { - "line": 60, - "column": 2 + "line": 63, + "column": 3 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "else", - "start": 1805, - "end": 1809, + "start": 1842, + "end": 1843, "loc": { "start": { - "line": 60, - "column": 3 + "line": 63, + "column": 4 }, "end": { - "line": 60, - "column": 7 + "line": 63, + "column": 5 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 1810, - "end": 1812, + "value": "n", + "start": 1843, + "end": 1844, "loc": { "start": { - "line": 60, - "column": 8 + "line": 63, + "column": 5 }, "end": { - "line": 60, - "column": 10 + "line": 63, + "column": 6 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 1813, - "end": 1814, + "value": "===", + "start": 1845, + "end": 1848, "loc": { "start": { - "line": 60, - "column": 11 + "line": 63, + "column": 7 }, "end": { - "line": 60, - "column": 12 + "line": 63, + "column": 10 } } }, @@ -9395,44 +9553,43 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1814, - "end": 1815, + "value": "p", + "start": 1849, + "end": 1850, "loc": { "start": { - "line": 60, - "column": 12 + "line": 63, + "column": 11 }, "end": { - "line": 60, - "column": 13 + "line": 63, + "column": 12 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1816, - "end": 1819, + "start": 1850, + "end": 1851, "loc": { "start": { - "line": 60, - "column": 14 + "line": 63, + "column": 12 }, "end": { - "line": 60, - "column": 17 + "line": 63, + "column": 13 } } }, @@ -9448,42 +9605,43 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1820, - "end": 1821, + "value": "left", + "start": 1851, + "end": 1855, "loc": { "start": { - "line": 60, - "column": 18 + "line": 63, + "column": 13 }, "end": { - "line": 60, - "column": 19 + "line": 63, + "column": 17 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "&&", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 2, "updateContext": null }, - "start": 1821, - "end": 1822, + "value": "&&", + "start": 1856, + "end": 1858, "loc": { "start": { - "line": 60, - "column": 19 + "line": 63, + "column": 18 }, "end": { - "line": 60, + "line": 63, "column": 20 } } @@ -9500,43 +9658,44 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1822, - "end": 1828, + "value": "p", + "start": 1859, + "end": 1860, "loc": { "start": { - "line": 60, - "column": 20 + "line": 63, + "column": 21 }, "end": { - "line": 60, - "column": 26 + "line": 63, + "column": 22 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1828, - "end": 1829, + "value": "===", + "start": 1861, + "end": 1864, "loc": { "start": { - "line": 60, - "column": 26 + "line": 63, + "column": 23 }, "end": { - "line": 60, - "column": 27 + "line": 63, + "column": 26 } } }, @@ -9552,44 +9711,43 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 1829, - "end": 1833, + "value": "g", + "start": 1865, + "end": 1866, "loc": { "start": { - "line": 60, + "line": 63, "column": 27 }, "end": { - "line": 60, - "column": 31 + "line": 63, + "column": 28 } } }, { "type": { - "label": "&&", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 2, + "binop": null, "updateContext": null }, - "value": "&&", - "start": 1834, - "end": 1836, + "start": 1866, + "end": 1867, "loc": { "start": { - "line": 60, - "column": 32 + "line": 63, + "column": 28 }, "end": { - "line": 60, - "column": 34 + "line": 63, + "column": 29 } } }, @@ -9605,23 +9763,23 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 1837, - "end": 1838, + "value": "right", + "start": 1867, + "end": 1872, "loc": { "start": { - "line": 60, - "column": 35 + "line": 63, + "column": 29 }, "end": { - "line": 60, - "column": 36 + "line": 63, + "column": 34 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -9629,26 +9787,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1838, - "end": 1839, + "start": 1872, + "end": 1873, "loc": { "start": { - "line": 60, - "column": 36 + "line": 63, + "column": 34 }, "end": { - "line": 60, - "column": 37 + "line": 63, + "column": 35 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -9657,44 +9814,32 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 1839, - "end": 1845, + "start": 1874, + "end": 1875, "loc": { "start": { - "line": 60, - "column": 37 + "line": 63, + "column": 36 }, "end": { - "line": 60, - "column": 43 + "line": 63, + "column": 37 } } }, { - "type": { - "label": "==/!=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 6, - "updateContext": null - }, - "value": "===", - "start": 1846, - "end": 1849, + "type": "CommentBlock", + "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", + "start": 1878, + "end": 2379, "loc": { "start": { - "line": 60, - "column": 44 + "line": 64, + "column": 2 }, "end": { - "line": 60, - "column": 47 + "line": 76, + "column": 5 } } }, @@ -9710,43 +9855,42 @@ "postfix": false, "binop": null }, - "value": "g", - "start": 1850, - "end": 1851, + "value": "rotate_right", + "start": 2382, + "end": 2394, "loc": { "start": { - "line": 60, - "column": 48 + "line": 77, + "column": 2 }, "end": { - "line": 60, - "column": 49 + "line": 77, + "column": 14 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1851, - "end": 1852, + "start": 2394, + "end": 2395, "loc": { "start": { - "line": 60, - "column": 49 + "line": 77, + "column": 14 }, "end": { - "line": 60, - "column": 50 + "line": 77, + "column": 15 } } }, @@ -9762,17 +9906,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 1852, - "end": 1857, + "value": "p", + "start": 2395, + "end": 2396, "loc": { "start": { - "line": 60, - "column": 50 + "line": 77, + "column": 15 }, "end": { - "line": 60, - "column": 55 + "line": 77, + "column": 16 } } }, @@ -9788,108 +9932,102 @@ "postfix": false, "binop": null }, - "start": 1857, - "end": 1858, + "start": 2396, + "end": 2397, "loc": { "start": { - "line": 60, - "column": 55 + "line": 77, + "column": 16 }, "end": { - "line": 60, - "column": 56 + "line": 77, + "column": 17 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1859, - "end": 1860, + "start": 2397, + "end": 2398, "loc": { "start": { - "line": 60, - "column": 57 + "line": 77, + "column": 17 }, "end": { - "line": 60, - "column": 58 + "line": 77, + "column": 18 } } }, { "type": "CommentBlock", - "value": "*\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t ", - "start": 1863, - "end": 2364, + "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", + "start": 2402, + "end": 2630, "loc": { "start": { - "line": 61, + "line": 79, "column": 2 }, "end": { - "line": 73, + "line": 87, "column": 5 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_right", - "start": 2367, - "end": 2379, + "type": "CommentLine", + "value": " n = n.right ;", + "start": 2634, + "end": 2650, "loc": { "start": { - "line": 74, + "line": 89, "column": 2 }, "end": { - "line": 74, - "column": 14 + "line": 89, + "column": 18 } } }, { "type": { - "label": "(", + "label": "return", + "keyword": "return", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2379, - "end": 2380, + "value": "return", + "start": 2653, + "end": 2659, "loc": { "start": { - "line": 74, - "column": 14 + "line": 90, + "column": 2 }, "end": { - "line": 74, - "column": 15 + "line": 90, + "column": 8 } } }, @@ -9905,43 +10043,42 @@ "postfix": false, "binop": null }, - "value": "n", - "start": 2380, - "end": 2381, + "value": "insert_case4", + "start": 2660, + "end": 2672, "loc": { "start": { - "line": 74, - "column": 15 + "line": 90, + "column": 9 }, "end": { - "line": 74, - "column": 16 + "line": 90, + "column": 21 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2381, - "end": 2382, + "start": 2672, + "end": 2673, "loc": { "start": { - "line": 74, - "column": 16 + "line": 90, + "column": 21 }, "end": { - "line": 74, - "column": 17 + "line": 90, + "column": 22 } } }, @@ -9957,16 +10094,16 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 2382, - "end": 2388, + "value": "p", + "start": 2673, + "end": 2674, "loc": { "start": { - "line": 74, - "column": 17 + "line": 90, + "column": 22 }, "end": { - "line": 74, + "line": 90, "column": 23 } } @@ -9983,15 +10120,15 @@ "postfix": false, "binop": null }, - "start": 2388, - "end": 2389, + "start": 2674, + "end": 2675, "loc": { "start": { - "line": 74, + "line": 90, "column": 23 }, "end": { - "line": 74, + "line": 90, "column": 24 } } @@ -10009,73 +10146,69 @@ "binop": null, "updateContext": null }, - "start": 2389, - "end": 2390, + "start": 2675, + "end": 2676, "loc": { "start": { - "line": 74, + "line": 90, "column": 24 }, "end": { - "line": 74, + "line": 90, "column": 25 } } }, { - "type": "CommentBlock", - "value": "*\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t ", - "start": 2394, - "end": 2622, + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2678, + "end": 2679, "loc": { "start": { - "line": 76, - "column": 2 + "line": 91, + "column": 1 }, "end": { - "line": 84, - "column": 5 - } - } - }, - { - "type": "CommentLine", - "value": " n = n.right ;", - "start": 2626, - "end": 2642, - "loc": { - "start": { - "line": 86, + "line": 91, "column": 2 - }, - "end": { - "line": 86, - "column": 18 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "return", + "keyword": "return", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2644, - "end": 2645, + "value": "return", + "start": 2682, + "end": 2688, "loc": { "start": { - "line": 87, + "line": 93, "column": 1 }, "end": { - "line": 87, - "column": 2 + "line": 93, + "column": 7 } } }, @@ -10092,16 +10225,16 @@ "binop": null }, "value": "insert_case4", - "start": 2648, - "end": 2660, + "start": 2689, + "end": 2701, "loc": { "start": { - "line": 89, - "column": 1 + "line": 93, + "column": 8 }, "end": { - "line": 89, - "column": 13 + "line": 93, + "column": 20 } } }, @@ -10117,16 +10250,16 @@ "postfix": false, "binop": null }, - "start": 2660, - "end": 2661, + "start": 2701, + "end": 2702, "loc": { "start": { - "line": 89, - "column": 13 + "line": 93, + "column": 20 }, "end": { - "line": 89, - "column": 14 + "line": 93, + "column": 21 } } }, @@ -10143,16 +10276,16 @@ "binop": null }, "value": "n", - "start": 2661, - "end": 2662, + "start": 2702, + "end": 2703, "loc": { "start": { - "line": 89, - "column": 14 + "line": 93, + "column": 21 }, "end": { - "line": 89, - "column": 15 + "line": 93, + "column": 22 } } }, @@ -10168,16 +10301,16 @@ "postfix": false, "binop": null }, - "start": 2662, - "end": 2663, + "start": 2703, + "end": 2704, "loc": { "start": { - "line": 89, - "column": 15 + "line": 93, + "column": 22 }, "end": { - "line": 89, - "column": 16 + "line": 93, + "column": 23 } } }, @@ -10194,16 +10327,16 @@ "binop": null, "updateContext": null }, - "start": 2663, - "end": 2664, + "start": 2704, + "end": 2705, "loc": { "start": { - "line": 89, - "column": 16 + "line": 93, + "column": 23 }, "end": { - "line": 89, - "column": 17 + "line": 93, + "column": 24 } } }, @@ -10219,15 +10352,15 @@ "postfix": false, "binop": null }, - "start": 2665, - "end": 2666, + "start": 2706, + "end": 2707, "loc": { "start": { - "line": 90, + "line": 94, "column": 0 }, "end": { - "line": 90, + "line": 94, "column": 1 } } @@ -10245,15 +10378,15 @@ "binop": null, "updateContext": null }, - "start": 2666, - "end": 2667, + "start": 2707, + "end": 2708, "loc": { "start": { - "line": 90, + "line": 94, "column": 1 }, "end": { - "line": 90, + "line": 94, "column": 2 } } @@ -10273,15 +10406,15 @@ "updateContext": null }, "value": "export", - "start": 2669, - "end": 2675, + "start": 2710, + "end": 2716, "loc": { "start": { - "line": 92, + "line": 96, "column": 0 }, "end": { - "line": 92, + "line": 96, "column": 6 } } @@ -10301,15 +10434,15 @@ "updateContext": null }, "value": "default", - "start": 2676, - "end": 2683, + "start": 2717, + "end": 2724, "loc": { "start": { - "line": 92, + "line": 96, "column": 7 }, "end": { - "line": 92, + "line": 96, "column": 14 } } @@ -10327,15 +10460,15 @@ "binop": null }, "value": "insert_case3", - "start": 2684, - "end": 2696, + "start": 2725, + "end": 2737, "loc": { "start": { - "line": 92, + "line": 96, "column": 15 }, "end": { - "line": 92, + "line": 96, "column": 27 } } @@ -10353,15 +10486,15 @@ "binop": null, "updateContext": null }, - "start": 2696, - "end": 2697, + "start": 2737, + "end": 2738, "loc": { "start": { - "line": 92, + "line": 96, "column": 27 }, "end": { - "line": 92, + "line": 96, "column": 28 } } @@ -10379,15 +10512,15 @@ "binop": null, "updateContext": null }, - "start": 2698, - "end": 2698, + "start": 2739, + "end": 2739, "loc": { "start": { - "line": 93, + "line": 97, "column": 0 }, "end": { - "line": 93, + "line": 97, "column": 0 } } diff --git a/ast/source/insertion/insert_case4.js.json b/ast/source/insertion/insert_case4.js.json index 6d1f113..4f10bac 100644 --- a/ast/source/insertion/insert_case4.js.json +++ b/ast/source/insertion/insert_case4.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 2141, + "end": 2212, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 71, + "line": 74, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 2141, + "end": 2212, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 71, + "line": 74, "column": 0 } }, @@ -513,16 +513,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 299, - "end": 578, + "end": 630, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 3 } } @@ -531,44 +531,44 @@ }, { "type": "Identifier", - "start": 579, - "end": 2110, + "start": 631, + "end": 2181, "loc": { "start": { - "line": 20, + "line": 21, "column": 0 }, "end": { - "line": 68, + "line": 71, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 585, - "end": 2109, + "start": 637, + "end": 2180, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 68, + "line": 71, "column": 1 } }, "id": { "type": "Identifier", - "start": 585, - "end": 597, + "start": 637, + "end": 649, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 20, + "line": 21, "column": 18 }, "identifierName": "insert_case4" @@ -578,15 +578,15 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 600, - "end": 2109, + "start": 652, + "end": 2180, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 68, + "line": 71, "column": 1 } }, @@ -597,15 +597,15 @@ "params": [ { "type": "Identifier", - "start": 601, - "end": 602, + "start": 653, + "end": 654, "loc": { "start": { - "line": 20, + "line": 21, "column": 22 }, "end": { - "line": 20, + "line": 21, "column": 23 }, "identifierName": "n" @@ -615,58 +615,58 @@ ], "body": { "type": "BlockStatement", - "start": 607, - "end": 2109, + "start": 659, + "end": 2180, "loc": { "start": { - "line": 20, + "line": 21, "column": 28 }, "end": { - "line": 68, + "line": 71, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 610, - "end": 636, + "start": 662, + "end": 688, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 610, - "end": 635, + "start": 662, + "end": 687, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 26 } }, "callee": { "type": "Identifier", - "start": 610, - "end": 616, + "start": 662, + "end": 668, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -676,29 +676,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 617, - "end": 634, + "start": 669, + "end": 686, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 25 } }, "left": { "type": "Identifier", - "start": 617, - "end": 618, + "start": 669, + "end": 670, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 }, "identifierName": "n" @@ -708,15 +708,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 630, - "end": 634, + "start": 682, + "end": 686, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 25 }, "identifierName": "Node" @@ -729,43 +729,43 @@ }, { "type": "ExpressionStatement", - "start": 638, - "end": 663, + "start": 690, + "end": 715, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 638, - "end": 662, + "start": 690, + "end": 714, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "callee": { "type": "Identifier", - "start": 638, - "end": 644, + "start": 690, + "end": 696, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -775,43 +775,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 645, - "end": 661, + "start": 697, + "end": 713, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 645, - "end": 653, + "start": 697, + "end": 705, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 645, - "end": 646, + "start": 697, + "end": 698, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -820,15 +820,15 @@ }, "property": { "type": "Identifier", - "start": 647, - "end": 653, + "start": 699, + "end": 705, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 16 }, "identifierName": "_color" @@ -840,15 +840,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 658, - "end": 661, + "start": 710, + "end": 713, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 24 }, "identifierName": "RED" @@ -861,43 +861,43 @@ }, { "type": "ExpressionStatement", - "start": 665, - "end": 716, + "start": 717, + "end": 768, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 52 } }, "expression": { "type": "CallExpression", - "start": 665, - "end": 715, + "start": 717, + "end": 767, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 51 } }, "callee": { "type": "Identifier", - "start": 665, - "end": 671, + "start": 717, + "end": 723, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -907,57 +907,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 672, - "end": 714, + "start": 724, + "end": 766, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 50 } }, "left": { "type": "BinaryExpression", - "start": 672, - "end": 687, + "start": 724, + "end": 739, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 23 } }, "left": { "type": "MemberExpression", - "start": 672, - "end": 678, + "start": 724, + "end": 730, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 14 } }, "object": { "type": "Identifier", - "start": 672, - "end": 673, + "start": 724, + "end": 725, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -966,15 +966,15 @@ }, "property": { "type": "Identifier", - "start": 674, - "end": 678, + "start": 726, + "end": 730, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 14 }, "identifierName": "left" @@ -986,15 +986,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 683, - "end": 687, + "start": 735, + "end": 739, "loc": { "start": { - "line": 23, + "line": 24, "column": 19 }, "end": { - "line": 23, + "line": 24, "column": 23 } } @@ -1003,57 +1003,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 691, - "end": 714, + "start": 743, + "end": 766, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 50 } }, "left": { "type": "MemberExpression", - "start": 691, - "end": 704, + "start": 743, + "end": 756, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 40 } }, "object": { "type": "MemberExpression", - "start": 691, - "end": 697, + "start": 743, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 33 } }, "object": { "type": "Identifier", - "start": 691, - "end": 692, + "start": 743, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 28 }, "identifierName": "n" @@ -1062,15 +1062,15 @@ }, "property": { "type": "Identifier", - "start": 693, - "end": 697, + "start": 745, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 29 }, "end": { - "line": 23, + "line": 24, "column": 33 }, "identifierName": "left" @@ -1081,15 +1081,15 @@ }, "property": { "type": "Identifier", - "start": 698, - "end": 704, + "start": 750, + "end": 756, "loc": { "start": { - "line": 23, + "line": 24, "column": 34 }, "end": { - "line": 23, + "line": 24, "column": 40 }, "identifierName": "_color" @@ -1101,15 +1101,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 709, - "end": 714, + "start": 761, + "end": 766, "loc": { "start": { - "line": 23, + "line": 24, "column": 45 }, "end": { - "line": 23, + "line": 24, "column": 50 }, "identifierName": "BLACK" @@ -1123,43 +1123,43 @@ }, { "type": "ExpressionStatement", - "start": 718, - "end": 771, + "start": 770, + "end": 823, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 54 } }, "expression": { "type": "CallExpression", - "start": 718, - "end": 770, + "start": 770, + "end": 822, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 53 } }, "callee": { "type": "Identifier", - "start": 718, - "end": 724, + "start": 770, + "end": 776, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -1169,57 +1169,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 725, - "end": 769, + "start": 777, + "end": 821, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 52 } }, "left": { "type": "BinaryExpression", - "start": 725, - "end": 741, + "start": 777, + "end": 793, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 725, - "end": 732, + "start": 777, + "end": 784, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 15 } }, "object": { "type": "Identifier", - "start": 725, - "end": 726, + "start": 777, + "end": 778, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 }, "identifierName": "n" @@ -1228,15 +1228,15 @@ }, "property": { "type": "Identifier", - "start": 727, - "end": 732, + "start": 779, + "end": 784, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 15 }, "identifierName": "right" @@ -1248,15 +1248,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 737, - "end": 741, + "start": 789, + "end": 793, "loc": { "start": { - "line": 24, + "line": 25, "column": 20 }, "end": { - "line": 24, + "line": 25, "column": 24 } } @@ -1265,57 +1265,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 745, - "end": 769, + "start": 797, + "end": 821, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 52 } }, "left": { "type": "MemberExpression", - "start": 745, - "end": 759, + "start": 797, + "end": 811, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 42 } }, "object": { "type": "MemberExpression", - "start": 745, - "end": 752, + "start": 797, + "end": 804, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 35 } }, "object": { "type": "Identifier", - "start": 745, - "end": 746, + "start": 797, + "end": 798, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 29 }, "identifierName": "n" @@ -1324,15 +1324,15 @@ }, "property": { "type": "Identifier", - "start": 747, - "end": 752, + "start": 799, + "end": 804, "loc": { "start": { - "line": 24, + "line": 25, "column": 30 }, "end": { - "line": 24, + "line": 25, "column": 35 }, "identifierName": "right" @@ -1343,15 +1343,15 @@ }, "property": { "type": "Identifier", - "start": 753, - "end": 759, + "start": 805, + "end": 811, "loc": { "start": { - "line": 24, + "line": 25, "column": 36 }, "end": { - "line": 24, + "line": 25, "column": 42 }, "identifierName": "_color" @@ -1363,15 +1363,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 764, - "end": 769, + "start": 816, + "end": 821, "loc": { "start": { - "line": 24, + "line": 25, "column": 47 }, "end": { - "line": 24, + "line": 25, "column": 52 }, "identifierName": "BLACK" @@ -1385,43 +1385,43 @@ }, { "type": "ExpressionStatement", - "start": 773, - "end": 799, + "start": 825, + "end": 851, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 773, - "end": 798, + "start": 825, + "end": 850, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 26 } }, "callee": { "type": "Identifier", - "start": 773, - "end": 779, + "start": 825, + "end": 831, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -1431,43 +1431,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 780, - "end": 797, + "start": 832, + "end": 849, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 780, - "end": 788, + "start": 832, + "end": 840, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 16 } }, "object": { "type": "Identifier", - "start": 780, - "end": 781, + "start": 832, + "end": 833, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 }, "identifierName": "n" @@ -1476,15 +1476,15 @@ }, "property": { "type": "Identifier", - "start": 782, - "end": 788, + "start": 834, + "end": 840, "loc": { "start": { - "line": 25, + "line": 26, "column": 10 }, "end": { - "line": 25, + "line": 26, "column": 16 }, "identifierName": "parent" @@ -1496,15 +1496,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 793, - "end": 797, + "start": 845, + "end": 849, "loc": { "start": { - "line": 25, + "line": 26, "column": 21 }, "end": { - "line": 25, + "line": 26, "column": 25 } } @@ -1515,43 +1515,43 @@ }, { "type": "ExpressionStatement", - "start": 801, - "end": 833, + "start": 853, + "end": 885, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 801, - "end": 832, + "start": 853, + "end": 884, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 32 } }, "callee": { "type": "Identifier", - "start": 801, - "end": 807, + "start": 853, + "end": 859, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -1561,57 +1561,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 808, - "end": 831, + "start": 860, + "end": 883, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 808, - "end": 823, + "start": 860, + "end": 875, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 808, - "end": 816, + "start": 860, + "end": 868, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 16 } }, "object": { "type": "Identifier", - "start": 808, - "end": 809, + "start": 860, + "end": 861, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 }, "identifierName": "n" @@ -1620,15 +1620,15 @@ }, "property": { "type": "Identifier", - "start": 810, - "end": 816, + "start": 862, + "end": 868, "loc": { "start": { - "line": 26, + "line": 27, "column": 10 }, "end": { - "line": 26, + "line": 27, "column": 16 }, "identifierName": "parent" @@ -1639,15 +1639,15 @@ }, "property": { "type": "Identifier", - "start": 817, - "end": 823, + "start": 869, + "end": 875, "loc": { "start": { - "line": 26, + "line": 27, "column": 17 }, "end": { - "line": 26, + "line": 27, "column": 23 }, "identifierName": "_color" @@ -1659,15 +1659,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 828, - "end": 831, + "start": 880, + "end": 883, "loc": { "start": { - "line": 26, + "line": 27, "column": 28 }, "end": { - "line": 26, + "line": 27, "column": 31 }, "identifierName": "RED" @@ -1680,44 +1680,44 @@ }, { "type": "VariableDeclaration", - "start": 835, - "end": 860, + "start": 887, + "end": 912, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 26 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 841, - "end": 859, + "start": 893, + "end": 911, "loc": { "start": { - "line": 27, + "line": 28, "column": 7 }, "end": { - "line": 27, + "line": 28, "column": 25 } }, "id": { "type": "Identifier", - "start": 841, - "end": 842, + "start": 893, + "end": 894, "loc": { "start": { - "line": 27, + "line": 28, "column": 7 }, "end": { - "line": 27, + "line": 28, "column": 8 }, "identifierName": "g" @@ -1726,29 +1726,29 @@ }, "init": { "type": "CallExpression", - "start": 845, - "end": 859, + "start": 897, + "end": 911, "loc": { "start": { - "line": 27, + "line": 28, "column": 11 }, "end": { - "line": 27, + "line": 28, "column": 25 } }, "callee": { "type": "Identifier", - "start": 845, - "end": 856, + "start": 897, + "end": 908, "loc": { "start": { - "line": 27, + "line": 28, "column": 11 }, "end": { - "line": 27, + "line": 28, "column": 22 }, "identifierName": "grandparent" @@ -1758,15 +1758,15 @@ "arguments": [ { "type": "Identifier", - "start": 857, - "end": 858, + "start": 909, + "end": 910, "loc": { "start": { - "line": 27, + "line": 28, "column": 23 }, "end": { - "line": 27, + "line": 28, "column": 24 }, "identifierName": "n" @@ -1782,15 +1782,15 @@ { "type": "CommentLine", "value": " Repaint n's parent black, n's grandparent red", - "start": 863, - "end": 911, + "start": 915, + "end": 963, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 30, "column": 49 } } @@ -1799,72 +1799,72 @@ }, { "type": "ExpressionStatement", - "start": 913, - "end": 937, + "start": 965, + "end": 989, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 913, - "end": 936, + "start": 965, + "end": 988, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 913, - "end": 928, + "start": 965, + "end": 980, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 16 } }, "object": { "type": "MemberExpression", - "start": 913, - "end": 921, + "start": 965, + "end": 973, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 9 } }, "object": { "type": "Identifier", - "start": 913, - "end": 914, + "start": 965, + "end": 966, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 2 }, "identifierName": "n" @@ -1874,15 +1874,15 @@ }, "property": { "type": "Identifier", - "start": 915, - "end": 921, + "start": 967, + "end": 973, "loc": { "start": { - "line": 30, + "line": 31, "column": 3 }, "end": { - "line": 30, + "line": 31, "column": 9 }, "identifierName": "parent" @@ -1894,15 +1894,15 @@ }, "property": { "type": "Identifier", - "start": 922, - "end": 928, + "start": 974, + "end": 980, "loc": { "start": { - "line": 30, + "line": 31, "column": 10 }, "end": { - "line": 30, + "line": 31, "column": 16 }, "identifierName": "_color" @@ -1914,15 +1914,15 @@ }, "right": { "type": "Identifier", - "start": 931, - "end": 936, + "start": 983, + "end": 988, "loc": { "start": { - "line": 30, + "line": 31, "column": 19 }, "end": { - "line": 30, + "line": 31, "column": 24 }, "identifierName": "BLACK" @@ -1935,15 +1935,15 @@ { "type": "CommentLine", "value": " Repaint n's parent black, n's grandparent red", - "start": 863, - "end": 911, + "start": 915, + "end": 963, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 30, "column": 49 } } @@ -1952,58 +1952,58 @@ }, { "type": "ExpressionStatement", - "start": 939, - "end": 954, + "start": 991, + "end": 1006, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 16 } }, "expression": { "type": "AssignmentExpression", - "start": 939, - "end": 953, + "start": 991, + "end": 1005, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 15 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 939, - "end": 947, + "start": 991, + "end": 999, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 9 } }, "object": { "type": "Identifier", - "start": 939, - "end": 940, + "start": 991, + "end": 992, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 2 }, "identifierName": "g" @@ -2012,15 +2012,15 @@ }, "property": { "type": "Identifier", - "start": 941, - "end": 947, + "start": 993, + "end": 999, "loc": { "start": { - "line": 31, + "line": 32, "column": 3 }, "end": { - "line": 31, + "line": 32, "column": 9 }, "identifierName": "_color" @@ -2031,15 +2031,15 @@ }, "right": { "type": "Identifier", - "start": 950, - "end": 953, + "start": 1002, + "end": 1005, "loc": { "start": { - "line": 31, + "line": 32, "column": 12 }, "end": { - "line": 31, + "line": 32, "column": 15 }, "identifierName": "RED" @@ -2050,43 +2050,43 @@ }, { "type": "IfStatement", - "start": 957, - "end": 2107, + "start": 1009, + "end": 2159, "loc": { "start": { - "line": 33, + "line": 34, "column": 1 }, "end": { - "line": 67, + "line": 68, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 961, - "end": 980, + "start": 1013, + "end": 1032, "loc": { "start": { - "line": 33, + "line": 34, "column": 5 }, "end": { - "line": 33, + "line": 34, "column": 24 } }, "left": { "type": "Identifier", - "start": 961, - "end": 962, + "start": 1013, + "end": 1014, "loc": { "start": { - "line": 33, + "line": 34, "column": 5 }, "end": { - "line": 33, + "line": 34, "column": 6 }, "identifierName": "n" @@ -2096,43 +2096,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 967, - "end": 980, + "start": 1019, + "end": 1032, "loc": { "start": { - "line": 33, + "line": 34, "column": 11 }, "end": { - "line": 33, + "line": 34, "column": 24 } }, "object": { "type": "MemberExpression", - "start": 967, - "end": 975, + "start": 1019, + "end": 1027, "loc": { "start": { - "line": 33, + "line": 34, "column": 11 }, "end": { - "line": 33, + "line": 34, "column": 19 } }, "object": { "type": "Identifier", - "start": 967, - "end": 968, + "start": 1019, + "end": 1020, "loc": { "start": { - "line": 33, + "line": 34, "column": 11 }, "end": { - "line": 33, + "line": 34, "column": 12 }, "identifierName": "n" @@ -2141,15 +2141,15 @@ }, "property": { "type": "Identifier", - "start": 969, - "end": 975, + "start": 1021, + "end": 1027, "loc": { "start": { - "line": 33, + "line": 34, "column": 13 }, "end": { - "line": 33, + "line": 34, "column": 19 }, "identifierName": "parent" @@ -2160,15 +2160,15 @@ }, "property": { "type": "Identifier", - "start": 976, - "end": 980, + "start": 1028, + "end": 1032, "loc": { "start": { - "line": 33, + "line": 34, "column": 20 }, "end": { - "line": 33, + "line": 34, "column": 24 }, "identifierName": "left" @@ -2180,58 +2180,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 982, - "end": 1553, + "start": 1034, + "end": 1605, "loc": { "start": { - "line": 33, + "line": 34, "column": 26 }, "end": { - "line": 50, + "line": 51, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1415, - "end": 1446, + "start": 1467, + "end": 1498, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 1415, - "end": 1445, + "start": 1467, + "end": 1497, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 32 } }, "callee": { "type": "Identifier", - "start": 1415, - "end": 1421, + "start": 1467, + "end": 1473, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 8 }, "identifierName": "assert" @@ -2242,43 +2242,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1422, - "end": 1444, + "start": 1474, + "end": 1496, "loc": { "start": { - "line": 46, + "line": 47, "column": 9 }, "end": { - "line": 46, + "line": 47, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 1422, - "end": 1428, + "start": 1474, + "end": 1480, "loc": { "start": { - "line": 46, + "line": 47, "column": 9 }, "end": { - "line": 46, + "line": 47, "column": 15 } }, "object": { "type": "Identifier", - "start": 1422, - "end": 1423, + "start": 1474, + "end": 1475, "loc": { "start": { - "line": 46, + "line": 47, "column": 9 }, "end": { - "line": 46, + "line": 47, "column": 10 }, "identifierName": "g" @@ -2287,15 +2287,15 @@ }, "property": { "type": "Identifier", - "start": 1424, - "end": 1428, + "start": 1476, + "end": 1480, "loc": { "start": { - "line": 46, + "line": 47, "column": 11 }, "end": { - "line": 46, + "line": 47, "column": 15 }, "identifierName": "left" @@ -2307,15 +2307,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1440, - "end": 1444, + "start": 1492, + "end": 1496, "loc": { "start": { - "line": 46, + "line": 47, "column": 27 }, "end": { - "line": 46, + "line": 47, "column": 31 }, "identifierName": "Node" @@ -2330,15 +2330,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 986, - "end": 1412, + "start": 1038, + "end": 1464, "loc": { "start": { - "line": 34, + "line": 35, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 5 } } @@ -2347,43 +2347,43 @@ }, { "type": "ExpressionStatement", - "start": 1449, - "end": 1475, + "start": 1501, + "end": 1527, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 1449, - "end": 1474, + "start": 1501, + "end": 1526, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 27 } }, "callee": { "type": "Identifier", - "start": 1449, - "end": 1455, + "start": 1501, + "end": 1507, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 8 }, "identifierName": "assert" @@ -2393,29 +2393,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1456, - "end": 1473, + "start": 1508, + "end": 1525, "loc": { "start": { - "line": 47, + "line": 48, "column": 9 }, "end": { - "line": 47, + "line": 48, "column": 26 } }, "left": { "type": "Identifier", - "start": 1456, - "end": 1457, + "start": 1508, + "end": 1509, "loc": { "start": { - "line": 47, + "line": 48, "column": 9 }, "end": { - "line": 47, + "line": 48, "column": 10 }, "identifierName": "n" @@ -2425,43 +2425,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 1462, - "end": 1473, + "start": 1514, + "end": 1525, "loc": { "start": { - "line": 47, + "line": 48, "column": 15 }, "end": { - "line": 47, + "line": 48, "column": 26 } }, "object": { "type": "MemberExpression", - "start": 1462, - "end": 1468, + "start": 1514, + "end": 1520, "loc": { "start": { - "line": 47, + "line": 48, "column": 15 }, "end": { - "line": 47, + "line": 48, "column": 21 } }, "object": { "type": "Identifier", - "start": 1462, - "end": 1463, + "start": 1514, + "end": 1515, "loc": { "start": { - "line": 47, + "line": 48, "column": 15 }, "end": { - "line": 47, + "line": 48, "column": 16 }, "identifierName": "g" @@ -2470,15 +2470,15 @@ }, "property": { "type": "Identifier", - "start": 1464, - "end": 1468, + "start": 1516, + "end": 1520, "loc": { "start": { - "line": 47, + "line": 48, "column": 17 }, "end": { - "line": 47, + "line": 48, "column": 21 }, "identifierName": "left" @@ -2489,15 +2489,15 @@ }, "property": { "type": "Identifier", - "start": 1469, - "end": 1473, + "start": 1521, + "end": 1525, "loc": { "start": { - "line": 47, + "line": 48, "column": 22 }, "end": { - "line": 47, + "line": 48, "column": 26 }, "identifierName": "left" @@ -2512,43 +2512,43 @@ }, { "type": "ExpressionStatement", - "start": 1478, - "end": 1531, + "start": 1530, + "end": 1583, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, + "line": 49, "column": 55 } }, "expression": { "type": "CallExpression", - "start": 1478, - "end": 1530, + "start": 1530, + "end": 1582, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, + "line": 49, "column": 54 } }, "callee": { "type": "Identifier", - "start": 1478, - "end": 1484, + "start": 1530, + "end": 1536, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, + "line": 49, "column": 8 }, "identifierName": "assert" @@ -2558,57 +2558,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 1485, - "end": 1529, + "start": 1537, + "end": 1581, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 53 } }, "left": { "type": "BinaryExpression", - "start": 1485, - "end": 1501, + "start": 1537, + "end": 1553, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 1485, - "end": 1492, + "start": 1537, + "end": 1544, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 16 } }, "object": { "type": "Identifier", - "start": 1485, - "end": 1486, + "start": 1537, + "end": 1538, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 10 }, "identifierName": "g" @@ -2617,15 +2617,15 @@ }, "property": { "type": "Identifier", - "start": 1487, - "end": 1492, + "start": 1539, + "end": 1544, "loc": { "start": { - "line": 48, + "line": 49, "column": 11 }, "end": { - "line": 48, + "line": 49, "column": 16 }, "identifierName": "right" @@ -2637,15 +2637,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1497, - "end": 1501, + "start": 1549, + "end": 1553, "loc": { "start": { - "line": 48, + "line": 49, "column": 21 }, "end": { - "line": 48, + "line": 49, "column": 25 } } @@ -2654,57 +2654,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 1505, - "end": 1529, + "start": 1557, + "end": 1581, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 53 } }, "left": { "type": "MemberExpression", - "start": 1505, - "end": 1519, + "start": 1557, + "end": 1571, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 43 } }, "object": { "type": "MemberExpression", - "start": 1505, - "end": 1512, + "start": 1557, + "end": 1564, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 36 } }, "object": { "type": "Identifier", - "start": 1505, - "end": 1506, + "start": 1557, + "end": 1558, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 30 }, "identifierName": "g" @@ -2713,15 +2713,15 @@ }, "property": { "type": "Identifier", - "start": 1507, - "end": 1512, + "start": 1559, + "end": 1564, "loc": { "start": { - "line": 48, + "line": 49, "column": 31 }, "end": { - "line": 48, + "line": 49, "column": 36 }, "identifierName": "right" @@ -2732,15 +2732,15 @@ }, "property": { "type": "Identifier", - "start": 1513, - "end": 1519, + "start": 1565, + "end": 1571, "loc": { "start": { - "line": 48, + "line": 49, "column": 37 }, "end": { - "line": 48, + "line": 49, "column": 43 }, "identifierName": "_color" @@ -2752,15 +2752,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1524, - "end": 1529, + "start": 1576, + "end": 1581, "loc": { "start": { - "line": 48, + "line": 49, "column": 48 }, "end": { - "line": 48, + "line": 49, "column": 53 }, "identifierName": "BLACK" @@ -2774,43 +2774,43 @@ }, { "type": "ExpressionStatement", - "start": 1534, - "end": 1550, + "start": 1586, + "end": 1602, "loc": { "start": { - "line": 49, + "line": 50, "column": 2 }, "end": { - "line": 49, + "line": 50, "column": 18 } }, "expression": { "type": "CallExpression", - "start": 1534, - "end": 1549, + "start": 1586, + "end": 1601, "loc": { "start": { - "line": 49, + "line": 50, "column": 2 }, "end": { - "line": 49, + "line": 50, "column": 17 } }, "callee": { "type": "Identifier", - "start": 1534, - "end": 1546, + "start": 1586, + "end": 1598, "loc": { "start": { - "line": 49, + "line": 50, "column": 2 }, "end": { - "line": 49, + "line": 50, "column": 14 }, "identifierName": "rotate_right" @@ -2820,15 +2820,15 @@ "arguments": [ { "type": "Identifier", - "start": 1547, - "end": 1548, + "start": 1599, + "end": 1600, "loc": { "start": { - "line": 49, + "line": 50, "column": 15 }, "end": { - "line": 49, + "line": 50, "column": 16 }, "identifierName": "g" @@ -2843,58 +2843,58 @@ }, "alternate": { "type": "BlockStatement", - "start": 1559, - "end": 2107, + "start": 1611, + "end": 2159, "loc": { "start": { - "line": 50, + "line": 51, "column": 8 }, "end": { - "line": 67, + "line": 68, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1969, - "end": 2001, + "start": 2021, + "end": 2053, "loc": { "start": { - "line": 63, + "line": 64, "column": 2 }, "end": { - "line": 63, + "line": 64, "column": 34 } }, "expression": { "type": "CallExpression", - "start": 1969, - "end": 2000, + "start": 2021, + "end": 2052, "loc": { "start": { - "line": 63, + "line": 64, "column": 2 }, "end": { - "line": 63, + "line": 64, "column": 33 } }, "callee": { "type": "Identifier", - "start": 1969, - "end": 1975, + "start": 2021, + "end": 2027, "loc": { "start": { - "line": 63, + "line": 64, "column": 2 }, "end": { - "line": 63, + "line": 64, "column": 8 }, "identifierName": "assert" @@ -2905,43 +2905,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1976, - "end": 1999, + "start": 2028, + "end": 2051, "loc": { "start": { - "line": 63, + "line": 64, "column": 9 }, "end": { - "line": 63, + "line": 64, "column": 32 } }, "left": { "type": "MemberExpression", - "start": 1976, - "end": 1983, + "start": 2028, + "end": 2035, "loc": { "start": { - "line": 63, + "line": 64, "column": 9 }, "end": { - "line": 63, + "line": 64, "column": 16 } }, "object": { "type": "Identifier", - "start": 1976, - "end": 1977, + "start": 2028, + "end": 2029, "loc": { "start": { - "line": 63, + "line": 64, "column": 9 }, "end": { - "line": 63, + "line": 64, "column": 10 }, "identifierName": "g" @@ -2950,15 +2950,15 @@ }, "property": { "type": "Identifier", - "start": 1978, - "end": 1983, + "start": 2030, + "end": 2035, "loc": { "start": { - "line": 63, + "line": 64, "column": 11 }, "end": { - "line": 63, + "line": 64, "column": 16 }, "identifierName": "right" @@ -2970,15 +2970,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1995, - "end": 1999, + "start": 2047, + "end": 2051, "loc": { "start": { - "line": 63, + "line": 64, "column": 28 }, "end": { - "line": 63, + "line": 64, "column": 32 }, "identifierName": "Node" @@ -2993,15 +2993,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 1563, - "end": 1966, + "start": 1615, + "end": 2018, "loc": { "start": { - "line": 51, + "line": 52, "column": 2 }, "end": { - "line": 62, + "line": 63, "column": 5 } } @@ -3010,43 +3010,43 @@ }, { "type": "ExpressionStatement", - "start": 2004, - "end": 2032, + "start": 2056, + "end": 2084, "loc": { "start": { - "line": 64, + "line": 65, "column": 2 }, "end": { - "line": 64, + "line": 65, "column": 30 } }, "expression": { "type": "CallExpression", - "start": 2004, - "end": 2031, + "start": 2056, + "end": 2083, "loc": { "start": { - "line": 64, + "line": 65, "column": 2 }, "end": { - "line": 64, + "line": 65, "column": 29 } }, "callee": { "type": "Identifier", - "start": 2004, - "end": 2010, + "start": 2056, + "end": 2062, "loc": { "start": { - "line": 64, + "line": 65, "column": 2 }, "end": { - "line": 64, + "line": 65, "column": 8 }, "identifierName": "assert" @@ -3056,29 +3056,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 2011, - "end": 2030, + "start": 2063, + "end": 2082, "loc": { "start": { - "line": 64, + "line": 65, "column": 9 }, "end": { - "line": 64, + "line": 65, "column": 28 } }, "left": { "type": "Identifier", - "start": 2011, - "end": 2012, + "start": 2063, + "end": 2064, "loc": { "start": { - "line": 64, + "line": 65, "column": 9 }, "end": { - "line": 64, + "line": 65, "column": 10 }, "identifierName": "n" @@ -3088,43 +3088,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 2017, - "end": 2030, + "start": 2069, + "end": 2082, "loc": { "start": { - "line": 64, + "line": 65, "column": 15 }, "end": { - "line": 64, + "line": 65, "column": 28 } }, "object": { "type": "MemberExpression", - "start": 2017, - "end": 2024, + "start": 2069, + "end": 2076, "loc": { "start": { - "line": 64, + "line": 65, "column": 15 }, "end": { - "line": 64, + "line": 65, "column": 22 } }, "object": { "type": "Identifier", - "start": 2017, - "end": 2018, + "start": 2069, + "end": 2070, "loc": { "start": { - "line": 64, + "line": 65, "column": 15 }, "end": { - "line": 64, + "line": 65, "column": 16 }, "identifierName": "g" @@ -3133,15 +3133,15 @@ }, "property": { "type": "Identifier", - "start": 2019, - "end": 2024, + "start": 2071, + "end": 2076, "loc": { "start": { - "line": 64, + "line": 65, "column": 17 }, "end": { - "line": 64, + "line": 65, "column": 22 }, "identifierName": "right" @@ -3152,15 +3152,15 @@ }, "property": { "type": "Identifier", - "start": 2025, - "end": 2030, + "start": 2077, + "end": 2082, "loc": { "start": { - "line": 64, + "line": 65, "column": 23 }, "end": { - "line": 64, + "line": 65, "column": 28 }, "identifierName": "right" @@ -3175,43 +3175,43 @@ }, { "type": "ExpressionStatement", - "start": 2035, - "end": 2086, + "start": 2087, + "end": 2138, "loc": { "start": { - "line": 65, + "line": 66, "column": 2 }, "end": { - "line": 65, + "line": 66, "column": 53 } }, "expression": { "type": "CallExpression", - "start": 2035, - "end": 2085, + "start": 2087, + "end": 2137, "loc": { "start": { - "line": 65, + "line": 66, "column": 2 }, "end": { - "line": 65, + "line": 66, "column": 52 } }, "callee": { "type": "Identifier", - "start": 2035, - "end": 2041, + "start": 2087, + "end": 2093, "loc": { "start": { - "line": 65, + "line": 66, "column": 2 }, "end": { - "line": 65, + "line": 66, "column": 8 }, "identifierName": "assert" @@ -3221,57 +3221,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 2042, - "end": 2084, + "start": 2094, + "end": 2136, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 51 } }, "left": { "type": "BinaryExpression", - "start": 2042, - "end": 2057, + "start": 2094, + "end": 2109, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 2042, - "end": 2048, + "start": 2094, + "end": 2100, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 15 } }, "object": { "type": "Identifier", - "start": 2042, - "end": 2043, + "start": 2094, + "end": 2095, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 10 }, "identifierName": "g" @@ -3280,15 +3280,15 @@ }, "property": { "type": "Identifier", - "start": 2044, - "end": 2048, + "start": 2096, + "end": 2100, "loc": { "start": { - "line": 65, + "line": 66, "column": 11 }, "end": { - "line": 65, + "line": 66, "column": 15 }, "identifierName": "left" @@ -3300,15 +3300,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 2053, - "end": 2057, + "start": 2105, + "end": 2109, "loc": { "start": { - "line": 65, + "line": 66, "column": 20 }, "end": { - "line": 65, + "line": 66, "column": 24 } } @@ -3317,57 +3317,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 2061, - "end": 2084, + "start": 2113, + "end": 2136, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 51 } }, "left": { "type": "MemberExpression", - "start": 2061, - "end": 2074, + "start": 2113, + "end": 2126, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 41 } }, "object": { "type": "MemberExpression", - "start": 2061, - "end": 2067, + "start": 2113, + "end": 2119, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 34 } }, "object": { "type": "Identifier", - "start": 2061, - "end": 2062, + "start": 2113, + "end": 2114, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 29 }, "identifierName": "g" @@ -3376,15 +3376,15 @@ }, "property": { "type": "Identifier", - "start": 2063, - "end": 2067, + "start": 2115, + "end": 2119, "loc": { "start": { - "line": 65, + "line": 66, "column": 30 }, "end": { - "line": 65, + "line": 66, "column": 34 }, "identifierName": "left" @@ -3395,15 +3395,15 @@ }, "property": { "type": "Identifier", - "start": 2068, - "end": 2074, + "start": 2120, + "end": 2126, "loc": { "start": { - "line": 65, + "line": 66, "column": 35 }, "end": { - "line": 65, + "line": 66, "column": 41 }, "identifierName": "_color" @@ -3415,15 +3415,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 2079, - "end": 2084, + "start": 2131, + "end": 2136, "loc": { "start": { - "line": 65, + "line": 66, "column": 46 }, "end": { - "line": 65, + "line": 66, "column": 51 }, "identifierName": "BLACK" @@ -3437,43 +3437,43 @@ }, { "type": "ExpressionStatement", - "start": 2089, - "end": 2104, + "start": 2141, + "end": 2156, "loc": { "start": { - "line": 66, + "line": 67, "column": 2 }, "end": { - "line": 66, + "line": 67, "column": 17 } }, "expression": { "type": "CallExpression", - "start": 2089, - "end": 2103, + "start": 2141, + "end": 2155, "loc": { "start": { - "line": 66, + "line": 67, "column": 2 }, "end": { - "line": 66, + "line": 67, "column": 16 } }, "callee": { "type": "Identifier", - "start": 2089, - "end": 2100, + "start": 2141, + "end": 2152, "loc": { "start": { - "line": 66, + "line": 67, "column": 2 }, "end": { - "line": 66, + "line": 67, "column": 13 }, "identifierName": "rotate_left" @@ -3483,15 +3483,15 @@ "arguments": [ { "type": "Identifier", - "start": 2101, - "end": 2102, + "start": 2153, + "end": 2154, "loc": { "start": { - "line": 66, + "line": 67, "column": 14 }, "end": { - "line": 66, + "line": 67, "column": 15 }, "identifierName": "g" @@ -3504,6 +3504,71 @@ ], "directives": [] } + }, + { + "type": "ReturnStatement", + "start": 2162, + "end": 2178, + "loc": { + "start": { + "line": 70, + "column": 1 + }, + "end": { + "line": 70, + "column": 17 + } + }, + "argument": { + "type": "MemberExpression", + "start": 2169, + "end": 2177, + "loc": { + "start": { + "line": 70, + "column": 8 + }, + "end": { + "line": 70, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 2169, + "end": 2170, + "loc": { + "start": { + "line": 70, + "column": 8 + }, + "end": { + "line": 70, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 2171, + "end": 2177, + "loc": { + "start": { + "line": 70, + "column": 10 + }, + "end": { + "line": 70, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } } ], "directives": [] @@ -3519,29 +3584,29 @@ }, { "type": "Identifier", - "start": 2112, - "end": 2140, + "start": 2183, + "end": 2211, "loc": { "start": { - "line": 70, + "line": 73, "column": 0 }, "end": { - "line": 70, + "line": 73, "column": 28 } }, "declaration": { "type": "Identifier", - "start": 2127, - "end": 2139, + "start": 2198, + "end": 2210, "loc": { "start": { - "line": 70, + "line": 73, "column": 15 }, "end": { - "line": 70, + "line": 73, "column": 27 }, "identifierName": "insert_case4" @@ -3554,58 +3619,58 @@ }, { "type": "ExportDefaultDeclaration", - "start": 2112, - "end": 2140, + "start": 2183, + "end": 2211, "loc": { "start": { - "line": 70, + "line": 73, "column": 0 }, "end": { - "line": 70, + "line": 73, "column": 28 } }, "declaration": { "type": "VariableDeclaration", - "start": 579, - "end": 2110, + "start": 631, + "end": 2181, "loc": { "start": { - "line": 20, + "line": 21, "column": 0 }, "end": { - "line": 68, + "line": 71, "column": 2 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 585, - "end": 2109, + "start": 637, + "end": 2180, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 68, + "line": 71, "column": 1 } }, "id": { "type": "Identifier", - "start": 585, - "end": 597, + "start": 637, + "end": 649, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 20, + "line": 21, "column": 18 }, "identifierName": "insert_case4" @@ -3615,29 +3680,29 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 600, - "end": 2109, + "start": 652, + "end": 2180, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 68, + "line": 71, "column": 1 } }, "id": { "type": "Identifier", - "start": 585, - "end": 597, + "start": 637, + "end": 649, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 20, + "line": 21, "column": 18 }, "identifierName": "insert_case4" @@ -3651,15 +3716,15 @@ "params": [ { "type": "Identifier", - "start": 601, - "end": 602, + "start": 653, + "end": 654, "loc": { "start": { - "line": 20, + "line": 21, "column": 22 }, "end": { - "line": 20, + "line": 21, "column": 23 }, "identifierName": "n" @@ -3669,58 +3734,58 @@ ], "body": { "type": "BlockStatement", - "start": 607, - "end": 2109, + "start": 659, + "end": 2180, "loc": { "start": { - "line": 20, + "line": 21, "column": 28 }, "end": { - "line": 68, + "line": 71, "column": 1 } }, "body": [ { "type": "ExpressionStatement", - "start": 610, - "end": 636, + "start": 662, + "end": 688, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 610, - "end": 635, + "start": 662, + "end": 687, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 26 } }, "callee": { "type": "Identifier", - "start": 610, - "end": 616, + "start": 662, + "end": 668, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 }, "identifierName": "assert" @@ -3730,29 +3795,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 617, - "end": 634, + "start": 669, + "end": 686, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 25 } }, "left": { "type": "Identifier", - "start": 617, - "end": 618, + "start": 669, + "end": 670, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 }, "identifierName": "n" @@ -3762,15 +3827,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 630, - "end": 634, + "start": 682, + "end": 686, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 25 }, "identifierName": "Node" @@ -3783,43 +3848,43 @@ }, { "type": "ExpressionStatement", - "start": 638, - "end": 663, + "start": 690, + "end": 715, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "expression": { "type": "CallExpression", - "start": 638, - "end": 662, + "start": 690, + "end": 714, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "callee": { "type": "Identifier", - "start": 638, - "end": 644, + "start": 690, + "end": 696, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -3829,43 +3894,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 645, - "end": 661, + "start": 697, + "end": 713, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 645, - "end": 653, + "start": 697, + "end": 705, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 16 } }, "object": { "type": "Identifier", - "start": 645, - "end": 646, + "start": 697, + "end": 698, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "n" @@ -3874,15 +3939,15 @@ }, "property": { "type": "Identifier", - "start": 647, - "end": 653, + "start": 699, + "end": 705, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 16 }, "identifierName": "_color" @@ -3894,15 +3959,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 658, - "end": 661, + "start": 710, + "end": 713, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 24 }, "identifierName": "RED" @@ -3915,43 +3980,43 @@ }, { "type": "ExpressionStatement", - "start": 665, - "end": 716, + "start": 717, + "end": 768, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 52 } }, "expression": { "type": "CallExpression", - "start": 665, - "end": 715, + "start": 717, + "end": 767, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 51 } }, "callee": { "type": "Identifier", - "start": 665, - "end": 671, + "start": 717, + "end": 723, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 }, "identifierName": "assert" @@ -3961,57 +4026,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 672, - "end": 714, + "start": 724, + "end": 766, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 50 } }, "left": { "type": "BinaryExpression", - "start": 672, - "end": 687, + "start": 724, + "end": 739, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 23 } }, "left": { "type": "MemberExpression", - "start": 672, - "end": 678, + "start": 724, + "end": 730, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 14 } }, "object": { "type": "Identifier", - "start": 672, - "end": 673, + "start": 724, + "end": 725, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 }, "identifierName": "n" @@ -4020,15 +4085,15 @@ }, "property": { "type": "Identifier", - "start": 674, - "end": 678, + "start": 726, + "end": 730, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 14 }, "identifierName": "left" @@ -4040,15 +4105,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 683, - "end": 687, + "start": 735, + "end": 739, "loc": { "start": { - "line": 23, + "line": 24, "column": 19 }, "end": { - "line": 23, + "line": 24, "column": 23 } } @@ -4057,57 +4122,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 691, - "end": 714, + "start": 743, + "end": 766, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 50 } }, "left": { "type": "MemberExpression", - "start": 691, - "end": 704, + "start": 743, + "end": 756, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 40 } }, "object": { "type": "MemberExpression", - "start": 691, - "end": 697, + "start": 743, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 33 } }, "object": { "type": "Identifier", - "start": 691, - "end": 692, + "start": 743, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 28 }, "identifierName": "n" @@ -4116,15 +4181,15 @@ }, "property": { "type": "Identifier", - "start": 693, - "end": 697, + "start": 745, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 29 }, "end": { - "line": 23, + "line": 24, "column": 33 }, "identifierName": "left" @@ -4135,15 +4200,15 @@ }, "property": { "type": "Identifier", - "start": 698, - "end": 704, + "start": 750, + "end": 756, "loc": { "start": { - "line": 23, + "line": 24, "column": 34 }, "end": { - "line": 23, + "line": 24, "column": 40 }, "identifierName": "_color" @@ -4155,15 +4220,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 709, - "end": 714, + "start": 761, + "end": 766, "loc": { "start": { - "line": 23, + "line": 24, "column": 45 }, "end": { - "line": 23, + "line": 24, "column": 50 }, "identifierName": "BLACK" @@ -4177,43 +4242,43 @@ }, { "type": "ExpressionStatement", - "start": 718, - "end": 771, + "start": 770, + "end": 823, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 54 } }, "expression": { "type": "CallExpression", - "start": 718, - "end": 770, + "start": 770, + "end": 822, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 53 } }, "callee": { "type": "Identifier", - "start": 718, - "end": 724, + "start": 770, + "end": 776, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 }, "identifierName": "assert" @@ -4223,57 +4288,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 725, - "end": 769, + "start": 777, + "end": 821, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 52 } }, "left": { "type": "BinaryExpression", - "start": 725, - "end": 741, + "start": 777, + "end": 793, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 725, - "end": 732, + "start": 777, + "end": 784, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 15 } }, "object": { "type": "Identifier", - "start": 725, - "end": 726, + "start": 777, + "end": 778, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 }, "identifierName": "n" @@ -4282,15 +4347,15 @@ }, "property": { "type": "Identifier", - "start": 727, - "end": 732, + "start": 779, + "end": 784, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 15 }, "identifierName": "right" @@ -4302,15 +4367,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 737, - "end": 741, + "start": 789, + "end": 793, "loc": { "start": { - "line": 24, + "line": 25, "column": 20 }, "end": { - "line": 24, + "line": 25, "column": 24 } } @@ -4319,57 +4384,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 745, - "end": 769, + "start": 797, + "end": 821, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 52 } }, "left": { "type": "MemberExpression", - "start": 745, - "end": 759, + "start": 797, + "end": 811, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 42 } }, "object": { "type": "MemberExpression", - "start": 745, - "end": 752, + "start": 797, + "end": 804, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 35 } }, "object": { "type": "Identifier", - "start": 745, - "end": 746, + "start": 797, + "end": 798, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 29 }, "identifierName": "n" @@ -4378,15 +4443,15 @@ }, "property": { "type": "Identifier", - "start": 747, - "end": 752, + "start": 799, + "end": 804, "loc": { "start": { - "line": 24, + "line": 25, "column": 30 }, "end": { - "line": 24, + "line": 25, "column": 35 }, "identifierName": "right" @@ -4397,15 +4462,15 @@ }, "property": { "type": "Identifier", - "start": 753, - "end": 759, + "start": 805, + "end": 811, "loc": { "start": { - "line": 24, + "line": 25, "column": 36 }, "end": { - "line": 24, + "line": 25, "column": 42 }, "identifierName": "_color" @@ -4417,15 +4482,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 764, - "end": 769, + "start": 816, + "end": 821, "loc": { "start": { - "line": 24, + "line": 25, "column": 47 }, "end": { - "line": 24, + "line": 25, "column": 52 }, "identifierName": "BLACK" @@ -4439,43 +4504,43 @@ }, { "type": "ExpressionStatement", - "start": 773, - "end": 799, + "start": 825, + "end": 851, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 773, - "end": 798, + "start": 825, + "end": 850, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 26 } }, "callee": { "type": "Identifier", - "start": 773, - "end": 779, + "start": 825, + "end": 831, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 }, "identifierName": "assert" @@ -4485,43 +4550,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 780, - "end": 797, + "start": 832, + "end": 849, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 780, - "end": 788, + "start": 832, + "end": 840, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 16 } }, "object": { "type": "Identifier", - "start": 780, - "end": 781, + "start": 832, + "end": 833, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 }, "identifierName": "n" @@ -4530,15 +4595,15 @@ }, "property": { "type": "Identifier", - "start": 782, - "end": 788, + "start": 834, + "end": 840, "loc": { "start": { - "line": 25, + "line": 26, "column": 10 }, "end": { - "line": 25, + "line": 26, "column": 16 }, "identifierName": "parent" @@ -4550,15 +4615,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 793, - "end": 797, + "start": 845, + "end": 849, "loc": { "start": { - "line": 25, + "line": 26, "column": 21 }, "end": { - "line": 25, + "line": 26, "column": 25 } } @@ -4569,43 +4634,43 @@ }, { "type": "ExpressionStatement", - "start": 801, - "end": 833, + "start": 853, + "end": 885, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 801, - "end": 832, + "start": 853, + "end": 884, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 32 } }, "callee": { "type": "Identifier", - "start": 801, - "end": 807, + "start": 853, + "end": 859, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 }, "identifierName": "assert" @@ -4615,57 +4680,57 @@ "arguments": [ { "type": "BinaryExpression", - "start": 808, - "end": 831, + "start": 860, + "end": 883, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 808, - "end": 823, + "start": 860, + "end": 875, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 23 } }, "object": { "type": "MemberExpression", - "start": 808, - "end": 816, + "start": 860, + "end": 868, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 16 } }, "object": { "type": "Identifier", - "start": 808, - "end": 809, + "start": 860, + "end": 861, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 }, "identifierName": "n" @@ -4674,15 +4739,15 @@ }, "property": { "type": "Identifier", - "start": 810, - "end": 816, + "start": 862, + "end": 868, "loc": { "start": { - "line": 26, + "line": 27, "column": 10 }, "end": { - "line": 26, + "line": 27, "column": 16 }, "identifierName": "parent" @@ -4693,15 +4758,15 @@ }, "property": { "type": "Identifier", - "start": 817, - "end": 823, + "start": 869, + "end": 875, "loc": { "start": { - "line": 26, + "line": 27, "column": 17 }, "end": { - "line": 26, + "line": 27, "column": 23 }, "identifierName": "_color" @@ -4713,15 +4778,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 828, - "end": 831, + "start": 880, + "end": 883, "loc": { "start": { - "line": 26, + "line": 27, "column": 28 }, "end": { - "line": 26, + "line": 27, "column": 31 }, "identifierName": "RED" @@ -4734,44 +4799,44 @@ }, { "type": "VariableDeclaration", - "start": 835, - "end": 860, + "start": 887, + "end": 912, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 26 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 841, - "end": 859, + "start": 893, + "end": 911, "loc": { "start": { - "line": 27, + "line": 28, "column": 7 }, "end": { - "line": 27, + "line": 28, "column": 25 } }, "id": { "type": "Identifier", - "start": 841, - "end": 842, + "start": 893, + "end": 894, "loc": { "start": { - "line": 27, + "line": 28, "column": 7 }, "end": { - "line": 27, + "line": 28, "column": 8 }, "identifierName": "g" @@ -4780,29 +4845,29 @@ }, "init": { "type": "CallExpression", - "start": 845, - "end": 859, + "start": 897, + "end": 911, "loc": { "start": { - "line": 27, + "line": 28, "column": 11 }, "end": { - "line": 27, + "line": 28, "column": 25 } }, "callee": { "type": "Identifier", - "start": 845, - "end": 856, + "start": 897, + "end": 908, "loc": { "start": { - "line": 27, + "line": 28, "column": 11 }, "end": { - "line": 27, + "line": 28, "column": 22 }, "identifierName": "grandparent" @@ -4812,15 +4877,15 @@ "arguments": [ { "type": "Identifier", - "start": 857, - "end": 858, + "start": 909, + "end": 910, "loc": { "start": { - "line": 27, + "line": 28, "column": 23 }, "end": { - "line": 27, + "line": 28, "column": 24 }, "identifierName": "n" @@ -4836,15 +4901,15 @@ { "type": "CommentLine", "value": " Repaint n's parent black, n's grandparent red", - "start": 863, - "end": 911, + "start": 915, + "end": 963, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 30, "column": 49 } } @@ -4853,72 +4918,72 @@ }, { "type": "ExpressionStatement", - "start": 913, - "end": 937, + "start": 965, + "end": 989, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 913, - "end": 936, + "start": 965, + "end": 988, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 913, - "end": 928, + "start": 965, + "end": 980, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 16 } }, "object": { "type": "MemberExpression", - "start": 913, - "end": 921, + "start": 965, + "end": 973, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 9 } }, "object": { "type": "Identifier", - "start": 913, - "end": 914, + "start": 965, + "end": 966, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 2 }, "identifierName": "n" @@ -4928,15 +4993,15 @@ }, "property": { "type": "Identifier", - "start": 915, - "end": 921, + "start": 967, + "end": 973, "loc": { "start": { - "line": 30, + "line": 31, "column": 3 }, "end": { - "line": 30, + "line": 31, "column": 9 }, "identifierName": "parent" @@ -4948,15 +5013,15 @@ }, "property": { "type": "Identifier", - "start": 922, - "end": 928, + "start": 974, + "end": 980, "loc": { "start": { - "line": 30, + "line": 31, "column": 10 }, "end": { - "line": 30, + "line": 31, "column": 16 }, "identifierName": "_color" @@ -4968,15 +5033,15 @@ }, "right": { "type": "Identifier", - "start": 931, - "end": 936, + "start": 983, + "end": 988, "loc": { "start": { - "line": 30, + "line": 31, "column": 19 }, "end": { - "line": 30, + "line": 31, "column": 24 }, "identifierName": "BLACK" @@ -4989,15 +5054,15 @@ { "type": "CommentLine", "value": " Repaint n's parent black, n's grandparent red", - "start": 863, - "end": 911, + "start": 915, + "end": 963, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 30, "column": 49 } } @@ -5006,58 +5071,58 @@ }, { "type": "ExpressionStatement", - "start": 939, - "end": 954, + "start": 991, + "end": 1006, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 16 } }, "expression": { "type": "AssignmentExpression", - "start": 939, - "end": 953, + "start": 991, + "end": 1005, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 15 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 939, - "end": 947, + "start": 991, + "end": 999, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 9 } }, "object": { "type": "Identifier", - "start": 939, - "end": 940, + "start": 991, + "end": 992, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 2 }, "identifierName": "g" @@ -5066,15 +5131,15 @@ }, "property": { "type": "Identifier", - "start": 941, - "end": 947, + "start": 993, + "end": 999, "loc": { "start": { - "line": 31, + "line": 32, "column": 3 }, "end": { - "line": 31, + "line": 32, "column": 9 }, "identifierName": "_color" @@ -5085,15 +5150,15 @@ }, "right": { "type": "Identifier", - "start": 950, - "end": 953, + "start": 1002, + "end": 1005, "loc": { "start": { - "line": 31, + "line": 32, "column": 12 }, "end": { - "line": 31, + "line": 32, "column": 15 }, "identifierName": "RED" @@ -5104,43 +5169,43 @@ }, { "type": "IfStatement", - "start": 957, - "end": 2107, + "start": 1009, + "end": 2159, "loc": { "start": { - "line": 33, + "line": 34, "column": 1 }, "end": { - "line": 67, + "line": 68, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 961, - "end": 980, + "start": 1013, + "end": 1032, "loc": { "start": { - "line": 33, + "line": 34, "column": 5 }, "end": { - "line": 33, + "line": 34, "column": 24 } }, "left": { "type": "Identifier", - "start": 961, - "end": 962, + "start": 1013, + "end": 1014, "loc": { "start": { - "line": 33, + "line": 34, "column": 5 }, "end": { - "line": 33, + "line": 34, "column": 6 }, "identifierName": "n" @@ -5150,43 +5215,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 967, - "end": 980, + "start": 1019, + "end": 1032, "loc": { "start": { - "line": 33, + "line": 34, "column": 11 }, "end": { - "line": 33, + "line": 34, "column": 24 } }, "object": { "type": "MemberExpression", - "start": 967, - "end": 975, + "start": 1019, + "end": 1027, "loc": { "start": { - "line": 33, + "line": 34, "column": 11 }, "end": { - "line": 33, + "line": 34, "column": 19 } }, "object": { "type": "Identifier", - "start": 967, - "end": 968, + "start": 1019, + "end": 1020, "loc": { "start": { - "line": 33, + "line": 34, "column": 11 }, "end": { - "line": 33, + "line": 34, "column": 12 }, "identifierName": "n" @@ -5195,15 +5260,15 @@ }, "property": { "type": "Identifier", - "start": 969, - "end": 975, + "start": 1021, + "end": 1027, "loc": { "start": { - "line": 33, + "line": 34, "column": 13 }, "end": { - "line": 33, + "line": 34, "column": 19 }, "identifierName": "parent" @@ -5214,15 +5279,15 @@ }, "property": { "type": "Identifier", - "start": 976, - "end": 980, + "start": 1028, + "end": 1032, "loc": { "start": { - "line": 33, + "line": 34, "column": 20 }, "end": { - "line": 33, + "line": 34, "column": 24 }, "identifierName": "left" @@ -5234,58 +5299,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 982, - "end": 1553, + "start": 1034, + "end": 1605, "loc": { "start": { - "line": 33, + "line": 34, "column": 26 }, "end": { - "line": 50, + "line": 51, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1415, - "end": 1446, + "start": 1467, + "end": 1498, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 33 } }, "expression": { "type": "CallExpression", - "start": 1415, - "end": 1445, + "start": 1467, + "end": 1497, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 32 } }, "callee": { "type": "Identifier", - "start": 1415, - "end": 1421, + "start": 1467, + "end": 1473, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 8 }, "identifierName": "assert" @@ -5296,43 +5361,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1422, - "end": 1444, + "start": 1474, + "end": 1496, "loc": { "start": { - "line": 46, + "line": 47, "column": 9 }, "end": { - "line": 46, + "line": 47, "column": 31 } }, "left": { "type": "MemberExpression", - "start": 1422, - "end": 1428, + "start": 1474, + "end": 1480, "loc": { "start": { - "line": 46, + "line": 47, "column": 9 }, "end": { - "line": 46, + "line": 47, "column": 15 } }, "object": { "type": "Identifier", - "start": 1422, - "end": 1423, + "start": 1474, + "end": 1475, "loc": { "start": { - "line": 46, + "line": 47, "column": 9 }, "end": { - "line": 46, + "line": 47, "column": 10 }, "identifierName": "g" @@ -5341,15 +5406,15 @@ }, "property": { "type": "Identifier", - "start": 1424, - "end": 1428, + "start": 1476, + "end": 1480, "loc": { "start": { - "line": 46, + "line": 47, "column": 11 }, "end": { - "line": 46, + "line": 47, "column": 15 }, "identifierName": "left" @@ -5361,15 +5426,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1440, - "end": 1444, + "start": 1492, + "end": 1496, "loc": { "start": { - "line": 46, + "line": 47, "column": 27 }, "end": { - "line": 46, + "line": 47, "column": 31 }, "identifierName": "Node" @@ -5384,15 +5449,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 986, - "end": 1412, + "start": 1038, + "end": 1464, "loc": { "start": { - "line": 34, + "line": 35, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 5 } } @@ -5401,43 +5466,43 @@ }, { "type": "ExpressionStatement", - "start": 1449, - "end": 1475, + "start": 1501, + "end": 1527, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 28 } }, "expression": { "type": "CallExpression", - "start": 1449, - "end": 1474, + "start": 1501, + "end": 1526, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 27 } }, "callee": { "type": "Identifier", - "start": 1449, - "end": 1455, + "start": 1501, + "end": 1507, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 8 }, "identifierName": "assert" @@ -5447,29 +5512,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1456, - "end": 1473, + "start": 1508, + "end": 1525, "loc": { "start": { - "line": 47, + "line": 48, "column": 9 }, "end": { - "line": 47, + "line": 48, "column": 26 } }, "left": { "type": "Identifier", - "start": 1456, - "end": 1457, + "start": 1508, + "end": 1509, "loc": { "start": { - "line": 47, + "line": 48, "column": 9 }, "end": { - "line": 47, + "line": 48, "column": 10 }, "identifierName": "n" @@ -5479,43 +5544,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 1462, - "end": 1473, + "start": 1514, + "end": 1525, "loc": { "start": { - "line": 47, + "line": 48, "column": 15 }, "end": { - "line": 47, + "line": 48, "column": 26 } }, "object": { "type": "MemberExpression", - "start": 1462, - "end": 1468, + "start": 1514, + "end": 1520, "loc": { "start": { - "line": 47, + "line": 48, "column": 15 }, "end": { - "line": 47, + "line": 48, "column": 21 } }, "object": { "type": "Identifier", - "start": 1462, - "end": 1463, + "start": 1514, + "end": 1515, "loc": { "start": { - "line": 47, + "line": 48, "column": 15 }, "end": { - "line": 47, + "line": 48, "column": 16 }, "identifierName": "g" @@ -5524,15 +5589,15 @@ }, "property": { "type": "Identifier", - "start": 1464, - "end": 1468, + "start": 1516, + "end": 1520, "loc": { "start": { - "line": 47, + "line": 48, "column": 17 }, "end": { - "line": 47, + "line": 48, "column": 21 }, "identifierName": "left" @@ -5543,15 +5608,15 @@ }, "property": { "type": "Identifier", - "start": 1469, - "end": 1473, + "start": 1521, + "end": 1525, "loc": { "start": { - "line": 47, + "line": 48, "column": 22 }, "end": { - "line": 47, + "line": 48, "column": 26 }, "identifierName": "left" @@ -5566,43 +5631,43 @@ }, { "type": "ExpressionStatement", - "start": 1478, - "end": 1531, + "start": 1530, + "end": 1583, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, + "line": 49, "column": 55 } }, "expression": { "type": "CallExpression", - "start": 1478, - "end": 1530, + "start": 1530, + "end": 1582, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, + "line": 49, "column": 54 } }, "callee": { "type": "Identifier", - "start": 1478, - "end": 1484, + "start": 1530, + "end": 1536, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, + "line": 49, "column": 8 }, "identifierName": "assert" @@ -5612,57 +5677,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 1485, - "end": 1529, + "start": 1537, + "end": 1581, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 53 } }, "left": { "type": "BinaryExpression", - "start": 1485, - "end": 1501, + "start": 1537, + "end": 1553, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 1485, - "end": 1492, + "start": 1537, + "end": 1544, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 16 } }, "object": { "type": "Identifier", - "start": 1485, - "end": 1486, + "start": 1537, + "end": 1538, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 10 }, "identifierName": "g" @@ -5671,15 +5736,15 @@ }, "property": { "type": "Identifier", - "start": 1487, - "end": 1492, + "start": 1539, + "end": 1544, "loc": { "start": { - "line": 48, + "line": 49, "column": 11 }, "end": { - "line": 48, + "line": 49, "column": 16 }, "identifierName": "right" @@ -5691,15 +5756,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1497, - "end": 1501, + "start": 1549, + "end": 1553, "loc": { "start": { - "line": 48, + "line": 49, "column": 21 }, "end": { - "line": 48, + "line": 49, "column": 25 } } @@ -5708,57 +5773,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 1505, - "end": 1529, + "start": 1557, + "end": 1581, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 53 } }, "left": { "type": "MemberExpression", - "start": 1505, - "end": 1519, + "start": 1557, + "end": 1571, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 43 } }, "object": { "type": "MemberExpression", - "start": 1505, - "end": 1512, + "start": 1557, + "end": 1564, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 36 } }, "object": { "type": "Identifier", - "start": 1505, - "end": 1506, + "start": 1557, + "end": 1558, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 30 }, "identifierName": "g" @@ -5767,15 +5832,15 @@ }, "property": { "type": "Identifier", - "start": 1507, - "end": 1512, + "start": 1559, + "end": 1564, "loc": { "start": { - "line": 48, + "line": 49, "column": 31 }, "end": { - "line": 48, + "line": 49, "column": 36 }, "identifierName": "right" @@ -5786,15 +5851,15 @@ }, "property": { "type": "Identifier", - "start": 1513, - "end": 1519, + "start": 1565, + "end": 1571, "loc": { "start": { - "line": 48, + "line": 49, "column": 37 }, "end": { - "line": 48, + "line": 49, "column": 43 }, "identifierName": "_color" @@ -5806,15 +5871,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 1524, - "end": 1529, + "start": 1576, + "end": 1581, "loc": { "start": { - "line": 48, + "line": 49, "column": 48 }, "end": { - "line": 48, + "line": 49, "column": 53 }, "identifierName": "BLACK" @@ -5828,43 +5893,43 @@ }, { "type": "ExpressionStatement", - "start": 1534, - "end": 1550, + "start": 1586, + "end": 1602, "loc": { "start": { - "line": 49, + "line": 50, "column": 2 }, "end": { - "line": 49, + "line": 50, "column": 18 } }, "expression": { "type": "CallExpression", - "start": 1534, - "end": 1549, + "start": 1586, + "end": 1601, "loc": { "start": { - "line": 49, + "line": 50, "column": 2 }, "end": { - "line": 49, + "line": 50, "column": 17 } }, "callee": { "type": "Identifier", - "start": 1534, - "end": 1546, + "start": 1586, + "end": 1598, "loc": { "start": { - "line": 49, + "line": 50, "column": 2 }, "end": { - "line": 49, + "line": 50, "column": 14 }, "identifierName": "rotate_right" @@ -5874,15 +5939,15 @@ "arguments": [ { "type": "Identifier", - "start": 1547, - "end": 1548, + "start": 1599, + "end": 1600, "loc": { "start": { - "line": 49, + "line": 50, "column": 15 }, "end": { - "line": 49, + "line": 50, "column": 16 }, "identifierName": "g" @@ -5897,58 +5962,58 @@ }, "alternate": { "type": "BlockStatement", - "start": 1559, - "end": 2107, + "start": 1611, + "end": 2159, "loc": { "start": { - "line": 50, + "line": 51, "column": 8 }, "end": { - "line": 67, + "line": 68, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 1969, - "end": 2001, + "start": 2021, + "end": 2053, "loc": { "start": { - "line": 63, + "line": 64, "column": 2 }, "end": { - "line": 63, + "line": 64, "column": 34 } }, "expression": { "type": "CallExpression", - "start": 1969, - "end": 2000, + "start": 2021, + "end": 2052, "loc": { "start": { - "line": 63, + "line": 64, "column": 2 }, "end": { - "line": 63, + "line": 64, "column": 33 } }, "callee": { "type": "Identifier", - "start": 1969, - "end": 1975, + "start": 2021, + "end": 2027, "loc": { "start": { - "line": 63, + "line": 64, "column": 2 }, "end": { - "line": 63, + "line": 64, "column": 8 }, "identifierName": "assert" @@ -5959,43 +6024,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1976, - "end": 1999, + "start": 2028, + "end": 2051, "loc": { "start": { - "line": 63, + "line": 64, "column": 9 }, "end": { - "line": 63, + "line": 64, "column": 32 } }, "left": { "type": "MemberExpression", - "start": 1976, - "end": 1983, + "start": 2028, + "end": 2035, "loc": { "start": { - "line": 63, + "line": 64, "column": 9 }, "end": { - "line": 63, + "line": 64, "column": 16 } }, "object": { "type": "Identifier", - "start": 1976, - "end": 1977, + "start": 2028, + "end": 2029, "loc": { "start": { - "line": 63, + "line": 64, "column": 9 }, "end": { - "line": 63, + "line": 64, "column": 10 }, "identifierName": "g" @@ -6004,15 +6069,15 @@ }, "property": { "type": "Identifier", - "start": 1978, - "end": 1983, + "start": 2030, + "end": 2035, "loc": { "start": { - "line": 63, + "line": 64, "column": 11 }, "end": { - "line": 63, + "line": 64, "column": 16 }, "identifierName": "right" @@ -6024,15 +6089,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1995, - "end": 1999, + "start": 2047, + "end": 2051, "loc": { "start": { - "line": 63, + "line": 64, "column": 28 }, "end": { - "line": 63, + "line": 64, "column": 32 }, "identifierName": "Node" @@ -6047,15 +6112,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 1563, - "end": 1966, + "start": 1615, + "end": 2018, "loc": { "start": { - "line": 51, + "line": 52, "column": 2 }, "end": { - "line": 62, + "line": 63, "column": 5 } } @@ -6064,43 +6129,43 @@ }, { "type": "ExpressionStatement", - "start": 2004, - "end": 2032, + "start": 2056, + "end": 2084, "loc": { "start": { - "line": 64, + "line": 65, "column": 2 }, "end": { - "line": 64, + "line": 65, "column": 30 } }, "expression": { "type": "CallExpression", - "start": 2004, - "end": 2031, + "start": 2056, + "end": 2083, "loc": { "start": { - "line": 64, + "line": 65, "column": 2 }, "end": { - "line": 64, + "line": 65, "column": 29 } }, "callee": { "type": "Identifier", - "start": 2004, - "end": 2010, + "start": 2056, + "end": 2062, "loc": { "start": { - "line": 64, + "line": 65, "column": 2 }, "end": { - "line": 64, + "line": 65, "column": 8 }, "identifierName": "assert" @@ -6110,29 +6175,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 2011, - "end": 2030, + "start": 2063, + "end": 2082, "loc": { "start": { - "line": 64, + "line": 65, "column": 9 }, "end": { - "line": 64, + "line": 65, "column": 28 } }, "left": { "type": "Identifier", - "start": 2011, - "end": 2012, + "start": 2063, + "end": 2064, "loc": { "start": { - "line": 64, + "line": 65, "column": 9 }, "end": { - "line": 64, + "line": 65, "column": 10 }, "identifierName": "n" @@ -6142,43 +6207,43 @@ "operator": "===", "right": { "type": "MemberExpression", - "start": 2017, - "end": 2030, + "start": 2069, + "end": 2082, "loc": { "start": { - "line": 64, + "line": 65, "column": 15 }, "end": { - "line": 64, + "line": 65, "column": 28 } }, "object": { "type": "MemberExpression", - "start": 2017, - "end": 2024, + "start": 2069, + "end": 2076, "loc": { "start": { - "line": 64, + "line": 65, "column": 15 }, "end": { - "line": 64, + "line": 65, "column": 22 } }, "object": { "type": "Identifier", - "start": 2017, - "end": 2018, + "start": 2069, + "end": 2070, "loc": { "start": { - "line": 64, + "line": 65, "column": 15 }, "end": { - "line": 64, + "line": 65, "column": 16 }, "identifierName": "g" @@ -6187,15 +6252,15 @@ }, "property": { "type": "Identifier", - "start": 2019, - "end": 2024, + "start": 2071, + "end": 2076, "loc": { "start": { - "line": 64, + "line": 65, "column": 17 }, "end": { - "line": 64, + "line": 65, "column": 22 }, "identifierName": "right" @@ -6206,15 +6271,15 @@ }, "property": { "type": "Identifier", - "start": 2025, - "end": 2030, + "start": 2077, + "end": 2082, "loc": { "start": { - "line": 64, + "line": 65, "column": 23 }, "end": { - "line": 64, + "line": 65, "column": 28 }, "identifierName": "right" @@ -6229,43 +6294,43 @@ }, { "type": "ExpressionStatement", - "start": 2035, - "end": 2086, + "start": 2087, + "end": 2138, "loc": { "start": { - "line": 65, + "line": 66, "column": 2 }, "end": { - "line": 65, + "line": 66, "column": 53 } }, "expression": { "type": "CallExpression", - "start": 2035, - "end": 2085, + "start": 2087, + "end": 2137, "loc": { "start": { - "line": 65, + "line": 66, "column": 2 }, "end": { - "line": 65, + "line": 66, "column": 52 } }, "callee": { "type": "Identifier", - "start": 2035, - "end": 2041, + "start": 2087, + "end": 2093, "loc": { "start": { - "line": 65, + "line": 66, "column": 2 }, "end": { - "line": 65, + "line": 66, "column": 8 }, "identifierName": "assert" @@ -6275,57 +6340,57 @@ "arguments": [ { "type": "LogicalExpression", - "start": 2042, - "end": 2084, + "start": 2094, + "end": 2136, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 51 } }, "left": { "type": "BinaryExpression", - "start": 2042, - "end": 2057, + "start": 2094, + "end": 2109, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 2042, - "end": 2048, + "start": 2094, + "end": 2100, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 15 } }, "object": { "type": "Identifier", - "start": 2042, - "end": 2043, + "start": 2094, + "end": 2095, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 10 }, "identifierName": "g" @@ -6334,15 +6399,15 @@ }, "property": { "type": "Identifier", - "start": 2044, - "end": 2048, + "start": 2096, + "end": 2100, "loc": { "start": { - "line": 65, + "line": 66, "column": 11 }, "end": { - "line": 65, + "line": 66, "column": 15 }, "identifierName": "left" @@ -6354,15 +6419,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 2053, - "end": 2057, + "start": 2105, + "end": 2109, "loc": { "start": { - "line": 65, + "line": 66, "column": 20 }, "end": { - "line": 65, + "line": 66, "column": 24 } } @@ -6371,57 +6436,57 @@ "operator": "||", "right": { "type": "BinaryExpression", - "start": 2061, - "end": 2084, + "start": 2113, + "end": 2136, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 51 } }, "left": { "type": "MemberExpression", - "start": 2061, - "end": 2074, + "start": 2113, + "end": 2126, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 41 } }, "object": { "type": "MemberExpression", - "start": 2061, - "end": 2067, + "start": 2113, + "end": 2119, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 34 } }, "object": { "type": "Identifier", - "start": 2061, - "end": 2062, + "start": 2113, + "end": 2114, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 29 }, "identifierName": "g" @@ -6430,15 +6495,15 @@ }, "property": { "type": "Identifier", - "start": 2063, - "end": 2067, + "start": 2115, + "end": 2119, "loc": { "start": { - "line": 65, + "line": 66, "column": 30 }, "end": { - "line": 65, + "line": 66, "column": 34 }, "identifierName": "left" @@ -6449,15 +6514,15 @@ }, "property": { "type": "Identifier", - "start": 2068, - "end": 2074, + "start": 2120, + "end": 2126, "loc": { "start": { - "line": 65, + "line": 66, "column": 35 }, "end": { - "line": 65, + "line": 66, "column": 41 }, "identifierName": "_color" @@ -6469,15 +6534,15 @@ "operator": "===", "right": { "type": "Identifier", - "start": 2079, - "end": 2084, + "start": 2131, + "end": 2136, "loc": { "start": { - "line": 65, + "line": 66, "column": 46 }, "end": { - "line": 65, + "line": 66, "column": 51 }, "identifierName": "BLACK" @@ -6491,43 +6556,43 @@ }, { "type": "ExpressionStatement", - "start": 2089, - "end": 2104, + "start": 2141, + "end": 2156, "loc": { "start": { - "line": 66, + "line": 67, "column": 2 }, "end": { - "line": 66, + "line": 67, "column": 17 } }, "expression": { "type": "CallExpression", - "start": 2089, - "end": 2103, + "start": 2141, + "end": 2155, "loc": { "start": { - "line": 66, + "line": 67, "column": 2 }, "end": { - "line": 66, + "line": 67, "column": 16 } }, "callee": { "type": "Identifier", - "start": 2089, - "end": 2100, + "start": 2141, + "end": 2152, "loc": { "start": { - "line": 66, + "line": 67, "column": 2 }, "end": { - "line": 66, + "line": 67, "column": 13 }, "identifierName": "rotate_left" @@ -6537,15 +6602,15 @@ "arguments": [ { "type": "Identifier", - "start": 2101, - "end": 2102, + "start": 2153, + "end": 2154, "loc": { "start": { - "line": 66, + "line": 67, "column": 14 }, "end": { - "line": 66, + "line": 67, "column": 15 }, "identifierName": "g" @@ -6558,6 +6623,71 @@ ], "directives": [] } + }, + { + "type": "ReturnStatement", + "start": 2162, + "end": 2178, + "loc": { + "start": { + "line": 70, + "column": 1 + }, + "end": { + "line": 70, + "column": 17 + } + }, + "argument": { + "type": "MemberExpression", + "start": 2169, + "end": 2177, + "loc": { + "start": { + "line": 70, + "column": 8 + }, + "end": { + "line": 70, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 2169, + "end": 2170, + "loc": { + "start": { + "line": 70, + "column": 8 + }, + "end": { + "line": 70, + "column": 9 + }, + "identifierName": "n" + }, + "name": "n" + }, + "property": { + "type": "Identifier", + "start": 2171, + "end": 2177, + "loc": { + "start": { + "line": 70, + "column": 10 + }, + "end": { + "line": 70, + "column": 16 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } } ], "directives": [] @@ -6570,16 +6700,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 299, - "end": 578, + "end": 630, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 3 } } @@ -6594,16 +6724,16 @@ "comments": [ { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 299, - "end": 578, + "end": 630, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 3 } } @@ -6611,15 +6741,15 @@ { "type": "CommentLine", "value": " Repaint n's parent black, n's grandparent red", - "start": 863, - "end": 911, + "start": 915, + "end": 963, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 30, "column": 49 } } @@ -6627,15 +6757,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 986, - "end": 1412, + "start": 1038, + "end": 1464, "loc": { "start": { - "line": 34, + "line": 35, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 5 } } @@ -6643,15 +6773,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 1563, - "end": 1966, + "start": 1615, + "end": 2018, "loc": { "start": { - "line": 51, + "line": 52, "column": 2 }, "end": { - "line": 62, + "line": 63, "column": 5 } } @@ -7591,16 +7721,16 @@ }, { "type": "CommentBlock", - "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n ", + "value": "*\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n ", "start": 299, - "end": 578, + "end": 630, "loc": { "start": { "line": 9, "column": 0 }, "end": { - "line": 19, + "line": 20, "column": 3 } } @@ -7620,15 +7750,15 @@ "updateContext": null }, "value": "const", - "start": 579, - "end": 584, + "start": 631, + "end": 636, "loc": { "start": { - "line": 20, + "line": 21, "column": 0 }, "end": { - "line": 20, + "line": 21, "column": 5 } } @@ -7646,15 +7776,15 @@ "binop": null }, "value": "insert_case4", - "start": 585, - "end": 597, + "start": 637, + "end": 649, "loc": { "start": { - "line": 20, + "line": 21, "column": 6 }, "end": { - "line": 20, + "line": 21, "column": 18 } } @@ -7673,15 +7803,15 @@ "updateContext": null }, "value": "=", - "start": 598, - "end": 599, + "start": 650, + "end": 651, "loc": { "start": { - "line": 20, + "line": 21, "column": 19 }, "end": { - "line": 20, + "line": 21, "column": 20 } } @@ -7698,15 +7828,15 @@ "postfix": false, "binop": null }, - "start": 600, - "end": 601, + "start": 652, + "end": 653, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 22 } } @@ -7724,15 +7854,15 @@ "binop": null }, "value": "n", - "start": 601, - "end": 602, + "start": 653, + "end": 654, "loc": { "start": { - "line": 20, + "line": 21, "column": 22 }, "end": { - "line": 20, + "line": 21, "column": 23 } } @@ -7749,15 +7879,15 @@ "postfix": false, "binop": null }, - "start": 602, - "end": 603, + "start": 654, + "end": 655, "loc": { "start": { - "line": 20, + "line": 21, "column": 23 }, "end": { - "line": 20, + "line": 21, "column": 24 } } @@ -7775,15 +7905,15 @@ "binop": null, "updateContext": null }, - "start": 604, - "end": 606, + "start": 656, + "end": 658, "loc": { "start": { - "line": 20, + "line": 21, "column": 25 }, "end": { - "line": 20, + "line": 21, "column": 27 } } @@ -7800,15 +7930,15 @@ "postfix": false, "binop": null }, - "start": 607, - "end": 608, + "start": 659, + "end": 660, "loc": { "start": { - "line": 20, + "line": 21, "column": 28 }, "end": { - "line": 20, + "line": 21, "column": 29 } } @@ -7826,15 +7956,15 @@ "binop": null }, "value": "assert", - "start": 610, - "end": 616, + "start": 662, + "end": 668, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 7 } } @@ -7851,15 +7981,15 @@ "postfix": false, "binop": null }, - "start": 616, - "end": 617, + "start": 668, + "end": 669, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 8 } } @@ -7877,15 +8007,15 @@ "binop": null }, "value": "n", - "start": 617, - "end": 618, + "start": 669, + "end": 670, "loc": { "start": { - "line": 21, + "line": 22, "column": 8 }, "end": { - "line": 21, + "line": 22, "column": 9 } } @@ -7905,15 +8035,15 @@ "updateContext": null }, "value": "instanceof", - "start": 619, - "end": 629, + "start": 671, + "end": 681, "loc": { "start": { - "line": 21, + "line": 22, "column": 10 }, "end": { - "line": 21, + "line": 22, "column": 20 } } @@ -7931,15 +8061,15 @@ "binop": null }, "value": "Node", - "start": 630, - "end": 634, + "start": 682, + "end": 686, "loc": { "start": { - "line": 21, + "line": 22, "column": 21 }, "end": { - "line": 21, + "line": 22, "column": 25 } } @@ -7956,15 +8086,15 @@ "postfix": false, "binop": null }, - "start": 634, - "end": 635, + "start": 686, + "end": 687, "loc": { "start": { - "line": 21, + "line": 22, "column": 25 }, "end": { - "line": 21, + "line": 22, "column": 26 } } @@ -7982,15 +8112,15 @@ "binop": null, "updateContext": null }, - "start": 635, - "end": 636, + "start": 687, + "end": 688, "loc": { "start": { - "line": 21, + "line": 22, "column": 26 }, "end": { - "line": 21, + "line": 22, "column": 27 } } @@ -8008,15 +8138,15 @@ "binop": null }, "value": "assert", - "start": 638, - "end": 644, + "start": 690, + "end": 696, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 } } @@ -8033,15 +8163,15 @@ "postfix": false, "binop": null }, - "start": 644, - "end": 645, + "start": 696, + "end": 697, "loc": { "start": { - "line": 22, + "line": 23, "column": 7 }, "end": { - "line": 22, + "line": 23, "column": 8 } } @@ -8059,15 +8189,15 @@ "binop": null }, "value": "n", - "start": 645, - "end": 646, + "start": 697, + "end": 698, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 } } @@ -8085,15 +8215,15 @@ "binop": null, "updateContext": null }, - "start": 646, - "end": 647, + "start": 698, + "end": 699, "loc": { "start": { - "line": 22, + "line": 23, "column": 9 }, "end": { - "line": 22, + "line": 23, "column": 10 } } @@ -8111,15 +8241,15 @@ "binop": null }, "value": "_color", - "start": 647, - "end": 653, + "start": 699, + "end": 705, "loc": { "start": { - "line": 22, + "line": 23, "column": 10 }, "end": { - "line": 22, + "line": 23, "column": 16 } } @@ -8138,15 +8268,15 @@ "updateContext": null }, "value": "===", - "start": 654, - "end": 657, + "start": 706, + "end": 709, "loc": { "start": { - "line": 22, + "line": 23, "column": 17 }, "end": { - "line": 22, + "line": 23, "column": 20 } } @@ -8164,15 +8294,15 @@ "binop": null }, "value": "RED", - "start": 658, - "end": 661, + "start": 710, + "end": 713, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 24 } } @@ -8189,15 +8319,15 @@ "postfix": false, "binop": null }, - "start": 661, - "end": 662, + "start": 713, + "end": 714, "loc": { "start": { - "line": 22, + "line": 23, "column": 24 }, "end": { - "line": 22, + "line": 23, "column": 25 } } @@ -8215,15 +8345,15 @@ "binop": null, "updateContext": null }, - "start": 662, - "end": 663, + "start": 714, + "end": 715, "loc": { "start": { - "line": 22, + "line": 23, "column": 25 }, "end": { - "line": 22, + "line": 23, "column": 26 } } @@ -8241,15 +8371,15 @@ "binop": null }, "value": "assert", - "start": 665, - "end": 671, + "start": 717, + "end": 723, "loc": { "start": { - "line": 23, + "line": 24, "column": 1 }, "end": { - "line": 23, + "line": 24, "column": 7 } } @@ -8266,15 +8396,15 @@ "postfix": false, "binop": null }, - "start": 671, - "end": 672, + "start": 723, + "end": 724, "loc": { "start": { - "line": 23, + "line": 24, "column": 7 }, "end": { - "line": 23, + "line": 24, "column": 8 } } @@ -8292,15 +8422,15 @@ "binop": null }, "value": "n", - "start": 672, - "end": 673, + "start": 724, + "end": 725, "loc": { "start": { - "line": 23, + "line": 24, "column": 8 }, "end": { - "line": 23, + "line": 24, "column": 9 } } @@ -8318,15 +8448,15 @@ "binop": null, "updateContext": null }, - "start": 673, - "end": 674, + "start": 725, + "end": 726, "loc": { "start": { - "line": 23, + "line": 24, "column": 9 }, "end": { - "line": 23, + "line": 24, "column": 10 } } @@ -8344,15 +8474,15 @@ "binop": null }, "value": "left", - "start": 674, - "end": 678, + "start": 726, + "end": 730, "loc": { "start": { - "line": 23, + "line": 24, "column": 10 }, "end": { - "line": 23, + "line": 24, "column": 14 } } @@ -8371,15 +8501,15 @@ "updateContext": null }, "value": "===", - "start": 679, - "end": 682, + "start": 731, + "end": 734, "loc": { "start": { - "line": 23, + "line": 24, "column": 15 }, "end": { - "line": 23, + "line": 24, "column": 18 } } @@ -8399,15 +8529,15 @@ "updateContext": null }, "value": "null", - "start": 683, - "end": 687, + "start": 735, + "end": 739, "loc": { "start": { - "line": 23, + "line": 24, "column": 19 }, "end": { - "line": 23, + "line": 24, "column": 23 } } @@ -8426,15 +8556,15 @@ "updateContext": null }, "value": "||", - "start": 688, - "end": 690, + "start": 740, + "end": 742, "loc": { "start": { - "line": 23, + "line": 24, "column": 24 }, "end": { - "line": 23, + "line": 24, "column": 26 } } @@ -8452,15 +8582,15 @@ "binop": null }, "value": "n", - "start": 691, - "end": 692, + "start": 743, + "end": 744, "loc": { "start": { - "line": 23, + "line": 24, "column": 27 }, "end": { - "line": 23, + "line": 24, "column": 28 } } @@ -8478,15 +8608,15 @@ "binop": null, "updateContext": null }, - "start": 692, - "end": 693, + "start": 744, + "end": 745, "loc": { "start": { - "line": 23, + "line": 24, "column": 28 }, "end": { - "line": 23, + "line": 24, "column": 29 } } @@ -8504,15 +8634,15 @@ "binop": null }, "value": "left", - "start": 693, - "end": 697, + "start": 745, + "end": 749, "loc": { "start": { - "line": 23, + "line": 24, "column": 29 }, "end": { - "line": 23, + "line": 24, "column": 33 } } @@ -8530,15 +8660,15 @@ "binop": null, "updateContext": null }, - "start": 697, - "end": 698, + "start": 749, + "end": 750, "loc": { "start": { - "line": 23, + "line": 24, "column": 33 }, "end": { - "line": 23, + "line": 24, "column": 34 } } @@ -8556,15 +8686,15 @@ "binop": null }, "value": "_color", - "start": 698, - "end": 704, + "start": 750, + "end": 756, "loc": { "start": { - "line": 23, + "line": 24, "column": 34 }, "end": { - "line": 23, + "line": 24, "column": 40 } } @@ -8583,15 +8713,15 @@ "updateContext": null }, "value": "===", - "start": 705, - "end": 708, + "start": 757, + "end": 760, "loc": { "start": { - "line": 23, + "line": 24, "column": 41 }, "end": { - "line": 23, + "line": 24, "column": 44 } } @@ -8609,15 +8739,15 @@ "binop": null }, "value": "BLACK", - "start": 709, - "end": 714, + "start": 761, + "end": 766, "loc": { "start": { - "line": 23, + "line": 24, "column": 45 }, "end": { - "line": 23, + "line": 24, "column": 50 } } @@ -8634,15 +8764,15 @@ "postfix": false, "binop": null }, - "start": 714, - "end": 715, + "start": 766, + "end": 767, "loc": { "start": { - "line": 23, + "line": 24, "column": 50 }, "end": { - "line": 23, + "line": 24, "column": 51 } } @@ -8660,15 +8790,15 @@ "binop": null, "updateContext": null }, - "start": 715, - "end": 716, + "start": 767, + "end": 768, "loc": { "start": { - "line": 23, + "line": 24, "column": 51 }, "end": { - "line": 23, + "line": 24, "column": 52 } } @@ -8686,15 +8816,15 @@ "binop": null }, "value": "assert", - "start": 718, - "end": 724, + "start": 770, + "end": 776, "loc": { "start": { - "line": 24, + "line": 25, "column": 1 }, "end": { - "line": 24, + "line": 25, "column": 7 } } @@ -8711,15 +8841,15 @@ "postfix": false, "binop": null }, - "start": 724, - "end": 725, + "start": 776, + "end": 777, "loc": { "start": { - "line": 24, + "line": 25, "column": 7 }, "end": { - "line": 24, + "line": 25, "column": 8 } } @@ -8737,15 +8867,15 @@ "binop": null }, "value": "n", - "start": 725, - "end": 726, + "start": 777, + "end": 778, "loc": { "start": { - "line": 24, + "line": 25, "column": 8 }, "end": { - "line": 24, + "line": 25, "column": 9 } } @@ -8763,15 +8893,15 @@ "binop": null, "updateContext": null }, - "start": 726, - "end": 727, + "start": 778, + "end": 779, "loc": { "start": { - "line": 24, + "line": 25, "column": 9 }, "end": { - "line": 24, + "line": 25, "column": 10 } } @@ -8789,15 +8919,15 @@ "binop": null }, "value": "right", - "start": 727, - "end": 732, + "start": 779, + "end": 784, "loc": { "start": { - "line": 24, + "line": 25, "column": 10 }, "end": { - "line": 24, + "line": 25, "column": 15 } } @@ -8816,15 +8946,15 @@ "updateContext": null }, "value": "===", - "start": 733, - "end": 736, + "start": 785, + "end": 788, "loc": { "start": { - "line": 24, + "line": 25, "column": 16 }, "end": { - "line": 24, + "line": 25, "column": 19 } } @@ -8844,15 +8974,15 @@ "updateContext": null }, "value": "null", - "start": 737, - "end": 741, + "start": 789, + "end": 793, "loc": { "start": { - "line": 24, + "line": 25, "column": 20 }, "end": { - "line": 24, + "line": 25, "column": 24 } } @@ -8871,15 +9001,15 @@ "updateContext": null }, "value": "||", - "start": 742, - "end": 744, + "start": 794, + "end": 796, "loc": { "start": { - "line": 24, + "line": 25, "column": 25 }, "end": { - "line": 24, + "line": 25, "column": 27 } } @@ -8897,15 +9027,15 @@ "binop": null }, "value": "n", - "start": 745, - "end": 746, + "start": 797, + "end": 798, "loc": { "start": { - "line": 24, + "line": 25, "column": 28 }, "end": { - "line": 24, + "line": 25, "column": 29 } } @@ -8923,15 +9053,15 @@ "binop": null, "updateContext": null }, - "start": 746, - "end": 747, + "start": 798, + "end": 799, "loc": { "start": { - "line": 24, + "line": 25, "column": 29 }, "end": { - "line": 24, + "line": 25, "column": 30 } } @@ -8949,15 +9079,15 @@ "binop": null }, "value": "right", - "start": 747, - "end": 752, + "start": 799, + "end": 804, "loc": { "start": { - "line": 24, + "line": 25, "column": 30 }, "end": { - "line": 24, + "line": 25, "column": 35 } } @@ -8975,15 +9105,15 @@ "binop": null, "updateContext": null }, - "start": 752, - "end": 753, + "start": 804, + "end": 805, "loc": { "start": { - "line": 24, + "line": 25, "column": 35 }, "end": { - "line": 24, + "line": 25, "column": 36 } } @@ -9001,15 +9131,15 @@ "binop": null }, "value": "_color", - "start": 753, - "end": 759, + "start": 805, + "end": 811, "loc": { "start": { - "line": 24, + "line": 25, "column": 36 }, "end": { - "line": 24, + "line": 25, "column": 42 } } @@ -9028,15 +9158,15 @@ "updateContext": null }, "value": "===", - "start": 760, - "end": 763, + "start": 812, + "end": 815, "loc": { "start": { - "line": 24, + "line": 25, "column": 43 }, "end": { - "line": 24, + "line": 25, "column": 46 } } @@ -9054,15 +9184,15 @@ "binop": null }, "value": "BLACK", - "start": 764, - "end": 769, + "start": 816, + "end": 821, "loc": { "start": { - "line": 24, + "line": 25, "column": 47 }, "end": { - "line": 24, + "line": 25, "column": 52 } } @@ -9079,15 +9209,15 @@ "postfix": false, "binop": null }, - "start": 769, - "end": 770, + "start": 821, + "end": 822, "loc": { "start": { - "line": 24, + "line": 25, "column": 52 }, "end": { - "line": 24, + "line": 25, "column": 53 } } @@ -9105,15 +9235,15 @@ "binop": null, "updateContext": null }, - "start": 770, - "end": 771, + "start": 822, + "end": 823, "loc": { "start": { - "line": 24, + "line": 25, "column": 53 }, "end": { - "line": 24, + "line": 25, "column": 54 } } @@ -9131,15 +9261,15 @@ "binop": null }, "value": "assert", - "start": 773, - "end": 779, + "start": 825, + "end": 831, "loc": { "start": { - "line": 25, + "line": 26, "column": 1 }, "end": { - "line": 25, + "line": 26, "column": 7 } } @@ -9156,15 +9286,15 @@ "postfix": false, "binop": null }, - "start": 779, - "end": 780, + "start": 831, + "end": 832, "loc": { "start": { - "line": 25, + "line": 26, "column": 7 }, "end": { - "line": 25, + "line": 26, "column": 8 } } @@ -9182,15 +9312,15 @@ "binop": null }, "value": "n", - "start": 780, - "end": 781, + "start": 832, + "end": 833, "loc": { "start": { - "line": 25, + "line": 26, "column": 8 }, "end": { - "line": 25, + "line": 26, "column": 9 } } @@ -9208,15 +9338,15 @@ "binop": null, "updateContext": null }, - "start": 781, - "end": 782, + "start": 833, + "end": 834, "loc": { "start": { - "line": 25, + "line": 26, "column": 9 }, "end": { - "line": 25, + "line": 26, "column": 10 } } @@ -9234,15 +9364,15 @@ "binop": null }, "value": "parent", - "start": 782, - "end": 788, + "start": 834, + "end": 840, "loc": { "start": { - "line": 25, + "line": 26, "column": 10 }, "end": { - "line": 25, + "line": 26, "column": 16 } } @@ -9261,15 +9391,15 @@ "updateContext": null }, "value": "!==", - "start": 789, - "end": 792, + "start": 841, + "end": 844, "loc": { "start": { - "line": 25, + "line": 26, "column": 17 }, "end": { - "line": 25, + "line": 26, "column": 20 } } @@ -9289,15 +9419,15 @@ "updateContext": null }, "value": "null", - "start": 793, - "end": 797, + "start": 845, + "end": 849, "loc": { "start": { - "line": 25, + "line": 26, "column": 21 }, "end": { - "line": 25, + "line": 26, "column": 25 } } @@ -9314,15 +9444,15 @@ "postfix": false, "binop": null }, - "start": 797, - "end": 798, + "start": 849, + "end": 850, "loc": { "start": { - "line": 25, + "line": 26, "column": 25 }, "end": { - "line": 25, + "line": 26, "column": 26 } } @@ -9340,15 +9470,15 @@ "binop": null, "updateContext": null }, - "start": 798, - "end": 799, + "start": 850, + "end": 851, "loc": { "start": { - "line": 25, + "line": 26, "column": 26 }, "end": { - "line": 25, + "line": 26, "column": 27 } } @@ -9366,15 +9496,15 @@ "binop": null }, "value": "assert", - "start": 801, - "end": 807, + "start": 853, + "end": 859, "loc": { "start": { - "line": 26, + "line": 27, "column": 1 }, "end": { - "line": 26, + "line": 27, "column": 7 } } @@ -9391,15 +9521,15 @@ "postfix": false, "binop": null }, - "start": 807, - "end": 808, + "start": 859, + "end": 860, "loc": { "start": { - "line": 26, + "line": 27, "column": 7 }, "end": { - "line": 26, + "line": 27, "column": 8 } } @@ -9417,15 +9547,15 @@ "binop": null }, "value": "n", - "start": 808, - "end": 809, + "start": 860, + "end": 861, "loc": { "start": { - "line": 26, + "line": 27, "column": 8 }, "end": { - "line": 26, + "line": 27, "column": 9 } } @@ -9443,15 +9573,15 @@ "binop": null, "updateContext": null }, - "start": 809, - "end": 810, + "start": 861, + "end": 862, "loc": { "start": { - "line": 26, + "line": 27, "column": 9 }, "end": { - "line": 26, + "line": 27, "column": 10 } } @@ -9469,15 +9599,15 @@ "binop": null }, "value": "parent", - "start": 810, - "end": 816, + "start": 862, + "end": 868, "loc": { "start": { - "line": 26, + "line": 27, "column": 10 }, "end": { - "line": 26, + "line": 27, "column": 16 } } @@ -9495,15 +9625,15 @@ "binop": null, "updateContext": null }, - "start": 816, - "end": 817, + "start": 868, + "end": 869, "loc": { "start": { - "line": 26, + "line": 27, "column": 16 }, "end": { - "line": 26, + "line": 27, "column": 17 } } @@ -9521,15 +9651,15 @@ "binop": null }, "value": "_color", - "start": 817, - "end": 823, + "start": 869, + "end": 875, "loc": { "start": { - "line": 26, + "line": 27, "column": 17 }, "end": { - "line": 26, + "line": 27, "column": 23 } } @@ -9548,15 +9678,15 @@ "updateContext": null }, "value": "===", - "start": 824, - "end": 827, + "start": 876, + "end": 879, "loc": { "start": { - "line": 26, + "line": 27, "column": 24 }, "end": { - "line": 26, + "line": 27, "column": 27 } } @@ -9574,15 +9704,15 @@ "binop": null }, "value": "RED", - "start": 828, - "end": 831, + "start": 880, + "end": 883, "loc": { "start": { - "line": 26, + "line": 27, "column": 28 }, "end": { - "line": 26, + "line": 27, "column": 31 } } @@ -9599,15 +9729,15 @@ "postfix": false, "binop": null }, - "start": 831, - "end": 832, + "start": 883, + "end": 884, "loc": { "start": { - "line": 26, + "line": 27, "column": 31 }, "end": { - "line": 26, + "line": 27, "column": 32 } } @@ -9625,15 +9755,15 @@ "binop": null, "updateContext": null }, - "start": 832, - "end": 833, + "start": 884, + "end": 885, "loc": { "start": { - "line": 26, + "line": 27, "column": 32 }, "end": { - "line": 26, + "line": 27, "column": 33 } } @@ -9653,15 +9783,15 @@ "updateContext": null }, "value": "const", - "start": 835, - "end": 840, + "start": 887, + "end": 892, "loc": { "start": { - "line": 27, + "line": 28, "column": 1 }, "end": { - "line": 27, + "line": 28, "column": 6 } } @@ -9679,15 +9809,15 @@ "binop": null }, "value": "g", - "start": 841, - "end": 842, + "start": 893, + "end": 894, "loc": { "start": { - "line": 27, + "line": 28, "column": 7 }, "end": { - "line": 27, + "line": 28, "column": 8 } } @@ -9706,15 +9836,15 @@ "updateContext": null }, "value": "=", - "start": 843, - "end": 844, + "start": 895, + "end": 896, "loc": { "start": { - "line": 27, + "line": 28, "column": 9 }, "end": { - "line": 27, + "line": 28, "column": 10 } } @@ -9732,15 +9862,15 @@ "binop": null }, "value": "grandparent", - "start": 845, - "end": 856, + "start": 897, + "end": 908, "loc": { "start": { - "line": 27, + "line": 28, "column": 11 }, "end": { - "line": 27, + "line": 28, "column": 22 } } @@ -9757,15 +9887,15 @@ "postfix": false, "binop": null }, - "start": 856, - "end": 857, + "start": 908, + "end": 909, "loc": { "start": { - "line": 27, + "line": 28, "column": 22 }, "end": { - "line": 27, + "line": 28, "column": 23 } } @@ -9783,15 +9913,15 @@ "binop": null }, "value": "n", - "start": 857, - "end": 858, + "start": 909, + "end": 910, "loc": { "start": { - "line": 27, + "line": 28, "column": 23 }, "end": { - "line": 27, + "line": 28, "column": 24 } } @@ -9808,15 +9938,15 @@ "postfix": false, "binop": null }, - "start": 858, - "end": 859, + "start": 910, + "end": 911, "loc": { "start": { - "line": 27, + "line": 28, "column": 24 }, "end": { - "line": 27, + "line": 28, "column": 25 } } @@ -9834,15 +9964,15 @@ "binop": null, "updateContext": null }, - "start": 859, - "end": 860, + "start": 911, + "end": 912, "loc": { "start": { - "line": 27, + "line": 28, "column": 25 }, "end": { - "line": 27, + "line": 28, "column": 26 } } @@ -9850,15 +9980,15 @@ { "type": "CommentLine", "value": " Repaint n's parent black, n's grandparent red", - "start": 863, - "end": 911, + "start": 915, + "end": 963, "loc": { "start": { - "line": 29, + "line": 30, "column": 1 }, "end": { - "line": 29, + "line": 30, "column": 49 } } @@ -9876,15 +10006,15 @@ "binop": null }, "value": "n", - "start": 913, - "end": 914, + "start": 965, + "end": 966, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 2 } } @@ -9902,15 +10032,15 @@ "binop": null, "updateContext": null }, - "start": 914, - "end": 915, + "start": 966, + "end": 967, "loc": { "start": { - "line": 30, + "line": 31, "column": 2 }, "end": { - "line": 30, + "line": 31, "column": 3 } } @@ -9928,15 +10058,15 @@ "binop": null }, "value": "parent", - "start": 915, - "end": 921, + "start": 967, + "end": 973, "loc": { "start": { - "line": 30, + "line": 31, "column": 3 }, "end": { - "line": 30, + "line": 31, "column": 9 } } @@ -9954,15 +10084,15 @@ "binop": null, "updateContext": null }, - "start": 921, - "end": 922, + "start": 973, + "end": 974, "loc": { "start": { - "line": 30, + "line": 31, "column": 9 }, "end": { - "line": 30, + "line": 31, "column": 10 } } @@ -9980,15 +10110,15 @@ "binop": null }, "value": "_color", - "start": 922, - "end": 928, + "start": 974, + "end": 980, "loc": { "start": { - "line": 30, + "line": 31, "column": 10 }, "end": { - "line": 30, + "line": 31, "column": 16 } } @@ -10007,15 +10137,15 @@ "updateContext": null }, "value": "=", - "start": 929, - "end": 930, + "start": 981, + "end": 982, "loc": { "start": { - "line": 30, + "line": 31, "column": 17 }, "end": { - "line": 30, + "line": 31, "column": 18 } } @@ -10033,15 +10163,15 @@ "binop": null }, "value": "BLACK", - "start": 931, - "end": 936, + "start": 983, + "end": 988, "loc": { "start": { - "line": 30, + "line": 31, "column": 19 }, "end": { - "line": 30, + "line": 31, "column": 24 } } @@ -10059,15 +10189,15 @@ "binop": null, "updateContext": null }, - "start": 936, - "end": 937, + "start": 988, + "end": 989, "loc": { "start": { - "line": 30, + "line": 31, "column": 24 }, "end": { - "line": 30, + "line": 31, "column": 25 } } @@ -10085,15 +10215,15 @@ "binop": null }, "value": "g", - "start": 939, - "end": 940, + "start": 991, + "end": 992, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 2 } } @@ -10111,15 +10241,15 @@ "binop": null, "updateContext": null }, - "start": 940, - "end": 941, + "start": 992, + "end": 993, "loc": { "start": { - "line": 31, + "line": 32, "column": 2 }, "end": { - "line": 31, + "line": 32, "column": 3 } } @@ -10137,15 +10267,15 @@ "binop": null }, "value": "_color", - "start": 941, - "end": 947, + "start": 993, + "end": 999, "loc": { "start": { - "line": 31, + "line": 32, "column": 3 }, "end": { - "line": 31, + "line": 32, "column": 9 } } @@ -10164,15 +10294,15 @@ "updateContext": null }, "value": "=", - "start": 948, - "end": 949, + "start": 1000, + "end": 1001, "loc": { "start": { - "line": 31, + "line": 32, "column": 10 }, "end": { - "line": 31, + "line": 32, "column": 11 } } @@ -10190,15 +10320,15 @@ "binop": null }, "value": "RED", - "start": 950, - "end": 953, + "start": 1002, + "end": 1005, "loc": { "start": { - "line": 31, + "line": 32, "column": 12 }, "end": { - "line": 31, + "line": 32, "column": 15 } } @@ -10216,15 +10346,15 @@ "binop": null, "updateContext": null }, - "start": 953, - "end": 954, + "start": 1005, + "end": 1006, "loc": { "start": { - "line": 31, + "line": 32, "column": 15 }, "end": { - "line": 31, + "line": 32, "column": 16 } } @@ -10244,15 +10374,15 @@ "updateContext": null }, "value": "if", - "start": 957, - "end": 959, + "start": 1009, + "end": 1011, "loc": { "start": { - "line": 33, + "line": 34, "column": 1 }, "end": { - "line": 33, + "line": 34, "column": 3 } } @@ -10269,15 +10399,15 @@ "postfix": false, "binop": null }, - "start": 960, - "end": 961, + "start": 1012, + "end": 1013, "loc": { "start": { - "line": 33, + "line": 34, "column": 4 }, "end": { - "line": 33, + "line": 34, "column": 5 } } @@ -10295,15 +10425,15 @@ "binop": null }, "value": "n", - "start": 961, - "end": 962, + "start": 1013, + "end": 1014, "loc": { "start": { - "line": 33, + "line": 34, "column": 5 }, "end": { - "line": 33, + "line": 34, "column": 6 } } @@ -10322,15 +10452,15 @@ "updateContext": null }, "value": "===", - "start": 963, - "end": 966, + "start": 1015, + "end": 1018, "loc": { "start": { - "line": 33, + "line": 34, "column": 7 }, "end": { - "line": 33, + "line": 34, "column": 10 } } @@ -10348,15 +10478,15 @@ "binop": null }, "value": "n", - "start": 967, - "end": 968, + "start": 1019, + "end": 1020, "loc": { "start": { - "line": 33, + "line": 34, "column": 11 }, "end": { - "line": 33, + "line": 34, "column": 12 } } @@ -10374,15 +10504,15 @@ "binop": null, "updateContext": null }, - "start": 968, - "end": 969, + "start": 1020, + "end": 1021, "loc": { "start": { - "line": 33, + "line": 34, "column": 12 }, "end": { - "line": 33, + "line": 34, "column": 13 } } @@ -10400,15 +10530,15 @@ "binop": null }, "value": "parent", - "start": 969, - "end": 975, + "start": 1021, + "end": 1027, "loc": { "start": { - "line": 33, + "line": 34, "column": 13 }, "end": { - "line": 33, + "line": 34, "column": 19 } } @@ -10426,15 +10556,15 @@ "binop": null, "updateContext": null }, - "start": 975, - "end": 976, + "start": 1027, + "end": 1028, "loc": { "start": { - "line": 33, + "line": 34, "column": 19 }, "end": { - "line": 33, + "line": 34, "column": 20 } } @@ -10452,15 +10582,15 @@ "binop": null }, "value": "left", - "start": 976, - "end": 980, + "start": 1028, + "end": 1032, "loc": { "start": { - "line": 33, + "line": 34, "column": 20 }, "end": { - "line": 33, + "line": 34, "column": 24 } } @@ -10477,15 +10607,15 @@ "postfix": false, "binop": null }, - "start": 980, - "end": 981, + "start": 1032, + "end": 1033, "loc": { "start": { - "line": 33, + "line": 34, "column": 24 }, "end": { - "line": 33, + "line": 34, "column": 25 } } @@ -10502,15 +10632,15 @@ "postfix": false, "binop": null }, - "start": 982, - "end": 983, + "start": 1034, + "end": 1035, "loc": { "start": { - "line": 33, + "line": 34, "column": 26 }, "end": { - "line": 33, + "line": 34, "column": 27 } } @@ -10518,15 +10648,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 986, - "end": 1412, + "start": 1038, + "end": 1464, "loc": { "start": { - "line": 34, + "line": 35, "column": 2 }, "end": { - "line": 45, + "line": 46, "column": 5 } } @@ -10544,15 +10674,15 @@ "binop": null }, "value": "assert", - "start": 1415, - "end": 1421, + "start": 1467, + "end": 1473, "loc": { "start": { - "line": 46, + "line": 47, "column": 2 }, "end": { - "line": 46, + "line": 47, "column": 8 } } @@ -10569,15 +10699,15 @@ "postfix": false, "binop": null }, - "start": 1421, - "end": 1422, + "start": 1473, + "end": 1474, "loc": { "start": { - "line": 46, + "line": 47, "column": 8 }, "end": { - "line": 46, + "line": 47, "column": 9 } } @@ -10595,15 +10725,15 @@ "binop": null }, "value": "g", - "start": 1422, - "end": 1423, + "start": 1474, + "end": 1475, "loc": { "start": { - "line": 46, + "line": 47, "column": 9 }, "end": { - "line": 46, + "line": 47, "column": 10 } } @@ -10621,15 +10751,15 @@ "binop": null, "updateContext": null }, - "start": 1423, - "end": 1424, + "start": 1475, + "end": 1476, "loc": { "start": { - "line": 46, + "line": 47, "column": 10 }, "end": { - "line": 46, + "line": 47, "column": 11 } } @@ -10647,15 +10777,15 @@ "binop": null }, "value": "left", - "start": 1424, - "end": 1428, + "start": 1476, + "end": 1480, "loc": { "start": { - "line": 46, + "line": 47, "column": 11 }, "end": { - "line": 46, + "line": 47, "column": 15 } } @@ -10675,15 +10805,15 @@ "updateContext": null }, "value": "instanceof", - "start": 1429, - "end": 1439, + "start": 1481, + "end": 1491, "loc": { "start": { - "line": 46, + "line": 47, "column": 16 }, "end": { - "line": 46, + "line": 47, "column": 26 } } @@ -10701,15 +10831,15 @@ "binop": null }, "value": "Node", - "start": 1440, - "end": 1444, + "start": 1492, + "end": 1496, "loc": { "start": { - "line": 46, + "line": 47, "column": 27 }, "end": { - "line": 46, + "line": 47, "column": 31 } } @@ -10726,15 +10856,15 @@ "postfix": false, "binop": null }, - "start": 1444, - "end": 1445, + "start": 1496, + "end": 1497, "loc": { "start": { - "line": 46, + "line": 47, "column": 31 }, "end": { - "line": 46, + "line": 47, "column": 32 } } @@ -10752,15 +10882,15 @@ "binop": null, "updateContext": null }, - "start": 1445, - "end": 1446, + "start": 1497, + "end": 1498, "loc": { "start": { - "line": 46, + "line": 47, "column": 32 }, "end": { - "line": 46, + "line": 47, "column": 33 } } @@ -10778,15 +10908,15 @@ "binop": null }, "value": "assert", - "start": 1449, - "end": 1455, + "start": 1501, + "end": 1507, "loc": { "start": { - "line": 47, + "line": 48, "column": 2 }, "end": { - "line": 47, + "line": 48, "column": 8 } } @@ -10803,15 +10933,15 @@ "postfix": false, "binop": null }, - "start": 1455, - "end": 1456, + "start": 1507, + "end": 1508, "loc": { "start": { - "line": 47, + "line": 48, "column": 8 }, "end": { - "line": 47, + "line": 48, "column": 9 } } @@ -10829,15 +10959,15 @@ "binop": null }, "value": "n", - "start": 1456, - "end": 1457, + "start": 1508, + "end": 1509, "loc": { "start": { - "line": 47, + "line": 48, "column": 9 }, "end": { - "line": 47, + "line": 48, "column": 10 } } @@ -10856,15 +10986,15 @@ "updateContext": null }, "value": "===", - "start": 1458, - "end": 1461, + "start": 1510, + "end": 1513, "loc": { "start": { - "line": 47, + "line": 48, "column": 11 }, "end": { - "line": 47, + "line": 48, "column": 14 } } @@ -10882,15 +11012,15 @@ "binop": null }, "value": "g", - "start": 1462, - "end": 1463, + "start": 1514, + "end": 1515, "loc": { "start": { - "line": 47, + "line": 48, "column": 15 }, "end": { - "line": 47, + "line": 48, "column": 16 } } @@ -10908,15 +11038,15 @@ "binop": null, "updateContext": null }, - "start": 1463, - "end": 1464, + "start": 1515, + "end": 1516, "loc": { "start": { - "line": 47, + "line": 48, "column": 16 }, "end": { - "line": 47, + "line": 48, "column": 17 } } @@ -10934,15 +11064,15 @@ "binop": null }, "value": "left", - "start": 1464, - "end": 1468, + "start": 1516, + "end": 1520, "loc": { "start": { - "line": 47, + "line": 48, "column": 17 }, "end": { - "line": 47, + "line": 48, "column": 21 } } @@ -10960,15 +11090,15 @@ "binop": null, "updateContext": null }, - "start": 1468, - "end": 1469, + "start": 1520, + "end": 1521, "loc": { "start": { - "line": 47, + "line": 48, "column": 21 }, "end": { - "line": 47, + "line": 48, "column": 22 } } @@ -10986,15 +11116,15 @@ "binop": null }, "value": "left", - "start": 1469, - "end": 1473, + "start": 1521, + "end": 1525, "loc": { "start": { - "line": 47, + "line": 48, "column": 22 }, "end": { - "line": 47, + "line": 48, "column": 26 } } @@ -11011,15 +11141,15 @@ "postfix": false, "binop": null }, - "start": 1473, - "end": 1474, + "start": 1525, + "end": 1526, "loc": { "start": { - "line": 47, + "line": 48, "column": 26 }, "end": { - "line": 47, + "line": 48, "column": 27 } } @@ -11037,15 +11167,15 @@ "binop": null, "updateContext": null }, - "start": 1474, - "end": 1475, + "start": 1526, + "end": 1527, "loc": { "start": { - "line": 47, + "line": 48, "column": 27 }, "end": { - "line": 47, + "line": 48, "column": 28 } } @@ -11063,15 +11193,15 @@ "binop": null }, "value": "assert", - "start": 1478, - "end": 1484, + "start": 1530, + "end": 1536, "loc": { "start": { - "line": 48, + "line": 49, "column": 2 }, "end": { - "line": 48, + "line": 49, "column": 8 } } @@ -11088,15 +11218,15 @@ "postfix": false, "binop": null }, - "start": 1484, - "end": 1485, + "start": 1536, + "end": 1537, "loc": { "start": { - "line": 48, + "line": 49, "column": 8 }, "end": { - "line": 48, + "line": 49, "column": 9 } } @@ -11114,15 +11244,15 @@ "binop": null }, "value": "g", - "start": 1485, - "end": 1486, + "start": 1537, + "end": 1538, "loc": { "start": { - "line": 48, + "line": 49, "column": 9 }, "end": { - "line": 48, + "line": 49, "column": 10 } } @@ -11140,15 +11270,15 @@ "binop": null, "updateContext": null }, - "start": 1486, - "end": 1487, + "start": 1538, + "end": 1539, "loc": { "start": { - "line": 48, + "line": 49, "column": 10 }, "end": { - "line": 48, + "line": 49, "column": 11 } } @@ -11166,15 +11296,15 @@ "binop": null }, "value": "right", - "start": 1487, - "end": 1492, + "start": 1539, + "end": 1544, "loc": { "start": { - "line": 48, + "line": 49, "column": 11 }, "end": { - "line": 48, + "line": 49, "column": 16 } } @@ -11193,15 +11323,15 @@ "updateContext": null }, "value": "===", - "start": 1493, - "end": 1496, + "start": 1545, + "end": 1548, "loc": { "start": { - "line": 48, + "line": 49, "column": 17 }, "end": { - "line": 48, + "line": 49, "column": 20 } } @@ -11221,15 +11351,15 @@ "updateContext": null }, "value": "null", - "start": 1497, - "end": 1501, + "start": 1549, + "end": 1553, "loc": { "start": { - "line": 48, + "line": 49, "column": 21 }, "end": { - "line": 48, + "line": 49, "column": 25 } } @@ -11248,15 +11378,15 @@ "updateContext": null }, "value": "||", - "start": 1502, - "end": 1504, + "start": 1554, + "end": 1556, "loc": { "start": { - "line": 48, + "line": 49, "column": 26 }, "end": { - "line": 48, + "line": 49, "column": 28 } } @@ -11274,15 +11404,15 @@ "binop": null }, "value": "g", - "start": 1505, - "end": 1506, + "start": 1557, + "end": 1558, "loc": { "start": { - "line": 48, + "line": 49, "column": 29 }, "end": { - "line": 48, + "line": 49, "column": 30 } } @@ -11300,15 +11430,15 @@ "binop": null, "updateContext": null }, - "start": 1506, - "end": 1507, + "start": 1558, + "end": 1559, "loc": { "start": { - "line": 48, + "line": 49, "column": 30 }, "end": { - "line": 48, + "line": 49, "column": 31 } } @@ -11326,15 +11456,15 @@ "binop": null }, "value": "right", - "start": 1507, - "end": 1512, + "start": 1559, + "end": 1564, "loc": { "start": { - "line": 48, + "line": 49, "column": 31 }, "end": { - "line": 48, + "line": 49, "column": 36 } } @@ -11352,15 +11482,15 @@ "binop": null, "updateContext": null }, - "start": 1512, - "end": 1513, + "start": 1564, + "end": 1565, "loc": { "start": { - "line": 48, + "line": 49, "column": 36 }, "end": { - "line": 48, + "line": 49, "column": 37 } } @@ -11378,15 +11508,15 @@ "binop": null }, "value": "_color", - "start": 1513, - "end": 1519, + "start": 1565, + "end": 1571, "loc": { "start": { - "line": 48, + "line": 49, "column": 37 }, "end": { - "line": 48, + "line": 49, "column": 43 } } @@ -11405,15 +11535,15 @@ "updateContext": null }, "value": "===", - "start": 1520, - "end": 1523, + "start": 1572, + "end": 1575, "loc": { "start": { - "line": 48, + "line": 49, "column": 44 }, "end": { - "line": 48, + "line": 49, "column": 47 } } @@ -11431,15 +11561,15 @@ "binop": null }, "value": "BLACK", - "start": 1524, - "end": 1529, + "start": 1576, + "end": 1581, "loc": { "start": { - "line": 48, + "line": 49, "column": 48 }, "end": { - "line": 48, + "line": 49, "column": 53 } } @@ -11456,15 +11586,15 @@ "postfix": false, "binop": null }, - "start": 1529, - "end": 1530, + "start": 1581, + "end": 1582, "loc": { "start": { - "line": 48, + "line": 49, "column": 53 }, "end": { - "line": 48, + "line": 49, "column": 54 } } @@ -11482,15 +11612,15 @@ "binop": null, "updateContext": null }, - "start": 1530, - "end": 1531, + "start": 1582, + "end": 1583, "loc": { "start": { - "line": 48, + "line": 49, "column": 54 }, "end": { - "line": 48, + "line": 49, "column": 55 } } @@ -11508,15 +11638,15 @@ "binop": null }, "value": "rotate_right", - "start": 1534, - "end": 1546, + "start": 1586, + "end": 1598, "loc": { "start": { - "line": 49, + "line": 50, "column": 2 }, "end": { - "line": 49, + "line": 50, "column": 14 } } @@ -11533,15 +11663,15 @@ "postfix": false, "binop": null }, - "start": 1546, - "end": 1547, + "start": 1598, + "end": 1599, "loc": { "start": { - "line": 49, + "line": 50, "column": 14 }, "end": { - "line": 49, + "line": 50, "column": 15 } } @@ -11559,15 +11689,15 @@ "binop": null }, "value": "g", - "start": 1547, - "end": 1548, + "start": 1599, + "end": 1600, "loc": { "start": { - "line": 49, + "line": 50, "column": 15 }, "end": { - "line": 49, + "line": 50, "column": 16 } } @@ -11584,15 +11714,15 @@ "postfix": false, "binop": null }, - "start": 1548, - "end": 1549, + "start": 1600, + "end": 1601, "loc": { "start": { - "line": 49, + "line": 50, "column": 16 }, "end": { - "line": 49, + "line": 50, "column": 17 } } @@ -11610,15 +11740,15 @@ "binop": null, "updateContext": null }, - "start": 1549, - "end": 1550, + "start": 1601, + "end": 1602, "loc": { "start": { - "line": 49, + "line": 50, "column": 17 }, "end": { - "line": 49, + "line": 50, "column": 18 } } @@ -11635,15 +11765,15 @@ "postfix": false, "binop": null }, - "start": 1552, - "end": 1553, + "start": 1604, + "end": 1605, "loc": { "start": { - "line": 50, + "line": 51, "column": 1 }, "end": { - "line": 50, + "line": 51, "column": 2 } } @@ -11663,15 +11793,15 @@ "updateContext": null }, "value": "else", - "start": 1554, - "end": 1558, + "start": 1606, + "end": 1610, "loc": { "start": { - "line": 50, + "line": 51, "column": 3 }, "end": { - "line": 50, + "line": 51, "column": 7 } } @@ -11688,15 +11818,15 @@ "postfix": false, "binop": null }, - "start": 1559, - "end": 1560, + "start": 1611, + "end": 1612, "loc": { "start": { - "line": 50, + "line": 51, "column": 8 }, "end": { - "line": 50, + "line": 51, "column": 9 } } @@ -11704,15 +11834,15 @@ { "type": "CommentBlock", "value": "*\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t ", - "start": 1563, - "end": 1966, + "start": 1615, + "end": 2018, "loc": { "start": { - "line": 51, + "line": 52, "column": 2 }, "end": { - "line": 62, + "line": 63, "column": 5 } } @@ -11730,15 +11860,15 @@ "binop": null }, "value": "assert", - "start": 1969, - "end": 1975, + "start": 2021, + "end": 2027, "loc": { "start": { - "line": 63, + "line": 64, "column": 2 }, "end": { - "line": 63, + "line": 64, "column": 8 } } @@ -11755,15 +11885,15 @@ "postfix": false, "binop": null }, - "start": 1975, - "end": 1976, + "start": 2027, + "end": 2028, "loc": { "start": { - "line": 63, + "line": 64, "column": 8 }, "end": { - "line": 63, + "line": 64, "column": 9 } } @@ -11781,15 +11911,15 @@ "binop": null }, "value": "g", - "start": 1976, - "end": 1977, + "start": 2028, + "end": 2029, "loc": { "start": { - "line": 63, + "line": 64, "column": 9 }, "end": { - "line": 63, + "line": 64, "column": 10 } } @@ -11807,15 +11937,15 @@ "binop": null, "updateContext": null }, - "start": 1977, - "end": 1978, + "start": 2029, + "end": 2030, "loc": { "start": { - "line": 63, + "line": 64, "column": 10 }, "end": { - "line": 63, + "line": 64, "column": 11 } } @@ -11833,15 +11963,15 @@ "binop": null }, "value": "right", - "start": 1978, - "end": 1983, + "start": 2030, + "end": 2035, "loc": { "start": { - "line": 63, + "line": 64, "column": 11 }, "end": { - "line": 63, + "line": 64, "column": 16 } } @@ -11861,15 +11991,15 @@ "updateContext": null }, "value": "instanceof", - "start": 1984, - "end": 1994, + "start": 2036, + "end": 2046, "loc": { "start": { - "line": 63, + "line": 64, "column": 17 }, "end": { - "line": 63, + "line": 64, "column": 27 } } @@ -11887,15 +12017,15 @@ "binop": null }, "value": "Node", - "start": 1995, - "end": 1999, + "start": 2047, + "end": 2051, "loc": { "start": { - "line": 63, + "line": 64, "column": 28 }, "end": { - "line": 63, + "line": 64, "column": 32 } } @@ -11912,15 +12042,15 @@ "postfix": false, "binop": null }, - "start": 1999, - "end": 2000, + "start": 2051, + "end": 2052, "loc": { "start": { - "line": 63, + "line": 64, "column": 32 }, "end": { - "line": 63, + "line": 64, "column": 33 } } @@ -11938,15 +12068,15 @@ "binop": null, "updateContext": null }, - "start": 2000, - "end": 2001, + "start": 2052, + "end": 2053, "loc": { "start": { - "line": 63, + "line": 64, "column": 33 }, "end": { - "line": 63, + "line": 64, "column": 34 } } @@ -11964,15 +12094,15 @@ "binop": null }, "value": "assert", - "start": 2004, - "end": 2010, + "start": 2056, + "end": 2062, "loc": { "start": { - "line": 64, + "line": 65, "column": 2 }, "end": { - "line": 64, + "line": 65, "column": 8 } } @@ -11989,15 +12119,15 @@ "postfix": false, "binop": null }, - "start": 2010, - "end": 2011, + "start": 2062, + "end": 2063, "loc": { "start": { - "line": 64, + "line": 65, "column": 8 }, "end": { - "line": 64, + "line": 65, "column": 9 } } @@ -12015,15 +12145,15 @@ "binop": null }, "value": "n", - "start": 2011, - "end": 2012, + "start": 2063, + "end": 2064, "loc": { "start": { - "line": 64, + "line": 65, "column": 9 }, "end": { - "line": 64, + "line": 65, "column": 10 } } @@ -12042,15 +12172,15 @@ "updateContext": null }, "value": "===", - "start": 2013, - "end": 2016, + "start": 2065, + "end": 2068, "loc": { "start": { - "line": 64, + "line": 65, "column": 11 }, "end": { - "line": 64, + "line": 65, "column": 14 } } @@ -12068,15 +12198,15 @@ "binop": null }, "value": "g", - "start": 2017, - "end": 2018, + "start": 2069, + "end": 2070, "loc": { "start": { - "line": 64, + "line": 65, "column": 15 }, "end": { - "line": 64, + "line": 65, "column": 16 } } @@ -12094,15 +12224,15 @@ "binop": null, "updateContext": null }, - "start": 2018, - "end": 2019, + "start": 2070, + "end": 2071, "loc": { "start": { - "line": 64, + "line": 65, "column": 16 }, "end": { - "line": 64, + "line": 65, "column": 17 } } @@ -12120,15 +12250,15 @@ "binop": null }, "value": "right", - "start": 2019, - "end": 2024, + "start": 2071, + "end": 2076, "loc": { "start": { - "line": 64, + "line": 65, "column": 17 }, "end": { - "line": 64, + "line": 65, "column": 22 } } @@ -12146,15 +12276,15 @@ "binop": null, "updateContext": null }, - "start": 2024, - "end": 2025, + "start": 2076, + "end": 2077, "loc": { "start": { - "line": 64, + "line": 65, "column": 22 }, "end": { - "line": 64, + "line": 65, "column": 23 } } @@ -12172,15 +12302,15 @@ "binop": null }, "value": "right", - "start": 2025, - "end": 2030, + "start": 2077, + "end": 2082, "loc": { "start": { - "line": 64, + "line": 65, "column": 23 }, "end": { - "line": 64, + "line": 65, "column": 28 } } @@ -12197,15 +12327,15 @@ "postfix": false, "binop": null }, - "start": 2030, - "end": 2031, + "start": 2082, + "end": 2083, "loc": { "start": { - "line": 64, + "line": 65, "column": 28 }, "end": { - "line": 64, + "line": 65, "column": 29 } } @@ -12223,15 +12353,15 @@ "binop": null, "updateContext": null }, - "start": 2031, - "end": 2032, + "start": 2083, + "end": 2084, "loc": { "start": { - "line": 64, + "line": 65, "column": 29 }, "end": { - "line": 64, + "line": 65, "column": 30 } } @@ -12249,15 +12379,15 @@ "binop": null }, "value": "assert", - "start": 2035, - "end": 2041, + "start": 2087, + "end": 2093, "loc": { "start": { - "line": 65, + "line": 66, "column": 2 }, "end": { - "line": 65, + "line": 66, "column": 8 } } @@ -12274,15 +12404,15 @@ "postfix": false, "binop": null }, - "start": 2041, - "end": 2042, + "start": 2093, + "end": 2094, "loc": { "start": { - "line": 65, + "line": 66, "column": 8 }, "end": { - "line": 65, + "line": 66, "column": 9 } } @@ -12300,15 +12430,15 @@ "binop": null }, "value": "g", - "start": 2042, - "end": 2043, + "start": 2094, + "end": 2095, "loc": { "start": { - "line": 65, + "line": 66, "column": 9 }, "end": { - "line": 65, + "line": 66, "column": 10 } } @@ -12326,15 +12456,15 @@ "binop": null, "updateContext": null }, - "start": 2043, - "end": 2044, + "start": 2095, + "end": 2096, "loc": { "start": { - "line": 65, + "line": 66, "column": 10 }, "end": { - "line": 65, + "line": 66, "column": 11 } } @@ -12352,15 +12482,15 @@ "binop": null }, "value": "left", - "start": 2044, - "end": 2048, + "start": 2096, + "end": 2100, "loc": { "start": { - "line": 65, + "line": 66, "column": 11 }, "end": { - "line": 65, + "line": 66, "column": 15 } } @@ -12379,15 +12509,15 @@ "updateContext": null }, "value": "===", - "start": 2049, - "end": 2052, + "start": 2101, + "end": 2104, "loc": { "start": { - "line": 65, + "line": 66, "column": 16 }, "end": { - "line": 65, + "line": 66, "column": 19 } } @@ -12407,15 +12537,15 @@ "updateContext": null }, "value": "null", - "start": 2053, - "end": 2057, + "start": 2105, + "end": 2109, "loc": { "start": { - "line": 65, + "line": 66, "column": 20 }, "end": { - "line": 65, + "line": 66, "column": 24 } } @@ -12434,15 +12564,15 @@ "updateContext": null }, "value": "||", - "start": 2058, - "end": 2060, + "start": 2110, + "end": 2112, "loc": { "start": { - "line": 65, + "line": 66, "column": 25 }, "end": { - "line": 65, + "line": 66, "column": 27 } } @@ -12460,15 +12590,15 @@ "binop": null }, "value": "g", - "start": 2061, - "end": 2062, + "start": 2113, + "end": 2114, "loc": { "start": { - "line": 65, + "line": 66, "column": 28 }, "end": { - "line": 65, + "line": 66, "column": 29 } } @@ -12486,15 +12616,15 @@ "binop": null, "updateContext": null }, - "start": 2062, - "end": 2063, + "start": 2114, + "end": 2115, "loc": { "start": { - "line": 65, + "line": 66, "column": 29 }, "end": { - "line": 65, + "line": 66, "column": 30 } } @@ -12512,15 +12642,15 @@ "binop": null }, "value": "left", - "start": 2063, - "end": 2067, + "start": 2115, + "end": 2119, "loc": { "start": { - "line": 65, + "line": 66, "column": 30 }, "end": { - "line": 65, + "line": 66, "column": 34 } } @@ -12538,15 +12668,15 @@ "binop": null, "updateContext": null }, - "start": 2067, - "end": 2068, + "start": 2119, + "end": 2120, "loc": { "start": { - "line": 65, + "line": 66, "column": 34 }, "end": { - "line": 65, + "line": 66, "column": 35 } } @@ -12564,15 +12694,15 @@ "binop": null }, "value": "_color", - "start": 2068, - "end": 2074, + "start": 2120, + "end": 2126, "loc": { "start": { - "line": 65, + "line": 66, "column": 35 }, "end": { - "line": 65, + "line": 66, "column": 41 } } @@ -12591,15 +12721,15 @@ "updateContext": null }, "value": "===", - "start": 2075, - "end": 2078, + "start": 2127, + "end": 2130, "loc": { "start": { - "line": 65, + "line": 66, "column": 42 }, "end": { - "line": 65, + "line": 66, "column": 45 } } @@ -12617,15 +12747,15 @@ "binop": null }, "value": "BLACK", - "start": 2079, - "end": 2084, + "start": 2131, + "end": 2136, "loc": { "start": { - "line": 65, + "line": 66, "column": 46 }, "end": { - "line": 65, + "line": 66, "column": 51 } } @@ -12642,15 +12772,15 @@ "postfix": false, "binop": null }, - "start": 2084, - "end": 2085, + "start": 2136, + "end": 2137, "loc": { "start": { - "line": 65, + "line": 66, "column": 51 }, "end": { - "line": 65, + "line": 66, "column": 52 } } @@ -12668,15 +12798,15 @@ "binop": null, "updateContext": null }, - "start": 2085, - "end": 2086, + "start": 2137, + "end": 2138, "loc": { "start": { - "line": 65, + "line": 66, "column": 52 }, "end": { - "line": 65, + "line": 66, "column": 53 } } @@ -12694,15 +12824,15 @@ "binop": null }, "value": "rotate_left", - "start": 2089, - "end": 2100, + "start": 2141, + "end": 2152, "loc": { "start": { - "line": 66, + "line": 67, "column": 2 }, "end": { - "line": 66, + "line": 67, "column": 13 } } @@ -12719,15 +12849,15 @@ "postfix": false, "binop": null }, - "start": 2100, - "end": 2101, + "start": 2152, + "end": 2153, "loc": { "start": { - "line": 66, + "line": 67, "column": 13 }, "end": { - "line": 66, + "line": 67, "column": 14 } } @@ -12745,15 +12875,15 @@ "binop": null }, "value": "g", - "start": 2101, - "end": 2102, + "start": 2153, + "end": 2154, "loc": { "start": { - "line": 66, + "line": 67, "column": 14 }, "end": { - "line": 66, + "line": 67, "column": 15 } } @@ -12770,15 +12900,15 @@ "postfix": false, "binop": null }, - "start": 2102, - "end": 2103, + "start": 2154, + "end": 2155, "loc": { "start": { - "line": 66, + "line": 67, "column": 15 }, "end": { - "line": 66, + "line": 67, "column": 16 } } @@ -12796,15 +12926,15 @@ "binop": null, "updateContext": null }, - "start": 2103, - "end": 2104, + "start": 2155, + "end": 2156, "loc": { "start": { - "line": 66, + "line": 67, "column": 16 }, "end": { - "line": 66, + "line": 67, "column": 17 } } @@ -12821,19 +12951,151 @@ "postfix": false, "binop": null }, - "start": 2106, - "end": 2107, + "start": 2158, + "end": 2159, "loc": { "start": { - "line": 67, + "line": 68, "column": 1 }, "end": { - "line": 67, + "line": 68, "column": 2 } } }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 2162, + "end": 2168, + "loc": { + "start": { + "line": 70, + "column": 1 + }, + "end": { + "line": 70, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "n", + "start": 2169, + "end": 2170, + "loc": { + "start": { + "line": 70, + "column": 8 + }, + "end": { + "line": 70, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2170, + "end": 2171, + "loc": { + "start": { + "line": 70, + "column": 9 + }, + "end": { + "line": 70, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 2171, + "end": 2177, + "loc": { + "start": { + "line": 70, + "column": 10 + }, + "end": { + "line": 70, + "column": 16 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2177, + "end": 2178, + "loc": { + "start": { + "line": 70, + "column": 16 + }, + "end": { + "line": 70, + "column": 17 + } + } + }, { "type": { "label": "}", @@ -12846,15 +13108,15 @@ "postfix": false, "binop": null }, - "start": 2108, - "end": 2109, + "start": 2179, + "end": 2180, "loc": { "start": { - "line": 68, + "line": 71, "column": 0 }, "end": { - "line": 68, + "line": 71, "column": 1 } } @@ -12872,15 +13134,15 @@ "binop": null, "updateContext": null }, - "start": 2109, - "end": 2110, + "start": 2180, + "end": 2181, "loc": { "start": { - "line": 68, + "line": 71, "column": 1 }, "end": { - "line": 68, + "line": 71, "column": 2 } } @@ -12900,15 +13162,15 @@ "updateContext": null }, "value": "export", - "start": 2112, - "end": 2118, + "start": 2183, + "end": 2189, "loc": { "start": { - "line": 70, + "line": 73, "column": 0 }, "end": { - "line": 70, + "line": 73, "column": 6 } } @@ -12928,15 +13190,15 @@ "updateContext": null }, "value": "default", - "start": 2119, - "end": 2126, + "start": 2190, + "end": 2197, "loc": { "start": { - "line": 70, + "line": 73, "column": 7 }, "end": { - "line": 70, + "line": 73, "column": 14 } } @@ -12954,15 +13216,15 @@ "binop": null }, "value": "insert_case4", - "start": 2127, - "end": 2139, + "start": 2198, + "end": 2210, "loc": { "start": { - "line": 70, + "line": 73, "column": 15 }, "end": { - "line": 70, + "line": 73, "column": 27 } } @@ -12980,15 +13242,15 @@ "binop": null, "updateContext": null }, - "start": 2139, - "end": 2140, + "start": 2210, + "end": 2211, "loc": { "start": { - "line": 70, + "line": 73, "column": 27 }, "end": { - "line": 70, + "line": 73, "column": 28 } } @@ -13006,15 +13268,15 @@ "binop": null, "updateContext": null }, - "start": 2141, - "end": 2141, + "start": 2212, + "end": 2212, "loc": { "start": { - "line": 71, + "line": 74, "column": 0 }, "end": { - "line": 71, + "line": 74, "column": 0 } } diff --git a/ast/source/rotate/rotate_left.js.json b/ast/source/rotate/rotate_left.js.json index 427772d..126c4a5 100644 --- a/ast/source/rotate/rotate_left.js.json +++ b/ast/source/rotate/rotate_left.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 825, + "end": 757, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 825, + "end": 757, "loc": { "start": { "line": 1, @@ -168,16 +168,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * A B\n * / \\ / \\\n * x B -> A y\n * / \\ / \\\n * b y x b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", "start": 67, - "end": 397, + "end": 412, "loc": { "start": { "line": 4, "column": 0 }, "end": { - "line": 17, + "line": 18, "column": 3 } } @@ -186,11 +186,11 @@ }, { "type": "Identifier", - "start": 399, - "end": 795, + "start": 414, + "end": 727, "loc": { "start": { - "line": 19, + "line": 20, "column": 0 }, "end": { @@ -201,11 +201,11 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 405, - "end": 794, + "start": 420, + "end": 726, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { @@ -215,15 +215,15 @@ }, "id": { "type": "Identifier", - "start": 405, - "end": 416, + "start": 420, + "end": 431, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 17 }, "identifierName": "rotate_left" @@ -233,11 +233,11 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 419, - "end": 794, + "start": 434, + "end": 726, "loc": { "start": { - "line": 19, + "line": 20, "column": 20 }, "end": { @@ -252,15 +252,15 @@ "params": [ { "type": "Identifier", - "start": 420, - "end": 421, + "start": 435, + "end": 436, "loc": { "start": { - "line": 19, + "line": 20, "column": 21 }, "end": { - "line": 19, + "line": 20, "column": 22 }, "identifierName": "A" @@ -270,11 +270,11 @@ ], "body": { "type": "BlockStatement", - "start": 426, - "end": 794, + "start": 441, + "end": 726, "loc": { "start": { - "line": 19, + "line": 20, "column": 27 }, "end": { @@ -285,43 +285,43 @@ "body": [ { "type": "ExpressionStatement", - "start": 429, - "end": 455, + "start": 444, + "end": 470, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 429, - "end": 454, + "start": 444, + "end": 469, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 429, - "end": 435, + "start": 444, + "end": 450, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -331,29 +331,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 436, - "end": 453, + "start": 451, + "end": 468, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 25 } }, "left": { "type": "Identifier", - "start": 436, - "end": 437, + "start": 451, + "end": 452, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 }, "identifierName": "A" @@ -363,15 +363,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 449, - "end": 453, + "start": 464, + "end": 468, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 }, "identifierName": "Node" @@ -384,44 +384,44 @@ }, { "type": "VariableDeclaration", - "start": 457, - "end": 475, + "start": 472, + "end": 490, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 19 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 463, - "end": 474, + "start": 478, + "end": 489, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 18 } }, "id": { "type": "Identifier", - "start": 463, - "end": 464, + "start": 478, + "end": 479, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 8 }, "identifierName": "B" @@ -430,29 +430,29 @@ }, "init": { "type": "MemberExpression", - "start": 467, - "end": 474, + "start": 482, + "end": 489, "loc": { "start": { - "line": 21, + "line": 22, "column": 11 }, "end": { - "line": 21, + "line": 22, "column": 18 } }, "object": { "type": "Identifier", - "start": 467, - "end": 468, + "start": 482, + "end": 483, "loc": { "start": { - "line": 21, + "line": 22, "column": 11 }, "end": { - "line": 21, + "line": 22, "column": 12 }, "identifierName": "A" @@ -461,15 +461,15 @@ }, "property": { "type": "Identifier", - "start": 469, - "end": 474, + "start": 484, + "end": 489, "loc": { "start": { - "line": 21, + "line": 22, "column": 13 }, "end": { - "line": 21, + "line": 22, "column": 18 }, "identifierName": "right" @@ -484,43 +484,43 @@ }, { "type": "ExpressionStatement", - "start": 477, - "end": 503, + "start": 492, + "end": 518, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 477, - "end": 502, + "start": 492, + "end": 517, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 477, - "end": 483, + "start": 492, + "end": 498, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -530,29 +530,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 484, - "end": 501, + "start": 499, + "end": 516, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 484, - "end": 485, + "start": 499, + "end": 500, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "B" @@ -562,15 +562,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 497, - "end": 501, + "start": 512, + "end": 516, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -583,75 +583,75 @@ }, { "type": "VariableDeclaration", - "start": 505, - "end": 522, + "start": 521, + "end": 540, "loc": { "start": { - "line": 23, + "line": 25, "column": 1 }, "end": { - "line": 23, - "column": 18 + "line": 25, + "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 511, - "end": 521, + "start": 527, + "end": 539, "loc": { "start": { - "line": 23, + "line": 25, "column": 7 }, "end": { - "line": 23, - "column": 17 + "line": 25, + "column": 19 } }, "id": { "type": "Identifier", - "start": 511, - "end": 512, + "start": 527, + "end": 528, "loc": { "start": { - "line": 23, + "line": 25, "column": 7 }, "end": { - "line": 23, + "line": 25, "column": 8 }, - "identifierName": "a" + "identifierName": "p" }, - "name": "a" + "name": "p" }, "init": { "type": "MemberExpression", - "start": 515, - "end": 521, + "start": 531, + "end": 539, "loc": { "start": { - "line": 23, + "line": 25, "column": 11 }, "end": { - "line": 23, - "column": 17 + "line": 25, + "column": 19 } }, "object": { "type": "Identifier", - "start": 515, - "end": 516, + "start": 531, + "end": 532, "loc": { "start": { - "line": 23, + "line": 25, "column": 11 }, "end": { - "line": 23, + "line": 25, "column": 12 }, "identifierName": "A" @@ -660,20 +660,20 @@ }, "property": { "type": "Identifier", - "start": 517, - "end": 521, + "start": 533, + "end": 539, "loc": { "start": { - "line": 23, + "line": 25, "column": 13 }, "end": { - "line": 23, - "column": 17 + "line": 25, + "column": 19 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false } @@ -682,806 +682,846 @@ "kind": "const" }, { - "type": "VariableDeclaration", - "start": 524, - "end": 541, + "type": "IfStatement", + "start": 542, + "end": 614, "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, - "column": 18 + "line": 29, + "column": 2 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 530, - "end": 540, + "test": { + "type": "BinaryExpression", + "start": 546, + "end": 556, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 546, + "end": 547, "loc": { "start": { - "line": 24, - "column": 7 + "line": 26, + "column": 5 }, "end": { - "line": 24, - "column": 17 - } + "line": 26, + "column": 6 + }, + "identifierName": "p" }, - "id": { - "type": "Identifier", - "start": 530, - "end": 531, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 - }, - "identifierName": "b" + "name": "p" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 552, + "end": 556, + "loc": { + "start": { + "line": 26, + "column": 11 }, - "name": "b" + "end": { + "line": 26, + "column": 15 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 558, + "end": 614, + "loc": { + "start": { + "line": 26, + "column": 17 }, - "init": { - "type": "MemberExpression", - "start": 534, - "end": 540, + "end": { + "line": 29, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 562, + "end": 611, "loc": { "start": { - "line": 24, - "column": 11 + "line": 27, + "column": 2 }, "end": { - "line": 24, - "column": 17 + "line": 28, + "column": 19 } }, - "object": { - "type": "Identifier", - "start": 534, - "end": 535, + "test": { + "type": "BinaryExpression", + "start": 566, + "end": 578, "loc": { "start": { - "line": 24, - "column": 11 + "line": 27, + "column": 6 }, "end": { - "line": 24, - "column": 12 + "line": 27, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 566, + "end": 567, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "A" }, - "identifierName": "B" + "name": "A" }, - "name": "B" + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 572, + "end": 578, + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 572, + "end": 573, + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 574, + "end": 578, + "loc": { + "start": { + "line": 27, + "column": 14 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } }, - "property": { - "type": "Identifier", - "start": 536, - "end": 540, + "consequent": { + "type": "ExpressionStatement", + "start": 580, + "end": 591, "loc": { "start": { - "line": 24, - "column": 13 + "line": 27, + "column": 20 }, "end": { - "line": 24, - "column": 17 - }, - "identifierName": "left" + "line": 27, + "column": 31 + } }, - "name": "left" - }, - "computed": false - } - } - ], - "kind": "const" - }, - { - "type": "VariableDeclaration", - "start": 543, - "end": 561, - "loc": { - "start": { - "line": 25, + "expression": { + "type": "AssignmentExpression", + "start": 580, + "end": 590, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 580, + "end": 586, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 580, + "end": 581, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 21 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 582, + "end": 586, + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 589, + "end": 590, + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 599, + "end": 611, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 599, + "end": 610, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 599, + "end": 606, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 599, + "end": 600, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 601, + "end": 606, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 14 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 18 + }, + "identifierName": "B" + }, + "name": "B" + } + } + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 617, + "end": 630, + "loc": { + "start": { + "line": 31, "column": 1 }, "end": { - "line": 25, - "column": 19 + "line": 31, + "column": 14 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 549, - "end": 560, + "expression": { + "type": "AssignmentExpression", + "start": 617, + "end": 629, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 617, + "end": 625, "loc": { "start": { - "line": 25, - "column": 7 + "line": 31, + "column": 1 }, "end": { - "line": 25, - "column": 18 + "line": 31, + "column": 9 } }, - "id": { + "object": { "type": "Identifier", - "start": 549, - "end": 550, + "start": 617, + "end": 618, "loc": { "start": { - "line": 25, - "column": 7 + "line": 31, + "column": 1 }, "end": { - "line": 25, - "column": 8 + "line": 31, + "column": 2 }, - "identifierName": "c" + "identifierName": "B" }, - "name": "c" + "name": "B" }, - "init": { - "type": "MemberExpression", - "start": 553, - "end": 560, + "property": { + "type": "Identifier", + "start": 619, + "end": 625, "loc": { "start": { - "line": 25, - "column": 11 + "line": 31, + "column": 3 }, "end": { - "line": 25, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 553, - "end": 554, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 12 - }, - "identifierName": "B" + "line": 31, + "column": 9 }, - "name": "B" + "identifierName": "parent" }, - "property": { - "type": "Identifier", - "start": 555, - "end": 560, - "loc": { - "start": { - "line": 25, - "column": 13 - }, - "end": { - "line": 25, - "column": 18 - }, - "identifierName": "right" - }, - "name": "right" + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 628, + "end": 629, + "loc": { + "start": { + "line": 31, + "column": 12 }, - "computed": false - } + "end": { + "line": 31, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" } - ], - "kind": "const" + } }, { "type": "ExpressionStatement", - "start": 564, - "end": 596, + "start": 632, + "end": 645, "loc": { "start": { - "line": 27, + "line": 32, "column": 1 }, "end": { - "line": 27, - "column": 33 + "line": 32, + "column": 14 } }, "expression": { "type": "AssignmentExpression", - "start": 564, - "end": 595, + "start": 632, + "end": 644, "loc": { "start": { - "line": 27, + "line": 32, "column": 1 }, "end": { - "line": 27, - "column": 32 + "line": 32, + "column": 13 } }, "operator": "=", "left": { - "type": "ArrayPattern", - "start": 564, - "end": 578, + "type": "MemberExpression", + "start": 632, + "end": 640, "loc": { "start": { - "line": 27, + "line": 32, "column": 1 }, "end": { - "line": 27, - "column": 15 + "line": 32, + "column": 9 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 565, - "end": 570, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 565, - "end": 566, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" + "object": { + "type": "Identifier", + "start": 632, + "end": 633, + "loc": { + "start": { + "line": 32, + "column": 1 }, - "property": { - "type": "Identifier", - "start": 567, - "end": 570, - "loc": { - "start": { - "line": 27, - "column": 4 - }, - "end": { - "line": 27, - "column": 7 - }, - "identifierName": "key" - }, - "name": "key" + "end": { + "line": 32, + "column": 2 }, - "computed": false + "identifierName": "A" }, - { - "type": "MemberExpression", - "start": 572, - "end": 577, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 572, - "end": 573, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 10 - }, - "identifierName": "B" - }, - "name": "B" + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 634, + "end": 640, + "loc": { + "start": { + "line": 32, + "column": 3 }, - "property": { - "type": "Identifier", - "start": 574, - "end": 577, - "loc": { - "start": { - "line": 27, - "column": 11 - }, - "end": { - "line": 27, - "column": 14 - }, - "identifierName": "key" - }, - "name": "key" + "end": { + "line": 32, + "column": 9 }, - "computed": false - } - ] + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, "right": { - "type": "ArrayExpression", - "start": 581, - "end": 595, + "type": "Identifier", + "start": 643, + "end": 644, "loc": { "start": { - "line": 27, - "column": 18 + "line": 32, + "column": 12 + }, + "end": { + "line": 32, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "VariableDeclaration", + "start": 648, + "end": 665, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 654, + "end": 664, + "loc": { + "start": { + "line": 34, + "column": 7 }, "end": { - "line": 27, - "column": 32 + "line": 34, + "column": 17 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 582, - "end": 587, + "id": { + "type": "Identifier", + "start": 654, + "end": 655, + "loc": { + "start": { + "line": 34, + "column": 7 + }, + "end": { + "line": 34, + "column": 8 + }, + "identifierName": "b" + }, + "name": "b" + }, + "init": { + "type": "MemberExpression", + "start": 658, + "end": 664, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 658, + "end": 659, "loc": { "start": { - "line": 27, - "column": 19 + "line": 34, + "column": 11 }, "end": { - "line": 27, - "column": 24 - } - }, - "object": { - "type": "Identifier", - "start": 582, - "end": 583, - "loc": { - "start": { - "line": 27, - "column": 19 - }, - "end": { - "line": 27, - "column": 20 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 584, - "end": 587, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 24 - }, - "identifierName": "key" + "line": 34, + "column": 12 }, - "name": "key" + "identifierName": "B" }, - "computed": false + "name": "B" }, - { - "type": "MemberExpression", - "start": 589, - "end": 594, + "property": { + "type": "Identifier", + "start": 660, + "end": 664, "loc": { "start": { - "line": 27, - "column": 26 + "line": 34, + "column": 13 }, "end": { - "line": 27, - "column": 31 - } - }, - "object": { - "type": "Identifier", - "start": 589, - "end": 590, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 27 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 591, - "end": 594, - "loc": { - "start": { - "line": 27, - "column": 28 - }, - "end": { - "line": 27, - "column": 31 - }, - "identifierName": "key" + "line": 34, + "column": 17 }, - "name": "key" + "identifierName": "left" }, - "computed": false - } - ] + "name": "left" + }, + "computed": false + } } - } + ], + "kind": "const" }, { "type": "ExpressionStatement", - "start": 598, - "end": 642, + "start": 667, + "end": 679, "loc": { "start": { - "line": 28, + "line": 35, "column": 1 }, "end": { - "line": 28, - "column": 45 + "line": 35, + "column": 13 } }, "expression": { "type": "AssignmentExpression", - "start": 598, - "end": 641, + "start": 667, + "end": 678, "loc": { "start": { - "line": 28, + "line": 35, "column": 1 }, "end": { - "line": 28, - "column": 44 + "line": 35, + "column": 12 } }, "operator": "=", "left": { - "type": "ArrayPattern", - "start": 598, - "end": 618, + "type": "MemberExpression", + "start": 667, + "end": 674, "loc": { "start": { - "line": 28, + "line": 35, "column": 1 }, "end": { - "line": 28, - "column": 21 + "line": 35, + "column": 8 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 599, - "end": 607, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 599, - "end": 600, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" + "object": { + "type": "Identifier", + "start": 667, + "end": 668, + "loc": { + "start": { + "line": 35, + "column": 1 }, - "property": { - "type": "Identifier", - "start": 601, - "end": 607, - "loc": { - "start": { - "line": 28, - "column": 4 - }, - "end": { - "line": 28, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 35, + "column": 2 }, - "computed": false + "identifierName": "A" }, - { - "type": "MemberExpression", - "start": 609, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 28, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 609, - "end": 610, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 28, - "column": 13 - }, - "identifierName": "B" - }, - "name": "B" + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 669, + "end": 674, + "loc": { + "start": { + "line": 35, + "column": 3 }, - "property": { - "type": "Identifier", - "start": 611, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 14 - }, - "end": { - "line": 28, - "column": 20 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 35, + "column": 8 }, - "computed": false - } - ] + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, "right": { - "type": "ArrayExpression", - "start": 621, - "end": 641, + "type": "Identifier", + "start": 677, + "end": 678, "loc": { "start": { - "line": 28, - "column": 24 + "line": 35, + "column": 11 }, "end": { - "line": 28, - "column": 44 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 622, - "end": 630, - "loc": { - "start": { - "line": 28, - "column": 25 - }, - "end": { - "line": 28, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 622, - "end": 623, - "loc": { - "start": { - "line": 28, - "column": 25 - }, - "end": { - "line": 28, - "column": 26 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 624, - "end": 630, - "loc": { - "start": { - "line": 28, - "column": 27 - }, - "end": { - "line": 28, - "column": 33 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false + "line": 35, + "column": 12 }, - { - "type": "MemberExpression", - "start": 632, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 35 - }, - "end": { - "line": 28, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 632, - "end": 633, - "loc": { - "start": { - "line": 28, - "column": 35 - }, - "end": { - "line": 28, - "column": 36 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 634, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 37 - }, - "end": { - "line": 28, - "column": 43 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] + "identifierName": "b" + }, + "name": "b" } } }, { "type": "ExpressionStatement", - "start": 645, - "end": 656, + "start": 681, + "end": 692, "loc": { "start": { - "line": 30, + "line": 36, "column": 1 }, "end": { - "line": 30, + "line": 36, "column": 12 } }, "expression": { "type": "AssignmentExpression", - "start": 645, - "end": 655, + "start": 681, + "end": 691, "loc": { "start": { - "line": 30, + "line": 36, "column": 1 }, "end": { - "line": 30, + "line": 36, "column": 11 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 645, - "end": 651, + "start": 681, + "end": 687, "loc": { "start": { - "line": 30, + "line": 36, "column": 1 }, "end": { - "line": 30, + "line": 36, "column": 7 } }, "object": { "type": "Identifier", - "start": 645, - "end": 646, + "start": 681, + "end": 682, "loc": { "start": { - "line": 30, + "line": 36, "column": 1 }, "end": { - "line": 30, + "line": 36, "column": 2 }, - "identifierName": "A" + "identifierName": "B" }, - "name": "A" + "name": "B" }, "property": { "type": "Identifier", - "start": 647, - "end": 651, + "start": 683, + "end": 687, "loc": { "start": { - "line": 30, + "line": 36, "column": 3 }, "end": { - "line": 30, + "line": 36, "column": 7 }, "identifierName": "left" @@ -1492,450 +1532,156 @@ }, "right": { "type": "Identifier", - "start": 654, - "end": 655, + "start": 690, + "end": 691, "loc": { "start": { - "line": 30, + "line": 36, "column": 10 }, "end": { - "line": 30, + "line": 36, "column": 11 }, - "identifierName": "B" + "identifierName": "A" }, - "name": "B" + "name": "A" } } }, { - "type": "ExpressionStatement", - "start": 658, - "end": 670, + "type": "IfStatement", + "start": 695, + "end": 724, "loc": { "start": { - "line": 31, + "line": 38, "column": 1 }, "end": { - "line": 31, - "column": 13 + "line": 38, + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 658, - "end": 669, + "test": { + "type": "BinaryExpression", + "start": 699, + "end": 709, "loc": { "start": { - "line": 31, - "column": 1 + "line": 38, + "column": 5 }, "end": { - "line": 31, - "column": 12 + "line": 38, + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 658, - "end": 665, + "type": "Identifier", + "start": 699, + "end": 700, "loc": { "start": { - "line": 31, - "column": 1 + "line": 38, + "column": 5 }, "end": { - "line": 31, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 658, - "end": 659, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 2 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 660, - "end": 665, - "loc": { - "start": { - "line": 31, - "column": 3 - }, - "end": { - "line": 31, - "column": 8 - }, - "identifierName": "right" + "line": 38, + "column": 6 }, - "name": "right" + "identifierName": "b" }, - "computed": false + "name": "b" }, + "operator": "!==", "right": { - "type": "Identifier", - "start": 668, - "end": 669, + "type": "NullLiteral", + "start": 705, + "end": 709, "loc": { "start": { - "line": 31, + "line": 38, "column": 11 }, "end": { - "line": 31, - "column": 12 - }, - "identifierName": "c" - }, - "name": "c" - } - } - }, - { - "type": "ExpressionStatement", - "start": 673, - "end": 684, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 12 + "line": 38, + "column": 15 + } + } } }, - "expression": { - "type": "AssignmentExpression", - "start": 673, - "end": 683, + "consequent": { + "type": "ExpressionStatement", + "start": 711, + "end": 724, "loc": { "start": { - "line": 33, - "column": 1 + "line": 38, + "column": 17 }, "end": { - "line": 33, - "column": 11 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 673, - "end": 679, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 673, - "end": 674, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 2 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 675, - "end": 679, - "loc": { - "start": { - "line": 33, - "column": 3 - }, - "end": { - "line": 33, - "column": 7 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 682, - "end": 683, - "loc": { - "start": { - "line": 33, - "column": 10 - }, - "end": { - "line": 33, - "column": 11 - }, - "identifierName": "a" - }, - "name": "a" - } - } - }, - { - "type": "ExpressionStatement", - "start": 686, - "end": 698, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 13 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 686, - "end": 697, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 12 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 686, - "end": 693, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 686, - "end": 687, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 2 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 688, - "end": 693, - "loc": { - "start": { - "line": 34, - "column": 3 - }, - "end": { - "line": 34, - "column": 8 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 696, - "end": 697, - "loc": { - "start": { - "line": 34, - "column": 11 - }, - "end": { - "line": 34, - "column": 12 - }, - "identifierName": "b" - }, - "name": "b" - } - } - }, - { - "type": "IfStatement", - "start": 701, - "end": 730, - "loc": { - "start": { - "line": 36, - "column": 1 - }, - "end": { - "line": 36, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 705, - "end": 715, - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 705, - "end": 706, - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 6 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 711, - "end": 715, - "loc": { - "start": { - "line": 36, - "column": 11 - }, - "end": { - "line": 36, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 717, - "end": 730, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 30 + "line": 38, + "column": 30 } }, "expression": { "type": "AssignmentExpression", - "start": 717, - "end": 729, + "start": 711, + "end": 723, "loc": { "start": { - "line": 36, + "line": 38, "column": 17 }, "end": { - "line": 36, + "line": 38, "column": 29 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 717, - "end": 725, + "start": 711, + "end": 719, "loc": { "start": { - "line": 36, + "line": 38, "column": 17 }, "end": { - "line": 36, + "line": 38, "column": 25 } }, "object": { "type": "Identifier", - "start": 717, - "end": 718, + "start": 711, + "end": 712, "loc": { "start": { - "line": 36, + "line": 38, "column": 17 }, "end": { - "line": 36, + "line": 38, "column": 18 }, - "identifierName": "a" + "identifierName": "b" }, - "name": "a" + "name": "b" }, "property": { "type": "Identifier", - "start": 719, - "end": 725, + "start": 713, + "end": 719, "loc": { "start": { - "line": 36, + "line": 38, "column": 19 }, "end": { - "line": 36, + "line": 38, "column": 25 }, "identifierName": "parent" @@ -1946,344 +1692,20 @@ }, "right": { "type": "Identifier", - "start": 728, - "end": 729, + "start": 722, + "end": 723, "loc": { "start": { - "line": 36, + "line": 38, "column": 28 }, "end": { - "line": 36, + "line": 38, "column": 29 }, - "identifierName": "B" + "identifierName": "A" }, - "name": "B" - } - } - }, - "alternate": null - }, - { - "type": "IfStatement", - "start": 732, - "end": 761, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 736, - "end": 746, - "loc": { - "start": { - "line": 37, - "column": 5 - }, - "end": { - "line": 37, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 736, - "end": 737, - "loc": { - "start": { - "line": 37, - "column": 5 - }, - "end": { - "line": 37, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 742, - "end": 746, - "loc": { - "start": { - "line": 37, - "column": 11 - }, - "end": { - "line": 37, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 748, - "end": 761, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 748, - "end": 760, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 748, - "end": 756, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 748, - "end": 749, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 18 - }, - "identifierName": "b" - }, - "name": "b" - }, - "property": { - "type": "Identifier", - "start": 750, - "end": 756, - "loc": { - "start": { - "line": 37, - "column": 19 - }, - "end": { - "line": 37, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 759, - "end": 760, - "loc": { - "start": { - "line": 37, - "column": 28 - }, - "end": { - "line": 37, - "column": 29 - }, - "identifierName": "B" - }, - "name": "B" - } - } - }, - "alternate": null - }, - { - "type": "IfStatement", - "start": 763, - "end": 792, - "loc": { - "start": { - "line": 38, - "column": 1 - }, - "end": { - "line": 38, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 767, - "end": 777, - "loc": { - "start": { - "line": 38, - "column": 5 - }, - "end": { - "line": 38, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 767, - "end": 768, - "loc": { - "start": { - "line": 38, - "column": 5 - }, - "end": { - "line": 38, - "column": 6 - }, - "identifierName": "c" - }, - "name": "c" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 773, - "end": 777, - "loc": { - "start": { - "line": 38, - "column": 11 - }, - "end": { - "line": 38, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 779, - "end": 792, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 779, - "end": 791, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 779, - "end": 787, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 779, - "end": 780, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 18 - }, - "identifierName": "c" - }, - "name": "c" - }, - "property": { - "type": "Identifier", - "start": 781, - "end": 787, - "loc": { - "start": { - "line": 38, - "column": 19 - }, - "end": { - "line": 38, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 790, - "end": 791, - "loc": { - "start": { - "line": 38, - "column": 28 - }, - "end": { - "line": 38, - "column": 29 - }, - "identifierName": "A" - }, - "name": "A" + "name": "A" } } }, @@ -2303,8 +1725,8 @@ }, { "type": "Identifier", - "start": 797, - "end": 824, + "start": 729, + "end": 756, "loc": { "start": { "line": 41, @@ -2317,8 +1739,8 @@ }, "declaration": { "type": "Identifier", - "start": 812, - "end": 823, + "start": 744, + "end": 755, "loc": { "start": { "line": 41, @@ -2338,8 +1760,8 @@ }, { "type": "ExportDefaultDeclaration", - "start": 797, - "end": 824, + "start": 729, + "end": 756, "loc": { "start": { "line": 41, @@ -2352,11 +1774,11 @@ }, "declaration": { "type": "VariableDeclaration", - "start": 399, - "end": 795, + "start": 414, + "end": 727, "loc": { "start": { - "line": 19, + "line": 20, "column": 0 }, "end": { @@ -2367,11 +1789,11 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 405, - "end": 794, + "start": 420, + "end": 726, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { @@ -2381,15 +1803,15 @@ }, "id": { "type": "Identifier", - "start": 405, - "end": 416, + "start": 420, + "end": 431, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 17 }, "identifierName": "rotate_left" @@ -2399,11 +1821,11 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 419, - "end": 794, + "start": 434, + "end": 726, "loc": { "start": { - "line": 19, + "line": 20, "column": 20 }, "end": { @@ -2413,15 +1835,15 @@ }, "id": { "type": "Identifier", - "start": 405, - "end": 416, + "start": 420, + "end": 431, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 17 }, "identifierName": "rotate_left" @@ -2435,15 +1857,15 @@ "params": [ { "type": "Identifier", - "start": 420, - "end": 421, + "start": 435, + "end": 436, "loc": { "start": { - "line": 19, + "line": 20, "column": 21 }, "end": { - "line": 19, + "line": 20, "column": 22 }, "identifierName": "A" @@ -2453,11 +1875,11 @@ ], "body": { "type": "BlockStatement", - "start": 426, - "end": 794, + "start": 441, + "end": 726, "loc": { "start": { - "line": 19, + "line": 20, "column": 27 }, "end": { @@ -2468,43 +1890,43 @@ "body": [ { "type": "ExpressionStatement", - "start": 429, - "end": 455, + "start": 444, + "end": 470, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 429, - "end": 454, + "start": 444, + "end": 469, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 429, - "end": 435, + "start": 444, + "end": 450, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -2514,29 +1936,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 436, - "end": 453, + "start": 451, + "end": 468, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 25 } }, "left": { "type": "Identifier", - "start": 436, - "end": 437, + "start": 451, + "end": 452, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 }, "identifierName": "A" @@ -2546,15 +1968,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 449, - "end": 453, + "start": 464, + "end": 468, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 }, "identifierName": "Node" @@ -2567,44 +1989,44 @@ }, { "type": "VariableDeclaration", - "start": 457, - "end": 475, + "start": 472, + "end": 490, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 19 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 463, - "end": 474, + "start": 478, + "end": 489, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 18 } }, "id": { "type": "Identifier", - "start": 463, - "end": 464, + "start": 478, + "end": 479, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 8 }, "identifierName": "B" @@ -2613,29 +2035,29 @@ }, "init": { "type": "MemberExpression", - "start": 467, - "end": 474, + "start": 482, + "end": 489, "loc": { "start": { - "line": 21, + "line": 22, "column": 11 }, "end": { - "line": 21, + "line": 22, "column": 18 } }, "object": { "type": "Identifier", - "start": 467, - "end": 468, + "start": 482, + "end": 483, "loc": { "start": { - "line": 21, + "line": 22, "column": 11 }, "end": { - "line": 21, + "line": 22, "column": 12 }, "identifierName": "A" @@ -2644,15 +2066,15 @@ }, "property": { "type": "Identifier", - "start": 469, - "end": 474, + "start": 484, + "end": 489, "loc": { "start": { - "line": 21, + "line": 22, "column": 13 }, "end": { - "line": 21, + "line": 22, "column": 18 }, "identifierName": "right" @@ -2667,43 +2089,43 @@ }, { "type": "ExpressionStatement", - "start": 477, - "end": 503, + "start": 492, + "end": 518, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 477, - "end": 502, + "start": 492, + "end": 517, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 477, - "end": 483, + "start": 492, + "end": 498, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -2713,29 +2135,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 484, - "end": 501, + "start": 499, + "end": 516, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 484, - "end": 485, + "start": 499, + "end": 500, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "B" @@ -2745,15 +2167,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 497, - "end": 501, + "start": 512, + "end": 516, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -2766,75 +2188,75 @@ }, { "type": "VariableDeclaration", - "start": 505, - "end": 522, + "start": 521, + "end": 540, "loc": { "start": { - "line": 23, + "line": 25, "column": 1 }, "end": { - "line": 23, - "column": 18 + "line": 25, + "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 511, - "end": 521, + "start": 527, + "end": 539, "loc": { "start": { - "line": 23, + "line": 25, "column": 7 }, "end": { - "line": 23, - "column": 17 + "line": 25, + "column": 19 } }, "id": { "type": "Identifier", - "start": 511, - "end": 512, + "start": 527, + "end": 528, "loc": { "start": { - "line": 23, + "line": 25, "column": 7 }, "end": { - "line": 23, + "line": 25, "column": 8 }, - "identifierName": "a" + "identifierName": "p" }, - "name": "a" + "name": "p" }, "init": { "type": "MemberExpression", - "start": 515, - "end": 521, + "start": 531, + "end": 539, "loc": { "start": { - "line": 23, + "line": 25, "column": 11 }, "end": { - "line": 23, - "column": 17 + "line": 25, + "column": 19 } }, "object": { "type": "Identifier", - "start": 515, - "end": 516, + "start": 531, + "end": 532, "loc": { "start": { - "line": 23, + "line": 25, "column": 11 }, "end": { - "line": 23, + "line": 25, "column": 12 }, "identifierName": "A" @@ -2843,20 +2265,20 @@ }, "property": { "type": "Identifier", - "start": 517, - "end": 521, + "start": 533, + "end": 539, "loc": { "start": { - "line": 23, + "line": 25, "column": 13 }, "end": { - "line": 23, - "column": 17 + "line": 25, + "column": 19 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false } @@ -2865,176 +2287,648 @@ "kind": "const" }, { - "type": "VariableDeclaration", - "start": 524, - "end": 541, + "type": "IfStatement", + "start": 542, + "end": 614, "loc": { "start": { - "line": 24, + "line": 26, "column": 1 }, "end": { - "line": 24, - "column": 18 + "line": 29, + "column": 2 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 530, - "end": 540, + "test": { + "type": "BinaryExpression", + "start": 546, + "end": 556, + "loc": { + "start": { + "line": 26, + "column": 5 + }, + "end": { + "line": 26, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 546, + "end": 547, "loc": { "start": { - "line": 24, - "column": 7 + "line": 26, + "column": 5 }, "end": { - "line": 24, - "column": 17 - } + "line": 26, + "column": 6 + }, + "identifierName": "p" }, - "id": { - "type": "Identifier", - "start": 530, - "end": 531, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 - }, - "identifierName": "b" + "name": "p" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 552, + "end": 556, + "loc": { + "start": { + "line": 26, + "column": 11 }, - "name": "b" + "end": { + "line": 26, + "column": 15 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 558, + "end": 614, + "loc": { + "start": { + "line": 26, + "column": 17 }, - "init": { - "type": "MemberExpression", - "start": 534, - "end": 540, + "end": { + "line": 29, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 562, + "end": 611, "loc": { "start": { - "line": 24, - "column": 11 + "line": 27, + "column": 2 }, "end": { - "line": 24, - "column": 17 + "line": 28, + "column": 19 } }, - "object": { - "type": "Identifier", - "start": 534, - "end": 535, + "test": { + "type": "BinaryExpression", + "start": 566, + "end": 578, "loc": { "start": { - "line": 24, - "column": 11 + "line": 27, + "column": 6 }, "end": { - "line": 24, - "column": 12 + "line": 27, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 566, + "end": 567, + "loc": { + "start": { + "line": 27, + "column": 6 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "A" }, - "identifierName": "B" + "name": "A" }, - "name": "B" + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 572, + "end": 578, + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 572, + "end": 573, + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 574, + "end": 578, + "loc": { + "start": { + "line": 27, + "column": 14 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } }, - "property": { - "type": "Identifier", - "start": 536, - "end": 540, + "consequent": { + "type": "ExpressionStatement", + "start": 580, + "end": 591, "loc": { "start": { - "line": 24, - "column": 13 + "line": 27, + "column": 20 }, "end": { - "line": 24, - "column": 17 - }, - "identifierName": "left" + "line": 27, + "column": 31 + } }, - "name": "left" + "expression": { + "type": "AssignmentExpression", + "start": 580, + "end": 590, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 580, + "end": 586, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 580, + "end": 581, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 21 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 582, + "end": 586, + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 589, + "end": 590, + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + }, + "identifierName": "B" + }, + "name": "B" + } + } }, - "computed": false + "alternate": { + "type": "ExpressionStatement", + "start": 599, + "end": 611, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 599, + "end": 610, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 599, + "end": 606, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 599, + "end": 600, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 601, + "end": 606, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 14 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 609, + "end": 610, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 18 + }, + "identifierName": "B" + }, + "name": "B" + } + } + } } - } - ], - "kind": "const" + ], + "directives": [] + }, + "alternate": null }, { - "type": "VariableDeclaration", - "start": 543, - "end": 561, + "type": "ExpressionStatement", + "start": 617, + "end": 630, "loc": { "start": { - "line": 25, + "line": 31, "column": 1 }, "end": { - "line": 25, - "column": 19 + "line": 31, + "column": 14 } }, - "declarations": [ - { + "expression": { + "type": "AssignmentExpression", + "start": 617, + "end": 629, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 617, + "end": 625, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 617, + "end": 618, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 619, + "end": 625, + "loc": { + "start": { + "line": 31, + "column": 3 + }, + "end": { + "line": 31, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 628, + "end": 629, + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" + } + } + }, + { + "type": "ExpressionStatement", + "start": 632, + "end": 645, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 632, + "end": 644, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 632, + "end": 640, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 632, + "end": 633, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 634, + "end": 640, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 643, + "end": 644, + "loc": { + "start": { + "line": 32, + "column": 12 + }, + "end": { + "line": 32, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "VariableDeclaration", + "start": 648, + "end": 665, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 18 + } + }, + "declarations": [ + { "type": "VariableDeclarator", - "start": 549, - "end": 560, + "start": 654, + "end": 664, "loc": { "start": { - "line": 25, + "line": 34, "column": 7 }, "end": { - "line": 25, - "column": 18 + "line": 34, + "column": 17 } }, "id": { "type": "Identifier", - "start": 549, - "end": 550, + "start": 654, + "end": 655, "loc": { "start": { - "line": 25, + "line": 34, "column": 7 }, "end": { - "line": 25, + "line": 34, "column": 8 }, - "identifierName": "c" + "identifierName": "b" }, - "name": "c" + "name": "b" }, "init": { "type": "MemberExpression", - "start": 553, - "end": 560, + "start": 658, + "end": 664, "loc": { "start": { - "line": 25, + "line": 34, "column": 11 }, "end": { - "line": 25, - "column": 18 + "line": 34, + "column": 17 } }, "object": { "type": "Identifier", - "start": 553, - "end": 554, + "start": 658, + "end": 659, "loc": { "start": { - "line": 25, + "line": 34, "column": 11 }, "end": { - "line": 25, + "line": 34, "column": 12 }, "identifierName": "B" @@ -3043,20 +2937,20 @@ }, "property": { "type": "Identifier", - "start": 555, - "end": 560, + "start": 660, + "end": 664, "loc": { "start": { - "line": 25, + "line": 34, "column": 13 }, "end": { - "line": 25, - "column": 18 + "line": 34, + "column": 17 }, - "identifierName": "right" + "identifierName": "left" }, - "name": "right" + "name": "left" }, "computed": false } @@ -3066,1408 +2960,358 @@ }, { "type": "ExpressionStatement", - "start": 564, - "end": 596, + "start": 667, + "end": 679, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, - "column": 33 + "line": 35, + "column": 13 } }, "expression": { "type": "AssignmentExpression", - "start": 564, - "end": 595, + "start": 667, + "end": 678, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, - "column": 32 + "line": 35, + "column": 12 } }, "operator": "=", "left": { - "type": "ArrayPattern", - "start": 564, - "end": 578, + "type": "MemberExpression", + "start": 667, + "end": 674, "loc": { "start": { - "line": 27, + "line": 35, "column": 1 }, "end": { - "line": 27, - "column": 15 + "line": 35, + "column": 8 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 565, - "end": 570, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 565, - "end": 566, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" + "object": { + "type": "Identifier", + "start": 667, + "end": 668, + "loc": { + "start": { + "line": 35, + "column": 1 }, - "property": { - "type": "Identifier", - "start": 567, - "end": 570, - "loc": { - "start": { - "line": 27, - "column": 4 - }, - "end": { - "line": 27, - "column": 7 - }, - "identifierName": "key" - }, - "name": "key" + "end": { + "line": 35, + "column": 2 }, - "computed": false + "identifierName": "A" }, - { - "type": "MemberExpression", - "start": 572, - "end": 577, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 14 - } + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 669, + "end": 674, + "loc": { + "start": { + "line": 35, + "column": 3 }, - "object": { - "type": "Identifier", - "start": 572, - "end": 573, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 10 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 574, - "end": 577, - "loc": { - "start": { - "line": 27, - "column": 11 - }, - "end": { - "line": 27, - "column": 14 - }, - "identifierName": "key" - }, - "name": "key" + "end": { + "line": 35, + "column": 8 }, - "computed": false - } - ] + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, "right": { - "type": "ArrayExpression", - "start": 581, - "end": 595, + "type": "Identifier", + "start": 677, + "end": 678, "loc": { "start": { - "line": 27, - "column": 18 + "line": 35, + "column": 11 }, "end": { - "line": 27, - "column": 32 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 582, - "end": 587, - "loc": { - "start": { - "line": 27, - "column": 19 - }, - "end": { - "line": 27, - "column": 24 - } - }, - "object": { - "type": "Identifier", - "start": 582, - "end": 583, - "loc": { - "start": { - "line": 27, - "column": 19 - }, - "end": { - "line": 27, - "column": 20 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 584, - "end": 587, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 24 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false + "line": 35, + "column": 12 }, - { - "type": "MemberExpression", - "start": 589, - "end": 594, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 31 - } - }, - "object": { - "type": "Identifier", - "start": 589, - "end": 590, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 27 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 591, - "end": 594, - "loc": { - "start": { - "line": 27, - "column": 28 - }, - "end": { - "line": 27, - "column": 31 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - } - ] + "identifierName": "b" + }, + "name": "b" } } }, { "type": "ExpressionStatement", - "start": 598, - "end": 642, + "start": 681, + "end": 692, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, - "column": 45 + "line": 36, + "column": 12 } }, "expression": { "type": "AssignmentExpression", - "start": 598, - "end": 641, + "start": 681, + "end": 691, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, - "column": 44 + "line": 36, + "column": 11 } }, "operator": "=", "left": { - "type": "ArrayPattern", - "start": 598, - "end": 618, + "type": "MemberExpression", + "start": 681, + "end": 687, "loc": { "start": { - "line": 28, + "line": 36, "column": 1 }, "end": { - "line": 28, - "column": 21 + "line": 36, + "column": 7 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 599, - "end": 607, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 599, - "end": 600, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" + "object": { + "type": "Identifier", + "start": 681, + "end": 682, + "loc": { + "start": { + "line": 36, + "column": 1 }, - "property": { - "type": "Identifier", - "start": 601, - "end": 607, - "loc": { - "start": { - "line": 28, - "column": 4 - }, - "end": { - "line": 28, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 36, + "column": 2 }, - "computed": false + "identifierName": "B" }, - { - "type": "MemberExpression", - "start": 609, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 28, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 609, - "end": 610, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 28, - "column": 13 - }, - "identifierName": "B" - }, - "name": "B" + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 683, + "end": 687, + "loc": { + "start": { + "line": 36, + "column": 3 }, - "property": { - "type": "Identifier", - "start": 611, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 14 - }, - "end": { - "line": 28, - "column": 20 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 36, + "column": 7 }, - "computed": false - } - ] + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, "right": { - "type": "ArrayExpression", - "start": 621, - "end": 641, + "type": "Identifier", + "start": 690, + "end": 691, "loc": { "start": { - "line": 28, - "column": 24 + "line": 36, + "column": 10 }, "end": { - "line": 28, - "column": 44 - } + "line": 36, + "column": 11 + }, + "identifierName": "A" }, - "elements": [ - { - "type": "MemberExpression", - "start": 622, - "end": 630, - "loc": { - "start": { - "line": 28, - "column": 25 - }, - "end": { - "line": 28, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 622, - "end": 623, - "loc": { - "start": { - "line": 28, - "column": 25 - }, - "end": { - "line": 28, - "column": 26 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 624, - "end": 630, - "loc": { - "start": { - "line": 28, - "column": 27 - }, - "end": { - "line": 28, - "column": 33 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 632, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 35 - }, - "end": { - "line": 28, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 632, - "end": 633, - "loc": { - "start": { - "line": 28, - "column": 35 - }, - "end": { - "line": 28, - "column": 36 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 634, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 37 - }, - "end": { - "line": 28, - "column": 43 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] + "name": "A" } } }, { - "type": "ExpressionStatement", - "start": 645, - "end": 656, + "type": "IfStatement", + "start": 695, + "end": 724, "loc": { "start": { - "line": 30, + "line": 38, "column": 1 }, "end": { - "line": 30, - "column": 12 + "line": 38, + "column": 30 } }, - "expression": { - "type": "AssignmentExpression", - "start": 645, - "end": 655, + "test": { + "type": "BinaryExpression", + "start": 699, + "end": 709, "loc": { "start": { - "line": 30, - "column": 1 + "line": 38, + "column": 5 }, "end": { - "line": 30, - "column": 11 + "line": 38, + "column": 15 } }, - "operator": "=", "left": { - "type": "MemberExpression", - "start": 645, - "end": 651, + "type": "Identifier", + "start": 699, + "end": 700, "loc": { "start": { - "line": 30, - "column": 1 + "line": 38, + "column": 5 }, "end": { - "line": 30, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 645, - "end": 646, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 2 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 647, - "end": 651, - "loc": { - "start": { - "line": 30, - "column": 3 - }, - "end": { - "line": 30, - "column": 7 - }, - "identifierName": "left" + "line": 38, + "column": 6 }, - "name": "left" + "identifierName": "b" }, - "computed": false + "name": "b" }, + "operator": "!==", "right": { - "type": "Identifier", - "start": 654, - "end": 655, + "type": "NullLiteral", + "start": 705, + "end": 709, "loc": { "start": { - "line": 30, - "column": 10 - }, - "end": { - "line": 30, + "line": 38, "column": 11 }, - "identifierName": "B" - }, - "name": "B" - } - } - }, - { - "type": "ExpressionStatement", - "start": 658, - "end": 670, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 13 + "end": { + "line": 38, + "column": 15 + } + } } }, - "expression": { - "type": "AssignmentExpression", - "start": 658, - "end": 669, + "consequent": { + "type": "ExpressionStatement", + "start": 711, + "end": 724, "loc": { "start": { - "line": 31, - "column": 1 + "line": 38, + "column": 17 }, "end": { - "line": 31, - "column": 12 + "line": 38, + "column": 30 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 658, - "end": 665, + "expression": { + "type": "AssignmentExpression", + "start": 711, + "end": 723, "loc": { "start": { - "line": 31, - "column": 1 + "line": 38, + "column": 17 }, "end": { - "line": 31, - "column": 8 + "line": 38, + "column": 29 } }, - "object": { - "type": "Identifier", - "start": 658, - "end": 659, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 711, + "end": 719, "loc": { "start": { - "line": 31, - "column": 1 + "line": 38, + "column": 17 }, "end": { - "line": 31, - "column": 2 + "line": 38, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 711, + "end": 712, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 18 + }, + "identifierName": "b" }, - "identifierName": "A" + "name": "b" }, - "name": "A" + "property": { + "type": "Identifier", + "start": 713, + "end": 719, + "loc": { + "start": { + "line": 38, + "column": 19 + }, + "end": { + "line": 38, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "property": { + "right": { "type": "Identifier", - "start": 660, - "end": 665, + "start": 722, + "end": 723, "loc": { "start": { - "line": 31, - "column": 3 + "line": 38, + "column": 28 }, "end": { - "line": 31, - "column": 8 + "line": 38, + "column": 29 }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 668, - "end": 669, - "loc": { - "start": { - "line": 31, - "column": 11 - }, - "end": { - "line": 31, - "column": 12 + "identifierName": "A" }, - "identifierName": "c" - }, - "name": "c" - } - } - }, - { - "type": "ExpressionStatement", - "start": 673, - "end": 684, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 12 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 673, - "end": 683, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 11 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 673, - "end": 679, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 673, - "end": 674, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 2 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 675, - "end": 679, - "loc": { - "start": { - "line": 33, - "column": 3 - }, - "end": { - "line": 33, - "column": 7 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 682, - "end": 683, - "loc": { - "start": { - "line": 33, - "column": 10 - }, - "end": { - "line": 33, - "column": 11 - }, - "identifierName": "a" - }, - "name": "a" - } - } - }, - { - "type": "ExpressionStatement", - "start": 686, - "end": 698, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 13 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 686, - "end": 697, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 12 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 686, - "end": 693, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 8 - } - }, - "object": { - "type": "Identifier", - "start": 686, - "end": 687, - "loc": { - "start": { - "line": 34, - "column": 1 - }, - "end": { - "line": 34, - "column": 2 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 688, - "end": 693, - "loc": { - "start": { - "line": 34, - "column": 3 - }, - "end": { - "line": 34, - "column": 8 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 696, - "end": 697, - "loc": { - "start": { - "line": 34, - "column": 11 - }, - "end": { - "line": 34, - "column": 12 - }, - "identifierName": "b" - }, - "name": "b" - } - } - }, - { - "type": "IfStatement", - "start": 701, - "end": 730, - "loc": { - "start": { - "line": 36, - "column": 1 - }, - "end": { - "line": 36, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 705, - "end": 715, - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 705, - "end": 706, - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 6 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 711, - "end": 715, - "loc": { - "start": { - "line": 36, - "column": 11 - }, - "end": { - "line": 36, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 717, - "end": 730, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 717, - "end": 729, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 717, - "end": 725, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 717, - "end": 718, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 18 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 719, - "end": 725, - "loc": { - "start": { - "line": 36, - "column": 19 - }, - "end": { - "line": 36, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 728, - "end": 729, - "loc": { - "start": { - "line": 36, - "column": 28 - }, - "end": { - "line": 36, - "column": 29 - }, - "identifierName": "B" - }, - "name": "B" - } - } - }, - "alternate": null - }, - { - "type": "IfStatement", - "start": 732, - "end": 761, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 736, - "end": 746, - "loc": { - "start": { - "line": 37, - "column": 5 - }, - "end": { - "line": 37, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 736, - "end": 737, - "loc": { - "start": { - "line": 37, - "column": 5 - }, - "end": { - "line": 37, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 742, - "end": 746, - "loc": { - "start": { - "line": 37, - "column": 11 - }, - "end": { - "line": 37, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 748, - "end": 761, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 748, - "end": 760, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 748, - "end": 756, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 748, - "end": 749, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 18 - }, - "identifierName": "b" - }, - "name": "b" - }, - "property": { - "type": "Identifier", - "start": 750, - "end": 756, - "loc": { - "start": { - "line": 37, - "column": 19 - }, - "end": { - "line": 37, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 759, - "end": 760, - "loc": { - "start": { - "line": 37, - "column": 28 - }, - "end": { - "line": 37, - "column": 29 - }, - "identifierName": "B" - }, - "name": "B" - } - } - }, - "alternate": null - }, - { - "type": "IfStatement", - "start": 763, - "end": 792, - "loc": { - "start": { - "line": 38, - "column": 1 - }, - "end": { - "line": 38, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 767, - "end": 777, - "loc": { - "start": { - "line": 38, - "column": 5 - }, - "end": { - "line": 38, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 767, - "end": 768, - "loc": { - "start": { - "line": 38, - "column": 5 - }, - "end": { - "line": 38, - "column": 6 - }, - "identifierName": "c" - }, - "name": "c" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 773, - "end": 777, - "loc": { - "start": { - "line": 38, - "column": 11 - }, - "end": { - "line": 38, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 779, - "end": 792, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 779, - "end": 791, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 779, - "end": 787, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 779, - "end": 780, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 18 - }, - "identifierName": "c" - }, - "name": "c" - }, - "property": { - "type": "Identifier", - "start": 781, - "end": 787, - "loc": { - "start": { - "line": 38, - "column": 19 - }, - "end": { - "line": 38, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 790, - "end": 791, - "loc": { - "start": { - "line": 38, - "column": 28 - }, - "end": { - "line": 38, - "column": 29 - }, - "identifierName": "A" - }, - "name": "A" - } + "name": "A" + } } }, "alternate": null @@ -4475,1099 +3319,60 @@ ], "directives": [] } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", - "start": 67, - "end": 397, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - } - ], - "trailingComments": [] - } - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", - "start": 67, - "end": 397, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 46, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", - "start": 67, - "end": 397, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 399, - "end": 404, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 19, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_left", - "start": 405, - "end": 416, - "loc": { - "start": { - "line": 19, - "column": 6 - }, - "end": { - "line": 19, - "column": 17 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 417, - "end": 418, - "loc": { - "start": { - "line": 19, - "column": 18 - }, - "end": { - "line": 19, - "column": 19 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 419, - "end": 420, - "loc": { - "start": { - "line": 19, - "column": 20 - }, - "end": { - "line": 19, - "column": 21 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "A", - "start": 420, - "end": 421, - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 421, - "end": 422, - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 23 - } - } - }, - { - "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 423, - "end": 425, - "loc": { - "start": { - "line": 19, - "column": 24 - }, - "end": { - "line": 19, - "column": 26 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 426, - "end": 427, - "loc": { - "start": { - "line": 19, - "column": 27 - }, - "end": { - "line": 19, - "column": 28 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 429, - "end": 435, - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 20, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 435, - "end": 436, - "loc": { - "start": { - "line": 20, - "column": 7 - }, - "end": { - "line": 20, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "A", - "start": 436, - "end": 437, - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 438, - "end": 448, - "loc": { - "start": { - "line": 20, - "column": 10 - }, - "end": { - "line": 20, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 449, - "end": 453, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 453, - "end": 454, - "loc": { - "start": { - "line": 20, - "column": 25 - }, - "end": { - "line": 20, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 454, - "end": 455, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 457, - "end": 462, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "B", - "start": 463, - "end": 464, - "loc": { - "start": { - "line": 21, - "column": 7 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 465, - "end": 466, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "A", - "start": 467, - "end": 468, - "loc": { - "start": { - "line": 21, - "column": 11 - }, - "end": { - "line": 21, - "column": 12 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 468, - "end": 469, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 469, - "end": 474, - "loc": { - "start": { - "line": 21, - "column": 13 - }, - "end": { - "line": 21, - "column": 18 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 474, - "end": 475, - "loc": { - "start": { - "line": 21, - "column": 18 - }, - "end": { - "line": 21, - "column": 19 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 477, - "end": 483, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 483, - "end": 484, - "loc": { - "start": { - "line": 22, - "column": 7 - }, - "end": { - "line": 22, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "B", - "start": 484, - "end": 485, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 486, - "end": 496, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 497, - "end": 501, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 501, - "end": 502, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 26 + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * A B\n * / \\ / \\\n * x B -> A y\n * / \\ / \\\n * b y x b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "start": 67, + "end": 412, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + } + ], + "trailingComments": [] } } - }, + ], + "directives": [] + }, + "comments": [ { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 502, - "end": 503, + "type": "CommentBlock", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * A B\n * / \\ / \\\n * x B -> A y\n * / \\ / \\\n * b y x b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "start": 67, + "end": 412, "loc": { "start": { - "line": 22, - "column": 26 + "line": 4, + "column": 0 }, "end": { - "line": 22, - "column": 27 + "line": 18, + "column": 3 } } - }, + } + ], + "tokens": [ { "type": { - "label": "const", - "keyword": "const", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5576,16 +3381,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 505, - "end": 510, + "value": "import", + "start": 0, + "end": 6, "loc": { "start": { - "line": 23, - "column": 1 + "line": 1, + "column": 0 }, "end": { - "line": 23, + "line": 1, "column": 6 } } @@ -5602,44 +3407,17 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 511, - "end": 512, + "value": "assert", + "start": 7, + "end": 13, "loc": { "start": { - "line": 23, + "line": 1, "column": 7 }, "end": { - "line": 23, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 513, - "end": 514, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 10 + "line": 1, + "column": 13 } } }, @@ -5655,25 +3433,25 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 515, - "end": 516, + "value": "from", + "start": 14, + "end": 18, "loc": { "start": { - "line": 23, - "column": 11 + "line": 1, + "column": 14 }, "end": { - "line": 23, - "column": 12 + "line": 1, + "column": 18 } } }, { "type": { - "label": ".", + "label": "string", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5682,42 +3460,17 @@ "binop": null, "updateContext": null }, - "start": 516, - "end": 517, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 517, - "end": 521, + "value": "assert", + "start": 19, + "end": 27, "loc": { "start": { - "line": 23, - "column": 13 + "line": 1, + "column": 19 }, "end": { - "line": 23, - "column": 17 + "line": 1, + "column": 27 } } }, @@ -5734,25 +3487,25 @@ "binop": null, "updateContext": null }, - "start": 521, - "end": 522, + "start": 27, + "end": 28, "loc": { "start": { - "line": 23, - "column": 17 + "line": 1, + "column": 27 }, "end": { - "line": 23, - "column": 18 + "line": 1, + "column": 28 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5761,16 +3514,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 524, - "end": 529, + "value": "import", + "start": 29, + "end": 35, "loc": { "start": { - "line": 24, - "column": 1 + "line": 2, + "column": 0 }, "end": { - "line": 24, + "line": 2, "column": 6 } } @@ -5787,44 +3540,17 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 530, - "end": 531, + "value": "Node", + "start": 36, + "end": 40, "loc": { "start": { - "line": 24, + "line": 2, "column": 7 }, "end": { - "line": 24, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 532, - "end": 533, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 10 + "line": 2, + "column": 11 } } }, @@ -5840,25 +3566,25 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 534, - "end": 535, + "value": "from", + "start": 41, + "end": 45, "loc": { "start": { - "line": 24, - "column": 11 + "line": 2, + "column": 12 }, "end": { - "line": 24, - "column": 12 + "line": 2, + "column": 16 } } }, { "type": { - "label": ".", + "label": "string", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5867,68 +3593,59 @@ "binop": null, "updateContext": null }, - "start": 535, - "end": 536, + "value": "../types/Node.js", + "start": 46, + "end": 64, "loc": { "start": { - "line": 24, - "column": 12 + "line": 2, + "column": 17 }, "end": { - "line": 24, - "column": 13 + "line": 2, + "column": 35 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "left", - "start": 536, - "end": 540, + "start": 64, + "end": 65, "loc": { "start": { - "line": 24, - "column": 13 + "line": 2, + "column": 35 }, "end": { - "line": 24, - "column": 17 + "line": 2, + "column": 36 } } }, { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 540, - "end": 541, + "type": "CommentBlock", + "value": "*\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * A B\n * / \\ / \\\n * x B -> A y\n * / \\ / \\\n * b y x b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n ", + "start": 67, + "end": 412, "loc": { "start": { - "line": 24, - "column": 17 + "line": 4, + "column": 0 }, "end": { - "line": 24, - "column": 18 + "line": 18, + "column": 3 } } }, @@ -5947,16 +3664,16 @@ "updateContext": null }, "value": "const", - "start": 543, - "end": 548, + "start": 414, + "end": 419, "loc": { "start": { - "line": 25, - "column": 1 + "line": 20, + "column": 0 }, "end": { - "line": 25, - "column": 6 + "line": 20, + "column": 5 } } }, @@ -5972,17 +3689,17 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 549, - "end": 550, + "value": "rotate_left", + "start": 420, + "end": 431, "loc": { "start": { - "line": 25, - "column": 7 + "line": 20, + "column": 6 }, "end": { - "line": 25, - "column": 8 + "line": 20, + "column": 17 } } }, @@ -6000,23 +3717,23 @@ "updateContext": null }, "value": "=", - "start": 551, - "end": 552, + "start": 432, + "end": 433, "loc": { "start": { - "line": 25, - "column": 9 + "line": 20, + "column": 18 }, "end": { - "line": 25, - "column": 10 + "line": 20, + "column": 19 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6025,43 +3742,16 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 553, - "end": 554, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 12 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 554, - "end": 555, + "start": 434, + "end": 435, "loc": { "start": { - "line": 25, - "column": 12 + "line": 20, + "column": 20 }, "end": { - "line": 25, - "column": 13 + "line": 20, + "column": 21 } } }, @@ -6077,51 +3767,50 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 555, - "end": 560, + "value": "A", + "start": 435, + "end": 436, "loc": { "start": { - "line": 25, - "column": 13 + "line": 20, + "column": 21 }, "end": { - "line": 25, - "column": 18 + "line": 20, + "column": 22 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 560, - "end": 561, + "start": 436, + "end": 437, "loc": { "start": { - "line": 25, - "column": 18 + "line": 20, + "column": 22 }, "end": { - "line": 25, - "column": 19 + "line": 20, + "column": 23 } } }, { "type": { - "label": "[", + "label": "=>", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6130,23 +3819,23 @@ "binop": null, "updateContext": null }, - "start": 564, - "end": 565, + "start": 438, + "end": 440, "loc": { "start": { - "line": 27, - "column": 1 + "line": 20, + "column": 24 }, "end": { - "line": 27, - "column": 2 + "line": 20, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6155,43 +3844,16 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 565, - "end": 566, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 566, - "end": 567, + "start": 441, + "end": 442, "loc": { "start": { - "line": 27, - "column": 3 + "line": 20, + "column": 27 }, "end": { - "line": 27, - "column": 4 + "line": 20, + "column": 28 } } }, @@ -6207,42 +3869,41 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 567, - "end": 570, + "value": "assert", + "start": 444, + "end": 450, "loc": { "start": { - "line": 27, - "column": 4 + "line": 21, + "column": 1 }, "end": { - "line": 27, + "line": 21, "column": 7 } } }, { "type": { - "label": ",", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 570, - "end": 571, + "start": 450, + "end": 451, "loc": { "start": { - "line": 27, + "line": 21, "column": 7 }, "end": { - "line": 27, + "line": 21, "column": 8 } } @@ -6259,43 +3920,45 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 572, - "end": 573, + "value": "A", + "start": 451, + "end": 452, "loc": { "start": { - "line": 27, - "column": 9 + "line": 21, + "column": 8 }, "end": { - "line": 27, - "column": 10 + "line": 21, + "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 573, - "end": 574, + "value": "instanceof", + "start": 453, + "end": 463, "loc": { "start": { - "line": 27, + "line": 21, "column": 10 }, "end": { - "line": 27, - "column": 11 + "line": 21, + "column": 20 } } }, @@ -6311,23 +3974,23 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 574, - "end": 577, + "value": "Node", + "start": 464, + "end": 468, "loc": { "start": { - "line": 27, - "column": 11 + "line": 21, + "column": 21 }, "end": { - "line": 27, - "column": 14 + "line": 21, + "column": 25 } } }, { "type": { - "label": "]", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6335,54 +3998,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 577, - "end": 578, + "start": 468, + "end": 469, "loc": { "start": { - "line": 27, - "column": 14 + "line": 21, + "column": 25 }, "end": { - "line": 27, - "column": 15 + "line": 21, + "column": 26 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 579, - "end": 580, + "start": 469, + "end": 470, "loc": { "start": { - "line": 27, - "column": 16 + "line": 21, + "column": 26 }, "end": { - "line": 27, - "column": 17 + "line": 21, + "column": 27 } } }, { "type": { - "label": "[", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6391,16 +4053,17 @@ "binop": null, "updateContext": null }, - "start": 581, - "end": 582, + "value": "const", + "start": 472, + "end": 477, "loc": { "start": { - "line": 27, - "column": 18 + "line": 22, + "column": 1 }, "end": { - "line": 27, - "column": 19 + "line": 22, + "column": 6 } } }, @@ -6417,42 +4080,43 @@ "binop": null }, "value": "B", - "start": 582, - "end": 583, + "start": 478, + "end": 479, "loc": { "start": { - "line": 27, - "column": 19 + "line": 22, + "column": 7 }, "end": { - "line": 27, - "column": 20 + "line": 22, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 583, - "end": 584, + "value": "=", + "start": 480, + "end": 481, "loc": { "start": { - "line": 27, - "column": 20 + "line": 22, + "column": 9 }, "end": { - "line": 27, - "column": 21 + "line": 22, + "column": 10 } } }, @@ -6468,24 +4132,24 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 584, - "end": 587, + "value": "A", + "start": 482, + "end": 483, "loc": { "start": { - "line": 27, - "column": 21 + "line": 22, + "column": 11 }, "end": { - "line": 27, - "column": 24 + "line": 22, + "column": 12 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6495,16 +4159,16 @@ "binop": null, "updateContext": null }, - "start": 587, - "end": 588, + "start": 483, + "end": 484, "loc": { "start": { - "line": 27, - "column": 24 + "line": 22, + "column": 12 }, "end": { - "line": 27, - "column": 25 + "line": 22, + "column": 13 } } }, @@ -6520,24 +4184,24 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 589, - "end": 590, + "value": "right", + "start": 484, + "end": 489, "loc": { "start": { - "line": 27, - "column": 26 + "line": 22, + "column": 13 }, "end": { - "line": 27, - "column": 27 + "line": 22, + "column": 18 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6547,16 +4211,16 @@ "binop": null, "updateContext": null }, - "start": 590, - "end": 591, + "start": 489, + "end": 490, "loc": { "start": { - "line": 27, - "column": 27 + "line": 22, + "column": 18 }, "end": { - "line": 27, - "column": 28 + "line": 22, + "column": 19 } } }, @@ -6572,95 +4236,96 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 591, - "end": 594, + "value": "assert", + "start": 492, + "end": 498, "loc": { "start": { - "line": 27, - "column": 28 + "line": 23, + "column": 1 }, "end": { - "line": 27, - "column": 31 + "line": 23, + "column": 7 } } }, { "type": { - "label": "]", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 594, - "end": 595, + "start": 498, + "end": 499, "loc": { "start": { - "line": 27, - "column": 31 + "line": 23, + "column": 7 }, "end": { - "line": 27, - "column": 32 + "line": 23, + "column": 8 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 595, - "end": 596, + "value": "B", + "start": 499, + "end": 500, "loc": { "start": { - "line": 27, - "column": 32 + "line": 23, + "column": 8 }, "end": { - "line": 27, - "column": 33 + "line": 23, + "column": 9 } } }, { "type": { - "label": "[", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 598, - "end": 599, + "value": "instanceof", + "start": 501, + "end": 511, "loc": { "start": { - "line": 28, - "column": 1 + "line": 23, + "column": 10 }, "end": { - "line": 28, - "column": 2 + "line": 23, + "column": 20 } } }, @@ -6676,23 +4341,23 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 599, - "end": 600, + "value": "Node", + "start": 512, + "end": 516, "loc": { "start": { - "line": 28, - "column": 2 + "line": 23, + "column": 21 }, "end": { - "line": 28, - "column": 3 + "line": 23, + "column": 25 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6700,52 +4365,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 600, - "end": 601, + "start": 516, + "end": 517, "loc": { "start": { - "line": 28, - "column": 3 + "line": 23, + "column": 25 }, "end": { - "line": 28, - "column": 4 + "line": 23, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_color", - "start": 601, - "end": 607, + "start": 517, + "end": 518, "loc": { "start": { - "line": 28, - "column": 4 + "line": 23, + "column": 26 }, "end": { - "line": 28, - "column": 10 + "line": 23, + "column": 27 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6755,16 +4420,17 @@ "binop": null, "updateContext": null }, - "start": 607, - "end": 608, + "value": "const", + "start": 521, + "end": 526, "loc": { "start": { - "line": 28, - "column": 10 + "line": 25, + "column": 1 }, "end": { - "line": 28, - "column": 11 + "line": 25, + "column": 6 } } }, @@ -6780,43 +4446,44 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 609, - "end": 610, + "value": "p", + "start": 527, + "end": 528, "loc": { "start": { - "line": 28, - "column": 12 + "line": 25, + "column": 7 }, "end": { - "line": 28, - "column": 13 + "line": 25, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 610, - "end": 611, + "value": "=", + "start": 529, + "end": 530, "loc": { "start": { - "line": 28, - "column": 13 + "line": 25, + "column": 9 }, "end": { - "line": 28, - "column": 14 + "line": 25, + "column": 10 } } }, @@ -6832,23 +4499,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 611, - "end": 617, + "value": "A", + "start": 531, + "end": 532, "loc": { "start": { - "line": 28, - "column": 14 + "line": 25, + "column": 11 }, "end": { - "line": 28, - "column": 20 + "line": 25, + "column": 12 } } }, { "type": { - "label": "]", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6859,51 +4526,50 @@ "binop": null, "updateContext": null }, - "start": 617, - "end": 618, + "start": 532, + "end": 533, "loc": { - "start": { - "line": 28, - "column": 20 + "start": { + "line": 25, + "column": 12 }, "end": { - "line": 28, - "column": 21 + "line": 25, + "column": 13 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 619, - "end": 620, + "value": "parent", + "start": 533, + "end": 539, "loc": { "start": { - "line": 28, - "column": 22 + "line": 25, + "column": 13 }, "end": { - "line": 28, - "column": 23 + "line": 25, + "column": 19 } } }, { "type": { - "label": "[", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6912,68 +4578,69 @@ "binop": null, "updateContext": null }, - "start": 621, - "end": 622, + "start": 539, + "end": 540, "loc": { "start": { - "line": 28, - "column": 24 + "line": 25, + "column": 19 }, "end": { - "line": 28, - "column": 25 + "line": 25, + "column": 20 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "B", - "start": 622, - "end": 623, + "value": "if", + "start": 542, + "end": 544, "loc": { "start": { - "line": 28, - "column": 25 + "line": 26, + "column": 1 }, "end": { - "line": 28, - "column": 26 + "line": 26, + "column": 3 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 623, - "end": 624, + "start": 545, + "end": 546, "loc": { "start": { - "line": 28, - "column": 26 + "line": 26, + "column": 4 }, "end": { - "line": 28, - "column": 27 + "line": 26, + "column": 5 } } }, @@ -6989,23 +4656,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 624, - "end": 630, + "value": "p", + "start": 546, + "end": 547, "loc": { "start": { - "line": 28, - "column": 27 + "line": 26, + "column": 5 }, "end": { - "line": 28, - "column": 33 + "line": 26, + "column": 6 } } }, { "type": { - "label": ",", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7013,25 +4680,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 630, - "end": 631, + "value": "!==", + "start": 548, + "end": 551, "loc": { "start": { - "line": 28, - "column": 33 + "line": 26, + "column": 7 }, "end": { - "line": 28, - "column": 34 + "line": 26, + "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7039,25 +4708,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "A", - "start": 632, - "end": 633, + "value": "null", + "start": 552, + "end": 556, "loc": { "start": { - "line": 28, - "column": 35 + "line": 26, + "column": 11 }, "end": { - "line": 28, - "column": 36 + "line": 26, + "column": 15 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7065,26 +4735,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 633, - "end": 634, + "start": 556, + "end": 557, "loc": { "start": { - "line": 28, - "column": 36 + "line": 26, + "column": 15 }, "end": { - "line": 28, - "column": 37 + "line": 26, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7093,23 +4762,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 634, - "end": 640, + "start": 558, + "end": 559, "loc": { "start": { - "line": 28, - "column": 37 + "line": 26, + "column": 17 }, "end": { - "line": 28, - "column": 43 + "line": 26, + "column": 18 } } }, { "type": { - "label": "]", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7120,42 +4789,42 @@ "binop": null, "updateContext": null }, - "start": 640, - "end": 641, + "value": "if", + "start": 562, + "end": 564, "loc": { "start": { - "line": 28, - "column": 43 + "line": 27, + "column": 2 }, "end": { - "line": 28, - "column": 44 + "line": 27, + "column": 4 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 641, - "end": 642, + "start": 565, + "end": 566, "loc": { "start": { - "line": 28, - "column": 44 + "line": 27, + "column": 5 }, "end": { - "line": 28, - "column": 45 + "line": 27, + "column": 6 } } }, @@ -7172,42 +4841,43 @@ "binop": null }, "value": "A", - "start": 645, - "end": 646, + "start": 566, + "end": 567, "loc": { "start": { - "line": 30, - "column": 1 + "line": 27, + "column": 6 }, "end": { - "line": 30, - "column": 2 + "line": 27, + "column": 7 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 646, - "end": 647, + "value": "===", + "start": 568, + "end": 571, "loc": { "start": { - "line": 30, - "column": 2 + "line": 27, + "column": 8 }, "end": { - "line": 30, - "column": 3 + "line": 27, + "column": 11 } } }, @@ -7223,44 +4893,43 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 647, - "end": 651, + "value": "p", + "start": 572, + "end": 573, "loc": { "start": { - "line": 30, - "column": 3 + "line": 27, + "column": 12 }, "end": { - "line": 30, - "column": 7 + "line": 27, + "column": 13 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 652, - "end": 653, + "start": 573, + "end": 574, "loc": { "start": { - "line": 30, - "column": 8 + "line": 27, + "column": 13 }, "end": { - "line": 30, - "column": 9 + "line": 27, + "column": 14 } } }, @@ -7276,43 +4945,42 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 654, - "end": 655, + "value": "left", + "start": 574, + "end": 578, "loc": { "start": { - "line": 30, - "column": 10 + "line": 27, + "column": 14 }, "end": { - "line": 30, - "column": 11 + "line": 27, + "column": 18 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 655, - "end": 656, + "start": 578, + "end": 579, "loc": { "start": { - "line": 30, - "column": 11 + "line": 27, + "column": 18 }, "end": { - "line": 30, - "column": 12 + "line": 27, + "column": 19 } } }, @@ -7328,17 +4996,17 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 658, - "end": 659, + "value": "p", + "start": 580, + "end": 581, "loc": { "start": { - "line": 31, - "column": 1 + "line": 27, + "column": 20 }, "end": { - "line": 31, - "column": 2 + "line": 27, + "column": 21 } } }, @@ -7355,16 +5023,16 @@ "binop": null, "updateContext": null }, - "start": 659, - "end": 660, + "start": 581, + "end": 582, "loc": { "start": { - "line": 31, - "column": 2 + "line": 27, + "column": 21 }, "end": { - "line": 31, - "column": 3 + "line": 27, + "column": 22 } } }, @@ -7380,17 +5048,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 660, - "end": 665, + "value": "left", + "start": 582, + "end": 586, "loc": { "start": { - "line": 31, - "column": 3 + "line": 27, + "column": 22 }, - "end": { - "line": 31, - "column": 8 + "end": { + "line": 27, + "column": 26 } } }, @@ -7408,16 +5076,16 @@ "updateContext": null }, "value": "=", - "start": 666, - "end": 667, + "start": 587, + "end": 588, "loc": { "start": { - "line": 31, - "column": 9 + "line": 27, + "column": 27 }, "end": { - "line": 31, - "column": 10 + "line": 27, + "column": 28 } } }, @@ -7433,17 +5101,17 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 668, - "end": 669, + "value": "B", + "start": 589, + "end": 590, "loc": { "start": { - "line": 31, - "column": 11 + "line": 27, + "column": 29 }, "end": { - "line": 31, - "column": 12 + "line": 27, + "column": 30 } } }, @@ -7460,16 +5128,44 @@ "binop": null, "updateContext": null }, - "start": 669, - "end": 670, + "start": 590, + "end": 591, "loc": { "start": { - "line": 31, - "column": 12 + "line": 27, + "column": 30 }, "end": { - "line": 31, - "column": 13 + "line": 27, + "column": 31 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 594, + "end": 598, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 6 } } }, @@ -7485,17 +5181,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 673, - "end": 674, + "value": "p", + "start": 599, + "end": 600, "loc": { "start": { - "line": 33, - "column": 1 + "line": 28, + "column": 7 }, "end": { - "line": 33, - "column": 2 + "line": 28, + "column": 8 } } }, @@ -7512,16 +5208,16 @@ "binop": null, "updateContext": null }, - "start": 674, - "end": 675, + "start": 600, + "end": 601, "loc": { "start": { - "line": 33, - "column": 2 + "line": 28, + "column": 8 }, "end": { - "line": 33, - "column": 3 + "line": 28, + "column": 9 } } }, @@ -7537,17 +5233,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 675, - "end": 679, + "value": "right", + "start": 601, + "end": 606, "loc": { "start": { - "line": 33, - "column": 3 + "line": 28, + "column": 9 }, "end": { - "line": 33, - "column": 7 + "line": 28, + "column": 14 } } }, @@ -7565,16 +5261,16 @@ "updateContext": null }, "value": "=", - "start": 680, - "end": 681, + "start": 607, + "end": 608, "loc": { "start": { - "line": 33, - "column": 8 + "line": 28, + "column": 15 }, "end": { - "line": 33, - "column": 9 + "line": 28, + "column": 16 } } }, @@ -7590,17 +5286,17 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 682, - "end": 683, + "value": "B", + "start": 609, + "end": 610, "loc": { "start": { - "line": 33, - "column": 10 + "line": 28, + "column": 17 }, "end": { - "line": 33, - "column": 11 + "line": 28, + "column": 18 } } }, @@ -7617,16 +5313,41 @@ "binop": null, "updateContext": null }, - "start": 683, - "end": 684, + "start": 610, + "end": 611, "loc": { "start": { - "line": 33, - "column": 11 + "line": 28, + "column": 18 }, "end": { - "line": 33, - "column": 12 + "line": 28, + "column": 19 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 613, + "end": 614, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 } } }, @@ -7643,15 +5364,15 @@ "binop": null }, "value": "B", - "start": 686, - "end": 687, + "start": 617, + "end": 618, "loc": { "start": { - "line": 34, + "line": 31, "column": 1 }, "end": { - "line": 34, + "line": 31, "column": 2 } } @@ -7669,15 +5390,15 @@ "binop": null, "updateContext": null }, - "start": 687, - "end": 688, + "start": 618, + "end": 619, "loc": { "start": { - "line": 34, + "line": 31, "column": 2 }, "end": { - "line": 34, + "line": 31, "column": 3 } } @@ -7694,17 +5415,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 688, - "end": 693, + "value": "parent", + "start": 619, + "end": 625, "loc": { "start": { - "line": 34, + "line": 31, "column": 3 }, "end": { - "line": 34, - "column": 8 + "line": 31, + "column": 9 } } }, @@ -7722,16 +5443,16 @@ "updateContext": null }, "value": "=", - "start": 694, - "end": 695, + "start": 626, + "end": 627, "loc": { "start": { - "line": 34, - "column": 9 + "line": 31, + "column": 10 }, "end": { - "line": 34, - "column": 10 + "line": 31, + "column": 11 } } }, @@ -7747,17 +5468,17 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 696, - "end": 697, + "value": "p", + "start": 628, + "end": 629, "loc": { "start": { - "line": 34, - "column": 11 + "line": 31, + "column": 12 }, "end": { - "line": 34, - "column": 12 + "line": 31, + "column": 13 } } }, @@ -7774,69 +5495,68 @@ "binop": null, "updateContext": null }, - "start": 697, - "end": 698, + "start": 629, + "end": 630, "loc": { "start": { - "line": 34, - "column": 12 + "line": 31, + "column": 13 }, "end": { - "line": 34, - "column": 13 + "line": 31, + "column": 14 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 701, - "end": 703, + "value": "A", + "start": 632, + "end": 633, "loc": { "start": { - "line": 36, + "line": 32, "column": 1 }, "end": { - "line": 36, - "column": 3 + "line": 32, + "column": 2 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 704, - "end": 705, + "start": 633, + "end": 634, "loc": { "start": { - "line": 36, - "column": 4 + "line": 32, + "column": 2 }, "end": { - "line": 36, - "column": 5 + "line": 32, + "column": 3 } } }, @@ -7852,53 +5572,78 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 705, - "end": 706, + "value": "parent", + "start": 634, + "end": 640, "loc": { "start": { - "line": 36, - "column": 5 + "line": 32, + "column": 3 }, "end": { - "line": 36, - "column": 6 + "line": 32, + "column": 9 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 641, + "end": 642, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "!==", - "start": 707, - "end": 710, + "value": "B", + "start": 643, + "end": 644, "loc": { "start": { - "line": 36, - "column": 7 + "line": 32, + "column": 12 }, "end": { - "line": 36, - "column": 10 + "line": 32, + "column": 13 } } }, { "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7907,23 +5652,23 @@ "binop": null, "updateContext": null }, - "value": "null", - "start": 711, - "end": 715, + "start": 644, + "end": 645, "loc": { "start": { - "line": 36, - "column": 11 + "line": 32, + "column": 13 }, "end": { - "line": 36, - "column": 15 + "line": 32, + "column": 14 } } }, { "type": { - "label": ")", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7931,18 +5676,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 715, - "end": 716, + "value": "const", + "start": 648, + "end": 653, "loc": { "start": { - "line": 36, - "column": 15 + "line": 34, + "column": 1 }, "end": { - "line": 36, - "column": 16 + "line": 34, + "column": 6 } } }, @@ -7958,43 +5705,44 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 717, - "end": 718, + "value": "b", + "start": 654, + "end": 655, "loc": { "start": { - "line": 36, - "column": 17 + "line": 34, + "column": 7 }, "end": { - "line": 36, - "column": 18 + "line": 34, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 718, - "end": 719, + "value": "=", + "start": 656, + "end": 657, "loc": { "start": { - "line": 36, - "column": 18 + "line": 34, + "column": 9 }, "end": { - "line": 36, - "column": 19 + "line": 34, + "column": 10 } } }, @@ -8010,44 +5758,43 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 719, - "end": 725, + "value": "B", + "start": 658, + "end": 659, "loc": { "start": { - "line": 36, - "column": 19 + "line": 34, + "column": 11 }, "end": { - "line": 36, - "column": 25 + "line": 34, + "column": 12 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 726, - "end": 727, + "start": 659, + "end": 660, "loc": { "start": { - "line": 36, - "column": 26 + "line": 34, + "column": 12 }, "end": { - "line": 36, - "column": 27 + "line": 34, + "column": 13 } } }, @@ -8063,17 +5810,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 728, - "end": 729, + "value": "left", + "start": 660, + "end": 664, "loc": { "start": { - "line": 36, - "column": 28 + "line": 34, + "column": 13 }, "end": { - "line": 36, - "column": 29 + "line": 34, + "column": 17 } } }, @@ -8090,69 +5837,68 @@ "binop": null, "updateContext": null }, - "start": 729, - "end": 730, + "start": 664, + "end": 665, "loc": { "start": { - "line": 36, - "column": 29 + "line": 34, + "column": 17 }, "end": { - "line": 36, - "column": 30 + "line": 34, + "column": 18 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 732, - "end": 734, + "value": "A", + "start": 667, + "end": 668, "loc": { "start": { - "line": 37, + "line": 35, "column": 1 }, "end": { - "line": 37, - "column": 3 + "line": 35, + "column": 2 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 735, - "end": 736, + "start": 668, + "end": 669, "loc": { "start": { - "line": 37, - "column": 4 + "line": 35, + "column": 2 }, "end": { - "line": 37, - "column": 5 + "line": 35, + "column": 3 } } }, @@ -8168,51 +5914,50 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 736, - "end": 737, + "value": "right", + "start": 669, + "end": 674, "loc": { "start": { - "line": 37, - "column": 5 + "line": 35, + "column": 3 }, "end": { - "line": 37, - "column": 6 + "line": 35, + "column": 8 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "!==", - "start": 738, - "end": 741, + "value": "=", + "start": 675, + "end": 676, "loc": { "start": { - "line": 37, - "column": 7 + "line": 35, + "column": 9 }, "end": { - "line": 37, + "line": 35, "column": 10 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8220,45 +5965,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 742, - "end": 746, + "value": "b", + "start": 677, + "end": 678, "loc": { "start": { - "line": 37, + "line": 35, "column": 11 }, "end": { - "line": 37, - "column": 15 + "line": 35, + "column": 12 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 746, - "end": 747, + "start": 678, + "end": 679, "loc": { "start": { - "line": 37, - "column": 15 + "line": 35, + "column": 12 }, "end": { - "line": 37, - "column": 16 + "line": 35, + "column": 13 } } }, @@ -8274,17 +6019,17 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 748, - "end": 749, + "value": "B", + "start": 681, + "end": 682, "loc": { "start": { - "line": 37, - "column": 17 + "line": 36, + "column": 1 }, "end": { - "line": 37, - "column": 18 + "line": 36, + "column": 2 } } }, @@ -8301,16 +6046,16 @@ "binop": null, "updateContext": null }, - "start": 749, - "end": 750, + "start": 682, + "end": 683, "loc": { "start": { - "line": 37, - "column": 18 + "line": 36, + "column": 2 }, "end": { - "line": 37, - "column": 19 + "line": 36, + "column": 3 } } }, @@ -8326,17 +6071,17 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 750, - "end": 756, + "value": "left", + "start": 683, + "end": 687, "loc": { "start": { - "line": 37, - "column": 19 + "line": 36, + "column": 3 }, "end": { - "line": 37, - "column": 25 + "line": 36, + "column": 7 } } }, @@ -8354,16 +6099,16 @@ "updateContext": null }, "value": "=", - "start": 757, - "end": 758, + "start": 688, + "end": 689, "loc": { "start": { - "line": 37, - "column": 26 + "line": 36, + "column": 8 }, "end": { - "line": 37, - "column": 27 + "line": 36, + "column": 9 } } }, @@ -8379,17 +6124,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 759, - "end": 760, + "value": "A", + "start": 690, + "end": 691, "loc": { "start": { - "line": 37, - "column": 28 + "line": 36, + "column": 10 }, "end": { - "line": 37, - "column": 29 + "line": 36, + "column": 11 } } }, @@ -8406,16 +6151,16 @@ "binop": null, "updateContext": null }, - "start": 760, - "end": 761, + "start": 691, + "end": 692, "loc": { "start": { - "line": 37, - "column": 29 + "line": 36, + "column": 11 }, "end": { - "line": 37, - "column": 30 + "line": 36, + "column": 12 } } }, @@ -8434,8 +6179,8 @@ "updateContext": null }, "value": "if", - "start": 763, - "end": 765, + "start": 695, + "end": 697, "loc": { "start": { "line": 38, @@ -8459,8 +6204,8 @@ "postfix": false, "binop": null }, - "start": 766, - "end": 767, + "start": 698, + "end": 699, "loc": { "start": { "line": 38, @@ -8484,9 +6229,9 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 767, - "end": 768, + "value": "b", + "start": 699, + "end": 700, "loc": { "start": { "line": 38, @@ -8512,8 +6257,8 @@ "updateContext": null }, "value": "!==", - "start": 769, - "end": 772, + "start": 701, + "end": 704, "loc": { "start": { "line": 38, @@ -8540,8 +6285,8 @@ "updateContext": null }, "value": "null", - "start": 773, - "end": 777, + "start": 705, + "end": 709, "loc": { "start": { "line": 38, @@ -8565,8 +6310,8 @@ "postfix": false, "binop": null }, - "start": 777, - "end": 778, + "start": 709, + "end": 710, "loc": { "start": { "line": 38, @@ -8590,9 +6335,9 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 779, - "end": 780, + "value": "b", + "start": 711, + "end": 712, "loc": { "start": { "line": 38, @@ -8617,8 +6362,8 @@ "binop": null, "updateContext": null }, - "start": 780, - "end": 781, + "start": 712, + "end": 713, "loc": { "start": { "line": 38, @@ -8643,8 +6388,8 @@ "binop": null }, "value": "parent", - "start": 781, - "end": 787, + "start": 713, + "end": 719, "loc": { "start": { "line": 38, @@ -8670,8 +6415,8 @@ "updateContext": null }, "value": "=", - "start": 788, - "end": 789, + "start": 720, + "end": 721, "loc": { "start": { "line": 38, @@ -8696,8 +6441,8 @@ "binop": null }, "value": "A", - "start": 790, - "end": 791, + "start": 722, + "end": 723, "loc": { "start": { "line": 38, @@ -8722,8 +6467,8 @@ "binop": null, "updateContext": null }, - "start": 791, - "end": 792, + "start": 723, + "end": 724, "loc": { "start": { "line": 38, @@ -8747,8 +6492,8 @@ "postfix": false, "binop": null }, - "start": 793, - "end": 794, + "start": 725, + "end": 726, "loc": { "start": { "line": 39, @@ -8773,8 +6518,8 @@ "binop": null, "updateContext": null }, - "start": 794, - "end": 795, + "start": 726, + "end": 727, "loc": { "start": { "line": 39, @@ -8801,8 +6546,8 @@ "updateContext": null }, "value": "export", - "start": 797, - "end": 803, + "start": 729, + "end": 735, "loc": { "start": { "line": 41, @@ -8829,8 +6574,8 @@ "updateContext": null }, "value": "default", - "start": 804, - "end": 811, + "start": 736, + "end": 743, "loc": { "start": { "line": 41, @@ -8855,8 +6600,8 @@ "binop": null }, "value": "rotate_left", - "start": 812, - "end": 823, + "start": 744, + "end": 755, "loc": { "start": { "line": 41, @@ -8881,8 +6626,8 @@ "binop": null, "updateContext": null }, - "start": 823, - "end": 824, + "start": 755, + "end": 756, "loc": { "start": { "line": 41, @@ -8907,8 +6652,8 @@ "binop": null, "updateContext": null }, - "start": 825, - "end": 825, + "start": 757, + "end": 757, "loc": { "start": { "line": 42, diff --git a/ast/source/rotate/rotate_right.js.json b/ast/source/rotate/rotate_right.js.json index c84d367..ac58061 100644 --- a/ast/source/rotate/rotate_right.js.json +++ b/ast/source/rotate/rotate_right.js.json @@ -1,7 +1,7 @@ { "type": "File", "start": 0, - "end": 836, + "end": 768, "loc": { "start": { "line": 1, @@ -15,7 +15,7 @@ "program": { "type": "Program", "start": 0, - "end": 836, + "end": 768, "loc": { "start": { "line": 1, @@ -168,16 +168,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * B A\n * / \\ / \\\n * A y -> x B\n * / \\ / \\\n * x b b j\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", "start": 67, - "end": 406, + "end": 421, "loc": { "start": { "line": 4, "column": 0 }, "end": { - "line": 17, + "line": 18, "column": 3 } } @@ -186,11 +186,11 @@ }, { "type": "Identifier", - "start": 408, - "end": 805, + "start": 423, + "end": 737, "loc": { "start": { - "line": 19, + "line": 20, "column": 0 }, "end": { @@ -201,11 +201,11 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 414, - "end": 804, + "start": 429, + "end": 736, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { @@ -215,15 +215,15 @@ }, "id": { "type": "Identifier", - "start": 414, - "end": 426, + "start": 429, + "end": 441, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 18 }, "identifierName": "rotate_right" @@ -233,11 +233,11 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 429, - "end": 804, + "start": 444, + "end": 736, "loc": { "start": { - "line": 19, + "line": 20, "column": 21 }, "end": { @@ -252,15 +252,15 @@ "params": [ { "type": "Identifier", - "start": 430, - "end": 431, + "start": 445, + "end": 446, "loc": { "start": { - "line": 19, + "line": 20, "column": 22 }, "end": { - "line": 19, + "line": 20, "column": 23 }, "identifierName": "B" @@ -270,11 +270,11 @@ ], "body": { "type": "BlockStatement", - "start": 436, - "end": 804, + "start": 451, + "end": 736, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { @@ -285,43 +285,43 @@ "body": [ { "type": "ExpressionStatement", - "start": 439, - "end": 465, + "start": 454, + "end": 480, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 439, - "end": 464, + "start": 454, + "end": 479, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 439, - "end": 445, + "start": 454, + "end": 460, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -331,29 +331,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 446, - "end": 463, + "start": 461, + "end": 478, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 25 } }, "left": { "type": "Identifier", - "start": 446, - "end": 447, + "start": 461, + "end": 462, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 }, "identifierName": "B" @@ -363,15 +363,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 459, - "end": 463, + "start": 474, + "end": 478, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 }, "identifierName": "Node" @@ -384,44 +384,44 @@ }, { "type": "VariableDeclaration", - "start": 467, - "end": 484, + "start": 482, + "end": 499, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 18 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 473, - "end": 483, + "start": 488, + "end": 498, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 17 } }, "id": { "type": "Identifier", - "start": 473, - "end": 474, + "start": 488, + "end": 489, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 8 }, "identifierName": "A" @@ -430,29 +430,29 @@ }, "init": { "type": "MemberExpression", - "start": 477, - "end": 483, + "start": 492, + "end": 498, "loc": { "start": { - "line": 21, + "line": 22, "column": 11 }, "end": { - "line": 21, + "line": 22, "column": 17 } }, "object": { "type": "Identifier", - "start": 477, - "end": 478, + "start": 492, + "end": 493, "loc": { "start": { - "line": 21, + "line": 22, "column": 11 }, "end": { - "line": 21, + "line": 22, "column": 12 }, "identifierName": "B" @@ -461,15 +461,15 @@ }, "property": { "type": "Identifier", - "start": 479, - "end": 483, + "start": 494, + "end": 498, "loc": { "start": { - "line": 21, + "line": 22, "column": 13 }, "end": { - "line": 21, + "line": 22, "column": 17 }, "identifierName": "left" @@ -484,43 +484,43 @@ }, { "type": "ExpressionStatement", - "start": 486, - "end": 512, + "start": 501, + "end": 527, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 486, - "end": 511, + "start": 501, + "end": 526, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 486, - "end": 492, + "start": 501, + "end": 507, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -530,29 +530,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 493, - "end": 510, + "start": 508, + "end": 525, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 493, - "end": 494, + "start": 508, + "end": 509, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "A" @@ -562,15 +562,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 506, - "end": 510, + "start": 521, + "end": 525, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -583,208 +583,8 @@ }, { "type": "VariableDeclaration", - "start": 514, - "end": 531, - "loc": { - "start": { - "line": 23, - "column": 1 - }, - "end": { - "line": 23, - "column": 18 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 520, - "end": 530, - "loc": { - "start": { - "line": 23, - "column": 7 - }, - "end": { - "line": 23, - "column": 17 - } - }, - "id": { - "type": "Identifier", - "start": 520, - "end": 521, - "loc": { - "start": { - "line": 23, - "column": 7 - }, - "end": { - "line": 23, - "column": 8 - }, - "identifierName": "a" - }, - "name": "a" - }, - "init": { - "type": "MemberExpression", - "start": 524, - "end": 530, - "loc": { - "start": { - "line": 23, - "column": 11 - }, - "end": { - "line": 23, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 524, - "end": 525, - "loc": { - "start": { - "line": 23, - "column": 11 - }, - "end": { - "line": 23, - "column": 12 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 526, - "end": 530, - "loc": { - "start": { - "line": 23, - "column": 13 - }, - "end": { - "line": 23, - "column": 17 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - } - ], - "kind": "const" - }, - { - "type": "VariableDeclaration", - "start": 533, - "end": 551, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 19 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 539, - "end": 550, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 18 - } - }, - "id": { - "type": "Identifier", - "start": 539, - "end": 540, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 - }, - "identifierName": "b" - }, - "name": "b" - }, - "init": { - "type": "MemberExpression", - "start": 543, - "end": 550, - "loc": { - "start": { - "line": 24, - "column": 11 - }, - "end": { - "line": 24, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 543, - "end": 544, - "loc": { - "start": { - "line": 24, - "column": 11 - }, - "end": { - "line": 24, - "column": 12 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 545, - "end": 550, - "loc": { - "start": { - "line": 24, - "column": 13 - }, - "end": { - "line": 24, - "column": 18 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } - } - ], - "kind": "const" - }, - { - "type": "VariableDeclaration", - "start": 553, - "end": 571, + "start": 530, + "end": 549, "loc": { "start": { "line": 25, @@ -792,14 +592,14 @@ }, "end": { "line": 25, - "column": 19 + "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 559, - "end": 570, + "start": 536, + "end": 548, "loc": { "start": { "line": 25, @@ -807,13 +607,13 @@ }, "end": { "line": 25, - "column": 18 + "column": 19 } }, "id": { "type": "Identifier", - "start": 559, - "end": 560, + "start": 536, + "end": 537, "loc": { "start": { "line": 25, @@ -823,14 +623,14 @@ "line": 25, "column": 8 }, - "identifierName": "c" + "identifierName": "p" }, - "name": "c" + "name": "p" }, "init": { "type": "MemberExpression", - "start": 563, - "end": 570, + "start": 540, + "end": 548, "loc": { "start": { "line": 25, @@ -838,13 +638,13 @@ }, "end": { "line": 25, - "column": 18 + "column": 19 } }, "object": { "type": "Identifier", - "start": 563, - "end": 564, + "start": 540, + "end": 541, "loc": { "start": { "line": 25, @@ -860,8 +660,8 @@ }, "property": { "type": "Identifier", - "start": 565, - "end": 570, + "start": 542, + "end": 548, "loc": { "start": { "line": 25, @@ -869,11 +669,11 @@ }, "end": { "line": 25, - "column": 18 + "column": 19 }, - "identifierName": "right" + "identifierName": "parent" }, - "name": "right" + "name": "parent" }, "computed": false } @@ -882,687 +682,533 @@ "kind": "const" }, { - "type": "ExpressionStatement", - "start": 574, - "end": 606, + "type": "IfStatement", + "start": 551, + "end": 623, "loc": { "start": { - "line": 27, + "line": 26, "column": 1 }, "end": { - "line": 27, - "column": 33 + "line": 29, + "column": 2 } }, - "expression": { - "type": "AssignmentExpression", - "start": 574, - "end": 605, + "test": { + "type": "BinaryExpression", + "start": 555, + "end": 565, "loc": { "start": { - "line": 27, - "column": 1 + "line": 26, + "column": 5 }, "end": { - "line": 27, - "column": 32 + "line": 26, + "column": 15 } }, - "operator": "=", "left": { - "type": "ArrayPattern", - "start": 574, - "end": 588, + "type": "Identifier", + "start": 555, + "end": 556, "loc": { "start": { - "line": 27, - "column": 1 + "line": 26, + "column": 5 }, "end": { - "line": 27, - "column": 15 - } + "line": 26, + "column": 6 + }, + "identifierName": "p" }, - "elements": [ - { - "type": "MemberExpression", + "name": "p" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 561, + "end": 565, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 15 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 567, + "end": 623, + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 29, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 571, + "end": 620, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 28, + "column": 19 + } + }, + "test": { + "type": "BinaryExpression", "start": 575, - "end": 580, + "end": 587, "loc": { "start": { "line": 27, - "column": 2 + "column": 6 }, "end": { "line": 27, - "column": 7 + "column": 18 } }, - "object": { + "left": { "type": "Identifier", "start": 575, "end": 576, "loc": { "start": { "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 577, - "end": 580, - "loc": { - "start": { - "line": 27, - "column": 4 + "column": 6 }, "end": { "line": 27, "column": 7 }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 582, - "end": 587, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 14 - } - }, - "object": { - "type": "Identifier", - "start": 582, - "end": 583, - "loc": { - "start": { - "line": 27, - "column": 9 - }, - "end": { - "line": 27, - "column": 10 - }, "identifierName": "B" }, "name": "B" }, - "property": { - "type": "Identifier", - "start": 584, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 581, "end": 587, "loc": { "start": { "line": 27, - "column": 11 + "column": 12 }, "end": { "line": 27, - "column": 14 + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 581, + "end": 582, + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 13 + }, + "identifierName": "p" }, - "identifierName": "key" + "name": "p" }, - "name": "key" - }, - "computed": false - } - ] - }, - "right": { - "type": "ArrayExpression", - "start": 591, - "end": 605, - "loc": { - "start": { - "line": 27, - "column": 18 + "property": { + "type": "Identifier", + "start": 583, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 14 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } }, - "end": { - "line": 27, - "column": 32 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 592, - "end": 597, + "consequent": { + "type": "ExpressionStatement", + "start": 589, + "end": 600, "loc": { "start": { "line": 27, - "column": 19 + "column": 20 }, "end": { "line": 27, - "column": 24 + "column": 31 } }, - "object": { - "type": "Identifier", - "start": 592, - "end": 593, + "expression": { + "type": "AssignmentExpression", + "start": 589, + "end": 599, "loc": { "start": { "line": 27, - "column": 19 + "column": 20 }, "end": { "line": 27, - "column": 20 - }, - "identifierName": "B" + "column": 30 + } }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 594, - "end": 597, - "loc": { - "start": { - "line": 27, - "column": 21 + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 589, + "end": 595, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 26 + } }, - "end": { - "line": 27, - "column": 24 + "object": { + "type": "Identifier", + "start": 589, + "end": 590, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 21 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 591, + "end": 595, + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" }, - "identifierName": "key" + "computed": false }, - "name": "key" - }, - "computed": false + "right": { + "type": "Identifier", + "start": 598, + "end": 599, + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + }, + "identifierName": "A" + }, + "name": "A" + } + } }, - { - "type": "MemberExpression", - "start": 599, - "end": 604, + "alternate": { + "type": "ExpressionStatement", + "start": 608, + "end": 620, "loc": { "start": { - "line": 27, - "column": 26 + "line": 28, + "column": 7 }, "end": { - "line": 27, - "column": 31 + "line": 28, + "column": 19 } }, - "object": { - "type": "Identifier", - "start": 599, - "end": 600, + "expression": { + "type": "AssignmentExpression", + "start": 608, + "end": 619, "loc": { "start": { - "line": 27, - "column": 26 + "line": 28, + "column": 7 }, "end": { - "line": 27, - "column": 27 - }, - "identifierName": "A" + "line": 28, + "column": 18 + } }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 601, - "end": 604, - "loc": { - "start": { - "line": 27, - "column": 28 + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 608, + "end": 615, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 14 + } }, - "end": { - "line": 27, - "column": 31 + "object": { + "type": "Identifier", + "start": 608, + "end": 609, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + }, + "identifierName": "p" + }, + "name": "p" }, - "identifierName": "key" + "property": { + "type": "Identifier", + "start": 610, + "end": 615, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 14 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false }, - "name": "key" - }, - "computed": false + "right": { + "type": "Identifier", + "start": 618, + "end": 619, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 18 + }, + "identifierName": "A" + }, + "name": "A" + } + } } - ] - } - } + } + ], + "directives": [] + }, + "alternate": null }, { "type": "ExpressionStatement", - "start": 608, - "end": 652, + "start": 626, + "end": 639, "loc": { "start": { - "line": 28, + "line": 31, "column": 1 }, "end": { - "line": 28, - "column": 45 + "line": 31, + "column": 14 } }, "expression": { "type": "AssignmentExpression", - "start": 608, - "end": 651, + "start": 626, + "end": 638, "loc": { "start": { - "line": 28, + "line": 31, "column": 1 }, "end": { - "line": 28, - "column": 44 + "line": 31, + "column": 13 } }, "operator": "=", "left": { - "type": "ArrayPattern", - "start": 608, - "end": 628, + "type": "MemberExpression", + "start": 626, + "end": 634, "loc": { "start": { - "line": 28, + "line": 31, "column": 1 }, "end": { - "line": 28, - "column": 21 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 609, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 609, - "end": 610, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 611, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 4 - }, - "end": { - "line": 28, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 619, - "end": 627, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 28, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 619, - "end": 620, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 28, - "column": 13 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 621, - "end": 627, - "loc": { - "start": { - "line": 28, - "column": 14 - }, - "end": { - "line": 28, - "column": 20 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] - }, - "right": { - "type": "ArrayExpression", - "start": 631, - "end": 651, - "loc": { - "start": { - "line": 28, - "column": 24 - }, - "end": { - "line": 28, - "column": 44 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 632, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 25 - }, - "end": { - "line": 28, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 632, - "end": 633, - "loc": { - "start": { - "line": 28, - "column": 25 - }, - "end": { - "line": 28, - "column": 26 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 634, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 27 - }, - "end": { - "line": 28, - "column": 33 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 642, - "end": 650, - "loc": { - "start": { - "line": 28, - "column": 35 - }, - "end": { - "line": 28, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 642, - "end": 643, - "loc": { - "start": { - "line": 28, - "column": 35 - }, - "end": { - "line": 28, - "column": 36 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 644, - "end": 650, - "loc": { - "start": { - "line": 28, - "column": 37 - }, - "end": { - "line": 28, - "column": 43 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] - } - } - }, - { - "type": "ExpressionStatement", - "start": 655, - "end": 666, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 12 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 655, - "end": 665, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 11 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 655, - "end": 661, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 7 + "line": 31, + "column": 9 } }, "object": { "type": "Identifier", - "start": 655, - "end": 656, + "start": 626, + "end": 627, "loc": { "start": { - "line": 30, + "line": 31, "column": 1 }, "end": { - "line": 30, + "line": 31, "column": 2 }, - "identifierName": "B" + "identifierName": "A" }, - "name": "B" + "name": "A" }, "property": { "type": "Identifier", - "start": 657, - "end": 661, + "start": 628, + "end": 634, "loc": { "start": { - "line": 30, + "line": 31, "column": 3 }, "end": { - "line": 30, - "column": 7 + "line": 31, + "column": 9 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false }, "right": { "type": "Identifier", - "start": 664, - "end": 665, + "start": 637, + "end": 638, "loc": { "start": { - "line": 30, - "column": 10 + "line": 31, + "column": 12 }, "end": { - "line": 30, - "column": 11 + "line": 31, + "column": 13 }, - "identifierName": "a" + "identifierName": "p" }, - "name": "a" + "name": "p" } } }, { "type": "ExpressionStatement", - "start": 668, - "end": 680, + "start": 641, + "end": 654, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, - "column": 13 + "line": 32, + "column": 14 } }, "expression": { "type": "AssignmentExpression", - "start": 668, - "end": 679, + "start": 641, + "end": 653, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, - "column": 12 + "line": 32, + "column": 13 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 668, - "end": 675, + "start": 641, + "end": 649, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, - "column": 8 + "line": 32, + "column": 9 } }, "object": { "type": "Identifier", - "start": 668, - "end": 669, + "start": 641, + "end": 642, "loc": { "start": { - "line": 31, + "line": 32, "column": 1 }, "end": { - "line": 31, + "line": 32, "column": 2 }, "identifierName": "B" @@ -1571,35 +1217,35 @@ }, "property": { "type": "Identifier", - "start": 670, - "end": 675, + "start": 643, + "end": 649, "loc": { "start": { - "line": 31, + "line": 32, "column": 3 }, "end": { - "line": 31, - "column": 8 + "line": 32, + "column": 9 }, - "identifierName": "right" + "identifierName": "parent" }, - "name": "right" + "name": "parent" }, "computed": false }, "right": { "type": "Identifier", - "start": 678, - "end": 679, + "start": 652, + "end": 653, "loc": { "start": { - "line": 31, - "column": 11 + "line": 32, + "column": 12 }, "end": { - "line": 31, - "column": 12 + "line": 32, + "column": 13 }, "identifierName": "A" }, @@ -1608,76 +1254,176 @@ } }, { - "type": "ExpressionStatement", - "start": 683, - "end": 694, + "type": "VariableDeclaration", + "start": 657, + "end": 675, "loc": { "start": { - "line": 33, + "line": 34, "column": 1 }, "end": { - "line": 33, - "column": 12 + "line": 34, + "column": 19 } }, - "expression": { - "type": "AssignmentExpression", - "start": 683, - "end": 693, - "loc": { - "start": { - "line": 33, - "column": 1 - }, - "end": { - "line": 33, - "column": 11 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 683, - "end": 689, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 663, + "end": 674, "loc": { "start": { - "line": 33, - "column": 1 + "line": 34, + "column": 7 }, "end": { - "line": 33, - "column": 7 + "line": 34, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 663, + "end": 664, + "loc": { + "start": { + "line": 34, + "column": 7 + }, + "end": { + "line": 34, + "column": 8 + }, + "identifierName": "b" + }, + "name": "b" + }, + "init": { + "type": "MemberExpression", + "start": 667, + "end": 674, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 667, + "end": 668, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 669, + "end": 674, + "loc": { + "start": { + "line": 34, + "column": 13 + }, + "end": { + "line": 34, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 677, + "end": 688, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 677, + "end": 687, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 677, + "end": 683, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 7 } }, "object": { "type": "Identifier", - "start": 683, - "end": 684, + "start": 677, + "end": 678, "loc": { "start": { - "line": 33, + "line": 35, "column": 1 }, "end": { - "line": 33, + "line": 35, "column": 2 }, - "identifierName": "A" + "identifierName": "B" }, - "name": "A" + "name": "B" }, "property": { "type": "Identifier", - "start": 685, - "end": 689, + "start": 679, + "end": 683, "loc": { "start": { - "line": 33, + "line": 35, "column": 3 }, "end": { - "line": 33, + "line": 35, "column": 7 }, "identifierName": "left" @@ -1688,15 +1434,15 @@ }, "right": { "type": "Identifier", - "start": 692, - "end": 693, + "start": 686, + "end": 687, "loc": { "start": { - "line": 33, + "line": 35, "column": 10 }, "end": { - "line": 33, + "line": 35, "column": 11 }, "identifierName": "b" @@ -1707,58 +1453,58 @@ }, { "type": "ExpressionStatement", - "start": 696, - "end": 708, + "start": 690, + "end": 702, "loc": { "start": { - "line": 34, + "line": 36, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 13 } }, "expression": { "type": "AssignmentExpression", - "start": 696, - "end": 707, + "start": 690, + "end": 701, "loc": { "start": { - "line": 34, + "line": 36, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 12 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 696, - "end": 703, + "start": 690, + "end": 697, "loc": { "start": { - "line": 34, + "line": 36, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 8 } }, "object": { "type": "Identifier", - "start": 696, - "end": 697, + "start": 690, + "end": 691, "loc": { "start": { - "line": 34, + "line": 36, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 2 }, "identifierName": "A" @@ -1767,15 +1513,15 @@ }, "property": { "type": "Identifier", - "start": 698, - "end": 703, + "start": 692, + "end": 697, "loc": { "start": { - "line": 34, + "line": 36, "column": 3 }, "end": { - "line": 34, + "line": 36, "column": 8 }, "identifierName": "right" @@ -1786,80 +1532,80 @@ }, "right": { "type": "Identifier", - "start": 706, - "end": 707, + "start": 700, + "end": 701, "loc": { "start": { - "line": 34, + "line": 36, "column": 11 }, "end": { - "line": 34, + "line": 36, "column": 12 }, - "identifierName": "c" + "identifierName": "B" }, - "name": "c" + "name": "B" } } }, { "type": "IfStatement", - "start": 711, - "end": 740, + "start": 705, + "end": 734, "loc": { "start": { - "line": 36, + "line": 38, "column": 1 }, "end": { - "line": 36, + "line": 38, "column": 30 } }, "test": { "type": "BinaryExpression", - "start": 715, - "end": 725, + "start": 709, + "end": 719, "loc": { "start": { - "line": 36, + "line": 38, "column": 5 }, "end": { - "line": 36, + "line": 38, "column": 15 } }, "left": { "type": "Identifier", - "start": 715, - "end": 716, + "start": 709, + "end": 710, "loc": { "start": { - "line": 36, + "line": 38, "column": 5 }, "end": { - "line": 36, + "line": 38, "column": 6 }, - "identifierName": "a" + "identifierName": "b" }, - "name": "a" + "name": "b" }, "operator": "!==", "right": { "type": "NullLiteral", - "start": 721, - "end": 725, + "start": 715, + "end": 719, "loc": { "start": { - "line": 36, + "line": 38, "column": 11 }, "end": { - "line": 36, + "line": 38, "column": 15 } } @@ -1867,75 +1613,75 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 727, - "end": 740, + "start": 721, + "end": 734, "loc": { "start": { - "line": 36, + "line": 38, "column": 17 }, "end": { - "line": 36, + "line": 38, "column": 30 } }, "expression": { "type": "AssignmentExpression", - "start": 727, - "end": 739, + "start": 721, + "end": 733, "loc": { "start": { - "line": 36, + "line": 38, "column": 17 }, "end": { - "line": 36, + "line": 38, "column": 29 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 727, - "end": 735, + "start": 721, + "end": 729, "loc": { "start": { - "line": 36, + "line": 38, "column": 17 }, "end": { - "line": 36, + "line": 38, "column": 25 } }, "object": { "type": "Identifier", - "start": 727, - "end": 728, + "start": 721, + "end": 722, "loc": { "start": { - "line": 36, + "line": 38, "column": 17 }, "end": { - "line": 36, + "line": 38, "column": 18 }, - "identifierName": "a" + "identifierName": "b" }, - "name": "a" + "name": "b" }, "property": { "type": "Identifier", - "start": 729, - "end": 735, + "start": 723, + "end": 729, "loc": { "start": { - "line": 36, + "line": 38, "column": 19 }, "end": { - "line": 36, + "line": 38, "column": 25 }, "identifierName": "parent" @@ -1946,15 +1692,15 @@ }, "right": { "type": "Identifier", - "start": 738, - "end": 739, + "start": 732, + "end": 733, "loc": { "start": { - "line": 36, + "line": 38, "column": 28 }, "end": { - "line": 36, + "line": 38, "column": 29 }, "identifierName": "B" @@ -1964,330 +1710,6 @@ } }, "alternate": null - }, - { - "type": "IfStatement", - "start": 742, - "end": 771, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 746, - "end": 756, - "loc": { - "start": { - "line": 37, - "column": 5 - }, - "end": { - "line": 37, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 746, - "end": 747, - "loc": { - "start": { - "line": 37, - "column": 5 - }, - "end": { - "line": 37, - "column": 6 - }, - "identifierName": "b" - }, - "name": "b" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 752, - "end": 756, - "loc": { - "start": { - "line": 37, - "column": 11 - }, - "end": { - "line": 37, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 758, - "end": 771, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 758, - "end": 770, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 758, - "end": 766, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 758, - "end": 759, - "loc": { - "start": { - "line": 37, - "column": 17 - }, - "end": { - "line": 37, - "column": 18 - }, - "identifierName": "b" - }, - "name": "b" - }, - "property": { - "type": "Identifier", - "start": 760, - "end": 766, - "loc": { - "start": { - "line": 37, - "column": 19 - }, - "end": { - "line": 37, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 769, - "end": 770, - "loc": { - "start": { - "line": 37, - "column": 28 - }, - "end": { - "line": 37, - "column": 29 - }, - "identifierName": "A" - }, - "name": "A" - } - } - }, - "alternate": null - }, - { - "type": "IfStatement", - "start": 773, - "end": 802, - "loc": { - "start": { - "line": 38, - "column": 1 - }, - "end": { - "line": 38, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 777, - "end": 787, - "loc": { - "start": { - "line": 38, - "column": 5 - }, - "end": { - "line": 38, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 777, - "end": 778, - "loc": { - "start": { - "line": 38, - "column": 5 - }, - "end": { - "line": 38, - "column": 6 - }, - "identifierName": "c" - }, - "name": "c" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 783, - "end": 787, - "loc": { - "start": { - "line": 38, - "column": 11 - }, - "end": { - "line": 38, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 789, - "end": 802, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 789, - "end": 801, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 789, - "end": 797, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 789, - "end": 790, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 18 - }, - "identifierName": "c" - }, - "name": "c" - }, - "property": { - "type": "Identifier", - "start": 791, - "end": 797, - "loc": { - "start": { - "line": 38, - "column": 19 - }, - "end": { - "line": 38, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 800, - "end": 801, - "loc": { - "start": { - "line": 38, - "column": 28 - }, - "end": { - "line": 38, - "column": 29 - }, - "identifierName": "A" - }, - "name": "A" - } - } - }, - "alternate": null } ], "directives": [] @@ -2303,8 +1725,8 @@ }, { "type": "Identifier", - "start": 807, - "end": 835, + "start": 739, + "end": 767, "loc": { "start": { "line": 41, @@ -2317,8 +1739,8 @@ }, "declaration": { "type": "Identifier", - "start": 822, - "end": 834, + "start": 754, + "end": 766, "loc": { "start": { "line": 41, @@ -2338,8 +1760,8 @@ }, { "type": "ExportDefaultDeclaration", - "start": 807, - "end": 835, + "start": 739, + "end": 767, "loc": { "start": { "line": 41, @@ -2352,11 +1774,11 @@ }, "declaration": { "type": "VariableDeclaration", - "start": 408, - "end": 805, + "start": 423, + "end": 737, "loc": { "start": { - "line": 19, + "line": 20, "column": 0 }, "end": { @@ -2367,11 +1789,11 @@ "declarations": [ { "type": "VariableDeclarator", - "start": 414, - "end": 804, + "start": 429, + "end": 736, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { @@ -2381,15 +1803,15 @@ }, "id": { "type": "Identifier", - "start": 414, - "end": 426, + "start": 429, + "end": 441, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 18 }, "identifierName": "rotate_right" @@ -2399,11 +1821,11 @@ }, "init": { "type": "ArrowFunctionExpression", - "start": 429, - "end": 804, + "start": 444, + "end": 736, "loc": { "start": { - "line": 19, + "line": 20, "column": 21 }, "end": { @@ -2413,15 +1835,15 @@ }, "id": { "type": "Identifier", - "start": 414, - "end": 426, + "start": 429, + "end": 441, "loc": { "start": { - "line": 19, + "line": 20, "column": 6 }, "end": { - "line": 19, + "line": 20, "column": 18 }, "identifierName": "rotate_right" @@ -2435,15 +1857,15 @@ "params": [ { "type": "Identifier", - "start": 430, - "end": 431, + "start": 445, + "end": 446, "loc": { "start": { - "line": 19, + "line": 20, "column": 22 }, "end": { - "line": 19, + "line": 20, "column": 23 }, "identifierName": "B" @@ -2453,11 +1875,11 @@ ], "body": { "type": "BlockStatement", - "start": 436, - "end": 804, + "start": 451, + "end": 736, "loc": { "start": { - "line": 19, + "line": 20, "column": 28 }, "end": { @@ -2468,43 +1890,43 @@ "body": [ { "type": "ExpressionStatement", - "start": 439, - "end": 465, + "start": 454, + "end": 480, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 439, - "end": 464, + "start": 454, + "end": 479, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 26 } }, "callee": { "type": "Identifier", - "start": 439, - "end": 445, + "start": 454, + "end": 460, "loc": { "start": { - "line": 20, + "line": 21, "column": 1 }, "end": { - "line": 20, + "line": 21, "column": 7 }, "identifierName": "assert" @@ -2514,29 +1936,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 446, - "end": 463, + "start": 461, + "end": 478, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 25 } }, "left": { "type": "Identifier", - "start": 446, - "end": 447, + "start": 461, + "end": 462, "loc": { "start": { - "line": 20, + "line": 21, "column": 8 }, "end": { - "line": 20, + "line": 21, "column": 9 }, "identifierName": "B" @@ -2546,15 +1968,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 459, - "end": 463, + "start": 474, + "end": 478, "loc": { "start": { - "line": 20, + "line": 21, "column": 21 }, "end": { - "line": 20, + "line": 21, "column": 25 }, "identifierName": "Node" @@ -2567,44 +1989,44 @@ }, { "type": "VariableDeclaration", - "start": 467, - "end": 484, + "start": 482, + "end": 499, "loc": { "start": { - "line": 21, + "line": 22, "column": 1 }, "end": { - "line": 21, + "line": 22, "column": 18 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 473, - "end": 483, + "start": 488, + "end": 498, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 17 } }, "id": { "type": "Identifier", - "start": 473, - "end": 474, + "start": 488, + "end": 489, "loc": { "start": { - "line": 21, + "line": 22, "column": 7 }, "end": { - "line": 21, + "line": 22, "column": 8 }, "identifierName": "A" @@ -2613,29 +2035,29 @@ }, "init": { "type": "MemberExpression", - "start": 477, - "end": 483, + "start": 492, + "end": 498, "loc": { "start": { - "line": 21, + "line": 22, "column": 11 }, "end": { - "line": 21, + "line": 22, "column": 17 } }, "object": { "type": "Identifier", - "start": 477, - "end": 478, + "start": 492, + "end": 493, "loc": { "start": { - "line": 21, + "line": 22, "column": 11 }, "end": { - "line": 21, + "line": 22, "column": 12 }, "identifierName": "B" @@ -2644,15 +2066,15 @@ }, "property": { "type": "Identifier", - "start": 479, - "end": 483, + "start": 494, + "end": 498, "loc": { "start": { - "line": 21, + "line": 22, "column": 13 }, "end": { - "line": 21, + "line": 22, "column": 17 }, "identifierName": "left" @@ -2667,43 +2089,43 @@ }, { "type": "ExpressionStatement", - "start": 486, - "end": 512, + "start": 501, + "end": 527, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 27 } }, "expression": { "type": "CallExpression", - "start": 486, - "end": 511, + "start": 501, + "end": 526, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 26 } }, "callee": { "type": "Identifier", - "start": 486, - "end": 492, + "start": 501, + "end": 507, "loc": { "start": { - "line": 22, + "line": 23, "column": 1 }, "end": { - "line": 22, + "line": 23, "column": 7 }, "identifierName": "assert" @@ -2713,29 +2135,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 493, - "end": 510, + "start": 508, + "end": 525, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 25 } }, "left": { "type": "Identifier", - "start": 493, - "end": 494, + "start": 508, + "end": 509, "loc": { "start": { - "line": 22, + "line": 23, "column": 8 }, "end": { - "line": 22, + "line": 23, "column": 9 }, "identifierName": "A" @@ -2745,15 +2167,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 506, - "end": 510, + "start": 521, + "end": 525, "loc": { "start": { - "line": 22, + "line": 23, "column": 21 }, "end": { - "line": 22, + "line": 23, "column": 25 }, "identifierName": "Node" @@ -2766,237 +2188,37 @@ }, { "type": "VariableDeclaration", - "start": 514, - "end": 531, + "start": 530, + "end": 549, "loc": { "start": { - "line": 23, + "line": 25, "column": 1 }, "end": { - "line": 23, - "column": 18 + "line": 25, + "column": 20 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 520, - "end": 530, + "start": 536, + "end": 548, "loc": { "start": { - "line": 23, - "column": 7 - }, - "end": { - "line": 23, - "column": 17 - } - }, - "id": { - "type": "Identifier", - "start": 520, - "end": 521, - "loc": { - "start": { - "line": 23, - "column": 7 - }, - "end": { - "line": 23, - "column": 8 - }, - "identifierName": "a" - }, - "name": "a" - }, - "init": { - "type": "MemberExpression", - "start": 524, - "end": 530, - "loc": { - "start": { - "line": 23, - "column": 11 - }, - "end": { - "line": 23, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 524, - "end": 525, - "loc": { - "start": { - "line": 23, - "column": 11 - }, - "end": { - "line": 23, - "column": 12 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 526, - "end": 530, - "loc": { - "start": { - "line": 23, - "column": 13 - }, - "end": { - "line": 23, - "column": 17 - }, - "identifierName": "left" - }, - "name": "left" - }, - "computed": false - } - } - ], - "kind": "const" - }, - { - "type": "VariableDeclaration", - "start": 533, - "end": 551, - "loc": { - "start": { - "line": 24, - "column": 1 - }, - "end": { - "line": 24, - "column": 19 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 539, - "end": 550, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 18 - } - }, - "id": { - "type": "Identifier", - "start": 539, - "end": 540, - "loc": { - "start": { - "line": 24, - "column": 7 - }, - "end": { - "line": 24, - "column": 8 - }, - "identifierName": "b" - }, - "name": "b" - }, - "init": { - "type": "MemberExpression", - "start": 543, - "end": 550, - "loc": { - "start": { - "line": 24, - "column": 11 - }, - "end": { - "line": 24, - "column": 18 - } - }, - "object": { - "type": "Identifier", - "start": 543, - "end": 544, - "loc": { - "start": { - "line": 24, - "column": 11 - }, - "end": { - "line": 24, - "column": 12 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 545, - "end": 550, - "loc": { - "start": { - "line": 24, - "column": 13 - }, - "end": { - "line": 24, - "column": 18 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - } - } - ], - "kind": "const" - }, - { - "type": "VariableDeclaration", - "start": 553, - "end": 571, - "loc": { - "start": { - "line": 25, - "column": 1 - }, - "end": { - "line": 25, - "column": 19 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 559, - "end": 570, - "loc": { - "start": { - "line": 25, + "line": 25, "column": 7 }, "end": { "line": 25, - "column": 18 + "column": 19 } }, "id": { "type": "Identifier", - "start": 559, - "end": 560, + "start": 536, + "end": 537, "loc": { "start": { "line": 25, @@ -3006,14 +2228,14 @@ "line": 25, "column": 8 }, - "identifierName": "c" + "identifierName": "p" }, - "name": "c" + "name": "p" }, "init": { "type": "MemberExpression", - "start": 563, - "end": 570, + "start": 540, + "end": 548, "loc": { "start": { "line": 25, @@ -3021,13 +2243,13 @@ }, "end": { "line": 25, - "column": 18 + "column": 19 } }, "object": { "type": "Identifier", - "start": 563, - "end": 564, + "start": 540, + "end": 541, "loc": { "start": { "line": 25, @@ -3043,8 +2265,8 @@ }, "property": { "type": "Identifier", - "start": 565, - "end": 570, + "start": 542, + "end": 548, "loc": { "start": { "line": 25, @@ -3052,11 +2274,11 @@ }, "end": { "line": 25, - "column": 18 + "column": 19 }, - "identifierName": "right" + "identifierName": "parent" }, - "name": "right" + "name": "parent" }, "computed": false } @@ -3065,589 +2287,533 @@ "kind": "const" }, { - "type": "ExpressionStatement", - "start": 574, - "end": 606, + "type": "IfStatement", + "start": 551, + "end": 623, "loc": { "start": { - "line": 27, + "line": 26, "column": 1 }, "end": { - "line": 27, - "column": 33 + "line": 29, + "column": 2 } }, - "expression": { - "type": "AssignmentExpression", - "start": 574, - "end": 605, + "test": { + "type": "BinaryExpression", + "start": 555, + "end": 565, "loc": { "start": { - "line": 27, - "column": 1 + "line": 26, + "column": 5 }, "end": { - "line": 27, - "column": 32 + "line": 26, + "column": 15 } }, - "operator": "=", "left": { - "type": "ArrayPattern", - "start": 574, - "end": 588, + "type": "Identifier", + "start": 555, + "end": 556, "loc": { "start": { - "line": 27, - "column": 1 + "line": 26, + "column": 5 }, "end": { - "line": 27, + "line": 26, + "column": 6 + }, + "identifierName": "p" + }, + "name": "p" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 561, + "end": 565, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, "column": 15 } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 567, + "end": 623, + "loc": { + "start": { + "line": 26, + "column": 17 }, - "elements": [ - { - "type": "MemberExpression", + "end": { + "line": 29, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 571, + "end": 620, + "loc": { + "start": { + "line": 27, + "column": 2 + }, + "end": { + "line": 28, + "column": 19 + } + }, + "test": { + "type": "BinaryExpression", "start": 575, - "end": 580, + "end": 587, "loc": { "start": { "line": 27, - "column": 2 + "column": 6 }, "end": { "line": 27, - "column": 7 + "column": 18 } }, - "object": { + "left": { "type": "Identifier", "start": 575, "end": 576, "loc": { "start": { "line": 27, - "column": 2 + "column": 6 }, "end": { "line": 27, - "column": 3 + "column": 7 }, - "identifierName": "A" + "identifierName": "B" }, - "name": "A" + "name": "B" }, - "property": { - "type": "Identifier", - "start": 577, - "end": 580, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 581, + "end": 587, "loc": { "start": { "line": 27, - "column": 4 + "column": 12 }, "end": { "line": 27, - "column": 7 + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 581, + "end": 582, + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 13 + }, + "identifierName": "p" }, - "identifierName": "key" + "name": "p" }, - "name": "key" - }, - "computed": false + "property": { + "type": "Identifier", + "start": 583, + "end": 587, + "loc": { + "start": { + "line": 27, + "column": 14 + }, + "end": { + "line": 27, + "column": 18 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } }, - { - "type": "MemberExpression", - "start": 582, - "end": 587, + "consequent": { + "type": "ExpressionStatement", + "start": 589, + "end": 600, "loc": { "start": { "line": 27, - "column": 9 + "column": 20 }, "end": { "line": 27, - "column": 14 + "column": 31 } }, - "object": { - "type": "Identifier", - "start": 582, - "end": 583, + "expression": { + "type": "AssignmentExpression", + "start": 589, + "end": 599, "loc": { "start": { "line": 27, - "column": 9 + "column": 20 }, "end": { "line": 27, - "column": 10 + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 589, + "end": 595, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 26 + } }, - "identifierName": "B" + "object": { + "type": "Identifier", + "start": 589, + "end": 590, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 21 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 591, + "end": 595, + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 584, - "end": 587, - "loc": { - "start": { - "line": 27, - "column": 11 - }, - "end": { - "line": 27, - "column": 14 + "right": { + "type": "Identifier", + "start": 598, + "end": 599, + "loc": { + "start": { + "line": 27, + "column": 29 + }, + "end": { + "line": 27, + "column": 30 + }, + "identifierName": "A" }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - } - ] - }, - "right": { - "type": "ArrayExpression", - "start": 591, - "end": 605, - "loc": { - "start": { - "line": 27, - "column": 18 + "name": "A" + } + } }, - "end": { - "line": 27, - "column": 32 - } - }, - "elements": [ - { - "type": "MemberExpression", - "start": 592, - "end": 597, + "alternate": { + "type": "ExpressionStatement", + "start": 608, + "end": 620, "loc": { "start": { - "line": 27, - "column": 19 + "line": 28, + "column": 7 }, "end": { - "line": 27, - "column": 24 + "line": 28, + "column": 19 } }, - "object": { - "type": "Identifier", - "start": 592, - "end": 593, + "expression": { + "type": "AssignmentExpression", + "start": 608, + "end": 619, "loc": { "start": { - "line": 27, - "column": 19 + "line": 28, + "column": 7 }, "end": { - "line": 27, - "column": 20 - }, - "identifierName": "B" + "line": 28, + "column": 18 + } }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 594, - "end": 597, - "loc": { - "start": { - "line": 27, - "column": 21 - }, - "end": { - "line": 27, - "column": 24 + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 608, + "end": 615, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 14 + } }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 599, - "end": 604, - "loc": { - "start": { - "line": 27, - "column": 26 - }, - "end": { - "line": 27, - "column": 31 - } - }, - "object": { - "type": "Identifier", - "start": 599, - "end": 600, - "loc": { - "start": { - "line": 27, - "column": 26 + "object": { + "type": "Identifier", + "start": 608, + "end": 609, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + }, + "identifierName": "p" + }, + "name": "p" }, - "end": { - "line": 27, - "column": 27 + "property": { + "type": "Identifier", + "start": 610, + "end": 615, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 14 + }, + "identifierName": "right" + }, + "name": "right" }, - "identifierName": "A" + "computed": false }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 601, - "end": 604, - "loc": { - "start": { - "line": 27, - "column": 28 + "right": { + "type": "Identifier", + "start": 618, + "end": 619, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 18 + }, + "identifierName": "A" }, - "end": { - "line": 27, - "column": 31 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false + "name": "A" + } + } } - ] - } - } + } + ], + "directives": [] + }, + "alternate": null }, { "type": "ExpressionStatement", - "start": 608, - "end": 652, + "start": 626, + "end": 639, "loc": { "start": { - "line": 28, + "line": 31, "column": 1 }, "end": { - "line": 28, - "column": 45 + "line": 31, + "column": 14 } }, "expression": { "type": "AssignmentExpression", - "start": 608, - "end": 651, + "start": 626, + "end": 638, "loc": { "start": { - "line": 28, + "line": 31, "column": 1 }, "end": { - "line": 28, - "column": 44 + "line": 31, + "column": 13 } }, "operator": "=", "left": { - "type": "ArrayPattern", - "start": 608, - "end": 628, + "type": "MemberExpression", + "start": 626, + "end": 634, "loc": { "start": { - "line": 28, + "line": 31, "column": 1 }, "end": { - "line": 28, - "column": 21 + "line": 31, + "column": 9 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 609, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 10 - } - }, - "object": { - "type": "Identifier", - "start": 609, - "end": 610, - "loc": { - "start": { - "line": 28, - "column": 2 - }, - "end": { - "line": 28, - "column": 3 - }, - "identifierName": "A" - }, - "name": "A" + "object": { + "type": "Identifier", + "start": 626, + "end": 627, + "loc": { + "start": { + "line": 31, + "column": 1 }, - "property": { - "type": "Identifier", - "start": 611, - "end": 617, - "loc": { - "start": { - "line": 28, - "column": 4 - }, - "end": { - "line": 28, - "column": 10 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 31, + "column": 2 }, - "computed": false + "identifierName": "A" }, - { - "type": "MemberExpression", - "start": 619, - "end": 627, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 28, - "column": 20 - } - }, - "object": { - "type": "Identifier", - "start": 619, - "end": 620, - "loc": { - "start": { - "line": 28, - "column": 12 - }, - "end": { - "line": 28, - "column": 13 - }, - "identifierName": "B" - }, - "name": "B" + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 628, + "end": 634, + "loc": { + "start": { + "line": 31, + "column": 3 }, - "property": { - "type": "Identifier", - "start": 621, - "end": 627, - "loc": { - "start": { - "line": 28, - "column": 14 - }, - "end": { - "line": 28, - "column": 20 - }, - "identifierName": "_color" - }, - "name": "_color" + "end": { + "line": 31, + "column": 9 }, - "computed": false - } - ] + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, "right": { - "type": "ArrayExpression", - "start": 631, - "end": 651, + "type": "Identifier", + "start": 637, + "end": 638, "loc": { "start": { - "line": 28, - "column": 24 + "line": 31, + "column": 12 }, "end": { - "line": 28, - "column": 44 + "line": 31, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" + } + } + }, + { + "type": "ExpressionStatement", + "start": 641, + "end": 654, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 641, + "end": 653, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 641, + "end": 649, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 9 } }, - "elements": [ - { - "type": "MemberExpression", - "start": 632, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 25 - }, - "end": { - "line": 28, - "column": 33 - } - }, - "object": { - "type": "Identifier", - "start": 632, - "end": 633, - "loc": { - "start": { - "line": 28, - "column": 25 - }, - "end": { - "line": 28, - "column": 26 - }, - "identifierName": "B" - }, - "name": "B" - }, - "property": { - "type": "Identifier", - "start": 634, - "end": 640, - "loc": { - "start": { - "line": 28, - "column": 27 - }, - "end": { - "line": 28, - "column": 33 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 642, - "end": 650, - "loc": { - "start": { - "line": 28, - "column": 35 - }, - "end": { - "line": 28, - "column": 43 - } - }, - "object": { - "type": "Identifier", - "start": 642, - "end": 643, - "loc": { - "start": { - "line": 28, - "column": 35 - }, - "end": { - "line": 28, - "column": 36 - }, - "identifierName": "A" - }, - "name": "A" - }, - "property": { - "type": "Identifier", - "start": 644, - "end": 650, - "loc": { - "start": { - "line": 28, - "column": 37 - }, - "end": { - "line": 28, - "column": 43 - }, - "identifierName": "_color" - }, - "name": "_color" - }, - "computed": false - } - ] - } - } - }, - { - "type": "ExpressionStatement", - "start": 655, - "end": 666, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 12 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 655, - "end": 665, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 11 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 655, - "end": 661, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 7 - } - }, - "object": { - "type": "Identifier", - "start": 655, - "end": 656, - "loc": { - "start": { - "line": 30, - "column": 1 + "object": { + "type": "Identifier", + "start": 641, + "end": 642, + "loc": { + "start": { + "line": 32, + "column": 1 }, "end": { - "line": 30, + "line": 32, "column": 2 }, "identifierName": "B" @@ -3656,211 +2822,213 @@ }, "property": { "type": "Identifier", - "start": 657, - "end": 661, + "start": 643, + "end": 649, "loc": { "start": { - "line": 30, + "line": 32, "column": 3 }, "end": { - "line": 30, - "column": 7 + "line": 32, + "column": 9 }, - "identifierName": "left" + "identifierName": "parent" }, - "name": "left" + "name": "parent" }, "computed": false }, "right": { "type": "Identifier", - "start": 664, - "end": 665, + "start": 652, + "end": 653, "loc": { "start": { - "line": 30, - "column": 10 + "line": 32, + "column": 12 }, "end": { - "line": 30, - "column": 11 + "line": 32, + "column": 13 }, - "identifierName": "a" + "identifierName": "A" }, - "name": "a" + "name": "A" } } }, { - "type": "ExpressionStatement", - "start": 668, - "end": 680, + "type": "VariableDeclaration", + "start": 657, + "end": 675, "loc": { "start": { - "line": 31, + "line": 34, "column": 1 }, "end": { - "line": 31, - "column": 13 + "line": 34, + "column": 19 } }, - "expression": { - "type": "AssignmentExpression", - "start": 668, - "end": 679, - "loc": { - "start": { - "line": 31, - "column": 1 - }, - "end": { - "line": 31, - "column": 12 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 668, - "end": 675, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 663, + "end": 674, "loc": { "start": { - "line": 31, - "column": 1 + "line": 34, + "column": 7 }, "end": { - "line": 31, - "column": 8 + "line": 34, + "column": 18 } }, - "object": { + "id": { "type": "Identifier", - "start": 668, - "end": 669, + "start": 663, + "end": 664, "loc": { "start": { - "line": 31, - "column": 1 + "line": 34, + "column": 7 }, "end": { - "line": 31, - "column": 2 + "line": 34, + "column": 8 }, - "identifierName": "B" + "identifierName": "b" }, - "name": "B" + "name": "b" }, - "property": { - "type": "Identifier", - "start": 670, - "end": 675, + "init": { + "type": "MemberExpression", + "start": 667, + "end": 674, "loc": { "start": { - "line": 31, - "column": 3 + "line": 34, + "column": 11 }, "end": { - "line": 31, - "column": 8 - }, - "identifierName": "right" + "line": 34, + "column": 18 + } }, - "name": "right" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 678, - "end": 679, - "loc": { - "start": { - "line": 31, - "column": 11 + "object": { + "type": "Identifier", + "start": 667, + "end": 668, + "loc": { + "start": { + "line": 34, + "column": 11 + }, + "end": { + "line": 34, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" }, - "end": { - "line": 31, - "column": 12 + "property": { + "type": "Identifier", + "start": 669, + "end": 674, + "loc": { + "start": { + "line": 34, + "column": 13 + }, + "end": { + "line": 34, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" }, - "identifierName": "A" - }, - "name": "A" + "computed": false + } } - } + ], + "kind": "const" }, { "type": "ExpressionStatement", - "start": 683, - "end": 694, + "start": 677, + "end": 688, "loc": { "start": { - "line": 33, + "line": 35, "column": 1 }, "end": { - "line": 33, + "line": 35, "column": 12 } }, "expression": { "type": "AssignmentExpression", - "start": 683, - "end": 693, + "start": 677, + "end": 687, "loc": { "start": { - "line": 33, + "line": 35, "column": 1 }, "end": { - "line": 33, + "line": 35, "column": 11 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 683, - "end": 689, + "start": 677, + "end": 683, "loc": { "start": { - "line": 33, + "line": 35, "column": 1 }, "end": { - "line": 33, + "line": 35, "column": 7 } }, "object": { "type": "Identifier", - "start": 683, - "end": 684, + "start": 677, + "end": 678, "loc": { "start": { - "line": 33, + "line": 35, "column": 1 }, "end": { - "line": 33, + "line": 35, "column": 2 }, - "identifierName": "A" + "identifierName": "B" }, - "name": "A" + "name": "B" }, "property": { "type": "Identifier", - "start": 685, - "end": 689, + "start": 679, + "end": 683, "loc": { "start": { - "line": 33, + "line": 35, "column": 3 }, "end": { - "line": 33, + "line": 35, "column": 7 }, "identifierName": "left" @@ -3871,15 +3039,15 @@ }, "right": { "type": "Identifier", - "start": 692, - "end": 693, + "start": 686, + "end": 687, "loc": { "start": { - "line": 33, + "line": 35, "column": 10 }, "end": { - "line": 33, + "line": 35, "column": 11 }, "identifierName": "b" @@ -3890,58 +3058,58 @@ }, { "type": "ExpressionStatement", - "start": 696, - "end": 708, + "start": 690, + "end": 702, "loc": { "start": { - "line": 34, + "line": 36, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 13 } }, "expression": { "type": "AssignmentExpression", - "start": 696, - "end": 707, + "start": 690, + "end": 701, "loc": { "start": { - "line": 34, + "line": 36, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 12 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 696, - "end": 703, + "start": 690, + "end": 697, "loc": { "start": { - "line": 34, + "line": 36, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 8 } }, "object": { "type": "Identifier", - "start": 696, - "end": 697, + "start": 690, + "end": 691, "loc": { "start": { - "line": 34, + "line": 36, "column": 1 }, "end": { - "line": 34, + "line": 36, "column": 2 }, "identifierName": "A" @@ -3950,15 +3118,15 @@ }, "property": { "type": "Identifier", - "start": 698, - "end": 703, + "start": 692, + "end": 697, "loc": { "start": { - "line": 34, + "line": 36, "column": 3 }, "end": { - "line": 34, + "line": 36, "column": 8 }, "identifierName": "right" @@ -3969,224 +3137,62 @@ }, "right": { "type": "Identifier", - "start": 706, - "end": 707, + "start": 700, + "end": 701, "loc": { "start": { - "line": 34, + "line": 36, "column": 11 }, "end": { - "line": 34, + "line": 36, "column": 12 }, - "identifierName": "c" + "identifierName": "B" }, - "name": "c" + "name": "B" } } }, { "type": "IfStatement", - "start": 711, - "end": 740, + "start": 705, + "end": 734, "loc": { "start": { - "line": 36, + "line": 38, "column": 1 }, "end": { - "line": 36, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 715, - "end": 725, - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 715, - "end": 716, - "loc": { - "start": { - "line": 36, - "column": 5 - }, - "end": { - "line": 36, - "column": 6 - }, - "identifierName": "a" - }, - "name": "a" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 721, - "end": 725, - "loc": { - "start": { - "line": 36, - "column": 11 - }, - "end": { - "line": 36, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 727, - "end": 740, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 727, - "end": 739, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 727, - "end": 735, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 727, - "end": 728, - "loc": { - "start": { - "line": 36, - "column": 17 - }, - "end": { - "line": 36, - "column": 18 - }, - "identifierName": "a" - }, - "name": "a" - }, - "property": { - "type": "Identifier", - "start": 729, - "end": 735, - "loc": { - "start": { - "line": 36, - "column": 19 - }, - "end": { - "line": 36, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 738, - "end": 739, - "loc": { - "start": { - "line": 36, - "column": 28 - }, - "end": { - "line": 36, - "column": 29 - }, - "identifierName": "B" - }, - "name": "B" - } - } - }, - "alternate": null - }, - { - "type": "IfStatement", - "start": 742, - "end": 771, - "loc": { - "start": { - "line": 37, - "column": 1 - }, - "end": { - "line": 37, + "line": 38, "column": 30 } }, "test": { "type": "BinaryExpression", - "start": 746, - "end": 756, + "start": 709, + "end": 719, "loc": { "start": { - "line": 37, + "line": 38, "column": 5 }, "end": { - "line": 37, + "line": 38, "column": 15 } }, "left": { "type": "Identifier", - "start": 746, - "end": 747, + "start": 709, + "end": 710, "loc": { "start": { - "line": 37, + "line": 38, "column": 5 }, "end": { - "line": 37, + "line": 38, "column": 6 }, "identifierName": "b" @@ -4196,15 +3202,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 752, - "end": 756, + "start": 715, + "end": 719, "loc": { "start": { - "line": 37, + "line": 38, "column": 11 }, "end": { - "line": 37, + "line": 38, "column": 15 } } @@ -4212,58 +3218,58 @@ }, "consequent": { "type": "ExpressionStatement", - "start": 758, - "end": 771, + "start": 721, + "end": 734, "loc": { "start": { - "line": 37, + "line": 38, "column": 17 }, "end": { - "line": 37, + "line": 38, "column": 30 } }, "expression": { "type": "AssignmentExpression", - "start": 758, - "end": 770, + "start": 721, + "end": 733, "loc": { "start": { - "line": 37, + "line": 38, "column": 17 }, "end": { - "line": 37, + "line": 38, "column": 29 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 758, - "end": 766, + "start": 721, + "end": 729, "loc": { "start": { - "line": 37, + "line": 38, "column": 17 }, "end": { - "line": 37, + "line": 38, "column": 25 } }, "object": { "type": "Identifier", - "start": 758, - "end": 759, + "start": 721, + "end": 722, "loc": { "start": { - "line": 37, + "line": 38, "column": 17 }, "end": { - "line": 37, + "line": 38, "column": 18 }, "identifierName": "b" @@ -4272,15 +3278,15 @@ }, "property": { "type": "Identifier", - "start": 760, - "end": 766, + "start": 723, + "end": 729, "loc": { "start": { - "line": 37, + "line": 38, "column": 19 }, "end": { - "line": 37, + "line": 38, "column": 25 }, "identifierName": "parent" @@ -4291,1283 +3297,82 @@ }, "right": { "type": "Identifier", - "start": 769, - "end": 770, + "start": 732, + "end": 733, "loc": { "start": { - "line": 37, + "line": 38, "column": 28 }, "end": { - "line": 37, - "column": 29 - }, - "identifierName": "A" - }, - "name": "A" - } - } - }, - "alternate": null - }, - { - "type": "IfStatement", - "start": 773, - "end": 802, - "loc": { - "start": { - "line": 38, - "column": 1 - }, - "end": { - "line": 38, - "column": 30 - } - }, - "test": { - "type": "BinaryExpression", - "start": 777, - "end": 787, - "loc": { - "start": { - "line": 38, - "column": 5 - }, - "end": { - "line": 38, - "column": 15 - } - }, - "left": { - "type": "Identifier", - "start": 777, - "end": 778, - "loc": { - "start": { - "line": 38, - "column": 5 - }, - "end": { - "line": 38, - "column": 6 - }, - "identifierName": "c" - }, - "name": "c" - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 783, - "end": 787, - "loc": { - "start": { - "line": 38, - "column": 11 - }, - "end": { - "line": 38, - "column": 15 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 789, - "end": 802, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 30 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 789, - "end": 801, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 29 - } - }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 789, - "end": 797, - "loc": { - "start": { "line": 38, - "column": 17 + "column": 29 }, - "end": { - "line": 38, - "column": 25 - } - }, - "object": { - "type": "Identifier", - "start": 789, - "end": 790, - "loc": { - "start": { - "line": 38, - "column": 17 - }, - "end": { - "line": 38, - "column": 18 - }, - "identifierName": "c" - }, - "name": "c" - }, - "property": { - "type": "Identifier", - "start": 791, - "end": 797, - "loc": { - "start": { - "line": 38, - "column": 19 - }, - "end": { - "line": 38, - "column": 25 - }, - "identifierName": "parent" - }, - "name": "parent" - }, - "computed": false - }, - "right": { - "type": "Identifier", - "start": 800, - "end": 801, - "loc": { - "start": { - "line": 38, - "column": 28 - }, - "end": { - "line": 38, - "column": 29 - }, - "identifierName": "A" - }, - "name": "A" - } - } - }, - "alternate": null - } - ], - "directives": [] - } - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 67, - "end": 406, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - } - ], - "trailingComments": [] - } - } - ], - "directives": [] - }, - "comments": [ - { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 67, - "end": 406, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - } - ], - "tokens": [ - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 0, - "end": 6, - "loc": { - "start": { - "line": 1, - "column": 0 - }, - "end": { - "line": 1, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 7, - "end": 13, - "loc": { - "start": { - "line": 1, - "column": 7 - }, - "end": { - "line": 1, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 14, - "end": 18, - "loc": { - "start": { - "line": 1, - "column": 14 - }, - "end": { - "line": 1, - "column": 18 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "assert", - "start": 19, - "end": 27, - "loc": { - "start": { - "line": 1, - "column": 19 - }, - "end": { - "line": 1, - "column": 27 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 27, - "end": 28, - "loc": { - "start": { - "line": 1, - "column": 27 - }, - "end": { - "line": 1, - "column": 28 - } - } - }, - { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 29, - "end": 35, - "loc": { - "start": { - "line": 2, - "column": 0 - }, - "end": { - "line": 2, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 36, - "end": 40, - "loc": { - "start": { - "line": 2, - "column": 7 - }, - "end": { - "line": 2, - "column": 11 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 41, - "end": 45, - "loc": { - "start": { - "line": 2, - "column": 12 - }, - "end": { - "line": 2, - "column": 16 - } - } - }, - { - "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "../types/Node.js", - "start": 46, - "end": 64, - "loc": { - "start": { - "line": 2, - "column": 17 - }, - "end": { - "line": 2, - "column": 35 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 64, - "end": 65, - "loc": { - "start": { - "line": 2, - "column": 35 - }, - "end": { - "line": 2, - "column": 36 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", - "start": 67, - "end": 406, - "loc": { - "start": { - "line": 4, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 408, - "end": 413, - "loc": { - "start": { - "line": 19, - "column": 0 - }, - "end": { - "line": 19, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "rotate_right", - "start": 414, - "end": 426, - "loc": { - "start": { - "line": 19, - "column": 6 - }, - "end": { - "line": 19, - "column": 18 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 427, - "end": 428, - "loc": { - "start": { - "line": 19, - "column": 19 - }, - "end": { - "line": 19, - "column": 20 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 429, - "end": 430, - "loc": { - "start": { - "line": 19, - "column": 21 - }, - "end": { - "line": 19, - "column": 22 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "B", - "start": 430, - "end": 431, - "loc": { - "start": { - "line": 19, - "column": 22 - }, - "end": { - "line": 19, - "column": 23 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 431, - "end": 432, - "loc": { - "start": { - "line": 19, - "column": 23 - }, - "end": { - "line": 19, - "column": 24 - } - } - }, - { - "type": { - "label": "=>", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 433, - "end": 435, - "loc": { - "start": { - "line": 19, - "column": 25 - }, - "end": { - "line": 19, - "column": 27 - } - } - }, - { - "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 436, - "end": 437, - "loc": { - "start": { - "line": 19, - "column": 28 - }, - "end": { - "line": 19, - "column": 29 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 439, - "end": 445, - "loc": { - "start": { - "line": 20, - "column": 1 - }, - "end": { - "line": 20, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 445, - "end": 446, - "loc": { - "start": { - "line": 20, - "column": 7 - }, - "end": { - "line": 20, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "B", - "start": 446, - "end": 447, - "loc": { - "start": { - "line": 20, - "column": 8 - }, - "end": { - "line": 20, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 448, - "end": 458, - "loc": { - "start": { - "line": 20, - "column": 10 - }, - "end": { - "line": 20, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 459, - "end": 463, - "loc": { - "start": { - "line": 20, - "column": 21 - }, - "end": { - "line": 20, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 463, - "end": 464, - "loc": { - "start": { - "line": 20, - "column": 25 - }, - "end": { - "line": 20, - "column": 26 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 464, - "end": 465, - "loc": { - "start": { - "line": 20, - "column": 26 - }, - "end": { - "line": 20, - "column": 27 - } - } - }, - { - "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "const", - "start": 467, - "end": 472, - "loc": { - "start": { - "line": 21, - "column": 1 - }, - "end": { - "line": 21, - "column": 6 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "A", - "start": 473, - "end": 474, - "loc": { - "start": { - "line": 21, - "column": 7 - }, - "end": { - "line": 21, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 475, - "end": 476, - "loc": { - "start": { - "line": 21, - "column": 9 - }, - "end": { - "line": 21, - "column": 10 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "B", - "start": 477, - "end": 478, - "loc": { - "start": { - "line": 21, - "column": 11 - }, - "end": { - "line": 21, - "column": 12 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 478, - "end": 479, - "loc": { - "start": { - "line": 21, - "column": 12 - }, - "end": { - "line": 21, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 479, - "end": 483, - "loc": { - "start": { - "line": 21, - "column": 13 - }, - "end": { - "line": 21, - "column": 17 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 483, - "end": 484, - "loc": { - "start": { - "line": 21, - "column": 17 - }, - "end": { - "line": 21, - "column": 18 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "assert", - "start": 486, - "end": 492, - "loc": { - "start": { - "line": 22, - "column": 1 - }, - "end": { - "line": 22, - "column": 7 - } - } - }, - { - "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 492, - "end": 493, - "loc": { - "start": { - "line": 22, - "column": 7 - }, - "end": { - "line": 22, - "column": 8 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "A", - "start": 493, - "end": 494, - "loc": { - "start": { - "line": 22, - "column": 8 - }, - "end": { - "line": 22, - "column": 9 - } - } - }, - { - "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": 7, - "updateContext": null - }, - "value": "instanceof", - "start": 495, - "end": 505, - "loc": { - "start": { - "line": 22, - "column": 10 - }, - "end": { - "line": 22, - "column": 20 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 506, - "end": 510, - "loc": { - "start": { - "line": 22, - "column": 21 - }, - "end": { - "line": 22, - "column": 25 - } - } - }, - { - "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 510, - "end": 511, - "loc": { - "start": { - "line": 22, - "column": 25 - }, - "end": { - "line": 22, - "column": 26 + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": null + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * B A\n * / \\ / \\\n * A y -> x B\n * / \\ / \\\n * x b b j\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 421, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 + } + } + } + ], + "trailingComments": [] } } - }, + ], + "directives": [] + }, + "comments": [ { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 511, - "end": 512, + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * B A\n * / \\ / \\\n * A y -> x B\n * / \\ / \\\n * x b b j\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 421, "loc": { "start": { - "line": 22, - "column": 26 + "line": 4, + "column": 0 }, "end": { - "line": 22, - "column": 27 + "line": 18, + "column": 3 } } - }, + } + ], + "tokens": [ { "type": { - "label": "const", - "keyword": "const", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5576,16 +3381,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 514, - "end": 519, + "value": "import", + "start": 0, + "end": 6, "loc": { "start": { - "line": 23, - "column": 1 + "line": 1, + "column": 0 }, "end": { - "line": 23, + "line": 1, "column": 6 } } @@ -5602,44 +3407,17 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 520, - "end": 521, + "value": "assert", + "start": 7, + "end": 13, "loc": { "start": { - "line": 23, + "line": 1, "column": 7 }, "end": { - "line": 23, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 522, - "end": 523, - "loc": { - "start": { - "line": 23, - "column": 9 - }, - "end": { - "line": 23, - "column": 10 + "line": 1, + "column": 13 } } }, @@ -5655,25 +3433,25 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 524, - "end": 525, + "value": "from", + "start": 14, + "end": 18, "loc": { "start": { - "line": 23, - "column": 11 + "line": 1, + "column": 14 }, "end": { - "line": 23, - "column": 12 + "line": 1, + "column": 18 } } }, { "type": { - "label": ".", + "label": "string", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5682,42 +3460,17 @@ "binop": null, "updateContext": null }, - "start": 525, - "end": 526, - "loc": { - "start": { - "line": 23, - "column": 12 - }, - "end": { - "line": 23, - "column": 13 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 526, - "end": 530, + "value": "assert", + "start": 19, + "end": 27, "loc": { "start": { - "line": 23, - "column": 13 + "line": 1, + "column": 19 }, "end": { - "line": 23, - "column": 17 + "line": 1, + "column": 27 } } }, @@ -5734,25 +3487,25 @@ "binop": null, "updateContext": null }, - "start": 530, - "end": 531, + "start": 27, + "end": 28, "loc": { "start": { - "line": 23, - "column": 17 + "line": 1, + "column": 27 }, "end": { - "line": 23, - "column": 18 + "line": 1, + "column": 28 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": "import", + "keyword": "import", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -5761,16 +3514,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 533, - "end": 538, + "value": "import", + "start": 29, + "end": 35, "loc": { "start": { - "line": 24, - "column": 1 + "line": 2, + "column": 0 }, "end": { - "line": 24, + "line": 2, "column": 6 } } @@ -5787,44 +3540,17 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 539, - "end": 540, + "value": "Node", + "start": 36, + "end": 40, "loc": { "start": { - "line": 24, + "line": 2, "column": 7 }, "end": { - "line": 24, - "column": 8 - } - } - }, - { - "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": true, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "=", - "start": 541, - "end": 542, - "loc": { - "start": { - "line": 24, - "column": 9 - }, - "end": { - "line": 24, - "column": 10 + "line": 2, + "column": 11 } } }, @@ -5840,49 +3566,23 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 543, - "end": 544, - "loc": { - "start": { - "line": 24, - "column": 11 - }, - "end": { - "line": 24, - "column": 12 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 544, - "end": 545, + "value": "from", + "start": 41, + "end": 45, "loc": { "start": { - "line": 24, + "line": 2, "column": 12 }, "end": { - "line": 24, - "column": 13 + "line": 2, + "column": 16 } } }, { "type": { - "label": "name", + "label": "string", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -5890,19 +3590,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "right", - "start": 545, - "end": 550, + "value": "../types/Node.js", + "start": 46, + "end": 64, "loc": { "start": { - "line": 24, - "column": 13 + "line": 2, + "column": 17 }, "end": { - "line": 24, - "column": 18 + "line": 2, + "column": 35 } } }, @@ -5919,16 +3620,32 @@ "binop": null, "updateContext": null }, - "start": 550, - "end": 551, + "start": 64, + "end": 65, "loc": { "start": { - "line": 24, - "column": 18 + "line": 2, + "column": 35 }, "end": { - "line": 24, - "column": 19 + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * B A\n * / \\ / \\\n * A y -> x B\n * / \\ / \\\n * x b b j\n *\n *\n * @param {Node} B - The root of the tree.\n *\n ", + "start": 67, + "end": 421, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 18, + "column": 3 } } }, @@ -5947,16 +3664,16 @@ "updateContext": null }, "value": "const", - "start": 553, - "end": 558, + "start": 423, + "end": 428, "loc": { "start": { - "line": 25, - "column": 1 + "line": 20, + "column": 0 }, "end": { - "line": 25, - "column": 6 + "line": 20, + "column": 5 } } }, @@ -5972,17 +3689,17 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 559, - "end": 560, + "value": "rotate_right", + "start": 429, + "end": 441, "loc": { "start": { - "line": 25, - "column": 7 + "line": 20, + "column": 6 }, "end": { - "line": 25, - "column": 8 + "line": 20, + "column": 18 } } }, @@ -6000,23 +3717,23 @@ "updateContext": null }, "value": "=", - "start": 561, - "end": 562, + "start": 442, + "end": 443, "loc": { "start": { - "line": 25, - "column": 9 + "line": 20, + "column": 19 }, "end": { - "line": 25, - "column": 10 + "line": 20, + "column": 20 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6025,43 +3742,16 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 563, - "end": 564, - "loc": { - "start": { - "line": 25, - "column": 11 - }, - "end": { - "line": 25, - "column": 12 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 564, - "end": 565, + "start": 444, + "end": 445, "loc": { "start": { - "line": 25, - "column": 12 + "line": 20, + "column": 21 }, "end": { - "line": 25, - "column": 13 + "line": 20, + "column": 22 } } }, @@ -6077,51 +3767,50 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 565, - "end": 570, + "value": "B", + "start": 445, + "end": 446, "loc": { "start": { - "line": 25, - "column": 13 + "line": 20, + "column": 22 }, "end": { - "line": 25, - "column": 18 + "line": 20, + "column": 23 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 570, - "end": 571, + "start": 446, + "end": 447, "loc": { "start": { - "line": 25, - "column": 18 + "line": 20, + "column": 23 }, "end": { - "line": 25, - "column": 19 + "line": 20, + "column": 24 } } }, { "type": { - "label": "[", + "label": "=>", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6130,23 +3819,23 @@ "binop": null, "updateContext": null }, - "start": 574, - "end": 575, + "start": 448, + "end": 450, "loc": { "start": { - "line": 27, - "column": 1 + "line": 20, + "column": 25 }, "end": { - "line": 27, - "column": 2 + "line": 20, + "column": 27 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -6155,43 +3844,16 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 575, - "end": 576, - "loc": { - "start": { - "line": 27, - "column": 2 - }, - "end": { - "line": 27, - "column": 3 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 576, - "end": 577, + "start": 451, + "end": 452, "loc": { "start": { - "line": 27, - "column": 3 + "line": 20, + "column": 28 }, "end": { - "line": 27, - "column": 4 + "line": 20, + "column": 29 } } }, @@ -6207,42 +3869,41 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 577, - "end": 580, + "value": "assert", + "start": 454, + "end": 460, "loc": { "start": { - "line": 27, - "column": 4 + "line": 21, + "column": 1 }, "end": { - "line": 27, + "line": 21, "column": 7 } } }, { "type": { - "label": ",", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 580, - "end": 581, + "start": 460, + "end": 461, "loc": { "start": { - "line": 27, + "line": 21, "column": 7 }, "end": { - "line": 27, + "line": 21, "column": 8 } } @@ -6260,42 +3921,44 @@ "binop": null }, "value": "B", - "start": 582, - "end": 583, + "start": 461, + "end": 462, "loc": { "start": { - "line": 27, - "column": 9 + "line": 21, + "column": 8 }, "end": { - "line": 27, - "column": 10 + "line": 21, + "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 583, - "end": 584, + "value": "instanceof", + "start": 463, + "end": 473, "loc": { "start": { - "line": 27, + "line": 21, "column": 10 }, "end": { - "line": 27, - "column": 11 + "line": 21, + "column": 20 } } }, @@ -6311,23 +3974,23 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 584, - "end": 587, + "value": "Node", + "start": 474, + "end": 478, "loc": { "start": { - "line": 27, - "column": 11 + "line": 21, + "column": 21 }, "end": { - "line": 27, - "column": 14 + "line": 21, + "column": 25 } } }, { "type": { - "label": "]", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6335,54 +3998,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 587, - "end": 588, + "start": 478, + "end": 479, "loc": { "start": { - "line": 27, - "column": 14 + "line": 21, + "column": 25 }, "end": { - "line": 27, - "column": 15 + "line": 21, + "column": 26 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 589, - "end": 590, + "start": 479, + "end": 480, "loc": { "start": { - "line": 27, - "column": 16 + "line": 21, + "column": 26 }, "end": { - "line": 27, - "column": 17 + "line": 21, + "column": 27 } } }, { "type": { - "label": "[", - "beforeExpr": true, - "startsExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6391,16 +4053,17 @@ "binop": null, "updateContext": null }, - "start": 591, - "end": 592, + "value": "const", + "start": 482, + "end": 487, "loc": { "start": { - "line": 27, - "column": 18 + "line": 22, + "column": 1 }, "end": { - "line": 27, - "column": 19 + "line": 22, + "column": 6 } } }, @@ -6416,43 +4079,44 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 592, - "end": 593, + "value": "A", + "start": 488, + "end": 489, "loc": { "start": { - "line": 27, - "column": 19 + "line": 22, + "column": 7 }, "end": { - "line": 27, - "column": 20 + "line": 22, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 593, - "end": 594, + "value": "=", + "start": 490, + "end": 491, "loc": { "start": { - "line": 27, - "column": 20 + "line": 22, + "column": 9 }, "end": { - "line": 27, - "column": 21 + "line": 22, + "column": 10 } } }, @@ -6468,24 +4132,24 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 594, - "end": 597, + "value": "B", + "start": 492, + "end": 493, "loc": { "start": { - "line": 27, - "column": 21 + "line": 22, + "column": 11 }, "end": { - "line": 27, - "column": 24 + "line": 22, + "column": 12 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6495,16 +4159,16 @@ "binop": null, "updateContext": null }, - "start": 597, - "end": 598, + "start": 493, + "end": 494, "loc": { "start": { - "line": 27, - "column": 24 + "line": 22, + "column": 12 }, "end": { - "line": 27, - "column": 25 + "line": 22, + "column": 13 } } }, @@ -6520,24 +4184,24 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 599, - "end": 600, + "value": "left", + "start": 494, + "end": 498, "loc": { "start": { - "line": 27, - "column": 26 + "line": 22, + "column": 13 }, "end": { - "line": 27, - "column": 27 + "line": 22, + "column": 17 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6547,16 +4211,16 @@ "binop": null, "updateContext": null }, - "start": 600, - "end": 601, + "start": 498, + "end": 499, "loc": { "start": { - "line": 27, - "column": 27 + "line": 22, + "column": 17 }, "end": { - "line": 27, - "column": 28 + "line": 22, + "column": 18 } } }, @@ -6572,95 +4236,96 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 601, - "end": 604, + "value": "assert", + "start": 501, + "end": 507, "loc": { "start": { - "line": 27, - "column": 28 + "line": 23, + "column": 1 }, "end": { - "line": 27, - "column": 31 + "line": 23, + "column": 7 } } }, { "type": { - "label": "]", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 604, - "end": 605, + "start": 507, + "end": 508, "loc": { "start": { - "line": 27, - "column": 31 + "line": 23, + "column": 7 }, "end": { - "line": 27, - "column": 32 + "line": 23, + "column": 8 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 605, - "end": 606, + "value": "A", + "start": 508, + "end": 509, "loc": { "start": { - "line": 27, - "column": 32 + "line": 23, + "column": 8 }, "end": { - "line": 27, - "column": 33 + "line": 23, + "column": 9 } } }, { "type": { - "label": "[", + "label": "instanceof", + "keyword": "instanceof", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "start": 608, - "end": 609, + "value": "instanceof", + "start": 510, + "end": 520, "loc": { "start": { - "line": 28, - "column": 1 + "line": 23, + "column": 10 }, "end": { - "line": 28, - "column": 2 + "line": 23, + "column": 20 } } }, @@ -6676,23 +4341,23 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 609, - "end": 610, + "value": "Node", + "start": 521, + "end": 525, "loc": { "start": { - "line": 28, - "column": 2 + "line": 23, + "column": 21 }, "end": { - "line": 28, - "column": 3 + "line": 23, + "column": 25 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6700,52 +4365,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 610, - "end": 611, + "start": 525, + "end": 526, "loc": { "start": { - "line": 28, - "column": 3 + "line": 23, + "column": 25 }, "end": { - "line": 28, - "column": 4 + "line": 23, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_color", - "start": 611, - "end": 617, + "start": 526, + "end": 527, "loc": { "start": { - "line": 28, - "column": 4 + "line": 23, + "column": 26 }, "end": { - "line": 28, - "column": 10 + "line": 23, + "column": 27 } } }, { "type": { - "label": ",", - "beforeExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -6755,16 +4420,17 @@ "binop": null, "updateContext": null }, - "start": 617, - "end": 618, + "value": "const", + "start": 530, + "end": 535, "loc": { "start": { - "line": 28, - "column": 10 + "line": 25, + "column": 1 }, "end": { - "line": 28, - "column": 11 + "line": 25, + "column": 6 } } }, @@ -6780,43 +4446,44 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 619, - "end": 620, + "value": "p", + "start": 536, + "end": 537, "loc": { "start": { - "line": 28, - "column": 12 + "line": 25, + "column": 7 }, "end": { - "line": 28, - "column": 13 + "line": 25, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 620, - "end": 621, + "value": "=", + "start": 538, + "end": 539, "loc": { "start": { - "line": 28, - "column": 13 + "line": 25, + "column": 9 }, "end": { - "line": 28, - "column": 14 + "line": 25, + "column": 10 } } }, @@ -6832,23 +4499,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 621, - "end": 627, + "value": "B", + "start": 540, + "end": 541, "loc": { "start": { - "line": 28, - "column": 14 + "line": 25, + "column": 11 }, "end": { - "line": 28, - "column": 20 + "line": 25, + "column": 12 } } }, { "type": { - "label": "]", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -6859,51 +4526,50 @@ "binop": null, "updateContext": null }, - "start": 627, - "end": 628, + "start": 541, + "end": 542, "loc": { "start": { - "line": 28, - "column": 20 + "line": 25, + "column": 12 }, "end": { - "line": 28, - "column": 21 + "line": 25, + "column": 13 } } }, { "type": { - "label": "=", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 629, - "end": 630, + "value": "parent", + "start": 542, + "end": 548, "loc": { "start": { - "line": 28, - "column": 22 + "line": 25, + "column": 13 }, "end": { - "line": 28, - "column": 23 + "line": 25, + "column": 19 } } }, { "type": { - "label": "[", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -6912,68 +4578,69 @@ "binop": null, "updateContext": null }, - "start": 631, - "end": 632, + "start": 548, + "end": 549, "loc": { "start": { - "line": 28, - "column": 24 + "line": 25, + "column": 19 }, "end": { - "line": 28, - "column": 25 + "line": 25, + "column": 20 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "B", - "start": 632, - "end": 633, + "value": "if", + "start": 551, + "end": 553, "loc": { "start": { - "line": 28, - "column": 25 + "line": 26, + "column": 1 }, "end": { - "line": 28, - "column": 26 + "line": 26, + "column": 3 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 633, - "end": 634, + "start": 554, + "end": 555, "loc": { "start": { - "line": 28, - "column": 26 + "line": 26, + "column": 4 }, "end": { - "line": 28, - "column": 27 + "line": 26, + "column": 5 } } }, @@ -6989,23 +4656,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 634, - "end": 640, + "value": "p", + "start": 555, + "end": 556, "loc": { "start": { - "line": 28, - "column": 27 + "line": 26, + "column": 5 }, "end": { - "line": 28, - "column": 33 + "line": 26, + "column": 6 } } }, { "type": { - "label": ",", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -7013,25 +4680,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 640, - "end": 641, + "value": "!==", + "start": 557, + "end": 560, "loc": { "start": { - "line": 28, - "column": 33 + "line": 26, + "column": 7 }, "end": { - "line": 28, - "column": 34 + "line": 26, + "column": 10 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7039,25 +4708,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "A", - "start": 642, - "end": 643, + "value": "null", + "start": 561, + "end": 565, "loc": { "start": { - "line": 28, - "column": 35 + "line": 26, + "column": 11 }, "end": { - "line": 28, - "column": 36 + "line": 26, + "column": 15 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7065,26 +4735,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 643, - "end": 644, + "start": 565, + "end": 566, "loc": { "start": { - "line": 28, - "column": 36 + "line": 26, + "column": 15 }, "end": { - "line": 28, - "column": 37 + "line": 26, + "column": 16 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7093,23 +4762,23 @@ "postfix": false, "binop": null }, - "value": "_color", - "start": 644, - "end": 650, + "start": 567, + "end": 568, "loc": { "start": { - "line": 28, - "column": 37 + "line": 26, + "column": 17 }, "end": { - "line": 28, - "column": 43 + "line": 26, + "column": 18 } } }, { "type": { - "label": "]", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7120,42 +4789,42 @@ "binop": null, "updateContext": null }, - "start": 650, - "end": 651, + "value": "if", + "start": 571, + "end": 573, "loc": { "start": { - "line": 28, - "column": 43 + "line": 27, + "column": 2 }, "end": { - "line": 28, - "column": 44 + "line": 27, + "column": 4 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 651, - "end": 652, + "start": 574, + "end": 575, "loc": { "start": { - "line": 28, - "column": 44 + "line": 27, + "column": 5 }, "end": { - "line": 28, - "column": 45 + "line": 27, + "column": 6 } } }, @@ -7172,42 +4841,43 @@ "binop": null }, "value": "B", - "start": 655, - "end": 656, + "start": 575, + "end": 576, "loc": { "start": { - "line": 30, - "column": 1 + "line": 27, + "column": 6 }, "end": { - "line": 30, - "column": 2 + "line": 27, + "column": 7 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 656, - "end": 657, + "value": "===", + "start": 577, + "end": 580, "loc": { "start": { - "line": 30, - "column": 2 + "line": 27, + "column": 8 }, "end": { - "line": 30, - "column": 3 + "line": 27, + "column": 11 } } }, @@ -7223,44 +4893,43 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 657, - "end": 661, + "value": "p", + "start": 581, + "end": 582, "loc": { "start": { - "line": 30, - "column": 3 + "line": 27, + "column": 12 }, "end": { - "line": 30, - "column": 7 + "line": 27, + "column": 13 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 662, - "end": 663, + "start": 582, + "end": 583, "loc": { "start": { - "line": 30, - "column": 8 + "line": 27, + "column": 13 }, "end": { - "line": 30, - "column": 9 + "line": 27, + "column": 14 } } }, @@ -7276,43 +4945,42 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 664, - "end": 665, + "value": "left", + "start": 583, + "end": 587, "loc": { "start": { - "line": 30, - "column": 10 + "line": 27, + "column": 14 }, "end": { - "line": 30, - "column": 11 + "line": 27, + "column": 18 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 665, - "end": 666, + "start": 587, + "end": 588, "loc": { "start": { - "line": 30, - "column": 11 + "line": 27, + "column": 18 }, "end": { - "line": 30, - "column": 12 + "line": 27, + "column": 19 } } }, @@ -7328,17 +4996,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 668, - "end": 669, + "value": "p", + "start": 589, + "end": 590, "loc": { "start": { - "line": 31, - "column": 1 + "line": 27, + "column": 20 }, "end": { - "line": 31, - "column": 2 + "line": 27, + "column": 21 } } }, @@ -7355,16 +5023,16 @@ "binop": null, "updateContext": null }, - "start": 669, - "end": 670, + "start": 590, + "end": 591, "loc": { "start": { - "line": 31, - "column": 2 + "line": 27, + "column": 21 }, "end": { - "line": 31, - "column": 3 + "line": 27, + "column": 22 } } }, @@ -7380,17 +5048,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 670, - "end": 675, + "value": "left", + "start": 591, + "end": 595, "loc": { "start": { - "line": 31, - "column": 3 + "line": 27, + "column": 22 }, "end": { - "line": 31, - "column": 8 + "line": 27, + "column": 26 } } }, @@ -7408,16 +5076,16 @@ "updateContext": null }, "value": "=", - "start": 676, - "end": 677, + "start": 596, + "end": 597, "loc": { "start": { - "line": 31, - "column": 9 + "line": 27, + "column": 27 }, "end": { - "line": 31, - "column": 10 + "line": 27, + "column": 28 } } }, @@ -7434,16 +5102,16 @@ "binop": null }, "value": "A", - "start": 678, - "end": 679, + "start": 598, + "end": 599, "loc": { "start": { - "line": 31, - "column": 11 + "line": 27, + "column": 29 }, "end": { - "line": 31, - "column": 12 + "line": 27, + "column": 30 } } }, @@ -7460,16 +5128,44 @@ "binop": null, "updateContext": null }, - "start": 679, - "end": 680, + "start": 599, + "end": 600, "loc": { "start": { - "line": 31, - "column": 12 + "line": 27, + "column": 30 }, "end": { - "line": 31, - "column": 13 + "line": 27, + "column": 31 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 603, + "end": 607, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 6 } } }, @@ -7485,17 +5181,17 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 683, - "end": 684, + "value": "p", + "start": 608, + "end": 609, "loc": { "start": { - "line": 33, - "column": 1 + "line": 28, + "column": 7 }, "end": { - "line": 33, - "column": 2 + "line": 28, + "column": 8 } } }, @@ -7512,16 +5208,16 @@ "binop": null, "updateContext": null }, - "start": 684, - "end": 685, + "start": 609, + "end": 610, "loc": { "start": { - "line": 33, - "column": 2 + "line": 28, + "column": 8 }, "end": { - "line": 33, - "column": 3 + "line": 28, + "column": 9 } } }, @@ -7537,17 +5233,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 685, - "end": 689, + "value": "right", + "start": 610, + "end": 615, "loc": { "start": { - "line": 33, - "column": 3 + "line": 28, + "column": 9 }, "end": { - "line": 33, - "column": 7 + "line": 28, + "column": 14 } } }, @@ -7565,16 +5261,16 @@ "updateContext": null }, "value": "=", - "start": 690, - "end": 691, + "start": 616, + "end": 617, "loc": { "start": { - "line": 33, - "column": 8 + "line": 28, + "column": 15 }, "end": { - "line": 33, - "column": 9 + "line": 28, + "column": 16 } } }, @@ -7590,17 +5286,17 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 692, - "end": 693, + "value": "A", + "start": 618, + "end": 619, "loc": { "start": { - "line": 33, - "column": 10 + "line": 28, + "column": 17 }, "end": { - "line": 33, - "column": 11 + "line": 28, + "column": 18 } } }, @@ -7617,16 +5313,41 @@ "binop": null, "updateContext": null }, - "start": 693, - "end": 694, + "start": 619, + "end": 620, "loc": { "start": { - "line": 33, - "column": 11 + "line": 28, + "column": 18 }, "end": { - "line": 33, - "column": 12 + "line": 28, + "column": 19 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 622, + "end": 623, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 2 } } }, @@ -7643,15 +5364,15 @@ "binop": null }, "value": "A", - "start": 696, - "end": 697, + "start": 626, + "end": 627, "loc": { "start": { - "line": 34, + "line": 31, "column": 1 }, "end": { - "line": 34, + "line": 31, "column": 2 } } @@ -7669,15 +5390,15 @@ "binop": null, "updateContext": null }, - "start": 697, - "end": 698, + "start": 627, + "end": 628, "loc": { "start": { - "line": 34, + "line": 31, "column": 2 }, "end": { - "line": 34, + "line": 31, "column": 3 } } @@ -7694,17 +5415,17 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 698, - "end": 703, + "value": "parent", + "start": 628, + "end": 634, "loc": { "start": { - "line": 34, + "line": 31, "column": 3 }, "end": { - "line": 34, - "column": 8 + "line": 31, + "column": 9 } } }, @@ -7722,16 +5443,16 @@ "updateContext": null }, "value": "=", - "start": 704, - "end": 705, + "start": 635, + "end": 636, "loc": { "start": { - "line": 34, - "column": 9 + "line": 31, + "column": 10 }, "end": { - "line": 34, - "column": 10 + "line": 31, + "column": 11 } } }, @@ -7747,17 +5468,17 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 706, - "end": 707, + "value": "p", + "start": 637, + "end": 638, "loc": { "start": { - "line": 34, - "column": 11 + "line": 31, + "column": 12 }, "end": { - "line": 34, - "column": 12 + "line": 31, + "column": 13 } } }, @@ -7774,69 +5495,68 @@ "binop": null, "updateContext": null }, - "start": 707, - "end": 708, + "start": 638, + "end": 639, "loc": { "start": { - "line": 34, - "column": 12 + "line": 31, + "column": 13 }, "end": { - "line": 34, - "column": 13 + "line": 31, + "column": 14 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 711, - "end": 713, + "value": "B", + "start": 641, + "end": 642, "loc": { "start": { - "line": 36, + "line": 32, "column": 1 }, "end": { - "line": 36, - "column": 3 + "line": 32, + "column": 2 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 714, - "end": 715, + "start": 642, + "end": 643, "loc": { "start": { - "line": 36, - "column": 4 + "line": 32, + "column": 2 }, "end": { - "line": 36, - "column": 5 + "line": 32, + "column": 3 } } }, @@ -7852,53 +5572,78 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 715, - "end": 716, + "value": "parent", + "start": 643, + "end": 649, "loc": { "start": { - "line": 36, - "column": 5 + "line": 32, + "column": 3 }, "end": { - "line": 36, - "column": 6 + "line": 32, + "column": 9 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "!==", - "start": 717, - "end": 720, + "value": "=", + "start": 650, + "end": 651, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 652, + "end": 653, "loc": { "start": { - "line": 36, - "column": 7 + "line": 32, + "column": 12 }, "end": { - "line": 36, - "column": 10 + "line": 32, + "column": 13 } } }, { "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7907,23 +5652,23 @@ "binop": null, "updateContext": null }, - "value": "null", - "start": 721, - "end": 725, + "start": 653, + "end": 654, "loc": { "start": { - "line": 36, - "column": 11 + "line": 32, + "column": 13 }, "end": { - "line": 36, - "column": 15 + "line": 32, + "column": 14 } } }, { "type": { - "label": ")", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -7931,18 +5676,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 725, - "end": 726, + "value": "const", + "start": 657, + "end": 662, "loc": { "start": { - "line": 36, - "column": 15 + "line": 34, + "column": 1 }, "end": { - "line": 36, - "column": 16 + "line": 34, + "column": 6 } } }, @@ -7958,43 +5705,44 @@ "postfix": false, "binop": null }, - "value": "a", - "start": 727, - "end": 728, + "value": "b", + "start": 663, + "end": 664, "loc": { "start": { - "line": 36, - "column": 17 + "line": 34, + "column": 7 }, "end": { - "line": 36, - "column": 18 + "line": 34, + "column": 8 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 728, - "end": 729, + "value": "=", + "start": 665, + "end": 666, "loc": { "start": { - "line": 36, - "column": 18 + "line": 34, + "column": 9 }, "end": { - "line": 36, - "column": 19 + "line": 34, + "column": 10 } } }, @@ -8010,44 +5758,43 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 729, - "end": 735, + "value": "A", + "start": 667, + "end": 668, "loc": { "start": { - "line": 36, - "column": 19 + "line": 34, + "column": 11 }, "end": { - "line": 36, - "column": 25 + "line": 34, + "column": 12 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 736, - "end": 737, + "start": 668, + "end": 669, "loc": { "start": { - "line": 36, - "column": 26 + "line": 34, + "column": 12 }, "end": { - "line": 36, - "column": 27 + "line": 34, + "column": 13 } } }, @@ -8063,17 +5810,17 @@ "postfix": false, "binop": null }, - "value": "B", - "start": 738, - "end": 739, + "value": "right", + "start": 669, + "end": 674, "loc": { "start": { - "line": 36, - "column": 28 + "line": 34, + "column": 13 }, "end": { - "line": 36, - "column": 29 + "line": 34, + "column": 18 } } }, @@ -8090,69 +5837,68 @@ "binop": null, "updateContext": null }, - "start": 739, - "end": 740, + "start": 674, + "end": 675, "loc": { "start": { - "line": 36, - "column": 29 + "line": 34, + "column": 18 }, "end": { - "line": 36, - "column": 30 + "line": 34, + "column": 19 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 742, - "end": 744, + "value": "B", + "start": 677, + "end": 678, "loc": { "start": { - "line": 37, + "line": 35, "column": 1 }, "end": { - "line": 37, - "column": 3 + "line": 35, + "column": 2 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 745, - "end": 746, + "start": 678, + "end": 679, "loc": { "start": { - "line": 37, - "column": 4 + "line": 35, + "column": 2 }, "end": { - "line": 37, - "column": 5 + "line": 35, + "column": 3 } } }, @@ -8168,51 +5914,50 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 746, - "end": 747, + "value": "left", + "start": 679, + "end": 683, "loc": { "start": { - "line": 37, - "column": 5 + "line": 35, + "column": 3 }, "end": { - "line": 37, - "column": 6 + "line": 35, + "column": 7 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "!==", - "start": 748, - "end": 751, + "value": "=", + "start": 684, + "end": 685, "loc": { "start": { - "line": 37, - "column": 7 + "line": 35, + "column": 8 }, "end": { - "line": 37, - "column": 10 + "line": 35, + "column": 9 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8220,45 +5965,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 752, - "end": 756, + "value": "b", + "start": 686, + "end": 687, "loc": { "start": { - "line": 37, - "column": 11 + "line": 35, + "column": 10 }, "end": { - "line": 37, - "column": 15 + "line": 35, + "column": 11 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 756, - "end": 757, + "start": 687, + "end": 688, "loc": { "start": { - "line": 37, - "column": 15 + "line": 35, + "column": 11 }, "end": { - "line": 37, - "column": 16 + "line": 35, + "column": 12 } } }, @@ -8274,17 +6019,17 @@ "postfix": false, "binop": null }, - "value": "b", - "start": 758, - "end": 759, + "value": "A", + "start": 690, + "end": 691, "loc": { "start": { - "line": 37, - "column": 17 + "line": 36, + "column": 1 }, "end": { - "line": 37, - "column": 18 + "line": 36, + "column": 2 } } }, @@ -8301,16 +6046,16 @@ "binop": null, "updateContext": null }, - "start": 759, - "end": 760, + "start": 691, + "end": 692, "loc": { "start": { - "line": 37, - "column": 18 + "line": 36, + "column": 2 }, "end": { - "line": 37, - "column": 19 + "line": 36, + "column": 3 } } }, @@ -8326,17 +6071,17 @@ "postfix": false, "binop": null }, - "value": "parent", - "start": 760, - "end": 766, + "value": "right", + "start": 692, + "end": 697, "loc": { "start": { - "line": 37, - "column": 19 + "line": 36, + "column": 3 }, "end": { - "line": 37, - "column": 25 + "line": 36, + "column": 8 } } }, @@ -8354,16 +6099,16 @@ "updateContext": null }, "value": "=", - "start": 767, - "end": 768, + "start": 698, + "end": 699, "loc": { "start": { - "line": 37, - "column": 26 + "line": 36, + "column": 9 }, "end": { - "line": 37, - "column": 27 + "line": 36, + "column": 10 } } }, @@ -8379,17 +6124,17 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 769, - "end": 770, + "value": "B", + "start": 700, + "end": 701, "loc": { "start": { - "line": 37, - "column": 28 + "line": 36, + "column": 11 }, "end": { - "line": 37, - "column": 29 + "line": 36, + "column": 12 } } }, @@ -8406,16 +6151,16 @@ "binop": null, "updateContext": null }, - "start": 770, - "end": 771, + "start": 701, + "end": 702, "loc": { "start": { - "line": 37, - "column": 29 + "line": 36, + "column": 12 }, "end": { - "line": 37, - "column": 30 + "line": 36, + "column": 13 } } }, @@ -8434,8 +6179,8 @@ "updateContext": null }, "value": "if", - "start": 773, - "end": 775, + "start": 705, + "end": 707, "loc": { "start": { "line": 38, @@ -8459,8 +6204,8 @@ "postfix": false, "binop": null }, - "start": 776, - "end": 777, + "start": 708, + "end": 709, "loc": { "start": { "line": 38, @@ -8484,9 +6229,9 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 777, - "end": 778, + "value": "b", + "start": 709, + "end": 710, "loc": { "start": { "line": 38, @@ -8512,8 +6257,8 @@ "updateContext": null }, "value": "!==", - "start": 779, - "end": 782, + "start": 711, + "end": 714, "loc": { "start": { "line": 38, @@ -8540,8 +6285,8 @@ "updateContext": null }, "value": "null", - "start": 783, - "end": 787, + "start": 715, + "end": 719, "loc": { "start": { "line": 38, @@ -8565,8 +6310,8 @@ "postfix": false, "binop": null }, - "start": 787, - "end": 788, + "start": 719, + "end": 720, "loc": { "start": { "line": 38, @@ -8590,9 +6335,9 @@ "postfix": false, "binop": null }, - "value": "c", - "start": 789, - "end": 790, + "value": "b", + "start": 721, + "end": 722, "loc": { "start": { "line": 38, @@ -8617,8 +6362,8 @@ "binop": null, "updateContext": null }, - "start": 790, - "end": 791, + "start": 722, + "end": 723, "loc": { "start": { "line": 38, @@ -8643,8 +6388,8 @@ "binop": null }, "value": "parent", - "start": 791, - "end": 797, + "start": 723, + "end": 729, "loc": { "start": { "line": 38, @@ -8670,8 +6415,8 @@ "updateContext": null }, "value": "=", - "start": 798, - "end": 799, + "start": 730, + "end": 731, "loc": { "start": { "line": 38, @@ -8695,9 +6440,9 @@ "postfix": false, "binop": null }, - "value": "A", - "start": 800, - "end": 801, + "value": "B", + "start": 732, + "end": 733, "loc": { "start": { "line": 38, @@ -8722,8 +6467,8 @@ "binop": null, "updateContext": null }, - "start": 801, - "end": 802, + "start": 733, + "end": 734, "loc": { "start": { "line": 38, @@ -8747,8 +6492,8 @@ "postfix": false, "binop": null }, - "start": 803, - "end": 804, + "start": 735, + "end": 736, "loc": { "start": { "line": 39, @@ -8773,8 +6518,8 @@ "binop": null, "updateContext": null }, - "start": 804, - "end": 805, + "start": 736, + "end": 737, "loc": { "start": { "line": 39, @@ -8801,8 +6546,8 @@ "updateContext": null }, "value": "export", - "start": 807, - "end": 813, + "start": 739, + "end": 745, "loc": { "start": { "line": 41, @@ -8829,8 +6574,8 @@ "updateContext": null }, "value": "default", - "start": 814, - "end": 821, + "start": 746, + "end": 753, "loc": { "start": { "line": 41, @@ -8855,8 +6600,8 @@ "binop": null }, "value": "rotate_right", - "start": 822, - "end": 834, + "start": 754, + "end": 766, "loc": { "start": { "line": 41, @@ -8881,8 +6626,8 @@ "binop": null, "updateContext": null }, - "start": 834, - "end": 835, + "start": 766, + "end": 767, "loc": { "start": { "line": 41, @@ -8907,8 +6652,8 @@ "binop": null, "updateContext": null }, - "start": 836, - "end": 836, + "start": 768, + "end": 768, "loc": { "start": { "line": 42, diff --git a/ast/source/swap/swap_color.js.json b/ast/source/swap/swap_color.js.json new file mode 100644 index 0000000..0bf1830 --- /dev/null +++ b/ast/source/swap/swap_color.js.json @@ -0,0 +1,3245 @@ +{ + "type": "File", + "start": 0, + "end": 430, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 23, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 430, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 23, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap colors of two arbitrary nodes.\n *\n * -A +B -> +A -B\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n ", + "start": 67, + "end": 243, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 245, + "end": 401, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 20, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 251, + "end": 400, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 251, + "end": 261, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 16 + }, + "identifierName": "swap_color" + }, + "name": "swap_color", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 264, + "end": 400, + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 265, + "end": 266, + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 21 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 268, + "end": 269, + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + }, + "identifierName": "B" + }, + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 274, + "end": 400, + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 277, + "end": 303, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 277, + "end": 302, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 277, + "end": 283, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 284, + "end": 301, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 284, + "end": 285, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 297, + "end": 301, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 305, + "end": 331, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 305, + "end": 330, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 305, + "end": 311, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 312, + "end": 329, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 312, + "end": 313, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 325, + "end": 329, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 334, + "end": 357, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 340, + "end": 356, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 340, + "end": 345, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 12 + }, + "identifierName": "color" + }, + "name": "color" + }, + "init": { + "type": "MemberExpression", + "start": 348, + "end": 356, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 348, + "end": 349, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 350, + "end": 356, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 359, + "end": 379, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 359, + "end": 378, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 20 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 359, + "end": 367, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 359, + "end": 360, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 361, + "end": 367, + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "MemberExpression", + "start": 370, + "end": 378, + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 370, + "end": 371, + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 372, + "end": 378, + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 20 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + } + }, + { + "type": "ExpressionStatement", + "start": 381, + "end": 398, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 18 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 381, + "end": 397, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 17 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 381, + "end": 389, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 381, + "end": 382, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 383, + "end": 389, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 392, + "end": 397, + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + }, + "identifierName": "color" + }, + "name": "color" + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 403, + "end": 429, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 26 + } + }, + "declaration": { + "type": "Identifier", + "start": 418, + "end": 428, + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 25 + }, + "identifierName": "swap_color" + }, + "name": "swap_color" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 403, + "end": 429, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 26 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 245, + "end": 401, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 20, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 251, + "end": 400, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 251, + "end": 261, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 16 + }, + "identifierName": "swap_color" + }, + "name": "swap_color", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 264, + "end": 400, + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 251, + "end": 261, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 16 + }, + "identifierName": "swap_color" + }, + "name": "swap_color", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 265, + "end": 266, + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 21 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 268, + "end": 269, + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + }, + "identifierName": "B" + }, + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 274, + "end": 400, + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 20, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 277, + "end": 303, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 277, + "end": 302, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 277, + "end": 283, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 284, + "end": 301, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 284, + "end": 285, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 297, + "end": 301, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 305, + "end": 331, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 305, + "end": 330, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 305, + "end": 311, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 312, + "end": 329, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 312, + "end": 313, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 325, + "end": 329, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 334, + "end": 357, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 24 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 340, + "end": 356, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 23 + } + }, + "id": { + "type": "Identifier", + "start": 340, + "end": 345, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 12 + }, + "identifierName": "color" + }, + "name": "color" + }, + "init": { + "type": "MemberExpression", + "start": 348, + "end": 356, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 23 + } + }, + "object": { + "type": "Identifier", + "start": 348, + "end": 349, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 350, + "end": 356, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 23 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 359, + "end": 379, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 359, + "end": 378, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 20 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 359, + "end": 367, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 359, + "end": 360, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 361, + "end": 367, + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "MemberExpression", + "start": 370, + "end": 378, + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 370, + "end": 371, + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 372, + "end": 378, + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 20 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + } + } + }, + { + "type": "ExpressionStatement", + "start": 381, + "end": 398, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 18 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 381, + "end": 397, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 17 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 381, + "end": 389, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 381, + "end": 382, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 383, + "end": 389, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 9 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 392, + "end": 397, + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + }, + "identifierName": "color" + }, + "name": "color" + } + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap colors of two arbitrary nodes.\n *\n * -A +B -> +A -B\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n ", + "start": 67, + "end": 243, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap colors of two arbitrary nodes.\n *\n * -A +B -> +A -B\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n ", + "start": 67, + "end": 243, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Swap colors of two arbitrary nodes.\n *\n * -A +B -> +A -B\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n ", + "start": 67, + "end": 243, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 11, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 245, + "end": 250, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_color", + "start": 251, + "end": 261, + "loc": { + "start": { + "line": 13, + "column": 6 + }, + "end": { + "line": 13, + "column": 16 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 262, + "end": 263, + "loc": { + "start": { + "line": 13, + "column": 17 + }, + "end": { + "line": 13, + "column": 18 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 264, + "end": 265, + "loc": { + "start": { + "line": 13, + "column": 19 + }, + "end": { + "line": 13, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 265, + "end": 266, + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 21 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 266, + "end": 267, + "loc": { + "start": { + "line": 13, + "column": 21 + }, + "end": { + "line": 13, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 268, + "end": 269, + "loc": { + "start": { + "line": 13, + "column": 23 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 269, + "end": 270, + "loc": { + "start": { + "line": 13, + "column": 24 + }, + "end": { + "line": 13, + "column": 25 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 271, + "end": 273, + "loc": { + "start": { + "line": 13, + "column": 26 + }, + "end": { + "line": 13, + "column": 28 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 274, + "end": 275, + "loc": { + "start": { + "line": 13, + "column": 29 + }, + "end": { + "line": 13, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 277, + "end": 283, + "loc": { + "start": { + "line": 14, + "column": 1 + }, + "end": { + "line": 14, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 283, + "end": 284, + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 284, + "end": 285, + "loc": { + "start": { + "line": 14, + "column": 8 + }, + "end": { + "line": 14, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 286, + "end": 296, + "loc": { + "start": { + "line": 14, + "column": 10 + }, + "end": { + "line": 14, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 297, + "end": 301, + "loc": { + "start": { + "line": 14, + "column": 21 + }, + "end": { + "line": 14, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 301, + "end": 302, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 302, + "end": 303, + "loc": { + "start": { + "line": 14, + "column": 26 + }, + "end": { + "line": 14, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 305, + "end": 311, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 311, + "end": 312, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 312, + "end": 313, + "loc": { + "start": { + "line": 15, + "column": 8 + }, + "end": { + "line": 15, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 314, + "end": 324, + "loc": { + "start": { + "line": 15, + "column": 10 + }, + "end": { + "line": 15, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 325, + "end": 329, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 329, + "end": 330, + "loc": { + "start": { + "line": 15, + "column": 25 + }, + "end": { + "line": 15, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 330, + "end": 331, + "loc": { + "start": { + "line": 15, + "column": 26 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 334, + "end": 339, + "loc": { + "start": { + "line": 17, + "column": 1 + }, + "end": { + "line": 17, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "color", + "start": 340, + "end": 345, + "loc": { + "start": { + "line": 17, + "column": 7 + }, + "end": { + "line": 17, + "column": 12 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 346, + "end": 347, + "loc": { + "start": { + "line": 17, + "column": 13 + }, + "end": { + "line": 17, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 348, + "end": 349, + "loc": { + "start": { + "line": 17, + "column": 15 + }, + "end": { + "line": 17, + "column": 16 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 349, + "end": 350, + "loc": { + "start": { + "line": 17, + "column": 16 + }, + "end": { + "line": 17, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 350, + "end": 356, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 23 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 356, + "end": 357, + "loc": { + "start": { + "line": 17, + "column": 23 + }, + "end": { + "line": 17, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 359, + "end": 360, + "loc": { + "start": { + "line": 18, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 360, + "end": 361, + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 361, + "end": 367, + "loc": { + "start": { + "line": 18, + "column": 3 + }, + "end": { + "line": 18, + "column": 9 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 368, + "end": 369, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 370, + "end": 371, + "loc": { + "start": { + "line": 18, + "column": 12 + }, + "end": { + "line": 18, + "column": 13 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 371, + "end": 372, + "loc": { + "start": { + "line": 18, + "column": 13 + }, + "end": { + "line": 18, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 372, + "end": 378, + "loc": { + "start": { + "line": 18, + "column": 14 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 378, + "end": 379, + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 381, + "end": 382, + "loc": { + "start": { + "line": 19, + "column": 1 + }, + "end": { + "line": 19, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 382, + "end": 383, + "loc": { + "start": { + "line": 19, + "column": 2 + }, + "end": { + "line": 19, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 383, + "end": 389, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 9 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 390, + "end": 391, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "color", + "start": 392, + "end": 397, + "loc": { + "start": { + "line": 19, + "column": 12 + }, + "end": { + "line": 19, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 397, + "end": 398, + "loc": { + "start": { + "line": 19, + "column": 17 + }, + "end": { + "line": 19, + "column": 18 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 399, + "end": 400, + "loc": { + "start": { + "line": 20, + "column": 0 + }, + "end": { + "line": 20, + "column": 1 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 400, + "end": 401, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 20, + "column": 2 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 403, + "end": 409, + "loc": { + "start": { + "line": 22, + "column": 0 + }, + "end": { + "line": 22, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 410, + "end": 417, + "loc": { + "start": { + "line": 22, + "column": 7 + }, + "end": { + "line": 22, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_color", + "start": 418, + "end": 428, + "loc": { + "start": { + "line": 22, + "column": 15 + }, + "end": { + "line": 22, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 428, + "end": 429, + "loc": { + "start": { + "line": 22, + "column": 25 + }, + "end": { + "line": 22, + "column": 26 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 430, + "end": 430, + "loc": { + "start": { + "line": 23, + "column": 0 + }, + "end": { + "line": 23, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/swap/swap_left.js.json b/ast/source/swap/swap_left.js.json new file mode 100644 index 0000000..c384364 --- /dev/null +++ b/ast/source/swap/swap_left.js.json @@ -0,0 +1,8837 @@ +{ + "type": "File", + "start": 0, + "end": 1115, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 54, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 1115, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 54, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 121, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 55 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 19 + }, + "identifierName": "replace_node" + }, + "name": "replace_node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 91, + "end": 120, + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 54 + } + }, + "extra": { + "rawValue": "../deletion/replace_node.js", + "raw": "'../deletion/replace_node.js'" + }, + "value": "../deletion/replace_node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 122, + "end": 163, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 41 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 129, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 17 + } + }, + "local": { + "type": "Identifier", + "start": 129, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 17 + }, + "identifierName": "swap_color" + }, + "name": "swap_color" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 145, + "end": 162, + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 40 + } + }, + "extra": { + "rawValue": "./swap_color.js", + "raw": "'./swap_color.js'" + }, + "value": "./swap_color.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap pointers and colors of a node and its left child B with one constraint:\n * - B's right child is a leaf\n *\n * NOTE: This constraint is implied because B is A's in-subtree predecessor.\n *\n * p p\n * | |\n * -A -B\n * / \\ / \\\n * +B c -> +A c\n * / \\ / \\\n * a - a -\n *\n * @param {Node} A - The node.\n * @return {Node} The node B.\n ", + "start": 165, + "end": 665, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 667, + "end": 1087, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 51, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 673, + "end": 1086, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 51, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 673, + "end": 682, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "swap_left" + }, + "name": "swap_left", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 685, + "end": 1086, + "loc": { + "start": { + "line": 24, + "column": 18 + }, + "end": { + "line": 51, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 686, + "end": 687, + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 20 + }, + "identifierName": "A" + }, + "name": "A" + } + ], + "body": { + "type": "BlockStatement", + "start": 692, + "end": 1086, + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 51, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 695, + "end": 721, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 695, + "end": 720, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 695, + "end": 701, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 702, + "end": 719, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 702, + "end": 703, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 715, + "end": 719, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 723, + "end": 740, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 729, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 729, + "end": 730, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "MemberExpression", + "start": 733, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 733, + "end": 734, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 735, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 13 + }, + "end": { + "line": 26, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 742, + "end": 768, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 742, + "end": 767, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 742, + "end": 748, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 749, + "end": 766, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 749, + "end": 750, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 762, + "end": 766, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 770, + "end": 787, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 776, + "end": 786, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 776, + "end": 777, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "MemberExpression", + "start": 780, + "end": 786, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 780, + "end": 781, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 782, + "end": 786, + "loc": { + "start": { + "line": 28, + "column": 13 + }, + "end": { + "line": 28, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 789, + "end": 814, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 789, + "end": 813, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 789, + "end": 795, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 796, + "end": 812, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 796, + "end": 803, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 796, + "end": 797, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 798, + "end": 803, + "loc": { + "start": { + "line": 29, + "column": 10 + }, + "end": { + "line": 29, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 808, + "end": 812, + "loc": { + "start": { + "line": 29, + "column": 20 + }, + "end": { + "line": 29, + "column": 24 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 816, + "end": 834, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 822, + "end": 833, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 822, + "end": 823, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 8 + }, + "identifierName": "c" + }, + "name": "c" + }, + "init": { + "type": "MemberExpression", + "start": 826, + "end": 833, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 826, + "end": 827, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 828, + "end": 833, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 837, + "end": 915, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 36, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 841, + "end": 858, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 841, + "end": 849, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 841, + "end": 842, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 843, + "end": 849, + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 854, + "end": 858, + "loc": { + "start": { + "line": 32, + "column": 18 + }, + "end": { + "line": 32, + "column": 22 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 860, + "end": 883, + "loc": { + "start": { + "line": 32, + "column": 24 + }, + "end": { + "line": 34, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 864, + "end": 880, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 18 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 864, + "end": 879, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 17 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 864, + "end": 872, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 864, + "end": 865, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 866, + "end": 872, + "loc": { + "start": { + "line": 33, + "column": 4 + }, + "end": { + "line": 33, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 875, + "end": 879, + "loc": { + "start": { + "line": 33, + "column": 13 + }, + "end": { + "line": 33, + "column": 17 + } + } + } + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 889, + "end": 915, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 36, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 893, + "end": 912, + "loc": { + "start": { + "line": 35, + "column": 2 + }, + "end": { + "line": 35, + "column": 21 + } + }, + "expression": { + "type": "CallExpression", + "start": 893, + "end": 911, + "loc": { + "start": { + "line": 35, + "column": 2 + }, + "end": { + "line": 35, + "column": 20 + } + }, + "callee": { + "type": "Identifier", + "start": 893, + "end": 905, + "loc": { + "start": { + "line": 35, + "column": 2 + }, + "end": { + "line": 35, + "column": 14 + }, + "identifierName": "replace_node" + }, + "name": "replace_node" + }, + "arguments": [ + { + "type": "Identifier", + "start": 906, + "end": 907, + "loc": { + "start": { + "line": 35, + "column": 15 + }, + "end": { + "line": 35, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 909, + "end": 910, + "loc": { + "start": { + "line": 35, + "column": 18 + }, + "end": { + "line": 35, + "column": 19 + }, + "identifierName": "B" + }, + "name": "B" + } + ] + } + } + ], + "directives": [] + } + }, + { + "type": "ExpressionStatement", + "start": 918, + "end": 931, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 918, + "end": 930, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 918, + "end": 926, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 918, + "end": 919, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 920, + "end": 926, + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 929, + "end": 930, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 934, + "end": 949, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 934, + "end": 948, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 934, + "end": 941, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 934, + "end": 935, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 936, + "end": 941, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 944, + "end": 948, + "loc": { + "start": { + "line": 40, + "column": 11 + }, + "end": { + "line": 40, + "column": 15 + } + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 951, + "end": 963, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 951, + "end": 962, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 951, + "end": 958, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 951, + "end": 952, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 953, + "end": 958, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 961, + "end": 962, + "loc": { + "start": { + "line": 41, + "column": 11 + }, + "end": { + "line": 41, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + } + } + }, + { + "type": "IfStatement", + "start": 965, + "end": 994, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 42, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 969, + "end": 979, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 969, + "end": 970, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 6 + }, + "identifierName": "c" + }, + "name": "c" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 975, + "end": 979, + "loc": { + "start": { + "line": 42, + "column": 11 + }, + "end": { + "line": 42, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 981, + "end": 994, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 981, + "end": 993, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 981, + "end": 989, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 981, + "end": 982, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 18 + }, + "identifierName": "c" + }, + "name": "c" + }, + "property": { + "type": "Identifier", + "start": 983, + "end": 989, + "loc": { + "start": { + "line": 42, + "column": 19 + }, + "end": { + "line": 42, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 992, + "end": 993, + "loc": { + "start": { + "line": 42, + "column": 28 + }, + "end": { + "line": 42, + "column": 29 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 997, + "end": 1008, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 997, + "end": 1007, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 997, + "end": 1003, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 997, + "end": 998, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 999, + "end": 1003, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1006, + "end": 1007, + "loc": { + "start": { + "line": 44, + "column": 10 + }, + "end": { + "line": 44, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + } + }, + { + "type": "IfStatement", + "start": 1010, + "end": 1039, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1014, + "end": 1024, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1014, + "end": 1015, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1020, + "end": 1024, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1026, + "end": 1039, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1026, + "end": 1038, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1026, + "end": 1034, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 1026, + "end": 1027, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 18 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 1028, + "end": 1034, + "loc": { + "start": { + "line": 45, + "column": 19 + }, + "end": { + "line": 45, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1037, + "end": 1038, + "loc": { + "start": { + "line": 45, + "column": 28 + }, + "end": { + "line": 45, + "column": 29 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 1041, + "end": 1052, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1041, + "end": 1051, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1041, + "end": 1047, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 1041, + "end": 1042, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1043, + "end": 1047, + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1050, + "end": 1051, + "loc": { + "start": { + "line": 46, + "column": 10 + }, + "end": { + "line": 46, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1055, + "end": 1072, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1055, + "end": 1071, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1055, + "end": 1065, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 11 + }, + "identifierName": "swap_color" + }, + "name": "swap_color" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1066, + "end": 1067, + "loc": { + "start": { + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 1069, + "end": 1070, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "B" + }, + "name": "B" + } + ] + } + }, + { + "type": "ReturnStatement", + "start": 1075, + "end": 1084, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 10 + } + }, + "argument": { + "type": "Identifier", + "start": 1082, + "end": 1083, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 50, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1089, + "end": 1114, + "loc": { + "start": { + "line": 53, + "column": 0 + }, + "end": { + "line": 53, + "column": 25 + } + }, + "declaration": { + "type": "Identifier", + "start": 1104, + "end": 1113, + "loc": { + "start": { + "line": 53, + "column": 15 + }, + "end": { + "line": 53, + "column": 24 + }, + "identifierName": "swap_left" + }, + "name": "swap_left" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1089, + "end": 1114, + "loc": { + "start": { + "line": 53, + "column": 0 + }, + "end": { + "line": 53, + "column": 25 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 667, + "end": 1087, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 51, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 673, + "end": 1086, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 51, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 673, + "end": 682, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "swap_left" + }, + "name": "swap_left", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 685, + "end": 1086, + "loc": { + "start": { + "line": 24, + "column": 18 + }, + "end": { + "line": 51, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 673, + "end": 682, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 15 + }, + "identifierName": "swap_left" + }, + "name": "swap_left", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 686, + "end": 687, + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 20 + }, + "identifierName": "A" + }, + "name": "A" + } + ], + "body": { + "type": "BlockStatement", + "start": 692, + "end": 1086, + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 51, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 695, + "end": 721, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 695, + "end": 720, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 695, + "end": 701, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 702, + "end": 719, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 702, + "end": 703, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 715, + "end": 719, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 723, + "end": 740, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 729, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 729, + "end": 730, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + }, + "identifierName": "B" + }, + "name": "B" + }, + "init": { + "type": "MemberExpression", + "start": 733, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 733, + "end": 734, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 735, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 13 + }, + "end": { + "line": 26, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 742, + "end": 768, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 742, + "end": 767, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 742, + "end": 748, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 749, + "end": 766, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 749, + "end": 750, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 762, + "end": 766, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 770, + "end": 787, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 776, + "end": 786, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 776, + "end": 777, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + }, + "identifierName": "a" + }, + "name": "a" + }, + "init": { + "type": "MemberExpression", + "start": 780, + "end": 786, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 780, + "end": 781, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 782, + "end": 786, + "loc": { + "start": { + "line": 28, + "column": 13 + }, + "end": { + "line": 28, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 789, + "end": 814, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 789, + "end": 813, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 789, + "end": 795, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 796, + "end": 812, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 796, + "end": 803, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 796, + "end": 797, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 798, + "end": 803, + "loc": { + "start": { + "line": 29, + "column": 10 + }, + "end": { + "line": 29, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 808, + "end": 812, + "loc": { + "start": { + "line": 29, + "column": 20 + }, + "end": { + "line": 29, + "column": 24 + } + } + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 816, + "end": 834, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 822, + "end": 833, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 822, + "end": 823, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 8 + }, + "identifierName": "c" + }, + "name": "c" + }, + "init": { + "type": "MemberExpression", + "start": 826, + "end": 833, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 826, + "end": 827, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 828, + "end": 833, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 837, + "end": 915, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 36, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 841, + "end": 858, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 22 + } + }, + "left": { + "type": "MemberExpression", + "start": 841, + "end": 849, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 13 + } + }, + "object": { + "type": "Identifier", + "start": 841, + "end": 842, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 6 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 843, + "end": 849, + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 13 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 854, + "end": 858, + "loc": { + "start": { + "line": 32, + "column": 18 + }, + "end": { + "line": 32, + "column": 22 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 860, + "end": 883, + "loc": { + "start": { + "line": 32, + "column": 24 + }, + "end": { + "line": 34, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 864, + "end": 880, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 18 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 864, + "end": 879, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 17 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 864, + "end": 872, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 10 + } + }, + "object": { + "type": "Identifier", + "start": 864, + "end": 865, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 3 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 866, + "end": 872, + "loc": { + "start": { + "line": 33, + "column": 4 + }, + "end": { + "line": 33, + "column": 10 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 875, + "end": 879, + "loc": { + "start": { + "line": 33, + "column": 13 + }, + "end": { + "line": 33, + "column": 17 + } + } + } + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 889, + "end": 915, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 36, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 893, + "end": 912, + "loc": { + "start": { + "line": 35, + "column": 2 + }, + "end": { + "line": 35, + "column": 21 + } + }, + "expression": { + "type": "CallExpression", + "start": 893, + "end": 911, + "loc": { + "start": { + "line": 35, + "column": 2 + }, + "end": { + "line": 35, + "column": 20 + } + }, + "callee": { + "type": "Identifier", + "start": 893, + "end": 905, + "loc": { + "start": { + "line": 35, + "column": 2 + }, + "end": { + "line": 35, + "column": 14 + }, + "identifierName": "replace_node" + }, + "name": "replace_node" + }, + "arguments": [ + { + "type": "Identifier", + "start": 906, + "end": 907, + "loc": { + "start": { + "line": 35, + "column": 15 + }, + "end": { + "line": 35, + "column": 16 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 909, + "end": 910, + "loc": { + "start": { + "line": 35, + "column": 18 + }, + "end": { + "line": 35, + "column": 19 + }, + "identifierName": "B" + }, + "name": "B" + } + ] + } + } + ], + "directives": [] + } + }, + { + "type": "ExpressionStatement", + "start": 918, + "end": 931, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 918, + "end": 930, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 918, + "end": 926, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 918, + "end": 919, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 920, + "end": 926, + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 929, + "end": 930, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 13 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + { + "type": "ExpressionStatement", + "start": 934, + "end": 949, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 934, + "end": 948, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 934, + "end": 941, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 934, + "end": 935, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 936, + "end": 941, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 944, + "end": 948, + "loc": { + "start": { + "line": 40, + "column": 11 + }, + "end": { + "line": 40, + "column": 15 + } + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 951, + "end": 963, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 951, + "end": 962, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 951, + "end": 958, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 951, + "end": 952, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 953, + "end": 958, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 961, + "end": 962, + "loc": { + "start": { + "line": 41, + "column": 11 + }, + "end": { + "line": 41, + "column": 12 + }, + "identifierName": "c" + }, + "name": "c" + } + } + }, + { + "type": "IfStatement", + "start": 965, + "end": 994, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 42, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 969, + "end": 979, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 969, + "end": 970, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 6 + }, + "identifierName": "c" + }, + "name": "c" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 975, + "end": 979, + "loc": { + "start": { + "line": 42, + "column": 11 + }, + "end": { + "line": 42, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 981, + "end": 994, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 981, + "end": 993, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 981, + "end": 989, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 981, + "end": 982, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 18 + }, + "identifierName": "c" + }, + "name": "c" + }, + "property": { + "type": "Identifier", + "start": 983, + "end": 989, + "loc": { + "start": { + "line": 42, + "column": 19 + }, + "end": { + "line": 42, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 992, + "end": 993, + "loc": { + "start": { + "line": 42, + "column": 28 + }, + "end": { + "line": 42, + "column": 29 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 997, + "end": 1008, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 997, + "end": 1007, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 997, + "end": 1003, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 997, + "end": 998, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 999, + "end": 1003, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1006, + "end": 1007, + "loc": { + "start": { + "line": 44, + "column": 10 + }, + "end": { + "line": 44, + "column": 11 + }, + "identifierName": "a" + }, + "name": "a" + } + } + }, + { + "type": "IfStatement", + "start": 1010, + "end": 1039, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1014, + "end": 1024, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1014, + "end": 1015, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1020, + "end": 1024, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1026, + "end": 1039, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1026, + "end": 1038, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1026, + "end": 1034, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 1026, + "end": 1027, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 18 + }, + "identifierName": "a" + }, + "name": "a" + }, + "property": { + "type": "Identifier", + "start": 1028, + "end": 1034, + "loc": { + "start": { + "line": 45, + "column": 19 + }, + "end": { + "line": 45, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1037, + "end": 1038, + "loc": { + "start": { + "line": 45, + "column": 28 + }, + "end": { + "line": 45, + "column": 29 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 1041, + "end": 1052, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1041, + "end": 1051, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1041, + "end": 1047, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 1041, + "end": 1042, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1043, + "end": 1047, + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1050, + "end": 1051, + "loc": { + "start": { + "line": 46, + "column": 10 + }, + "end": { + "line": 46, + "column": 11 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1055, + "end": 1072, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1055, + "end": 1071, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1055, + "end": 1065, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 11 + }, + "identifierName": "swap_color" + }, + "name": "swap_color" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1066, + "end": 1067, + "loc": { + "start": { + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 1069, + "end": 1070, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + }, + "identifierName": "B" + }, + "name": "B" + } + ] + } + }, + { + "type": "ReturnStatement", + "start": 1075, + "end": 1084, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 10 + } + }, + "argument": { + "type": "Identifier", + "start": 1082, + "end": 1083, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 50, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap pointers and colors of a node and its left child B with one constraint:\n * - B's right child is a leaf\n *\n * NOTE: This constraint is implied because B is A's in-subtree predecessor.\n *\n * p p\n * | |\n * -A -B\n * / \\ / \\\n * +B c -> +A c\n * / \\ / \\\n * a - a -\n *\n * @param {Node} A - The node.\n * @return {Node} The node B.\n ", + "start": 165, + "end": 665, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap pointers and colors of a node and its left child B with one constraint:\n * - B's right child is a leaf\n *\n * NOTE: This constraint is implied because B is A's in-subtree predecessor.\n *\n * p p\n * | |\n * -A -B\n * / \\ / \\\n * +B c -> +A c\n * / \\ / \\\n * a - a -\n *\n * @param {Node} A - The node.\n * @return {Node} The node B.\n ", + "start": 165, + "end": 665, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "replace_node", + "start": 73, + "end": 85, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 86, + "end": 90, + "loc": { + "start": { + "line": 3, + "column": 20 + }, + "end": { + "line": 3, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../deletion/replace_node.js", + "start": 91, + "end": 120, + "loc": { + "start": { + "line": 3, + "column": 25 + }, + "end": { + "line": 3, + "column": 54 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 120, + "end": 121, + "loc": { + "start": { + "line": 3, + "column": 54 + }, + "end": { + "line": 3, + "column": 55 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 122, + "end": 128, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_color", + "start": 129, + "end": 139, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 140, + "end": 144, + "loc": { + "start": { + "line": 4, + "column": 18 + }, + "end": { + "line": 4, + "column": 22 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./swap_color.js", + "start": 145, + "end": 162, + "loc": { + "start": { + "line": 4, + "column": 23 + }, + "end": { + "line": 4, + "column": 40 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 162, + "end": 163, + "loc": { + "start": { + "line": 4, + "column": 40 + }, + "end": { + "line": 4, + "column": 41 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Swap pointers and colors of a node and its left child B with one constraint:\n * - B's right child is a leaf\n *\n * NOTE: This constraint is implied because B is A's in-subtree predecessor.\n *\n * p p\n * | |\n * -A -B\n * / \\ / \\\n * +B c -> +A c\n * / \\ / \\\n * a - a -\n *\n * @param {Node} A - The node.\n * @return {Node} The node B.\n ", + "start": 165, + "end": 665, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 667, + "end": 672, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_left", + "start": 673, + "end": 682, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 15 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 683, + "end": 684, + "loc": { + "start": { + "line": 24, + "column": 16 + }, + "end": { + "line": 24, + "column": 17 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 685, + "end": 686, + "loc": { + "start": { + "line": 24, + "column": 18 + }, + "end": { + "line": 24, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 686, + "end": 687, + "loc": { + "start": { + "line": 24, + "column": 19 + }, + "end": { + "line": 24, + "column": 20 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 687, + "end": 688, + "loc": { + "start": { + "line": 24, + "column": 20 + }, + "end": { + "line": 24, + "column": 21 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 689, + "end": 691, + "loc": { + "start": { + "line": 24, + "column": 22 + }, + "end": { + "line": 24, + "column": 24 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 692, + "end": 693, + "loc": { + "start": { + "line": 24, + "column": 25 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 695, + "end": 701, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 701, + "end": 702, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 702, + "end": 703, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 704, + "end": 714, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 715, + "end": 719, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 719, + "end": 720, + "loc": { + "start": { + "line": 25, + "column": 25 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 720, + "end": 721, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 723, + "end": 728, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 729, + "end": 730, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 731, + "end": 732, + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 733, + "end": 734, + "loc": { + "start": { + "line": 26, + "column": 11 + }, + "end": { + "line": 26, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 734, + "end": 735, + "loc": { + "start": { + "line": 26, + "column": 12 + }, + "end": { + "line": 26, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 735, + "end": 739, + "loc": { + "start": { + "line": 26, + "column": 13 + }, + "end": { + "line": 26, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 739, + "end": 740, + "loc": { + "start": { + "line": 26, + "column": 17 + }, + "end": { + "line": 26, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 742, + "end": 748, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 748, + "end": 749, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 749, + "end": 750, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 751, + "end": 761, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 762, + "end": 766, + "loc": { + "start": { + "line": 27, + "column": 21 + }, + "end": { + "line": 27, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 766, + "end": 767, + "loc": { + "start": { + "line": 27, + "column": 25 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 767, + "end": 768, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 770, + "end": 775, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "a", + "start": 776, + "end": 777, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 778, + "end": 779, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 780, + "end": 781, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 781, + "end": 782, + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 28, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 782, + "end": 786, + "loc": { + "start": { + "line": 28, + "column": 13 + }, + "end": { + "line": 28, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 786, + "end": 787, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 789, + "end": 795, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 795, + "end": 796, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 796, + "end": 797, + "loc": { + "start": { + "line": 29, + "column": 8 + }, + "end": { + "line": 29, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 797, + "end": 798, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 798, + "end": 803, + "loc": { + "start": { + "line": 29, + "column": 10 + }, + "end": { + "line": 29, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 804, + "end": 807, + "loc": { + "start": { + "line": 29, + "column": 16 + }, + "end": { + "line": 29, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 808, + "end": 812, + "loc": { + "start": { + "line": 29, + "column": 20 + }, + "end": { + "line": 29, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 812, + "end": 813, + "loc": { + "start": { + "line": 29, + "column": 24 + }, + "end": { + "line": 29, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 813, + "end": 814, + "loc": { + "start": { + "line": 29, + "column": 25 + }, + "end": { + "line": 29, + "column": 26 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 816, + "end": 821, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "c", + "start": 822, + "end": 823, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 824, + "end": 825, + "loc": { + "start": { + "line": 30, + "column": 9 + }, + "end": { + "line": 30, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 826, + "end": 827, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 827, + "end": 828, + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 828, + "end": 833, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 18 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 833, + "end": 834, + "loc": { + "start": { + "line": 30, + "column": 18 + }, + "end": { + "line": 30, + "column": 19 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 837, + "end": 839, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 840, + "end": 841, + "loc": { + "start": { + "line": 32, + "column": 4 + }, + "end": { + "line": 32, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 841, + "end": 842, + "loc": { + "start": { + "line": 32, + "column": 5 + }, + "end": { + "line": 32, + "column": 6 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 842, + "end": 843, + "loc": { + "start": { + "line": 32, + "column": 6 + }, + "end": { + "line": 32, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 843, + "end": 849, + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 850, + "end": 853, + "loc": { + "start": { + "line": 32, + "column": 14 + }, + "end": { + "line": 32, + "column": 17 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 854, + "end": 858, + "loc": { + "start": { + "line": 32, + "column": 18 + }, + "end": { + "line": 32, + "column": 22 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 858, + "end": 859, + "loc": { + "start": { + "line": 32, + "column": 22 + }, + "end": { + "line": 32, + "column": 23 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 860, + "end": 861, + "loc": { + "start": { + "line": 32, + "column": 24 + }, + "end": { + "line": 32, + "column": 25 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 864, + "end": 865, + "loc": { + "start": { + "line": 33, + "column": 2 + }, + "end": { + "line": 33, + "column": 3 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 865, + "end": 866, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 4 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 866, + "end": 872, + "loc": { + "start": { + "line": 33, + "column": 4 + }, + "end": { + "line": 33, + "column": 10 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 873, + "end": 874, + "loc": { + "start": { + "line": 33, + "column": 11 + }, + "end": { + "line": 33, + "column": 12 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 875, + "end": 879, + "loc": { + "start": { + "line": 33, + "column": 13 + }, + "end": { + "line": 33, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 879, + "end": 880, + "loc": { + "start": { + "line": 33, + "column": 17 + }, + "end": { + "line": 33, + "column": 18 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 882, + "end": 883, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 2 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 884, + "end": 888, + "loc": { + "start": { + "line": 34, + "column": 3 + }, + "end": { + "line": 34, + "column": 7 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 889, + "end": 890, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "replace_node", + "start": 893, + "end": 905, + "loc": { + "start": { + "line": 35, + "column": 2 + }, + "end": { + "line": 35, + "column": 14 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 905, + "end": 906, + "loc": { + "start": { + "line": 35, + "column": 14 + }, + "end": { + "line": 35, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 906, + "end": 907, + "loc": { + "start": { + "line": 35, + "column": 15 + }, + "end": { + "line": 35, + "column": 16 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 907, + "end": 908, + "loc": { + "start": { + "line": 35, + "column": 16 + }, + "end": { + "line": 35, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 909, + "end": 910, + "loc": { + "start": { + "line": 35, + "column": 18 + }, + "end": { + "line": 35, + "column": 19 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 910, + "end": 911, + "loc": { + "start": { + "line": 35, + "column": 19 + }, + "end": { + "line": 35, + "column": 20 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 911, + "end": 912, + "loc": { + "start": { + "line": 35, + "column": 20 + }, + "end": { + "line": 35, + "column": 21 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 914, + "end": 915, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 2 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 918, + "end": 919, + "loc": { + "start": { + "line": 38, + "column": 1 + }, + "end": { + "line": 38, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 919, + "end": 920, + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 920, + "end": 926, + "loc": { + "start": { + "line": 38, + "column": 3 + }, + "end": { + "line": 38, + "column": 9 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 927, + "end": 928, + "loc": { + "start": { + "line": 38, + "column": 10 + }, + "end": { + "line": 38, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 929, + "end": 930, + "loc": { + "start": { + "line": 38, + "column": 12 + }, + "end": { + "line": 38, + "column": 13 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 930, + "end": 931, + "loc": { + "start": { + "line": 38, + "column": 13 + }, + "end": { + "line": 38, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 934, + "end": 935, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 935, + "end": 936, + "loc": { + "start": { + "line": 40, + "column": 2 + }, + "end": { + "line": 40, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 936, + "end": 941, + "loc": { + "start": { + "line": 40, + "column": 3 + }, + "end": { + "line": 40, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 942, + "end": 943, + "loc": { + "start": { + "line": 40, + "column": 9 + }, + "end": { + "line": 40, + "column": 10 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 944, + "end": 948, + "loc": { + "start": { + "line": 40, + "column": 11 + }, + "end": { + "line": 40, + "column": 15 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 948, + "end": 949, + "loc": { + "start": { + "line": 40, + "column": 15 + }, + "end": { + "line": 40, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 951, + "end": 952, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 952, + "end": 953, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 953, + "end": 958, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 959, + "end": 960, + "loc": { + "start": { + "line": 41, + "column": 9 + }, + "end": { + "line": 41, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "c", + "start": 961, + "end": 962, + "loc": { + "start": { + "line": 41, + "column": 11 + }, + "end": { + "line": 41, + "column": 12 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 962, + "end": 963, + "loc": { + "start": { + "line": 41, + "column": 12 + }, + "end": { + "line": 41, + "column": 13 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 965, + "end": 967, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 42, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 968, + "end": 969, + "loc": { + "start": { + "line": 42, + "column": 4 + }, + "end": { + "line": 42, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "c", + "start": 969, + "end": 970, + "loc": { + "start": { + "line": 42, + "column": 5 + }, + "end": { + "line": 42, + "column": 6 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 971, + "end": 974, + "loc": { + "start": { + "line": 42, + "column": 7 + }, + "end": { + "line": 42, + "column": 10 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 975, + "end": 979, + "loc": { + "start": { + "line": 42, + "column": 11 + }, + "end": { + "line": 42, + "column": 15 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 979, + "end": 980, + "loc": { + "start": { + "line": 42, + "column": 15 + }, + "end": { + "line": 42, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "c", + "start": 981, + "end": 982, + "loc": { + "start": { + "line": 42, + "column": 17 + }, + "end": { + "line": 42, + "column": 18 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 982, + "end": 983, + "loc": { + "start": { + "line": 42, + "column": 18 + }, + "end": { + "line": 42, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 983, + "end": 989, + "loc": { + "start": { + "line": 42, + "column": 19 + }, + "end": { + "line": 42, + "column": 25 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 990, + "end": 991, + "loc": { + "start": { + "line": 42, + "column": 26 + }, + "end": { + "line": 42, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 992, + "end": 993, + "loc": { + "start": { + "line": 42, + "column": 28 + }, + "end": { + "line": 42, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 993, + "end": 994, + "loc": { + "start": { + "line": 42, + "column": 29 + }, + "end": { + "line": 42, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 997, + "end": 998, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 998, + "end": 999, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 999, + "end": 1003, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 7 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1004, + "end": 1005, + "loc": { + "start": { + "line": 44, + "column": 8 + }, + "end": { + "line": 44, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "a", + "start": 1006, + "end": 1007, + "loc": { + "start": { + "line": 44, + "column": 10 + }, + "end": { + "line": 44, + "column": 11 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1007, + "end": 1008, + "loc": { + "start": { + "line": 44, + "column": 11 + }, + "end": { + "line": 44, + "column": 12 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1010, + "end": 1012, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1013, + "end": 1014, + "loc": { + "start": { + "line": 45, + "column": 4 + }, + "end": { + "line": 45, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "a", + "start": 1014, + "end": 1015, + "loc": { + "start": { + "line": 45, + "column": 5 + }, + "end": { + "line": 45, + "column": 6 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1016, + "end": 1019, + "loc": { + "start": { + "line": 45, + "column": 7 + }, + "end": { + "line": 45, + "column": 10 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1020, + "end": 1024, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 15 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1024, + "end": 1025, + "loc": { + "start": { + "line": 45, + "column": 15 + }, + "end": { + "line": 45, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "a", + "start": 1026, + "end": 1027, + "loc": { + "start": { + "line": 45, + "column": 17 + }, + "end": { + "line": 45, + "column": 18 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1027, + "end": 1028, + "loc": { + "start": { + "line": 45, + "column": 18 + }, + "end": { + "line": 45, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1028, + "end": 1034, + "loc": { + "start": { + "line": 45, + "column": 19 + }, + "end": { + "line": 45, + "column": 25 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1035, + "end": 1036, + "loc": { + "start": { + "line": 45, + "column": 26 + }, + "end": { + "line": 45, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1037, + "end": 1038, + "loc": { + "start": { + "line": 45, + "column": 28 + }, + "end": { + "line": 45, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1038, + "end": 1039, + "loc": { + "start": { + "line": 45, + "column": 29 + }, + "end": { + "line": 45, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1041, + "end": 1042, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1042, + "end": 1043, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1043, + "end": 1047, + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 7 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1048, + "end": 1049, + "loc": { + "start": { + "line": 46, + "column": 8 + }, + "end": { + "line": 46, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1050, + "end": 1051, + "loc": { + "start": { + "line": 46, + "column": 10 + }, + "end": { + "line": 46, + "column": 11 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1051, + "end": 1052, + "loc": { + "start": { + "line": 46, + "column": 11 + }, + "end": { + "line": 46, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_color", + "start": 1055, + "end": 1065, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 11 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1065, + "end": 1066, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1066, + "end": 1067, + "loc": { + "start": { + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 13 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1067, + "end": 1068, + "loc": { + "start": { + "line": 48, + "column": 13 + }, + "end": { + "line": 48, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1069, + "end": 1070, + "loc": { + "start": { + "line": 48, + "column": 15 + }, + "end": { + "line": 48, + "column": 16 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1070, + "end": 1071, + "loc": { + "start": { + "line": 48, + "column": 16 + }, + "end": { + "line": 48, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1071, + "end": 1072, + "loc": { + "start": { + "line": 48, + "column": 17 + }, + "end": { + "line": 48, + "column": 18 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 1075, + "end": 1081, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1082, + "end": 1083, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 50, + "column": 9 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1083, + "end": 1084, + "loc": { + "start": { + "line": 50, + "column": 9 + }, + "end": { + "line": 50, + "column": 10 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1085, + "end": 1086, + "loc": { + "start": { + "line": 51, + "column": 0 + }, + "end": { + "line": 51, + "column": 1 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1086, + "end": 1087, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 2 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1089, + "end": 1095, + "loc": { + "start": { + "line": 53, + "column": 0 + }, + "end": { + "line": 53, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1096, + "end": 1103, + "loc": { + "start": { + "line": 53, + "column": 7 + }, + "end": { + "line": 53, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_left", + "start": 1104, + "end": 1113, + "loc": { + "start": { + "line": 53, + "column": 15 + }, + "end": { + "line": 53, + "column": 24 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1113, + "end": 1114, + "loc": { + "start": { + "line": 53, + "column": 24 + }, + "end": { + "line": 53, + "column": 25 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1115, + "end": 1115, + "loc": { + "start": { + "line": 54, + "column": 0 + }, + "end": { + "line": 54, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/swap/swap_non_adjacent.js.json b/ast/source/swap/swap_non_adjacent.js.json new file mode 100644 index 0000000..01fb134 --- /dev/null +++ b/ast/source/swap/swap_non_adjacent.js.json @@ -0,0 +1,11779 @@ +{ + "type": "File", + "start": 0, + "end": 1325, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 58, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 1325, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 58, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 107, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 41 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 17 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 17 + }, + "identifierName": "swap_color" + }, + "name": "swap_color" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 89, + "end": 106, + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 40 + } + }, + "extra": { + "rawValue": "./swap_color.js", + "raw": "'./swap_color.js'" + }, + "value": "./swap_color.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap pointers and colors of two NON-ADJACENT nodes with three constraints:\n * - B is not the root\n * - B is its parent right child\n * - B's right child is a leaf\n *\n * NOTE: These three constraints are implied because B is A's in-subtree\n * predecessor without being A's left child.\n *\n * p q q p\n * | \\ \\ |\n * -A +B +A -B\n * / \\ / \\ / \\ / \\\n * u v x - -> x - u v\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n ", + "start": 109, + "end": 727, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + } + ] + }, + { + "type": "Identifier", + "start": 729, + "end": 1289, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 55, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 735, + "end": 1288, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 55, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 735, + "end": 752, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 23 + }, + "identifierName": "swap_non_adjacent" + }, + "name": "swap_non_adjacent", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 755, + "end": 1288, + "loc": { + "start": { + "line": 24, + "column": 26 + }, + "end": { + "line": 55, + "column": 1 + } + }, + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 756, + "end": 757, + "loc": { + "start": { + "line": 24, + "column": 27 + }, + "end": { + "line": 24, + "column": 28 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 30 + }, + "end": { + "line": 24, + "column": 31 + }, + "identifierName": "B" + }, + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 765, + "end": 1288, + "loc": { + "start": { + "line": 24, + "column": 36 + }, + "end": { + "line": 55, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 768, + "end": 794, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 768, + "end": 793, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 768, + "end": 774, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 775, + "end": 792, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 775, + "end": 776, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 788, + "end": 792, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 796, + "end": 822, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 796, + "end": 821, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 796, + "end": 802, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 803, + "end": 820, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 803, + "end": 804, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 816, + "end": 820, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 824, + "end": 843, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 830, + "end": 842, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 830, + "end": 831, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "p" + }, + "name": "p" + }, + "init": { + "type": "MemberExpression", + "start": 834, + "end": 842, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 834, + "end": 835, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 836, + "end": 842, + "loc": { + "start": { + "line": 27, + "column": 13 + }, + "end": { + "line": 27, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 845, + "end": 862, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 851, + "end": 861, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 851, + "end": 852, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + }, + "identifierName": "u" + }, + "name": "u" + }, + "init": { + "type": "MemberExpression", + "start": 855, + "end": 861, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 855, + "end": 856, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 857, + "end": 861, + "loc": { + "start": { + "line": 28, + "column": 13 + }, + "end": { + "line": 28, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 864, + "end": 882, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 870, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 870, + "end": 871, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 8 + }, + "identifierName": "v" + }, + "name": "v" + }, + "init": { + "type": "MemberExpression", + "start": 874, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 874, + "end": 875, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 876, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 884, + "end": 903, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 890, + "end": 902, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 890, + "end": 891, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 8 + }, + "identifierName": "q" + }, + "name": "q" + }, + "init": { + "type": "MemberExpression", + "start": 894, + "end": 902, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 894, + "end": 895, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 896, + "end": 902, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 905, + "end": 922, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 911, + "end": 921, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 911, + "end": 912, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MemberExpression", + "start": 915, + "end": 921, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 915, + "end": 916, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 917, + "end": 921, + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 924, + "end": 949, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 924, + "end": 948, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 924, + "end": 930, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 931, + "end": 947, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 931, + "end": 938, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 931, + "end": 932, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 933, + "end": 938, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 943, + "end": 947, + "loc": { + "start": { + "line": 32, + "column": 20 + }, + "end": { + "line": 32, + "column": 24 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 951, + "end": 970, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 951, + "end": 969, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 951, + "end": 957, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 958, + "end": 968, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 958, + "end": 959, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 9 + }, + "identifierName": "q" + }, + "name": "q" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 964, + "end": 968, + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 18 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 972, + "end": 994, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 23 + } + }, + "expression": { + "type": "CallExpression", + "start": 972, + "end": 993, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 972, + "end": 978, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 979, + "end": 992, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 979, + "end": 980, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 985, + "end": 992, + "loc": { + "start": { + "line": 34, + "column": 14 + }, + "end": { + "line": 34, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 985, + "end": 986, + "loc": { + "start": { + "line": 34, + "column": 14 + }, + "end": { + "line": 34, + "column": 15 + }, + "identifierName": "q" + }, + "name": "q" + }, + "property": { + "type": "Identifier", + "start": 987, + "end": 992, + "loc": { + "start": { + "line": 34, + "column": 16 + }, + "end": { + "line": 34, + "column": 21 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 997, + "end": 1069, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 39, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1001, + "end": 1011, + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1001, + "end": 1002, + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 6 + }, + "identifierName": "p" + }, + "name": "p" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1007, + "end": 1011, + "loc": { + "start": { + "line": 36, + "column": 11 + }, + "end": { + "line": 36, + "column": 15 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1013, + "end": 1069, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 39, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 1017, + "end": 1066, + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 38, + "column": 19 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1021, + "end": 1033, + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 1021, + "end": 1022, + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1027, + "end": 1033, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 1027, + "end": 1028, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 1029, + "end": 1033, + "loc": { + "start": { + "line": 37, + "column": 14 + }, + "end": { + "line": 37, + "column": 18 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1035, + "end": 1046, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 31 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1035, + "end": 1045, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1035, + "end": 1041, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 1035, + "end": 1036, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 21 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 1037, + "end": 1041, + "loc": { + "start": { + "line": 37, + "column": 22 + }, + "end": { + "line": 37, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1044, + "end": 1045, + "loc": { + "start": { + "line": 37, + "column": 29 + }, + "end": { + "line": 37, + "column": 30 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1054, + "end": 1066, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1054, + "end": 1065, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1054, + "end": 1061, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 1054, + "end": 1055, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 8 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 1056, + "end": 1061, + "loc": { + "start": { + "line": 38, + "column": 9 + }, + "end": { + "line": 38, + "column": 14 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1064, + "end": 1065, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 18 + }, + "identifierName": "B" + }, + "name": "B" + } + } + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 1072, + "end": 1084, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1072, + "end": 1083, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1072, + "end": 1079, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1072, + "end": 1073, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 2 + }, + "identifierName": "q" + }, + "name": "q" + }, + "property": { + "type": "Identifier", + "start": 1074, + "end": 1079, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1082, + "end": 1083, + "loc": { + "start": { + "line": 41, + "column": 11 + }, + "end": { + "line": 41, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1087, + "end": 1100, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1087, + "end": 1099, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1087, + "end": 1095, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1087, + "end": 1088, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1089, + "end": 1095, + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1098, + "end": 1099, + "loc": { + "start": { + "line": 43, + "column": 12 + }, + "end": { + "line": 43, + "column": 13 + }, + "identifierName": "q" + }, + "name": "q" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1102, + "end": 1113, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1102, + "end": 1112, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1102, + "end": 1108, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 1102, + "end": 1103, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1104, + "end": 1108, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1111, + "end": 1112, + "loc": { + "start": { + "line": 44, + "column": 10 + }, + "end": { + "line": 44, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1115, + "end": 1130, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1115, + "end": 1129, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1115, + "end": 1122, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1115, + "end": 1116, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1117, + "end": 1122, + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 1125, + "end": 1129, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 15 + } + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 1132, + "end": 1145, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1132, + "end": 1144, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1132, + "end": 1140, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1132, + "end": 1133, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1134, + "end": 1140, + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1143, + "end": 1144, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1147, + "end": 1158, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1147, + "end": 1157, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1147, + "end": 1153, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 1147, + "end": 1148, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1149, + "end": 1153, + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1156, + "end": 1157, + "loc": { + "start": { + "line": 47, + "column": 10 + }, + "end": { + "line": 47, + "column": 11 + }, + "identifierName": "u" + }, + "name": "u" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1160, + "end": 1172, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1160, + "end": 1171, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1160, + "end": 1167, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1160, + "end": 1161, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1162, + "end": 1167, + "loc": { + "start": { + "line": 48, + "column": 3 + }, + "end": { + "line": 48, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1170, + "end": 1171, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 12 + }, + "identifierName": "v" + }, + "name": "v" + } + } + }, + { + "type": "IfStatement", + "start": 1175, + "end": 1204, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1179, + "end": 1189, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1179, + "end": 1180, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1185, + "end": 1189, + "loc": { + "start": { + "line": 50, + "column": 11 + }, + "end": { + "line": 50, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1191, + "end": 1204, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1191, + "end": 1203, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1191, + "end": 1199, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 1191, + "end": 1192, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + }, + "property": { + "type": "Identifier", + "start": 1193, + "end": 1199, + "loc": { + "start": { + "line": 50, + "column": 19 + }, + "end": { + "line": 50, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1202, + "end": 1203, + "loc": { + "start": { + "line": 50, + "column": 28 + }, + "end": { + "line": 50, + "column": 29 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + "alternate": null + }, + { + "type": "IfStatement", + "start": 1206, + "end": 1235, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1210, + "end": 1220, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1210, + "end": 1211, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 6 + }, + "identifierName": "u" + }, + "name": "u" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1216, + "end": 1220, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1222, + "end": 1235, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1222, + "end": 1234, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1222, + "end": 1230, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 1222, + "end": 1223, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 18 + }, + "identifierName": "u" + }, + "name": "u" + }, + "property": { + "type": "Identifier", + "start": 1224, + "end": 1230, + "loc": { + "start": { + "line": 51, + "column": 19 + }, + "end": { + "line": 51, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1233, + "end": 1234, + "loc": { + "start": { + "line": 51, + "column": 28 + }, + "end": { + "line": 51, + "column": 29 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": null + }, + { + "type": "IfStatement", + "start": 1237, + "end": 1266, + "loc": { + "start": { + "line": 52, + "column": 1 + }, + "end": { + "line": 52, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1241, + "end": 1251, + "loc": { + "start": { + "line": 52, + "column": 5 + }, + "end": { + "line": 52, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1241, + "end": 1242, + "loc": { + "start": { + "line": 52, + "column": 5 + }, + "end": { + "line": 52, + "column": 6 + }, + "identifierName": "v" + }, + "name": "v" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1247, + "end": 1251, + "loc": { + "start": { + "line": 52, + "column": 11 + }, + "end": { + "line": 52, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1253, + "end": 1266, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1253, + "end": 1265, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1253, + "end": 1261, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 1253, + "end": 1254, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 18 + }, + "identifierName": "v" + }, + "name": "v" + }, + "property": { + "type": "Identifier", + "start": 1255, + "end": 1261, + "loc": { + "start": { + "line": 52, + "column": 19 + }, + "end": { + "line": 52, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1264, + "end": 1265, + "loc": { + "start": { + "line": 52, + "column": 28 + }, + "end": { + "line": 52, + "column": 29 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 1269, + "end": 1286, + "loc": { + "start": { + "line": 54, + "column": 1 + }, + "end": { + "line": 54, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1269, + "end": 1285, + "loc": { + "start": { + "line": 54, + "column": 1 + }, + "end": { + "line": 54, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1269, + "end": 1279, + "loc": { + "start": { + "line": 54, + "column": 1 + }, + "end": { + "line": 54, + "column": 11 + }, + "identifierName": "swap_color" + }, + "name": "swap_color" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1280, + "end": 1281, + "loc": { + "start": { + "line": 54, + "column": 12 + }, + "end": { + "line": 54, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 1283, + "end": 1284, + "loc": { + "start": { + "line": 54, + "column": 15 + }, + "end": { + "line": 54, + "column": 16 + }, + "identifierName": "B" + }, + "name": "B" + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [], + "name": "_", + "trailingComments": [] + }, + { + "type": "Identifier", + "start": 1291, + "end": 1324, + "loc": { + "start": { + "line": 57, + "column": 0 + }, + "end": { + "line": 57, + "column": 33 + } + }, + "declaration": { + "type": "Identifier", + "start": 1306, + "end": 1323, + "loc": { + "start": { + "line": 57, + "column": 15 + }, + "end": { + "line": 57, + "column": 32 + }, + "identifierName": "swap_non_adjacent" + }, + "name": "swap_non_adjacent" + }, + "name": "_", + "leadingComments": [], + "trailingComments": [] + }, + { + "type": "ExportDefaultDeclaration", + "start": 1291, + "end": 1324, + "loc": { + "start": { + "line": 57, + "column": 0 + }, + "end": { + "line": 57, + "column": 33 + } + }, + "declaration": { + "type": "VariableDeclaration", + "start": 729, + "end": 1289, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 55, + "column": 2 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 735, + "end": 1288, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 55, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 735, + "end": 752, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 23 + }, + "identifierName": "swap_non_adjacent" + }, + "name": "swap_non_adjacent", + "leadingComments": null + }, + "init": { + "type": "ArrowFunctionExpression", + "start": 755, + "end": 1288, + "loc": { + "start": { + "line": 24, + "column": 26 + }, + "end": { + "line": 55, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 735, + "end": 752, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 23 + }, + "identifierName": "swap_non_adjacent" + }, + "name": "swap_non_adjacent", + "leadingComments": null + }, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 756, + "end": 757, + "loc": { + "start": { + "line": 24, + "column": 27 + }, + "end": { + "line": 24, + "column": 28 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 30 + }, + "end": { + "line": 24, + "column": 31 + }, + "identifierName": "B" + }, + "name": "B" + } + ], + "body": { + "type": "BlockStatement", + "start": 765, + "end": 1288, + "loc": { + "start": { + "line": 24, + "column": 36 + }, + "end": { + "line": 55, + "column": 1 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 768, + "end": 794, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 768, + "end": 793, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 768, + "end": 774, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 775, + "end": 792, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 775, + "end": 776, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 788, + "end": 792, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 796, + "end": 822, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 27 + } + }, + "expression": { + "type": "CallExpression", + "start": 796, + "end": 821, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 26 + } + }, + "callee": { + "type": "Identifier", + "start": 796, + "end": 802, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 803, + "end": 820, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 25 + } + }, + "left": { + "type": "Identifier", + "start": 803, + "end": 804, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 816, + "end": 820, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "VariableDeclaration", + "start": 824, + "end": 843, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 830, + "end": 842, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 830, + "end": 831, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + }, + "identifierName": "p" + }, + "name": "p" + }, + "init": { + "type": "MemberExpression", + "start": 834, + "end": 842, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 834, + "end": 835, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 836, + "end": 842, + "loc": { + "start": { + "line": 27, + "column": 13 + }, + "end": { + "line": 27, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 845, + "end": 862, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 851, + "end": 861, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 851, + "end": 852, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + }, + "identifierName": "u" + }, + "name": "u" + }, + "init": { + "type": "MemberExpression", + "start": 855, + "end": 861, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 855, + "end": 856, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 857, + "end": 861, + "loc": { + "start": { + "line": 28, + "column": 13 + }, + "end": { + "line": 28, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 864, + "end": 882, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 19 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 870, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 18 + } + }, + "id": { + "type": "Identifier", + "start": 870, + "end": 871, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 8 + }, + "identifierName": "v" + }, + "name": "v" + }, + "init": { + "type": "MemberExpression", + "start": 874, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 874, + "end": 875, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 876, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 18 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 884, + "end": 903, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 890, + "end": 902, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 19 + } + }, + "id": { + "type": "Identifier", + "start": 890, + "end": 891, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 8 + }, + "identifierName": "q" + }, + "name": "q" + }, + "init": { + "type": "MemberExpression", + "start": 894, + "end": 902, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 894, + "end": 895, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 896, + "end": 902, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "VariableDeclaration", + "start": 905, + "end": 922, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 18 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 911, + "end": 921, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "id": { + "type": "Identifier", + "start": 911, + "end": 912, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 8 + }, + "identifierName": "x" + }, + "name": "x" + }, + "init": { + "type": "MemberExpression", + "start": 915, + "end": 921, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 915, + "end": 916, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 12 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 917, + "end": 921, + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 17 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 924, + "end": 949, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 26 + } + }, + "expression": { + "type": "CallExpression", + "start": 924, + "end": 948, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 25 + } + }, + "callee": { + "type": "Identifier", + "start": 924, + "end": 930, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 931, + "end": 947, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 931, + "end": 938, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 931, + "end": 932, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 933, + "end": 938, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 15 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 943, + "end": 947, + "loc": { + "start": { + "line": 32, + "column": 20 + }, + "end": { + "line": 32, + "column": 24 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 951, + "end": 970, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 20 + } + }, + "expression": { + "type": "CallExpression", + "start": 951, + "end": 969, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 19 + } + }, + "callee": { + "type": "Identifier", + "start": 951, + "end": 957, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 958, + "end": 968, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 958, + "end": 959, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 9 + }, + "identifierName": "q" + }, + "name": "q" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 964, + "end": 968, + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 18 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 972, + "end": 994, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 23 + } + }, + "expression": { + "type": "CallExpression", + "start": 972, + "end": 993, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 22 + } + }, + "callee": { + "type": "Identifier", + "start": 972, + "end": 978, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 7 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 979, + "end": 992, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 21 + } + }, + "left": { + "type": "Identifier", + "start": 979, + "end": 980, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 9 + }, + "identifierName": "B" + }, + "name": "B" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 985, + "end": 992, + "loc": { + "start": { + "line": 34, + "column": 14 + }, + "end": { + "line": 34, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 985, + "end": 986, + "loc": { + "start": { + "line": 34, + "column": 14 + }, + "end": { + "line": 34, + "column": 15 + }, + "identifierName": "q" + }, + "name": "q" + }, + "property": { + "type": "Identifier", + "start": 987, + "end": 992, + "loc": { + "start": { + "line": 34, + "column": 16 + }, + "end": { + "line": 34, + "column": 21 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 997, + "end": 1069, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 39, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1001, + "end": 1011, + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1001, + "end": 1002, + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 6 + }, + "identifierName": "p" + }, + "name": "p" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1007, + "end": 1011, + "loc": { + "start": { + "line": 36, + "column": 11 + }, + "end": { + "line": 36, + "column": 15 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1013, + "end": 1069, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 39, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 1017, + "end": 1066, + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 38, + "column": 19 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1021, + "end": 1033, + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 1021, + "end": 1022, + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 7 + }, + "identifierName": "A" + }, + "name": "A" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 1027, + "end": 1033, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 18 + } + }, + "object": { + "type": "Identifier", + "start": 1027, + "end": 1028, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 1029, + "end": 1033, + "loc": { + "start": { + "line": 37, + "column": 14 + }, + "end": { + "line": 37, + "column": 18 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1035, + "end": 1046, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 31 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1035, + "end": 1045, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 30 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1035, + "end": 1041, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 1035, + "end": 1036, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 21 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 1037, + "end": 1041, + "loc": { + "start": { + "line": 37, + "column": 22 + }, + "end": { + "line": 37, + "column": 26 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1044, + "end": 1045, + "loc": { + "start": { + "line": 37, + "column": 29 + }, + "end": { + "line": 37, + "column": 30 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": { + "type": "ExpressionStatement", + "start": 1054, + "end": 1066, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 19 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1054, + "end": 1065, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 18 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1054, + "end": 1061, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 14 + } + }, + "object": { + "type": "Identifier", + "start": 1054, + "end": 1055, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 8 + }, + "identifierName": "p" + }, + "name": "p" + }, + "property": { + "type": "Identifier", + "start": 1056, + "end": 1061, + "loc": { + "start": { + "line": 38, + "column": 9 + }, + "end": { + "line": 38, + "column": 14 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1064, + "end": 1065, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 18 + }, + "identifierName": "B" + }, + "name": "B" + } + } + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 1072, + "end": 1084, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1072, + "end": 1083, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1072, + "end": 1079, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1072, + "end": 1073, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 2 + }, + "identifierName": "q" + }, + "name": "q" + }, + "property": { + "type": "Identifier", + "start": 1074, + "end": 1079, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1082, + "end": 1083, + "loc": { + "start": { + "line": 41, + "column": 11 + }, + "end": { + "line": 41, + "column": 12 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1087, + "end": 1100, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1087, + "end": 1099, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1087, + "end": 1095, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1087, + "end": 1088, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1089, + "end": 1095, + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1098, + "end": 1099, + "loc": { + "start": { + "line": 43, + "column": 12 + }, + "end": { + "line": 43, + "column": 13 + }, + "identifierName": "q" + }, + "name": "q" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1102, + "end": 1113, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1102, + "end": 1112, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1102, + "end": 1108, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 1102, + "end": 1103, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1104, + "end": 1108, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1111, + "end": 1112, + "loc": { + "start": { + "line": 44, + "column": 10 + }, + "end": { + "line": 44, + "column": 11 + }, + "identifierName": "x" + }, + "name": "x" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1115, + "end": 1130, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 16 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1115, + "end": 1129, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 15 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1115, + "end": 1122, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1115, + "end": 1116, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 2 + }, + "identifierName": "A" + }, + "name": "A" + }, + "property": { + "type": "Identifier", + "start": 1117, + "end": 1122, + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 1125, + "end": 1129, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 15 + } + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 1132, + "end": 1145, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 14 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1132, + "end": 1144, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 13 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1132, + "end": 1140, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 9 + } + }, + "object": { + "type": "Identifier", + "start": 1132, + "end": 1133, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1134, + "end": 1140, + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 9 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1143, + "end": 1144, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 13 + }, + "identifierName": "p" + }, + "name": "p" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1147, + "end": 1158, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 12 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1147, + "end": 1157, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 11 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1147, + "end": 1153, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 7 + } + }, + "object": { + "type": "Identifier", + "start": 1147, + "end": 1148, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1149, + "end": 1153, + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 7 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1156, + "end": 1157, + "loc": { + "start": { + "line": 47, + "column": 10 + }, + "end": { + "line": 47, + "column": 11 + }, + "identifierName": "u" + }, + "name": "u" + } + } + }, + { + "type": "ExpressionStatement", + "start": 1160, + "end": 1172, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 13 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1160, + "end": 1171, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 12 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1160, + "end": 1167, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 8 + } + }, + "object": { + "type": "Identifier", + "start": 1160, + "end": 1161, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 2 + }, + "identifierName": "B" + }, + "name": "B" + }, + "property": { + "type": "Identifier", + "start": 1162, + "end": 1167, + "loc": { + "start": { + "line": 48, + "column": 3 + }, + "end": { + "line": 48, + "column": 8 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1170, + "end": 1171, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 12 + }, + "identifierName": "v" + }, + "name": "v" + } + } + }, + { + "type": "IfStatement", + "start": 1175, + "end": 1204, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1179, + "end": 1189, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1179, + "end": 1180, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 6 + }, + "identifierName": "x" + }, + "name": "x" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1185, + "end": 1189, + "loc": { + "start": { + "line": 50, + "column": 11 + }, + "end": { + "line": 50, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1191, + "end": 1204, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1191, + "end": 1203, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1191, + "end": 1199, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 1191, + "end": 1192, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 18 + }, + "identifierName": "x" + }, + "name": "x" + }, + "property": { + "type": "Identifier", + "start": 1193, + "end": 1199, + "loc": { + "start": { + "line": 50, + "column": 19 + }, + "end": { + "line": 50, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1202, + "end": 1203, + "loc": { + "start": { + "line": 50, + "column": 28 + }, + "end": { + "line": 50, + "column": 29 + }, + "identifierName": "A" + }, + "name": "A" + } + } + }, + "alternate": null + }, + { + "type": "IfStatement", + "start": 1206, + "end": 1235, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1210, + "end": 1220, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1210, + "end": 1211, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 6 + }, + "identifierName": "u" + }, + "name": "u" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1216, + "end": 1220, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1222, + "end": 1235, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1222, + "end": 1234, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1222, + "end": 1230, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 1222, + "end": 1223, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 18 + }, + "identifierName": "u" + }, + "name": "u" + }, + "property": { + "type": "Identifier", + "start": 1224, + "end": 1230, + "loc": { + "start": { + "line": 51, + "column": 19 + }, + "end": { + "line": 51, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1233, + "end": 1234, + "loc": { + "start": { + "line": 51, + "column": 28 + }, + "end": { + "line": 51, + "column": 29 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": null + }, + { + "type": "IfStatement", + "start": 1237, + "end": 1266, + "loc": { + "start": { + "line": 52, + "column": 1 + }, + "end": { + "line": 52, + "column": 30 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1241, + "end": 1251, + "loc": { + "start": { + "line": 52, + "column": 5 + }, + "end": { + "line": 52, + "column": 15 + } + }, + "left": { + "type": "Identifier", + "start": 1241, + "end": 1242, + "loc": { + "start": { + "line": 52, + "column": 5 + }, + "end": { + "line": 52, + "column": 6 + }, + "identifierName": "v" + }, + "name": "v" + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1247, + "end": 1251, + "loc": { + "start": { + "line": 52, + "column": 11 + }, + "end": { + "line": 52, + "column": 15 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 1253, + "end": 1266, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 30 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1253, + "end": 1265, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 29 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1253, + "end": 1261, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 25 + } + }, + "object": { + "type": "Identifier", + "start": 1253, + "end": 1254, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 18 + }, + "identifierName": "v" + }, + "name": "v" + }, + "property": { + "type": "Identifier", + "start": 1255, + "end": 1261, + "loc": { + "start": { + "line": 52, + "column": 19 + }, + "end": { + "line": 52, + "column": 25 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1264, + "end": 1265, + "loc": { + "start": { + "line": 52, + "column": 28 + }, + "end": { + "line": 52, + "column": 29 + }, + "identifierName": "B" + }, + "name": "B" + } + } + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 1269, + "end": 1286, + "loc": { + "start": { + "line": 54, + "column": 1 + }, + "end": { + "line": 54, + "column": 18 + } + }, + "expression": { + "type": "CallExpression", + "start": 1269, + "end": 1285, + "loc": { + "start": { + "line": 54, + "column": 1 + }, + "end": { + "line": 54, + "column": 17 + } + }, + "callee": { + "type": "Identifier", + "start": 1269, + "end": 1279, + "loc": { + "start": { + "line": 54, + "column": 1 + }, + "end": { + "line": 54, + "column": 11 + }, + "identifierName": "swap_color" + }, + "name": "swap_color" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1280, + "end": 1281, + "loc": { + "start": { + "line": 54, + "column": 12 + }, + "end": { + "line": 54, + "column": 13 + }, + "identifierName": "A" + }, + "name": "A" + }, + { + "type": "Identifier", + "start": 1283, + "end": 1284, + "loc": { + "start": { + "line": 54, + "column": 15 + }, + "end": { + "line": 54, + "column": 16 + }, + "identifierName": "B" + }, + "name": "B" + } + ] + } + } + ], + "directives": [] + } + }, + "leadingComments": null + } + ], + "kind": "const", + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap pointers and colors of two NON-ADJACENT nodes with three constraints:\n * - B is not the root\n * - B is its parent right child\n * - B's right child is a leaf\n *\n * NOTE: These three constraints are implied because B is A's in-subtree\n * predecessor without being A's left child.\n *\n * p q q p\n * | \\ \\ |\n * -A +B +A -B\n * / \\ / \\ / \\ / \\\n * u v x - -> x - u v\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n ", + "start": 109, + "end": 727, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + } + ], + "trailingComments": [] + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Swap pointers and colors of two NON-ADJACENT nodes with three constraints:\n * - B is not the root\n * - B is its parent right child\n * - B's right child is a leaf\n *\n * NOTE: These three constraints are implied because B is A's in-subtree\n * predecessor without being A's left child.\n *\n * p q q p\n * | \\ \\ |\n * -A +B +A -B\n * / \\ / \\ / \\ / \\\n * u v x - -> x - u v\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n ", + "start": 109, + "end": 727, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_color", + "start": 73, + "end": 83, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 84, + "end": 88, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 22 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./swap_color.js", + "start": 89, + "end": 106, + "loc": { + "start": { + "line": 3, + "column": 23 + }, + "end": { + "line": 3, + "column": 40 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 106, + "end": 107, + "loc": { + "start": { + "line": 3, + "column": 40 + }, + "end": { + "line": 3, + "column": 41 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Swap pointers and colors of two NON-ADJACENT nodes with three constraints:\n * - B is not the root\n * - B is its parent right child\n * - B's right child is a leaf\n *\n * NOTE: These three constraints are implied because B is A's in-subtree\n * predecessor without being A's left child.\n *\n * p q q p\n * | \\ \\ |\n * -A +B +A -B\n * / \\ / \\ / \\ / \\\n * u v x - -> x - u v\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n ", + "start": 109, + "end": 727, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 22, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 729, + "end": 734, + "loc": { + "start": { + "line": 24, + "column": 0 + }, + "end": { + "line": 24, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_non_adjacent", + "start": 735, + "end": 752, + "loc": { + "start": { + "line": 24, + "column": 6 + }, + "end": { + "line": 24, + "column": 23 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 753, + "end": 754, + "loc": { + "start": { + "line": 24, + "column": 24 + }, + "end": { + "line": 24, + "column": 25 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 755, + "end": 756, + "loc": { + "start": { + "line": 24, + "column": 26 + }, + "end": { + "line": 24, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 756, + "end": 757, + "loc": { + "start": { + "line": 24, + "column": 27 + }, + "end": { + "line": 24, + "column": 28 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 757, + "end": 758, + "loc": { + "start": { + "line": 24, + "column": 28 + }, + "end": { + "line": 24, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 759, + "end": 760, + "loc": { + "start": { + "line": 24, + "column": 30 + }, + "end": { + "line": 24, + "column": 31 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 760, + "end": 761, + "loc": { + "start": { + "line": 24, + "column": 31 + }, + "end": { + "line": 24, + "column": 32 + } + } + }, + { + "type": { + "label": "=>", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 762, + "end": 764, + "loc": { + "start": { + "line": 24, + "column": 33 + }, + "end": { + "line": 24, + "column": 35 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 765, + "end": 766, + "loc": { + "start": { + "line": 24, + "column": 36 + }, + "end": { + "line": 24, + "column": 37 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 768, + "end": 774, + "loc": { + "start": { + "line": 25, + "column": 1 + }, + "end": { + "line": 25, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 774, + "end": 775, + "loc": { + "start": { + "line": 25, + "column": 7 + }, + "end": { + "line": 25, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 775, + "end": 776, + "loc": { + "start": { + "line": 25, + "column": 8 + }, + "end": { + "line": 25, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 777, + "end": 787, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 788, + "end": 792, + "loc": { + "start": { + "line": 25, + "column": 21 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 792, + "end": 793, + "loc": { + "start": { + "line": 25, + "column": 25 + }, + "end": { + "line": 25, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 793, + "end": 794, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 796, + "end": 802, + "loc": { + "start": { + "line": 26, + "column": 1 + }, + "end": { + "line": 26, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 802, + "end": 803, + "loc": { + "start": { + "line": 26, + "column": 7 + }, + "end": { + "line": 26, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 803, + "end": 804, + "loc": { + "start": { + "line": 26, + "column": 8 + }, + "end": { + "line": 26, + "column": 9 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 805, + "end": 815, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 816, + "end": 820, + "loc": { + "start": { + "line": 26, + "column": 21 + }, + "end": { + "line": 26, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 820, + "end": 821, + "loc": { + "start": { + "line": 26, + "column": 25 + }, + "end": { + "line": 26, + "column": 26 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 821, + "end": 822, + "loc": { + "start": { + "line": 26, + "column": 26 + }, + "end": { + "line": 26, + "column": 27 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 824, + "end": 829, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "p", + "start": 830, + "end": 831, + "loc": { + "start": { + "line": 27, + "column": 7 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 832, + "end": 833, + "loc": { + "start": { + "line": 27, + "column": 9 + }, + "end": { + "line": 27, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 834, + "end": 835, + "loc": { + "start": { + "line": 27, + "column": 11 + }, + "end": { + "line": 27, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 835, + "end": 836, + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 836, + "end": 842, + "loc": { + "start": { + "line": 27, + "column": 13 + }, + "end": { + "line": 27, + "column": 19 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 842, + "end": 843, + "loc": { + "start": { + "line": 27, + "column": 19 + }, + "end": { + "line": 27, + "column": 20 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 845, + "end": 850, + "loc": { + "start": { + "line": 28, + "column": 1 + }, + "end": { + "line": 28, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "u", + "start": 851, + "end": 852, + "loc": { + "start": { + "line": 28, + "column": 7 + }, + "end": { + "line": 28, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 853, + "end": 854, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 855, + "end": 856, + "loc": { + "start": { + "line": 28, + "column": 11 + }, + "end": { + "line": 28, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 856, + "end": 857, + "loc": { + "start": { + "line": 28, + "column": 12 + }, + "end": { + "line": 28, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 857, + "end": 861, + "loc": { + "start": { + "line": 28, + "column": 13 + }, + "end": { + "line": 28, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 861, + "end": 862, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 18 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 864, + "end": 869, + "loc": { + "start": { + "line": 29, + "column": 1 + }, + "end": { + "line": 29, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "v", + "start": 870, + "end": 871, + "loc": { + "start": { + "line": 29, + "column": 7 + }, + "end": { + "line": 29, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 872, + "end": 873, + "loc": { + "start": { + "line": 29, + "column": 9 + }, + "end": { + "line": 29, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 874, + "end": 875, + "loc": { + "start": { + "line": 29, + "column": 11 + }, + "end": { + "line": 29, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 875, + "end": 876, + "loc": { + "start": { + "line": 29, + "column": 12 + }, + "end": { + "line": 29, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 876, + "end": 881, + "loc": { + "start": { + "line": 29, + "column": 13 + }, + "end": { + "line": 29, + "column": 18 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 881, + "end": 882, + "loc": { + "start": { + "line": 29, + "column": 18 + }, + "end": { + "line": 29, + "column": 19 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 884, + "end": 889, + "loc": { + "start": { + "line": 30, + "column": 1 + }, + "end": { + "line": 30, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "q", + "start": 890, + "end": 891, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 892, + "end": 893, + "loc": { + "start": { + "line": 30, + "column": 9 + }, + "end": { + "line": 30, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 894, + "end": 895, + "loc": { + "start": { + "line": 30, + "column": 11 + }, + "end": { + "line": 30, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 895, + "end": 896, + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 896, + "end": 902, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 19 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 902, + "end": 903, + "loc": { + "start": { + "line": 30, + "column": 19 + }, + "end": { + "line": 30, + "column": 20 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 905, + "end": 910, + "loc": { + "start": { + "line": 31, + "column": 1 + }, + "end": { + "line": 31, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "x", + "start": 911, + "end": 912, + "loc": { + "start": { + "line": 31, + "column": 7 + }, + "end": { + "line": 31, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 913, + "end": 914, + "loc": { + "start": { + "line": 31, + "column": 9 + }, + "end": { + "line": 31, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 915, + "end": 916, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 916, + "end": 917, + "loc": { + "start": { + "line": 31, + "column": 12 + }, + "end": { + "line": 31, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 917, + "end": 921, + "loc": { + "start": { + "line": 31, + "column": 13 + }, + "end": { + "line": 31, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 921, + "end": 922, + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 924, + "end": 930, + "loc": { + "start": { + "line": 32, + "column": 1 + }, + "end": { + "line": 32, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 930, + "end": 931, + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 931, + "end": 932, + "loc": { + "start": { + "line": 32, + "column": 8 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 932, + "end": 933, + "loc": { + "start": { + "line": 32, + "column": 9 + }, + "end": { + "line": 32, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 933, + "end": 938, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 939, + "end": 942, + "loc": { + "start": { + "line": 32, + "column": 16 + }, + "end": { + "line": 32, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 943, + "end": 947, + "loc": { + "start": { + "line": 32, + "column": 20 + }, + "end": { + "line": 32, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 947, + "end": 948, + "loc": { + "start": { + "line": 32, + "column": 24 + }, + "end": { + "line": 32, + "column": 25 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 948, + "end": 949, + "loc": { + "start": { + "line": 32, + "column": 25 + }, + "end": { + "line": 32, + "column": 26 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 951, + "end": 957, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 957, + "end": 958, + "loc": { + "start": { + "line": 33, + "column": 7 + }, + "end": { + "line": 33, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "q", + "start": 958, + "end": 959, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 9 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 960, + "end": 963, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 13 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 964, + "end": 968, + "loc": { + "start": { + "line": 33, + "column": 14 + }, + "end": { + "line": 33, + "column": 18 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 968, + "end": 969, + "loc": { + "start": { + "line": 33, + "column": 18 + }, + "end": { + "line": 33, + "column": 19 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 969, + "end": 970, + "loc": { + "start": { + "line": 33, + "column": 19 + }, + "end": { + "line": 33, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 972, + "end": 978, + "loc": { + "start": { + "line": 34, + "column": 1 + }, + "end": { + "line": 34, + "column": 7 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 978, + "end": 979, + "loc": { + "start": { + "line": 34, + "column": 7 + }, + "end": { + "line": 34, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 979, + "end": 980, + "loc": { + "start": { + "line": 34, + "column": 8 + }, + "end": { + "line": 34, + "column": 9 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 981, + "end": 984, + "loc": { + "start": { + "line": 34, + "column": 10 + }, + "end": { + "line": 34, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "q", + "start": 985, + "end": 986, + "loc": { + "start": { + "line": 34, + "column": 14 + }, + "end": { + "line": 34, + "column": 15 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 986, + "end": 987, + "loc": { + "start": { + "line": 34, + "column": 15 + }, + "end": { + "line": 34, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 987, + "end": 992, + "loc": { + "start": { + "line": 34, + "column": 16 + }, + "end": { + "line": 34, + "column": 21 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 992, + "end": 993, + "loc": { + "start": { + "line": 34, + "column": 21 + }, + "end": { + "line": 34, + "column": 22 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 993, + "end": 994, + "loc": { + "start": { + "line": 34, + "column": 22 + }, + "end": { + "line": 34, + "column": 23 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 997, + "end": 999, + "loc": { + "start": { + "line": 36, + "column": 1 + }, + "end": { + "line": 36, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1000, + "end": 1001, + "loc": { + "start": { + "line": 36, + "column": 4 + }, + "end": { + "line": 36, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "p", + "start": 1001, + "end": 1002, + "loc": { + "start": { + "line": 36, + "column": 5 + }, + "end": { + "line": 36, + "column": 6 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1003, + "end": 1006, + "loc": { + "start": { + "line": 36, + "column": 7 + }, + "end": { + "line": 36, + "column": 10 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1007, + "end": 1011, + "loc": { + "start": { + "line": 36, + "column": 11 + }, + "end": { + "line": 36, + "column": 15 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1011, + "end": 1012, + "loc": { + "start": { + "line": 36, + "column": 15 + }, + "end": { + "line": 36, + "column": 16 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1013, + "end": 1014, + "loc": { + "start": { + "line": 36, + "column": 17 + }, + "end": { + "line": 36, + "column": 18 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1017, + "end": 1019, + "loc": { + "start": { + "line": 37, + "column": 2 + }, + "end": { + "line": 37, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1020, + "end": 1021, + "loc": { + "start": { + "line": 37, + "column": 5 + }, + "end": { + "line": 37, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1021, + "end": 1022, + "loc": { + "start": { + "line": 37, + "column": 6 + }, + "end": { + "line": 37, + "column": 7 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 1023, + "end": 1026, + "loc": { + "start": { + "line": 37, + "column": 8 + }, + "end": { + "line": 37, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "p", + "start": 1027, + "end": 1028, + "loc": { + "start": { + "line": 37, + "column": 12 + }, + "end": { + "line": 37, + "column": 13 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1028, + "end": 1029, + "loc": { + "start": { + "line": 37, + "column": 13 + }, + "end": { + "line": 37, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1029, + "end": 1033, + "loc": { + "start": { + "line": 37, + "column": 14 + }, + "end": { + "line": 37, + "column": 18 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1033, + "end": 1034, + "loc": { + "start": { + "line": 37, + "column": 18 + }, + "end": { + "line": 37, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "p", + "start": 1035, + "end": 1036, + "loc": { + "start": { + "line": 37, + "column": 20 + }, + "end": { + "line": 37, + "column": 21 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1036, + "end": 1037, + "loc": { + "start": { + "line": 37, + "column": 21 + }, + "end": { + "line": 37, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1037, + "end": 1041, + "loc": { + "start": { + "line": 37, + "column": 22 + }, + "end": { + "line": 37, + "column": 26 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1042, + "end": 1043, + "loc": { + "start": { + "line": 37, + "column": 27 + }, + "end": { + "line": 37, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1044, + "end": 1045, + "loc": { + "start": { + "line": 37, + "column": 29 + }, + "end": { + "line": 37, + "column": 30 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1045, + "end": 1046, + "loc": { + "start": { + "line": 37, + "column": 30 + }, + "end": { + "line": 37, + "column": 31 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 1049, + "end": 1053, + "loc": { + "start": { + "line": 38, + "column": 2 + }, + "end": { + "line": 38, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "p", + "start": 1054, + "end": 1055, + "loc": { + "start": { + "line": 38, + "column": 7 + }, + "end": { + "line": 38, + "column": 8 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1055, + "end": 1056, + "loc": { + "start": { + "line": 38, + "column": 8 + }, + "end": { + "line": 38, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1056, + "end": 1061, + "loc": { + "start": { + "line": 38, + "column": 9 + }, + "end": { + "line": 38, + "column": 14 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1062, + "end": 1063, + "loc": { + "start": { + "line": 38, + "column": 15 + }, + "end": { + "line": 38, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1064, + "end": 1065, + "loc": { + "start": { + "line": 38, + "column": 17 + }, + "end": { + "line": 38, + "column": 18 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1065, + "end": 1066, + "loc": { + "start": { + "line": 38, + "column": 18 + }, + "end": { + "line": 38, + "column": 19 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1068, + "end": 1069, + "loc": { + "start": { + "line": 39, + "column": 1 + }, + "end": { + "line": 39, + "column": 2 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "q", + "start": 1072, + "end": 1073, + "loc": { + "start": { + "line": 41, + "column": 1 + }, + "end": { + "line": 41, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1073, + "end": 1074, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1074, + "end": 1079, + "loc": { + "start": { + "line": 41, + "column": 3 + }, + "end": { + "line": 41, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1080, + "end": 1081, + "loc": { + "start": { + "line": 41, + "column": 9 + }, + "end": { + "line": 41, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1082, + "end": 1083, + "loc": { + "start": { + "line": 41, + "column": 11 + }, + "end": { + "line": 41, + "column": 12 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1083, + "end": 1084, + "loc": { + "start": { + "line": 41, + "column": 12 + }, + "end": { + "line": 41, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1087, + "end": 1088, + "loc": { + "start": { + "line": 43, + "column": 1 + }, + "end": { + "line": 43, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1088, + "end": 1089, + "loc": { + "start": { + "line": 43, + "column": 2 + }, + "end": { + "line": 43, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1089, + "end": 1095, + "loc": { + "start": { + "line": 43, + "column": 3 + }, + "end": { + "line": 43, + "column": 9 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1096, + "end": 1097, + "loc": { + "start": { + "line": 43, + "column": 10 + }, + "end": { + "line": 43, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "q", + "start": 1098, + "end": 1099, + "loc": { + "start": { + "line": 43, + "column": 12 + }, + "end": { + "line": 43, + "column": 13 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1099, + "end": 1100, + "loc": { + "start": { + "line": 43, + "column": 13 + }, + "end": { + "line": 43, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1102, + "end": 1103, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 44, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1103, + "end": 1104, + "loc": { + "start": { + "line": 44, + "column": 2 + }, + "end": { + "line": 44, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1104, + "end": 1108, + "loc": { + "start": { + "line": 44, + "column": 3 + }, + "end": { + "line": 44, + "column": 7 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1109, + "end": 1110, + "loc": { + "start": { + "line": 44, + "column": 8 + }, + "end": { + "line": 44, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "x", + "start": 1111, + "end": 1112, + "loc": { + "start": { + "line": 44, + "column": 10 + }, + "end": { + "line": 44, + "column": 11 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1112, + "end": 1113, + "loc": { + "start": { + "line": 44, + "column": 11 + }, + "end": { + "line": 44, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1115, + "end": 1116, + "loc": { + "start": { + "line": 45, + "column": 1 + }, + "end": { + "line": 45, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1116, + "end": 1117, + "loc": { + "start": { + "line": 45, + "column": 2 + }, + "end": { + "line": 45, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1117, + "end": 1122, + "loc": { + "start": { + "line": 45, + "column": 3 + }, + "end": { + "line": 45, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1123, + "end": 1124, + "loc": { + "start": { + "line": 45, + "column": 9 + }, + "end": { + "line": 45, + "column": 10 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1125, + "end": 1129, + "loc": { + "start": { + "line": 45, + "column": 11 + }, + "end": { + "line": 45, + "column": 15 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1129, + "end": 1130, + "loc": { + "start": { + "line": 45, + "column": 15 + }, + "end": { + "line": 45, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1132, + "end": 1133, + "loc": { + "start": { + "line": 46, + "column": 1 + }, + "end": { + "line": 46, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1133, + "end": 1134, + "loc": { + "start": { + "line": 46, + "column": 2 + }, + "end": { + "line": 46, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1134, + "end": 1140, + "loc": { + "start": { + "line": 46, + "column": 3 + }, + "end": { + "line": 46, + "column": 9 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1141, + "end": 1142, + "loc": { + "start": { + "line": 46, + "column": 10 + }, + "end": { + "line": 46, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "p", + "start": 1143, + "end": 1144, + "loc": { + "start": { + "line": 46, + "column": 12 + }, + "end": { + "line": 46, + "column": 13 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1144, + "end": 1145, + "loc": { + "start": { + "line": 46, + "column": 13 + }, + "end": { + "line": 46, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1147, + "end": 1148, + "loc": { + "start": { + "line": 47, + "column": 1 + }, + "end": { + "line": 47, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1148, + "end": 1149, + "loc": { + "start": { + "line": 47, + "column": 2 + }, + "end": { + "line": 47, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1149, + "end": 1153, + "loc": { + "start": { + "line": 47, + "column": 3 + }, + "end": { + "line": 47, + "column": 7 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1154, + "end": 1155, + "loc": { + "start": { + "line": 47, + "column": 8 + }, + "end": { + "line": 47, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "u", + "start": 1156, + "end": 1157, + "loc": { + "start": { + "line": 47, + "column": 10 + }, + "end": { + "line": 47, + "column": 11 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1157, + "end": 1158, + "loc": { + "start": { + "line": 47, + "column": 11 + }, + "end": { + "line": 47, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1160, + "end": 1161, + "loc": { + "start": { + "line": 48, + "column": 1 + }, + "end": { + "line": 48, + "column": 2 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1161, + "end": 1162, + "loc": { + "start": { + "line": 48, + "column": 2 + }, + "end": { + "line": 48, + "column": 3 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1162, + "end": 1167, + "loc": { + "start": { + "line": 48, + "column": 3 + }, + "end": { + "line": 48, + "column": 8 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1168, + "end": 1169, + "loc": { + "start": { + "line": 48, + "column": 9 + }, + "end": { + "line": 48, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "v", + "start": 1170, + "end": 1171, + "loc": { + "start": { + "line": 48, + "column": 11 + }, + "end": { + "line": 48, + "column": 12 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1171, + "end": 1172, + "loc": { + "start": { + "line": 48, + "column": 12 + }, + "end": { + "line": 48, + "column": 13 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1175, + "end": 1177, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1178, + "end": 1179, + "loc": { + "start": { + "line": 50, + "column": 4 + }, + "end": { + "line": 50, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "x", + "start": 1179, + "end": 1180, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 6 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1181, + "end": 1184, + "loc": { + "start": { + "line": 50, + "column": 7 + }, + "end": { + "line": 50, + "column": 10 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1185, + "end": 1189, + "loc": { + "start": { + "line": 50, + "column": 11 + }, + "end": { + "line": 50, + "column": 15 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1189, + "end": 1190, + "loc": { + "start": { + "line": 50, + "column": 15 + }, + "end": { + "line": 50, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "x", + "start": 1191, + "end": 1192, + "loc": { + "start": { + "line": 50, + "column": 17 + }, + "end": { + "line": 50, + "column": 18 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1192, + "end": 1193, + "loc": { + "start": { + "line": 50, + "column": 18 + }, + "end": { + "line": 50, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1193, + "end": 1199, + "loc": { + "start": { + "line": 50, + "column": 19 + }, + "end": { + "line": 50, + "column": 25 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1200, + "end": 1201, + "loc": { + "start": { + "line": 50, + "column": 26 + }, + "end": { + "line": 50, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1202, + "end": 1203, + "loc": { + "start": { + "line": 50, + "column": 28 + }, + "end": { + "line": 50, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1203, + "end": 1204, + "loc": { + "start": { + "line": 50, + "column": 29 + }, + "end": { + "line": 50, + "column": 30 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1206, + "end": 1208, + "loc": { + "start": { + "line": 51, + "column": 1 + }, + "end": { + "line": 51, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1209, + "end": 1210, + "loc": { + "start": { + "line": 51, + "column": 4 + }, + "end": { + "line": 51, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "u", + "start": 1210, + "end": 1211, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 6 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1212, + "end": 1215, + "loc": { + "start": { + "line": 51, + "column": 7 + }, + "end": { + "line": 51, + "column": 10 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1216, + "end": 1220, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 15 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1220, + "end": 1221, + "loc": { + "start": { + "line": 51, + "column": 15 + }, + "end": { + "line": 51, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "u", + "start": 1222, + "end": 1223, + "loc": { + "start": { + "line": 51, + "column": 17 + }, + "end": { + "line": 51, + "column": 18 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1223, + "end": 1224, + "loc": { + "start": { + "line": 51, + "column": 18 + }, + "end": { + "line": 51, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1224, + "end": 1230, + "loc": { + "start": { + "line": 51, + "column": 19 + }, + "end": { + "line": 51, + "column": 25 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1231, + "end": 1232, + "loc": { + "start": { + "line": 51, + "column": 26 + }, + "end": { + "line": 51, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1233, + "end": 1234, + "loc": { + "start": { + "line": 51, + "column": 28 + }, + "end": { + "line": 51, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1234, + "end": 1235, + "loc": { + "start": { + "line": 51, + "column": 29 + }, + "end": { + "line": 51, + "column": 30 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1237, + "end": 1239, + "loc": { + "start": { + "line": 52, + "column": 1 + }, + "end": { + "line": 52, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1240, + "end": 1241, + "loc": { + "start": { + "line": 52, + "column": 4 + }, + "end": { + "line": 52, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "v", + "start": 1241, + "end": 1242, + "loc": { + "start": { + "line": 52, + "column": 5 + }, + "end": { + "line": 52, + "column": 6 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1243, + "end": 1246, + "loc": { + "start": { + "line": 52, + "column": 7 + }, + "end": { + "line": 52, + "column": 10 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1247, + "end": 1251, + "loc": { + "start": { + "line": 52, + "column": 11 + }, + "end": { + "line": 52, + "column": 15 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1251, + "end": 1252, + "loc": { + "start": { + "line": 52, + "column": 15 + }, + "end": { + "line": 52, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "v", + "start": 1253, + "end": 1254, + "loc": { + "start": { + "line": 52, + "column": 17 + }, + "end": { + "line": 52, + "column": 18 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1254, + "end": 1255, + "loc": { + "start": { + "line": 52, + "column": 18 + }, + "end": { + "line": 52, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1255, + "end": 1261, + "loc": { + "start": { + "line": 52, + "column": 19 + }, + "end": { + "line": 52, + "column": 25 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1262, + "end": 1263, + "loc": { + "start": { + "line": 52, + "column": 26 + }, + "end": { + "line": 52, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1264, + "end": 1265, + "loc": { + "start": { + "line": 52, + "column": 28 + }, + "end": { + "line": 52, + "column": 29 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1265, + "end": 1266, + "loc": { + "start": { + "line": 52, + "column": 29 + }, + "end": { + "line": 52, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_color", + "start": 1269, + "end": 1279, + "loc": { + "start": { + "line": 54, + "column": 1 + }, + "end": { + "line": 54, + "column": 11 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1279, + "end": 1280, + "loc": { + "start": { + "line": 54, + "column": 11 + }, + "end": { + "line": 54, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "A", + "start": 1280, + "end": 1281, + "loc": { + "start": { + "line": 54, + "column": 12 + }, + "end": { + "line": 54, + "column": 13 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1281, + "end": 1282, + "loc": { + "start": { + "line": 54, + "column": 13 + }, + "end": { + "line": 54, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "B", + "start": 1283, + "end": 1284, + "loc": { + "start": { + "line": 54, + "column": 15 + }, + "end": { + "line": 54, + "column": 16 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1284, + "end": 1285, + "loc": { + "start": { + "line": 54, + "column": 16 + }, + "end": { + "line": 54, + "column": 17 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1285, + "end": 1286, + "loc": { + "start": { + "line": 54, + "column": 17 + }, + "end": { + "line": 54, + "column": 18 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1287, + "end": 1288, + "loc": { + "start": { + "line": 55, + "column": 0 + }, + "end": { + "line": 55, + "column": 1 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1288, + "end": 1289, + "loc": { + "start": { + "line": 55, + "column": 1 + }, + "end": { + "line": 55, + "column": 2 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 1291, + "end": 1297, + "loc": { + "start": { + "line": 57, + "column": 0 + }, + "end": { + "line": 57, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 1298, + "end": 1305, + "loc": { + "start": { + "line": 57, + "column": 7 + }, + "end": { + "line": 57, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_non_adjacent", + "start": 1306, + "end": 1323, + "loc": { + "start": { + "line": 57, + "column": 15 + }, + "end": { + "line": 57, + "column": 32 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1323, + "end": 1324, + "loc": { + "start": { + "line": 57, + "column": 32 + }, + "end": { + "line": 57, + "column": 33 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1325, + "end": 1325, + "loc": { + "start": { + "line": 58, + "column": 0 + }, + "end": { + "line": 58, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/traversal/leftOpenRangeTraversal.js.json b/ast/source/traversal/leftOpenRangeTraversal.js.json new file mode 100644 index 0000000..ebf0d44 --- /dev/null +++ b/ast/source/traversal/leftOpenRangeTraversal.js.json @@ -0,0 +1,5866 @@ +{ + "type": "File", + "start": 0, + "end": 1177, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 37, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 1177, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 37, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 119, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 53 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 23 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 95, + "end": 118, + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 52 + } + }, + "extra": { + "rawValue": "./inordertraversal.js", + "raw": "'./inordertraversal.js'" + }, + "value": "./inordertraversal.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval (-oo, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 463, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] + }, + { + "type": "ExportDefaultDeclaration", + "start": 464, + "end": 1176, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 36, + "column": 1 + } + }, + "declaration": { + "type": "FunctionDeclaration", + "start": 479, + "end": 1176, + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 36, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 489, + "end": 511, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 47 + }, + "identifierName": "leftOpenRangeTraversal" + }, + "name": "leftOpenRangeTraversal", + "leadingComments": null + }, + "generator": true, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 512, + "end": 519, + "loc": { + "start": { + "line": 14, + "column": 48 + }, + "end": { + "line": 14, + "column": 55 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "Identifier", + "start": 521, + "end": 525, + "loc": { + "start": { + "line": 14, + "column": 57 + }, + "end": { + "line": 14, + "column": 61 + }, + "identifierName": "root" + }, + "name": "root" + }, + { + "type": "Identifier", + "start": 527, + "end": 532, + "loc": { + "start": { + "line": 14, + "column": 63 + }, + "end": { + "line": 14, + "column": 68 + }, + "identifierName": "right" + }, + "name": "right" + } + ], + "body": { + "type": "BlockStatement", + "start": 534, + "end": 1176, + "loc": { + "start": { + "line": 14, + "column": 70 + }, + "end": { + "line": 36, + "column": 1 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 537, + "end": 1174, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 35, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 541, + "end": 570, + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 34 + } + }, + "left": { + "type": "CallExpression", + "start": 541, + "end": 565, + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 541, + "end": 548, + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 12 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 549, + "end": 557, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 549, + "end": 553, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 17 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 554, + "end": 557, + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 21 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + }, + { + "type": "Identifier", + "start": 559, + "end": 564, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 28 + }, + "identifierName": "right" + }, + "name": "right" + } + ] + }, + "operator": ">=", + "right": { + "type": "NumericLiteral", + "start": 569, + "end": 570, + "loc": { + "start": { + "line": 15, + "column": 33 + }, + "end": { + "line": 15, + "column": 34 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "consequent": { + "type": "BlockStatement", + "start": 572, + "end": 805, + "loc": { + "start": { + "line": 15, + "column": 36 + }, + "end": { + "line": 22, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 674, + "end": 802, + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 678, + "end": 696, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 678, + "end": 687, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 678, + "end": 682, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 683, + "end": 687, + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false, + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 692, + "end": 696, + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 698, + "end": 802, + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 703, + "end": 737, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 37 + } + }, + "expression": { + "type": "CallExpression", + "start": 703, + "end": 736, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 703, + "end": 709, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 710, + "end": 735, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 35 + } + }, + "left": { + "type": "MemberExpression", + "start": 710, + "end": 719, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 710, + "end": 714, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 715, + "end": 719, + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 19 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 19, + "column": 31 + }, + "end": { + "line": 19, + "column": 35 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 741, + "end": 798, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 60 + } + }, + "expression": { + "type": "YieldExpression", + "start": 741, + "end": 797, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 59 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 748, + "end": 797, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 59 + } + }, + "callee": { + "type": "Identifier", + "start": 748, + "end": 770, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 32 + }, + "identifierName": "leftOpenRangeTraversal" + }, + "name": "leftOpenRangeTraversal" + }, + "arguments": [ + { + "type": "Identifier", + "start": 771, + "end": 778, + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 20, + "column": 40 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "MemberExpression", + "start": 780, + "end": 789, + "loc": { + "start": { + "line": 20, + "column": 42 + }, + "end": { + "line": 20, + "column": 51 + } + }, + "object": { + "type": "Identifier", + "start": 780, + "end": 784, + "loc": { + "start": { + "line": 20, + "column": 42 + }, + "end": { + "line": 20, + "column": 46 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 785, + "end": 789, + "loc": { + "start": { + "line": 20, + "column": 47 + }, + "end": { + "line": 20, + "column": 51 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + { + "type": "Identifier", + "start": 791, + "end": 796, + "loc": { + "start": { + "line": 20, + "column": 53 + }, + "end": { + "line": 20, + "column": 58 + }, + "identifierName": "right" + }, + "name": "right" + } + ] + } + } + } + ], + "directives": [] + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If the root lies to the right of the interval, we can discard the", + "start": 576, + "end": 644, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 70 + } + } + }, + { + "type": "CommentLine", + "value": " entire right subtree.", + "start": 647, + "end": 671, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 26 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 811, + "end": 1174, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 35, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 912, + "end": 1018, + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 916, + "end": 934, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 916, + "end": 925, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 916, + "end": 920, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 921, + "end": 925, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false, + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 930, + "end": 934, + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 936, + "end": 1018, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 28, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 941, + "end": 975, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 37 + } + }, + "expression": { + "type": "CallExpression", + "start": 941, + "end": 974, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 941, + "end": 947, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 948, + "end": 973, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 35 + } + }, + "left": { + "type": "MemberExpression", + "start": 948, + "end": 957, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 948, + "end": 952, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 953, + "end": 957, + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 19 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 969, + "end": 973, + "loc": { + "start": { + "line": 26, + "column": 31 + }, + "end": { + "line": 26, + "column": 35 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 979, + "end": 1014, + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 38 + } + }, + "expression": { + "type": "YieldExpression", + "start": 979, + "end": 1013, + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 37 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 986, + "end": 1013, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 37 + } + }, + "callee": { + "type": "Identifier", + "start": 986, + "end": 1002, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 26 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1003, + "end": 1012, + "loc": { + "start": { + "line": 27, + "column": 27 + }, + "end": { + "line": 27, + "column": 36 + } + }, + "object": { + "type": "Identifier", + "start": 1003, + "end": 1007, + "loc": { + "start": { + "line": 27, + "column": 27 + }, + "end": { + "line": 27, + "column": 31 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1008, + "end": 1012, + "loc": { + "start": { + "line": 27, + "column": 32 + }, + "end": { + "line": 27, + "column": 36 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + } + ] + } + } + } + ], + "directives": [] + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise yield entire left subtree, yield the root, and recurse on", + "start": 815, + "end": 885, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " the right subtree.", + "start": 888, + "end": 909, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 23 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1022, + "end": 1037, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 17 + } + }, + "expression": { + "type": "YieldExpression", + "start": 1022, + "end": 1036, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "delegate": false, + "argument": { + "type": "MemberExpression", + "start": 1028, + "end": 1036, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1028, + "end": 1032, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 12 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1033, + "end": 1036, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 16 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + } + }, + { + "type": "IfStatement", + "start": 1040, + "end": 1171, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 34, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1044, + "end": 1063, + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1044, + "end": 1054, + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1044, + "end": 1048, + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1049, + "end": 1054, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1059, + "end": 1063, + "loc": { + "start": { + "line": 31, + "column": 21 + }, + "end": { + "line": 31, + "column": 25 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1065, + "end": 1171, + "loc": { + "start": { + "line": 31, + "column": 27 + }, + "end": { + "line": 34, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1070, + "end": 1105, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 38 + } + }, + "expression": { + "type": "CallExpression", + "start": 1070, + "end": 1104, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 37 + } + }, + "callee": { + "type": "Identifier", + "start": 1070, + "end": 1076, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1077, + "end": 1103, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 36 + } + }, + "left": { + "type": "MemberExpression", + "start": 1077, + "end": 1087, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 1077, + "end": 1081, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1082, + "end": 1087, + "loc": { + "start": { + "line": 32, + "column": 15 + }, + "end": { + "line": 32, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1099, + "end": 1103, + "loc": { + "start": { + "line": 32, + "column": 32 + }, + "end": { + "line": 32, + "column": 36 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1109, + "end": 1167, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 61 + } + }, + "expression": { + "type": "YieldExpression", + "start": 1109, + "end": 1166, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 60 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 1116, + "end": 1166, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 60 + } + }, + "callee": { + "type": "Identifier", + "start": 1116, + "end": 1138, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 32 + }, + "identifierName": "leftOpenRangeTraversal" + }, + "name": "leftOpenRangeTraversal" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1139, + "end": 1146, + "loc": { + "start": { + "line": 33, + "column": 33 + }, + "end": { + "line": 33, + "column": 40 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "MemberExpression", + "start": 1148, + "end": 1158, + "loc": { + "start": { + "line": 33, + "column": 42 + }, + "end": { + "line": 33, + "column": 52 + } + }, + "object": { + "type": "Identifier", + "start": 1148, + "end": 1152, + "loc": { + "start": { + "line": 33, + "column": 42 + }, + "end": { + "line": 33, + "column": 46 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1153, + "end": 1158, + "loc": { + "start": { + "line": 33, + "column": 47 + }, + "end": { + "line": 33, + "column": 52 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + { + "type": "Identifier", + "start": 1160, + "end": 1165, + "loc": { + "start": { + "line": 33, + "column": 54 + }, + "end": { + "line": 33, + "column": 59 + }, + "identifierName": "right" + }, + "name": "right" + } + ] + } + } + } + ], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } + } + ], + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval (-oo, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 463, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], + "trailingComments": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval (-oo, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 463, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval (-oo, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 463, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " If the root lies to the right of the interval, we can discard the", + "start": 576, + "end": 644, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 70 + } + } + }, + { + "type": "CommentLine", + "value": " entire right subtree.", + "start": 647, + "end": 671, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 26 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise yield entire left subtree, yield the root, and recurse on", + "start": 815, + "end": 885, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " the right subtree.", + "start": 888, + "end": 909, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 23 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "inordertraversal", + "start": 73, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 90, + "end": 94, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./inordertraversal.js", + "start": 95, + "end": 118, + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 52 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 118, + "end": 119, + "loc": { + "start": { + "line": 3, + "column": 52 + }, + "end": { + "line": 3, + "column": 53 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval (-oo, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 463, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 464, + "end": 470, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 471, + "end": 478, + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": { + "label": "function", + "keyword": "function", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "function", + "start": 479, + "end": 487, + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 487, + "end": 488, + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "leftOpenRangeTraversal", + "start": 489, + "end": 511, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 47 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 511, + "end": 512, + "loc": { + "start": { + "line": 14, + "column": 47 + }, + "end": { + "line": 14, + "column": 48 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 512, + "end": 519, + "loc": { + "start": { + "line": 14, + "column": 48 + }, + "end": { + "line": 14, + "column": 55 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 519, + "end": 520, + "loc": { + "start": { + "line": 14, + "column": 55 + }, + "end": { + "line": 14, + "column": 56 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 521, + "end": 525, + "loc": { + "start": { + "line": 14, + "column": 57 + }, + "end": { + "line": 14, + "column": 61 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 525, + "end": 526, + "loc": { + "start": { + "line": 14, + "column": 61 + }, + "end": { + "line": 14, + "column": 62 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 527, + "end": 532, + "loc": { + "start": { + "line": 14, + "column": 63 + }, + "end": { + "line": 14, + "column": 68 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 532, + "end": 533, + "loc": { + "start": { + "line": 14, + "column": 68 + }, + "end": { + "line": 14, + "column": 69 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 534, + "end": 535, + "loc": { + "start": { + "line": 14, + "column": 70 + }, + "end": { + "line": 14, + "column": 71 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 537, + "end": 539, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 540, + "end": 541, + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 541, + "end": 548, + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 548, + "end": 549, + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 549, + "end": 553, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 553, + "end": 554, + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 554, + "end": 557, + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 557, + "end": 558, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 559, + "end": 564, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 28 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 564, + "end": 565, + "loc": { + "start": { + "line": 15, + "column": 28 + }, + "end": { + "line": 15, + "column": 29 + } + } + }, + { + "type": { + "label": "", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": ">=", + "start": 566, + "end": 568, + "loc": { + "start": { + "line": 15, + "column": 30 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + { + "type": { + "label": "num", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": 0, + "start": 569, + "end": 570, + "loc": { + "start": { + "line": 15, + "column": 33 + }, + "end": { + "line": 15, + "column": 34 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 570, + "end": 571, + "loc": { + "start": { + "line": 15, + "column": 34 + }, + "end": { + "line": 15, + "column": 35 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 572, + "end": 573, + "loc": { + "start": { + "line": 15, + "column": 36 + }, + "end": { + "line": 15, + "column": 37 + } + } + }, + { + "type": "CommentLine", + "value": " If the root lies to the right of the interval, we can discard the", + "start": 576, + "end": 644, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 70 + } + } + }, + { + "type": "CommentLine", + "value": " entire right subtree.", + "start": 647, + "end": 671, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 26 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 674, + "end": 676, + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 677, + "end": 678, + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 678, + "end": 682, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 682, + "end": 683, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 683, + "end": 687, + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 688, + "end": 691, + "loc": { + "start": { + "line": 18, + "column": 16 + }, + "end": { + "line": 18, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 692, + "end": 696, + "loc": { + "start": { + "line": 18, + "column": 20 + }, + "end": { + "line": 18, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 696, + "end": 697, + "loc": { + "start": { + "line": 18, + "column": 24 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 698, + "end": 699, + "loc": { + "start": { + "line": 18, + "column": 26 + }, + "end": { + "line": 18, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 703, + "end": 709, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 709, + "end": 710, + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 710, + "end": 714, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 714, + "end": 715, + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 715, + "end": 719, + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 19 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 720, + "end": 730, + "loc": { + "start": { + "line": 19, + "column": 20 + }, + "end": { + "line": 19, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 731, + "end": 735, + "loc": { + "start": { + "line": 19, + "column": 31 + }, + "end": { + "line": 19, + "column": 35 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 735, + "end": 736, + "loc": { + "start": { + "line": 19, + "column": 35 + }, + "end": { + "line": 19, + "column": 36 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 736, + "end": 737, + "loc": { + "start": { + "line": 19, + "column": 36 + }, + "end": { + "line": 19, + "column": 37 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 741, + "end": 746, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 746, + "end": 747, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "leftOpenRangeTraversal", + "start": 748, + "end": 770, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 32 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 770, + "end": 771, + "loc": { + "start": { + "line": 20, + "column": 32 + }, + "end": { + "line": 20, + "column": 33 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 771, + "end": 778, + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 20, + "column": 40 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 778, + "end": 779, + "loc": { + "start": { + "line": 20, + "column": 40 + }, + "end": { + "line": 20, + "column": 41 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 780, + "end": 784, + "loc": { + "start": { + "line": 20, + "column": 42 + }, + "end": { + "line": 20, + "column": 46 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 784, + "end": 785, + "loc": { + "start": { + "line": 20, + "column": 46 + }, + "end": { + "line": 20, + "column": 47 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 785, + "end": 789, + "loc": { + "start": { + "line": 20, + "column": 47 + }, + "end": { + "line": 20, + "column": 51 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 789, + "end": 790, + "loc": { + "start": { + "line": 20, + "column": 51 + }, + "end": { + "line": 20, + "column": 52 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 791, + "end": 796, + "loc": { + "start": { + "line": 20, + "column": 53 + }, + "end": { + "line": 20, + "column": 58 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 796, + "end": 797, + "loc": { + "start": { + "line": 20, + "column": 58 + }, + "end": { + "line": 20, + "column": 59 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 797, + "end": 798, + "loc": { + "start": { + "line": 20, + "column": 59 + }, + "end": { + "line": 20, + "column": 60 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 801, + "end": 802, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 804, + "end": 805, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 806, + "end": 810, + "loc": { + "start": { + "line": 22, + "column": 3 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 811, + "end": 812, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise yield entire left subtree, yield the root, and recurse on", + "start": 815, + "end": 885, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 72 + } + } + }, + { + "type": "CommentLine", + "value": " the right subtree.", + "start": 888, + "end": 909, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 23 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 912, + "end": 914, + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 915, + "end": 916, + "loc": { + "start": { + "line": 25, + "column": 5 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 916, + "end": 920, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 920, + "end": 921, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 921, + "end": 925, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 926, + "end": 929, + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 930, + "end": 934, + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 934, + "end": 935, + "loc": { + "start": { + "line": 25, + "column": 24 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 936, + "end": 937, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 941, + "end": 947, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 947, + "end": 948, + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 948, + "end": 952, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 952, + "end": 953, + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 953, + "end": 957, + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 19 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 958, + "end": 968, + "loc": { + "start": { + "line": 26, + "column": 20 + }, + "end": { + "line": 26, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 969, + "end": 973, + "loc": { + "start": { + "line": 26, + "column": 31 + }, + "end": { + "line": 26, + "column": 35 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 973, + "end": 974, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 36 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 974, + "end": 975, + "loc": { + "start": { + "line": 26, + "column": 36 + }, + "end": { + "line": 26, + "column": 37 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 979, + "end": 984, + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 984, + "end": 985, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "inordertraversal", + "start": 986, + "end": 1002, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1002, + "end": 1003, + "loc": { + "start": { + "line": 27, + "column": 26 + }, + "end": { + "line": 27, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1003, + "end": 1007, + "loc": { + "start": { + "line": 27, + "column": 27 + }, + "end": { + "line": 27, + "column": 31 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1007, + "end": 1008, + "loc": { + "start": { + "line": 27, + "column": 31 + }, + "end": { + "line": 27, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1008, + "end": 1012, + "loc": { + "start": { + "line": 27, + "column": 32 + }, + "end": { + "line": 27, + "column": 36 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1012, + "end": 1013, + "loc": { + "start": { + "line": 27, + "column": 36 + }, + "end": { + "line": 27, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1013, + "end": 1014, + "loc": { + "start": { + "line": 27, + "column": 37 + }, + "end": { + "line": 27, + "column": 38 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1017, + "end": 1018, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 1022, + "end": 1027, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1028, + "end": 1032, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1032, + "end": 1033, + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 1033, + "end": 1036, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 16 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1036, + "end": 1037, + "loc": { + "start": { + "line": 30, + "column": 16 + }, + "end": { + "line": 30, + "column": 17 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1040, + "end": 1042, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1043, + "end": 1044, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1044, + "end": 1048, + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1048, + "end": 1049, + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1049, + "end": 1054, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1055, + "end": 1058, + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 20 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1059, + "end": 1063, + "loc": { + "start": { + "line": 31, + "column": 21 + }, + "end": { + "line": 31, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1063, + "end": 1064, + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 26 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1065, + "end": 1066, + "loc": { + "start": { + "line": 31, + "column": 27 + }, + "end": { + "line": 31, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 1070, + "end": 1076, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1076, + "end": 1077, + "loc": { + "start": { + "line": 32, + "column": 9 + }, + "end": { + "line": 32, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1077, + "end": 1081, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1081, + "end": 1082, + "loc": { + "start": { + "line": 32, + "column": 14 + }, + "end": { + "line": 32, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1082, + "end": 1087, + "loc": { + "start": { + "line": 32, + "column": 15 + }, + "end": { + "line": 32, + "column": 20 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 1088, + "end": 1098, + "loc": { + "start": { + "line": 32, + "column": 21 + }, + "end": { + "line": 32, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 1099, + "end": 1103, + "loc": { + "start": { + "line": 32, + "column": 32 + }, + "end": { + "line": 32, + "column": 36 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1103, + "end": 1104, + "loc": { + "start": { + "line": 32, + "column": 36 + }, + "end": { + "line": 32, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1104, + "end": 1105, + "loc": { + "start": { + "line": 32, + "column": 37 + }, + "end": { + "line": 32, + "column": 38 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 1109, + "end": 1114, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 8 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 1114, + "end": 1115, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "leftOpenRangeTraversal", + "start": 1116, + "end": 1138, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 32 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1138, + "end": 1139, + "loc": { + "start": { + "line": 33, + "column": 32 + }, + "end": { + "line": 33, + "column": 33 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 1139, + "end": 1146, + "loc": { + "start": { + "line": 33, + "column": 33 + }, + "end": { + "line": 33, + "column": 40 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1146, + "end": 1147, + "loc": { + "start": { + "line": 33, + "column": 40 + }, + "end": { + "line": 33, + "column": 41 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1148, + "end": 1152, + "loc": { + "start": { + "line": 33, + "column": 42 + }, + "end": { + "line": 33, + "column": 46 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1152, + "end": 1153, + "loc": { + "start": { + "line": 33, + "column": 46 + }, + "end": { + "line": 33, + "column": 47 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1153, + "end": 1158, + "loc": { + "start": { + "line": 33, + "column": 47 + }, + "end": { + "line": 33, + "column": 52 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1158, + "end": 1159, + "loc": { + "start": { + "line": 33, + "column": 52 + }, + "end": { + "line": 33, + "column": 53 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1160, + "end": 1165, + "loc": { + "start": { + "line": 33, + "column": 54 + }, + "end": { + "line": 33, + "column": 59 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1165, + "end": 1166, + "loc": { + "start": { + "line": 33, + "column": 59 + }, + "end": { + "line": 33, + "column": 60 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1166, + "end": 1167, + "loc": { + "start": { + "line": 33, + "column": 60 + }, + "end": { + "line": 33, + "column": 61 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1170, + "end": 1171, + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 34, + "column": 3 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1173, + "end": 1174, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 2 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1175, + "end": 1176, + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1177, + "end": 1177, + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/traversal/rangetraversal.js.json b/ast/source/traversal/rangetraversal.js.json index 7fe26d8..21b1428 100644 --- a/ast/source/traversal/rangetraversal.js.json +++ b/ast/source/traversal/rangetraversal.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 1459, + "end": 1597, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 44, + "line": 46, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 1459, + "end": 1597, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 44, + "line": 46, "column": 0 } }, @@ -164,20 +164,158 @@ "raw": "'../types/Node.js'" }, "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 131, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 65 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 95, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 29 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 95, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 29 + }, + "identifierName": "leftOpenRangeTraversal" + }, + "name": "leftOpenRangeTraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 101, + "end": 130, + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 64 + } + }, + "extra": { + "rawValue": "./leftOpenRangeTraversal.js", + "raw": "'./leftOpenRangeTraversal.js'" + }, + "value": "./leftOpenRangeTraversal.js" + } + }, + { + "type": "ImportDeclaration", + "start": 132, + "end": 199, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 67 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 139, + "end": 162, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 30 + } + }, + "local": { + "type": "Identifier", + "start": 139, + "end": 162, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 30 + }, + "identifierName": "rightOpenRangeTraversal" + }, + "name": "rightOpenRangeTraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 168, + "end": 198, + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 4, + "column": 66 + } + }, + "extra": { + "rawValue": "./rightOpenRangeTraversal.js", + "raw": "'./rightOpenRangeTraversal.js'" + }, + "value": "./rightOpenRangeTraversal.js" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", - "start": 67, - "end": 476, + "start": 201, + "end": 610, "loc": { "start": { - "line": 4, + "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 15, "column": 3 } } @@ -186,43 +324,43 @@ }, { "type": "ExportDefaultDeclaration", - "start": 477, - "end": 1458, + "start": 611, + "end": 1596, "loc": { "start": { - "line": 14, + "line": 16, "column": 0 }, "end": { - "line": 43, + "line": 45, "column": 1 } }, "declaration": { "type": "FunctionDeclaration", - "start": 492, - "end": 1458, + "start": 626, + "end": 1596, "loc": { "start": { - "line": 14, + "line": 16, "column": 15 }, "end": { - "line": 43, + "line": 45, "column": 1 } }, "id": { "type": "Identifier", - "start": 502, - "end": 516, + "start": 636, + "end": 650, "loc": { "start": { - "line": 14, + "line": 16, "column": 25 }, "end": { - "line": 14, + "line": 16, "column": 39 }, "identifierName": "rangetraversal" @@ -236,15 +374,15 @@ "params": [ { "type": "Identifier", - "start": 517, - "end": 524, + "start": 651, + "end": 658, "loc": { "start": { - "line": 14, + "line": 16, "column": 40 }, "end": { - "line": 14, + "line": 16, "column": 47 }, "identifierName": "compare" @@ -253,15 +391,15 @@ }, { "type": "Identifier", - "start": 526, - "end": 530, + "start": 660, + "end": 664, "loc": { "start": { - "line": 14, + "line": 16, "column": 49 }, "end": { - "line": 14, + "line": 16, "column": 53 }, "identifierName": "root" @@ -270,15 +408,15 @@ }, { "type": "Identifier", - "start": 532, - "end": 536, + "start": 666, + "end": 670, "loc": { "start": { - "line": 14, + "line": 16, "column": 55 }, "end": { - "line": 14, + "line": 16, "column": 59 }, "identifierName": "left" @@ -287,15 +425,15 @@ }, { "type": "Identifier", - "start": 538, - "end": 543, + "start": 672, + "end": 677, "loc": { "start": { - "line": 14, + "line": 16, "column": 61 }, "end": { - "line": 14, + "line": 16, "column": 66 }, "identifierName": "right" @@ -305,72 +443,72 @@ ], "body": { "type": "BlockStatement", - "start": 545, - "end": 1458, + "start": 679, + "end": 1596, "loc": { "start": { - "line": 14, + "line": 16, "column": 68 }, "end": { - "line": 43, + "line": 45, "column": 1 } }, "body": [ { "type": "IfStatement", - "start": 548, - "end": 1456, + "start": 682, + "end": 1594, "loc": { "start": { - "line": 15, + "line": 17, "column": 1 }, "end": { - "line": 42, + "line": 44, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 552, - "end": 579, + "start": 686, + "end": 713, "loc": { "start": { - "line": 15, + "line": 17, "column": 5 }, "end": { - "line": 15, + "line": 17, "column": 32 } }, "left": { "type": "CallExpression", - "start": 552, - "end": 575, + "start": 686, + "end": 709, "loc": { "start": { - "line": 15, + "line": 17, "column": 5 }, "end": { - "line": 15, + "line": 17, "column": 28 } }, "callee": { "type": "Identifier", - "start": 552, - "end": 559, + "start": 686, + "end": 693, "loc": { "start": { - "line": 15, + "line": 17, "column": 5 }, "end": { - "line": 15, + "line": 17, "column": 12 }, "identifierName": "compare" @@ -380,29 +518,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 560, - "end": 568, + "start": 694, + "end": 702, "loc": { "start": { - "line": 15, + "line": 17, "column": 13 }, "end": { - "line": 15, + "line": 17, "column": 21 } }, "object": { "type": "Identifier", - "start": 560, - "end": 564, + "start": 694, + "end": 698, "loc": { "start": { - "line": 15, + "line": 17, "column": 13 }, "end": { - "line": 15, + "line": 17, "column": 17 }, "identifierName": "root" @@ -411,15 +549,15 @@ }, "property": { "type": "Identifier", - "start": 565, - "end": 568, + "start": 699, + "end": 702, "loc": { "start": { - "line": 15, + "line": 17, "column": 18 }, "end": { - "line": 15, + "line": 17, "column": 21 }, "identifierName": "key" @@ -430,15 +568,15 @@ }, { "type": "Identifier", - "start": 570, - "end": 574, + "start": 704, + "end": 708, "loc": { "start": { - "line": 15, + "line": 17, "column": 23 }, "end": { - "line": 15, + "line": 17, "column": 27 }, "identifierName": "left" @@ -450,15 +588,15 @@ "operator": "<", "right": { "type": "NumericLiteral", - "start": 578, - "end": 579, + "start": 712, + "end": 713, "loc": { "start": { - "line": 15, + "line": 17, "column": 31 }, "end": { - "line": 15, + "line": 17, "column": 32 } }, @@ -471,72 +609,72 @@ }, "consequent": { "type": "BlockStatement", - "start": 581, - "end": 813, + "start": 715, + "end": 947, "loc": { "start": { - "line": 15, + "line": 17, "column": 34 }, "end": { - "line": 22, + "line": 24, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 681, - "end": 810, + "start": 815, + "end": 944, "loc": { "start": { - "line": 18, + "line": 20, "column": 2 }, "end": { - "line": 21, + "line": 23, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 685, - "end": 704, + "start": 819, + "end": 838, "loc": { "start": { - "line": 18, + "line": 20, "column": 6 }, "end": { - "line": 18, + "line": 20, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 685, - "end": 695, + "start": 819, + "end": 829, "loc": { "start": { - "line": 18, + "line": 20, "column": 6 }, "end": { - "line": 18, + "line": 20, "column": 16 } }, "object": { "type": "Identifier", - "start": 685, - "end": 689, + "start": 819, + "end": 823, "loc": { "start": { - "line": 18, + "line": 20, "column": 6 }, "end": { - "line": 18, + "line": 20, "column": 10 }, "identifierName": "root" @@ -546,15 +684,15 @@ }, "property": { "type": "Identifier", - "start": 690, - "end": 695, + "start": 824, + "end": 829, "loc": { "start": { - "line": 18, + "line": 20, "column": 11 }, "end": { - "line": 18, + "line": 20, "column": 16 }, "identifierName": "right" @@ -567,15 +705,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 700, - "end": 704, + "start": 834, + "end": 838, "loc": { "start": { - "line": 18, + "line": 20, "column": 21 }, "end": { - "line": 18, + "line": 20, "column": 25 } } @@ -584,58 +722,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 706, - "end": 810, + "start": 840, + "end": 944, "loc": { "start": { - "line": 18, + "line": 20, "column": 27 }, "end": { - "line": 21, + "line": 23, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 711, - "end": 746, + "start": 845, + "end": 880, "loc": { "start": { - "line": 19, + "line": 21, "column": 3 }, "end": { - "line": 19, + "line": 21, "column": 38 } }, "expression": { "type": "CallExpression", - "start": 711, - "end": 745, + "start": 845, + "end": 879, "loc": { "start": { - "line": 19, + "line": 21, "column": 3 }, "end": { - "line": 19, + "line": 21, "column": 37 } }, "callee": { "type": "Identifier", - "start": 711, - "end": 717, + "start": 845, + "end": 851, "loc": { "start": { - "line": 19, + "line": 21, "column": 3 }, "end": { - "line": 19, + "line": 21, "column": 9 }, "identifierName": "assert" @@ -645,43 +783,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 718, - "end": 744, + "start": 852, + "end": 878, "loc": { "start": { - "line": 19, + "line": 21, "column": 10 }, "end": { - "line": 19, + "line": 21, "column": 36 } }, "left": { "type": "MemberExpression", - "start": 718, - "end": 728, + "start": 852, + "end": 862, "loc": { "start": { - "line": 19, + "line": 21, "column": 10 }, "end": { - "line": 19, + "line": 21, "column": 20 } }, "object": { "type": "Identifier", - "start": 718, - "end": 722, + "start": 852, + "end": 856, "loc": { "start": { - "line": 19, + "line": 21, "column": 10 }, "end": { - "line": 19, + "line": 21, "column": 14 }, "identifierName": "root" @@ -690,15 +828,15 @@ }, "property": { "type": "Identifier", - "start": 723, - "end": 728, + "start": 857, + "end": 862, "loc": { "start": { - "line": 19, + "line": 21, "column": 15 }, "end": { - "line": 19, + "line": 21, "column": 20 }, "identifierName": "right" @@ -710,15 +848,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 740, - "end": 744, + "start": 874, + "end": 878, "loc": { "start": { - "line": 19, + "line": 21, "column": 32 }, "end": { - "line": 19, + "line": 21, "column": 36 }, "identifierName": "Node" @@ -731,58 +869,58 @@ }, { "type": "ExpressionStatement", - "start": 750, - "end": 806, + "start": 884, + "end": 940, "loc": { "start": { - "line": 20, + "line": 22, "column": 3 }, "end": { - "line": 20, + "line": 22, "column": 59 } }, "expression": { "type": "YieldExpression", - "start": 750, - "end": 805, + "start": 884, + "end": 939, "loc": { "start": { - "line": 20, + "line": 22, "column": 3 }, "end": { - "line": 20, + "line": 22, "column": 58 } }, "delegate": true, "argument": { "type": "CallExpression", - "start": 757, - "end": 805, + "start": 891, + "end": 939, "loc": { "start": { - "line": 20, + "line": 22, "column": 10 }, "end": { - "line": 20, + "line": 22, "column": 58 } }, "callee": { "type": "Identifier", - "start": 757, - "end": 771, + "start": 891, + "end": 905, "loc": { "start": { - "line": 20, + "line": 22, "column": 10 }, "end": { - "line": 20, + "line": 22, "column": 24 }, "identifierName": "rangetraversal" @@ -792,15 +930,15 @@ "arguments": [ { "type": "Identifier", - "start": 772, - "end": 779, + "start": 906, + "end": 913, "loc": { "start": { - "line": 20, + "line": 22, "column": 25 }, "end": { - "line": 20, + "line": 22, "column": 32 }, "identifierName": "compare" @@ -809,29 +947,29 @@ }, { "type": "MemberExpression", - "start": 781, - "end": 791, + "start": 915, + "end": 925, "loc": { "start": { - "line": 20, + "line": 22, "column": 34 }, "end": { - "line": 20, + "line": 22, "column": 44 } }, "object": { "type": "Identifier", - "start": 781, - "end": 785, + "start": 915, + "end": 919, "loc": { "start": { - "line": 20, + "line": 22, "column": 34 }, "end": { - "line": 20, + "line": 22, "column": 38 }, "identifierName": "root" @@ -840,15 +978,15 @@ }, "property": { "type": "Identifier", - "start": 786, - "end": 791, + "start": 920, + "end": 925, "loc": { "start": { - "line": 20, + "line": 22, "column": 39 }, "end": { - "line": 20, + "line": 22, "column": 44 }, "identifierName": "right" @@ -859,15 +997,15 @@ }, { "type": "Identifier", - "start": 793, - "end": 797, + "start": 927, + "end": 931, "loc": { "start": { - "line": 20, + "line": 22, "column": 46 }, "end": { - "line": 20, + "line": 22, "column": 50 }, "identifierName": "left" @@ -876,15 +1014,15 @@ }, { "type": "Identifier", - "start": 799, - "end": 804, + "start": 933, + "end": 938, "loc": { "start": { - "line": 20, + "line": 22, "column": 52 }, "end": { - "line": 20, + "line": 22, "column": 57 }, "identifierName": "right" @@ -903,15 +1041,15 @@ { "type": "CommentLine", "value": " If the root lies to the left of the interval, we can discard the", - "start": 585, - "end": 652, + "start": 719, + "end": 786, "loc": { "start": { - "line": 16, + "line": 18, "column": 2 }, "end": { - "line": 16, + "line": 18, "column": 69 } } @@ -919,15 +1057,15 @@ { "type": "CommentLine", "value": " entire left subtree.", - "start": 655, - "end": 678, + "start": 789, + "end": 812, "loc": { "start": { - "line": 17, + "line": 19, "column": 2 }, "end": { - "line": 17, + "line": 19, "column": 25 } } @@ -939,57 +1077,57 @@ }, "alternate": { "type": "IfStatement", - "start": 819, - "end": 1456, + "start": 953, + "end": 1594, "loc": { "start": { - "line": 22, + "line": 24, "column": 8 }, "end": { - "line": 42, + "line": 44, "column": 2 } }, "test": { "type": "BinaryExpression", - "start": 823, - "end": 852, + "start": 957, + "end": 986, "loc": { "start": { - "line": 22, + "line": 24, "column": 12 }, "end": { - "line": 22, + "line": 24, "column": 41 } }, "left": { "type": "CallExpression", - "start": 823, - "end": 847, + "start": 957, + "end": 981, "loc": { "start": { - "line": 22, + "line": 24, "column": 12 }, "end": { - "line": 22, + "line": 24, "column": 36 } }, "callee": { "type": "Identifier", - "start": 823, - "end": 830, + "start": 957, + "end": 964, "loc": { "start": { - "line": 22, + "line": 24, "column": 12 }, "end": { - "line": 22, + "line": 24, "column": 19 }, "identifierName": "compare" @@ -999,29 +1137,29 @@ "arguments": [ { "type": "MemberExpression", - "start": 831, - "end": 839, + "start": 965, + "end": 973, "loc": { "start": { - "line": 22, + "line": 24, "column": 20 }, "end": { - "line": 22, + "line": 24, "column": 28 } }, "object": { "type": "Identifier", - "start": 831, - "end": 835, + "start": 965, + "end": 969, "loc": { "start": { - "line": 22, + "line": 24, "column": 20 }, "end": { - "line": 22, + "line": 24, "column": 24 }, "identifierName": "root" @@ -1030,15 +1168,15 @@ }, "property": { "type": "Identifier", - "start": 836, - "end": 839, + "start": 970, + "end": 973, "loc": { "start": { - "line": 22, + "line": 24, "column": 25 }, "end": { - "line": 22, + "line": 24, "column": 28 }, "identifierName": "key" @@ -1049,15 +1187,15 @@ }, { "type": "Identifier", - "start": 841, - "end": 846, + "start": 975, + "end": 980, "loc": { "start": { - "line": 22, + "line": 24, "column": 30 }, "end": { - "line": 22, + "line": 24, "column": 35 }, "identifierName": "right" @@ -1069,15 +1207,15 @@ "operator": ">=", "right": { "type": "NumericLiteral", - "start": 851, - "end": 852, + "start": 985, + "end": 986, "loc": { "start": { - "line": 22, + "line": 24, "column": 40 }, "end": { - "line": 22, + "line": 24, "column": 41 } }, @@ -1090,72 +1228,72 @@ }, "consequent": { "type": "BlockStatement", - "start": 854, - "end": 1085, + "start": 988, + "end": 1219, "loc": { "start": { - "line": 22, + "line": 24, "column": 43 }, "end": { - "line": 29, + "line": 31, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 956, - "end": 1082, + "start": 1090, + "end": 1216, "loc": { "start": { - "line": 25, + "line": 27, "column": 2 }, "end": { - "line": 28, + "line": 30, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 960, - "end": 978, + "start": 1094, + "end": 1112, "loc": { "start": { - "line": 25, + "line": 27, "column": 6 }, "end": { - "line": 25, + "line": 27, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 960, - "end": 969, + "start": 1094, + "end": 1103, "loc": { "start": { - "line": 25, + "line": 27, "column": 6 }, "end": { - "line": 25, + "line": 27, "column": 15 } }, "object": { "type": "Identifier", - "start": 960, - "end": 964, + "start": 1094, + "end": 1098, "loc": { "start": { - "line": 25, + "line": 27, "column": 6 }, "end": { - "line": 25, + "line": 27, "column": 10 }, "identifierName": "root" @@ -1165,15 +1303,15 @@ }, "property": { "type": "Identifier", - "start": 965, - "end": 969, + "start": 1099, + "end": 1103, "loc": { "start": { - "line": 25, + "line": 27, "column": 11 }, "end": { - "line": 25, + "line": 27, "column": 15 }, "identifierName": "left" @@ -1186,15 +1324,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 974, - "end": 978, + "start": 1108, + "end": 1112, "loc": { "start": { - "line": 25, + "line": 27, "column": 20 }, "end": { - "line": 25, + "line": 27, "column": 24 } } @@ -1203,58 +1341,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 980, - "end": 1082, + "start": 1114, + "end": 1216, "loc": { "start": { - "line": 25, + "line": 27, "column": 26 }, "end": { - "line": 28, + "line": 30, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 985, - "end": 1019, + "start": 1119, + "end": 1153, "loc": { "start": { - "line": 26, + "line": 28, "column": 3 }, "end": { - "line": 26, + "line": 28, "column": 37 } }, "expression": { "type": "CallExpression", - "start": 985, - "end": 1018, + "start": 1119, + "end": 1152, "loc": { "start": { - "line": 26, + "line": 28, "column": 3 }, "end": { - "line": 26, + "line": 28, "column": 36 } }, "callee": { "type": "Identifier", - "start": 985, - "end": 991, + "start": 1119, + "end": 1125, "loc": { "start": { - "line": 26, + "line": 28, "column": 3 }, "end": { - "line": 26, + "line": 28, "column": 9 }, "identifierName": "assert" @@ -1264,43 +1402,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 992, - "end": 1017, + "start": 1126, + "end": 1151, "loc": { "start": { - "line": 26, + "line": 28, "column": 10 }, "end": { - "line": 26, + "line": 28, "column": 35 } }, "left": { "type": "MemberExpression", - "start": 992, - "end": 1001, + "start": 1126, + "end": 1135, "loc": { "start": { - "line": 26, + "line": 28, "column": 10 }, "end": { - "line": 26, + "line": 28, "column": 19 } }, "object": { "type": "Identifier", - "start": 992, - "end": 996, + "start": 1126, + "end": 1130, "loc": { "start": { - "line": 26, + "line": 28, "column": 10 }, "end": { - "line": 26, + "line": 28, "column": 14 }, "identifierName": "root" @@ -1309,15 +1447,15 @@ }, "property": { "type": "Identifier", - "start": 997, - "end": 1001, + "start": 1131, + "end": 1135, "loc": { "start": { - "line": 26, + "line": 28, "column": 15 }, "end": { - "line": 26, + "line": 28, "column": 19 }, "identifierName": "left" @@ -1329,15 +1467,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1013, - "end": 1017, + "start": 1147, + "end": 1151, "loc": { "start": { - "line": 26, + "line": 28, "column": 31 }, "end": { - "line": 26, + "line": 28, "column": 35 }, "identifierName": "Node" @@ -1350,58 +1488,58 @@ }, { "type": "ExpressionStatement", - "start": 1023, - "end": 1078, + "start": 1157, + "end": 1212, "loc": { "start": { - "line": 27, + "line": 29, "column": 3 }, "end": { - "line": 27, + "line": 29, "column": 58 } }, "expression": { "type": "YieldExpression", - "start": 1023, - "end": 1077, + "start": 1157, + "end": 1211, "loc": { "start": { - "line": 27, + "line": 29, "column": 3 }, "end": { - "line": 27, + "line": 29, "column": 57 } }, "delegate": true, "argument": { "type": "CallExpression", - "start": 1030, - "end": 1077, + "start": 1164, + "end": 1211, "loc": { "start": { - "line": 27, + "line": 29, "column": 10 }, "end": { - "line": 27, + "line": 29, "column": 57 } }, "callee": { "type": "Identifier", - "start": 1030, - "end": 1044, + "start": 1164, + "end": 1178, "loc": { "start": { - "line": 27, + "line": 29, "column": 10 }, "end": { - "line": 27, + "line": 29, "column": 24 }, "identifierName": "rangetraversal" @@ -1411,15 +1549,15 @@ "arguments": [ { "type": "Identifier", - "start": 1045, - "end": 1052, + "start": 1179, + "end": 1186, "loc": { "start": { - "line": 27, + "line": 29, "column": 25 }, "end": { - "line": 27, + "line": 29, "column": 32 }, "identifierName": "compare" @@ -1428,29 +1566,29 @@ }, { "type": "MemberExpression", - "start": 1054, - "end": 1063, + "start": 1188, + "end": 1197, "loc": { "start": { - "line": 27, + "line": 29, "column": 34 }, "end": { - "line": 27, + "line": 29, "column": 43 } }, "object": { "type": "Identifier", - "start": 1054, - "end": 1058, + "start": 1188, + "end": 1192, "loc": { "start": { - "line": 27, + "line": 29, "column": 34 }, "end": { - "line": 27, + "line": 29, "column": 38 }, "identifierName": "root" @@ -1459,15 +1597,15 @@ }, "property": { "type": "Identifier", - "start": 1059, - "end": 1063, + "start": 1193, + "end": 1197, "loc": { "start": { - "line": 27, + "line": 29, "column": 39 }, "end": { - "line": 27, + "line": 29, "column": 43 }, "identifierName": "left" @@ -1478,15 +1616,15 @@ }, { "type": "Identifier", - "start": 1065, - "end": 1069, + "start": 1199, + "end": 1203, "loc": { "start": { - "line": 27, + "line": 29, "column": 45 }, "end": { - "line": 27, + "line": 29, "column": 49 }, "identifierName": "left" @@ -1495,15 +1633,15 @@ }, { "type": "Identifier", - "start": 1071, - "end": 1076, + "start": 1205, + "end": 1210, "loc": { "start": { - "line": 27, + "line": 29, "column": 51 }, "end": { - "line": 27, + "line": 29, "column": 56 }, "identifierName": "right" @@ -1522,15 +1660,15 @@ { "type": "CommentLine", "value": " If the root lies to the right of the interval, we can discard the", - "start": 858, - "end": 926, + "start": 992, + "end": 1060, "loc": { "start": { - "line": 23, + "line": 25, "column": 2 }, "end": { - "line": 23, + "line": 25, "column": 70 } } @@ -1538,15 +1676,15 @@ { "type": "CommentLine", "value": " entire right subtree.", - "start": 929, - "end": 953, + "start": 1063, + "end": 1087, "loc": { "start": { - "line": 24, + "line": 26, "column": 2 }, "end": { - "line": 24, + "line": 26, "column": 26 } } @@ -1558,72 +1696,72 @@ }, "alternate": { "type": "BlockStatement", - "start": 1091, - "end": 1456, + "start": 1225, + "end": 1594, "loc": { "start": { - "line": 29, + "line": 31, "column": 8 }, "end": { - "line": 42, + "line": 44, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 1176, - "end": 1302, + "start": 1310, + "end": 1438, "loc": { "start": { - "line": 32, + "line": 34, "column": 2 }, "end": { - "line": 35, + "line": 37, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 1180, - "end": 1198, + "start": 1314, + "end": 1332, "loc": { "start": { - "line": 32, + "line": 34, "column": 6 }, "end": { - "line": 32, + "line": 34, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 1180, - "end": 1189, + "start": 1314, + "end": 1323, "loc": { "start": { - "line": 32, + "line": 34, "column": 6 }, "end": { - "line": 32, + "line": 34, "column": 15 } }, "object": { "type": "Identifier", - "start": 1180, - "end": 1184, + "start": 1314, + "end": 1318, "loc": { "start": { - "line": 32, + "line": 34, "column": 6 }, "end": { - "line": 32, + "line": 34, "column": 10 }, "identifierName": "root" @@ -1633,15 +1771,15 @@ }, "property": { "type": "Identifier", - "start": 1185, - "end": 1189, + "start": 1319, + "end": 1323, "loc": { "start": { - "line": 32, + "line": 34, "column": 11 }, "end": { - "line": 32, + "line": 34, "column": 15 }, "identifierName": "left" @@ -1654,15 +1792,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 1194, - "end": 1198, + "start": 1328, + "end": 1332, "loc": { "start": { - "line": 32, + "line": 34, "column": 20 }, "end": { - "line": 32, + "line": 34, "column": 24 } } @@ -1671,58 +1809,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 1200, - "end": 1302, + "start": 1334, + "end": 1438, "loc": { "start": { - "line": 32, + "line": 34, "column": 26 }, "end": { - "line": 35, + "line": 37, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 1205, - "end": 1239, + "start": 1339, + "end": 1373, "loc": { "start": { - "line": 33, + "line": 35, "column": 3 }, "end": { - "line": 33, + "line": 35, "column": 37 } }, "expression": { "type": "CallExpression", - "start": 1205, - "end": 1238, + "start": 1339, + "end": 1372, "loc": { "start": { - "line": 33, + "line": 35, "column": 3 }, "end": { - "line": 33, + "line": 35, "column": 36 } }, "callee": { "type": "Identifier", - "start": 1205, - "end": 1211, + "start": 1339, + "end": 1345, "loc": { "start": { - "line": 33, + "line": 35, "column": 3 }, "end": { - "line": 33, + "line": 35, "column": 9 }, "identifierName": "assert" @@ -1732,43 +1870,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1212, - "end": 1237, + "start": 1346, + "end": 1371, "loc": { "start": { - "line": 33, + "line": 35, "column": 10 }, "end": { - "line": 33, + "line": 35, "column": 35 } }, "left": { "type": "MemberExpression", - "start": 1212, - "end": 1221, + "start": 1346, + "end": 1355, "loc": { "start": { - "line": 33, + "line": 35, "column": 10 }, "end": { - "line": 33, + "line": 35, "column": 19 } }, "object": { "type": "Identifier", - "start": 1212, - "end": 1216, + "start": 1346, + "end": 1350, "loc": { "start": { - "line": 33, + "line": 35, "column": 10 }, "end": { - "line": 33, + "line": 35, "column": 14 }, "identifierName": "root" @@ -1777,15 +1915,15 @@ }, "property": { "type": "Identifier", - "start": 1217, - "end": 1221, + "start": 1351, + "end": 1355, "loc": { "start": { - "line": 33, + "line": 35, "column": 15 }, "end": { - "line": 33, + "line": 35, "column": 19 }, "identifierName": "left" @@ -1797,15 +1935,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1233, - "end": 1237, + "start": 1367, + "end": 1371, "loc": { "start": { - "line": 33, + "line": 35, "column": 31 }, "end": { - "line": 33, + "line": 35, "column": 35 }, "identifierName": "Node" @@ -1818,77 +1956,77 @@ }, { "type": "ExpressionStatement", - "start": 1243, - "end": 1298, + "start": 1377, + "end": 1434, "loc": { "start": { - "line": 34, + "line": 36, "column": 3 }, "end": { - "line": 34, - "column": 58 + "line": 36, + "column": 60 } }, "expression": { "type": "YieldExpression", - "start": 1243, - "end": 1297, + "start": 1377, + "end": 1433, "loc": { "start": { - "line": 34, + "line": 36, "column": 3 }, "end": { - "line": 34, - "column": 57 + "line": 36, + "column": 59 } }, "delegate": true, "argument": { "type": "CallExpression", - "start": 1250, - "end": 1297, + "start": 1384, + "end": 1433, "loc": { "start": { - "line": 34, + "line": 36, "column": 10 }, "end": { - "line": 34, - "column": 57 + "line": 36, + "column": 59 } }, "callee": { "type": "Identifier", - "start": 1250, - "end": 1264, + "start": 1384, + "end": 1407, "loc": { "start": { - "line": 34, + "line": 36, "column": 10 }, "end": { - "line": 34, - "column": 24 + "line": 36, + "column": 33 }, - "identifierName": "rangetraversal" + "identifierName": "rightOpenRangeTraversal" }, - "name": "rangetraversal" + "name": "rightOpenRangeTraversal" }, "arguments": [ { "type": "Identifier", - "start": 1265, - "end": 1272, + "start": 1408, + "end": 1415, "loc": { "start": { - "line": 34, - "column": 25 + "line": 36, + "column": 34 }, "end": { - "line": 34, - "column": 32 + "line": 36, + "column": 41 }, "identifierName": "compare" }, @@ -1896,30 +2034,30 @@ }, { "type": "MemberExpression", - "start": 1274, - "end": 1283, + "start": 1417, + "end": 1426, "loc": { "start": { - "line": 34, - "column": 34 + "line": 36, + "column": 43 }, "end": { - "line": 34, - "column": 43 + "line": 36, + "column": 52 } }, "object": { "type": "Identifier", - "start": 1274, - "end": 1278, + "start": 1417, + "end": 1421, "loc": { "start": { - "line": 34, - "column": 34 + "line": 36, + "column": 43 }, "end": { - "line": 34, - "column": 38 + "line": 36, + "column": 47 }, "identifierName": "root" }, @@ -1927,16 +2065,16 @@ }, "property": { "type": "Identifier", - "start": 1279, - "end": 1283, + "start": 1422, + "end": 1426, "loc": { "start": { - "line": 34, - "column": 39 + "line": 36, + "column": 48 }, "end": { - "line": 34, - "column": 43 + "line": 36, + "column": 52 }, "identifierName": "left" }, @@ -1946,37 +2084,20 @@ }, { "type": "Identifier", - "start": 1285, - "end": 1289, + "start": 1428, + "end": 1432, "loc": { "start": { - "line": 34, - "column": 45 + "line": 36, + "column": 54 }, "end": { - "line": 34, - "column": 49 + "line": 36, + "column": 58 }, "identifierName": "left" }, "name": "left" - }, - { - "type": "Identifier", - "start": 1291, - "end": 1296, - "loc": { - "start": { - "line": 34, - "column": 51 - }, - "end": { - "line": 34, - "column": 56 - }, - "identifierName": "right" - }, - "name": "right" } ] } @@ -1990,15 +2111,15 @@ { "type": "CommentLine", "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 1095, - "end": 1159, + "start": 1229, + "end": 1293, "loc": { "start": { - "line": 30, + "line": 32, "column": 2 }, "end": { - "line": 30, + "line": 32, "column": 66 } } @@ -2006,15 +2127,15 @@ { "type": "CommentLine", "value": " between.", - "start": 1162, - "end": 1173, + "start": 1296, + "end": 1307, "loc": { "start": { - "line": 31, + "line": 33, "column": 2 }, "end": { - "line": 31, + "line": 33, "column": 13 } } @@ -2023,58 +2144,58 @@ }, { "type": "ExpressionStatement", - "start": 1306, - "end": 1321, + "start": 1442, + "end": 1457, "loc": { "start": { - "line": 37, + "line": 39, "column": 2 }, "end": { - "line": 37, + "line": 39, "column": 17 } }, "expression": { "type": "YieldExpression", - "start": 1306, - "end": 1320, + "start": 1442, + "end": 1456, "loc": { "start": { - "line": 37, + "line": 39, "column": 2 }, "end": { - "line": 37, + "line": 39, "column": 16 } }, "delegate": false, "argument": { "type": "MemberExpression", - "start": 1312, - "end": 1320, + "start": 1448, + "end": 1456, "loc": { "start": { - "line": 37, + "line": 39, "column": 8 }, "end": { - "line": 37, + "line": 39, "column": 16 } }, "object": { "type": "Identifier", - "start": 1312, - "end": 1316, + "start": 1448, + "end": 1452, "loc": { "start": { - "line": 37, + "line": 39, "column": 8 }, "end": { - "line": 37, + "line": 39, "column": 12 }, "identifierName": "root" @@ -2083,15 +2204,15 @@ }, "property": { "type": "Identifier", - "start": 1317, - "end": 1320, + "start": 1453, + "end": 1456, "loc": { "start": { - "line": 37, + "line": 39, "column": 13 }, "end": { - "line": 37, + "line": 39, "column": 16 }, "identifierName": "key" @@ -2104,57 +2225,57 @@ }, { "type": "IfStatement", - "start": 1324, - "end": 1453, + "start": 1460, + "end": 1591, "loc": { "start": { - "line": 38, + "line": 40, "column": 2 }, "end": { - "line": 41, + "line": 43, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 1328, - "end": 1347, + "start": 1464, + "end": 1483, "loc": { "start": { - "line": 38, + "line": 40, "column": 6 }, "end": { - "line": 38, + "line": 40, "column": 25 } }, "left": { "type": "MemberExpression", - "start": 1328, - "end": 1338, + "start": 1464, + "end": 1474, "loc": { "start": { - "line": 38, + "line": 40, "column": 6 }, "end": { - "line": 38, + "line": 40, "column": 16 } }, "object": { "type": "Identifier", - "start": 1328, - "end": 1332, + "start": 1464, + "end": 1468, "loc": { "start": { - "line": 38, + "line": 40, "column": 6 }, "end": { - "line": 38, + "line": 40, "column": 10 }, "identifierName": "root" @@ -2163,15 +2284,15 @@ }, "property": { "type": "Identifier", - "start": 1333, - "end": 1338, + "start": 1469, + "end": 1474, "loc": { "start": { - "line": 38, + "line": 40, "column": 11 }, "end": { - "line": 38, + "line": 40, "column": 16 }, "identifierName": "right" @@ -2183,15 +2304,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 1343, - "end": 1347, + "start": 1479, + "end": 1483, "loc": { "start": { - "line": 38, + "line": 40, "column": 21 }, "end": { - "line": 38, + "line": 40, "column": 25 } } @@ -2199,58 +2320,58 @@ }, "consequent": { "type": "BlockStatement", - "start": 1349, - "end": 1453, + "start": 1485, + "end": 1591, "loc": { "start": { - "line": 38, + "line": 40, "column": 27 }, "end": { - "line": 41, + "line": 43, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 1354, - "end": 1389, + "start": 1490, + "end": 1525, "loc": { "start": { - "line": 39, + "line": 41, "column": 3 }, "end": { - "line": 39, + "line": 41, "column": 38 } }, "expression": { "type": "CallExpression", - "start": 1354, - "end": 1388, + "start": 1490, + "end": 1524, "loc": { "start": { - "line": 39, + "line": 41, "column": 3 }, "end": { - "line": 39, + "line": 41, "column": 37 } }, "callee": { "type": "Identifier", - "start": 1354, - "end": 1360, + "start": 1490, + "end": 1496, "loc": { "start": { - "line": 39, + "line": 41, "column": 3 }, "end": { - "line": 39, + "line": 41, "column": 9 }, "identifierName": "assert" @@ -2260,43 +2381,43 @@ "arguments": [ { "type": "BinaryExpression", - "start": 1361, - "end": 1387, + "start": 1497, + "end": 1523, "loc": { "start": { - "line": 39, + "line": 41, "column": 10 }, "end": { - "line": 39, + "line": 41, "column": 36 } }, "left": { "type": "MemberExpression", - "start": 1361, - "end": 1371, + "start": 1497, + "end": 1507, "loc": { "start": { - "line": 39, + "line": 41, "column": 10 }, "end": { - "line": 39, + "line": 41, "column": 20 } }, "object": { "type": "Identifier", - "start": 1361, - "end": 1365, + "start": 1497, + "end": 1501, "loc": { "start": { - "line": 39, + "line": 41, "column": 10 }, "end": { - "line": 39, + "line": 41, "column": 14 }, "identifierName": "root" @@ -2305,15 +2426,15 @@ }, "property": { "type": "Identifier", - "start": 1366, - "end": 1371, + "start": 1502, + "end": 1507, "loc": { "start": { - "line": 39, + "line": 41, "column": 15 }, "end": { - "line": 39, + "line": 41, "column": 20 }, "identifierName": "right" @@ -2325,15 +2446,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 1383, - "end": 1387, + "start": 1519, + "end": 1523, "loc": { "start": { - "line": 39, + "line": 41, "column": 32 }, "end": { - "line": 39, + "line": 41, "column": 36 }, "identifierName": "Node" @@ -2346,77 +2467,77 @@ }, { "type": "ExpressionStatement", - "start": 1393, - "end": 1449, + "start": 1529, + "end": 1587, "loc": { "start": { - "line": 40, + "line": 42, "column": 3 }, "end": { - "line": 40, - "column": 59 + "line": 42, + "column": 61 } }, "expression": { "type": "YieldExpression", - "start": 1393, - "end": 1448, + "start": 1529, + "end": 1586, "loc": { "start": { - "line": 40, + "line": 42, "column": 3 }, "end": { - "line": 40, - "column": 58 + "line": 42, + "column": 60 } }, "delegate": true, "argument": { "type": "CallExpression", - "start": 1400, - "end": 1448, + "start": 1536, + "end": 1586, "loc": { "start": { - "line": 40, + "line": 42, "column": 10 }, "end": { - "line": 40, - "column": 58 + "line": 42, + "column": 60 } }, "callee": { "type": "Identifier", - "start": 1400, - "end": 1414, + "start": 1536, + "end": 1558, "loc": { "start": { - "line": 40, + "line": 42, "column": 10 }, "end": { - "line": 40, - "column": 24 + "line": 42, + "column": 32 }, - "identifierName": "rangetraversal" + "identifierName": "leftOpenRangeTraversal" }, - "name": "rangetraversal" + "name": "leftOpenRangeTraversal" }, "arguments": [ { "type": "Identifier", - "start": 1415, - "end": 1422, + "start": 1559, + "end": 1566, "loc": { "start": { - "line": 40, - "column": 25 + "line": 42, + "column": 33 }, "end": { - "line": 40, - "column": 32 + "line": 42, + "column": 40 }, "identifierName": "compare" }, @@ -2424,30 +2545,30 @@ }, { "type": "MemberExpression", - "start": 1424, - "end": 1434, + "start": 1568, + "end": 1578, "loc": { "start": { - "line": 40, - "column": 34 + "line": 42, + "column": 42 }, "end": { - "line": 40, - "column": 44 + "line": 42, + "column": 52 } }, "object": { "type": "Identifier", - "start": 1424, - "end": 1428, + "start": 1568, + "end": 1572, "loc": { "start": { - "line": 40, - "column": 34 + "line": 42, + "column": 42 }, "end": { - "line": 40, - "column": 38 + "line": 42, + "column": 46 }, "identifierName": "root" }, @@ -2455,16 +2576,16 @@ }, "property": { "type": "Identifier", - "start": 1429, - "end": 1434, + "start": 1573, + "end": 1578, "loc": { "start": { - "line": 40, - "column": 39 + "line": 42, + "column": 47 }, "end": { - "line": 40, - "column": 44 + "line": 42, + "column": 52 }, "identifierName": "right" }, @@ -2474,33 +2595,16 @@ }, { "type": "Identifier", - "start": 1436, - "end": 1440, - "loc": { - "start": { - "line": 40, - "column": 46 - }, - "end": { - "line": 40, - "column": 50 - }, - "identifierName": "left" - }, - "name": "left" - }, - { - "type": "Identifier", - "start": 1442, - "end": 1447, + "start": 1580, + "end": 1585, "loc": { "start": { - "line": 40, - "column": 52 + "line": 42, + "column": 54 }, "end": { - "line": 40, - "column": 57 + "line": 42, + "column": 59 }, "identifierName": "right" }, @@ -2527,15 +2631,15 @@ { "type": "CommentBlock", "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", - "start": 67, - "end": 476, + "start": 201, + "end": 610, "loc": { "start": { - "line": 4, + "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 15, "column": 3 } } @@ -2547,15 +2651,15 @@ { "type": "CommentBlock", "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", - "start": 67, - "end": 476, + "start": 201, + "end": 610, "loc": { "start": { - "line": 4, + "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 15, "column": 3 } } @@ -2569,15 +2673,15 @@ { "type": "CommentBlock", "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", - "start": 67, - "end": 476, + "start": 201, + "end": 610, "loc": { "start": { - "line": 4, + "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 15, "column": 3 } } @@ -2585,15 +2689,15 @@ { "type": "CommentLine", "value": " If the root lies to the left of the interval, we can discard the", - "start": 585, - "end": 652, + "start": 719, + "end": 786, "loc": { "start": { - "line": 16, + "line": 18, "column": 2 }, "end": { - "line": 16, + "line": 18, "column": 69 } } @@ -2601,15 +2705,15 @@ { "type": "CommentLine", "value": " entire left subtree.", - "start": 655, - "end": 678, + "start": 789, + "end": 812, "loc": { "start": { - "line": 17, + "line": 19, "column": 2 }, "end": { - "line": 17, + "line": 19, "column": 25 } } @@ -2617,15 +2721,15 @@ { "type": "CommentLine", "value": " If the root lies to the right of the interval, we can discard the", - "start": 858, - "end": 926, + "start": 992, + "end": 1060, "loc": { "start": { - "line": 23, + "line": 25, "column": 2 }, "end": { - "line": 23, + "line": 25, "column": 70 } } @@ -2633,15 +2737,15 @@ { "type": "CommentLine", "value": " entire right subtree.", - "start": 929, - "end": 953, + "start": 1063, + "end": 1087, "loc": { "start": { - "line": 24, + "line": 26, "column": 2 }, "end": { - "line": 24, + "line": 26, "column": 26 } } @@ -2649,15 +2753,15 @@ { "type": "CommentLine", "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 1095, - "end": 1159, + "start": 1229, + "end": 1293, "loc": { "start": { - "line": 30, + "line": 32, "column": 2 }, "end": { - "line": 30, + "line": 32, "column": 66 } } @@ -2665,15 +2769,15 @@ { "type": "CommentLine", "value": " between.", - "start": 1162, - "end": 1173, + "start": 1296, + "end": 1307, "loc": { "start": { - "line": 31, + "line": 33, "column": 2 }, "end": { - "line": 31, + "line": 33, "column": 13 } } @@ -2946,18 +3050,284 @@ } } }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "leftOpenRangeTraversal", + "start": 73, + "end": 95, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 29 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 96, + "end": 100, + "loc": { + "start": { + "line": 3, + "column": 30 + }, + "end": { + "line": 3, + "column": 34 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./leftOpenRangeTraversal.js", + "start": 101, + "end": 130, + "loc": { + "start": { + "line": 3, + "column": 35 + }, + "end": { + "line": 3, + "column": 64 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 130, + "end": 131, + "loc": { + "start": { + "line": 3, + "column": 64 + }, + "end": { + "line": 3, + "column": 65 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 132, + "end": 138, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rightOpenRangeTraversal", + "start": 139, + "end": 162, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 163, + "end": 167, + "loc": { + "start": { + "line": 4, + "column": 31 + }, + "end": { + "line": 4, + "column": 35 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./rightOpenRangeTraversal.js", + "start": 168, + "end": 198, + "loc": { + "start": { + "line": 4, + "column": 36 + }, + "end": { + "line": 4, + "column": 66 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 198, + "end": 199, + "loc": { + "start": { + "line": 4, + "column": 66 + }, + "end": { + "line": 4, + "column": 67 + } + } + }, { "type": "CommentBlock", "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n ", - "start": 67, - "end": 476, + "start": 201, + "end": 610, "loc": { "start": { - "line": 4, + "line": 6, "column": 0 }, "end": { - "line": 13, + "line": 15, "column": 3 } } @@ -2977,15 +3347,15 @@ "updateContext": null }, "value": "export", - "start": 477, - "end": 483, + "start": 611, + "end": 617, "loc": { "start": { - "line": 14, + "line": 16, "column": 0 }, "end": { - "line": 14, + "line": 16, "column": 6 } } @@ -3005,15 +3375,15 @@ "updateContext": null }, "value": "default", - "start": 484, - "end": 491, + "start": 618, + "end": 625, "loc": { "start": { - "line": 14, + "line": 16, "column": 7 }, "end": { - "line": 14, + "line": 16, "column": 14 } } @@ -3032,15 +3402,15 @@ "binop": null }, "value": "function", - "start": 492, - "end": 500, + "start": 626, + "end": 634, "loc": { "start": { - "line": 14, + "line": 16, "column": 15 }, "end": { - "line": 14, + "line": 16, "column": 23 } } @@ -3059,15 +3429,15 @@ "updateContext": null }, "value": "*", - "start": 500, - "end": 501, + "start": 634, + "end": 635, "loc": { "start": { - "line": 14, + "line": 16, "column": 23 }, "end": { - "line": 14, + "line": 16, "column": 24 } } @@ -3085,15 +3455,15 @@ "binop": null }, "value": "rangetraversal", - "start": 502, - "end": 516, + "start": 636, + "end": 650, "loc": { "start": { - "line": 14, + "line": 16, "column": 25 }, "end": { - "line": 14, + "line": 16, "column": 39 } } @@ -3110,15 +3480,15 @@ "postfix": false, "binop": null }, - "start": 516, - "end": 517, + "start": 650, + "end": 651, "loc": { "start": { - "line": 14, + "line": 16, "column": 39 }, "end": { - "line": 14, + "line": 16, "column": 40 } } @@ -3136,15 +3506,15 @@ "binop": null }, "value": "compare", - "start": 517, - "end": 524, + "start": 651, + "end": 658, "loc": { "start": { - "line": 14, + "line": 16, "column": 40 }, "end": { - "line": 14, + "line": 16, "column": 47 } } @@ -3162,15 +3532,15 @@ "binop": null, "updateContext": null }, - "start": 524, - "end": 525, + "start": 658, + "end": 659, "loc": { "start": { - "line": 14, + "line": 16, "column": 47 }, "end": { - "line": 14, + "line": 16, "column": 48 } } @@ -3188,15 +3558,15 @@ "binop": null }, "value": "root", - "start": 526, - "end": 530, + "start": 660, + "end": 664, "loc": { "start": { - "line": 14, + "line": 16, "column": 49 }, "end": { - "line": 14, + "line": 16, "column": 53 } } @@ -3214,15 +3584,15 @@ "binop": null, "updateContext": null }, - "start": 530, - "end": 531, + "start": 664, + "end": 665, "loc": { "start": { - "line": 14, + "line": 16, "column": 53 }, "end": { - "line": 14, + "line": 16, "column": 54 } } @@ -3240,15 +3610,15 @@ "binop": null }, "value": "left", - "start": 532, - "end": 536, + "start": 666, + "end": 670, "loc": { "start": { - "line": 14, + "line": 16, "column": 55 }, "end": { - "line": 14, + "line": 16, "column": 59 } } @@ -3266,15 +3636,15 @@ "binop": null, "updateContext": null }, - "start": 536, - "end": 537, + "start": 670, + "end": 671, "loc": { "start": { - "line": 14, + "line": 16, "column": 59 }, "end": { - "line": 14, + "line": 16, "column": 60 } } @@ -3292,15 +3662,15 @@ "binop": null }, "value": "right", - "start": 538, - "end": 543, + "start": 672, + "end": 677, "loc": { "start": { - "line": 14, + "line": 16, "column": 61 }, "end": { - "line": 14, + "line": 16, "column": 66 } } @@ -3317,15 +3687,15 @@ "postfix": false, "binop": null }, - "start": 543, - "end": 544, + "start": 677, + "end": 678, "loc": { "start": { - "line": 14, + "line": 16, "column": 66 }, "end": { - "line": 14, + "line": 16, "column": 67 } } @@ -3342,15 +3712,15 @@ "postfix": false, "binop": null }, - "start": 545, - "end": 546, + "start": 679, + "end": 680, "loc": { "start": { - "line": 14, + "line": 16, "column": 68 }, "end": { - "line": 14, + "line": 16, "column": 69 } } @@ -3370,15 +3740,15 @@ "updateContext": null }, "value": "if", - "start": 548, - "end": 550, + "start": 682, + "end": 684, "loc": { "start": { - "line": 15, + "line": 17, "column": 1 }, "end": { - "line": 15, + "line": 17, "column": 3 } } @@ -3395,15 +3765,15 @@ "postfix": false, "binop": null }, - "start": 551, - "end": 552, + "start": 685, + "end": 686, "loc": { "start": { - "line": 15, + "line": 17, "column": 4 }, "end": { - "line": 15, + "line": 17, "column": 5 } } @@ -3421,15 +3791,15 @@ "binop": null }, "value": "compare", - "start": 552, - "end": 559, + "start": 686, + "end": 693, "loc": { "start": { - "line": 15, + "line": 17, "column": 5 }, "end": { - "line": 15, + "line": 17, "column": 12 } } @@ -3446,15 +3816,15 @@ "postfix": false, "binop": null }, - "start": 559, - "end": 560, + "start": 693, + "end": 694, "loc": { "start": { - "line": 15, + "line": 17, "column": 12 }, "end": { - "line": 15, + "line": 17, "column": 13 } } @@ -3472,15 +3842,15 @@ "binop": null }, "value": "root", - "start": 560, - "end": 564, + "start": 694, + "end": 698, "loc": { "start": { - "line": 15, + "line": 17, "column": 13 }, "end": { - "line": 15, + "line": 17, "column": 17 } } @@ -3498,15 +3868,15 @@ "binop": null, "updateContext": null }, - "start": 564, - "end": 565, + "start": 698, + "end": 699, "loc": { "start": { - "line": 15, + "line": 17, "column": 17 }, "end": { - "line": 15, + "line": 17, "column": 18 } } @@ -3524,15 +3894,15 @@ "binop": null }, "value": "key", - "start": 565, - "end": 568, + "start": 699, + "end": 702, "loc": { "start": { - "line": 15, + "line": 17, "column": 18 }, "end": { - "line": 15, + "line": 17, "column": 21 } } @@ -3550,15 +3920,15 @@ "binop": null, "updateContext": null }, - "start": 568, - "end": 569, + "start": 702, + "end": 703, "loc": { "start": { - "line": 15, + "line": 17, "column": 21 }, "end": { - "line": 15, + "line": 17, "column": 22 } } @@ -3576,15 +3946,15 @@ "binop": null }, "value": "left", - "start": 570, - "end": 574, + "start": 704, + "end": 708, "loc": { "start": { - "line": 15, + "line": 17, "column": 23 }, "end": { - "line": 15, + "line": 17, "column": 27 } } @@ -3601,15 +3971,15 @@ "postfix": false, "binop": null }, - "start": 574, - "end": 575, + "start": 708, + "end": 709, "loc": { "start": { - "line": 15, + "line": 17, "column": 27 }, "end": { - "line": 15, + "line": 17, "column": 28 } } @@ -3628,15 +3998,15 @@ "updateContext": null }, "value": "<", - "start": 576, - "end": 577, + "start": 710, + "end": 711, "loc": { "start": { - "line": 15, + "line": 17, "column": 29 }, "end": { - "line": 15, + "line": 17, "column": 30 } } @@ -3655,15 +4025,15 @@ "updateContext": null }, "value": 0, - "start": 578, - "end": 579, + "start": 712, + "end": 713, "loc": { "start": { - "line": 15, + "line": 17, "column": 31 }, "end": { - "line": 15, + "line": 17, "column": 32 } } @@ -3680,15 +4050,15 @@ "postfix": false, "binop": null }, - "start": 579, - "end": 580, + "start": 713, + "end": 714, "loc": { "start": { - "line": 15, + "line": 17, "column": 32 }, "end": { - "line": 15, + "line": 17, "column": 33 } } @@ -3705,15 +4075,15 @@ "postfix": false, "binop": null }, - "start": 581, - "end": 582, + "start": 715, + "end": 716, "loc": { "start": { - "line": 15, + "line": 17, "column": 34 }, "end": { - "line": 15, + "line": 17, "column": 35 } } @@ -3721,15 +4091,15 @@ { "type": "CommentLine", "value": " If the root lies to the left of the interval, we can discard the", - "start": 585, - "end": 652, + "start": 719, + "end": 786, "loc": { "start": { - "line": 16, + "line": 18, "column": 2 }, "end": { - "line": 16, + "line": 18, "column": 69 } } @@ -3737,15 +4107,15 @@ { "type": "CommentLine", "value": " entire left subtree.", - "start": 655, - "end": 678, + "start": 789, + "end": 812, "loc": { "start": { - "line": 17, + "line": 19, "column": 2 }, "end": { - "line": 17, + "line": 19, "column": 25 } } @@ -3765,15 +4135,15 @@ "updateContext": null }, "value": "if", - "start": 681, - "end": 683, + "start": 815, + "end": 817, "loc": { "start": { - "line": 18, + "line": 20, "column": 2 }, "end": { - "line": 18, + "line": 20, "column": 4 } } @@ -3790,15 +4160,15 @@ "postfix": false, "binop": null }, - "start": 684, - "end": 685, + "start": 818, + "end": 819, "loc": { "start": { - "line": 18, + "line": 20, "column": 5 }, "end": { - "line": 18, + "line": 20, "column": 6 } } @@ -3816,15 +4186,15 @@ "binop": null }, "value": "root", - "start": 685, - "end": 689, + "start": 819, + "end": 823, "loc": { "start": { - "line": 18, + "line": 20, "column": 6 }, "end": { - "line": 18, + "line": 20, "column": 10 } } @@ -3842,15 +4212,15 @@ "binop": null, "updateContext": null }, - "start": 689, - "end": 690, + "start": 823, + "end": 824, "loc": { "start": { - "line": 18, + "line": 20, "column": 10 }, "end": { - "line": 18, + "line": 20, "column": 11 } } @@ -3868,15 +4238,15 @@ "binop": null }, "value": "right", - "start": 690, - "end": 695, + "start": 824, + "end": 829, "loc": { "start": { - "line": 18, + "line": 20, "column": 11 }, "end": { - "line": 18, + "line": 20, "column": 16 } } @@ -3895,15 +4265,15 @@ "updateContext": null }, "value": "!==", - "start": 696, - "end": 699, + "start": 830, + "end": 833, "loc": { "start": { - "line": 18, + "line": 20, "column": 17 }, "end": { - "line": 18, + "line": 20, "column": 20 } } @@ -3923,15 +4293,15 @@ "updateContext": null }, "value": "null", - "start": 700, - "end": 704, + "start": 834, + "end": 838, "loc": { "start": { - "line": 18, + "line": 20, "column": 21 }, "end": { - "line": 18, + "line": 20, "column": 25 } } @@ -3948,15 +4318,15 @@ "postfix": false, "binop": null }, - "start": 704, - "end": 705, + "start": 838, + "end": 839, "loc": { "start": { - "line": 18, + "line": 20, "column": 25 }, "end": { - "line": 18, + "line": 20, "column": 26 } } @@ -3973,15 +4343,15 @@ "postfix": false, "binop": null }, - "start": 706, - "end": 707, + "start": 840, + "end": 841, "loc": { "start": { - "line": 18, + "line": 20, "column": 27 }, "end": { - "line": 18, + "line": 20, "column": 28 } } @@ -3999,15 +4369,15 @@ "binop": null }, "value": "assert", - "start": 711, - "end": 717, + "start": 845, + "end": 851, "loc": { "start": { - "line": 19, + "line": 21, "column": 3 }, "end": { - "line": 19, + "line": 21, "column": 9 } } @@ -4024,15 +4394,15 @@ "postfix": false, "binop": null }, - "start": 717, - "end": 718, + "start": 851, + "end": 852, "loc": { "start": { - "line": 19, + "line": 21, "column": 9 }, "end": { - "line": 19, + "line": 21, "column": 10 } } @@ -4050,15 +4420,15 @@ "binop": null }, "value": "root", - "start": 718, - "end": 722, + "start": 852, + "end": 856, "loc": { "start": { - "line": 19, + "line": 21, "column": 10 }, "end": { - "line": 19, + "line": 21, "column": 14 } } @@ -4076,15 +4446,15 @@ "binop": null, "updateContext": null }, - "start": 722, - "end": 723, + "start": 856, + "end": 857, "loc": { "start": { - "line": 19, + "line": 21, "column": 14 }, "end": { - "line": 19, + "line": 21, "column": 15 } } @@ -4102,15 +4472,15 @@ "binop": null }, "value": "right", - "start": 723, - "end": 728, + "start": 857, + "end": 862, "loc": { "start": { - "line": 19, + "line": 21, "column": 15 }, "end": { - "line": 19, + "line": 21, "column": 20 } } @@ -4130,15 +4500,15 @@ "updateContext": null }, "value": "instanceof", - "start": 729, - "end": 739, + "start": 863, + "end": 873, "loc": { "start": { - "line": 19, + "line": 21, "column": 21 }, "end": { - "line": 19, + "line": 21, "column": 31 } } @@ -4156,15 +4526,15 @@ "binop": null }, "value": "Node", - "start": 740, - "end": 744, + "start": 874, + "end": 878, "loc": { "start": { - "line": 19, + "line": 21, "column": 32 }, "end": { - "line": 19, + "line": 21, "column": 36 } } @@ -4181,15 +4551,15 @@ "postfix": false, "binop": null }, - "start": 744, - "end": 745, + "start": 878, + "end": 879, "loc": { "start": { - "line": 19, + "line": 21, "column": 36 }, "end": { - "line": 19, + "line": 21, "column": 37 } } @@ -4207,15 +4577,15 @@ "binop": null, "updateContext": null }, - "start": 745, - "end": 746, + "start": 879, + "end": 880, "loc": { "start": { - "line": 19, + "line": 21, "column": 37 }, "end": { - "line": 19, + "line": 21, "column": 38 } } @@ -4235,15 +4605,15 @@ "updateContext": null }, "value": "yield", - "start": 750, - "end": 755, + "start": 884, + "end": 889, "loc": { "start": { - "line": 20, + "line": 22, "column": 3 }, "end": { - "line": 20, + "line": 22, "column": 8 } } @@ -4262,15 +4632,15 @@ "updateContext": null }, "value": "*", - "start": 755, - "end": 756, + "start": 889, + "end": 890, "loc": { "start": { - "line": 20, + "line": 22, "column": 8 }, "end": { - "line": 20, + "line": 22, "column": 9 } } @@ -4288,15 +4658,15 @@ "binop": null }, "value": "rangetraversal", - "start": 757, - "end": 771, + "start": 891, + "end": 905, "loc": { "start": { - "line": 20, + "line": 22, "column": 10 }, "end": { - "line": 20, + "line": 22, "column": 24 } } @@ -4313,15 +4683,15 @@ "postfix": false, "binop": null }, - "start": 771, - "end": 772, + "start": 905, + "end": 906, "loc": { "start": { - "line": 20, + "line": 22, "column": 24 }, "end": { - "line": 20, + "line": 22, "column": 25 } } @@ -4339,15 +4709,15 @@ "binop": null }, "value": "compare", - "start": 772, - "end": 779, + "start": 906, + "end": 913, "loc": { "start": { - "line": 20, + "line": 22, "column": 25 }, "end": { - "line": 20, + "line": 22, "column": 32 } } @@ -4365,15 +4735,15 @@ "binop": null, "updateContext": null }, - "start": 779, - "end": 780, + "start": 913, + "end": 914, "loc": { "start": { - "line": 20, + "line": 22, "column": 32 }, "end": { - "line": 20, + "line": 22, "column": 33 } } @@ -4391,15 +4761,15 @@ "binop": null }, "value": "root", - "start": 781, - "end": 785, + "start": 915, + "end": 919, "loc": { "start": { - "line": 20, + "line": 22, "column": 34 }, "end": { - "line": 20, + "line": 22, "column": 38 } } @@ -4417,15 +4787,15 @@ "binop": null, "updateContext": null }, - "start": 785, - "end": 786, + "start": 919, + "end": 920, "loc": { "start": { - "line": 20, + "line": 22, "column": 38 }, "end": { - "line": 20, + "line": 22, "column": 39 } } @@ -4443,15 +4813,15 @@ "binop": null }, "value": "right", - "start": 786, - "end": 791, + "start": 920, + "end": 925, "loc": { "start": { - "line": 20, + "line": 22, "column": 39 }, "end": { - "line": 20, + "line": 22, "column": 44 } } @@ -4469,15 +4839,15 @@ "binop": null, "updateContext": null }, - "start": 791, - "end": 792, + "start": 925, + "end": 926, "loc": { "start": { - "line": 20, + "line": 22, "column": 44 }, "end": { - "line": 20, + "line": 22, "column": 45 } } @@ -4495,15 +4865,15 @@ "binop": null }, "value": "left", - "start": 793, - "end": 797, + "start": 927, + "end": 931, "loc": { "start": { - "line": 20, + "line": 22, "column": 46 }, "end": { - "line": 20, + "line": 22, "column": 50 } } @@ -4521,15 +4891,15 @@ "binop": null, "updateContext": null }, - "start": 797, - "end": 798, + "start": 931, + "end": 932, "loc": { "start": { - "line": 20, + "line": 22, "column": 50 }, "end": { - "line": 20, + "line": 22, "column": 51 } } @@ -4547,15 +4917,15 @@ "binop": null }, "value": "right", - "start": 799, - "end": 804, + "start": 933, + "end": 938, "loc": { "start": { - "line": 20, + "line": 22, "column": 52 }, "end": { - "line": 20, + "line": 22, "column": 57 } } @@ -4572,15 +4942,15 @@ "postfix": false, "binop": null }, - "start": 804, - "end": 805, + "start": 938, + "end": 939, "loc": { "start": { - "line": 20, + "line": 22, "column": 57 }, "end": { - "line": 20, + "line": 22, "column": 58 } } @@ -4598,15 +4968,15 @@ "binop": null, "updateContext": null }, - "start": 805, - "end": 806, + "start": 939, + "end": 940, "loc": { "start": { - "line": 20, + "line": 22, "column": 58 }, "end": { - "line": 20, + "line": 22, "column": 59 } } @@ -4623,15 +4993,15 @@ "postfix": false, "binop": null }, - "start": 809, - "end": 810, + "start": 943, + "end": 944, "loc": { "start": { - "line": 21, + "line": 23, "column": 2 }, "end": { - "line": 21, + "line": 23, "column": 3 } } @@ -4648,15 +5018,15 @@ "postfix": false, "binop": null }, - "start": 812, - "end": 813, + "start": 946, + "end": 947, "loc": { "start": { - "line": 22, + "line": 24, "column": 1 }, "end": { - "line": 22, + "line": 24, "column": 2 } } @@ -4676,15 +5046,15 @@ "updateContext": null }, "value": "else", - "start": 814, - "end": 818, + "start": 948, + "end": 952, "loc": { "start": { - "line": 22, + "line": 24, "column": 3 }, "end": { - "line": 22, + "line": 24, "column": 7 } } @@ -4704,15 +5074,15 @@ "updateContext": null }, "value": "if", - "start": 819, - "end": 821, + "start": 953, + "end": 955, "loc": { "start": { - "line": 22, + "line": 24, "column": 8 }, "end": { - "line": 22, + "line": 24, "column": 10 } } @@ -4729,15 +5099,15 @@ "postfix": false, "binop": null }, - "start": 822, - "end": 823, + "start": 956, + "end": 957, "loc": { "start": { - "line": 22, + "line": 24, "column": 11 }, "end": { - "line": 22, + "line": 24, "column": 12 } } @@ -4755,15 +5125,15 @@ "binop": null }, "value": "compare", - "start": 823, - "end": 830, + "start": 957, + "end": 964, "loc": { "start": { - "line": 22, + "line": 24, "column": 12 }, "end": { - "line": 22, + "line": 24, "column": 19 } } @@ -4780,15 +5150,15 @@ "postfix": false, "binop": null }, - "start": 830, - "end": 831, + "start": 964, + "end": 965, "loc": { "start": { - "line": 22, + "line": 24, "column": 19 }, "end": { - "line": 22, + "line": 24, "column": 20 } } @@ -4806,15 +5176,15 @@ "binop": null }, "value": "root", - "start": 831, - "end": 835, + "start": 965, + "end": 969, "loc": { "start": { - "line": 22, + "line": 24, "column": 20 }, "end": { - "line": 22, + "line": 24, "column": 24 } } @@ -4832,15 +5202,15 @@ "binop": null, "updateContext": null }, - "start": 835, - "end": 836, + "start": 969, + "end": 970, "loc": { "start": { - "line": 22, + "line": 24, "column": 24 }, "end": { - "line": 22, + "line": 24, "column": 25 } } @@ -4858,15 +5228,15 @@ "binop": null }, "value": "key", - "start": 836, - "end": 839, + "start": 970, + "end": 973, "loc": { "start": { - "line": 22, + "line": 24, "column": 25 }, "end": { - "line": 22, + "line": 24, "column": 28 } } @@ -4884,15 +5254,15 @@ "binop": null, "updateContext": null }, - "start": 839, - "end": 840, + "start": 973, + "end": 974, "loc": { "start": { - "line": 22, + "line": 24, "column": 28 }, "end": { - "line": 22, + "line": 24, "column": 29 } } @@ -4910,15 +5280,15 @@ "binop": null }, "value": "right", - "start": 841, - "end": 846, + "start": 975, + "end": 980, "loc": { "start": { - "line": 22, + "line": 24, "column": 30 }, "end": { - "line": 22, + "line": 24, "column": 35 } } @@ -4935,15 +5305,15 @@ "postfix": false, "binop": null }, - "start": 846, - "end": 847, + "start": 980, + "end": 981, "loc": { "start": { - "line": 22, + "line": 24, "column": 35 }, "end": { - "line": 22, + "line": 24, "column": 36 } } @@ -4962,15 +5332,15 @@ "updateContext": null }, "value": ">=", - "start": 848, - "end": 850, + "start": 982, + "end": 984, "loc": { "start": { - "line": 22, + "line": 24, "column": 37 }, "end": { - "line": 22, + "line": 24, "column": 39 } } @@ -4989,15 +5359,15 @@ "updateContext": null }, "value": 0, - "start": 851, - "end": 852, + "start": 985, + "end": 986, "loc": { "start": { - "line": 22, + "line": 24, "column": 40 }, "end": { - "line": 22, + "line": 24, "column": 41 } } @@ -5014,15 +5384,15 @@ "postfix": false, "binop": null }, - "start": 852, - "end": 853, + "start": 986, + "end": 987, "loc": { "start": { - "line": 22, + "line": 24, "column": 41 }, "end": { - "line": 22, + "line": 24, "column": 42 } } @@ -5039,15 +5409,15 @@ "postfix": false, "binop": null }, - "start": 854, - "end": 855, + "start": 988, + "end": 989, "loc": { "start": { - "line": 22, + "line": 24, "column": 43 }, "end": { - "line": 22, + "line": 24, "column": 44 } } @@ -5055,15 +5425,15 @@ { "type": "CommentLine", "value": " If the root lies to the right of the interval, we can discard the", - "start": 858, - "end": 926, + "start": 992, + "end": 1060, "loc": { "start": { - "line": 23, + "line": 25, "column": 2 }, "end": { - "line": 23, + "line": 25, "column": 70 } } @@ -5071,15 +5441,15 @@ { "type": "CommentLine", "value": " entire right subtree.", - "start": 929, - "end": 953, + "start": 1063, + "end": 1087, "loc": { "start": { - "line": 24, + "line": 26, "column": 2 }, "end": { - "line": 24, + "line": 26, "column": 26 } } @@ -5099,15 +5469,15 @@ "updateContext": null }, "value": "if", - "start": 956, - "end": 958, + "start": 1090, + "end": 1092, "loc": { "start": { - "line": 25, + "line": 27, "column": 2 }, "end": { - "line": 25, + "line": 27, "column": 4 } } @@ -5124,15 +5494,15 @@ "postfix": false, "binop": null }, - "start": 959, - "end": 960, + "start": 1093, + "end": 1094, "loc": { "start": { - "line": 25, + "line": 27, "column": 5 }, "end": { - "line": 25, + "line": 27, "column": 6 } } @@ -5150,15 +5520,15 @@ "binop": null }, "value": "root", - "start": 960, - "end": 964, + "start": 1094, + "end": 1098, "loc": { "start": { - "line": 25, + "line": 27, "column": 6 }, "end": { - "line": 25, + "line": 27, "column": 10 } } @@ -5176,15 +5546,15 @@ "binop": null, "updateContext": null }, - "start": 964, - "end": 965, + "start": 1098, + "end": 1099, "loc": { "start": { - "line": 25, + "line": 27, "column": 10 }, "end": { - "line": 25, + "line": 27, "column": 11 } } @@ -5202,15 +5572,15 @@ "binop": null }, "value": "left", - "start": 965, - "end": 969, + "start": 1099, + "end": 1103, "loc": { "start": { - "line": 25, + "line": 27, "column": 11 }, "end": { - "line": 25, + "line": 27, "column": 15 } } @@ -5229,15 +5599,15 @@ "updateContext": null }, "value": "!==", - "start": 970, - "end": 973, + "start": 1104, + "end": 1107, "loc": { "start": { - "line": 25, + "line": 27, "column": 16 }, "end": { - "line": 25, + "line": 27, "column": 19 } } @@ -5257,15 +5627,15 @@ "updateContext": null }, "value": "null", - "start": 974, - "end": 978, + "start": 1108, + "end": 1112, "loc": { "start": { - "line": 25, + "line": 27, "column": 20 }, "end": { - "line": 25, + "line": 27, "column": 24 } } @@ -5282,15 +5652,15 @@ "postfix": false, "binop": null }, - "start": 978, - "end": 979, + "start": 1112, + "end": 1113, "loc": { "start": { - "line": 25, + "line": 27, "column": 24 }, "end": { - "line": 25, + "line": 27, "column": 25 } } @@ -5307,15 +5677,15 @@ "postfix": false, "binop": null }, - "start": 980, - "end": 981, + "start": 1114, + "end": 1115, "loc": { "start": { - "line": 25, + "line": 27, "column": 26 }, "end": { - "line": 25, + "line": 27, "column": 27 } } @@ -5333,15 +5703,15 @@ "binop": null }, "value": "assert", - "start": 985, - "end": 991, + "start": 1119, + "end": 1125, "loc": { "start": { - "line": 26, + "line": 28, "column": 3 }, "end": { - "line": 26, + "line": 28, "column": 9 } } @@ -5358,15 +5728,15 @@ "postfix": false, "binop": null }, - "start": 991, - "end": 992, + "start": 1125, + "end": 1126, "loc": { "start": { - "line": 26, + "line": 28, "column": 9 }, "end": { - "line": 26, + "line": 28, "column": 10 } } @@ -5384,15 +5754,15 @@ "binop": null }, "value": "root", - "start": 992, - "end": 996, + "start": 1126, + "end": 1130, "loc": { "start": { - "line": 26, + "line": 28, "column": 10 }, "end": { - "line": 26, + "line": 28, "column": 14 } } @@ -5410,15 +5780,15 @@ "binop": null, "updateContext": null }, - "start": 996, - "end": 997, + "start": 1130, + "end": 1131, "loc": { "start": { - "line": 26, + "line": 28, "column": 14 }, "end": { - "line": 26, + "line": 28, "column": 15 } } @@ -5436,15 +5806,15 @@ "binop": null }, "value": "left", - "start": 997, - "end": 1001, + "start": 1131, + "end": 1135, "loc": { "start": { - "line": 26, + "line": 28, "column": 15 }, "end": { - "line": 26, + "line": 28, "column": 19 } } @@ -5464,15 +5834,15 @@ "updateContext": null }, "value": "instanceof", - "start": 1002, - "end": 1012, + "start": 1136, + "end": 1146, "loc": { "start": { - "line": 26, + "line": 28, "column": 20 }, "end": { - "line": 26, + "line": 28, "column": 30 } } @@ -5490,15 +5860,15 @@ "binop": null }, "value": "Node", - "start": 1013, - "end": 1017, + "start": 1147, + "end": 1151, "loc": { "start": { - "line": 26, + "line": 28, "column": 31 }, "end": { - "line": 26, + "line": 28, "column": 35 } } @@ -5515,15 +5885,15 @@ "postfix": false, "binop": null }, - "start": 1017, - "end": 1018, + "start": 1151, + "end": 1152, "loc": { "start": { - "line": 26, + "line": 28, "column": 35 }, "end": { - "line": 26, + "line": 28, "column": 36 } } @@ -5541,15 +5911,15 @@ "binop": null, "updateContext": null }, - "start": 1018, - "end": 1019, + "start": 1152, + "end": 1153, "loc": { "start": { - "line": 26, + "line": 28, "column": 36 }, "end": { - "line": 26, + "line": 28, "column": 37 } } @@ -5569,15 +5939,15 @@ "updateContext": null }, "value": "yield", - "start": 1023, - "end": 1028, + "start": 1157, + "end": 1162, "loc": { "start": { - "line": 27, + "line": 29, "column": 3 }, "end": { - "line": 27, + "line": 29, "column": 8 } } @@ -5596,15 +5966,15 @@ "updateContext": null }, "value": "*", - "start": 1028, - "end": 1029, + "start": 1162, + "end": 1163, "loc": { "start": { - "line": 27, + "line": 29, "column": 8 }, "end": { - "line": 27, + "line": 29, "column": 9 } } @@ -5622,15 +5992,15 @@ "binop": null }, "value": "rangetraversal", - "start": 1030, - "end": 1044, + "start": 1164, + "end": 1178, "loc": { "start": { - "line": 27, + "line": 29, "column": 10 }, "end": { - "line": 27, + "line": 29, "column": 24 } } @@ -5647,15 +6017,15 @@ "postfix": false, "binop": null }, - "start": 1044, - "end": 1045, + "start": 1178, + "end": 1179, "loc": { "start": { - "line": 27, + "line": 29, "column": 24 }, "end": { - "line": 27, + "line": 29, "column": 25 } } @@ -5673,15 +6043,15 @@ "binop": null }, "value": "compare", - "start": 1045, - "end": 1052, + "start": 1179, + "end": 1186, "loc": { "start": { - "line": 27, + "line": 29, "column": 25 }, "end": { - "line": 27, + "line": 29, "column": 32 } } @@ -5699,15 +6069,15 @@ "binop": null, "updateContext": null }, - "start": 1052, - "end": 1053, + "start": 1186, + "end": 1187, "loc": { "start": { - "line": 27, + "line": 29, "column": 32 }, "end": { - "line": 27, + "line": 29, "column": 33 } } @@ -5725,15 +6095,15 @@ "binop": null }, "value": "root", - "start": 1054, - "end": 1058, + "start": 1188, + "end": 1192, "loc": { "start": { - "line": 27, + "line": 29, "column": 34 }, "end": { - "line": 27, + "line": 29, "column": 38 } } @@ -5751,15 +6121,15 @@ "binop": null, "updateContext": null }, - "start": 1058, - "end": 1059, + "start": 1192, + "end": 1193, "loc": { "start": { - "line": 27, + "line": 29, "column": 38 }, "end": { - "line": 27, + "line": 29, "column": 39 } } @@ -5777,15 +6147,15 @@ "binop": null }, "value": "left", - "start": 1059, - "end": 1063, + "start": 1193, + "end": 1197, "loc": { "start": { - "line": 27, + "line": 29, "column": 39 }, "end": { - "line": 27, + "line": 29, "column": 43 } } @@ -5803,15 +6173,15 @@ "binop": null, "updateContext": null }, - "start": 1063, - "end": 1064, + "start": 1197, + "end": 1198, "loc": { "start": { - "line": 27, + "line": 29, "column": 43 }, "end": { - "line": 27, + "line": 29, "column": 44 } } @@ -5829,15 +6199,15 @@ "binop": null }, "value": "left", - "start": 1065, - "end": 1069, + "start": 1199, + "end": 1203, "loc": { "start": { - "line": 27, + "line": 29, "column": 45 }, "end": { - "line": 27, + "line": 29, "column": 49 } } @@ -5855,15 +6225,15 @@ "binop": null, "updateContext": null }, - "start": 1069, - "end": 1070, + "start": 1203, + "end": 1204, "loc": { "start": { - "line": 27, + "line": 29, "column": 49 }, "end": { - "line": 27, + "line": 29, "column": 50 } } @@ -5881,15 +6251,15 @@ "binop": null }, "value": "right", - "start": 1071, - "end": 1076, + "start": 1205, + "end": 1210, "loc": { "start": { - "line": 27, + "line": 29, "column": 51 }, "end": { - "line": 27, + "line": 29, "column": 56 } } @@ -5906,15 +6276,15 @@ "postfix": false, "binop": null }, - "start": 1076, - "end": 1077, + "start": 1210, + "end": 1211, "loc": { "start": { - "line": 27, + "line": 29, "column": 56 }, "end": { - "line": 27, + "line": 29, "column": 57 } } @@ -5932,15 +6302,15 @@ "binop": null, "updateContext": null }, - "start": 1077, - "end": 1078, + "start": 1211, + "end": 1212, "loc": { "start": { - "line": 27, + "line": 29, "column": 57 }, "end": { - "line": 27, + "line": 29, "column": 58 } } @@ -5957,15 +6327,15 @@ "postfix": false, "binop": null }, - "start": 1081, - "end": 1082, + "start": 1215, + "end": 1216, "loc": { "start": { - "line": 28, + "line": 30, "column": 2 }, "end": { - "line": 28, + "line": 30, "column": 3 } } @@ -5982,15 +6352,15 @@ "postfix": false, "binop": null }, - "start": 1084, - "end": 1085, + "start": 1218, + "end": 1219, "loc": { "start": { - "line": 29, + "line": 31, "column": 1 }, "end": { - "line": 29, + "line": 31, "column": 2 } } @@ -6010,15 +6380,15 @@ "updateContext": null }, "value": "else", - "start": 1086, - "end": 1090, + "start": 1220, + "end": 1224, "loc": { "start": { - "line": 29, + "line": 31, "column": 3 }, "end": { - "line": 29, + "line": 31, "column": 7 } } @@ -6035,15 +6405,15 @@ "postfix": false, "binop": null }, - "start": 1091, - "end": 1092, + "start": 1225, + "end": 1226, "loc": { "start": { - "line": 29, + "line": 31, "column": 8 }, "end": { - "line": 29, + "line": 31, "column": 9 } } @@ -6051,15 +6421,15 @@ { "type": "CommentLine", "value": " Otherwise just recurse on both subtrees and yield the root in", - "start": 1095, - "end": 1159, + "start": 1229, + "end": 1293, "loc": { "start": { - "line": 30, + "line": 32, "column": 2 }, "end": { - "line": 30, + "line": 32, "column": 66 } } @@ -6067,15 +6437,15 @@ { "type": "CommentLine", "value": " between.", - "start": 1162, - "end": 1173, + "start": 1296, + "end": 1307, "loc": { "start": { - "line": 31, + "line": 33, "column": 2 }, "end": { - "line": 31, + "line": 33, "column": 13 } } @@ -6095,15 +6465,15 @@ "updateContext": null }, "value": "if", - "start": 1176, - "end": 1178, + "start": 1310, + "end": 1312, "loc": { "start": { - "line": 32, + "line": 34, "column": 2 }, "end": { - "line": 32, + "line": 34, "column": 4 } } @@ -6120,15 +6490,15 @@ "postfix": false, "binop": null }, - "start": 1179, - "end": 1180, + "start": 1313, + "end": 1314, "loc": { "start": { - "line": 32, + "line": 34, "column": 5 }, "end": { - "line": 32, + "line": 34, "column": 6 } } @@ -6146,15 +6516,15 @@ "binop": null }, "value": "root", - "start": 1180, - "end": 1184, + "start": 1314, + "end": 1318, "loc": { "start": { - "line": 32, + "line": 34, "column": 6 }, "end": { - "line": 32, + "line": 34, "column": 10 } } @@ -6172,15 +6542,15 @@ "binop": null, "updateContext": null }, - "start": 1184, - "end": 1185, + "start": 1318, + "end": 1319, "loc": { "start": { - "line": 32, + "line": 34, "column": 10 }, "end": { - "line": 32, + "line": 34, "column": 11 } } @@ -6198,15 +6568,15 @@ "binop": null }, "value": "left", - "start": 1185, - "end": 1189, + "start": 1319, + "end": 1323, "loc": { "start": { - "line": 32, + "line": 34, "column": 11 }, "end": { - "line": 32, + "line": 34, "column": 15 } } @@ -6225,15 +6595,15 @@ "updateContext": null }, "value": "!==", - "start": 1190, - "end": 1193, + "start": 1324, + "end": 1327, "loc": { "start": { - "line": 32, + "line": 34, "column": 16 }, "end": { - "line": 32, + "line": 34, "column": 19 } } @@ -6253,15 +6623,15 @@ "updateContext": null }, "value": "null", - "start": 1194, - "end": 1198, + "start": 1328, + "end": 1332, "loc": { "start": { - "line": 32, + "line": 34, "column": 20 }, "end": { - "line": 32, + "line": 34, "column": 24 } } @@ -6278,15 +6648,15 @@ "postfix": false, "binop": null }, - "start": 1198, - "end": 1199, + "start": 1332, + "end": 1333, "loc": { "start": { - "line": 32, + "line": 34, "column": 24 }, "end": { - "line": 32, + "line": 34, "column": 25 } } @@ -6303,15 +6673,15 @@ "postfix": false, "binop": null }, - "start": 1200, - "end": 1201, + "start": 1334, + "end": 1335, "loc": { "start": { - "line": 32, + "line": 34, "column": 26 }, "end": { - "line": 32, + "line": 34, "column": 27 } } @@ -6329,15 +6699,15 @@ "binop": null }, "value": "assert", - "start": 1205, - "end": 1211, + "start": 1339, + "end": 1345, "loc": { "start": { - "line": 33, + "line": 35, "column": 3 }, "end": { - "line": 33, + "line": 35, "column": 9 } } @@ -6354,15 +6724,15 @@ "postfix": false, "binop": null }, - "start": 1211, - "end": 1212, + "start": 1345, + "end": 1346, "loc": { "start": { - "line": 33, + "line": 35, "column": 9 }, "end": { - "line": 33, + "line": 35, "column": 10 } } @@ -6380,15 +6750,15 @@ "binop": null }, "value": "root", - "start": 1212, - "end": 1216, + "start": 1346, + "end": 1350, "loc": { "start": { - "line": 33, + "line": 35, "column": 10 }, "end": { - "line": 33, + "line": 35, "column": 14 } } @@ -6406,15 +6776,15 @@ "binop": null, "updateContext": null }, - "start": 1216, - "end": 1217, + "start": 1350, + "end": 1351, "loc": { "start": { - "line": 33, + "line": 35, "column": 14 }, "end": { - "line": 33, + "line": 35, "column": 15 } } @@ -6432,15 +6802,15 @@ "binop": null }, "value": "left", - "start": 1217, - "end": 1221, + "start": 1351, + "end": 1355, "loc": { "start": { - "line": 33, + "line": 35, "column": 15 }, "end": { - "line": 33, + "line": 35, "column": 19 } } @@ -6460,15 +6830,15 @@ "updateContext": null }, "value": "instanceof", - "start": 1222, - "end": 1232, + "start": 1356, + "end": 1366, "loc": { "start": { - "line": 33, + "line": 35, "column": 20 }, "end": { - "line": 33, + "line": 35, "column": 30 } } @@ -6486,15 +6856,15 @@ "binop": null }, "value": "Node", - "start": 1233, - "end": 1237, + "start": 1367, + "end": 1371, "loc": { "start": { - "line": 33, + "line": 35, "column": 31 }, "end": { - "line": 33, + "line": 35, "column": 35 } } @@ -6511,15 +6881,15 @@ "postfix": false, "binop": null }, - "start": 1237, - "end": 1238, + "start": 1371, + "end": 1372, "loc": { "start": { - "line": 33, + "line": 35, "column": 35 }, "end": { - "line": 33, + "line": 35, "column": 36 } } @@ -6537,15 +6907,15 @@ "binop": null, "updateContext": null }, - "start": 1238, - "end": 1239, + "start": 1372, + "end": 1373, "loc": { "start": { - "line": 33, + "line": 35, "column": 36 }, "end": { - "line": 33, + "line": 35, "column": 37 } } @@ -6565,15 +6935,15 @@ "updateContext": null }, "value": "yield", - "start": 1243, - "end": 1248, + "start": 1377, + "end": 1382, "loc": { "start": { - "line": 34, + "line": 36, "column": 3 }, "end": { - "line": 34, + "line": 36, "column": 8 } } @@ -6592,15 +6962,15 @@ "updateContext": null }, "value": "*", - "start": 1248, - "end": 1249, + "start": 1382, + "end": 1383, "loc": { "start": { - "line": 34, + "line": 36, "column": 8 }, "end": { - "line": 34, + "line": 36, "column": 9 } } @@ -6617,17 +6987,17 @@ "postfix": false, "binop": null }, - "value": "rangetraversal", - "start": 1250, - "end": 1264, + "value": "rightOpenRangeTraversal", + "start": 1384, + "end": 1407, "loc": { "start": { - "line": 34, + "line": 36, "column": 10 }, "end": { - "line": 34, - "column": 24 + "line": 36, + "column": 33 } } }, @@ -6643,16 +7013,16 @@ "postfix": false, "binop": null }, - "start": 1264, - "end": 1265, + "start": 1407, + "end": 1408, "loc": { "start": { - "line": 34, - "column": 24 + "line": 36, + "column": 33 }, "end": { - "line": 34, - "column": 25 + "line": 36, + "column": 34 } } }, @@ -6669,16 +7039,16 @@ "binop": null }, "value": "compare", - "start": 1265, - "end": 1272, + "start": 1408, + "end": 1415, "loc": { "start": { - "line": 34, - "column": 25 + "line": 36, + "column": 34 }, "end": { - "line": 34, - "column": 32 + "line": 36, + "column": 41 } } }, @@ -6695,16 +7065,16 @@ "binop": null, "updateContext": null }, - "start": 1272, - "end": 1273, + "start": 1415, + "end": 1416, "loc": { "start": { - "line": 34, - "column": 32 + "line": 36, + "column": 41 }, "end": { - "line": 34, - "column": 33 + "line": 36, + "column": 42 } } }, @@ -6721,16 +7091,16 @@ "binop": null }, "value": "root", - "start": 1274, - "end": 1278, + "start": 1417, + "end": 1421, "loc": { "start": { - "line": 34, - "column": 34 + "line": 36, + "column": 43 }, "end": { - "line": 34, - "column": 38 + "line": 36, + "column": 47 } } }, @@ -6747,16 +7117,16 @@ "binop": null, "updateContext": null }, - "start": 1278, - "end": 1279, + "start": 1421, + "end": 1422, "loc": { "start": { - "line": 34, - "column": 38 + "line": 36, + "column": 47 }, "end": { - "line": 34, - "column": 39 + "line": 36, + "column": 48 } } }, @@ -6773,16 +7143,16 @@ "binop": null }, "value": "left", - "start": 1279, - "end": 1283, + "start": 1422, + "end": 1426, "loc": { "start": { - "line": 34, - "column": 39 + "line": 36, + "column": 48 }, "end": { - "line": 34, - "column": 43 + "line": 36, + "column": 52 } } }, @@ -6799,16 +7169,16 @@ "binop": null, "updateContext": null }, - "start": 1283, - "end": 1284, + "start": 1426, + "end": 1427, "loc": { "start": { - "line": 34, - "column": 43 + "line": 36, + "column": 52 }, "end": { - "line": 34, - "column": 44 + "line": 36, + "column": 53 } } }, @@ -6825,68 +7195,16 @@ "binop": null }, "value": "left", - "start": 1285, - "end": 1289, - "loc": { - "start": { - "line": 34, - "column": 45 - }, - "end": { - "line": 34, - "column": 49 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1289, - "end": 1290, - "loc": { - "start": { - "line": 34, - "column": 49 - }, - "end": { - "line": 34, - "column": 50 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "right", - "start": 1291, - "end": 1296, + "start": 1428, + "end": 1432, "loc": { "start": { - "line": 34, - "column": 51 + "line": 36, + "column": 54 }, "end": { - "line": 34, - "column": 56 + "line": 36, + "column": 58 } } }, @@ -6902,16 +7220,16 @@ "postfix": false, "binop": null }, - "start": 1296, - "end": 1297, + "start": 1432, + "end": 1433, "loc": { "start": { - "line": 34, - "column": 56 + "line": 36, + "column": 58 }, "end": { - "line": 34, - "column": 57 + "line": 36, + "column": 59 } } }, @@ -6928,16 +7246,16 @@ "binop": null, "updateContext": null }, - "start": 1297, - "end": 1298, + "start": 1433, + "end": 1434, "loc": { "start": { - "line": 34, - "column": 57 + "line": 36, + "column": 59 }, "end": { - "line": 34, - "column": 58 + "line": 36, + "column": 60 } } }, @@ -6953,15 +7271,15 @@ "postfix": false, "binop": null }, - "start": 1301, - "end": 1302, + "start": 1437, + "end": 1438, "loc": { "start": { - "line": 35, + "line": 37, "column": 2 }, "end": { - "line": 35, + "line": 37, "column": 3 } } @@ -6981,15 +7299,15 @@ "updateContext": null }, "value": "yield", - "start": 1306, - "end": 1311, + "start": 1442, + "end": 1447, "loc": { "start": { - "line": 37, + "line": 39, "column": 2 }, "end": { - "line": 37, + "line": 39, "column": 7 } } @@ -7007,15 +7325,15 @@ "binop": null }, "value": "root", - "start": 1312, - "end": 1316, + "start": 1448, + "end": 1452, "loc": { "start": { - "line": 37, + "line": 39, "column": 8 }, "end": { - "line": 37, + "line": 39, "column": 12 } } @@ -7033,15 +7351,15 @@ "binop": null, "updateContext": null }, - "start": 1316, - "end": 1317, + "start": 1452, + "end": 1453, "loc": { "start": { - "line": 37, + "line": 39, "column": 12 }, "end": { - "line": 37, + "line": 39, "column": 13 } } @@ -7059,15 +7377,15 @@ "binop": null }, "value": "key", - "start": 1317, - "end": 1320, + "start": 1453, + "end": 1456, "loc": { "start": { - "line": 37, + "line": 39, "column": 13 }, "end": { - "line": 37, + "line": 39, "column": 16 } } @@ -7085,15 +7403,15 @@ "binop": null, "updateContext": null }, - "start": 1320, - "end": 1321, + "start": 1456, + "end": 1457, "loc": { "start": { - "line": 37, + "line": 39, "column": 16 }, "end": { - "line": 37, + "line": 39, "column": 17 } } @@ -7113,15 +7431,15 @@ "updateContext": null }, "value": "if", - "start": 1324, - "end": 1326, + "start": 1460, + "end": 1462, "loc": { "start": { - "line": 38, + "line": 40, "column": 2 }, "end": { - "line": 38, + "line": 40, "column": 4 } } @@ -7138,15 +7456,15 @@ "postfix": false, "binop": null }, - "start": 1327, - "end": 1328, + "start": 1463, + "end": 1464, "loc": { "start": { - "line": 38, + "line": 40, "column": 5 }, "end": { - "line": 38, + "line": 40, "column": 6 } } @@ -7164,15 +7482,15 @@ "binop": null }, "value": "root", - "start": 1328, - "end": 1332, + "start": 1464, + "end": 1468, "loc": { "start": { - "line": 38, + "line": 40, "column": 6 }, "end": { - "line": 38, + "line": 40, "column": 10 } } @@ -7190,15 +7508,15 @@ "binop": null, "updateContext": null }, - "start": 1332, - "end": 1333, + "start": 1468, + "end": 1469, "loc": { "start": { - "line": 38, + "line": 40, "column": 10 }, "end": { - "line": 38, + "line": 40, "column": 11 } } @@ -7216,15 +7534,15 @@ "binop": null }, "value": "right", - "start": 1333, - "end": 1338, + "start": 1469, + "end": 1474, "loc": { "start": { - "line": 38, + "line": 40, "column": 11 }, "end": { - "line": 38, + "line": 40, "column": 16 } } @@ -7243,15 +7561,15 @@ "updateContext": null }, "value": "!==", - "start": 1339, - "end": 1342, + "start": 1475, + "end": 1478, "loc": { "start": { - "line": 38, + "line": 40, "column": 17 }, "end": { - "line": 38, + "line": 40, "column": 20 } } @@ -7271,15 +7589,15 @@ "updateContext": null }, "value": "null", - "start": 1343, - "end": 1347, + "start": 1479, + "end": 1483, "loc": { "start": { - "line": 38, + "line": 40, "column": 21 }, "end": { - "line": 38, + "line": 40, "column": 25 } } @@ -7296,15 +7614,15 @@ "postfix": false, "binop": null }, - "start": 1347, - "end": 1348, + "start": 1483, + "end": 1484, "loc": { "start": { - "line": 38, + "line": 40, "column": 25 }, "end": { - "line": 38, + "line": 40, "column": 26 } } @@ -7321,15 +7639,15 @@ "postfix": false, "binop": null }, - "start": 1349, - "end": 1350, + "start": 1485, + "end": 1486, "loc": { "start": { - "line": 38, + "line": 40, "column": 27 }, "end": { - "line": 38, + "line": 40, "column": 28 } } @@ -7347,15 +7665,15 @@ "binop": null }, "value": "assert", - "start": 1354, - "end": 1360, + "start": 1490, + "end": 1496, "loc": { "start": { - "line": 39, + "line": 41, "column": 3 }, "end": { - "line": 39, + "line": 41, "column": 9 } } @@ -7372,15 +7690,15 @@ "postfix": false, "binop": null }, - "start": 1360, - "end": 1361, + "start": 1496, + "end": 1497, "loc": { "start": { - "line": 39, + "line": 41, "column": 9 }, "end": { - "line": 39, + "line": 41, "column": 10 } } @@ -7398,15 +7716,15 @@ "binop": null }, "value": "root", - "start": 1361, - "end": 1365, + "start": 1497, + "end": 1501, "loc": { "start": { - "line": 39, + "line": 41, "column": 10 }, "end": { - "line": 39, + "line": 41, "column": 14 } } @@ -7424,15 +7742,15 @@ "binop": null, "updateContext": null }, - "start": 1365, - "end": 1366, + "start": 1501, + "end": 1502, "loc": { "start": { - "line": 39, + "line": 41, "column": 14 }, "end": { - "line": 39, + "line": 41, "column": 15 } } @@ -7450,15 +7768,15 @@ "binop": null }, "value": "right", - "start": 1366, - "end": 1371, + "start": 1502, + "end": 1507, "loc": { "start": { - "line": 39, + "line": 41, "column": 15 }, "end": { - "line": 39, + "line": 41, "column": 20 } } @@ -7478,15 +7796,15 @@ "updateContext": null }, "value": "instanceof", - "start": 1372, - "end": 1382, + "start": 1508, + "end": 1518, "loc": { "start": { - "line": 39, + "line": 41, "column": 21 }, "end": { - "line": 39, + "line": 41, "column": 31 } } @@ -7504,15 +7822,15 @@ "binop": null }, "value": "Node", - "start": 1383, - "end": 1387, + "start": 1519, + "end": 1523, "loc": { "start": { - "line": 39, + "line": 41, "column": 32 }, "end": { - "line": 39, + "line": 41, "column": 36 } } @@ -7529,15 +7847,15 @@ "postfix": false, "binop": null }, - "start": 1387, - "end": 1388, + "start": 1523, + "end": 1524, "loc": { "start": { - "line": 39, + "line": 41, "column": 36 }, "end": { - "line": 39, + "line": 41, "column": 37 } } @@ -7555,15 +7873,15 @@ "binop": null, "updateContext": null }, - "start": 1388, - "end": 1389, + "start": 1524, + "end": 1525, "loc": { "start": { - "line": 39, + "line": 41, "column": 37 }, "end": { - "line": 39, + "line": 41, "column": 38 } } @@ -7583,15 +7901,15 @@ "updateContext": null }, "value": "yield", - "start": 1393, - "end": 1398, + "start": 1529, + "end": 1534, "loc": { "start": { - "line": 40, + "line": 42, "column": 3 }, "end": { - "line": 40, + "line": 42, "column": 8 } } @@ -7610,15 +7928,15 @@ "updateContext": null }, "value": "*", - "start": 1398, - "end": 1399, + "start": 1534, + "end": 1535, "loc": { "start": { - "line": 40, + "line": 42, "column": 8 }, "end": { - "line": 40, + "line": 42, "column": 9 } } @@ -7635,17 +7953,17 @@ "postfix": false, "binop": null }, - "value": "rangetraversal", - "start": 1400, - "end": 1414, + "value": "leftOpenRangeTraversal", + "start": 1536, + "end": 1558, "loc": { "start": { - "line": 40, + "line": 42, "column": 10 }, "end": { - "line": 40, - "column": 24 + "line": 42, + "column": 32 } } }, @@ -7661,16 +7979,16 @@ "postfix": false, "binop": null }, - "start": 1414, - "end": 1415, + "start": 1558, + "end": 1559, "loc": { "start": { - "line": 40, - "column": 24 + "line": 42, + "column": 32 }, "end": { - "line": 40, - "column": 25 + "line": 42, + "column": 33 } } }, @@ -7687,16 +8005,16 @@ "binop": null }, "value": "compare", - "start": 1415, - "end": 1422, + "start": 1559, + "end": 1566, "loc": { "start": { - "line": 40, - "column": 25 + "line": 42, + "column": 33 }, "end": { - "line": 40, - "column": 32 + "line": 42, + "column": 40 } } }, @@ -7713,16 +8031,16 @@ "binop": null, "updateContext": null }, - "start": 1422, - "end": 1423, + "start": 1566, + "end": 1567, "loc": { "start": { - "line": 40, - "column": 32 + "line": 42, + "column": 40 }, "end": { - "line": 40, - "column": 33 + "line": 42, + "column": 41 } } }, @@ -7739,16 +8057,16 @@ "binop": null }, "value": "root", - "start": 1424, - "end": 1428, + "start": 1568, + "end": 1572, "loc": { "start": { - "line": 40, - "column": 34 + "line": 42, + "column": 42 }, "end": { - "line": 40, - "column": 38 + "line": 42, + "column": 46 } } }, @@ -7765,16 +8083,16 @@ "binop": null, "updateContext": null }, - "start": 1428, - "end": 1429, + "start": 1572, + "end": 1573, "loc": { "start": { - "line": 40, - "column": 38 + "line": 42, + "column": 46 }, "end": { - "line": 40, - "column": 39 + "line": 42, + "column": 47 } } }, @@ -7791,68 +8109,16 @@ "binop": null }, "value": "right", - "start": 1429, - "end": 1434, - "loc": { - "start": { - "line": 40, - "column": 39 - }, - "end": { - "line": 40, - "column": 44 - } - } - }, - { - "type": { - "label": ",", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1434, - "end": 1435, - "loc": { - "start": { - "line": 40, - "column": 44 - }, - "end": { - "line": 40, - "column": 45 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "left", - "start": 1436, - "end": 1440, + "start": 1573, + "end": 1578, "loc": { "start": { - "line": 40, - "column": 46 + "line": 42, + "column": 47 }, "end": { - "line": 40, - "column": 50 + "line": 42, + "column": 52 } } }, @@ -7869,16 +8135,16 @@ "binop": null, "updateContext": null }, - "start": 1440, - "end": 1441, + "start": 1578, + "end": 1579, "loc": { "start": { - "line": 40, - "column": 50 + "line": 42, + "column": 52 }, "end": { - "line": 40, - "column": 51 + "line": 42, + "column": 53 } } }, @@ -7895,16 +8161,16 @@ "binop": null }, "value": "right", - "start": 1442, - "end": 1447, + "start": 1580, + "end": 1585, "loc": { "start": { - "line": 40, - "column": 52 + "line": 42, + "column": 54 }, "end": { - "line": 40, - "column": 57 + "line": 42, + "column": 59 } } }, @@ -7920,16 +8186,16 @@ "postfix": false, "binop": null }, - "start": 1447, - "end": 1448, + "start": 1585, + "end": 1586, "loc": { "start": { - "line": 40, - "column": 57 + "line": 42, + "column": 59 }, "end": { - "line": 40, - "column": 58 + "line": 42, + "column": 60 } } }, @@ -7946,16 +8212,16 @@ "binop": null, "updateContext": null }, - "start": 1448, - "end": 1449, + "start": 1586, + "end": 1587, "loc": { "start": { - "line": 40, - "column": 58 + "line": 42, + "column": 60 }, "end": { - "line": 40, - "column": 59 + "line": 42, + "column": 61 } } }, @@ -7971,15 +8237,15 @@ "postfix": false, "binop": null }, - "start": 1452, - "end": 1453, + "start": 1590, + "end": 1591, "loc": { "start": { - "line": 41, + "line": 43, "column": 2 }, "end": { - "line": 41, + "line": 43, "column": 3 } } @@ -7996,15 +8262,15 @@ "postfix": false, "binop": null }, - "start": 1455, - "end": 1456, + "start": 1593, + "end": 1594, "loc": { "start": { - "line": 42, + "line": 44, "column": 1 }, "end": { - "line": 42, + "line": 44, "column": 2 } } @@ -8021,15 +8287,15 @@ "postfix": false, "binop": null }, - "start": 1457, - "end": 1458, + "start": 1595, + "end": 1596, "loc": { "start": { - "line": 43, + "line": 45, "column": 0 }, "end": { - "line": 43, + "line": 45, "column": 1 } } @@ -8047,15 +8313,15 @@ "binop": null, "updateContext": null }, - "start": 1459, - "end": 1459, + "start": 1597, + "end": 1597, "loc": { "start": { - "line": 44, + "line": 46, "column": 0 }, "end": { - "line": 44, + "line": 46, "column": 0 } } diff --git a/ast/source/traversal/rightOpenRangeTraversal.js.json b/ast/source/traversal/rightOpenRangeTraversal.js.json new file mode 100644 index 0000000..0657707 --- /dev/null +++ b/ast/source/traversal/rightOpenRangeTraversal.js.json @@ -0,0 +1,5866 @@ +{ + "type": "File", + "start": 0, + "end": 1170, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 37, + "column": 0 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 1170, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 37, + "column": 0 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ImportDeclaration", + "start": 0, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 28 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + }, + "local": { + "type": "Identifier", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + }, + "identifierName": "assert" + }, + "name": "assert" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + }, + "extra": { + "rawValue": "assert", + "raw": "'assert'" + }, + "value": "assert" + } + }, + { + "type": "ImportDeclaration", + "start": 29, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 36 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "local": { + "type": "Identifier", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + }, + "extra": { + "rawValue": "../types/Node.js", + "raw": "'../types/Node.js'" + }, + "value": "../types/Node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 66, + "end": 119, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 53 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 73, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 23 + } + }, + "local": { + "type": "Identifier", + "start": 73, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 23 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 95, + "end": 118, + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 52 + } + }, + "extra": { + "rawValue": "./inordertraversal.js", + "raw": "'./inordertraversal.js'" + }, + "value": "./inordertraversal.js" + }, + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, +oo), in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 457, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] + }, + { + "type": "ExportDefaultDeclaration", + "start": 458, + "end": 1169, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 36, + "column": 1 + } + }, + "declaration": { + "type": "FunctionDeclaration", + "start": 473, + "end": 1169, + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 36, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 483, + "end": 506, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 48 + }, + "identifierName": "rightOpenRangeTraversal" + }, + "name": "rightOpenRangeTraversal", + "leadingComments": null + }, + "generator": true, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 507, + "end": 514, + "loc": { + "start": { + "line": 14, + "column": 49 + }, + "end": { + "line": 14, + "column": 56 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "Identifier", + "start": 516, + "end": 520, + "loc": { + "start": { + "line": 14, + "column": 58 + }, + "end": { + "line": 14, + "column": 62 + }, + "identifierName": "root" + }, + "name": "root" + }, + { + "type": "Identifier", + "start": 522, + "end": 526, + "loc": { + "start": { + "line": 14, + "column": 64 + }, + "end": { + "line": 14, + "column": 68 + }, + "identifierName": "left" + }, + "name": "left" + } + ], + "body": { + "type": "BlockStatement", + "start": 528, + "end": 1169, + "loc": { + "start": { + "line": 14, + "column": 70 + }, + "end": { + "line": 36, + "column": 1 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 531, + "end": 1167, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 35, + "column": 2 + } + }, + "test": { + "type": "BinaryExpression", + "start": 535, + "end": 562, + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 32 + } + }, + "left": { + "type": "CallExpression", + "start": 535, + "end": 558, + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 28 + } + }, + "callee": { + "type": "Identifier", + "start": 535, + "end": 542, + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 12 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 543, + "end": 551, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 543, + "end": 547, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 17 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 548, + "end": 551, + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 21 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + }, + { + "type": "Identifier", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 27 + }, + "identifierName": "left" + }, + "name": "left" + } + ] + }, + "operator": "<", + "right": { + "type": "NumericLiteral", + "start": 561, + "end": 562, + "loc": { + "start": { + "line": 15, + "column": 31 + }, + "end": { + "line": 15, + "column": 32 + } + }, + "extra": { + "rawValue": 0, + "raw": "0" + }, + "value": 0 + } + }, + "consequent": { + "type": "BlockStatement", + "start": 564, + "end": 798, + "loc": { + "start": { + "line": 15, + "column": 34 + }, + "end": { + "line": 22, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 664, + "end": 795, + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 668, + "end": 687, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 668, + "end": 678, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 668, + "end": 672, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 673, + "end": 678, + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false, + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 683, + "end": 687, + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 689, + "end": 795, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 21, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 694, + "end": 729, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 38 + } + }, + "expression": { + "type": "CallExpression", + "start": 694, + "end": 728, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 37 + } + }, + "callee": { + "type": "Identifier", + "start": 694, + "end": 700, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 701, + "end": 727, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 36 + } + }, + "left": { + "type": "MemberExpression", + "start": 701, + "end": 711, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 701, + "end": 705, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 706, + "end": 711, + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 723, + "end": 727, + "loc": { + "start": { + "line": 19, + "column": 32 + }, + "end": { + "line": 19, + "column": 36 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 733, + "end": 791, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 61 + } + }, + "expression": { + "type": "YieldExpression", + "start": 733, + "end": 790, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 60 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 740, + "end": 790, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 60 + } + }, + "callee": { + "type": "Identifier", + "start": 740, + "end": 763, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 33 + }, + "identifierName": "rightOpenRangeTraversal" + }, + "name": "rightOpenRangeTraversal" + }, + "arguments": [ + { + "type": "Identifier", + "start": 764, + "end": 771, + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 20, + "column": 41 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "MemberExpression", + "start": 773, + "end": 783, + "loc": { + "start": { + "line": 20, + "column": 43 + }, + "end": { + "line": 20, + "column": 53 + } + }, + "object": { + "type": "Identifier", + "start": 773, + "end": 777, + "loc": { + "start": { + "line": 20, + "column": 43 + }, + "end": { + "line": 20, + "column": 47 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 778, + "end": 783, + "loc": { + "start": { + "line": 20, + "column": 48 + }, + "end": { + "line": 20, + "column": 53 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + { + "type": "Identifier", + "start": 785, + "end": 789, + "loc": { + "start": { + "line": 20, + "column": 55 + }, + "end": { + "line": 20, + "column": 59 + }, + "identifierName": "left" + }, + "name": "left" + } + ] + } + } + } + ], + "directives": [] + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " If the root lies to the left of the interval, we can discard the", + "start": 568, + "end": 635, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " entire left subtree.", + "start": 638, + "end": 661, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 25 + } + } + } + ] + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 804, + "end": 1167, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 35, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 905, + "end": 1033, + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 909, + "end": 927, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 909, + "end": 918, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 909, + "end": 913, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 914, + "end": 918, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 15 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false, + "leadingComments": null + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 923, + "end": 927, + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + "leadingComments": null + }, + "consequent": { + "type": "BlockStatement", + "start": 929, + "end": 1033, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 28, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 934, + "end": 968, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 37 + } + }, + "expression": { + "type": "CallExpression", + "start": 934, + "end": 967, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 36 + } + }, + "callee": { + "type": "Identifier", + "start": 934, + "end": 940, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 941, + "end": 966, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 35 + } + }, + "left": { + "type": "MemberExpression", + "start": 941, + "end": 950, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 941, + "end": 945, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 946, + "end": 950, + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 19 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 962, + "end": 966, + "loc": { + "start": { + "line": 26, + "column": 31 + }, + "end": { + "line": 26, + "column": 35 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 972, + "end": 1029, + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 60 + } + }, + "expression": { + "type": "YieldExpression", + "start": 972, + "end": 1028, + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 59 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 979, + "end": 1028, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 59 + } + }, + "callee": { + "type": "Identifier", + "start": 979, + "end": 1002, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 33 + }, + "identifierName": "rightOpenRangeTraversal" + }, + "name": "rightOpenRangeTraversal" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1003, + "end": 1010, + "loc": { + "start": { + "line": 27, + "column": 34 + }, + "end": { + "line": 27, + "column": 41 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "MemberExpression", + "start": 1012, + "end": 1021, + "loc": { + "start": { + "line": 27, + "column": 43 + }, + "end": { + "line": 27, + "column": 52 + } + }, + "object": { + "type": "Identifier", + "start": 1012, + "end": 1016, + "loc": { + "start": { + "line": 27, + "column": 43 + }, + "end": { + "line": 27, + "column": 47 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1017, + "end": 1021, + "loc": { + "start": { + "line": 27, + "column": 48 + }, + "end": { + "line": 27, + "column": 52 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + { + "type": "Identifier", + "start": 1023, + "end": 1027, + "loc": { + "start": { + "line": 27, + "column": 54 + }, + "end": { + "line": 27, + "column": 58 + }, + "identifierName": "left" + }, + "name": "left" + } + ] + } + } + } + ], + "directives": [] + }, + "alternate": null, + "leadingComments": [ + { + "type": "CommentLine", + "value": " Otherwise recurse on left subtree, yield the root, and yield the", + "start": 808, + "end": 875, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " entire right subtree.", + "start": 878, + "end": 902, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 26 + } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 1037, + "end": 1052, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 17 + } + }, + "expression": { + "type": "YieldExpression", + "start": 1037, + "end": 1051, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "delegate": false, + "argument": { + "type": "MemberExpression", + "start": 1043, + "end": 1051, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1043, + "end": 1047, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 12 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1048, + "end": 1051, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 16 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false + } + } + }, + { + "type": "IfStatement", + "start": 1055, + "end": 1164, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 34, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 1059, + "end": 1078, + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 25 + } + }, + "left": { + "type": "MemberExpression", + "start": 1059, + "end": 1069, + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 16 + } + }, + "object": { + "type": "Identifier", + "start": 1059, + "end": 1063, + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 10 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1064, + "end": 1069, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 16 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1074, + "end": 1078, + "loc": { + "start": { + "line": 31, + "column": 21 + }, + "end": { + "line": 31, + "column": 25 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 1080, + "end": 1164, + "loc": { + "start": { + "line": 31, + "column": 27 + }, + "end": { + "line": 34, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 1085, + "end": 1120, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 38 + } + }, + "expression": { + "type": "CallExpression", + "start": 1085, + "end": 1119, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 37 + } + }, + "callee": { + "type": "Identifier", + "start": 1085, + "end": 1091, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1092, + "end": 1118, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 36 + } + }, + "left": { + "type": "MemberExpression", + "start": 1092, + "end": 1102, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 1092, + "end": 1096, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1097, + "end": 1102, + "loc": { + "start": { + "line": 32, + "column": 15 + }, + "end": { + "line": 32, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 1114, + "end": 1118, + "loc": { + "start": { + "line": 32, + "column": 32 + }, + "end": { + "line": 32, + "column": 36 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1124, + "end": 1160, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 39 + } + }, + "expression": { + "type": "YieldExpression", + "start": 1124, + "end": 1159, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 38 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 1131, + "end": 1159, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 38 + } + }, + "callee": { + "type": "Identifier", + "start": 1131, + "end": 1147, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 26 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 1148, + "end": 1158, + "loc": { + "start": { + "line": 33, + "column": 27 + }, + "end": { + "line": 33, + "column": 37 + } + }, + "object": { + "type": "Identifier", + "start": 1148, + "end": 1152, + "loc": { + "start": { + "line": 33, + "column": 27 + }, + "end": { + "line": 33, + "column": 31 + }, + "identifierName": "root" + }, + "name": "root" + }, + "property": { + "type": "Identifier", + "start": 1153, + "end": 1158, + "loc": { + "start": { + "line": 33, + "column": 32 + }, + "end": { + "line": 33, + "column": 37 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + } + ] + } + } + } + ], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } + } + ], + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, +oo), in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 457, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ], + "trailingComments": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, +oo), in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 457, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, +oo), in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 457, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": "CommentLine", + "value": " If the root lies to the left of the interval, we can discard the", + "start": 568, + "end": 635, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " entire left subtree.", + "start": 638, + "end": 661, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise recurse on left subtree, yield the root, and yield the", + "start": 808, + "end": 875, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " entire right subtree.", + "start": 878, + "end": 902, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 26 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../types/Node.js", + "start": 46, + "end": 64, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 64, + "end": 65, + "loc": { + "start": { + "line": 2, + "column": 35 + }, + "end": { + "line": 2, + "column": 36 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 66, + "end": 72, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "inordertraversal", + "start": 73, + "end": 89, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 90, + "end": 94, + "loc": { + "start": { + "line": 3, + "column": 24 + }, + "end": { + "line": 3, + "column": 28 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./inordertraversal.js", + "start": 95, + "end": 118, + "loc": { + "start": { + "line": 3, + "column": 29 + }, + "end": { + "line": 3, + "column": 52 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 118, + "end": 119, + "loc": { + "start": { + "line": 3, + "column": 52 + }, + "end": { + "line": 3, + "column": 53 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, +oo), in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @returns {IterableIterator}\n ", + "start": 121, + "end": 457, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 13, + "column": 3 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 458, + "end": 464, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 465, + "end": 472, + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 14 + } + } + }, + { + "type": { + "label": "function", + "keyword": "function", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "function", + "start": 473, + "end": 481, + "loc": { + "start": { + "line": 14, + "column": 15 + }, + "end": { + "line": 14, + "column": 23 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 481, + "end": 482, + "loc": { + "start": { + "line": 14, + "column": 23 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rightOpenRangeTraversal", + "start": 483, + "end": 506, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 48 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 506, + "end": 507, + "loc": { + "start": { + "line": 14, + "column": 48 + }, + "end": { + "line": 14, + "column": 49 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 507, + "end": 514, + "loc": { + "start": { + "line": 14, + "column": 49 + }, + "end": { + "line": 14, + "column": 56 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 514, + "end": 515, + "loc": { + "start": { + "line": 14, + "column": 56 + }, + "end": { + "line": 14, + "column": 57 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 516, + "end": 520, + "loc": { + "start": { + "line": 14, + "column": 58 + }, + "end": { + "line": 14, + "column": 62 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 520, + "end": 521, + "loc": { + "start": { + "line": 14, + "column": 62 + }, + "end": { + "line": 14, + "column": 63 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 522, + "end": 526, + "loc": { + "start": { + "line": 14, + "column": 64 + }, + "end": { + "line": 14, + "column": 68 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 526, + "end": 527, + "loc": { + "start": { + "line": 14, + "column": 68 + }, + "end": { + "line": 14, + "column": 69 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 528, + "end": 529, + "loc": { + "start": { + "line": 14, + "column": 70 + }, + "end": { + "line": 14, + "column": 71 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 531, + "end": 533, + "loc": { + "start": { + "line": 15, + "column": 1 + }, + "end": { + "line": 15, + "column": 3 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 534, + "end": 535, + "loc": { + "start": { + "line": 15, + "column": 4 + }, + "end": { + "line": 15, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 535, + "end": 542, + "loc": { + "start": { + "line": 15, + "column": 5 + }, + "end": { + "line": 15, + "column": 12 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 542, + "end": 543, + "loc": { + "start": { + "line": 15, + "column": 12 + }, + "end": { + "line": 15, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 543, + "end": 547, + "loc": { + "start": { + "line": 15, + "column": 13 + }, + "end": { + "line": 15, + "column": 17 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 547, + "end": 548, + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 548, + "end": 551, + "loc": { + "start": { + "line": 15, + "column": 18 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 551, + "end": 552, + "loc": { + "start": { + "line": 15, + "column": 21 + }, + "end": { + "line": 15, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 553, + "end": 557, + "loc": { + "start": { + "line": 15, + "column": 23 + }, + "end": { + "line": 15, + "column": 27 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 557, + "end": 558, + "loc": { + "start": { + "line": 15, + "column": 27 + }, + "end": { + "line": 15, + "column": 28 + } + } + }, + { + "type": { + "label": "", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "<", + "start": 559, + "end": 560, + "loc": { + "start": { + "line": 15, + "column": 29 + }, + "end": { + "line": 15, + "column": 30 + } + } + }, + { + "type": { + "label": "num", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": 0, + "start": 561, + "end": 562, + "loc": { + "start": { + "line": 15, + "column": 31 + }, + "end": { + "line": 15, + "column": 32 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 562, + "end": 563, + "loc": { + "start": { + "line": 15, + "column": 32 + }, + "end": { + "line": 15, + "column": 33 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 564, + "end": 565, + "loc": { + "start": { + "line": 15, + "column": 34 + }, + "end": { + "line": 15, + "column": 35 + } + } + }, + { + "type": "CommentLine", + "value": " If the root lies to the left of the interval, we can discard the", + "start": 568, + "end": 635, + "loc": { + "start": { + "line": 16, + "column": 2 + }, + "end": { + "line": 16, + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " entire left subtree.", + "start": 638, + "end": 661, + "loc": { + "start": { + "line": 17, + "column": 2 + }, + "end": { + "line": 17, + "column": 25 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 664, + "end": 666, + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 667, + "end": 668, + "loc": { + "start": { + "line": 18, + "column": 5 + }, + "end": { + "line": 18, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 668, + "end": 672, + "loc": { + "start": { + "line": 18, + "column": 6 + }, + "end": { + "line": 18, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 672, + "end": 673, + "loc": { + "start": { + "line": 18, + "column": 10 + }, + "end": { + "line": 18, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 673, + "end": 678, + "loc": { + "start": { + "line": 18, + "column": 11 + }, + "end": { + "line": 18, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 679, + "end": 682, + "loc": { + "start": { + "line": 18, + "column": 17 + }, + "end": { + "line": 18, + "column": 20 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 683, + "end": 687, + "loc": { + "start": { + "line": 18, + "column": 21 + }, + "end": { + "line": 18, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 687, + "end": 688, + "loc": { + "start": { + "line": 18, + "column": 25 + }, + "end": { + "line": 18, + "column": 26 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 689, + "end": 690, + "loc": { + "start": { + "line": 18, + "column": 27 + }, + "end": { + "line": 18, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 694, + "end": 700, + "loc": { + "start": { + "line": 19, + "column": 3 + }, + "end": { + "line": 19, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 700, + "end": 701, + "loc": { + "start": { + "line": 19, + "column": 9 + }, + "end": { + "line": 19, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 701, + "end": 705, + "loc": { + "start": { + "line": 19, + "column": 10 + }, + "end": { + "line": 19, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 705, + "end": 706, + "loc": { + "start": { + "line": 19, + "column": 14 + }, + "end": { + "line": 19, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 706, + "end": 711, + "loc": { + "start": { + "line": 19, + "column": 15 + }, + "end": { + "line": 19, + "column": 20 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 712, + "end": 722, + "loc": { + "start": { + "line": 19, + "column": 21 + }, + "end": { + "line": 19, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 723, + "end": 727, + "loc": { + "start": { + "line": 19, + "column": 32 + }, + "end": { + "line": 19, + "column": 36 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 727, + "end": 728, + "loc": { + "start": { + "line": 19, + "column": 36 + }, + "end": { + "line": 19, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 728, + "end": 729, + "loc": { + "start": { + "line": 19, + "column": 37 + }, + "end": { + "line": 19, + "column": 38 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 733, + "end": 738, + "loc": { + "start": { + "line": 20, + "column": 3 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 738, + "end": 739, + "loc": { + "start": { + "line": 20, + "column": 8 + }, + "end": { + "line": 20, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rightOpenRangeTraversal", + "start": 740, + "end": 763, + "loc": { + "start": { + "line": 20, + "column": 10 + }, + "end": { + "line": 20, + "column": 33 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 763, + "end": 764, + "loc": { + "start": { + "line": 20, + "column": 33 + }, + "end": { + "line": 20, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 764, + "end": 771, + "loc": { + "start": { + "line": 20, + "column": 34 + }, + "end": { + "line": 20, + "column": 41 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 771, + "end": 772, + "loc": { + "start": { + "line": 20, + "column": 41 + }, + "end": { + "line": 20, + "column": 42 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 773, + "end": 777, + "loc": { + "start": { + "line": 20, + "column": 43 + }, + "end": { + "line": 20, + "column": 47 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 777, + "end": 778, + "loc": { + "start": { + "line": 20, + "column": 47 + }, + "end": { + "line": 20, + "column": 48 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 778, + "end": 783, + "loc": { + "start": { + "line": 20, + "column": 48 + }, + "end": { + "line": 20, + "column": 53 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 783, + "end": 784, + "loc": { + "start": { + "line": 20, + "column": 53 + }, + "end": { + "line": 20, + "column": 54 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 785, + "end": 789, + "loc": { + "start": { + "line": 20, + "column": 55 + }, + "end": { + "line": 20, + "column": 59 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 789, + "end": 790, + "loc": { + "start": { + "line": 20, + "column": 59 + }, + "end": { + "line": 20, + "column": 60 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 790, + "end": 791, + "loc": { + "start": { + "line": 20, + "column": 60 + }, + "end": { + "line": 20, + "column": 61 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 794, + "end": 795, + "loc": { + "start": { + "line": 21, + "column": 2 + }, + "end": { + "line": 21, + "column": 3 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 797, + "end": 798, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 799, + "end": 803, + "loc": { + "start": { + "line": 22, + "column": 3 + }, + "end": { + "line": 22, + "column": 7 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 804, + "end": 805, + "loc": { + "start": { + "line": 22, + "column": 8 + }, + "end": { + "line": 22, + "column": 9 + } + } + }, + { + "type": "CommentLine", + "value": " Otherwise recurse on left subtree, yield the root, and yield the", + "start": 808, + "end": 875, + "loc": { + "start": { + "line": 23, + "column": 2 + }, + "end": { + "line": 23, + "column": 69 + } + } + }, + { + "type": "CommentLine", + "value": " entire right subtree.", + "start": 878, + "end": 902, + "loc": { + "start": { + "line": 24, + "column": 2 + }, + "end": { + "line": 24, + "column": 26 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 905, + "end": 907, + "loc": { + "start": { + "line": 25, + "column": 2 + }, + "end": { + "line": 25, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 908, + "end": 909, + "loc": { + "start": { + "line": 25, + "column": 5 + }, + "end": { + "line": 25, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 909, + "end": 913, + "loc": { + "start": { + "line": 25, + "column": 6 + }, + "end": { + "line": 25, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 913, + "end": 914, + "loc": { + "start": { + "line": 25, + "column": 10 + }, + "end": { + "line": 25, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 914, + "end": 918, + "loc": { + "start": { + "line": 25, + "column": 11 + }, + "end": { + "line": 25, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 919, + "end": 922, + "loc": { + "start": { + "line": 25, + "column": 16 + }, + "end": { + "line": 25, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 923, + "end": 927, + "loc": { + "start": { + "line": 25, + "column": 20 + }, + "end": { + "line": 25, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 927, + "end": 928, + "loc": { + "start": { + "line": 25, + "column": 24 + }, + "end": { + "line": 25, + "column": 25 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 929, + "end": 930, + "loc": { + "start": { + "line": 25, + "column": 26 + }, + "end": { + "line": 25, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 934, + "end": 940, + "loc": { + "start": { + "line": 26, + "column": 3 + }, + "end": { + "line": 26, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 940, + "end": 941, + "loc": { + "start": { + "line": 26, + "column": 9 + }, + "end": { + "line": 26, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 941, + "end": 945, + "loc": { + "start": { + "line": 26, + "column": 10 + }, + "end": { + "line": 26, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 945, + "end": 946, + "loc": { + "start": { + "line": 26, + "column": 14 + }, + "end": { + "line": 26, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 946, + "end": 950, + "loc": { + "start": { + "line": 26, + "column": 15 + }, + "end": { + "line": 26, + "column": 19 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 951, + "end": 961, + "loc": { + "start": { + "line": 26, + "column": 20 + }, + "end": { + "line": 26, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 962, + "end": 966, + "loc": { + "start": { + "line": 26, + "column": 31 + }, + "end": { + "line": 26, + "column": 35 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 966, + "end": 967, + "loc": { + "start": { + "line": 26, + "column": 35 + }, + "end": { + "line": 26, + "column": 36 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 967, + "end": 968, + "loc": { + "start": { + "line": 26, + "column": 36 + }, + "end": { + "line": 26, + "column": 37 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 972, + "end": 977, + "loc": { + "start": { + "line": 27, + "column": 3 + }, + "end": { + "line": 27, + "column": 8 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 977, + "end": 978, + "loc": { + "start": { + "line": 27, + "column": 8 + }, + "end": { + "line": 27, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rightOpenRangeTraversal", + "start": 979, + "end": 1002, + "loc": { + "start": { + "line": 27, + "column": 10 + }, + "end": { + "line": 27, + "column": 33 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1002, + "end": 1003, + "loc": { + "start": { + "line": 27, + "column": 33 + }, + "end": { + "line": 27, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 1003, + "end": 1010, + "loc": { + "start": { + "line": 27, + "column": 34 + }, + "end": { + "line": 27, + "column": 41 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1010, + "end": 1011, + "loc": { + "start": { + "line": 27, + "column": 41 + }, + "end": { + "line": 27, + "column": 42 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1012, + "end": 1016, + "loc": { + "start": { + "line": 27, + "column": 43 + }, + "end": { + "line": 27, + "column": 47 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1016, + "end": 1017, + "loc": { + "start": { + "line": 27, + "column": 47 + }, + "end": { + "line": 27, + "column": 48 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1017, + "end": 1021, + "loc": { + "start": { + "line": 27, + "column": 48 + }, + "end": { + "line": 27, + "column": 52 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1021, + "end": 1022, + "loc": { + "start": { + "line": 27, + "column": 52 + }, + "end": { + "line": 27, + "column": 53 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "left", + "start": 1023, + "end": 1027, + "loc": { + "start": { + "line": 27, + "column": 54 + }, + "end": { + "line": 27, + "column": 58 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1027, + "end": 1028, + "loc": { + "start": { + "line": 27, + "column": 58 + }, + "end": { + "line": 27, + "column": 59 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1028, + "end": 1029, + "loc": { + "start": { + "line": 27, + "column": 59 + }, + "end": { + "line": 27, + "column": 60 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1032, + "end": 1033, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 3 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 1037, + "end": 1042, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1043, + "end": 1047, + "loc": { + "start": { + "line": 30, + "column": 8 + }, + "end": { + "line": 30, + "column": 12 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1047, + "end": 1048, + "loc": { + "start": { + "line": 30, + "column": 12 + }, + "end": { + "line": 30, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 1048, + "end": 1051, + "loc": { + "start": { + "line": 30, + "column": 13 + }, + "end": { + "line": 30, + "column": 16 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1051, + "end": 1052, + "loc": { + "start": { + "line": 30, + "column": 16 + }, + "end": { + "line": 30, + "column": 17 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1055, + "end": 1057, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1058, + "end": 1059, + "loc": { + "start": { + "line": 31, + "column": 5 + }, + "end": { + "line": 31, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1059, + "end": 1063, + "loc": { + "start": { + "line": 31, + "column": 6 + }, + "end": { + "line": 31, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1063, + "end": 1064, + "loc": { + "start": { + "line": 31, + "column": 10 + }, + "end": { + "line": 31, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1064, + "end": 1069, + "loc": { + "start": { + "line": 31, + "column": 11 + }, + "end": { + "line": 31, + "column": 16 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1070, + "end": 1073, + "loc": { + "start": { + "line": 31, + "column": 17 + }, + "end": { + "line": 31, + "column": 20 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1074, + "end": 1078, + "loc": { + "start": { + "line": 31, + "column": 21 + }, + "end": { + "line": 31, + "column": 25 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1078, + "end": 1079, + "loc": { + "start": { + "line": 31, + "column": 25 + }, + "end": { + "line": 31, + "column": 26 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1080, + "end": 1081, + "loc": { + "start": { + "line": 31, + "column": 27 + }, + "end": { + "line": 31, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 1085, + "end": 1091, + "loc": { + "start": { + "line": 32, + "column": 3 + }, + "end": { + "line": 32, + "column": 9 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1091, + "end": 1092, + "loc": { + "start": { + "line": 32, + "column": 9 + }, + "end": { + "line": 32, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1092, + "end": 1096, + "loc": { + "start": { + "line": 32, + "column": 10 + }, + "end": { + "line": 32, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1096, + "end": 1097, + "loc": { + "start": { + "line": 32, + "column": 14 + }, + "end": { + "line": 32, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1097, + "end": 1102, + "loc": { + "start": { + "line": 32, + "column": 15 + }, + "end": { + "line": 32, + "column": 20 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 1103, + "end": 1113, + "loc": { + "start": { + "line": 32, + "column": 21 + }, + "end": { + "line": 32, + "column": 31 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 1114, + "end": 1118, + "loc": { + "start": { + "line": 32, + "column": 32 + }, + "end": { + "line": 32, + "column": 36 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1118, + "end": 1119, + "loc": { + "start": { + "line": 32, + "column": 36 + }, + "end": { + "line": 32, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1119, + "end": 1120, + "loc": { + "start": { + "line": 32, + "column": 37 + }, + "end": { + "line": 32, + "column": 38 + } + } + }, + { + "type": { + "label": "yield", + "keyword": "yield", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "yield", + "start": 1124, + "end": 1129, + "loc": { + "start": { + "line": 33, + "column": 3 + }, + "end": { + "line": 33, + "column": 8 + } + } + }, + { + "type": { + "label": "*", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 10, + "updateContext": null + }, + "value": "*", + "start": 1129, + "end": 1130, + "loc": { + "start": { + "line": 33, + "column": 8 + }, + "end": { + "line": 33, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "inordertraversal", + "start": 1131, + "end": 1147, + "loc": { + "start": { + "line": 33, + "column": 10 + }, + "end": { + "line": 33, + "column": 26 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1147, + "end": 1148, + "loc": { + "start": { + "line": 33, + "column": 26 + }, + "end": { + "line": 33, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1148, + "end": 1152, + "loc": { + "start": { + "line": 33, + "column": 27 + }, + "end": { + "line": 33, + "column": 31 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1152, + "end": 1153, + "loc": { + "start": { + "line": 33, + "column": 31 + }, + "end": { + "line": 33, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 1153, + "end": 1158, + "loc": { + "start": { + "line": 33, + "column": 32 + }, + "end": { + "line": 33, + "column": 37 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1158, + "end": 1159, + "loc": { + "start": { + "line": 33, + "column": 37 + }, + "end": { + "line": 33, + "column": 38 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1159, + "end": 1160, + "loc": { + "start": { + "line": 33, + "column": 38 + }, + "end": { + "line": 33, + "column": 39 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1163, + "end": 1164, + "loc": { + "start": { + "line": 34, + "column": 2 + }, + "end": { + "line": 34, + "column": 3 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1166, + "end": 1167, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 35, + "column": 2 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1168, + "end": 1169, + "loc": { + "start": { + "line": 36, + "column": 0 + }, + "end": { + "line": 36, + "column": 1 + } + } + }, + { + "type": { + "label": "eof", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1170, + "end": 1170, + "loc": { + "start": { + "line": 37, + "column": 0 + }, + "end": { + "line": 37, + "column": 0 + } + } + } + ] +} \ No newline at end of file diff --git a/ast/source/types/RedBlackTree.js.json b/ast/source/types/RedBlackTree.js.json index dc2224d..07ceb2b 100644 --- a/ast/source/types/RedBlackTree.js.json +++ b/ast/source/types/RedBlackTree.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 5065, + "end": 6843, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 197, + "line": 261, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 5065, + "end": 6843, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 197, + "line": 261, "column": 0 } }, @@ -484,9 +484,9 @@ "line": 7, "column": 19 }, - "identifierName": "insert_case1" + "identifierName": "insert_case2" }, - "name": "insert_case1" + "name": "insert_case2" } } ], @@ -505,10 +505,10 @@ } }, "extra": { - "rawValue": "../insertion/insert_case1.js", - "raw": "'../insertion/insert_case1.js'" + "rawValue": "../insertion/insert_case2.js", + "raw": "'../insertion/insert_case2.js'" }, - "value": "../insertion/insert_case1.js" + "value": "../insertion/insert_case2.js" } }, { @@ -854,20 +854,227 @@ "raw": "'../traversal/rangetraversal.js'" }, "value": "../traversal/rangetraversal.js" + } + }, + { + "type": "ImportDeclaration", + "start": 581, + "end": 636, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 55 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 588, + "end": 600, + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 19 + } + }, + "local": { + "type": "Identifier", + "start": 588, + "end": 600, + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 19 + }, + "identifierName": "replace_node" + }, + "name": "replace_node" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 606, + "end": 635, + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 13, + "column": 54 + } + }, + "extra": { + "rawValue": "../deletion/replace_node.js", + "raw": "'../deletion/replace_node.js'" + }, + "value": "../deletion/replace_node.js" + } + }, + { + "type": "ImportDeclaration", + "start": 637, + "end": 698, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 61 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 644, + "end": 661, + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 24 + } + }, + "local": { + "type": "Identifier", + "start": 644, + "end": 661, + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 24 + }, + "identifierName": "swap_non_adjacent" + }, + "name": "swap_non_adjacent" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 667, + "end": 697, + "loc": { + "start": { + "line": 14, + "column": 30 + }, + "end": { + "line": 14, + "column": 60 + } + }, + "extra": { + "rawValue": "../swap/swap_non_adjacent.js", + "raw": "'../swap/swap_non_adjacent.js'" + }, + "value": "../swap/swap_non_adjacent.js" + } + }, + { + "type": "ImportDeclaration", + "start": 699, + "end": 744, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 45 + } + }, + "specifiers": [ + { + "type": "ImportDefaultSpecifier", + "start": 706, + "end": 715, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 16 + } + }, + "local": { + "type": "Identifier", + "start": 706, + "end": 715, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 16 + }, + "identifierName": "swap_left" + }, + "name": "swap_left" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 721, + "end": 743, + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 44 + } + }, + "extra": { + "rawValue": "../swap/swap_left.js", + "raw": "'../swap/swap_left.js'" + }, + "value": "../swap/swap_left.js" }, "trailingComments": [ { "type": "CommentBlock", "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 582, - "end": 631, + "start": 746, + "end": 795, "loc": { "start": { - "line": 14, + "line": 17, "column": 0 }, "end": { - "line": 17, + "line": 20, "column": 3 } } @@ -876,43 +1083,43 @@ }, { "type": "ExportDefaultDeclaration", - "start": 632, - "end": 5064, + "start": 796, + "end": 6842, "loc": { "start": { - "line": 18, + "line": 21, "column": 0 }, "end": { - "line": 196, + "line": 260, "column": 1 } }, "declaration": { "type": "ClassDeclaration", - "start": 647, - "end": 5064, + "start": 811, + "end": 6842, "loc": { "start": { - "line": 18, + "line": 21, "column": 15 }, "end": { - "line": 196, + "line": 260, "column": 1 } }, "id": { "type": "Identifier", - "start": 653, - "end": 665, + "start": 817, + "end": 829, "loc": { "start": { - "line": 18, + "line": 21, "column": 21 }, "end": { - "line": 18, + "line": 21, "column": 33 }, "identifierName": "RedBlackTree" @@ -923,30 +1130,30 @@ "superClass": null, "body": { "type": "ClassBody", - "start": 666, - "end": 5064, + "start": 830, + "end": 6842, "loc": { "start": { - "line": 18, + "line": 21, "column": 34 }, "end": { - "line": 196, + "line": 260, "column": 1 } }, "body": [ { "type": "ClassMethod", - "start": 797, - "end": 1020, + "start": 961, + "end": 1184, "loc": { "start": { - "line": 24, + "line": 27, "column": 1 }, "end": { - "line": 30, + "line": 33, "column": 2 } }, @@ -954,15 +1161,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 797, - "end": 808, + "start": 961, + "end": 972, "loc": { "start": { - "line": 24, + "line": 27, "column": 1 }, "end": { - "line": 24, + "line": 27, "column": 12 }, "identifierName": "constructor" @@ -978,15 +1185,15 @@ "params": [ { "type": "Identifier", - "start": 809, - "end": 816, + "start": 973, + "end": 980, "loc": { "start": { - "line": 24, + "line": 27, "column": 13 }, "end": { - "line": 24, + "line": 27, "column": 20 }, "identifierName": "compare" @@ -996,58 +1203,58 @@ ], "body": { "type": "BlockStatement", - "start": 818, - "end": 1020, + "start": 982, + "end": 1184, "loc": { "start": { - "line": 24, + "line": 27, "column": 22 }, "end": { - "line": 30, + "line": 33, "column": 2 } }, "body": [ { "type": "ExpressionStatement", - "start": 822, - "end": 858, + "start": 986, + "end": 1022, "loc": { "start": { - "line": 25, + "line": 28, "column": 2 }, "end": { - "line": 25, + "line": 28, "column": 38 } }, "expression": { "type": "CallExpression", - "start": 822, - "end": 857, + "start": 986, + "end": 1021, "loc": { "start": { - "line": 25, + "line": 28, "column": 2 }, "end": { - "line": 25, + "line": 28, "column": 37 } }, "callee": { "type": "Identifier", - "start": 822, - "end": 828, + "start": 986, + "end": 992, "loc": { "start": { - "line": 25, + "line": 28, "column": 2 }, "end": { - "line": 25, + "line": 28, "column": 8 }, "identifierName": "assert" @@ -1057,29 +1264,29 @@ "arguments": [ { "type": "BinaryExpression", - "start": 829, - "end": 856, + "start": 993, + "end": 1020, "loc": { "start": { - "line": 25, + "line": 28, "column": 9 }, "end": { - "line": 25, + "line": 28, "column": 36 } }, "left": { "type": "Identifier", - "start": 829, - "end": 836, + "start": 993, + "end": 1000, "loc": { "start": { - "line": 25, + "line": 28, "column": 9 }, "end": { - "line": 25, + "line": 28, "column": 16 }, "identifierName": "compare" @@ -1089,15 +1296,15 @@ "operator": "instanceof", "right": { "type": "Identifier", - "start": 848, - "end": 856, + "start": 1012, + "end": 1020, "loc": { "start": { - "line": 25, + "line": 28, "column": 28 }, "end": { - "line": 25, + "line": 28, "column": 36 }, "identifierName": "Function" @@ -1111,15 +1318,15 @@ { "type": "CommentBlock", "value": "* @member {Function} The comparison function for node keys. ", - "start": 861, - "end": 925, + "start": 1025, + "end": 1089, "loc": { "start": { - "line": 26, + "line": 29, "column": 2 }, "end": { - "line": 26, + "line": 29, "column": 66 } } @@ -1128,58 +1335,58 @@ }, { "type": "ExpressionStatement", - "start": 928, - "end": 951, + "start": 1092, + "end": 1115, "loc": { "start": { - "line": 27, + "line": 30, "column": 2 }, "end": { - "line": 27, + "line": 30, "column": 25 } }, "expression": { "type": "AssignmentExpression", - "start": 928, - "end": 950, + "start": 1092, + "end": 1114, "loc": { "start": { - "line": 27, + "line": 30, "column": 2 }, "end": { - "line": 27, + "line": 30, "column": 24 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 928, - "end": 940, + "start": 1092, + "end": 1104, "loc": { "start": { - "line": 27, + "line": 30, "column": 2 }, "end": { - "line": 27, + "line": 30, "column": 14 } }, "object": { "type": "ThisExpression", - "start": 928, - "end": 932, + "start": 1092, + "end": 1096, "loc": { "start": { - "line": 27, + "line": 30, "column": 2 }, "end": { - "line": 27, + "line": 30, "column": 6 } }, @@ -1187,15 +1394,15 @@ }, "property": { "type": "Identifier", - "start": 933, - "end": 940, + "start": 1097, + "end": 1104, "loc": { "start": { - "line": 27, + "line": 30, "column": 7 }, "end": { - "line": 27, + "line": 30, "column": 14 }, "identifierName": "compare" @@ -1207,15 +1414,15 @@ }, "right": { "type": "Identifier", - "start": 943, - "end": 950, + "start": 1107, + "end": 1114, "loc": { "start": { - "line": 27, + "line": 30, "column": 17 }, "end": { - "line": 27, + "line": 30, "column": 24 }, "identifierName": "compare" @@ -1228,15 +1435,15 @@ { "type": "CommentBlock", "value": "* @member {Function} The comparison function for node keys. ", - "start": 861, - "end": 925, + "start": 1025, + "end": 1089, "loc": { "start": { - "line": 26, + "line": 29, "column": 2 }, "end": { - "line": 26, + "line": 29, "column": 66 } } @@ -1246,15 +1453,15 @@ { "type": "CommentBlock", "value": "* @member {Node} The root of the tree. ", - "start": 954, - "end": 997, + "start": 1118, + "end": 1161, "loc": { "start": { - "line": 28, + "line": 31, "column": 2 }, "end": { - "line": 28, + "line": 31, "column": 45 } } @@ -1263,58 +1470,58 @@ }, { "type": "ExpressionStatement", - "start": 1000, - "end": 1017, + "start": 1164, + "end": 1181, "loc": { "start": { - "line": 29, + "line": 32, "column": 2 }, "end": { - "line": 29, + "line": 32, "column": 19 } }, "expression": { "type": "AssignmentExpression", - "start": 1000, - "end": 1016, + "start": 1164, + "end": 1180, "loc": { "start": { - "line": 29, + "line": 32, "column": 2 }, "end": { - "line": 29, + "line": 32, "column": 18 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1000, - "end": 1009, + "start": 1164, + "end": 1173, "loc": { "start": { - "line": 29, + "line": 32, "column": 2 }, "end": { - "line": 29, + "line": 32, "column": 11 } }, "object": { "type": "ThisExpression", - "start": 1000, - "end": 1004, + "start": 1164, + "end": 1168, "loc": { "start": { - "line": 29, + "line": 32, "column": 2 }, "end": { - "line": 29, + "line": 32, "column": 6 } }, @@ -1322,15 +1529,15 @@ }, "property": { "type": "Identifier", - "start": 1005, - "end": 1009, + "start": 1169, + "end": 1173, "loc": { "start": { - "line": 29, + "line": 32, "column": 7 }, "end": { - "line": 29, + "line": 32, "column": 11 }, "identifierName": "root" @@ -1342,15 +1549,15 @@ }, "right": { "type": "NullLiteral", - "start": 1012, - "end": 1016, + "start": 1176, + "end": 1180, "loc": { "start": { - "line": 29, + "line": 32, "column": 14 }, "end": { - "line": 29, + "line": 32, "column": 18 } } @@ -1361,15 +1568,15 @@ { "type": "CommentBlock", "value": "* @member {Node} The root of the tree. ", - "start": 954, - "end": 997, + "start": 1118, + "end": 1161, "loc": { "start": { - "line": 28, + "line": 31, "column": 2 }, "end": { - "line": 28, + "line": 31, "column": 45 } } @@ -1384,15 +1591,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", - "start": 669, - "end": 795, + "start": 833, + "end": 959, "loc": { "start": { - "line": 19, + "line": 22, "column": 1 }, "end": { - "line": 23, + "line": 26, "column": 4 } } @@ -1402,15 +1609,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 1023, - "end": 1127, + "start": 1187, + "end": 1291, "loc": { "start": { - "line": 32, + "line": 35, "column": 1 }, "end": { - "line": 36, + "line": 39, "column": 4 } } @@ -1419,15 +1626,15 @@ }, { "type": "ClassMethod", - "start": 1129, - "end": 1172, + "start": 1293, + "end": 1336, "loc": { "start": { - "line": 37, + "line": 40, "column": 1 }, "end": { - "line": 39, + "line": 42, "column": 2 } }, @@ -1435,15 +1642,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1129, - "end": 1136, + "start": 1293, + "end": 1300, "loc": { "start": { - "line": 37, + "line": 40, "column": 1 }, "end": { - "line": 37, + "line": 40, "column": 8 }, "identifierName": "isEmpty" @@ -1459,87 +1666,87 @@ "params": [], "body": { "type": "BlockStatement", - "start": 1139, - "end": 1172, + "start": 1303, + "end": 1336, "loc": { "start": { - "line": 37, + "line": 40, "column": 11 }, "end": { - "line": 39, + "line": 42, "column": 2 } }, "body": [ { "type": "ReturnStatement", - "start": 1143, - "end": 1169, + "start": 1307, + "end": 1333, "loc": { "start": { - "line": 38, + "line": 41, "column": 2 }, "end": { - "line": 38, + "line": 41, "column": 28 } }, "argument": { "type": "BinaryExpression", - "start": 1150, - "end": 1168, + "start": 1314, + "end": 1332, "loc": { "start": { - "line": 38, + "line": 41, "column": 9 }, "end": { - "line": 38, + "line": 41, "column": 27 } }, "left": { "type": "MemberExpression", - "start": 1150, - "end": 1159, + "start": 1314, + "end": 1323, "loc": { "start": { - "line": 38, + "line": 41, "column": 9 }, "end": { - "line": 38, + "line": 41, "column": 18 } }, "object": { "type": "ThisExpression", - "start": 1150, - "end": 1154, + "start": 1314, + "end": 1318, "loc": { "start": { - "line": 38, + "line": 41, "column": 9 }, "end": { - "line": 38, + "line": 41, "column": 13 } } }, "property": { "type": "Identifier", - "start": 1155, - "end": 1159, + "start": 1319, + "end": 1323, "loc": { "start": { - "line": 38, + "line": 41, "column": 14 }, "end": { - "line": 38, + "line": 41, "column": 18 }, "identifierName": "root" @@ -1551,15 +1758,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1164, - "end": 1168, + "start": 1328, + "end": 1332, "loc": { "start": { - "line": 38, + "line": 41, "column": 23 }, "end": { - "line": 38, + "line": 41, "column": 27 } } @@ -1574,15 +1781,15 @@ { "type": "CommentBlock", "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 1023, - "end": 1127, + "start": 1187, + "end": 1291, "loc": { "start": { - "line": 32, + "line": 35, "column": 1 }, "end": { - "line": 36, + "line": 39, "column": 4 } } @@ -1591,16 +1798,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", - "start": 1175, - "end": 1254, + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t * @return {Node} The newly added node.\n\t ", + "start": 1339, + "end": 1459, "loc": { "start": { - "line": 41, + "line": 44, "column": 1 }, "end": { - "line": 45, + "line": 49, "column": 4 } } @@ -1609,15 +1816,15 @@ }, { "type": "ClassMethod", - "start": 1256, - "end": 1450, + "start": 1461, + "end": 1834, "loc": { "start": { - "line": 46, + "line": 50, "column": 1 }, "end": { - "line": 54, + "line": 67, "column": 2 } }, @@ -1625,15 +1832,15 @@ "computed": false, "key": { "type": "Identifier", - "start": 1256, - "end": 1259, + "start": 1461, + "end": 1464, "loc": { "start": { - "line": 46, + "line": 50, "column": 1 }, "end": { - "line": 46, + "line": 50, "column": 4 }, "identifierName": "add" @@ -1649,15 +1856,15 @@ "params": [ { "type": "Identifier", - "start": 1260, - "end": 1263, + "start": 1465, + "end": 1468, "loc": { "start": { - "line": 46, + "line": 50, "column": 5 }, "end": { - "line": 46, + "line": 50, "column": 8 }, "identifierName": "key" @@ -1667,87 +1874,87 @@ ], "body": { "type": "BlockStatement", - "start": 1265, - "end": 1450, + "start": 1470, + "end": 1834, "loc": { "start": { - "line": 46, + "line": 50, "column": 10 }, "end": { - "line": 54, + "line": 67, "column": 2 } }, "body": [ { "type": "IfStatement", - "start": 1269, - "end": 1447, + "start": 1474, + "end": 1561, "loc": { "start": { - "line": 47, + "line": 51, "column": 2 }, "end": { - "line": 53, + "line": 54, "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 1273, - "end": 1291, + "start": 1478, + "end": 1496, "loc": { "start": { - "line": 47, + "line": 51, "column": 6 }, "end": { - "line": 47, + "line": 51, "column": 24 } }, "left": { "type": "MemberExpression", - "start": 1273, - "end": 1282, + "start": 1478, + "end": 1487, "loc": { "start": { - "line": 47, + "line": 51, "column": 6 }, "end": { - "line": 47, + "line": 51, "column": 15 } }, "object": { "type": "ThisExpression", - "start": 1273, - "end": 1277, + "start": 1478, + "end": 1482, "loc": { "start": { - "line": 47, + "line": 51, "column": 6 }, "end": { - "line": 47, + "line": 51, "column": 10 } } }, "property": { "type": "Identifier", - "start": 1278, - "end": 1282, + "start": 1483, + "end": 1487, "loc": { "start": { - "line": 47, + "line": 51, "column": 11 }, "end": { - "line": 47, + "line": 51, "column": 15 }, "identifierName": "root" @@ -1759,15 +1966,15 @@ "operator": "===", "right": { "type": "NullLiteral", - "start": 1287, - "end": 1291, + "start": 1492, + "end": 1496, "loc": { "start": { - "line": 47, + "line": 51, "column": 20 }, "end": { - "line": 47, + "line": 51, "column": 24 } } @@ -1775,88 +1982,88 @@ }, "consequent": { "type": "BlockStatement", - "start": 1293, - "end": 1335, + "start": 1498, + "end": 1561, "loc": { "start": { - "line": 47, + "line": 51, "column": 26 }, "end": { - "line": 49, + "line": 54, "column": 3 } }, "body": [ { "type": "ExpressionStatement", - "start": 1298, - "end": 1331, + "start": 1503, + "end": 1536, "loc": { "start": { - "line": 48, + "line": 52, "column": 3 }, "end": { - "line": 48, + "line": 52, "column": 36 } }, "expression": { "type": "AssignmentExpression", - "start": 1298, - "end": 1330, + "start": 1503, + "end": 1535, "loc": { "start": { - "line": 48, + "line": 52, "column": 3 }, "end": { - "line": 48, + "line": 52, "column": 35 } }, "operator": "=", "left": { "type": "MemberExpression", - "start": 1298, - "end": 1307, + "start": 1503, + "end": 1512, "loc": { "start": { - "line": 48, + "line": 52, "column": 3 }, "end": { - "line": 48, + "line": 52, "column": 12 } }, "object": { "type": "ThisExpression", - "start": 1298, - "end": 1302, + "start": 1503, + "end": 1507, "loc": { "start": { - "line": 48, + "line": 52, "column": 3 }, "end": { - "line": 48, + "line": 52, "column": 7 } } }, "property": { "type": "Identifier", - "start": 1303, - "end": 1307, + "start": 1508, + "end": 1512, "loc": { "start": { - "line": 48, + "line": 52, "column": 8 }, "end": { - "line": 48, + "line": 52, "column": 12 }, "identifierName": "root" @@ -1867,29 +2074,29 @@ }, "right": { "type": "NewExpression", - "start": 1310, - "end": 1330, + "start": 1515, + "end": 1535, "loc": { "start": { - "line": 48, + "line": 52, "column": 15 }, "end": { - "line": 48, + "line": 52, "column": 35 } }, "callee": { "type": "Identifier", - "start": 1314, - "end": 1318, + "start": 1519, + "end": 1523, "loc": { "start": { - "line": 48, + "line": 52, "column": 19 }, "end": { - "line": 48, + "line": 52, "column": 23 }, "identifierName": "Node" @@ -1899,15 +2106,15 @@ "arguments": [ { "type": "Identifier", - "start": 1319, - "end": 1324, + "start": 1524, + "end": 1529, "loc": { "start": { - "line": 48, + "line": 52, "column": 24 }, "end": { - "line": 48, + "line": 52, "column": 29 }, "identifierName": "BLACK" @@ -1916,15 +2123,15 @@ }, { "type": "Identifier", - "start": 1326, - "end": 1329, + "start": 1531, + "end": 1534, "loc": { "start": { - "line": 48, + "line": 52, "column": 31 }, "end": { - "line": 48, + "line": 52, "column": 34 }, "identifierName": "key" @@ -1934,774 +2141,977 @@ ] } } - } - ], - "directives": [] - }, - "alternate": { - "type": "BlockStatement", - "start": 1341, - "end": 1447, - "loc": { - "start": { - "line": 49, - "column": 9 }, - "end": { - "line": 53, - "column": 3 - } - }, - "body": [ { - "type": "VariableDeclaration", - "start": 1346, - "end": 1378, + "type": "ReturnStatement", + "start": 1540, + "end": 1557, "loc": { "start": { - "line": 50, + "line": 53, "column": 3 }, "end": { - "line": 50, - "column": 35 + "line": 53, + "column": 20 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 1352, - "end": 1377, + "argument": { + "type": "MemberExpression", + "start": 1547, + "end": 1556, + "loc": { + "start": { + "line": 53, + "column": 10 + }, + "end": { + "line": 53, + "column": 19 + } + }, + "object": { + "type": "ThisExpression", + "start": 1547, + "end": 1551, "loc": { "start": { - "line": 50, - "column": 9 + "line": 53, + "column": 10 }, "end": { - "line": 50, - "column": 34 + "line": 53, + "column": 14 } - }, - "id": { - "type": "Identifier", - "start": 1352, - "end": 1356, - "loc": { - "start": { - "line": 50, - "column": 9 - }, - "end": { - "line": 50, - "column": 13 - }, - "identifierName": "node" - }, - "name": "node" - }, - "init": { - "type": "NewExpression", - "start": 1359, - "end": 1377, - "loc": { - "start": { - "line": 50, - "column": 16 - }, - "end": { - "line": 50, - "column": 34 - } + } + }, + "property": { + "type": "Identifier", + "start": 1552, + "end": 1556, + "loc": { + "start": { + "line": 53, + "column": 15 }, - "callee": { - "type": "Identifier", - "start": 1363, - "end": 1367, - "loc": { - "start": { - "line": 50, - "column": 20 - }, - "end": { - "line": 50, - "column": 24 - }, - "identifierName": "Node" - }, - "name": "Node" + "end": { + "line": 53, + "column": 19 }, - "arguments": [ - { - "type": "Identifier", - "start": 1368, - "end": 1371, - "loc": { - "start": { - "line": 50, - "column": 25 - }, - "end": { - "line": 50, - "column": 28 - }, - "identifierName": "RED" - }, - "name": "RED" - }, - { - "type": "Identifier", - "start": 1373, - "end": 1376, - "loc": { - "start": { - "line": 50, - "column": 30 - }, - "end": { - "line": 50, - "column": 33 - }, - "identifierName": "key" - }, - "name": "key" - } - ] - } - } - ], - "kind": "const" + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + } + } + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "VariableDeclaration", + "start": 1565, + "end": 1597, + "loc": { + "start": { + "line": 56, + "column": 2 + }, + "end": { + "line": 56, + "column": 34 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 1571, + "end": 1596, + "loc": { + "start": { + "line": 56, + "column": 8 + }, + "end": { + "line": 56, + "column": 33 + } }, - { - "type": "ExpressionStatement", - "start": 1382, - "end": 1420, + "id": { + "type": "Identifier", + "start": 1571, + "end": 1575, "loc": { "start": { - "line": 51, - "column": 3 + "line": 56, + "column": 8 }, "end": { - "line": 51, - "column": 41 + "line": 56, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + }, + "init": { + "type": "NewExpression", + "start": 1578, + "end": 1596, + "loc": { + "start": { + "line": 56, + "column": 15 + }, + "end": { + "line": 56, + "column": 33 } }, - "expression": { - "type": "CallExpression", - "start": 1382, - "end": 1419, + "callee": { + "type": "Identifier", + "start": 1582, + "end": 1586, "loc": { "start": { - "line": 51, - "column": 3 + "line": 56, + "column": 19 }, "end": { - "line": 51, - "column": 40 - } + "line": 56, + "column": 23 + }, + "identifierName": "Node" }, - "callee": { + "name": "Node" + }, + "arguments": [ + { "type": "Identifier", - "start": 1382, - "end": 1388, + "start": 1587, + "end": 1590, "loc": { "start": { - "line": 51, - "column": 3 + "line": 56, + "column": 24 }, "end": { - "line": 51, - "column": 9 + "line": 56, + "column": 27 }, - "identifierName": "insert" + "identifierName": "RED" }, - "name": "insert" + "name": "RED" }, - "arguments": [ - { - "type": "MemberExpression", - "start": 1389, - "end": 1401, - "loc": { - "start": { - "line": 51, - "column": 10 - }, - "end": { - "line": 51, - "column": 22 - } - }, - "object": { - "type": "ThisExpression", - "start": 1389, - "end": 1393, - "loc": { - "start": { - "line": 51, - "column": 10 - }, - "end": { - "line": 51, - "column": 14 - } - } - }, - "property": { - "type": "Identifier", - "start": 1394, - "end": 1401, - "loc": { - "start": { - "line": 51, - "column": 15 - }, - "end": { - "line": 51, - "column": 22 - }, - "identifierName": "compare" - }, - "name": "compare" - }, - "computed": false - }, - { - "type": "MemberExpression", - "start": 1403, - "end": 1412, - "loc": { - "start": { - "line": 51, - "column": 24 - }, - "end": { - "line": 51, - "column": 33 - } - }, - "object": { - "type": "ThisExpression", - "start": 1403, - "end": 1407, - "loc": { - "start": { - "line": 51, - "column": 24 - }, - "end": { - "line": 51, - "column": 28 - } - } + { + "type": "Identifier", + "start": 1592, + "end": 1595, + "loc": { + "start": { + "line": 56, + "column": 29 }, - "property": { - "type": "Identifier", - "start": 1408, - "end": 1412, - "loc": { - "start": { - "line": 51, - "column": 29 - }, - "end": { - "line": 51, - "column": 33 - }, - "identifierName": "root" - }, - "name": "root" + "end": { + "line": 56, + "column": 32 }, - "computed": false + "identifierName": "key" }, - { - "type": "Identifier", - "start": 1414, - "end": 1418, - "loc": { - "start": { - "line": 51, - "column": 35 - }, - "end": { - "line": 51, - "column": 39 - }, - "identifierName": "node" - }, - "name": "node" - } - ] - } + "name": "key" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 1600, + "end": 1638, + "loc": { + "start": { + "line": 57, + "column": 2 + }, + "end": { + "line": 57, + "column": 40 + } + }, + "expression": { + "type": "CallExpression", + "start": 1600, + "end": 1637, + "loc": { + "start": { + "line": 57, + "column": 2 + }, + "end": { + "line": 57, + "column": 39 + } + }, + "callee": { + "type": "Identifier", + "start": 1600, + "end": 1606, + "loc": { + "start": { + "line": 57, + "column": 2 + }, + "end": { + "line": 57, + "column": 8 + }, + "identifierName": "insert" }, + "name": "insert" + }, + "arguments": [ { - "type": "ExpressionStatement", - "start": 1424, - "end": 1443, + "type": "MemberExpression", + "start": 1607, + "end": 1619, "loc": { "start": { - "line": 52, - "column": 3 + "line": 57, + "column": 9 }, "end": { - "line": 52, - "column": 22 + "line": 57, + "column": 21 } }, - "expression": { - "type": "CallExpression", - "start": 1424, - "end": 1442, + "object": { + "type": "ThisExpression", + "start": 1607, + "end": 1611, "loc": { "start": { - "line": 52, - "column": 3 + "line": 57, + "column": 9 }, "end": { - "line": 52, - "column": 21 + "line": 57, + "column": 13 } + } + }, + "property": { + "type": "Identifier", + "start": 1612, + "end": 1619, + "loc": { + "start": { + "line": 57, + "column": 14 + }, + "end": { + "line": 57, + "column": 21 + }, + "identifierName": "compare" }, - "callee": { - "type": "Identifier", - "start": 1424, - "end": 1436, - "loc": { - "start": { - "line": 52, - "column": 3 + "name": "compare" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 1621, + "end": 1630, + "loc": { + "start": { + "line": 57, + "column": 23 + }, + "end": { + "line": 57, + "column": 32 + } + }, + "object": { + "type": "ThisExpression", + "start": 1621, + "end": 1625, + "loc": { + "start": { + "line": 57, + "column": 23 + }, + "end": { + "line": 57, + "column": 27 + } + } + }, + "property": { + "type": "Identifier", + "start": 1626, + "end": 1630, + "loc": { + "start": { + "line": 57, + "column": 28 + }, + "end": { + "line": 57, + "column": 32 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + { + "type": "Identifier", + "start": 1632, + "end": 1636, + "loc": { + "start": { + "line": 57, + "column": 34 + }, + "end": { + "line": 57, + "column": 38 + }, + "identifierName": "node" + }, + "name": "node" + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 1641, + "end": 1670, + "loc": { + "start": { + "line": 58, + "column": 2 + }, + "end": { + "line": 58, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 1641, + "end": 1669, + "loc": { + "start": { + "line": 58, + "column": 2 + }, + "end": { + "line": 58, + "column": 30 + } + }, + "callee": { + "type": "Identifier", + "start": 1641, + "end": 1647, + "loc": { + "start": { + "line": 58, + "column": 2 + }, + "end": { + "line": 58, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 1648, + "end": 1668, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 29 + } + }, + "left": { + "type": "MemberExpression", + "start": 1648, + "end": 1659, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 1648, + "end": 1652, + "loc": { + "start": { + "line": 58, + "column": 9 }, "end": { - "line": 52, - "column": 15 + "line": 58, + "column": 13 }, - "identifierName": "insert_case1" + "identifierName": "node" }, - "name": "insert_case1" + "name": "node" }, - "arguments": [ - { - "type": "Identifier", - "start": 1437, - "end": 1441, - "loc": { - "start": { - "line": 52, - "column": 16 - }, - "end": { - "line": 52, - "column": 20 - }, - "identifierName": "node" + "property": { + "type": "Identifier", + "start": 1653, + "end": 1659, + "loc": { + "start": { + "line": 58, + "column": 14 }, - "name": "node" + "end": { + "line": 58, + "column": 20 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 1664, + "end": 1668, + "loc": { + "start": { + "line": 58, + "column": 25 + }, + "end": { + "line": 58, + "column": 29 } - ] + } } } - ], - "directives": [] - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", - "start": 1175, - "end": 1254, - "loc": { - "start": { - "line": 41, - "column": 1 - }, - "end": { - "line": 45, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1453, - "end": 1679, - "loc": { - "start": { - "line": 56, - "column": 1 - }, - "end": { - "line": 63, - "column": 4 + ] } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 1681, - "end": 1784, - "loc": { - "start": { - "line": 64, - "column": 1 - }, - "end": { - "line": 67, - "column": 2 - } - }, - "static": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 1681, - "end": 1688, - "loc": { - "start": { - "line": 64, - "column": 1 - }, - "end": { - "line": 64, - "column": 8 - }, - "identifierName": "_search" - }, - "name": "_search", - "leadingComments": null - }, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 1689, - "end": 1692, - "loc": { - "start": { - "line": 64, - "column": 9 - }, - "end": { - "line": 64, - "column": 12 - }, - "identifierName": "key" - }, - "name": "key" - } - ], - "body": { - "type": "BlockStatement", - "start": 1694, - "end": 1784, - "loc": { - "start": { - "line": 64, - "column": 14 }, - "end": { - "line": 67, - "column": 2 - } - }, - "body": [ { "type": "IfStatement", - "start": 1698, - "end": 1734, + "start": 1673, + "end": 1815, "loc": { "start": { - "line": 65, + "line": 59, "column": 2 }, "end": { - "line": 65, - "column": 38 + "line": 64, + "column": 3 } }, "test": { "type": "BinaryExpression", - "start": 1702, - "end": 1720, + "start": 1677, + "end": 1705, "loc": { "start": { - "line": 65, + "line": 59, "column": 6 }, "end": { - "line": 65, - "column": 24 + "line": 59, + "column": 34 } }, "left": { "type": "MemberExpression", - "start": 1702, - "end": 1711, + "start": 1677, + "end": 1695, "loc": { "start": { - "line": 65, + "line": 59, "column": 6 }, "end": { - "line": 65, - "column": 15 + "line": 59, + "column": 24 } }, "object": { - "type": "ThisExpression", - "start": 1702, - "end": 1706, + "type": "MemberExpression", + "start": 1677, + "end": 1688, "loc": { "start": { - "line": 65, + "line": 59, "column": 6 }, "end": { - "line": 65, - "column": 10 + "line": 59, + "column": 17 } - } + }, + "object": { + "type": "Identifier", + "start": 1677, + "end": 1681, + "loc": { + "start": { + "line": 59, + "column": 6 + }, + "end": { + "line": 59, + "column": 10 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 1682, + "end": 1688, + "loc": { + "start": { + "line": 59, + "column": 11 + }, + "end": { + "line": 59, + "column": 17 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, "property": { "type": "Identifier", - "start": 1707, - "end": 1711, + "start": 1689, + "end": 1695, "loc": { "start": { - "line": 65, - "column": 11 + "line": 59, + "column": 18 }, "end": { - "line": 65, - "column": 15 + "line": 59, + "column": 24 }, - "identifierName": "root" + "identifierName": "_color" }, - "name": "root" + "name": "_color" }, "computed": false }, - "operator": "===", + "operator": "!==", "right": { - "type": "NullLiteral", - "start": 1716, - "end": 1720, + "type": "Identifier", + "start": 1700, + "end": 1705, "loc": { "start": { - "line": 65, - "column": 20 + "line": 59, + "column": 29 }, "end": { - "line": 65, - "column": 24 - } - } - } - }, - "consequent": { - "type": "ReturnStatement", - "start": 1722, - "end": 1734, - "loc": { - "start": { - "line": 65, - "column": 26 - }, - "end": { - "line": 65, - "column": 38 - } - }, - "argument": { - "type": "NullLiteral", - "start": 1729, - "end": 1733, - "loc": { - "start": { - "line": 65, - "column": 33 + "line": 59, + "column": 34 }, - "end": { - "line": 65, - "column": 37 - } - } - } - }, - "alternate": null - }, - { - "type": "ReturnStatement", - "start": 1737, - "end": 1781, - "loc": { - "start": { - "line": 66, - "column": 2 - }, - "end": { - "line": 66, - "column": 46 + "identifierName": "BLACK" + }, + "name": "BLACK" } }, - "argument": { - "type": "CallExpression", - "start": 1744, - "end": 1780, + "consequent": { + "type": "BlockStatement", + "start": 1707, + "end": 1815, "loc": { "start": { - "line": 66, - "column": 9 + "line": 59, + "column": 36 }, "end": { - "line": 66, - "column": 45 + "line": 64, + "column": 3 } }, - "callee": { - "type": "Identifier", - "start": 1744, - "end": 1750, - "loc": { - "start": { - "line": 66, - "column": 9 - }, - "end": { - "line": 66, - "column": 15 - }, - "identifierName": "search" - }, - "name": "search" - }, - "arguments": [ + "body": [ { - "type": "MemberExpression", - "start": 1751, - "end": 1763, + "type": "VariableDeclaration", + "start": 1712, + "end": 1747, "loc": { "start": { - "line": 66, - "column": 16 + "line": 60, + "column": 3 }, "end": { - "line": 66, - "column": 28 + "line": 60, + "column": 38 } }, - "object": { - "type": "ThisExpression", - "start": 1751, - "end": 1755, - "loc": { - "start": { - "line": 66, - "column": 16 + "declarations": [ + { + "type": "VariableDeclarator", + "start": 1718, + "end": 1746, + "loc": { + "start": { + "line": 60, + "column": 9 + }, + "end": { + "line": 60, + "column": 37 + } }, - "end": { - "line": 66, - "column": 20 + "id": { + "type": "Identifier", + "start": 1718, + "end": 1725, + "loc": { + "start": { + "line": 60, + "column": 9 + }, + "end": { + "line": 60, + "column": 16 + }, + "identifierName": "subtree" + }, + "name": "subtree" + }, + "init": { + "type": "CallExpression", + "start": 1728, + "end": 1746, + "loc": { + "start": { + "line": 60, + "column": 19 + }, + "end": { + "line": 60, + "column": 37 + } + }, + "callee": { + "type": "Identifier", + "start": 1728, + "end": 1740, + "loc": { + "start": { + "line": 60, + "column": 19 + }, + "end": { + "line": 60, + "column": 31 + }, + "identifierName": "insert_case2" + }, + "name": "insert_case2" + }, + "arguments": [ + { + "type": "Identifier", + "start": 1741, + "end": 1745, + "loc": { + "start": { + "line": 60, + "column": 32 + }, + "end": { + "line": 60, + "column": 36 + }, + "identifierName": "node" + }, + "name": "node" + } + ] } } - }, - "property": { - "type": "Identifier", - "start": 1756, - "end": 1763, - "loc": { - "start": { - "line": 66, - "column": 21 - }, - "end": { - "line": 66, - "column": 28 - }, - "identifierName": "compare" - }, - "name": "compare" - }, - "computed": false + ], + "kind": "const" }, { - "type": "MemberExpression", - "start": 1765, - "end": 1774, + "type": "IfStatement", + "start": 1751, + "end": 1811, "loc": { "start": { - "line": 66, - "column": 30 + "line": 61, + "column": 3 }, "end": { - "line": 66, - "column": 39 + "line": 63, + "column": 4 } }, - "object": { - "type": "ThisExpression", - "start": 1765, - "end": 1769, + "test": { + "type": "BinaryExpression", + "start": 1755, + "end": 1778, "loc": { "start": { - "line": 66, - "column": 30 + "line": 61, + "column": 7 }, "end": { - "line": 66, - "column": 34 + "line": 61, + "column": 30 + } + }, + "left": { + "type": "MemberExpression", + "start": 1755, + "end": 1769, + "loc": { + "start": { + "line": 61, + "column": 7 + }, + "end": { + "line": 61, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 1755, + "end": 1762, + "loc": { + "start": { + "line": 61, + "column": 7 + }, + "end": { + "line": 61, + "column": 14 + }, + "identifierName": "subtree" + }, + "name": "subtree" + }, + "property": { + "type": "Identifier", + "start": 1763, + "end": 1769, + "loc": { + "start": { + "line": 61, + "column": 15 + }, + "end": { + "line": 61, + "column": 21 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 1774, + "end": 1778, + "loc": { + "start": { + "line": 61, + "column": 26 + }, + "end": { + "line": 61, + "column": 30 + } } } }, - "property": { - "type": "Identifier", - "start": 1770, - "end": 1774, + "consequent": { + "type": "BlockStatement", + "start": 1780, + "end": 1811, "loc": { "start": { - "line": 66, - "column": 35 + "line": 61, + "column": 32 }, "end": { - "line": 66, - "column": 39 - }, - "identifierName": "root" + "line": 63, + "column": 4 + } }, - "name": "root" - }, - "computed": false - }, - { - "type": "Identifier", - "start": 1776, - "end": 1779, - "loc": { - "start": { - "line": 66, - "column": 41 - }, - "end": { - "line": 66, - "column": 44 - }, - "identifierName": "key" + "body": [ + { + "type": "ExpressionStatement", + "start": 1786, + "end": 1806, + "loc": { + "start": { + "line": 62, + "column": 4 + }, + "end": { + "line": 62, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 1786, + "end": 1805, + "loc": { + "start": { + "line": 62, + "column": 4 + }, + "end": { + "line": 62, + "column": 23 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 1786, + "end": 1795, + "loc": { + "start": { + "line": 62, + "column": 4 + }, + "end": { + "line": 62, + "column": 13 + } + }, + "object": { + "type": "ThisExpression", + "start": 1786, + "end": 1790, + "loc": { + "start": { + "line": 62, + "column": 4 + }, + "end": { + "line": 62, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "start": 1791, + "end": 1795, + "loc": { + "start": { + "line": 62, + "column": 9 + }, + "end": { + "line": 62, + "column": 13 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 1798, + "end": 1805, + "loc": { + "start": { + "line": 62, + "column": 16 + }, + "end": { + "line": 62, + "column": 23 + }, + "identifierName": "subtree" + }, + "name": "subtree" + } + } + } + ], + "directives": [] }, - "name": "key" + "alternate": null } - ] + ], + "directives": [] + }, + "alternate": null + }, + { + "type": "ReturnStatement", + "start": 1819, + "end": 1831, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 14 + } + }, + "argument": { + "type": "Identifier", + "start": 1826, + "end": 1830, + "loc": { + "start": { + "line": 66, + "column": 9 + }, + "end": { + "line": 66, + "column": 13 + }, + "identifierName": "node" + }, + "name": "node" } } ], @@ -2711,16 +3121,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1453, - "end": 1679, + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t * @return {Node} The newly added node.\n\t ", + "start": 1339, + "end": 1459, "loc": { "start": { - "line": 56, + "line": 44, "column": 1 }, "end": { - "line": 63, + "line": 49, "column": 4 } } @@ -2729,9 +3139,9 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", - "start": 1787, - "end": 2049, + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", + "start": 1837, + "end": 2063, "loc": { "start": { "line": 69, @@ -2747,8 +3157,8 @@ }, { "type": "ClassMethod", - "start": 2051, - "end": 2140, + "start": 2065, + "end": 2168, "loc": { "start": { "line": 77, @@ -2763,8 +3173,8 @@ "computed": false, "key": { "type": "Identifier", - "start": 2051, - "end": 2054, + "start": 2065, + "end": 2072, "loc": { "start": { "line": 77, @@ -2772,11 +3182,11 @@ }, "end": { "line": 77, - "column": 4 + "column": 8 }, - "identifierName": "get" + "identifierName": "_search" }, - "name": "get", + "name": "_search", "leadingComments": null }, "kind": "method", @@ -2787,16 +3197,16 @@ "params": [ { "type": "Identifier", - "start": 2055, - "end": 2058, + "start": 2073, + "end": 2076, "loc": { "start": { "line": 77, - "column": 5 + "column": 9 }, "end": { "line": 77, - "column": 8 + "column": 12 }, "identifierName": "key" }, @@ -2805,12 +3215,12 @@ ], "body": { "type": "BlockStatement", - "start": 2060, - "end": 2140, + "start": 2078, + "end": 2168, "loc": { "start": { "line": 77, - "column": 10 + "column": 14 }, "end": { "line": 80, @@ -2819,9 +3229,9 @@ }, "body": [ { - "type": "VariableDeclaration", - "start": 2064, - "end": 2095, + "type": "IfStatement", + "start": 2082, + "end": 2118, "loc": { "start": { "line": 78, @@ -2829,131 +3239,124 @@ }, "end": { "line": 78, - "column": 33 + "column": 38 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 2070, - "end": 2094, + "test": { + "type": "BinaryExpression", + "start": 2086, + "end": 2104, + "loc": { + "start": { + "line": 78, + "column": 6 + }, + "end": { + "line": 78, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 2086, + "end": 2095, "loc": { "start": { "line": 78, - "column": 8 + "column": 6 }, "end": { "line": 78, - "column": 32 + "column": 15 } }, - "id": { - "type": "Identifier", - "start": 2070, - "end": 2074, + "object": { + "type": "ThisExpression", + "start": 2086, + "end": 2090, "loc": { "start": { "line": 78, - "column": 8 + "column": 6 }, "end": { "line": 78, - "column": 12 - }, - "identifierName": "node" - }, - "name": "node" + "column": 10 + } + } }, - "init": { - "type": "CallExpression", - "start": 2077, - "end": 2094, + "property": { + "type": "Identifier", + "start": 2091, + "end": 2095, "loc": { "start": { "line": 78, - "column": 15 + "column": 11 }, "end": { "line": 78, - "column": 32 - } - }, - "callee": { - "type": "MemberExpression", - "start": 2077, - "end": 2089, - "loc": { - "start": { - "line": 78, - "column": 15 - }, - "end": { - "line": 78, - "column": 27 - } - }, - "object": { - "type": "ThisExpression", - "start": 2077, - "end": 2081, - "loc": { - "start": { - "line": 78, - "column": 15 - }, - "end": { - "line": 78, - "column": 19 - } - } - }, - "property": { - "type": "Identifier", - "start": 2082, - "end": 2089, - "loc": { - "start": { - "line": 78, - "column": 20 - }, - "end": { - "line": 78, - "column": 27 - }, - "identifierName": "_search" - }, - "name": "_search" + "column": 15 }, - "computed": false + "identifierName": "root" }, - "arguments": [ - { - "type": "Identifier", - "start": 2090, - "end": 2093, - "loc": { - "start": { - "line": 78, - "column": 28 - }, - "end": { - "line": 78, - "column": 31 - }, - "identifierName": "key" - }, - "name": "key" - } - ] + "name": "root" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 2100, + "end": 2104, + "loc": { + "start": { + "line": 78, + "column": 20 + }, + "end": { + "line": 78, + "column": 24 + } } } - ], - "kind": "const" + }, + "consequent": { + "type": "ReturnStatement", + "start": 2106, + "end": 2118, + "loc": { + "start": { + "line": 78, + "column": 26 + }, + "end": { + "line": 78, + "column": 38 + } + }, + "argument": { + "type": "NullLiteral", + "start": 2113, + "end": 2117, + "loc": { + "start": { + "line": 78, + "column": 33 + }, + "end": { + "line": 78, + "column": 37 + } + } + } + }, + "alternate": null }, { "type": "ReturnStatement", - "start": 2098, - "end": 2137, + "start": 2121, + "end": 2165, "loc": { "start": { "line": 79, @@ -2961,13 +3364,13 @@ }, "end": { "line": 79, - "column": 41 + "column": 46 } }, "argument": { - "type": "ConditionalExpression", - "start": 2105, - "end": 2136, + "type": "CallExpression", + "start": 2128, + "end": 2164, "loc": { "start": { "line": 79, @@ -2975,13 +3378,13 @@ }, "end": { "line": 79, - "column": 40 + "column": 45 } }, - "test": { - "type": "BinaryExpression", - "start": 2105, - "end": 2118, + "callee": { + "type": "Identifier", + "start": 2128, + "end": 2134, "loc": { "start": { "line": 79, @@ -2989,108 +3392,127 @@ }, "end": { "line": 79, - "column": 22 - } + "column": 15 + }, + "identifierName": "search" }, - "left": { - "type": "Identifier", - "start": 2105, - "end": 2109, + "name": "search" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 2135, + "end": 2147, "loc": { "start": { "line": 79, - "column": 9 + "column": 16 }, "end": { "line": 79, - "column": 13 + "column": 28 + } + }, + "object": { + "type": "ThisExpression", + "start": 2135, + "end": 2139, + "loc": { + "start": { + "line": 79, + "column": 16 + }, + "end": { + "line": 79, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "start": 2140, + "end": 2147, + "loc": { + "start": { + "line": 79, + "column": 21 + }, + "end": { + "line": 79, + "column": 28 + }, + "identifierName": "compare" }, - "identifierName": "node" + "name": "compare" }, - "name": "node" + "computed": false }, - "operator": "===", - "right": { - "type": "NullLiteral", - "start": 2114, - "end": 2118, + { + "type": "MemberExpression", + "start": 2149, + "end": 2158, "loc": { "start": { "line": 79, - "column": 18 + "column": 30 }, "end": { "line": 79, - "column": 22 + "column": 39 } - } - } - }, - "consequent": { - "type": "NullLiteral", - "start": 2121, - "end": 2125, - "loc": { - "start": { - "line": 79, - "column": 25 }, - "end": { - "line": 79, - "column": 29 - } - } - }, - "alternate": { - "type": "MemberExpression", - "start": 2128, - "end": 2136, - "loc": { - "start": { - "line": 79, - "column": 32 + "object": { + "type": "ThisExpression", + "start": 2149, + "end": 2153, + "loc": { + "start": { + "line": 79, + "column": 30 + }, + "end": { + "line": 79, + "column": 34 + } + } }, - "end": { - "line": 79, - "column": 40 - } - }, - "object": { - "type": "Identifier", - "start": 2128, - "end": 2132, - "loc": { - "start": { - "line": 79, - "column": 32 - }, - "end": { - "line": 79, - "column": 36 + "property": { + "type": "Identifier", + "start": 2154, + "end": 2158, + "loc": { + "start": { + "line": 79, + "column": 35 + }, + "end": { + "line": 79, + "column": 39 + }, + "identifierName": "root" }, - "identifierName": "node" + "name": "root" }, - "name": "node" + "computed": false }, - "property": { + { "type": "Identifier", - "start": 2133, - "end": 2136, + "start": 2160, + "end": 2163, "loc": { "start": { "line": 79, - "column": 37 + "column": 41 }, "end": { "line": 79, - "column": 40 + "column": 44 }, "identifierName": "key" }, "name": "key" - }, - "computed": false - } + } + ] } } ], @@ -3100,9 +3522,9 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", - "start": 1787, - "end": 2049, + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", + "start": 1837, + "end": 2063, "loc": { "start": { "line": 69, @@ -3118,16 +3540,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", - "start": 2143, - "end": 2298, + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", + "start": 2171, + "end": 2433, "loc": { "start": { "line": 82, "column": 1 }, "end": { - "line": 88, + "line": 89, "column": 4 } } @@ -3136,15 +3558,15 @@ }, { "type": "ClassMethod", - "start": 2300, - "end": 2350, + "start": 2435, + "end": 2529, "loc": { "start": { - "line": 89, + "line": 90, "column": 1 }, "end": { - "line": 91, + "line": 93, "column": 2 } }, @@ -3152,20 +3574,20 @@ "computed": false, "key": { "type": "Identifier", - "start": 2300, - "end": 2303, + "start": 2435, + "end": 2438, "loc": { "start": { - "line": 89, + "line": 90, "column": 1 }, "end": { - "line": 89, + "line": 90, "column": 4 }, - "identifierName": "has" + "identifierName": "get" }, - "name": "has", + "name": "get", "leadingComments": null }, "kind": "method", @@ -3176,15 +3598,15 @@ "params": [ { "type": "Identifier", - "start": 2304, - "end": 2307, + "start": 2439, + "end": 2442, "loc": { "start": { - "line": 89, + "line": 90, "column": 5 }, "end": { - "line": 89, + "line": 90, "column": 8 }, "identifierName": "key" @@ -3194,144 +3616,293 @@ ], "body": { "type": "BlockStatement", - "start": 2309, - "end": 2350, + "start": 2444, + "end": 2529, "loc": { "start": { - "line": 89, + "line": 90, "column": 10 }, "end": { - "line": 91, + "line": 93, "column": 2 } }, "body": [ { - "type": "ReturnStatement", - "start": 2313, - "end": 2347, + "type": "VariableDeclaration", + "start": 2448, + "end": 2479, "loc": { "start": { - "line": 90, + "line": 91, "column": 2 }, "end": { - "line": 90, - "column": 36 + "line": 91, + "column": 33 } }, - "argument": { - "type": "BinaryExpression", - "start": 2320, - "end": 2346, - "loc": { - "start": { - "line": 90, - "column": 9 - }, - "end": { - "line": 90, - "column": 35 - } - }, - "left": { - "type": "CallExpression", - "start": 2320, - "end": 2337, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 2454, + "end": 2478, "loc": { "start": { - "line": 90, - "column": 9 + "line": 91, + "column": 8 }, "end": { - "line": 90, - "column": 26 + "line": 91, + "column": 32 } }, - "callee": { - "type": "MemberExpression", - "start": 2320, - "end": 2332, + "id": { + "type": "Identifier", + "start": 2454, + "end": 2458, "loc": { "start": { - "line": 90, - "column": 9 + "line": 91, + "column": 8 }, "end": { - "line": 90, - "column": 21 - } + "line": 91, + "column": 12 + }, + "identifierName": "node" }, - "object": { - "type": "ThisExpression", - "start": 2320, - "end": 2324, - "loc": { - "start": { - "line": 90, - "column": 9 - }, - "end": { - "line": 90, - "column": 13 - } + "name": "node" + }, + "init": { + "type": "CallExpression", + "start": 2461, + "end": 2478, + "loc": { + "start": { + "line": 91, + "column": 15 + }, + "end": { + "line": 91, + "column": 32 } }, - "property": { - "type": "Identifier", - "start": 2325, - "end": 2332, + "callee": { + "type": "MemberExpression", + "start": 2461, + "end": 2473, "loc": { "start": { - "line": 90, - "column": 14 + "line": 91, + "column": 15 }, "end": { - "line": 90, - "column": 21 - }, - "identifierName": "_search" + "line": 91, + "column": 27 + } }, - "name": "_search" - }, - "computed": false - }, - "arguments": [ - { - "type": "Identifier", - "start": 2333, - "end": 2336, - "loc": { - "start": { - "line": 90, - "column": 22 - }, - "end": { - "line": 90, - "column": 25 + "object": { + "type": "ThisExpression", + "start": 2461, + "end": 2465, + "loc": { + "start": { + "line": 91, + "column": 15 + }, + "end": { + "line": 91, + "column": 19 + } + } + }, + "property": { + "type": "Identifier", + "start": 2466, + "end": 2473, + "loc": { + "start": { + "line": 91, + "column": 20 + }, + "end": { + "line": 91, + "column": 27 + }, + "identifierName": "_search" }, - "identifierName": "key" + "name": "_search" }, - "name": "key" - } - ] - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 2342, - "end": 2346, - "loc": { - "start": { - "line": 90, - "column": 31 + "computed": false }, - "end": { - "line": 90, - "column": 35 + "arguments": [ + { + "type": "Identifier", + "start": 2474, + "end": 2477, + "loc": { + "start": { + "line": 91, + "column": 28 + }, + "end": { + "line": 91, + "column": 31 + }, + "identifierName": "key" + }, + "name": "key" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ReturnStatement", + "start": 2482, + "end": 2526, + "loc": { + "start": { + "line": 92, + "column": 2 + }, + "end": { + "line": 92, + "column": 46 + } + }, + "argument": { + "type": "ConditionalExpression", + "start": 2489, + "end": 2525, + "loc": { + "start": { + "line": 92, + "column": 9 + }, + "end": { + "line": 92, + "column": 45 + } + }, + "test": { + "type": "BinaryExpression", + "start": 2489, + "end": 2502, + "loc": { + "start": { + "line": 92, + "column": 9 + }, + "end": { + "line": 92, + "column": 22 + } + }, + "left": { + "type": "Identifier", + "start": 2489, + "end": 2493, + "loc": { + "start": { + "line": 92, + "column": 9 + }, + "end": { + "line": 92, + "column": 13 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 2498, + "end": 2502, + "loc": { + "start": { + "line": 92, + "column": 18 + }, + "end": { + "line": 92, + "column": 22 + } } } + }, + "consequent": { + "type": "Identifier", + "start": 2505, + "end": 2514, + "loc": { + "start": { + "line": 92, + "column": 25 + }, + "end": { + "line": 92, + "column": 34 + }, + "identifierName": "undefined" + }, + "name": "undefined" + }, + "alternate": { + "type": "MemberExpression", + "start": 2517, + "end": 2525, + "loc": { + "start": { + "line": 92, + "column": 37 + }, + "end": { + "line": 92, + "column": 45 + } + }, + "object": { + "type": "Identifier", + "start": 2517, + "end": 2521, + "loc": { + "start": { + "line": 92, + "column": 37 + }, + "end": { + "line": 92, + "column": 41 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 2522, + "end": 2525, + "loc": { + "start": { + "line": 92, + "column": 42 + }, + "end": { + "line": 92, + "column": 45 + }, + "identifierName": "key" + }, + "name": "key" + }, + "computed": false } } } @@ -3342,16 +3913,16 @@ "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", - "start": 2143, - "end": 2298, + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", + "start": 2171, + "end": 2433, "loc": { "start": { "line": 82, "column": 1 }, "end": { - "line": 88, + "line": 89, "column": 4 } } @@ -3360,16 +3931,16 @@ "trailingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2353, - "end": 2458, + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", + "start": 2532, + "end": 2687, "loc": { "start": { - "line": 93, + "line": 95, "column": 1 }, "end": { - "line": 97, + "line": 101, "column": 4 } } @@ -3378,15 +3949,15 @@ }, { "type": "ClassMethod", - "start": 2460, - "end": 3286, + "start": 2689, + "end": 2739, "loc": { "start": { - "line": 98, + "line": 102, "column": 1 }, "end": { - "line": 125, + "line": 104, "column": 2 } }, @@ -3394,20 +3965,20 @@ "computed": false, "key": { "type": "Identifier", - "start": 2460, - "end": 2467, + "start": 2689, + "end": 2692, "loc": { "start": { - "line": 98, + "line": 102, "column": 1 }, "end": { - "line": 98, - "column": 8 + "line": 102, + "column": 4 }, - "identifierName": "_delete" + "identifierName": "has" }, - "name": "_delete", + "name": "has", "leadingComments": null }, "kind": "method", @@ -3418,206 +3989,448 @@ "params": [ { "type": "Identifier", - "start": 2468, - "end": 2472, + "start": 2693, + "end": 2696, "loc": { "start": { - "line": 98, - "column": 9 + "line": 102, + "column": 5 }, "end": { - "line": 98, - "column": 13 + "line": 102, + "column": 8 }, - "identifierName": "node" + "identifierName": "key" }, - "name": "node" + "name": "key" } ], "body": { "type": "BlockStatement", - "start": 2474, - "end": 3286, + "start": 2698, + "end": 2739, "loc": { "start": { - "line": 98, - "column": 15 + "line": 102, + "column": 10 }, "end": { - "line": 125, + "line": 104, "column": 2 } }, "body": [ { - "type": "ExpressionStatement", - "start": 2478, - "end": 2507, + "type": "ReturnStatement", + "start": 2702, + "end": 2736, "loc": { "start": { - "line": 99, + "line": 103, "column": 2 }, "end": { - "line": 99, - "column": 31 + "line": 103, + "column": 36 } }, - "expression": { - "type": "CallExpression", - "start": 2478, - "end": 2506, + "argument": { + "type": "BinaryExpression", + "start": 2709, + "end": 2735, "loc": { "start": { - "line": 99, - "column": 2 + "line": 103, + "column": 9 }, "end": { - "line": 99, - "column": 30 + "line": 103, + "column": 35 } }, - "callee": { - "type": "Identifier", - "start": 2478, - "end": 2484, + "left": { + "type": "CallExpression", + "start": 2709, + "end": 2726, "loc": { "start": { - "line": 99, - "column": 2 + "line": 103, + "column": 9 }, "end": { - "line": 99, - "column": 8 - }, - "identifierName": "assert" + "line": 103, + "column": 26 + } }, - "name": "assert" - }, - "arguments": [ - { - "type": "BinaryExpression", - "start": 2485, - "end": 2505, + "callee": { + "type": "MemberExpression", + "start": 2709, + "end": 2721, "loc": { "start": { - "line": 99, + "line": 103, "column": 9 }, "end": { - "line": 99, - "column": 29 + "line": 103, + "column": 21 } }, - "left": { - "type": "Identifier", - "start": 2485, - "end": 2489, + "object": { + "type": "ThisExpression", + "start": 2709, + "end": 2713, "loc": { "start": { - "line": 99, + "line": 103, "column": 9 }, "end": { - "line": 99, + "line": 103, "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "start": 2714, + "end": 2721, + "loc": { + "start": { + "line": 103, + "column": 14 }, - "identifierName": "node" + "end": { + "line": 103, + "column": 21 + }, + "identifierName": "_search" }, - "name": "node" + "name": "_search" }, - "operator": "instanceof", - "right": { + "computed": false + }, + "arguments": [ + { "type": "Identifier", - "start": 2501, - "end": 2505, + "start": 2722, + "end": 2725, "loc": { "start": { - "line": 99, - "column": 25 + "line": 103, + "column": 22 }, "end": { - "line": 99, - "column": 29 + "line": 103, + "column": 25 }, - "identifierName": "Node" + "identifierName": "key" }, - "name": "Node" + "name": "key" } - } - ] - } - }, - { - "type": "IfStatement", - "start": 2510, - "end": 3283, - "loc": { - "start": { - "line": 100, - "column": 2 - }, - "end": { - "line": 124, - "column": 3 - } - }, - "test": { - "type": "BinaryExpression", - "start": 2514, - "end": 2532, - "loc": { - "start": { - "line": 100, - "column": 6 - }, - "end": { - "line": 100, - "column": 24 - } + ] }, - "left": { - "type": "MemberExpression", - "start": 2514, - "end": 2523, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 2731, + "end": 2735, "loc": { "start": { - "line": 100, - "column": 6 + "line": 103, + "column": 31 }, "end": { - "line": 100, - "column": 15 + "line": 103, + "column": 35 } - }, - "object": { - "type": "Identifier", - "start": 2514, - "end": 2518, - "loc": { - "start": { - "line": 100, - "column": 6 - }, - "end": { - "line": 100, - "column": 10 - }, - "identifierName": "node" + } + } + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", + "start": 2532, + "end": 2687, + "loc": { + "start": { + "line": 95, + "column": 1 + }, + "end": { + "line": 101, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", + "start": 2742, + "end": 2847, + "loc": { + "start": { + "line": 106, + "column": 1 + }, + "end": { + "line": 110, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 2849, + "end": 5066, + "loc": { + "start": { + "line": 111, + "column": 1 + }, + "end": { + "line": 189, + "column": 2 + } + }, + "static": false, + "computed": false, + "key": { + "type": "Identifier", + "start": 2849, + "end": 2855, + "loc": { + "start": { + "line": 111, + "column": 1 + }, + "end": { + "line": 111, + "column": 7 + }, + "identifierName": "unlink" + }, + "name": "unlink", + "leadingComments": null + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 2856, + "end": 2860, + "loc": { + "start": { + "line": 111, + "column": 8 + }, + "end": { + "line": 111, + "column": 12 + }, + "identifierName": "node" + }, + "name": "node" + } + ], + "body": { + "type": "BlockStatement", + "start": 2862, + "end": 5066, + "loc": { + "start": { + "line": 111, + "column": 14 + }, + "end": { + "line": 189, + "column": 2 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 2866, + "end": 2895, + "loc": { + "start": { + "line": 112, + "column": 2 + }, + "end": { + "line": 112, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 2866, + "end": 2894, + "loc": { + "start": { + "line": 112, + "column": 2 + }, + "end": { + "line": 112, + "column": 30 + } + }, + "callee": { + "type": "Identifier", + "start": 2866, + "end": 2872, + "loc": { + "start": { + "line": 112, + "column": 2 + }, + "end": { + "line": 112, + "column": 8 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 2873, + "end": 2893, + "loc": { + "start": { + "line": 112, + "column": 9 + }, + "end": { + "line": 112, + "column": 29 + } + }, + "left": { + "type": "Identifier", + "start": 2873, + "end": 2877, + "loc": { + "start": { + "line": 112, + "column": 9 + }, + "end": { + "line": 112, + "column": 13 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "instanceof", + "right": { + "type": "Identifier", + "start": 2889, + "end": 2893, + "loc": { + "start": { + "line": 112, + "column": 25 + }, + "end": { + "line": 112, + "column": 29 + }, + "identifierName": "Node" + }, + "name": "Node" + } + } + ] + } + }, + { + "type": "IfStatement", + "start": 2898, + "end": 5063, + "loc": { + "start": { + "line": 113, + "column": 2 + }, + "end": { + "line": 188, + "column": 3 + } + }, + "test": { + "type": "BinaryExpression", + "start": 2902, + "end": 2920, + "loc": { + "start": { + "line": 113, + "column": 6 + }, + "end": { + "line": 113, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 2902, + "end": 2911, + "loc": { + "start": { + "line": 113, + "column": 6 + }, + "end": { + "line": 113, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 2902, + "end": 2906, + "loc": { + "start": { + "line": 113, + "column": 6 + }, + "end": { + "line": 113, + "column": 10 + }, + "identifierName": "node" }, "name": "node" }, "property": { "type": "Identifier", - "start": 2519, - "end": 2523, + "start": 2907, + "end": 2911, "loc": { "start": { - "line": 100, + "line": 113, "column": 11 }, "end": { - "line": 100, + "line": 113, "column": 15 }, "identifierName": "left" @@ -3629,15 +4442,15 @@ "operator": "!==", "right": { "type": "NullLiteral", - "start": 2528, - "end": 2532, + "start": 2916, + "end": 2920, "loc": { "start": { - "line": 100, + "line": 113, "column": 20 }, "end": { - "line": 100, + "line": 113, "column": 24 } } @@ -3645,59 +4458,59 @@ }, "consequent": { "type": "BlockStatement", - "start": 2534, - "end": 2882, + "start": 2922, + "end": 3677, "loc": { "start": { - "line": 100, + "line": 113, "column": 26 }, "end": { - "line": 112, + "line": 142, "column": 3 } }, "body": [ { "type": "VariableDeclaration", - "start": 2587, - "end": 2618, + "start": 2964, + "end": 2995, "loc": { "start": { - "line": 102, + "line": 115, "column": 3 }, "end": { - "line": 102, + "line": 115, "column": 34 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 2593, - "end": 2617, + "start": 2970, + "end": 2994, "loc": { "start": { - "line": 102, + "line": 115, "column": 9 }, "end": { - "line": 102, + "line": 115, "column": 33 } }, "id": { "type": "Identifier", - "start": 2593, - "end": 2597, + "start": 2970, + "end": 2974, "loc": { "start": { - "line": 102, + "line": 115, "column": 9 }, "end": { - "line": 102, + "line": 115, "column": 13 }, "identifierName": "pred" @@ -3707,29 +4520,29 @@ }, "init": { "type": "CallExpression", - "start": 2600, - "end": 2617, + "start": 2977, + "end": 2994, "loc": { "start": { - "line": 102, + "line": 115, "column": 16 }, "end": { - "line": 102, + "line": 115, "column": 33 } }, "callee": { "type": "Identifier", - "start": 2600, - "end": 2611, + "start": 2977, + "end": 2988, "loc": { "start": { - "line": 102, + "line": 115, "column": 16 }, "end": { - "line": 102, + "line": 115, "column": 27 }, "identifierName": "predecessor" @@ -3739,15 +4552,15 @@ "arguments": [ { "type": "Identifier", - "start": 2612, - "end": 2616, + "start": 2989, + "end": 2993, "loc": { "start": { - "line": 102, + "line": 115, "column": 28 }, "end": { - "line": 102, + "line": 115, "column": 32 }, "identifierName": "node" @@ -3763,198 +4576,249 @@ "leadingComments": [ { "type": "CommentLine", - "value": " Replace node's key with predecessor's key", - "start": 2539, - "end": 2583, + "value": " Swap node with its predecessor", + "start": 2927, + "end": 2960, "loc": { "start": { - "line": 101, + "line": 114, "column": 3 }, "end": { - "line": 101, - "column": 47 + "line": 114, + "column": 36 } } } - ] - }, - { - "type": "ExpressionStatement", - "start": 2622, - "end": 2642, - "loc": { - "start": { - "line": 103, - "column": 3 + ], + "trailingComments": [ + { + "type": "CommentLine", + "value": " Delete predecessor node", + "start": 2999, + "end": 3025, + "loc": { + "start": { + "line": 116, + "column": 3 + }, + "end": { + "line": 116, + "column": 29 + } + } }, - "end": { - "line": 103, - "column": 23 - } - }, - "expression": { - "type": "AssignmentExpression", - "start": 2622, - "end": 2641, - "loc": { - "start": { - "line": 103, - "column": 3 - }, - "end": { - "line": 103, - "column": 22 + { + "type": "CommentLine", + "value": " NOTE: this node can have at most one non-leaf (left) child", + "start": 3029, + "end": 3090, + "loc": { + "start": { + "line": 117, + "column": 3 + }, + "end": { + "line": 117, + "column": 64 + } } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 2622, - "end": 2630, + { + "type": "CommentLine", + "value": " because of red-black tree invariant.", + "start": 3094, + "end": 3133, "loc": { "start": { - "line": 103, + "line": 118, "column": 3 }, "end": { - "line": 103, - "column": 11 + "line": 118, + "column": 42 } + } + } + ] + }, + { + "type": "ExpressionStatement", + "start": 3137, + "end": 3165, + "loc": { + "start": { + "line": 119, + "column": 3 + }, + "end": { + "line": 119, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 3137, + "end": 3164, + "loc": { + "start": { + "line": 119, + "column": 3 }, - "object": { - "type": "Identifier", - "start": 2622, - "end": 2626, - "loc": { - "start": { - "line": 103, - "column": 3 - }, - "end": { - "line": 103, - "column": 7 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 2627, - "end": 2630, - "loc": { - "start": { - "line": 103, - "column": 8 - }, - "end": { - "line": 103, - "column": 11 - }, - "identifierName": "key" - }, - "name": "key" - }, - "computed": false + "end": { + "line": 119, + "column": 30 + } }, - "right": { - "type": "MemberExpression", - "start": 2633, - "end": 2641, + "callee": { + "type": "Identifier", + "start": 3137, + "end": 3143, "loc": { "start": { - "line": 103, - "column": 14 + "line": 119, + "column": 3 }, "end": { - "line": 103, - "column": 22 - } + "line": 119, + "column": 9 + }, + "identifierName": "assert" }, - "object": { - "type": "Identifier", - "start": 2633, - "end": 2637, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 3144, + "end": 3163, "loc": { "start": { - "line": 103, - "column": 14 + "line": 119, + "column": 10 }, "end": { - "line": 103, - "column": 18 - }, - "identifierName": "pred" + "line": 119, + "column": 29 + } }, - "name": "pred" - }, - "property": { - "type": "Identifier", - "start": 2638, - "end": 2641, - "loc": { - "start": { - "line": 103, - "column": 19 + "left": { + "type": "MemberExpression", + "start": 3144, + "end": 3154, + "loc": { + "start": { + "line": 119, + "column": 10 + }, + "end": { + "line": 119, + "column": 20 + } }, - "end": { - "line": 103, - "column": 22 + "object": { + "type": "Identifier", + "start": 3144, + "end": 3148, + "loc": { + "start": { + "line": 119, + "column": 10 + }, + "end": { + "line": 119, + "column": 14 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 3149, + "end": 3154, + "loc": { + "start": { + "line": 119, + "column": 15 + }, + "end": { + "line": 119, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" }, - "identifierName": "key" + "computed": false }, - "name": "key" - }, - "computed": false - } + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 3159, + "end": 3163, + "loc": { + "start": { + "line": 119, + "column": 25 + }, + "end": { + "line": 119, + "column": 29 + } + } + } + } + ], + "leadingComments": null }, - "trailingComments": [ + "leadingComments": [ { "type": "CommentLine", "value": " Delete predecessor node", - "start": 2646, - "end": 2672, + "start": 2999, + "end": 3025, "loc": { "start": { - "line": 104, + "line": 116, "column": 3 }, "end": { - "line": 104, + "line": 116, "column": 29 } } }, { "type": "CommentLine", - "value": " NOTE: this node can only have one non-leaf (left) child because", - "start": 2676, - "end": 2742, + "value": " NOTE: this node can have at most one non-leaf (left) child", + "start": 3029, + "end": 3090, "loc": { "start": { - "line": 105, + "line": 117, "column": 3 }, "end": { - "line": 105, - "column": 69 + "line": 117, + "column": 64 } } }, { "type": "CommentLine", - "value": " of red-black tree invariant.", - "start": 2746, - "end": 2777, + "value": " because of red-black tree invariant.", + "start": 3094, + "end": 3133, "loc": { "start": { - "line": 106, + "line": 118, "column": 3 }, "end": { - "line": 106, - "column": 34 + "line": 118, + "column": 42 } } } @@ -3962,179 +4826,178 @@ }, { "type": "IfStatement", - "start": 2781, - "end": 2878, + "start": 3169, + "end": 3267, "loc": { "start": { - "line": 107, + "line": 120, "column": 3 }, "end": { - "line": 111, + "line": 124, "column": 4 } }, "test": { "type": "BinaryExpression", - "start": 2785, - "end": 2803, + "start": 3173, + "end": 3191, "loc": { "start": { - "line": 107, + "line": 120, "column": 7 }, "end": { - "line": 107, + "line": 120, "column": 25 } }, "left": { - "type": "MemberExpression", - "start": 2785, - "end": 2794, + "type": "Identifier", + "start": 3173, + "end": 3177, "loc": { "start": { - "line": 107, + "line": 120, "column": 7 }, "end": { - "line": 107, + "line": 120, + "column": 11 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 3182, + "end": 3191, + "loc": { + "start": { + "line": 120, "column": 16 + }, + "end": { + "line": 120, + "column": 25 } }, "object": { "type": "Identifier", - "start": 2785, - "end": 2789, + "start": 3182, + "end": 3186, "loc": { "start": { - "line": 107, - "column": 7 + "line": 120, + "column": 16 }, "end": { - "line": 107, - "column": 11 + "line": 120, + "column": 20 }, - "identifierName": "pred" + "identifierName": "node" }, - "name": "pred", - "leadingComments": null + "name": "node" }, "property": { "type": "Identifier", - "start": 2790, - "end": 2794, + "start": 3187, + "end": 3191, "loc": { "start": { - "line": 107, - "column": 12 + "line": 120, + "column": 21 }, "end": { - "line": 107, - "column": 16 + "line": 120, + "column": 25 }, "identifierName": "left" }, "name": "left" }, - "computed": false, - "leadingComments": null - }, - "operator": "===", - "right": { - "type": "NullLiteral", - "start": 2799, - "end": 2803, - "loc": { - "start": { - "line": 107, - "column": 21 - }, - "end": { - "line": 107, - "column": 25 - } - } - }, - "leadingComments": null + "computed": false + } }, "consequent": { "type": "BlockStatement", - "start": 2805, - "end": 2838, + "start": 3193, + "end": 3220, "loc": { "start": { - "line": 107, + "line": 120, "column": 27 }, "end": { - "line": 109, + "line": 122, "column": 4 } }, "body": [ { "type": "ExpressionStatement", - "start": 2811, - "end": 2833, + "start": 3199, + "end": 3215, "loc": { "start": { - "line": 108, + "line": 121, "column": 4 }, "end": { - "line": 108, - "column": 26 + "line": 121, + "column": 20 } }, "expression": { "type": "CallExpression", - "start": 2811, - "end": 2832, + "start": 3199, + "end": 3214, "loc": { "start": { - "line": 108, + "line": 121, "column": 4 }, "end": { - "line": 108, - "column": 25 + "line": 121, + "column": 19 } }, "callee": { "type": "Identifier", - "start": 2811, - "end": 2826, + "start": 3199, + "end": 3208, "loc": { "start": { - "line": 108, + "line": 121, "column": 4 }, "end": { - "line": 108, - "column": 19 + "line": 121, + "column": 13 }, - "identifierName": "delete_no_child" + "identifierName": "swap_left" }, - "name": "delete_no_child" + "name": "swap_left" }, "arguments": [ { "type": "Identifier", - "start": 2827, - "end": 2831, + "start": 3209, + "end": 3213, "loc": { "start": { - "line": 108, - "column": 20 + "line": 121, + "column": 14 }, "end": { - "line": 108, - "column": 24 + "line": 121, + "column": 18 }, - "identifierName": "pred" + "identifierName": "node" }, - "name": "pred" + "name": "node" } ] } @@ -4144,77 +5007,94 @@ }, "alternate": { "type": "BlockStatement", - "start": 2844, - "end": 2878, + "start": 3226, + "end": 3267, "loc": { "start": { - "line": 109, + "line": 122, "column": 10 }, "end": { - "line": 111, + "line": 124, "column": 4 } }, "body": [ { "type": "ExpressionStatement", - "start": 2850, - "end": 2873, + "start": 3232, + "end": 3262, "loc": { "start": { - "line": 110, + "line": 123, "column": 4 }, "end": { - "line": 110, - "column": 27 + "line": 123, + "column": 34 } }, "expression": { "type": "CallExpression", - "start": 2850, - "end": 2872, + "start": 3232, + "end": 3261, "loc": { "start": { - "line": 110, + "line": 123, "column": 4 }, "end": { - "line": 110, - "column": 26 + "line": 123, + "column": 33 } }, "callee": { "type": "Identifier", - "start": 2850, - "end": 2866, + "start": 3232, + "end": 3249, "loc": { "start": { - "line": 110, + "line": 123, "column": 4 }, "end": { - "line": 110, - "column": 20 + "line": 123, + "column": 21 }, - "identifierName": "delete_one_child" + "identifierName": "swap_non_adjacent" }, - "name": "delete_one_child" + "name": "swap_non_adjacent" }, "arguments": [ { "type": "Identifier", - "start": 2867, - "end": 2871, + "start": 3250, + "end": 3254, "loc": { "start": { - "line": 110, - "column": 21 + "line": 123, + "column": 22 }, "end": { - "line": 110, - "column": 25 + "line": 123, + "column": 26 + }, + "identifierName": "node" + }, + "name": "node" + }, + { + "type": "Identifier", + "start": 3256, + "end": 3260, + "loc": { + "start": { + "line": 123, + "column": 28 + }, + "end": { + "line": 123, + "column": 32 }, "identifierName": "pred" }, @@ -4225,244 +5105,94 @@ } ], "directives": [] - }, - "leadingComments": [ - { - "type": "CommentLine", - "value": " Delete predecessor node", - "start": 2646, - "end": 2672, - "loc": { - "start": { - "line": 104, - "column": 3 - }, - "end": { - "line": 104, - "column": 29 - } - } - }, - { - "type": "CommentLine", - "value": " NOTE: this node can only have one non-leaf (left) child because", - "start": 2676, - "end": 2742, - "loc": { - "start": { - "line": 105, - "column": 3 - }, - "end": { - "line": 105, - "column": 69 - } - } - }, - { - "type": "CommentLine", - "value": " of red-black tree invariant.", - "start": 2746, - "end": 2777, - "loc": { - "start": { - "line": 106, - "column": 3 - }, - "end": { - "line": 106, - "column": 34 - } - } - } - ] - } - ], - "directives": [] - }, - "alternate": { - "type": "IfStatement", - "start": 2888, - "end": 3283, - "loc": { - "start": { - "line": 112, - "column": 9 - }, - "end": { - "line": 124, - "column": 3 - } - }, - "test": { - "type": "BinaryExpression", - "start": 2892, - "end": 2911, - "loc": { - "start": { - "line": 112, - "column": 13 - }, - "end": { - "line": 112, - "column": 32 } }, - "left": { - "type": "MemberExpression", - "start": 2892, - "end": 2902, - "loc": { - "start": { - "line": 112, - "column": 13 - }, - "end": { - "line": 112, - "column": 23 - } - }, - "object": { - "type": "Identifier", - "start": 2892, - "end": 2896, - "loc": { - "start": { - "line": 112, - "column": 13 - }, - "end": { - "line": 112, - "column": 17 - }, - "identifierName": "node" - }, - "name": "node" - }, - "property": { - "type": "Identifier", - "start": 2897, - "end": 2902, - "loc": { - "start": { - "line": 112, - "column": 18 - }, - "end": { - "line": 112, - "column": 23 - }, - "identifierName": "right" - }, - "name": "right" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 2907, - "end": 2911, + { + "type": "ExpressionStatement", + "start": 3272, + "end": 3300, "loc": { "start": { - "line": 112, - "column": 28 + "line": 126, + "column": 3 }, "end": { - "line": 112, - "column": 32 + "line": 126, + "column": 31 } - } - } - }, - "consequent": { - "type": "BlockStatement", - "start": 2913, - "end": 3190, - "loc": { - "start": { - "line": 112, - "column": 34 }, - "end": { - "line": 120, - "column": 3 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 3084, - "end": 3108, + "expression": { + "type": "CallExpression", + "start": 3272, + "end": 3299, "loc": { "start": { - "line": 116, + "line": 126, "column": 3 }, "end": { - "line": 116, - "column": 27 + "line": 126, + "column": 30 } }, - "declarations": [ + "callee": { + "type": "Identifier", + "start": 3272, + "end": 3278, + "loc": { + "start": { + "line": 126, + "column": 3 + }, + "end": { + "line": 126, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ { - "type": "VariableDeclarator", - "start": 3090, - "end": 3107, + "type": "BinaryExpression", + "start": 3279, + "end": 3298, "loc": { "start": { - "line": 116, - "column": 9 + "line": 126, + "column": 10 }, "end": { - "line": 116, - "column": 26 + "line": 126, + "column": 29 } }, - "id": { - "type": "Identifier", - "start": 3090, - "end": 3094, - "loc": { - "start": { - "line": 116, - "column": 9 - }, - "end": { - "line": 116, - "column": 13 - }, - "identifierName": "succ" - }, - "name": "succ", - "leadingComments": null - }, - "init": { + "left": { "type": "MemberExpression", - "start": 3097, - "end": 3107, + "start": 3279, + "end": 3289, "loc": { "start": { - "line": 116, - "column": 16 + "line": 126, + "column": 10 }, "end": { - "line": 116, - "column": 26 + "line": 126, + "column": 20 } }, "object": { "type": "Identifier", - "start": 3097, - "end": 3101, + "start": 3279, + "end": 3283, "loc": { "start": { - "line": 116, - "column": 16 + "line": 126, + "column": 10 }, "end": { - "line": 116, - "column": 20 + "line": 126, + "column": 14 }, "identifierName": "node" }, @@ -4470,16 +5200,16 @@ }, "property": { "type": "Identifier", - "start": 3102, - "end": 3107, + "start": 3284, + "end": 3289, "loc": { "start": { - "line": 116, - "column": 21 + "line": 126, + "column": 15 }, "end": { - "line": 116, - "column": 26 + "line": 126, + "column": 20 }, "identifierName": "right" }, @@ -4487,2248 +5217,3746 @@ }, "computed": false }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [ - { - "type": "CommentLine", - "value": " Replace node's key with successor's key", - "start": 2918, - "end": 2960, - "loc": { - "start": { - "line": 113, - "column": 3 - }, - "end": { - "line": 113, - "column": 45 - } - } - }, - { - "type": "CommentLine", - "value": " NOTE: Since there is no left child, then there can only be one", - "start": 2964, - "end": 3029, - "loc": { - "start": { - "line": 114, - "column": 3 - }, - "end": { - "line": 114, - "column": 68 - } - } - }, - { - "type": "CommentLine", - "value": " right child by the red-black tree invariant.", - "start": 3033, - "end": 3080, - "loc": { - "start": { - "line": 115, - "column": 3 - }, - "end": { - "line": 115, - "column": 50 + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 3294, + "end": 3298, + "loc": { + "start": { + "line": 126, + "column": 25 + }, + "end": { + "line": 126, + "column": 29 + } } } } ] + } + }, + { + "type": "IfStatement", + "start": 3304, + "end": 3673, + "loc": { + "start": { + "line": 127, + "column": 3 + }, + "end": { + "line": 141, + "column": 4 + } }, - { - "type": "ExpressionStatement", - "start": 3112, - "end": 3132, + "test": { + "type": "BinaryExpression", + "start": 3308, + "end": 3326, "loc": { "start": { - "line": 117, - "column": 3 + "line": 127, + "column": 7 }, "end": { - "line": 117, - "column": 23 + "line": 127, + "column": 25 } }, - "expression": { - "type": "AssignmentExpression", - "start": 3112, - "end": 3131, + "left": { + "type": "MemberExpression", + "start": 3308, + "end": 3317, "loc": { "start": { - "line": 117, - "column": 3 + "line": 127, + "column": 7 }, "end": { - "line": 117, - "column": 22 + "line": 127, + "column": 16 } }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 3112, - "end": 3120, + "object": { + "type": "Identifier", + "start": 3308, + "end": 3312, "loc": { "start": { - "line": 117, - "column": 3 + "line": 127, + "column": 7 }, "end": { - "line": 117, + "line": 127, "column": 11 - } + }, + "identifierName": "node" }, - "object": { - "type": "Identifier", - "start": 3112, - "end": 3116, - "loc": { - "start": { - "line": 117, - "column": 3 + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 3313, + "end": 3317, + "loc": { + "start": { + "line": 127, + "column": 12 + }, + "end": { + "line": 127, + "column": 16 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 3322, + "end": 3326, + "loc": { + "start": { + "line": 127, + "column": 21 + }, + "end": { + "line": 127, + "column": 25 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 3328, + "end": 3539, + "loc": { + "start": { + "line": 127, + "column": 27 + }, + "end": { + "line": 135, + "column": 4 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 3334, + "end": 3372, + "loc": { + "start": { + "line": 128, + "column": 4 + }, + "end": { + "line": 128, + "column": 42 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 3340, + "end": 3371, + "loc": { + "start": { + "line": 128, + "column": 10 + }, + "end": { + "line": 128, + "column": 41 + } }, - "end": { - "line": 117, - "column": 7 + "id": { + "type": "Identifier", + "start": 3340, + "end": 3347, + "loc": { + "start": { + "line": 128, + "column": 10 + }, + "end": { + "line": 128, + "column": 17 + }, + "identifierName": "subtree" + }, + "name": "subtree" }, - "identifierName": "node" + "init": { + "type": "CallExpression", + "start": 3350, + "end": 3371, + "loc": { + "start": { + "line": 128, + "column": 20 + }, + "end": { + "line": 128, + "column": 41 + } + }, + "callee": { + "type": "Identifier", + "start": 3350, + "end": 3365, + "loc": { + "start": { + "line": 128, + "column": 20 + }, + "end": { + "line": 128, + "column": 35 + }, + "identifierName": "delete_no_child" + }, + "name": "delete_no_child" + }, + "arguments": [ + { + "type": "Identifier", + "start": 3366, + "end": 3370, + "loc": { + "start": { + "line": 128, + "column": 36 + }, + "end": { + "line": 128, + "column": 40 + }, + "identifierName": "node" + }, + "name": "node" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 3377, + "end": 3534, + "loc": { + "start": { + "line": 129, + "column": 4 }, - "name": "node" + "end": { + "line": 134, + "column": 5 + } }, - "property": { - "type": "Identifier", - "start": 3117, - "end": 3120, + "test": { + "type": "BinaryExpression", + "start": 3381, + "end": 3404, "loc": { "start": { - "line": 117, + "line": 129, "column": 8 }, "end": { - "line": 117, - "column": 11 - }, - "identifierName": "key" + "line": 129, + "column": 31 + } }, - "name": "key" - }, - "computed": false - }, - "right": { - "type": "MemberExpression", - "start": 3123, - "end": 3131, - "loc": { - "start": { - "line": 117, - "column": 14 + "left": { + "type": "MemberExpression", + "start": 3381, + "end": 3395, + "loc": { + "start": { + "line": 129, + "column": 8 + }, + "end": { + "line": 129, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 3381, + "end": 3388, + "loc": { + "start": { + "line": 129, + "column": 8 + }, + "end": { + "line": 129, + "column": 15 + }, + "identifierName": "subtree" + }, + "name": "subtree" + }, + "property": { + "type": "Identifier", + "start": 3389, + "end": 3395, + "loc": { + "start": { + "line": 129, + "column": 16 + }, + "end": { + "line": 129, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false }, - "end": { - "line": 117, - "column": 22 + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 3400, + "end": 3404, + "loc": { + "start": { + "line": 129, + "column": 27 + }, + "end": { + "line": 129, + "column": 31 + } + } } }, - "object": { - "type": "Identifier", - "start": 3123, - "end": 3127, + "consequent": { + "type": "BlockStatement", + "start": 3406, + "end": 3439, "loc": { "start": { - "line": 117, - "column": 14 + "line": 129, + "column": 33 }, "end": { - "line": 117, - "column": 18 - }, - "identifierName": "succ" + "line": 131, + "column": 5 + } }, - "name": "succ" + "body": [ + { + "type": "ExpressionStatement", + "start": 3413, + "end": 3433, + "loc": { + "start": { + "line": 130, + "column": 5 + }, + "end": { + "line": 130, + "column": 25 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 3413, + "end": 3432, + "loc": { + "start": { + "line": 130, + "column": 5 + }, + "end": { + "line": 130, + "column": 24 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 3413, + "end": 3422, + "loc": { + "start": { + "line": 130, + "column": 5 + }, + "end": { + "line": 130, + "column": 14 + } + }, + "object": { + "type": "ThisExpression", + "start": 3413, + "end": 3417, + "loc": { + "start": { + "line": 130, + "column": 5 + }, + "end": { + "line": 130, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "start": 3418, + "end": 3422, + "loc": { + "start": { + "line": 130, + "column": 10 + }, + "end": { + "line": 130, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 3425, + "end": 3432, + "loc": { + "start": { + "line": 130, + "column": 17 + }, + "end": { + "line": 130, + "column": 24 + }, + "identifierName": "subtree" + }, + "name": "subtree" + } + } + } + ], + "directives": [] }, - "property": { - "type": "Identifier", - "start": 3128, - "end": 3131, + "alternate": { + "type": "IfStatement", + "start": 3445, + "end": 3534, "loc": { "start": { - "line": 117, - "column": 19 + "line": 131, + "column": 11 }, "end": { - "line": 117, - "column": 22 + "line": 134, + "column": 5 + } + }, + "test": { + "type": "BinaryExpression", + "start": 3449, + "end": 3469, + "loc": { + "start": { + "line": 131, + "column": 15 + }, + "end": { + "line": 131, + "column": 35 + } }, - "identifierName": "key" + "left": { + "type": "MemberExpression", + "start": 3449, + "end": 3460, + "loc": { + "start": { + "line": 131, + "column": 15 + }, + "end": { + "line": 131, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 3449, + "end": 3453, + "loc": { + "start": { + "line": 131, + "column": 15 + }, + "end": { + "line": 131, + "column": 19 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 3454, + "end": 3460, + "loc": { + "start": { + "line": 131, + "column": 20 + }, + "end": { + "line": 131, + "column": 26 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 3465, + "end": 3469, + "loc": { + "start": { + "line": 131, + "column": 31 + }, + "end": { + "line": 131, + "column": 35 + } + } + } }, - "name": "key" - }, - "computed": false - } - }, - "trailingComments": [ - { - "type": "CommentLine", - "value": " Delete successor node", - "start": 3136, - "end": 3160, - "loc": { - "start": { - "line": 118, - "column": 3 + "consequent": { + "type": "BlockStatement", + "start": 3471, + "end": 3534, + "loc": { + "start": { + "line": 131, + "column": 37 + }, + "end": { + "line": 134, + "column": 5 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 3478, + "end": 3505, + "loc": { + "start": { + "line": 132, + "column": 5 + }, + "end": { + "line": 132, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 3478, + "end": 3504, + "loc": { + "start": { + "line": 132, + "column": 5 + }, + "end": { + "line": 132, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 3478, + "end": 3484, + "loc": { + "start": { + "line": 132, + "column": 5 + }, + "end": { + "line": 132, + "column": 11 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 3485, + "end": 3503, + "loc": { + "start": { + "line": 132, + "column": 12 + }, + "end": { + "line": 132, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 3485, + "end": 3489, + "loc": { + "start": { + "line": 132, + "column": 12 + }, + "end": { + "line": 132, + "column": 16 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 3494, + "end": 3503, + "loc": { + "start": { + "line": 132, + "column": 21 + }, + "end": { + "line": 132, + "column": 30 + } + }, + "object": { + "type": "ThisExpression", + "start": 3494, + "end": 3498, + "loc": { + "start": { + "line": 132, + "column": 21 + }, + "end": { + "line": 132, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "start": 3499, + "end": 3503, + "loc": { + "start": { + "line": 132, + "column": 26 + }, + "end": { + "line": 132, + "column": 30 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 3511, + "end": 3528, + "loc": { + "start": { + "line": 133, + "column": 5 + }, + "end": { + "line": 133, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 3511, + "end": 3527, + "loc": { + "start": { + "line": 133, + "column": 5 + }, + "end": { + "line": 133, + "column": 21 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 3511, + "end": 3520, + "loc": { + "start": { + "line": 133, + "column": 5 + }, + "end": { + "line": 133, + "column": 14 + } + }, + "object": { + "type": "ThisExpression", + "start": 3511, + "end": 3515, + "loc": { + "start": { + "line": 133, + "column": 5 + }, + "end": { + "line": 133, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "start": 3516, + "end": 3520, + "loc": { + "start": { + "line": 133, + "column": 10 + }, + "end": { + "line": 133, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 3523, + "end": 3527, + "loc": { + "start": { + "line": 133, + "column": 17 + }, + "end": { + "line": 133, + "column": 21 + }, + "identifierName": "pred" + }, + "name": "pred" + } + } + } + ], + "directives": [] }, - "end": { - "line": 118, - "column": 27 - } + "alternate": null } } - ] + ], + "directives": [] }, - { - "type": "ExpressionStatement", - "start": 3164, - "end": 3186, + "alternate": { + "type": "BlockStatement", + "start": 3545, + "end": 3673, "loc": { "start": { - "line": 119, - "column": 3 + "line": 135, + "column": 10 }, "end": { - "line": 119, - "column": 25 + "line": 141, + "column": 4 } }, - "expression": { - "type": "CallExpression", - "start": 3164, - "end": 3185, - "loc": { - "start": { - "line": 119, - "column": 3 - }, - "end": { - "line": 119, - "column": 24 - } - }, - "callee": { - "type": "Identifier", - "start": 3164, - "end": 3179, + "body": [ + { + "type": "ExpressionStatement", + "start": 3551, + "end": 3574, "loc": { "start": { - "line": 119, - "column": 3 + "line": 136, + "column": 4 }, "end": { - "line": 119, - "column": 18 - }, - "identifierName": "delete_no_child" + "line": 136, + "column": 27 + } }, - "name": "delete_no_child", - "leadingComments": null - }, - "arguments": [ - { - "type": "Identifier", - "start": 3180, - "end": 3184, + "expression": { + "type": "CallExpression", + "start": 3551, + "end": 3573, "loc": { "start": { - "line": 119, - "column": 19 + "line": 136, + "column": 4 }, "end": { - "line": 119, - "column": 23 - }, - "identifierName": "succ" + "line": 136, + "column": 26 + } }, - "name": "succ" - } - ], - "leadingComments": null - }, - "leadingComments": [ + "callee": { + "type": "Identifier", + "start": 3551, + "end": 3567, + "loc": { + "start": { + "line": 136, + "column": 4 + }, + "end": { + "line": 136, + "column": 20 + }, + "identifierName": "delete_one_child" + }, + "name": "delete_one_child" + }, + "arguments": [ + { + "type": "Identifier", + "start": 3568, + "end": 3572, + "loc": { + "start": { + "line": 136, + "column": 21 + }, + "end": { + "line": 136, + "column": 25 + }, + "identifierName": "node" + }, + "name": "node" + } + ] + } + }, { - "type": "CommentLine", - "value": " Delete successor node", - "start": 3136, - "end": 3160, + "type": "IfStatement", + "start": 3579, + "end": 3668, "loc": { "start": { - "line": 118, - "column": 3 + "line": 137, + "column": 4 }, "end": { - "line": 118, - "column": 27 + "line": 140, + "column": 5 } - } + }, + "test": { + "type": "BinaryExpression", + "start": 3583, + "end": 3603, + "loc": { + "start": { + "line": 137, + "column": 8 + }, + "end": { + "line": 137, + "column": 28 + } + }, + "left": { + "type": "MemberExpression", + "start": 3583, + "end": 3594, + "loc": { + "start": { + "line": 137, + "column": 8 + }, + "end": { + "line": 137, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 3583, + "end": 3587, + "loc": { + "start": { + "line": 137, + "column": 8 + }, + "end": { + "line": 137, + "column": 12 + }, + "identifierName": "pred" + }, + "name": "pred" + }, + "property": { + "type": "Identifier", + "start": 3588, + "end": 3594, + "loc": { + "start": { + "line": 137, + "column": 13 + }, + "end": { + "line": 137, + "column": 19 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 3599, + "end": 3603, + "loc": { + "start": { + "line": 137, + "column": 24 + }, + "end": { + "line": 137, + "column": 28 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 3605, + "end": 3668, + "loc": { + "start": { + "line": 137, + "column": 30 + }, + "end": { + "line": 140, + "column": 5 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 3612, + "end": 3639, + "loc": { + "start": { + "line": 138, + "column": 5 + }, + "end": { + "line": 138, + "column": 32 + } + }, + "expression": { + "type": "CallExpression", + "start": 3612, + "end": 3638, + "loc": { + "start": { + "line": 138, + "column": 5 + }, + "end": { + "line": 138, + "column": 31 + } + }, + "callee": { + "type": "Identifier", + "start": 3612, + "end": 3618, + "loc": { + "start": { + "line": 138, + "column": 5 + }, + "end": { + "line": 138, + "column": 11 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 3619, + "end": 3637, + "loc": { + "start": { + "line": 138, + "column": 12 + }, + "end": { + "line": 138, + "column": 30 + } + }, + "left": { + "type": "Identifier", + "start": 3619, + "end": 3623, + "loc": { + "start": { + "line": 138, + "column": 12 + }, + "end": { + "line": 138, + "column": 16 + }, + "identifierName": "node" + }, + "name": "node" + }, + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 3628, + "end": 3637, + "loc": { + "start": { + "line": 138, + "column": 21 + }, + "end": { + "line": 138, + "column": 30 + } + }, + "object": { + "type": "ThisExpression", + "start": 3628, + "end": 3632, + "loc": { + "start": { + "line": 138, + "column": 21 + }, + "end": { + "line": 138, + "column": 25 + } + } + }, + "property": { + "type": "Identifier", + "start": 3633, + "end": 3637, + "loc": { + "start": { + "line": 138, + "column": 26 + }, + "end": { + "line": 138, + "column": 30 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 3645, + "end": 3662, + "loc": { + "start": { + "line": 139, + "column": 5 + }, + "end": { + "line": 139, + "column": 22 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 3645, + "end": 3661, + "loc": { + "start": { + "line": 139, + "column": 5 + }, + "end": { + "line": 139, + "column": 21 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 3645, + "end": 3654, + "loc": { + "start": { + "line": 139, + "column": 5 + }, + "end": { + "line": 139, + "column": 14 + } + }, + "object": { + "type": "ThisExpression", + "start": 3645, + "end": 3649, + "loc": { + "start": { + "line": 139, + "column": 5 + }, + "end": { + "line": 139, + "column": 9 + } + } + }, + "property": { + "type": "Identifier", + "start": 3650, + "end": 3654, + "loc": { + "start": { + "line": 139, + "column": 10 + }, + "end": { + "line": 139, + "column": 14 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 3657, + "end": 3661, + "loc": { + "start": { + "line": 139, + "column": 17 + }, + "end": { + "line": 139, + "column": 21 + }, + "identifierName": "pred" + }, + "name": "pred" + } + } + } + ], + "directives": [] + }, + "alternate": null } - ] + ], + "directives": [] } - ], - "directives": [] + } + ], + "directives": [] + }, + "alternate": { + "type": "IfStatement", + "start": 3683, + "end": 5063, + "loc": { + "start": { + "line": 142, + "column": 9 + }, + "end": { + "line": 188, + "column": 3 + } }, - "alternate": { - "type": "IfStatement", - "start": 3196, - "end": 3283, + "test": { + "type": "BinaryExpression", + "start": 3687, + "end": 3706, "loc": { "start": { - "line": 120, - "column": 9 + "line": 142, + "column": 13 }, "end": { - "line": 124, - "column": 3 + "line": 142, + "column": 32 } }, - "test": { - "type": "BinaryExpression", - "start": 3200, - "end": 3218, + "left": { + "type": "MemberExpression", + "start": 3687, + "end": 3697, "loc": { "start": { - "line": 120, + "line": 142, "column": 13 }, "end": { - "line": 120, - "column": 31 + "line": 142, + "column": 23 } }, - "left": { + "object": { "type": "Identifier", - "start": 3200, - "end": 3204, + "start": 3687, + "end": 3691, "loc": { "start": { - "line": 120, + "line": 142, "column": 13 }, "end": { - "line": 120, + "line": 142, "column": 17 }, "identifierName": "node" }, "name": "node" }, - "operator": "===", - "right": { - "type": "MemberExpression", - "start": 3209, - "end": 3218, + "property": { + "type": "Identifier", + "start": 3692, + "end": 3697, "loc": { "start": { - "line": 120, - "column": 22 + "line": 142, + "column": 18 }, "end": { - "line": 120, - "column": 31 - } - }, - "object": { - "type": "ThisExpression", - "start": 3209, - "end": 3213, - "loc": { - "start": { - "line": 120, - "column": 22 - }, - "end": { - "line": 120, - "column": 26 - } - } - }, - "property": { - "type": "Identifier", - "start": 3214, - "end": 3218, - "loc": { - "start": { - "line": 120, - "column": 27 - }, - "end": { - "line": 120, - "column": 31 - }, - "identifierName": "root" + "line": 142, + "column": 23 }, - "name": "root" + "identifierName": "right" }, - "computed": false - } + "name": "right" + }, + "computed": false }, - "consequent": { - "type": "BlockStatement", - "start": 3220, - "end": 3246, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 3702, + "end": 3706, "loc": { "start": { - "line": 120, - "column": 33 + "line": 142, + "column": 28 }, "end": { - "line": 122, - "column": 3 + "line": 142, + "column": 32 } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 3708, + "end": 4697, + "loc": { + "start": { + "line": 142, + "column": 34 }, - "body": [ - { - "type": "ExpressionStatement", - "start": 3225, - "end": 3242, + "end": { + "line": 175, + "column": 3 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 4426, + "end": 4453, + "loc": { + "start": { + "line": 164, + "column": 3 + }, + "end": { + "line": 164, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 4426, + "end": 4452, "loc": { "start": { - "line": 121, + "line": 164, "column": 3 }, "end": { - "line": 121, - "column": 20 + "line": 164, + "column": 29 } }, - "expression": { - "type": "AssignmentExpression", - "start": 3225, - "end": 3241, + "callee": { + "type": "Identifier", + "start": 4426, + "end": 4432, "loc": { "start": { - "line": 121, + "line": 164, "column": 3 }, "end": { - "line": 121, - "column": 19 - } + "line": 164, + "column": 9 + }, + "identifierName": "assert" }, - "operator": "=", - "left": { - "type": "MemberExpression", - "start": 3225, - "end": 3234, + "name": "assert", + "leadingComments": null + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 4433, + "end": 4451, "loc": { "start": { - "line": 121, - "column": 3 + "line": 164, + "column": 10 }, "end": { - "line": 121, - "column": 12 + "line": 164, + "column": 28 } }, - "object": { - "type": "ThisExpression", - "start": 3225, - "end": 3229, + "left": { + "type": "MemberExpression", + "start": 4433, + "end": 4442, "loc": { "start": { - "line": 121, - "column": 3 + "line": 164, + "column": 10 }, "end": { - "line": 121, - "column": 7 + "line": 164, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 4433, + "end": 4437, + "loc": { + "start": { + "line": 164, + "column": 10 + }, + "end": { + "line": 164, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 4438, + "end": 4442, + "loc": { + "start": { + "line": 164, + "column": 15 + }, + "end": { + "line": 164, + "column": 19 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 4447, + "end": 4451, + "loc": { + "start": { + "line": 164, + "column": 24 + }, + "end": { + "line": 164, + "column": 28 } } + } + } + ], + "leadingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t\t\t * Swap node with its successor.\n\t\t\t *\n\t\t\t * NOTE: Since pred is a leaf, there can only by one node in the\n\t\t\t * right subtree, succ, which is necessarily red, hence\n\t\t\t * node is black.\n\t\t\t *\n\t\t\t * The configuration:\n\t\t\t *\n\t\t\t * (A) (B) (C)\n\t\t\t *\n\t\t\t * p p p\n\t\t\t * | | |\n\t\t\t * node (BLACK) succ (BLACK) succ (BLACK)\n\t\t\t * / \\ / \\ / \\\n\t\t\t * - succ (RED) -> - node (RED) -> - -\n\t\t\t * / \\ / \\\n\t\t\t * - - - -\n\t\t\t *\n\t\t\t * NOTE: We take a shortcut and go directly from (A) to (C)\n\t\t\t ", + "start": 3713, + "end": 4422, + "loc": { + "start": { + "line": 143, + "column": 3 + }, + "end": { + "line": 163, + "column": 6 + } + } + } + ] + }, + { + "type": "VariableDeclaration", + "start": 4457, + "end": 4481, + "loc": { + "start": { + "line": 165, + "column": 3 + }, + "end": { + "line": 165, + "column": 27 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4463, + "end": 4480, + "loc": { + "start": { + "line": 165, + "column": 9 + }, + "end": { + "line": 165, + "column": 26 + } + }, + "id": { + "type": "Identifier", + "start": 4463, + "end": 4467, + "loc": { + "start": { + "line": 165, + "column": 9 + }, + "end": { + "line": 165, + "column": 13 + }, + "identifierName": "succ" + }, + "name": "succ" + }, + "init": { + "type": "MemberExpression", + "start": 4470, + "end": 4480, + "loc": { + "start": { + "line": 165, + "column": 16 + }, + "end": { + "line": 165, + "column": 26 + } + }, + "object": { + "type": "Identifier", + "start": 4470, + "end": 4474, + "loc": { + "start": { + "line": 165, + "column": 16 + }, + "end": { + "line": 165, + "column": 20 + }, + "identifierName": "node" + }, + "name": "node" }, "property": { "type": "Identifier", - "start": 3230, - "end": 3234, + "start": 4475, + "end": 4480, "loc": { "start": { - "line": 121, - "column": 8 + "line": 165, + "column": 21 }, "end": { - "line": 121, - "column": 12 + "line": 165, + "column": 26 }, - "identifierName": "root" + "identifierName": "right" }, - "name": "root" + "name": "right" }, "computed": false + } + } + ], + "kind": "const" + }, + { + "type": "ExpressionStatement", + "start": 4485, + "end": 4513, + "loc": { + "start": { + "line": 166, + "column": 3 + }, + "end": { + "line": 166, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 4485, + "end": 4512, + "loc": { + "start": { + "line": 166, + "column": 3 }, - "right": { - "type": "NullLiteral", - "start": 3237, - "end": 3241, + "end": { + "line": 166, + "column": 30 + } + }, + "callee": { + "type": "Identifier", + "start": 4485, + "end": 4491, + "loc": { + "start": { + "line": 166, + "column": 3 + }, + "end": { + "line": 166, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 4492, + "end": 4511, "loc": { "start": { - "line": 121, - "column": 15 + "line": 166, + "column": 10 }, "end": { - "line": 121, - "column": 19 + "line": 166, + "column": 29 } + }, + "left": { + "type": "MemberExpression", + "start": 4492, + "end": 4503, + "loc": { + "start": { + "line": 166, + "column": 10 + }, + "end": { + "line": 166, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 4492, + "end": 4496, + "loc": { + "start": { + "line": 166, + "column": 10 + }, + "end": { + "line": 166, + "column": 14 + }, + "identifierName": "succ" + }, + "name": "succ" + }, + "property": { + "type": "Identifier", + "start": 4497, + "end": 4503, + "loc": { + "start": { + "line": 166, + "column": 15 + }, + "end": { + "line": 166, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 4508, + "end": 4511, + "loc": { + "start": { + "line": 166, + "column": 26 + }, + "end": { + "line": 166, + "column": 29 + }, + "identifierName": "RED" + }, + "name": "RED" } } - } - } - ], - "directives": [] - }, - "alternate": { - "type": "BlockStatement", - "start": 3252, - "end": 3283, - "loc": { - "start": { - "line": 122, - "column": 9 - }, - "end": { - "line": 124, - "column": 3 + ] } }, - "body": [ - { - "type": "ExpressionStatement", - "start": 3257, - "end": 3279, + { + "type": "ExpressionStatement", + "start": 4517, + "end": 4537, + "loc": { + "start": { + "line": 167, + "column": 3 + }, + "end": { + "line": 167, + "column": 23 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 4517, + "end": 4536, "loc": { "start": { - "line": 123, + "line": 167, "column": 3 }, "end": { - "line": 123, - "column": 25 + "line": 167, + "column": 22 } }, - "expression": { - "type": "CallExpression", - "start": 3257, - "end": 3278, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 4517, + "end": 4528, "loc": { "start": { - "line": 123, + "line": 167, "column": 3 }, "end": { - "line": 123, - "column": 24 + "line": 167, + "column": 14 } }, - "callee": { + "object": { "type": "Identifier", - "start": 3257, - "end": 3272, + "start": 4517, + "end": 4521, "loc": { "start": { - "line": 123, + "line": 167, "column": 3 }, "end": { - "line": 123, - "column": 18 + "line": 167, + "column": 7 }, - "identifierName": "delete_no_child" + "identifierName": "succ" }, - "name": "delete_no_child" + "name": "succ" }, - "arguments": [ - { - "type": "Identifier", - "start": 3273, - "end": 3277, - "loc": { - "start": { - "line": 123, - "column": 19 - }, - "end": { - "line": 123, - "column": 23 - }, - "identifierName": "node" - }, - "name": "node" - } - ] + "property": { + "type": "Identifier", + "start": 4522, + "end": 4528, + "loc": { + "start": { + "line": 167, + "column": 8 + }, + "end": { + "line": 167, + "column": 14 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 4531, + "end": 4536, + "loc": { + "start": { + "line": 167, + "column": 17 + }, + "end": { + "line": 167, + "column": 22 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" } } - ], - "directives": [] - } - } - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2353, - "end": 2458, - "loc": { - "start": { - "line": 93, - "column": 1 - }, - "end": { - "line": 97, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 3289, - "end": 3701, - "loc": { - "start": { - "line": 127, - "column": 1 - }, - "end": { - "line": 135, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 3703, - "end": 3826, - "loc": { - "start": { - "line": 136, - "column": 1 - }, - "end": { - "line": 142, - "column": 2 - } - }, - "static": false, - "computed": false, - "key": { - "type": "Identifier", - "start": 3703, - "end": 3709, - "loc": { - "start": { - "line": 136, - "column": 1 - }, - "end": { - "line": 136, - "column": 7 - }, - "identifierName": "remove" - }, - "name": "remove", - "leadingComments": null - }, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 3710, - "end": 3713, - "loc": { - "start": { - "line": 136, - "column": 8 - }, - "end": { - "line": 136, - "column": 11 - }, - "identifierName": "key" - }, - "name": "key" - } - ], - "body": { - "type": "BlockStatement", - "start": 3715, - "end": 3826, - "loc": { - "start": { - "line": 136, - "column": 13 - }, - "end": { - "line": 142, - "column": 2 - } - }, - "body": [ - { - "type": "VariableDeclaration", - "start": 3719, - "end": 3750, - "loc": { - "start": { - "line": 137, - "column": 2 - }, - "end": { - "line": 137, - "column": 33 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 3725, - "end": 3749, - "loc": { - "start": { - "line": 137, - "column": 8 - }, - "end": { - "line": 137, - "column": 32 - } - }, - "id": { - "type": "Identifier", - "start": 3725, - "end": 3729, - "loc": { - "start": { - "line": 137, - "column": 8 - }, - "end": { - "line": 137, - "column": 12 - }, - "identifierName": "node" - }, - "name": "node" - }, - "init": { - "type": "CallExpression", - "start": 3732, - "end": 3749, - "loc": { - "start": { - "line": 137, - "column": 15 - }, - "end": { - "line": 137, - "column": 32 - } }, - "callee": { - "type": "MemberExpression", - "start": 3732, - "end": 3744, + { + "type": "IfStatement", + "start": 4541, + "end": 4693, "loc": { "start": { - "line": 137, - "column": 15 + "line": 168, + "column": 3 }, "end": { - "line": 137, - "column": 27 + "line": 174, + "column": 4 } }, - "object": { - "type": "ThisExpression", - "start": 3732, - "end": 3736, + "test": { + "type": "BinaryExpression", + "start": 4545, + "end": 4563, "loc": { "start": { - "line": 137, - "column": 15 + "line": 168, + "column": 7 }, "end": { - "line": 137, - "column": 19 + "line": 168, + "column": 25 } - } - }, - "property": { - "type": "Identifier", - "start": 3737, - "end": 3744, - "loc": { - "start": { - "line": 137, - "column": 20 - }, - "end": { - "line": 137, - "column": 27 + }, + "left": { + "type": "Identifier", + "start": 4545, + "end": 4549, + "loc": { + "start": { + "line": 168, + "column": 7 + }, + "end": { + "line": 168, + "column": 11 + }, + "identifierName": "node" }, - "identifierName": "_search" + "name": "node" }, - "name": "_search" + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 4554, + "end": 4563, + "loc": { + "start": { + "line": 168, + "column": 16 + }, + "end": { + "line": 168, + "column": 25 + } + }, + "object": { + "type": "ThisExpression", + "start": 4554, + "end": 4558, + "loc": { + "start": { + "line": 168, + "column": 16 + }, + "end": { + "line": 168, + "column": 20 + } + } + }, + "property": { + "type": "Identifier", + "start": 4559, + "end": 4563, + "loc": { + "start": { + "line": 168, + "column": 21 + }, + "end": { + "line": 168, + "column": 25 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + } }, - "computed": false - }, - "arguments": [ - { - "type": "Identifier", - "start": 3745, - "end": 3748, + "consequent": { + "type": "BlockStatement", + "start": 4565, + "end": 4651, "loc": { "start": { - "line": 137, - "column": 28 + "line": 168, + "column": 27 }, "end": { - "line": 137, - "column": 31 - }, - "identifierName": "key" + "line": 172, + "column": 4 + } }, - "name": "key" - } - ] - } - } - ], - "kind": "const" - }, - { - "type": "IfStatement", - "start": 3753, - "end": 3785, - "loc": { - "start": { - "line": 138, - "column": 2 - }, - "end": { - "line": 138, - "column": 34 - } - }, - "test": { - "type": "BinaryExpression", - "start": 3757, - "end": 3770, - "loc": { - "start": { - "line": 138, - "column": 6 - }, - "end": { - "line": 138, - "column": 19 - } - }, - "left": { - "type": "Identifier", - "start": 3757, - "end": 3761, - "loc": { - "start": { - "line": 138, - "column": 6 - }, - "end": { - "line": 138, - "column": 10 - }, - "identifierName": "node" - }, - "name": "node" - }, - "operator": "===", - "right": { - "type": "NullLiteral", - "start": 3766, - "end": 3770, - "loc": { - "start": { - "line": 138, - "column": 15 - }, - "end": { - "line": 138, - "column": 19 - } - } - } - }, - "consequent": { - "type": "ReturnStatement", - "start": 3772, - "end": 3785, - "loc": { - "start": { - "line": 138, - "column": 21 - }, - "end": { - "line": 138, - "column": 34 - } - }, - "argument": { - "type": "BooleanLiteral", - "start": 3779, - "end": 3784, - "loc": { - "start": { - "line": 138, - "column": 28 - }, - "end": { - "line": 138, - "column": 33 + "body": [ + { + "type": "ExpressionStatement", + "start": 4571, + "end": 4600, + "loc": { + "start": { + "line": 169, + "column": 4 + }, + "end": { + "line": 169, + "column": 33 + } + }, + "expression": { + "type": "CallExpression", + "start": 4571, + "end": 4599, + "loc": { + "start": { + "line": 169, + "column": 4 + }, + "end": { + "line": 169, + "column": 32 + } + }, + "callee": { + "type": "Identifier", + "start": 4571, + "end": 4577, + "loc": { + "start": { + "line": 169, + "column": 4 + }, + "end": { + "line": 169, + "column": 10 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 4578, + "end": 4598, + "loc": { + "start": { + "line": 169, + "column": 11 + }, + "end": { + "line": 169, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 4578, + "end": 4589, + "loc": { + "start": { + "line": 169, + "column": 11 + }, + "end": { + "line": 169, + "column": 22 + } + }, + "object": { + "type": "Identifier", + "start": 4578, + "end": 4582, + "loc": { + "start": { + "line": 169, + "column": 11 + }, + "end": { + "line": 169, + "column": 15 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 4583, + "end": 4589, + "loc": { + "start": { + "line": 169, + "column": 16 + }, + "end": { + "line": 169, + "column": 22 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 4594, + "end": 4598, + "loc": { + "start": { + "line": 169, + "column": 27 + }, + "end": { + "line": 169, + "column": 31 + } + } + } + } + ] + } + }, + { + "type": "ExpressionStatement", + "start": 4605, + "end": 4624, + "loc": { + "start": { + "line": 170, + "column": 4 + }, + "end": { + "line": 170, + "column": 23 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 4605, + "end": 4623, + "loc": { + "start": { + "line": 170, + "column": 4 + }, + "end": { + "line": 170, + "column": 22 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 4605, + "end": 4616, + "loc": { + "start": { + "line": 170, + "column": 4 + }, + "end": { + "line": 170, + "column": 15 + } + }, + "object": { + "type": "Identifier", + "start": 4605, + "end": 4609, + "loc": { + "start": { + "line": 170, + "column": 4 + }, + "end": { + "line": 170, + "column": 8 + }, + "identifierName": "succ" + }, + "name": "succ" + }, + "property": { + "type": "Identifier", + "start": 4610, + "end": 4616, + "loc": { + "start": { + "line": 170, + "column": 9 + }, + "end": { + "line": 170, + "column": 15 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "right": { + "type": "NullLiteral", + "start": 4619, + "end": 4623, + "loc": { + "start": { + "line": 170, + "column": 18 + }, + "end": { + "line": 170, + "column": 22 + } + } + } + } + }, + { + "type": "ExpressionStatement", + "start": 4629, + "end": 4646, + "loc": { + "start": { + "line": 171, + "column": 4 + }, + "end": { + "line": 171, + "column": 21 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 4629, + "end": 4645, + "loc": { + "start": { + "line": 171, + "column": 4 + }, + "end": { + "line": 171, + "column": 20 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 4629, + "end": 4638, + "loc": { + "start": { + "line": 171, + "column": 4 + }, + "end": { + "line": 171, + "column": 13 + } + }, + "object": { + "type": "ThisExpression", + "start": 4629, + "end": 4633, + "loc": { + "start": { + "line": 171, + "column": 4 + }, + "end": { + "line": 171, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "start": 4634, + "end": 4638, + "loc": { + "start": { + "line": 171, + "column": 9 + }, + "end": { + "line": 171, + "column": 13 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 4641, + "end": 4645, + "loc": { + "start": { + "line": 171, + "column": 16 + }, + "end": { + "line": 171, + "column": 20 + }, + "identifierName": "succ" + }, + "name": "succ" + } + } + } + ], + "directives": [] + }, + "alternate": { + "type": "BlockStatement", + "start": 4657, + "end": 4693, + "loc": { + "start": { + "line": 172, + "column": 10 + }, + "end": { + "line": 174, + "column": 4 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 4663, + "end": 4688, + "loc": { + "start": { + "line": 173, + "column": 4 + }, + "end": { + "line": 173, + "column": 29 + } + }, + "expression": { + "type": "CallExpression", + "start": 4663, + "end": 4687, + "loc": { + "start": { + "line": 173, + "column": 4 + }, + "end": { + "line": 173, + "column": 28 + } + }, + "callee": { + "type": "Identifier", + "start": 4663, + "end": 4675, + "loc": { + "start": { + "line": 173, + "column": 4 + }, + "end": { + "line": 173, + "column": 16 + }, + "identifierName": "replace_node" + }, + "name": "replace_node" + }, + "arguments": [ + { + "type": "Identifier", + "start": 4676, + "end": 4680, + "loc": { + "start": { + "line": 173, + "column": 17 + }, + "end": { + "line": 173, + "column": 21 + }, + "identifierName": "node" + }, + "name": "node" + }, + { + "type": "Identifier", + "start": 4682, + "end": 4686, + "loc": { + "start": { + "line": 173, + "column": 23 + }, + "end": { + "line": 173, + "column": 27 + }, + "identifierName": "succ" + }, + "name": "succ" + } + ] + } + } + ], + "directives": [] + } } - }, - "value": false - } - }, - "alternate": null - }, - { - "type": "ExpressionStatement", - "start": 3789, - "end": 3808, - "loc": { - "start": { - "line": 140, - "column": 2 - }, - "end": { - "line": 140, - "column": 21 - } - }, - "expression": { - "type": "CallExpression", - "start": 3789, - "end": 3807, - "loc": { - "start": { - "line": 140, - "column": 2 - }, - "end": { - "line": 140, - "column": 20 - } + ], + "directives": [] }, - "callee": { - "type": "MemberExpression", - "start": 3789, - "end": 3801, + "alternate": { + "type": "IfStatement", + "start": 4703, + "end": 5063, "loc": { "start": { - "line": 140, - "column": 2 + "line": 175, + "column": 9 }, "end": { - "line": 140, - "column": 14 + "line": 188, + "column": 3 } }, - "object": { - "type": "ThisExpression", - "start": 3789, - "end": 3793, + "test": { + "type": "BinaryExpression", + "start": 4707, + "end": 4725, "loc": { "start": { - "line": 140, - "column": 2 + "line": 175, + "column": 13 }, "end": { - "line": 140, - "column": 6 + "line": 175, + "column": 31 } - } - }, - "property": { - "type": "Identifier", - "start": 3794, - "end": 3801, - "loc": { - "start": { - "line": 140, - "column": 7 - }, - "end": { - "line": 140, - "column": 14 - }, - "identifierName": "_delete" }, - "name": "_delete" - }, - "computed": false - }, - "arguments": [ - { - "type": "Identifier", - "start": 3802, - "end": 3806, - "loc": { - "start": { - "line": 140, - "column": 15 - }, - "end": { - "line": 140, - "column": 19 + "left": { + "type": "Identifier", + "start": 4707, + "end": 4711, + "loc": { + "start": { + "line": 175, + "column": 13 + }, + "end": { + "line": 175, + "column": 17 + }, + "identifierName": "node" }, - "identifierName": "node" - }, - "name": "node" - } - ] - } - }, - { - "type": "ReturnStatement", - "start": 3811, - "end": 3823, - "loc": { - "start": { - "line": 141, - "column": 2 - }, - "end": { - "line": 141, - "column": 14 - } - }, - "argument": { - "type": "BooleanLiteral", - "start": 3818, - "end": 3822, - "loc": { - "start": { - "line": 141, - "column": 9 - }, - "end": { - "line": 141, - "column": 13 - } - }, - "value": true - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 3289, - "end": 3701, - "loc": { - "start": { - "line": 127, - "column": 1 - }, - "end": { - "line": 135, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", - "start": 3829, - "end": 4086, - "loc": { - "start": { - "line": 144, - "column": 1 - }, - "end": { - "line": 150, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 4088, - "end": 4202, - "loc": { - "start": { - "line": 151, - "column": 1 - }, - "end": { - "line": 154, - "column": 2 - } - }, - "static": false, - "kind": "method", - "computed": false, - "key": { - "type": "Identifier", - "start": 4089, - "end": 4094, - "loc": { - "start": { - "line": 151, - "column": 2 - }, - "end": { - "line": 151, - "column": 7 - }, - "identifierName": "range" - }, - "name": "range", - "leadingComments": null - }, - "id": null, - "generator": true, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 4095, - "end": 4099, - "loc": { - "start": { - "line": 151, - "column": 8 - }, - "end": { - "line": 151, - "column": 12 - }, - "identifierName": "left" - }, - "name": "left" - }, - { - "type": "Identifier", - "start": 4101, - "end": 4106, - "loc": { - "start": { - "line": 151, - "column": 14 - }, - "end": { - "line": 151, - "column": 19 - }, - "identifierName": "right" - }, - "name": "right" - } - ], - "body": { - "type": "BlockStatement", - "start": 4108, - "end": 4202, - "loc": { - "start": { - "line": 151, - "column": 21 - }, - "end": { - "line": 154, - "column": 2 - } - }, - "body": [ - { - "type": "IfStatement", - "start": 4112, - "end": 4199, - "loc": { - "start": { - "line": 152, - "column": 2 - }, - "end": { - "line": 153, - "column": 63 - } - }, - "test": { - "type": "BinaryExpression", - "start": 4116, - "end": 4134, - "loc": { - "start": { - "line": 152, - "column": 6 - }, - "end": { - "line": 152, - "column": 24 - } - }, - "left": { - "type": "MemberExpression", - "start": 4116, - "end": 4125, - "loc": { - "start": { - "line": 152, - "column": 6 + "name": "node" }, - "end": { - "line": 152, - "column": 15 - } - }, - "object": { - "type": "ThisExpression", - "start": 4116, - "end": 4120, - "loc": { - "start": { - "line": 152, - "column": 6 + "operator": "===", + "right": { + "type": "MemberExpression", + "start": 4716, + "end": 4725, + "loc": { + "start": { + "line": 175, + "column": 22 + }, + "end": { + "line": 175, + "column": 31 + } }, - "end": { - "line": 152, - "column": 10 - } + "object": { + "type": "ThisExpression", + "start": 4716, + "end": 4720, + "loc": { + "start": { + "line": 175, + "column": 22 + }, + "end": { + "line": 175, + "column": 26 + } + } + }, + "property": { + "type": "Identifier", + "start": 4721, + "end": 4725, + "loc": { + "start": { + "line": 175, + "column": 27 + }, + "end": { + "line": 175, + "column": 31 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false } }, - "property": { - "type": "Identifier", - "start": 4121, - "end": 4125, + "consequent": { + "type": "BlockStatement", + "start": 4727, + "end": 4883, "loc": { "start": { - "line": 152, - "column": 11 + "line": 175, + "column": 33 }, "end": { - "line": 152, - "column": 15 - }, - "identifierName": "root" - }, - "name": "root" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 4130, - "end": 4134, - "loc": { - "start": { - "line": 152, - "column": 20 + "line": 181, + "column": 3 + } }, - "end": { - "line": 152, - "column": 24 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 4139, - "end": 4199, - "loc": { - "start": { - "line": 153, - "column": 3 - }, - "end": { - "line": 153, - "column": 63 - } - }, - "expression": { - "type": "YieldExpression", - "start": 4139, - "end": 4198, - "loc": { - "start": { - "line": 153, - "column": 3 - }, - "end": { - "line": 153, - "column": 62 - } - }, - "delegate": true, - "argument": { - "type": "CallExpression", - "start": 4146, - "end": 4198, - "loc": { - "start": { - "line": 153, - "column": 10 - }, - "end": { - "line": 153, - "column": 62 - } - }, - "callee": { - "type": "Identifier", - "start": 4146, - "end": 4160, - "loc": { - "start": { - "line": 153, - "column": 10 - }, - "end": { - "line": 153, - "column": 24 - }, - "identifierName": "rangetraversal" - }, - "name": "rangetraversal" - }, - "arguments": [ + "body": [ { - "type": "MemberExpression", - "start": 4161, - "end": 4173, + "type": "ExpressionStatement", + "start": 4732, + "end": 4761, "loc": { "start": { - "line": 153, - "column": 25 + "line": 176, + "column": 3 }, "end": { - "line": 153, - "column": 37 + "line": 176, + "column": 32 } }, - "object": { - "type": "ThisExpression", - "start": 4161, - "end": 4165, + "expression": { + "type": "CallExpression", + "start": 4732, + "end": 4760, "loc": { "start": { - "line": 153, - "column": 25 + "line": 176, + "column": 3 }, "end": { - "line": 153, - "column": 29 + "line": 176, + "column": 31 } - } - }, - "property": { - "type": "Identifier", - "start": 4166, - "end": 4173, - "loc": { - "start": { - "line": 153, - "column": 30 - }, - "end": { - "line": 153, - "column": 37 + }, + "callee": { + "type": "Identifier", + "start": 4732, + "end": 4738, + "loc": { + "start": { + "line": 176, + "column": 3 + }, + "end": { + "line": 176, + "column": 9 + }, + "identifierName": "assert" }, - "identifierName": "compare" + "name": "assert" }, - "name": "compare" - }, - "computed": false + "arguments": [ + { + "type": "BinaryExpression", + "start": 4739, + "end": 4759, + "loc": { + "start": { + "line": 176, + "column": 10 + }, + "end": { + "line": 176, + "column": 30 + } + }, + "left": { + "type": "MemberExpression", + "start": 4739, + "end": 4750, + "loc": { + "start": { + "line": 176, + "column": 10 + }, + "end": { + "line": 176, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 4739, + "end": 4743, + "loc": { + "start": { + "line": 176, + "column": 10 + }, + "end": { + "line": 176, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 4744, + "end": 4750, + "loc": { + "start": { + "line": 176, + "column": 15 + }, + "end": { + "line": 176, + "column": 21 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 4755, + "end": 4759, + "loc": { + "start": { + "line": 176, + "column": 26 + }, + "end": { + "line": 176, + "column": 30 + } + } + } + } + ] + } }, { - "type": "MemberExpression", - "start": 4175, - "end": 4184, + "type": "ExpressionStatement", + "start": 4765, + "end": 4795, "loc": { "start": { - "line": 153, - "column": 39 + "line": 177, + "column": 3 }, "end": { - "line": 153, - "column": 48 + "line": 177, + "column": 33 } }, - "object": { - "type": "ThisExpression", - "start": 4175, - "end": 4179, + "expression": { + "type": "CallExpression", + "start": 4765, + "end": 4794, "loc": { "start": { - "line": 153, - "column": 39 + "line": 177, + "column": 3 }, "end": { - "line": 153, - "column": 43 + "line": 177, + "column": 32 } - } - }, - "property": { - "type": "Identifier", - "start": 4180, - "end": 4184, - "loc": { - "start": { - "line": 153, - "column": 44 - }, - "end": { - "line": 153, - "column": 48 + }, + "callee": { + "type": "Identifier", + "start": 4765, + "end": 4771, + "loc": { + "start": { + "line": 177, + "column": 3 + }, + "end": { + "line": 177, + "column": 9 + }, + "identifierName": "assert" }, - "identifierName": "root" + "name": "assert" }, - "name": "root" - }, - "computed": false + "arguments": [ + { + "type": "BinaryExpression", + "start": 4772, + "end": 4793, + "loc": { + "start": { + "line": 177, + "column": 10 + }, + "end": { + "line": 177, + "column": 31 + } + }, + "left": { + "type": "MemberExpression", + "start": 4772, + "end": 4783, + "loc": { + "start": { + "line": 177, + "column": 10 + }, + "end": { + "line": 177, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 4772, + "end": 4776, + "loc": { + "start": { + "line": 177, + "column": 10 + }, + "end": { + "line": 177, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 4777, + "end": 4783, + "loc": { + "start": { + "line": 177, + "column": 15 + }, + "end": { + "line": 177, + "column": 21 + }, + "identifierName": "_color" + }, + "name": "_color" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "Identifier", + "start": 4788, + "end": 4793, + "loc": { + "start": { + "line": 177, + "column": 26 + }, + "end": { + "line": 177, + "column": 31 + }, + "identifierName": "BLACK" + }, + "name": "BLACK" + } + } + ] + } }, { - "type": "Identifier", - "start": 4186, - "end": 4190, + "type": "ExpressionStatement", + "start": 4799, + "end": 4826, "loc": { "start": { - "line": 153, - "column": 50 + "line": 178, + "column": 3 }, "end": { - "line": 153, - "column": 54 - }, - "identifierName": "left" + "line": 178, + "column": 30 + } }, - "name": "left" + "expression": { + "type": "CallExpression", + "start": 4799, + "end": 4825, + "loc": { + "start": { + "line": 178, + "column": 3 + }, + "end": { + "line": 178, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 4799, + "end": 4805, + "loc": { + "start": { + "line": 178, + "column": 3 + }, + "end": { + "line": 178, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 4806, + "end": 4824, + "loc": { + "start": { + "line": 178, + "column": 10 + }, + "end": { + "line": 178, + "column": 28 + } + }, + "left": { + "type": "MemberExpression", + "start": 4806, + "end": 4815, + "loc": { + "start": { + "line": 178, + "column": 10 + }, + "end": { + "line": 178, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 4806, + "end": 4810, + "loc": { + "start": { + "line": 178, + "column": 10 + }, + "end": { + "line": 178, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 4811, + "end": 4815, + "loc": { + "start": { + "line": 178, + "column": 15 + }, + "end": { + "line": 178, + "column": 19 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 4820, + "end": 4824, + "loc": { + "start": { + "line": 178, + "column": 24 + }, + "end": { + "line": 178, + "column": 28 + } + } + } + } + ] + } }, { - "type": "Identifier", - "start": 4192, - "end": 4197, + "type": "ExpressionStatement", + "start": 4830, + "end": 4858, "loc": { "start": { - "line": 153, - "column": 56 + "line": 179, + "column": 3 }, "end": { - "line": 153, - "column": 61 - }, - "identifierName": "right" + "line": 179, + "column": 31 + } }, - "name": "right" - } - ] - } - } - }, - "alternate": null - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", - "start": 3829, - "end": 4086, - "loc": { - "start": { - "line": 144, - "column": 1 - }, - "end": { - "line": 150, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", - "start": 4205, - "end": 4309, - "loc": { - "start": { - "line": 156, - "column": 1 - }, - "end": { - "line": 160, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 4311, - "end": 4386, - "loc": { - "start": { - "line": 161, - "column": 1 - }, - "end": { - "line": 163, - "column": 2 - } - }, - "static": false, - "kind": "method", - "computed": false, - "key": { - "type": "Identifier", - "start": 4312, - "end": 4317, - "loc": { - "start": { - "line": 161, - "column": 2 - }, - "end": { - "line": 161, - "column": 7 - }, - "identifierName": "items" - }, - "name": "items", - "leadingComments": null - }, - "id": null, - "generator": true, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 4320, - "end": 4386, - "loc": { - "start": { - "line": 161, - "column": 10 - }, - "end": { - "line": 163, - "column": 2 - } - }, - "body": [ - { - "type": "IfStatement", - "start": 4324, - "end": 4383, - "loc": { - "start": { - "line": 162, - "column": 2 - }, - "end": { - "line": 162, - "column": 61 - } - }, - "test": { - "type": "BinaryExpression", - "start": 4328, - "end": 4346, - "loc": { - "start": { - "line": 162, - "column": 6 - }, - "end": { - "line": 162, - "column": 24 - } - }, - "left": { - "type": "MemberExpression", - "start": 4328, - "end": 4337, - "loc": { - "start": { - "line": 162, - "column": 6 - }, - "end": { - "line": 162, - "column": 15 - } - }, - "object": { - "type": "ThisExpression", - "start": 4328, - "end": 4332, - "loc": { - "start": { - "line": 162, - "column": 6 - }, - "end": { - "line": 162, - "column": 10 - } - } - }, - "property": { - "type": "Identifier", - "start": 4333, - "end": 4337, - "loc": { - "start": { - "line": 162, - "column": 11 - }, - "end": { - "line": 162, - "column": 15 - }, - "identifierName": "root" - }, - "name": "root" - }, - "computed": false - }, - "operator": "!==", - "right": { - "type": "NullLiteral", - "start": 4342, - "end": 4346, - "loc": { - "start": { - "line": 162, - "column": 20 - }, - "end": { - "line": 162, - "column": 24 - } - } - } - }, - "consequent": { - "type": "ExpressionStatement", - "start": 4348, - "end": 4383, - "loc": { - "start": { - "line": 162, - "column": 26 - }, - "end": { - "line": 162, - "column": 61 - } - }, - "expression": { - "type": "YieldExpression", - "start": 4348, - "end": 4382, - "loc": { - "start": { - "line": 162, - "column": 26 - }, - "end": { - "line": 162, - "column": 60 - } - }, - "delegate": true, - "argument": { - "type": "CallExpression", - "start": 4355, - "end": 4382, - "loc": { - "start": { - "line": 162, - "column": 33 - }, - "end": { - "line": 162, - "column": 60 - } - }, - "callee": { - "type": "Identifier", - "start": 4355, - "end": 4371, - "loc": { - "start": { - "line": 162, - "column": 33 - }, - "end": { - "line": 162, - "column": 49 - }, - "identifierName": "inordertraversal" + "expression": { + "type": "CallExpression", + "start": 4830, + "end": 4857, + "loc": { + "start": { + "line": 179, + "column": 3 + }, + "end": { + "line": 179, + "column": 30 + } + }, + "callee": { + "type": "Identifier", + "start": 4830, + "end": 4836, + "loc": { + "start": { + "line": 179, + "column": 3 + }, + "end": { + "line": 179, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 4837, + "end": 4856, + "loc": { + "start": { + "line": 179, + "column": 10 + }, + "end": { + "line": 179, + "column": 29 + } + }, + "left": { + "type": "MemberExpression", + "start": 4837, + "end": 4847, + "loc": { + "start": { + "line": 179, + "column": 10 + }, + "end": { + "line": 179, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 4837, + "end": 4841, + "loc": { + "start": { + "line": 179, + "column": 10 + }, + "end": { + "line": 179, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 4842, + "end": 4847, + "loc": { + "start": { + "line": 179, + "column": 15 + }, + "end": { + "line": 179, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 4852, + "end": 4856, + "loc": { + "start": { + "line": 179, + "column": 25 + }, + "end": { + "line": 179, + "column": 29 + } + } + } + } + ] + } }, - "name": "inordertraversal" - }, - "arguments": [ { - "type": "MemberExpression", - "start": 4372, - "end": 4381, + "type": "ExpressionStatement", + "start": 4862, + "end": 4879, "loc": { "start": { - "line": 162, - "column": 50 + "line": 180, + "column": 3 }, "end": { - "line": 162, - "column": 59 + "line": 180, + "column": 20 } }, - "object": { - "type": "ThisExpression", - "start": 4372, - "end": 4376, + "expression": { + "type": "AssignmentExpression", + "start": 4862, + "end": 4878, "loc": { "start": { - "line": 162, - "column": 50 + "line": 180, + "column": 3 }, "end": { - "line": 162, - "column": 54 + "line": 180, + "column": 19 } - } - }, - "property": { - "type": "Identifier", - "start": 4377, - "end": 4381, - "loc": { - "start": { - "line": 162, - "column": 55 - }, - "end": { - "line": 162, - "column": 59 + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 4862, + "end": 4871, + "loc": { + "start": { + "line": 180, + "column": 3 + }, + "end": { + "line": 180, + "column": 12 + } }, - "identifierName": "root" + "object": { + "type": "ThisExpression", + "start": 4862, + "end": 4866, + "loc": { + "start": { + "line": 180, + "column": 3 + }, + "end": { + "line": 180, + "column": 7 + } + } + }, + "property": { + "type": "Identifier", + "start": 4867, + "end": 4871, + "loc": { + "start": { + "line": 180, + "column": 8 + }, + "end": { + "line": 180, + "column": 12 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false }, - "name": "root" - }, - "computed": false + "right": { + "type": "NullLiteral", + "start": 4874, + "end": 4878, + "loc": { + "start": { + "line": 180, + "column": 15 + }, + "end": { + "line": 180, + "column": 19 + } + } + } + } } - ] - } - } - }, - "alternate": null - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", - "start": 4205, - "end": 4309, - "loc": { - "start": { - "line": 156, - "column": 1 - }, - "end": { - "line": 160, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 4389, - "end": 4437, - "loc": { - "start": { - "line": 165, - "column": 1 - }, - "end": { - "line": 167, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 4439, - "end": 4486, - "loc": { - "start": { - "line": 168, - "column": 1 - }, - "end": { - "line": 170, - "column": 2 - } - }, - "static": false, - "computed": true, - "key": { - "type": "MemberExpression", - "start": 4440, - "end": 4455, - "loc": { - "start": { - "line": 168, - "column": 2 - }, - "end": { - "line": 168, - "column": 17 - } - }, - "object": { - "type": "Identifier", - "start": 4440, - "end": 4446, - "loc": { - "start": { - "line": 168, - "column": 2 - }, - "end": { - "line": 168, - "column": 8 - }, - "identifierName": "Symbol" - }, - "name": "Symbol", - "leadingComments": null - }, - "property": { - "type": "Identifier", - "start": 4447, - "end": 4455, - "loc": { - "start": { - "line": 168, - "column": 9 - }, - "end": { - "line": 168, - "column": 17 - }, - "identifierName": "iterator" - }, - "name": "iterator" - }, - "computed": false, - "leadingComments": null - }, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [], - "body": { - "type": "BlockStatement", - "start": 4459, - "end": 4486, - "loc": { - "start": { - "line": 168, - "column": 21 - }, - "end": { - "line": 170, - "column": 2 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 4463, - "end": 4483, - "loc": { - "start": { - "line": 169, - "column": 2 - }, - "end": { - "line": 169, - "column": 22 - } - }, - "argument": { - "type": "CallExpression", - "start": 4470, - "end": 4482, - "loc": { - "start": { - "line": 169, - "column": 9 - }, - "end": { - "line": 169, - "column": 21 - } - }, - "callee": { - "type": "MemberExpression", - "start": 4470, - "end": 4480, - "loc": { - "start": { - "line": 169, - "column": 9 - }, - "end": { - "line": 169, - "column": 19 - } + ], + "directives": [] }, - "object": { - "type": "ThisExpression", - "start": 4470, - "end": 4474, + "alternate": { + "type": "BlockStatement", + "start": 4889, + "end": 5063, "loc": { "start": { - "line": 169, + "line": 181, "column": 9 }, "end": { - "line": 169, - "column": 13 + "line": 188, + "column": 3 } - } - }, - "property": { - "type": "Identifier", - "start": 4475, - "end": 4480, - "loc": { - "start": { - "line": 169, - "column": 14 - }, - "end": { - "line": 169, - "column": 19 - }, - "identifierName": "items" }, - "name": "items" - }, - "computed": false - }, - "arguments": [] - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 4389, - "end": 4437, - "loc": { - "start": { - "line": 165, - "column": 1 - }, - "end": { - "line": 167, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4489, - "end": 4633, - "loc": { - "start": { - "line": 172, - "column": 1 - }, - "end": { - "line": 177, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 4635, - "end": 4697, - "loc": { - "start": { - "line": 178, - "column": 1 - }, - "end": { - "line": 180, - "column": 2 - } - }, - "static": true, - "computed": false, - "key": { - "type": "Identifier", - "start": 4642, - "end": 4647, - "loc": { - "start": { - "line": 178, - "column": 8 - }, - "end": { - "line": 178, - "column": 13 - }, - "identifierName": "empty" - }, - "name": "empty" - }, - "kind": "method", - "id": null, - "generator": false, - "expression": false, - "async": false, - "params": [ - { - "type": "Identifier", - "start": 4648, - "end": 4655, - "loc": { - "start": { - "line": 178, - "column": 14 - }, - "end": { - "line": 178, - "column": 21 - }, - "identifierName": "compare" - }, - "name": "compare" - } - ], - "body": { - "type": "BlockStatement", - "start": 4657, - "end": 4697, - "loc": { - "start": { - "line": 178, - "column": 23 - }, - "end": { - "line": 180, - "column": 2 - } - }, - "body": [ - { - "type": "ReturnStatement", - "start": 4661, - "end": 4694, - "loc": { - "start": { - "line": 179, - "column": 2 - }, - "end": { - "line": 179, - "column": 35 - } - }, - "argument": { - "type": "NewExpression", - "start": 4668, - "end": 4693, - "loc": { - "start": { - "line": 179, - "column": 9 - }, - "end": { - "line": 179, - "column": 34 - } - }, - "callee": { - "type": "Identifier", - "start": 4672, - "end": 4684, - "loc": { - "start": { - "line": 179, - "column": 13 - }, - "end": { - "line": 179, - "column": 25 - }, - "identifierName": "RedBlackTree" - }, - "name": "RedBlackTree" - }, - "arguments": [ - { - "type": "Identifier", - "start": 4685, - "end": 4692, - "loc": { - "start": { - "line": 179, - "column": 26 + "body": [ + { + "type": "ExpressionStatement", + "start": 4894, + "end": 4921, + "loc": { + "start": { + "line": 182, + "column": 3 + }, + "end": { + "line": 182, + "column": 30 + } + }, + "expression": { + "type": "CallExpression", + "start": 4894, + "end": 4920, + "loc": { + "start": { + "line": 182, + "column": 3 + }, + "end": { + "line": 182, + "column": 29 + } + }, + "callee": { + "type": "Identifier", + "start": 4894, + "end": 4900, + "loc": { + "start": { + "line": 182, + "column": 3 + }, + "end": { + "line": 182, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 4901, + "end": 4919, + "loc": { + "start": { + "line": 182, + "column": 10 + }, + "end": { + "line": 182, + "column": 28 + } + }, + "left": { + "type": "MemberExpression", + "start": 4901, + "end": 4910, + "loc": { + "start": { + "line": 182, + "column": 10 + }, + "end": { + "line": 182, + "column": 19 + } + }, + "object": { + "type": "Identifier", + "start": 4901, + "end": 4905, + "loc": { + "start": { + "line": 182, + "column": 10 + }, + "end": { + "line": 182, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 4906, + "end": 4910, + "loc": { + "start": { + "line": 182, + "column": 15 + }, + "end": { + "line": 182, + "column": 19 + }, + "identifierName": "left" + }, + "name": "left" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 4915, + "end": 4919, + "loc": { + "start": { + "line": 182, + "column": 24 + }, + "end": { + "line": 182, + "column": 28 + } + } + } + } + ] + } }, - "end": { - "line": 179, - "column": 33 + { + "type": "ExpressionStatement", + "start": 4925, + "end": 4953, + "loc": { + "start": { + "line": 183, + "column": 3 + }, + "end": { + "line": 183, + "column": 31 + } + }, + "expression": { + "type": "CallExpression", + "start": 4925, + "end": 4952, + "loc": { + "start": { + "line": 183, + "column": 3 + }, + "end": { + "line": 183, + "column": 30 + } + }, + "callee": { + "type": "Identifier", + "start": 4925, + "end": 4931, + "loc": { + "start": { + "line": 183, + "column": 3 + }, + "end": { + "line": 183, + "column": 9 + }, + "identifierName": "assert" + }, + "name": "assert" + }, + "arguments": [ + { + "type": "BinaryExpression", + "start": 4932, + "end": 4951, + "loc": { + "start": { + "line": 183, + "column": 10 + }, + "end": { + "line": 183, + "column": 29 + } + }, + "left": { + "type": "MemberExpression", + "start": 4932, + "end": 4942, + "loc": { + "start": { + "line": 183, + "column": 10 + }, + "end": { + "line": 183, + "column": 20 + } + }, + "object": { + "type": "Identifier", + "start": 4932, + "end": 4936, + "loc": { + "start": { + "line": 183, + "column": 10 + }, + "end": { + "line": 183, + "column": 14 + }, + "identifierName": "node" + }, + "name": "node" + }, + "property": { + "type": "Identifier", + "start": 4937, + "end": 4942, + "loc": { + "start": { + "line": 183, + "column": 15 + }, + "end": { + "line": 183, + "column": 20 + }, + "identifierName": "right" + }, + "name": "right" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 4947, + "end": 4951, + "loc": { + "start": { + "line": 183, + "column": 25 + }, + "end": { + "line": 183, + "column": 29 + } + } + } + } + ] + } }, - "identifierName": "compare" - }, - "name": "compare" - } - ] - } - } - ], - "directives": [], - "trailingComments": null - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4489, - "end": 4633, - "loc": { - "start": { - "line": 172, - "column": 1 - }, - "end": { - "line": 177, - "column": 4 - } - } - } - ], - "trailingComments": [ - { - "type": "CommentBlock", - "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4700, - "end": 4913, - "loc": { - "start": { - "line": 182, - "column": 1 - }, - "end": { - "line": 188, - "column": 4 - } - } - } - ] - }, - { - "type": "ClassMethod", - "start": 4915, - "end": 5062, - "loc": { - "start": { - "line": 189, + { + "type": "VariableDeclaration", + "start": 4957, + "end": 4995, + "loc": { + "start": { + "line": 184, + "column": 3 + }, + "end": { + "line": 184, + "column": 41 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 4963, + "end": 4994, + "loc": { + "start": { + "line": 184, + "column": 9 + }, + "end": { + "line": 184, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 4963, + "end": 4970, + "loc": { + "start": { + "line": 184, + "column": 9 + }, + "end": { + "line": 184, + "column": 16 + }, + "identifierName": "subtree" + }, + "name": "subtree" + }, + "init": { + "type": "CallExpression", + "start": 4973, + "end": 4994, + "loc": { + "start": { + "line": 184, + "column": 19 + }, + "end": { + "line": 184, + "column": 40 + } + }, + "callee": { + "type": "Identifier", + "start": 4973, + "end": 4988, + "loc": { + "start": { + "line": 184, + "column": 19 + }, + "end": { + "line": 184, + "column": 34 + }, + "identifierName": "delete_no_child" + }, + "name": "delete_no_child" + }, + "arguments": [ + { + "type": "Identifier", + "start": 4989, + "end": 4993, + "loc": { + "start": { + "line": 184, + "column": 35 + }, + "end": { + "line": 184, + "column": 39 + }, + "identifierName": "node" + }, + "name": "node" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "IfStatement", + "start": 4999, + "end": 5059, + "loc": { + "start": { + "line": 185, + "column": 3 + }, + "end": { + "line": 187, + "column": 4 + } + }, + "test": { + "type": "BinaryExpression", + "start": 5003, + "end": 5026, + "loc": { + "start": { + "line": 185, + "column": 7 + }, + "end": { + "line": 185, + "column": 30 + } + }, + "left": { + "type": "MemberExpression", + "start": 5003, + "end": 5017, + "loc": { + "start": { + "line": 185, + "column": 7 + }, + "end": { + "line": 185, + "column": 21 + } + }, + "object": { + "type": "Identifier", + "start": 5003, + "end": 5010, + "loc": { + "start": { + "line": 185, + "column": 7 + }, + "end": { + "line": 185, + "column": 14 + }, + "identifierName": "subtree" + }, + "name": "subtree" + }, + "property": { + "type": "Identifier", + "start": 5011, + "end": 5017, + "loc": { + "start": { + "line": 185, + "column": 15 + }, + "end": { + "line": 185, + "column": 21 + }, + "identifierName": "parent" + }, + "name": "parent" + }, + "computed": false + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 5022, + "end": 5026, + "loc": { + "start": { + "line": 185, + "column": 26 + }, + "end": { + "line": 185, + "column": 30 + } + } + } + }, + "consequent": { + "type": "BlockStatement", + "start": 5028, + "end": 5059, + "loc": { + "start": { + "line": 185, + "column": 32 + }, + "end": { + "line": 187, + "column": 4 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 5034, + "end": 5054, + "loc": { + "start": { + "line": 186, + "column": 4 + }, + "end": { + "line": 186, + "column": 24 + } + }, + "expression": { + "type": "AssignmentExpression", + "start": 5034, + "end": 5053, + "loc": { + "start": { + "line": 186, + "column": 4 + }, + "end": { + "line": 186, + "column": 23 + } + }, + "operator": "=", + "left": { + "type": "MemberExpression", + "start": 5034, + "end": 5043, + "loc": { + "start": { + "line": 186, + "column": 4 + }, + "end": { + "line": 186, + "column": 13 + } + }, + "object": { + "type": "ThisExpression", + "start": 5034, + "end": 5038, + "loc": { + "start": { + "line": 186, + "column": 4 + }, + "end": { + "line": 186, + "column": 8 + } + } + }, + "property": { + "type": "Identifier", + "start": 5039, + "end": 5043, + "loc": { + "start": { + "line": 186, + "column": 9 + }, + "end": { + "line": 186, + "column": 13 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + "right": { + "type": "Identifier", + "start": 5046, + "end": 5053, + "loc": { + "start": { + "line": 186, + "column": 16 + }, + "end": { + "line": 186, + "column": 23 + }, + "identifierName": "subtree" + }, + "name": "subtree" + } + } + } + ], + "directives": [] + }, + "alternate": null + } + ], + "directives": [] + } + } + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", + "start": 2742, + "end": 2847, + "loc": { + "start": { + "line": 106, + "column": 1 + }, + "end": { + "line": 110, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#unlink}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 5069, + "end": 5480, + "loc": { + "start": { + "line": 191, + "column": 1 + }, + "end": { + "line": 199, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 5482, + "end": 5604, + "loc": { + "start": { + "line": 200, "column": 1 }, "end": { - "line": 195, + "line": 206, "column": 2 } }, - "static": true, + "static": false, "computed": false, "key": { "type": "Identifier", - "start": 4922, - "end": 4926, + "start": 5482, + "end": 5488, "loc": { "start": { - "line": 189, - "column": 8 + "line": 200, + "column": 1 }, "end": { - "line": 189, - "column": 12 + "line": 200, + "column": 7 }, - "identifierName": "from" + "identifierName": "remove" }, - "name": "from" + "name": "remove", + "leadingComments": null }, "kind": "method", "id": null, @@ -6738,148 +8966,162 @@ "params": [ { "type": "Identifier", - "start": 4927, - "end": 4934, - "loc": { - "start": { - "line": 189, - "column": 13 - }, - "end": { - "line": 189, - "column": 20 - }, - "identifierName": "compare" - }, - "name": "compare" - }, - { - "type": "Identifier", - "start": 4936, - "end": 4944, + "start": 5489, + "end": 5492, "loc": { "start": { - "line": 189, - "column": 22 + "line": 200, + "column": 8 }, "end": { - "line": 189, - "column": 30 + "line": 200, + "column": 11 }, - "identifierName": "iterable" + "identifierName": "key" }, - "name": "iterable" + "name": "key" } ], "body": { "type": "BlockStatement", - "start": 4946, - "end": 5062, + "start": 5494, + "end": 5604, "loc": { "start": { - "line": 189, - "column": 32 + "line": 200, + "column": 13 }, "end": { - "line": 195, + "line": 206, "column": 2 } }, "body": [ { "type": "VariableDeclaration", - "start": 4950, - "end": 4989, + "start": 5498, + "end": 5529, "loc": { "start": { - "line": 190, + "line": 201, "column": 2 }, "end": { - "line": 190, - "column": 41 + "line": 201, + "column": 33 } }, "declarations": [ { "type": "VariableDeclarator", - "start": 4956, - "end": 4988, + "start": 5504, + "end": 5528, "loc": { "start": { - "line": 190, + "line": 201, "column": 8 }, "end": { - "line": 190, - "column": 40 + "line": 201, + "column": 32 } }, "id": { "type": "Identifier", - "start": 4956, - "end": 4960, + "start": 5504, + "end": 5508, "loc": { "start": { - "line": 190, + "line": 201, "column": 8 }, "end": { - "line": 190, + "line": 201, "column": 12 }, - "identifierName": "tree" + "identifierName": "node" }, - "name": "tree" + "name": "node" }, "init": { - "type": "NewExpression", - "start": 4963, - "end": 4988, + "type": "CallExpression", + "start": 5511, + "end": 5528, "loc": { "start": { - "line": 190, + "line": 201, "column": 15 }, "end": { - "line": 190, - "column": 40 + "line": 201, + "column": 32 } }, "callee": { - "type": "Identifier", - "start": 4967, - "end": 4979, + "type": "MemberExpression", + "start": 5511, + "end": 5523, "loc": { "start": { - "line": 190, - "column": 19 + "line": 201, + "column": 15 }, "end": { - "line": 190, - "column": 31 - }, - "identifierName": "RedBlackTree" + "line": 201, + "column": 27 + } }, - "name": "RedBlackTree" - }, - "arguments": [ - { + "object": { + "type": "ThisExpression", + "start": 5511, + "end": 5515, + "loc": { + "start": { + "line": 201, + "column": 15 + }, + "end": { + "line": 201, + "column": 19 + } + } + }, + "property": { "type": "Identifier", - "start": 4980, - "end": 4987, + "start": 5516, + "end": 5523, "loc": { "start": { - "line": 190, - "column": 32 + "line": 201, + "column": 20 }, "end": { - "line": 190, - "column": 39 + "line": 201, + "column": 27 }, - "identifierName": "compare" + "identifierName": "_search" }, - "name": "compare" + "name": "_search" + }, + "computed": false + }, + "arguments": [ + { + "type": "Identifier", + "start": 5524, + "end": 5527, + "loc": { + "start": { + "line": 201, + "column": 28 + }, + "end": { + "line": 201, + "column": 31 + }, + "identifierName": "key" + }, + "name": "key" } ] } @@ -6888,676 +9130,9966 @@ "kind": "const" }, { - "type": "ForOfStatement", - "start": 4993, - "end": 5043, + "type": "IfStatement", + "start": 5532, + "end": 5564, "loc": { "start": { - "line": 192, + "line": 202, "column": 2 }, "end": { - "line": 192, - "column": 52 + "line": 202, + "column": 34 } }, - "left": { - "type": "VariableDeclaration", - "start": 4998, - "end": 5011, + "test": { + "type": "BinaryExpression", + "start": 5536, + "end": 5549, "loc": { "start": { - "line": 192, - "column": 7 + "line": 202, + "column": 6 }, "end": { - "line": 192, - "column": 20 + "line": 202, + "column": 19 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 5004, - "end": 5011, - "loc": { - "start": { - "line": 192, - "column": 13 - }, - "end": { - "line": 192, - "column": 20 - } + "left": { + "type": "Identifier", + "start": 5536, + "end": 5540, + "loc": { + "start": { + "line": 202, + "column": 6 }, - "id": { - "type": "Identifier", - "start": 5004, - "end": 5011, - "loc": { - "start": { - "line": 192, - "column": 13 - }, - "end": { - "line": 192, - "column": 20 - }, - "identifierName": "element" - }, - "name": "element" + "end": { + "line": 202, + "column": 10 }, - "init": null + "identifierName": "node" + }, + "name": "node" + }, + "operator": "===", + "right": { + "type": "NullLiteral", + "start": 5545, + "end": 5549, + "loc": { + "start": { + "line": 202, + "column": 15 + }, + "end": { + "line": 202, + "column": 19 + } } - ], - "kind": "const" + } }, - "right": { - "type": "Identifier", - "start": 5015, - "end": 5023, + "consequent": { + "type": "ReturnStatement", + "start": 5551, + "end": 5564, "loc": { "start": { - "line": 192, - "column": 24 + "line": 202, + "column": 21 }, "end": { - "line": 192, - "column": 32 + "line": 202, + "column": 34 + } + }, + "argument": { + "type": "BooleanLiteral", + "start": 5558, + "end": 5563, + "loc": { + "start": { + "line": 202, + "column": 28 + }, + "end": { + "line": 202, + "column": 33 + } }, - "identifierName": "iterable" + "value": false + } + }, + "alternate": null + }, + { + "type": "ExpressionStatement", + "start": 5568, + "end": 5586, + "loc": { + "start": { + "line": 204, + "column": 2 }, - "name": "iterable" + "end": { + "line": 204, + "column": 20 + } }, - "body": { - "type": "ExpressionStatement", - "start": 5025, - "end": 5043, + "expression": { + "type": "CallExpression", + "start": 5568, + "end": 5585, "loc": { "start": { - "line": 192, - "column": 34 + "line": 204, + "column": 2 }, "end": { - "line": 192, - "column": 52 + "line": 204, + "column": 19 } }, - "expression": { - "type": "CallExpression", - "start": 5025, - "end": 5042, + "callee": { + "type": "MemberExpression", + "start": 5568, + "end": 5579, "loc": { "start": { - "line": 192, - "column": 34 + "line": 204, + "column": 2 }, "end": { - "line": 192, - "column": 51 + "line": 204, + "column": 13 } }, - "callee": { - "type": "MemberExpression", - "start": 5025, - "end": 5033, + "object": { + "type": "ThisExpression", + "start": 5568, + "end": 5572, "loc": { "start": { - "line": 192, - "column": 34 + "line": 204, + "column": 2 }, "end": { - "line": 192, - "column": 42 + "line": 204, + "column": 6 } - }, - "object": { - "type": "Identifier", - "start": 5025, - "end": 5029, - "loc": { - "start": { - "line": 192, - "column": 34 - }, - "end": { - "line": 192, - "column": 38 - }, - "identifierName": "tree" + } + }, + "property": { + "type": "Identifier", + "start": 5573, + "end": 5579, + "loc": { + "start": { + "line": 204, + "column": 7 }, - "name": "tree" - }, - "property": { - "type": "Identifier", - "start": 5030, - "end": 5033, - "loc": { - "start": { - "line": 192, - "column": 39 - }, - "end": { - "line": 192, - "column": 42 - }, - "identifierName": "add" + "end": { + "line": 204, + "column": 13 }, - "name": "add" + "identifierName": "unlink" }, - "computed": false + "name": "unlink" }, - "arguments": [ - { - "type": "Identifier", - "start": 5034, - "end": 5041, - "loc": { - "start": { - "line": 192, - "column": 43 - }, - "end": { - "line": 192, - "column": 50 - }, - "identifierName": "element" + "computed": false + }, + "arguments": [ + { + "type": "Identifier", + "start": 5580, + "end": 5584, + "loc": { + "start": { + "line": 204, + "column": 14 }, - "name": "element" - } - ] - } + "end": { + "line": 204, + "column": 18 + }, + "identifierName": "node" + }, + "name": "node" + } + ] } }, { "type": "ReturnStatement", - "start": 5047, - "end": 5059, + "start": 5589, + "end": 5601, "loc": { "start": { - "line": 194, + "line": 205, "column": 2 }, "end": { - "line": 194, + "line": 205, "column": 14 } }, "argument": { - "type": "Identifier", - "start": 5054, - "end": 5058, + "type": "BooleanLiteral", + "start": 5596, + "end": 5600, "loc": { "start": { - "line": 194, + "line": 205, "column": 9 }, "end": { - "line": 194, + "line": 205, "column": 13 - }, - "identifierName": "tree" + } }, - "name": "tree" + "value": true } } ], - "directives": [] + "directives": [], + "trailingComments": null }, "leadingComments": [ { "type": "CommentBlock", - "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4700, - "end": 4913, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#unlink}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 5069, + "end": 5480, + "loc": { + "start": { + "line": 191, + "column": 1 + }, + "end": { + "line": 199, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", + "start": 5607, + "end": 5864, "loc": { "start": { - "line": 182, + "line": 208, "column": 1 }, "end": { - "line": 188, + "line": 214, "column": 4 } } } ] - } - ] - }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 582, - "end": 631, - "loc": { - "start": { - "line": 14, - "column": 0 + }, + { + "type": "ClassMethod", + "start": 5866, + "end": 5980, + "loc": { + "start": { + "line": 215, + "column": 1 + }, + "end": { + "line": 218, + "column": 2 + } }, - "end": { - "line": 17, - "column": 3 - } - } - } - ], - "trailingComments": [] + "static": false, + "kind": "method", + "computed": false, + "key": { + "type": "Identifier", + "start": 5867, + "end": 5872, + "loc": { + "start": { + "line": 215, + "column": 2 + }, + "end": { + "line": 215, + "column": 7 + }, + "identifierName": "range" + }, + "name": "range", + "leadingComments": null + }, + "id": null, + "generator": true, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 5873, + "end": 5877, + "loc": { + "start": { + "line": 215, + "column": 8 + }, + "end": { + "line": 215, + "column": 12 + }, + "identifierName": "left" + }, + "name": "left" + }, + { + "type": "Identifier", + "start": 5879, + "end": 5884, + "loc": { + "start": { + "line": 215, + "column": 14 + }, + "end": { + "line": 215, + "column": 19 + }, + "identifierName": "right" + }, + "name": "right" + } + ], + "body": { + "type": "BlockStatement", + "start": 5886, + "end": 5980, + "loc": { + "start": { + "line": 215, + "column": 21 + }, + "end": { + "line": 218, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 5890, + "end": 5977, + "loc": { + "start": { + "line": 216, + "column": 2 + }, + "end": { + "line": 217, + "column": 63 + } + }, + "test": { + "type": "BinaryExpression", + "start": 5894, + "end": 5912, + "loc": { + "start": { + "line": 216, + "column": 6 + }, + "end": { + "line": 216, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 5894, + "end": 5903, + "loc": { + "start": { + "line": 216, + "column": 6 + }, + "end": { + "line": 216, + "column": 15 + } + }, + "object": { + "type": "ThisExpression", + "start": 5894, + "end": 5898, + "loc": { + "start": { + "line": 216, + "column": 6 + }, + "end": { + "line": 216, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "start": 5899, + "end": 5903, + "loc": { + "start": { + "line": 216, + "column": 11 + }, + "end": { + "line": 216, + "column": 15 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 5908, + "end": 5912, + "loc": { + "start": { + "line": 216, + "column": 20 + }, + "end": { + "line": 216, + "column": 24 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 5917, + "end": 5977, + "loc": { + "start": { + "line": 217, + "column": 3 + }, + "end": { + "line": 217, + "column": 63 + } + }, + "expression": { + "type": "YieldExpression", + "start": 5917, + "end": 5976, + "loc": { + "start": { + "line": 217, + "column": 3 + }, + "end": { + "line": 217, + "column": 62 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 5924, + "end": 5976, + "loc": { + "start": { + "line": 217, + "column": 10 + }, + "end": { + "line": 217, + "column": 62 + } + }, + "callee": { + "type": "Identifier", + "start": 5924, + "end": 5938, + "loc": { + "start": { + "line": 217, + "column": 10 + }, + "end": { + "line": 217, + "column": 24 + }, + "identifierName": "rangetraversal" + }, + "name": "rangetraversal" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 5939, + "end": 5951, + "loc": { + "start": { + "line": 217, + "column": 25 + }, + "end": { + "line": 217, + "column": 37 + } + }, + "object": { + "type": "ThisExpression", + "start": 5939, + "end": 5943, + "loc": { + "start": { + "line": 217, + "column": 25 + }, + "end": { + "line": 217, + "column": 29 + } + } + }, + "property": { + "type": "Identifier", + "start": 5944, + "end": 5951, + "loc": { + "start": { + "line": 217, + "column": 30 + }, + "end": { + "line": 217, + "column": 37 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + "computed": false + }, + { + "type": "MemberExpression", + "start": 5953, + "end": 5962, + "loc": { + "start": { + "line": 217, + "column": 39 + }, + "end": { + "line": 217, + "column": 48 + } + }, + "object": { + "type": "ThisExpression", + "start": 5953, + "end": 5957, + "loc": { + "start": { + "line": 217, + "column": 39 + }, + "end": { + "line": 217, + "column": 43 + } + } + }, + "property": { + "type": "Identifier", + "start": 5958, + "end": 5962, + "loc": { + "start": { + "line": 217, + "column": 44 + }, + "end": { + "line": 217, + "column": 48 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + { + "type": "Identifier", + "start": 5964, + "end": 5968, + "loc": { + "start": { + "line": 217, + "column": 50 + }, + "end": { + "line": 217, + "column": 54 + }, + "identifierName": "left" + }, + "name": "left" + }, + { + "type": "Identifier", + "start": 5970, + "end": 5975, + "loc": { + "start": { + "line": 217, + "column": 56 + }, + "end": { + "line": 217, + "column": 61 + }, + "identifierName": "right" + }, + "name": "right" + } + ] + } + } + }, + "alternate": null + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", + "start": 5607, + "end": 5864, + "loc": { + "start": { + "line": 208, + "column": 1 + }, + "end": { + "line": 214, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", + "start": 5983, + "end": 6087, + "loc": { + "start": { + "line": 220, + "column": 1 + }, + "end": { + "line": 224, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 6089, + "end": 6164, + "loc": { + "start": { + "line": 225, + "column": 1 + }, + "end": { + "line": 227, + "column": 2 + } + }, + "static": false, + "kind": "method", + "computed": false, + "key": { + "type": "Identifier", + "start": 6090, + "end": 6095, + "loc": { + "start": { + "line": 225, + "column": 2 + }, + "end": { + "line": 225, + "column": 7 + }, + "identifierName": "items" + }, + "name": "items", + "leadingComments": null + }, + "id": null, + "generator": true, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 6098, + "end": 6164, + "loc": { + "start": { + "line": 225, + "column": 10 + }, + "end": { + "line": 227, + "column": 2 + } + }, + "body": [ + { + "type": "IfStatement", + "start": 6102, + "end": 6161, + "loc": { + "start": { + "line": 226, + "column": 2 + }, + "end": { + "line": 226, + "column": 61 + } + }, + "test": { + "type": "BinaryExpression", + "start": 6106, + "end": 6124, + "loc": { + "start": { + "line": 226, + "column": 6 + }, + "end": { + "line": 226, + "column": 24 + } + }, + "left": { + "type": "MemberExpression", + "start": 6106, + "end": 6115, + "loc": { + "start": { + "line": 226, + "column": 6 + }, + "end": { + "line": 226, + "column": 15 + } + }, + "object": { + "type": "ThisExpression", + "start": 6106, + "end": 6110, + "loc": { + "start": { + "line": 226, + "column": 6 + }, + "end": { + "line": 226, + "column": 10 + } + } + }, + "property": { + "type": "Identifier", + "start": 6111, + "end": 6115, + "loc": { + "start": { + "line": 226, + "column": 11 + }, + "end": { + "line": 226, + "column": 15 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + }, + "operator": "!==", + "right": { + "type": "NullLiteral", + "start": 6120, + "end": 6124, + "loc": { + "start": { + "line": 226, + "column": 20 + }, + "end": { + "line": 226, + "column": 24 + } + } + } + }, + "consequent": { + "type": "ExpressionStatement", + "start": 6126, + "end": 6161, + "loc": { + "start": { + "line": 226, + "column": 26 + }, + "end": { + "line": 226, + "column": 61 + } + }, + "expression": { + "type": "YieldExpression", + "start": 6126, + "end": 6160, + "loc": { + "start": { + "line": 226, + "column": 26 + }, + "end": { + "line": 226, + "column": 60 + } + }, + "delegate": true, + "argument": { + "type": "CallExpression", + "start": 6133, + "end": 6160, + "loc": { + "start": { + "line": 226, + "column": 33 + }, + "end": { + "line": 226, + "column": 60 + } + }, + "callee": { + "type": "Identifier", + "start": 6133, + "end": 6149, + "loc": { + "start": { + "line": 226, + "column": 33 + }, + "end": { + "line": 226, + "column": 49 + }, + "identifierName": "inordertraversal" + }, + "name": "inordertraversal" + }, + "arguments": [ + { + "type": "MemberExpression", + "start": 6150, + "end": 6159, + "loc": { + "start": { + "line": 226, + "column": 50 + }, + "end": { + "line": 226, + "column": 59 + } + }, + "object": { + "type": "ThisExpression", + "start": 6150, + "end": 6154, + "loc": { + "start": { + "line": 226, + "column": 50 + }, + "end": { + "line": 226, + "column": 54 + } + } + }, + "property": { + "type": "Identifier", + "start": 6155, + "end": 6159, + "loc": { + "start": { + "line": 226, + "column": 55 + }, + "end": { + "line": 226, + "column": 59 + }, + "identifierName": "root" + }, + "name": "root" + }, + "computed": false + } + ] + } + } + }, + "alternate": null + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", + "start": 5983, + "end": 6087, + "loc": { + "start": { + "line": 220, + "column": 1 + }, + "end": { + "line": 224, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", + "start": 6167, + "end": 6215, + "loc": { + "start": { + "line": 229, + "column": 1 + }, + "end": { + "line": 231, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 6217, + "end": 6264, + "loc": { + "start": { + "line": 232, + "column": 1 + }, + "end": { + "line": 234, + "column": 2 + } + }, + "static": false, + "computed": true, + "key": { + "type": "MemberExpression", + "start": 6218, + "end": 6233, + "loc": { + "start": { + "line": 232, + "column": 2 + }, + "end": { + "line": 232, + "column": 17 + } + }, + "object": { + "type": "Identifier", + "start": 6218, + "end": 6224, + "loc": { + "start": { + "line": 232, + "column": 2 + }, + "end": { + "line": 232, + "column": 8 + }, + "identifierName": "Symbol" + }, + "name": "Symbol", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 6225, + "end": 6233, + "loc": { + "start": { + "line": 232, + "column": 9 + }, + "end": { + "line": 232, + "column": 17 + }, + "identifierName": "iterator" + }, + "name": "iterator" + }, + "computed": false, + "leadingComments": null + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 6237, + "end": 6264, + "loc": { + "start": { + "line": 232, + "column": 21 + }, + "end": { + "line": 234, + "column": 2 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 6241, + "end": 6261, + "loc": { + "start": { + "line": 233, + "column": 2 + }, + "end": { + "line": 233, + "column": 22 + } + }, + "argument": { + "type": "CallExpression", + "start": 6248, + "end": 6260, + "loc": { + "start": { + "line": 233, + "column": 9 + }, + "end": { + "line": 233, + "column": 21 + } + }, + "callee": { + "type": "MemberExpression", + "start": 6248, + "end": 6258, + "loc": { + "start": { + "line": 233, + "column": 9 + }, + "end": { + "line": 233, + "column": 19 + } + }, + "object": { + "type": "ThisExpression", + "start": 6248, + "end": 6252, + "loc": { + "start": { + "line": 233, + "column": 9 + }, + "end": { + "line": 233, + "column": 13 + } + } + }, + "property": { + "type": "Identifier", + "start": 6253, + "end": 6258, + "loc": { + "start": { + "line": 233, + "column": 14 + }, + "end": { + "line": 233, + "column": 19 + }, + "identifierName": "items" + }, + "name": "items" + }, + "computed": false + }, + "arguments": [] + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", + "start": 6167, + "end": 6215, + "loc": { + "start": { + "line": 229, + "column": 1 + }, + "end": { + "line": 231, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", + "start": 6267, + "end": 6411, + "loc": { + "start": { + "line": 236, + "column": 1 + }, + "end": { + "line": 241, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 6413, + "end": 6475, + "loc": { + "start": { + "line": 242, + "column": 1 + }, + "end": { + "line": 244, + "column": 2 + } + }, + "static": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 6420, + "end": 6425, + "loc": { + "start": { + "line": 242, + "column": 8 + }, + "end": { + "line": 242, + "column": 13 + }, + "identifierName": "empty" + }, + "name": "empty" + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6426, + "end": 6433, + "loc": { + "start": { + "line": 242, + "column": 14 + }, + "end": { + "line": 242, + "column": 21 + }, + "identifierName": "compare" + }, + "name": "compare" + } + ], + "body": { + "type": "BlockStatement", + "start": 6435, + "end": 6475, + "loc": { + "start": { + "line": 242, + "column": 23 + }, + "end": { + "line": 244, + "column": 2 + } + }, + "body": [ + { + "type": "ReturnStatement", + "start": 6439, + "end": 6472, + "loc": { + "start": { + "line": 243, + "column": 2 + }, + "end": { + "line": 243, + "column": 35 + } + }, + "argument": { + "type": "NewExpression", + "start": 6446, + "end": 6471, + "loc": { + "start": { + "line": 243, + "column": 9 + }, + "end": { + "line": 243, + "column": 34 + } + }, + "callee": { + "type": "Identifier", + "start": 6450, + "end": 6462, + "loc": { + "start": { + "line": 243, + "column": 13 + }, + "end": { + "line": 243, + "column": 25 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + }, + "arguments": [ + { + "type": "Identifier", + "start": 6463, + "end": 6470, + "loc": { + "start": { + "line": 243, + "column": 26 + }, + "end": { + "line": 243, + "column": 33 + }, + "identifierName": "compare" + }, + "name": "compare" + } + ] + } + } + ], + "directives": [], + "trailingComments": null + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", + "start": 6267, + "end": 6411, + "loc": { + "start": { + "line": 236, + "column": 1 + }, + "end": { + "line": 241, + "column": 4 + } + } + } + ], + "trailingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "start": 6478, + "end": 6691, + "loc": { + "start": { + "line": 246, + "column": 1 + }, + "end": { + "line": 252, + "column": 4 + } + } + } + ] + }, + { + "type": "ClassMethod", + "start": 6693, + "end": 6840, + "loc": { + "start": { + "line": 253, + "column": 1 + }, + "end": { + "line": 259, + "column": 2 + } + }, + "static": true, + "computed": false, + "key": { + "type": "Identifier", + "start": 6700, + "end": 6704, + "loc": { + "start": { + "line": 253, + "column": 8 + }, + "end": { + "line": 253, + "column": 12 + }, + "identifierName": "from" + }, + "name": "from" + }, + "kind": "method", + "id": null, + "generator": false, + "expression": false, + "async": false, + "params": [ + { + "type": "Identifier", + "start": 6705, + "end": 6712, + "loc": { + "start": { + "line": 253, + "column": 13 + }, + "end": { + "line": 253, + "column": 20 + }, + "identifierName": "compare" + }, + "name": "compare" + }, + { + "type": "Identifier", + "start": 6714, + "end": 6722, + "loc": { + "start": { + "line": 253, + "column": 22 + }, + "end": { + "line": 253, + "column": 30 + }, + "identifierName": "iterable" + }, + "name": "iterable" + } + ], + "body": { + "type": "BlockStatement", + "start": 6724, + "end": 6840, + "loc": { + "start": { + "line": 253, + "column": 32 + }, + "end": { + "line": 259, + "column": 2 + } + }, + "body": [ + { + "type": "VariableDeclaration", + "start": 6728, + "end": 6767, + "loc": { + "start": { + "line": 254, + "column": 2 + }, + "end": { + "line": 254, + "column": 41 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6734, + "end": 6766, + "loc": { + "start": { + "line": 254, + "column": 8 + }, + "end": { + "line": 254, + "column": 40 + } + }, + "id": { + "type": "Identifier", + "start": 6734, + "end": 6738, + "loc": { + "start": { + "line": 254, + "column": 8 + }, + "end": { + "line": 254, + "column": 12 + }, + "identifierName": "tree" + }, + "name": "tree" + }, + "init": { + "type": "NewExpression", + "start": 6741, + "end": 6766, + "loc": { + "start": { + "line": 254, + "column": 15 + }, + "end": { + "line": 254, + "column": 40 + } + }, + "callee": { + "type": "Identifier", + "start": 6745, + "end": 6757, + "loc": { + "start": { + "line": 254, + "column": 19 + }, + "end": { + "line": 254, + "column": 31 + }, + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree" + }, + "arguments": [ + { + "type": "Identifier", + "start": 6758, + "end": 6765, + "loc": { + "start": { + "line": 254, + "column": 32 + }, + "end": { + "line": 254, + "column": 39 + }, + "identifierName": "compare" + }, + "name": "compare" + } + ] + } + } + ], + "kind": "const" + }, + { + "type": "ForOfStatement", + "start": 6771, + "end": 6821, + "loc": { + "start": { + "line": 256, + "column": 2 + }, + "end": { + "line": 256, + "column": 52 + } + }, + "left": { + "type": "VariableDeclaration", + "start": 6776, + "end": 6789, + "loc": { + "start": { + "line": 256, + "column": 7 + }, + "end": { + "line": 256, + "column": 20 + } + }, + "declarations": [ + { + "type": "VariableDeclarator", + "start": 6782, + "end": 6789, + "loc": { + "start": { + "line": 256, + "column": 13 + }, + "end": { + "line": 256, + "column": 20 + } + }, + "id": { + "type": "Identifier", + "start": 6782, + "end": 6789, + "loc": { + "start": { + "line": 256, + "column": 13 + }, + "end": { + "line": 256, + "column": 20 + }, + "identifierName": "element" + }, + "name": "element" + }, + "init": null + } + ], + "kind": "const" + }, + "right": { + "type": "Identifier", + "start": 6793, + "end": 6801, + "loc": { + "start": { + "line": 256, + "column": 24 + }, + "end": { + "line": 256, + "column": 32 + }, + "identifierName": "iterable" + }, + "name": "iterable" + }, + "body": { + "type": "ExpressionStatement", + "start": 6803, + "end": 6821, + "loc": { + "start": { + "line": 256, + "column": 34 + }, + "end": { + "line": 256, + "column": 52 + } + }, + "expression": { + "type": "CallExpression", + "start": 6803, + "end": 6820, + "loc": { + "start": { + "line": 256, + "column": 34 + }, + "end": { + "line": 256, + "column": 51 + } + }, + "callee": { + "type": "MemberExpression", + "start": 6803, + "end": 6811, + "loc": { + "start": { + "line": 256, + "column": 34 + }, + "end": { + "line": 256, + "column": 42 + } + }, + "object": { + "type": "Identifier", + "start": 6803, + "end": 6807, + "loc": { + "start": { + "line": 256, + "column": 34 + }, + "end": { + "line": 256, + "column": 38 + }, + "identifierName": "tree" + }, + "name": "tree" + }, + "property": { + "type": "Identifier", + "start": 6808, + "end": 6811, + "loc": { + "start": { + "line": 256, + "column": 39 + }, + "end": { + "line": 256, + "column": 42 + }, + "identifierName": "add" + }, + "name": "add" + }, + "computed": false + }, + "arguments": [ + { + "type": "Identifier", + "start": 6812, + "end": 6819, + "loc": { + "start": { + "line": 256, + "column": 43 + }, + "end": { + "line": 256, + "column": 50 + }, + "identifierName": "element" + }, + "name": "element" + } + ] + } + } + }, + { + "type": "ReturnStatement", + "start": 6825, + "end": 6837, + "loc": { + "start": { + "line": 258, + "column": 2 + }, + "end": { + "line": 258, + "column": 14 + } + }, + "argument": { + "type": "Identifier", + "start": 6832, + "end": 6836, + "loc": { + "start": { + "line": 258, + "column": 9 + }, + "end": { + "line": 258, + "column": 13 + }, + "identifierName": "tree" + }, + "name": "tree" + } + } + ], + "directives": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "start": 6478, + "end": 6691, + "loc": { + "start": { + "line": 246, + "column": 1 + }, + "end": { + "line": 252, + "column": 4 + } + } + } + ] + } + ] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", + "start": 746, + "end": 795, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ], + "trailingComments": [] + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", + "start": 746, + "end": 795, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentBlock", + "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", + "start": 746, + "end": 795, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", + "start": 833, + "end": 959, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 26, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Function} The comparison function for node keys. ", + "start": 1025, + "end": 1089, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 66 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Node} The root of the tree. ", + "start": 1118, + "end": 1161, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", + "start": 1187, + "end": 1291, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 39, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t * @return {Node} The newly added node.\n\t ", + "start": 1339, + "end": 1459, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 49, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", + "start": 1837, + "end": 2063, + "loc": { + "start": { + "line": 69, + "column": 1 + }, + "end": { + "line": 76, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", + "start": 2171, + "end": 2433, + "loc": { + "start": { + "line": 82, + "column": 1 + }, + "end": { + "line": 89, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", + "start": 2532, + "end": 2687, + "loc": { + "start": { + "line": 95, + "column": 1 + }, + "end": { + "line": 101, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", + "start": 2742, + "end": 2847, + "loc": { + "start": { + "line": 106, + "column": 1 + }, + "end": { + "line": 110, + "column": 4 + } + } + }, + { + "type": "CommentLine", + "value": " Swap node with its predecessor", + "start": 2927, + "end": 2960, + "loc": { + "start": { + "line": 114, + "column": 3 + }, + "end": { + "line": 114, + "column": 36 + } + } + }, + { + "type": "CommentLine", + "value": " Delete predecessor node", + "start": 2999, + "end": 3025, + "loc": { + "start": { + "line": 116, + "column": 3 + }, + "end": { + "line": 116, + "column": 29 + } + } + }, + { + "type": "CommentLine", + "value": " NOTE: this node can have at most one non-leaf (left) child", + "start": 3029, + "end": 3090, + "loc": { + "start": { + "line": 117, + "column": 3 + }, + "end": { + "line": 117, + "column": 64 + } + } + }, + { + "type": "CommentLine", + "value": " because of red-black tree invariant.", + "start": 3094, + "end": 3133, + "loc": { + "start": { + "line": 118, + "column": 3 + }, + "end": { + "line": 118, + "column": 42 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t\t\t * Swap node with its successor.\n\t\t\t *\n\t\t\t * NOTE: Since pred is a leaf, there can only by one node in the\n\t\t\t * right subtree, succ, which is necessarily red, hence\n\t\t\t * node is black.\n\t\t\t *\n\t\t\t * The configuration:\n\t\t\t *\n\t\t\t * (A) (B) (C)\n\t\t\t *\n\t\t\t * p p p\n\t\t\t * | | |\n\t\t\t * node (BLACK) succ (BLACK) succ (BLACK)\n\t\t\t * / \\ / \\ / \\\n\t\t\t * - succ (RED) -> - node (RED) -> - -\n\t\t\t * / \\ / \\\n\t\t\t * - - - -\n\t\t\t *\n\t\t\t * NOTE: We take a shortcut and go directly from (A) to (C)\n\t\t\t ", + "start": 3713, + "end": 4422, + "loc": { + "start": { + "line": 143, + "column": 3 + }, + "end": { + "line": 163, + "column": 6 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#unlink}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 5069, + "end": 5480, + "loc": { + "start": { + "line": 191, + "column": 1 + }, + "end": { + "line": 199, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", + "start": 5607, + "end": 5864, + "loc": { + "start": { + "line": 208, + "column": 1 + }, + "end": { + "line": 214, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", + "start": 5983, + "end": 6087, + "loc": { + "start": { + "line": 220, + "column": 1 + }, + "end": { + "line": 224, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", + "start": 6167, + "end": 6215, + "loc": { + "start": { + "line": 229, + "column": 1 + }, + "end": { + "line": 231, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", + "start": 6267, + "end": 6411, + "loc": { + "start": { + "line": 236, + "column": 1 + }, + "end": { + "line": 241, + "column": 4 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", + "start": 6478, + "end": 6691, + "loc": { + "start": { + "line": 246, + "column": 1 + }, + "end": { + "line": 252, + "column": 4 + } + } + } + ], + "tokens": [ + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 0, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 7, + "end": 13, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 14, + "end": 18, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "assert", + "start": 19, + "end": 27, + "loc": { + "start": { + "line": 1, + "column": 19 + }, + "end": { + "line": 1, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 27, + "end": 28, + "loc": { + "start": { + "line": 1, + "column": 27 + }, + "end": { + "line": 1, + "column": 28 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 29, + "end": 35, + "loc": { + "start": { + "line": 2, + "column": 0 + }, + "end": { + "line": 2, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 36, + "end": 40, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 41, + "end": 45, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 16 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "./Node.js", + "start": 46, + "end": 57, + "loc": { + "start": { + "line": 2, + "column": 17 + }, + "end": { + "line": 2, + "column": 28 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 57, + "end": 58, + "loc": { + "start": { + "line": 2, + "column": 28 + }, + "end": { + "line": 2, + "column": 29 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 59, + "end": 65, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 66, + "end": 71, + "loc": { + "start": { + "line": 3, + "column": 7 + }, + "end": { + "line": 3, + "column": 12 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 72, + "end": 76, + "loc": { + "start": { + "line": 3, + "column": 13 + }, + "end": { + "line": 3, + "column": 17 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/BLACK.js", + "start": 77, + "end": 96, + "loc": { + "start": { + "line": 3, + "column": 18 + }, + "end": { + "line": 3, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 96, + "end": 97, + "loc": { + "start": { + "line": 3, + "column": 37 + }, + "end": { + "line": 3, + "column": 38 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 98, + "end": 104, + "loc": { + "start": { + "line": 4, + "column": 0 + }, + "end": { + "line": 4, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 105, + "end": 108, + "loc": { + "start": { + "line": 4, + "column": 7 + }, + "end": { + "line": 4, + "column": 10 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 109, + "end": 113, + "loc": { + "start": { + "line": 4, + "column": 11 + }, + "end": { + "line": 4, + "column": 15 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../color/RED.js", + "start": 114, + "end": 131, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 131, + "end": 132, + "loc": { + "start": { + "line": 4, + "column": 33 + }, + "end": { + "line": 4, + "column": 34 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 133, + "end": 139, + "loc": { + "start": { + "line": 5, + "column": 0 + }, + "end": { + "line": 5, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "predecessor", + "start": 140, + "end": 151, + "loc": { + "start": { + "line": 5, + "column": 7 + }, + "end": { + "line": 5, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 152, + "end": 156, + "loc": { + "start": { + "line": 5, + "column": 19 + }, + "end": { + "line": 5, + "column": 23 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../family/predecessor.js", + "start": 157, + "end": 183, + "loc": { + "start": { + "line": 5, + "column": 24 + }, + "end": { + "line": 5, + "column": 50 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 183, + "end": 184, + "loc": { + "start": { + "line": 5, + "column": 50 + }, + "end": { + "line": 5, + "column": 51 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 185, + "end": 191, + "loc": { + "start": { + "line": 6, + "column": 0 + }, + "end": { + "line": 6, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert", + "start": 192, + "end": 198, + "loc": { + "start": { + "line": 6, + "column": 7 + }, + "end": { + "line": 6, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 199, + "end": 203, + "loc": { + "start": { + "line": 6, + "column": 14 + }, + "end": { + "line": 6, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../insertion/insert.js", + "start": 204, + "end": 228, + "loc": { + "start": { + "line": 6, + "column": 19 + }, + "end": { + "line": 6, + "column": 43 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 228, + "end": 229, + "loc": { + "start": { + "line": 6, + "column": 43 + }, + "end": { + "line": 6, + "column": 44 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 230, + "end": 236, + "loc": { + "start": { + "line": 7, + "column": 0 + }, + "end": { + "line": 7, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case2", + "start": 237, + "end": 249, + "loc": { + "start": { + "line": 7, + "column": 7 + }, + "end": { + "line": 7, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 250, + "end": 254, + "loc": { + "start": { + "line": 7, + "column": 20 + }, + "end": { + "line": 7, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../insertion/insert_case2.js", + "start": 255, + "end": 285, + "loc": { + "start": { + "line": 7, + "column": 25 + }, + "end": { + "line": 7, + "column": 55 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 285, + "end": 286, + "loc": { + "start": { + "line": 7, + "column": 55 + }, + "end": { + "line": 7, + "column": 56 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 287, + "end": 293, + "loc": { + "start": { + "line": 8, + "column": 0 + }, + "end": { + "line": 8, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_one_child", + "start": 294, + "end": 310, + "loc": { + "start": { + "line": 8, + "column": 7 + }, + "end": { + "line": 8, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 311, + "end": 315, + "loc": { + "start": { + "line": 8, + "column": 24 + }, + "end": { + "line": 8, + "column": 28 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../deletion/delete_one_child.js", + "start": 316, + "end": 349, + "loc": { + "start": { + "line": 8, + "column": 29 + }, + "end": { + "line": 8, + "column": 62 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 349, + "end": 350, + "loc": { + "start": { + "line": 8, + "column": 62 + }, + "end": { + "line": 8, + "column": 63 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 351, + "end": 357, + "loc": { + "start": { + "line": 9, + "column": 0 + }, + "end": { + "line": 9, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "delete_no_child", + "start": 358, + "end": 373, + "loc": { + "start": { + "line": 9, + "column": 7 + }, + "end": { + "line": 9, + "column": 22 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 374, + "end": 378, + "loc": { + "start": { + "line": 9, + "column": 23 + }, + "end": { + "line": 9, + "column": 27 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../deletion/delete_no_child.js", + "start": 379, + "end": 411, + "loc": { + "start": { + "line": 9, + "column": 28 + }, + "end": { + "line": 9, + "column": 60 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 411, + "end": 412, + "loc": { + "start": { + "line": 9, + "column": 60 + }, + "end": { + "line": 9, + "column": 61 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 413, + "end": 419, + "loc": { + "start": { + "line": 10, + "column": 0 + }, + "end": { + "line": 10, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "search", + "start": 420, + "end": 426, + "loc": { + "start": { + "line": 10, + "column": 7 + }, + "end": { + "line": 10, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 427, + "end": 431, + "loc": { + "start": { + "line": 10, + "column": 14 + }, + "end": { + "line": 10, + "column": 18 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../search/search.js", + "start": 432, + "end": 453, + "loc": { + "start": { + "line": 10, + "column": 19 + }, + "end": { + "line": 10, + "column": 40 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 453, + "end": 454, + "loc": { + "start": { + "line": 10, + "column": 40 + }, + "end": { + "line": 10, + "column": 41 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 455, + "end": 461, + "loc": { + "start": { + "line": 11, + "column": 0 + }, + "end": { + "line": 11, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "inordertraversal", + "start": 462, + "end": 478, + "loc": { + "start": { + "line": 11, + "column": 7 + }, + "end": { + "line": 11, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 479, + "end": 483, + "loc": { + "start": { + "line": 11, + "column": 24 + }, + "end": { + "line": 11, + "column": 28 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../traversal/inordertraversal.js", + "start": 484, + "end": 518, + "loc": { + "start": { + "line": 11, + "column": 29 + }, + "end": { + "line": 11, + "column": 63 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 518, + "end": 519, + "loc": { + "start": { + "line": 11, + "column": 63 + }, + "end": { + "line": 11, + "column": 64 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 520, + "end": 526, + "loc": { + "start": { + "line": 12, + "column": 0 + }, + "end": { + "line": 12, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "rangetraversal", + "start": 527, + "end": 541, + "loc": { + "start": { + "line": 12, + "column": 7 + }, + "end": { + "line": 12, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 542, + "end": 546, + "loc": { + "start": { + "line": 12, + "column": 22 + }, + "end": { + "line": 12, + "column": 26 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../traversal/rangetraversal.js", + "start": 547, + "end": 579, + "loc": { + "start": { + "line": 12, + "column": 27 + }, + "end": { + "line": 12, + "column": 59 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 579, + "end": 580, + "loc": { + "start": { + "line": 12, + "column": 59 + }, + "end": { + "line": 12, + "column": 60 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 581, + "end": 587, + "loc": { + "start": { + "line": 13, + "column": 0 + }, + "end": { + "line": 13, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "replace_node", + "start": 588, + "end": 600, + "loc": { + "start": { + "line": 13, + "column": 7 + }, + "end": { + "line": 13, + "column": 19 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 601, + "end": 605, + "loc": { + "start": { + "line": 13, + "column": 20 + }, + "end": { + "line": 13, + "column": 24 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../deletion/replace_node.js", + "start": 606, + "end": 635, + "loc": { + "start": { + "line": 13, + "column": 25 + }, + "end": { + "line": 13, + "column": 54 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 635, + "end": 636, + "loc": { + "start": { + "line": 13, + "column": 54 + }, + "end": { + "line": 13, + "column": 55 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 637, + "end": 643, + "loc": { + "start": { + "line": 14, + "column": 0 + }, + "end": { + "line": 14, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_non_adjacent", + "start": 644, + "end": 661, + "loc": { + "start": { + "line": 14, + "column": 7 + }, + "end": { + "line": 14, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 662, + "end": 666, + "loc": { + "start": { + "line": 14, + "column": 25 + }, + "end": { + "line": 14, + "column": 29 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../swap/swap_non_adjacent.js", + "start": 667, + "end": 697, + "loc": { + "start": { + "line": 14, + "column": 30 + }, + "end": { + "line": 14, + "column": 60 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 697, + "end": 698, + "loc": { + "start": { + "line": 14, + "column": 60 + }, + "end": { + "line": 14, + "column": 61 + } + } + }, + { + "type": { + "label": "import", + "keyword": "import", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "import", + "start": 699, + "end": 705, + "loc": { + "start": { + "line": 15, + "column": 0 + }, + "end": { + "line": 15, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "swap_left", + "start": 706, + "end": 715, + "loc": { + "start": { + "line": 15, + "column": 7 + }, + "end": { + "line": 15, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "from", + "start": 716, + "end": 720, + "loc": { + "start": { + "line": 15, + "column": 17 + }, + "end": { + "line": 15, + "column": 21 + } + } + }, + { + "type": { + "label": "string", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "../swap/swap_left.js", + "start": 721, + "end": 743, + "loc": { + "start": { + "line": 15, + "column": 22 + }, + "end": { + "line": 15, + "column": 44 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 743, + "end": 744, + "loc": { + "start": { + "line": 15, + "column": 44 + }, + "end": { + "line": 15, + "column": 45 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", + "start": 746, + "end": 795, + "loc": { + "start": { + "line": 17, + "column": 0 + }, + "end": { + "line": 20, + "column": 3 + } + } + }, + { + "type": { + "label": "export", + "keyword": "export", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "export", + "start": 796, + "end": 802, + "loc": { + "start": { + "line": 21, + "column": 0 + }, + "end": { + "line": 21, + "column": 6 + } + } + }, + { + "type": { + "label": "default", + "keyword": "default", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "default", + "start": 803, + "end": 810, + "loc": { + "start": { + "line": 21, + "column": 7 + }, + "end": { + "line": 21, + "column": 14 + } + } + }, + { + "type": { + "label": "class", + "keyword": "class", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "class", + "start": 811, + "end": 816, + "loc": { + "start": { + "line": 21, + "column": 15 + }, + "end": { + "line": 21, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RedBlackTree", + "start": 817, + "end": 829, + "loc": { + "start": { + "line": 21, + "column": 21 + }, + "end": { + "line": 21, + "column": 33 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 830, + "end": 831, + "loc": { + "start": { + "line": 21, + "column": 34 + }, + "end": { + "line": 21, + "column": 35 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", + "start": 833, + "end": 959, + "loc": { + "start": { + "line": 22, + "column": 1 + }, + "end": { + "line": 26, + "column": 4 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "constructor", + "start": 961, + "end": 972, + "loc": { + "start": { + "line": 27, + "column": 1 + }, + "end": { + "line": 27, + "column": 12 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 972, + "end": 973, + "loc": { + "start": { + "line": 27, + "column": 12 + }, + "end": { + "line": 27, + "column": 13 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 973, + "end": 980, + "loc": { + "start": { + "line": 27, + "column": 13 + }, + "end": { + "line": 27, + "column": 20 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 980, + "end": 981, + "loc": { + "start": { + "line": 27, + "column": 20 + }, + "end": { + "line": 27, + "column": 21 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 982, + "end": 983, + "loc": { + "start": { + "line": 27, + "column": 22 + }, + "end": { + "line": 27, + "column": 23 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 986, + "end": 992, + "loc": { + "start": { + "line": 28, + "column": 2 + }, + "end": { + "line": 28, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 992, + "end": 993, + "loc": { + "start": { + "line": 28, + "column": 8 + }, + "end": { + "line": 28, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 993, + "end": 1000, + "loc": { + "start": { + "line": 28, + "column": 9 + }, + "end": { + "line": 28, + "column": 16 + } + } + }, + { + "type": { + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 7, + "updateContext": null + }, + "value": "instanceof", + "start": 1001, + "end": 1011, + "loc": { + "start": { + "line": 28, + "column": 17 + }, + "end": { + "line": 28, + "column": 27 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Function", + "start": 1012, + "end": 1020, + "loc": { + "start": { + "line": 28, + "column": 28 + }, + "end": { + "line": 28, + "column": 36 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1020, + "end": 1021, + "loc": { + "start": { + "line": 28, + "column": 36 + }, + "end": { + "line": 28, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1021, + "end": 1022, + "loc": { + "start": { + "line": 28, + "column": 37 + }, + "end": { + "line": 28, + "column": 38 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Function} The comparison function for node keys. ", + "start": 1025, + "end": 1089, + "loc": { + "start": { + "line": 29, + "column": 2 + }, + "end": { + "line": 29, + "column": 66 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1092, + "end": 1096, + "loc": { + "start": { + "line": 30, + "column": 2 + }, + "end": { + "line": 30, + "column": 6 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1096, + "end": 1097, + "loc": { + "start": { + "line": 30, + "column": 6 + }, + "end": { + "line": 30, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 1097, + "end": 1104, + "loc": { + "start": { + "line": 30, + "column": 7 + }, + "end": { + "line": 30, + "column": 14 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1105, + "end": 1106, + "loc": { + "start": { + "line": 30, + "column": 15 + }, + "end": { + "line": 30, + "column": 16 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 1107, + "end": 1114, + "loc": { + "start": { + "line": 30, + "column": 17 + }, + "end": { + "line": 30, + "column": 24 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1114, + "end": 1115, + "loc": { + "start": { + "line": 30, + "column": 24 + }, + "end": { + "line": 30, + "column": 25 + } + } + }, + { + "type": "CommentBlock", + "value": "* @member {Node} The root of the tree. ", + "start": 1118, + "end": 1161, + "loc": { + "start": { + "line": 31, + "column": 2 + }, + "end": { + "line": 31, + "column": 45 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1164, + "end": 1168, + "loc": { + "start": { + "line": 32, + "column": 2 + }, + "end": { + "line": 32, + "column": 6 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1168, + "end": 1169, + "loc": { + "start": { + "line": 32, + "column": 6 + }, + "end": { + "line": 32, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1169, + "end": 1173, + "loc": { + "start": { + "line": 32, + "column": 7 + }, + "end": { + "line": 32, + "column": 11 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1174, + "end": 1175, + "loc": { + "start": { + "line": 32, + "column": 12 + }, + "end": { + "line": 32, + "column": 13 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1176, + "end": 1180, + "loc": { + "start": { + "line": 32, + "column": 14 + }, + "end": { + "line": 32, + "column": 18 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1180, + "end": 1181, + "loc": { + "start": { + "line": 32, + "column": 18 + }, + "end": { + "line": 32, + "column": 19 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1183, + "end": 1184, + "loc": { + "start": { + "line": 33, + "column": 1 + }, + "end": { + "line": 33, + "column": 2 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", + "start": 1187, + "end": 1291, + "loc": { + "start": { + "line": 35, + "column": 1 + }, + "end": { + "line": 39, + "column": 4 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "isEmpty", + "start": 1293, + "end": 1300, + "loc": { + "start": { + "line": 40, + "column": 1 + }, + "end": { + "line": 40, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1300, + "end": 1301, + "loc": { + "start": { + "line": 40, + "column": 8 + }, + "end": { + "line": 40, + "column": 9 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1301, + "end": 1302, + "loc": { + "start": { + "line": 40, + "column": 9 + }, + "end": { + "line": 40, + "column": 10 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1303, + "end": 1304, + "loc": { + "start": { + "line": 40, + "column": 11 + }, + "end": { + "line": 40, + "column": 12 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 1307, + "end": 1313, + "loc": { + "start": { + "line": 41, + "column": 2 + }, + "end": { + "line": 41, + "column": 8 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1314, + "end": 1318, + "loc": { + "start": { + "line": 41, + "column": 9 + }, + "end": { + "line": 41, + "column": 13 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1318, + "end": 1319, + "loc": { + "start": { + "line": 41, + "column": 13 + }, + "end": { + "line": 41, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1319, + "end": 1323, + "loc": { + "start": { + "line": 41, + "column": 14 + }, + "end": { + "line": 41, + "column": 18 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 1324, + "end": 1327, + "loc": { + "start": { + "line": 41, + "column": 19 + }, + "end": { + "line": 41, + "column": 22 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1328, + "end": 1332, + "loc": { + "start": { + "line": 41, + "column": 23 + }, + "end": { + "line": 41, + "column": 27 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1332, + "end": 1333, + "loc": { + "start": { + "line": 41, + "column": 27 + }, + "end": { + "line": 41, + "column": 28 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1335, + "end": 1336, + "loc": { + "start": { + "line": 42, + "column": 1 + }, + "end": { + "line": 42, + "column": 2 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t * @return {Node} The newly added node.\n\t ", + "start": 1339, + "end": 1459, + "loc": { + "start": { + "line": 44, + "column": 1 + }, + "end": { + "line": 49, + "column": 4 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "add", + "start": 1461, + "end": 1464, + "loc": { + "start": { + "line": 50, + "column": 1 + }, + "end": { + "line": 50, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1464, + "end": 1465, + "loc": { + "start": { + "line": 50, + "column": 4 + }, + "end": { + "line": 50, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 1465, + "end": 1468, + "loc": { + "start": { + "line": 50, + "column": 5 + }, + "end": { + "line": 50, + "column": 8 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1468, + "end": 1469, + "loc": { + "start": { + "line": 50, + "column": 8 + }, + "end": { + "line": 50, + "column": 9 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1470, + "end": 1471, + "loc": { + "start": { + "line": 50, + "column": 10 + }, + "end": { + "line": 50, + "column": 11 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1474, + "end": 1476, + "loc": { + "start": { + "line": 51, + "column": 2 + }, + "end": { + "line": 51, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1477, + "end": 1478, + "loc": { + "start": { + "line": 51, + "column": 5 + }, + "end": { + "line": 51, + "column": 6 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1478, + "end": 1482, + "loc": { + "start": { + "line": 51, + "column": 6 + }, + "end": { + "line": 51, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1482, + "end": 1483, + "loc": { + "start": { + "line": 51, + "column": 10 + }, + "end": { + "line": 51, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1483, + "end": 1487, + "loc": { + "start": { + "line": 51, + "column": 11 + }, + "end": { + "line": 51, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 1488, + "end": 1491, + "loc": { + "start": { + "line": 51, + "column": 16 + }, + "end": { + "line": 51, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1492, + "end": 1496, + "loc": { + "start": { + "line": 51, + "column": 20 + }, + "end": { + "line": 51, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1496, + "end": 1497, + "loc": { + "start": { + "line": 51, + "column": 24 + }, + "end": { + "line": 51, + "column": 25 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1498, + "end": 1499, + "loc": { + "start": { + "line": 51, + "column": 26 + }, + "end": { + "line": 51, + "column": 27 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1503, + "end": 1507, + "loc": { + "start": { + "line": 52, + "column": 3 + }, + "end": { + "line": 52, + "column": 7 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1507, + "end": 1508, + "loc": { + "start": { + "line": 52, + "column": 7 + }, + "end": { + "line": 52, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1508, + "end": 1512, + "loc": { + "start": { + "line": 52, + "column": 8 + }, + "end": { + "line": 52, + "column": 12 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1513, + "end": 1514, + "loc": { + "start": { + "line": 52, + "column": 13 + }, + "end": { + "line": 52, + "column": 14 + } + } + }, + { + "type": { + "label": "new", + "keyword": "new", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "new", + "start": 1515, + "end": 1518, + "loc": { + "start": { + "line": 52, + "column": 15 + }, + "end": { + "line": 52, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 1519, + "end": 1523, + "loc": { + "start": { + "line": 52, + "column": 19 + }, + "end": { + "line": 52, + "column": 23 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1523, + "end": 1524, + "loc": { + "start": { + "line": 52, + "column": 23 + }, + "end": { + "line": 52, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 1524, + "end": 1529, + "loc": { + "start": { + "line": 52, + "column": 24 + }, + "end": { + "line": 52, + "column": 29 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1529, + "end": 1530, + "loc": { + "start": { + "line": 52, + "column": 29 + }, + "end": { + "line": 52, + "column": 30 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 1531, + "end": 1534, + "loc": { + "start": { + "line": 52, + "column": 31 + }, + "end": { + "line": 52, + "column": 34 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1534, + "end": 1535, + "loc": { + "start": { + "line": 52, + "column": 34 + }, + "end": { + "line": 52, + "column": 35 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1535, + "end": 1536, + "loc": { + "start": { + "line": 52, + "column": 35 + }, + "end": { + "line": 52, + "column": 36 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 1540, + "end": 1546, + "loc": { + "start": { + "line": 53, + "column": 3 + }, + "end": { + "line": 53, + "column": 9 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1547, + "end": 1551, + "loc": { + "start": { + "line": 53, + "column": 10 + }, + "end": { + "line": 53, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1551, + "end": 1552, + "loc": { + "start": { + "line": 53, + "column": 14 + }, + "end": { + "line": 53, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1552, + "end": 1556, + "loc": { + "start": { + "line": 53, + "column": 15 + }, + "end": { + "line": 53, + "column": 19 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1556, + "end": 1557, + "loc": { + "start": { + "line": 53, + "column": 19 + }, + "end": { + "line": 53, + "column": 20 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1560, + "end": 1561, + "loc": { + "start": { + "line": 54, + "column": 2 + }, + "end": { + "line": 54, + "column": 3 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 1565, + "end": 1570, + "loc": { + "start": { + "line": 56, + "column": 2 + }, + "end": { + "line": 56, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 1571, + "end": 1575, + "loc": { + "start": { + "line": 56, + "column": 8 + }, + "end": { + "line": 56, + "column": 12 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1576, + "end": 1577, + "loc": { + "start": { + "line": 56, + "column": 13 + }, + "end": { + "line": 56, + "column": 14 + } + } + }, + { + "type": { + "label": "new", + "keyword": "new", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "new", + "start": 1578, + "end": 1581, + "loc": { + "start": { + "line": 56, + "column": 15 + }, + "end": { + "line": 56, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "Node", + "start": 1582, + "end": 1586, + "loc": { + "start": { + "line": 56, + "column": 19 + }, + "end": { + "line": 56, + "column": 23 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1586, + "end": 1587, + "loc": { + "start": { + "line": 56, + "column": 23 + }, + "end": { + "line": 56, + "column": 24 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "RED", + "start": 1587, + "end": 1590, + "loc": { + "start": { + "line": 56, + "column": 24 + }, + "end": { + "line": 56, + "column": 27 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1590, + "end": 1591, + "loc": { + "start": { + "line": 56, + "column": 27 + }, + "end": { + "line": 56, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 1592, + "end": 1595, + "loc": { + "start": { + "line": 56, + "column": 29 + }, + "end": { + "line": 56, + "column": 32 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1595, + "end": 1596, + "loc": { + "start": { + "line": 56, + "column": 32 + }, + "end": { + "line": 56, + "column": 33 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1596, + "end": 1597, + "loc": { + "start": { + "line": 56, + "column": 33 + }, + "end": { + "line": 56, + "column": 34 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert", + "start": 1600, + "end": 1606, + "loc": { + "start": { + "line": 57, + "column": 2 + }, + "end": { + "line": 57, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1606, + "end": 1607, + "loc": { + "start": { + "line": 57, + "column": 8 + }, + "end": { + "line": 57, + "column": 9 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1607, + "end": 1611, + "loc": { + "start": { + "line": 57, + "column": 9 + }, + "end": { + "line": 57, + "column": 13 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1611, + "end": 1612, + "loc": { + "start": { + "line": 57, + "column": 13 + }, + "end": { + "line": 57, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 1612, + "end": 1619, + "loc": { + "start": { + "line": 57, + "column": 14 + }, + "end": { + "line": 57, + "column": 21 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1619, + "end": 1620, + "loc": { + "start": { + "line": 57, + "column": 21 + }, + "end": { + "line": 57, + "column": 22 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1621, + "end": 1625, + "loc": { + "start": { + "line": 57, + "column": 23 + }, + "end": { + "line": 57, + "column": 27 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1625, + "end": 1626, + "loc": { + "start": { + "line": 57, + "column": 27 + }, + "end": { + "line": 57, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1626, + "end": 1630, + "loc": { + "start": { + "line": 57, + "column": 28 + }, + "end": { + "line": 57, + "column": 32 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1630, + "end": 1631, + "loc": { + "start": { + "line": 57, + "column": 32 + }, + "end": { + "line": 57, + "column": 33 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 1632, + "end": 1636, + "loc": { + "start": { + "line": 57, + "column": 34 + }, + "end": { + "line": 57, + "column": 38 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1636, + "end": 1637, + "loc": { + "start": { + "line": 57, + "column": 38 + }, + "end": { + "line": 57, + "column": 39 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1637, + "end": 1638, + "loc": { + "start": { + "line": 57, + "column": 39 + }, + "end": { + "line": 57, + "column": 40 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "assert", + "start": 1641, + "end": 1647, + "loc": { + "start": { + "line": 58, + "column": 2 + }, + "end": { + "line": 58, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1647, + "end": 1648, + "loc": { + "start": { + "line": 58, + "column": 8 + }, + "end": { + "line": 58, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 1648, + "end": 1652, + "loc": { + "start": { + "line": 58, + "column": 9 + }, + "end": { + "line": 58, + "column": 13 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1652, + "end": 1653, + "loc": { + "start": { + "line": 58, + "column": 13 + }, + "end": { + "line": 58, + "column": 14 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1653, + "end": 1659, + "loc": { + "start": { + "line": 58, + "column": 14 + }, + "end": { + "line": 58, + "column": 20 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1660, + "end": 1663, + "loc": { + "start": { + "line": 58, + "column": 21 + }, + "end": { + "line": 58, + "column": 24 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1664, + "end": 1668, + "loc": { + "start": { + "line": 58, + "column": 25 + }, + "end": { + "line": 58, + "column": 29 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1668, + "end": 1669, + "loc": { + "start": { + "line": 58, + "column": 29 + }, + "end": { + "line": 58, + "column": 30 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1669, + "end": 1670, + "loc": { + "start": { + "line": 58, + "column": 30 + }, + "end": { + "line": 58, + "column": 31 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1673, + "end": 1675, + "loc": { + "start": { + "line": 59, + "column": 2 + }, + "end": { + "line": 59, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1676, + "end": 1677, + "loc": { + "start": { + "line": 59, + "column": 5 + }, + "end": { + "line": 59, + "column": 6 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 1677, + "end": 1681, + "loc": { + "start": { + "line": 59, + "column": 6 + }, + "end": { + "line": 59, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1681, + "end": 1682, + "loc": { + "start": { + "line": 59, + "column": 10 + }, + "end": { + "line": 59, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1682, + "end": 1688, + "loc": { + "start": { + "line": 59, + "column": 11 + }, + "end": { + "line": 59, + "column": 17 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1688, + "end": 1689, + "loc": { + "start": { + "line": 59, + "column": 17 + }, + "end": { + "line": 59, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_color", + "start": 1689, + "end": 1695, + "loc": { + "start": { + "line": 59, + "column": 18 + }, + "end": { + "line": 59, + "column": 24 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "!==", + "start": 1696, + "end": 1699, + "loc": { + "start": { + "line": 59, + "column": 25 + }, + "end": { + "line": 59, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "BLACK", + "start": 1700, + "end": 1705, + "loc": { + "start": { + "line": 59, + "column": 29 + }, + "end": { + "line": 59, + "column": 34 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1705, + "end": 1706, + "loc": { + "start": { + "line": 59, + "column": 34 + }, + "end": { + "line": 59, + "column": 35 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1707, + "end": 1708, + "loc": { + "start": { + "line": 59, + "column": 36 + }, + "end": { + "line": 59, + "column": 37 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 1712, + "end": 1717, + "loc": { + "start": { + "line": 60, + "column": 3 + }, + "end": { + "line": 60, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "subtree", + "start": 1718, + "end": 1725, + "loc": { + "start": { + "line": 60, + "column": 9 + }, + "end": { + "line": 60, + "column": 16 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1726, + "end": 1727, + "loc": { + "start": { + "line": 60, + "column": 17 + }, + "end": { + "line": 60, + "column": 18 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "insert_case2", + "start": 1728, + "end": 1740, + "loc": { + "start": { + "line": 60, + "column": 19 + }, + "end": { + "line": 60, + "column": 31 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1740, + "end": 1741, + "loc": { + "start": { + "line": 60, + "column": 31 + }, + "end": { + "line": 60, + "column": 32 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 1741, + "end": 1745, + "loc": { + "start": { + "line": 60, + "column": 32 + }, + "end": { + "line": 60, + "column": 36 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1745, + "end": 1746, + "loc": { + "start": { + "line": 60, + "column": 36 + }, + "end": { + "line": 60, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1746, + "end": 1747, + "loc": { + "start": { + "line": 60, + "column": 37 + }, + "end": { + "line": 60, + "column": 38 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 1751, + "end": 1753, + "loc": { + "start": { + "line": 61, + "column": 3 + }, + "end": { + "line": 61, + "column": 5 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1754, + "end": 1755, + "loc": { + "start": { + "line": 61, + "column": 6 + }, + "end": { + "line": 61, + "column": 7 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "subtree", + "start": 1755, + "end": 1762, + "loc": { + "start": { + "line": 61, + "column": 7 + }, + "end": { + "line": 61, + "column": 14 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1762, + "end": 1763, + "loc": { + "start": { + "line": 61, + "column": 14 + }, + "end": { + "line": 61, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "parent", + "start": 1763, + "end": 1769, + "loc": { + "start": { + "line": 61, + "column": 15 + }, + "end": { + "line": 61, + "column": 21 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 1770, + "end": 1773, + "loc": { + "start": { + "line": 61, + "column": 22 + }, + "end": { + "line": 61, + "column": 25 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 1774, + "end": 1778, + "loc": { + "start": { + "line": 61, + "column": 26 + }, + "end": { + "line": 61, + "column": 30 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1778, + "end": 1779, + "loc": { + "start": { + "line": 61, + "column": 30 + }, + "end": { + "line": 61, + "column": 31 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1780, + "end": 1781, + "loc": { + "start": { + "line": 61, + "column": 32 + }, + "end": { + "line": 61, + "column": 33 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 1786, + "end": 1790, + "loc": { + "start": { + "line": 62, + "column": 4 + }, + "end": { + "line": 62, + "column": 8 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1790, + "end": 1791, + "loc": { + "start": { + "line": 62, + "column": 8 + }, + "end": { + "line": 62, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 1791, + "end": 1795, + "loc": { + "start": { + "line": 62, + "column": 9 + }, + "end": { + "line": 62, + "column": 13 + } + } + }, + { + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 1796, + "end": 1797, + "loc": { + "start": { + "line": 62, + "column": 14 + }, + "end": { + "line": 62, + "column": 15 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "subtree", + "start": 1798, + "end": 1805, + "loc": { + "start": { + "line": 62, + "column": 16 + }, + "end": { + "line": 62, + "column": 23 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1805, + "end": 1806, + "loc": { + "start": { + "line": 62, + "column": 23 + }, + "end": { + "line": 62, + "column": 24 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1810, + "end": 1811, + "loc": { + "start": { + "line": 63, + "column": 3 + }, + "end": { + "line": 63, + "column": 4 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1814, + "end": 1815, + "loc": { + "start": { + "line": 64, + "column": 2 + }, + "end": { + "line": 64, + "column": 3 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 1819, + "end": 1825, + "loc": { + "start": { + "line": 66, + "column": 2 + }, + "end": { + "line": 66, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 1826, + "end": 1830, + "loc": { + "start": { + "line": 66, + "column": 9 + }, + "end": { + "line": 66, + "column": 13 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 1830, + "end": 1831, + "loc": { + "start": { + "line": 66, + "column": 13 + }, + "end": { + "line": 66, + "column": 14 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 1833, + "end": 1834, + "loc": { + "start": { + "line": 67, + "column": 1 + }, + "end": { + "line": 67, + "column": 2 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", + "start": 1837, + "end": 2063, + "loc": { + "start": { + "line": 69, + "column": 1 + }, + "end": { + "line": 76, + "column": 4 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_search", + "start": 2065, + "end": 2072, + "loc": { + "start": { + "line": 77, + "column": 1 + }, + "end": { + "line": 77, + "column": 8 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2072, + "end": 2073, + "loc": { + "start": { + "line": 77, + "column": 8 + }, + "end": { + "line": 77, + "column": 9 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 2073, + "end": 2076, + "loc": { + "start": { + "line": 77, + "column": 9 + }, + "end": { + "line": 77, + "column": 12 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2076, + "end": 2077, + "loc": { + "start": { + "line": 77, + "column": 12 + }, + "end": { + "line": 77, + "column": 13 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2078, + "end": 2079, + "loc": { + "start": { + "line": 77, + "column": 14 + }, + "end": { + "line": 77, + "column": 15 + } + } + }, + { + "type": { + "label": "if", + "keyword": "if", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "if", + "start": 2082, + "end": 2084, + "loc": { + "start": { + "line": 78, + "column": 2 + }, + "end": { + "line": 78, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2085, + "end": 2086, + "loc": { + "start": { + "line": 78, + "column": 5 + }, + "end": { + "line": 78, + "column": 6 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 2086, + "end": 2090, + "loc": { + "start": { + "line": 78, + "column": 6 + }, + "end": { + "line": 78, + "column": 10 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2090, + "end": 2091, + "loc": { + "start": { + "line": 78, + "column": 10 + }, + "end": { + "line": 78, + "column": 11 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 2091, + "end": 2095, + "loc": { + "start": { + "line": 78, + "column": 11 + }, + "end": { + "line": 78, + "column": 15 + } + } + }, + { + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 2096, + "end": 2099, + "loc": { + "start": { + "line": 78, + "column": 16 + }, + "end": { + "line": 78, + "column": 19 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 2100, + "end": 2104, + "loc": { + "start": { + "line": 78, + "column": 20 + }, + "end": { + "line": 78, + "column": 24 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2104, + "end": 2105, + "loc": { + "start": { + "line": 78, + "column": 24 + }, + "end": { + "line": 78, + "column": 25 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 2106, + "end": 2112, + "loc": { + "start": { + "line": 78, + "column": 26 + }, + "end": { + "line": 78, + "column": 32 + } + } + }, + { + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 2113, + "end": 2117, + "loc": { + "start": { + "line": 78, + "column": 33 + }, + "end": { + "line": 78, + "column": 37 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2117, + "end": 2118, + "loc": { + "start": { + "line": 78, + "column": 37 + }, + "end": { + "line": 78, + "column": 38 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 2121, + "end": 2127, + "loc": { + "start": { + "line": 79, + "column": 2 + }, + "end": { + "line": 79, + "column": 8 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "search", + "start": 2128, + "end": 2134, + "loc": { + "start": { + "line": 79, + "column": 9 + }, + "end": { + "line": 79, + "column": 15 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2134, + "end": 2135, + "loc": { + "start": { + "line": 79, + "column": 15 + }, + "end": { + "line": 79, + "column": 16 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 2135, + "end": 2139, + "loc": { + "start": { + "line": 79, + "column": 16 + }, + "end": { + "line": 79, + "column": 20 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2139, + "end": 2140, + "loc": { + "start": { + "line": 79, + "column": 20 + }, + "end": { + "line": 79, + "column": 21 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "compare", + "start": 2140, + "end": 2147, + "loc": { + "start": { + "line": 79, + "column": 21 + }, + "end": { + "line": 79, + "column": 28 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2147, + "end": 2148, + "loc": { + "start": { + "line": 79, + "column": 28 + }, + "end": { + "line": 79, + "column": 29 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 2149, + "end": 2153, + "loc": { + "start": { + "line": 79, + "column": 30 + }, + "end": { + "line": 79, + "column": 34 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2153, + "end": 2154, + "loc": { + "start": { + "line": 79, + "column": 34 + }, + "end": { + "line": 79, + "column": 35 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "root", + "start": 2154, + "end": 2158, + "loc": { + "start": { + "line": 79, + "column": 35 + }, + "end": { + "line": 79, + "column": 39 + } + } + }, + { + "type": { + "label": ",", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2158, + "end": 2159, + "loc": { + "start": { + "line": 79, + "column": 39 + }, + "end": { + "line": 79, + "column": 40 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 2160, + "end": 2163, + "loc": { + "start": { + "line": 79, + "column": 41 + }, + "end": { + "line": 79, + "column": 44 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2163, + "end": 2164, + "loc": { + "start": { + "line": 79, + "column": 44 + }, + "end": { + "line": 79, + "column": 45 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2164, + "end": 2165, + "loc": { + "start": { + "line": 79, + "column": 45 + }, + "end": { + "line": 79, + "column": 46 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2167, + "end": 2168, + "loc": { + "start": { + "line": 80, + "column": 1 + }, + "end": { + "line": 80, + "column": 2 + } + } + }, + { + "type": "CommentBlock", + "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", + "start": 2171, + "end": 2433, + "loc": { + "start": { + "line": 82, + "column": 1 + }, + "end": { + "line": 89, + "column": 4 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "get", + "start": 2435, + "end": 2438, + "loc": { + "start": { + "line": 90, + "column": 1 + }, + "end": { + "line": 90, + "column": 4 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2438, + "end": 2439, + "loc": { + "start": { + "line": 90, + "column": 4 + }, + "end": { + "line": 90, + "column": 5 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 2439, + "end": 2442, + "loc": { + "start": { + "line": 90, + "column": 5 + }, + "end": { + "line": 90, + "column": 8 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2442, + "end": 2443, + "loc": { + "start": { + "line": 90, + "column": 8 + }, + "end": { + "line": 90, + "column": 9 + } + } + }, + { + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2444, + "end": 2445, + "loc": { + "start": { + "line": 90, + "column": 10 + }, + "end": { + "line": 90, + "column": 11 + } + } + }, + { + "type": { + "label": "const", + "keyword": "const", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "const", + "start": 2448, + "end": 2453, + "loc": { + "start": { + "line": 91, + "column": 2 }, - "leadingComments": [ - { - "type": "CommentBlock", - "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 582, - "end": 631, - "loc": { - "start": { - "line": 14, - "column": 0 - }, - "end": { - "line": 17, - "column": 3 - } - } - } - ] + "end": { + "line": 91, + "column": 7 + } } - ], - "directives": [] - }, - "comments": [ + }, { - "type": "CommentBlock", - "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 582, - "end": 631, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 2454, + "end": 2458, "loc": { "start": { - "line": 14, - "column": 0 + "line": 91, + "column": 8 }, "end": { - "line": 17, - "column": 3 + "line": 91, + "column": 12 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", - "start": 669, - "end": 795, + "type": { + "label": "=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": true, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "=", + "start": 2459, + "end": 2460, + "loc": { + "start": { + "line": 91, + "column": 13 + }, + "end": { + "line": 91, + "column": 14 + } + } + }, + { + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 2461, + "end": 2465, + "loc": { + "start": { + "line": 91, + "column": 15 + }, + "end": { + "line": 91, + "column": 19 + } + } + }, + { + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2465, + "end": 2466, + "loc": { + "start": { + "line": 91, + "column": 19 + }, + "end": { + "line": 91, + "column": 20 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_search", + "start": 2466, + "end": 2473, + "loc": { + "start": { + "line": 91, + "column": 20 + }, + "end": { + "line": 91, + "column": 27 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2473, + "end": 2474, + "loc": { + "start": { + "line": 91, + "column": 27 + }, + "end": { + "line": 91, + "column": 28 + } + } + }, + { + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 2474, + "end": 2477, + "loc": { + "start": { + "line": 91, + "column": 28 + }, + "end": { + "line": 91, + "column": 31 + } + } + }, + { + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2477, + "end": 2478, + "loc": { + "start": { + "line": 91, + "column": 31 + }, + "end": { + "line": 91, + "column": 32 + } + } + }, + { + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2478, + "end": 2479, + "loc": { + "start": { + "line": 91, + "column": 32 + }, + "end": { + "line": 91, + "column": 33 + } + } + }, + { + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 2482, + "end": 2488, "loc": { "start": { - "line": 19, - "column": 1 + "line": 92, + "column": 2 }, "end": { - "line": 23, - "column": 4 + "line": 92, + "column": 8 } } }, { - "type": "CommentBlock", - "value": "* @member {Function} The comparison function for node keys. ", - "start": 861, - "end": 925, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 2489, + "end": 2493, "loc": { "start": { - "line": 26, - "column": 2 + "line": 92, + "column": 9 }, "end": { - "line": 26, - "column": 66 + "line": 92, + "column": 13 } } }, { - "type": "CommentBlock", - "value": "* @member {Node} The root of the tree. ", - "start": 954, - "end": 997, + "type": { + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": 6, + "updateContext": null + }, + "value": "===", + "start": 2494, + "end": 2497, "loc": { "start": { - "line": 28, - "column": 2 + "line": 92, + "column": 14 }, "end": { - "line": 28, - "column": 45 + "line": 92, + "column": 17 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 1023, - "end": 1127, + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 2498, + "end": 2502, "loc": { "start": { - "line": 32, - "column": 1 + "line": 92, + "column": 18 }, "end": { - "line": 36, - "column": 4 + "line": 92, + "column": 22 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", - "start": 1175, - "end": 1254, + "type": { + "label": "?", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2503, + "end": 2504, "loc": { "start": { - "line": 41, - "column": 1 + "line": 92, + "column": 23 }, "end": { - "line": 45, - "column": 4 + "line": 92, + "column": 24 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1453, - "end": 1679, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "undefined", + "start": 2505, + "end": 2514, "loc": { "start": { - "line": 56, - "column": 1 + "line": 92, + "column": 25 }, "end": { - "line": 63, - "column": 4 + "line": 92, + "column": 34 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", - "start": 1787, - "end": 2049, + "type": { + "label": ":", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2515, + "end": 2516, "loc": { "start": { - "line": 69, - "column": 1 + "line": 92, + "column": 35 }, "end": { - "line": 76, - "column": 4 + "line": 92, + "column": 36 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", - "start": 2143, - "end": 2298, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "node", + "start": 2517, + "end": 2521, "loc": { "start": { - "line": 82, - "column": 1 + "line": 92, + "column": 37 }, "end": { - "line": 88, - "column": 4 + "line": 92, + "column": 41 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2353, - "end": 2458, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2521, + "end": 2522, "loc": { "start": { - "line": 93, - "column": 1 + "line": 92, + "column": 41 }, "end": { - "line": 97, - "column": 4 + "line": 92, + "column": 42 } } }, { - "type": "CommentLine", - "value": " Replace node's key with predecessor's key", - "start": 2539, - "end": 2583, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 2522, + "end": 2525, "loc": { "start": { - "line": 101, - "column": 3 + "line": 92, + "column": 42 }, "end": { - "line": 101, - "column": 47 + "line": 92, + "column": 45 } } }, { - "type": "CommentLine", - "value": " Delete predecessor node", - "start": 2646, - "end": 2672, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2525, + "end": 2526, "loc": { "start": { - "line": 104, - "column": 3 + "line": 92, + "column": 45 }, "end": { - "line": 104, - "column": 29 + "line": 92, + "column": 46 } } }, { - "type": "CommentLine", - "value": " NOTE: this node can only have one non-leaf (left) child because", - "start": 2676, - "end": 2742, + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2528, + "end": 2529, "loc": { "start": { - "line": 105, - "column": 3 + "line": 93, + "column": 1 }, "end": { - "line": 105, - "column": 69 + "line": 93, + "column": 2 } } }, { - "type": "CommentLine", - "value": " of red-black tree invariant.", - "start": 2746, - "end": 2777, + "type": "CommentBlock", + "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", + "start": 2532, + "end": 2687, "loc": { "start": { - "line": 106, - "column": 3 + "line": 95, + "column": 1 }, "end": { - "line": 106, - "column": 34 + "line": 101, + "column": 4 } } }, { - "type": "CommentLine", - "value": " Replace node's key with successor's key", - "start": 2918, - "end": 2960, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "has", + "start": 2689, + "end": 2692, "loc": { "start": { - "line": 113, - "column": 3 + "line": 102, + "column": 1 }, "end": { - "line": 113, - "column": 45 + "line": 102, + "column": 4 } } }, { - "type": "CommentLine", - "value": " NOTE: Since there is no left child, then there can only be one", - "start": 2964, - "end": 3029, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2692, + "end": 2693, "loc": { "start": { - "line": 114, - "column": 3 + "line": 102, + "column": 4 }, "end": { - "line": 114, - "column": 68 + "line": 102, + "column": 5 } } }, { - "type": "CommentLine", - "value": " right child by the red-black tree invariant.", - "start": 3033, - "end": 3080, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "key", + "start": 2693, + "end": 2696, "loc": { "start": { - "line": 115, - "column": 3 + "line": 102, + "column": 5 }, "end": { - "line": 115, - "column": 50 + "line": 102, + "column": 8 } } }, { - "type": "CommentLine", - "value": " Delete successor node", - "start": 3136, - "end": 3160, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2696, + "end": 2697, "loc": { "start": { - "line": 118, - "column": 3 + "line": 102, + "column": 8 }, "end": { - "line": 118, - "column": 27 + "line": 102, + "column": 9 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 3289, - "end": 3701, + "type": { + "label": "{", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2698, + "end": 2699, "loc": { "start": { - "line": 127, - "column": 1 + "line": 102, + "column": 10 }, "end": { - "line": 135, - "column": 4 + "line": 102, + "column": 11 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", - "start": 3829, - "end": 4086, + "type": { + "label": "return", + "keyword": "return", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "return", + "start": 2702, + "end": 2708, "loc": { "start": { - "line": 144, - "column": 1 + "line": 103, + "column": 2 }, "end": { - "line": 150, - "column": 4 + "line": 103, + "column": 8 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", - "start": 4205, - "end": 4309, + "type": { + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "this", + "start": 2709, + "end": 2713, "loc": { "start": { - "line": 156, - "column": 1 + "line": 103, + "column": 9 }, "end": { - "line": 160, - "column": 4 + "line": 103, + "column": 13 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 4389, - "end": 4437, + "type": { + "label": ".", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 2713, + "end": 2714, "loc": { "start": { - "line": 165, - "column": 1 + "line": 103, + "column": 13 }, "end": { - "line": 167, - "column": 4 + "line": 103, + "column": 14 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4489, - "end": 4633, + "type": { + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "_search", + "start": 2714, + "end": 2721, "loc": { "start": { - "line": 172, - "column": 1 + "line": 103, + "column": 14 }, "end": { - "line": 177, - "column": 4 + "line": 103, + "column": 21 } } }, { - "type": "CommentBlock", - "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4700, - "end": 4913, + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 2721, + "end": 2722, "loc": { "start": { - "line": 182, - "column": 1 + "line": 103, + "column": 21 }, "end": { - "line": 188, - "column": 4 + "line": 103, + "column": 22 } } - } - ], - "tokens": [ + }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7565,28 +19097,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 0, - "end": 6, + "value": "key", + "start": 2722, + "end": 2725, "loc": { "start": { - "line": 1, - "column": 0 + "line": 103, + "column": 22 }, "end": { - "line": 1, - "column": 6 + "line": 103, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -7594,49 +19125,50 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 7, - "end": 13, + "start": 2725, + "end": 2726, "loc": { "start": { - "line": 1, - "column": 7 + "line": 103, + "column": 25 }, "end": { - "line": 1, - "column": 13 + "line": 103, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "from", - "start": 14, - "end": 18, + "value": "!==", + "start": 2727, + "end": 2730, "loc": { "start": { - "line": 1, - "column": 14 + "line": 103, + "column": 27 }, - "end": { - "line": 1, - "column": 18 + "end": { + "line": 103, + "column": 30 } } }, { "type": { - "label": "string", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -7647,17 +19179,17 @@ "binop": null, "updateContext": null }, - "value": "assert", - "start": 19, - "end": 27, + "value": "null", + "start": 2731, + "end": 2735, "loc": { "start": { - "line": 1, - "column": 19 + "line": 103, + "column": 31 }, "end": { - "line": 1, - "column": 27 + "line": 103, + "column": 35 } } }, @@ -7674,70 +19206,57 @@ "binop": null, "updateContext": null }, - "start": 27, - "end": 28, + "start": 2735, + "end": 2736, "loc": { "start": { - "line": 1, - "column": 27 + "line": 103, + "column": 35 }, "end": { - "line": 1, - "column": 28 + "line": 103, + "column": 36 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 29, - "end": 35, + "start": 2738, + "end": 2739, "loc": { "start": { - "line": 2, - "column": 0 + "line": 104, + "column": 1 }, "end": { - "line": 2, - "column": 6 + "line": 104, + "column": 2 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "Node", - "start": 36, - "end": 40, + "type": "CommentBlock", + "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", + "start": 2742, + "end": 2847, "loc": { "start": { - "line": 2, - "column": 7 + "line": 106, + "column": 1 }, "end": { - "line": 2, - "column": 11 + "line": 110, + "column": 4 } } }, @@ -7753,105 +19272,100 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 41, - "end": 45, + "value": "unlink", + "start": 2849, + "end": 2855, "loc": { "start": { - "line": 2, - "column": 12 + "line": 111, + "column": 1 }, "end": { - "line": 2, - "column": 16 + "line": 111, + "column": 7 } } }, { "type": { - "label": "string", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "./Node.js", - "start": 46, - "end": 57, + "start": 2855, + "end": 2856, "loc": { "start": { - "line": 2, - "column": 17 + "line": 111, + "column": 7 }, "end": { - "line": 2, - "column": 28 + "line": 111, + "column": 8 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 57, - "end": 58, + "value": "node", + "start": 2856, + "end": 2860, "loc": { "start": { - "line": 2, - "column": 28 + "line": 111, + "column": 8 }, "end": { - "line": 2, - "column": 29 + "line": 111, + "column": 12 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 59, - "end": 65, + "start": 2860, + "end": 2861, "loc": { "start": { - "line": 3, - "column": 0 + "line": 111, + "column": 12 }, "end": { - "line": 3, - "column": 6 + "line": 111, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -7860,17 +19374,16 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 66, - "end": 71, + "start": 2862, + "end": 2863, "loc": { "start": { - "line": 3, - "column": 7 + "line": 111, + "column": 14 }, "end": { - "line": 3, - "column": 12 + "line": 111, + "column": 15 } } }, @@ -7886,98 +19399,96 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 72, - "end": 76, + "value": "assert", + "start": 2866, + "end": 2872, "loc": { "start": { - "line": 3, - "column": 13 + "line": 112, + "column": 2 }, "end": { - "line": 3, - "column": 17 + "line": 112, + "column": 8 } } }, { "type": { - "label": "string", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../color/BLACK.js", - "start": 77, - "end": 96, + "start": 2872, + "end": 2873, "loc": { "start": { - "line": 3, - "column": 18 + "line": 112, + "column": 8 }, "end": { - "line": 3, - "column": 37 + "line": 112, + "column": 9 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 96, - "end": 97, + "value": "node", + "start": 2873, + "end": 2877, "loc": { "start": { - "line": 3, - "column": 37 + "line": 112, + "column": 9 }, "end": { - "line": 3, - "column": 38 + "line": 112, + "column": 13 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": "instanceof", + "keyword": "instanceof", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 7, "updateContext": null }, - "value": "import", - "start": 98, - "end": 104, + "value": "instanceof", + "start": 2878, + "end": 2888, "loc": { "start": { - "line": 4, - "column": 0 + "line": 112, + "column": 14 }, "end": { - "line": 4, - "column": 6 + "line": 112, + "column": 24 } } }, @@ -7993,25 +19504,25 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 105, - "end": 108, + "value": "Node", + "start": 2889, + "end": 2893, "loc": { "start": { - "line": 4, - "column": 7 + "line": 112, + "column": 25 }, "end": { - "line": 4, - "column": 10 + "line": 112, + "column": 29 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8019,25 +19530,24 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 109, - "end": 113, + "start": 2893, + "end": 2894, "loc": { "start": { - "line": 4, - "column": 11 + "line": 112, + "column": 29 }, "end": { - "line": 4, - "column": 15 + "line": 112, + "column": 30 } } }, { "type": { - "label": "string", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8046,24 +19556,24 @@ "binop": null, "updateContext": null }, - "value": "../color/RED.js", - "start": 114, - "end": 131, + "start": 2894, + "end": 2895, "loc": { "start": { - "line": 4, - "column": 16 + "line": 112, + "column": 30 }, "end": { - "line": 4, - "column": 33 + "line": 112, + "column": 31 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": "if", + "keyword": "if", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -8073,43 +19583,41 @@ "binop": null, "updateContext": null }, - "start": 131, - "end": 132, + "value": "if", + "start": 2898, + "end": 2900, "loc": { "start": { - "line": 4, - "column": 33 + "line": 113, + "column": 2 }, "end": { - "line": 4, - "column": 34 + "line": 113, + "column": 4 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 133, - "end": 139, + "start": 2901, + "end": 2902, "loc": { "start": { - "line": 5, - "column": 0 + "line": 113, + "column": 5 }, "end": { - "line": 5, + "line": 113, "column": 6 } } @@ -8126,49 +19634,49 @@ "postfix": false, "binop": null }, - "value": "predecessor", - "start": 140, - "end": 151, + "value": "node", + "start": 2902, + "end": 2906, "loc": { "start": { - "line": 5, - "column": 7 + "line": 113, + "column": 6 }, "end": { - "line": 5, - "column": 18 + "line": 113, + "column": 10 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "from", - "start": 152, - "end": 156, + "start": 2906, + "end": 2907, "loc": { "start": { - "line": 5, - "column": 19 + "line": 113, + "column": 10 }, "end": { - "line": 5, - "column": 23 + "line": 113, + "column": 11 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8176,26 +19684,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../family/predecessor.js", - "start": 157, - "end": 183, + "value": "left", + "start": 2907, + "end": 2911, "loc": { "start": { - "line": 5, - "column": 24 + "line": 113, + "column": 11 }, "end": { - "line": 5, - "column": 50 + "line": 113, + "column": 15 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8203,26 +19710,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 183, - "end": 184, + "value": "!==", + "start": 2912, + "end": 2915, "loc": { "start": { - "line": 5, - "column": 50 + "line": 113, + "column": 16 }, "end": { - "line": 5, - "column": 51 + "line": 113, + "column": 19 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8233,25 +19741,25 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 185, - "end": 191, + "value": "null", + "start": 2916, + "end": 2920, "loc": { "start": { - "line": 6, - "column": 0 + "line": 113, + "column": 20 }, "end": { - "line": 6, - "column": 6 + "line": 113, + "column": 24 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8259,24 +19767,23 @@ "postfix": false, "binop": null }, - "value": "insert", - "start": 192, - "end": 198, + "start": 2920, + "end": 2921, "loc": { "start": { - "line": 6, - "column": 7 + "line": 113, + "column": 24 }, "end": { - "line": 6, - "column": 13 + "line": 113, + "column": 25 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -8285,25 +19792,41 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 199, - "end": 203, + "start": 2922, + "end": 2923, "loc": { "start": { - "line": 6, - "column": 14 + "line": 113, + "column": 26 }, "end": { - "line": 6, - "column": 18 + "line": 113, + "column": 27 + } + } + }, + { + "type": "CommentLine", + "value": " Swap node with its predecessor", + "start": 2927, + "end": 2960, + "loc": { + "start": { + "line": 114, + "column": 3 + }, + "end": { + "line": 114, + "column": 36 } } }, { "type": { - "label": "string", + "label": "const", + "keyword": "const", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8312,50 +19835,76 @@ "binop": null, "updateContext": null }, - "value": "../insertion/insert.js", - "start": 204, - "end": 228, + "value": "const", + "start": 2964, + "end": 2969, "loc": { "start": { - "line": 6, - "column": 19 + "line": 115, + "column": 3 }, "end": { - "line": 6, - "column": 43 + "line": 115, + "column": 8 } } }, { "type": { - "label": ";", + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "pred", + "start": 2970, + "end": 2974, + "loc": { + "start": { + "line": 115, + "column": 9 + }, + "end": { + "line": 115, + "column": 13 + } + } + }, + { + "type": { + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 228, - "end": 229, + "value": "=", + "start": 2975, + "end": 2976, "loc": { "start": { - "line": 6, - "column": 43 + "line": 115, + "column": 14 }, "end": { - "line": 6, - "column": 44 + "line": 115, + "column": 15 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8363,27 +19912,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 230, - "end": 236, + "value": "predecessor", + "start": 2977, + "end": 2988, "loc": { "start": { - "line": 7, - "column": 0 + "line": 115, + "column": 16 }, "end": { - "line": 7, - "column": 6 + "line": 115, + "column": 27 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -8392,17 +19940,16 @@ "postfix": false, "binop": null }, - "value": "insert_case1", - "start": 237, - "end": 249, + "start": 2988, + "end": 2989, "loc": { "start": { - "line": 7, - "column": 7 + "line": 115, + "column": 27 }, "end": { - "line": 7, - "column": 19 + "line": 115, + "column": 28 } } }, @@ -8418,44 +19965,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 250, - "end": 254, + "value": "node", + "start": 2989, + "end": 2993, "loc": { "start": { - "line": 7, - "column": 20 + "line": 115, + "column": 28 }, "end": { - "line": 7, - "column": 24 + "line": 115, + "column": 32 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../insertion/insert_case1.js", - "start": 255, - "end": 285, + "start": 2993, + "end": 2994, "loc": { "start": { - "line": 7, - "column": 25 + "line": 115, + "column": 32 }, "end": { - "line": 7, - "column": 55 + "line": 115, + "column": 33 } } }, @@ -8472,70 +20017,64 @@ "binop": null, "updateContext": null }, - "start": 285, - "end": 286, + "start": 2994, + "end": 2995, "loc": { "start": { - "line": 7, - "column": 55 + "line": 115, + "column": 33 }, "end": { - "line": 7, - "column": 56 + "line": 115, + "column": 34 } } }, { - "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "import", - "start": 287, - "end": 293, + "type": "CommentLine", + "value": " Delete predecessor node", + "start": 2999, + "end": 3025, "loc": { "start": { - "line": 8, - "column": 0 + "line": 116, + "column": 3 }, "end": { - "line": 8, - "column": 6 + "line": 116, + "column": 29 } } }, { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "delete_one_child", - "start": 294, - "end": 310, + "type": "CommentLine", + "value": " NOTE: this node can have at most one non-leaf (left) child", + "start": 3029, + "end": 3090, "loc": { "start": { - "line": 8, - "column": 7 + "line": 117, + "column": 3 }, "end": { - "line": 8, - "column": 23 + "line": 117, + "column": 64 + } + } + }, + { + "type": "CommentLine", + "value": " because of red-black tree invariant.", + "start": 3094, + "end": 3133, + "loc": { + "start": { + "line": 118, + "column": 3 + }, + "end": { + "line": 118, + "column": 42 } } }, @@ -8551,79 +20090,76 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 311, - "end": 315, + "value": "assert", + "start": 3137, + "end": 3143, "loc": { "start": { - "line": 8, - "column": 24 + "line": 119, + "column": 3 }, "end": { - "line": 8, - "column": 28 + "line": 119, + "column": 9 } } }, { "type": { - "label": "string", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../deletion/delete_one_child.js", - "start": 316, - "end": 349, + "start": 3143, + "end": 3144, "loc": { "start": { - "line": 8, - "column": 29 + "line": 119, + "column": 9 }, "end": { - "line": 8, - "column": 62 + "line": 119, + "column": 10 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 349, - "end": 350, + "value": "pred", + "start": 3144, + "end": 3148, "loc": { "start": { - "line": 8, - "column": 62 + "line": 119, + "column": 10 }, "end": { - "line": 8, - "column": 63 + "line": 119, + "column": 14 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8632,17 +20168,16 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 351, - "end": 357, + "start": 3148, + "end": 3149, "loc": { "start": { - "line": 9, - "column": 0 + "line": 119, + "column": 14 }, "end": { - "line": 9, - "column": 6 + "line": 119, + "column": 15 } } }, @@ -8658,49 +20193,51 @@ "postfix": false, "binop": null }, - "value": "delete_no_child", - "start": 358, - "end": 373, + "value": "right", + "start": 3149, + "end": 3154, "loc": { "start": { - "line": 9, - "column": 7 + "line": 119, + "column": 15 }, "end": { - "line": 9, - "column": 22 + "line": 119, + "column": 20 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "==/!=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "value": "from", - "start": 374, - "end": 378, + "value": "===", + "start": 3155, + "end": 3158, "loc": { "start": { - "line": 9, - "column": 23 + "line": 119, + "column": 21 }, "end": { - "line": 9, - "column": 27 + "line": 119, + "column": 24 } } }, { "type": { - "label": "string", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8711,52 +20248,50 @@ "binop": null, "updateContext": null }, - "value": "../deletion/delete_no_child.js", - "start": 379, - "end": 411, + "value": "null", + "start": 3159, + "end": 3163, "loc": { "start": { - "line": 9, - "column": 28 + "line": 119, + "column": 25 }, "end": { - "line": 9, - "column": 60 + "line": 119, + "column": 29 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 411, - "end": 412, + "start": 3163, + "end": 3164, "loc": { "start": { - "line": 9, - "column": 60 + "line": 119, + "column": 29 }, "end": { - "line": 9, - "column": 61 + "line": 119, + "column": 30 } } }, { "type": { - "label": "import", - "keyword": "import", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -8765,50 +20300,51 @@ "binop": null, "updateContext": null }, - "value": "import", - "start": 413, - "end": 419, + "start": 3164, + "end": 3165, "loc": { "start": { - "line": 10, - "column": 0 + "line": 119, + "column": 30 }, "end": { - "line": 10, - "column": 6 + "line": 119, + "column": 31 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "search", - "start": 420, - "end": 426, + "value": "if", + "start": 3169, + "end": 3171, "loc": { "start": { - "line": 10, - "column": 7 + "line": 120, + "column": 3 }, "end": { - "line": 10, - "column": 13 + "line": 120, + "column": 5 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -8817,23 +20353,22 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 427, - "end": 431, + "start": 3172, + "end": 3173, "loc": { "start": { - "line": 10, - "column": 14 + "line": 120, + "column": 6 }, "end": { - "line": 10, - "column": 18 + "line": 120, + "column": 7 } } }, { "type": { - "label": "string", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8841,26 +20376,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../search/search.js", - "start": 432, - "end": 453, + "value": "pred", + "start": 3173, + "end": 3177, "loc": { "start": { - "line": 10, - "column": 19 + "line": 120, + "column": 7 }, "end": { - "line": 10, - "column": 40 + "line": 120, + "column": 11 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -8868,26 +20402,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 453, - "end": 454, + "value": "===", + "start": 3178, + "end": 3181, "loc": { "start": { - "line": 10, - "column": 40 + "line": 120, + "column": 12 }, "end": { - "line": 10, - "column": 41 + "line": 120, + "column": 15 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -8895,46 +20429,45 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 455, - "end": 461, + "value": "node", + "start": 3182, + "end": 3186, "loc": { "start": { - "line": 11, - "column": 0 + "line": 120, + "column": 16 }, "end": { - "line": 11, - "column": 6 + "line": 120, + "column": 20 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "inordertraversal", - "start": 462, - "end": 478, + "start": 3186, + "end": 3187, "loc": { "start": { - "line": 11, - "column": 7 + "line": 120, + "column": 20 }, "end": { - "line": 11, - "column": 23 + "line": 120, + "column": 21 } } }, @@ -8950,77 +20483,73 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 479, - "end": 483, + "value": "left", + "start": 3187, + "end": 3191, "loc": { "start": { - "line": 11, - "column": 24 + "line": 120, + "column": 21 }, "end": { - "line": 11, - "column": 28 + "line": 120, + "column": 25 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../traversal/inordertraversal.js", - "start": 484, - "end": 518, + "start": 3191, + "end": 3192, "loc": { "start": { - "line": 11, - "column": 29 + "line": 120, + "column": 25 }, "end": { - "line": 11, - "column": 63 + "line": 120, + "column": 26 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 518, - "end": 519, + "start": 3193, + "end": 3194, "loc": { "start": { - "line": 11, - "column": 63 + "line": 120, + "column": 27 }, "end": { - "line": 11, - "column": 64 + "line": 120, + "column": 28 } } }, { "type": { - "label": "import", - "keyword": "import", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -9028,27 +20557,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "import", - "start": 520, - "end": 526, + "value": "swap_left", + "start": 3199, + "end": 3208, "loc": { "start": { - "line": 12, - "column": 0 + "line": 121, + "column": 4 }, "end": { - "line": 12, - "column": 6 + "line": 121, + "column": 13 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -9057,17 +20585,16 @@ "postfix": false, "binop": null }, - "value": "rangetraversal", - "start": 527, - "end": 541, + "start": 3208, + "end": 3209, "loc": { "start": { - "line": 12, - "column": 7 + "line": 121, + "column": 13 }, "end": { - "line": 12, - "column": 21 + "line": 121, + "column": 14 } } }, @@ -9083,44 +20610,42 @@ "postfix": false, "binop": null }, - "value": "from", - "start": 542, - "end": 546, + "value": "node", + "start": 3209, + "end": 3213, "loc": { "start": { - "line": 12, - "column": 22 + "line": 121, + "column": 14 }, "end": { - "line": 12, - "column": 26 + "line": 121, + "column": 18 } } }, { "type": { - "label": "string", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "../traversal/rangetraversal.js", - "start": 547, - "end": 579, + "start": 3213, + "end": 3214, "loc": { "start": { - "line": 12, - "column": 27 + "line": 121, + "column": 18 }, "end": { - "line": 12, - "column": 59 + "line": 121, + "column": 19 } } }, @@ -9137,39 +20662,22 @@ "binop": null, "updateContext": null }, - "start": 579, - "end": 580, - "loc": { - "start": { - "line": 12, - "column": 59 - }, - "end": { - "line": 12, - "column": 60 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n * A RedBlackTree with key-only nodes.\n *\n ", - "start": 582, - "end": 631, + "start": 3214, + "end": 3215, "loc": { "start": { - "line": 14, - "column": 0 + "line": 121, + "column": 19 }, "end": { - "line": 17, - "column": 3 + "line": 121, + "column": 20 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -9177,27 +20685,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "export", - "start": 632, - "end": 638, + "start": 3219, + "end": 3220, "loc": { "start": { - "line": 18, - "column": 0 + "line": 122, + "column": 3 }, "end": { - "line": 18, - "column": 6 + "line": 122, + "column": 4 } } }, { "type": { - "label": "default", - "keyword": "default", + "label": "else", + "keyword": "else", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -9208,45 +20714,42 @@ "binop": null, "updateContext": null }, - "value": "default", - "start": 639, - "end": 646, + "value": "else", + "start": 3221, + "end": 3225, "loc": { "start": { - "line": 18, - "column": 7 + "line": 122, + "column": 5 }, "end": { - "line": 18, - "column": 14 + "line": 122, + "column": 9 } } }, { "type": { - "label": "class", - "keyword": "class", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "class", - "start": 647, - "end": 652, + "start": 3226, + "end": 3227, "loc": { "start": { - "line": 18, - "column": 15 + "line": 122, + "column": 10 }, "end": { - "line": 18, - "column": 20 + "line": 122, + "column": 11 } } }, @@ -9262,23 +20765,23 @@ "postfix": false, "binop": null }, - "value": "RedBlackTree", - "start": 653, - "end": 665, + "value": "swap_non_adjacent", + "start": 3232, + "end": 3249, "loc": { "start": { - "line": 18, - "column": 21 + "line": 123, + "column": 4 }, "end": { - "line": 18, - "column": 33 + "line": 123, + "column": 21 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -9288,32 +20791,16 @@ "postfix": false, "binop": null }, - "start": 666, - "end": 667, - "loc": { - "start": { - "line": 18, - "column": 34 - }, - "end": { - "line": 18, - "column": 35 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t ", - "start": 669, - "end": 795, + "start": 3249, + "end": 3250, "loc": { "start": { - "line": 19, - "column": 1 + "line": 123, + "column": 21 }, "end": { - "line": 23, - "column": 4 + "line": 123, + "column": 22 } } }, @@ -9329,42 +20816,43 @@ "postfix": false, "binop": null }, - "value": "constructor", - "start": 797, - "end": 808, + "value": "node", + "start": 3250, + "end": 3254, "loc": { "start": { - "line": 24, - "column": 1 + "line": 123, + "column": 22 }, "end": { - "line": 24, - "column": 12 + "line": 123, + "column": 26 } } }, { "type": { - "label": "(", + "label": ",", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 808, - "end": 809, + "start": 3254, + "end": 3255, "loc": { "start": { - "line": 24, - "column": 12 + "line": 123, + "column": 26 }, "end": { - "line": 24, - "column": 13 + "line": 123, + "column": 27 } } }, @@ -9380,17 +20868,17 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 809, - "end": 816, + "value": "pred", + "start": 3256, + "end": 3260, "loc": { "start": { - "line": 24, - "column": 13 + "line": 123, + "column": 28 }, "end": { - "line": 24, - "column": 20 + "line": 123, + "column": 32 } } }, @@ -9406,24 +20894,50 @@ "postfix": false, "binop": null }, - "start": 816, - "end": 817, + "start": 3260, + "end": 3261, "loc": { "start": { - "line": 24, - "column": 20 + "line": 123, + "column": 32 }, "end": { - "line": 24, - "column": 21 + "line": 123, + "column": 33 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 3261, + "end": 3262, + "loc": { + "start": { + "line": 123, + "column": 33 + }, + "end": { + "line": 123, + "column": 34 + } + } + }, + { + "type": { + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -9431,16 +20945,16 @@ "postfix": false, "binop": null }, - "start": 818, - "end": 819, + "start": 3266, + "end": 3267, "loc": { "start": { - "line": 24, - "column": 22 + "line": 124, + "column": 3 }, "end": { - "line": 24, - "column": 23 + "line": 124, + "column": 4 } } }, @@ -9457,16 +20971,16 @@ "binop": null }, "value": "assert", - "start": 822, - "end": 828, + "start": 3272, + "end": 3278, "loc": { "start": { - "line": 25, - "column": 2 + "line": 126, + "column": 3 }, "end": { - "line": 25, - "column": 8 + "line": 126, + "column": 9 } } }, @@ -9482,16 +20996,16 @@ "postfix": false, "binop": null }, - "start": 828, - "end": 829, + "start": 3278, + "end": 3279, "loc": { "start": { - "line": 25, - "column": 8 + "line": 126, + "column": 9 }, "end": { - "line": 25, - "column": 9 + "line": 126, + "column": 10 } } }, @@ -9507,45 +21021,43 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 829, - "end": 836, + "value": "node", + "start": 3279, + "end": 3283, "loc": { "start": { - "line": 25, - "column": 9 + "line": 126, + "column": 10 }, "end": { - "line": 25, - "column": 16 + "line": 126, + "column": 14 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 837, - "end": 847, + "start": 3283, + "end": 3284, "loc": { "start": { - "line": 25, - "column": 17 + "line": 126, + "column": 14 }, "end": { - "line": 25, - "column": 27 + "line": 126, + "column": 15 } } }, @@ -9561,50 +21073,53 @@ "postfix": false, "binop": null }, - "value": "Function", - "start": 848, - "end": 856, + "value": "right", + "start": 3284, + "end": 3289, "loc": { "start": { - "line": 25, - "column": 28 + "line": 126, + "column": 15 }, "end": { - "line": 25, - "column": 36 + "line": 126, + "column": 20 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 856, - "end": 857, + "value": "===", + "start": 3290, + "end": 3293, "loc": { "start": { - "line": 25, - "column": 36 + "line": 126, + "column": 21 }, "end": { - "line": 25, - "column": 37 + "line": 126, + "column": 24 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -9613,41 +21128,50 @@ "binop": null, "updateContext": null }, - "start": 857, - "end": 858, + "value": "null", + "start": 3294, + "end": 3298, "loc": { "start": { - "line": 25, - "column": 37 + "line": 126, + "column": 25 }, "end": { - "line": 25, - "column": 38 + "line": 126, + "column": 29 } } }, { - "type": "CommentBlock", - "value": "* @member {Function} The comparison function for node keys. ", - "start": 861, - "end": 925, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 3298, + "end": 3299, "loc": { "start": { - "line": 26, - "column": 2 + "line": 126, + "column": 29 }, "end": { - "line": 26, - "column": 66 + "line": 126, + "column": 30 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -9656,23 +21180,23 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 928, - "end": 932, + "start": 3299, + "end": 3300, "loc": { "start": { - "line": 27, - "column": 2 + "line": 126, + "column": 30 }, "end": { - "line": 27, - "column": 6 + "line": 126, + "column": 31 } } }, { "type": { - "label": ".", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -9683,15 +21207,41 @@ "binop": null, "updateContext": null }, - "start": 932, - "end": 933, + "value": "if", + "start": 3304, + "end": 3306, + "loc": { + "start": { + "line": 127, + "column": 3 + }, + "end": { + "line": 127, + "column": 5 + } + } + }, + { + "type": { + "label": "(", + "beforeExpr": true, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 3307, + "end": 3308, "loc": { "start": { - "line": 27, + "line": 127, "column": 6 }, "end": { - "line": 27, + "line": 127, "column": 7 } } @@ -9708,44 +21258,43 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 933, - "end": 940, + "value": "node", + "start": 3308, + "end": 3312, "loc": { "start": { - "line": 27, + "line": 127, "column": 7 }, "end": { - "line": 27, - "column": 14 + "line": 127, + "column": 11 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 941, - "end": 942, + "start": 3312, + "end": 3313, "loc": { "start": { - "line": 27, - "column": 15 + "line": 127, + "column": 11 }, "end": { - "line": 27, - "column": 16 + "line": 127, + "column": 12 } } }, @@ -9761,23 +21310,23 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 943, - "end": 950, + "value": "left", + "start": 3313, + "end": 3317, "loc": { "start": { - "line": 27, - "column": 17 + "line": 127, + "column": 12 }, "end": { - "line": 27, - "column": 24 + "line": 127, + "column": 16 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -9785,42 +21334,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 950, - "end": 951, - "loc": { - "start": { - "line": 27, - "column": 24 - }, - "end": { - "line": 27, - "column": 25 - } - } - }, - { - "type": "CommentBlock", - "value": "* @member {Node} The root of the tree. ", - "start": 954, - "end": 997, + "value": "===", + "start": 3318, + "end": 3321, "loc": { "start": { - "line": 28, - "column": 2 + "line": 127, + "column": 17 }, "end": { - "line": 28, - "column": 45 + "line": 127, + "column": 20 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -9831,23 +21365,23 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 1000, - "end": 1004, + "value": "null", + "start": 3322, + "end": 3326, "loc": { "start": { - "line": 29, - "column": 2 + "line": 127, + "column": 21 }, "end": { - "line": 29, - "column": 6 + "line": 127, + "column": 25 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -9855,26 +21389,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1004, - "end": 1005, + "start": 3326, + "end": 3327, "loc": { "start": { - "line": 29, - "column": 6 + "line": 127, + "column": 25 }, "end": { - "line": 29, - "column": 7 + "line": 127, + "column": 26 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -9883,51 +21416,50 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 1005, - "end": 1009, + "start": 3328, + "end": 3329, "loc": { "start": { - "line": 29, - "column": 7 + "line": 127, + "column": 27 }, "end": { - "line": 29, - "column": 11 + "line": 127, + "column": 28 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": "const", + "keyword": "const", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 1010, - "end": 1011, + "value": "const", + "start": 3334, + "end": 3339, "loc": { "start": { - "line": 29, - "column": 12 + "line": 128, + "column": 4 }, "end": { - "line": 29, - "column": 13 + "line": 128, + "column": 9 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -9935,90 +21467,49 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 1012, - "end": 1016, + "value": "subtree", + "start": 3340, + "end": 3347, "loc": { "start": { - "line": 29, - "column": 14 + "line": 128, + "column": 10 }, "end": { - "line": 29, - "column": 18 + "line": 128, + "column": 17 } } }, { "type": { - "label": ";", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 1016, - "end": 1017, + "value": "=", + "start": 3348, + "end": 3349, "loc": { "start": { - "line": 29, + "line": 128, "column": 18 }, "end": { - "line": 29, + "line": 128, "column": 19 } } }, - { - "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "start": 1019, - "end": 1020, - "loc": { - "start": { - "line": 30, - "column": 1 - }, - "end": { - "line": 30, - "column": 2 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t ", - "start": 1023, - "end": 1127, - "loc": { - "start": { - "line": 32, - "column": 1 - }, - "end": { - "line": 36, - "column": 4 - } - } - }, { "type": { "label": "name", @@ -10031,17 +21522,17 @@ "postfix": false, "binop": null }, - "value": "isEmpty", - "start": 1129, - "end": 1136, + "value": "delete_no_child", + "start": 3350, + "end": 3365, "loc": { "start": { - "line": 37, - "column": 1 + "line": 128, + "column": 20 }, "end": { - "line": 37, - "column": 8 + "line": 128, + "column": 35 } } }, @@ -10057,24 +21548,24 @@ "postfix": false, "binop": null }, - "start": 1136, - "end": 1137, + "start": 3365, + "end": 3366, "loc": { "start": { - "line": 37, - "column": 8 + "line": 128, + "column": 35 }, "end": { - "line": 37, - "column": 9 + "line": 128, + "column": 36 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10082,24 +21573,25 @@ "postfix": false, "binop": null }, - "start": 1137, - "end": 1138, + "value": "node", + "start": 3366, + "end": 3370, "loc": { "start": { - "line": 37, - "column": 9 + "line": 128, + "column": 36 }, "end": { - "line": 37, - "column": 10 + "line": 128, + "column": 40 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10107,23 +21599,22 @@ "postfix": false, "binop": null }, - "start": 1139, - "end": 1140, + "start": 3370, + "end": 3371, "loc": { "start": { - "line": 37, - "column": 11 + "line": 128, + "column": 40 }, "end": { - "line": 37, - "column": 12 + "line": 128, + "column": 41 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -10134,26 +21625,25 @@ "binop": null, "updateContext": null }, - "value": "return", - "start": 1143, - "end": 1149, + "start": 3371, + "end": 3372, "loc": { "start": { - "line": 38, - "column": 2 + "line": 128, + "column": 41 }, "end": { - "line": 38, - "column": 8 + "line": 128, + "column": 42 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10162,43 +21652,42 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 1150, - "end": 1154, + "value": "if", + "start": 3377, + "end": 3379, "loc": { "start": { - "line": 38, - "column": 9 + "line": 129, + "column": 4 }, "end": { - "line": 38, - "column": 13 + "line": 129, + "column": 6 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1154, - "end": 1155, + "start": 3380, + "end": 3381, "loc": { "start": { - "line": 38, - "column": 13 + "line": 129, + "column": 7 }, "end": { - "line": 38, - "column": 14 + "line": 129, + "column": 8 } } }, @@ -10214,51 +21703,49 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 1155, - "end": 1159, + "value": "subtree", + "start": 3381, + "end": 3388, "loc": { "start": { - "line": 38, - "column": 14 + "line": 129, + "column": 8 }, "end": { - "line": 38, - "column": 18 + "line": 129, + "column": 15 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1160, - "end": 1163, + "start": 3388, + "end": 3389, "loc": { "start": { - "line": 38, - "column": 19 + "line": 129, + "column": 15 }, "end": { - "line": 38, - "column": 22 + "line": 129, + "column": 16 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -10266,26 +21753,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 1164, - "end": 1168, + "value": "parent", + "start": 3389, + "end": 3395, "loc": { "start": { - "line": 38, - "column": 23 + "line": 129, + "column": 16 }, "end": { - "line": 38, - "column": 27 + "line": 129, + "column": 22 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -10293,68 +21779,56 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1168, - "end": 1169, + "value": "===", + "start": 3396, + "end": 3399, "loc": { "start": { - "line": 38, - "column": 27 + "line": 129, + "column": 23 }, "end": { - "line": 38, - "column": 28 + "line": 129, + "column": 26 } } }, { "type": { - "label": "}", + "label": "null", + "keyword": "null", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1171, - "end": 1172, - "loc": { - "start": { - "line": 39, - "column": 1 - }, - "end": { - "line": 39, - "column": 2 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t ", - "start": 1175, - "end": 1254, + "value": "null", + "start": 3400, + "end": 3404, "loc": { "start": { - "line": 41, - "column": 1 + "line": 129, + "column": 27 }, "end": { - "line": 45, - "column": 4 + "line": 129, + "column": 31 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10362,23 +21836,22 @@ "postfix": false, "binop": null }, - "value": "add", - "start": 1256, - "end": 1259, + "start": 3404, + "end": 3405, "loc": { "start": { - "line": 46, - "column": 1 + "line": 129, + "column": 31 }, "end": { - "line": 46, - "column": 4 + "line": 129, + "column": 32 } } }, { "type": { - "label": "(", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -10388,22 +21861,23 @@ "postfix": false, "binop": null }, - "start": 1259, - "end": 1260, + "start": 3406, + "end": 3407, "loc": { "start": { - "line": 46, - "column": 4 + "line": 129, + "column": 33 }, "end": { - "line": 46, - "column": 5 + "line": 129, + "column": 34 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -10411,25 +21885,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "key", - "start": 1260, - "end": 1263, + "value": "this", + "start": 3413, + "end": 3417, "loc": { "start": { - "line": 46, + "line": 130, "column": 5 }, "end": { - "line": 46, - "column": 8 + "line": 130, + "column": 9 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -10437,25 +21912,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1263, - "end": 1264, + "start": 3417, + "end": 3418, "loc": { "start": { - "line": 46, - "column": 8 + "line": 130, + "column": 9 }, "end": { - "line": 46, - "column": 9 + "line": 130, + "column": 10 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -10464,51 +21940,51 @@ "postfix": false, "binop": null }, - "start": 1265, - "end": 1266, + "value": "root", + "start": 3418, + "end": 3422, "loc": { "start": { - "line": 46, + "line": 130, "column": 10 }, "end": { - "line": 46, - "column": 11 + "line": 130, + "column": 14 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "if", - "start": 1269, - "end": 1271, + "value": "=", + "start": 3423, + "end": 3424, "loc": { "start": { - "line": 47, - "column": 2 + "line": 130, + "column": 15 }, "end": { - "line": 47, - "column": 4 + "line": 130, + "column": 16 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -10517,25 +21993,25 @@ "postfix": false, "binop": null }, - "start": 1272, - "end": 1273, + "value": "subtree", + "start": 3425, + "end": 3432, "loc": { "start": { - "line": 47, - "column": 5 + "line": 130, + "column": 17 }, "end": { - "line": 47, - "column": 6 + "line": 130, + "column": 24 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10544,23 +22020,22 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 1273, - "end": 1277, + "start": 3432, + "end": 3433, "loc": { "start": { - "line": 47, - "column": 6 + "line": 130, + "column": 24 }, "end": { - "line": 47, - "column": 10 + "line": 130, + "column": 25 } } }, { "type": { - "label": ".", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -10568,108 +22043,107 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1277, - "end": 1278, + "start": 3438, + "end": 3439, "loc": { "start": { - "line": 47, - "column": 10 + "line": 131, + "column": 4 }, "end": { - "line": 47, - "column": 11 + "line": 131, + "column": 5 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "root", - "start": 1278, - "end": 1282, + "value": "else", + "start": 3440, + "end": 3444, "loc": { "start": { - "line": 47, - "column": 11 + "line": 131, + "column": 6 }, "end": { - "line": 47, - "column": 15 + "line": 131, + "column": 10 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": "if", + "keyword": "if", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 1283, - "end": 1286, + "value": "if", + "start": 3445, + "end": 3447, "loc": { "start": { - "line": 47, - "column": 16 + "line": 131, + "column": 11 }, "end": { - "line": 47, - "column": 19 + "line": 131, + "column": 13 } } }, { "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 1287, - "end": 1291, + "start": 3448, + "end": 3449, "loc": { "start": { - "line": 47, - "column": 20 + "line": 131, + "column": 14 }, "end": { - "line": 47, - "column": 24 + "line": 131, + "column": 15 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -10677,48 +22151,49 @@ "postfix": false, "binop": null }, - "start": 1291, - "end": 1292, + "value": "pred", + "start": 3449, + "end": 3453, "loc": { "start": { - "line": 47, - "column": 24 + "line": 131, + "column": 15 }, "end": { - "line": 47, - "column": 25 + "line": 131, + "column": 19 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1293, - "end": 1294, + "start": 3453, + "end": 3454, "loc": { "start": { - "line": 47, - "column": 26 + "line": 131, + "column": 19 }, "end": { - "line": 47, - "column": 27 + "line": 131, + "column": 20 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -10726,52 +22201,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 1298, - "end": 1302, + "value": "parent", + "start": 3454, + "end": 3460, "loc": { "start": { - "line": 48, - "column": 3 + "line": 131, + "column": 20 }, "end": { - "line": 48, - "column": 7 + "line": 131, + "column": 26 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1302, - "end": 1303, + "value": "===", + "start": 3461, + "end": 3464, "loc": { "start": { - "line": 48, - "column": 7 + "line": 131, + "column": 27 }, "end": { - "line": 48, - "column": 8 + "line": 131, + "column": 30 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -10779,74 +22255,70 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "root", - "start": 1303, - "end": 1307, + "value": "null", + "start": 3465, + "end": 3469, "loc": { "start": { - "line": 48, - "column": 8 + "line": 131, + "column": 31 }, "end": { - "line": 48, - "column": 12 + "line": 131, + "column": 35 } } }, { "type": { - "label": "=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 1308, - "end": 1309, + "start": 3469, + "end": 3470, "loc": { "start": { - "line": 48, - "column": 13 + "line": 131, + "column": 35 }, "end": { - "line": 48, - "column": 14 + "line": 131, + "column": 36 } } }, { "type": { - "label": "new", - "keyword": "new", + "label": "{", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null + "postfix": false, + "binop": null }, - "value": "new", - "start": 1310, - "end": 1313, + "start": 3471, + "end": 3472, "loc": { "start": { - "line": 48, - "column": 15 + "line": 131, + "column": 37 }, "end": { - "line": 48, - "column": 18 + "line": 131, + "column": 38 } } }, @@ -10862,17 +22334,17 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 1314, - "end": 1318, + "value": "assert", + "start": 3478, + "end": 3484, "loc": { "start": { - "line": 48, - "column": 19 + "line": 132, + "column": 5 }, "end": { - "line": 48, - "column": 23 + "line": 132, + "column": 11 } } }, @@ -10888,16 +22360,16 @@ "postfix": false, "binop": null }, - "start": 1318, - "end": 1319, + "start": 3484, + "end": 3485, "loc": { "start": { - "line": 48, - "column": 23 + "line": 132, + "column": 11 }, "end": { - "line": 48, - "column": 24 + "line": 132, + "column": 12 } } }, @@ -10913,23 +22385,23 @@ "postfix": false, "binop": null }, - "value": "BLACK", - "start": 1319, - "end": 1324, + "value": "node", + "start": 3485, + "end": 3489, "loc": { "start": { - "line": 48, - "column": 24 + "line": 132, + "column": 12 }, "end": { - "line": 48, - "column": 29 + "line": 132, + "column": 16 } } }, { "type": { - "label": ",", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -10937,25 +22409,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1324, - "end": 1325, + "value": "===", + "start": 3490, + "end": 3493, "loc": { "start": { - "line": 48, - "column": 29 + "line": 132, + "column": 17 }, "end": { - "line": 48, - "column": 30 + "line": 132, + "column": 20 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -10963,25 +22437,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "key", - "start": 1326, - "end": 1329, + "value": "this", + "start": 3494, + "end": 3498, "loc": { "start": { - "line": 48, - "column": 31 + "line": 132, + "column": 21 }, "end": { - "line": 48, - "column": 34 + "line": 132, + "column": 25 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -10989,50 +22464,51 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1329, - "end": 1330, + "start": 3498, + "end": 3499, "loc": { "start": { - "line": 48, - "column": 34 + "line": 132, + "column": 25 }, "end": { - "line": 48, - "column": 35 + "line": 132, + "column": 26 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1330, - "end": 1331, + "value": "root", + "start": 3499, + "end": 3503, "loc": { "start": { - "line": 48, - "column": 35 + "line": 132, + "column": 26 }, "end": { - "line": 48, - "column": 36 + "line": 132, + "column": 30 } } }, { "type": { - "label": "}", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -11042,23 +22518,22 @@ "postfix": false, "binop": null }, - "start": 1334, - "end": 1335, + "start": 3503, + "end": 3504, "loc": { "start": { - "line": 49, - "column": 2 + "line": 132, + "column": 30 }, "end": { - "line": 49, - "column": 3 + "line": 132, + "column": 31 } } }, { "type": { - "label": "else", - "keyword": "else", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -11069,49 +22544,50 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 1336, - "end": 1340, + "start": 3504, + "end": 3505, "loc": { "start": { - "line": 49, - "column": 4 + "line": 132, + "column": 31 }, "end": { - "line": 49, - "column": 8 + "line": 132, + "column": 32 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "this", + "keyword": "this", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1341, - "end": 1342, + "value": "this", + "start": 3511, + "end": 3515, "loc": { "start": { - "line": 49, - "column": 9 + "line": 133, + "column": 5 }, "end": { - "line": 49, - "column": 10 + "line": 133, + "column": 9 } } }, { "type": { - "label": "const", - "keyword": "const", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -11122,17 +22598,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 1346, - "end": 1351, + "start": 3515, + "end": 3516, "loc": { "start": { - "line": 50, - "column": 3 + "line": 133, + "column": 9 }, "end": { - "line": 50, - "column": 8 + "line": 133, + "column": 10 } } }, @@ -11148,17 +22623,17 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 1352, - "end": 1356, + "value": "root", + "start": 3516, + "end": 3520, "loc": { "start": { - "line": 50, - "column": 9 + "line": 133, + "column": 10 }, "end": { - "line": 50, - "column": 13 + "line": 133, + "column": 14 } } }, @@ -11176,78 +22651,76 @@ "updateContext": null }, "value": "=", - "start": 1357, - "end": 1358, + "start": 3521, + "end": 3522, "loc": { "start": { - "line": 50, - "column": 14 + "line": 133, + "column": 15 }, "end": { - "line": 50, - "column": 15 + "line": 133, + "column": 16 } } }, { "type": { - "label": "new", - "keyword": "new", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "new", - "start": 1359, - "end": 1362, + "value": "pred", + "start": 3523, + "end": 3527, "loc": { "start": { - "line": 50, - "column": 16 + "line": 133, + "column": 17 }, "end": { - "line": 50, - "column": 19 + "line": 133, + "column": 21 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "Node", - "start": 1363, - "end": 1367, + "start": 3527, + "end": 3528, "loc": { "start": { - "line": 50, - "column": 20 + "line": 133, + "column": 21 }, "end": { - "line": 50, - "column": 24 + "line": 133, + "column": 22 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11255,24 +22728,24 @@ "postfix": false, "binop": null }, - "start": 1367, - "end": 1368, + "start": 3533, + "end": 3534, "loc": { "start": { - "line": 50, - "column": 24 + "line": 134, + "column": 4 }, "end": { - "line": 50, - "column": 25 + "line": 134, + "column": 5 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11280,23 +22753,23 @@ "postfix": false, "binop": null }, - "value": "RED", - "start": 1368, - "end": 1371, + "start": 3538, + "end": 3539, "loc": { "start": { - "line": 50, - "column": 25 + "line": 135, + "column": 3 }, "end": { - "line": 50, - "column": 28 + "line": 135, + "column": 4 } } }, { "type": { - "label": ",", + "label": "else", + "keyword": "else", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -11307,23 +22780,24 @@ "binop": null, "updateContext": null }, - "start": 1371, - "end": 1372, + "value": "else", + "start": 3540, + "end": 3544, "loc": { "start": { - "line": 50, - "column": 28 + "line": 135, + "column": 5 }, "end": { - "line": 50, - "column": 29 + "line": 135, + "column": 9 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -11332,25 +22806,24 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 1373, - "end": 1376, + "start": 3545, + "end": 3546, "loc": { "start": { - "line": 50, - "column": 30 + "line": 135, + "column": 10 }, "end": { - "line": 50, - "column": 33 + "line": 135, + "column": 11 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11358,49 +22831,24 @@ "postfix": false, "binop": null }, - "start": 1376, - "end": 1377, + "value": "delete_one_child", + "start": 3551, + "end": 3567, "loc": { "start": { - "line": 50, - "column": 33 + "line": 136, + "column": 4 }, "end": { - "line": 50, - "column": 34 + "line": 136, + "column": 20 } } }, { "type": { - "label": ";", + "label": "(", "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1377, - "end": 1378, - "loc": { - "start": { - "line": 50, - "column": 34 - }, - "end": { - "line": 50, - "column": 35 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -11409,24 +22857,23 @@ "postfix": false, "binop": null }, - "value": "insert", - "start": 1382, - "end": 1388, + "start": 3567, + "end": 3568, "loc": { - "start": { - "line": 51, - "column": 3 + "start": { + "line": 136, + "column": 20 }, "end": { - "line": 51, - "column": 9 + "line": 136, + "column": 21 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -11435,51 +22882,49 @@ "postfix": false, "binop": null }, - "start": 1388, - "end": 1389, + "value": "node", + "start": 3568, + "end": 3572, "loc": { "start": { - "line": 51, - "column": 9 + "line": 136, + "column": 21 }, "end": { - "line": 51, - "column": 10 + "line": 136, + "column": 25 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 1389, - "end": 1393, + "start": 3572, + "end": 3573, "loc": { "start": { - "line": 51, - "column": 10 + "line": 136, + "column": 25 }, "end": { - "line": 51, - "column": 14 + "line": 136, + "column": 26 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -11489,75 +22934,75 @@ "binop": null, "updateContext": null }, - "start": 1393, - "end": 1394, + "start": 3573, + "end": 3574, "loc": { "start": { - "line": 51, - "column": 14 + "line": 136, + "column": 26 }, "end": { - "line": 51, - "column": 15 + "line": 136, + "column": 27 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "compare", - "start": 1394, - "end": 1401, + "value": "if", + "start": 3579, + "end": 3581, "loc": { "start": { - "line": 51, - "column": 15 + "line": 137, + "column": 4 }, "end": { - "line": 51, - "column": 22 + "line": 137, + "column": 6 } } }, { "type": { - "label": ",", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1401, - "end": 1402, + "start": 3582, + "end": 3583, "loc": { "start": { - "line": 51, - "column": 22 + "line": 137, + "column": 7 }, "end": { - "line": 51, - "column": 23 + "line": 137, + "column": 8 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -11565,20 +23010,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 1403, - "end": 1407, + "value": "pred", + "start": 3583, + "end": 3587, "loc": { "start": { - "line": 51, - "column": 24 + "line": 137, + "column": 8 }, "end": { - "line": 51, - "column": 28 + "line": 137, + "column": 12 } } }, @@ -11595,16 +23039,16 @@ "binop": null, "updateContext": null }, - "start": 1407, - "end": 1408, + "start": 3587, + "end": 3588, "loc": { "start": { - "line": 51, - "column": 28 + "line": 137, + "column": 12 }, "end": { - "line": 51, - "column": 29 + "line": 137, + "column": 13 } } }, @@ -11620,23 +23064,23 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 1408, - "end": 1412, + "value": "parent", + "start": 3588, + "end": 3594, "loc": { "start": { - "line": 51, - "column": 29 + "line": 137, + "column": 13 }, "end": { - "line": 51, - "column": 33 + "line": 137, + "column": 19 } } }, { "type": { - "label": ",", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -11644,25 +23088,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1412, - "end": 1413, + "value": "===", + "start": 3595, + "end": 3598, "loc": { "start": { - "line": 51, - "column": 33 + "line": 137, + "column": 20 }, "end": { - "line": 51, - "column": 34 + "line": 137, + "column": 23 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -11670,19 +23116,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 1414, - "end": 1418, + "value": "null", + "start": 3599, + "end": 3603, "loc": { "start": { - "line": 51, - "column": 35 + "line": 137, + "column": 24 }, "end": { - "line": 51, - "column": 39 + "line": 137, + "column": 28 } } }, @@ -11698,42 +23145,41 @@ "postfix": false, "binop": null }, - "start": 1418, - "end": 1419, + "start": 3603, + "end": 3604, "loc": { "start": { - "line": 51, - "column": 39 + "line": 137, + "column": 28 }, "end": { - "line": 51, - "column": 40 + "line": 137, + "column": 29 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1419, - "end": 1420, + "start": 3605, + "end": 3606, "loc": { "start": { - "line": 51, - "column": 40 + "line": 137, + "column": 30 }, "end": { - "line": 51, - "column": 41 + "line": 137, + "column": 31 } } }, @@ -11749,17 +23195,17 @@ "postfix": false, "binop": null }, - "value": "insert_case1", - "start": 1424, - "end": 1436, + "value": "assert", + "start": 3612, + "end": 3618, "loc": { "start": { - "line": 52, - "column": 3 + "line": 138, + "column": 5 }, "end": { - "line": 52, - "column": 15 + "line": 138, + "column": 11 } } }, @@ -11775,16 +23221,16 @@ "postfix": false, "binop": null }, - "start": 1436, - "end": 1437, + "start": 3618, + "end": 3619, "loc": { "start": { - "line": 52, - "column": 15 + "line": 138, + "column": 11 }, "end": { - "line": 52, - "column": 16 + "line": 138, + "column": 12 } } }, @@ -11801,49 +23247,52 @@ "binop": null }, "value": "node", - "start": 1437, - "end": 1441, + "start": 3619, + "end": 3623, "loc": { "start": { - "line": 52, - "column": 16 + "line": 138, + "column": 12 }, "end": { - "line": 52, - "column": 20 + "line": 138, + "column": 16 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 1441, - "end": 1442, + "value": "===", + "start": 3624, + "end": 3627, "loc": { "start": { - "line": 52, - "column": 20 + "line": 138, + "column": 17 }, "end": { - "line": 52, - "column": 21 + "line": 138, + "column": 20 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11852,22 +23301,23 @@ "binop": null, "updateContext": null }, - "start": 1442, - "end": 1443, + "value": "this", + "start": 3628, + "end": 3632, "loc": { "start": { - "line": 52, + "line": 138, "column": 21 }, "end": { - "line": 52, - "column": 22 + "line": 138, + "column": 25 } } }, { "type": { - "label": "}", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -11875,26 +23325,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1446, - "end": 1447, + "start": 3632, + "end": 3633, "loc": { "start": { - "line": 53, - "column": 2 + "line": 138, + "column": 25 }, "end": { - "line": 53, - "column": 3 + "line": 138, + "column": 26 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11902,40 +23353,25 @@ "postfix": false, "binop": null }, - "start": 1449, - "end": 1450, - "loc": { - "start": { - "line": 54, - "column": 1 - }, - "end": { - "line": 54, - "column": 2 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t ", - "start": 1453, - "end": 1679, + "value": "root", + "start": 3633, + "end": 3637, "loc": { "start": { - "line": 56, - "column": 1 + "line": 138, + "column": 26 }, "end": { - "line": 63, - "column": 4 + "line": 138, + "column": 30 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -11943,48 +23379,49 @@ "postfix": false, "binop": null }, - "value": "_search", - "start": 1681, - "end": 1688, + "start": 3637, + "end": 3638, "loc": { "start": { - "line": 64, - "column": 1 + "line": 138, + "column": 30 }, "end": { - "line": 64, - "column": 8 + "line": 138, + "column": 31 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1688, - "end": 1689, + "start": 3638, + "end": 3639, "loc": { "start": { - "line": 64, - "column": 8 + "line": 138, + "column": 31 }, "end": { - "line": 64, - "column": 9 + "line": 138, + "column": 32 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -11992,25 +23429,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "key", - "start": 1689, - "end": 1692, + "value": "this", + "start": 3645, + "end": 3649, "loc": { "start": { - "line": 64, - "column": 9 + "line": 139, + "column": 5 }, "end": { - "line": 64, - "column": 12 + "line": 139, + "column": 9 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -12018,25 +23456,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1692, - "end": 1693, + "start": 3649, + "end": 3650, "loc": { "start": { - "line": 64, - "column": 12 + "line": 139, + "column": 9 }, "end": { - "line": 64, - "column": 13 + "line": 139, + "column": 10 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -12045,51 +23484,51 @@ "postfix": false, "binop": null }, - "start": 1694, - "end": 1695, + "value": "root", + "start": 3650, + "end": 3654, "loc": { "start": { - "line": 64, - "column": 14 + "line": 139, + "column": 10 }, "end": { - "line": 64, - "column": 15 + "line": 139, + "column": 14 } } }, { "type": { - "label": "if", - "keyword": "if", - "beforeExpr": false, + "label": "=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "if", - "start": 1698, - "end": 1700, + "value": "=", + "start": 3655, + "end": 3656, "loc": { "start": { - "line": 65, - "column": 2 + "line": 139, + "column": 15 }, "end": { - "line": 65, - "column": 4 + "line": 139, + "column": 16 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -12098,25 +23537,25 @@ "postfix": false, "binop": null }, - "start": 1701, - "end": 1702, + "value": "pred", + "start": 3657, + "end": 3661, "loc": { "start": { - "line": 65, - "column": 5 + "line": 139, + "column": 17 }, "end": { - "line": 65, - "column": 6 + "line": 139, + "column": 21 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12125,23 +23564,22 @@ "binop": null, "updateContext": null }, - "value": "this", - "start": 1702, - "end": 1706, + "start": 3661, + "end": 3662, "loc": { "start": { - "line": 65, - "column": 6 + "line": 139, + "column": 21 }, "end": { - "line": 65, - "column": 10 + "line": 139, + "column": 22 } } }, { "type": { - "label": ".", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -12149,27 +23587,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1706, - "end": 1707, + "start": 3667, + "end": 3668, "loc": { "start": { - "line": 65, - "column": 10 + "line": 140, + "column": 4 }, "end": { - "line": 65, - "column": 11 + "line": 140, + "column": 5 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12177,53 +23614,50 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 1707, - "end": 1711, + "start": 3672, + "end": 3673, "loc": { "start": { - "line": 65, - "column": 11 + "line": 141, + "column": 3 }, "end": { - "line": 65, - "column": 15 + "line": 141, + "column": 4 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 1712, - "end": 1715, + "start": 3676, + "end": 3677, "loc": { "start": { - "line": 65, - "column": 16 + "line": 142, + "column": 2 }, "end": { - "line": 65, - "column": 19 + "line": 142, + "column": 3 } } }, { "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12232,23 +23666,24 @@ "binop": null, "updateContext": null }, - "value": "null", - "start": 1716, - "end": 1720, + "value": "else", + "start": 3678, + "end": 3682, "loc": { "start": { - "line": 65, - "column": 20 + "line": 142, + "column": 4 }, "end": { - "line": 65, - "column": 24 + "line": 142, + "column": 8 } } }, { "type": { - "label": ")", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -12256,53 +23691,51 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1720, - "end": 1721, + "value": "if", + "start": 3683, + "end": 3685, "loc": { "start": { - "line": 65, - "column": 24 + "line": 142, + "column": 9 }, "end": { - "line": 65, - "column": 25 + "line": 142, + "column": 11 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "return", - "start": 1722, - "end": 1728, + "start": 3686, + "end": 3687, "loc": { "start": { - "line": 65, - "column": 26 + "line": 142, + "column": 12 }, "end": { - "line": 65, - "column": 32 + "line": 142, + "column": 13 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -12310,27 +23743,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 1729, - "end": 1733, + "value": "node", + "start": 3687, + "end": 3691, "loc": { "start": { - "line": 65, - "column": 33 + "line": 142, + "column": 13 }, "end": { - "line": 65, - "column": 37 + "line": 142, + "column": 17 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -12340,23 +23772,48 @@ "binop": null, "updateContext": null }, - "start": 1733, - "end": 1734, + "start": 3691, + "end": 3692, "loc": { "start": { - "line": 65, - "column": 37 + "line": 142, + "column": 17 }, "end": { - "line": 65, - "column": 38 + "line": 142, + "column": 18 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": "name", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "value": "right", + "start": 3692, + "end": 3697, + "loc": { + "start": { + "line": 142, + "column": 18 + }, + "end": { + "line": 142, + "column": 23 + } + } + }, + { + "type": { + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -12364,26 +23821,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "return", - "start": 1737, - "end": 1743, + "value": "!==", + "start": 3698, + "end": 3701, "loc": { "start": { - "line": 66, - "column": 2 + "line": 142, + "column": 24 }, "end": { - "line": 66, - "column": 8 + "line": 142, + "column": 27 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -12391,27 +23849,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "search", - "start": 1744, - "end": 1750, + "value": "null", + "start": 3702, + "end": 3706, "loc": { "start": { - "line": 66, - "column": 9 + "line": 142, + "column": 28 }, "end": { - "line": 66, - "column": 15 + "line": 142, + "column": 32 } } }, { "type": { - "label": "(", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -12419,70 +23878,57 @@ "postfix": false, "binop": null }, - "start": 1750, - "end": 1751, + "start": 3706, + "end": 3707, "loc": { "start": { - "line": 66, - "column": 15 + "line": 142, + "column": 32 }, "end": { - "line": 66, - "column": 16 + "line": 142, + "column": 33 } } }, { "type": { - "label": "this", - "keyword": "this", - "beforeExpr": false, + "label": "{", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 1751, - "end": 1755, + "start": 3708, + "end": 3709, "loc": { "start": { - "line": 66, - "column": 16 + "line": 142, + "column": 34 }, "end": { - "line": 66, - "column": 20 + "line": 142, + "column": 35 } } }, { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 1755, - "end": 1756, + "type": "CommentBlock", + "value": "*\n\t\t\t * Swap node with its successor.\n\t\t\t *\n\t\t\t * NOTE: Since pred is a leaf, there can only by one node in the\n\t\t\t * right subtree, succ, which is necessarily red, hence\n\t\t\t * node is black.\n\t\t\t *\n\t\t\t * The configuration:\n\t\t\t *\n\t\t\t * (A) (B) (C)\n\t\t\t *\n\t\t\t * p p p\n\t\t\t * | | |\n\t\t\t * node (BLACK) succ (BLACK) succ (BLACK)\n\t\t\t * / \\ / \\ / \\\n\t\t\t * - succ (RED) -> - node (RED) -> - -\n\t\t\t * / \\ / \\\n\t\t\t * - - - -\n\t\t\t *\n\t\t\t * NOTE: We take a shortcut and go directly from (A) to (C)\n\t\t\t ", + "start": 3713, + "end": 4422, "loc": { "start": { - "line": 66, - "column": 20 + "line": 143, + "column": 3 }, "end": { - "line": 66, - "column": 21 + "line": 163, + "column": 6 } } }, @@ -12498,50 +23944,48 @@ "postfix": false, "binop": null }, - "value": "compare", - "start": 1756, - "end": 1763, + "value": "assert", + "start": 4426, + "end": 4432, "loc": { "start": { - "line": 66, - "column": 21 + "line": 164, + "column": 3 }, "end": { - "line": 66, - "column": 28 + "line": 164, + "column": 9 } } }, { "type": { - "label": ",", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 1763, - "end": 1764, + "start": 4432, + "end": 4433, "loc": { "start": { - "line": 66, - "column": 28 + "line": 164, + "column": 9 }, "end": { - "line": 66, - "column": 29 + "line": 164, + "column": 10 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -12549,20 +23993,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 1765, - "end": 1769, + "value": "node", + "start": 4433, + "end": 4437, "loc": { "start": { - "line": 66, - "column": 30 + "line": 164, + "column": 10 }, "end": { - "line": 66, - "column": 34 + "line": 164, + "column": 14 } } }, @@ -12579,16 +24022,16 @@ "binop": null, "updateContext": null }, - "start": 1769, - "end": 1770, + "start": 4437, + "end": 4438, "loc": { "start": { - "line": 66, - "column": 34 + "line": 164, + "column": 14 }, "end": { - "line": 66, - "column": 35 + "line": 164, + "column": 15 } } }, @@ -12604,23 +24047,23 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 1770, - "end": 1774, + "value": "left", + "start": 4438, + "end": 4442, "loc": { "start": { - "line": 66, - "column": 35 + "line": 164, + "column": 15 }, "end": { - "line": 66, - "column": 39 + "line": 164, + "column": 19 } } }, { "type": { - "label": ",", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -12628,25 +24071,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 1774, - "end": 1775, + "value": "===", + "start": 4443, + "end": 4446, "loc": { "start": { - "line": 66, - "column": 39 + "line": 164, + "column": 20 }, "end": { - "line": 66, - "column": 40 + "line": 164, + "column": 23 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -12654,19 +24099,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "key", - "start": 1776, - "end": 1779, + "value": "null", + "start": 4447, + "end": 4451, "loc": { "start": { - "line": 66, - "column": 41 + "line": 164, + "column": 24 }, "end": { - "line": 66, - "column": 44 + "line": 164, + "column": 28 } } }, @@ -12682,16 +24128,16 @@ "postfix": false, "binop": null }, - "start": 1779, - "end": 1780, + "start": 4451, + "end": 4452, "loc": { "start": { - "line": 66, - "column": 44 + "line": 164, + "column": 28 }, "end": { - "line": 66, - "column": 45 + "line": 164, + "column": 29 } } }, @@ -12708,22 +24154,23 @@ "binop": null, "updateContext": null }, - "start": 1780, - "end": 1781, + "start": 4452, + "end": 4453, "loc": { "start": { - "line": 66, - "column": 45 + "line": 164, + "column": 29 }, "end": { - "line": 66, - "column": 46 + "line": 164, + "column": 30 } } }, { "type": { - "label": "}", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -12731,34 +24178,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 1783, - "end": 1784, - "loc": { - "start": { - "line": 67, - "column": 1 - }, - "end": { - "line": 67, - "column": 2 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t ", - "start": 1787, - "end": 2049, + "value": "const", + "start": 4457, + "end": 4462, "loc": { "start": { - "line": 69, - "column": 1 + "line": 165, + "column": 3 }, "end": { - "line": 76, - "column": 4 + "line": 165, + "column": 8 } } }, @@ -12774,42 +24207,44 @@ "postfix": false, "binop": null }, - "value": "get", - "start": 2051, - "end": 2054, + "value": "succ", + "start": 4463, + "end": 4467, "loc": { "start": { - "line": 77, - "column": 1 + "line": 165, + "column": 9 }, "end": { - "line": 77, - "column": 4 + "line": 165, + "column": 13 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2054, - "end": 2055, + "value": "=", + "start": 4468, + "end": 4469, "loc": { "start": { - "line": 77, - "column": 4 + "line": 165, + "column": 14 }, "end": { - "line": 77, - "column": 5 + "line": 165, + "column": 15 } } }, @@ -12825,23 +24260,23 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 2055, - "end": 2058, + "value": "node", + "start": 4470, + "end": 4474, "loc": { "start": { - "line": 77, - "column": 5 + "line": 165, + "column": 16 }, "end": { - "line": 77, - "column": 8 + "line": 165, + "column": 20 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -12849,25 +24284,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2058, - "end": 2059, + "start": 4474, + "end": 4475, "loc": { "start": { - "line": 77, - "column": 8 + "line": 165, + "column": 20 }, - "end": { - "line": 77, - "column": 9 + "end": { + "line": 165, + "column": 21 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -12876,24 +24312,24 @@ "postfix": false, "binop": null }, - "start": 2060, - "end": 2061, + "value": "right", + "start": 4475, + "end": 4480, "loc": { "start": { - "line": 77, - "column": 10 + "line": 165, + "column": 21 }, "end": { - "line": 77, - "column": 11 + "line": 165, + "column": 26 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -12903,17 +24339,16 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 2064, - "end": 2069, + "start": 4480, + "end": 4481, "loc": { "start": { - "line": 78, - "column": 2 + "line": 165, + "column": 26 }, "end": { - "line": 78, - "column": 7 + "line": 165, + "column": 27 } } }, @@ -12929,51 +24364,48 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 2070, - "end": 2074, + "value": "assert", + "start": 4485, + "end": 4491, "loc": { "start": { - "line": 78, - "column": 8 + "line": 166, + "column": 3 }, "end": { - "line": 78, - "column": 12 + "line": 166, + "column": 9 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 2075, - "end": 2076, + "start": 4491, + "end": 4492, "loc": { "start": { - "line": 78, - "column": 13 + "line": 166, + "column": 9 }, "end": { - "line": 78, - "column": 14 + "line": 166, + "column": 10 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -12981,20 +24413,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 2077, - "end": 2081, + "value": "succ", + "start": 4492, + "end": 4496, "loc": { "start": { - "line": 78, - "column": 15 + "line": 166, + "column": 10 }, "end": { - "line": 78, - "column": 19 + "line": 166, + "column": 14 } } }, @@ -13011,16 +24442,16 @@ "binop": null, "updateContext": null }, - "start": 2081, - "end": 2082, + "start": 4496, + "end": 4497, "loc": { "start": { - "line": 78, - "column": 19 + "line": 166, + "column": 14 }, "end": { - "line": 78, - "column": 20 + "line": 166, + "column": 15 } } }, @@ -13036,42 +24467,44 @@ "postfix": false, "binop": null }, - "value": "_search", - "start": 2082, - "end": 2089, + "value": "_color", + "start": 4497, + "end": 4503, "loc": { "start": { - "line": 78, - "column": 20 + "line": 166, + "column": 15 }, "end": { - "line": 78, - "column": 27 + "line": 166, + "column": 21 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 2089, - "end": 2090, + "value": "===", + "start": 4504, + "end": 4507, "loc": { "start": { - "line": 78, - "column": 27 + "line": 166, + "column": 22 }, "end": { - "line": 78, - "column": 28 + "line": 166, + "column": 25 } } }, @@ -13087,17 +24520,17 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 2090, - "end": 2093, + "value": "RED", + "start": 4508, + "end": 4511, "loc": { "start": { - "line": 78, - "column": 28 + "line": 166, + "column": 26 }, "end": { - "line": 78, - "column": 31 + "line": 166, + "column": 29 } } }, @@ -13113,16 +24546,16 @@ "postfix": false, "binop": null }, - "start": 2093, - "end": 2094, + "start": 4511, + "end": 4512, "loc": { "start": { - "line": 78, - "column": 31 + "line": 166, + "column": 29 }, "end": { - "line": 78, - "column": 32 + "line": 166, + "column": 30 } } }, @@ -13139,44 +24572,16 @@ "binop": null, "updateContext": null }, - "start": 2094, - "end": 2095, - "loc": { - "start": { - "line": 78, - "column": 32 - }, - "end": { - "line": 78, - "column": 33 - } - } - }, - { - "type": { - "label": "return", - "keyword": "return", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "return", - "start": 2098, - "end": 2104, + "start": 4512, + "end": 4513, "loc": { "start": { - "line": 79, - "column": 2 + "line": 166, + "column": 30 }, "end": { - "line": 79, - "column": 8 + "line": 166, + "column": 31 } } }, @@ -13192,51 +24597,49 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 2105, - "end": 2109, + "value": "succ", + "start": 4517, + "end": 4521, "loc": { "start": { - "line": 79, - "column": 9 + "line": 167, + "column": 3 }, "end": { - "line": 79, - "column": 13 + "line": 167, + "column": 7 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "===", - "start": 2110, - "end": 2113, + "start": 4521, + "end": 4522, "loc": { "start": { - "line": 79, - "column": 14 + "line": 167, + "column": 7 }, "end": { - "line": 79, - "column": 17 + "line": 167, + "column": 8 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -13244,53 +24647,52 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 2114, - "end": 2118, + "value": "_color", + "start": 4522, + "end": 4528, "loc": { "start": { - "line": 79, - "column": 18 + "line": 167, + "column": 8 }, "end": { - "line": 79, - "column": 22 + "line": 167, + "column": 14 } } }, { "type": { - "label": "?", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "start": 2119, - "end": 2120, + "value": "=", + "start": 4529, + "end": 4530, "loc": { "start": { - "line": 79, - "column": 23 + "line": 167, + "column": 15 }, "end": { - "line": 79, - "column": 24 + "line": 167, + "column": 16 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -13298,26 +24700,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 2121, - "end": 2125, + "value": "BLACK", + "start": 4531, + "end": 4536, "loc": { "start": { - "line": 79, - "column": 25 + "line": 167, + "column": 17 }, "end": { - "line": 79, - "column": 29 + "line": 167, + "column": 22 } } }, { "type": { - "label": ":", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -13328,68 +24729,69 @@ "binop": null, "updateContext": null }, - "start": 2126, - "end": 2127, + "start": 4536, + "end": 4537, "loc": { "start": { - "line": 79, - "column": 30 + "line": 167, + "column": 22 }, "end": { - "line": 79, - "column": 31 + "line": 167, + "column": 23 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 2128, - "end": 2132, + "value": "if", + "start": 4541, + "end": 4543, "loc": { "start": { - "line": 79, - "column": 32 + "line": 168, + "column": 3 }, "end": { - "line": 79, - "column": 36 + "line": 168, + "column": 5 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2132, - "end": 2133, + "start": 4544, + "end": 4545, "loc": { "start": { - "line": 79, - "column": 36 + "line": 168, + "column": 6 }, "end": { - "line": 79, - "column": 37 + "line": 168, + "column": 7 } } }, @@ -13405,23 +24807,23 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 2133, - "end": 2136, + "value": "node", + "start": 4545, + "end": 4549, "loc": { "start": { - "line": 79, - "column": 37 + "line": 168, + "column": 7 }, "end": { - "line": 79, - "column": 40 + "line": 168, + "column": 11 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -13429,93 +24831,81 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 2136, - "end": 2137, + "value": "===", + "start": 4550, + "end": 4553, "loc": { "start": { - "line": 79, - "column": 40 + "line": 168, + "column": 12 }, "end": { - "line": 79, - "column": 41 + "line": 168, + "column": 15 } } }, { "type": { - "label": "}", + "label": "this", + "keyword": "this", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2139, - "end": 2140, - "loc": { - "start": { - "line": 80, - "column": 1 - }, - "end": { - "line": 80, - "column": 2 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t ", - "start": 2143, - "end": 2298, + "value": "this", + "start": 4554, + "end": 4558, "loc": { "start": { - "line": 82, - "column": 1 + "line": 168, + "column": 16 }, "end": { - "line": 88, - "column": 4 + "line": 168, + "column": 20 } } }, { "type": { - "label": "name", + "label": ".", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "has", - "start": 2300, - "end": 2303, + "start": 4558, + "end": 4559, "loc": { "start": { - "line": 89, - "column": 1 + "line": 168, + "column": 20 }, "end": { - "line": 89, - "column": 4 + "line": 168, + "column": 21 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -13524,24 +24914,25 @@ "postfix": false, "binop": null }, - "start": 2303, - "end": 2304, + "value": "root", + "start": 4559, + "end": 4563, "loc": { "start": { - "line": 89, - "column": 4 + "line": 168, + "column": 21 }, "end": { - "line": 89, - "column": 5 + "line": 168, + "column": 25 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -13549,25 +24940,24 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 2304, - "end": 2307, + "start": 4563, + "end": 4564, "loc": { "start": { - "line": 89, - "column": 5 + "line": 168, + "column": 25 }, "end": { - "line": 89, - "column": 8 + "line": 168, + "column": 26 } } }, { "type": { - "label": ")", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -13575,23 +24965,23 @@ "postfix": false, "binop": null }, - "start": 2307, - "end": 2308, + "start": 4565, + "end": 4566, "loc": { "start": { - "line": 89, - "column": 8 + "line": 168, + "column": 27 }, "end": { - "line": 89, - "column": 9 + "line": 168, + "column": 28 } } }, { "type": { - "label": "{", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -13600,51 +24990,48 @@ "postfix": false, "binop": null }, - "start": 2309, - "end": 2310, + "value": "assert", + "start": 4571, + "end": 4577, "loc": { "start": { - "line": 89, - "column": 10 + "line": 169, + "column": 4 }, "end": { - "line": 89, - "column": 11 + "line": 169, + "column": 10 } } }, { "type": { - "label": "return", - "keyword": "return", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "return", - "start": 2313, - "end": 2319, + "start": 4577, + "end": 4578, "loc": { "start": { - "line": 90, - "column": 2 + "line": 169, + "column": 10 }, "end": { - "line": 90, - "column": 8 + "line": 169, + "column": 11 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -13652,20 +25039,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 2320, - "end": 2324, + "value": "node", + "start": 4578, + "end": 4582, "loc": { "start": { - "line": 90, - "column": 9 + "line": 169, + "column": 11 }, "end": { - "line": 90, - "column": 13 + "line": 169, + "column": 15 } } }, @@ -13682,16 +25068,16 @@ "binop": null, "updateContext": null }, - "start": 2324, - "end": 2325, + "start": 4582, + "end": 4583, "loc": { "start": { - "line": 90, - "column": 13 + "line": 169, + "column": 15 }, "end": { - "line": 90, - "column": 14 + "line": 169, + "column": 16 } } }, @@ -13707,48 +25093,51 @@ "postfix": false, "binop": null }, - "value": "_search", - "start": 2325, - "end": 2332, + "value": "parent", + "start": 4583, + "end": 4589, "loc": { "start": { - "line": 90, - "column": 14 + "line": 169, + "column": 16 }, "end": { - "line": 90, - "column": 21 + "line": 169, + "column": 22 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 2332, - "end": 2333, + "value": "===", + "start": 4590, + "end": 4593, "loc": { "start": { - "line": 90, - "column": 21 + "line": 169, + "column": 23 }, "end": { - "line": 90, - "column": 22 + "line": 169, + "column": 26 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -13756,19 +25145,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "key", - "start": 2333, - "end": 2336, + "value": "null", + "start": 4594, + "end": 4598, "loc": { "start": { - "line": 90, - "column": 22 + "line": 169, + "column": 27 }, "end": { - "line": 90, - "column": 25 + "line": 169, + "column": 31 } } }, @@ -13784,22 +25174,22 @@ "postfix": false, "binop": null }, - "start": 2336, - "end": 2337, + "start": 4598, + "end": 4599, "loc": { "start": { - "line": 90, - "column": 25 + "line": 169, + "column": 31 }, "end": { - "line": 90, - "column": 26 + "line": 169, + "column": 32 } } }, { "type": { - "label": "==/!=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -13807,27 +25197,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "!==", - "start": 2338, - "end": 2341, + "start": 4599, + "end": 4600, "loc": { "start": { - "line": 90, - "column": 27 + "line": 169, + "column": 32 }, "end": { - "line": 90, - "column": 30 + "line": 169, + "column": 33 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -13835,27 +25223,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 2342, - "end": 2346, + "value": "succ", + "start": 4605, + "end": 4609, "loc": { "start": { - "line": 90, - "column": 31 + "line": 170, + "column": 4 }, - "end": { - "line": 90, - "column": 35 + "end": { + "line": 170, + "column": 8 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -13865,24 +25252,24 @@ "binop": null, "updateContext": null }, - "start": 2346, - "end": 2347, + "start": 4609, + "end": 4610, "loc": { "start": { - "line": 90, - "column": 35 + "line": 170, + "column": 8 }, "end": { - "line": 90, - "column": 36 + "line": 170, + "column": 9 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -13890,159 +25277,152 @@ "postfix": false, "binop": null }, - "start": 2349, - "end": 2350, - "loc": { - "start": { - "line": 91, - "column": 1 - }, - "end": { - "line": 91, - "column": 2 - } - } - }, - { - "type": "CommentBlock", - "value": "*\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t ", - "start": 2353, - "end": 2458, + "value": "parent", + "start": 4610, + "end": 4616, "loc": { "start": { - "line": 93, - "column": 1 + "line": 170, + "column": 9 }, "end": { - "line": 97, - "column": 4 + "line": 170, + "column": 15 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": "=", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "_delete", - "start": 2460, - "end": 2467, + "value": "=", + "start": 4617, + "end": 4618, "loc": { "start": { - "line": 98, - "column": 1 + "line": 170, + "column": 16 }, "end": { - "line": 98, - "column": 8 + "line": 170, + "column": 17 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "null", + "keyword": "null", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2467, - "end": 2468, + "value": "null", + "start": 4619, + "end": 4623, "loc": { "start": { - "line": 98, - "column": 8 + "line": 170, + "column": 18 }, "end": { - "line": 98, - "column": 9 + "line": 170, + "column": 22 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 2468, - "end": 2472, + "start": 4623, + "end": 4624, "loc": { "start": { - "line": 98, - "column": 9 + "line": 170, + "column": 22 }, "end": { - "line": 98, - "column": 13 + "line": 170, + "column": 23 } } }, { "type": { - "label": ")", + "label": "this", + "keyword": "this", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2472, - "end": 2473, + "value": "this", + "start": 4629, + "end": 4633, "loc": { "start": { - "line": 98, - "column": 13 + "line": 171, + "column": 4 }, "end": { - "line": 98, - "column": 14 + "line": 171, + "column": 8 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2474, - "end": 2475, + "start": 4633, + "end": 4634, "loc": { "start": { - "line": 98, - "column": 15 + "line": 171, + "column": 8 }, "end": { - "line": 98, - "column": 16 + "line": 171, + "column": 9 } } }, @@ -14058,42 +25438,44 @@ "postfix": false, "binop": null }, - "value": "assert", - "start": 2478, - "end": 2484, + "value": "root", + "start": 4634, + "end": 4638, "loc": { "start": { - "line": 99, - "column": 2 + "line": 171, + "column": 9 }, "end": { - "line": 99, - "column": 8 + "line": 171, + "column": 13 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2484, - "end": 2485, + "value": "=", + "start": 4639, + "end": 4640, "loc": { "start": { - "line": 99, - "column": 8 + "line": 171, + "column": 14 }, "end": { - "line": 99, - "column": 9 + "line": 171, + "column": 15 } } }, @@ -14109,24 +25491,23 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 2485, - "end": 2489, + "value": "succ", + "start": 4641, + "end": 4645, "loc": { "start": { - "line": 99, - "column": 9 + "line": 171, + "column": 16 }, "end": { - "line": 99, - "column": 13 + "line": 171, + "column": 20 } } }, { "type": { - "label": "instanceof", - "keyword": "instanceof", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -14134,28 +25515,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": 7, + "binop": null, "updateContext": null }, - "value": "instanceof", - "start": 2490, - "end": 2500, + "start": 4645, + "end": 4646, "loc": { "start": { - "line": 99, - "column": 14 + "line": 171, + "column": 20 }, "end": { - "line": 99, - "column": 24 + "line": 171, + "column": 21 } } }, { "type": { - "label": "name", + "label": "}", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14163,96 +25543,95 @@ "postfix": false, "binop": null }, - "value": "Node", - "start": 2501, - "end": 2505, + "start": 4650, + "end": 4651, "loc": { "start": { - "line": 99, - "column": 25 + "line": 172, + "column": 3 }, "end": { - "line": 99, - "column": 29 + "line": 172, + "column": 4 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": "else", + "keyword": "else", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2505, - "end": 2506, + "value": "else", + "start": 4652, + "end": 4656, "loc": { "start": { - "line": 99, - "column": 29 + "line": 172, + "column": 5 }, "end": { - "line": 99, - "column": 30 + "line": 172, + "column": 9 } } }, { "type": { - "label": ";", + "label": "{", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2506, - "end": 2507, + "start": 4657, + "end": 4658, "loc": { "start": { - "line": 99, - "column": 30 + "line": 172, + "column": 10 }, "end": { - "line": 99, - "column": 31 + "line": 172, + "column": 11 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 2510, - "end": 2512, + "value": "replace_node", + "start": 4663, + "end": 4675, "loc": { "start": { - "line": 100, - "column": 2 + "line": 173, + "column": 4 }, "end": { - "line": 100, - "column": 4 + "line": 173, + "column": 16 } } }, @@ -14268,16 +25647,16 @@ "postfix": false, "binop": null }, - "start": 2513, - "end": 2514, + "start": 4675, + "end": 4676, "loc": { "start": { - "line": 100, - "column": 5 + "line": 173, + "column": 16 }, "end": { - "line": 100, - "column": 6 + "line": 173, + "column": 17 } } }, @@ -14294,23 +25673,23 @@ "binop": null }, "value": "node", - "start": 2514, - "end": 2518, + "start": 4676, + "end": 4680, "loc": { "start": { - "line": 100, - "column": 6 + "line": 173, + "column": 17 }, "end": { - "line": 100, - "column": 10 + "line": 173, + "column": 21 } } }, { "type": { - "label": ".", - "beforeExpr": false, + "label": ",", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -14320,16 +25699,16 @@ "binop": null, "updateContext": null }, - "start": 2518, - "end": 2519, + "start": 4680, + "end": 4681, "loc": { "start": { - "line": 100, - "column": 10 + "line": 173, + "column": 21 }, "end": { - "line": 100, - "column": 11 + "line": 173, + "column": 22 } } }, @@ -14345,53 +25724,50 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 2519, - "end": 2523, + "value": "succ", + "start": 4682, + "end": 4686, "loc": { "start": { - "line": 100, - "column": 11 + "line": 173, + "column": 23 }, "end": { - "line": 100, - "column": 15 + "line": 173, + "column": 27 } } }, { "type": { - "label": "==/!=", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "!==", - "start": 2524, - "end": 2527, + "start": 4686, + "end": 4687, "loc": { "start": { - "line": 100, - "column": 16 + "line": 173, + "column": 27 }, "end": { - "line": 100, - "column": 19 + "line": 173, + "column": 28 } } }, { "type": { - "label": "null", - "keyword": "null", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14400,23 +25776,22 @@ "binop": null, "updateContext": null }, - "value": "null", - "start": 2528, - "end": 2532, + "start": 4687, + "end": 4688, "loc": { "start": { - "line": 100, - "column": 20 + "line": 173, + "column": 28 }, "end": { - "line": 100, - "column": 24 + "line": 173, + "column": 29 } } }, { "type": { - "label": ")", + "label": "}", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14426,24 +25801,24 @@ "postfix": false, "binop": null }, - "start": 2532, - "end": 2533, + "start": 4692, + "end": 4693, "loc": { "start": { - "line": 100, - "column": 24 + "line": 174, + "column": 3 }, "end": { - "line": 100, - "column": 25 + "line": 174, + "column": 4 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14451,40 +25826,24 @@ "postfix": false, "binop": null }, - "start": 2534, - "end": 2535, + "start": 4696, + "end": 4697, "loc": { "start": { - "line": 100, - "column": 26 + "line": 175, + "column": 2 }, "end": { - "line": 100, - "column": 27 - } - } - }, - { - "type": "CommentLine", - "value": " Replace node's key with predecessor's key", - "start": 2539, - "end": 2583, - "loc": { - "start": { - "line": 101, + "line": 175, "column": 3 - }, - "end": { - "line": 101, - "column": 47 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, + "label": "else", + "keyword": "else", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -14494,70 +25853,70 @@ "binop": null, "updateContext": null }, - "value": "const", - "start": 2587, - "end": 2592, + "value": "else", + "start": 4698, + "end": 4702, "loc": { "start": { - "line": 102, - "column": 3 + "line": 175, + "column": 4 }, "end": { - "line": 102, + "line": 175, "column": 8 } } }, { "type": { - "label": "name", + "label": "if", + "keyword": "if", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "pred", - "start": 2593, - "end": 2597, + "value": "if", + "start": 4703, + "end": 4705, "loc": { "start": { - "line": 102, + "line": 175, "column": 9 }, "end": { - "line": 102, - "column": 13 + "line": 175, + "column": 11 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 2598, - "end": 2599, + "start": 4706, + "end": 4707, "loc": { "start": { - "line": 102, - "column": 14 + "line": 175, + "column": 12 }, "end": { - "line": 102, - "column": 15 + "line": 175, + "column": 13 } } }, @@ -14573,48 +25932,51 @@ "postfix": false, "binop": null }, - "value": "predecessor", - "start": 2600, - "end": 2611, + "value": "node", + "start": 4707, + "end": 4711, "loc": { "start": { - "line": 102, - "column": 16 + "line": 175, + "column": 13 }, "end": { - "line": 102, - "column": 27 + "line": 175, + "column": 17 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 2611, - "end": 2612, + "value": "===", + "start": 4712, + "end": 4715, "loc": { "start": { - "line": 102, - "column": 27 + "line": 175, + "column": 18 }, "end": { - "line": 102, - "column": 28 + "line": 175, + "column": 21 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -14622,25 +25984,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 2612, - "end": 2616, + "value": "this", + "start": 4716, + "end": 4720, "loc": { "start": { - "line": 102, - "column": 28 + "line": 175, + "column": 22 }, "end": { - "line": 102, - "column": 32 + "line": 175, + "column": 26 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -14648,52 +26011,53 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2616, - "end": 2617, + "start": 4720, + "end": 4721, "loc": { "start": { - "line": 102, - "column": 32 + "line": 175, + "column": 26 }, "end": { - "line": 102, - "column": 33 + "line": 175, + "column": 27 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2617, - "end": 2618, + "value": "root", + "start": 4721, + "end": 4725, "loc": { "start": { - "line": 102, - "column": 33 + "line": 175, + "column": 27 }, "end": { - "line": 102, - "column": 34 + "line": 175, + "column": 31 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -14701,43 +26065,41 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 2622, - "end": 2626, + "start": 4725, + "end": 4726, "loc": { "start": { - "line": 103, - "column": 3 + "line": 175, + "column": 31 }, "end": { - "line": 103, - "column": 7 + "line": 175, + "column": 32 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2626, - "end": 2627, + "start": 4727, + "end": 4728, "loc": { "start": { - "line": 103, - "column": 7 + "line": 175, + "column": 33 }, "end": { - "line": 103, - "column": 8 + "line": 175, + "column": 34 } } }, @@ -14753,44 +26115,42 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 2627, - "end": 2630, + "value": "assert", + "start": 4732, + "end": 4738, "loc": { "start": { - "line": 103, - "column": 8 + "line": 176, + "column": 3 }, "end": { - "line": 103, - "column": 11 + "line": 176, + "column": 9 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "=", - "start": 2631, - "end": 2632, + "start": 4738, + "end": 4739, "loc": { "start": { - "line": 103, - "column": 12 + "line": 176, + "column": 9 }, "end": { - "line": 103, - "column": 13 + "line": 176, + "column": 10 } } }, @@ -14806,17 +26166,17 @@ "postfix": false, "binop": null }, - "value": "pred", - "start": 2633, - "end": 2637, + "value": "node", + "start": 4739, + "end": 4743, "loc": { "start": { - "line": 103, - "column": 14 + "line": 176, + "column": 10 }, "end": { - "line": 103, - "column": 18 + "line": 176, + "column": 14 } } }, @@ -14833,16 +26193,16 @@ "binop": null, "updateContext": null }, - "start": 2637, - "end": 2638, + "start": 4743, + "end": 4744, "loc": { "start": { - "line": 103, - "column": 18 + "line": 176, + "column": 14 }, "end": { - "line": 103, - "column": 19 + "line": 176, + "column": 15 } } }, @@ -14858,23 +26218,23 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 2638, - "end": 2641, + "value": "parent", + "start": 4744, + "end": 4750, "loc": { "start": { - "line": 103, - "column": 19 + "line": 176, + "column": 15 }, "end": { - "line": 103, - "column": 22 + "line": 176, + "column": 21 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -14882,95 +26242,125 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 2641, - "end": 2642, + "value": "===", + "start": 4751, + "end": 4754, "loc": { "start": { - "line": 103, + "line": 176, "column": 22 }, "end": { - "line": 103, - "column": 23 + "line": 176, + "column": 25 } } }, { - "type": "CommentLine", - "value": " Delete predecessor node", - "start": 2646, - "end": 2672, + "type": { + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "null", + "start": 4755, + "end": 4759, "loc": { "start": { - "line": 104, - "column": 3 + "line": 176, + "column": 26 }, "end": { - "line": 104, - "column": 29 + "line": 176, + "column": 30 } } }, { - "type": "CommentLine", - "value": " NOTE: this node can only have one non-leaf (left) child because", - "start": 2676, - "end": 2742, + "type": { + "label": ")", + "beforeExpr": false, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null + }, + "start": 4759, + "end": 4760, "loc": { "start": { - "line": 105, - "column": 3 + "line": 176, + "column": 30 }, "end": { - "line": 105, - "column": 69 + "line": 176, + "column": 31 } } }, { - "type": "CommentLine", - "value": " of red-black tree invariant.", - "start": 2746, - "end": 2777, + "type": { + "label": ";", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "start": 4760, + "end": 4761, "loc": { "start": { - "line": 106, - "column": 3 + "line": 176, + "column": 31 }, "end": { - "line": 106, - "column": 34 + "line": 176, + "column": 32 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 2781, - "end": 2783, + "value": "assert", + "start": 4765, + "end": 4771, "loc": { "start": { - "line": 107, + "line": 177, "column": 3 }, "end": { - "line": 107, - "column": 5 + "line": 177, + "column": 9 } } }, @@ -14986,16 +26376,16 @@ "postfix": false, "binop": null }, - "start": 2784, - "end": 2785, + "start": 4771, + "end": 4772, "loc": { "start": { - "line": 107, - "column": 6 + "line": 177, + "column": 9 }, "end": { - "line": 107, - "column": 7 + "line": 177, + "column": 10 } } }, @@ -15011,17 +26401,17 @@ "postfix": false, "binop": null }, - "value": "pred", - "start": 2785, - "end": 2789, + "value": "node", + "start": 4772, + "end": 4776, "loc": { "start": { - "line": 107, - "column": 7 + "line": 177, + "column": 10 }, "end": { - "line": 107, - "column": 11 + "line": 177, + "column": 14 } } }, @@ -15038,16 +26428,16 @@ "binop": null, "updateContext": null }, - "start": 2789, - "end": 2790, + "start": 4776, + "end": 4777, "loc": { "start": { - "line": 107, - "column": 11 + "line": 177, + "column": 14 }, "end": { - "line": 107, - "column": 12 + "line": 177, + "column": 15 } } }, @@ -15063,17 +26453,17 @@ "postfix": false, "binop": null }, - "value": "left", - "start": 2790, - "end": 2794, + "value": "_color", + "start": 4777, + "end": 4783, "loc": { "start": { - "line": 107, - "column": 12 + "line": 177, + "column": 15 }, "end": { - "line": 107, - "column": 16 + "line": 177, + "column": 21 } } }, @@ -15091,23 +26481,22 @@ "updateContext": null }, "value": "===", - "start": 2795, - "end": 2798, + "start": 4784, + "end": 4787, "loc": { "start": { - "line": 107, - "column": 17 + "line": 177, + "column": 22 }, "end": { - "line": 107, - "column": 20 + "line": 177, + "column": 25 } } }, { "type": { - "label": "null", - "keyword": "null", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -15115,20 +26504,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "null", - "start": 2799, - "end": 2803, + "value": "BLACK", + "start": 4788, + "end": 4793, "loc": { "start": { - "line": 107, - "column": 21 + "line": 177, + "column": 26 }, "end": { - "line": 107, - "column": 25 + "line": 177, + "column": 31 } } }, @@ -15144,41 +26532,42 @@ "postfix": false, "binop": null }, - "start": 2803, - "end": 2804, + "start": 4793, + "end": 4794, "loc": { "start": { - "line": 107, - "column": 25 + "line": 177, + "column": 31 }, "end": { - "line": 107, - "column": 26 + "line": 177, + "column": 32 } } }, { "type": { - "label": "{", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2805, - "end": 2806, + "start": 4794, + "end": 4795, "loc": { "start": { - "line": 107, - "column": 27 + "line": 177, + "column": 32 }, "end": { - "line": 107, - "column": 28 + "line": 177, + "column": 33 } } }, @@ -15194,17 +26583,17 @@ "postfix": false, "binop": null }, - "value": "delete_no_child", - "start": 2811, - "end": 2826, + "value": "assert", + "start": 4799, + "end": 4805, "loc": { "start": { - "line": 108, - "column": 4 + "line": 178, + "column": 3 }, "end": { - "line": 108, - "column": 19 + "line": 178, + "column": 9 } } }, @@ -15220,16 +26609,16 @@ "postfix": false, "binop": null }, - "start": 2826, - "end": 2827, + "start": 4805, + "end": 4806, "loc": { "start": { - "line": 108, - "column": 19 + "line": 178, + "column": 9 }, "end": { - "line": 108, - "column": 20 + "line": 178, + "column": 10 } } }, @@ -15245,23 +26634,23 @@ "postfix": false, "binop": null }, - "value": "pred", - "start": 2827, - "end": 2831, + "value": "node", + "start": 4806, + "end": 4810, "loc": { "start": { - "line": 108, - "column": 20 + "line": 178, + "column": 10 }, "end": { - "line": 108, - "column": 24 + "line": 178, + "column": 14 } } }, { "type": { - "label": ")", + "label": ".", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -15269,78 +26658,81 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2831, - "end": 2832, + "start": 4810, + "end": 4811, "loc": { "start": { - "line": 108, - "column": 24 + "line": 178, + "column": 14 }, "end": { - "line": 108, - "column": 25 + "line": 178, + "column": 15 } } }, { "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, + "label": "name", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 2832, - "end": 2833, + "value": "left", + "start": 4811, + "end": 4815, "loc": { "start": { - "line": 108, - "column": 25 + "line": 178, + "column": 15 }, "end": { - "line": 108, - "column": 26 + "line": 178, + "column": 19 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 2837, - "end": 2838, + "value": "===", + "start": 4816, + "end": 4819, "loc": { "start": { - "line": 109, - "column": 3 + "line": 178, + "column": 20 }, "end": { - "line": 109, - "column": 4 + "line": 178, + "column": 23 } } }, { "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15349,25 +26741,25 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 2839, - "end": 2843, + "value": "null", + "start": 4820, + "end": 4824, "loc": { "start": { - "line": 109, - "column": 5 + "line": 178, + "column": 24 }, "end": { - "line": 109, - "column": 9 + "line": 178, + "column": 28 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ")", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15375,49 +26767,49 @@ "postfix": false, "binop": null }, - "start": 2844, - "end": 2845, + "start": 4824, + "end": 4825, "loc": { "start": { - "line": 109, - "column": 10 + "line": 178, + "column": 28 }, "end": { - "line": 109, - "column": 11 + "line": 178, + "column": 29 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "delete_one_child", - "start": 2850, - "end": 2866, + "start": 4825, + "end": 4826, "loc": { "start": { - "line": 110, - "column": 4 + "line": 178, + "column": 29 }, "end": { - "line": 110, - "column": 20 + "line": 178, + "column": 30 } } }, { "type": { - "label": "(", - "beforeExpr": true, + "label": "name", + "beforeExpr": false, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -15426,23 +26818,24 @@ "postfix": false, "binop": null }, - "start": 2866, - "end": 2867, + "value": "assert", + "start": 4830, + "end": 4836, "loc": { "start": { - "line": 110, - "column": 20 + "line": 179, + "column": 3 }, "end": { - "line": 110, - "column": 21 + "line": 179, + "column": 9 } } }, { "type": { - "label": "name", - "beforeExpr": false, + "label": "(", + "beforeExpr": true, "startsExpr": true, "rightAssociative": false, "isLoop": false, @@ -15451,25 +26844,24 @@ "postfix": false, "binop": null }, - "value": "pred", - "start": 2867, - "end": 2871, + "start": 4836, + "end": 4837, "loc": { "start": { - "line": 110, - "column": 21 + "line": 179, + "column": 9 }, "end": { - "line": 110, - "column": 25 + "line": 179, + "column": 10 } } }, { "type": { - "label": ")", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15477,23 +26869,24 @@ "postfix": false, "binop": null }, - "start": 2871, - "end": 2872, + "value": "node", + "start": 4837, + "end": 4841, "loc": { "start": { - "line": 110, - "column": 25 + "line": 179, + "column": 10 }, "end": { - "line": 110, - "column": 26 + "line": 179, + "column": 14 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -15503,24 +26896,24 @@ "binop": null, "updateContext": null }, - "start": 2872, - "end": 2873, + "start": 4841, + "end": 4842, "loc": { "start": { - "line": 110, - "column": 26 + "line": 179, + "column": 14 }, "end": { - "line": 110, - "column": 27 + "line": 179, + "column": 15 } } }, { "type": { - "label": "}", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15528,50 +26921,53 @@ "postfix": false, "binop": null }, - "start": 2877, - "end": 2878, + "value": "right", + "start": 4842, + "end": 4847, "loc": { "start": { - "line": 111, - "column": 3 + "line": 179, + "column": 15 }, "end": { - "line": 111, - "column": 4 + "line": 179, + "column": 20 } } }, { "type": { - "label": "}", - "beforeExpr": false, + "label": "==/!=", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 2881, - "end": 2882, + "value": "===", + "start": 4848, + "end": 4851, "loc": { "start": { - "line": 112, - "column": 2 + "line": 179, + "column": 21 }, "end": { - "line": 112, - "column": 3 + "line": 179, + "column": 24 } } }, { "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, - "startsExpr": false, + "label": "null", + "keyword": "null", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15580,24 +26976,23 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 2883, - "end": 2887, + "value": "null", + "start": 4852, + "end": 4856, "loc": { "start": { - "line": 112, - "column": 4 + "line": 179, + "column": 25 }, "end": { - "line": 112, - "column": 8 + "line": 179, + "column": 29 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -15605,51 +27000,51 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 2888, - "end": 2890, + "start": 4856, + "end": 4857, "loc": { "start": { - "line": 112, - "column": 9 + "line": 179, + "column": 29 }, "end": { - "line": 112, - "column": 11 + "line": 179, + "column": 30 } } }, { "type": { - "label": "(", + "label": ";", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2891, - "end": 2892, + "start": 4857, + "end": 4858, "loc": { "start": { - "line": 112, - "column": 12 + "line": 179, + "column": 30 }, "end": { - "line": 112, - "column": 13 + "line": 179, + "column": 31 } } }, { "type": { - "label": "name", + "label": "this", + "keyword": "this", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -15657,19 +27052,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "node", - "start": 2892, - "end": 2896, + "value": "this", + "start": 4862, + "end": 4866, "loc": { "start": { - "line": 112, - "column": 13 + "line": 180, + "column": 3 }, "end": { - "line": 112, - "column": 17 + "line": 180, + "column": 7 } } }, @@ -15686,16 +27082,16 @@ "binop": null, "updateContext": null }, - "start": 2896, - "end": 2897, + "start": 4866, + "end": 4867, "loc": { "start": { - "line": 112, - "column": 17 + "line": 180, + "column": 7 }, "end": { - "line": 112, - "column": 18 + "line": 180, + "column": 8 } } }, @@ -15711,44 +27107,44 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 2897, - "end": 2902, + "value": "root", + "start": 4867, + "end": 4871, "loc": { "start": { - "line": 112, - "column": 18 + "line": 180, + "column": 8 }, "end": { - "line": 112, - "column": 23 + "line": 180, + "column": 12 } } }, { "type": { - "label": "==/!=", + "label": "=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": 6, + "binop": null, "updateContext": null }, - "value": "!==", - "start": 2903, - "end": 2906, + "value": "=", + "start": 4872, + "end": 4873, "loc": { "start": { - "line": 112, - "column": 24 + "line": 180, + "column": 13 }, "end": { - "line": 112, - "column": 27 + "line": 180, + "column": 14 } } }, @@ -15767,49 +27163,50 @@ "updateContext": null }, "value": "null", - "start": 2907, - "end": 2911, + "start": 4874, + "end": 4878, "loc": { "start": { - "line": 112, - "column": 28 + "line": 180, + "column": 15 }, "end": { - "line": 112, - "column": 32 + "line": 180, + "column": 19 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 2911, - "end": 2912, + "start": 4878, + "end": 4879, "loc": { "start": { - "line": 112, - "column": 32 + "line": 180, + "column": 19 }, "end": { - "line": 112, - "column": 33 + "line": 180, + "column": 20 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": "}", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -15817,92 +27214,69 @@ "postfix": false, "binop": null }, - "start": 2913, - "end": 2914, - "loc": { - "start": { - "line": 112, - "column": 34 - }, - "end": { - "line": 112, - "column": 35 - } - } - }, - { - "type": "CommentLine", - "value": " Replace node's key with successor's key", - "start": 2918, - "end": 2960, + "start": 4882, + "end": 4883, "loc": { "start": { - "line": 113, - "column": 3 + "line": 181, + "column": 2 }, "end": { - "line": 113, - "column": 45 - } - } - }, - { - "type": "CommentLine", - "value": " NOTE: Since there is no left child, then there can only be one", - "start": 2964, - "end": 3029, - "loc": { - "start": { - "line": 114, + "line": 181, "column": 3 - }, - "end": { - "line": 114, - "column": 68 } } }, { - "type": "CommentLine", - "value": " right child by the red-black tree invariant.", - "start": 3033, - "end": 3080, + "type": { + "label": "else", + "keyword": "else", + "beforeExpr": true, + "startsExpr": false, + "rightAssociative": false, + "isLoop": false, + "isAssign": false, + "prefix": false, + "postfix": false, + "binop": null, + "updateContext": null + }, + "value": "else", + "start": 4884, + "end": 4888, "loc": { "start": { - "line": 115, - "column": 3 + "line": 181, + "column": 4 }, "end": { - "line": 115, - "column": 50 + "line": 181, + "column": 8 } } }, { "type": { - "label": "const", - "keyword": "const", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "const", - "start": 3084, - "end": 3089, + "start": 4889, + "end": 4890, "loc": { "start": { - "line": 116, - "column": 3 + "line": 181, + "column": 9 }, "end": { - "line": 116, - "column": 8 + "line": 181, + "column": 10 } } }, @@ -15918,44 +27292,42 @@ "postfix": false, "binop": null }, - "value": "succ", - "start": 3090, - "end": 3094, + "value": "assert", + "start": 4894, + "end": 4900, "loc": { "start": { - "line": 116, - "column": 9 + "line": 182, + "column": 3 }, "end": { - "line": 116, - "column": 13 + "line": 182, + "column": 9 } } }, { "type": { - "label": "=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null + "postfix": false, + "binop": null }, - "value": "=", - "start": 3095, - "end": 3096, + "start": 4900, + "end": 4901, "loc": { "start": { - "line": 116, - "column": 14 + "line": 182, + "column": 9 }, "end": { - "line": 116, - "column": 15 + "line": 182, + "column": 10 } } }, @@ -15972,16 +27344,16 @@ "binop": null }, "value": "node", - "start": 3097, - "end": 3101, + "start": 4901, + "end": 4905, "loc": { "start": { - "line": 116, - "column": 16 + "line": 182, + "column": 10 }, "end": { - "line": 116, - "column": 20 + "line": 182, + "column": 14 } } }, @@ -15998,16 +27370,16 @@ "binop": null, "updateContext": null }, - "start": 3101, - "end": 3102, + "start": 4905, + "end": 4906, "loc": { "start": { - "line": 116, - "column": 20 + "line": 182, + "column": 14 }, "end": { - "line": 116, - "column": 21 + "line": 182, + "column": 15 } } }, @@ -16023,23 +27395,23 @@ "postfix": false, "binop": null }, - "value": "right", - "start": 3102, - "end": 3107, + "value": "left", + "start": 4906, + "end": 4910, "loc": { "start": { - "line": 116, - "column": 21 + "line": 182, + "column": 15 }, "end": { - "line": 116, - "column": 26 + "line": 182, + "column": 19 } } }, { "type": { - "label": ";", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, @@ -16047,25 +27419,27 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "start": 3107, - "end": 3108, + "value": "===", + "start": 4911, + "end": 4914, "loc": { "start": { - "line": 116, - "column": 26 + "line": 182, + "column": 20 }, "end": { - "line": 116, - "column": 27 + "line": 182, + "column": 23 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -16073,53 +27447,28 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "value": "node", - "start": 3112, - "end": 3116, - "loc": { - "start": { - "line": 117, - "column": 3 - }, - "end": { - "line": 117, - "column": 7 - } - } - }, - { - "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, "binop": null, "updateContext": null }, - "start": 3116, - "end": 3117, + "value": "null", + "start": 4915, + "end": 4919, "loc": { "start": { - "line": 117, - "column": 7 + "line": 182, + "column": 24 }, "end": { - "line": 117, - "column": 8 + "line": 182, + "column": 28 } } }, { "type": { - "label": "name", + "label": ")", "beforeExpr": false, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -16127,44 +27476,42 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 3117, - "end": 3120, + "start": 4919, + "end": 4920, "loc": { "start": { - "line": 117, - "column": 8 + "line": 182, + "column": 28 }, "end": { - "line": 117, - "column": 11 + "line": 182, + "column": 29 } } }, { "type": { - "label": "=", + "label": ";", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 3121, - "end": 3122, + "start": 4920, + "end": 4921, "loc": { "start": { - "line": 117, - "column": 12 + "line": 182, + "column": 29 }, "end": { - "line": 117, - "column": 13 + "line": 182, + "column": 30 } } }, @@ -16180,43 +27527,42 @@ "postfix": false, "binop": null }, - "value": "succ", - "start": 3123, - "end": 3127, + "value": "assert", + "start": 4925, + "end": 4931, "loc": { "start": { - "line": 117, - "column": 14 + "line": 183, + "column": 3 }, "end": { - "line": 117, - "column": 18 + "line": 183, + "column": 9 } } }, { "type": { - "label": ".", - "beforeExpr": false, - "startsExpr": false, + "label": "(", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 3127, - "end": 3128, + "start": 4931, + "end": 4932, "loc": { "start": { - "line": 117, - "column": 18 + "line": 183, + "column": 9 }, "end": { - "line": 117, - "column": 19 + "line": 183, + "column": 10 } } }, @@ -16232,24 +27578,24 @@ "postfix": false, "binop": null }, - "value": "key", - "start": 3128, - "end": 3131, + "value": "node", + "start": 4932, + "end": 4936, "loc": { "start": { - "line": 117, - "column": 19 + "line": 183, + "column": 10 }, "end": { - "line": 117, - "column": 22 + "line": 183, + "column": 14 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ".", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, @@ -16259,32 +27605,16 @@ "binop": null, "updateContext": null }, - "start": 3131, - "end": 3132, - "loc": { - "start": { - "line": 117, - "column": 22 - }, - "end": { - "line": 117, - "column": 23 - } - } - }, - { - "type": "CommentLine", - "value": " Delete successor node", - "start": 3136, - "end": 3160, + "start": 4936, + "end": 4937, "loc": { "start": { - "line": 118, - "column": 3 + "line": 183, + "column": 14 }, "end": { - "line": 118, - "column": 27 + "line": 183, + "column": 15 } } }, @@ -16300,48 +27630,51 @@ "postfix": false, "binop": null }, - "value": "delete_no_child", - "start": 3164, - "end": 3179, + "value": "right", + "start": 4937, + "end": 4942, "loc": { "start": { - "line": 119, - "column": 3 + "line": 183, + "column": 15 }, "end": { - "line": 119, - "column": 18 + "line": 183, + "column": 20 } } }, { "type": { - "label": "(", + "label": "==/!=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": 6, + "updateContext": null }, - "start": 3179, - "end": 3180, + "value": "===", + "start": 4943, + "end": 4946, "loc": { "start": { - "line": 119, - "column": 18 + "line": 183, + "column": 21 }, "end": { - "line": 119, - "column": 19 + "line": 183, + "column": 24 } } }, { "type": { - "label": "name", + "label": "null", + "keyword": "null", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -16349,19 +27682,20 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "succ", - "start": 3180, - "end": 3184, + "value": "null", + "start": 4947, + "end": 4951, "loc": { "start": { - "line": 119, - "column": 19 + "line": 183, + "column": 25 }, "end": { - "line": 119, - "column": 23 + "line": 183, + "column": 29 } } }, @@ -16377,16 +27711,16 @@ "postfix": false, "binop": null }, - "start": 3184, - "end": 3185, + "start": 4951, + "end": 4952, "loc": { "start": { - "line": 119, - "column": 23 + "line": 183, + "column": 29 }, "end": { - "line": 119, - "column": 24 + "line": 183, + "column": 30 } } }, @@ -16403,22 +27737,23 @@ "binop": null, "updateContext": null }, - "start": 3185, - "end": 3186, + "start": 4952, + "end": 4953, "loc": { "start": { - "line": 119, - "column": 24 + "line": 183, + "column": 30 }, "end": { - "line": 119, - "column": 25 + "line": 183, + "column": 31 } } }, { "type": { - "label": "}", + "label": "const", + "keyword": "const", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16426,99 +27761,73 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null - }, - "start": 3189, - "end": 3190, - "loc": { - "start": { - "line": 120, - "column": 2 - }, - "end": { - "line": 120, - "column": 3 - } - } - }, - { - "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, "binop": null, "updateContext": null }, - "value": "else", - "start": 3191, - "end": 3195, + "value": "const", + "start": 4957, + "end": 4962, "loc": { "start": { - "line": 120, - "column": 4 + "line": 184, + "column": 3 }, "end": { - "line": 120, + "line": 184, "column": 8 } } }, { "type": { - "label": "if", - "keyword": "if", + "label": "name", "beforeExpr": false, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "if", - "start": 3196, - "end": 3198, + "value": "subtree", + "start": 4963, + "end": 4970, "loc": { "start": { - "line": 120, + "line": 184, "column": 9 }, "end": { - "line": 120, - "column": 11 + "line": 184, + "column": 16 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 3199, - "end": 3200, + "value": "=", + "start": 4971, + "end": 4972, "loc": { "start": { - "line": 120, - "column": 12 + "line": 184, + "column": 17 }, "end": { - "line": 120, - "column": 13 + "line": 184, + "column": 18 } } }, @@ -16534,51 +27843,48 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 3200, - "end": 3204, + "value": "delete_no_child", + "start": 4973, + "end": 4988, "loc": { "start": { - "line": 120, - "column": 13 + "line": 184, + "column": 19 }, "end": { - "line": 120, - "column": 17 + "line": 184, + "column": 34 } } }, { "type": { - "label": "==/!=", + "label": "(", "beforeExpr": true, - "startsExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": 6, - "updateContext": null + "binop": null }, - "value": "===", - "start": 3205, - "end": 3208, + "start": 4988, + "end": 4989, "loc": { "start": { - "line": 120, - "column": 18 + "line": 184, + "column": 34 }, "end": { - "line": 120, - "column": 21 + "line": 184, + "column": 35 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -16586,26 +27892,25 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 3209, - "end": 3213, + "value": "node", + "start": 4989, + "end": 4993, "loc": { "start": { - "line": 120, - "column": 22 + "line": 184, + "column": 35 }, "end": { - "line": 120, - "column": 26 + "line": 184, + "column": 39 } } }, { "type": { - "label": ".", + "label": ")", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16613,51 +27918,51 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 3213, - "end": 3214, + "start": 4993, + "end": 4994, "loc": { "start": { - "line": 120, - "column": 26 + "line": 184, + "column": 39 }, "end": { - "line": 120, - "column": 27 + "line": 184, + "column": 40 } } }, { "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, + "label": ";", + "beforeExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "value": "root", - "start": 3214, - "end": 3218, + "start": 4994, + "end": 4995, "loc": { "start": { - "line": 120, - "column": 27 + "line": 184, + "column": 40 }, "end": { - "line": 120, - "column": 31 + "line": 184, + "column": 41 } } }, { "type": { - "label": ")", + "label": "if", + "keyword": "if", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -16665,24 +27970,26 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 3218, - "end": 3219, + "value": "if", + "start": 4999, + "end": 5001, "loc": { "start": { - "line": 120, - "column": 31 + "line": 185, + "column": 3 }, "end": { - "line": 120, - "column": 32 + "line": 185, + "column": 5 } } }, { "type": { - "label": "{", + "label": "(", "beforeExpr": true, "startsExpr": true, "rightAssociative": false, @@ -16692,23 +27999,22 @@ "postfix": false, "binop": null }, - "start": 3220, - "end": 3221, + "start": 5002, + "end": 5003, "loc": { "start": { - "line": 120, - "column": 33 + "line": 185, + "column": 6 }, "end": { - "line": 120, - "column": 34 + "line": 185, + "column": 7 } } }, { "type": { - "label": "this", - "keyword": "this", + "label": "name", "beforeExpr": false, "startsExpr": true, "rightAssociative": false, @@ -16716,20 +28022,19 @@ "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "value": "this", - "start": 3225, - "end": 3229, + "value": "subtree", + "start": 5003, + "end": 5010, "loc": { "start": { - "line": 121, - "column": 3 + "line": 185, + "column": 7 }, "end": { - "line": 121, - "column": 7 + "line": 185, + "column": 14 } } }, @@ -16746,16 +28051,16 @@ "binop": null, "updateContext": null }, - "start": 3229, - "end": 3230, + "start": 5010, + "end": 5011, "loc": { "start": { - "line": 121, - "column": 7 + "line": 185, + "column": 14 }, "end": { - "line": 121, - "column": 8 + "line": 185, + "column": 15 } } }, @@ -16771,44 +28076,44 @@ "postfix": false, "binop": null }, - "value": "root", - "start": 3230, - "end": 3234, + "value": "parent", + "start": 5011, + "end": 5017, "loc": { "start": { - "line": 121, - "column": 8 + "line": 185, + "column": 15 }, "end": { - "line": 121, - "column": 12 + "line": 185, + "column": 21 } } }, { "type": { - "label": "=", + "label": "==/!=", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, - "binop": null, + "binop": 6, "updateContext": null }, - "value": "=", - "start": 3235, - "end": 3236, + "value": "===", + "start": 5018, + "end": 5021, "loc": { "start": { - "line": 121, - "column": 13 + "line": 185, + "column": 22 }, "end": { - "line": 121, - "column": 14 + "line": 185, + "column": 25 } } }, @@ -16827,50 +28132,49 @@ "updateContext": null }, "value": "null", - "start": 3237, - "end": 3241, + "start": 5022, + "end": 5026, "loc": { "start": { - "line": 121, - "column": 15 + "line": 185, + "column": 26 }, "end": { - "line": 121, - "column": 19 + "line": 185, + "column": 30 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": ")", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 3241, - "end": 3242, + "start": 5026, + "end": 5027, "loc": { "start": { - "line": 121, - "column": 19 + "line": 185, + "column": 30 }, "end": { - "line": 121, - "column": 20 + "line": 185, + "column": 31 } } }, { "type": { - "label": "}", - "beforeExpr": false, - "startsExpr": false, + "label": "{", + "beforeExpr": true, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -16878,25 +28182,25 @@ "postfix": false, "binop": null }, - "start": 3245, - "end": 3246, + "start": 5028, + "end": 5029, "loc": { "start": { - "line": 122, - "column": 2 + "line": 185, + "column": 32 }, "end": { - "line": 122, - "column": 3 + "line": 185, + "column": 33 } } }, { "type": { - "label": "else", - "keyword": "else", - "beforeExpr": true, - "startsExpr": false, + "label": "this", + "keyword": "this", + "beforeExpr": false, + "startsExpr": true, "rightAssociative": false, "isLoop": false, "isAssign": false, @@ -16905,42 +28209,43 @@ "binop": null, "updateContext": null }, - "value": "else", - "start": 3247, - "end": 3251, + "value": "this", + "start": 5034, + "end": 5038, "loc": { "start": { - "line": 122, + "line": 186, "column": 4 }, "end": { - "line": 122, + "line": 186, "column": 8 } } }, { "type": { - "label": "{", - "beforeExpr": true, - "startsExpr": true, + "label": ".", + "beforeExpr": false, + "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 3252, - "end": 3253, + "start": 5038, + "end": 5039, "loc": { "start": { - "line": 122, - "column": 9 + "line": 186, + "column": 8 }, "end": { - "line": 122, - "column": 10 + "line": 186, + "column": 9 } } }, @@ -16956,42 +28261,44 @@ "postfix": false, "binop": null }, - "value": "delete_no_child", - "start": 3257, - "end": 3272, + "value": "root", + "start": 5039, + "end": 5043, "loc": { "start": { - "line": 123, - "column": 3 + "line": 186, + "column": 9 }, "end": { - "line": 123, - "column": 18 + "line": 186, + "column": 13 } } }, { "type": { - "label": "(", + "label": "=", "beforeExpr": true, - "startsExpr": true, + "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": false, + "isAssign": true, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 3272, - "end": 3273, + "value": "=", + "start": 5044, + "end": 5045, "loc": { "start": { - "line": 123, - "column": 18 + "line": 186, + "column": 14 }, "end": { - "line": 123, - "column": 19 + "line": 186, + "column": 15 } } }, @@ -17007,68 +28314,68 @@ "postfix": false, "binop": null }, - "value": "node", - "start": 3273, - "end": 3277, + "value": "subtree", + "start": 5046, + "end": 5053, "loc": { - "start": { - "line": 123, - "column": 19 + "start": { + "line": 186, + "column": 16 }, "end": { - "line": 123, + "line": 186, "column": 23 } } }, { "type": { - "label": ")", - "beforeExpr": false, + "label": ";", + "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null + "binop": null, + "updateContext": null }, - "start": 3277, - "end": 3278, + "start": 5053, + "end": 5054, "loc": { "start": { - "line": 123, + "line": 186, "column": 23 }, "end": { - "line": 123, + "line": 186, "column": 24 } } }, { "type": { - "label": ";", - "beforeExpr": true, + "label": "}", + "beforeExpr": false, "startsExpr": false, "rightAssociative": false, "isLoop": false, "isAssign": false, "prefix": false, "postfix": false, - "binop": null, - "updateContext": null + "binop": null }, - "start": 3278, - "end": 3279, + "start": 5058, + "end": 5059, "loc": { "start": { - "line": 123, - "column": 24 + "line": 187, + "column": 3 }, "end": { - "line": 123, - "column": 25 + "line": 187, + "column": 4 } } }, @@ -17084,15 +28391,15 @@ "postfix": false, "binop": null }, - "start": 3282, - "end": 3283, + "start": 5062, + "end": 5063, "loc": { "start": { - "line": 124, + "line": 188, "column": 2 }, "end": { - "line": 124, + "line": 188, "column": 3 } } @@ -17109,31 +28416,31 @@ "postfix": false, "binop": null }, - "start": 3285, - "end": 3286, + "start": 5065, + "end": 5066, "loc": { "start": { - "line": 125, + "line": 189, "column": 1 }, "end": { - "line": 125, + "line": 189, "column": 2 } } }, { "type": "CommentBlock", - "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", - "start": 3289, - "end": 3701, + "value": "*\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#unlink}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t ", + "start": 5069, + "end": 5480, "loc": { "start": { - "line": 127, + "line": 191, "column": 1 }, "end": { - "line": 135, + "line": 199, "column": 4 } } @@ -17151,15 +28458,15 @@ "binop": null }, "value": "remove", - "start": 3703, - "end": 3709, + "start": 5482, + "end": 5488, "loc": { "start": { - "line": 136, + "line": 200, "column": 1 }, "end": { - "line": 136, + "line": 200, "column": 7 } } @@ -17176,15 +28483,15 @@ "postfix": false, "binop": null }, - "start": 3709, - "end": 3710, + "start": 5488, + "end": 5489, "loc": { "start": { - "line": 136, + "line": 200, "column": 7 }, "end": { - "line": 136, + "line": 200, "column": 8 } } @@ -17202,15 +28509,15 @@ "binop": null }, "value": "key", - "start": 3710, - "end": 3713, + "start": 5489, + "end": 5492, "loc": { "start": { - "line": 136, + "line": 200, "column": 8 }, "end": { - "line": 136, + "line": 200, "column": 11 } } @@ -17227,15 +28534,15 @@ "postfix": false, "binop": null }, - "start": 3713, - "end": 3714, + "start": 5492, + "end": 5493, "loc": { "start": { - "line": 136, + "line": 200, "column": 11 }, "end": { - "line": 136, + "line": 200, "column": 12 } } @@ -17252,15 +28559,15 @@ "postfix": false, "binop": null }, - "start": 3715, - "end": 3716, + "start": 5494, + "end": 5495, "loc": { "start": { - "line": 136, + "line": 200, "column": 13 }, "end": { - "line": 136, + "line": 200, "column": 14 } } @@ -17280,15 +28587,15 @@ "updateContext": null }, "value": "const", - "start": 3719, - "end": 3724, + "start": 5498, + "end": 5503, "loc": { "start": { - "line": 137, + "line": 201, "column": 2 }, "end": { - "line": 137, + "line": 201, "column": 7 } } @@ -17306,15 +28613,15 @@ "binop": null }, "value": "node", - "start": 3725, - "end": 3729, + "start": 5504, + "end": 5508, "loc": { "start": { - "line": 137, + "line": 201, "column": 8 }, "end": { - "line": 137, + "line": 201, "column": 12 } } @@ -17333,15 +28640,15 @@ "updateContext": null }, "value": "=", - "start": 3730, - "end": 3731, + "start": 5509, + "end": 5510, "loc": { "start": { - "line": 137, + "line": 201, "column": 13 }, "end": { - "line": 137, + "line": 201, "column": 14 } } @@ -17361,15 +28668,15 @@ "updateContext": null }, "value": "this", - "start": 3732, - "end": 3736, + "start": 5511, + "end": 5515, "loc": { "start": { - "line": 137, + "line": 201, "column": 15 }, "end": { - "line": 137, + "line": 201, "column": 19 } } @@ -17387,15 +28694,15 @@ "binop": null, "updateContext": null }, - "start": 3736, - "end": 3737, + "start": 5515, + "end": 5516, "loc": { "start": { - "line": 137, + "line": 201, "column": 19 }, "end": { - "line": 137, + "line": 201, "column": 20 } } @@ -17413,15 +28720,15 @@ "binop": null }, "value": "_search", - "start": 3737, - "end": 3744, + "start": 5516, + "end": 5523, "loc": { "start": { - "line": 137, + "line": 201, "column": 20 }, "end": { - "line": 137, + "line": 201, "column": 27 } } @@ -17438,15 +28745,15 @@ "postfix": false, "binop": null }, - "start": 3744, - "end": 3745, + "start": 5523, + "end": 5524, "loc": { "start": { - "line": 137, + "line": 201, "column": 27 }, "end": { - "line": 137, + "line": 201, "column": 28 } } @@ -17464,15 +28771,15 @@ "binop": null }, "value": "key", - "start": 3745, - "end": 3748, + "start": 5524, + "end": 5527, "loc": { "start": { - "line": 137, + "line": 201, "column": 28 }, "end": { - "line": 137, + "line": 201, "column": 31 } } @@ -17489,15 +28796,15 @@ "postfix": false, "binop": null }, - "start": 3748, - "end": 3749, + "start": 5527, + "end": 5528, "loc": { "start": { - "line": 137, + "line": 201, "column": 31 }, "end": { - "line": 137, + "line": 201, "column": 32 } } @@ -17515,15 +28822,15 @@ "binop": null, "updateContext": null }, - "start": 3749, - "end": 3750, + "start": 5528, + "end": 5529, "loc": { "start": { - "line": 137, + "line": 201, "column": 32 }, "end": { - "line": 137, + "line": 201, "column": 33 } } @@ -17543,15 +28850,15 @@ "updateContext": null }, "value": "if", - "start": 3753, - "end": 3755, + "start": 5532, + "end": 5534, "loc": { "start": { - "line": 138, + "line": 202, "column": 2 }, "end": { - "line": 138, + "line": 202, "column": 4 } } @@ -17568,15 +28875,15 @@ "postfix": false, "binop": null }, - "start": 3756, - "end": 3757, + "start": 5535, + "end": 5536, "loc": { "start": { - "line": 138, + "line": 202, "column": 5 }, "end": { - "line": 138, + "line": 202, "column": 6 } } @@ -17594,15 +28901,15 @@ "binop": null }, "value": "node", - "start": 3757, - "end": 3761, + "start": 5536, + "end": 5540, "loc": { "start": { - "line": 138, + "line": 202, "column": 6 }, "end": { - "line": 138, + "line": 202, "column": 10 } } @@ -17621,15 +28928,15 @@ "updateContext": null }, "value": "===", - "start": 3762, - "end": 3765, + "start": 5541, + "end": 5544, "loc": { "start": { - "line": 138, + "line": 202, "column": 11 }, "end": { - "line": 138, + "line": 202, "column": 14 } } @@ -17649,15 +28956,15 @@ "updateContext": null }, "value": "null", - "start": 3766, - "end": 3770, + "start": 5545, + "end": 5549, "loc": { "start": { - "line": 138, + "line": 202, "column": 15 }, "end": { - "line": 138, + "line": 202, "column": 19 } } @@ -17674,15 +28981,15 @@ "postfix": false, "binop": null }, - "start": 3770, - "end": 3771, + "start": 5549, + "end": 5550, "loc": { "start": { - "line": 138, + "line": 202, "column": 19 }, "end": { - "line": 138, + "line": 202, "column": 20 } } @@ -17702,15 +29009,15 @@ "updateContext": null }, "value": "return", - "start": 3772, - "end": 3778, + "start": 5551, + "end": 5557, "loc": { "start": { - "line": 138, + "line": 202, "column": 21 }, "end": { - "line": 138, + "line": 202, "column": 27 } } @@ -17730,15 +29037,15 @@ "updateContext": null }, "value": "false", - "start": 3779, - "end": 3784, + "start": 5558, + "end": 5563, "loc": { "start": { - "line": 138, + "line": 202, "column": 28 }, "end": { - "line": 138, + "line": 202, "column": 33 } } @@ -17756,15 +29063,15 @@ "binop": null, "updateContext": null }, - "start": 3784, - "end": 3785, + "start": 5563, + "end": 5564, "loc": { "start": { - "line": 138, + "line": 202, "column": 33 }, "end": { - "line": 138, + "line": 202, "column": 34 } } @@ -17784,15 +29091,15 @@ "updateContext": null }, "value": "this", - "start": 3789, - "end": 3793, + "start": 5568, + "end": 5572, "loc": { "start": { - "line": 140, + "line": 204, "column": 2 }, "end": { - "line": 140, + "line": 204, "column": 6 } } @@ -17810,15 +29117,15 @@ "binop": null, "updateContext": null }, - "start": 3793, - "end": 3794, + "start": 5572, + "end": 5573, "loc": { "start": { - "line": 140, + "line": 204, "column": 6 }, "end": { - "line": 140, + "line": 204, "column": 7 } } @@ -17835,17 +29142,17 @@ "postfix": false, "binop": null }, - "value": "_delete", - "start": 3794, - "end": 3801, + "value": "unlink", + "start": 5573, + "end": 5579, "loc": { "start": { - "line": 140, + "line": 204, "column": 7 }, "end": { - "line": 140, - "column": 14 + "line": 204, + "column": 13 } } }, @@ -17861,16 +29168,16 @@ "postfix": false, "binop": null }, - "start": 3801, - "end": 3802, + "start": 5579, + "end": 5580, "loc": { "start": { - "line": 140, - "column": 14 + "line": 204, + "column": 13 }, "end": { - "line": 140, - "column": 15 + "line": 204, + "column": 14 } } }, @@ -17887,16 +29194,16 @@ "binop": null }, "value": "node", - "start": 3802, - "end": 3806, + "start": 5580, + "end": 5584, "loc": { "start": { - "line": 140, - "column": 15 + "line": 204, + "column": 14 }, "end": { - "line": 140, - "column": 19 + "line": 204, + "column": 18 } } }, @@ -17912,16 +29219,16 @@ "postfix": false, "binop": null }, - "start": 3806, - "end": 3807, + "start": 5584, + "end": 5585, "loc": { "start": { - "line": 140, - "column": 19 + "line": 204, + "column": 18 }, "end": { - "line": 140, - "column": 20 + "line": 204, + "column": 19 } } }, @@ -17938,16 +29245,16 @@ "binop": null, "updateContext": null }, - "start": 3807, - "end": 3808, + "start": 5585, + "end": 5586, "loc": { "start": { - "line": 140, - "column": 20 + "line": 204, + "column": 19 }, "end": { - "line": 140, - "column": 21 + "line": 204, + "column": 20 } } }, @@ -17966,15 +29273,15 @@ "updateContext": null }, "value": "return", - "start": 3811, - "end": 3817, + "start": 5589, + "end": 5595, "loc": { "start": { - "line": 141, + "line": 205, "column": 2 }, "end": { - "line": 141, + "line": 205, "column": 8 } } @@ -17994,15 +29301,15 @@ "updateContext": null }, "value": "true", - "start": 3818, - "end": 3822, + "start": 5596, + "end": 5600, "loc": { "start": { - "line": 141, + "line": 205, "column": 9 }, "end": { - "line": 141, + "line": 205, "column": 13 } } @@ -18020,15 +29327,15 @@ "binop": null, "updateContext": null }, - "start": 3822, - "end": 3823, + "start": 5600, + "end": 5601, "loc": { "start": { - "line": 141, + "line": 205, "column": 13 }, "end": { - "line": 141, + "line": 205, "column": 14 } } @@ -18045,15 +29352,15 @@ "postfix": false, "binop": null }, - "start": 3825, - "end": 3826, + "start": 5603, + "end": 5604, "loc": { "start": { - "line": 142, + "line": 206, "column": 1 }, "end": { - "line": 142, + "line": 206, "column": 2 } } @@ -18061,15 +29368,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t ", - "start": 3829, - "end": 4086, + "start": 5607, + "end": 5864, "loc": { "start": { - "line": 144, + "line": 208, "column": 1 }, "end": { - "line": 150, + "line": 214, "column": 4 } } @@ -18088,15 +29395,15 @@ "updateContext": null }, "value": "*", - "start": 4088, - "end": 4089, + "start": 5866, + "end": 5867, "loc": { "start": { - "line": 151, + "line": 215, "column": 1 }, "end": { - "line": 151, + "line": 215, "column": 2 } } @@ -18114,15 +29421,15 @@ "binop": null }, "value": "range", - "start": 4089, - "end": 4094, + "start": 5867, + "end": 5872, "loc": { "start": { - "line": 151, + "line": 215, "column": 2 }, "end": { - "line": 151, + "line": 215, "column": 7 } } @@ -18139,15 +29446,15 @@ "postfix": false, "binop": null }, - "start": 4094, - "end": 4095, + "start": 5872, + "end": 5873, "loc": { "start": { - "line": 151, + "line": 215, "column": 7 }, "end": { - "line": 151, + "line": 215, "column": 8 } } @@ -18165,15 +29472,15 @@ "binop": null }, "value": "left", - "start": 4095, - "end": 4099, + "start": 5873, + "end": 5877, "loc": { "start": { - "line": 151, + "line": 215, "column": 8 }, "end": { - "line": 151, + "line": 215, "column": 12 } } @@ -18191,15 +29498,15 @@ "binop": null, "updateContext": null }, - "start": 4099, - "end": 4100, + "start": 5877, + "end": 5878, "loc": { "start": { - "line": 151, + "line": 215, "column": 12 }, "end": { - "line": 151, + "line": 215, "column": 13 } } @@ -18217,15 +29524,15 @@ "binop": null }, "value": "right", - "start": 4101, - "end": 4106, + "start": 5879, + "end": 5884, "loc": { "start": { - "line": 151, + "line": 215, "column": 14 }, "end": { - "line": 151, + "line": 215, "column": 19 } } @@ -18242,15 +29549,15 @@ "postfix": false, "binop": null }, - "start": 4106, - "end": 4107, + "start": 5884, + "end": 5885, "loc": { "start": { - "line": 151, + "line": 215, "column": 19 }, "end": { - "line": 151, + "line": 215, "column": 20 } } @@ -18267,15 +29574,15 @@ "postfix": false, "binop": null }, - "start": 4108, - "end": 4109, + "start": 5886, + "end": 5887, "loc": { "start": { - "line": 151, + "line": 215, "column": 21 }, "end": { - "line": 151, + "line": 215, "column": 22 } } @@ -18295,15 +29602,15 @@ "updateContext": null }, "value": "if", - "start": 4112, - "end": 4114, + "start": 5890, + "end": 5892, "loc": { "start": { - "line": 152, + "line": 216, "column": 2 }, "end": { - "line": 152, + "line": 216, "column": 4 } } @@ -18320,15 +29627,15 @@ "postfix": false, "binop": null }, - "start": 4115, - "end": 4116, + "start": 5893, + "end": 5894, "loc": { "start": { - "line": 152, + "line": 216, "column": 5 }, "end": { - "line": 152, + "line": 216, "column": 6 } } @@ -18348,15 +29655,15 @@ "updateContext": null }, "value": "this", - "start": 4116, - "end": 4120, + "start": 5894, + "end": 5898, "loc": { "start": { - "line": 152, + "line": 216, "column": 6 }, "end": { - "line": 152, + "line": 216, "column": 10 } } @@ -18374,15 +29681,15 @@ "binop": null, "updateContext": null }, - "start": 4120, - "end": 4121, + "start": 5898, + "end": 5899, "loc": { "start": { - "line": 152, + "line": 216, "column": 10 }, "end": { - "line": 152, + "line": 216, "column": 11 } } @@ -18400,15 +29707,15 @@ "binop": null }, "value": "root", - "start": 4121, - "end": 4125, + "start": 5899, + "end": 5903, "loc": { "start": { - "line": 152, + "line": 216, "column": 11 }, "end": { - "line": 152, + "line": 216, "column": 15 } } @@ -18427,15 +29734,15 @@ "updateContext": null }, "value": "!==", - "start": 4126, - "end": 4129, + "start": 5904, + "end": 5907, "loc": { "start": { - "line": 152, + "line": 216, "column": 16 }, "end": { - "line": 152, + "line": 216, "column": 19 } } @@ -18455,15 +29762,15 @@ "updateContext": null }, "value": "null", - "start": 4130, - "end": 4134, + "start": 5908, + "end": 5912, "loc": { "start": { - "line": 152, + "line": 216, "column": 20 }, "end": { - "line": 152, + "line": 216, "column": 24 } } @@ -18480,15 +29787,15 @@ "postfix": false, "binop": null }, - "start": 4134, - "end": 4135, + "start": 5912, + "end": 5913, "loc": { "start": { - "line": 152, + "line": 216, "column": 24 }, "end": { - "line": 152, + "line": 216, "column": 25 } } @@ -18508,15 +29815,15 @@ "updateContext": null }, "value": "yield", - "start": 4139, - "end": 4144, + "start": 5917, + "end": 5922, "loc": { "start": { - "line": 153, + "line": 217, "column": 3 }, "end": { - "line": 153, + "line": 217, "column": 8 } } @@ -18535,15 +29842,15 @@ "updateContext": null }, "value": "*", - "start": 4144, - "end": 4145, + "start": 5922, + "end": 5923, "loc": { "start": { - "line": 153, + "line": 217, "column": 8 }, "end": { - "line": 153, + "line": 217, "column": 9 } } @@ -18561,15 +29868,15 @@ "binop": null }, "value": "rangetraversal", - "start": 4146, - "end": 4160, + "start": 5924, + "end": 5938, "loc": { "start": { - "line": 153, + "line": 217, "column": 10 }, "end": { - "line": 153, + "line": 217, "column": 24 } } @@ -18586,15 +29893,15 @@ "postfix": false, "binop": null }, - "start": 4160, - "end": 4161, + "start": 5938, + "end": 5939, "loc": { "start": { - "line": 153, + "line": 217, "column": 24 }, "end": { - "line": 153, + "line": 217, "column": 25 } } @@ -18614,15 +29921,15 @@ "updateContext": null }, "value": "this", - "start": 4161, - "end": 4165, + "start": 5939, + "end": 5943, "loc": { "start": { - "line": 153, + "line": 217, "column": 25 }, "end": { - "line": 153, + "line": 217, "column": 29 } } @@ -18640,15 +29947,15 @@ "binop": null, "updateContext": null }, - "start": 4165, - "end": 4166, + "start": 5943, + "end": 5944, "loc": { "start": { - "line": 153, + "line": 217, "column": 29 }, "end": { - "line": 153, + "line": 217, "column": 30 } } @@ -18666,15 +29973,15 @@ "binop": null }, "value": "compare", - "start": 4166, - "end": 4173, + "start": 5944, + "end": 5951, "loc": { "start": { - "line": 153, + "line": 217, "column": 30 }, "end": { - "line": 153, + "line": 217, "column": 37 } } @@ -18692,15 +29999,15 @@ "binop": null, "updateContext": null }, - "start": 4173, - "end": 4174, + "start": 5951, + "end": 5952, "loc": { "start": { - "line": 153, + "line": 217, "column": 37 }, "end": { - "line": 153, + "line": 217, "column": 38 } } @@ -18720,15 +30027,15 @@ "updateContext": null }, "value": "this", - "start": 4175, - "end": 4179, + "start": 5953, + "end": 5957, "loc": { "start": { - "line": 153, + "line": 217, "column": 39 }, "end": { - "line": 153, + "line": 217, "column": 43 } } @@ -18746,15 +30053,15 @@ "binop": null, "updateContext": null }, - "start": 4179, - "end": 4180, + "start": 5957, + "end": 5958, "loc": { "start": { - "line": 153, + "line": 217, "column": 43 }, "end": { - "line": 153, + "line": 217, "column": 44 } } @@ -18772,15 +30079,15 @@ "binop": null }, "value": "root", - "start": 4180, - "end": 4184, + "start": 5958, + "end": 5962, "loc": { "start": { - "line": 153, + "line": 217, "column": 44 }, "end": { - "line": 153, + "line": 217, "column": 48 } } @@ -18798,15 +30105,15 @@ "binop": null, "updateContext": null }, - "start": 4184, - "end": 4185, + "start": 5962, + "end": 5963, "loc": { "start": { - "line": 153, + "line": 217, "column": 48 }, "end": { - "line": 153, + "line": 217, "column": 49 } } @@ -18824,15 +30131,15 @@ "binop": null }, "value": "left", - "start": 4186, - "end": 4190, + "start": 5964, + "end": 5968, "loc": { "start": { - "line": 153, + "line": 217, "column": 50 }, "end": { - "line": 153, + "line": 217, "column": 54 } } @@ -18850,15 +30157,15 @@ "binop": null, "updateContext": null }, - "start": 4190, - "end": 4191, + "start": 5968, + "end": 5969, "loc": { "start": { - "line": 153, + "line": 217, "column": 54 }, "end": { - "line": 153, + "line": 217, "column": 55 } } @@ -18876,15 +30183,15 @@ "binop": null }, "value": "right", - "start": 4192, - "end": 4197, + "start": 5970, + "end": 5975, "loc": { "start": { - "line": 153, + "line": 217, "column": 56 }, "end": { - "line": 153, + "line": 217, "column": 61 } } @@ -18901,15 +30208,15 @@ "postfix": false, "binop": null }, - "start": 4197, - "end": 4198, + "start": 5975, + "end": 5976, "loc": { "start": { - "line": 153, + "line": 217, "column": 61 }, "end": { - "line": 153, + "line": 217, "column": 62 } } @@ -18927,15 +30234,15 @@ "binop": null, "updateContext": null }, - "start": 4198, - "end": 4199, + "start": 5976, + "end": 5977, "loc": { "start": { - "line": 153, + "line": 217, "column": 62 }, "end": { - "line": 153, + "line": 217, "column": 63 } } @@ -18952,15 +30259,15 @@ "postfix": false, "binop": null }, - "start": 4201, - "end": 4202, + "start": 5979, + "end": 5980, "loc": { "start": { - "line": 154, + "line": 218, "column": 1 }, "end": { - "line": 154, + "line": 218, "column": 2 } } @@ -18968,15 +30275,15 @@ { "type": "CommentBlock", "value": "*\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t ", - "start": 4205, - "end": 4309, + "start": 5983, + "end": 6087, "loc": { "start": { - "line": 156, + "line": 220, "column": 1 }, "end": { - "line": 160, + "line": 224, "column": 4 } } @@ -18995,15 +30302,15 @@ "updateContext": null }, "value": "*", - "start": 4311, - "end": 4312, + "start": 6089, + "end": 6090, "loc": { "start": { - "line": 161, + "line": 225, "column": 1 }, "end": { - "line": 161, + "line": 225, "column": 2 } } @@ -19021,15 +30328,15 @@ "binop": null }, "value": "items", - "start": 4312, - "end": 4317, + "start": 6090, + "end": 6095, "loc": { "start": { - "line": 161, + "line": 225, "column": 2 }, "end": { - "line": 161, + "line": 225, "column": 7 } } @@ -19046,15 +30353,15 @@ "postfix": false, "binop": null }, - "start": 4317, - "end": 4318, + "start": 6095, + "end": 6096, "loc": { "start": { - "line": 161, + "line": 225, "column": 7 }, "end": { - "line": 161, + "line": 225, "column": 8 } } @@ -19071,15 +30378,15 @@ "postfix": false, "binop": null }, - "start": 4318, - "end": 4319, + "start": 6096, + "end": 6097, "loc": { "start": { - "line": 161, + "line": 225, "column": 8 }, "end": { - "line": 161, + "line": 225, "column": 9 } } @@ -19096,15 +30403,15 @@ "postfix": false, "binop": null }, - "start": 4320, - "end": 4321, + "start": 6098, + "end": 6099, "loc": { "start": { - "line": 161, + "line": 225, "column": 10 }, "end": { - "line": 161, + "line": 225, "column": 11 } } @@ -19124,15 +30431,15 @@ "updateContext": null }, "value": "if", - "start": 4324, - "end": 4326, + "start": 6102, + "end": 6104, "loc": { "start": { - "line": 162, + "line": 226, "column": 2 }, "end": { - "line": 162, + "line": 226, "column": 4 } } @@ -19149,15 +30456,15 @@ "postfix": false, "binop": null }, - "start": 4327, - "end": 4328, + "start": 6105, + "end": 6106, "loc": { "start": { - "line": 162, + "line": 226, "column": 5 }, "end": { - "line": 162, + "line": 226, "column": 6 } } @@ -19177,15 +30484,15 @@ "updateContext": null }, "value": "this", - "start": 4328, - "end": 4332, + "start": 6106, + "end": 6110, "loc": { "start": { - "line": 162, + "line": 226, "column": 6 }, "end": { - "line": 162, + "line": 226, "column": 10 } } @@ -19203,15 +30510,15 @@ "binop": null, "updateContext": null }, - "start": 4332, - "end": 4333, + "start": 6110, + "end": 6111, "loc": { "start": { - "line": 162, + "line": 226, "column": 10 }, "end": { - "line": 162, + "line": 226, "column": 11 } } @@ -19229,15 +30536,15 @@ "binop": null }, "value": "root", - "start": 4333, - "end": 4337, + "start": 6111, + "end": 6115, "loc": { "start": { - "line": 162, + "line": 226, "column": 11 }, "end": { - "line": 162, + "line": 226, "column": 15 } } @@ -19256,15 +30563,15 @@ "updateContext": null }, "value": "!==", - "start": 4338, - "end": 4341, + "start": 6116, + "end": 6119, "loc": { "start": { - "line": 162, + "line": 226, "column": 16 }, "end": { - "line": 162, + "line": 226, "column": 19 } } @@ -19284,15 +30591,15 @@ "updateContext": null }, "value": "null", - "start": 4342, - "end": 4346, + "start": 6120, + "end": 6124, "loc": { "start": { - "line": 162, + "line": 226, "column": 20 }, "end": { - "line": 162, + "line": 226, "column": 24 } } @@ -19309,15 +30616,15 @@ "postfix": false, "binop": null }, - "start": 4346, - "end": 4347, + "start": 6124, + "end": 6125, "loc": { "start": { - "line": 162, + "line": 226, "column": 24 }, "end": { - "line": 162, + "line": 226, "column": 25 } } @@ -19337,15 +30644,15 @@ "updateContext": null }, "value": "yield", - "start": 4348, - "end": 4353, + "start": 6126, + "end": 6131, "loc": { "start": { - "line": 162, + "line": 226, "column": 26 }, "end": { - "line": 162, + "line": 226, "column": 31 } } @@ -19364,15 +30671,15 @@ "updateContext": null }, "value": "*", - "start": 4353, - "end": 4354, + "start": 6131, + "end": 6132, "loc": { "start": { - "line": 162, + "line": 226, "column": 31 }, "end": { - "line": 162, + "line": 226, "column": 32 } } @@ -19390,15 +30697,15 @@ "binop": null }, "value": "inordertraversal", - "start": 4355, - "end": 4371, + "start": 6133, + "end": 6149, "loc": { "start": { - "line": 162, + "line": 226, "column": 33 }, "end": { - "line": 162, + "line": 226, "column": 49 } } @@ -19415,15 +30722,15 @@ "postfix": false, "binop": null }, - "start": 4371, - "end": 4372, + "start": 6149, + "end": 6150, "loc": { "start": { - "line": 162, + "line": 226, "column": 49 }, "end": { - "line": 162, + "line": 226, "column": 50 } } @@ -19443,15 +30750,15 @@ "updateContext": null }, "value": "this", - "start": 4372, - "end": 4376, + "start": 6150, + "end": 6154, "loc": { "start": { - "line": 162, + "line": 226, "column": 50 }, "end": { - "line": 162, + "line": 226, "column": 54 } } @@ -19469,15 +30776,15 @@ "binop": null, "updateContext": null }, - "start": 4376, - "end": 4377, + "start": 6154, + "end": 6155, "loc": { "start": { - "line": 162, + "line": 226, "column": 54 }, "end": { - "line": 162, + "line": 226, "column": 55 } } @@ -19495,15 +30802,15 @@ "binop": null }, "value": "root", - "start": 4377, - "end": 4381, + "start": 6155, + "end": 6159, "loc": { "start": { - "line": 162, + "line": 226, "column": 55 }, "end": { - "line": 162, + "line": 226, "column": 59 } } @@ -19520,15 +30827,15 @@ "postfix": false, "binop": null }, - "start": 4381, - "end": 4382, + "start": 6159, + "end": 6160, "loc": { "start": { - "line": 162, + "line": 226, "column": 59 }, "end": { - "line": 162, + "line": 226, "column": 60 } } @@ -19546,15 +30853,15 @@ "binop": null, "updateContext": null }, - "start": 4382, - "end": 4383, + "start": 6160, + "end": 6161, "loc": { "start": { - "line": 162, + "line": 226, "column": 60 }, "end": { - "line": 162, + "line": 226, "column": 61 } } @@ -19571,15 +30878,15 @@ "postfix": false, "binop": null }, - "start": 4385, - "end": 4386, + "start": 6163, + "end": 6164, "loc": { "start": { - "line": 163, + "line": 227, "column": 1 }, "end": { - "line": 163, + "line": 227, "column": 2 } } @@ -19587,15 +30894,15 @@ { "type": "CommentBlock", "value": "*\n\t * Same as {@link RedBlackTree#items}.\n\t ", - "start": 4389, - "end": 4437, + "start": 6167, + "end": 6215, "loc": { "start": { - "line": 165, + "line": 229, "column": 1 }, "end": { - "line": 167, + "line": 231, "column": 4 } } @@ -19613,15 +30920,15 @@ "binop": null, "updateContext": null }, - "start": 4439, - "end": 4440, + "start": 6217, + "end": 6218, "loc": { "start": { - "line": 168, + "line": 232, "column": 1 }, "end": { - "line": 168, + "line": 232, "column": 2 } } @@ -19639,15 +30946,15 @@ "binop": null }, "value": "Symbol", - "start": 4440, - "end": 4446, + "start": 6218, + "end": 6224, "loc": { "start": { - "line": 168, + "line": 232, "column": 2 }, "end": { - "line": 168, + "line": 232, "column": 8 } } @@ -19665,15 +30972,15 @@ "binop": null, "updateContext": null }, - "start": 4446, - "end": 4447, + "start": 6224, + "end": 6225, "loc": { "start": { - "line": 168, + "line": 232, "column": 8 }, "end": { - "line": 168, + "line": 232, "column": 9 } } @@ -19691,15 +30998,15 @@ "binop": null }, "value": "iterator", - "start": 4447, - "end": 4455, + "start": 6225, + "end": 6233, "loc": { "start": { - "line": 168, + "line": 232, "column": 9 }, "end": { - "line": 168, + "line": 232, "column": 17 } } @@ -19717,15 +31024,15 @@ "binop": null, "updateContext": null }, - "start": 4455, - "end": 4456, + "start": 6233, + "end": 6234, "loc": { "start": { - "line": 168, + "line": 232, "column": 17 }, "end": { - "line": 168, + "line": 232, "column": 18 } } @@ -19742,15 +31049,15 @@ "postfix": false, "binop": null }, - "start": 4456, - "end": 4457, + "start": 6234, + "end": 6235, "loc": { "start": { - "line": 168, + "line": 232, "column": 18 }, "end": { - "line": 168, + "line": 232, "column": 19 } } @@ -19767,15 +31074,15 @@ "postfix": false, "binop": null }, - "start": 4457, - "end": 4458, + "start": 6235, + "end": 6236, "loc": { "start": { - "line": 168, + "line": 232, "column": 19 }, "end": { - "line": 168, + "line": 232, "column": 20 } } @@ -19792,15 +31099,15 @@ "postfix": false, "binop": null }, - "start": 4459, - "end": 4460, + "start": 6237, + "end": 6238, "loc": { "start": { - "line": 168, + "line": 232, "column": 21 }, "end": { - "line": 168, + "line": 232, "column": 22 } } @@ -19820,15 +31127,15 @@ "updateContext": null }, "value": "return", - "start": 4463, - "end": 4469, + "start": 6241, + "end": 6247, "loc": { "start": { - "line": 169, + "line": 233, "column": 2 }, "end": { - "line": 169, + "line": 233, "column": 8 } } @@ -19848,15 +31155,15 @@ "updateContext": null }, "value": "this", - "start": 4470, - "end": 4474, + "start": 6248, + "end": 6252, "loc": { "start": { - "line": 169, + "line": 233, "column": 9 }, "end": { - "line": 169, + "line": 233, "column": 13 } } @@ -19874,15 +31181,15 @@ "binop": null, "updateContext": null }, - "start": 4474, - "end": 4475, + "start": 6252, + "end": 6253, "loc": { "start": { - "line": 169, + "line": 233, "column": 13 }, "end": { - "line": 169, + "line": 233, "column": 14 } } @@ -19900,15 +31207,15 @@ "binop": null }, "value": "items", - "start": 4475, - "end": 4480, + "start": 6253, + "end": 6258, "loc": { "start": { - "line": 169, + "line": 233, "column": 14 }, "end": { - "line": 169, + "line": 233, "column": 19 } } @@ -19925,15 +31232,15 @@ "postfix": false, "binop": null }, - "start": 4480, - "end": 4481, + "start": 6258, + "end": 6259, "loc": { "start": { - "line": 169, + "line": 233, "column": 19 }, "end": { - "line": 169, + "line": 233, "column": 20 } } @@ -19950,15 +31257,15 @@ "postfix": false, "binop": null }, - "start": 4481, - "end": 4482, + "start": 6259, + "end": 6260, "loc": { "start": { - "line": 169, + "line": 233, "column": 20 }, "end": { - "line": 169, + "line": 233, "column": 21 } } @@ -19976,15 +31283,15 @@ "binop": null, "updateContext": null }, - "start": 4482, - "end": 4483, + "start": 6260, + "end": 6261, "loc": { "start": { - "line": 169, + "line": 233, "column": 21 }, "end": { - "line": 169, + "line": 233, "column": 22 } } @@ -20001,15 +31308,15 @@ "postfix": false, "binop": null }, - "start": 4485, - "end": 4486, + "start": 6263, + "end": 6264, "loc": { "start": { - "line": 170, + "line": 234, "column": 1 }, "end": { - "line": 170, + "line": 234, "column": 2 } } @@ -20017,15 +31324,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4489, - "end": 4633, + "start": 6267, + "end": 6411, "loc": { "start": { - "line": 172, + "line": 236, "column": 1 }, "end": { - "line": 177, + "line": 241, "column": 4 } } @@ -20043,15 +31350,15 @@ "binop": null }, "value": "static", - "start": 4635, - "end": 4641, + "start": 6413, + "end": 6419, "loc": { "start": { - "line": 178, + "line": 242, "column": 1 }, "end": { - "line": 178, + "line": 242, "column": 7 } } @@ -20069,15 +31376,15 @@ "binop": null }, "value": "empty", - "start": 4642, - "end": 4647, + "start": 6420, + "end": 6425, "loc": { "start": { - "line": 178, + "line": 242, "column": 8 }, "end": { - "line": 178, + "line": 242, "column": 13 } } @@ -20094,15 +31401,15 @@ "postfix": false, "binop": null }, - "start": 4647, - "end": 4648, + "start": 6425, + "end": 6426, "loc": { "start": { - "line": 178, + "line": 242, "column": 13 }, "end": { - "line": 178, + "line": 242, "column": 14 } } @@ -20120,15 +31427,15 @@ "binop": null }, "value": "compare", - "start": 4648, - "end": 4655, + "start": 6426, + "end": 6433, "loc": { "start": { - "line": 178, + "line": 242, "column": 14 }, "end": { - "line": 178, + "line": 242, "column": 21 } } @@ -20145,15 +31452,15 @@ "postfix": false, "binop": null }, - "start": 4655, - "end": 4656, + "start": 6433, + "end": 6434, "loc": { "start": { - "line": 178, + "line": 242, "column": 21 }, "end": { - "line": 178, + "line": 242, "column": 22 } } @@ -20170,15 +31477,15 @@ "postfix": false, "binop": null }, - "start": 4657, - "end": 4658, + "start": 6435, + "end": 6436, "loc": { "start": { - "line": 178, + "line": 242, "column": 23 }, "end": { - "line": 178, + "line": 242, "column": 24 } } @@ -20198,15 +31505,15 @@ "updateContext": null }, "value": "return", - "start": 4661, - "end": 4667, + "start": 6439, + "end": 6445, "loc": { "start": { - "line": 179, + "line": 243, "column": 2 }, "end": { - "line": 179, + "line": 243, "column": 8 } } @@ -20226,15 +31533,15 @@ "updateContext": null }, "value": "new", - "start": 4668, - "end": 4671, + "start": 6446, + "end": 6449, "loc": { "start": { - "line": 179, + "line": 243, "column": 9 }, "end": { - "line": 179, + "line": 243, "column": 12 } } @@ -20252,15 +31559,15 @@ "binop": null }, "value": "RedBlackTree", - "start": 4672, - "end": 4684, + "start": 6450, + "end": 6462, "loc": { "start": { - "line": 179, + "line": 243, "column": 13 }, "end": { - "line": 179, + "line": 243, "column": 25 } } @@ -20277,15 +31584,15 @@ "postfix": false, "binop": null }, - "start": 4684, - "end": 4685, + "start": 6462, + "end": 6463, "loc": { "start": { - "line": 179, + "line": 243, "column": 25 }, "end": { - "line": 179, + "line": 243, "column": 26 } } @@ -20303,15 +31610,15 @@ "binop": null }, "value": "compare", - "start": 4685, - "end": 4692, + "start": 6463, + "end": 6470, "loc": { "start": { - "line": 179, + "line": 243, "column": 26 }, "end": { - "line": 179, + "line": 243, "column": 33 } } @@ -20328,15 +31635,15 @@ "postfix": false, "binop": null }, - "start": 4692, - "end": 4693, + "start": 6470, + "end": 6471, "loc": { "start": { - "line": 179, + "line": 243, "column": 33 }, "end": { - "line": 179, + "line": 243, "column": 34 } } @@ -20354,15 +31661,15 @@ "binop": null, "updateContext": null }, - "start": 4693, - "end": 4694, + "start": 6471, + "end": 6472, "loc": { "start": { - "line": 179, + "line": 243, "column": 34 }, "end": { - "line": 179, + "line": 243, "column": 35 } } @@ -20379,15 +31686,15 @@ "postfix": false, "binop": null }, - "start": 4696, - "end": 4697, + "start": 6474, + "end": 6475, "loc": { "start": { - "line": 180, + "line": 244, "column": 1 }, "end": { - "line": 180, + "line": 244, "column": 2 } } @@ -20395,15 +31702,15 @@ { "type": "CommentBlock", "value": "*\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t ", - "start": 4700, - "end": 4913, + "start": 6478, + "end": 6691, "loc": { "start": { - "line": 182, + "line": 246, "column": 1 }, "end": { - "line": 188, + "line": 252, "column": 4 } } @@ -20421,15 +31728,15 @@ "binop": null }, "value": "static", - "start": 4915, - "end": 4921, + "start": 6693, + "end": 6699, "loc": { "start": { - "line": 189, + "line": 253, "column": 1 }, "end": { - "line": 189, + "line": 253, "column": 7 } } @@ -20447,15 +31754,15 @@ "binop": null }, "value": "from", - "start": 4922, - "end": 4926, + "start": 6700, + "end": 6704, "loc": { "start": { - "line": 189, + "line": 253, "column": 8 }, "end": { - "line": 189, + "line": 253, "column": 12 } } @@ -20472,15 +31779,15 @@ "postfix": false, "binop": null }, - "start": 4926, - "end": 4927, + "start": 6704, + "end": 6705, "loc": { "start": { - "line": 189, + "line": 253, "column": 12 }, "end": { - "line": 189, + "line": 253, "column": 13 } } @@ -20498,15 +31805,15 @@ "binop": null }, "value": "compare", - "start": 4927, - "end": 4934, + "start": 6705, + "end": 6712, "loc": { "start": { - "line": 189, + "line": 253, "column": 13 }, "end": { - "line": 189, + "line": 253, "column": 20 } } @@ -20524,15 +31831,15 @@ "binop": null, "updateContext": null }, - "start": 4934, - "end": 4935, + "start": 6712, + "end": 6713, "loc": { "start": { - "line": 189, + "line": 253, "column": 20 }, "end": { - "line": 189, + "line": 253, "column": 21 } } @@ -20550,15 +31857,15 @@ "binop": null }, "value": "iterable", - "start": 4936, - "end": 4944, + "start": 6714, + "end": 6722, "loc": { "start": { - "line": 189, + "line": 253, "column": 22 }, "end": { - "line": 189, + "line": 253, "column": 30 } } @@ -20575,15 +31882,15 @@ "postfix": false, "binop": null }, - "start": 4944, - "end": 4945, + "start": 6722, + "end": 6723, "loc": { "start": { - "line": 189, + "line": 253, "column": 30 }, "end": { - "line": 189, + "line": 253, "column": 31 } } @@ -20600,15 +31907,15 @@ "postfix": false, "binop": null }, - "start": 4946, - "end": 4947, + "start": 6724, + "end": 6725, "loc": { "start": { - "line": 189, + "line": 253, "column": 32 }, "end": { - "line": 189, + "line": 253, "column": 33 } } @@ -20628,15 +31935,15 @@ "updateContext": null }, "value": "const", - "start": 4950, - "end": 4955, + "start": 6728, + "end": 6733, "loc": { "start": { - "line": 190, + "line": 254, "column": 2 }, "end": { - "line": 190, + "line": 254, "column": 7 } } @@ -20654,15 +31961,15 @@ "binop": null }, "value": "tree", - "start": 4956, - "end": 4960, + "start": 6734, + "end": 6738, "loc": { "start": { - "line": 190, + "line": 254, "column": 8 }, "end": { - "line": 190, + "line": 254, "column": 12 } } @@ -20681,15 +31988,15 @@ "updateContext": null }, "value": "=", - "start": 4961, - "end": 4962, + "start": 6739, + "end": 6740, "loc": { "start": { - "line": 190, + "line": 254, "column": 13 }, "end": { - "line": 190, + "line": 254, "column": 14 } } @@ -20709,15 +32016,15 @@ "updateContext": null }, "value": "new", - "start": 4963, - "end": 4966, + "start": 6741, + "end": 6744, "loc": { "start": { - "line": 190, + "line": 254, "column": 15 }, "end": { - "line": 190, + "line": 254, "column": 18 } } @@ -20735,15 +32042,15 @@ "binop": null }, "value": "RedBlackTree", - "start": 4967, - "end": 4979, + "start": 6745, + "end": 6757, "loc": { "start": { - "line": 190, + "line": 254, "column": 19 }, "end": { - "line": 190, + "line": 254, "column": 31 } } @@ -20760,15 +32067,15 @@ "postfix": false, "binop": null }, - "start": 4979, - "end": 4980, + "start": 6757, + "end": 6758, "loc": { "start": { - "line": 190, + "line": 254, "column": 31 }, "end": { - "line": 190, + "line": 254, "column": 32 } } @@ -20786,15 +32093,15 @@ "binop": null }, "value": "compare", - "start": 4980, - "end": 4987, + "start": 6758, + "end": 6765, "loc": { "start": { - "line": 190, + "line": 254, "column": 32 }, "end": { - "line": 190, + "line": 254, "column": 39 } } @@ -20811,15 +32118,15 @@ "postfix": false, "binop": null }, - "start": 4987, - "end": 4988, + "start": 6765, + "end": 6766, "loc": { "start": { - "line": 190, + "line": 254, "column": 39 }, "end": { - "line": 190, + "line": 254, "column": 40 } } @@ -20837,15 +32144,15 @@ "binop": null, "updateContext": null }, - "start": 4988, - "end": 4989, + "start": 6766, + "end": 6767, "loc": { "start": { - "line": 190, + "line": 254, "column": 40 }, "end": { - "line": 190, + "line": 254, "column": 41 } } @@ -20865,15 +32172,15 @@ "updateContext": null }, "value": "for", - "start": 4993, - "end": 4996, + "start": 6771, + "end": 6774, "loc": { "start": { - "line": 192, + "line": 256, "column": 2 }, "end": { - "line": 192, + "line": 256, "column": 5 } } @@ -20890,15 +32197,15 @@ "postfix": false, "binop": null }, - "start": 4997, - "end": 4998, + "start": 6775, + "end": 6776, "loc": { "start": { - "line": 192, + "line": 256, "column": 6 }, "end": { - "line": 192, + "line": 256, "column": 7 } } @@ -20918,15 +32225,15 @@ "updateContext": null }, "value": "const", - "start": 4998, - "end": 5003, + "start": 6776, + "end": 6781, "loc": { "start": { - "line": 192, + "line": 256, "column": 7 }, "end": { - "line": 192, + "line": 256, "column": 12 } } @@ -20944,15 +32251,15 @@ "binop": null }, "value": "element", - "start": 5004, - "end": 5011, + "start": 6782, + "end": 6789, "loc": { "start": { - "line": 192, + "line": 256, "column": 13 }, "end": { - "line": 192, + "line": 256, "column": 20 } } @@ -20970,15 +32277,15 @@ "binop": null }, "value": "of", - "start": 5012, - "end": 5014, + "start": 6790, + "end": 6792, "loc": { "start": { - "line": 192, + "line": 256, "column": 21 }, "end": { - "line": 192, + "line": 256, "column": 23 } } @@ -20996,15 +32303,15 @@ "binop": null }, "value": "iterable", - "start": 5015, - "end": 5023, + "start": 6793, + "end": 6801, "loc": { "start": { - "line": 192, + "line": 256, "column": 24 }, "end": { - "line": 192, + "line": 256, "column": 32 } } @@ -21021,15 +32328,15 @@ "postfix": false, "binop": null }, - "start": 5023, - "end": 5024, + "start": 6801, + "end": 6802, "loc": { "start": { - "line": 192, + "line": 256, "column": 32 }, "end": { - "line": 192, + "line": 256, "column": 33 } } @@ -21047,15 +32354,15 @@ "binop": null }, "value": "tree", - "start": 5025, - "end": 5029, + "start": 6803, + "end": 6807, "loc": { "start": { - "line": 192, + "line": 256, "column": 34 }, "end": { - "line": 192, + "line": 256, "column": 38 } } @@ -21073,15 +32380,15 @@ "binop": null, "updateContext": null }, - "start": 5029, - "end": 5030, + "start": 6807, + "end": 6808, "loc": { "start": { - "line": 192, + "line": 256, "column": 38 }, "end": { - "line": 192, + "line": 256, "column": 39 } } @@ -21099,15 +32406,15 @@ "binop": null }, "value": "add", - "start": 5030, - "end": 5033, + "start": 6808, + "end": 6811, "loc": { "start": { - "line": 192, + "line": 256, "column": 39 }, "end": { - "line": 192, + "line": 256, "column": 42 } } @@ -21124,15 +32431,15 @@ "postfix": false, "binop": null }, - "start": 5033, - "end": 5034, + "start": 6811, + "end": 6812, "loc": { "start": { - "line": 192, + "line": 256, "column": 42 }, "end": { - "line": 192, + "line": 256, "column": 43 } } @@ -21150,15 +32457,15 @@ "binop": null }, "value": "element", - "start": 5034, - "end": 5041, + "start": 6812, + "end": 6819, "loc": { "start": { - "line": 192, + "line": 256, "column": 43 }, "end": { - "line": 192, + "line": 256, "column": 50 } } @@ -21175,15 +32482,15 @@ "postfix": false, "binop": null }, - "start": 5041, - "end": 5042, + "start": 6819, + "end": 6820, "loc": { "start": { - "line": 192, + "line": 256, "column": 50 }, "end": { - "line": 192, + "line": 256, "column": 51 } } @@ -21201,15 +32508,15 @@ "binop": null, "updateContext": null }, - "start": 5042, - "end": 5043, + "start": 6820, + "end": 6821, "loc": { "start": { - "line": 192, + "line": 256, "column": 51 }, "end": { - "line": 192, + "line": 256, "column": 52 } } @@ -21229,15 +32536,15 @@ "updateContext": null }, "value": "return", - "start": 5047, - "end": 5053, + "start": 6825, + "end": 6831, "loc": { "start": { - "line": 194, + "line": 258, "column": 2 }, "end": { - "line": 194, + "line": 258, "column": 8 } } @@ -21255,15 +32562,15 @@ "binop": null }, "value": "tree", - "start": 5054, - "end": 5058, + "start": 6832, + "end": 6836, "loc": { "start": { - "line": 194, + "line": 258, "column": 9 }, "end": { - "line": 194, + "line": 258, "column": 13 } } @@ -21281,15 +32588,15 @@ "binop": null, "updateContext": null }, - "start": 5058, - "end": 5059, + "start": 6836, + "end": 6837, "loc": { "start": { - "line": 194, + "line": 258, "column": 13 }, "end": { - "line": 194, + "line": 258, "column": 14 } } @@ -21306,15 +32613,15 @@ "postfix": false, "binop": null }, - "start": 5061, - "end": 5062, + "start": 6839, + "end": 6840, "loc": { "start": { - "line": 195, + "line": 259, "column": 1 }, "end": { - "line": 195, + "line": 259, "column": 2 } } @@ -21331,15 +32638,15 @@ "postfix": false, "binop": null }, - "start": 5063, - "end": 5064, + "start": 6841, + "end": 6842, "loc": { "start": { - "line": 196, + "line": 260, "column": 0 }, "end": { - "line": 196, + "line": 260, "column": 1 } } @@ -21357,15 +32664,15 @@ "binop": null, "updateContext": null }, - "start": 5065, - "end": 5065, + "start": 6843, + "end": 6843, "loc": { "start": { - "line": 197, + "line": 261, "column": 0 }, "end": { - "line": 197, + "line": 261, "column": 0 } } diff --git a/class/src/types/RedBlackTree.js~RedBlackTree.html b/class/src/types/RedBlackTree.js~RedBlackTree.html index 8524e71..27b5d32 100644 --- a/class/src/types/RedBlackTree.js~RedBlackTree.html +++ b/class/src/types/RedBlackTree.js~RedBlackTree.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -64,13 +69,13 @@
    - + public class - | source + | source
    @@ -315,7 +320,7 @@

    RedBlackTree

    - add(key: any) + add(key: any): Node

    @@ -499,7 +504,7 @@

    RedBlackTree

    Search for the first node of the tree whose key equals the input key (with RedBlackTree#_search), then delete that node -(with RedBlackTree#_delete).

    +(with RedBlackTree#unlink).

    - - - - - + - + +
    Private Methods
    - private + public @@ -528,7 +527,7 @@

    RedBlackTree

    - _delete(node: Node) + unlink(node: Node)

    @@ -543,7 +542,13 @@

    RedBlackTree

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Private Methods
    private @@ -593,7 +598,7 @@

    - source + source

    @@ -666,7 +671,7 @@

    - source + source

    @@ -749,7 +754,7 @@

    - source + source

    @@ -813,7 +818,7 @@

    - source + source

    @@ -856,7 +861,7 @@

    - source + source

    @@ -902,7 +907,7 @@

    - source + source

    @@ -954,11 +959,11 @@

    - add(key: any) + add(key: any): Node - source + source

    @@ -990,7 +995,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The newly added node.

    +
    +
    +
    +
    @@ -1019,7 +1037,7 @@

    - source + source

    @@ -1094,7 +1112,7 @@

    - source + source

    @@ -1168,7 +1186,7 @@

    - source + source

    @@ -1225,7 +1243,7 @@

    - source + source

    @@ -1281,7 +1299,7 @@

    - source + source

    @@ -1362,7 +1380,7 @@

    - source + source

    @@ -1371,7 +1389,7 @@

    Search for the first node of the tree whose key equals the input key (with RedBlackTree#_search), then delete that node -(with RedBlackTree#_delete). If such a node is found and deleted +(with RedBlackTree#unlink). If such a node is found and deleted then return true. Return false otherwise.

    @@ -1427,21 +1445,19 @@

    Return:

    -

    Private Methods

    -
    -

    - private +

    @@ -1490,6 +1506,8 @@

    Params:

    +

    Private Methods

    +
    diff --git a/coverage.json b/coverage.json index 56d3c37..a02c010 100644 --- a/coverage.json +++ b/coverage.json @@ -1,7 +1,7 @@ { "coverage": "100%", - "expectCount": 45, - "actualCount": 45, + "expectCount": 50, + "actualCount": 50, "files": { "src/api/empty.js": { "expectCount": 1, @@ -133,16 +133,41 @@ "actualCount": 1, "undocumentLines": [] }, + "src/swap/swap_color.js": { + "expectCount": 1, + "actualCount": 1, + "undocumentLines": [] + }, + "src/swap/swap_left.js": { + "expectCount": 1, + "actualCount": 1, + "undocumentLines": [] + }, + "src/swap/swap_non_adjacent.js": { + "expectCount": 1, + "actualCount": 1, + "undocumentLines": [] + }, "src/traversal/inordertraversal.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, + "src/traversal/leftOpenRangeTraversal.js": { + "expectCount": 1, + "actualCount": 1, + "undocumentLines": [] + }, "src/traversal/rangetraversal.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, + "src/traversal/rightOpenRangeTraversal.js": { + "expectCount": 1, + "actualCount": 1, + "undocumentLines": [] + }, "src/types/Node.js": { "expectCount": 1, "actualCount": 1, diff --git a/file/src/api/empty.js.html b/file/src/api/empty.js.html index 566c4e0..c6d8c30 100644 --- a/file/src/api/empty.js.html +++ b/file/src/api/empty.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/api/from.js.html b/file/src/api/from.js.html index e1fc5ba..5dcf2e3 100644 --- a/file/src/api/from.js.html +++ b/file/src/api/from.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/color/BLACK.js.html b/file/src/color/BLACK.js.html index 52fc01c..bcb11de 100644 --- a/file/src/color/BLACK.js.html +++ b/file/src/color/BLACK.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/color/RED.js.html b/file/src/color/RED.js.html index c5ed52a..b7827b5 100644 --- a/file/src/color/RED.js.html +++ b/file/src/color/RED.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/debug/_debug.js.html b/file/src/debug/_debug.js.html index 03d352d..bd23be6 100644 --- a/file/src/debug/_debug.js.html +++ b/file/src/debug/_debug.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/deletion/delete_case0.js.html b/file/src/deletion/delete_case0.js.html index bb5e8d6..eb24037 100644 --- a/file/src/deletion/delete_case0.js.html +++ b/file/src/deletion/delete_case0.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -76,6 +81,7 @@ * - all other root-leaf paths have a black height of b * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const delete_case0 = (n) => { assert(n instanceof Node); @@ -83,7 +89,7 @@ // If n is the root, there is nothing to do: // - all paths go through n, and // - n is black. - if (n.parent !== null) delete_case1(n); + return n.parent === null ? n : delete_case1(n); }; export default delete_case0; diff --git a/file/src/deletion/delete_case1.js.html b/file/src/deletion/delete_case1.js.html index 6c78ebf..c4a074f 100644 --- a/file/src/deletion/delete_case1.js.html +++ b/file/src/deletion/delete_case1.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -83,6 +88,7 @@ * - n is not the root * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const delete_case1 = (n) => { assert(n instanceof Node); @@ -94,25 +100,25 @@ if (s._color === BLACK) { // If n's sibling is BLACK, go to case 2. - delete_case2(n); - } else { - /** - * Otherwise, prepare for and go to case 3. - * - * B B - * / \ / \ - * >B R R B - * / \ / \ --> / \ / \ - * - - B B >B B = = - * / \ / \ / \ / \ - * = = = = - - = = - */ - n.parent._color = RED; - s._color = BLACK; - if (n === n.parent.left) rotate_left(n.parent); - else rotate_right(n.parent); - delete_case3(n); + return delete_case2(n); } + + /** + * Otherwise, prepare for and go to case 3. + * + * B *B + * / \ / \ + * >B R R B + * / \ / \ --> / \ / \ + * - - B B >B B = = + * / \ / \ / \ / \ + * = = = = - - = = + */ + n.parent._color = RED; + s._color = BLACK; + if (n === n.parent.left) rotate_left(n.parent); + else rotate_right(n.parent); + return delete_case3(n).parent; }; export default delete_case1; diff --git a/file/src/deletion/delete_case2.js.html b/file/src/deletion/delete_case2.js.html index a92235c..c0558a1 100644 --- a/file/src/deletion/delete_case2.js.html +++ b/file/src/deletion/delete_case2.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -82,6 +87,7 @@ * - n's sibling is black * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const delete_case2 = (n) => { assert(n instanceof Node); @@ -110,11 +116,11 @@ (s.right === null || s.right._color === BLACK) ) { s._color = RED; - delete_case0(n.parent); + return delete_case0(n.parent); } // Otherwise, go to case 3. - else delete_case3(n); + return delete_case3(n); }; export default delete_case2; diff --git a/file/src/deletion/delete_case5.js.html b/file/src/deletion/delete_case5.js.html index 679c416..16dc904 100644 --- a/file/src/deletion/delete_case5.js.html +++ b/file/src/deletion/delete_case5.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -83,6 +88,7 @@ * - if n is a right child, the left child of n's sibling is red * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const delete_case5 = (n) => { assert(n instanceof Node); @@ -94,8 +100,9 @@ /** * Increment the black height of all root-leaf paths going through n by + * swapping the colors of n's parent and n's sibling and * rotating at n's parent. This decrements the black height of all - * root-leaft paths going through n's sibling's right child. + * root-leaf paths going through n's sibling's right child. * We can repaint n's sibling's right child in black to fix this. * We are done. * @@ -110,6 +117,7 @@ * - - */ + // Swap the color of the parent and the sibling. s._color = n.parent._color; n.parent._color = BLACK; @@ -117,14 +125,15 @@ assert(s.right._color === RED); s.right._color = BLACK; rotate_left(n.parent); + return s; } // Symmetric case - else { - assert(s.left._color === RED); - s.left._color = BLACK; - rotate_right(n.parent); - } + + assert(s.left._color === RED); + s.left._color = BLACK; + rotate_right(n.parent); + return s; }; export default delete_case5; diff --git a/file/src/deletion/delete_no_child.js.html b/file/src/deletion/delete_no_child.js.html index 603a392..cfa6590 100644 --- a/file/src/deletion/delete_no_child.js.html +++ b/file/src/deletion/delete_no_child.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -69,7 +74,6 @@ import RED from '../color/RED.js'; import Node from '../types/Node.js'; -import replace_node from './replace_node.js'; import delete_case1 from './delete_case1.js'; import prune from './prune.js'; @@ -82,6 +86,7 @@ * - n is not the root * * @param {Node} n - The node to delete. + * @return {Node} The root of the modified subtree. */ const delete_no_child = (n) => { assert(n instanceof Node); @@ -92,23 +97,18 @@ if (n._color !== BLACK) { assert(n._color === RED); prune(n); - return; + return n.parent; } - // Mock leaf since there is no left child - // We use key = n.key to avoid mixing types, but this property is never - // accessed. - const leaf = new Node(BLACK, n.key); - - // Replace n with the mocked leaf - replace_node(n, leaf); - // If n is black, deleting it reduces the black-height of every path going // through it by 1. The leaf is black, so there are more things to fix. - delete_case1(leaf); + // NOTE We temporarily keep n in the tree to mock a leaf, since n does not + // have children. + const subtree = delete_case1(n); // Delete mocked leaf - prune(leaf); + prune(n); + return subtree; }; export default delete_no_child; diff --git a/file/src/deletion/delete_one_child.js.html b/file/src/deletion/delete_one_child.js.html index ebd449b..63e7a4a 100644 --- a/file/src/deletion/delete_one_child.js.html +++ b/file/src/deletion/delete_one_child.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -75,6 +80,14 @@ * Delete a node <code>n</code> with one non-leaf left child and one leaf right * child. * + * p + * | + * n (BLACK) + * / \ + * RED - + * / \ + * - - + * * Precondition: * - n has exactly one non-leaf child. * - n is not the root @@ -99,6 +112,8 @@ // We can easily fix this when its only child is an // internal RED node: change the color of the child to black and // replace n with it. + // TODO we could know n's direction depending whether swap_left or + // swap_non_adjacent has been called upstream. replace_node(n, child); child._color = BLACK; }; diff --git a/file/src/deletion/prune.js.html b/file/src/deletion/prune.js.html index 009ab5d..8461900 100644 --- a/file/src/deletion/prune.js.html +++ b/file/src/deletion/prune.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/deletion/replace_node.js.html b/file/src/deletion/replace_node.js.html index 4c669bc..4d8998f 100644 --- a/file/src/deletion/replace_node.js.html +++ b/file/src/deletion/replace_node.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -76,7 +81,7 @@ const replace_node = (A, B) => { assert(A instanceof Node); assert(B instanceof Node); - // We never apply delete_one_child or delete_no_child on the root + // We never apply replace_node on the root assert(A.parent !== null); if (A === A.parent.left) A.parent.left = B; diff --git a/file/src/family/grandparent.js.html b/file/src/family/grandparent.js.html index 690adc9..9751e79 100644 --- a/file/src/family/grandparent.js.html +++ b/file/src/family/grandparent.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/family/predecessor.js.html b/file/src/family/predecessor.js.html index ebdbca2..fdb7f94 100644 --- a/file/src/family/predecessor.js.html +++ b/file/src/family/predecessor.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/family/sibling.js.html b/file/src/family/sibling.js.html index f928e29..a4f5ab7 100644 --- a/file/src/family/sibling.js.html +++ b/file/src/family/sibling.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/family/uncle.js.html b/file/src/family/uncle.js.html index 107945b..894bdaf 100644 --- a/file/src/family/uncle.js.html +++ b/file/src/family/uncle.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/index.js.html b/file/src/index.js.html index 2057149..2ce165a 100644 --- a/file/src/index.js.html +++ b/file/src/index.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -92,8 +97,13 @@ export {default as rotate_left} from './rotate/rotate_left.js'; export {default as rotate_right} from './rotate/rotate_right.js'; export {default as search} from './search/search.js'; +export {default as swap_color} from './swap/swap_color.js'; +export {default as swap_left} from './swap/swap_left.js'; +export {default as swap_non_adjacent} from './swap/swap_non_adjacent.js'; export {default as inordertraversal} from './traversal/inordertraversal.js'; +export {default as leftOpenRangeTraversal} from './traversal/leftOpenRangeTraversal.js'; export {default as rangetraversal} from './traversal/rangetraversal.js'; +export {default as rightOpenRangeTraversal} from './traversal/rightOpenRangeTraversal.js'; export {default as Node} from './types/Node.js'; export {default as RedBlackTree} from './types/RedBlackTree.js'; diff --git a/file/src/insertion/insert.js.html b/file/src/insertion/insert.js.html index a5bacc8..7203ca3 100644 --- a/file/src/insertion/insert.js.html +++ b/file/src/insertion/insert.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/insertion/insert_case0.js.html b/file/src/insertion/insert_case0.js.html index 9ad78c3..a918fb5 100644 --- a/file/src/insertion/insert_case0.js.html +++ b/file/src/insertion/insert_case0.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -76,6 +81,7 @@ * - n's children are BLACK * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const insert_case0 = (n) => { assert(n instanceof Node); @@ -89,8 +95,12 @@ * / \ * - - */ - if (n.parent === null) n._color = BLACK; - else insert_case1(n); + if (n.parent === null) { + n._color = BLACK; + return n; + } + + return insert_case1(n); }; export default insert_case0; diff --git a/file/src/insertion/insert_case1.js.html b/file/src/insertion/insert_case1.js.html index b8fbafa..466c0f6 100644 --- a/file/src/insertion/insert_case1.js.html +++ b/file/src/insertion/insert_case1.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -77,6 +82,7 @@ * - n is not the root of the tree. * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const insert_case1 = (n) => { assert(n instanceof Node); @@ -94,9 +100,7 @@ * / \ * - - */ - if (n.parent._color === BLACK) return; - - insert_case2(n); + return n.parent._color === BLACK ? n : insert_case2(n); }; export default insert_case1; diff --git a/file/src/insertion/insert_case2.js.html b/file/src/insertion/insert_case2.js.html index 17c9d53..afe27c0 100644 --- a/file/src/insertion/insert_case2.js.html +++ b/file/src/insertion/insert_case2.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -81,6 +86,7 @@ * - n's parent is red. * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const insert_case2 = (n) => { assert(n instanceof Node); @@ -111,8 +117,10 @@ u._color = BLACK; const g = grandparent(n); g._color = RED; - insert_case0(g); - } else insert_case3(n); + return insert_case0(g); + } + + return insert_case3(n); }; export default insert_case2; diff --git a/file/src/insertion/insert_case3.js.html b/file/src/insertion/insert_case3.js.html index 425d0a6..9c7d1fb 100644 --- a/file/src/insertion/insert_case3.js.html +++ b/file/src/insertion/insert_case3.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -70,7 +75,6 @@ import RED from '../color/RED.js'; import rotate_left from '../rotate/rotate_left.js'; import rotate_right from '../rotate/rotate_right.js'; -import grandparent from '../family/grandparent.js'; import insert_case4 from './insert_case4.js'; /** @@ -84,6 +88,7 @@ * Here we fix the input subtree to pass the preconditions of {@link insert_case4}. * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const insert_case3 = (n) => { assert(n instanceof Node); @@ -92,24 +97,24 @@ assert(n.right === null || n.right._color === BLACK); assert(n.parent !== null); assert(n.parent._color === RED); - const g = grandparent(n); + const p = n.parent; + const g = p.parent; - /** - * If the path from g to n makes a left-right, change it to a left-left - * with {@link rotate_left}. Then call {@link insert_case4} on the old - * parent of n. - * - * B B - * / \ / \ - * R B R B - * / \ / \ --> / \ / \ - * = >R - - >R = - - - * / \ / \ - * = = = = - */ - - if (n === n.parent.right && n.parent === g.left) { - rotate_left(n.parent); + if (n === p.right && p === g.left) { + /** + * If the path from g to n makes a left-right, change it to a left-left + * with {@link rotate_left}. Then call {@link insert_case4} on the old + * parent of n. + * + * B B + * / \ / \ + * R B >R B + * / \ / \ --> / \ / \ + * = >R - - R = - - + * / \ / \ + * = = = = + */ + rotate_left(p); /** * Rotate_left can be the below because of already having *g = grandparent(n) @@ -123,7 +128,10 @@ */ // n = n.left; /!\ need to fix rotate, so that we can safely reference a node - } else if (n === n.parent.left && n.parent === g.right) { + return insert_case4(p); + } + + if (n === p.left && p === g.right) { /** * If the path from g to n makes a right-left, change it to a right-right * with {@link rotate_right}. Then call {@link insert_case4} on the old @@ -131,13 +139,13 @@ * * B B * / \ / \ - * B R B R + * B R B >R * / \ / \ --> / \ / \ - * - - >R = - - = >R + * - - >R = - - = R * / \ / \ * = = = = */ - rotate_right(n.parent); + rotate_right(p); /** * Rotate_right can be the below to take advantage of already having *g = grandparent(n) @@ -150,9 +158,10 @@ */ // n = n.right ; + return insert_case4(p); } - insert_case4(n); + return insert_case4(n); }; export default insert_case3; diff --git a/file/src/insertion/insert_case4.js.html b/file/src/insertion/insert_case4.js.html index 64cf24f..09208bb 100644 --- a/file/src/insertion/insert_case4.js.html +++ b/file/src/insertion/insert_case4.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -82,6 +87,7 @@ * - the path from n to its grandparent makes a left-left or right-right. * * @param {Node} n - The input node. + * @return {Node} The root of the modified subtree. */ const insert_case4 = (n) => { assert(n instanceof Node); @@ -131,6 +137,8 @@ assert(g.left === null || g.left._color === BLACK); rotate_left(g); } + + return n.parent; }; export default insert_case4; diff --git a/file/src/rotate/rotate_left.js.html b/file/src/rotate/rotate_left.js.html index d23d751..0ac015f 100644 --- a/file/src/rotate/rotate_left.js.html +++ b/file/src/rotate/rotate_left.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -69,13 +74,14 @@ /** * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation) - * /!\ This swaps the references to A and B. * + * p p + * | | * A B * / \ / \ - * a B -> A c + * x B -> A y * / \ / \ - * b c a b + * b y x b * * * @param {Node} A - The root of the tree. @@ -86,22 +92,21 @@ assert(A instanceof Node); const B = A.right; assert(B instanceof Node); - const a = A.left; - const b = B.left; - const c = B.right; - [A.key, B.key] = [B.key, A.key]; - [A._color, B._color] = [B._color, A._color]; + const p = A.parent; + if (p !== null) { + if (A === p.left) p.left = B; + else p.right = B; + } - A.left = B; - A.right = c; + B.parent = p; + A.parent = B; - B.left = a; - B.right = b; + const b = B.left; + A.right = b; + B.left = A; - if (a !== null) a.parent = B; - if (b !== null) b.parent = B; - if (c !== null) c.parent = A; + if (b !== null) b.parent = A; }; export default rotate_left; diff --git a/file/src/rotate/rotate_right.js.html b/file/src/rotate/rotate_right.js.html index dee5245..10fb4e0 100644 --- a/file/src/rotate/rotate_right.js.html +++ b/file/src/rotate/rotate_right.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -69,13 +74,14 @@ /** * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation) - * /!\ This swaps the references to A and B. * + * p p + * | | * B A * / \ / \ - * A c -> a B + * A y -> x B * / \ / \ - * a b b c + * x b b j * * * @param {Node} B - The root of the tree. @@ -86,22 +92,21 @@ assert(B instanceof Node); const A = B.left; assert(A instanceof Node); - const a = A.left; - const b = A.right; - const c = B.right; - [A.key, B.key] = [B.key, A.key]; - [A._color, B._color] = [B._color, A._color]; + const p = B.parent; + if (p !== null) { + if (B === p.left) p.left = A; + else p.right = A; + } - B.left = a; - B.right = A; + A.parent = p; + B.parent = A; - A.left = b; - A.right = c; + const b = A.right; + B.left = b; + A.right = B; - if (a !== null) a.parent = B; - if (b !== null) b.parent = A; - if (c !== null) c.parent = A; + if (b !== null) b.parent = B; }; export default rotate_right; diff --git a/file/src/search/search.js.html b/file/src/search/search.js.html index db18ff6..407e6cc 100644 --- a/file/src/search/search.js.html +++ b/file/src/search/search.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/swap/swap_color.js.html b/file/src/swap/swap_color.js.html new file mode 100644 index 0000000..c94e03a --- /dev/null +++ b/file/src/swap/swap_color.js.html @@ -0,0 +1,110 @@ + + + + + + src/swap/swap_color.js | @aureooms/js-red-black-tree + + + + + + + +
    + Home + Manual + Reference + Source + + +
    + + + +

    src/swap/swap_color.js

    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +
    +/**
    + * Swap colors of two arbitrary nodes.
    + *
    + *        -A        +B      ->      +A        -B
    + *
    + * @param {Node} A - The first node.
    + * @param {Node} B - The second node.
    + */
    +
    +const swap_color = (A, B) => {
    +	assert(A instanceof Node);
    +	assert(B instanceof Node);
    +
    +	const color = A._color;
    +	A._color = B._color;
    +	B._color = color;
    +};
    +
    +export default swap_color;
    +
    + +
    + + + + + + + + + + + + diff --git a/file/src/swap/swap_left.js.html b/file/src/swap/swap_left.js.html new file mode 100644 index 0000000..159ffa7 --- /dev/null +++ b/file/src/swap/swap_left.js.html @@ -0,0 +1,141 @@ + + + + + + src/swap/swap_left.js | @aureooms/js-red-black-tree + + + + + + + +
    + Home + Manual + Reference + Source + + +
    + + + +

    src/swap/swap_left.js

    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import replace_node from '../deletion/replace_node.js';
    +import swap_color from './swap_color.js';
    +
    +/**
    + * Swap pointers and colors of a node and its left child B with one constraint:
    + *   - B's right child is a leaf
    + *
    + * NOTE: This constraint is implied because B is A's in-subtree predecessor.
    + *
    + *         p                   p
    + *         |                   |
    + *        -A                  -B
    + *        / \                 / \
    + *      +B   c       ->     +A   c
    + *      / \                 / \
    + *     a   -               a   -
    + *
    + * @param {Node} A - The node.
    + * @return {Node} The node B.
    + */
    +
    +const swap_left = (A) => {
    +	assert(A instanceof Node);
    +	const B = A.left;
    +	assert(B instanceof Node);
    +	const a = B.left;
    +	assert(B.right === null);
    +	const c = A.right;
    +
    +	if (A.parent === null) {
    +		B.parent = null;
    +	} else {
    +		replace_node(A, B);
    +	}
    +
    +	A.parent = B;
    +
    +	A.right = null;
    +	B.right = c;
    +	if (c !== null) c.parent = B;
    +
    +	A.left = a;
    +	if (a !== null) a.parent = A;
    +	B.left = A;
    +
    +	swap_color(A, B);
    +
    +	return B;
    +};
    +
    +export default swap_left;
    +
    + +
    + + + + + + + + + + + + diff --git a/file/src/swap/swap_non_adjacent.js.html b/file/src/swap/swap_non_adjacent.js.html new file mode 100644 index 0000000..ec70aa9 --- /dev/null +++ b/file/src/swap/swap_non_adjacent.js.html @@ -0,0 +1,145 @@ + + + + + + src/swap/swap_non_adjacent.js | @aureooms/js-red-black-tree + + + + + + + +
    + Home + Manual + Reference + Source + + +
    + + + +

    src/swap/swap_non_adjacent.js

    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import swap_color from './swap_color.js';
    +
    +/**
    + * Swap pointers and colors of two NON-ADJACENT nodes with three constraints:
    + *   - B is not the root
    + *   - B is its parent right child
    + *   - B's right child is a leaf
    + *
    + * NOTE: These three constraints are implied because B is A's in-subtree
    + * predecessor without being A's left child.
    + *
    + *         p       q             q           p
    + *         |        \             \          |
    + *        -A        +B            +A        -B
    + *        / \       / \           / \       / \
    + *       u   v     x   -     ->  x   -     u   v
    + *
    + * @param {Node} A - The first node.
    + * @param {Node} B - The second node.
    + */
    +
    +const swap_non_adjacent = (A, B) => {
    +	assert(A instanceof Node);
    +	assert(B instanceof Node);
    +	const p = A.parent;
    +	const u = A.left;
    +	const v = A.right;
    +	const q = B.parent;
    +	const x = B.left;
    +	assert(B.right === null);
    +	assert(q !== null);
    +	assert(B === q.right);
    +
    +	if (p !== null) {
    +		if (A === p.left) p.left = B;
    +		else p.right = B;
    +	}
    +
    +	q.right = A;
    +
    +	A.parent = q;
    +	A.left = x;
    +	A.right = null;
    +	B.parent = p;
    +	B.left = u;
    +	B.right = v;
    +
    +	if (x !== null) x.parent = A;
    +	if (u !== null) u.parent = B;
    +	if (v !== null) v.parent = B;
    +
    +	swap_color(A, B);
    +};
    +
    +export default swap_non_adjacent;
    +
    + +
    + + + + + + + + + + + + diff --git a/file/src/traversal/inordertraversal.js.html b/file/src/traversal/inordertraversal.js.html index a4f40db..0d318aa 100644 --- a/file/src/traversal/inordertraversal.js.html +++ b/file/src/traversal/inordertraversal.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/traversal/leftOpenRangeTraversal.js.html b/file/src/traversal/leftOpenRangeTraversal.js.html new file mode 100644 index 0000000..ebf9c7e --- /dev/null +++ b/file/src/traversal/leftOpenRangeTraversal.js.html @@ -0,0 +1,124 @@ + + + + + + src/traversal/leftOpenRangeTraversal.js | @aureooms/js-red-black-tree + + + + + + + +
    + Home + Manual + Reference + Source + + +
    + + + +

    src/traversal/leftOpenRangeTraversal.js

    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import inordertraversal from './inordertraversal.js';
    +
    +/**
    + * Yields all the keys in the tree rooted at <code>root</code> that lie in the
    + * interval <code>(-oo, right[</code>, in order.
    + *
    + * @param {Function} compare - The comparison function.
    + * @param {Node} root - The root of the tree.
    + * @param {any} right - The non-inclusive upper bound of the interval.
    + * @returns {IterableIterator}
    + */
    +export default function* leftOpenRangeTraversal(compare, root, right) {
    +	if (compare(root.key, right) >= 0) {
    +		// If the root lies to the right of the interval, we can discard the
    +		// entire right subtree.
    +		if (root.left !== null) {
    +			assert(root.left instanceof Node);
    +			yield* leftOpenRangeTraversal(compare, root.left, right);
    +		}
    +	} else {
    +		// Otherwise yield entire left subtree, yield the root, and recurse on
    +		// the right subtree.
    +		if (root.left !== null) {
    +			assert(root.left instanceof Node);
    +			yield* inordertraversal(root.left);
    +		}
    +
    +		yield root.key;
    +		if (root.right !== null) {
    +			assert(root.right instanceof Node);
    +			yield* leftOpenRangeTraversal(compare, root.right, right);
    +		}
    +	}
    +}
    +
    + +
    + + + + + + + + + + + + diff --git a/file/src/traversal/rangetraversal.js.html b/file/src/traversal/rangetraversal.js.html index e14f942..26cf923 100644 --- a/file/src/traversal/rangetraversal.js.html +++ b/file/src/traversal/rangetraversal.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -66,6 +71,8 @@

    src/traversal/rangetraversal.js

    import assert from 'assert';
     import Node from '../types/Node.js';
    +import leftOpenRangeTraversal from './leftOpenRangeTraversal.js';
    +import rightOpenRangeTraversal from './rightOpenRangeTraversal.js';
     
     /**
      * Yields all the keys in the tree rooted at <code>root</code> that lie in the
    @@ -97,13 +104,13 @@
     		// between.
     		if (root.left !== null) {
     			assert(root.left instanceof Node);
    -			yield* rangetraversal(compare, root.left, left, right);
    +			yield* rightOpenRangeTraversal(compare, root.left, left);
     		}
     
     		yield root.key;
     		if (root.right !== null) {
     			assert(root.right instanceof Node);
    -			yield* rangetraversal(compare, root.right, left, right);
    +			yield* leftOpenRangeTraversal(compare, root.right, right);
     		}
     	}
     }
    diff --git a/file/src/traversal/rightOpenRangeTraversal.js.html b/file/src/traversal/rightOpenRangeTraversal.js.html
    new file mode 100644
    index 0000000..02b89ed
    --- /dev/null
    +++ b/file/src/traversal/rightOpenRangeTraversal.js.html
    @@ -0,0 +1,124 @@
    +
    +
    +
    +  
    +  
    +  src/traversal/rightOpenRangeTraversal.js | @aureooms/js-red-black-tree
    +  
    +  
    +  
    +  
    +
    +
    +
    +
    + Home + Manual + Reference + Source + + +
    + + + +

    src/traversal/rightOpenRangeTraversal.js

    +
    import assert from 'assert';
    +import Node from '../types/Node.js';
    +import inordertraversal from './inordertraversal.js';
    +
    +/**
    + * Yields all the keys in the tree rooted at <code>root</code> that lie in the
    + * interval <code>[left, +oo)</code>, in order.
    + *
    + * @param {Function} compare - The comparison function.
    + * @param {Node} root - The root of the tree.
    + * @param {any} left - The inclusive lower bound of the interval.
    + * @returns {IterableIterator}
    + */
    +export default function* rightOpenRangeTraversal(compare, root, left) {
    +	if (compare(root.key, left) < 0) {
    +		// If the root lies to the left of the interval, we can discard the
    +		// entire left subtree.
    +		if (root.right !== null) {
    +			assert(root.right instanceof Node);
    +			yield* rightOpenRangeTraversal(compare, root.right, left);
    +		}
    +	} else {
    +		// Otherwise recurse on left subtree, yield the root, and yield the
    +		// entire right subtree.
    +		if (root.left !== null) {
    +			assert(root.left instanceof Node);
    +			yield* rightOpenRangeTraversal(compare, root.left, left);
    +		}
    +
    +		yield root.key;
    +		if (root.right !== null) {
    +			assert(root.right instanceof Node);
    +			yield* inordertraversal(root.right);
    +		}
    +	}
    +}
    +
    + +
    + + + + + + + + + + + + diff --git a/file/src/types/Node.js.html b/file/src/types/Node.js.html index 4f6ba1e..3c4f28b 100644 --- a/file/src/types/Node.js.html +++ b/file/src/types/Node.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/file/src/types/RedBlackTree.js.html b/file/src/types/RedBlackTree.js.html index b083e46..05771b8 100644 --- a/file/src/types/RedBlackTree.js.html +++ b/file/src/types/RedBlackTree.js.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -70,12 +75,15 @@ import RED from '../color/RED.js'; import predecessor from '../family/predecessor.js'; import insert from '../insertion/insert.js'; -import insert_case1 from '../insertion/insert_case1.js'; +import insert_case2 from '../insertion/insert_case2.js'; import delete_one_child from '../deletion/delete_one_child.js'; import delete_no_child from '../deletion/delete_no_child.js'; import search from '../search/search.js'; import inordertraversal from '../traversal/inordertraversal.js'; import rangetraversal from '../traversal/rangetraversal.js'; +import replace_node from '../deletion/replace_node.js'; +import swap_non_adjacent from '../swap/swap_non_adjacent.js'; +import swap_left from '../swap/swap_left.js'; /** * A RedBlackTree with key-only nodes. @@ -108,15 +116,25 @@ * Adds a key to the tree. * * @param {any} key - The key to add. + * @return {Node} The newly added node. */ add(key) { if (this.root === null) { this.root = new Node(BLACK, key); - } else { - const node = new Node(RED, key); - insert(this.compare, this.root, node); - insert_case1(node); + return this.root; + } + + const node = new Node(RED, key); + insert(this.compare, this.root, node); + assert(node.parent !== null); + if (node.parent._color !== BLACK) { + const subtree = insert_case2(node); + if (subtree.parent === null) { + this.root = subtree; + } } + + return node; } /** @@ -142,7 +160,7 @@ */ get(key) { const node = this._search(key); - return node === null ? null : node.key; + return node === null ? undefined : node.key; } /** @@ -161,39 +179,90 @@ * * @param {Node} node - The input node to delete. */ - _delete(node) { + unlink(node) { assert(node instanceof Node); if (node.left !== null) { - // Replace node's key with predecessor's key + // Swap node with its predecessor const pred = predecessor(node); - node.key = pred.key; // Delete predecessor node - // NOTE: this node can only have one non-leaf (left) child because - // of red-black tree invariant. - if (pred.left === null) { - delete_no_child(pred); + // NOTE: this node can have at most one non-leaf (left) child + // because of red-black tree invariant. + assert(pred.right === null); + if (pred === node.left) { + swap_left(node); } else { - delete_one_child(pred); + swap_non_adjacent(node, pred); + } + + assert(node.right === null); + if (node.left === null) { + const subtree = delete_no_child(node); + if (subtree.parent === null) { + this.root = subtree; + } else if (pred.parent === null) { + assert(node === this.root); + this.root = pred; + } + } else { + delete_one_child(node); + if (pred.parent === null) { + assert(node === this.root); + this.root = pred; + } } } else if (node.right !== null) { - // Replace node's key with successor's key - // NOTE: Since there is no left child, then there can only be one - // right child by the red-black tree invariant. + /** + * Swap node with its successor. + * + * NOTE: Since pred is a leaf, there can only by one node in the + * right subtree, succ, which is necessarily red, hence + * node is black. + * + * The configuration: + * + * (A) (B) (C) + * + * p p p + * | | | + * node (BLACK) succ (BLACK) succ (BLACK) + * / \ / \ / \ + * - succ (RED) -> - node (RED) -> - - + * / \ / \ + * - - - - + * + * NOTE: We take a shortcut and go directly from (A) to (C) + */ + assert(node.left === null); const succ = node.right; - node.key = succ.key; - // Delete successor node - delete_no_child(succ); + assert(succ._color === RED); + succ._color = BLACK; + if (node === this.root) { + assert(node.parent === null); + succ.parent = null; + this.root = succ; + } else { + replace_node(node, succ); + } } else if (node === this.root) { + assert(node.parent === null); + assert(node._color === BLACK); + assert(node.left === null); + assert(node.right === null); this.root = null; } else { - delete_no_child(node); + assert(node.left === null); + assert(node.right === null); + const subtree = delete_no_child(node); + if (subtree.parent === null) { + this.root = subtree; + } } } /** * Search for the first node of the tree whose key equals the input key * (with {@link RedBlackTree#_search}), then delete that node - * (with {@link RedBlackTree#_delete}). If such a node is found and deleted + * (with {@link RedBlackTree#unlink}). If such a node is found and deleted * then return <code>true</code>. Return <code>false</code> otherwise. * * @param {any} key - The input key. @@ -203,7 +272,7 @@ const node = this._search(key); if (node === null) return false; - this._delete(node); + this.unlink(node); return true; } diff --git a/function/index.html b/function/index.html index 4016ee2..2e67582 100644 --- a/function/index.html +++ b/function/index.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -111,7 +116,7 @@ - delete_case0(n: Node) + delete_case0(n: Node): Node

    @@ -145,7 +150,7 @@ - delete_case1(n: Node) + delete_case1(n: Node): Node

    @@ -180,7 +185,7 @@ - delete_case2(n: Node) + delete_case2(n: Node): Node

    @@ -216,7 +221,7 @@ - delete_case5(n: Node) + delete_case5(n: Node): Node

    @@ -254,7 +259,7 @@ - delete_no_child(n: Node) + delete_no_child(n: Node): Node

    @@ -401,7 +406,7 @@ - insert_case0(n: Node) + insert_case0(n: Node): Node

    @@ -433,7 +438,7 @@ - insert_case1(n: Node) + insert_case1(n: Node): Node

    @@ -465,7 +470,7 @@ - insert_case2(n: Node) + insert_case2(n: Node): Node

    @@ -497,7 +502,7 @@ - insert_case3(n: Node) + insert_case3(n: Node): Node

    @@ -529,7 +534,7 @@ - insert_case4(n: Node) + insert_case4(n: Node): Node

    @@ -553,6 +558,36 @@ + +
    +
    +

    + + + * + leftOpenRangeTraversal(compare: Function, root: Node, right: any): IterableIterator +

    +
    +
    + + +

    Yields all the keys in the tree rooted at root that lie in the +interval (-oo, right[, in order.

    +
    +
    +
    + + +
    + public + + + @@ -671,6 +706,36 @@ + + +
    +

    + + + * + rightOpenRangeTraversal(compare: Function, root: Node, left: any): IterableIterator +

    +
    +
    + + +

    Yields all the keys in the tree rooted at root that lie in the +interval [left, +oo), in order.

    +
    +
    +
    + + +
    + public + + + @@ -787,6 +852,109 @@ + + +
    +

    + + + + swap_color(A: Node, B: Node) +

    +
    +
    + + +

    Swap colors of two arbitrary nodes.

    +
    +
    +
    + + +
    + public + + + + + +
    +

    + + + + swap_left(A: Node): Node +

    +
    +
    + + +

    Swap pointers and colors of a node and its left child B with one constraint:

    +
      +
    • B's right child is a leaf
    • +
    +

    NOTE: This constraint is implied because B is A's in-subtree predecessor.

    +
    +
    +
    + + +
    + public + + + + + +
    +

    + + + + swap_non_adjacent(A: Node, B: Node) +

    +
    +
    + + +

    Swap pointers and colors of two NON-ADJACENT nodes with three constraints:

    +
      +
    • B is not the root
    • +
    • B is its parent right child
    • +
    • B's right child is a leaf
    • +
    +

    NOTE: These three constraints are implied because B is A's in-subtree +predecessor without being A's left child.

    +
        p       q             q           p
    +    |        \             \          |
    +   -A        +B            +A        -B
    +   / \       / \           / \       / \
    +  u   v     x   -     ->  x   -     u   v
    +
    +
    +
    + + +
    + public + + + @@ -927,15 +1095,15 @@

    - delete_case0(n: Node) + delete_case0(n: Node): Node - source + source

    - +

    Preconditions:

    @@ -968,7 +1136,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -993,15 +1174,15 @@

    - delete_case1(n: Node) + delete_case1(n: Node): Node - source + source

    - +

    Preconditions:

    @@ -1035,7 +1216,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -1060,15 +1254,15 @@

    - delete_case2(n: Node) + delete_case2(n: Node): Node - source + source

    - +

    Preconditions:

    @@ -1103,7 +1297,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -1128,15 +1335,15 @@

    - delete_case5(n: Node) + delete_case5(n: Node): Node - source + source

    - +

    Preconditions:

    @@ -1173,7 +1380,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -1198,7 +1418,7 @@

    - delete_no_child(n: Node) + delete_no_child(n: Node): Node @@ -1239,7 +1459,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -1268,15 +1501,24 @@

    - source + source

    - +

    Delete a node n with one non-leaf left child and one leaf right child.

    +
      p
    +  |
    +  n (BLACK)
    + / \
    +

    RED - + / \

    +
      +
    • -
    • +

    Precondition:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -1642,15 +1897,15 @@

    - insert_case1(n: Node) + insert_case1(n: Node): Node - source + source

    - +

    Preconditions:

    @@ -1683,7 +1938,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -1708,15 +1976,15 @@

    - insert_case2(n: Node) + insert_case2(n: Node): Node - source + source

    - +

    Preconditions:

    @@ -1750,7 +2018,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -1775,7 +2056,7 @@

    - insert_case3(n: Node) + insert_case3(n: Node): Node @@ -1819,7 +2100,20 @@

    Params:

    - +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    @@ -1844,15 +2138,15 @@

    - insert_case4(n: Node) + insert_case4(n: Node): Node - source + source

    - +

    Preconditions:

    @@ -1888,8 +2182,109 @@

    Params:

    +
    +

    Return:

    + + + + + + + +
    Node

    The root of the modified subtree.

    +
    +
    +
    +
    + + + + + + + + + + + + + + + + +
    +

    + public + + + + + * + leftOpenRangeTraversal(compare: Function, root: Node, right: any): IterableIterator + + + + source + +

    + + + + +

    Yields all the keys in the tree rooted at root that lie in the +interval (-oo, right[, in order.

    +
    + +
    +

    Params:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    compareFunction

    The comparison function.

    +
    rootNode

    The root of the tree.

    +
    rightany

    The non-inclusive upper bound of the interval.

    +
    +
    +
    + +
    +

    Return:

    + + + + + + + +
    IterableIterator
    +
    +
    +
    + @@ -2052,11 +2447,11 @@

    - source + source

    - +

    Yields all the keys in the tree rooted at root that lie in the @@ -2202,6 +2597,94 @@

    Params:

    +
    +
    +

    + public + + + + + * + rightOpenRangeTraversal(compare: Function, root: Node, left: any): IterableIterator + + + + source + +

    + + + + +

    Yields all the keys in the tree rooted at root that lie in the +interval [left, +oo), in order.

    +
    + + + +
    +

    Params:

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    compareFunction

    The comparison function.

    +
    rootNode

    The root of the tree.

    +
    leftany

    The inclusive lower bound of the interval.

    +
    +
    +
    + +
    +

    Return:

    + + + + + + + +
    IterableIterator
    +
    +
    +
    + + + + + + + + + + + + + + +

    @@ -2215,20 +2698,21 @@

    - source + source

    - + -

    Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation) -/!\ This swaps the references to A and B.

    -
        A                B
    +  

    Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)

    +
        p                p
    +    |                |
    +    A                B
        / \              / \
    -  a   B     ->     A   c
    +  x   B     ->     A   y
          / \          / \
    -    b   c        a   b
    +    b   y        x   b
     
    @@ -2282,20 +2766,21 @@

    - source + source

    - + -

    Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation) -/!\ This swaps the references to A and B.

    -
        B                A
    +  

    Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)

    +
        p                p
    +    |                |
    +    B                A
        / \              / \
    -  A   c     ->     a   B
    +  A   y     ->     x   B
      / \                  / \
    -a   b                b   c
    +x   b                b   j
     
    @@ -2496,6 +2981,240 @@

    Return:

    +
    +
    +

    + public + + + + + + swap_color(A: Node, B: Node) + + + + source + +

    + + + + +

    Swap colors of two arbitrary nodes.

    +
       -A        +B      ->      +A        -B
    +
    + + + +
    +

    Params:

    + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    ANode

    The first node.

    +
    BNode

    The second node.

    +
    +
    +
    + + + + + + + + + + + + + + + + + +
    +
    +

    + public + + + + + + swap_left(A: Node): Node + + + + source + +

    + + + + +

    Swap pointers and colors of a node and its left child B with one constraint:

    +
      +
    • B's right child is a leaf
    • +
    +

    NOTE: This constraint is implied because B is A's in-subtree predecessor.

    +
        p                   p
    +    |                   |
    +   -A                  -B
    +   / \                 / \
    + +B   c       ->     +A   c
    + / \                 / \
    +a   -               a   -
    +
    + + + +
    +

    Params:

    + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    ANode

    The node.

    +
    +
    +
    + +
    +

    Return:

    + + + + + + + +
    Node

    The node B.

    +
    +
    +
    +
    + + + + + + + + + + + + + + + +
    +
    +

    + public + + + + + + swap_non_adjacent(A: Node, B: Node) + + + + source + +

    + + + + +

    Swap pointers and colors of two NON-ADJACENT nodes with three constraints:

    +
      +
    • B is not the root
    • +
    • B is its parent right child
    • +
    • B's right child is a leaf
    • +
    +

    NOTE: These three constraints are implied because B is A's in-subtree +predecessor without being A's left child.

    +
        p       q             q           p
    +    |        \             \          |
    +   -A        +B            +A        -B
    +   / \       / \           / \       / \
    +  u   v     x   -     ->  x   -     u   v
    +
    + + + +
    +

    Params:

    + + + + + + + + + + + + + + + + + + + +
    NameTypeAttributeDescription
    ANode

    The first node.

    +
    BNode

    The second node.

    +
    +
    +
    + + + + + + + + + + + + + + + + +

    diff --git a/identifiers.html b/identifiers.html index 86fc0d6..e711787 100644 --- a/identifiers.html +++ b/identifiers.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • @@ -263,7 +268,7 @@

    deletion

    F - delete_case0(n: Node) + delete_case0(n: Node): Node

    @@ -297,7 +302,7 @@

    deletion

    F - delete_case1(n: Node) + delete_case1(n: Node): Node

    @@ -332,7 +337,7 @@

    deletion

    F - delete_case2(n: Node) + delete_case2(n: Node): Node

    @@ -368,7 +373,7 @@

    deletion

    F - delete_case5(n: Node) + delete_case5(n: Node): Node

    @@ -406,7 +411,7 @@

    deletion

    F - delete_no_child(n: Node) + delete_no_child(n: Node): Node

    @@ -691,7 +696,7 @@

    insertion

    F - insert_case0(n: Node) + insert_case0(n: Node): Node

    @@ -723,7 +728,7 @@

    insertion

    F - insert_case1(n: Node) + insert_case1(n: Node): Node

    @@ -755,7 +760,7 @@

    insertion

    F - insert_case2(n: Node) + insert_case2(n: Node): Node

    @@ -787,7 +792,7 @@

    insertion

    F - insert_case3(n: Node) + insert_case3(n: Node): Node

    @@ -819,7 +824,7 @@

    insertion

    F - insert_case4(n: Node) + insert_case4(n: Node): Node

    @@ -942,6 +947,119 @@

    +
    +
    +
    +
    +

    swap

    +
    + + + + + + + + + + + + + + + + + @@ -989,6 +1107,36 @@

    traversal

    + + + + + + + + + + + + @@ -1097,6 +1275,7 @@

    types

    + diff --git a/index.html b/index.html index c59a64c..bac623f 100644 --- a/index.html +++ b/index.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • diff --git a/index.json b/index.json index 178fefe..7fa4bd6 100644 --- a/index.json +++ b/index.json @@ -752,7 +752,7 @@ "__docId__": 58, "kind": "file", "name": "src/deletion/delete_case0.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport Node from '../types/Node.js';\nimport delete_case1 from './delete_case1.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n */\nconst delete_case0 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\t// If n is the root, there is nothing to do:\n\t// - all paths go through n, and\n\t// - n is black.\n\tif (n.parent !== null) delete_case1(n);\n};\n\nexport default delete_case0;\n", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport Node from '../types/Node.js';\nimport delete_case1 from './delete_case1.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst delete_case0 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\t// If n is the root, there is nothing to do:\n\t// - all paths go through n, and\n\t// - n is black.\n\treturn n.parent === null ? n : delete_case1(n);\n};\n\nexport default delete_case0;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case0.js", "access": "public", @@ -773,7 +773,7 @@ "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case0.js", "importStyle": "delete_case0", "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b", - "lineNumber": 14, + "lineNumber": 15, "params": [ { "nullable": null, @@ -786,13 +786,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 60, "kind": "file", "name": "src/deletion/delete_case1.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case2 from './delete_case2.js';\nimport delete_case3 from './delete_case3.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n */\nconst delete_case1 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\n\tif (s._color === BLACK) {\n\t\t// If n's sibling is BLACK, go to case 2.\n\t\tdelete_case2(n);\n\t} else {\n\t\t/**\n\t\t * Otherwise, prepare for and go to case 3.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * >B R R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - B B >B B = =\n\t\t * / \\ / \\ / \\ / \\\n\t\t * = = = = - - = =\n\t\t */\n\t\tn.parent._color = RED;\n\t\ts._color = BLACK;\n\t\tif (n === n.parent.left) rotate_left(n.parent);\n\t\telse rotate_right(n.parent);\n\t\tdelete_case3(n);\n\t}\n};\n\nexport default delete_case1;\n", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case2 from './delete_case2.js';\nimport delete_case3 from './delete_case3.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst delete_case1 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\n\tif (s._color === BLACK) {\n\t\t// If n's sibling is BLACK, go to case 2.\n\t\treturn delete_case2(n);\n\t}\n\n\t/**\n\t * Otherwise, prepare for and go to case 3.\n\t *\n\t * B *B\n\t * / \\ / \\\n\t * >B R R B\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B >B B = =\n\t * / \\ / \\ / \\ / \\\n\t * = = = = - - = =\n\t */\n\tn.parent._color = RED;\n\ts._color = BLACK;\n\tif (n === n.parent.left) rotate_left(n.parent);\n\telse rotate_right(n.parent);\n\treturn delete_case3(n).parent;\n};\n\nexport default delete_case1;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case1.js", "access": "public", @@ -813,7 +820,7 @@ "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case1.js", "importStyle": "delete_case1", "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root", - "lineNumber": 21, + "lineNumber": 22, "params": [ { "nullable": null, @@ -826,13 +833,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 62, "kind": "file", "name": "src/deletion/delete_case2.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case0 from './delete_case0.js';\nimport delete_case3 from './delete_case3.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n */\nconst delete_case2 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\tn.parent._color === BLACK &&\n\t\t(s.left === null || s.left._color === BLACK) &&\n\t\t(s.right === null || s.right._color === BLACK)\n\t) {\n\t\ts._color = RED;\n\t\tdelete_case0(n.parent);\n\t}\n\n\t// Otherwise, go to case 3.\n\telse delete_case3(n);\n};\n\nexport default delete_case2;\n", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport sibling from '../family/sibling.js';\n\nimport delete_case0 from './delete_case0.js';\nimport delete_case3 from './delete_case3.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst delete_case2 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * If n's parent is black and n's sibling's children are black, then\n\t * repaint n's sibling red. Now all root-leaf paths going through n's\n\t * parent have a black height of b - 1. We recurse thus on n's parent.\n\t *\n\t * B >B\n\t * / \\ / \\\n\t * >B B B R\n\t * / \\ / \\ --> / \\ / \\\n\t * - - B B - - B B\n\t * / \\ / \\ / \\ / \\\n\t * - - - - - - - -\n\t */\n\tif (\n\t\tn.parent._color === BLACK &&\n\t\t(s.left === null || s.left._color === BLACK) &&\n\t\t(s.right === null || s.right._color === BLACK)\n\t) {\n\t\ts._color = RED;\n\t\treturn delete_case0(n.parent);\n\t}\n\n\t// Otherwise, go to case 3.\n\treturn delete_case3(n);\n};\n\nexport default delete_case2;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case2.js", "access": "public", @@ -853,7 +867,7 @@ "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case2.js", "importStyle": "delete_case2", "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black", - "lineNumber": 20, + "lineNumber": 21, "params": [ { "nullable": null, @@ -866,13 +880,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 64, "kind": "file", "name": "src/deletion/delete_case5.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n */\nconst delete_case5 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaft paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n\ts._color = n.parent._color;\n\tn.parent._color = BLACK;\n\n\tif (n === n.parent.left) {\n\t\tassert(s.right._color === RED);\n\t\ts.right._color = BLACK;\n\t\trotate_left(n.parent);\n\t}\n\n\t// Symmetric case\n\telse {\n\t\tassert(s.left._color === RED);\n\t\ts.left._color = BLACK;\n\t\trotate_right(n.parent);\n\t}\n};\n\nexport default delete_case5;\n", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport sibling from '../family/sibling.js';\n\n/**\n * Preconditions:\n * - n is black\n * - all root-leaf paths going through n have a black height of b - 1\n * - all other root-leaf paths have a black height of b\n * - n is not the root\n * - n's sibling is black\n * - if n is a left child, the right child of n's sibling is red\n * - if n is a right child, the left child of n's sibling is red\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst delete_case5 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tconst s = sibling(n);\n\tassert(s instanceof Node);\n\tassert(s._color === BLACK);\n\n\t/**\n\t * Increment the black height of all root-leaf paths going through n by\n\t * swapping the colors of n's parent and n's sibling and\n\t * rotating at n's parent. This decrements the black height of all\n\t * root-leaf paths going through n's sibling's right child.\n\t * We can repaint n's sibling's right child in black to fix this.\n\t * We are done.\n\t *\n\t * ? ?\n\t * / \\ / \\\n\t * >B B B B\n\t * / \\ / \\ / \\ / \\\n\t * - - = R --> >B = = B\n\t * / \\ / \\ / \\\n\t * = B - - - -\n\t * / \\\n\t * - -\n\t */\n\n\t// Swap the color of the parent and the sibling.\n\ts._color = n.parent._color;\n\tn.parent._color = BLACK;\n\n\tif (n === n.parent.left) {\n\t\tassert(s.right._color === RED);\n\t\ts.right._color = BLACK;\n\t\trotate_left(n.parent);\n\t\treturn s;\n\t}\n\n\t// Symmetric case\n\n\tassert(s.left._color === RED);\n\ts.left._color = BLACK;\n\trotate_right(n.parent);\n\treturn s;\n};\n\nexport default delete_case5;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_case5.js", "access": "public", @@ -893,7 +914,7 @@ "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_case5.js", "importStyle": "delete_case5", "description": "Preconditions:\n - n is black\n - all root-leaf paths going through n have a black height of b - 1\n - all other root-leaf paths have a black height of b\n - n is not the root\n - n's sibling is black\n - if n is a left child, the right child of n's sibling is red\n - if n is a right child, the left child of n's sibling is red", - "lineNumber": 21, + "lineNumber": 22, "params": [ { "nullable": null, @@ -906,13 +927,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 66, "kind": "file", "name": "src/deletion/delete_no_child.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\n\nimport replace_node from './replace_node.js';\nimport delete_case1 from './delete_case1.js';\n\nimport prune from './prune.js';\n\n/**\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n */\nconst delete_no_child = (n) => {\n\tassert(n instanceof Node);\n\tassert(n.parent !== null);\n\tassert(n.left === null);\n\tassert(n.right === null);\n\n\tif (n._color !== BLACK) {\n\t\tassert(n._color === RED);\n\t\tprune(n);\n\t\treturn;\n\t}\n\n\t// Mock leaf since there is no left child\n\t// We use key = n.key to avoid mixing types, but this property is never\n\t// accessed.\n\tconst leaf = new Node(BLACK, n.key);\n\n\t// Replace n with the mocked leaf\n\treplace_node(n, leaf);\n\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1. The leaf is black, so there are more things to fix.\n\tdelete_case1(leaf);\n\n\t// Delete mocked leaf\n\tprune(leaf);\n};\n\nexport default delete_no_child;\n", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\n\nimport delete_case1 from './delete_case1.js';\n\nimport prune from './prune.js';\n\n/**\n * Delete a node n that has no non-leaf child.\n *\n * Precondition:\n * - n has no non-leaf child.\n * - n is not the root\n *\n * @param {Node} n - The node to delete.\n * @return {Node} The root of the modified subtree.\n */\nconst delete_no_child = (n) => {\n\tassert(n instanceof Node);\n\tassert(n.parent !== null);\n\tassert(n.left === null);\n\tassert(n.right === null);\n\n\tif (n._color !== BLACK) {\n\t\tassert(n._color === RED);\n\t\tprune(n);\n\t\treturn n.parent;\n\t}\n\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1. The leaf is black, so there are more things to fix.\n\t// NOTE We temporarily keep n in the tree to mock a leaf, since n does not\n\t// have children.\n\tconst subtree = delete_case1(n);\n\n\t// Delete mocked leaf\n\tprune(n);\n\treturn subtree;\n};\n\nexport default delete_no_child;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_no_child.js", "access": "public", @@ -946,13 +974,20 @@ "description": "The node to delete." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 68, "kind": "file", "name": "src/deletion/delete_one_child.js", - "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\n\nimport replace_node from './replace_node.js';\n\n/**\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n */\nconst delete_one_child = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.left instanceof Node);\n\tassert(n.left._color === RED);\n\tassert(n.right === null);\n\n\tconst child = n.left;\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1.\n\t// We can easily fix this when its only child is an\n\t// internal RED node: change the color of the child to black and\n\t// replace n with it.\n\treplace_node(n, child);\n\tchild._color = BLACK;\n};\n\nexport default delete_one_child;\n", + "content": "import assert from 'assert';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport Node from '../types/Node.js';\n\nimport replace_node from './replace_node.js';\n\n/**\n * Delete a node n with one non-leaf left child and one leaf right\n * child.\n *\n * p\n * |\n * n (BLACK)\n * / \\\n * RED -\n * / \\\n * - -\n *\n * Precondition:\n * - n has exactly one non-leaf child.\n * - n is not the root\n * - n's only non-leaf child is n's left child.\n * - hence, n's right child is a leaf\n * - hence, n's left child is RED\n * - hence, n is BLACK\n *\n * @param {Node} n - The node to delete.\n */\nconst delete_one_child = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.left instanceof Node);\n\tassert(n.left._color === RED);\n\tassert(n.right === null);\n\n\tconst child = n.left;\n\t// If n is black, deleting it reduces the black-height of every path going\n\t// through it by 1.\n\t// We can easily fix this when its only child is an\n\t// internal RED node: change the color of the child to black and\n\t// replace n with it.\n\t// TODO we could know n's direction depending whether swap_left or\n\t// swap_non_adjacent has been called upstream.\n\treplace_node(n, child);\n\tchild._color = BLACK;\n};\n\nexport default delete_one_child;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/delete_one_child.js", "access": "public", @@ -972,8 +1007,8 @@ "export": true, "importPath": "@aureooms/js-red-black-tree/src/deletion/delete_one_child.js", "importStyle": "delete_one_child", - "description": "Delete a node n with one non-leaf left child and one leaf right\nchild.\n\nPrecondition:\n - n has exactly one non-leaf child.\n - n is not the root\n - n's only non-leaf child is n's left child.\n - hence, n's right child is a leaf\n - hence, n's left child is RED\n - hence, n is BLACK", - "lineNumber": 22, + "description": "Delete a node n with one non-leaf left child and one leaf right\nchild.\n\n p\n |\n n (BLACK)\n / \\\n RED -\n / \\\n - -\n\nPrecondition:\n - n has exactly one non-leaf child.\n - n is not the root\n - n's only non-leaf child is n's left child.\n - hence, n's right child is a leaf\n - hence, n's left child is RED\n - hence, n is BLACK", + "lineNumber": 30, "params": [ { "nullable": null, @@ -1032,7 +1067,7 @@ "__docId__": 72, "kind": "file", "name": "src/deletion/replace_node.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n */\nconst replace_node = (A, B) => {\n\tassert(A instanceof Node);\n\tassert(B instanceof Node);\n\t// We never apply delete_one_child or delete_no_child on the root\n\tassert(A.parent !== null);\n\n\tif (A === A.parent.left) A.parent.left = B;\n\telse A.parent.right = B;\n\n\tB.parent = A.parent;\n};\n\nexport default replace_node;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Replaces node A by node B.\n *\n * @param {Node} A - The node to replace.\n * @param {Node} B - The replacement node.\n */\nconst replace_node = (A, B) => {\n\tassert(A instanceof Node);\n\tassert(B instanceof Node);\n\t// We never apply replace_node on the root\n\tassert(A.parent !== null);\n\n\tif (A === A.parent.left) A.parent.left = B;\n\telse A.parent.right = B;\n\n\tB.parent = A.parent;\n};\n\nexport default replace_node;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/deletion/replace_node.js", "access": "public", @@ -1294,7 +1329,7 @@ "__docId__": 82, "kind": "file", "name": "src/index.js", - "content": "export {default as empty} from './api/empty.js';\nexport {default as from} from './api/from.js';\nexport {default as BLACK} from './color/BLACK.js';\nexport {default as RED} from './color/RED.js';\nexport {default as _debug} from './debug/_debug.js';\nexport {default as delete_case0} from './deletion/delete_case0.js';\nexport {default as delete_case1} from './deletion/delete_case1.js';\nexport {default as delete_case2} from './deletion/delete_case2.js';\nexport {default as delete_case3} from './deletion/delete_case3.js';\nexport {default as delete_case4} from './deletion/delete_case4.js';\nexport {default as delete_case5} from './deletion/delete_case5.js';\nexport {default as delete_no_child} from './deletion/delete_no_child.js';\nexport {default as delete_one_child} from './deletion/delete_one_child.js';\nexport {default as prune} from './deletion/prune.js';\nexport {default as replace_node} from './deletion/replace_node.js';\nexport {default as grandparent} from './family/grandparent.js';\nexport {default as predecessor} from './family/predecessor.js';\nexport {default as sibling} from './family/sibling.js';\nexport {default as uncle} from './family/uncle.js';\nexport {default as insert} from './insertion/insert.js';\nexport {default as insert_case0} from './insertion/insert_case0.js';\nexport {default as insert_case1} from './insertion/insert_case1.js';\nexport {default as insert_case2} from './insertion/insert_case2.js';\nexport {default as insert_case3} from './insertion/insert_case3.js';\nexport {default as insert_case4} from './insertion/insert_case4.js';\nexport {default as rotate_left} from './rotate/rotate_left.js';\nexport {default as rotate_right} from './rotate/rotate_right.js';\nexport {default as search} from './search/search.js';\nexport {default as inordertraversal} from './traversal/inordertraversal.js';\nexport {default as rangetraversal} from './traversal/rangetraversal.js';\nexport {default as Node} from './types/Node.js';\nexport {default as RedBlackTree} from './types/RedBlackTree.js';\n", + "content": "export {default as empty} from './api/empty.js';\nexport {default as from} from './api/from.js';\nexport {default as BLACK} from './color/BLACK.js';\nexport {default as RED} from './color/RED.js';\nexport {default as _debug} from './debug/_debug.js';\nexport {default as delete_case0} from './deletion/delete_case0.js';\nexport {default as delete_case1} from './deletion/delete_case1.js';\nexport {default as delete_case2} from './deletion/delete_case2.js';\nexport {default as delete_case3} from './deletion/delete_case3.js';\nexport {default as delete_case4} from './deletion/delete_case4.js';\nexport {default as delete_case5} from './deletion/delete_case5.js';\nexport {default as delete_no_child} from './deletion/delete_no_child.js';\nexport {default as delete_one_child} from './deletion/delete_one_child.js';\nexport {default as prune} from './deletion/prune.js';\nexport {default as replace_node} from './deletion/replace_node.js';\nexport {default as grandparent} from './family/grandparent.js';\nexport {default as predecessor} from './family/predecessor.js';\nexport {default as sibling} from './family/sibling.js';\nexport {default as uncle} from './family/uncle.js';\nexport {default as insert} from './insertion/insert.js';\nexport {default as insert_case0} from './insertion/insert_case0.js';\nexport {default as insert_case1} from './insertion/insert_case1.js';\nexport {default as insert_case2} from './insertion/insert_case2.js';\nexport {default as insert_case3} from './insertion/insert_case3.js';\nexport {default as insert_case4} from './insertion/insert_case4.js';\nexport {default as rotate_left} from './rotate/rotate_left.js';\nexport {default as rotate_right} from './rotate/rotate_right.js';\nexport {default as search} from './search/search.js';\nexport {default as swap_color} from './swap/swap_color.js';\nexport {default as swap_left} from './swap/swap_left.js';\nexport {default as swap_non_adjacent} from './swap/swap_non_adjacent.js';\nexport {default as inordertraversal} from './traversal/inordertraversal.js';\nexport {default as leftOpenRangeTraversal} from './traversal/leftOpenRangeTraversal.js';\nexport {default as rangetraversal} from './traversal/rangetraversal.js';\nexport {default as rightOpenRangeTraversal} from './traversal/rightOpenRangeTraversal.js';\nexport {default as Node} from './types/Node.js';\nexport {default as RedBlackTree} from './types/RedBlackTree.js';\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/index.js", "access": "public", @@ -1378,7 +1413,7 @@ "__docId__": 85, "kind": "file", "name": "src/insertion/insert_case0.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case1 from './insert_case1.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n */\nconst insert_case0 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent === null) n._color = BLACK;\n\telse insert_case1(n);\n};\n\nexport default insert_case0;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case1 from './insert_case1.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst insert_case0 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left._color === BLACK);\n\tassert(n.right._color === BLACK);\n\t/**\n\t * If n is the root of the tree, paint it black and we are done.\n\t *\n\t * >R\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent === null) {\n\t\tn._color = BLACK;\n\t\treturn n;\n\t}\n\n\treturn insert_case1(n);\n};\n\nexport default insert_case0;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case0.js", "access": "public", @@ -1399,7 +1434,7 @@ "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case0.js", "importStyle": "insert_case0", "description": "Preconditions:\n - n is red.\n - n's children are BLACK", - "lineNumber": 14, + "lineNumber": 15, "params": [ { "nullable": null, @@ -1412,13 +1447,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 87, "kind": "file", "name": "src/insertion/insert_case1.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case2 from './insert_case2.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case1 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\tif (n.parent._color === BLACK) return;\n\n\tinsert_case2(n);\n};\n\nexport default insert_case1;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport insert_case2 from './insert_case2.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst insert_case1 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\n\t/**\n\t * If the parent of n is black then we have nothing to do.\n\t *\n\t * B\n\t * / \\\n\t * >R -\n\t * / \\\n\t * - -\n\t */\n\treturn n.parent._color === BLACK ? n : insert_case2(n);\n};\n\nexport default insert_case1;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case1.js", "access": "public", @@ -1439,7 +1481,7 @@ "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case1.js", "importStyle": "insert_case1", "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.", - "lineNumber": 15, + "lineNumber": 16, "params": [ { "nullable": null, @@ -1452,13 +1494,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 89, "kind": "file", "name": "src/insertion/insert_case2.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport uncle from '../family/uncle.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case0 from './insert_case0.js';\nimport insert_case3 from './insert_case3.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case2 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst u = uncle(n);\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\tif (u !== null && u._color !== BLACK) {\n\t\tassert(u._color === RED);\n\t\tn.parent._color = BLACK;\n\t\tu._color = BLACK;\n\t\tconst g = grandparent(n);\n\t\tg._color = RED;\n\t\tinsert_case0(g);\n\t} else insert_case3(n);\n};\n\nexport default insert_case2;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport uncle from '../family/uncle.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case0 from './insert_case0.js';\nimport insert_case3 from './insert_case3.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst insert_case2 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst u = uncle(n);\n\n\t/**\n\t * If n has a non-leaf uncle and this uncle is red then we simply\n\t * repaint the parent and the uncle of n in black, the grandparent of\n\t * n in red, then call insert_case0 on n's grandparent.\n\t *\n\t * B >R\n\t * / \\ / \\\n\t * R R B B\n\t * / \\ / \\ --> / \\ / \\\n\t * >R - - - R - - -\n\t * / \\ / \\\n\t * - - - -\n\t */\n\n\tif (u !== null && u._color !== BLACK) {\n\t\tassert(u._color === RED);\n\t\tn.parent._color = BLACK;\n\t\tu._color = BLACK;\n\t\tconst g = grandparent(n);\n\t\tg._color = RED;\n\t\treturn insert_case0(g);\n\t}\n\n\treturn insert_case3(n);\n};\n\nexport default insert_case2;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case2.js", "access": "public", @@ -1479,7 +1528,7 @@ "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case2.js", "importStyle": "insert_case2", "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.", - "lineNumber": 19, + "lineNumber": 20, "params": [ { "nullable": null, @@ -1492,13 +1541,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 91, "kind": "file", "name": "src/insertion/insert_case3.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\nimport insert_case4 from './insert_case4.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case3 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t/**\n\t * If the path from g to n makes a left-right, change it to a left-left\n\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t * parent of n.\n\t *\n\t * B B\n\t * / \\ / \\\n\t * R B R B\n\t * / \\ / \\ --> / \\ / \\\n\t * = >R - - >R = - -\n\t * / \\ / \\\n\t * = = = =\n\t */\n\n\tif (n === n.parent.right && n.parent === g.left) {\n\t\trotate_left(n.parent);\n\n\t\t/**\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\t} else if (n === n.parent.left && n.parent === g.right) {\n\t\t/**\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = >R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_right(n.parent);\n\n\t\t/**\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t}\n\n\tinsert_case4(n);\n};\n\nexport default insert_case3;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport insert_case4 from './insert_case4.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n *\n * Here we fix the input subtree to pass the preconditions of {@link insert_case4}.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst insert_case3 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst p = n.parent;\n\tconst g = p.parent;\n\n\tif (n === p.right && p === g.left) {\n\t\t/**\n\t\t * If the path from g to n makes a left-right, change it to a left-left\n\t\t * with {@link rotate_left}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * R B >R B\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * = >R - - R = - -\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_left(p);\n\n\t\t/**\n\t\t * Rotate_left can be the below because of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.left, *saved_left_n=n.left;\n\t\t * g.left=n;\n\t\t * n.left=saved_p;\n\t\t * saved_p.right=saved_left_n;\n\t\t *\n\t\t * and modify the parent's nodes properly\n\t\t */\n\n\t\t// n = n.left; /!\\ need to fix rotate, so that we can safely reference a node\n\t\treturn insert_case4(p);\n\t}\n\n\tif (n === p.left && p === g.right) {\n\t\t/**\n\t\t * If the path from g to n makes a right-left, change it to a right-right\n\t\t * with {@link rotate_right}. Then call {@link insert_case4} on the old\n\t\t * parent of n.\n\t\t *\n\t\t * B B\n\t\t * / \\ / \\\n\t\t * B R B >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - >R = - - = R\n\t\t * / \\ / \\\n\t\t * = = = =\n\t\t */\n\t\trotate_right(p);\n\n\t\t/**\n\t\t * Rotate_right can be the below to take advantage of already having *g = grandparent(n)\n\t\t *\n\t\t * saved_p=g.right, *saved_right_n=n.right;\n\t\t * g.right=n;\n\t\t * n.right=saved_p;\n\t\t * saved_p.left=saved_right_n;\n\t\t *\n\t\t */\n\n\t\t// n = n.right ;\n\t\treturn insert_case4(p);\n\t}\n\n\treturn insert_case4(n);\n};\n\nexport default insert_case3;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case3.js", "access": "public", @@ -1532,13 +1588,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 93, "kind": "file", "name": "src/insertion/insert_case4.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n */\nconst insert_case4 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t// Repaint n's parent black, n's grandparent red\n\tn.parent._color = BLACK;\n\tg._color = RED;\n\n\tif (n === n.parent.left) {\n\t\t/**\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.left instanceof Node);\n\t\tassert(n === g.left.left);\n\t\tassert(g.right === null || g.right._color === BLACK);\n\t\trotate_right(g);\n\t} else {\n\t\t/**\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.right instanceof Node);\n\t\tassert(n === g.right.right);\n\t\tassert(g.left === null || g.left._color === BLACK);\n\t\trotate_left(g);\n\t}\n};\n\nexport default insert_case4;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport rotate_left from '../rotate/rotate_left.js';\nimport rotate_right from '../rotate/rotate_right.js';\nimport grandparent from '../family/grandparent.js';\n\n/**\n * Preconditions:\n * - n is red.\n * - n's children are BLACK\n * - n is not the root of the tree.\n * - n's parent is red.\n * - n's uncle is black.\n * - the path from n to its grandparent makes a left-left or right-right.\n *\n * @param {Node} n - The input node.\n * @return {Node} The root of the modified subtree.\n */\nconst insert_case4 = (n) => {\n\tassert(n instanceof Node);\n\tassert(n._color === RED);\n\tassert(n.left === null || n.left._color === BLACK);\n\tassert(n.right === null || n.right._color === BLACK);\n\tassert(n.parent !== null);\n\tassert(n.parent._color === RED);\n\tconst g = grandparent(n);\n\n\t// Repaint n's parent black, n's grandparent red\n\tn.parent._color = BLACK;\n\tg._color = RED;\n\n\tif (n === n.parent.left) {\n\t\t/**\n\t\t * If the path from g to n makes a left-left, {@link rotate_right} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B >R R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * >R = - - = = = B\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.left instanceof Node);\n\t\tassert(n === g.left.left);\n\t\tassert(g.right === null || g.right._color === BLACK);\n\t\trotate_right(g);\n\t} else {\n\t\t/**\n\t\t * If the path from g to n makes a right-right, {@link rotate_left} at g.\n\t\t * We are done.\n\t\t *\n\t\t * R B\n\t\t * / \\ / \\\n\t\t * B B R >R\n\t\t * / \\ / \\ --> / \\ / \\\n\t\t * - - = >R B = = =\n\t\t * / \\ / \\\n\t\t * = = - -\n\t\t */\n\t\tassert(g.right instanceof Node);\n\t\tassert(n === g.right.right);\n\t\tassert(g.left === null || g.left._color === BLACK);\n\t\trotate_left(g);\n\t}\n\n\treturn n.parent;\n};\n\nexport default insert_case4;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/insertion/insert_case4.js", "access": "public", @@ -1559,7 +1622,7 @@ "importPath": "@aureooms/js-red-black-tree/src/insertion/insert_case4.js", "importStyle": "insert_case4", "description": "Preconditions:\n - n is red.\n - n's children are BLACK\n - n is not the root of the tree.\n - n's parent is red.\n - n's uncle is black.\n - the path from n to its grandparent makes a left-left or right-right.", - "lineNumber": 20, + "lineNumber": 21, "params": [ { "nullable": null, @@ -1572,13 +1635,20 @@ "description": "The input node." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The root of the modified subtree." + } }, { "__docId__": 95, "kind": "file", "name": "src/rotate/rotate_left.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * A B\n * / \\ / \\\n * a B -> A c\n * / \\ / \\\n * b c a b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nconst rotate_left = (A) => {\n\tassert(A instanceof Node);\n\tconst B = A.right;\n\tassert(B instanceof Node);\n\tconst a = A.left;\n\tconst b = B.left;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tA.left = B;\n\tA.right = c;\n\n\tB.left = a;\n\tB.right = b;\n\n\tif (a !== null) a.parent = B;\n\tif (b !== null) b.parent = B;\n\tif (c !== null) c.parent = A;\n};\n\nexport default rotate_left;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * A B\n * / \\ / \\\n * x B -> A y\n * / \\ / \\\n * b y x b\n *\n *\n * @param {Node} A - The root of the tree.\n *\n */\n\nconst rotate_left = (A) => {\n\tassert(A instanceof Node);\n\tconst B = A.right;\n\tassert(B instanceof Node);\n\n\tconst p = A.parent;\n\tif (p !== null) {\n\t\tif (A === p.left) p.left = B;\n\t\telse p.right = B;\n\t}\n\n\tB.parent = p;\n\tA.parent = B;\n\n\tconst b = B.left;\n\tA.right = b;\n\tB.left = A;\n\n\tif (b !== null) b.parent = A;\n};\n\nexport default rotate_left;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_left.js", "access": "public", @@ -1598,8 +1668,8 @@ "export": true, "importPath": "@aureooms/js-red-black-tree/src/rotate/rotate_left.js", "importStyle": "rotate_left", - "description": "Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n/!\\ This swaps the references to A and B.\n\n A B\n / \\ / \\\n a B -> A c\n / \\ / \\\n b c a b", - "lineNumber": 19, + "description": "Rotate tree left. (see https://en.wikipedia.org/wiki/Tree_rotation)\n\n p p\n | |\n A B\n / \\ / \\\n x B -> A y\n / \\ / \\\n b y x b", + "lineNumber": 20, "params": [ { "nullable": null, @@ -1618,7 +1688,7 @@ "__docId__": 97, "kind": "file", "name": "src/rotate/rotate_right.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n * /!\\ This swaps the references to A and B.\n *\n * B A\n * / \\ / \\\n * A c -> a B\n * / \\ / \\\n * a b b c\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nconst rotate_right = (B) => {\n\tassert(B instanceof Node);\n\tconst A = B.left;\n\tassert(A instanceof Node);\n\tconst a = A.left;\n\tconst b = A.right;\n\tconst c = B.right;\n\n\t[A.key, B.key] = [B.key, A.key];\n\t[A._color, B._color] = [B._color, A._color];\n\n\tB.left = a;\n\tB.right = A;\n\n\tA.left = b;\n\tA.right = c;\n\n\tif (a !== null) a.parent = B;\n\tif (b !== null) b.parent = A;\n\tif (c !== null) c.parent = A;\n};\n\nexport default rotate_right;\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n *\n * p p\n * | |\n * B A\n * / \\ / \\\n * A y -> x B\n * / \\ / \\\n * x b b j\n *\n *\n * @param {Node} B - The root of the tree.\n *\n */\n\nconst rotate_right = (B) => {\n\tassert(B instanceof Node);\n\tconst A = B.left;\n\tassert(A instanceof Node);\n\n\tconst p = B.parent;\n\tif (p !== null) {\n\t\tif (B === p.left) p.left = A;\n\t\telse p.right = A;\n\t}\n\n\tA.parent = p;\n\tB.parent = A;\n\n\tconst b = A.right;\n\tB.left = b;\n\tA.right = B;\n\n\tif (b !== null) b.parent = B;\n};\n\nexport default rotate_right;\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/rotate/rotate_right.js", "access": "public", @@ -1638,8 +1708,8 @@ "export": true, "importPath": "@aureooms/js-red-black-tree/src/rotate/rotate_right.js", "importStyle": "rotate_right", - "description": "Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n/!\\ This swaps the references to A and B.\n\n B A\n / \\ / \\\n A c -> a B\n / \\ / \\\n a b b c", - "lineNumber": 19, + "description": "Rotate tree right. (see https://en.wikipedia.org/wiki/Tree_rotation)\n\n p p\n | |\n B A\n / \\ / \\\n A y -> x B\n / \\ / \\\n x b b j", + "lineNumber": 20, "params": [ { "nullable": null, @@ -1730,6 +1800,153 @@ { "__docId__": 101, "kind": "file", + "name": "src/swap/swap_color.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Swap colors of two arbitrary nodes.\n *\n * -A +B -> +A -B\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n */\n\nconst swap_color = (A, B) => {\n\tassert(A instanceof Node);\n\tassert(B instanceof Node);\n\n\tconst color = A._color;\n\tA._color = B._color;\n\tB._color = color;\n};\n\nexport default swap_color;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/swap/swap_color.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 102, + "kind": "function", + "name": "swap_color", + "memberof": "src/swap/swap_color.js", + "generator": false, + "async": false, + "static": true, + "longname": "src/swap/swap_color.js~swap_color", + "access": "public", + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/swap/swap_color.js", + "importStyle": "swap_color", + "description": "Swap colors of two arbitrary nodes.\n\n -A +B -> +A -B", + "lineNumber": 13, + "params": [ + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "A", + "description": "The first node." + }, + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "B", + "description": "The second node." + } + ], + "return": null + }, + { + "__docId__": 103, + "kind": "file", + "name": "src/swap/swap_left.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport replace_node from '../deletion/replace_node.js';\nimport swap_color from './swap_color.js';\n\n/**\n * Swap pointers and colors of a node and its left child B with one constraint:\n * - B's right child is a leaf\n *\n * NOTE: This constraint is implied because B is A's in-subtree predecessor.\n *\n * p p\n * | |\n * -A -B\n * / \\ / \\\n * +B c -> +A c\n * / \\ / \\\n * a - a -\n *\n * @param {Node} A - The node.\n * @return {Node} The node B.\n */\n\nconst swap_left = (A) => {\n\tassert(A instanceof Node);\n\tconst B = A.left;\n\tassert(B instanceof Node);\n\tconst a = B.left;\n\tassert(B.right === null);\n\tconst c = A.right;\n\n\tif (A.parent === null) {\n\t\tB.parent = null;\n\t} else {\n\t\treplace_node(A, B);\n\t}\n\n\tA.parent = B;\n\n\tA.right = null;\n\tB.right = c;\n\tif (c !== null) c.parent = B;\n\n\tA.left = a;\n\tif (a !== null) a.parent = A;\n\tB.left = A;\n\n\tswap_color(A, B);\n\n\treturn B;\n};\n\nexport default swap_left;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/swap/swap_left.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 104, + "kind": "function", + "name": "swap_left", + "memberof": "src/swap/swap_left.js", + "generator": false, + "async": false, + "static": true, + "longname": "src/swap/swap_left.js~swap_left", + "access": "public", + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/swap/swap_left.js", + "importStyle": "swap_left", + "description": "Swap pointers and colors of a node and its left child B with one constraint:\n - B's right child is a leaf\n\nNOTE: This constraint is implied because B is A's in-subtree predecessor.\n\n p p\n | |\n -A -B\n / \\ / \\\n +B c -> +A c\n / \\ / \\\n a - a -", + "lineNumber": 24, + "params": [ + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "A", + "description": "The node." + } + ], + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The node B." + } + }, + { + "__docId__": 105, + "kind": "file", + "name": "src/swap/swap_non_adjacent.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport swap_color from './swap_color.js';\n\n/**\n * Swap pointers and colors of two NON-ADJACENT nodes with three constraints:\n * - B is not the root\n * - B is its parent right child\n * - B's right child is a leaf\n *\n * NOTE: These three constraints are implied because B is A's in-subtree\n * predecessor without being A's left child.\n *\n * p q q p\n * | \\ \\ |\n * -A +B +A -B\n * / \\ / \\ / \\ / \\\n * u v x - -> x - u v\n *\n * @param {Node} A - The first node.\n * @param {Node} B - The second node.\n */\n\nconst swap_non_adjacent = (A, B) => {\n\tassert(A instanceof Node);\n\tassert(B instanceof Node);\n\tconst p = A.parent;\n\tconst u = A.left;\n\tconst v = A.right;\n\tconst q = B.parent;\n\tconst x = B.left;\n\tassert(B.right === null);\n\tassert(q !== null);\n\tassert(B === q.right);\n\n\tif (p !== null) {\n\t\tif (A === p.left) p.left = B;\n\t\telse p.right = B;\n\t}\n\n\tq.right = A;\n\n\tA.parent = q;\n\tA.left = x;\n\tA.right = null;\n\tB.parent = p;\n\tB.left = u;\n\tB.right = v;\n\n\tif (x !== null) x.parent = A;\n\tif (u !== null) u.parent = B;\n\tif (v !== null) v.parent = B;\n\n\tswap_color(A, B);\n};\n\nexport default swap_non_adjacent;\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/swap/swap_non_adjacent.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 106, + "kind": "function", + "name": "swap_non_adjacent", + "memberof": "src/swap/swap_non_adjacent.js", + "generator": false, + "async": false, + "static": true, + "longname": "src/swap/swap_non_adjacent.js~swap_non_adjacent", + "access": "public", + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/swap/swap_non_adjacent.js", + "importStyle": "swap_non_adjacent", + "description": "Swap pointers and colors of two NON-ADJACENT nodes with three constraints:\n - B is not the root\n - B is its parent right child\n - B's right child is a leaf\n\nNOTE: These three constraints are implied because B is A's in-subtree\npredecessor without being A's left child.\n\n p q q p\n | \\ \\ |\n -A +B +A -B\n / \\ / \\ / \\ / \\\n u v x - -> x - u v", + "lineNumber": 24, + "params": [ + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "A", + "description": "The first node." + }, + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "B", + "description": "The second node." + } + ], + "return": null + }, + { + "__docId__": 107, + "kind": "file", "name": "src/traversal/inordertraversal.js", "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Traverses the tree rooted at node in order.\n *\n * @param {Node} node - The root of the tree.\n * @returns {IterableIterator}\n */\nexport default function* inordertraversal(node) {\n\tassert(node instanceof Node);\n\tif (node.left !== null) {\n\t\t// Yield the nodes on the left recursively. Those nodes are all smaller\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tassert(node.left instanceof Node);\n\t\tyield* inordertraversal(node.left);\n\t}\n\n\t// Yield the current node.\n\tyield node.key;\n\n\tif (node.right !== null) {\n\t\t// Yield the nodes on the right recursively. Those nodes are all larger\n\t\t// than (or equal to) the current node by the binary search tree\n\t\t// properties.\n\t\tassert(node.right instanceof Node);\n\t\tyield* inordertraversal(node.right);\n\t}\n}\n", "static": true, @@ -1739,7 +1956,7 @@ "lineNumber": 1 }, { - "__docId__": 102, + "__docId__": 108, "kind": "function", "name": "inordertraversal", "memberof": "src/traversal/inordertraversal.js", @@ -1781,10 +1998,83 @@ } }, { - "__docId__": 103, + "__docId__": 109, + "kind": "file", + "name": "src/traversal/leftOpenRangeTraversal.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport inordertraversal from './inordertraversal.js';\n\n/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval (-oo, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n */\nexport default function* leftOpenRangeTraversal(compare, root, right) {\n\tif (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* leftOpenRangeTraversal(compare, root.left, right);\n\t\t}\n\t} else {\n\t\t// Otherwise yield entire left subtree, yield the root, and recurse on\n\t\t// the right subtree.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* inordertraversal(root.left);\n\t\t}\n\n\t\tyield root.key;\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* leftOpenRangeTraversal(compare, root.right, right);\n\t\t}\n\t}\n}\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/leftOpenRangeTraversal.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 110, + "kind": "function", + "name": "leftOpenRangeTraversal", + "memberof": "src/traversal/leftOpenRangeTraversal.js", + "generator": true, + "async": false, + "static": true, + "longname": "src/traversal/leftOpenRangeTraversal.js~leftOpenRangeTraversal", + "access": "public", + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/traversal/leftOpenRangeTraversal.js", + "importStyle": "leftOpenRangeTraversal", + "description": "Yields all the keys in the tree rooted at root that lie in the\ninterval (-oo, right[, in order.", + "lineNumber": 14, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{IterableIterator}" + } + ], + "params": [ + { + "nullable": null, + "types": [ + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function." + }, + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "root", + "description": "The root of the tree." + }, + { + "nullable": null, + "types": [ + "any" + ], + "spread": false, + "optional": false, + "name": "right", + "description": "The non-inclusive upper bound of the interval." + } + ], + "return": { + "nullable": null, + "types": [ + "IterableIterator" + ], + "spread": false, + "description": "" + } + }, + { + "__docId__": 111, "kind": "file", "name": "src/traversal/rangetraversal.js", - "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\n\n/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n */\nexport default function* rangetraversal(compare, root, left, right) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t} else if (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\t} else {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\n\t\tyield root.key;\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t}\n}\n", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport leftOpenRangeTraversal from './leftOpenRangeTraversal.js';\nimport rightOpenRangeTraversal from './rightOpenRangeTraversal.js';\n\n/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, right[, in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @param {any} right - The non-inclusive upper bound of the interval.\n * @returns {IterableIterator}\n */\nexport default function* rangetraversal(compare, root, left, right) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.right, left, right);\n\t\t}\n\t} else if (compare(root.key, right) >= 0) {\n\t\t// If the root lies to the right of the interval, we can discard the\n\t\t// entire right subtree.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rangetraversal(compare, root.left, left, right);\n\t\t}\n\t} else {\n\t\t// Otherwise just recurse on both subtrees and yield the root in\n\t\t// between.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rightOpenRangeTraversal(compare, root.left, left);\n\t\t}\n\n\t\tyield root.key;\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* leftOpenRangeTraversal(compare, root.right, right);\n\t\t}\n\t}\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/rangetraversal.js", "access": "public", @@ -1792,7 +2082,7 @@ "lineNumber": 1 }, { - "__docId__": 104, + "__docId__": 112, "kind": "function", "name": "rangetraversal", "memberof": "src/traversal/rangetraversal.js", @@ -1805,7 +2095,7 @@ "importPath": "@aureooms/js-red-black-tree/src/traversal/rangetraversal.js", "importStyle": "rangetraversal", "description": "Yields all the keys in the tree rooted at root that lie in the\ninterval [left, right[, in order.", - "lineNumber": 14, + "lineNumber": 16, "unknown": [ { "tagName": "@returns", @@ -1864,7 +2154,80 @@ } }, { - "__docId__": 105, + "__docId__": 113, + "kind": "file", + "name": "src/traversal/rightOpenRangeTraversal.js", + "content": "import assert from 'assert';\nimport Node from '../types/Node.js';\nimport inordertraversal from './inordertraversal.js';\n\n/**\n * Yields all the keys in the tree rooted at root that lie in the\n * interval [left, +oo), in order.\n *\n * @param {Function} compare - The comparison function.\n * @param {Node} root - The root of the tree.\n * @param {any} left - The inclusive lower bound of the interval.\n * @returns {IterableIterator}\n */\nexport default function* rightOpenRangeTraversal(compare, root, left) {\n\tif (compare(root.key, left) < 0) {\n\t\t// If the root lies to the left of the interval, we can discard the\n\t\t// entire left subtree.\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* rightOpenRangeTraversal(compare, root.right, left);\n\t\t}\n\t} else {\n\t\t// Otherwise recurse on left subtree, yield the root, and yield the\n\t\t// entire right subtree.\n\t\tif (root.left !== null) {\n\t\t\tassert(root.left instanceof Node);\n\t\t\tyield* rightOpenRangeTraversal(compare, root.left, left);\n\t\t}\n\n\t\tyield root.key;\n\t\tif (root.right !== null) {\n\t\t\tassert(root.right instanceof Node);\n\t\t\tyield* inordertraversal(root.right);\n\t\t}\n\t}\n}\n", + "static": true, + "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/traversal/rightOpenRangeTraversal.js", + "access": "public", + "description": null, + "lineNumber": 1 + }, + { + "__docId__": 114, + "kind": "function", + "name": "rightOpenRangeTraversal", + "memberof": "src/traversal/rightOpenRangeTraversal.js", + "generator": true, + "async": false, + "static": true, + "longname": "src/traversal/rightOpenRangeTraversal.js~rightOpenRangeTraversal", + "access": "public", + "export": true, + "importPath": "@aureooms/js-red-black-tree/src/traversal/rightOpenRangeTraversal.js", + "importStyle": "rightOpenRangeTraversal", + "description": "Yields all the keys in the tree rooted at root that lie in the\ninterval [left, +oo), in order.", + "lineNumber": 14, + "unknown": [ + { + "tagName": "@returns", + "tagValue": "{IterableIterator}" + } + ], + "params": [ + { + "nullable": null, + "types": [ + "Function" + ], + "spread": false, + "optional": false, + "name": "compare", + "description": "The comparison function." + }, + { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "optional": false, + "name": "root", + "description": "The root of the tree." + }, + { + "nullable": null, + "types": [ + "any" + ], + "spread": false, + "optional": false, + "name": "left", + "description": "The inclusive lower bound of the interval." + } + ], + "return": { + "nullable": null, + "types": [ + "IterableIterator" + ], + "spread": false, + "description": "" + } + }, + { + "__docId__": 115, "kind": "file", "name": "src/types/Node.js", "content": "/**\n * An internal node. This node can be red or black.\n *\n * @class\n * @param {number} color - The color of the node.\n * @param {any} key - The key of the node.\n */\nexport default function Node(color, key) {\n\t/** @member {number} The color of the node. */\n\tthis._color = color;\n\t/** @member {Node} The left child */\n\tthis.left = null;\n\t/** @member {Node} The right child */\n\tthis.right = null;\n\t/** @member {Node} The parent node. */\n\tthis.parent = null;\n\t/** @member {any} The key held by this node. */\n\tthis.key = key;\n}\n", @@ -1875,7 +2238,7 @@ "lineNumber": 1 }, { - "__docId__": 106, + "__docId__": 116, "kind": "function", "name": "Node", "memberof": "src/types/Node.js", @@ -1920,10 +2283,10 @@ "return": null }, { - "__docId__": 107, + "__docId__": 117, "kind": "file", "name": "src/types/RedBlackTree.js", - "content": "import assert from 'assert';\nimport Node from './Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport predecessor from '../family/predecessor.js';\nimport insert from '../insertion/insert.js';\nimport insert_case1 from '../insertion/insert_case1.js';\nimport delete_one_child from '../deletion/delete_one_child.js';\nimport delete_no_child from '../deletion/delete_no_child.js';\nimport search from '../search/search.js';\nimport inordertraversal from '../traversal/inordertraversal.js';\nimport rangetraversal from '../traversal/rangetraversal.js';\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport default class RedBlackTree {\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t */\n\tconstructor(compare) {\n\t\tassert(compare instanceof Function);\n\t\t/** @member {Function} The comparison function for node keys. */\n\t\tthis.compare = compare;\n\t\t/** @member {Node} The root of the tree. */\n\t\tthis.root = null;\n\t}\n\n\t/**\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t */\n\tisEmpty() {\n\t\treturn this.root === null;\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t */\n\tadd(key) {\n\t\tif (this.root === null) {\n\t\t\tthis.root = new Node(BLACK, key);\n\t\t} else {\n\t\t\tconst node = new Node(RED, key);\n\t\t\tinsert(this.compare, this.root, node);\n\t\t\tinsert_case1(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search(key) {\n\t\tif (this.root === null) return null;\n\t\treturn search(this.compare, this.root, key);\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t */\n\tget(key) {\n\t\tconst node = this._search(key);\n\t\treturn node === null ? null : node.key;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t */\n\thas(key) {\n\t\treturn this._search(key) !== null;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\t_delete(node) {\n\t\tassert(node instanceof Node);\n\t\tif (node.left !== null) {\n\t\t\t// Replace node's key with predecessor's key\n\t\t\tconst pred = predecessor(node);\n\t\t\tnode.key = pred.key;\n\t\t\t// Delete predecessor node\n\t\t\t// NOTE: this node can only have one non-leaf (left) child because\n\t\t\t// of red-black tree invariant.\n\t\t\tif (pred.left === null) {\n\t\t\t\tdelete_no_child(pred);\n\t\t\t} else {\n\t\t\t\tdelete_one_child(pred);\n\t\t\t}\n\t\t} else if (node.right !== null) {\n\t\t\t// Replace node's key with successor's key\n\t\t\t// NOTE: Since there is no left child, then there can only be one\n\t\t\t// right child by the red-black tree invariant.\n\t\t\tconst succ = node.right;\n\t\t\tnode.key = succ.key;\n\t\t\t// Delete successor node\n\t\t\tdelete_no_child(succ);\n\t\t} else if (node === this.root) {\n\t\t\tthis.root = null;\n\t\t} else {\n\t\t\tdelete_no_child(node);\n\t\t}\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#_delete}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove(key) {\n\t\tconst node = this._search(key);\n\t\tif (node === null) return false;\n\n\t\tthis._delete(node);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t */\n\t*range(left, right) {\n\t\tif (this.root !== null)\n\t\t\tyield* rangetraversal(this.compare, this.root, left, right);\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t */\n\t*items() {\n\t\tif (this.root !== null) yield* inordertraversal(this.root);\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator]() {\n\t\treturn this.items();\n\t}\n\n\t/**\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic empty(compare) {\n\t\treturn new RedBlackTree(compare);\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from(compare, iterable) {\n\t\tconst tree = new RedBlackTree(compare);\n\n\t\tfor (const element of iterable) tree.add(element);\n\n\t\treturn tree;\n\t}\n}\n", + "content": "import assert from 'assert';\nimport Node from './Node.js';\nimport BLACK from '../color/BLACK.js';\nimport RED from '../color/RED.js';\nimport predecessor from '../family/predecessor.js';\nimport insert from '../insertion/insert.js';\nimport insert_case2 from '../insertion/insert_case2.js';\nimport delete_one_child from '../deletion/delete_one_child.js';\nimport delete_no_child from '../deletion/delete_no_child.js';\nimport search from '../search/search.js';\nimport inordertraversal from '../traversal/inordertraversal.js';\nimport rangetraversal from '../traversal/rangetraversal.js';\nimport replace_node from '../deletion/replace_node.js';\nimport swap_non_adjacent from '../swap/swap_non_adjacent.js';\nimport swap_left from '../swap/swap_left.js';\n\n/**\n * A RedBlackTree with key-only nodes.\n *\n */\nexport default class RedBlackTree {\n\t/**\n\t * Constructs a new empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function for node keys.\n\t */\n\tconstructor(compare) {\n\t\tassert(compare instanceof Function);\n\t\t/** @member {Function} The comparison function for node keys. */\n\t\tthis.compare = compare;\n\t\t/** @member {Node} The root of the tree. */\n\t\tthis.root = null;\n\t}\n\n\t/**\n\t * Tells whether the tree is empty.\n\t *\n\t * @returns {boolean} true if empty, false otherwise.\n\t */\n\tisEmpty() {\n\t\treturn this.root === null;\n\t}\n\n\t/**\n\t * Adds a key to the tree.\n\t *\n\t * @param {any} key - The key to add.\n\t * @return {Node} The newly added node.\n\t */\n\tadd(key) {\n\t\tif (this.root === null) {\n\t\t\tthis.root = new Node(BLACK, key);\n\t\t\treturn this.root;\n\t\t}\n\n\t\tconst node = new Node(RED, key);\n\t\tinsert(this.compare, this.root, node);\n\t\tassert(node.parent !== null);\n\t\tif (node.parent._color !== BLACK) {\n\t\t\tconst subtree = insert_case2(node);\n\t\t\tif (subtree.parent === null) {\n\t\t\t\tthis.root = subtree;\n\t\t\t}\n\t\t}\n\n\t\treturn node;\n\t}\n\n\t/**\n\t * Search for the input key in the tree.\n\t * Returns the first node whose key equals the input key.\n\t * If no such node exists, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {Node}\n\t */\n\t_search(key) {\n\t\tif (this.root === null) return null;\n\t\treturn search(this.compare, this.root, key);\n\t}\n\n\t/**\n\t * Search for the input key in the tree. Returns the first node key found\n\t * in this way (with {@link RedBlackTree#_search}. If no such key exists\n\t * in the tree, returns null.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {any}\n\t */\n\tget(key) {\n\t\tconst node = this._search(key);\n\t\treturn node === null ? undefined : node.key;\n\t}\n\n\t/**\n\t * Returns true if and only if the tree contains the input\n\t * key.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean}\n\t */\n\thas(key) {\n\t\treturn this._search(key) !== null;\n\t}\n\n\t/**\n\t * Deletes the input node from the tree.\n\t *\n\t * @param {Node} node - The input node to delete.\n\t */\n\tunlink(node) {\n\t\tassert(node instanceof Node);\n\t\tif (node.left !== null) {\n\t\t\t// Swap node with its predecessor\n\t\t\tconst pred = predecessor(node);\n\t\t\t// Delete predecessor node\n\t\t\t// NOTE: this node can have at most one non-leaf (left) child\n\t\t\t// because of red-black tree invariant.\n\t\t\tassert(pred.right === null);\n\t\t\tif (pred === node.left) {\n\t\t\t\tswap_left(node);\n\t\t\t} else {\n\t\t\t\tswap_non_adjacent(node, pred);\n\t\t\t}\n\n\t\t\tassert(node.right === null);\n\t\t\tif (node.left === null) {\n\t\t\t\tconst subtree = delete_no_child(node);\n\t\t\t\tif (subtree.parent === null) {\n\t\t\t\t\tthis.root = subtree;\n\t\t\t\t} else if (pred.parent === null) {\n\t\t\t\t\tassert(node === this.root);\n\t\t\t\t\tthis.root = pred;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tdelete_one_child(node);\n\t\t\t\tif (pred.parent === null) {\n\t\t\t\t\tassert(node === this.root);\n\t\t\t\t\tthis.root = pred;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (node.right !== null) {\n\t\t\t/**\n\t\t\t * Swap node with its successor.\n\t\t\t *\n\t\t\t * NOTE: Since pred is a leaf, there can only by one node in the\n\t\t\t * right subtree, succ, which is necessarily red, hence\n\t\t\t * node is black.\n\t\t\t *\n\t\t\t * The configuration:\n\t\t\t *\n\t\t\t * (A) (B) (C)\n\t\t\t *\n\t\t\t * p p p\n\t\t\t * | | |\n\t\t\t * node (BLACK) succ (BLACK) succ (BLACK)\n\t\t\t * / \\ / \\ / \\\n\t\t\t * - succ (RED) -> - node (RED) -> - -\n\t\t\t * / \\ / \\\n\t\t\t * - - - -\n\t\t\t *\n\t\t\t * NOTE: We take a shortcut and go directly from (A) to (C)\n\t\t\t */\n\t\t\tassert(node.left === null);\n\t\t\tconst succ = node.right;\n\t\t\tassert(succ._color === RED);\n\t\t\tsucc._color = BLACK;\n\t\t\tif (node === this.root) {\n\t\t\t\tassert(node.parent === null);\n\t\t\t\tsucc.parent = null;\n\t\t\t\tthis.root = succ;\n\t\t\t} else {\n\t\t\t\treplace_node(node, succ);\n\t\t\t}\n\t\t} else if (node === this.root) {\n\t\t\tassert(node.parent === null);\n\t\t\tassert(node._color === BLACK);\n\t\t\tassert(node.left === null);\n\t\t\tassert(node.right === null);\n\t\t\tthis.root = null;\n\t\t} else {\n\t\t\tassert(node.left === null);\n\t\t\tassert(node.right === null);\n\t\t\tconst subtree = delete_no_child(node);\n\t\t\tif (subtree.parent === null) {\n\t\t\t\tthis.root = subtree;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Search for the first node of the tree whose key equals the input key\n\t * (with {@link RedBlackTree#_search}), then delete that node\n\t * (with {@link RedBlackTree#unlink}). If such a node is found and deleted\n\t * then return true. Return false otherwise.\n\t *\n\t * @param {any} key - The input key.\n\t * @returns {boolean} - Whether the key existed in the tree before removal.\n\t */\n\tremove(key) {\n\t\tconst node = this._search(key);\n\t\tif (node === null) return false;\n\n\t\tthis.unlink(node);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree that lie in the\n\t * interval [left, right[.\n\t * @param {any} left - The left bound of the interval.\n\t * @param {any} right - The right bound of the interval.\n\t * @returns {IterableIterator}\n\t */\n\t*range(left, right) {\n\t\tif (this.root !== null)\n\t\t\tyield* rangetraversal(this.compare, this.root, left, right);\n\t}\n\n\t/**\n\t * Returns an in order iterator over the keys of the tree.\n\t *\n\t * @returns {IterableIterator}\n\t */\n\t*items() {\n\t\tif (this.root !== null) yield* inordertraversal(this.root);\n\t}\n\n\t/**\n\t * Same as {@link RedBlackTree#items}.\n\t */\n\t[Symbol.iterator]() {\n\t\treturn this.items();\n\t}\n\n\t/**\n\t * Constructs an empty red-black tree.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic empty(compare) {\n\t\treturn new RedBlackTree(compare);\n\t}\n\n\t/**\n\t * Constructs a red-black tree from an input iterable.\n\t *\n\t * @param {Function} compare - The comparison function to use.\n\t * @param {Iterable} iterable - The input iterable.\n\t * @returns {RedBlackTree}\n\t */\n\tstatic from(compare, iterable) {\n\t\tconst tree = new RedBlackTree(compare);\n\n\t\tfor (const element of iterable) tree.add(element);\n\n\t\treturn tree;\n\t}\n}\n", "static": true, "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/src/types/RedBlackTree.js", "access": "public", @@ -1931,7 +2294,7 @@ "lineNumber": 1 }, { - "__docId__": 108, + "__docId__": 118, "kind": "class", "name": "RedBlackTree", "memberof": "src/types/RedBlackTree.js", @@ -1942,11 +2305,11 @@ "importPath": "@aureooms/js-red-black-tree/src/types/RedBlackTree.js", "importStyle": "RedBlackTree", "description": "A RedBlackTree with key-only nodes.", - "lineNumber": 18, + "lineNumber": 21, "interface": false }, { - "__docId__": 109, + "__docId__": 119, "kind": "constructor", "name": "constructor", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -1956,7 +2319,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#constructor", "access": "public", "description": "Constructs a new empty red-black tree.", - "lineNumber": 24, + "lineNumber": 27, "params": [ { "nullable": null, @@ -1971,7 +2334,7 @@ ] }, { - "__docId__": 110, + "__docId__": 120, "kind": "member", "name": "compare", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -1979,7 +2342,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#compare", "access": "public", "description": null, - "lineNumber": 27, + "lineNumber": 30, "type": { "types": [ "*" @@ -1987,7 +2350,7 @@ } }, { - "__docId__": 111, + "__docId__": 121, "kind": "member", "name": "root", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -1995,7 +2358,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#root", "access": "public", "description": null, - "lineNumber": 29, + "lineNumber": 32, "type": { "types": [ "*" @@ -2003,7 +2366,7 @@ } }, { - "__docId__": 112, + "__docId__": 122, "kind": "method", "name": "isEmpty", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2013,7 +2376,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#isEmpty", "access": "public", "description": "Tells whether the tree is empty.", - "lineNumber": 37, + "lineNumber": 40, "unknown": [ { "tagName": "@returns", @@ -2031,7 +2394,7 @@ "params": [] }, { - "__docId__": 113, + "__docId__": 123, "kind": "method", "name": "add", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2041,7 +2404,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#add", "access": "public", "description": "Adds a key to the tree.", - "lineNumber": 46, + "lineNumber": 50, "params": [ { "nullable": null, @@ -2054,10 +2417,17 @@ "description": "The key to add." } ], - "return": null + "return": { + "nullable": null, + "types": [ + "Node" + ], + "spread": false, + "description": "The newly added node." + } }, { - "__docId__": 115, + "__docId__": 126, "kind": "method", "name": "_search", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2067,7 +2437,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#_search", "access": "private", "description": "Search for the input key in the tree.\nReturns the first node whose key equals the input key.\nIf no such node exists, returns null.", - "lineNumber": 64, + "lineNumber": 77, "unknown": [ { "tagName": "@returns", @@ -2096,7 +2466,7 @@ } }, { - "__docId__": 116, + "__docId__": 127, "kind": "method", "name": "get", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2106,7 +2476,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#get", "access": "public", "description": "Search for the input key in the tree. Returns the first node key found\nin this way (with {@link RedBlackTree#_search}. If no such key exists\nin the tree, returns null.", - "lineNumber": 77, + "lineNumber": 90, "unknown": [ { "tagName": "@returns", @@ -2135,7 +2505,7 @@ } }, { - "__docId__": 117, + "__docId__": 128, "kind": "method", "name": "has", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2145,7 +2515,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#has", "access": "public", "description": "Returns true if and only if the tree contains the input\nkey.", - "lineNumber": 89, + "lineNumber": 102, "unknown": [ { "tagName": "@returns", @@ -2174,17 +2544,17 @@ } }, { - "__docId__": 118, + "__docId__": 129, "kind": "method", - "name": "_delete", + "name": "unlink", "memberof": "src/types/RedBlackTree.js~RedBlackTree", "generator": false, "async": false, "static": false, - "longname": "src/types/RedBlackTree.js~RedBlackTree#_delete", - "access": "private", + "longname": "src/types/RedBlackTree.js~RedBlackTree#unlink", + "access": "public", "description": "Deletes the input node from the tree.", - "lineNumber": 98, + "lineNumber": 111, "params": [ { "nullable": null, @@ -2200,7 +2570,7 @@ "return": null }, { - "__docId__": 120, + "__docId__": 136, "kind": "method", "name": "remove", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2209,8 +2579,8 @@ "static": false, "longname": "src/types/RedBlackTree.js~RedBlackTree#remove", "access": "public", - "description": "Search for the first node of the tree whose key equals the input key\n(with {@link RedBlackTree#_search}), then delete that node\n(with {@link RedBlackTree#_delete}). If such a node is found and deleted\nthen return true. Return false otherwise.", - "lineNumber": 136, + "description": "Search for the first node of the tree whose key equals the input key\n(with {@link RedBlackTree#_search}), then delete that node\n(with {@link RedBlackTree#unlink}). If such a node is found and deleted\nthen return true. Return false otherwise.", + "lineNumber": 200, "unknown": [ { "tagName": "@returns", @@ -2239,7 +2609,7 @@ } }, { - "__docId__": 121, + "__docId__": 137, "kind": "method", "name": "range", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2249,7 +2619,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#range", "access": "public", "description": "Returns an in order iterator over the keys of the tree that lie in the\ninterval [left, right[.", - "lineNumber": 151, + "lineNumber": 215, "unknown": [ { "tagName": "@returns", @@ -2288,7 +2658,7 @@ } }, { - "__docId__": 122, + "__docId__": 138, "kind": "method", "name": "items", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2298,7 +2668,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#items", "access": "public", "description": "Returns an in order iterator over the keys of the tree.", - "lineNumber": 161, + "lineNumber": 225, "unknown": [ { "tagName": "@returns", @@ -2316,7 +2686,7 @@ "params": [] }, { - "__docId__": 123, + "__docId__": 139, "kind": "method", "name": "[Symbol.iterator]", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2326,7 +2696,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "access": "public", "description": "Same as {@link RedBlackTree#items}.", - "lineNumber": 168, + "lineNumber": 232, "params": [], "return": { "types": [ @@ -2335,7 +2705,7 @@ } }, { - "__docId__": 124, + "__docId__": 140, "kind": "method", "name": "empty", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2345,7 +2715,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree.empty", "access": "public", "description": "Constructs an empty red-black tree.", - "lineNumber": 178, + "lineNumber": 242, "unknown": [ { "tagName": "@returns", @@ -2374,7 +2744,7 @@ } }, { - "__docId__": 125, + "__docId__": 141, "kind": "method", "name": "from", "memberof": "src/types/RedBlackTree.js~RedBlackTree", @@ -2384,7 +2754,7 @@ "longname": "src/types/RedBlackTree.js~RedBlackTree.from", "access": "public", "description": "Constructs a red-black tree from an input iterable.", - "lineNumber": 189, + "lineNumber": 253, "unknown": [ { "tagName": "@returns", @@ -2432,7 +2802,7 @@ }, { "kind": "packageJSON", - "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"8.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"esmodule\": \"dist/index.modern.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.14\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.14\",\n \"@commitlint/cli\": \"12.0.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.7.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"6.0.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ]\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"debug\",\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"test\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ]\n },\n \"cover\": {\n \"sourceMaps\": \"inline\",\n \"presets\": [\n \"babel-preset-power-assert\"\n ]\n },\n \"development\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"production\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"plugins\": [\n \"babel-plugin-unassert\"\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", + "content": "{\n \"name\": \"@aureooms/js-red-black-tree\",\n \"description\": \"Red-black tree library for JavaScript\",\n \"version\": \"9.0.0\",\n \"license\": \"AGPL-3.0\",\n \"author\": \"Aurélien Ooms \",\n \"homepage\": \"https://aureooms.github.io/js-red-black-tree\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/aureooms/js-red-black-tree\"\n },\n \"bugs\": {\n \"url\": \"https://github.com/aureooms/js-red-black-tree/issues\"\n },\n \"keywords\": [\n \"balanced binary search tree\",\n \"bst\",\n \"data structure\",\n \"red-black tree\"\n ],\n \"sideEffects\": false,\n \"source\": \"src/index.js\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.module.js\",\n \"esmodule\": \"dist/index.modern.js\",\n \"umd:main\": \"dist/index.umd.js\",\n \"unpkg\": \"dist/index.umd.js\",\n \"exports\": {\n \".\": {\n \"browser\": \"./dist/index.module.js\",\n \"umd\": \"./dist/index.umd.js\",\n \"require\": \"./dist/index.js\",\n \"default\": \"./dist/index.modern.js\"\n }\n },\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"NODE_ENV=production microbundle\",\n \"build-docs\": \"esdoc\",\n \"build-gh-pages\": \"npm run build-docs\",\n \"ci:test\": \"npm run lint-config && npm run lint && npm run cover\",\n \"commit-msg\": \"commitlint --edit\",\n \"cover\": \"NODE_ENV=cover c8 --all --src src --reporter lcov --reporter text-summary --reporter text npm test\",\n \"debug\": \"NODE_ENV=debug npm run test -- -st --fail-fast\",\n \"dev\": \"npm run lint-config-and-fix && npm run lint-and-fix && npm run cover -- -- -st --fail-fast\",\n \"install-hooks\": \"husky install\",\n \"lint\": \"xo\",\n \"lint-and-fix\": \"npm run lint -- --fix\",\n \"lint-config\": \"fixpack --dryRun\",\n \"lint-config-and-fix\": \"fixpack || fixpack\",\n \"postinstall\": \"npm run install-hooks\",\n \"postpublish\": \"pinst --enable\",\n \"precommit\": \"lint-staged\",\n \"prepare\": \"npm run build\",\n \"prepublishOnly\": \"pinst --disable\",\n \"release\": \"np --message ':hatching_chick: release: Bumping to v%s.'\",\n \"test\": \"ava\"\n },\n \"devDependencies\": {\n \"@aureooms/js-compare\": \"2.0.0\",\n \"@aureooms/js-itertools\": \"5.1.0\",\n \"@aureooms/js-pseudo-random\": \"2.0.0\",\n \"@aureooms/js-random\": \"2.0.0\",\n \"@babel/core\": \"7.13.14\",\n \"@babel/preset-env\": \"7.13.12\",\n \"@babel/register\": \"7.13.14\",\n \"@commitlint/cli\": \"12.1.1\",\n \"@js-library/commitlint-config\": \"0.0.4\",\n \"ava\": \"3.15.0\",\n \"babel-plugin-transform-remove-console\": \"6.9.4\",\n \"babel-plugin-unassert\": \"3.0.1\",\n \"babel-preset-power-assert\": \"3.0.0\",\n \"c8\": \"7.7.0\",\n \"chalk\": \"4.1.0\",\n \"coveralls\": \"3.1.0\",\n \"esdoc\": \"1.1.0\",\n \"esdoc-inject-script-plugin\": \"1.0.0\",\n \"esdoc-inject-style-plugin\": \"1.0.0\",\n \"esdoc-standard-plugin\": \"1.0.0\",\n \"fixpack\": \"4.0.0\",\n \"husky\": \"6.0.0\",\n \"lint-staged\": \"10.5.4\",\n \"microbundle\": \"0.13.0\",\n \"np\": \"7.4.0\",\n \"pinst\": \"2.1.6\",\n \"power-assert\": \"1.6.1\",\n \"regenerator-runtime\": \"0.13.7\",\n \"xo\": \"0.38.2\"\n },\n \"ava\": {\n \"files\": [\n \"test/src/**/*\"\n ],\n \"require\": [\n \"regenerator-runtime/runtime\",\n \"@babel/register\"\n ],\n \"timeout\": \"1m\"\n },\n \"babel\": {\n \"sourceMaps\": true,\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": \"current node\"\n }\n ]\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ],\n \"env\": {\n \"debug\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ],\n \"plugins\": [\n [\n \"transform-remove-console\",\n {\n \"exclude\": [\n \"debug\",\n \"log\",\n \"error\",\n \"warn\"\n ]\n }\n ]\n ]\n },\n \"test\": {\n \"presets\": [\n \"babel-preset-power-assert\"\n ]\n },\n \"cover\": {\n \"sourceMaps\": \"both\",\n \"presets\": [\n \"babel-preset-power-assert\"\n ]\n },\n \"development\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ],\n \"babel-preset-power-assert\"\n ]\n },\n \"production\": {\n \"presets\": [\n [\n \"@babel/preset-env\",\n {\n \"targets\": [\n \"defaults\",\n \"maintained node versions\"\n ]\n }\n ]\n ],\n \"plugins\": [\n \"babel-plugin-unassert\"\n ]\n }\n }\n },\n \"lint-staged\": {\n \"*.js\": [\n \"npm run lint-and-fix\"\n ],\n \"package.json\": [\n \"npm run lint-config-and-fix\"\n ]\n },\n \"prettier\": {\n \"trailingComma\": \"all\"\n },\n \"xo\": {\n \"prettier\": true,\n \"plugins\": [\n \"unicorn\"\n ],\n \"rules\": {\n \"unicorn/filename-case\": \"off\",\n \"camelcase\": \"off\",\n \"unicorn/prevent-abbreviations\": \"off\",\n \"no-constant-condition\": \"off\",\n \"unicorn/prefer-math-trunc\": \"off\",\n \"unicorn/no-new-array\": \"off\",\n \"no-negated-condition\": \"off\"\n },\n \"overrides\": [\n {\n \"files\": [\n \"doc/**\"\n ],\n \"env\": \"browser\"\n }\n ]\n }\n}\n", "longname": "/home/runner/work/js-red-black-tree/js-red-black-tree/package.json", "name": "package.json", "static": true, diff --git a/script/search_index.js b/script/search_index.js index b8b8af5..2afce82 100644 --- a/script/search_index.js +++ b/script/search_index.js @@ -125,6 +125,12 @@ window.esdocSearchIndex = [ "insert_case4 @aureooms/js-red-black-tree/src/insertion/insert_case4.js", "function" ], + [ + "@aureooms/js-red-black-tree/src/traversal/leftopenrangetraversal.js~leftopenrangetraversal", + "function/index.html#static-function-leftOpenRangeTraversal", + "leftOpenRangeTraversal @aureooms/js-red-black-tree/src/traversal/leftOpenRangeTraversal.js", + "function" + ], [ "@aureooms/js-red-black-tree/src/family/predecessor.js~predecessor", "function/index.html#static-function-predecessor", @@ -149,6 +155,12 @@ window.esdocSearchIndex = [ "replace_node @aureooms/js-red-black-tree/src/deletion/replace_node.js", "function" ], + [ + "@aureooms/js-red-black-tree/src/traversal/rightopenrangetraversal.js~rightopenrangetraversal", + "function/index.html#static-function-rightOpenRangeTraversal", + "rightOpenRangeTraversal @aureooms/js-red-black-tree/src/traversal/rightOpenRangeTraversal.js", + "function" + ], [ "@aureooms/js-red-black-tree/src/rotate/rotate_left.js~rotate_left", "function/index.html#static-function-rotate_left", @@ -173,6 +185,24 @@ window.esdocSearchIndex = [ "sibling @aureooms/js-red-black-tree/src/family/sibling.js", "function" ], + [ + "@aureooms/js-red-black-tree/src/swap/swap_color.js~swap_color", + "function/index.html#static-function-swap_color", + "swap_color @aureooms/js-red-black-tree/src/swap/swap_color.js", + "function" + ], + [ + "@aureooms/js-red-black-tree/src/swap/swap_left.js~swap_left", + "function/index.html#static-function-swap_left", + "swap_left @aureooms/js-red-black-tree/src/swap/swap_left.js", + "function" + ], + [ + "@aureooms/js-red-black-tree/src/swap/swap_non_adjacent.js~swap_non_adjacent", + "function/index.html#static-function-swap_non_adjacent", + "swap_non_adjacent @aureooms/js-red-black-tree/src/swap/swap_non_adjacent.js", + "function" + ], [ "@aureooms/js-red-black-tree/src/family/uncle.js~uncle", "function/index.html#static-function-uncle", @@ -623,18 +653,48 @@ window.esdocSearchIndex = [ "src/search/search.js", "file" ], + [ + "src/swap/swap_color.js", + "file/src/swap/swap_color.js.html", + "src/swap/swap_color.js", + "file" + ], + [ + "src/swap/swap_left.js", + "file/src/swap/swap_left.js.html", + "src/swap/swap_left.js", + "file" + ], + [ + "src/swap/swap_non_adjacent.js", + "file/src/swap/swap_non_adjacent.js.html", + "src/swap/swap_non_adjacent.js", + "file" + ], [ "src/traversal/inordertraversal.js", "file/src/traversal/inordertraversal.js.html", "src/traversal/inordertraversal.js", "file" ], + [ + "src/traversal/leftopenrangetraversal.js", + "file/src/traversal/leftOpenRangeTraversal.js.html", + "src/traversal/leftOpenRangeTraversal.js", + "file" + ], [ "src/traversal/rangetraversal.js", "file/src/traversal/rangetraversal.js.html", "src/traversal/rangetraversal.js", "file" ], + [ + "src/traversal/rightopenrangetraversal.js", + "file/src/traversal/rightOpenRangeTraversal.js.html", + "src/traversal/rightOpenRangeTraversal.js", + "file" + ], [ "src/types/node.js", "file/src/types/Node.js.html", @@ -653,12 +713,6 @@ window.esdocSearchIndex = [ "src/types/RedBlackTree.js~RedBlackTree#[Symbol.iterator]", "method" ], - [ - "src/types/redblacktree.js~redblacktree#_delete", - "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-_delete", - "src/types/RedBlackTree.js~RedBlackTree#_delete", - "method" - ], [ "src/types/redblacktree.js~redblacktree#_search", "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-_search", @@ -725,6 +779,12 @@ window.esdocSearchIndex = [ "src/types/RedBlackTree.js~RedBlackTree#root", "member" ], + [ + "src/types/redblacktree.js~redblacktree#unlink", + "class/src/types/RedBlackTree.js~RedBlackTree.html#instance-method-unlink", + "src/types/RedBlackTree.js~RedBlackTree#unlink", + "method" + ], [ "src/types/redblacktree.js~redblacktree.empty", "class/src/types/RedBlackTree.js~RedBlackTree.html#static-method-empty", diff --git a/source.html b/source.html index 20ed42a..ab7d351 100644 --- a/source.html +++ b/source.html @@ -55,15 +55,20 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • -

    Source 45/45

    +

    Source 50/50

    summary
    + public + + + + + +
    +

    + F + + + swap_color(A: Node, B: Node) +

    +
    +
    + + +

    Swap colors of two arbitrary nodes.

    +
    +
    +
    + + +
    + public + + + + + +
    +

    + F + + + swap_left(A: Node): Node +

    +
    +
    + + +

    Swap pointers and colors of a node and its left child B with one constraint:

    +
      +
    • B's right child is a leaf
    • +
    +

    NOTE: This constraint is implied because B is A's in-subtree predecessor.

    +
    +
    +
    + + +
    + public + + + + + +
    +

    + F + + + swap_non_adjacent(A: Node, B: Node) +

    +
    +
    + + +

    Swap pointers and colors of two NON-ADJACENT nodes with three constraints:

    +
      +
    • B is not the root
    • +
    • B is its parent right child
    • +
    • B's right child is a leaf
    • +
    +

    NOTE: These three constraints are implied because B is A's in-subtree +predecessor without being A's left child.

    +
        p       q             q           p
    +    |        \             \          |
    +   -A        +B            +A        -B
    +   / \       / \           / \       / \
    +  u   v     x   -     ->  x   -     u   v
    +
    +
    +
    + +
    +
    +

    + F + + * + leftOpenRangeTraversal(compare: Function, root: Node, right: any): IterableIterator +

    +
    +
    + + +

    Yields all the keys in the tree rooted at root that lie in the +interval (-oo, right[, in order.

    +
    +
    +
    + + +
    + public + + + @@ -1011,6 +1159,36 @@

    traversal

    +
    + public + + + + + +
    +

    + F + + * + rightOpenRangeTraversal(compare: Function, root: Node, left: any): IterableIterator +

    +
    +
    + + +

    Yields all the keys in the tree rooted at root that lie in the +interval [left, +oo), in order.

    +
    +
    +
    + +
    @@ -84,7 +89,7 @@ - + @@ -92,7 +97,7 @@ - + @@ -100,7 +105,7 @@ - + @@ -108,7 +113,7 @@ - + @@ -116,55 +121,55 @@ - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -172,15 +177,15 @@ - + - + - + @@ -188,7 +193,7 @@ - + @@ -196,7 +201,7 @@ - + @@ -204,7 +209,7 @@ - + @@ -212,15 +217,15 @@ - + - - - + + + @@ -228,63 +233,63 @@ - + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - + - + - + - + @@ -292,7 +297,31 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + @@ -300,15 +329,31 @@ - + + + + + + + + + - - - + + + + + + + + + + + @@ -316,15 +361,15 @@ - + - - - + + +
    100 %1/1 176 byte 82021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/api/from.js100 %1/1 171 byte 82021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/color/BLACK.js100 %1/1 70 byte 52021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/color/RED.js100 %1/1 64 byte 52021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/debug/_debug.js100 %1/1 761 byte 322021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/deletion/delete_case0.js delete_case0 100 %1/1629 byte232021-03-04 16:44:23 (UTC)689 byte242021-04-03 08:23:55 (UTC)
    src/deletion/delete_case1.js delete_case1 100 %1/11441 byte522021-03-04 16:44:23 (UTC)1489 byte532021-04-03 08:23:55 (UTC)
    src/deletion/delete_case2.js delete_case2 100 %1/11558 byte542021-03-04 16:44:23 (UTC)1619 byte552021-04-03 08:23:55 (UTC)
    src/deletion/delete_case5.js delete_case5 100 %1/11898 byte642021-03-04 16:44:23 (UTC)2067 byte682021-04-03 08:23:55 (UTC)
    src/deletion/delete_no_child.js delete_no_child 100 %1/11153 byte482021-03-04 16:44:23 (UTC)1061 byte432021-04-03 08:23:55 (UTC)
    src/deletion/delete_one_child.js delete_one_child 100 %1/11126 byte402021-03-04 16:44:23 (UTC)1332 byte502021-04-03 08:23:55 (UTC)
    src/deletion/prune.js100 %1/1 379 byte 172021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/deletion/replace_node.js replace_node 100 %1/1531 byte508 byte 222021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/family/grandparent.js100 %1/1 454 byte 182021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/family/predecessor.js100 %1/1 506 byte 232021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/family/sibling.js100 %1/1 437 byte 182021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/family/uncle.js100 %1/1 454 byte 192021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/index.js - -2013 byte322021-03-04 16:44:23 (UTC)2385 byte372021-04-03 08:23:55 (UTC)
    src/insertion/insert.js100 %1/1 1285 byte 502021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/insertion/insert_case0.js insert_case0 100 %1/1671 byte302021-03-04 16:44:23 (UTC)745 byte352021-04-03 08:23:55 (UTC)
    src/insertion/insert_case1.js insert_case1 100 %1/1798 byte362021-03-04 16:44:23 (UTC)848 byte352021-04-03 08:23:55 (UTC)
    src/insertion/insert_case2.js insert_case2 100 %1/11516 byte522021-03-04 16:44:23 (UTC)1579 byte552021-04-03 08:23:55 (UTC)
    src/insertion/insert_case3.js insert_case3 100 %1/12698 byte922021-03-04 16:44:23 (UTC)2739 byte962021-04-03 08:23:55 (UTC)
    src/insertion/insert_case4.js insert_case4 100 %1/12141 byte702021-03-04 16:44:23 (UTC)2212 byte732021-04-03 08:23:55 (UTC)
    src/rotate/rotate_left.js rotate_left 100 %1/1825 byte757 byte 412021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/rotate/rotate_right.js rotate_right 100 %1/1836 byte768 byte 412021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/search/search.js100 %1/1 594 byte 292021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/swap/swap_color.jsswap_color100 %1/1430 byte222021-04-03 08:23:55 (UTC)
    src/swap/swap_left.jsswap_left100 %1/11115 byte532021-04-03 08:23:55 (UTC)
    src/swap/swap_non_adjacent.jsswap_non_adjacent100 %1/11325 byte572021-04-03 08:23:55 (UTC)
    src/traversal/inordertraversal.js100 %1/1 874 byte 302021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/traversal/leftOpenRangeTraversal.jsleftOpenRangeTraversal100 %1/11177 byte362021-04-03 08:23:55 (UTC)
    src/traversal/rangetraversal.js rangetraversal 100 %1/11459 byte432021-03-04 16:44:23 (UTC)1597 byte452021-04-03 08:23:55 (UTC)
    src/traversal/rightOpenRangeTraversal.jsrightOpenRangeTraversal100 %1/11170 byte362021-04-03 08:23:55 (UTC)
    src/types/Node.js100 %1/1 524 byte 192021-03-04 16:44:23 (UTC)2021-04-03 08:23:55 (UTC)
    src/types/RedBlackTree.js RedBlackTree 100 %16/165065 byte1962021-03-04 16:44:23 (UTC)6843 byte2602021-04-03 08:23:55 (UTC)
    diff --git a/variable/index.html b/variable/index.html index e60dba1..7ae94da 100644 --- a/variable/index.html +++ b/variable/index.html @@ -55,8 +55,13 @@
  • rotateFrotate_left
  • Frotate_right
  • searchFsearch
  • +
  • swapFswap_color
  • +
  • Fswap_left
  • +
  • Fswap_non_adjacent
  • traversalFinordertraversal
  • +
  • FleftOpenRangeTraversal
  • Frangetraversal
  • +
  • FrightOpenRangeTraversal
  • typesCRedBlackTree
  • FNode
  • From cd6e73ac987c06c8fa6e852fd302ae9d26c7db72 Mon Sep 17 00:00:00 2001 From: make-github-pseudonymous-again Date: Thu, 15 Jul 2021 13:31:07 +0000 Subject: [PATCH 25/26] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20bi?= =?UTF-8?q?nary-search-tree/red-black-tree@3eb23c4c55c1889d7468258d2587fbd?= =?UTF-8?q?7ff8c8837=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ast/source/api/from.js.json | 496 ++++-------------- .../types/RedBlackTree.js~RedBlackTree.html | 9 +- coverage.json | 9 +- file/src/api/empty.js.html | 7 +- file/src/api/from.js.html | 10 +- file/src/color/BLACK.js.html | 7 +- file/src/color/RED.js.html | 7 +- file/src/debug/_debug.js.html | 7 +- file/src/deletion/delete_case0.js.html | 7 +- file/src/deletion/delete_case1.js.html | 7 +- file/src/deletion/delete_case2.js.html | 7 +- file/src/deletion/delete_case5.js.html | 7 +- file/src/deletion/delete_no_child.js.html | 7 +- file/src/deletion/delete_one_child.js.html | 7 +- file/src/deletion/prune.js.html | 7 +- file/src/deletion/replace_node.js.html | 7 +- file/src/family/grandparent.js.html | 7 +- file/src/family/predecessor.js.html | 7 +- file/src/family/sibling.js.html | 7 +- file/src/family/uncle.js.html | 7 +- file/src/index.js.html | 7 +- file/src/insertion/insert.js.html | 7 +- file/src/insertion/insert_case0.js.html | 7 +- file/src/insertion/insert_case1.js.html | 7 +- file/src/insertion/insert_case2.js.html | 7 +- file/src/insertion/insert_case3.js.html | 7 +- file/src/insertion/insert_case4.js.html | 7 +- file/src/rotate/rotate_left.js.html | 7 +- file/src/rotate/rotate_right.js.html | 7 +- file/src/search/search.js.html | 7 +- file/src/swap/swap_color.js.html | 7 +- file/src/swap/swap_left.js.html | 7 +- file/src/swap/swap_non_adjacent.js.html | 7 +- file/src/traversal/inordertraversal.js.html | 7 +- .../traversal/leftOpenRangeTraversal.js.html | 7 +- file/src/traversal/rangetraversal.js.html | 7 +- .../traversal/rightOpenRangeTraversal.js.html | 7 +- file/src/types/Node.js.html | 7 +- file/src/types/RedBlackTree.js.html | 7 +- function/index.html | 67 ++- identifiers.html | 36 +- index.html | 47 +- index.json | 349 ++++++------ inject/script/0-header.js | 4 +- manual/example.html | 6 +- manual/index.html | 16 +- manual/installation.html | 10 +- manual/overview.html | 6 +- manual/usage.html | 12 +- script/search_index.js | 142 +++-- source.html | 89 ++-- variable/index.html | 86 +-- 52 files changed, 576 insertions(+), 1063 deletions(-) diff --git a/ast/source/api/from.js.json b/ast/source/api/from.js.json index 0e7da00..d53feb5 100644 --- a/ast/source/api/from.js.json +++ b/ast/source/api/from.js.json @@ -1,28 +1,28 @@ { "type": "File", "start": 0, - "end": 171, + "end": 152, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 9, + "line": 8, "column": 0 } }, "program": { "type": "Program", "start": 0, - "end": 171, + "end": 152, "loc": { "start": { "line": 1, "column": 0 }, "end": { - "line": 9, + "line": 8, "column": 0 } }, @@ -116,9 +116,9 @@ ] }, { - "type": "Identifier", + "type": "ExportDefaultDeclaration", "start": 118, - "end": 149, + "end": 151, "loc": { "start": { "line": 7, @@ -126,250 +126,59 @@ }, "end": { "line": 7, - "column": 31 - } - }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 124, - "end": 148, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 30 - } - }, - "id": { - "type": "Identifier", - "start": 124, - "end": 128, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 10 - }, - "identifierName": "from" - }, - "name": "from", - "leadingComments": null - }, - "init": { - "type": "MemberExpression", - "start": 131, - "end": 148, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 30 - } - }, - "object": { - "type": "Identifier", - "start": 131, - "end": 143, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 25 - }, - "identifierName": "RedBlackTree" - }, - "name": "RedBlackTree" - }, - "property": { - "type": "Identifier", - "start": 144, - "end": 148, - "loc": { - "start": { - "line": 7, - "column": 26 - }, - "end": { - "line": 7, - "column": 30 - }, - "identifierName": "from" - }, - "name": "from" - }, - "computed": false - }, - "leadingComments": null - } - ], - "kind": "const", - "leadingComments": [], - "name": "_", - "trailingComments": [] - }, - { - "type": "Identifier", - "start": 150, - "end": 170, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 20 - } - }, - "declaration": { - "type": "Identifier", - "start": 165, - "end": 169, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 19 - }, - "identifierName": "from" - }, - "name": "from" - }, - "name": "_", - "leadingComments": [], - "trailingComments": [] - }, - { - "type": "ExportDefaultDeclaration", - "start": 150, - "end": 170, - "loc": { - "start": { - "line": 8, - "column": 0 - }, - "end": { - "line": 8, - "column": 20 + "column": 33 } }, "declaration": { - "type": "VariableDeclaration", - "start": 118, - "end": 149, + "type": "MemberExpression", + "start": 133, + "end": 150, "loc": { "start": { "line": 7, - "column": 0 + "column": 15 }, "end": { "line": 7, - "column": 31 + "column": 32 } }, - "declarations": [ - { - "type": "VariableDeclarator", - "start": 124, - "end": 148, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 30 - } + "object": { + "type": "Identifier", + "start": 133, + "end": 145, + "loc": { + "start": { + "line": 7, + "column": 15 }, - "id": { - "type": "Identifier", - "start": 124, - "end": 128, - "loc": { - "start": { - "line": 7, - "column": 6 - }, - "end": { - "line": 7, - "column": 10 - }, - "identifierName": "from" - }, - "name": "from", - "leadingComments": null + "end": { + "line": 7, + "column": 27 }, - "init": { - "type": "MemberExpression", - "start": 131, - "end": 148, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 30 - } - }, - "object": { - "type": "Identifier", - "start": 131, - "end": 143, - "loc": { - "start": { - "line": 7, - "column": 13 - }, - "end": { - "line": 7, - "column": 25 - }, - "identifierName": "RedBlackTree" - }, - "name": "RedBlackTree" - }, - "property": { - "type": "Identifier", - "start": 144, - "end": 148, - "loc": { - "start": { - "line": 7, - "column": 26 - }, - "end": { - "line": 7, - "column": 30 - }, - "identifierName": "from" - }, - "name": "from" - }, - "computed": false + "identifierName": "RedBlackTree" + }, + "name": "RedBlackTree", + "leadingComments": null + }, + "property": { + "type": "Identifier", + "start": 146, + "end": 150, + "loc": { + "start": { + "line": 7, + "column": 28 }, - "leadingComments": null - } - ], - "kind": "const", + "end": { + "line": 7, + "column": 32 + }, + "identifierName": "from" + }, + "name": "from" + }, + "computed": false, "leadingComments": [ { "type": "CommentBlock", @@ -389,7 +198,25 @@ } ], "trailingComments": [] - } + }, + "leadingComments": [ + { + "type": "CommentBlock", + "value": "*\n * Same as {@link RedBlackTree.from}.\n * @function from\n ", + "start": 54, + "end": 117, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 6, + "column": 3 + } + } + } + ] } ], "directives": [] @@ -564,8 +391,8 @@ }, { "type": { - "label": "const", - "keyword": "const", + "label": "export", + "keyword": "export", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -576,70 +403,45 @@ "binop": null, "updateContext": null }, - "value": "const", + "value": "export", "start": 118, - "end": 123, + "end": 124, "loc": { "start": { "line": 7, "column": 0 }, "end": { - "line": 7, - "column": 5 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 124, - "end": 128, - "loc": { - "start": { "line": 7, "column": 6 - }, - "end": { - "line": 7, - "column": 10 } } }, { "type": { - "label": "=", + "label": "default", + "keyword": "default", "beforeExpr": true, "startsExpr": false, "rightAssociative": false, "isLoop": false, - "isAssign": true, + "isAssign": false, "prefix": false, "postfix": false, "binop": null, "updateContext": null }, - "value": "=", - "start": 129, - "end": 130, + "value": "default", + "start": 125, + "end": 132, "loc": { "start": { "line": 7, - "column": 11 + "column": 7 }, "end": { "line": 7, - "column": 12 + "column": 14 } } }, @@ -656,16 +458,16 @@ "binop": null }, "value": "RedBlackTree", - "start": 131, - "end": 143, + "start": 133, + "end": 145, "loc": { "start": { "line": 7, - "column": 13 + "column": 15 }, "end": { "line": 7, - "column": 25 + "column": 27 } } }, @@ -682,16 +484,16 @@ "binop": null, "updateContext": null }, - "start": 143, - "end": 144, + "start": 145, + "end": 146, "loc": { "start": { "line": 7, - "column": 25 + "column": 27 }, "end": { "line": 7, - "column": 26 + "column": 28 } } }, @@ -708,16 +510,16 @@ "binop": null }, "value": "from", - "start": 144, - "end": 148, + "start": 146, + "end": 150, "loc": { "start": { "line": 7, - "column": 26 + "column": 28 }, "end": { "line": 7, - "column": 30 + "column": 32 } } }, @@ -734,23 +536,22 @@ "binop": null, "updateContext": null }, - "start": 148, - "end": 149, + "start": 150, + "end": 151, "loc": { "start": { "line": 7, - "column": 30 + "column": 32 }, "end": { "line": 7, - "column": 31 + "column": 33 } } }, { "type": { - "label": "export", - "keyword": "export", + "label": "eof", "beforeExpr": false, "startsExpr": false, "rightAssociative": false, @@ -761,9 +562,8 @@ "binop": null, "updateContext": null }, - "value": "export", - "start": 150, - "end": 156, + "start": 152, + "end": 152, "loc": { "start": { "line": 8, @@ -771,112 +571,6 @@ }, "end": { "line": 8, - "column": 6 - } - } - }, - { - "type": { - "label": "default", - "keyword": "default", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "value": "default", - "start": 157, - "end": 164, - "loc": { - "start": { - "line": 8, - "column": 7 - }, - "end": { - "line": 8, - "column": 14 - } - } - }, - { - "type": { - "label": "name", - "beforeExpr": false, - "startsExpr": true, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null - }, - "value": "from", - "start": 165, - "end": 169, - "loc": { - "start": { - "line": 8, - "column": 15 - }, - "end": { - "line": 8, - "column": 19 - } - } - }, - { - "type": { - "label": ";", - "beforeExpr": true, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 169, - "end": 170, - "loc": { - "start": { - "line": 8, - "column": 19 - }, - "end": { - "line": 8, - "column": 20 - } - } - }, - { - "type": { - "label": "eof", - "beforeExpr": false, - "startsExpr": false, - "rightAssociative": false, - "isLoop": false, - "isAssign": false, - "prefix": false, - "postfix": false, - "binop": null, - "updateContext": null - }, - "start": 171, - "end": 171, - "loc": { - "start": { - "line": 9, - "column": 0 - }, - "end": { - "line": 9, "column": 0 } } diff --git a/class/src/types/RedBlackTree.js~RedBlackTree.html b/class/src/types/RedBlackTree.js~RedBlackTree.html index 27b5d32..fecd16a 100644 --- a/class/src/types/RedBlackTree.js~RedBlackTree.html +++ b/class/src/types/RedBlackTree.js~RedBlackTree.html @@ -3,12 +3,12 @@ - RedBlackTree | @aureooms/js-red-black-tree + RedBlackTree | @binary-search-tree/red-black-tree - +
    @@ -24,13 +24,12 @@
      - +
      - + public class diff --git a/coverage.json b/coverage.json index a02c010..846e118 100644 --- a/coverage.json +++ b/coverage.json @@ -1,18 +1,13 @@ { "coverage": "100%", - "expectCount": 50, - "actualCount": 50, + "expectCount": 49, + "actualCount": 49, "files": { "src/api/empty.js": { "expectCount": 1, "actualCount": 1, "undocumentLines": [] }, - "src/api/from.js": { - "expectCount": 1, - "actualCount": 1, - "undocumentLines": [] - }, "src/color/BLACK.js": { "expectCount": 1, "actualCount": 1, diff --git a/file/src/api/empty.js.html b/file/src/api/empty.js.html index c6d8c30..add6e69 100644 --- a/file/src/api/empty.js.html +++ b/file/src/api/empty.js.html @@ -3,12 +3,12 @@ - src/api/empty.js | @aureooms/js-red-black-tree + src/api/empty.js | @binary-search-tree/red-black-tree - +
      @@ -24,13 +24,12 @@
        - +
        - +